@visactor/vstory 0.0.5-alpha.4 → 0.0.6

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 (81) hide show
  1. package/cjs/dsl/constant/index.js +1 -1
  2. package/cjs/dsl/story-executor/index.js +0 -2
  3. package/cjs/dsl/story-processor/index.js +1 -1
  4. package/cjs/dsl/story-processor/processor.js +1 -1
  5. package/cjs/dsl/types/Datum.js +1 -1
  6. package/cjs/dsl/types/index.js +1 -1
  7. package/cjs/dsl/utils/datum.js +1 -1
  8. package/cjs/dsl/utils/flicker.js +1 -2
  9. package/cjs/edit/edit-component/base-selection.js +1 -1
  10. package/cjs/edit/edit-component/box-selection.js +1 -1
  11. package/cjs/edit/edit-component/chart-selection.js +1 -1
  12. package/cjs/edit/edit-component/common.js +2 -0
  13. package/cjs/edit/edit-component/image-selection.js +1 -1
  14. package/cjs/edit/edit-component/index.js +1 -1
  15. package/cjs/edit/edit-component/layer-edit.js +2 -0
  16. package/cjs/edit/edit-component/rect-selection.js +1 -1
  17. package/cjs/edit/edit-component/richtext-selection-common.js +1 -1
  18. package/cjs/edit/edit-component/richtext-selection.js +1 -1
  19. package/cjs/edit/edit-component/shape-selection.js +1 -1
  20. package/cjs/edit/edit-component/text-selection.js +2 -1
  21. package/cjs/interface/type.js +2 -1
  22. package/cjs/player/encode.js +2 -0
  23. package/cjs/player/interface/player.js +1 -1
  24. package/cjs/player/interface/scheduler.js +1 -1
  25. package/cjs/player/processor/common-processor.js +0 -2
  26. package/cjs/player/processor/processor-item.js +1 -1
  27. package/cjs/story/character/chart/character.js +2 -2
  28. package/cjs/story/character/chart/character.js.map +1 -1
  29. package/cjs/story/character/chart/graphic/vchart-graphic.d.ts +2 -2
  30. package/cjs/story/character/chart/graphic/vchart-graphic.js +6 -7
  31. package/cjs/story/character/chart/graphic/vchart-graphic.js.map +1 -1
  32. package/cjs/story/interface/runtime-interface.d.ts +0 -1
  33. package/cjs/story/interface/runtime-interface.js.map +1 -1
  34. package/cjs/story/story.d.ts +0 -1
  35. package/cjs/story/story.js +0 -3
  36. package/cjs/story/story.js.map +1 -1
  37. package/cjs/story/utils/chart.d.ts +1 -2
  38. package/cjs/story/utils/chart.js +2 -30
  39. package/cjs/story/utils/chart.js.map +1 -1
  40. package/dist/index.js +134 -188
  41. package/dist/index.min.js +3 -3
  42. package/es/dsl/constant/index.js +1 -1
  43. package/es/dsl/story-executor/index.js +0 -2
  44. package/es/dsl/story-processor/index.js +1 -1
  45. package/es/dsl/story-processor/processor.js +1 -1
  46. package/es/dsl/types/Datum.js +1 -1
  47. package/es/dsl/types/index.js +1 -1
  48. package/es/dsl/utils/datum.js +1 -1
  49. package/es/dsl/utils/flicker.js +1 -2
  50. package/es/edit/edit-component/base-selection.js +1 -1
  51. package/es/edit/edit-component/box-selection.js +1 -1
  52. package/es/edit/edit-component/chart-selection.js +1 -1
  53. package/es/edit/edit-component/common.js +2 -0
  54. package/es/edit/edit-component/image-selection.js +1 -1
  55. package/es/edit/edit-component/index.js +1 -1
  56. package/es/edit/edit-component/layer-edit.js +2 -0
  57. package/es/edit/edit-component/rect-selection.js +1 -1
  58. package/es/edit/edit-component/richtext-selection-common.js +1 -1
  59. package/es/edit/edit-component/richtext-selection.js +1 -1
  60. package/es/edit/edit-component/shape-selection.js +1 -1
  61. package/es/edit/edit-component/text-selection.js +2 -1
  62. package/es/interface/type.js +2 -1
  63. package/es/player/encode.js +2 -0
  64. package/es/player/interface/player.js +1 -1
  65. package/es/player/interface/scheduler.js +1 -1
  66. package/es/player/processor/common-processor.js +0 -2
  67. package/es/player/processor/processor-item.js +1 -1
  68. package/es/story/character/chart/character.js +2 -4
  69. package/es/story/character/chart/character.js.map +1 -1
  70. package/es/story/character/chart/graphic/vchart-graphic.d.ts +2 -2
  71. package/es/story/character/chart/graphic/vchart-graphic.js +5 -9
  72. package/es/story/character/chart/graphic/vchart-graphic.js.map +1 -1
  73. package/es/story/interface/runtime-interface.d.ts +0 -1
  74. package/es/story/interface/runtime-interface.js.map +1 -1
  75. package/es/story/story.d.ts +0 -1
  76. package/es/story/story.js +0 -3
  77. package/es/story/story.js.map +1 -1
  78. package/es/story/utils/chart.d.ts +1 -2
  79. package/es/story/utils/chart.js +1 -29
  80. package/es/story/utils/chart.js.map +1 -1
  81. package/package.json +5 -5
@@ -21,4 +21,4 @@ function(StoryChartType) {
21
21
  function(StoryChartComponentType) {
22
22
  StoryChartComponentType.MARK_POINT = "markPoint", StoryChartComponentType.TITLE = "title";
23
23
  }(StoryChartComponentType = exports.StoryChartComponentType || (exports.StoryChartComponentType = {}));
24
- //# sourceMappingURL=index.js.map
24
+ //# sourceMappingURL=index.js.map
@@ -1,3 +1 @@
1
-
2
-
3
1
  //# sourceMappingURL=index.js.map
@@ -27,4 +27,4 @@ Object.defineProperty(exports, "processorMap", {
27
27
  return processorMap_1.processorMap;
28
28
  }
29
29
  });
30
- //# sourceMappingURL=index.js.map
30
+ //# sourceMappingURL=index.js.map
@@ -67,4 +67,4 @@ class ActionProcessor {
67
67
  }
68
68
 
69
69
  exports.ActionProcessor = ActionProcessor, ActionProcessor._instance = null;
70
- //# sourceMappingURL=processor.js.map
70
+ //# sourceMappingURL=processor.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=Datum.js.map
6
+ //# sourceMappingURL=Datum.js.map
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), __exportStar(require("./common"), exports), __exportStar(require("./chart"), exports),
21
21
  __exportStar(require("./graphic"), exports);
22
- //# sourceMappingURL=index.js.map
22
+ //# sourceMappingURL=index.js.map
@@ -13,4 +13,4 @@ const vutils_1 = require("@visactor/vutils"), isDatumEqual = (source, target) =>
13
13
  };
14
14
 
15
15
  exports.isDatumEqual = isDatumEqual;
16
- //# sourceMappingURL=datum.js.map
16
+ //# sourceMappingURL=datum.js.map
@@ -14,5 +14,4 @@ const flickerEffect = group => {
14
14
  }));
15
15
  };
16
16
 
17
- exports.flickerEffect = flickerEffect;
18
- //# sourceMappingURL=flicker.js.map
17
+ exports.flickerEffect = flickerEffect;
@@ -91,4 +91,4 @@ class BaseSelection {
91
91
  }
92
92
 
93
93
  exports.BaseSelection = BaseSelection;
94
- //# sourceMappingURL=base-selection.js.map
94
+ //# sourceMappingURL=base-selection.js.map
@@ -24,4 +24,4 @@ class BoxSelection extends base_selection_1.BaseSelection {
24
24
  }
25
25
 
26
26
  exports.BoxSelection = BoxSelection;
27
- //# sourceMappingURL=box-selection.js.map
27
+ //# sourceMappingURL=box-selection.js.map
@@ -36,4 +36,4 @@ class ChartSelection extends base_selection_1.BaseSelection {
36
36
  }
37
37
 
38
38
  exports.ChartSelection = ChartSelection;
39
- //# sourceMappingURL=chart-selection.js.map
39
+ //# sourceMappingURL=chart-selection.js.map
@@ -1 +1,3 @@
1
+
2
+
1
3
  //# sourceMappingURL=common.js.map
@@ -13,4 +13,4 @@ class ImageSelection extends rect_selection_1.RectSelection {
13
13
  }
14
14
 
15
15
  exports.ImageSelection = ImageSelection;
16
- //# sourceMappingURL=image-selection.js.map
16
+ //# sourceMappingURL=image-selection.js.map
@@ -13,4 +13,4 @@ function loadAllSelection() {
13
13
  }
14
14
 
15
15
  exports.loadAllSelection = loadAllSelection;
16
- //# sourceMappingURL=index.js.map
16
+ //# sourceMappingURL=index.js.map
@@ -1 +1,3 @@
1
+
2
+
1
3
  //# sourceMappingURL=layer-edit.js.map
@@ -27,4 +27,4 @@ class RectSelection extends richtext_selection_common_1.RichTextSelectionCommon
27
27
  }
28
28
 
29
29
  exports.RectSelection = RectSelection;
30
- //# sourceMappingURL=rect-selection.js.map
30
+ //# sourceMappingURL=rect-selection.js.map
@@ -32,4 +32,4 @@ class RichTextSelectionCommon extends base_selection_1.BaseSelection {
32
32
  }
33
33
 
34
34
  exports.RichTextSelectionCommon = RichTextSelectionCommon, (0, vutils_1.mixin)(RichTextSelectionCommon, richtext_1.RichTextMixin);
35
- //# sourceMappingURL=richtext-selection-common.js.map
35
+ //# sourceMappingURL=richtext-selection-common.js.map
@@ -30,4 +30,4 @@ class RichTextSelection extends base_selection_1.BaseSelection {
30
30
  }
31
31
 
32
32
  exports.RichTextSelection = RichTextSelection;
33
- //# sourceMappingURL=richtext-selection.js.map
33
+ //# sourceMappingURL=richtext-selection.js.map
@@ -33,4 +33,4 @@ class ShapeSelection extends rect_selection_1.RectSelection {
33
33
  }
34
34
 
35
35
  exports.ShapeSelection = ShapeSelection;
36
- //# sourceMappingURL=shape-selection.js.map
36
+ //# sourceMappingURL=shape-selection.js.map
@@ -19,4 +19,5 @@ class TextSelection extends base_selection_1.BaseSelection {
19
19
  }
20
20
  }
21
21
 
22
- exports.TextSelection = TextSelection;
22
+ exports.TextSelection = TextSelection;
23
+ //# sourceMappingURL=text-selection.js.map
@@ -2,4 +2,5 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- });
5
+ });
6
+ //# sourceMappingURL=type.js.map
@@ -1 +1,3 @@
1
+
2
+
1
3
  //# sourceMappingURL=encode.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=player.js.map
6
+ //# sourceMappingURL=player.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=scheduler.js.map
6
+ //# sourceMappingURL=scheduler.js.map
@@ -1,3 +1 @@
1
-
2
-
3
1
  //# sourceMappingURL=common-processor.js.map
@@ -21,4 +21,4 @@ class ActionProcessorItem {
21
21
  }
22
22
 
23
23
  exports.ActionProcessorItem = ActionProcessorItem;
24
- //# sourceMappingURL=processor-item.js.map
24
+ //# sourceMappingURL=processor-item.js.map
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.CharacterChart = void 0;
6
6
 
7
- const common_spec_1 = require("./runtime/common-spec"), component_spec_1 = require("./runtime/component-spec"), vutils_1 = require("@visactor/vutils"), vchart_1 = require("@visactor/vchart"), vchart_graphic_1 = require("./graphic/vchart-graphic"), character_1 = require("../visactor/character"), spec_process_1 = require("./spec-process/spec-process"), data_temp_transform_1 = require("./spec-process/data-temp-transform"), series_spec_1 = require("./runtime/series-spec"), layout_1 = require("../../utils/layout"), vchart_pick_1 = require("../../utils/vchart-pick"), chart_1 = require("../../utils/chart");
7
+ const common_spec_1 = require("./runtime/common-spec"), component_spec_1 = require("./runtime/component-spec"), vutils_1 = require("@visactor/vutils"), vchart_1 = require("@visactor/vchart"), vchart_graphic_1 = require("./graphic/vchart-graphic"), character_1 = require("../visactor/character"), spec_process_1 = require("./spec-process/spec-process"), data_temp_transform_1 = require("./spec-process/data-temp-transform"), series_spec_1 = require("./runtime/series-spec"), layout_1 = require("../../utils/layout"), vchart_pick_1 = require("../../utils/vchart-pick");
8
8
 
9
9
  class CharacterChart extends character_1.CharacterVisactor {
10
10
  constructor() {
@@ -42,7 +42,7 @@ class CharacterChart extends character_1.CharacterVisactor {
42
42
  ticker: this._option.canvas.getStage().ticker,
43
43
  visibleAll: !1
44
44
  }, null !== (_a = this._spec.options.panel) && void 0 !== _a ? _a : {}), {
45
- chartInitOptions: (0, chart_1.mergeChartOption)({
45
+ chartInitOptions: (0, vutils_1.merge)({
46
46
  animation: !0,
47
47
  disableTriggerEvent: !0,
48
48
  performanceHook: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/chart/character.ts"],"names":[],"mappings":";;;AAAA,uDAA0D;AAC1D,6DAAgE;AAEhE,6CAAoD;AACpD,6CAA0C;AAE1C,6DAAiD;AACjD,qDAA0D;AAC1D,8DAA0D;AAC1D,4EAA4E;AAG5E,uDAA0D;AAG1D,+CAAyD;AACzD,yDAAiE;AACjE,6CAAqD;AAErD,MAAa,cAAe,SAAQ,6BAAiB;IAArD;;QAQW,iBAAY,GAAG,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CAClE,CAAC","file":"character.js","sourcesContent":["import { CommonSpecRuntime } from './runtime/common-spec';\nimport { ComponentSpecRuntime } from './runtime/component-spec';\nimport type { IChartCharacterRuntimeConstructor } from './runtime/interface';\nimport { cloneDeep, merge } from '@visactor/vutils';\nimport { VChart } from '@visactor/vchart';\nimport type { IChartCharacterSpec } from '../dsl-interface';\nimport { Chart } from './graphic/vchart-graphic';\nimport { CharacterVisactor } from '../visactor/character';\nimport { SpecProcess } from './spec-process/spec-process';\nimport { ChartDataTempTransform } from './spec-process/data-temp-transform';\nimport type { ITicker } from '@visactor/vrender';\nimport type { IChartTemp } from './temp/interface';\nimport { SeriesSpecRuntime } from './runtime/series-spec';\nimport type { StoryEvent } from '../../interface/runtime-interface';\nimport type { ICharacterPickInfo } from '../runtime-interface';\nimport { getLayoutFromWidget } from '../../utils/layout';\nimport { getChartModelWithEvent } from '../../utils/vchart-pick';\nimport { mergeChartOption } from '../../utils/chart';\n\nexport class CharacterChart extends CharacterVisactor {\n static type = 'CharacterChart';\n static RunTime: IChartCharacterRuntimeConstructor[] = [\n ComponentSpecRuntime as unknown as IChartCharacterRuntimeConstructor,\n CommonSpecRuntime as unknown as IChartCharacterRuntimeConstructor,\n SeriesSpecRuntime as unknown as IChartCharacterRuntimeConstructor\n ];\n\n readonly visActorType = 'chart';\n\n protected declare _specProcess: SpecProcess;\n protected _ticker: ITicker;\n\n declare _graphic: Chart;\n\n protected declare _spec: IChartCharacterSpec;\n get spec() {\n return this._spec;\n }\n\n protected _initSpecProcess(): void {\n this._specProcess = new SpecProcess(this as any, ChartDataTempTransform, this.onSpecReady);\n }\n\n protected _initRuntime(): void {\n CharacterChart.RunTime.forEach(R => {\n this._runtime.push(new R(this));\n });\n }\n\n protected _parserSpec(): void {\n this._specProcess.updateConfig(this._spec);\n }\n protected _initGraphics(): void {\n const { spec, viewBox } = this._getChartOption();\n // @ts-ignore\n this._graphic = new Chart({\n renderCanvas: this._option.canvas.getCanvas(),\n spec,\n ClassType: VChart,\n vchart: null,\n zIndex: this._spec.zIndex,\n mode: 'desktop-browser',\n dpr: window.devicePixelRatio,\n interactive: false,\n autoRender: false,\n disableDirtyBounds: true,\n viewBox,\n ticker: this._option.canvas.getStage().ticker,\n visibleAll: false,\n ...(this._spec.options.panel ?? {}),\n chartInitOptions: mergeChartOption(\n {\n animation: true,\n disableTriggerEvent: true,\n performanceHook: {\n afterInitializeChart: () => {\n (<IChartTemp>this.specProcess.dataTempTransform?.specTemp)?.afterInitializeChart({ character: this });\n this._runtime.forEach(r => r.afterInitializeChart?.());\n },\n afterVRenderDraw: () => {\n this._runtime.forEach(r => r.afterVRenderDraw?.());\n }\n }\n },\n this._spec.options.initOption ?? {}\n )\n });\n this.option.graphicParent.add(this._graphic as any);\n }\n\n setAttributes(attr: Record<string, any>): void {\n // character 的属性\n if (attr.position) {\n this._spec.position = attr.position;\n // 位置属性\n this._graphic.updateViewBox(this.getViewBoxFromSpec().viewBox);\n }\n }\n getViewBoxFromSpec() {\n const layout = getLayoutFromWidget(this._spec.position);\n const viewBox = {\n x1: layout.x,\n x2: layout.x + layout.width,\n y1: layout.y,\n y2: layout.y + layout.height\n };\n return { layout, viewBox };\n }\n\n private _getChartOption() {\n const { layout, viewBox } = this.getViewBoxFromSpec();\n const spec = cloneDeep(this._specProcess.getVisSpec() ?? this._spec.options.spec);\n spec.width = layout.width;\n spec.height = layout.height;\n return {\n viewBox,\n spec\n };\n }\n\n protected _afterRender(): void {\n // console.log('afterRender');\n return;\n }\n protected _updateVisactorSpec(): void {\n this._graphic?.updateSpec(this._specProcess.getVisSpec());\n }\n\n clearCharacter(): void {\n this._graphic.vProduct.release();\n this._graphic.parent.removeChild(this._graphic);\n }\n\n tickTo(t: number): void {\n this._ticker.tickAt(t);\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n if (!(event.detailPath ?? event.path).some(g => g === this._graphic)) {\n return false;\n }\n const chartPath = event.detailPath[event.detailPath.length - 1];\n const result = getChartModelWithEvent(this._graphic.vProduct, event);\n if (!result) {\n // 点击到图表的空白区域\n if (this._graphic.pointInViewBox((event as any).canvasX, (event as any).canvasY)) {\n return {\n part: 'null',\n graphic: null,\n modelInfo: null,\n graphicType: 'null'\n };\n }\n return false;\n }\n const graphic = chartPath?.[chartPath.length - 1];\n return {\n part: result.type,\n modelInfo: result,\n graphic,\n graphicType: graphic.type\n };\n }\n\n release(): void {\n this.option.graphicParent.removeChild(this._graphic as any);\n this._graphic.release && this._graphic.release();\n }\n\n private _reflow() {\n if (!this._graphic) {\n this._initGraphics();\n return;\n }\n const { spec } = this._getChartOption();\n this._graphic.updateSpec(spec);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/chart/character.ts"],"names":[],"mappings":";;;AAAA,uDAA0D;AAC1D,6DAAgE;AAEhE,6CAAoD;AACpD,6CAA0C;AAE1C,6DAAiD;AACjD,qDAA0D;AAC1D,8DAA0D;AAC1D,4EAA4E;AAG5E,uDAA0D;AAG1D,+CAAyD;AACzD,yDAAiE;AAEjE,MAAa,cAAe,SAAQ,6BAAiB;IAArD;;QAQW,iBAAY,GAAG,OAAO,CAAC;IAsJlC,CAAC;IA9IC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAES,gBAAgB;QACxB,IAAI,CAAC,YAAY,GAAG,IAAI,0BAAW,CAAC,IAAW,EAAE,4CAAsB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7F,CAAC;IAES,YAAY;QACpB,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACjC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAES,WAAW;QACnB,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IACS,aAAa;;QACrB,MAAM,EAAE,IAAI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IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS,EAAE,MAAM;YACjB,OAAO;YACP,WAAW,EAAE,OAAO,CAAC,IAAI;SAC1B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,QAAe,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnD,CAAC;IAEO,OAAO;QACb,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,OAAO;SACR;QACD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;;AA7JH,wCA8JC;AA7JQ,mBAAI,GAAG,gBAAgB,CAAC;AACxB,sBAAO,GAAwC;IACpD,qCAAoE;IACpE,+BAAiE;IACjE,+BAAiE;CAClE,CAAC","file":"character.js","sourcesContent":["import { CommonSpecRuntime } from './runtime/common-spec';\nimport { ComponentSpecRuntime } from './runtime/component-spec';\nimport type { IChartCharacterRuntimeConstructor } from './runtime/interface';\nimport { cloneDeep, merge } from '@visactor/vutils';\nimport { VChart } from '@visactor/vchart';\nimport type { IChartCharacterSpec } from '../dsl-interface';\nimport { Chart } from './graphic/vchart-graphic';\nimport { CharacterVisactor } from '../visactor/character';\nimport { SpecProcess } from './spec-process/spec-process';\nimport { ChartDataTempTransform } from './spec-process/data-temp-transform';\nimport type { ITicker } from '@visactor/vrender';\nimport type { IChartTemp } from './temp/interface';\nimport { SeriesSpecRuntime } from './runtime/series-spec';\nimport type { StoryEvent } from '../../interface/runtime-interface';\nimport type { ICharacterPickInfo } from '../runtime-interface';\nimport { getLayoutFromWidget } from '../../utils/layout';\nimport { getChartModelWithEvent } from '../../utils/vchart-pick';\n\nexport class CharacterChart extends CharacterVisactor {\n static type = 'CharacterChart';\n static RunTime: IChartCharacterRuntimeConstructor[] = [\n ComponentSpecRuntime as unknown as IChartCharacterRuntimeConstructor,\n CommonSpecRuntime as unknown as IChartCharacterRuntimeConstructor,\n SeriesSpecRuntime as unknown as IChartCharacterRuntimeConstructor\n ];\n\n readonly visActorType = 'chart';\n\n protected declare _specProcess: SpecProcess;\n protected _ticker: ITicker;\n\n declare _graphic: Chart;\n\n protected declare _spec: IChartCharacterSpec;\n get spec() {\n return this._spec;\n }\n\n protected _initSpecProcess(): void {\n this._specProcess = new SpecProcess(this as any, ChartDataTempTransform, this.onSpecReady);\n }\n\n protected _initRuntime(): void {\n CharacterChart.RunTime.forEach(R => {\n this._runtime.push(new R(this));\n });\n }\n\n protected _parserSpec(): void {\n this._specProcess.updateConfig(this._spec);\n }\n protected _initGraphics(): void {\n const { spec, viewBox } = this._getChartOption();\n // @ts-ignore\n this._graphic = new Chart({\n renderCanvas: this._option.canvas.getCanvas(),\n spec,\n ClassType: VChart,\n vchart: null,\n zIndex: this._spec.zIndex,\n mode: 'desktop-browser',\n dpr: window.devicePixelRatio,\n interactive: false,\n autoRender: false,\n disableDirtyBounds: true,\n viewBox,\n ticker: this._option.canvas.getStage().ticker,\n visibleAll: false,\n ...(this._spec.options.panel ?? {}),\n chartInitOptions: merge(\n {\n animation: true,\n disableTriggerEvent: true,\n performanceHook: {\n afterInitializeChart: () => {\n (<IChartTemp>this.specProcess.dataTempTransform?.specTemp)?.afterInitializeChart({ character: this });\n this._runtime.forEach(r => r.afterInitializeChart?.());\n },\n afterVRenderDraw: () => {\n this._runtime.forEach(r => r.afterVRenderDraw?.());\n }\n }\n },\n this._spec.options.initOption ?? {}\n )\n });\n this.option.graphicParent.add(this._graphic as any);\n }\n\n setAttributes(attr: Record<string, any>): void {\n // character 的属性\n if (attr.position) {\n this._spec.position = attr.position;\n // 位置属性\n this._graphic.updateViewBox(this.getViewBoxFromSpec().viewBox);\n }\n }\n getViewBoxFromSpec() {\n const layout = getLayoutFromWidget(this._spec.position);\n const viewBox = {\n x1: layout.x,\n x2: layout.x + layout.width,\n y1: layout.y,\n y2: layout.y + layout.height\n };\n return { layout, viewBox };\n }\n\n private _getChartOption() {\n const { layout, viewBox } = this.getViewBoxFromSpec();\n const spec = cloneDeep(this._specProcess.getVisSpec() ?? this._spec.options.spec);\n spec.width = layout.width;\n spec.height = layout.height;\n return {\n viewBox,\n spec\n };\n }\n\n protected _afterRender(): void {\n // console.log('afterRender');\n return;\n }\n protected _updateVisactorSpec(): void {\n this._graphic?.updateSpec(this._specProcess.getVisSpec());\n }\n\n clearCharacter(): void {\n this._graphic.vProduct.release();\n this._graphic.parent.removeChild(this._graphic);\n }\n\n tickTo(t: number): void {\n this._ticker.tickAt(t);\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n if (!(event.detailPath ?? event.path).some(g => g === this._graphic)) {\n return false;\n }\n const chartPath = event.detailPath[event.detailPath.length - 1];\n const result = getChartModelWithEvent(this._graphic.vProduct, event);\n if (!result) {\n // 点击到图表的空白区域\n if (this._graphic.pointInViewBox((event as any).canvasX, (event as any).canvasY)) {\n return {\n part: 'null',\n graphic: null,\n modelInfo: null,\n graphicType: 'null'\n };\n }\n return false;\n }\n const graphic = chartPath?.[chartPath.length - 1];\n return {\n part: result.type,\n modelInfo: result,\n graphic,\n graphicType: graphic.type\n };\n }\n\n release(): void {\n this.option.graphicParent.removeChild(this._graphic as any);\n this._graphic.release && this._graphic.release();\n }\n\n private _reflow() {\n if (!this._graphic) {\n this._initGraphics();\n return;\n }\n const { spec } = this._getChartOption();\n this._graphic.updateSpec(spec);\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { IVisactorGraphic } from '../../visactor/interface';
2
2
  import { type AABBBounds, type IAABBBounds, type IBoundsLike } from '@visactor/vutils';
3
- import type { IInitOption, ISpec, IVChart } from '@visactor/vchart';
3
+ import type { ISpec, IVChart } from '@visactor/vchart';
4
4
  import type { GraphicType, IGroupGraphicAttribute, ITicker } from '@visactor/vrender';
5
5
  import { Group } from '@visactor/vrender';
6
6
  export interface IChartGraphicAttribute extends IGroupGraphicAttribute {
@@ -8,7 +8,7 @@ export interface IChartGraphicAttribute extends IGroupGraphicAttribute {
8
8
  spec: any;
9
9
  ClassType: any;
10
10
  vchart: IVChart;
11
- mode: IInitOption['mode'];
11
+ mode: string;
12
12
  modeParams?: any;
13
13
  dpr: number;
14
14
  interactive: boolean;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.Chart = exports.CHART_NUMBER_TYPE = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), vrender_1 = require("@visactor/vrender"), space_1 = require("../../../../util/space"), chart_1 = require("../../../utils/chart"), VIEW_BOX_EXPEND = 4;
7
+ const vutils_1 = require("@visactor/vutils"), vrender_1 = require("@visactor/vrender"), space_1 = require("../../../../util/space");
8
8
 
9
9
  exports.CHART_NUMBER_TYPE = (0, vrender_1.genNumberType)();
10
10
 
@@ -42,8 +42,7 @@ class Chart extends vrender_1.Group {
42
42
  x2: 100,
43
43
  y2: 100
44
44
  }, this.drawTag = !1, this._boundsChangeTag = !0, this.numberType = exports.CHART_NUMBER_TYPE,
45
- params.vchart ? this._vchart = params.vchart : params.vchart = this._vchart = new params.ClassType(params.spec, (0,
46
- chart_1.mergeChartOption)({
45
+ params.vchart ? this._vchart = params.vchart : params.vchart = this._vchart = new params.ClassType(params.spec, Object.assign({
47
46
  renderCanvas: params.renderCanvas,
48
47
  mode: params.mode,
49
48
  modeParams: params.modeParams,
@@ -109,9 +108,9 @@ class Chart extends vrender_1.Group {
109
108
  }
110
109
  _updateViewBox() {
111
110
  if (!this._vchart) return;
112
- this._boundsChangeTag = !0, this._vchart.resize(this._globalViewBox.x2 - this._globalViewBox.x1, this._globalViewBox.y2 - this._globalViewBox.y1);
111
+ this._boundsChangeTag = !0;
113
112
  const rootBounds = this._getVChartRootMarkBounds();
114
- this._vchart.getStage().defaultLayer.translateTo(4 - rootBounds.x1, 4 - rootBounds.y1),
113
+ this._vchart.getStage().defaultLayer.translateTo(-rootBounds.x1, -rootBounds.y1),
115
114
  this._BoundsViewBox = rootBounds;
116
115
  const viewBox = Object.assign({}, this._globalViewBox);
117
116
  this.setAttributes({
@@ -122,10 +121,10 @@ class Chart extends vrender_1.Group {
122
121
  }), this._localViewBox.x1 = -rootBounds.x1, this._localViewBox.y1 = -rootBounds.y1,
123
122
  this._localViewBox.x2 += -rootBounds.x1, this._localViewBox.y2 += -rootBounds.y1,
124
123
  viewBox.x2 -= viewBox.x1, viewBox.y2 -= viewBox.y1, viewBox.x1 = 0, viewBox.y1 = 0,
125
- this._vchart.updateViewBox(viewBox);
124
+ this._vchart.resize(viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1), this._vchart.updateViewBox(viewBox);
126
125
  const renderViewBox = Object.assign({}, rootBounds);
127
126
  renderViewBox.x2 -= renderViewBox.x1, renderViewBox.y2 -= renderViewBox.y1, renderViewBox.x1 = 0,
128
- renderViewBox.y1 = 0, renderViewBox.x2 += 8, renderViewBox.y2 += 8, this._vchart._compiler._view.renderer.setViewBox(renderViewBox, !0);
127
+ renderViewBox.y1 = 0, this._vchart._compiler._view.renderer.setViewBox(renderViewBox, !0);
129
128
  }
130
129
  release() {
131
130
  this._vchart && this._vchart.release();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/chart/graphic/vchart-graphic.ts"],"names":[],"mappings":";;;AACA,6CAA+F;AAG/F,+CAAyD;AACzD,kDAAyD;AACzD,gDAAwD;AAExD,MAAM,eAAe,GAAG,CAAC,CAAC;AAoBb,QAAA,iBAAiB,GAAG,IAAA,uBAAa,GAAE,CAAC;AAGjD,MAAa,KAAM,SAAQ,eAAK;IAQ9B,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC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AE,CAAC;QACxC,aAAa,CAAC,EAAE,IAAI,aAAa,CAAC,EAAE,CAAC;QACrC,aAAa,CAAC,EAAE,IAAI,aAAa,CAAC,EAAE,CAAC;QACrC,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC;QACrB,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC;QACrB,aAAa,CAAC,EAAE,IAAI,eAAe,GAAG,CAAC,CAAC;QACxC,aAAa,CAAC,EAAE,IAAI,eAAe,GAAG,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;CACF;AAtMD,sBAsMC","file":"vchart-graphic.js","sourcesContent":["import type { IVisactorGraphic } from '../../visactor/interface';\nimport { Bounds, type AABBBounds, type IAABBBounds, type IBoundsLike } from '@visactor/vutils';\nimport type { IInitOption, ISpec, IVChart } from '@visactor/vchart';\nimport type { GraphicType, IGroupGraphicAttribute, ITicker } from '@visactor/vrender';\nimport { genNumberType, Group } from '@visactor/vrender';\nimport { isPointInBounds } from '../../../../util/space';\nimport { mergeChartOption } from '../../../utils/chart';\n\nconst VIEW_BOX_EXPEND = 4;\n\nexport interface IChartGraphicAttribute extends IGroupGraphicAttribute {\n renderCanvas: HTMLCanvasElement;\n spec: any;\n ClassType: any;\n vchart: IVChart;\n mode: IInitOption['mode'];\n modeParams?: any;\n dpr: number;\n interactive: boolean;\n animation: boolean;\n disableTriggerEvent: boolean;\n disableDirtyBounds: boolean;\n viewBox: IBoundsLike;\n ticker?: ITicker;\n autoRender?: boolean;\n chartInitOptions?: any;\n}\n\nexport const CHART_NUMBER_TYPE = genNumberType();\n\n// @ts-ignore\nexport class Chart extends Group implements IVisactorGraphic {\n type: GraphicType = 'chart' as any;\n declare attribute: IChartGraphicAttribute;\n protected _vchart: IVChart;\n // 是否试一次空render,目的是只生成场景树,不会真实渲染\n // protected _emptyRenderCall: boolean;\n protected declare _AABBBounds: AABBBounds;\n declare valid: boolean;\n get vchart() {\n return this._vchart;\n }\n get vProduct() {\n return this._vchart;\n }\n\n // 设置的 viewBox 是全局值\n private _globalViewBox: IBoundsLike = { x1: 0, y1: 0, x2: 100, y2: 100 };\n // 设置的 viewBox 相对于 vchart-graphic 的位置\n private _localViewBox: IBoundsLike = { x1: 0, y1: 0, x2: 100, y2: 100 };\n private _BoundsViewBox: IBoundsLike = { x1: 0, y1: 0, x2: 100, y2: 100 };\n\n drawTag = false;\n protected _boundsChangeTag: boolean = true;\n\n private _getVChartRootMarkBounds() {\n const stage = this._vchart.getStage();\n return stage.defaultLayer.getChildByName('root').AABBBounds.clone();\n }\n\n doUpdateAABBBounds(full?: boolean): IAABBBounds {\n if (!this._vchart) {\n return super.doUpdateAABBBounds();\n }\n const b = new Bounds();\n b.x1 = this.attribute.x;\n b.x2 = this.attribute.x + this.attribute.width;\n b.y1 = this.attribute.y;\n b.y2 = this.attribute.y + this.attribute.height;\n return b;\n }\n\n constructor(params: IChartGraphicAttribute) {\n super(params);\n this.numberType = CHART_NUMBER_TYPE;\n\n // 创建chart\n if (!params.vchart) {\n params.vchart = this._vchart = new params.ClassType(\n params.spec,\n mergeChartOption(\n {\n renderCanvas: params.renderCanvas,\n mode: params.mode,\n modeParams: params.modeParams,\n canvasControled: false,\n // viewBox: params.vi\n dpr: params.dpr,\n interactive: params.interactive,\n animation: false,\n autoFit: false,\n disableTriggerEvent: params.disableTriggerEvent,\n disableDirtyBounds: params.disableDirtyBounds,\n // @ts-ignore\n ticker: params.ticker,\n beforeRender: () => {\n if (!this.stage) {\n return;\n }\n const chartStage = this._vchart.getStage();\n if (!(chartStage as any)._editor_needRender) {\n chartStage.pauseRender();\n this.stage.dirtyBounds?.union(this.globalAABBBounds);\n this.stage.renderNextFrame();\n }\n },\n afterRender: () => {\n if (!this._vchart) {\n return;\n }\n if (!this.stage) {\n return;\n }\n // @ts-ignore\n this._vchart.getStage()._editor_needRender = false;\n this._vchart.getStage().stage.resumeRender();\n }\n },\n params.chartInitOptions ?? {}\n )\n );\n } else {\n this._vchart = params.vchart;\n }\n // 背景设置为false后,不会擦除画布内容,可以实现元素正常堆叠绘制\n const stage = this._vchart.getStage();\n stage.stage.pauseRender();\n this._vchart.renderSync();\n stage.stage.resumeRender();\n if (stage) {\n stage.background = false as any;\n // 关闭交互\n // stage.pauseTriggerEvent();\n }\n if (params.viewBox) {\n this.updateViewBox(params.viewBox);\n }\n }\n\n /**\n * 判定点是否在VChart中,可能点在Character里,但不在VChart里\n * @param canvasX\n * @param canvasY\n */\n pointInVChart(canvasX: number, canvasY: number): boolean {\n const vchart = this._vchart;\n if (!vchart) {\n return false;\n }\n const target = { x: 0, y: 0 };\n this.globalTransMatrix.transformPoint({ x: canvasX, y: canvasY }, target);\n // 判断点是否在viewBox中\n return isPointInBounds(target, vchart.getStage().viewBox);\n }\n\n /**\n * 判定点是否在设置 viewBox 内。设置 viewBox 会小于展示 bounds\n * @param canvasX\n * @param canvasY\n */\n pointInViewBox(canvasX: number, canvasY: number): boolean {\n const target = { x: 0, y: 0 };\n this.globalTransMatrix.transformPoint({ x: canvasX, y: canvasY }, target);\n return isPointInBounds(target, this._localViewBox);\n }\n\n updateSpec(spec: ISpec, viewBox?: IBoundsLike, forceMerge = false, morphConfig = false) {\n this._boundsChangeTag = true;\n viewBox && this.updateViewBox(viewBox);\n this._vchart.updateSpecSync(spec, forceMerge, { reuse: false, morph: morphConfig });\n this._updateViewBox();\n }\n\n updateViewBox(viewBox: IBoundsLike) {\n // 图表的设置大小\n this._globalViewBox = { ...viewBox };\n this._localViewBox = { x1: 0, y1: 0, x2: viewBox.x2 - viewBox.x1, y2: viewBox.y2 - viewBox.y1 };\n\n this._updateViewBox();\n }\n\n private _updateViewBox() {\n if (!this._vchart) {\n return;\n }\n this._boundsChangeTag = true;\n this._vchart.resize(\n this._globalViewBox.x2 - this._globalViewBox.x1,\n this._globalViewBox.y2 - this._globalViewBox.y1\n );\n const rootBounds = this._getVChartRootMarkBounds();\n this._vchart\n .getStage()\n .defaultLayer.translateTo(-rootBounds.x1 + VIEW_BOX_EXPEND, -rootBounds.y1 + VIEW_BOX_EXPEND);\n this._BoundsViewBox = rootBounds;\n\n const viewBox = { ...this._globalViewBox };\n this.setAttributes({\n x: viewBox.x1 + rootBounds.x1,\n y: viewBox.y1 + rootBounds.y1,\n width: rootBounds.x2 - rootBounds.x1,\n height: rootBounds.y2 - rootBounds.y1\n });\n // viewBox 在展示 bounds 下的位置\n this._localViewBox.x1 = -rootBounds.x1;\n this._localViewBox.y1 = -rootBounds.y1;\n this._localViewBox.x2 += -rootBounds.x1;\n this._localViewBox.y2 += -rootBounds.y1;\n //\n viewBox.x2 -= viewBox.x1;\n viewBox.y2 -= viewBox.y1;\n viewBox.x1 = 0;\n viewBox.y1 = 0;\n // this._vchart.resize(viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1);\n this._vchart.updateViewBox(viewBox);\n const renderViewBox = { ...rootBounds };\n renderViewBox.x2 -= renderViewBox.x1;\n renderViewBox.y2 -= renderViewBox.y1;\n renderViewBox.x1 = 0;\n renderViewBox.y1 = 0;\n renderViewBox.x2 += VIEW_BOX_EXPEND * 2;\n renderViewBox.y2 += VIEW_BOX_EXPEND * 2;\n // @ts-ignore\n this._vchart._compiler._view.renderer.setViewBox(renderViewBox, true);\n }\n\n release() {\n this._vchart && this._vchart.release();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/chart/graphic/vchart-graphic.ts"],"names":[],"mappings":";;;AACA,6CAA+F;AAG/F,+CAAyD;AACzD,kDAAyD;AAoB5C,QAAA,iBAAiB,GAAG,IAAA,uBAAa,GAAE,CAAC;AAGjD,MAAa,KAAM,SAAQ,eAAK;IAQ9B,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACt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,CAAC;QACrC,aAAa,CAAC,EAAE,IAAI,aAAa,CAAC,EAAE,CAAC;QACrC,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC;QACrB,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC;QAErB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;CACF;AAxLD,sBAwLC","file":"vchart-graphic.js","sourcesContent":["import type { IVisactorGraphic } from '../../visactor/interface';\nimport { Bounds, type AABBBounds, type IAABBBounds, type IBoundsLike } from '@visactor/vutils';\nimport type { ISpec, IVChart } from '@visactor/vchart';\nimport type { GraphicType, IGroupGraphicAttribute, ITicker } from '@visactor/vrender';\nimport { genNumberType, Group } from '@visactor/vrender';\nimport { isPointInBounds } from '../../../../util/space';\n\nexport interface IChartGraphicAttribute extends IGroupGraphicAttribute {\n renderCanvas: HTMLCanvasElement;\n spec: any;\n ClassType: any;\n vchart: IVChart;\n mode: string;\n modeParams?: any;\n dpr: number;\n interactive: boolean;\n animation: boolean;\n disableTriggerEvent: boolean;\n disableDirtyBounds: boolean;\n viewBox: IBoundsLike;\n ticker?: ITicker;\n autoRender?: boolean;\n chartInitOptions?: any;\n}\n\nexport const CHART_NUMBER_TYPE = genNumberType();\n\n// @ts-ignore\nexport class Chart extends Group implements IVisactorGraphic {\n type: GraphicType = 'chart' as any;\n declare attribute: IChartGraphicAttribute;\n protected _vchart: IVChart;\n // 是否试一次空render,目的是只生成场景树,不会真实渲染\n // protected _emptyRenderCall: boolean;\n protected declare _AABBBounds: AABBBounds;\n declare valid: boolean;\n get vchart() {\n return this._vchart;\n }\n get vProduct() {\n return this._vchart;\n }\n\n // 设置的 viewBox 是全局值\n private _globalViewBox: IBoundsLike = { x1: 0, y1: 0, x2: 100, y2: 100 };\n // 设置的 viewBox 相对于 vchart-graphic 的位置\n private _localViewBox: IBoundsLike = { x1: 0, y1: 0, x2: 100, y2: 100 };\n private _BoundsViewBox: IBoundsLike = { x1: 0, y1: 0, x2: 100, y2: 100 };\n\n drawTag = false;\n protected _boundsChangeTag: boolean = true;\n\n private _getVChartRootMarkBounds() {\n const stage = this._vchart.getStage();\n return stage.defaultLayer.getChildByName('root').AABBBounds.clone();\n }\n\n doUpdateAABBBounds(full?: boolean): IAABBBounds {\n if (!this._vchart) {\n return super.doUpdateAABBBounds();\n }\n const b = new Bounds();\n b.x1 = this.attribute.x;\n b.x2 = this.attribute.x + this.attribute.width;\n b.y1 = this.attribute.y;\n b.y2 = this.attribute.y + this.attribute.height;\n return b;\n }\n\n constructor(params: IChartGraphicAttribute) {\n super(params);\n this.numberType = CHART_NUMBER_TYPE;\n\n // 创建chart\n if (!params.vchart) {\n params.vchart = this._vchart = new params.ClassType(params.spec, {\n renderCanvas: params.renderCanvas,\n mode: params.mode,\n modeParams: params.modeParams,\n canvasControled: false,\n // viewBox: params.vi\n dpr: params.dpr,\n interactive: params.interactive,\n animation: false,\n autoFit: false,\n disableTriggerEvent: params.disableTriggerEvent,\n disableDirtyBounds: params.disableDirtyBounds,\n ticker: params.ticker,\n beforeRender: () => {\n if (!this.stage) {\n return;\n }\n const chartStage = this._vchart.getStage();\n if (!(chartStage as any)._editor_needRender) {\n chartStage.pauseRender();\n this.stage.dirtyBounds?.union(this.globalAABBBounds);\n this.stage.renderNextFrame();\n }\n },\n afterRender: () => {\n if (!this._vchart) {\n return;\n }\n if (!this.stage) {\n return;\n }\n // @ts-ignore\n this._vchart.getStage()._editor_needRender = false;\n this._vchart.getStage().stage.resumeRender();\n },\n ...(params.chartInitOptions ?? {})\n });\n } else {\n this._vchart = params.vchart;\n }\n // 背景设置为false后,不会擦除画布内容,可以实现元素正常堆叠绘制\n const stage = this._vchart.getStage();\n stage.stage.pauseRender();\n this._vchart.renderSync();\n stage.stage.resumeRender();\n if (stage) {\n stage.background = false as any;\n // 关闭交互\n // stage.pauseTriggerEvent();\n }\n if (params.viewBox) {\n this.updateViewBox(params.viewBox);\n }\n }\n\n /**\n * 判定点是否在VChart中,可能点在Character里,但不在VChart里\n * @param canvasX\n * @param canvasY\n */\n pointInVChart(canvasX: number, canvasY: number): boolean {\n const vchart = this._vchart;\n if (!vchart) {\n return false;\n }\n const target = { x: 0, y: 0 };\n this.globalTransMatrix.transformPoint({ x: canvasX, y: canvasY }, target);\n // 判断点是否在viewBox中\n return isPointInBounds(target, vchart.getStage().viewBox);\n }\n\n /**\n * 判定点是否在设置 viewBox 内。设置 viewBox 会小于展示 bounds\n * @param canvasX\n * @param canvasY\n */\n pointInViewBox(canvasX: number, canvasY: number): boolean {\n const target = { x: 0, y: 0 };\n this.globalTransMatrix.transformPoint({ x: canvasX, y: canvasY }, target);\n return isPointInBounds(target, this._localViewBox);\n }\n\n updateSpec(spec: ISpec, viewBox?: IBoundsLike, forceMerge = false, morphConfig = false) {\n this._boundsChangeTag = true;\n viewBox && this.updateViewBox(viewBox);\n this._vchart.updateSpecSync(spec, forceMerge, { reuse: false, morph: morphConfig });\n this._updateViewBox();\n }\n\n updateViewBox(viewBox: IBoundsLike) {\n // 图表的设置大小\n this._globalViewBox = { ...viewBox };\n this._localViewBox = { x1: 0, y1: 0, x2: viewBox.x2 - viewBox.x1, y2: viewBox.y2 - viewBox.y1 };\n\n this._updateViewBox();\n }\n\n private _updateViewBox() {\n if (!this._vchart) {\n return;\n }\n this._boundsChangeTag = true;\n const rootBounds = this._getVChartRootMarkBounds();\n this._vchart.getStage().defaultLayer.translateTo(-rootBounds.x1, -rootBounds.y1);\n this._BoundsViewBox = rootBounds;\n\n const viewBox = { ...this._globalViewBox };\n this.setAttributes({\n x: viewBox.x1 + rootBounds.x1,\n y: viewBox.y1 + rootBounds.y1,\n width: rootBounds.x2 - rootBounds.x1,\n height: rootBounds.y2 - rootBounds.y1\n });\n // viewBox 在展示 bounds 下的位置\n this._localViewBox.x1 = -rootBounds.x1;\n this._localViewBox.y1 = -rootBounds.y1;\n this._localViewBox.x2 += -rootBounds.x1;\n this._localViewBox.y2 += -rootBounds.y1;\n //\n viewBox.x2 -= viewBox.x1;\n viewBox.y2 -= viewBox.y1;\n viewBox.x1 = 0;\n viewBox.y1 = 0;\n this._vchart.resize(viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1);\n this._vchart.updateViewBox(viewBox);\n const renderViewBox = { ...rootBounds };\n renderViewBox.x2 -= renderViewBox.x1;\n renderViewBox.y2 -= renderViewBox.y1;\n renderViewBox.x1 = 0;\n renderViewBox.y1 = 0;\n // @ts-ignore\n this._vchart._compiler._view.renderer.setViewBox(renderViewBox, true);\n }\n\n release() {\n this._vchart && this._vchart.release();\n }\n}\n"]}
@@ -20,7 +20,6 @@ export interface IStoryCanvas {
20
20
  export interface IStory {
21
21
  readonly id: string;
22
22
  readonly player: IPlayer;
23
- readonly characterTree: ICharacterTree;
24
23
  canvas: IStoryCanvas;
25
24
  getCharacters: () => {
26
25
  [key: string]: ICharacter;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/interface/runtime-interface.ts"],"names":[],"mappings":"","file":"runtime-interface.js","sourcesContent":["import type { IGraphic, IStage } from '@visactor/vrender';\nimport type { ICharacter, ICharacterSpec } from '../character';\nimport type { IPlayer } from '../../player/interface/player';\n\nexport interface IStoryInitOption {\n dom: string | HTMLDivElement; // dom id\n playerOption?: {\n scaleX?: number;\n scaleY?: number;\n };\n}\n\nexport interface IStoryCanvas {\n getStage: () => IStage;\n getCanvas: () => HTMLCanvasElement;\n getEventDetail: (event: StoryEvent) => {\n character: ICharacter;\n characterInfo: undefined;\n };\n release: () => void;\n}\n\nexport interface IStory {\n readonly id: string;\n readonly player: IPlayer;\n readonly characterTree: ICharacterTree;\n canvas: IStoryCanvas;\n getCharacters: () => { [key: string]: ICharacter };\n getCharactersById: (key: string) => ICharacter | null;\n}\nexport interface ICharacterTree {\n getCharacters: () => { [key: string]: ICharacter };\n getCharactersById: (key: string) => ICharacter | null;\n addCharacter: (spec: ICharacterSpec) => ICharacter;\n initCharacters: (spec: ICharacterSpec[]) => void;\n}\n\nexport type StoryEvent = Event & {\n detailPath: IGraphic[];\n path: IGraphic[];\n canvasX?: number;\n canvasY?: number;\n};\n"]}
1
+ {"version":3,"sources":["../src/story/interface/runtime-interface.ts"],"names":[],"mappings":"","file":"runtime-interface.js","sourcesContent":["import type { IGraphic, IStage } from '@visactor/vrender';\nimport type { ICharacter, ICharacterSpec } from '../character';\nimport type { IPlayer } from '../../player/interface/player';\n\nexport interface IStoryInitOption {\n dom: string | HTMLDivElement; // dom id\n playerOption?: {\n scaleX?: number;\n scaleY?: number;\n };\n}\n\nexport interface IStoryCanvas {\n getStage: () => IStage;\n getCanvas: () => HTMLCanvasElement;\n getEventDetail: (event: StoryEvent) => {\n character: ICharacter;\n characterInfo: undefined;\n };\n release: () => void;\n}\n\nexport interface IStory {\n readonly id: string;\n readonly player: IPlayer;\n canvas: IStoryCanvas;\n getCharacters: () => { [key: string]: ICharacter };\n getCharactersById: (key: string) => ICharacter | null;\n}\nexport interface ICharacterTree {\n getCharacters: () => { [key: string]: ICharacter };\n getCharactersById: (key: string) => ICharacter | null;\n addCharacter: (spec: ICharacterSpec) => ICharacter;\n initCharacters: (spec: ICharacterSpec[]) => void;\n}\n\nexport type StoryEvent = Event & {\n detailPath: IGraphic[];\n path: IGraphic[];\n canvasX?: number;\n canvasY?: number;\n};\n"]}
@@ -11,7 +11,6 @@ export declare class Story implements IStory {
11
11
  protected _spec: IStorySpec;
12
12
  get canvas(): IStoryCanvas;
13
13
  get player(): IPlayer;
14
- get characterTree(): ICharacterTree;
15
14
  constructor(spec: IStorySpec, option: IStoryInitOption);
16
15
  load(spec: IStorySpec): void;
17
16
  getCharacters(): {
@@ -41,9 +41,6 @@ class Story {
41
41
  get player() {
42
42
  return this._player;
43
43
  }
44
- get characterTree() {
45
- return this._characterTree;
46
- }
47
44
  constructor(spec, option) {
48
45
  this.id = "test-mvp_" + Story._id_++, this._canvas = new canvas_1.StoryCanvas(this, (0,
49
46
  vutils_1.isString)(option.dom) ? document.getElementById(option.dom) : option.dom),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/story.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,6CAA4C;AAG5C,4CAA8C;AAG9C,+CAAmE;AACnE,oEAAgE;AAEhE,6CAA0C;AAG1C,uBAAa,CAAC,WAAW,CAAC,yBAAe,CAAC,CAAC;AAE3C,MAAa,KAAK;IAahB,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,YAAY,IAAgB,EAAE,MAAwB;QACpD,IAAI,CAAC,EAAE,GAAG,WAAW,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,oBAAW,CAC5B,IAAI,EACJ,IAAA,iBAAQ,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAoB,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAC5F,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,eAAM,CAAC,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;QAErD,IAAI,CAAC,cAAc,GAAG,IAAI,8BAAa,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,IAAI,CAAC,IAAgB;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,IAAI,EAAE;YACT,OAAO;SACR;QACD,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;IAC7C,CAAC;IAED,iBAAiB,CAAC,GAAW;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IAMD,IAAI,CAAC,OAAgB,IAAI;QAEvB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;gBAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAEK,aAAa,CAAC,YAAoB,EAAE,UAAkB,EAAE,GAAW;;YACvE,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACrD,CAAC;KAAA;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;;AArFH,sBAsFC;AArFQ,UAAI,GAAG,CAAC,CAAC","file":"story.js","sourcesContent":["import type { ICharacterSpec } from './character/dsl-interface';\nimport { isString } from '@visactor/vutils';\nimport type { ICharacterTree, IStory, IStoryCanvas, IStoryInitOption } from './interface/runtime-interface';\nimport type { ICharacter } from './character/runtime-interface';\nimport { StoryCanvas } from './canvas/canvas';\nimport type { IStorySpec, IActSpec } from './interface';\nimport { StoryFactory } from './factory/factory';\nimport { defaultTicker, defaultTimeline } from '@visactor/vrender';\nimport { CharacterTree } from './character-tree/character-tree';\nimport type { IPlayer } from '../player/interface/player';\nimport { Player } from '../player/player';\nimport { logger } from '../util/output';\n\ndefaultTicker.remTimeline(defaultTimeline);\n\nexport class Story implements IStory {\n static _id_ = 0;\n\n protected _player: IPlayer;\n\n readonly id: string;\n\n protected _canvas: IStoryCanvas;\n\n protected _characterTree: ICharacterTree;\n\n protected _spec: IStorySpec;\n\n get canvas() {\n return this._canvas;\n }\n\n get player(): IPlayer {\n return this._player;\n }\n\n get characterTree() {\n return this._characterTree;\n }\n\n constructor(spec: IStorySpec, option: IStoryInitOption) {\n this.id = 'test-mvp_' + Story._id_++;\n this._canvas = new StoryCanvas(\n this,\n isString(option.dom) ? (document.getElementById(option.dom) as HTMLDivElement) : option.dom\n );\n this._player = new Player(this, option.playerOption);\n\n this._characterTree = new CharacterTree(this);\n spec && this.load(spec);\n }\n\n load(spec: IStorySpec) {\n this._spec = spec;\n if (!spec) {\n return;\n }\n this._characterTree.initCharacters(spec.characters);\n this._player.initActs(spec.acts);\n }\n\n getCharacters(): { [key: string]: ICharacter } {\n return this._characterTree.getCharacters();\n }\n\n getCharactersById(key: string) {\n return this._characterTree.getCharactersById(key);\n }\n\n // private _createAct(spec: IActSpec) {\n // this._player.addAct(spec, this._characters);\n // }\n\n play(loop: boolean = true) {\n // player 开始播放\n this._spec && this.load(this._spec);\n this._player.play();\n if (loop) {\n this._player.once('onstop', () => {\n this.play(loop);\n });\n }\n }\n\n pause() {\n this._player.pause();\n return;\n }\n\n async encodeToVideo(actIndexOrId: number, millsecond: number, fps: number) {\n return this._player.encodeToVideo(millsecond, fps);\n }\n\n getPlayer() {\n return this._player;\n }\n\n release() {\n this._player.release();\n this._canvas.release();\n }\n}\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C7C,CAAC;IAED,iBAAiB,CAAC,GAAW;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IAMD,IAAI,CAAC,OAAgB,IAAI;QAEvB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;gBAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAEK,aAAa,CAAC,YAAoB,EAAE,UAAkB,EAAE,GAAW;;YACvE,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACrD,CAAC;KAAA;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;;AAjFH,sBAkFC;AAjFQ,UAAI,GAAG,CAAC,CAAC","file":"story.js","sourcesContent":["import type { ICharacterSpec } from './character/dsl-interface';\nimport { isString } from '@visactor/vutils';\nimport type { ICharacterTree, IStory, IStoryCanvas, IStoryInitOption } from './interface/runtime-interface';\nimport type { ICharacter } from './character/runtime-interface';\nimport { StoryCanvas } from './canvas/canvas';\nimport type { IStorySpec, IActSpec } from './interface';\nimport { StoryFactory } from './factory/factory';\nimport { defaultTicker, defaultTimeline } from '@visactor/vrender';\nimport { CharacterTree } from './character-tree/character-tree';\nimport type { IPlayer } from '../player/interface/player';\nimport { Player } from '../player/player';\nimport { logger } from '../util/output';\n\ndefaultTicker.remTimeline(defaultTimeline);\n\nexport class Story implements IStory {\n static _id_ = 0;\n\n protected _player: IPlayer;\n\n readonly id: string;\n\n protected _canvas: IStoryCanvas;\n\n protected _characterTree: ICharacterTree;\n\n protected _spec: IStorySpec;\n\n get canvas() {\n return this._canvas;\n }\n\n get player(): IPlayer {\n return this._player;\n }\n\n constructor(spec: IStorySpec, option: IStoryInitOption) {\n this.id = 'test-mvp_' + Story._id_++;\n this._canvas = new StoryCanvas(\n this,\n isString(option.dom) ? (document.getElementById(option.dom) as HTMLDivElement) : option.dom\n );\n this._player = new Player(this, option.playerOption);\n\n this._characterTree = new CharacterTree(this);\n spec && this.load(spec);\n }\n\n load(spec: IStorySpec) {\n this._spec = spec;\n if (!spec) {\n return;\n }\n this._characterTree.initCharacters(spec.characters);\n this._player.initActs(spec.acts);\n }\n\n getCharacters(): { [key: string]: ICharacter } {\n return this._characterTree.getCharacters();\n }\n\n getCharactersById(key: string) {\n return this._characterTree.getCharactersById(key);\n }\n\n // private _createAct(spec: IActSpec) {\n // this._player.addAct(spec, this._characters);\n // }\n\n play(loop: boolean = true) {\n // player 开始播放\n this._spec && this.load(this._spec);\n this._player.play();\n if (loop) {\n this._player.once('onstop', () => {\n this.play(loop);\n });\n }\n }\n\n pause() {\n this._player.pause();\n return;\n }\n\n async encodeToVideo(actIndexOrId: number, millsecond: number, fps: number) {\n return this._player.encodeToVideo(millsecond, fps);\n }\n\n getPlayer() {\n return this._player;\n }\n\n release() {\n this._player.release();\n this._canvas.release();\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { ISpec, IInitOption } from '@visactor/vchart';
1
+ import { ISpec } from '@visactor/vchart';
2
2
  export declare function isModelInfoMatchSpec(info: any, spec: {
3
3
  id: string | number;
4
4
  }, specKey: string, index: number, option?: {
@@ -6,4 +6,3 @@ export declare function isModelInfoMatchSpec(info: any, spec: {
6
6
  }): boolean;
7
7
  export declare function mergeSpec(target: any, ...sources: any[]): any;
8
8
  export declare function findChartSpec(s: any, vchartSpec: ISpec): any;
9
- export declare function mergeChartOption(target: Partial<IInitOption>, ...sources: Partial<IInitOption>[]): Partial<IInitOption>;
@@ -1,18 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var __rest = this && this.__rest || function(s, e) {
4
- var t = {};
5
- for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
6
- if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
7
- var i = 0;
8
- for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
9
- }
10
- return t;
11
- };
12
-
13
3
  Object.defineProperty(exports, "__esModule", {
14
4
  value: !0
15
- }), exports.mergeChartOption = exports.findChartSpec = exports.mergeSpec = exports.isModelInfoMatchSpec = void 0;
5
+ }), exports.findChartSpec = exports.mergeSpec = exports.isModelInfoMatchSpec = void 0;
16
6
 
17
7
  const vutils_1 = require("@visactor/vutils"), directlyAssignSpecKeys = [ "seriesId", "text" ];
18
8
 
@@ -80,24 +70,6 @@ function findChartSpec(s, vchartSpec) {
80
70
  vutils_1.isObject)(chartSpec) && isModelInfoMatchSpec(s, chartSpec, s.specKey, 0) ? chartSpec : null : null;
81
71
  }
82
72
 
83
- function mergeChartOption(target, ...sources) {
84
- const performanceHook = {};
85
- function pushHookToTemp(hooks) {
86
- Object.keys(hooks).forEach((k => {
87
- performanceHook[k] || (performanceHook[k] = []), performanceHook[k].push(hooks[k]);
88
- }));
89
- }
90
- return target.performanceHook && pushHookToTemp(target.performanceHook), sources.forEach((source => {
91
- if (!source) return;
92
- const {performanceHook: performanceHook} = source, rest = __rest(source, [ "performanceHook" ]);
93
- performanceHook && pushHookToTemp(performanceHook), (0, vutils_1.merge)(target, rest);
94
- })), target.performanceHook = {}, Object.keys(performanceHook).forEach((k => {
95
- target.performanceHook[k] = (...args) => {
96
- performanceHook[k].forEach((f => f(...args)));
97
- };
98
- })), target;
99
- }
100
-
101
73
  exports.isModelInfoMatchSpec = isModelInfoMatchSpec, exports.mergeSpec = mergeSpec,
102
- exports.findChartSpec = findChartSpec, exports.mergeChartOption = mergeChartOption;
74
+ exports.findChartSpec = findChartSpec;
103
75
  //# sourceMappingURL=chart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/utils/chart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,6CAAkH;AAElH,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAEpD,SAAgB,oBAAoB,CAClC,IAAS,EACT,IAA6B,EAC7B,OAAe,EACf,KAAa,EACb,SAEI;IACF,aAAa,EAAE,KAAK;CACrB;IAED,IAAI,CAAC,IAAA,cAAK,EAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAClC,IAAI,KAAK,IAAI,MAAM,CAAC,aAAa,KAAK,IAAI,EAAE;YAC1C,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC,OAAO,KAAK,OAAO,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC;AAC9D,CAAC;AAlBD,oDAkBC;AAED,SAAS,SAAS,CAAC,MAAW,EAAE,MAAW,EAAE,YAAY,GAAG,KAAK;IAC/D,IAAI,MAAM,EAAE;QACV,IAAI,MAAM,KAAK,MAAM,EAAE;YACrB,OAAO;SACR;QACD,IAAI,IAAA,gBAAO,EAAC,MAAM,CAAC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAEjD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,MAAM,KAAK,GAAG,EAAE,CAAC;YAEjB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;gBAC1B,KAAK,CA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EAAE;YACvC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE;gBACvB,eAAe,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;aACzB;YAED,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,cAAc,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;KACxC;IACD,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACvB,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QACD,MAAM,EAAE,eAAe,KAAc,MAAM,EAAf,IAAI,UAAK,MAAM,EAArC,mBAA4B,CAAS,CAAC;QAC5C,IAAI,eAAe,EAAE;YACnB,cAAc,CAAC,eAAe,CAAC,CAAC;SACjC;QACD,IAAA,cAAK,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,eAAe,GAAG,EAAE,CAAC;IAC5B,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAEvC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE;YAEtC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AArCD,4CAqCC","file":"chart.js","sourcesContent":["import type { ISpec, IInitOption } from '@visactor/vchart';\nimport { isArray, isArrayLike, isNil, isObject, isPlainObject, isString, isValid, merge } from '@visactor/vutils';\n\nconst directlyAssignSpecKeys = ['seriesId', 'text'];\n\nexport function isModelInfoMatchSpec(\n info: any,\n spec: { id: string | number },\n specKey: string,\n index: number,\n option: {\n ignoreIdMatch: boolean;\n } = {\n ignoreIdMatch: false\n }\n) {\n if (!isNil(info.id)) {\n const match = info.id === spec.id;\n if (match || option.ignoreIdMatch !== true) {\n return match;\n }\n }\n return info.specKey === specKey && info.specIndex === index;\n}\n\nfunction baseMerge(target: any, source: any, shallowArray = false) {\n if (source) {\n if (target === source) {\n return;\n }\n if (isValid(source) && typeof source === 'object') {\n // baseFor\n const iterable = Object(source);\n const props = [];\n // keysIn\n for (const key in iterable) {\n props.push(key);\n }\n let { length } = props;\n let propIndex = -1;\n while (length--) {\n const key = props[++propIndex];\n if (isValid(iterable[key]) && typeof iterable[key] === 'object') {\n baseMergeDeep(target, source, key, shallowArray);\n } else {\n assignMergeValue(target, key, iterable[key]);\n }\n }\n }\n }\n}\n\nfunction baseMergeDeep(target: object, source: object, key: string, shallowArray = false) {\n const objValue = target[key];\n const srcValue = source[key];\n let newValue = source[key];\n let isCommon = true;\n // handle excluded spec keys\n if (directlyAssignSpecKeys.includes(key)) {\n isCommon = false;\n }\n // 不考虑 buffer / typedArray 类型\n else if (isArray(srcValue)) {\n if (shallowArray || !objValue) {\n // 依据参数对数组做浅拷贝\n newValue = [];\n } else if (isArray(objValue)) {\n newValue = objValue;\n } else if (isArrayLike(objValue) && !isString(objValue)) {\n // 如果 objValue 是字符串则直接赋值\n // 如果 source 为数组,则 target 的 arrayLike 对象也视作为数组处理\n newValue = new Array(objValue.length);\n let index = -1;\n const length = objValue.length;\n while (++index < length) {\n newValue[index] = objValue[index];\n }\n }\n }\n // else if (isArray(srcValue) && shallowArray) {\n // newValue = [];\n // }\n // 不考虑 argument 类型\n else if (isPlainObject(srcValue)) {\n newValue = objValue ?? {};\n // 不考虑 prototype 的额外处理\n if (typeof objValue === 'function' || typeof objValue !== 'object') {\n newValue = {};\n }\n } else {\n isCommon = false;\n }\n // 对 class 等复杂对象或者浅拷贝的 array 不做拷贝处理\n if (isCommon) {\n baseMerge(newValue, srcValue, shallowArray);\n }\n assignMergeValue(target, key, newValue);\n}\n\nfunction assignMergeValue(target: object, key: string, value: any) {\n if ((value !== undefined && !eq(target[key], value)) || (value === undefined && !(key in target))) {\n // 不考虑 __proto__ 的赋值处理\n target[key] = value;\n }\n}\n\nfunction eq(value: any, other: any) {\n return value === other || (Number.isNaN(value) && Number.isNaN(other));\n}\n\nexport function mergeSpec(target: any, ...sources: any[]): any {\n let sourceIndex = -1;\n const length = sources.length;\n while (++sourceIndex < length) {\n const source = sources[sourceIndex];\n baseMerge(target, source, false);\n }\n return target;\n}\n\nexport function findChartSpec(s: any, vchartSpec: ISpec) {\n const chartSpec = vchartSpec[s.specKey];\n if (!chartSpec) {\n return null;\n }\n if (isArray(chartSpec)) {\n return chartSpec.find((_s, index) => {\n return isModelInfoMatchSpec(s, _s, s.specKey, index);\n });\n } else if (isObject(chartSpec)) {\n return isModelInfoMatchSpec(s, chartSpec as { id: string | number }, s.specKey, 0) ? chartSpec : null;\n }\n return null;\n}\n\nexport function mergeChartOption(\n target: Partial<IInitOption>,\n ...sources: Partial<IInitOption>[]\n): Partial<IInitOption> {\n const performanceHook: { [key: string]: (() => void)[] } = {};\n\n function pushHookToTemp(hooks: IInitOption['performanceHook']) {\n Object.keys(hooks).forEach((k: string) => {\n if (!performanceHook[k]) {\n performanceHook[k] = [];\n }\n // @ts-ignore\n performanceHook[k].push(hooks[k]);\n });\n }\n if (target.performanceHook) {\n pushHookToTemp(target.performanceHook);\n }\n sources.forEach(source => {\n if (!source) {\n return;\n }\n const { performanceHook, ...rest } = source;\n if (performanceHook) {\n pushHookToTemp(performanceHook);\n }\n merge(target, rest);\n });\n target.performanceHook = {};\n Object.keys(performanceHook).forEach(k => {\n // @ts-ignore\n target.performanceHook[k] = (...args) => {\n // @ts-ignore\n performanceHook[k].forEach(f => f(...args));\n };\n });\n return target;\n}\n"]}
1
+ {"version":3,"sources":["../src/story/utils/chart.ts"],"names":[],"mappings":";;;AACA,6CAA2G;AAE3G,MAAM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B,CAAC;AARD,8BAQC;AAED,SAAgB,aAAa,CAAC,CAAM,EAAE,UAAiB;IACrD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACxC,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,IAAI,CAAC;KACb;IACD,IAAI,IAAA,gBAAO,EAAC,SAAS,CAAC,EAAE;QACtB,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;YAClC,OAAO,oBAAoB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;KACJ;SAAM,IAAI,IAAA,iBAAQ,EAAC,SAAS,CAAC,EAAE;QAC9B,OAAO,oBAAoB,CAAC,CAAC,EAAE,SAAoC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;KACvG;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAbD,sCAaC","file":"chart.js","sourcesContent":["import { ISpec } from '@visactor/vchart';\nimport { isArray, isArrayLike, isNil, isObject, isPlainObject, isString, isValid } from '@visactor/vutils';\n\nconst directlyAssignSpecKeys = ['seriesId', 'text'];\n\nexport function isModelInfoMatchSpec(\n info: any,\n spec: { id: string | number },\n specKey: string,\n index: number,\n option: {\n ignoreIdMatch: boolean;\n } = {\n ignoreIdMatch: false\n }\n) {\n if (!isNil(info.id)) {\n const match = info.id === spec.id;\n if (match || option.ignoreIdMatch !== true) {\n return match;\n }\n }\n return info.specKey === specKey && info.specIndex === index;\n}\n\nfunction baseMerge(target: any, source: any, shallowArray = false) {\n if (source) {\n if (target === source) {\n return;\n }\n if (isValid(source) && typeof source === 'object') {\n // baseFor\n const iterable = Object(source);\n const props = [];\n // keysIn\n for (const key in iterable) {\n props.push(key);\n }\n let { length } = props;\n let propIndex = -1;\n while (length--) {\n const key = props[++propIndex];\n if (isValid(iterable[key]) && typeof iterable[key] === 'object') {\n baseMergeDeep(target, source, key, shallowArray);\n } else {\n assignMergeValue(target, key, iterable[key]);\n }\n }\n }\n }\n}\n\nfunction baseMergeDeep(target: object, source: object, key: string, shallowArray = false) {\n const objValue = target[key];\n const srcValue = source[key];\n let newValue = source[key];\n let isCommon = true;\n // handle excluded spec keys\n if (directlyAssignSpecKeys.includes(key)) {\n isCommon = false;\n }\n // 不考虑 buffer / typedArray 类型\n else if (isArray(srcValue)) {\n if (shallowArray || !objValue) {\n // 依据参数对数组做浅拷贝\n newValue = [];\n } else if (isArray(objValue)) {\n newValue = objValue;\n } else if (isArrayLike(objValue) && !isString(objValue)) {\n // 如果 objValue 是字符串则直接赋值\n // 如果 source 为数组,则 target 的 arrayLike 对象也视作为数组处理\n newValue = new Array(objValue.length);\n let index = -1;\n const length = objValue.length;\n while (++index < length) {\n newValue[index] = objValue[index];\n }\n }\n }\n // else if (isArray(srcValue) && shallowArray) {\n // newValue = [];\n // }\n // 不考虑 argument 类型\n else if (isPlainObject(srcValue)) {\n newValue = objValue ?? {};\n // 不考虑 prototype 的额外处理\n if (typeof objValue === 'function' || typeof objValue !== 'object') {\n newValue = {};\n }\n } else {\n isCommon = false;\n }\n // 对 class 等复杂对象或者浅拷贝的 array 不做拷贝处理\n if (isCommon) {\n baseMerge(newValue, srcValue, shallowArray);\n }\n assignMergeValue(target, key, newValue);\n}\n\nfunction assignMergeValue(target: object, key: string, value: any) {\n if ((value !== undefined && !eq(target[key], value)) || (value === undefined && !(key in target))) {\n // 不考虑 __proto__ 的赋值处理\n target[key] = value;\n }\n}\n\nfunction eq(value: any, other: any) {\n return value === other || (Number.isNaN(value) && Number.isNaN(other));\n}\n\nexport function mergeSpec(target: any, ...sources: any[]): any {\n let sourceIndex = -1;\n const length = sources.length;\n while (++sourceIndex < length) {\n const source = sources[sourceIndex];\n baseMerge(target, source, false);\n }\n return target;\n}\n\nexport function findChartSpec(s: any, vchartSpec: ISpec) {\n const chartSpec = vchartSpec[s.specKey];\n if (!chartSpec) {\n return null;\n }\n if (isArray(chartSpec)) {\n return chartSpec.find((_s, index) => {\n return isModelInfoMatchSpec(s, _s, s.specKey, index);\n });\n } else if (isObject(chartSpec)) {\n return isModelInfoMatchSpec(s, chartSpec as { id: string | number }, s.specKey, 0) ? chartSpec : null;\n }\n return null;\n}\n"]}