@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
@@ -1 +1 @@
1
- {"version":3,"file":"validate-time-series-scene.d.ts","sourceRoot":"","sources":["../../src/generated/validate-time-series-scene.ts"],"names":[],"mappings":"AACa,eAAO,MAAM,uBAAuB,mBAAa,CAAC;AAAkx1D,iBAAS,UAAU,CAAC,IAAI,KAAA,EAAE,EAAC,YAAe,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAa,EAAE,cAAiB,EAAC;;;;CAAG,WAAiykB;kBAAx4kB,UAAU"}
1
+ {"version":3,"file":"validate-time-series-scene.d.ts","sourceRoot":"","sources":["../../src/generated/validate-time-series-scene.ts"],"names":[],"mappings":"AACa,eAAO,MAAM,uBAAuB,mBAAa,CAAC;AAA8k1D,iBAAS,UAAU,CAAC,IAAI,KAAA,EAAE,EAAC,YAAe,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAa,EAAE,cAAiB,EAAC;;;;CAAG,WAAillB;kBAAxrlB,UAAU"}
@@ -1,12 +1,12 @@
1
1
  // @ts-nocheck -- generated standalone validator
2
2
  "use strict";
3
3
  export const validateTimeSeriesScene = validate20;
4
- const schema31 = { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://baron.dev/kline-scene/time-series-scene.schema.json", "title": "TimeSeriesScene", "type": "object", "additionalProperties": false, "required": ["schema", "version", "runtime", "period", "series", "data", "chart", "viewport", "render", "metadata"], "properties": { "schema": { "const": "@baron1996/time-series-scene" }, "version": { "const": 1 }, "runtime": { "$ref": "https://baron.dev/kline-scene/time-series-runtime.schema.json" }, "period": { "$ref": "#/$defs/timeSeriesPeriod" }, "series": { "type": "array", "minItems": 1, "maxItems": 64, "items": { "$ref": "#/$defs/timeSeriesDefinition" } }, "data": { "type": "array", "minItems": 1, "maxItems": 1000000, "items": { "$ref": "#/$defs/timeSeriesPoint" } }, "chart": { "$ref": "https://baron.dev/kline-scene/time-series-chart-config.schema.json" }, "viewport": { "$ref": "#/$defs/timeSeriesViewport" }, "render": { "$ref": "#/$defs/timeSeriesRender" }, "metadata": { "$ref": "#/$defs/metadata" } }, "$defs": { "timeSeriesPeriod": { "type": "object", "additionalProperties": false, "required": ["span", "type"], "properties": { "span": { "type": "integer", "minimum": 1, "maximum": 100000 }, "type": { "enum": ["second", "minute", "hour", "day", "week", "month", "year"] } } }, "timeSeriesDefinition": { "type": "object", "additionalProperties": false, "required": ["id", "name", "type", "unit", "precision", "visible", "style"], "properties": { "id": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$" }, "name": { "type": "string", "minLength": 1, "maxLength": 256 }, "type": { "const": "line" }, "unit": { "type": "string", "minLength": 1, "maxLength": 64 }, "precision": { "type": "integer", "minimum": 0, "maximum": 16 }, "visible": { "type": "boolean" }, "style": { "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/lineStyle" } } }, "timeSeriesPoint": { "type": "object", "additionalProperties": false, "required": ["timestamp", "values"], "properties": { "timestamp": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "values": { "type": "object", "minProperties": 1, "maxProperties": 64, "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$" }, "additionalProperties": { "oneOf": [{ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber" }, { "type": "null" }] } } } }, "timeSeriesViewport": { "type": "object", "additionalProperties": false, "required": ["barSpace", "rightOffsetDistance", "anchorTimestamp"], "properties": { "barSpace": { "type": "number", "minimum": 1, "maximum": 100 }, "rightOffsetDistance": { "type": "number", "minimum": 0, "maximum": 10000 }, "anchorTimestamp": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } } }, "timeSeriesRender": { "type": "object", "additionalProperties": false, "required": ["width", "height", "deviceScaleFactor", "background", "fontFamily", "timeoutMs"], "properties": { "width": { "type": "integer", "minimum": 320, "maximum": 8192 }, "height": { "type": "integer", "minimum": 240, "maximum": 8192 }, "deviceScaleFactor": { "type": "number", "minimum": 0.5, "maximum": 4 }, "background": { "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor" }, "fontFamily": { "const": "Baron Sans" }, "timeoutMs": { "type": "integer", "minimum": 100, "maximum": 120000 } } }, "metadata": { "type": "object", "maxProperties": 64, "propertyNames": { "type": "string", "minLength": 1, "maxLength": 128 }, "additionalProperties": { "oneOf": [{ "type": "null" }, { "type": "boolean" }, { "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber" }, { "type": "string" }] } } } };
4
+ const schema31 = { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://baron.dev/kline-scene/time-series-scene.schema.json", "title": "TimeSeriesScene", "type": "object", "additionalProperties": false, "required": ["schema", "version", "runtime", "period", "series", "data", "chart", "viewport", "render", "metadata"], "properties": { "schema": { "const": "@baron1996/time-series-scene" }, "version": { "const": 1 }, "runtime": { "$ref": "https://baron.dev/kline-scene/time-series-runtime.schema.json" }, "period": { "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/period" }, "series": { "type": "array", "minItems": 1, "maxItems": 64, "items": { "$ref": "#/$defs/timeSeriesDefinition" } }, "data": { "type": "array", "minItems": 1, "maxItems": 1000000, "items": { "$ref": "#/$defs/timeSeriesPoint" } }, "chart": { "$ref": "https://baron.dev/kline-scene/time-series-chart-config.schema.json" }, "viewport": { "$ref": "#/$defs/timeSeriesViewport" }, "render": { "$ref": "#/$defs/timeSeriesRender" }, "metadata": { "$ref": "#/$defs/metadata" } }, "$defs": { "timeSeriesDefinition": { "type": "object", "additionalProperties": false, "required": ["id", "name", "type", "unit", "precision", "visible", "style"], "properties": { "id": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$" }, "name": { "type": "string", "minLength": 1, "maxLength": 256 }, "type": { "const": "line" }, "unit": { "type": "string", "minLength": 1, "maxLength": 64 }, "precision": { "type": "integer", "minimum": 0, "maximum": 16 }, "visible": { "type": "boolean" }, "style": { "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/lineStyle" } } }, "timeSeriesPoint": { "type": "object", "additionalProperties": false, "required": ["timestamp", "values"], "properties": { "timestamp": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "values": { "type": "object", "minProperties": 1, "maxProperties": 64, "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$" }, "additionalProperties": { "oneOf": [{ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber" }, { "type": "null" }] } } } }, "timeSeriesViewport": { "type": "object", "additionalProperties": false, "required": ["barSpace", "rightOffsetDistance", "anchorTimestamp"], "properties": { "barSpace": { "type": "number", "minimum": 1, "maximum": 100 }, "rightOffsetDistance": { "type": "number", "minimum": 0, "maximum": 10000 }, "anchorTimestamp": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } } }, "timeSeriesRender": { "type": "object", "additionalProperties": false, "required": ["width", "height", "deviceScaleFactor", "background", "fontFamily", "timeoutMs"], "properties": { "width": { "type": "integer", "minimum": 320, "maximum": 8192 }, "height": { "type": "integer", "minimum": 240, "maximum": 8192 }, "deviceScaleFactor": { "type": "number", "minimum": 0.5, "maximum": 4 }, "background": { "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor" }, "fontFamily": { "const": "Baron Sans" }, "timeoutMs": { "type": "integer", "minimum": 100, "maximum": 120000 } } }, "metadata": { "type": "object", "maxProperties": 64, "propertyNames": { "type": "string", "minLength": 1, "maxLength": 128 }, "additionalProperties": { "oneOf": [{ "type": "null" }, { "type": "boolean" }, { "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber" }, { "type": "string" }] } } } };
5
5
  const schema32 = { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://baron.dev/kline-scene/time-series-runtime.schema.json", "title": "TimeSeriesRuntimeIdentity", "type": "object", "additionalProperties": false, "required": ["engine", "engineVersion", "runtimeVersion"], "properties": { "engine": { "const": "klinecharts" }, "engineVersion": { "const": "10.0.0" }, "runtimeVersion": { "const": "0.1.0" } } };
6
- const schema33 = { "type": "object", "additionalProperties": false, "required": ["span", "type"], "properties": { "span": { "type": "integer", "minimum": 1, "maximum": 100000 }, "type": { "enum": ["second", "minute", "hour", "day", "week", "month", "year"] } } };
6
+ const schema34 = { "type": "object", "additionalProperties": false, "required": ["span", "type"], "properties": { "span": { "type": "integer", "minimum": 1, "maximum": 100000 }, "type": { "enum": ["second", "minute", "hour", "day", "week", "month", "year"] } } };
7
7
  const schema45 = { "type": "object", "additionalProperties": false, "required": ["barSpace", "rightOffsetDistance", "anchorTimestamp"], "properties": { "barSpace": { "type": "number", "minimum": 1, "maximum": 100 }, "rightOffsetDistance": { "type": "number", "minimum": 0, "maximum": 10000 }, "anchorTimestamp": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } } };
8
8
  const func1 = Object.prototype.hasOwnProperty;
9
- const schema34 = { "type": "object", "additionalProperties": false, "required": ["id", "name", "type", "unit", "precision", "visible", "style"], "properties": { "id": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$" }, "name": { "type": "string", "minLength": 1, "maxLength": 256 }, "type": { "const": "line" }, "unit": { "type": "string", "minLength": 1, "maxLength": 64 }, "precision": { "type": "integer", "minimum": 0, "maximum": 16 }, "visible": { "type": "boolean" }, "style": { "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/lineStyle" } } };
9
+ const schema35 = { "type": "object", "additionalProperties": false, "required": ["id", "name", "type", "unit", "precision", "visible", "style"], "properties": { "id": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$" }, "name": { "type": "string", "minLength": 1, "maxLength": 256 }, "type": { "const": "line" }, "unit": { "type": "string", "minLength": 1, "maxLength": 64 }, "precision": { "type": "integer", "minimum": 0, "maximum": 16 }, "visible": { "type": "boolean" }, "style": { "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/lineStyle" } } };
10
10
  const pattern4 = new RegExp("^[A-Za-z][A-Za-z0-9_-]{0,63}$", "u");
11
11
  const func2 = (value) => { let length = 0; for (const _character of value)
12
12
  length++; return length; };
@@ -145,7 +145,7 @@ else {
145
145
  errors++;
146
146
  } validate23.errors = vErrors; return errors === 0; }
147
147
  validate23.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
148
- function validate21(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate21.evaluated; if (evaluated0.dynamicProps) {
148
+ function validate22(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate22.evaluated; if (evaluated0.dynamicProps) {
149
149
  evaluated0.props = undefined;
150
150
  } if (evaluated0.dynamicItems) {
151
151
  evaluated0.items = undefined;
@@ -402,8 +402,8 @@ else {
402
402
  vErrors.push(err21);
403
403
  }
404
404
  errors++;
405
- } validate21.errors = vErrors; return errors === 0; }
406
- validate21.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
405
+ } validate22.errors = vErrors; return errors === 0; }
406
+ validate22.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
407
407
  const schema38 = { "type": "object", "additionalProperties": false, "required": ["timestamp", "values"], "properties": { "timestamp": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "values": { "type": "object", "minProperties": 1, "maxProperties": 64, "propertyNames": { "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$" }, "additionalProperties": { "oneOf": [{ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/finiteNumber" }, { "type": "null" }] } } } };
408
408
  const schema39 = { "type": "number", "minimum": -1.7976931348623157e+308, "maximum": 1.7976931348623157e+308 };
409
409
  function validate26(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate26.evaluated; if (evaluated0.dynamicProps) {
@@ -1990,7 +1990,7 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
1990
1990
  let data6 = data.period;
1991
1991
  if (data6 && typeof data6 == "object" && !Array.isArray(data6)) {
1992
1992
  if (data6.span === undefined) {
1993
- const err21 = { instancePath: instancePath + "/period", schemaPath: "#/$defs/timeSeriesPeriod/required", keyword: "required", params: { missingProperty: "span" }, message: "must have required property '" + "span" + "'" };
1993
+ const err21 = { instancePath: instancePath + "/period", schemaPath: "https://baron.dev/kline-scene/common.schema.json#/$defs/period/required", keyword: "required", params: { missingProperty: "span" }, message: "must have required property '" + "span" + "'" };
1994
1994
  if (vErrors === null) {
1995
1995
  vErrors = [err21];
1996
1996
  }
@@ -2000,7 +2000,7 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
2000
2000
  errors++;
2001
2001
  }
2002
2002
  if (data6.type === undefined) {
2003
- const err22 = { instancePath: instancePath + "/period", schemaPath: "#/$defs/timeSeriesPeriod/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property '" + "type" + "'" };
2003
+ const err22 = { instancePath: instancePath + "/period", schemaPath: "https://baron.dev/kline-scene/common.schema.json#/$defs/period/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property '" + "type" + "'" };
2004
2004
  if (vErrors === null) {
2005
2005
  vErrors = [err22];
2006
2006
  }
@@ -2011,7 +2011,7 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
2011
2011
  }
2012
2012
  for (const key2 in data6) {
2013
2013
  if (!((key2 === "span") || (key2 === "type"))) {
2014
- const err23 = { instancePath: instancePath + "/period", schemaPath: "#/$defs/timeSeriesPeriod/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" };
2014
+ const err23 = { instancePath: instancePath + "/period", schemaPath: "https://baron.dev/kline-scene/common.schema.json#/$defs/period/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" };
2015
2015
  if (vErrors === null) {
2016
2016
  vErrors = [err23];
2017
2017
  }
@@ -2024,7 +2024,7 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
2024
2024
  if (data6.span !== undefined) {
2025
2025
  let data7 = data6.span;
2026
2026
  if (!(((typeof data7 == "number") && (!(data7 % 1) && !isNaN(data7))) && (isFinite(data7)))) {
2027
- const err24 = { instancePath: instancePath + "/period/span", schemaPath: "#/$defs/timeSeriesPeriod/properties/span/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
2027
+ const err24 = { instancePath: instancePath + "/period/span", schemaPath: "https://baron.dev/kline-scene/common.schema.json#/$defs/period/properties/span/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
2028
2028
  if (vErrors === null) {
2029
2029
  vErrors = [err24];
2030
2030
  }
@@ -2035,7 +2035,7 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
2035
2035
  }
2036
2036
  if ((typeof data7 == "number") && (isFinite(data7))) {
2037
2037
  if (data7 > 100000 || isNaN(data7)) {
2038
- const err25 = { instancePath: instancePath + "/period/span", schemaPath: "#/$defs/timeSeriesPeriod/properties/span/maximum", keyword: "maximum", params: { comparison: "<=", limit: 100000 }, message: "must be <= 100000" };
2038
+ const err25 = { instancePath: instancePath + "/period/span", schemaPath: "https://baron.dev/kline-scene/common.schema.json#/$defs/period/properties/span/maximum", keyword: "maximum", params: { comparison: "<=", limit: 100000 }, message: "must be <= 100000" };
2039
2039
  if (vErrors === null) {
2040
2040
  vErrors = [err25];
2041
2041
  }
@@ -2045,7 +2045,7 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
2045
2045
  errors++;
2046
2046
  }
2047
2047
  if (data7 < 1 || isNaN(data7)) {
2048
- const err26 = { instancePath: instancePath + "/period/span", schemaPath: "#/$defs/timeSeriesPeriod/properties/span/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
2048
+ const err26 = { instancePath: instancePath + "/period/span", schemaPath: "https://baron.dev/kline-scene/common.schema.json#/$defs/period/properties/span/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
2049
2049
  if (vErrors === null) {
2050
2050
  vErrors = [err26];
2051
2051
  }
@@ -2059,7 +2059,7 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
2059
2059
  if (data6.type !== undefined) {
2060
2060
  let data8 = data6.type;
2061
2061
  if (!(((((((data8 === "second") || (data8 === "minute")) || (data8 === "hour")) || (data8 === "day")) || (data8 === "week")) || (data8 === "month")) || (data8 === "year"))) {
2062
- const err27 = { instancePath: instancePath + "/period/type", schemaPath: "#/$defs/timeSeriesPeriod/properties/type/enum", keyword: "enum", params: { allowedValues: schema33.properties.type.enum }, message: "must be equal to one of the allowed values" };
2062
+ const err27 = { instancePath: instancePath + "/period/type", schemaPath: "https://baron.dev/kline-scene/common.schema.json#/$defs/period/properties/type/enum", keyword: "enum", params: { allowedValues: schema34.properties.type.enum }, message: "must be equal to one of the allowed values" };
2063
2063
  if (vErrors === null) {
2064
2064
  vErrors = [err27];
2065
2065
  }
@@ -2071,7 +2071,7 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
2071
2071
  }
2072
2072
  }
2073
2073
  else {
2074
- const err28 = { instancePath: instancePath + "/period", schemaPath: "#/$defs/timeSeriesPeriod/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2074
+ const err28 = { instancePath: instancePath + "/period", schemaPath: "https://baron.dev/kline-scene/common.schema.json#/$defs/period/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2075
2075
  if (vErrors === null) {
2076
2076
  vErrors = [err28];
2077
2077
  }
@@ -2106,8 +2106,8 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
2106
2106
  }
2107
2107
  const len0 = data9.length;
2108
2108
  for (let i0 = 0; i0 < len0; i0++) {
2109
- if (!(validate21(data9[i0], { instancePath: instancePath + "/series/" + i0, parentData: data9, parentDataProperty: i0, rootData, dynamicAnchors }))) {
2110
- vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);
2109
+ if (!(validate22(data9[i0], { instancePath: instancePath + "/series/" + i0, parentData: data9, parentDataProperty: i0, rootData, dynamicAnchors }))) {
2110
+ vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);
2111
2111
  errors = vErrors.length;
2112
2112
  }
2113
2113
  }
package/dist/index.d.ts CHANGED
@@ -1,10 +1,23 @@
1
1
  /** 场景协议包版本;Scene version 仍保持 1。 */
2
- export declare const SCENE_PACKAGE_VERSION: "0.3.0";
2
+ export declare const SCENE_PACKAGE_VERSION: "0.4.0";
3
3
  export * from './canonical-json.js';
4
4
  export * from './canonicalize.js';
5
+ export * from './decimal-normalization.js';
6
+ export * from './drawing-canonical-json.js';
7
+ export * from './drawing-canonicalize.js';
8
+ export * from './drawing-errors.js';
9
+ export * from './drawing-semantic-validator.js';
10
+ export * from './drawing-validator.js';
11
+ export * from './drawable-workspace-canonical-json.js';
12
+ export * from './drawable-workspace-canonicalize.js';
13
+ export * from './drawable-workspace-errors.js';
14
+ export * from './drawable-workspace-semantic-validator.js';
15
+ export * from './drawable-workspace-validator.js';
5
16
  export * from './errors.js';
6
17
  export * from './generated/chart-scene.js';
18
+ export * from './generated/drawing-document.js';
7
19
  export * from './generated/schemas.js';
20
+ export type { DrawableWorkspaceDocument } from './generated/drawable-workspace.js';
8
21
  export * from './semantic-validator.js';
9
22
  export * from './generated/time-series-scene.js';
10
23
  export * from './time-series-canonical-json.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,eAAO,MAAM,qBAAqB,EAAG,OAAgB,CAAC;AAEtD,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,eAAO,MAAM,qBAAqB,EAAG,OAAgB,CAAC;AAEtD,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,YAAY,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACnF,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,21 @@
1
1
  /** 场景协议包版本;Scene version 仍保持 1。 */
2
- export const SCENE_PACKAGE_VERSION = '0.3.0';
2
+ export const SCENE_PACKAGE_VERSION = '0.4.0';
3
3
  export * from './canonical-json.js';
4
4
  export * from './canonicalize.js';
5
+ export * from './decimal-normalization.js';
6
+ export * from './drawing-canonical-json.js';
7
+ export * from './drawing-canonicalize.js';
8
+ export * from './drawing-errors.js';
9
+ export * from './drawing-semantic-validator.js';
10
+ export * from './drawing-validator.js';
11
+ export * from './drawable-workspace-canonical-json.js';
12
+ export * from './drawable-workspace-canonicalize.js';
13
+ export * from './drawable-workspace-errors.js';
14
+ export * from './drawable-workspace-semantic-validator.js';
15
+ export * from './drawable-workspace-validator.js';
5
16
  export * from './errors.js';
6
17
  export * from './generated/chart-scene.js';
18
+ export * from './generated/drawing-document.js';
7
19
  export * from './generated/schemas.js';
8
20
  export * from './semantic-validator.js';
9
21
  export * from './generated/time-series-scene.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baron1996/kline-scene-schema",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Strict ChartScene schema, types, validation, and canonical serialization.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -79,9 +79,51 @@
79
79
  "candle_stroke",
80
80
  "candle_up_stroke",
81
81
  "candle_down_stroke",
82
- "ohlc"
82
+ "ohlc",
83
+ "area"
83
84
  ]
84
85
  },
86
+ "area": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": [
90
+ "value",
91
+ "line",
92
+ "backgroundColor",
93
+ "smooth",
94
+ "pointVisible"
95
+ ],
96
+ "properties": {
97
+ "value": {
98
+ "const": "close"
99
+ },
100
+ "line": {
101
+ "type": "object",
102
+ "additionalProperties": false,
103
+ "required": [
104
+ "color",
105
+ "size"
106
+ ],
107
+ "properties": {
108
+ "color": {
109
+ "const": "rgba(41, 98, 255, 1)"
110
+ },
111
+ "size": {
112
+ "const": 2
113
+ }
114
+ }
115
+ },
116
+ "backgroundColor": {
117
+ "const": "rgba(0, 0, 0, 0)"
118
+ },
119
+ "smooth": {
120
+ "const": false
121
+ },
122
+ "pointVisible": {
123
+ "const": false
124
+ }
125
+ }
126
+ },
85
127
  "upColor": {
86
128
  "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
87
129
  },
@@ -109,6 +151,31 @@
109
151
  "noChangeWickColor": {
110
152
  "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/rgbaColor"
111
153
  }
154
+ },
155
+ "if": {
156
+ "properties": {
157
+ "type": {
158
+ "const": "area"
159
+ }
160
+ },
161
+ "required": [
162
+ "type"
163
+ ]
164
+ },
165
+ "then": {
166
+ "required": [
167
+ "area"
168
+ ],
169
+ "properties": {
170
+ "area": true
171
+ }
172
+ },
173
+ "else": {
174
+ "not": {
175
+ "required": [
176
+ "area"
177
+ ]
178
+ }
112
179
  }
113
180
  },
114
181
  "grid": {
@@ -32,7 +32,7 @@
32
32
  "$ref": "#/$defs/symbol"
33
33
  },
34
34
  "period": {
35
- "$ref": "#/$defs/period"
35
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/period"
36
36
  },
37
37
  "data": {
38
38
  "type": "array",
@@ -102,32 +102,6 @@
102
102
  }
103
103
  }
104
104
  },
105
- "period": {
106
- "type": "object",
107
- "additionalProperties": false,
108
- "required": [
109
- "span",
110
- "type"
111
- ],
112
- "properties": {
113
- "span": {
114
- "type": "integer",
115
- "minimum": 1,
116
- "maximum": 100000
117
- },
118
- "type": {
119
- "enum": [
120
- "second",
121
- "minute",
122
- "hour",
123
- "day",
124
- "week",
125
- "month",
126
- "year"
127
- ]
128
- }
129
- }
130
- },
131
105
  "viewport": {
132
106
  "type": "object",
133
107
  "additionalProperties": false,
@@ -9,6 +9,32 @@
9
9
  "maxLength": 128,
10
10
  "pattern": "^[A-Za-z][A-Za-z0-9._:-]*$"
11
11
  },
12
+ "period": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": [
16
+ "span",
17
+ "type"
18
+ ],
19
+ "properties": {
20
+ "span": {
21
+ "type": "integer",
22
+ "minimum": 1,
23
+ "maximum": 100000
24
+ },
25
+ "type": {
26
+ "enum": [
27
+ "second",
28
+ "minute",
29
+ "hour",
30
+ "day",
31
+ "week",
32
+ "month",
33
+ "year"
34
+ ]
35
+ }
36
+ }
37
+ },
12
38
  "finiteNumber": {
13
39
  "type": "number",
14
40
  "minimum": -1.7976931348623157e+308,
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://baron.dev/kline-scene/drawable-workspace.schema.json",
4
+ "title": "DrawableWorkspaceDocument",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema",
9
+ "version",
10
+ "runtime",
11
+ "scene",
12
+ "drawings",
13
+ "binding",
14
+ "metadata"
15
+ ],
16
+ "properties": {
17
+ "schema": {
18
+ "const": "@baron1996/drawable-workspace"
19
+ },
20
+ "version": {
21
+ "const": 1
22
+ },
23
+ "runtime": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": [
27
+ "engine",
28
+ "engineVersion",
29
+ "workspaceRuntimeVersion"
30
+ ],
31
+ "properties": {
32
+ "engine": {
33
+ "const": "klinecharts"
34
+ },
35
+ "engineVersion": {
36
+ "const": "10.0.0"
37
+ },
38
+ "workspaceRuntimeVersion": {
39
+ "const": "1.0.0"
40
+ }
41
+ }
42
+ },
43
+ "scene": {
44
+ "oneOf": [
45
+ {
46
+ "title": "ChartWorkspaceScene",
47
+ "type": "object",
48
+ "additionalProperties": false,
49
+ "required": [
50
+ "kind",
51
+ "document"
52
+ ],
53
+ "properties": {
54
+ "kind": {
55
+ "const": "chart"
56
+ },
57
+ "document": {
58
+ "$ref": "https://baron.dev/kline-scene/chart-scene.schema.json"
59
+ }
60
+ }
61
+ },
62
+ {
63
+ "title": "TimeSeriesWorkspaceScene",
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": [
67
+ "kind",
68
+ "document"
69
+ ],
70
+ "properties": {
71
+ "kind": {
72
+ "const": "time-series"
73
+ },
74
+ "document": {
75
+ "$ref": "https://baron.dev/kline-scene/time-series-scene.schema.json"
76
+ }
77
+ }
78
+ }
79
+ ]
80
+ },
81
+ "drawings": {
82
+ "$ref": "https://baron.dev/kline-scene/drawing-document.schema.json"
83
+ },
84
+ "binding": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": [
88
+ "scopeKey",
89
+ "timezone",
90
+ "valueAxes"
91
+ ],
92
+ "properties": {
93
+ "scopeKey": {
94
+ "type": "string",
95
+ "minLength": 1,
96
+ "maxLength": 256
97
+ },
98
+ "timezone": {
99
+ "$ref": "https://baron.dev/kline-scene/drawing-document.schema.json#/$defs/timezone"
100
+ },
101
+ "valueAxes": {
102
+ "$ref": "https://baron.dev/kline-scene/drawing-document.schema.json#/$defs/valueAxes"
103
+ }
104
+ }
105
+ },
106
+ "metadata": {
107
+ "$ref": "https://baron.dev/kline-scene/common.schema.json#/$defs/metadata"
108
+ }
109
+ }
110
+ }