Add Chart Builder: no-JSON Vega-Lite composer from a dataset (M4)

This commit is contained in:
2026-06-05 23:46:21 +03:00
parent 693f5d7073
commit c11afc273d
16 changed files with 1856 additions and 26 deletions
+5 -1
View File
@@ -124,7 +124,11 @@ export const useSnippetStore = create<SnippetState>((set, get) => ({
createSnippet: (options) => {
get().commitDraft(); // flush the outgoing snippet's valid edits before switching away
const snippet = createSnippet(options);
const created = createSnippet(options);
// Mirror datasetRefs from the spec at creation, like publish does, so a snippet
// built with a named-data reference (Chart Builder, §06) is linked to its dataset
// immediately. Inline-data specs (the sample template) resolve to no refs.
const snippet = { ...created, datasetRefs: recomputeDatasetRefs(created.spec) };
set((s) => ({
snippets: [snippet, ...s.snippets],
activeSnippetId: snippet.id,