@baron1996/kline-scene-schema 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.
Files changed (48) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +22 -0
  3. package/README.md +18 -0
  4. package/dist/canonical-json.d.ts +3 -0
  5. package/dist/canonical-json.d.ts.map +1 -0
  6. package/dist/canonical-json.js +15 -0
  7. package/dist/canonicalize.d.ts +3 -0
  8. package/dist/canonicalize.d.ts.map +1 -0
  9. package/dist/canonicalize.js +19 -0
  10. package/dist/errors.d.ts +13 -0
  11. package/dist/errors.d.ts.map +1 -0
  12. package/dist/errors.js +12 -0
  13. package/dist/generated/chart-scene.d.ts +219 -0
  14. package/dist/generated/chart-scene.d.ts.map +1 -0
  15. package/dist/generated/chart-scene.js +2 -0
  16. package/dist/generated/schemas.d.ts +777 -0
  17. package/dist/generated/schemas.d.ts.map +1 -0
  18. package/dist/generated/schemas.js +1043 -0
  19. package/dist/generated/validate-chart-scene.d.ts +15 -0
  20. package/dist/generated/validate-chart-scene.d.ts.map +1 -0
  21. package/dist/generated/validate-chart-scene.js +5916 -0
  22. package/dist/index.d.ts +11 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +10 -0
  25. package/dist/semantic-validator.d.ts +5 -0
  26. package/dist/semantic-validator.d.ts.map +1 -0
  27. package/dist/semantic-validator.js +264 -0
  28. package/dist/validator.d.ts +4 -0
  29. package/dist/validator.d.ts.map +1 -0
  30. package/dist/validator.js +49 -0
  31. package/dist/version.d.ts +5 -0
  32. package/dist/version.d.ts.map +1 -0
  33. package/dist/version.js +4 -0
  34. package/licenses/KLineCharts-LICENSE +201 -0
  35. package/licenses/KLineCharts-NOTICE +5 -0
  36. package/licenses/Noto-Sans-SC-OFL-1.1 +93 -0
  37. package/licenses/Tabler-Icons-LICENSE +21 -0
  38. package/licenses/TradingView-Lightweight-Charts-LICENSE +201 -0
  39. package/licenses/fflate-LICENSE +21 -0
  40. package/package.json +53 -0
  41. package/schema/chart-config.schema.json +177 -0
  42. package/schema/chart-scene.schema.json +198 -0
  43. package/schema/common.schema.json +156 -0
  44. package/schema/indicator.schema.json +146 -0
  45. package/schema/market-data.schema.json +37 -0
  46. package/schema/overlay.schema.json +188 -0
  47. package/schema/pane.schema.json +117 -0
  48. package/schema/runtime.schema.json +23 -0
@@ -0,0 +1,1043 @@
1
+ /* Generated by scripts/generate.mjs. Do not edit. */
2
+ export const CommonSchema = {
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "$id": "https://baron.dev/kline-scene/common.schema.json",
5
+ "title": "ChartScene Common Types",
6
+ "$defs": {
7
+ "stableId": {
8
+ "type": "string",
9
+ "minLength": 1,
10
+ "maxLength": 128,
11
+ "pattern": "^[A-Za-z][A-Za-z0-9._:-]*$"
12
+ },
13
+ "finiteNumber": {
14
+ "type": "number",
15
+ "minimum": -1.7976931348623157e+308,
16
+ "maximum": 1.7976931348623157e+308
17
+ },
18
+ "safeInteger": {
19
+ "type": "integer",
20
+ "minimum": -9007199254740991,
21
+ "maximum": 9007199254740991
22
+ },
23
+ "nonNegativeNumber": {
24
+ "type": "number",
25
+ "minimum": 0,
26
+ "maximum": 1.7976931348623157e+308
27
+ },
28
+ "rgbaColor": {
29
+ "type": "string",
30
+ "pattern": "^rgba\\(\\s*[0-9]{1,3}\\s*,\\s*[0-9]{1,3}\\s*,\\s*[0-9]{1,3}\\s*,\\s*(?:0(?:\\.[0-9]+)?|1(?:\\.0+)?)\\s*\\)$"
31
+ },
32
+ "lineStyle": {
33
+ "type": "object",
34
+ "additionalProperties": false,
35
+ "required": [
36
+ "color",
37
+ "size",
38
+ "style"
39
+ ],
40
+ "properties": {
41
+ "color": {
42
+ "$ref": "#/$defs/rgbaColor"
43
+ },
44
+ "size": {
45
+ "type": "number",
46
+ "exclusiveMinimum": 0,
47
+ "maximum": 20
48
+ },
49
+ "style": {
50
+ "enum": [
51
+ "solid",
52
+ "dashed",
53
+ "dotted"
54
+ ]
55
+ }
56
+ }
57
+ },
58
+ "fillStyle": {
59
+ "type": "object",
60
+ "additionalProperties": false,
61
+ "required": [
62
+ "color"
63
+ ],
64
+ "properties": {
65
+ "color": {
66
+ "$ref": "#/$defs/rgbaColor"
67
+ }
68
+ }
69
+ },
70
+ "textStyle": {
71
+ "type": "object",
72
+ "additionalProperties": false,
73
+ "required": [
74
+ "color",
75
+ "size",
76
+ "family",
77
+ "weight",
78
+ "backgroundColor",
79
+ "borderColor"
80
+ ],
81
+ "properties": {
82
+ "color": {
83
+ "$ref": "#/$defs/rgbaColor"
84
+ },
85
+ "size": {
86
+ "type": "number",
87
+ "minimum": 8,
88
+ "maximum": 72
89
+ },
90
+ "family": {
91
+ "type": "string",
92
+ "minLength": 1,
93
+ "maxLength": 128
94
+ },
95
+ "weight": {
96
+ "oneOf": [
97
+ {
98
+ "type": "integer",
99
+ "minimum": 100,
100
+ "maximum": 900,
101
+ "multipleOf": 100
102
+ },
103
+ {
104
+ "enum": [
105
+ "normal",
106
+ "bold"
107
+ ]
108
+ }
109
+ ]
110
+ },
111
+ "backgroundColor": {
112
+ "$ref": "#/$defs/rgbaColor"
113
+ },
114
+ "borderColor": {
115
+ "$ref": "#/$defs/rgbaColor"
116
+ }
117
+ }
118
+ },
119
+ "jsonValue": {
120
+ "oneOf": [
121
+ {
122
+ "type": "null"
123
+ },
124
+ {
125
+ "type": "boolean"
126
+ },
127
+ {
128
+ "$ref": "#/$defs/finiteNumber"
129
+ },
130
+ {
131
+ "type": "string"
132
+ },
133
+ {
134
+ "type": "array",
135
+ "maxItems": 1000,
136
+ "items": {
137
+ "$ref": "#/$defs/jsonValue"
138
+ }
139
+ },
140
+ {
141
+ "type": "object",
142
+ "maxProperties": 1000,
143
+ "additionalProperties": {
144
+ "$ref": "#/$defs/jsonValue"
145
+ }
146
+ }
147
+ ]
148
+ },
149
+ "metadata": {
150
+ "type": "object",
151
+ "maxProperties": 1000,
152
+ "additionalProperties": {
153
+ "$ref": "#/$defs/jsonValue"
154
+ }
155
+ }
156
+ }
157
+ };
158
+ export const RuntimeSchema = {
159
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
160
+ "$id": "https://baron.dev/kline-scene/runtime.schema.json",
161
+ "title": "RuntimeIdentity",
162
+ "type": "object",
163
+ "additionalProperties": false,
164
+ "required": [
165
+ "engine",
166
+ "engineVersion",
167
+ "runtimeVersion"
168
+ ],
169
+ "properties": {
170
+ "engine": {
171
+ "const": "klinecharts"
172
+ },
173
+ "engineVersion": {
174
+ "const": "10.0.0"
175
+ },
176
+ "runtimeVersion": {
177
+ "const": "0.1.0"
178
+ }
179
+ }
180
+ };
181
+ export const MarketDataSchema = {
182
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
183
+ "$id": "https://baron.dev/kline-scene/market-data.schema.json",
184
+ "title": "MarketData",
185
+ "type": "object",
186
+ "additionalProperties": false,
187
+ "required": [
188
+ "timestamp",
189
+ "open",
190
+ "high",
191
+ "low",
192
+ "close"
193
+ ],
194
+ "properties": {
195
+ "timestamp": {
196
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
197
+ },
198
+ "open": {
199
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
200
+ },
201
+ "high": {
202
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
203
+ },
204
+ "low": {
205
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
206
+ },
207
+ "close": {
208
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
209
+ },
210
+ "volume": {
211
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/nonNegativeNumber"
212
+ },
213
+ "turnover": {
214
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/nonNegativeNumber"
215
+ }
216
+ }
217
+ };
218
+ export const ChartConfigSchema = {
219
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
220
+ "$id": "https://baron.dev/kline-scene/chart-config.schema.json",
221
+ "title": "ChartConfig",
222
+ "type": "object",
223
+ "additionalProperties": false,
224
+ "required": [
225
+ "locale",
226
+ "timezone",
227
+ "layout",
228
+ "candle",
229
+ "grid",
230
+ "thousandsSeparator",
231
+ "decimalFold",
232
+ "zoomAnchor",
233
+ "dateFormat",
234
+ "largeNumberFormat"
235
+ ],
236
+ "properties": {
237
+ "locale": {
238
+ "type": "string",
239
+ "minLength": 2,
240
+ "maxLength": 64,
241
+ "pattern": "^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$"
242
+ },
243
+ "timezone": {
244
+ "type": "string",
245
+ "minLength": 1,
246
+ "maxLength": 128,
247
+ "pattern": "^[A-Za-z_+-]+(?:/[A-Za-z0-9_+-]+)*$"
248
+ },
249
+ "layout": {
250
+ "type": "object",
251
+ "additionalProperties": false,
252
+ "required": [
253
+ "backgroundColor",
254
+ "textColor",
255
+ "fontFamily",
256
+ "fontSize"
257
+ ],
258
+ "properties": {
259
+ "backgroundColor": {
260
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
261
+ },
262
+ "textColor": {
263
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
264
+ },
265
+ "fontFamily": {
266
+ "type": "string",
267
+ "minLength": 1,
268
+ "maxLength": 128
269
+ },
270
+ "fontSize": {
271
+ "type": "number",
272
+ "minimum": 8,
273
+ "maximum": 32
274
+ }
275
+ }
276
+ },
277
+ "candle": {
278
+ "type": "object",
279
+ "additionalProperties": false,
280
+ "required": [
281
+ "type",
282
+ "upColor",
283
+ "downColor",
284
+ "noChangeColor",
285
+ "upBorderColor",
286
+ "downBorderColor",
287
+ "noChangeBorderColor",
288
+ "upWickColor",
289
+ "downWickColor",
290
+ "noChangeWickColor"
291
+ ],
292
+ "properties": {
293
+ "type": {
294
+ "enum": [
295
+ "candle_solid",
296
+ "candle_stroke",
297
+ "candle_up_stroke",
298
+ "candle_down_stroke",
299
+ "ohlc"
300
+ ]
301
+ },
302
+ "upColor": {
303
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
304
+ },
305
+ "downColor": {
306
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
307
+ },
308
+ "noChangeColor": {
309
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
310
+ },
311
+ "upBorderColor": {
312
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
313
+ },
314
+ "downBorderColor": {
315
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
316
+ },
317
+ "noChangeBorderColor": {
318
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
319
+ },
320
+ "upWickColor": {
321
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
322
+ },
323
+ "downWickColor": {
324
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
325
+ },
326
+ "noChangeWickColor": {
327
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
328
+ }
329
+ }
330
+ },
331
+ "grid": {
332
+ "type": "object",
333
+ "additionalProperties": false,
334
+ "required": [
335
+ "horizontalColor",
336
+ "verticalColor"
337
+ ],
338
+ "properties": {
339
+ "horizontalColor": {
340
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
341
+ },
342
+ "verticalColor": {
343
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
344
+ }
345
+ }
346
+ },
347
+ "thousandsSeparator": {
348
+ "enum": [
349
+ "",
350
+ ",",
351
+ " ",
352
+ "_"
353
+ ]
354
+ },
355
+ "decimalFold": {
356
+ "type": "object",
357
+ "additionalProperties": false,
358
+ "required": [
359
+ "enabled",
360
+ "threshold"
361
+ ],
362
+ "properties": {
363
+ "enabled": {
364
+ "type": "boolean"
365
+ },
366
+ "threshold": {
367
+ "type": "integer",
368
+ "minimum": 1,
369
+ "maximum": 16
370
+ }
371
+ }
372
+ },
373
+ "zoomAnchor": {
374
+ "enum": [
375
+ "cursor",
376
+ "right"
377
+ ]
378
+ },
379
+ "dateFormat": {
380
+ "enum": [
381
+ "yyyy-MM-dd",
382
+ "yyyy-MM-dd HH:mm",
383
+ "yyyy-MM-dd HH:mm:ss"
384
+ ]
385
+ },
386
+ "largeNumberFormat": {
387
+ "enum": [
388
+ "western",
389
+ "chinese",
390
+ "plain"
391
+ ]
392
+ }
393
+ }
394
+ };
395
+ export const IndicatorSchema = {
396
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
397
+ "$id": "https://baron.dev/kline-scene/indicator.schema.json",
398
+ "title": "SceneIndicator",
399
+ "type": "object",
400
+ "additionalProperties": false,
401
+ "required": [
402
+ "id",
403
+ "name",
404
+ "paneId",
405
+ "yAxisId",
406
+ "calcParams",
407
+ "precision",
408
+ "visible",
409
+ "zLevel",
410
+ "styles"
411
+ ],
412
+ "properties": {
413
+ "id": {
414
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
415
+ },
416
+ "name": {
417
+ "enum": [
418
+ "MA",
419
+ "EMA",
420
+ "SMA",
421
+ "BBI",
422
+ "VOL",
423
+ "MACD",
424
+ "BOLL",
425
+ "KDJ",
426
+ "RSI",
427
+ "BIAS",
428
+ "BRAR",
429
+ "CCI",
430
+ "DMI",
431
+ "CR",
432
+ "PSY",
433
+ "DMA",
434
+ "TRIX",
435
+ "OBV",
436
+ "VR",
437
+ "WR",
438
+ "MTM",
439
+ "EMV",
440
+ "SAR",
441
+ "AO",
442
+ "ROC",
443
+ "PVT",
444
+ "AVP"
445
+ ]
446
+ },
447
+ "paneId": {
448
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
449
+ },
450
+ "yAxisId": {
451
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
452
+ },
453
+ "calcParams": {
454
+ "type": "array",
455
+ "maxItems": 8,
456
+ "items": {
457
+ "type": "number",
458
+ "exclusiveMinimum": 0,
459
+ "maximum": 100000
460
+ }
461
+ },
462
+ "precision": {
463
+ "type": "integer",
464
+ "minimum": 0,
465
+ "maximum": 16
466
+ },
467
+ "visible": {
468
+ "type": "boolean"
469
+ },
470
+ "zLevel": {
471
+ "type": "integer",
472
+ "minimum": -1000,
473
+ "maximum": 1000
474
+ },
475
+ "styles": {
476
+ "type": "object",
477
+ "additionalProperties": false,
478
+ "required": [
479
+ "lines",
480
+ "bars",
481
+ "circles"
482
+ ],
483
+ "properties": {
484
+ "lines": {
485
+ "type": "array",
486
+ "maxItems": 16,
487
+ "items": {
488
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/lineStyle"
489
+ }
490
+ },
491
+ "bars": {
492
+ "type": "array",
493
+ "maxItems": 16,
494
+ "items": {
495
+ "type": "object",
496
+ "additionalProperties": false,
497
+ "required": [
498
+ "upColor",
499
+ "downColor",
500
+ "noChangeColor"
501
+ ],
502
+ "properties": {
503
+ "upColor": {
504
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
505
+ },
506
+ "downColor": {
507
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
508
+ },
509
+ "noChangeColor": {
510
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
511
+ }
512
+ }
513
+ }
514
+ },
515
+ "circles": {
516
+ "type": "array",
517
+ "maxItems": 16,
518
+ "items": {
519
+ "type": "object",
520
+ "additionalProperties": false,
521
+ "required": [
522
+ "color",
523
+ "radius"
524
+ ],
525
+ "properties": {
526
+ "color": {
527
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
528
+ },
529
+ "radius": {
530
+ "type": "number",
531
+ "exclusiveMinimum": 0,
532
+ "maximum": 20
533
+ }
534
+ }
535
+ }
536
+ }
537
+ }
538
+ }
539
+ }
540
+ };
541
+ export const PaneSchema = {
542
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
543
+ "$id": "https://baron.dev/kline-scene/pane.schema.json",
544
+ "title": "ScenePane",
545
+ "type": "object",
546
+ "additionalProperties": false,
547
+ "required": [
548
+ "id",
549
+ "kind",
550
+ "order",
551
+ "height",
552
+ "minHeight",
553
+ "state",
554
+ "yAxes",
555
+ "indicators"
556
+ ],
557
+ "properties": {
558
+ "id": {
559
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
560
+ },
561
+ "kind": {
562
+ "enum": [
563
+ "candle",
564
+ "indicator"
565
+ ]
566
+ },
567
+ "order": {
568
+ "type": "integer",
569
+ "minimum": 0,
570
+ "maximum": 128
571
+ },
572
+ "height": {
573
+ "type": "integer",
574
+ "minimum": 1,
575
+ "maximum": 10000
576
+ },
577
+ "minHeight": {
578
+ "type": "integer",
579
+ "minimum": 1,
580
+ "maximum": 10000
581
+ },
582
+ "state": {
583
+ "enum": [
584
+ "normal",
585
+ "maximize",
586
+ "minimize"
587
+ ]
588
+ },
589
+ "yAxes": {
590
+ "type": "array",
591
+ "minItems": 1,
592
+ "maxItems": 16,
593
+ "items": {
594
+ "$ref": "#/$defs/yAxis"
595
+ }
596
+ },
597
+ "indicators": {
598
+ "type": "array",
599
+ "maxItems": 128,
600
+ "items": {
601
+ "$ref": "https://baron.dev/kline-scene/indicator.schema.json"
602
+ }
603
+ }
604
+ },
605
+ "$defs": {
606
+ "yAxis": {
607
+ "type": "object",
608
+ "additionalProperties": false,
609
+ "required": [
610
+ "id",
611
+ "role",
612
+ "position",
613
+ "reverse",
614
+ "inside",
615
+ "scrollZoomEnabled",
616
+ "topGap",
617
+ "bottomGap"
618
+ ],
619
+ "properties": {
620
+ "id": {
621
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
622
+ },
623
+ "role": {
624
+ "enum": [
625
+ "primary",
626
+ "additional"
627
+ ]
628
+ },
629
+ "position": {
630
+ "enum": [
631
+ "left",
632
+ "right"
633
+ ]
634
+ },
635
+ "reverse": {
636
+ "type": "boolean"
637
+ },
638
+ "inside": {
639
+ "type": "boolean"
640
+ },
641
+ "scrollZoomEnabled": {
642
+ "type": "boolean"
643
+ },
644
+ "topGap": {
645
+ "type": "number",
646
+ "minimum": 0,
647
+ "maximum": 0.9
648
+ },
649
+ "bottomGap": {
650
+ "type": "number",
651
+ "minimum": 0,
652
+ "maximum": 0.9
653
+ }
654
+ }
655
+ }
656
+ }
657
+ };
658
+ export const OverlaySchema = {
659
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
660
+ "$id": "https://baron.dev/kline-scene/overlay.schema.json",
661
+ "title": "SceneOverlay",
662
+ "type": "object",
663
+ "additionalProperties": false,
664
+ "required": [
665
+ "id",
666
+ "type",
667
+ "paneId",
668
+ "visible",
669
+ "locked",
670
+ "zLevel",
671
+ "mode",
672
+ "styles"
673
+ ],
674
+ "properties": {
675
+ "id": {
676
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
677
+ },
678
+ "type": {
679
+ "enum": [
680
+ "horizontalRayLine",
681
+ "horizontalSegment",
682
+ "horizontalStraightLine",
683
+ "verticalRayLine",
684
+ "verticalSegment",
685
+ "verticalStraightLine",
686
+ "rayLine",
687
+ "segment",
688
+ "straightLine",
689
+ "priceLine",
690
+ "priceChannelLine",
691
+ "parallelStraightLine",
692
+ "fibonacciLine",
693
+ "brush",
694
+ "simpleAnnotation",
695
+ "simpleTag",
696
+ "rectangle",
697
+ "arrow",
698
+ "crossLine",
699
+ "callout",
700
+ "text"
701
+ ]
702
+ },
703
+ "paneId": {
704
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
705
+ },
706
+ "groupId": {
707
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
708
+ },
709
+ "visible": {
710
+ "type": "boolean"
711
+ },
712
+ "locked": {
713
+ "type": "boolean"
714
+ },
715
+ "zLevel": {
716
+ "type": "integer",
717
+ "minimum": -1000,
718
+ "maximum": 1000
719
+ },
720
+ "mode": {
721
+ "enum": [
722
+ "normal",
723
+ "weak_magnet",
724
+ "strong_magnet"
725
+ ]
726
+ },
727
+ "anchor": {
728
+ "oneOf": [
729
+ {
730
+ "$ref": "#/$defs/timeAnchor"
731
+ },
732
+ {
733
+ "$ref": "#/$defs/valueAnchor"
734
+ },
735
+ {
736
+ "$ref": "#/$defs/timeValueAnchor"
737
+ }
738
+ ]
739
+ },
740
+ "value": {
741
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
742
+ },
743
+ "startTimestamp": {
744
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
745
+ },
746
+ "endTimestamp": {
747
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
748
+ },
749
+ "timestamp": {
750
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
751
+ },
752
+ "startValue": {
753
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
754
+ },
755
+ "endValue": {
756
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
757
+ },
758
+ "point": {
759
+ "$ref": "#/$defs/timeValueAnchor"
760
+ },
761
+ "start": {
762
+ "$ref": "#/$defs/timeValueAnchor"
763
+ },
764
+ "end": {
765
+ "$ref": "#/$defs/timeValueAnchor"
766
+ },
767
+ "points": {
768
+ "type": "array",
769
+ "minItems": 1,
770
+ "maxItems": 256,
771
+ "items": {
772
+ "$ref": "#/$defs/timeValueAnchor"
773
+ }
774
+ },
775
+ "text": {
776
+ "type": "string",
777
+ "maxLength": 4096
778
+ },
779
+ "styles": {
780
+ "type": "object",
781
+ "additionalProperties": false,
782
+ "required": [
783
+ "line",
784
+ "fill",
785
+ "text"
786
+ ],
787
+ "properties": {
788
+ "line": {
789
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/lineStyle"
790
+ },
791
+ "fill": {
792
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/fillStyle"
793
+ },
794
+ "text": {
795
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/textStyle"
796
+ }
797
+ }
798
+ },
799
+ "metadata": {
800
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/metadata"
801
+ }
802
+ },
803
+ "$defs": {
804
+ "timeAnchor": {
805
+ "type": "object",
806
+ "additionalProperties": false,
807
+ "required": [
808
+ "timestamp"
809
+ ],
810
+ "properties": {
811
+ "timestamp": {
812
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
813
+ }
814
+ }
815
+ },
816
+ "valueAnchor": {
817
+ "type": "object",
818
+ "additionalProperties": false,
819
+ "required": [
820
+ "value"
821
+ ],
822
+ "properties": {
823
+ "value": {
824
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
825
+ }
826
+ }
827
+ },
828
+ "timeValueAnchor": {
829
+ "type": "object",
830
+ "additionalProperties": false,
831
+ "required": [
832
+ "timestamp",
833
+ "value"
834
+ ],
835
+ "properties": {
836
+ "timestamp": {
837
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
838
+ },
839
+ "value": {
840
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
841
+ }
842
+ }
843
+ }
844
+ }
845
+ };
846
+ export const ChartSceneSchema = {
847
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
848
+ "$id": "https://baron.dev/kline-scene/chart-scene.schema.json",
849
+ "title": "ChartScene",
850
+ "type": "object",
851
+ "additionalProperties": false,
852
+ "required": [
853
+ "schema",
854
+ "version",
855
+ "runtime",
856
+ "symbol",
857
+ "period",
858
+ "data",
859
+ "chart",
860
+ "panes",
861
+ "overlays",
862
+ "viewport",
863
+ "render",
864
+ "metadata"
865
+ ],
866
+ "properties": {
867
+ "schema": {
868
+ "const": "@baron1996/kline-scene"
869
+ },
870
+ "version": {
871
+ "const": 1
872
+ },
873
+ "runtime": {
874
+ "$ref": "https://baron.dev/kline-scene/runtime.schema.json"
875
+ },
876
+ "symbol": {
877
+ "$ref": "#/$defs/symbol"
878
+ },
879
+ "period": {
880
+ "$ref": "#/$defs/period"
881
+ },
882
+ "data": {
883
+ "type": "array",
884
+ "minItems": 1,
885
+ "maxItems": 1000000,
886
+ "items": {
887
+ "$ref": "https://baron.dev/kline-scene/market-data.schema.json"
888
+ }
889
+ },
890
+ "chart": {
891
+ "$ref": "https://baron.dev/kline-scene/chart-config.schema.json"
892
+ },
893
+ "panes": {
894
+ "type": "array",
895
+ "minItems": 1,
896
+ "maxItems": 32,
897
+ "items": {
898
+ "$ref": "https://baron.dev/kline-scene/pane.schema.json"
899
+ }
900
+ },
901
+ "overlays": {
902
+ "type": "array",
903
+ "maxItems": 10000,
904
+ "items": {
905
+ "$ref": "https://baron.dev/kline-scene/overlay.schema.json"
906
+ }
907
+ },
908
+ "viewport": {
909
+ "$ref": "#/$defs/viewport"
910
+ },
911
+ "render": {
912
+ "$ref": "#/$defs/render"
913
+ },
914
+ "metadata": {
915
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/metadata"
916
+ }
917
+ },
918
+ "$defs": {
919
+ "symbol": {
920
+ "type": "object",
921
+ "additionalProperties": false,
922
+ "required": [
923
+ "ticker",
924
+ "pricePrecision",
925
+ "volumePrecision"
926
+ ],
927
+ "properties": {
928
+ "ticker": {
929
+ "type": "string",
930
+ "minLength": 1,
931
+ "maxLength": 128
932
+ },
933
+ "name": {
934
+ "type": "string",
935
+ "minLength": 1,
936
+ "maxLength": 256
937
+ },
938
+ "pricePrecision": {
939
+ "type": "integer",
940
+ "minimum": 0,
941
+ "maximum": 16
942
+ },
943
+ "volumePrecision": {
944
+ "type": "integer",
945
+ "minimum": 0,
946
+ "maximum": 16
947
+ }
948
+ }
949
+ },
950
+ "period": {
951
+ "type": "object",
952
+ "additionalProperties": false,
953
+ "required": [
954
+ "span",
955
+ "type"
956
+ ],
957
+ "properties": {
958
+ "span": {
959
+ "type": "integer",
960
+ "minimum": 1,
961
+ "maximum": 100000
962
+ },
963
+ "type": {
964
+ "enum": [
965
+ "second",
966
+ "minute",
967
+ "hour",
968
+ "day",
969
+ "week",
970
+ "month",
971
+ "year"
972
+ ]
973
+ }
974
+ }
975
+ },
976
+ "viewport": {
977
+ "type": "object",
978
+ "additionalProperties": false,
979
+ "required": [
980
+ "barSpace",
981
+ "rightOffsetDistance",
982
+ "anchorTimestamp"
983
+ ],
984
+ "properties": {
985
+ "barSpace": {
986
+ "type": "number",
987
+ "minimum": 1,
988
+ "maximum": 100
989
+ },
990
+ "rightOffsetDistance": {
991
+ "type": "number",
992
+ "minimum": 0,
993
+ "maximum": 10000
994
+ },
995
+ "anchorTimestamp": {
996
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
997
+ }
998
+ }
999
+ },
1000
+ "render": {
1001
+ "type": "object",
1002
+ "additionalProperties": false,
1003
+ "required": [
1004
+ "width",
1005
+ "height",
1006
+ "deviceScaleFactor",
1007
+ "background",
1008
+ "fontFamily",
1009
+ "timeoutMs"
1010
+ ],
1011
+ "properties": {
1012
+ "width": {
1013
+ "type": "integer",
1014
+ "minimum": 320,
1015
+ "maximum": 8192
1016
+ },
1017
+ "height": {
1018
+ "type": "integer",
1019
+ "minimum": 240,
1020
+ "maximum": 8192
1021
+ },
1022
+ "deviceScaleFactor": {
1023
+ "type": "number",
1024
+ "minimum": 0.5,
1025
+ "maximum": 4
1026
+ },
1027
+ "background": {
1028
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
1029
+ },
1030
+ "fontFamily": {
1031
+ "enum": [
1032
+ "Baron Sans"
1033
+ ]
1034
+ },
1035
+ "timeoutMs": {
1036
+ "type": "integer",
1037
+ "minimum": 100,
1038
+ "maximum": 120000
1039
+ }
1040
+ }
1041
+ }
1042
+ }
1043
+ };