@thomasfosterau/charts 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +591 -2
- package/dist/core-BVbfW7N6.mjs +936 -0
- package/dist/core-BVbfW7N6.mjs.map +1 -0
- package/dist/core.d.mts +2 -0
- package/dist/core.mjs +1 -0
- package/dist/index-B32E5tbG.d.mts +405 -0
- package/dist/index-M0KOYMo4.d.mts +200 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/prosemirror.d.mts +106 -0
- package/dist/prosemirror.mjs +245 -0
- package/dist/prosemirror.mjs.map +1 -0
- package/dist/spec-FF2Tds2a.mjs +351 -0
- package/dist/spec-FF2Tds2a.mjs.map +1 -0
- package/dist/svelte/Chart.svelte +73 -0
- package/dist/svelte/Chart.svelte.d.ts +37 -0
- package/dist/svelte/ChartAxes.svelte +39 -0
- package/dist/svelte/ChartAxes.svelte.d.ts +11 -0
- package/dist/svelte/ChartMarks.svelte +74 -0
- package/dist/svelte/ChartMarks.svelte.d.ts +9 -0
- package/dist/svelte/index.d.ts +9 -0
- package/dist/svelte/index.js +9 -0
- package/dist/vega.d.mts +97 -0
- package/dist/vega.mjs +82 -0
- package/dist/vega.mjs.map +1 -0
- package/package.json +90 -3
- package/schema/chart-spec.v1.json +393 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/thomasfosterau/components/blob/trunk/packages/charts/schema/chart-spec.v1.json",
|
|
4
|
+
"$ref": "#/$defs/ChartSpec",
|
|
5
|
+
"$defs": {
|
|
6
|
+
"SpecVersion": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"enum": [
|
|
9
|
+
"1",
|
|
10
|
+
"1.1"
|
|
11
|
+
],
|
|
12
|
+
"description": "The portable chart spec version this document conforms to."
|
|
13
|
+
},
|
|
14
|
+
"Mark": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"enum": [
|
|
17
|
+
"bar",
|
|
18
|
+
"line",
|
|
19
|
+
"point",
|
|
20
|
+
"area",
|
|
21
|
+
"tree"
|
|
22
|
+
],
|
|
23
|
+
"description": "The mark (geometric primitive) used to render the chart. The native-charting intersection, plus \"tree\" (spec 1.1): a hierarchy laid out by the interpreter."
|
|
24
|
+
},
|
|
25
|
+
"FieldType": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": [
|
|
28
|
+
"quantitative",
|
|
29
|
+
"ordinal",
|
|
30
|
+
"nominal",
|
|
31
|
+
"temporal"
|
|
32
|
+
],
|
|
33
|
+
"description": "The declared type of an encoded field. Interpreters reconstruct typed values from this declaration, never by sniffing JSON values."
|
|
34
|
+
},
|
|
35
|
+
"Channel": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"properties": {
|
|
38
|
+
"field": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "The name of the field in each datum that this channel reads."
|
|
41
|
+
},
|
|
42
|
+
"type": {
|
|
43
|
+
"$ref": "#/$defs/FieldType"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": [
|
|
47
|
+
"field",
|
|
48
|
+
"type"
|
|
49
|
+
],
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"description": "A field-to-channel mapping with an explicit declared type."
|
|
52
|
+
},
|
|
53
|
+
"Channel_1": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"field": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "The name of the field in each datum that this channel reads."
|
|
59
|
+
},
|
|
60
|
+
"type": {
|
|
61
|
+
"$ref": "#/$defs/FieldType"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"required": [
|
|
65
|
+
"field",
|
|
66
|
+
"type"
|
|
67
|
+
],
|
|
68
|
+
"additionalProperties": false,
|
|
69
|
+
"description": "Spec 1.1: the end of a range on x. With mark \"bar\", each bar spans x to x2. Same type as x, quantitative or temporal."
|
|
70
|
+
},
|
|
71
|
+
"Channel_2": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"properties": {
|
|
74
|
+
"field": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "The name of the field in each datum that this channel reads."
|
|
77
|
+
},
|
|
78
|
+
"type": {
|
|
79
|
+
"$ref": "#/$defs/FieldType"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"required": [
|
|
83
|
+
"field",
|
|
84
|
+
"type"
|
|
85
|
+
],
|
|
86
|
+
"additionalProperties": false,
|
|
87
|
+
"description": "Spec 1.1: the end of a range on y. With mark \"bar\", each bar spans y to y2. Same type as y, quantitative or temporal."
|
|
88
|
+
},
|
|
89
|
+
"Channel_3": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"properties": {
|
|
92
|
+
"field": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"description": "The name of the field in each datum that this channel reads."
|
|
95
|
+
},
|
|
96
|
+
"type": {
|
|
97
|
+
"$ref": "#/$defs/FieldType"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"required": [
|
|
101
|
+
"field",
|
|
102
|
+
"type"
|
|
103
|
+
],
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"description": "Spec 1.1, mark \"tree\": the field naming each row; ids are unique."
|
|
106
|
+
},
|
|
107
|
+
"Channel_4": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"properties": {
|
|
110
|
+
"field": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"description": "The name of the field in each datum that this channel reads."
|
|
113
|
+
},
|
|
114
|
+
"type": {
|
|
115
|
+
"$ref": "#/$defs/FieldType"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"required": [
|
|
119
|
+
"field",
|
|
120
|
+
"type"
|
|
121
|
+
],
|
|
122
|
+
"additionalProperties": false,
|
|
123
|
+
"description": "Spec 1.1, mark \"tree\": the field holding the parent row's id; null (or absent) for a root."
|
|
124
|
+
},
|
|
125
|
+
"Channel_5": {
|
|
126
|
+
"type": "object",
|
|
127
|
+
"properties": {
|
|
128
|
+
"field": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"description": "The name of the field in each datum that this channel reads."
|
|
131
|
+
},
|
|
132
|
+
"type": {
|
|
133
|
+
"$ref": "#/$defs/FieldType"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"required": [
|
|
137
|
+
"field",
|
|
138
|
+
"type"
|
|
139
|
+
],
|
|
140
|
+
"additionalProperties": false,
|
|
141
|
+
"description": "Spec 1.1, mark \"tree\": the text of each node; defaults to its id."
|
|
142
|
+
},
|
|
143
|
+
"Encoding": {
|
|
144
|
+
"type": "object",
|
|
145
|
+
"properties": {
|
|
146
|
+
"x": {
|
|
147
|
+
"$ref": "#/$defs/Channel"
|
|
148
|
+
},
|
|
149
|
+
"y": {
|
|
150
|
+
"$ref": "#/$defs/Channel"
|
|
151
|
+
},
|
|
152
|
+
"x2": {
|
|
153
|
+
"$ref": "#/$defs/Channel_1"
|
|
154
|
+
},
|
|
155
|
+
"y2": {
|
|
156
|
+
"$ref": "#/$defs/Channel_2"
|
|
157
|
+
},
|
|
158
|
+
"id": {
|
|
159
|
+
"$ref": "#/$defs/Channel_3"
|
|
160
|
+
},
|
|
161
|
+
"parent": {
|
|
162
|
+
"$ref": "#/$defs/Channel_4"
|
|
163
|
+
},
|
|
164
|
+
"label": {
|
|
165
|
+
"$ref": "#/$defs/Channel_5"
|
|
166
|
+
},
|
|
167
|
+
"color": {
|
|
168
|
+
"$ref": "#/$defs/Channel"
|
|
169
|
+
},
|
|
170
|
+
"size": {
|
|
171
|
+
"$ref": "#/$defs/Channel"
|
|
172
|
+
},
|
|
173
|
+
"opacity": {
|
|
174
|
+
"$ref": "#/$defs/Channel"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"additionalProperties": false,
|
|
178
|
+
"description": "Field-to-channel mappings describing how data maps to visual channels."
|
|
179
|
+
},
|
|
180
|
+
"DatumValue": {
|
|
181
|
+
"anyOf": [
|
|
182
|
+
{
|
|
183
|
+
"type": "string"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"type": "number"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"type": "boolean"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"type": "null"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"description": "A single value inside a data row: a flat JSON primitive."
|
|
196
|
+
},
|
|
197
|
+
"Datum": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"additionalProperties": {
|
|
200
|
+
"$ref": "#/$defs/DatumValue"
|
|
201
|
+
},
|
|
202
|
+
"description": "A single data row: a flat record of JSON primitives."
|
|
203
|
+
},
|
|
204
|
+
"InlineData": {
|
|
205
|
+
"type": "object",
|
|
206
|
+
"properties": {
|
|
207
|
+
"values": {
|
|
208
|
+
"type": "array",
|
|
209
|
+
"items": {
|
|
210
|
+
"$ref": "#/$defs/Datum"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"required": [
|
|
215
|
+
"values"
|
|
216
|
+
],
|
|
217
|
+
"additionalProperties": false,
|
|
218
|
+
"description": "Inline data: small datasets embedded directly in the spec."
|
|
219
|
+
},
|
|
220
|
+
"DataRefKind": {
|
|
221
|
+
"type": "string",
|
|
222
|
+
"enum": [
|
|
223
|
+
"query",
|
|
224
|
+
"node",
|
|
225
|
+
"url"
|
|
226
|
+
],
|
|
227
|
+
"description": "The kind of external data reference: a live query, another content node, or a URL."
|
|
228
|
+
},
|
|
229
|
+
"DataRef": {
|
|
230
|
+
"type": "object",
|
|
231
|
+
"properties": {
|
|
232
|
+
"ref": {
|
|
233
|
+
"type": "object",
|
|
234
|
+
"properties": {
|
|
235
|
+
"kind": {
|
|
236
|
+
"$ref": "#/$defs/DataRefKind"
|
|
237
|
+
},
|
|
238
|
+
"id": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"description": "Identifier of the referenced dataset (query id, node id, or URL)."
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"required": [
|
|
244
|
+
"kind",
|
|
245
|
+
"id"
|
|
246
|
+
],
|
|
247
|
+
"additionalProperties": false
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"required": [
|
|
251
|
+
"ref"
|
|
252
|
+
],
|
|
253
|
+
"additionalProperties": false,
|
|
254
|
+
"description": "A reference to an externally stored dataset, resolved by the host."
|
|
255
|
+
},
|
|
256
|
+
"Data": {
|
|
257
|
+
"oneOf": [
|
|
258
|
+
{
|
|
259
|
+
"$ref": "#/$defs/InlineData"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"$ref": "#/$defs/DataRef"
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"description": "The chart data: exactly one of inline values or an external reference."
|
|
266
|
+
},
|
|
267
|
+
"DomainValue": {
|
|
268
|
+
"anyOf": [
|
|
269
|
+
{
|
|
270
|
+
"type": "number"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"type": "string"
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"description": "A domain entry: a number for quantitative, an ISO 8601 string for temporal, or a category value for ordinal/nominal."
|
|
277
|
+
},
|
|
278
|
+
"ScaleHint": {
|
|
279
|
+
"type": "object",
|
|
280
|
+
"properties": {
|
|
281
|
+
"domain": {
|
|
282
|
+
"type": "array",
|
|
283
|
+
"items": {
|
|
284
|
+
"$ref": "#/$defs/DomainValue"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"nice": {
|
|
288
|
+
"type": "boolean",
|
|
289
|
+
"description": "Round the domain to human-friendly values."
|
|
290
|
+
},
|
|
291
|
+
"zero": {
|
|
292
|
+
"type": "boolean",
|
|
293
|
+
"description": "Force the domain to include zero."
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"additionalProperties": false,
|
|
297
|
+
"description": "Optional scale hints. Interpreters may infer or override these."
|
|
298
|
+
},
|
|
299
|
+
"Scales": {
|
|
300
|
+
"type": "object",
|
|
301
|
+
"properties": {
|
|
302
|
+
"x": {
|
|
303
|
+
"$ref": "#/$defs/ScaleHint"
|
|
304
|
+
},
|
|
305
|
+
"y": {
|
|
306
|
+
"$ref": "#/$defs/ScaleHint"
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"additionalProperties": false,
|
|
310
|
+
"description": "Per-channel scale hints."
|
|
311
|
+
},
|
|
312
|
+
"Config": {
|
|
313
|
+
"type": "object",
|
|
314
|
+
"properties": {
|
|
315
|
+
"title": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"description": "The chart title."
|
|
318
|
+
},
|
|
319
|
+
"tooltip": {
|
|
320
|
+
"type": "boolean",
|
|
321
|
+
"description": "Whether tooltips are enabled. A trivial declarative hint — real interaction is per-platform application code, not document data."
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"additionalProperties": false,
|
|
325
|
+
"description": "Portable presentation hints."
|
|
326
|
+
},
|
|
327
|
+
"Extensions": {
|
|
328
|
+
"type": "object",
|
|
329
|
+
"description": "Web-only, non-portable hints. Native interpreters ignore this entirely."
|
|
330
|
+
},
|
|
331
|
+
"TreeOptions": {
|
|
332
|
+
"type": "object",
|
|
333
|
+
"properties": {
|
|
334
|
+
"orientation": {
|
|
335
|
+
"type": "string",
|
|
336
|
+
"enum": [
|
|
337
|
+
"vertical",
|
|
338
|
+
"horizontal"
|
|
339
|
+
],
|
|
340
|
+
"description": "Vertical: roots at the top. Horizontal: roots at the start edge."
|
|
341
|
+
},
|
|
342
|
+
"linkStyle": {
|
|
343
|
+
"type": "string",
|
|
344
|
+
"enum": [
|
|
345
|
+
"orthogonal",
|
|
346
|
+
"curved"
|
|
347
|
+
],
|
|
348
|
+
"description": "How a parent joins its children."
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"additionalProperties": false,
|
|
352
|
+
"description": "Spec 1.1: layout options of the \"tree\" mark. Only valid with mark \"tree\"."
|
|
353
|
+
},
|
|
354
|
+
"ChartSpec": {
|
|
355
|
+
"type": "object",
|
|
356
|
+
"properties": {
|
|
357
|
+
"specVersion": {
|
|
358
|
+
"$ref": "#/$defs/SpecVersion"
|
|
359
|
+
},
|
|
360
|
+
"mark": {
|
|
361
|
+
"$ref": "#/$defs/Mark"
|
|
362
|
+
},
|
|
363
|
+
"encoding": {
|
|
364
|
+
"$ref": "#/$defs/Encoding"
|
|
365
|
+
},
|
|
366
|
+
"data": {
|
|
367
|
+
"$ref": "#/$defs/Data"
|
|
368
|
+
},
|
|
369
|
+
"scales": {
|
|
370
|
+
"$ref": "#/$defs/Scales"
|
|
371
|
+
},
|
|
372
|
+
"config": {
|
|
373
|
+
"$ref": "#/$defs/Config"
|
|
374
|
+
},
|
|
375
|
+
"extensions": {
|
|
376
|
+
"$ref": "#/$defs/Extensions"
|
|
377
|
+
},
|
|
378
|
+
"tree": {
|
|
379
|
+
"$ref": "#/$defs/TreeOptions"
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"required": [
|
|
383
|
+
"specVersion",
|
|
384
|
+
"mark",
|
|
385
|
+
"encoding",
|
|
386
|
+
"data"
|
|
387
|
+
],
|
|
388
|
+
"additionalProperties": false,
|
|
389
|
+
"title": "Portable Chart Specification",
|
|
390
|
+
"description": "A renderer-agnostic, framework-agnostic, language-neutral chart description. Grammar-of-graphics level: mark + encodings + declared data types + data reference."
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|