mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Add Chart Builder: no-JSON Vega-Lite composer from a dataset (M4)
This commit is contained in:
+11
-2
@@ -14,6 +14,13 @@
|
||||
/** Current schema version for a Snippet record (read-time migration target). */
|
||||
export const CURRENT_SNIPPET_VERSION = 1;
|
||||
|
||||
/**
|
||||
* The Vega-Lite schema URL stamped into generated specs (`$schema`). Shared so the
|
||||
* sample template and the Chart Builder agree on one version; the Monaco schema
|
||||
* service pins the same URI independently (infrastructure/monaco-schema.ts).
|
||||
*/
|
||||
export const VEGA_LITE_SCHEMA_URL = 'https://vega.github.io/schema/vega-lite/v6.json';
|
||||
|
||||
export interface Snippet {
|
||||
/** Unique, stable identifier. */
|
||||
id: string;
|
||||
@@ -45,7 +52,7 @@ export interface Snippet {
|
||||
* Inline data only — datasets arrive in M3.
|
||||
*/
|
||||
export const SAMPLE_SPEC = {
|
||||
$schema: 'https://vega.github.io/schema/vega-lite/v6.json',
|
||||
$schema: VEGA_LITE_SCHEMA_URL,
|
||||
description: 'A simple bar chart.',
|
||||
data: {
|
||||
values: [
|
||||
@@ -92,6 +99,8 @@ export interface CreateSnippetOptions {
|
||||
now?: Date;
|
||||
/** Id injection for deterministic tests; defaults to a random UUID. */
|
||||
id?: string;
|
||||
/** Seed the extensible metadata bag (e.g. Chart Builder provenance). */
|
||||
meta?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +122,7 @@ export function createSnippet(options: CreateSnippetOptions = {}): Snippet {
|
||||
comment: '',
|
||||
tags: [],
|
||||
datasetRefs: [],
|
||||
meta: {},
|
||||
meta: options.meta ?? {},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user