@visactor/vstory 0.0.4-alpha.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animate/typewirter.d.ts +3 -4
- package/cjs/animate/typewirter.js +44 -30
- package/cjs/animate/typewirter.js.map +1 -1
- package/cjs/constants/action.d.ts +9 -0
- package/cjs/constants/action.js +10 -2
- package/cjs/constants/action.js.map +1 -1
- package/cjs/constants/character.d.ts +0 -1
- package/cjs/constants/character.js +1 -2
- package/cjs/constants/character.js.map +1 -1
- package/cjs/constants/config.js +2 -1
- package/cjs/dsl/constant/index.d.ts +13 -0
- package/cjs/dsl/constant/index.js +6 -1
- package/cjs/dsl/constant/index.js.map +1 -1
- package/cjs/dsl/story-chart/area.d.ts +2 -0
- package/cjs/dsl/story-chart/area.js +5 -1
- package/cjs/dsl/story-chart/area.js.map +1 -1
- package/cjs/dsl/story-chart/bar.d.ts +2 -0
- package/cjs/dsl/story-chart/bar.js +1 -1
- package/cjs/dsl/story-chart/bar.js.map +1 -1
- package/cjs/dsl/story-chart/chart.js +1 -2
- package/cjs/dsl/story-chart/line.d.ts +2 -0
- package/cjs/dsl/story-chart/line.js +1 -1
- package/cjs/dsl/story-chart/line.js.map +1 -1
- package/cjs/dsl/story-chart/pie.d.ts +2 -0
- package/cjs/dsl/story-chart/pie.js +3 -0
- package/cjs/dsl/story-chart/pie.js.map +1 -1
- package/cjs/dsl/story-processor/graphic/appear.js.map +1 -1
- package/cjs/dsl/story-processor/graphic/effect/appear.js +2 -7
- package/cjs/dsl/story-processor/graphic/effect/appear.js.map +1 -1
- package/cjs/dsl/story-processor/graphic/effect/typewriter.js +1 -1
- package/cjs/dsl/story-processor/graphic/effect/typewriter.js.map +1 -1
- package/cjs/dsl/story-processor/processor.js +1 -1
- package/cjs/dsl/utils/datum.js +2 -1
- package/cjs/dsl/utils/flicker.js +1 -1
- package/cjs/edit/edit-component/layer-edit.js +0 -2
- package/cjs/edit/edit-component/rect-selection.js +1 -1
- package/cjs/edit/edit-component/richtext-selection.js +1 -1
- package/cjs/edit/edit-component/text-selection.js +1 -1
- package/cjs/index.d.ts +0 -1
- package/cjs/index.js +1 -2
- package/cjs/index.js.map +1 -1
- package/cjs/interface/type.js +1 -2
- package/cjs/player/interface/player.d.ts +5 -2
- package/cjs/player/interface/player.js.map +1 -1
- package/cjs/player/interface/scheduler.d.ts +1 -1
- package/cjs/player/interface/scheduler.js.map +1 -1
- package/cjs/player/player.d.ts +7 -2
- package/cjs/player/player.js +25 -19
- package/cjs/player/player.js.map +1 -1
- package/cjs/player/processor/chart/common/chartAppear.d.ts +5 -0
- package/cjs/player/processor/chart/common/chartAppear.js +11 -0
- package/cjs/player/processor/chart/common/chartAppear.js.map +1 -0
- package/cjs/player/processor/chart/common/commonAppear.d.ts +8 -0
- package/cjs/player/processor/chart/common/commonAppear.js +46 -0
- package/cjs/player/processor/chart/common/commonAppear.js.map +1 -0
- package/cjs/player/processor/chart/component/axisAppear.d.ts +2 -2
- package/cjs/player/processor/chart/component/axisAppear.js +2 -2
- package/cjs/player/processor/chart/component/axisAppear.js.map +1 -1
- package/cjs/player/processor/chart/component/commonAppear.d.ts +3 -3
- package/cjs/player/processor/chart/component/commonAppear.js +5 -17
- package/cjs/player/processor/chart/component/commonAppear.js.map +1 -1
- package/cjs/player/processor/chart/component/labelAppear.d.ts +2 -2
- package/cjs/player/processor/chart/component/labelAppear.js +1 -1
- package/cjs/player/processor/chart/component/labelAppear.js.map +1 -1
- package/cjs/player/processor/chart/component/legendsAppear.d.ts +4 -3
- package/cjs/player/processor/chart/component/legendsAppear.js +2 -3
- package/cjs/player/processor/chart/component/legendsAppear.js.map +1 -1
- package/cjs/player/processor/chart/component/titleAppear.d.ts +4 -3
- package/cjs/player/processor/chart/component/titleAppear.js +2 -3
- package/cjs/player/processor/chart/component/titleAppear.js.map +1 -1
- package/cjs/player/processor/chart/seriesmark/commonTransformMarkAppear.d.ts +3 -3
- package/cjs/player/processor/chart/seriesmark/commonTransformMarkAppear.js.map +1 -1
- package/cjs/player/processor/chart/seriesmark/{transformArcAppear.d.ts → transformArcVisibility.d.ts} +2 -2
- package/cjs/player/processor/chart/seriesmark/{transformArcAppear.js → transformArcVisibility.js} +5 -6
- package/cjs/player/processor/chart/seriesmark/transformArcVisibility.js.map +1 -0
- package/cjs/player/processor/chart/seriesmark/{transformRectAppear.d.ts → transformLineVisibility.d.ts} +2 -2
- package/cjs/player/processor/chart/seriesmark/transformLineVisibility.js +12 -0
- package/cjs/player/processor/chart/seriesmark/transformLineVisibility.js.map +1 -0
- package/cjs/player/processor/chart/seriesmark/{transformLineAppear.d.ts → transformRectVisibility.d.ts} +2 -2
- package/cjs/player/processor/chart/seriesmark/{transformRectAppear.js → transformRectVisibility.js} +6 -7
- package/cjs/player/processor/chart/seriesmark/transformRectVisibility.js.map +1 -0
- package/cjs/player/processor/chart/seriesmark/transformSymbolVisibility.d.ts +12 -0
- package/cjs/player/processor/chart/seriesmark/transformSymbolVisibility.js +12 -0
- package/cjs/player/processor/chart/seriesmark/transformSymbolVisibility.js.map +1 -0
- package/cjs/player/processor/chart/seriesmark/transformTextVisibility.d.ts +12 -0
- package/cjs/player/processor/chart/seriesmark/transformTextVisibility.js +12 -0
- package/cjs/player/processor/chart/seriesmark/transformTextVisibility.js.map +1 -0
- package/cjs/player/processor/chart/transformMap.d.ts +24 -18
- package/cjs/player/processor/chart/transformMap.js +8 -7
- package/cjs/player/processor/chart/transformMap.js.map +1 -1
- package/cjs/player/processor/chart/vchart.d.ts +62 -15
- package/cjs/player/processor/chart/vchart.js +98 -11
- package/cjs/player/processor/chart/vchart.js.map +1 -1
- package/cjs/player/processor/common/bounce-processor.d.ts +3 -0
- package/cjs/player/processor/common/bounce-processor.js +24 -0
- package/cjs/player/processor/common/bounce-processor.js.map +1 -0
- package/cjs/player/processor/common/common.d.ts +5 -0
- package/cjs/player/processor/common/common.js +20 -0
- package/cjs/player/processor/common/common.js.map +1 -0
- package/cjs/player/processor/common/fade-processor.d.ts +4 -0
- package/cjs/player/processor/common/fade-processor.js +36 -0
- package/cjs/player/processor/common/fade-processor.js.map +1 -0
- package/cjs/player/processor/common/move-processor.d.ts +8 -0
- package/cjs/player/processor/common/move-processor.js +155 -0
- package/cjs/player/processor/common/move-processor.js.map +1 -0
- package/cjs/player/processor/common/scale-processor.d.ts +8 -0
- package/cjs/player/processor/common/scale-processor.js +49 -0
- package/cjs/player/processor/common/scale-processor.js.map +1 -0
- package/cjs/player/processor/common/wipe-processor.d.ts +4 -0
- package/cjs/player/processor/common/wipe-processor.js +40 -0
- package/cjs/player/processor/common/wipe-processor.js.map +1 -0
- package/cjs/player/processor/common-processor.js +3 -0
- package/cjs/player/processor/common-processor.js.map +1 -0
- package/cjs/player/processor/component/common-component.d.ts +45 -9
- package/cjs/player/processor/component/common-component.js +98 -77
- package/cjs/player/processor/component/common-component.js.map +1 -1
- package/cjs/player/processor/component/image/image-visibility.d.ts +5 -0
- package/cjs/player/processor/component/image/image-visibility.js +16 -0
- package/cjs/player/processor/component/image/image-visibility.js.map +1 -0
- package/cjs/player/processor/component/line/line-visibility.d.ts +5 -0
- package/cjs/player/processor/component/line/line-visibility.js +16 -0
- package/cjs/player/processor/component/line/line-visibility.js.map +1 -0
- package/cjs/player/processor/component/rect/rect-visibility.d.ts +5 -0
- package/cjs/player/processor/component/rect/rect-visibility.js +16 -0
- package/cjs/player/processor/component/rect/rect-visibility.js.map +1 -0
- package/cjs/player/processor/component/shape/shape-visibility.d.ts +5 -0
- package/cjs/player/processor/component/shape/shape-visibility.js +16 -0
- package/cjs/player/processor/component/shape/shape-visibility.js.map +1 -0
- package/cjs/player/processor/component/text/text-visibility.d.ts +6 -0
- package/cjs/player/processor/component/text/text-visibility.js +41 -0
- package/cjs/player/processor/component/text/text-visibility.js.map +1 -0
- package/cjs/player/processor/component/timeline/timeline-visibility.d.ts +15 -0
- package/cjs/player/processor/component/timeline/timeline-visibility.js +79 -0
- package/cjs/player/processor/component/timeline/timeline-visibility.js.map +1 -0
- package/cjs/player/processor/component/utils.d.ts +3 -1
- package/cjs/player/processor/component/utils.js +16 -1
- package/cjs/player/processor/component/utils.js.map +1 -1
- package/cjs/player/processor/interface/action-processor.d.ts +6 -6
- package/cjs/player/processor/interface/action-processor.js.map +1 -1
- package/cjs/player/processor/interface/appear-action.d.ts +30 -18
- package/cjs/player/processor/interface/appear-action.js.map +1 -1
- package/cjs/player/processor/interface/common-action.d.ts +14 -0
- package/cjs/player/processor/interface/common-action.js +6 -0
- package/cjs/player/processor/interface/common-action.js.map +1 -0
- package/cjs/player/processor/interface/style-action.d.ts +34 -0
- package/cjs/player/processor/interface/style-action.js +6 -0
- package/cjs/player/processor/interface/style-action.js.map +1 -0
- package/cjs/player/processor/processor-item.d.ts +5 -5
- package/cjs/player/processor/processor-item.js.map +1 -1
- package/cjs/player/processor/processor.d.ts +3 -3
- package/cjs/player/processor/processor.js +2 -2
- package/cjs/player/processor/processor.js.map +1 -1
- package/cjs/player/processor/processorMap.d.ts +22 -21
- package/cjs/player/processor/processorMap.js +42 -8
- package/cjs/player/processor/processorMap.js.map +1 -1
- package/cjs/player/scheduler.d.ts +4 -3
- package/cjs/player/scheduler.js +7 -5
- package/cjs/player/scheduler.js.map +1 -1
- package/cjs/story/canvas/canvas.d.ts +4 -2
- package/cjs/story/canvas/canvas.js +17 -10
- package/cjs/story/canvas/canvas.js.map +1 -1
- package/cjs/story/character/base/base.d.ts +3 -4
- package/cjs/story/character/base/base.js +6 -3
- package/cjs/story/character/base/base.js.map +1 -1
- package/cjs/story/character/chart/character.d.ts +1 -0
- package/cjs/story/character/chart/character.js +5 -2
- package/cjs/story/character/chart/character.js.map +1 -1
- package/cjs/story/character/chart/graphic/vchart-graphic-render.js +3 -3
- package/cjs/story/character/chart/graphic/vchart-graphic-render.js.map +1 -1
- package/cjs/story/character/chart/graphic/vchart-graphic.d.ts +1 -0
- package/cjs/story/character/chart/graphic/vchart-graphic.js +5 -1
- package/cjs/story/character/chart/graphic/vchart-graphic.js.map +1 -1
- package/cjs/story/character/component/character-group/component-group-graphic.d.ts +1 -0
- package/cjs/story/character/component/character-group/component-group-graphic.js +8 -2
- package/cjs/story/character/component/character-group/component-group-graphic.js.map +1 -1
- package/cjs/story/character/component/character.d.ts +4 -3
- package/cjs/story/character/component/character.js +8 -5
- package/cjs/story/character/component/character.js.map +1 -1
- package/cjs/story/character/component/characters/character-richtext.d.ts +1 -6
- package/cjs/story/character/component/characters/character-richtext.js +0 -16
- package/cjs/story/character/component/characters/character-richtext.js.map +1 -1
- package/cjs/story/character/component/characters/character-text.js +1 -1
- package/cjs/story/character/component/characters/character-text.js.map +1 -1
- package/cjs/story/character/component/graphic/graphic-base-text.d.ts +23 -0
- package/cjs/story/character/component/graphic/{graphic-text.js → graphic-base-text.js} +38 -22
- package/cjs/story/character/component/graphic/graphic-base-text.js.map +1 -0
- package/cjs/story/character/component/graphic/graphic.d.ts +1 -1
- package/cjs/story/character/component/graphic/graphic.js.map +1 -1
- package/cjs/story/character/component/graphic/richtext.d.ts +1 -9
- package/cjs/story/character/component/graphic/richtext.js +0 -45
- package/cjs/story/character/component/graphic/richtext.js.map +1 -1
- package/cjs/story/character/component/graphic/text.d.ts +4 -3
- package/cjs/story/character/component/graphic/text.js +21 -6
- package/cjs/story/character/component/graphic/text.js.map +1 -1
- package/cjs/story/character/component/graphic/timeline.d.ts +6 -0
- package/cjs/story/character/component/graphic/timeline.js +7 -1
- package/cjs/story/character/component/graphic/timeline.js.map +1 -1
- package/cjs/story/character/dsl-interface.d.ts +2 -2
- package/cjs/story/character/dsl-interface.js.map +1 -1
- package/cjs/story/character/runtime-interface.d.ts +1 -0
- package/cjs/story/character/runtime-interface.js.map +1 -1
- package/cjs/story/character/visactor/character.d.ts +2 -3
- package/cjs/story/character/visactor/character.js.map +1 -1
- package/cjs/story/character/visactor/interface.d.ts +1 -0
- package/cjs/story/character/visactor/interface.js.map +1 -1
- package/cjs/story/character-tree/character-tree.d.ts +1 -0
- package/cjs/story/character-tree/character-tree.js +6 -0
- package/cjs/story/character-tree/character-tree.js.map +1 -1
- package/cjs/story/index.js +1 -2
- package/cjs/story/index.js.map +1 -1
- package/cjs/story/interface/dsl-interface.d.ts +5 -8
- package/cjs/story/interface/dsl-interface.js.map +1 -1
- package/cjs/story/interface/player.d.ts +1 -13
- package/cjs/story/interface/player.js +1 -4
- package/cjs/story/interface/player.js.map +1 -1
- package/cjs/story/interface/runtime-interface.d.ts +3 -3
- package/cjs/story/interface/runtime-interface.js.map +1 -1
- package/cjs/story/story.d.ts +2 -1
- package/cjs/story/story.js +8 -6
- package/cjs/story/story.js.map +1 -1
- package/dist/index.js +53440 -0
- package/dist/index.min.js +20 -0
- package/es/animate/typewirter.d.ts +3 -4
- package/es/animate/typewirter.js +46 -30
- package/es/animate/typewirter.js.map +1 -1
- package/es/constants/action.d.ts +9 -0
- package/es/constants/action.js +11 -1
- package/es/constants/action.js.map +1 -1
- package/es/constants/character.d.ts +0 -1
- package/es/constants/character.js +1 -2
- package/es/constants/character.js.map +1 -1
- package/es/constants/config.js +2 -1
- package/es/dsl/constant/index.d.ts +13 -0
- package/es/dsl/constant/index.js +6 -1
- package/es/dsl/constant/index.js.map +1 -1
- package/es/dsl/story-chart/area.d.ts +2 -0
- package/es/dsl/story-chart/area.js +5 -1
- package/es/dsl/story-chart/area.js.map +1 -1
- package/es/dsl/story-chart/bar.d.ts +2 -0
- package/es/dsl/story-chart/bar.js +1 -1
- package/es/dsl/story-chart/bar.js.map +1 -1
- package/es/dsl/story-chart/chart.js +1 -2
- package/es/dsl/story-chart/line.d.ts +2 -0
- package/es/dsl/story-chart/line.js +1 -1
- package/es/dsl/story-chart/line.js.map +1 -1
- package/es/dsl/story-chart/pie.d.ts +2 -0
- package/es/dsl/story-chart/pie.js +3 -0
- package/es/dsl/story-chart/pie.js.map +1 -1
- package/es/dsl/story-processor/graphic/appear.js.map +1 -1
- package/es/dsl/story-processor/graphic/effect/appear.js +1 -8
- package/es/dsl/story-processor/graphic/effect/appear.js.map +1 -1
- package/es/dsl/story-processor/graphic/effect/typewriter.js +1 -1
- package/es/dsl/story-processor/graphic/effect/typewriter.js.map +1 -1
- package/es/dsl/story-processor/processor.js +1 -1
- package/es/dsl/utils/datum.js +2 -1
- package/es/dsl/utils/flicker.js +1 -1
- package/es/edit/edit-component/layer-edit.js +0 -2
- package/es/edit/edit-component/rect-selection.js +1 -1
- package/es/edit/edit-component/richtext-selection.js +1 -1
- package/es/edit/edit-component/text-selection.js +1 -1
- package/es/index.d.ts +0 -1
- package/es/index.js +1 -3
- package/es/index.js.map +1 -1
- package/es/interface/type.js +1 -2
- package/es/player/interface/player.d.ts +5 -2
- package/es/player/interface/player.js.map +1 -1
- package/es/player/interface/scheduler.d.ts +1 -1
- package/es/player/interface/scheduler.js.map +1 -1
- package/es/player/player.d.ts +7 -2
- package/es/player/player.js +27 -18
- package/es/player/player.js.map +1 -1
- package/es/player/processor/chart/common/chartAppear.d.ts +5 -0
- package/es/player/processor/chart/common/chartAppear.js +4 -0
- package/es/player/processor/chart/common/chartAppear.js.map +1 -0
- package/es/player/processor/chart/common/commonAppear.d.ts +8 -0
- package/es/player/processor/chart/common/commonAppear.js +36 -0
- package/es/player/processor/chart/common/commonAppear.js.map +1 -0
- package/es/player/processor/chart/component/axisAppear.d.ts +2 -2
- package/es/player/processor/chart/component/axisAppear.js +3 -1
- package/es/player/processor/chart/component/axisAppear.js.map +1 -1
- package/es/player/processor/chart/component/commonAppear.d.ts +3 -3
- package/es/player/processor/chart/component/commonAppear.js +3 -14
- package/es/player/processor/chart/component/commonAppear.js.map +1 -1
- package/es/player/processor/chart/component/labelAppear.d.ts +2 -2
- package/es/player/processor/chart/component/labelAppear.js +1 -1
- package/es/player/processor/chart/component/labelAppear.js.map +1 -1
- package/es/player/processor/chart/component/legendsAppear.d.ts +4 -3
- package/es/player/processor/chart/component/legendsAppear.js +2 -2
- package/es/player/processor/chart/component/legendsAppear.js.map +1 -1
- package/es/player/processor/chart/component/titleAppear.d.ts +4 -3
- package/es/player/processor/chart/component/titleAppear.js +2 -2
- package/es/player/processor/chart/component/titleAppear.js.map +1 -1
- package/es/player/processor/chart/seriesmark/commonTransformMarkAppear.d.ts +3 -3
- package/es/player/processor/chart/seriesmark/commonTransformMarkAppear.js.map +1 -1
- package/{cjs/player/processor/chart/seriesmark/transformSymbolAppear.d.ts → es/player/processor/chart/seriesmark/transformArcVisibility.d.ts} +3 -3
- package/es/player/processor/chart/seriesmark/{transformArcAppear.js → transformArcVisibility.js} +3 -4
- package/es/player/processor/chart/seriesmark/transformArcVisibility.js.map +1 -0
- package/es/player/processor/chart/seriesmark/transformLineVisibility.d.ts +12 -0
- package/es/player/processor/chart/seriesmark/transformLineVisibility.js +4 -0
- package/es/player/processor/chart/seriesmark/transformLineVisibility.js.map +1 -0
- package/es/player/processor/chart/seriesmark/transformRectVisibility.d.ts +12 -0
- package/es/player/processor/chart/seriesmark/{transformRectAppear.js → transformRectVisibility.js} +4 -5
- package/es/player/processor/chart/seriesmark/transformRectVisibility.js.map +1 -0
- package/es/player/processor/chart/seriesmark/transformSymbolVisibility.d.ts +12 -0
- package/es/player/processor/chart/seriesmark/transformSymbolVisibility.js +4 -0
- package/es/player/processor/chart/seriesmark/transformSymbolVisibility.js.map +1 -0
- package/es/player/processor/chart/seriesmark/transformTextVisibility.d.ts +12 -0
- package/es/player/processor/chart/seriesmark/transformTextVisibility.js +4 -0
- package/es/player/processor/chart/seriesmark/transformTextVisibility.js.map +1 -0
- package/es/player/processor/chart/transformMap.d.ts +24 -18
- package/es/player/processor/chart/transformMap.js +14 -11
- package/es/player/processor/chart/transformMap.js.map +1 -1
- package/es/player/processor/chart/vchart.d.ts +62 -15
- package/es/player/processor/chart/vchart.js +92 -9
- package/es/player/processor/chart/vchart.js.map +1 -1
- package/es/player/processor/common/bounce-processor.d.ts +3 -0
- package/es/player/processor/common/bounce-processor.js +20 -0
- package/es/player/processor/common/bounce-processor.js.map +1 -0
- package/es/player/processor/common/common.d.ts +5 -0
- package/es/player/processor/common/common.js +12 -0
- package/es/player/processor/common/common.js.map +1 -0
- package/es/player/processor/common/fade-processor.d.ts +4 -0
- package/es/player/processor/common/fade-processor.js +30 -0
- package/es/player/processor/common/fade-processor.js.map +1 -0
- package/es/player/processor/common/move-processor.d.ts +8 -0
- package/es/player/processor/common/move-processor.js +148 -0
- package/es/player/processor/common/move-processor.js.map +1 -0
- package/es/player/processor/common/scale-processor.d.ts +8 -0
- package/es/player/processor/common/scale-processor.js +43 -0
- package/es/player/processor/common/scale-processor.js.map +1 -0
- package/es/player/processor/common/wipe-processor.d.ts +4 -0
- package/es/player/processor/common/wipe-processor.js +36 -0
- package/es/player/processor/common/wipe-processor.js.map +1 -0
- package/es/player/processor/common-processor.js +3 -0
- package/es/player/processor/common-processor.js.map +1 -0
- package/es/player/processor/component/common-component.d.ts +45 -9
- package/es/player/processor/component/common-component.js +97 -73
- package/es/player/processor/component/common-component.js.map +1 -1
- package/es/player/processor/component/image/image-visibility.d.ts +5 -0
- package/es/player/processor/component/image/image-visibility.js +8 -0
- package/es/player/processor/component/image/image-visibility.js.map +1 -0
- package/es/player/processor/component/line/line-visibility.d.ts +5 -0
- package/es/player/processor/component/line/line-visibility.js +8 -0
- package/es/player/processor/component/line/line-visibility.js.map +1 -0
- package/es/player/processor/component/rect/rect-visibility.d.ts +5 -0
- package/es/player/processor/component/rect/rect-visibility.js +8 -0
- package/es/player/processor/component/rect/rect-visibility.js.map +1 -0
- package/es/player/processor/component/shape/shape-visibility.d.ts +5 -0
- package/es/player/processor/component/shape/shape-visibility.js +8 -0
- package/es/player/processor/component/shape/shape-visibility.js.map +1 -0
- package/es/player/processor/component/text/text-visibility.d.ts +6 -0
- package/es/player/processor/component/text/text-visibility.js +39 -0
- package/es/player/processor/component/text/text-visibility.js.map +1 -0
- package/es/player/processor/component/timeline/timeline-visibility.d.ts +15 -0
- package/es/player/processor/component/timeline/timeline-visibility.js +71 -0
- package/es/player/processor/component/timeline/timeline-visibility.js.map +1 -0
- package/es/player/processor/component/utils.d.ts +3 -1
- package/es/player/processor/component/utils.js +13 -0
- package/es/player/processor/component/utils.js.map +1 -1
- package/es/player/processor/interface/action-processor.d.ts +6 -6
- package/es/player/processor/interface/action-processor.js.map +1 -1
- package/es/player/processor/interface/appear-action.d.ts +30 -18
- package/es/player/processor/interface/appear-action.js.map +1 -1
- package/es/player/processor/interface/common-action.d.ts +14 -0
- package/es/player/processor/interface/common-action.js +2 -0
- package/es/player/processor/interface/common-action.js.map +1 -0
- package/es/player/processor/interface/style-action.d.ts +34 -0
- package/es/player/processor/interface/style-action.js +2 -0
- package/es/player/processor/interface/style-action.js.map +1 -0
- package/es/player/processor/processor-item.d.ts +5 -5
- package/es/player/processor/processor-item.js.map +1 -1
- package/es/player/processor/processor.d.ts +3 -3
- package/es/player/processor/processor.js +2 -2
- package/es/player/processor/processor.js.map +1 -1
- package/es/player/processor/processorMap.d.ts +22 -21
- package/es/player/processor/processorMap.js +51 -15
- package/es/player/processor/processorMap.js.map +1 -1
- package/es/player/scheduler.d.ts +4 -3
- package/es/player/scheduler.js +7 -5
- package/es/player/scheduler.js.map +1 -1
- package/es/story/canvas/canvas.d.ts +4 -2
- package/es/story/canvas/canvas.js +18 -10
- package/es/story/canvas/canvas.js.map +1 -1
- package/es/story/character/base/base.d.ts +3 -4
- package/es/story/character/base/base.js +6 -3
- package/es/story/character/base/base.js.map +1 -1
- package/es/story/character/chart/character.d.ts +1 -0
- package/es/story/character/chart/character.js +6 -3
- package/es/story/character/chart/character.js.map +1 -1
- package/es/story/character/chart/graphic/vchart-graphic-render.js +3 -3
- package/es/story/character/chart/graphic/vchart-graphic-render.js.map +1 -1
- package/es/story/character/chart/graphic/vchart-graphic.d.ts +1 -0
- package/es/story/character/chart/graphic/vchart-graphic.js +5 -1
- package/es/story/character/chart/graphic/vchart-graphic.js.map +1 -1
- package/es/story/character/component/character-group/component-group-graphic.d.ts +1 -0
- package/es/story/character/component/character-group/component-group-graphic.js +8 -2
- package/es/story/character/component/character-group/component-group-graphic.js.map +1 -1
- package/es/story/character/component/character.d.ts +4 -3
- package/es/story/character/component/character.js +8 -4
- package/es/story/character/component/character.js.map +1 -1
- package/es/story/character/component/characters/character-richtext.d.ts +1 -6
- package/es/story/character/component/characters/character-richtext.js +0 -12
- package/es/story/character/component/characters/character-richtext.js.map +1 -1
- package/es/story/character/component/characters/character-text.js +2 -2
- package/es/story/character/component/characters/character-text.js.map +1 -1
- package/es/story/character/component/graphic/graphic-base-text.d.ts +23 -0
- package/es/story/character/component/graphic/{graphic-text.js → graphic-base-text.js} +37 -21
- package/es/story/character/component/graphic/graphic-base-text.js.map +1 -0
- package/es/story/character/component/graphic/graphic.d.ts +1 -1
- package/es/story/character/component/graphic/graphic.js.map +1 -1
- package/es/story/character/component/graphic/richtext.d.ts +1 -9
- package/es/story/character/component/graphic/richtext.js +0 -41
- package/es/story/character/component/graphic/richtext.js.map +1 -1
- package/es/story/character/component/graphic/text.d.ts +4 -3
- package/es/story/character/component/graphic/text.js +21 -4
- package/es/story/character/component/graphic/text.js.map +1 -1
- package/es/story/character/component/graphic/timeline.d.ts +6 -0
- package/es/story/character/component/graphic/timeline.js +7 -1
- package/es/story/character/component/graphic/timeline.js.map +1 -1
- package/es/story/character/dsl-interface.d.ts +2 -2
- package/es/story/character/dsl-interface.js.map +1 -1
- package/es/story/character/runtime-interface.d.ts +1 -0
- package/es/story/character/runtime-interface.js.map +1 -1
- package/es/story/character/visactor/character.d.ts +2 -3
- package/es/story/character/visactor/character.js.map +1 -1
- package/es/story/character/visactor/interface.d.ts +1 -0
- package/es/story/character/visactor/interface.js.map +1 -1
- package/es/story/character-tree/character-tree.d.ts +1 -0
- package/es/story/character-tree/character-tree.js +6 -0
- package/es/story/character-tree/character-tree.js.map +1 -1
- package/es/story/index.js +0 -3
- package/es/story/index.js.map +1 -1
- package/es/story/interface/dsl-interface.d.ts +5 -8
- package/es/story/interface/dsl-interface.js.map +1 -1
- package/es/story/interface/player.d.ts +1 -13
- package/es/story/interface/player.js +2 -1
- package/es/story/interface/player.js.map +1 -1
- package/es/story/interface/runtime-interface.d.ts +3 -3
- package/es/story/interface/runtime-interface.js.map +1 -1
- package/es/story/story.d.ts +2 -1
- package/es/story/story.js +8 -6
- package/es/story/story.js.map +1 -1
- package/package.json +7 -7
- package/cjs/player/processor/chart/seriesmark/transformArcAppear.js.map +0 -1
- package/cjs/player/processor/chart/seriesmark/transformLineAppear.js +0 -14
- package/cjs/player/processor/chart/seriesmark/transformLineAppear.js.map +0 -1
- package/cjs/player/processor/chart/seriesmark/transformRectAppear.js.map +0 -1
- package/cjs/player/processor/chart/seriesmark/transformSymbolAppear.js +0 -14
- package/cjs/player/processor/chart/seriesmark/transformSymbolAppear.js.map +0 -1
- package/cjs/player/processor/chart/seriesmark/transformTextAppear.d.ts +0 -12
- package/cjs/player/processor/chart/seriesmark/transformTextAppear.js +0 -14
- package/cjs/player/processor/chart/seriesmark/transformTextAppear.js.map +0 -1
- package/cjs/player/processor/component/image/image-appear.d.ts +0 -5
- package/cjs/player/processor/component/image/image-appear.js +0 -16
- package/cjs/player/processor/component/image/image-appear.js.map +0 -1
- package/cjs/player/processor/component/line/line-appear.d.ts +0 -5
- package/cjs/player/processor/component/line/line-appear.js +0 -16
- package/cjs/player/processor/component/line/line-appear.js.map +0 -1
- package/cjs/player/processor/component/rect/rect-appear.d.ts +0 -5
- package/cjs/player/processor/component/rect/rect-appear.js +0 -16
- package/cjs/player/processor/component/rect/rect-appear.js.map +0 -1
- package/cjs/player/processor/component/shape/shape-appear.d.ts +0 -5
- package/cjs/player/processor/component/shape/shape-appear.js +0 -16
- package/cjs/player/processor/component/shape/shape-appear.js.map +0 -1
- package/cjs/player/processor/component/text/text-appear.d.ts +0 -7
- package/cjs/player/processor/component/text/text-appear.js +0 -34
- package/cjs/player/processor/component/text/text-appear.js.map +0 -1
- package/cjs/player/processor/component/timeline/timeline-appear.d.ts +0 -7
- package/cjs/player/processor/component/timeline/timeline-appear.js +0 -33
- package/cjs/player/processor/component/timeline/timeline-appear.js.map +0 -1
- package/cjs/story/character/component/graphic/graphic-text.d.ts +0 -18
- package/cjs/story/character/component/graphic/graphic-text.js.map +0 -1
- package/cjs/story/player/encode.js +0 -3
- package/cjs/story/player/encode.js.map +0 -1
- package/cjs/story/player/index.js +0 -3
- package/cjs/story/player/index.js.map +0 -1
- package/cjs/story/player/ticker.d.ts +0 -1
- package/cjs/story/player/ticker.js +0 -3
- package/cjs/story/player/ticker.js.map +0 -1
- package/es/player/processor/chart/seriesmark/transformArcAppear.d.ts +0 -12
- package/es/player/processor/chart/seriesmark/transformArcAppear.js.map +0 -1
- package/es/player/processor/chart/seriesmark/transformLineAppear.d.ts +0 -12
- package/es/player/processor/chart/seriesmark/transformLineAppear.js +0 -7
- package/es/player/processor/chart/seriesmark/transformLineAppear.js.map +0 -1
- package/es/player/processor/chart/seriesmark/transformRectAppear.d.ts +0 -12
- package/es/player/processor/chart/seriesmark/transformRectAppear.js.map +0 -1
- package/es/player/processor/chart/seriesmark/transformSymbolAppear.d.ts +0 -12
- package/es/player/processor/chart/seriesmark/transformSymbolAppear.js +0 -7
- package/es/player/processor/chart/seriesmark/transformSymbolAppear.js.map +0 -1
- package/es/player/processor/chart/seriesmark/transformTextAppear.d.ts +0 -12
- package/es/player/processor/chart/seriesmark/transformTextAppear.js +0 -7
- package/es/player/processor/chart/seriesmark/transformTextAppear.js.map +0 -1
- package/es/player/processor/component/image/image-appear.d.ts +0 -5
- package/es/player/processor/component/image/image-appear.js +0 -8
- package/es/player/processor/component/image/image-appear.js.map +0 -1
- package/es/player/processor/component/line/line-appear.d.ts +0 -5
- package/es/player/processor/component/line/line-appear.js +0 -8
- package/es/player/processor/component/line/line-appear.js.map +0 -1
- package/es/player/processor/component/rect/rect-appear.d.ts +0 -5
- package/es/player/processor/component/rect/rect-appear.js +0 -8
- package/es/player/processor/component/rect/rect-appear.js.map +0 -1
- package/es/player/processor/component/shape/shape-appear.d.ts +0 -5
- package/es/player/processor/component/shape/shape-appear.js +0 -8
- package/es/player/processor/component/shape/shape-appear.js.map +0 -1
- package/es/player/processor/component/text/text-appear.d.ts +0 -7
- package/es/player/processor/component/text/text-appear.js +0 -32
- package/es/player/processor/component/text/text-appear.js.map +0 -1
- package/es/player/processor/component/timeline/timeline-appear.d.ts +0 -7
- package/es/player/processor/component/timeline/timeline-appear.js +0 -27
- package/es/player/processor/component/timeline/timeline-appear.js.map +0 -1
- package/es/story/character/component/graphic/graphic-text.d.ts +0 -18
- package/es/story/character/component/graphic/graphic-text.js.map +0 -1
- package/es/story/player/encode.d.ts +0 -1
- package/es/story/player/encode.js +0 -3
- package/es/story/player/encode.js.map +0 -1
- package/es/story/player/index.d.ts +0 -1
- package/es/story/player/index.js +0 -3
- package/es/story/player/index.js.map +0 -1
- package/es/story/player/ticker.d.ts +0 -1
- package/es/story/player/ticker.js +0 -3
- package/es/story/player/ticker.js.map +0 -1
- /package/cjs/{story/player/encode.d.ts → player/processor/common-processor.d.ts} +0 -0
- /package/{cjs/story/player/index.d.ts → es/player/processor/common-processor.d.ts} +0 -0
|
@@ -2,19 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.
|
|
5
|
+
}), exports.GraphicBaseText = exports.MAX_LAYOUT_SIZE = void 0;
|
|
6
6
|
|
|
7
7
|
const layout_1 = require("../../../utils/layout"), vrender_1 = require("@visactor/vrender");
|
|
8
8
|
|
|
9
9
|
exports.MAX_LAYOUT_SIZE = 999999;
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class GraphicBaseText {
|
|
12
12
|
constructor(graphicCharacter) {
|
|
13
13
|
this.updateAttribute = attribute => {
|
|
14
14
|
attribute && (this._graphic.setAttributes(this._transformTextAttributes(attribute)),
|
|
15
15
|
this._updateGraphicCharacterSize());
|
|
16
16
|
}, this._character = graphicCharacter;
|
|
17
17
|
}
|
|
18
|
+
getInitialAttributes() {
|
|
19
|
+
return {
|
|
20
|
+
visible: !0,
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 0,
|
|
23
|
+
textAlign: "center",
|
|
24
|
+
textBaseline: "middle",
|
|
25
|
+
textConfig: [],
|
|
26
|
+
fontSize: 16,
|
|
27
|
+
graphicAlign: "center",
|
|
28
|
+
graphicBaseline: "middle",
|
|
29
|
+
ignoreBuf: !0,
|
|
30
|
+
maxLineWidth: exports.MAX_LAYOUT_SIZE,
|
|
31
|
+
heightLimit: exports.MAX_LAYOUT_SIZE
|
|
32
|
+
};
|
|
33
|
+
}
|
|
18
34
|
show() {
|
|
19
35
|
this._graphic.setAttributes({
|
|
20
36
|
visible: !0
|
|
@@ -25,24 +41,23 @@ class GraphicText {
|
|
|
25
41
|
visible: !1
|
|
26
42
|
});
|
|
27
43
|
}
|
|
28
|
-
|
|
44
|
+
transformTextAttrsToRichTextConfig() {
|
|
29
45
|
var _a, _b;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
heightLimit: exports.MAX_LAYOUT_SIZE
|
|
46
|
+
const textAttr = null !== (_b = null === (_a = this._character.spec.options) || void 0 === _a ? void 0 : _a.text) && void 0 !== _b ? _b : {};
|
|
47
|
+
let textConfig = textAttr.textConfig;
|
|
48
|
+
if ((!textConfig || !textConfig.length) && textAttr.text) {
|
|
49
|
+
const textList = Array.isArray(textAttr.text) ? textAttr.text : [ textAttr.text ];
|
|
50
|
+
textConfig = textList.map(((item, i) => ({
|
|
51
|
+
textAlign: "center",
|
|
52
|
+
textBaseline: "middle",
|
|
53
|
+
text: item + (i < textList.length - 1 ? "\n" : "")
|
|
54
|
+
})));
|
|
55
|
+
}
|
|
56
|
+
return textConfig;
|
|
57
|
+
}
|
|
58
|
+
init() {
|
|
59
|
+
this._graphic = (0, vrender_1.createRichText)(this._transformTextAttributes(Object.assign(Object.assign({}, this.getInitialAttributes()), {
|
|
60
|
+
textConfig: this.transformTextAttrsToRichTextConfig()
|
|
46
61
|
}))), this._character.getGraphicParent().add(this._graphic);
|
|
47
62
|
}
|
|
48
63
|
applyGraphicAttribute(graphicAttribute) {
|
|
@@ -87,7 +102,8 @@ class GraphicText {
|
|
|
87
102
|
angle: layoutData.angle,
|
|
88
103
|
anchor: [ layoutData.width / 2, layoutData.height / 2 ],
|
|
89
104
|
scaleCenter: [ layoutData.width / 2, layoutData.height / 2 ],
|
|
90
|
-
|
|
105
|
+
maxWidth: layoutData.width,
|
|
106
|
+
maxHeight: layoutData.height,
|
|
91
107
|
heightLimit: this._character.graphic.getGraphicAttribute().isResized ? bottom - top : exports.MAX_LAYOUT_SIZE
|
|
92
108
|
}));
|
|
93
109
|
}
|
|
@@ -99,5 +115,5 @@ class GraphicText {
|
|
|
99
115
|
}
|
|
100
116
|
}
|
|
101
117
|
|
|
102
|
-
exports.
|
|
103
|
-
//# sourceMappingURL=graphic-text.js.map
|
|
118
|
+
exports.GraphicBaseText = GraphicBaseText;
|
|
119
|
+
//# sourceMappingURL=graphic-base-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/graphic/graphic-base-text.ts"],"names":[],"mappings":";;;AAAA,kDAA4D;AAG5D,+CAA+D;AAGlD,QAAA,eAAe,GAAG,MAAM,CAAC;AAEtC,MAAa,eAAe;IAG1B,YAAY,gBAAoC;QA2EhD,oBAAe,GAAG,CAAC,SAA6C,EAAQ,EAAE;YACxE,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;gBACtE,IAAI,CAAC,2BAA2B,EAAE,CAAC;aACpC;QACH,CAAC,CAAC;QA/EA,IAAI,CAAC,UAAU,GA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,GAAG,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;YAC1D,QAAQ,EAAE,UAAU,CAAC,KAAK;YAC1B,SAAS,EAAE,UAAU,CAAC,MAAM;YAC5B,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,uBAAe;SACtG,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,2BAA2B;QACjC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,SAAS,EAAE;YAQ5D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;SACjE;IACH,CAAC;IAEO,wBAAwB,CAAC,UAAqC;QACpE,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAjKD,0CAiKC","file":"graphic-base-text.js","sourcesContent":["import { getLayoutFromWidget } from '../../../utils/layout';\nimport type { IWidgetData } from '../../dsl-interface';\nimport type { IRichText, IRichTextGraphicAttribute, TextAlignType, TextBaselineType } from '@visactor/vrender';\nimport { createRichText, createText } from '@visactor/vrender';\nimport type { CharacterComponent } from '../character';\n\nexport const MAX_LAYOUT_SIZE = 999999;\n\nexport class GraphicBaseText {\n private _character: CharacterComponent;\n private _graphic: IRichText;\n constructor(graphicCharacter: CharacterComponent) {\n this._character = graphicCharacter;\n }\n\n getInitialAttributes(): IRichTextGraphicAttribute & { graphicAlign: string; graphicBaseline: string } {\n return {\n visible: true,\n x: 0,\n y: 0,\n textAlign: 'center',\n textBaseline: 'middle',\n textConfig: [],\n fontSize: 16,\n // fill: '#000000',\n // whiteSpace: 'normal',\n graphicAlign: 'center',\n graphicBaseline: 'middle',\n // // compute real height without vrender buffer\n ignoreBuf: true,\n maxLineWidth: MAX_LAYOUT_SIZE,\n heightLimit: MAX_LAYOUT_SIZE\n };\n }\n\n show(): void {\n this._graphic.setAttributes({\n visible: true\n // visibleAll: true,\n });\n }\n hide(): void {\n this._graphic.setAttributes({\n visible: false\n // visibleAll: false,\n });\n }\n\n transformTextAttrsToRichTextConfig() {\n const textAttr = (this._character.spec.options?.text ?? {}) as IRichTextGraphicAttribute;\n let textConfig = textAttr.textConfig;\n\n // 如果是纯文本定义方式\n if (!(textConfig && textConfig.length) && textAttr.text) {\n const textList = Array.isArray(textAttr.text) ? textAttr.text : [textAttr.text];\n textConfig = textList.map((item, i) => {\n return {\n textAlign: 'center',\n textBaseline: 'middle',\n // ...((textAttr || {}) as any),\n text: item + (i < textList.length - 1 ? '\\n' : '')\n };\n });\n }\n\n return textConfig;\n }\n\n init() {\n this._graphic = createRichText(\n this._transformTextAttributes({\n ...this.getInitialAttributes(),\n textConfig: this.transformTextAttrsToRichTextConfig()\n } as any)\n );\n this._character.getGraphicParent().add(this._graphic);\n }\n\n applyGraphicAttribute(graphicAttribute: Partial<IRichTextGraphicAttribute>): void {\n this._graphic.setAttributes({ ...graphicAttribute });\n }\n\n getGraphicAttribute(): IRichTextGraphicAttribute {\n return this._graphic?.attribute;\n }\n\n updateAttribute = (attribute: Partial<IRichTextGraphicAttribute>): void => {\n if (attribute) {\n this._graphic.setAttributes(this._transformTextAttributes(attribute));\n this._updateGraphicCharacterSize();\n }\n };\n\n applyLayoutData(w: Partial<IWidgetData>): void {\n const layoutData = getLayoutFromWidget(w);\n const layoutRatio = this._character.getTextLayoutRatio();\n const graphicAlign = (this._graphic.attribute as any).graphicAlign;\n const graphicBaseline = (this._graphic.attribute as any).graphicBaseline;\n const left = layoutData.width * layoutRatio.left;\n const right = layoutData.width * layoutRatio.right;\n const center = (left + right) / 2;\n const top = layoutData.height * layoutRatio.top;\n const bottom = layoutData.height * layoutRatio.bottom;\n const middle = (top + bottom) / 2;\n let x = center;\n let align: TextAlignType = 'center';\n let y = middle;\n let baseline: TextBaselineType = 'middle';\n switch (graphicAlign) {\n case 'left':\n x = left;\n align = 'left';\n break;\n case 'center':\n x = center;\n align = 'center';\n break;\n case 'right':\n x = right;\n align = 'right';\n break;\n }\n switch (graphicBaseline) {\n case 'top':\n y = top;\n baseline = 'top';\n break;\n case 'middle':\n y = middle;\n baseline = 'middle';\n break;\n case 'bottom':\n y = bottom;\n baseline = 'bottom';\n break;\n }\n\n this._graphic.setAttributes(\n this._transformTextAttributes({\n x,\n y,\n textAlign: align,\n textBaseline: baseline,\n angle: layoutData.angle,\n anchor: [layoutData.width / 2, layoutData.height / 2],\n scaleCenter: [layoutData.width / 2, layoutData.height / 2],\n maxWidth: layoutData.width,\n maxHeight: layoutData.height,\n heightLimit: this._character.graphic.getGraphicAttribute().isResized ? bottom - top : MAX_LAYOUT_SIZE\n })\n );\n }\n\n private _updateGraphicCharacterSize() {\n if (!this._character.graphic.getGraphicAttribute().isResized) {\n // const layoutRatio = this._character.graphic.getTextLayoutRatio();\n // const textHeight = this._graphic.AABBBounds.height();\n // const minGraphicHeight = this._character.graphic.getInitialAttributes().height;\n // const graphicHeight = Math.max(textHeight / (layoutRatio.bottom - layoutRatio.top), minGraphicHeight);\n // this._character.graphic.applyLayoutData({\n // height: graphicHeight\n // });\n this.applyLayoutData(this._character.graphic.getPositionData());\n }\n }\n\n private _transformTextAttributes(attributes: IRichTextGraphicAttribute): IRichTextGraphicAttribute {\n return attributes;\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ export interface IGraphicConstructor {
|
|
|
8
8
|
export declare abstract class Graphic {
|
|
9
9
|
readonly containsShapePoints: boolean;
|
|
10
10
|
type: string;
|
|
11
|
-
protected _character:
|
|
11
|
+
protected _character: any;
|
|
12
12
|
protected _graphic: IGraphic<any>;
|
|
13
13
|
get graphic(): IGraphic<any>;
|
|
14
14
|
constructor(type: string, character: CharacterComponent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/graphic/graphic.ts"],"names":[],"mappings":";;;AAEA,6CAA2C;AAG3C,kDAA4D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AAM,CAAC;QAEpE,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC5D,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC/C,IAAI,CAAC,IAAA,gBAAO,EAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;gBAC7B,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAC;aACnC;QACH,CAAC,CAAC,CAAC;QACH,qBAAqB,CAAC,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;QACvD,qBAAqB,CAAC,WAAW,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5D,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5B,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,qBAAqB,CAAC;IAC/B,CAAC;CACF;AA1HD,0BA0HC","file":"graphic.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender';\nimport type { IAABBBounds, IPointLike } from '@visactor/vutils';\nimport { isValid } from '@visactor/vutils';\nimport type { CharacterComponent } from '../character';\nimport type { IComponentCharacterSpec, IWidgetData } from '../..';\nimport { getLayoutFromWidget } from '../../../utils/layout';\n\nexport interface IGraphicConstructor {\n new (type: string, character: CharacterComponent): Graphic;\n}\n\nexport abstract class Graphic {\n readonly containsShapePoints: boolean = false;\n type: string;\n\n protected _character:
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/graphic/graphic.ts"],"names":[],"mappings":";;;AAEA,6CAA2C;AAG3C,kDAA4D;AAM5D,MAAsB,OAAO;IAM3B,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAGD,YAAY,IAAY,EAAE,SAA6B;QAV9C,wBAAmB,GAAY,KAAK,CAAC;QAW5C,IAA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AC,EAAE;YAC/C,IAAI,CAAC,IAAA,gBAAO,EAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;gBAC7B,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAC;aACnC;QACH,CAAC,CAAC,CAAC;QACH,qBAAqB,CAAC,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;QACvD,qBAAqB,CAAC,WAAW,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5D,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5B,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,qBAAqB,CAAC;IAC/B,CAAC;CACF;AA1HD,0BA0HC","file":"graphic.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender';\nimport type { IAABBBounds, IPointLike } from '@visactor/vutils';\nimport { isValid } from '@visactor/vutils';\nimport type { CharacterComponent } from '../character';\nimport type { IComponentCharacterSpec, IWidgetData } from '../..';\nimport { getLayoutFromWidget } from '../../../utils/layout';\n\nexport interface IGraphicConstructor {\n new (type: string, character: CharacterComponent): Graphic;\n}\n\nexport abstract class Graphic {\n readonly containsShapePoints: boolean = false;\n type: string;\n\n protected _character: any;\n protected _graphic: IGraphic<any>;\n get graphic() {\n return this._graphic;\n }\n // protected _group: IGraphic<any>;\n\n constructor(type: string, character: CharacterComponent) {\n this.type = type;\n this._character = character;\n }\n\n abstract init(): void;\n\n getBounds(): IAABBBounds {\n return this._graphic.AABBBounds;\n }\n\n release() {\n if (this._graphic) {\n this._graphic.parent.removeChild(this._graphic);\n this._graphic = null;\n }\n }\n\n getInitialAttributes(): any {\n return {\n x: 0,\n y: 0,\n width: 120,\n height: 80,\n angle: 0,\n anchor: [60, 40],\n lineWidth: 2,\n stroke: '#000000',\n shapePoints: [] as IPointLike[]\n };\n }\n\n setAttributes(attr: Record<string, any>): void {\n if (!this._graphic) {\n return;\n }\n this._graphic.setAttributes(attr);\n }\n\n show(): void {\n this._graphic.setAttributes({\n visible: true,\n visibleAll: true\n });\n }\n hide(): void {\n this._graphic.setAttributes({\n visible: false,\n visibleAll: false\n });\n }\n\n getGraphicAttribute(): IComponentCharacterSpec['options']['graphic'] {\n return this._graphic?.attribute;\n }\n\n applyGraphicAttribute(graphicAttribute: IComponentCharacterSpec['options']['graphic']): void {\n this._graphic.setAttributes(\n this._transformAttributes({\n ...graphicAttribute\n })\n );\n }\n\n getPositionData() {\n return {\n x: this._graphic.attribute.x,\n y: this._graphic.attribute.y,\n width: this._graphic.attribute.width,\n height: this._graphic.attribute.height,\n angle: this._graphic.attribute.angle,\n shapePoints: this._graphic.attribute.shapePoints\n };\n }\n\n applyLayoutData(layoutData: Partial<IWidgetData>): void {\n this._graphic.setAttributes(\n this._transformAttributes({\n ...getLayoutFromWidget(layoutData),\n shapePoints: this._character.spec.options.shapePoints\n })\n );\n }\n\n getTextLayoutRatio(): { left: number; right: number; top: number; bottom: number } {\n return {\n left: 0,\n right: 1,\n top: 0,\n bottom: 1\n };\n }\n\n protected _transformAttributes(attributes: any): any {\n // const x = attributes.x ?? this._graphic?.attribute.x;\n // const y = attributes.y ?? this._graphic?.attribute.y;\n const width = attributes.width ?? this._graphic?.attribute.width;\n const height = attributes.height ?? this._graphic?.attribute.height;\n\n const transformedAttributes = Object.assign({}, attributes);\n Object.keys(transformedAttributes).forEach(key => {\n if (!isValid(attributes[key])) {\n delete transformedAttributes[key];\n }\n });\n transformedAttributes.anchor = [width / 2, height / 2];\n transformedAttributes.scaleCenter = [width / 2, height / 2];\n transformedAttributes.x = 0;\n transformedAttributes.y = 0;\n return transformedAttributes;\n }\n}\n"]}
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Graphic } from './graphic';
|
|
3
|
-
import type { IWidgetData } from '../../dsl-interface';
|
|
4
|
-
export declare class GraphicRichText extends Graphic {
|
|
5
|
-
protected _graphic: IRichText;
|
|
6
|
-
getInitialAttributes(): Partial<IRichTextAttribute>;
|
|
7
|
-
init(): void;
|
|
8
|
-
applyLayoutData(w: Partial<IWidgetData>): void;
|
|
9
|
-
}
|
|
1
|
+
|
|
@@ -1,48 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.GraphicRichText = void 0;
|
|
6
2
|
|
|
7
|
-
const vrender_1 = require("@visactor/vrender"), graphic_1 = require("./graphic"), layout_1 = require("../../../utils/layout");
|
|
8
|
-
|
|
9
|
-
class GraphicRichText extends graphic_1.Graphic {
|
|
10
|
-
getInitialAttributes() {
|
|
11
|
-
return {
|
|
12
|
-
x: 0,
|
|
13
|
-
y: 0,
|
|
14
|
-
width: 120,
|
|
15
|
-
height: 80,
|
|
16
|
-
maxWidth: 120,
|
|
17
|
-
maxHeight: 80,
|
|
18
|
-
angle: 0,
|
|
19
|
-
fontSize: 16,
|
|
20
|
-
textAlign: "center",
|
|
21
|
-
textBaseline: "middle",
|
|
22
|
-
fill: "#000000",
|
|
23
|
-
lineWidth: 2,
|
|
24
|
-
ignoreBuf: !0,
|
|
25
|
-
stroke: !1,
|
|
26
|
-
ellipsis: !0,
|
|
27
|
-
textConfig: []
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
init() {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
this._graphic || (this._graphic = (0, vrender_1.createRichText)(this._transformAttributes(Object.assign(Object.assign({}, this.getInitialAttributes()), null !== (_b = null === (_a = this._character.spec.options) || void 0 === _a ? void 0 : _a.graphic) && void 0 !== _b ? _b : {}))),
|
|
33
|
-
this._graphic.name = `graphic-richtext-${this._character.id}`, this._character.getGraphicParent().add(this._graphic));
|
|
34
|
-
}
|
|
35
|
-
applyLayoutData(w) {
|
|
36
|
-
const {x: x, y: y, width: width, height: height, angle: angle} = (0, layout_1.getLayoutFromWidget)(w);
|
|
37
|
-
this._graphic.setAttributes(this._transformAttributes({
|
|
38
|
-
x: x,
|
|
39
|
-
y: y,
|
|
40
|
-
angle: angle,
|
|
41
|
-
maxWidth: width,
|
|
42
|
-
maxHeight: height
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
exports.GraphicRichText = GraphicRichText;
|
|
48
3
|
//# sourceMappingURL=richtext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/graphic/richtext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/graphic/richtext.ts"],"names":[],"mappings":"","file":"richtext.js","sourcesContent":["// import type { IRichText, IRichTextAttribute } from '@visactor/vrender';\n// import { createRichText } from '@visactor/vrender';\n// import { Graphic } from './graphic';\n// import type { IWidgetData } from '../../dsl-interface';\n// import { getLayoutFromWidget } from '../../../utils/layout';\n\n// export class GraphicRichText extends Graphic {\n// protected _graphic: IRichText;\n\n// getInitialAttributes() {\n// return {\n// x: 0,\n// y: 0,\n// width: 120,\n// height: 80,\n// maxWidth: 120,\n// maxHeight: 80,\n// angle: 0,\n// fontSize: 16,\n// textAlign: 'center',\n// textBaseline: 'middle',\n// fill: '#000000',\n// lineWidth: 2,\n// ignoreBuf: true,\n// stroke: false,\n// ellipsis: true,\n// textConfig: []\n// } as Partial<IRichTextAttribute>;\n// }\n\n// init() {\n// if (!this._graphic) {\n// this._graphic = createRichText(\n// this._transformAttributes({\n// ...this.getInitialAttributes(),\n// ...(this._character.spec.options?.graphic ?? {})\n// })\n// );\n// this._graphic.name = `graphic-richtext-${this._character.id}`;\n// this._character.getGraphicParent().add(this._graphic);\n// }\n// }\n\n// applyLayoutData(w: Partial<IWidgetData>) {\n// const { x, y, width, height, angle } = getLayoutFromWidget(w);\n// this._graphic.setAttributes(\n// this._transformAttributes({\n// x,\n// y,\n// angle,\n// maxWidth: width,\n// maxHeight: height\n// })\n// );\n// }\n// }\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IRichText } from '@visactor/vrender';
|
|
2
2
|
import type { IPointLike } from '@visactor/vutils';
|
|
3
3
|
import { Graphic } from './graphic';
|
|
4
4
|
import type { IWidgetData } from '../../dsl-interface';
|
|
5
|
-
export declare class
|
|
6
|
-
protected _graphic:
|
|
5
|
+
export declare class GraphicText extends Graphic {
|
|
6
|
+
protected _graphic: IRichText;
|
|
7
7
|
getInitialAttributes(): {
|
|
8
8
|
x: number;
|
|
9
9
|
y: number;
|
|
@@ -19,6 +19,7 @@ export declare class GraphicPureText extends Graphic {
|
|
|
19
19
|
stroke: boolean;
|
|
20
20
|
shapePoints: IPointLike[];
|
|
21
21
|
};
|
|
22
|
+
transformTextAttrsToRichTextConfig(): import("@visactor/vrender").IRichTextCharacter[];
|
|
22
23
|
init(): void;
|
|
23
24
|
applyLayoutData(w: Partial<IWidgetData>): void;
|
|
24
25
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.
|
|
5
|
+
}), exports.GraphicText = void 0;
|
|
6
6
|
|
|
7
|
-
const vrender_1 = require("@visactor/vrender"), graphic_1 = require("./graphic"), layout_1 = require("../../../utils/layout");
|
|
7
|
+
const vrender_1 = require("@visactor/vrender"), graphic_1 = require("./graphic"), layout_1 = require("../../../utils/layout"), richtextCombinedAttrs = [ "fill", "stroke", "fontSize", "fontFamily", "fontStyle", "fontWeight", "lineWidth", "opacity", "fillOpacity", "strokeOpacity" ];
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class GraphicText extends graphic_1.Graphic {
|
|
10
10
|
getInitialAttributes() {
|
|
11
11
|
return {
|
|
12
12
|
x: 0,
|
|
@@ -24,10 +24,25 @@ class GraphicPureText extends graphic_1.Graphic {
|
|
|
24
24
|
shapePoints: []
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
transformTextAttrsToRichTextConfig() {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const textAttr = null !== (_b = null === (_a = this._character.spec.options) || void 0 === _a ? void 0 : _a.graphic) && void 0 !== _b ? _b : {};
|
|
30
|
+
let textConfig = textAttr.textConfig;
|
|
31
|
+
if ((!textConfig || !textConfig.length) && textAttr.text) {
|
|
32
|
+
const textList = Array.isArray(textAttr.text) ? textAttr.text : [ textAttr.text ];
|
|
33
|
+
textConfig = textList.map(((item, i) => ({
|
|
34
|
+
textAlign: textAttr.textAlign,
|
|
35
|
+
textBaseline: textAttr.textBaseline,
|
|
36
|
+
text: item + (i < textList.length - 1 ? "\n" : "")
|
|
37
|
+
})));
|
|
38
|
+
}
|
|
39
|
+
return textConfig;
|
|
40
|
+
}
|
|
27
41
|
init() {
|
|
28
42
|
var _a, _b;
|
|
29
|
-
this._graphic || (this._graphic = (0, vrender_1.
|
|
30
|
-
|
|
43
|
+
this._graphic || (this._graphic = (0, vrender_1.createRichText)(this._transformAttributes(Object.assign(Object.assign(Object.assign({}, this.getInitialAttributes()), null !== (_b = null === (_a = this._character.spec.options) || void 0 === _a ? void 0 : _a.graphic) && void 0 !== _b ? _b : {}), {
|
|
44
|
+
textConfig: this.transformTextAttrsToRichTextConfig()
|
|
45
|
+
}))), this._graphic.name = `graphic-text-${this._character.id}`, this._character.getGraphicParent().add(this._graphic));
|
|
31
46
|
}
|
|
32
47
|
applyLayoutData(w) {
|
|
33
48
|
const {x: x, y: y, width: width, height: height, angle: angle} = (0, layout_1.getLayoutFromWidget)(w);
|
|
@@ -43,5 +58,5 @@ class GraphicPureText extends graphic_1.Graphic {
|
|
|
43
58
|
}
|
|
44
59
|
}
|
|
45
60
|
|
|
46
|
-
exports.
|
|
61
|
+
exports.GraphicText = GraphicText;
|
|
47
62
|
//# sourceMappingURL=text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/graphic/text.ts"],"names":[],"mappings":";;;AAC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{ createRichText, createText } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport { Graphic } from './graphic';\nimport type { IWidgetData } from '../../dsl-interface';\nimport { getLayoutFromWidget } from '../../../utils/layout';\n\nconst richtextCombinedAttrs = [\n 'fill',\n 'stroke',\n 'fontSize',\n 'fontFamily',\n 'fontStyle',\n 'fontWeight',\n 'lineWidth',\n 'opacity',\n 'fillOpacity',\n 'strokeOpacity'\n];\n\nexport class GraphicText extends Graphic {\n protected _graphic: IRichText;\n\n getInitialAttributes() {\n return {\n x: 0,\n y: 0,\n width: 120,\n height: 80,\n angle: 0,\n fontSize: 16,\n textAlign: 'center',\n textBaseline: 'middle',\n fill: '#000000',\n lineWidth: 2,\n ignoreBuf: true,\n stroke: false,\n shapePoints: [] as IPointLike[]\n };\n }\n\n transformTextAttrsToRichTextConfig() {\n const textAttr = (this._character.spec.options?.graphic ?? {}) as IRichTextGraphicAttribute;\n let textConfig = textAttr.textConfig;\n\n // 如果是纯文本定义方式\n if (!(textConfig && textConfig.length) && textAttr.text) {\n const textList = Array.isArray(textAttr.text) ? textAttr.text : [textAttr.text];\n textConfig = textList.map((item, i) => {\n return {\n textAlign: textAttr.textAlign,\n textBaseline: textAttr.textBaseline,\n // ...((textAttr || {}) as any),\n text: item + (i < textList.length - 1 ? '\\n' : '')\n };\n });\n }\n\n return textConfig;\n }\n\n init() {\n if (!this._graphic) {\n this._graphic = createRichText(\n this._transformAttributes({\n ...this.getInitialAttributes(),\n ...(this._character.spec.options?.graphic ?? {}),\n textConfig: this.transformTextAttrsToRichTextConfig()\n })\n );\n this._graphic.name = `graphic-text-${this._character.id}`;\n this._character.getGraphicParent().add(this._graphic);\n }\n }\n\n applyLayoutData(w: Partial<IWidgetData>) {\n const { x, y, width, height, angle } = getLayoutFromWidget(w);\n this._graphic.setAttributes(\n this._transformAttributes({\n x,\n y,\n angle,\n width,\n height,\n maxLineWidth: width,\n heightLimit: height\n })\n );\n }\n}\n"]}
|
|
@@ -7,6 +7,12 @@ export declare class GraphicTimeline extends Graphic {
|
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
clipRange: number;
|
|
10
|
+
activeSymbolStyle: {
|
|
11
|
+
size: number;
|
|
12
|
+
};
|
|
13
|
+
activeLineStyle: {
|
|
14
|
+
lineWidth: number;
|
|
15
|
+
};
|
|
10
16
|
};
|
|
11
17
|
init(): void;
|
|
12
18
|
applyLayoutData(w: Partial<IWidgetData>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/component/graphic/timeline.ts"],"names":[],"mappings":";;;AAAA,qEAAwD;AAGxD,uCAAoC;AAEpC,kDAA4D;AAE5D,MAAa,eAAgB,SAAQ,iBAAO;IAG1C,oBAAoB;QAClB,OAAO;YACL,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;YACJ,SAAS,EAAE,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/graphic/timeline.ts"],"names":[],"mappings":";;;AAAA,qEAAwD;AAGxD,uCAAoC;AAEpC,kDAA4D;AAE5D,MAAa,eAAgB,SAAQ,iBAAO;IAG1C,oBAAoB;QAClB,OAAO;YACL,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;YACJ,SAAS,EAAE,CAAC;YACZ,iBAAiB,EAAE;gBACjB,IAAI,EAAE,EAAE;aACT;YACD,eAAe,EAAE;gBACf,SAAS,EAAE,GAAG;aACf;SACF,CAAC;IACJ,CAAC;IAED,IAAI;;QACF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,6BAAQ,CAC1B,IAAI,CAAC,oBAAoB,iCACpB,IAAI,CAAC,oBAAoB,EAAE,GAC3B,CAAC,MAAA,MAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,0CAAE,OAAO,mCAAI,EAAE,CAAC,EAChD,CACH,CAAC;YACF,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,YAAY,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;YACtD,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvD;IACH,CAAC;IAED,eAAe,CAAC,CAAuB;QACrC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,4BAAmB,EAAC,CAAC,CAAC,CAAC;QAC9D,IAAI,CAAC,QAAQ,CAAC,aAAa,CACzB,IAAI,CAAC,oBAAoB,CAAC;YACxB,CAAC;YACD,CAAC;YACD,KAAK;YACL,KAAK;YACL,MAAM;SACP,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AA1CD,0CA0CC","file":"timeline.js","sourcesContent":["import { Timeline } from '@visactor/vrender-components';\nimport { createText } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport { Graphic } from './graphic';\nimport type { IWidgetData } from '../../dsl-interface';\nimport { getLayoutFromWidget } from '../../../utils/layout';\n\nexport class GraphicTimeline extends Graphic {\n protected _graphic: Timeline;\n\n getInitialAttributes() {\n return {\n x: 0,\n y: 0,\n clipRange: 0,\n activeSymbolStyle: {\n size: 26\n },\n activeLineStyle: {\n lineWidth: 1.5\n }\n };\n }\n\n init() {\n if (!this._graphic) {\n this._graphic = new Timeline(\n this._transformAttributes({\n ...this.getInitialAttributes(),\n ...(this._character.spec.options?.graphic ?? {})\n })\n );\n this._graphic.name = `timeline-${this._character.id}`;\n this._character.getGraphicParent().add(this._graphic);\n }\n }\n\n applyLayoutData(w: Partial<IWidgetData>) {\n const { x, y, width, height, angle } = getLayoutFromWidget(w);\n this._graphic.setAttributes(\n this._transformAttributes({\n x,\n y,\n angle,\n width,\n height\n })\n );\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ITextGraphicAttribute } from '@visactor/vrender';
|
|
1
|
+
import type { IRichTextGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender';
|
|
2
2
|
import type { DirectionType } from './chart/const';
|
|
3
3
|
export type IPercent = `${number}%`;
|
|
4
4
|
export type WidgetNumber = number;
|
|
@@ -21,7 +21,7 @@ export interface ICharacterSpecBase {
|
|
|
21
21
|
export type IEditorTextGraphicAttribute = {
|
|
22
22
|
graphicAlign?: 'left' | 'center' | 'right';
|
|
23
23
|
graphicBaseline?: 'top' | 'middle' | 'bottom';
|
|
24
|
-
} & ITextGraphicAttribute
|
|
24
|
+
} & Partial<ITextGraphicAttribute & IRichTextGraphicAttribute>;
|
|
25
25
|
export interface IComponentCharacterSpec extends ICharacterSpecBase {
|
|
26
26
|
options: {
|
|
27
27
|
graphic: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/dsl-interface.ts"],"names":[],"mappings":"","file":"dsl-interface.js","sourcesContent":["import type { ITextGraphicAttribute } from '@visactor/vrender';\nimport type { DirectionType } from './chart/const';\n\nexport type IPercent = `${number}%`;\nexport type WidgetNumber = number; // | IPercent;\n\nexport type IWidgetData = {\n left: WidgetNumber;\n top: WidgetNumber;\n} & (\n | {\n bottom: WidgetNumber;\n right: WidgetNumber;\n }\n | {\n width: WidgetNumber;\n height: WidgetNumber;\n }\n);\n\nexport interface ICharacterSpecBase {\n id: string;\n type: string; // 类型\n position: IWidgetData; // 定位描述\n zIndex: number;\n}\n\nexport type IEditorTextGraphicAttribute = {\n graphicAlign?: 'left' | 'center' | 'right';\n graphicBaseline?: 'top' | 'middle' | 'bottom';\n} & ITextGraphicAttribute
|
|
1
|
+
{"version":3,"sources":["../src/story/character/dsl-interface.ts"],"names":[],"mappings":"","file":"dsl-interface.js","sourcesContent":["import type { IRichTextGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender';\nimport type { DirectionType } from './chart/const';\n\nexport type IPercent = `${number}%`;\nexport type WidgetNumber = number; // | IPercent;\n\nexport type IWidgetData = {\n left: WidgetNumber;\n top: WidgetNumber;\n} & (\n | {\n bottom: WidgetNumber;\n right: WidgetNumber;\n }\n | {\n width: WidgetNumber;\n height: WidgetNumber;\n }\n);\n\nexport interface ICharacterSpecBase {\n id: string;\n type: string; // 类型\n position: IWidgetData; // 定位描述\n zIndex: number;\n}\n\nexport type IEditorTextGraphicAttribute = {\n graphicAlign?: 'left' | 'center' | 'right';\n graphicBaseline?: 'top' | 'middle' | 'bottom';\n} & Partial<ITextGraphicAttribute & IRichTextGraphicAttribute>;\n\nexport interface IComponentCharacterSpec extends ICharacterSpecBase {\n options: {\n graphic: any;\n text?: IEditorTextGraphicAttribute;\n isResized?: boolean;\n angle?: number;\n shapePoints?: any;\n };\n}\n\nexport interface IComponentMatch {\n usrId?: string;\n specIndex?: number | 'all'; // all 表示所有\n [key: string]: any;\n}\n\nexport interface IComponentSpec {\n specKey: string;\n matchInfo: IComponentMatch;\n spec: any;\n}\n\nexport interface IChartCharacterSpec extends ICharacterSpecBase {\n options: {\n // 图表spec\n spec?: any;\n panel?: any;\n // 各种图表配置属性\n theme?: any;\n // 数据源\n data?: any;\n // 内部模块布局信息\n padding?: any;\n // 标题\n title?: any;\n layout?: any;\n // 色板\n color?: string[];\n // 标注\n marker?: any;\n // mark单元素样式配置\n markStyle?: any[];\n // 组样式\n dataGroupSpec?: {\n [key: string]: any;\n };\n // 方向\n direction?: DirectionType;\n // 系列配置\n seriesSpec?: {\n matchInfo: IComponentMatch;\n spec: any;\n }[];\n // 模块 spec\n componentSpec?: IComponentSpec[];\n };\n}\n\nexport type ICharacterSpec = IChartCharacterSpec | IComponentCharacterSpec;\n"]}
|
|
@@ -20,6 +20,7 @@ export interface ICharacter {
|
|
|
20
20
|
checkEvent: (event: StoryEvent) => false | (ICharacterPickInfo & any);
|
|
21
21
|
updateSpec: (spec: Omit<Partial<ICharacterSpec>, 'id' | 'type'>) => void;
|
|
22
22
|
setAttributes: (attr: Record<string, any>) => void;
|
|
23
|
+
release: () => void;
|
|
23
24
|
}
|
|
24
25
|
export interface ICharacterInitOption {
|
|
25
26
|
story: IStory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/runtime-interface.ts"],"names":[],"mappings":"","file":"runtime-interface.js","sourcesContent":["import type { IGroup } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { StoryCanvas } from '../canvas/canvas';\nimport type { IStory, IStoryCanvas, StoryEvent } from '../interface/runtime-interface';\nimport type { ICharacterSpec } from './dsl-interface';\nimport type { Graphic } from './component/graphic/graphic';\n\nexport interface ICharacterPickInfo {\n part: string;\n graphicType: string;\n}\nexport interface ICharacter {\n id: string;\n spec: ICharacterSpec;\n\n init: () => void;\n reset: () => void;\n show: () => void;\n hide: () => void;\n getGraphicParent: () => IGroup;\n graphic: Graphic | IGroup;\n tickTo: (t: number) => void;\n\n checkEvent: (event: StoryEvent) => false | (ICharacterPickInfo & any);\n\n updateSpec: (spec: Omit<Partial<ICharacterSpec>, 'id' | 'type'>) => void;\n\n setAttributes: (attr: Record<string, any>) => void;\n}\n\nexport interface ICharacterInitOption {\n story: IStory;\n canvas: IStoryCanvas;\n graphicParent: IGroup;\n}\n\nexport interface ICharacterConstructor {\n new (spec: ICharacterSpec, option: ICharacterInitOption): ICharacter;\n}\n\nexport interface ILayoutAttribute {\n x: number;\n y: number;\n width: number;\n height: number;\n angle: number;\n anchor?: [number | string, number | string];\n dx?: number;\n dy?: number;\n shapePoints?: IPointLike[];\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/story/character/runtime-interface.ts"],"names":[],"mappings":"","file":"runtime-interface.js","sourcesContent":["import type { IGroup } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { StoryCanvas } from '../canvas/canvas';\nimport type { IStory, IStoryCanvas, StoryEvent } from '../interface/runtime-interface';\nimport type { ICharacterSpec } from './dsl-interface';\nimport type { Graphic } from './component/graphic/graphic';\n\nexport interface ICharacterPickInfo {\n part: string;\n graphicType: string;\n}\nexport interface ICharacter {\n id: string;\n spec: ICharacterSpec;\n\n init: () => void;\n reset: () => void;\n show: () => void;\n hide: () => void;\n getGraphicParent: () => IGroup;\n graphic: Graphic | IGroup;\n tickTo: (t: number) => void;\n\n checkEvent: (event: StoryEvent) => false | (ICharacterPickInfo & any);\n\n updateSpec: (spec: Omit<Partial<ICharacterSpec>, 'id' | 'type'>) => void;\n\n setAttributes: (attr: Record<string, any>) => void;\n release: () => void;\n}\n\nexport interface ICharacterInitOption {\n story: IStory;\n canvas: IStoryCanvas;\n graphicParent: IGroup;\n}\n\nexport interface ICharacterConstructor {\n new (spec: ICharacterSpec, option: ICharacterInitOption): ICharacter;\n}\n\nexport interface ILayoutAttribute {\n x: number;\n y: number;\n width: number;\n height: number;\n angle: number;\n anchor?: [number | string, number | string];\n dx?: number;\n dy?: number;\n shapePoints?: IPointLike[];\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ICharacterSpec } from 'src/story/character/dsl-interface';
|
|
2
2
|
import { CharacterBase } from '../base/base';
|
|
3
|
-
import type { ISpecProcess, ICharacterVisactor
|
|
3
|
+
import type { ISpecProcess, ICharacterVisactor } from './interface';
|
|
4
4
|
import { ICharacterInitOption } from '../runtime-interface';
|
|
5
5
|
import { IChartCharacterRuntime } from '../chart/runtime/interface';
|
|
6
6
|
export declare abstract class CharacterVisactor extends CharacterBase implements ICharacterVisactor {
|
|
@@ -9,7 +9,6 @@ export declare abstract class CharacterVisactor extends CharacterBase implements
|
|
|
9
9
|
get dataTempTransform(): import("./interface").IDataTempTransform;
|
|
10
10
|
get chartType(): string;
|
|
11
11
|
get tempType(): string;
|
|
12
|
-
protected _graphic: IVisactorGraphic;
|
|
13
12
|
protected _runtime: IChartCharacterRuntime[];
|
|
14
13
|
constructor(spec: ICharacterSpec, option: ICharacterInitOption);
|
|
15
14
|
protected _initRuntime(): void;
|
|
@@ -24,7 +23,7 @@ export declare abstract class CharacterVisactor extends CharacterBase implements
|
|
|
24
23
|
protected abstract _updateVisactorSpec(): void;
|
|
25
24
|
show(): void;
|
|
26
25
|
hide(): void;
|
|
27
|
-
getGraphicParent():
|
|
26
|
+
getGraphicParent(): any;
|
|
28
27
|
tickTo(t: number): void;
|
|
29
28
|
release(): void;
|
|
30
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/visactor/character.ts"],"names":[],"mappings":";;;AAEA,uCAA6C;AAK7C,MAAsB,iBAAkB,SAAQ,oBAAa;IAE3D,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC;IAC7C,CAAC;IAED,IAAI,SAAS;;QACX,OAAO,MAAA,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,0CAAE,YAAY,EAAE,CAAC;IACtE,CAAC;IAED,IAAI,QAAQ;;QACV,OAAO,MAAA,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,0CAAE,IAAI,CAAC;IAC5D,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/story/character/visactor/character.ts"],"names":[],"mappings":";;;AAEA,uCAA6C;AAK7C,MAAsB,iBAAkB,SAAQ,oBAAa;IAE3D,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC;IAC7C,CAAC;IAED,IAAI,SAAS;;QACX,OAAO,MAAA,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,0CAAE,YAAY,EAAE,CAAC;IACtE,CAAC;IAED,IAAI,QAAQ;;QACV,OAAO,MAAA,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,0CAAE,IAAI,CAAC;IAC5D,CAAC;IAID,YAAY,IAAoB,EAAE,MAA4B;QAC5D,KAAK,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/* eslint-disable no-console */\nimport { ICharacterSpec } from 'src/story/character/dsl-interface';\nimport { CharacterBase } from '../base/base';\nimport type { ISpecProcess, ICharacterVisactor, IVisactorGraphic } from './interface';\nimport { ICharacterInitOption } from '../runtime-interface';\nimport { IChartCharacterRuntime } from '../chart/runtime/interface';\n\nexport abstract class CharacterVisactor extends CharacterBase implements ICharacterVisactor {\n protected declare _specProcess: ISpecProcess;\n get specProcess() {\n return this._specProcess;\n }\n get dataTempTransform() {\n return this._specProcess.dataTempTransform;\n }\n\n get chartType() {\n return this._specProcess.dataTempTransform.specTemp?.getChartType();\n }\n\n get tempType() {\n return this._specProcess.dataTempTransform.specTemp?.type;\n }\n\n protected _runtime: IChartCharacterRuntime[] = [];\n\n constructor(spec: ICharacterSpec, option: ICharacterInitOption) {\n super(spec, option);\n this._initSpecProcess();\n }\n\n protected _initRuntime(): void {}\n\n clearConfig(opt: { clearCurrent: false | { [key: string]: any } }) {\n // do nothing\n }\n\n protected abstract _initSpecProcess(): void;\n\n onSpecReady = () => {\n console.log('onSpecReady !');\n this._runtime.forEach(r => r.onSpecReady?.());\n this._specProcess.dataTempTransform.specTemp?.standardizedSpec(this._specProcess.getVisSpec(), { character: this });\n this._updateVisactorSpec();\n this._afterRender();\n };\n\n protected abstract _afterRender(): void;\n\n protected abstract _updateVisactorSpec(): void;\n\n show(): void {\n this._graphic.setAttribute('visibleAll', true);\n }\n hide(): void {\n this._graphic.setAttribute('visibleAll', false);\n }\n\n getGraphicParent() {\n return this._graphic;\n }\n\n tickTo(t: number): void {\n return;\n }\n\n release() {\n this._specProcess.release();\n this._graphic?.parent?.removeChild(this._graphic);\n this._specProcess = this._graphic = null;\n }\n}\n"]}
|
|
@@ -84,6 +84,7 @@ export interface IVisactorTempConstructor {
|
|
|
84
84
|
export interface IVisactorGraphic extends IGroup {
|
|
85
85
|
readonly vProduct: IVChart;
|
|
86
86
|
updateSpec: (spec: any) => void;
|
|
87
|
+
release: () => void;
|
|
87
88
|
}
|
|
88
89
|
export interface ICharacterVisactor extends ICharacter {
|
|
89
90
|
clearConfig: (opt: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character/visactor/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IChartCharacterSpec } from '../dsl-interface';\nimport type { EventEmitter } from '@visactor/vutils';\nimport type { ICharacter } from '../runtime-interface';\nimport type { ISpec, IVChart } from '@visactor/vchart';\nimport type { IGroup } from '@visactor/vrender';\n\nexport type StandardData = IDataValue | IDataValue[];\nexport type IParserValue = any;\nexport type DataUpdateCall = (data: StandardData) => void;\nexport type DataErrorCall = (msg: { type: string; info: string }, opt?: any) => void;\n\n// visactor 元素的内部结构\n// 数据部分 start\n// DataParser:数据处理。负责解析数据,得到模版可用数据,处理数据上的特性内容。\n// VisactorTemp:模版处理。负责结合数据,生成对应类型的基础 spec。不同类型图表的特殊逻辑,在 temp 中处理\n// DataTempTransform:数据与模版更新管理,当数据/模版更新时,通过这个模块判定更新是否成功,成功后抛出更新成功消息。包含 VisactorTemp 与 DataParser\n// SpecProcess:编辑配置管理器,编辑属性更新的处理,对外输出合并了编辑信息的 spec 。包含一个 dataTempTransform\n// 数据部分 end\n\n// graphic 部分 start\n// IVisactorGraphic:包含一个 vchart|vtbale 。visactor 的自定义图元封装。处理图元是否重绘,viewBox的图元属性逻辑\n// IVisactorGraphic-render:实际的 draw 入口,处理绘图过程,主要是处理变换矩阵。\n// graphic 部分 end\n\n// Visactor-role:编辑元素,包含一个 specProcess、IVisactorGraphic\n\nexport interface IDataTempTransform {\n readonly specTemp: IVisactorTemp;\n\n readonly nextTemp: IVisactorTemp;\n emitter: EventEmitter;\n\n updateChartTemp: (temp?: string) => void;\n\n // 得到没有经过编辑器配置加工过的基础spec\n getBaseSpec: () => any;\n\n // 释放\n release: () => void;\n\n dataParser?: IDataParser;\n}\n\nexport interface IDataTempTransformConstructor {\n new ({ specProcess, character }: { character: ICharacterVisactor; specProcess: ISpecProcess }): IDataTempTransform;\n}\n\nexport interface ISpecProcess {\n dataTempTransform: IDataTempTransform;\n emitter: EventEmitter;\n\n // 得到visactor元素的spec\n getVisSpec: () => ISpec;\n // 得到角色的spec\n getCharacterSpec: () => IChartCharacterSpec;\n\n // temp\n getCharacterType: () => string;\n\n release: () => void;\n}\n\nexport type IDataType = any;\n\nexport interface IDataValue {\n id: string;\n sourceKey: string;\n values: IDataType[];\n}\n\nexport type DataInfo = {\n [key: string]: {\n type: 'ordinal' | 'linear';\n };\n};\n\nexport type DataSave = {\n type: string;\n value: any;\n};\n\nexport interface IDataParser {\n type: string;\n getData: () => StandardData;\n getDataValue: () => IParserValue;\n getDataInfo?: () => DataInfo;\n getSpecOption?: () => any;\n getSave: () => DataSave;\n updateValue: (value: IParserValue) => void;\n setDataUpdateHandler: (call: DataUpdateCall) => void;\n setDataErrorHandler: (call: DataErrorCall) => void;\n clear: () => void;\n}\n\nexport interface IDataParserConstructor {\n type: string;\n new (\n value: any,\n option: {\n updateCall: DataUpdateCall;\n errorCall: DataErrorCall;\n currentData?: IDataParser;\n emitter: EventEmitter;\n }\n ): IDataParser;\n}\n\n// chart & table 都是用这个模版接口\nexport interface IVisactorTemp {\n type: string;\n getSpec: (data: StandardData, ctx: any, opt?: any) => ISpec | null;\n standardizedSpec: (spec: any, ctx: any, opt?: any) => void;\n getChartType: () => string;\n checkDataEnable: (data: StandardData, opt?: any) => boolean;\n getTempInfo?: () => any;\n clear: () => void;\n}\n\nexport interface IVisactorTempConstructor {\n new (): IVisactorTemp;\n}\n\n// 绘图元素\nexport interface IVisactorGraphic extends IGroup {\n readonly vProduct: IVChart;\n\n updateSpec: (spec: any) => void;\n}\n\n// 编辑元素\nexport interface ICharacterVisactor extends ICharacter {\n // 清除编辑数据\n clearConfig: (opt: { clearCurrent: false | { [key: string]: any } }) => void;\n getGraphicParent: () => IVisactorGraphic;\n}\n\nexport interface IUpdateAttributeOption {\n triggerHistory?: boolean;\n saveData?: boolean;\n actionType?: 'data-add' | 'data-change' | 'data-replace' | string;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/story/character/visactor/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IChartCharacterSpec } from '../dsl-interface';\nimport type { EventEmitter } from '@visactor/vutils';\nimport type { ICharacter } from '../runtime-interface';\nimport type { ISpec, IVChart } from '@visactor/vchart';\nimport type { IGroup } from '@visactor/vrender';\n\nexport type StandardData = IDataValue | IDataValue[];\nexport type IParserValue = any;\nexport type DataUpdateCall = (data: StandardData) => void;\nexport type DataErrorCall = (msg: { type: string; info: string }, opt?: any) => void;\n\n// visactor 元素的内部结构\n// 数据部分 start\n// DataParser:数据处理。负责解析数据,得到模版可用数据,处理数据上的特性内容。\n// VisactorTemp:模版处理。负责结合数据,生成对应类型的基础 spec。不同类型图表的特殊逻辑,在 temp 中处理\n// DataTempTransform:数据与模版更新管理,当数据/模版更新时,通过这个模块判定更新是否成功,成功后抛出更新成功消息。包含 VisactorTemp 与 DataParser\n// SpecProcess:编辑配置管理器,编辑属性更新的处理,对外输出合并了编辑信息的 spec 。包含一个 dataTempTransform\n// 数据部分 end\n\n// graphic 部分 start\n// IVisactorGraphic:包含一个 vchart|vtbale 。visactor 的自定义图元封装。处理图元是否重绘,viewBox的图元属性逻辑\n// IVisactorGraphic-render:实际的 draw 入口,处理绘图过程,主要是处理变换矩阵。\n// graphic 部分 end\n\n// Visactor-role:编辑元素,包含一个 specProcess、IVisactorGraphic\n\nexport interface IDataTempTransform {\n readonly specTemp: IVisactorTemp;\n\n readonly nextTemp: IVisactorTemp;\n emitter: EventEmitter;\n\n updateChartTemp: (temp?: string) => void;\n\n // 得到没有经过编辑器配置加工过的基础spec\n getBaseSpec: () => any;\n\n // 释放\n release: () => void;\n\n dataParser?: IDataParser;\n}\n\nexport interface IDataTempTransformConstructor {\n new ({ specProcess, character }: { character: ICharacterVisactor; specProcess: ISpecProcess }): IDataTempTransform;\n}\n\nexport interface ISpecProcess {\n dataTempTransform: IDataTempTransform;\n emitter: EventEmitter;\n\n // 得到visactor元素的spec\n getVisSpec: () => ISpec;\n // 得到角色的spec\n getCharacterSpec: () => IChartCharacterSpec;\n\n // temp\n getCharacterType: () => string;\n\n release: () => void;\n}\n\nexport type IDataType = any;\n\nexport interface IDataValue {\n id: string;\n sourceKey: string;\n values: IDataType[];\n}\n\nexport type DataInfo = {\n [key: string]: {\n type: 'ordinal' | 'linear';\n };\n};\n\nexport type DataSave = {\n type: string;\n value: any;\n};\n\nexport interface IDataParser {\n type: string;\n getData: () => StandardData;\n getDataValue: () => IParserValue;\n getDataInfo?: () => DataInfo;\n getSpecOption?: () => any;\n getSave: () => DataSave;\n updateValue: (value: IParserValue) => void;\n setDataUpdateHandler: (call: DataUpdateCall) => void;\n setDataErrorHandler: (call: DataErrorCall) => void;\n clear: () => void;\n}\n\nexport interface IDataParserConstructor {\n type: string;\n new (\n value: any,\n option: {\n updateCall: DataUpdateCall;\n errorCall: DataErrorCall;\n currentData?: IDataParser;\n emitter: EventEmitter;\n }\n ): IDataParser;\n}\n\n// chart & table 都是用这个模版接口\nexport interface IVisactorTemp {\n type: string;\n getSpec: (data: StandardData, ctx: any, opt?: any) => ISpec | null;\n standardizedSpec: (spec: any, ctx: any, opt?: any) => void;\n getChartType: () => string;\n checkDataEnable: (data: StandardData, opt?: any) => boolean;\n getTempInfo?: () => any;\n clear: () => void;\n}\n\nexport interface IVisactorTempConstructor {\n new (): IVisactorTemp;\n}\n\n// 绘图元素\nexport interface IVisactorGraphic extends IGroup {\n readonly vProduct: IVChart;\n\n updateSpec: (spec: any) => void;\n release: () => void;\n}\n\n// 编辑元素\nexport interface ICharacterVisactor extends ICharacter {\n // 清除编辑数据\n clearConfig: (opt: { clearCurrent: false | { [key: string]: any } }) => void;\n getGraphicParent: () => IVisactorGraphic;\n}\n\nexport interface IUpdateAttributeOption {\n triggerHistory?: boolean;\n saveData?: boolean;\n actionType?: 'data-add' | 'data-change' | 'data-replace' | string;\n}\n"]}
|
|
@@ -26,6 +26,7 @@ class CharacterTree {
|
|
|
26
26
|
this._characters[spec.id]) : null;
|
|
27
27
|
}
|
|
28
28
|
initCharacters(specs) {
|
|
29
|
+
this.releaseOldCharacters(), this._characters = {};
|
|
29
30
|
const option = {
|
|
30
31
|
story: this._story,
|
|
31
32
|
canvas: this._story.canvas,
|
|
@@ -35,6 +36,11 @@ class CharacterTree {
|
|
|
35
36
|
spec.id && (this._characters[spec.id] || (this._characters[spec.id] = factory_1.StoryFactory.createCharacter(spec, option)));
|
|
36
37
|
}));
|
|
37
38
|
}
|
|
39
|
+
releaseOldCharacters() {
|
|
40
|
+
Object.keys(this._characters).forEach((k => {
|
|
41
|
+
this._characters[k].release();
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
exports.CharacterTree = CharacterTree;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/character-tree/character-tree.ts"],"names":[],"mappings":";;;AACA,gDAAkD;AAGlD,MAAa,aAAa;IAIxB,YAAY,KAAa;QAHf,gBAAW,GAAkC,EAAE,CAAC;QAIxD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,iBAAiB,CAAC,GAAW;QAC3B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;IACvC,CAAC;IAED,YAAY,CAAC,IAAoB;QAC/B,MAAM,MAAM,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,YAAY;SAC1D,CAAC;QACF,IAAqB,IAAK,CAAC,EAAE,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAkB,IAAK,CAAC,EAA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AAC,CAAC,EAAE;YACxC,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC,CAAC,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxDD,sCAwDC","file":"character-tree.js","sourcesContent":["import type { ICharacter, ICharacterSpec } from '../character';\nimport { StoryFactory } from '../factory/factory';\nimport type { ICharacterTree, IStory } from '../interface';\n\nexport class CharacterTree implements ICharacterTree {\n protected _characters: { [key: string]: ICharacter } = {};\n protected _story: IStory;\n\n constructor(story: IStory) {\n this._story = story;\n }\n\n getCharacters(): { [key: string]: ICharacter } {\n return this._characters;\n }\n\n getCharactersById(key: string) {\n return this._characters[key] || null;\n }\n\n addCharacter(spec: ICharacterSpec) {\n const option = {\n story: this._story,\n canvas: this._story.canvas,\n graphicParent: this._story.canvas.getStage().defaultLayer\n };\n if ((<ICharacterSpec>spec).id) {\n if (!this._characters[(<ICharacterSpec>spec).id]) {\n this._characters[(<ICharacterSpec>spec).id] = StoryFactory.createCharacter(<ICharacterSpec>spec, option);\n }\n return this._characters[(<ICharacterSpec>spec).id];\n }\n return null;\n }\n\n initCharacters(specs: ICharacterSpec[]): void {\n this.releaseOldCharacters();\n this._characters = {};\n const option = {\n story: this._story,\n canvas: this._story.canvas,\n graphicParent: this._story.canvas.getStage().defaultLayer\n };\n\n specs.forEach(spec => {\n if ((<ICharacterSpec>spec).id) {\n if (!this._characters[(<ICharacterSpec>spec).id]) {\n this._characters[(<ICharacterSpec>spec).id] = StoryFactory.createCharacter(<ICharacterSpec>spec, option);\n }\n // return this._characters[(<ICharacterSpec>spec).id];\n }\n });\n }\n\n releaseOldCharacters() {\n Object.keys(this._characters).forEach(k => {\n const c = this._characters[k];\n c.release();\n });\n }\n}\n"]}
|
package/cjs/story/index.js
CHANGED
|
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
value: !0
|
|
20
20
|
}), exports.registerCharacter = void 0;
|
|
21
21
|
|
|
22
|
-
const character_qipao_1 = require("./character/component/characters/character-qipao"), character_rect_1 = require("./character/component/characters/character-rect"), factory_1 = require("./factory/factory"), vrender_1 = require("@visactor/vrender"), vrender_2 = require("@visactor/vrender"), vchart_graphic_render_1 = require("./character/chart/graphic/vchart-graphic-render"), character_text_1 = require("./character/component/characters/character-text"),
|
|
22
|
+
const character_qipao_1 = require("./character/component/characters/character-qipao"), character_rect_1 = require("./character/component/characters/character-rect"), factory_1 = require("./factory/factory"), vrender_1 = require("@visactor/vrender"), vrender_2 = require("@visactor/vrender"), vchart_graphic_render_1 = require("./character/chart/graphic/vchart-graphic-render"), character_text_1 = require("./character/component/characters/character-text"), vchart_graphic_picker_1 = require("./character/chart/graphic/vchart-graphic-picker"), character_1 = require("../constants/character"), character_line_1 = require("./character/component/characters/character-line"), character_image_1 = require("./character/component/characters/character-image"), character_shape_1 = require("./character/component/characters/character-shape"), vchart_1 = require("./character/chart/characters/vchart"), component_group_graphic_render_1 = require("./character/component/character-group/component-group-graphic-render"), character_timeline_1 = require("./character/component/characters/character-timeline"), splitModule = new vrender_1.ContainerModule((bind => {
|
|
23
23
|
bind(vchart_graphic_render_1.VChartRender).toSelf().inSingletonScope(), bind(vchart_graphic_render_1.ChartRender).toService(vchart_graphic_render_1.VChartRender),
|
|
24
24
|
bind(vrender_1.GraphicRender).toService(vchart_graphic_render_1.ChartRender), bind(vchart_graphic_picker_1.VChartPicker).to(vchart_graphic_picker_1.VChartPicker).inSingletonScope(),
|
|
25
25
|
bind(vrender_2.CanvasPickerContribution).toService(vchart_graphic_picker_1.VChartPicker),
|
|
@@ -33,7 +33,6 @@ function registerCharacter() {
|
|
|
33
33
|
_register || (_register = !0, factory_1.StoryFactory.registerCharacter(vchart_1.VChartCharacter.type, vchart_1.VChartCharacter),
|
|
34
34
|
factory_1.StoryFactory.registerCharacter(character_1.StoryComponentType.RECT, character_rect_1.CharacterComponentRect),
|
|
35
35
|
factory_1.StoryFactory.registerCharacter(character_1.StoryComponentType.TEXT, character_text_1.CharacterComponentText),
|
|
36
|
-
factory_1.StoryFactory.registerCharacter(character_1.StoryComponentType.RICH_TEXT, character_richtext_1.CharacterComponentRichText),
|
|
37
36
|
factory_1.StoryFactory.registerCharacter(character_1.StoryComponentType.QIPAO, character_qipao_1.CharacterComponentQipao),
|
|
38
37
|
factory_1.StoryFactory.registerCharacter(character_1.StoryComponentType.LINE, character_line_1.CharacterComponentLine),
|
|
39
38
|
factory_1.StoryFactory.registerCharacter(character_1.StoryComponentType.IMAGE, character_image_1.CharacterComponentImage),
|