@baron1996/kline-scene-schema 0.3.0 → 0.4.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 (64) hide show
  1. package/dist/decimal-normalization.d.ts +6 -0
  2. package/dist/decimal-normalization.d.ts.map +1 -0
  3. package/dist/decimal-normalization.js +47 -0
  4. package/dist/drawable-workspace-canonical-json.d.ts +3 -0
  5. package/dist/drawable-workspace-canonical-json.d.ts.map +1 -0
  6. package/dist/drawable-workspace-canonical-json.js +15 -0
  7. package/dist/drawable-workspace-canonicalize.d.ts +3 -0
  8. package/dist/drawable-workspace-canonicalize.d.ts.map +1 -0
  9. package/dist/drawable-workspace-canonicalize.js +19 -0
  10. package/dist/drawable-workspace-errors.d.ts +14 -0
  11. package/dist/drawable-workspace-errors.d.ts.map +1 -0
  12. package/dist/drawable-workspace-errors.js +12 -0
  13. package/dist/drawable-workspace-semantic-validator.d.ts +5 -0
  14. package/dist/drawable-workspace-semantic-validator.d.ts.map +1 -0
  15. package/dist/drawable-workspace-semantic-validator.js +127 -0
  16. package/dist/drawable-workspace-validator.d.ts +4 -0
  17. package/dist/drawable-workspace-validator.d.ts.map +1 -0
  18. package/dist/drawable-workspace-validator.js +74 -0
  19. package/dist/drawing-canonical-json.d.ts +3 -0
  20. package/dist/drawing-canonical-json.d.ts.map +1 -0
  21. package/dist/drawing-canonical-json.js +15 -0
  22. package/dist/drawing-canonicalize.d.ts +3 -0
  23. package/dist/drawing-canonicalize.d.ts.map +1 -0
  24. package/dist/drawing-canonicalize.js +19 -0
  25. package/dist/drawing-errors.d.ts +13 -0
  26. package/dist/drawing-errors.d.ts.map +1 -0
  27. package/dist/drawing-errors.js +12 -0
  28. package/dist/drawing-semantic-validator.d.ts +6 -0
  29. package/dist/drawing-semantic-validator.d.ts.map +1 -0
  30. package/dist/drawing-semantic-validator.js +123 -0
  31. package/dist/drawing-validator.d.ts +4 -0
  32. package/dist/drawing-validator.d.ts.map +1 -0
  33. package/dist/drawing-validator.js +66 -0
  34. package/dist/generated/chart-scene.d.ts +11 -1
  35. package/dist/generated/chart-scene.d.ts.map +1 -1
  36. package/dist/generated/drawable-workspace.d.ts +526 -0
  37. package/dist/generated/drawable-workspace.d.ts.map +1 -0
  38. package/dist/generated/drawable-workspace.js +2 -0
  39. package/dist/generated/drawing-document.d.ts +216 -0
  40. package/dist/generated/drawing-document.d.ts.map +1 -0
  41. package/dist/generated/drawing-document.js +2 -0
  42. package/dist/generated/schemas.d.ts +770 -33
  43. package/dist/generated/schemas.d.ts.map +1 -1
  44. package/dist/generated/schemas.js +1113 -151
  45. package/dist/generated/validate-chart-scene.d.ts.map +1 -1
  46. package/dist/generated/validate-chart-scene.js +550 -237
  47. package/dist/generated/validate-drawable-workspace.d.ts +15 -0
  48. package/dist/generated/validate-drawable-workspace.d.ts.map +1 -0
  49. package/dist/generated/validate-drawable-workspace.js +13449 -0
  50. package/dist/generated/validate-drawing-document.d.ts +15 -0
  51. package/dist/generated/validate-drawing-document.d.ts.map +1 -0
  52. package/dist/generated/validate-drawing-document.js +4307 -0
  53. package/dist/generated/validate-time-series-scene.d.ts.map +1 -1
  54. package/dist/generated/validate-time-series-scene.js +16 -16
  55. package/dist/index.d.ts +14 -1
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +13 -1
  58. package/package.json +1 -1
  59. package/schema/chart-config.schema.json +68 -1
  60. package/schema/chart-scene.schema.json +1 -27
  61. package/schema/common.schema.json +26 -0
  62. package/schema/drawable-workspace.schema.json +110 -0
  63. package/schema/drawing-document.schema.json +811 -0
  64. package/schema/time-series-scene.schema.json +3 -12
@@ -10,6 +10,32 @@ export const CommonSchema = {
10
10
  "maxLength": 128,
11
11
  "pattern": "^[A-Za-z][A-Za-z0-9._:-]*$"
12
12
  },
13
+ "period": {
14
+ "type": "object",
15
+ "additionalProperties": false,
16
+ "required": [
17
+ "span",
18
+ "type"
19
+ ],
20
+ "properties": {
21
+ "span": {
22
+ "type": "integer",
23
+ "minimum": 1,
24
+ "maximum": 100000
25
+ },
26
+ "type": {
27
+ "enum": [
28
+ "second",
29
+ "minute",
30
+ "hour",
31
+ "day",
32
+ "week",
33
+ "month",
34
+ "year"
35
+ ]
36
+ }
37
+ }
38
+ },
13
39
  "finiteNumber": {
14
40
  "type": "number",
15
41
  "minimum": -1.7976931348623157e+308,
@@ -299,9 +325,51 @@ export const ChartConfigSchema = {
299
325
  "candle_stroke",
300
326
  "candle_up_stroke",
301
327
  "candle_down_stroke",
302
- "ohlc"
328
+ "ohlc",
329
+ "area"
303
330
  ]
304
331
  },
332
+ "area": {
333
+ "type": "object",
334
+ "additionalProperties": false,
335
+ "required": [
336
+ "value",
337
+ "line",
338
+ "backgroundColor",
339
+ "smooth",
340
+ "pointVisible"
341
+ ],
342
+ "properties": {
343
+ "value": {
344
+ "const": "close"
345
+ },
346
+ "line": {
347
+ "type": "object",
348
+ "additionalProperties": false,
349
+ "required": [
350
+ "color",
351
+ "size"
352
+ ],
353
+ "properties": {
354
+ "color": {
355
+ "const": "rgba(41, 98, 255, 1)"
356
+ },
357
+ "size": {
358
+ "const": 2
359
+ }
360
+ }
361
+ },
362
+ "backgroundColor": {
363
+ "const": "rgba(0, 0, 0, 0)"
364
+ },
365
+ "smooth": {
366
+ "const": false
367
+ },
368
+ "pointVisible": {
369
+ "const": false
370
+ }
371
+ }
372
+ },
305
373
  "upColor": {
306
374
  "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
307
375
  },
@@ -329,6 +397,31 @@ export const ChartConfigSchema = {
329
397
  "noChangeWickColor": {
330
398
  "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
331
399
  }
400
+ },
401
+ "if": {
402
+ "properties": {
403
+ "type": {
404
+ "const": "area"
405
+ }
406
+ },
407
+ "required": [
408
+ "type"
409
+ ]
410
+ },
411
+ "then": {
412
+ "required": [
413
+ "area"
414
+ ],
415
+ "properties": {
416
+ "area": true
417
+ }
418
+ },
419
+ "else": {
420
+ "not": {
421
+ "required": [
422
+ "area"
423
+ ]
424
+ }
332
425
  }
333
426
  },
334
427
  "grid": {
@@ -887,7 +980,7 @@ export const ChartSceneSchema = {
887
980
  "$ref": "#/$defs/symbol"
888
981
  },
889
982
  "period": {
890
- "$ref": "#/$defs/period"
983
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/period"
891
984
  },
892
985
  "data": {
893
986
  "type": "array",
@@ -957,32 +1050,6 @@ export const ChartSceneSchema = {
957
1050
  }
958
1051
  }
959
1052
  },
960
- "period": {
961
- "type": "object",
962
- "additionalProperties": false,
963
- "required": [
964
- "span",
965
- "type"
966
- ],
967
- "properties": {
968
- "span": {
969
- "type": "integer",
970
- "minimum": 1,
971
- "maximum": 100000
972
- },
973
- "type": {
974
- "enum": [
975
- "second",
976
- "minute",
977
- "hour",
978
- "day",
979
- "week",
980
- "month",
981
- "year"
982
- ]
983
- }
984
- }
985
- },
986
1053
  "viewport": {
987
1054
  "type": "object",
988
1055
  "additionalProperties": false,
@@ -1051,52 +1118,62 @@ export const ChartSceneSchema = {
1051
1118
  }
1052
1119
  }
1053
1120
  };
1054
- export const TimeSeriesRuntimeSchema = {
1121
+ export const DrawingDocumentSchema = {
1055
1122
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1056
- "$id": "https://baron.dev/kline-scene/time-series-runtime.schema.json",
1057
- "title": "TimeSeriesRuntimeIdentity",
1123
+ "$id": "https://baron.dev/kline-scene/drawing-document.schema.json",
1124
+ "title": "DrawingDocument",
1058
1125
  "type": "object",
1059
1126
  "additionalProperties": false,
1060
1127
  "required": [
1061
- "engine",
1062
- "engineVersion",
1063
- "runtimeVersion"
1128
+ "schema",
1129
+ "version",
1130
+ "scopeKey",
1131
+ "coordinateSystem",
1132
+ "drawings",
1133
+ "metadata"
1064
1134
  ],
1065
1135
  "properties": {
1066
- "engine": {
1067
- "const": "klinecharts"
1136
+ "schema": {
1137
+ "const": "@baron1996/drawing-document"
1068
1138
  },
1069
- "engineVersion": {
1070
- "const": "10.0.0"
1139
+ "version": {
1140
+ "const": 1
1071
1141
  },
1072
- "runtimeVersion": {
1073
- "const": "0.1.0"
1074
- }
1075
- }
1076
- };
1077
- export const TimeSeriesChartConfigSchema = {
1078
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1079
- "$id": "https://baron.dev/kline-scene/time-series-chart-config.schema.json",
1080
- "title": "TimeSeriesChartConfig",
1081
- "type": "object",
1082
- "additionalProperties": false,
1083
- "required": [
1084
- "locale",
1085
- "timezone",
1086
- "layout",
1087
- "grid",
1088
- "thousandsSeparator",
1089
- "decimalFold",
1090
- "zoomAnchor",
1091
- "dateFormat",
1092
- "largeNumberFormat"
1093
- ],
1094
- "properties": {
1095
- "locale": {
1142
+ "scopeKey": {
1096
1143
  "type": "string",
1097
- "minLength": 2,
1098
- "maxLength": 64,
1099
- "pattern": "^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$"
1144
+ "minLength": 1,
1145
+ "maxLength": 256
1146
+ },
1147
+ "coordinateSystem": {
1148
+ "$ref": "#/$defs/coordinateSystem"
1149
+ },
1150
+ "drawings": {
1151
+ "type": "array",
1152
+ "maxItems": 10000,
1153
+ "items": {
1154
+ "$ref": "#/$defs/drawing"
1155
+ }
1156
+ },
1157
+ "metadata": {
1158
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/metadata"
1159
+ }
1160
+ },
1161
+ "$defs": {
1162
+ "coordinateSystem": {
1163
+ "type": "object",
1164
+ "additionalProperties": false,
1165
+ "required": [
1166
+ "timezone",
1167
+ "valueAxes"
1168
+ ],
1169
+ "properties": {
1170
+ "timezone": {
1171
+ "$ref": "#/$defs/timezone"
1172
+ },
1173
+ "valueAxes": {
1174
+ "$ref": "#/$defs/valueAxes"
1175
+ }
1176
+ }
1100
1177
  },
1101
1178
  "timezone": {
1102
1179
  "type": "string",
@@ -1104,100 +1181,1011 @@ export const TimeSeriesChartConfigSchema = {
1104
1181
  "maxLength": 128,
1105
1182
  "pattern": "^[A-Za-z_+-]+(?:/[A-Za-z0-9_+-]+)*$"
1106
1183
  },
1107
- "layout": {
1184
+ "valueAxes": {
1185
+ "type": "array",
1186
+ "minItems": 1,
1187
+ "maxItems": 64,
1188
+ "items": {
1189
+ "$ref": "#/$defs/valueAxis"
1190
+ }
1191
+ },
1192
+ "valueAxis": {
1108
1193
  "type": "object",
1109
1194
  "additionalProperties": false,
1110
1195
  "required": [
1111
- "backgroundColor",
1112
- "textColor",
1113
- "fontFamily",
1114
- "fontSize"
1196
+ "paneRole",
1197
+ "yAxisRole",
1198
+ "valuePrecision"
1115
1199
  ],
1116
1200
  "properties": {
1117
- "backgroundColor": {
1118
- "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
1119
- },
1120
- "textColor": {
1121
- "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
1201
+ "paneRole": {
1202
+ "type": "string",
1203
+ "minLength": 1,
1204
+ "maxLength": 128
1122
1205
  },
1123
- "fontFamily": {
1206
+ "yAxisRole": {
1124
1207
  "type": "string",
1125
1208
  "minLength": 1,
1126
1209
  "maxLength": 128
1127
1210
  },
1128
- "fontSize": {
1129
- "type": "number",
1130
- "minimum": 8,
1131
- "maximum": 32
1211
+ "valuePrecision": {
1212
+ "type": "integer",
1213
+ "minimum": 0,
1214
+ "maximum": 16
1132
1215
  }
1133
1216
  }
1134
1217
  },
1135
- "grid": {
1218
+ "target": {
1136
1219
  "type": "object",
1137
1220
  "additionalProperties": false,
1138
1221
  "required": [
1139
- "horizontalColor",
1140
- "verticalColor"
1222
+ "paneRole",
1223
+ "yAxisRole"
1141
1224
  ],
1142
1225
  "properties": {
1143
- "horizontalColor": {
1144
- "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
1226
+ "paneRole": {
1227
+ "type": "string",
1228
+ "minLength": 1,
1229
+ "maxLength": 128
1145
1230
  },
1146
- "verticalColor": {
1147
- "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
1231
+ "yAxisRole": {
1232
+ "type": "string",
1233
+ "minLength": 1,
1234
+ "maxLength": 128
1148
1235
  }
1149
1236
  }
1150
1237
  },
1151
- "thousandsSeparator": {
1152
- "enum": [
1153
- "",
1154
- ",",
1155
- " ",
1156
- "_"
1157
- ]
1238
+ "drawingStyles": {
1239
+ "type": "object",
1240
+ "additionalProperties": false,
1241
+ "required": [
1242
+ "line",
1243
+ "fill",
1244
+ "text"
1245
+ ],
1246
+ "properties": {
1247
+ "line": {
1248
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/lineStyle"
1249
+ },
1250
+ "fill": {
1251
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/fillStyle"
1252
+ },
1253
+ "text": {
1254
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/textStyle"
1255
+ }
1256
+ }
1158
1257
  },
1159
- "decimalFold": {
1258
+ "drawingBase": {
1160
1259
  "type": "object",
1161
1260
  "additionalProperties": false,
1162
1261
  "required": [
1163
- "enabled",
1164
- "threshold"
1262
+ "id",
1263
+ "target",
1264
+ "visible",
1265
+ "locked",
1266
+ "zLevel",
1267
+ "mode",
1268
+ "styles"
1165
1269
  ],
1166
1270
  "properties": {
1167
- "enabled": {
1271
+ "id": {
1272
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
1273
+ },
1274
+ "groupId": {
1275
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
1276
+ },
1277
+ "target": {
1278
+ "$ref": "#/$defs/target"
1279
+ },
1280
+ "visible": {
1168
1281
  "type": "boolean"
1169
1282
  },
1170
- "threshold": {
1283
+ "locked": {
1284
+ "type": "boolean"
1285
+ },
1286
+ "zLevel": {
1171
1287
  "type": "integer",
1172
- "minimum": 1,
1173
- "maximum": 16
1288
+ "minimum": -1000,
1289
+ "maximum": 1000
1290
+ },
1291
+ "mode": {
1292
+ "enum": [
1293
+ "normal",
1294
+ "weak_magnet",
1295
+ "strong_magnet"
1296
+ ]
1297
+ },
1298
+ "styles": {
1299
+ "$ref": "#/$defs/drawingStyles"
1300
+ },
1301
+ "metadata": {
1302
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/metadata"
1174
1303
  }
1175
1304
  }
1176
1305
  },
1177
- "zoomAnchor": {
1178
- "enum": [
1179
- "cursor",
1180
- "right"
1181
- ]
1182
- },
1183
- "dateFormat": {
1184
- "enum": [
1185
- "yyyy-MM-dd",
1186
- "yyyy-MM-dd HH:mm",
1187
- "yyyy-MM-dd HH:mm:ss"
1188
- ]
1306
+ "drawingTimeAnchor": {
1307
+ "type": "object",
1308
+ "additionalProperties": false,
1309
+ "required": [
1310
+ "timestamp",
1311
+ "granularity"
1312
+ ],
1313
+ "properties": {
1314
+ "timestamp": {
1315
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
1316
+ },
1317
+ "granularity": {
1318
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/period"
1319
+ }
1320
+ }
1189
1321
  },
1190
- "largeNumberFormat": {
1191
- "enum": [
1192
- "western",
1193
- "chinese",
1194
- "plain"
1195
- ]
1196
- }
1197
- }
1198
- };
1199
- export const TimeSeriesSceneSchema = {
1200
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1322
+ "timeValuePoint": {
1323
+ "type": "object",
1324
+ "additionalProperties": false,
1325
+ "required": [
1326
+ "timestamp",
1327
+ "granularity",
1328
+ "value"
1329
+ ],
1330
+ "properties": {
1331
+ "timestamp": {
1332
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
1333
+ },
1334
+ "granularity": {
1335
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/period"
1336
+ },
1337
+ "value": {
1338
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
1339
+ }
1340
+ }
1341
+ },
1342
+ "geometryValue": {
1343
+ "type": "object",
1344
+ "additionalProperties": false,
1345
+ "required": [
1346
+ "value"
1347
+ ],
1348
+ "properties": {
1349
+ "value": {
1350
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
1351
+ }
1352
+ }
1353
+ },
1354
+ "geometryValueText": {
1355
+ "type": "object",
1356
+ "additionalProperties": false,
1357
+ "required": [
1358
+ "value",
1359
+ "text"
1360
+ ],
1361
+ "properties": {
1362
+ "value": {
1363
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
1364
+ },
1365
+ "text": {
1366
+ "type": "string",
1367
+ "maxLength": 4096
1368
+ }
1369
+ }
1370
+ },
1371
+ "geometryTime": {
1372
+ "type": "object",
1373
+ "additionalProperties": false,
1374
+ "required": [
1375
+ "time"
1376
+ ],
1377
+ "properties": {
1378
+ "time": {
1379
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
1380
+ }
1381
+ }
1382
+ },
1383
+ "geometryValueSpan": {
1384
+ "type": "object",
1385
+ "additionalProperties": false,
1386
+ "required": [
1387
+ "value",
1388
+ "startTime",
1389
+ "endTime"
1390
+ ],
1391
+ "properties": {
1392
+ "value": {
1393
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
1394
+ },
1395
+ "startTime": {
1396
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
1397
+ },
1398
+ "endTime": {
1399
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
1400
+ }
1401
+ }
1402
+ },
1403
+ "geometryTimeSpan": {
1404
+ "type": "object",
1405
+ "additionalProperties": false,
1406
+ "required": [
1407
+ "time",
1408
+ "startValue",
1409
+ "endValue"
1410
+ ],
1411
+ "properties": {
1412
+ "time": {
1413
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/safeInteger"
1414
+ },
1415
+ "startValue": {
1416
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
1417
+ },
1418
+ "endValue": {
1419
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber"
1420
+ }
1421
+ }
1422
+ },
1423
+ "geometryTwoPoints": {
1424
+ "type": "object",
1425
+ "additionalProperties": false,
1426
+ "required": [
1427
+ "points"
1428
+ ],
1429
+ "properties": {
1430
+ "points": {
1431
+ "type": "array",
1432
+ "minItems": 2,
1433
+ "maxItems": 2,
1434
+ "items": {
1435
+ "$ref": "#/$defs/timeValuePoint"
1436
+ }
1437
+ }
1438
+ }
1439
+ },
1440
+ "geometryThreePoints": {
1441
+ "type": "object",
1442
+ "additionalProperties": false,
1443
+ "required": [
1444
+ "points"
1445
+ ],
1446
+ "properties": {
1447
+ "points": {
1448
+ "type": "array",
1449
+ "minItems": 3,
1450
+ "maxItems": 3,
1451
+ "items": {
1452
+ "$ref": "#/$defs/timeValuePoint"
1453
+ }
1454
+ }
1455
+ }
1456
+ },
1457
+ "geometryBrushPoints": {
1458
+ "type": "object",
1459
+ "additionalProperties": false,
1460
+ "required": [
1461
+ "points"
1462
+ ],
1463
+ "properties": {
1464
+ "points": {
1465
+ "type": "array",
1466
+ "minItems": 2,
1467
+ "maxItems": 256,
1468
+ "items": {
1469
+ "$ref": "#/$defs/timeValuePoint"
1470
+ }
1471
+ }
1472
+ }
1473
+ },
1474
+ "geometryPointText": {
1475
+ "type": "object",
1476
+ "additionalProperties": false,
1477
+ "required": [
1478
+ "point",
1479
+ "text"
1480
+ ],
1481
+ "properties": {
1482
+ "point": {
1483
+ "$ref": "#/$defs/timeValuePoint"
1484
+ },
1485
+ "text": {
1486
+ "type": "string",
1487
+ "maxLength": 4096
1488
+ }
1489
+ }
1490
+ },
1491
+ "geometryPoint": {
1492
+ "type": "object",
1493
+ "additionalProperties": false,
1494
+ "required": [
1495
+ "point"
1496
+ ],
1497
+ "properties": {
1498
+ "point": {
1499
+ "$ref": "#/$defs/timeValuePoint"
1500
+ }
1501
+ }
1502
+ },
1503
+ "geometryStartEnd": {
1504
+ "type": "object",
1505
+ "additionalProperties": false,
1506
+ "required": [
1507
+ "start",
1508
+ "end"
1509
+ ],
1510
+ "properties": {
1511
+ "start": {
1512
+ "$ref": "#/$defs/timeValuePoint"
1513
+ },
1514
+ "end": {
1515
+ "$ref": "#/$defs/timeValuePoint"
1516
+ }
1517
+ }
1518
+ },
1519
+ "drawing": {
1520
+ "type": "object",
1521
+ "additionalProperties": false,
1522
+ "required": [
1523
+ "id",
1524
+ "target",
1525
+ "visible",
1526
+ "locked",
1527
+ "zLevel",
1528
+ "mode",
1529
+ "styles",
1530
+ "type",
1531
+ "geometry"
1532
+ ],
1533
+ "properties": {
1534
+ "id": {
1535
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
1536
+ },
1537
+ "groupId": {
1538
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/stableId"
1539
+ },
1540
+ "target": {
1541
+ "$ref": "#/$defs/target"
1542
+ },
1543
+ "visible": {
1544
+ "type": "boolean"
1545
+ },
1546
+ "locked": {
1547
+ "type": "boolean"
1548
+ },
1549
+ "zLevel": {
1550
+ "type": "integer",
1551
+ "minimum": -1000,
1552
+ "maximum": 1000
1553
+ },
1554
+ "mode": {
1555
+ "enum": [
1556
+ "normal",
1557
+ "weak_magnet",
1558
+ "strong_magnet"
1559
+ ]
1560
+ },
1561
+ "styles": {
1562
+ "$ref": "#/$defs/drawingStyles"
1563
+ },
1564
+ "metadata": {
1565
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/metadata"
1566
+ },
1567
+ "type": {
1568
+ "enum": [
1569
+ "horizontalStraightLine",
1570
+ "priceLine",
1571
+ "simpleTag",
1572
+ "verticalStraightLine",
1573
+ "horizontalRayLine",
1574
+ "horizontalSegment",
1575
+ "verticalRayLine",
1576
+ "verticalSegment",
1577
+ "rayLine",
1578
+ "segment",
1579
+ "straightLine",
1580
+ "fibonacciLine",
1581
+ "priceChannelLine",
1582
+ "parallelStraightLine",
1583
+ "brush",
1584
+ "simpleAnnotation",
1585
+ "callout",
1586
+ "text",
1587
+ "crossLine",
1588
+ "rectangle",
1589
+ "arrow",
1590
+ "priceMeasurement"
1591
+ ]
1592
+ },
1593
+ "geometry": {
1594
+ "type": "object"
1595
+ }
1596
+ },
1597
+ "oneOf": [
1598
+ {
1599
+ "title": "DrawingHorizontalStraightLine",
1600
+ "properties": {
1601
+ "type": {
1602
+ "const": "horizontalStraightLine"
1603
+ },
1604
+ "geometry": {
1605
+ "$ref": "#/$defs/geometryValue"
1606
+ }
1607
+ },
1608
+ "required": [
1609
+ "type",
1610
+ "geometry"
1611
+ ]
1612
+ },
1613
+ {
1614
+ "title": "DrawingPriceLine",
1615
+ "properties": {
1616
+ "type": {
1617
+ "const": "priceLine"
1618
+ },
1619
+ "geometry": {
1620
+ "$ref": "#/$defs/geometryValue"
1621
+ }
1622
+ },
1623
+ "required": [
1624
+ "type",
1625
+ "geometry"
1626
+ ]
1627
+ },
1628
+ {
1629
+ "title": "DrawingSimpleTag",
1630
+ "properties": {
1631
+ "type": {
1632
+ "const": "simpleTag"
1633
+ },
1634
+ "geometry": {
1635
+ "$ref": "#/$defs/geometryValueText"
1636
+ }
1637
+ },
1638
+ "required": [
1639
+ "type",
1640
+ "geometry"
1641
+ ]
1642
+ },
1643
+ {
1644
+ "title": "DrawingVerticalStraightLine",
1645
+ "properties": {
1646
+ "type": {
1647
+ "const": "verticalStraightLine"
1648
+ },
1649
+ "geometry": {
1650
+ "$ref": "#/$defs/geometryTime"
1651
+ }
1652
+ },
1653
+ "required": [
1654
+ "type",
1655
+ "geometry"
1656
+ ]
1657
+ },
1658
+ {
1659
+ "title": "DrawingHorizontalRayLine",
1660
+ "properties": {
1661
+ "type": {
1662
+ "const": "horizontalRayLine"
1663
+ },
1664
+ "geometry": {
1665
+ "$ref": "#/$defs/geometryValueSpan"
1666
+ }
1667
+ },
1668
+ "required": [
1669
+ "type",
1670
+ "geometry"
1671
+ ]
1672
+ },
1673
+ {
1674
+ "title": "DrawingHorizontalSegment",
1675
+ "properties": {
1676
+ "type": {
1677
+ "const": "horizontalSegment"
1678
+ },
1679
+ "geometry": {
1680
+ "$ref": "#/$defs/geometryValueSpan"
1681
+ }
1682
+ },
1683
+ "required": [
1684
+ "type",
1685
+ "geometry"
1686
+ ]
1687
+ },
1688
+ {
1689
+ "title": "DrawingVerticalRayLine",
1690
+ "properties": {
1691
+ "type": {
1692
+ "const": "verticalRayLine"
1693
+ },
1694
+ "geometry": {
1695
+ "$ref": "#/$defs/geometryTimeSpan"
1696
+ }
1697
+ },
1698
+ "required": [
1699
+ "type",
1700
+ "geometry"
1701
+ ]
1702
+ },
1703
+ {
1704
+ "title": "DrawingVerticalSegment",
1705
+ "properties": {
1706
+ "type": {
1707
+ "const": "verticalSegment"
1708
+ },
1709
+ "geometry": {
1710
+ "$ref": "#/$defs/geometryTimeSpan"
1711
+ }
1712
+ },
1713
+ "required": [
1714
+ "type",
1715
+ "geometry"
1716
+ ]
1717
+ },
1718
+ {
1719
+ "title": "DrawingRayLine",
1720
+ "properties": {
1721
+ "type": {
1722
+ "const": "rayLine"
1723
+ },
1724
+ "geometry": {
1725
+ "$ref": "#/$defs/geometryTwoPoints"
1726
+ }
1727
+ },
1728
+ "required": [
1729
+ "type",
1730
+ "geometry"
1731
+ ]
1732
+ },
1733
+ {
1734
+ "title": "DrawingSegment",
1735
+ "properties": {
1736
+ "type": {
1737
+ "const": "segment"
1738
+ },
1739
+ "geometry": {
1740
+ "$ref": "#/$defs/geometryTwoPoints"
1741
+ }
1742
+ },
1743
+ "required": [
1744
+ "type",
1745
+ "geometry"
1746
+ ]
1747
+ },
1748
+ {
1749
+ "title": "DrawingStraightLine",
1750
+ "properties": {
1751
+ "type": {
1752
+ "const": "straightLine"
1753
+ },
1754
+ "geometry": {
1755
+ "$ref": "#/$defs/geometryTwoPoints"
1756
+ }
1757
+ },
1758
+ "required": [
1759
+ "type",
1760
+ "geometry"
1761
+ ]
1762
+ },
1763
+ {
1764
+ "title": "DrawingFibonacciLine",
1765
+ "properties": {
1766
+ "type": {
1767
+ "const": "fibonacciLine"
1768
+ },
1769
+ "geometry": {
1770
+ "$ref": "#/$defs/geometryTwoPoints"
1771
+ }
1772
+ },
1773
+ "required": [
1774
+ "type",
1775
+ "geometry"
1776
+ ]
1777
+ },
1778
+ {
1779
+ "title": "DrawingPriceChannelLine",
1780
+ "properties": {
1781
+ "type": {
1782
+ "const": "priceChannelLine"
1783
+ },
1784
+ "geometry": {
1785
+ "$ref": "#/$defs/geometryThreePoints"
1786
+ }
1787
+ },
1788
+ "required": [
1789
+ "type",
1790
+ "geometry"
1791
+ ]
1792
+ },
1793
+ {
1794
+ "title": "DrawingParallelStraightLine",
1795
+ "properties": {
1796
+ "type": {
1797
+ "const": "parallelStraightLine"
1798
+ },
1799
+ "geometry": {
1800
+ "$ref": "#/$defs/geometryThreePoints"
1801
+ }
1802
+ },
1803
+ "required": [
1804
+ "type",
1805
+ "geometry"
1806
+ ]
1807
+ },
1808
+ {
1809
+ "title": "DrawingBrush",
1810
+ "properties": {
1811
+ "type": {
1812
+ "const": "brush"
1813
+ },
1814
+ "geometry": {
1815
+ "$ref": "#/$defs/geometryBrushPoints"
1816
+ }
1817
+ },
1818
+ "required": [
1819
+ "type",
1820
+ "geometry"
1821
+ ]
1822
+ },
1823
+ {
1824
+ "title": "DrawingSimpleAnnotation",
1825
+ "properties": {
1826
+ "type": {
1827
+ "const": "simpleAnnotation"
1828
+ },
1829
+ "geometry": {
1830
+ "$ref": "#/$defs/geometryPointText"
1831
+ }
1832
+ },
1833
+ "required": [
1834
+ "type",
1835
+ "geometry"
1836
+ ]
1837
+ },
1838
+ {
1839
+ "title": "DrawingCallout",
1840
+ "properties": {
1841
+ "type": {
1842
+ "const": "callout"
1843
+ },
1844
+ "geometry": {
1845
+ "$ref": "#/$defs/geometryPointText"
1846
+ }
1847
+ },
1848
+ "required": [
1849
+ "type",
1850
+ "geometry"
1851
+ ]
1852
+ },
1853
+ {
1854
+ "title": "DrawingText",
1855
+ "properties": {
1856
+ "type": {
1857
+ "const": "text"
1858
+ },
1859
+ "geometry": {
1860
+ "$ref": "#/$defs/geometryPointText"
1861
+ }
1862
+ },
1863
+ "required": [
1864
+ "type",
1865
+ "geometry"
1866
+ ]
1867
+ },
1868
+ {
1869
+ "title": "DrawingCrossLine",
1870
+ "properties": {
1871
+ "type": {
1872
+ "const": "crossLine"
1873
+ },
1874
+ "geometry": {
1875
+ "$ref": "#/$defs/geometryPoint"
1876
+ }
1877
+ },
1878
+ "required": [
1879
+ "type",
1880
+ "geometry"
1881
+ ]
1882
+ },
1883
+ {
1884
+ "title": "DrawingRectangle",
1885
+ "properties": {
1886
+ "type": {
1887
+ "const": "rectangle"
1888
+ },
1889
+ "geometry": {
1890
+ "$ref": "#/$defs/geometryStartEnd"
1891
+ }
1892
+ },
1893
+ "required": [
1894
+ "type",
1895
+ "geometry"
1896
+ ]
1897
+ },
1898
+ {
1899
+ "title": "DrawingArrow",
1900
+ "properties": {
1901
+ "type": {
1902
+ "const": "arrow"
1903
+ },
1904
+ "geometry": {
1905
+ "$ref": "#/$defs/geometryStartEnd"
1906
+ }
1907
+ },
1908
+ "required": [
1909
+ "type",
1910
+ "geometry"
1911
+ ]
1912
+ },
1913
+ {
1914
+ "title": "DrawingPriceMeasurement",
1915
+ "properties": {
1916
+ "type": {
1917
+ "const": "priceMeasurement"
1918
+ },
1919
+ "geometry": {
1920
+ "$ref": "#/$defs/geometryStartEnd"
1921
+ }
1922
+ },
1923
+ "required": [
1924
+ "type",
1925
+ "geometry"
1926
+ ]
1927
+ }
1928
+ ]
1929
+ }
1930
+ }
1931
+ };
1932
+ export const DrawableWorkspaceSchema = {
1933
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
1934
+ "$id": "https://baron.dev/kline-scene/drawable-workspace.schema.json",
1935
+ "title": "DrawableWorkspaceDocument",
1936
+ "type": "object",
1937
+ "additionalProperties": false,
1938
+ "required": [
1939
+ "schema",
1940
+ "version",
1941
+ "runtime",
1942
+ "scene",
1943
+ "drawings",
1944
+ "binding",
1945
+ "metadata"
1946
+ ],
1947
+ "properties": {
1948
+ "schema": {
1949
+ "const": "@baron1996/drawable-workspace"
1950
+ },
1951
+ "version": {
1952
+ "const": 1
1953
+ },
1954
+ "runtime": {
1955
+ "type": "object",
1956
+ "additionalProperties": false,
1957
+ "required": [
1958
+ "engine",
1959
+ "engineVersion",
1960
+ "workspaceRuntimeVersion"
1961
+ ],
1962
+ "properties": {
1963
+ "engine": {
1964
+ "const": "klinecharts"
1965
+ },
1966
+ "engineVersion": {
1967
+ "const": "10.0.0"
1968
+ },
1969
+ "workspaceRuntimeVersion": {
1970
+ "const": "1.0.0"
1971
+ }
1972
+ }
1973
+ },
1974
+ "scene": {
1975
+ "oneOf": [
1976
+ {
1977
+ "title": "ChartWorkspaceScene",
1978
+ "type": "object",
1979
+ "additionalProperties": false,
1980
+ "required": [
1981
+ "kind",
1982
+ "document"
1983
+ ],
1984
+ "properties": {
1985
+ "kind": {
1986
+ "const": "chart"
1987
+ },
1988
+ "document": {
1989
+ "$ref": "https://baron.dev/kline-scene/chart-scene.schema.json"
1990
+ }
1991
+ }
1992
+ },
1993
+ {
1994
+ "title": "TimeSeriesWorkspaceScene",
1995
+ "type": "object",
1996
+ "additionalProperties": false,
1997
+ "required": [
1998
+ "kind",
1999
+ "document"
2000
+ ],
2001
+ "properties": {
2002
+ "kind": {
2003
+ "const": "time-series"
2004
+ },
2005
+ "document": {
2006
+ "$ref": "https://baron.dev/kline-scene/time-series-scene.schema.json"
2007
+ }
2008
+ }
2009
+ }
2010
+ ]
2011
+ },
2012
+ "drawings": {
2013
+ "$ref": "https://baron.dev/kline-scene/drawing-document.schema.json"
2014
+ },
2015
+ "binding": {
2016
+ "type": "object",
2017
+ "additionalProperties": false,
2018
+ "required": [
2019
+ "scopeKey",
2020
+ "timezone",
2021
+ "valueAxes"
2022
+ ],
2023
+ "properties": {
2024
+ "scopeKey": {
2025
+ "type": "string",
2026
+ "minLength": 1,
2027
+ "maxLength": 256
2028
+ },
2029
+ "timezone": {
2030
+ "$ref": "https://baron.dev/kline-scene/drawing-document.schema.json#/$defs/timezone"
2031
+ },
2032
+ "valueAxes": {
2033
+ "$ref": "https://baron.dev/kline-scene/drawing-document.schema.json#/$defs/valueAxes"
2034
+ }
2035
+ }
2036
+ },
2037
+ "metadata": {
2038
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/metadata"
2039
+ }
2040
+ }
2041
+ };
2042
+ export const TimeSeriesRuntimeSchema = {
2043
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
2044
+ "$id": "https://baron.dev/kline-scene/time-series-runtime.schema.json",
2045
+ "title": "TimeSeriesRuntimeIdentity",
2046
+ "type": "object",
2047
+ "additionalProperties": false,
2048
+ "required": [
2049
+ "engine",
2050
+ "engineVersion",
2051
+ "runtimeVersion"
2052
+ ],
2053
+ "properties": {
2054
+ "engine": {
2055
+ "const": "klinecharts"
2056
+ },
2057
+ "engineVersion": {
2058
+ "const": "10.0.0"
2059
+ },
2060
+ "runtimeVersion": {
2061
+ "const": "0.1.0"
2062
+ }
2063
+ }
2064
+ };
2065
+ export const TimeSeriesChartConfigSchema = {
2066
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
2067
+ "$id": "https://baron.dev/kline-scene/time-series-chart-config.schema.json",
2068
+ "title": "TimeSeriesChartConfig",
2069
+ "type": "object",
2070
+ "additionalProperties": false,
2071
+ "required": [
2072
+ "locale",
2073
+ "timezone",
2074
+ "layout",
2075
+ "grid",
2076
+ "thousandsSeparator",
2077
+ "decimalFold",
2078
+ "zoomAnchor",
2079
+ "dateFormat",
2080
+ "largeNumberFormat"
2081
+ ],
2082
+ "properties": {
2083
+ "locale": {
2084
+ "type": "string",
2085
+ "minLength": 2,
2086
+ "maxLength": 64,
2087
+ "pattern": "^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$"
2088
+ },
2089
+ "timezone": {
2090
+ "type": "string",
2091
+ "minLength": 1,
2092
+ "maxLength": 128,
2093
+ "pattern": "^[A-Za-z_+-]+(?:/[A-Za-z0-9_+-]+)*$"
2094
+ },
2095
+ "layout": {
2096
+ "type": "object",
2097
+ "additionalProperties": false,
2098
+ "required": [
2099
+ "backgroundColor",
2100
+ "textColor",
2101
+ "fontFamily",
2102
+ "fontSize"
2103
+ ],
2104
+ "properties": {
2105
+ "backgroundColor": {
2106
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
2107
+ },
2108
+ "textColor": {
2109
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
2110
+ },
2111
+ "fontFamily": {
2112
+ "type": "string",
2113
+ "minLength": 1,
2114
+ "maxLength": 128
2115
+ },
2116
+ "fontSize": {
2117
+ "type": "number",
2118
+ "minimum": 8,
2119
+ "maximum": 32
2120
+ }
2121
+ }
2122
+ },
2123
+ "grid": {
2124
+ "type": "object",
2125
+ "additionalProperties": false,
2126
+ "required": [
2127
+ "horizontalColor",
2128
+ "verticalColor"
2129
+ ],
2130
+ "properties": {
2131
+ "horizontalColor": {
2132
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
2133
+ },
2134
+ "verticalColor": {
2135
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
2136
+ }
2137
+ }
2138
+ },
2139
+ "thousandsSeparator": {
2140
+ "enum": [
2141
+ "",
2142
+ ",",
2143
+ " ",
2144
+ "_"
2145
+ ]
2146
+ },
2147
+ "decimalFold": {
2148
+ "type": "object",
2149
+ "additionalProperties": false,
2150
+ "required": [
2151
+ "enabled",
2152
+ "threshold"
2153
+ ],
2154
+ "properties": {
2155
+ "enabled": {
2156
+ "type": "boolean"
2157
+ },
2158
+ "threshold": {
2159
+ "type": "integer",
2160
+ "minimum": 1,
2161
+ "maximum": 16
2162
+ }
2163
+ }
2164
+ },
2165
+ "zoomAnchor": {
2166
+ "enum": [
2167
+ "cursor",
2168
+ "right"
2169
+ ]
2170
+ },
2171
+ "dateFormat": {
2172
+ "enum": [
2173
+ "yyyy-MM-dd",
2174
+ "yyyy-MM-dd HH:mm",
2175
+ "yyyy-MM-dd HH:mm:ss"
2176
+ ]
2177
+ },
2178
+ "largeNumberFormat": {
2179
+ "enum": [
2180
+ "western",
2181
+ "chinese",
2182
+ "plain"
2183
+ ]
2184
+ }
2185
+ }
2186
+ };
2187
+ export const TimeSeriesSceneSchema = {
2188
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
1201
2189
  "$id": "https://baron.dev/kline-scene/time-series-scene.schema.json",
1202
2190
  "title": "TimeSeriesScene",
1203
2191
  "type": "object",
@@ -1225,7 +2213,7 @@ export const TimeSeriesSceneSchema = {
1225
2213
  "$ref": "https://baron.dev/kline-scene/time-series-runtime.schema.json"
1226
2214
  },
1227
2215
  "period": {
1228
- "$ref": "#/$defs/timeSeriesPeriod"
2216
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/period"
1229
2217
  },
1230
2218
  "series": {
1231
2219
  "type": "array",
@@ -1257,32 +2245,6 @@ export const TimeSeriesSceneSchema = {
1257
2245
  }
1258
2246
  },
1259
2247
  "$defs": {
1260
- "timeSeriesPeriod": {
1261
- "type": "object",
1262
- "additionalProperties": false,
1263
- "required": [
1264
- "span",
1265
- "type"
1266
- ],
1267
- "properties": {
1268
- "span": {
1269
- "type": "integer",
1270
- "minimum": 1,
1271
- "maximum": 100000
1272
- },
1273
- "type": {
1274
- "enum": [
1275
- "second",
1276
- "minute",
1277
- "hour",
1278
- "day",
1279
- "week",
1280
- "month",
1281
- "year"
1282
- ]
1283
- }
1284
- }
1285
- },
1286
2248
  "timeSeriesDefinition": {
1287
2249
  "type": "object",
1288
2250
  "additionalProperties": false,