@visactor/vrender-kits 0.21.0-vstory.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/canvas/contributions/browser/context.d.ts +3 -0
- package/cjs/canvas/contributions/browser/context.js +2 -2
- package/cjs/canvas/contributions/browser/context.js.map +1 -1
- package/cjs/canvas/contributions/harmony/context.js +2 -2
- package/cjs/canvas/contributions/harmony/context.js.map +1 -1
- package/cjs/canvas/contributions/lynx/context.js +2 -2
- package/cjs/canvas/contributions/lynx/context.js.map +1 -1
- package/cjs/canvas/contributions/taro/context.js +5 -5
- package/cjs/canvas/contributions/taro/context.js.map +1 -1
- package/cjs/env/contributions/feishu-contribution.js +2 -1
- package/cjs/env/contributions/lynx-contribution.js +1 -2
- package/cjs/event/extension/drag.js +1 -1
- package/cjs/event/extension/gesture.js +12 -9
- package/cjs/event/extension/gesture.js.map +1 -1
- package/cjs/event/extension/index.d.ts +1 -0
- package/cjs/event/extension/index.js +16 -1
- package/cjs/event/extension/index.js.map +1 -1
- package/cjs/event/extension/interface.js.map +1 -1
- package/cjs/index.d.ts +0 -3
- package/cjs/index.js +9 -11
- package/cjs/index.js.map +1 -1
- package/cjs/jsx/index.js +1 -2
- package/cjs/picker/canvas-picker-service.d.ts +2 -3
- package/cjs/picker/canvas-picker-service.js +4 -7
- package/cjs/picker/canvas-picker-service.js.map +1 -1
- package/cjs/picker/contributions/canvas-picker/symbol-picker.js +3 -2
- package/cjs/picker/contributions/canvas-picker/symbol-picker.js.map +1 -1
- package/cjs/picker/contributions/common/base-line-picker.js +3 -2
- package/cjs/picker/contributions/common/base-line-picker.js.map +1 -1
- package/cjs/picker/contributions/common/base.js +3 -2
- package/cjs/picker/contributions/common/base.js.map +1 -1
- package/cjs/picker/contributions/common/picker-utils.js +3 -2
- package/cjs/picker/contributions/common/picker-utils.js.map +1 -1
- package/cjs/picker/contributions/common/rect-picker-base.js +3 -2
- package/cjs/picker/contributions/common/rect-picker-base.js.map +1 -1
- package/cjs/picker/contributions/constants.d.ts +0 -1
- package/cjs/picker/contributions/constants.js +7 -7
- package/cjs/picker/contributions/constants.js.map +1 -1
- package/cjs/picker/math-picker-service.d.ts +2 -3
- package/cjs/picker/math-picker-service.js +3 -5
- package/cjs/picker/math-picker-service.js.map +1 -1
- package/cjs/register/register-image.js +2 -1
- package/cjs/register/register-path.js +1 -2
- package/dist/index.es.js +58 -852
- package/es/canvas/contributions/browser/context.d.ts +3 -0
- package/es/canvas/contributions/browser/context.js +4 -4
- package/es/canvas/contributions/browser/context.js.map +1 -1
- package/es/canvas/contributions/harmony/context.js +2 -2
- package/es/canvas/contributions/harmony/context.js.map +1 -1
- package/es/canvas/contributions/lynx/context.js +2 -2
- package/es/canvas/contributions/lynx/context.js.map +1 -1
- package/es/canvas/contributions/taro/context.js +2 -2
- package/es/canvas/contributions/taro/context.js.map +1 -1
- package/es/env/contributions/feishu-contribution.js +2 -1
- package/es/env/contributions/lynx-contribution.js +1 -2
- package/es/event/extension/drag.js +1 -1
- package/es/event/extension/gesture.js +11 -9
- package/es/event/extension/gesture.js.map +1 -1
- package/es/event/extension/index.d.ts +1 -0
- package/es/event/extension/index.js +2 -0
- package/es/event/extension/index.js.map +1 -1
- package/es/event/extension/interface.js.map +1 -1
- package/es/index.d.ts +0 -3
- package/es/index.js +0 -6
- package/es/index.js.map +1 -1
- package/es/jsx/index.js +1 -2
- package/es/picker/canvas-picker-service.d.ts +2 -3
- package/es/picker/canvas-picker-service.js +5 -7
- package/es/picker/canvas-picker-service.js.map +1 -1
- package/es/picker/contributions/canvas-picker/symbol-picker.js +2 -2
- package/es/picker/contributions/canvas-picker/symbol-picker.js.map +1 -1
- package/es/picker/contributions/common/base-line-picker.js +2 -2
- package/es/picker/contributions/common/base-line-picker.js.map +1 -1
- package/es/picker/contributions/common/base.js +2 -2
- package/es/picker/contributions/common/base.js.map +1 -1
- package/es/picker/contributions/common/picker-utils.js +2 -2
- package/es/picker/contributions/common/picker-utils.js.map +1 -1
- package/es/picker/contributions/common/rect-picker-base.js +2 -2
- package/es/picker/contributions/common/rect-picker-base.js.map +1 -1
- package/es/picker/contributions/constants.d.ts +0 -1
- package/es/picker/contributions/constants.js +0 -2
- package/es/picker/contributions/constants.js.map +1 -1
- package/es/picker/math-picker-service.d.ts +2 -3
- package/es/picker/math-picker-service.js +4 -5
- package/es/picker/math-picker-service.js.map +1 -1
- package/es/register/register-image.js +2 -1
- package/es/register/register-path.js +1 -2
- package/package.json +4 -5
- package/cjs/graphic/Lottie.d.ts +0 -49
- package/cjs/graphic/Lottie.js +0 -62
- package/cjs/graphic/Lottie.js.map +0 -1
- package/cjs/graphic/constants.d.ts +0 -1
- package/cjs/graphic/constants.js +0 -9
- package/cjs/graphic/constants.js.map +0 -1
- package/cjs/graphic/interface/lottie.d.ts +0 -10
- package/cjs/graphic/interface/lottie.js +0 -6
- package/cjs/graphic/interface/lottie.js.map +0 -1
- package/cjs/picker/contributions/canvas-picker/lottie-module.d.ts +0 -2
- package/cjs/picker/contributions/canvas-picker/lottie-module.js +0 -15
- package/cjs/picker/contributions/canvas-picker/lottie-module.js.map +0 -1
- package/cjs/picker/contributions/canvas-picker/lottie-picker.d.ts +0 -6
- package/cjs/picker/contributions/canvas-picker/lottie-picker.js +0 -30
- package/cjs/picker/contributions/canvas-picker/lottie-picker.js.map +0 -1
- package/cjs/render/contributions/canvas/lottie-module.d.ts +0 -2
- package/cjs/render/contributions/canvas/lottie-module.js +0 -15
- package/cjs/render/contributions/canvas/lottie-module.js.map +0 -1
- package/cjs/render/contributions/canvas/lottie-render.d.ts +0 -9
- package/cjs/render/contributions/canvas/lottie-render.js +0 -40
- package/cjs/render/contributions/canvas/lottie-render.js.map +0 -1
- package/es/graphic/Lottie.d.ts +0 -49
- package/es/graphic/Lottie.js +0 -53
- package/es/graphic/Lottie.js.map +0 -1
- package/es/graphic/constants.d.ts +0 -1
- package/es/graphic/constants.js +0 -3
- package/es/graphic/constants.js.map +0 -1
- package/es/graphic/interface/lottie.d.ts +0 -10
- package/es/graphic/interface/lottie.js +0 -2
- package/es/graphic/interface/lottie.js.map +0 -1
- package/es/picker/contributions/canvas-picker/lottie-module.d.ts +0 -2
- package/es/picker/contributions/canvas-picker/lottie-module.js +0 -13
- package/es/picker/contributions/canvas-picker/lottie-module.js.map +0 -1
- package/es/picker/contributions/canvas-picker/lottie-picker.d.ts +0 -6
- package/es/picker/contributions/canvas-picker/lottie-picker.js +0 -26
- package/es/picker/contributions/canvas-picker/lottie-picker.js.map +0 -1
- package/es/render/contributions/canvas/lottie-module.d.ts +0 -2
- package/es/render/contributions/canvas/lottie-module.js +0 -11
- package/es/render/contributions/canvas/lottie-module.js.map +0 -1
- package/es/render/contributions/canvas/lottie-render.d.ts +0 -9
- package/es/render/contributions/canvas/lottie-render.js +0 -36
- package/es/render/contributions/canvas/lottie-render.js.map +0 -1
|
@@ -16,7 +16,6 @@ export declare const CanvasAreaPicker: unique symbol;
|
|
|
16
16
|
export declare const CanvasCirclePicker: unique symbol;
|
|
17
17
|
export declare const CanvasImagePicker: unique symbol;
|
|
18
18
|
export declare const CanvasLinePicker: unique symbol;
|
|
19
|
-
export declare const CanvasLottiePicker: unique symbol;
|
|
20
19
|
export declare const CanvasPathPicker: unique symbol;
|
|
21
20
|
export declare const CanvasRectPicker: unique symbol;
|
|
22
21
|
export declare const CanvasRect3dPicker: unique symbol;
|
|
@@ -34,8 +34,6 @@ export const CanvasImagePicker = Symbol.for("CanvasImagePicker");
|
|
|
34
34
|
|
|
35
35
|
export const CanvasLinePicker = Symbol.for("CanvasLinePicker");
|
|
36
36
|
|
|
37
|
-
export const CanvasLottiePicker = Symbol.for("CanvasLottiePicker");
|
|
38
|
-
|
|
39
37
|
export const CanvasPathPicker = Symbol.for("CanvasPathPicker");
|
|
40
38
|
|
|
41
39
|
export const CanvasRectPicker = Symbol.for("CanvasRectPicker");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/contribut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,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC","file":"constants.js","sourcesContent":["export const MathPickerContribution = Symbol.for('MathPickerContribution');\n\n// math\nexport const MathArcPicker = Symbol.for('MathArcPicker');\nexport const MathAreaPicker = Symbol.for('MathAreaPicker');\nexport const MathCirclePicker = Symbol.for('MathCirclePicker');\nexport const MathImagePicker = Symbol.for('MathImagePicker');\nexport const MathLinePicker = Symbol.for('MathLinePicker');\nexport const MathPathPicker = Symbol.for('MathPathPicker');\nexport const MathRectPicker = Symbol.for('MathRectPicker');\nexport const MathSymbolPicker = Symbol.for('MathSymbolPicker');\nexport const MathTextPicker = Symbol.for('MathTextPicker');\nexport const MathPolygonPicker = Symbol.for('MathPolygonPicker');\nexport const MathGlyphPicker = Symbol.for('MathGlyphPicker');\n\n// canvas\nexport const CanvasArcPicker = Symbol.for('CanvasArcPicker');\nexport const CanvasArc3dPicker = Symbol.for('CanvasArc3dPicker');\nexport const CanvasAreaPicker = Symbol.for('CanvasAreaPicker');\nexport const CanvasCirclePicker = Symbol.for('CanvasCirclePicker');\nexport const CanvasImagePicker = Symbol.for('CanvasImagePicker');\nexport const CanvasLinePicker = Symbol.for('CanvasLinePicker');\nexport const CanvasPathPicker = Symbol.for('CanvasPathPicker');\nexport const CanvasRectPicker = Symbol.for('CanvasRectPicker');\nexport const CanvasRect3dPicker = Symbol.for('CanvasRect3dPicker');\nexport const CanvasSymbolPicker = Symbol.for('CanvasSymbolPicker');\nexport const CanvasTextPicker = Symbol.for('CanvasTextPicker');\nexport const CanvasPolygonPicker = Symbol.for('CanvasPolygonPicker');\nexport const CanvasPyramid3dPicker = Symbol.for('CanvasPyramid3dPicker');\nexport const CanvasRichTextPicker = Symbol.for('CanvasRichTextPicker');\nexport const CanvasGlyphPicker = Symbol.for('CanvasGlyphPicker');\nexport const CanvasGroupPicker = Symbol.for('CanvasGroupPicker');\nexport const CanvasPickerContribution = Symbol.for('CanvasPickerContribution');\n"]}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { IMatrix, IPointLike } from '@visactor/vutils';
|
|
2
2
|
import { DefaultPickService } from '@visactor/vrender-core';
|
|
3
|
-
import type { ICanvas, IContext2d, IGraphic, EnvType, IGlobal, IGraphicPicker, IPickerService, IContributionProvider, IPickItemInterceptorContribution, IPickParams, PickResult
|
|
3
|
+
import type { ICanvas, IContext2d, IGraphic, EnvType, IGlobal, IGraphicPicker, IPickerService, IContributionProvider, IPickItemInterceptorContribution, IPickParams, PickResult } from '@visactor/vrender-core';
|
|
4
4
|
export declare class DefaultMathPickerService extends DefaultPickService implements IPickerService {
|
|
5
5
|
protected readonly contributions: IContributionProvider<IGraphicPicker>;
|
|
6
6
|
protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>;
|
|
7
|
-
protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>;
|
|
8
7
|
type: 'default';
|
|
9
8
|
pickCanvas: ICanvas;
|
|
10
9
|
pickContext: IContext2d;
|
|
11
10
|
pickerMap: Map<number, IGraphicPicker>;
|
|
12
|
-
constructor(contributions: IContributionProvider<IGraphicPicker>, pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution
|
|
11
|
+
constructor(contributions: IContributionProvider<IGraphicPicker>, pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>);
|
|
13
12
|
init(): void;
|
|
14
13
|
configure(global: IGlobal, env: EnvType): void;
|
|
15
14
|
pickItem(graphic: IGraphic, point: IPointLike, parentMatrix: IMatrix | null, params?: IPickParams): PickResult | null;
|
|
@@ -10,14 +10,13 @@ var __decorate = this && this.__decorate || function(decorators, target, key, de
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
import { ContributionProvider, inject, injectable, named, DefaultPickService, EmptyContext2d, PickItemInterceptor
|
|
13
|
+
import { ContributionProvider, inject, injectable, named, DefaultPickService, EmptyContext2d, PickItemInterceptor } from "@visactor/vrender-core";
|
|
14
14
|
|
|
15
15
|
import { MathPickerContribution } from "./contributions/constants";
|
|
16
16
|
|
|
17
17
|
let DefaultMathPickerService = class extends DefaultPickService {
|
|
18
|
-
constructor(contributions, pickItemInterceptorContributions
|
|
19
|
-
super(pickItemInterceptorContributions
|
|
20
|
-
this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.pickServiceInterceptorContributions = pickServiceInterceptorContributions,
|
|
18
|
+
constructor(contributions, pickItemInterceptorContributions) {
|
|
19
|
+
super(pickItemInterceptorContributions), this.contributions = contributions, this.pickItemInterceptorContributions = pickItemInterceptorContributions,
|
|
21
20
|
this.global.hooks.onSetEnv.tap("math-picker-service", ((lastEnv, env, global) => {
|
|
22
21
|
this.configure(global, env);
|
|
23
22
|
})), this.configure(this.global, this.global.env), this.pickerMap = new Map, this.init();
|
|
@@ -42,7 +41,7 @@ let DefaultMathPickerService = class extends DefaultPickService {
|
|
|
42
41
|
}
|
|
43
42
|
};
|
|
44
43
|
|
|
45
|
-
DefaultMathPickerService = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(MathPickerContribution)), __param(1, inject(ContributionProvider)), __param(1, named(PickItemInterceptor)),
|
|
44
|
+
DefaultMathPickerService = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(MathPickerContribution)), __param(1, inject(ContributionProvider)), __param(1, named(PickItemInterceptor)), __metadata("design:paramtypes", [ Object, Object ]) ], DefaultMathPickerService);
|
|
46
45
|
|
|
47
46
|
export { DefaultMathPickerService };
|
|
48
47
|
//# sourceMappingURL=math-picker-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/math-picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EACL,oBAAoB,EACpB,MAAM,EACN,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["../src/picker/math-picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EACL,oBAAoB,EACpB,MAAM,EACN,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAK5D,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,kBAAkB;IAO9D,YAGqB,aAAoD,EAIpD,gCAAyF;QAE5G,KAAK,CAAC,gCAAgC,CAAC,CAAC;QANrB,kBAAa,GAAb,aAAa,CAAuC;QAIpD,qCAAgC,GAAhC,gCAAgC,CAAyD;QAG5G,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;YAC7E,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,IAAI;QACF,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAED,SAAS,CAAC,MAAe,EAAE,GAAY;QACrC,IAAI,CAAC,WAAW,GAAG,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC;IAGD,QAAQ,CACN,OAAiB,EACjB,KAAiB,EACjB,YAA4B,EAC5B,MAAoB;QAEpB,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,KAAK,KAAK,EAAE;YACxC,OAAO,IAAI,CAAC;SACb;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QACD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QACnD,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9B,IAAI,CAAC,EAAE;YACL,OAAO;gBACL,OAAO,EAAE,CAAC;gBACV,MAAM,EAAE,EAAE;aACX,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AA5DY,wBAAwB;IADpC,UAAU,EAAE;IASR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;IAG7B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;;GAblB,wBAAwB,CA4DpC;SA5DY,wBAAwB","file":"math-picker-service.js","sourcesContent":["import type { IMatrix, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line\nimport {\n ContributionProvider,\n inject,\n injectable,\n named,\n DefaultPickService,\n EmptyContext2d,\n PickItemInterceptor\n} from '@visactor/vrender-core';\nimport type {\n ICanvas,\n IContext2d,\n IGraphic,\n EnvType,\n IGlobal,\n IGraphicPicker,\n IPickerService,\n IContributionProvider,\n IPickItemInterceptorContribution,\n IPickParams,\n PickResult\n} from '@visactor/vrender-core';\nimport { MathPickerContribution } from './contributions/constants';\n\n// 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution\n// 用户可以写plugin\n@injectable()\nexport class DefaultMathPickerService extends DefaultPickService implements IPickerService {\n declare type: 'default';\n // pcik canvas\n declare pickCanvas: ICanvas;\n declare pickContext: IContext2d;\n declare pickerMap: Map<number, IGraphicPicker>;\n\n constructor(\n @inject(ContributionProvider)\n @named(MathPickerContribution)\n protected readonly contributions: IContributionProvider<IGraphicPicker>,\n // 拦截器\n @inject(ContributionProvider)\n @named(PickItemInterceptor)\n protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>\n ) {\n super(pickItemInterceptorContributions);\n this.global.hooks.onSetEnv.tap('math-picker-service', (lastEnv, env, global) => {\n this.configure(global, env);\n });\n this.configure(this.global, this.global.env);\n this.pickerMap = new Map();\n this.init();\n }\n\n init() {\n this.contributions.getContributions().forEach(item => {\n this.pickerMap.set(item.numberType, item);\n });\n super._init();\n }\n\n configure(global: IGlobal, env: EnvType) {\n this.pickContext = new EmptyContext2d(null, 1);\n }\n\n // todo: switch统一改为数字map\n pickItem(\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params?: IPickParams\n ): PickResult | null {\n if (graphic.attribute.pickable === false) {\n return null;\n }\n const picker = this.pickerMap.get(graphic.numberType);\n if (!picker) {\n return null;\n }\n const pd = picker.contains(graphic, point, params);\n const g = pd ? graphic : null;\n if (g) {\n return {\n graphic: g,\n params: pd\n };\n }\n return null;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-kits",
|
|
3
|
-
"version": "0.21.0
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@visactor/vutils": "~0.
|
|
16
|
-
"@visactor/vrender-core": "0.21.0
|
|
15
|
+
"@visactor/vutils": "~0.19.1",
|
|
16
|
+
"@visactor/vrender-core": "0.21.0",
|
|
17
17
|
"@resvg/resvg-js": "2.4.1",
|
|
18
|
-
"roughjs": "4.5.2"
|
|
19
|
-
"lottie-web": "^5.12.2"
|
|
18
|
+
"roughjs": "4.5.2"
|
|
20
19
|
},
|
|
21
20
|
"devDependencies": {
|
|
22
21
|
"@rushstack/eslint-patch": "~1.1.4",
|
package/cjs/graphic/Lottie.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { IRectGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
-
import { Rect } from '@visactor/vrender-core';
|
|
3
|
-
import type { ILottie, ILottieGraphicAttribute } from './interface/lottie';
|
|
4
|
-
import type { AnimationItem } from 'lottie-web';
|
|
5
|
-
export declare class Lottie extends Rect implements ILottie {
|
|
6
|
-
type: any;
|
|
7
|
-
attribute: ILottieGraphicAttribute;
|
|
8
|
-
lottieInstance?: AnimationItem;
|
|
9
|
-
canvas?: any;
|
|
10
|
-
static NOWORK_ANIMATE_ATTR: {
|
|
11
|
-
strokeSeg: number;
|
|
12
|
-
boundsPadding: number;
|
|
13
|
-
pickMode: number;
|
|
14
|
-
boundsMode: number;
|
|
15
|
-
customPickShape: number;
|
|
16
|
-
pickable: number;
|
|
17
|
-
childrenPickable: number;
|
|
18
|
-
visible: number;
|
|
19
|
-
zIndex: number;
|
|
20
|
-
layout: number;
|
|
21
|
-
keepDirIn3d: number;
|
|
22
|
-
globalZIndex: number;
|
|
23
|
-
outerBorder: number;
|
|
24
|
-
innerBorder: number;
|
|
25
|
-
lineDash: number;
|
|
26
|
-
lineCap: number;
|
|
27
|
-
lineJoin: number;
|
|
28
|
-
miterLimit: number;
|
|
29
|
-
strokeBoundsBuffer: number;
|
|
30
|
-
scaleCenter: number;
|
|
31
|
-
anchor: number;
|
|
32
|
-
anchor3d: number;
|
|
33
|
-
postMatrix: number;
|
|
34
|
-
backgroundMode: number;
|
|
35
|
-
background: number;
|
|
36
|
-
texture: number;
|
|
37
|
-
cursor: number;
|
|
38
|
-
html: number;
|
|
39
|
-
};
|
|
40
|
-
constructor(params: ILottieGraphicAttribute);
|
|
41
|
-
setAttributes(params: Partial<ILottieGraphicAttribute>, forceUpdateTag?: boolean, context?: any): void;
|
|
42
|
-
setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: any): void;
|
|
43
|
-
getGraphicTheme(): Required<IRectGraphicAttribute>;
|
|
44
|
-
initLottieWeb(data: string): void;
|
|
45
|
-
renderNextFrame: () => void;
|
|
46
|
-
release(): void;
|
|
47
|
-
releaseLottieInstance(): void;
|
|
48
|
-
}
|
|
49
|
-
export declare function createLottie(attributes: ILottieGraphicAttribute): ILottie;
|
package/cjs/graphic/Lottie.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __importDefault = this && this.__importDefault || function(mod) {
|
|
4
|
-
return mod && mod.__esModule ? mod : {
|
|
5
|
-
default: mod
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: !0
|
|
11
|
-
}), exports.createLottie = exports.Lottie = void 0;
|
|
12
|
-
|
|
13
|
-
const constants_1 = require("./constants"), vrender_core_1 = require("@visactor/vrender-core"), lottie_web_1 = __importDefault(require("lottie-web"));
|
|
14
|
-
|
|
15
|
-
class Lottie extends vrender_core_1.Rect {
|
|
16
|
-
constructor(params) {
|
|
17
|
-
super(params), this.type = "lottie", this.renderNextFrame = () => {
|
|
18
|
-
this.stage.renderNextFrame();
|
|
19
|
-
}, this.numberType = constants_1.LOTTIE_NUMBER_TYPE, this.initLottieWeb(this.attribute.data);
|
|
20
|
-
}
|
|
21
|
-
setAttributes(params, forceUpdateTag, context) {
|
|
22
|
-
return params.data && this.initLottieWeb(params.data), super.setAttributes(params, forceUpdateTag, context);
|
|
23
|
-
}
|
|
24
|
-
setAttribute(key, value, forceUpdateTag, context) {
|
|
25
|
-
return "data" === key && this.initLottieWeb(value), super.setAttribute(key, value, forceUpdateTag, context);
|
|
26
|
-
}
|
|
27
|
-
getGraphicTheme() {
|
|
28
|
-
return (0, vrender_core_1.getTheme)(this).rect;
|
|
29
|
-
}
|
|
30
|
-
initLottieWeb(data) {
|
|
31
|
-
if ("browser" !== vrender_core_1.vglobal.env) return;
|
|
32
|
-
this.lottieInstance && this.releaseLottieInstance();
|
|
33
|
-
const theme = this.getGraphicTheme(), {width: width = theme.width, height: height = theme.height} = this.attribute, canvas = vrender_core_1.vglobal.createCanvas({
|
|
34
|
-
width: width,
|
|
35
|
-
height: height,
|
|
36
|
-
dpr: vrender_core_1.vglobal.devicePixelRatio
|
|
37
|
-
}), params = {
|
|
38
|
-
rendererSettings: {
|
|
39
|
-
context: canvas.getContext("2d")
|
|
40
|
-
},
|
|
41
|
-
animType: "canvas",
|
|
42
|
-
loop: !0
|
|
43
|
-
};
|
|
44
|
-
"string" == typeof data ? params.path = data : params.animationData = data, this.lottieInstance = lottie_web_1.default.loadAnimation(params),
|
|
45
|
-
this.canvas = canvas, this.lottieInstance.addEventListener("drawnFrame", this.renderNextFrame);
|
|
46
|
-
}
|
|
47
|
-
release() {
|
|
48
|
-
super.release(), this.releaseLottieInstance();
|
|
49
|
-
}
|
|
50
|
-
releaseLottieInstance() {
|
|
51
|
-
this.lottieInstance.removeEventListener("drawnFrame", this.renderNextFrame), this.lottieInstance.destroy(),
|
|
52
|
-
this.lottieInstance = null;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function createLottie(attributes) {
|
|
57
|
-
return new Lottie(attributes);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
exports.Lottie = Lottie, Lottie.NOWORK_ANIMATE_ATTR = vrender_core_1.NOWORK_ANIMATE_ATTR,
|
|
61
|
-
exports.createLottie = createLottie;
|
|
62
|
-
//# sourceMappingURL=Lottie.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/Lottie.ts"],"names":[],"mappings":";;;;;;AACA,2CAAiD;AAEjD,yDAA+G;AAG/G,4DAAmC;AAEnC,MAAa,MAAO,SAAQ,mBAAI;IAQ9B,YAAY,MAA+B;QACzC,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,SAAI,GAAQ,QAAQ,CAAC;QA4DrB,oBAAe,GAAG,GAAG,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAC/B,CAAC,CAAC;QArDA,IAAI,CAAC,UAAU,GAAG,8BAAkB,CAAC;QACrC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,aAAa,CAAC,MAAwC,EAAE,cAAwB,EAAE,OAAa;QAC7F,IAAI,MAAM,CAAC,IAAI,EAAE;YACf,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SACjC;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,YAAY,CAAC,GAAW,EAAE,KAAU,EAAE,cAAwB,EAAE,OAAa;QAC3E,IAAI,GAAG,KAAK,MAAM,EAAE;YAClB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;SAC3B;QACD,OAAO,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,eAAe;QACb,OAAO,IAAA,uBAAQ,EA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Ae,CAAC,CAAC;QAC5E,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;;AA1EH,wBA2EC;AArEQ,0BAAmB,GAAG,kCAAmB,CAAC;AAuEnD,SAAgB,YAAY,CAAC,UAAmC;IAC9D,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AAFD,oCAEC","file":"Lottie.js","sourcesContent":["import { min } from '@visactor/vutils';\nimport { LOTTIE_NUMBER_TYPE } from './constants';\nimport type { IRectGraphicAttribute } from '@visactor/vrender-core';\nimport { getTheme, GraphicType, IContext2d, NOWORK_ANIMATE_ATTR, Rect, vglobal } from '@visactor/vrender-core';\nimport type { ILottie, ILottieGraphicAttribute } from './interface/lottie';\nimport type { AnimationItem } from 'lottie-web';\nimport bodymovin from 'lottie-web';\n\nexport class Lottie extends Rect implements ILottie {\n type: any = 'lottie';\n declare attribute: ILottieGraphicAttribute;\n declare lottieInstance?: AnimationItem;\n declare canvas?: any;\n\n static NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;\n\n constructor(params: ILottieGraphicAttribute) {\n super(params);\n this.numberType = LOTTIE_NUMBER_TYPE;\n this.initLottieWeb(this.attribute.data);\n }\n\n setAttributes(params: Partial<ILottieGraphicAttribute>, forceUpdateTag?: boolean, context?: any): void {\n if (params.data) {\n this.initLottieWeb(params.data);\n }\n return super.setAttributes(params, forceUpdateTag, context);\n }\n\n setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: any): void {\n if (key === 'data') {\n this.initLottieWeb(value);\n }\n return super.setAttribute(key, value, forceUpdateTag, context);\n }\n\n getGraphicTheme(): Required<IRectGraphicAttribute> {\n return getTheme(this).rect;\n }\n\n initLottieWeb(data: string) {\n // 必须是浏览器环境才行\n if (vglobal.env !== 'browser') {\n return;\n }\n if (this.lottieInstance) {\n this.releaseLottieInstance();\n }\n const theme = this.getGraphicTheme();\n const { width = theme.width, height = theme.height } = this.attribute;\n const canvas = vglobal.createCanvas({ width, height, dpr: vglobal.devicePixelRatio });\n const params: any = {\n // wrapper: svgContainer,\n rendererSettings: {\n context: canvas.getContext('2d')\n },\n animType: 'canvas',\n loop: true\n };\n if (typeof data === 'string') {\n params.path = data;\n } else {\n params.animationData = data;\n }\n this.lottieInstance = bodymovin.loadAnimation(params);\n this.canvas = canvas;\n this.lottieInstance.addEventListener('drawnFrame', this.renderNextFrame);\n }\n\n renderNextFrame = () => {\n this.stage.renderNextFrame();\n };\n\n release(): void {\n super.release();\n this.releaseLottieInstance();\n }\n\n releaseLottieInstance() {\n this.lottieInstance.removeEventListener('drawnFrame', this.renderNextFrame);\n this.lottieInstance.destroy();\n this.lottieInstance = null;\n }\n}\n\nexport function createLottie(attributes: ILottieGraphicAttribute): ILottie {\n return new Lottie(attributes);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const LOTTIE_NUMBER_TYPE: number;
|
package/cjs/graphic/constants.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/constants.ts"],"names":[],"mappings":";;;AAAA,yDAAmD;AAEtC,QAAA,kBAAkB,GAAG,wBAAS,CAAC,kBAAkB,EAAE,CAAC","file":"constants.js","sourcesContent":["import { Generator } from '@visactor/vrender-core';\n\nexport const LOTTIE_NUMBER_TYPE = Generator.GenAutoIncrementId();\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IGraphic, IRectGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
-
import type { AnimationItem } from 'lottie-web';
|
|
3
|
-
export type ILottieAttribute = {
|
|
4
|
-
data: string;
|
|
5
|
-
};
|
|
6
|
-
export type ILottieGraphicAttribute = Partial<IRectGraphicAttribute> & Partial<ILottieAttribute>;
|
|
7
|
-
export interface ILottie extends IGraphic<ILottieGraphicAttribute> {
|
|
8
|
-
lottieInstance?: AnimationItem;
|
|
9
|
-
canvas?: any;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/interface/lottie.ts"],"names":[],"mappings":"","file":"lottie.js","sourcesContent":["import type { IGraphic, IRectGraphicAttribute } from '@visactor/vrender-core';\nimport type { AnimationItem } from 'lottie-web';\n\nexport type ILottieAttribute = {\n data: string;\n};\n\nexport type ILottieGraphicAttribute = Partial<IRectGraphicAttribute> & Partial<ILottieAttribute>;\n\nexport interface ILottie extends IGraphic<ILottieGraphicAttribute> {\n lottieInstance?: AnimationItem;\n canvas?: any;\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.lottieCanvasPickModule = void 0;
|
|
6
|
-
|
|
7
|
-
const vrender_core_1 = require("@visactor/vrender-core"), constants_1 = require("../constants"), lottie_picker_1 = require("./lottie-picker");
|
|
8
|
-
|
|
9
|
-
let loadLottiePick = !1;
|
|
10
|
-
|
|
11
|
-
exports.lottieCanvasPickModule = new vrender_core_1.ContainerModule(((bind, unbind, isBound, rebind) => {
|
|
12
|
-
loadLottiePick || (loadLottiePick = !0, bind(constants_1.CanvasLottiePicker).to(lottie_picker_1.DefaultCanvasLottiePicker).inSingletonScope(),
|
|
13
|
-
bind(constants_1.CanvasPickerContribution).toService(constants_1.CanvasLottiePicker));
|
|
14
|
-
}));
|
|
15
|
-
//# sourceMappingURL=lottie-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/contributions/canvas-picker/lottie-module.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,4CAA4E;AAC5E,mDAA4D;AAE5D,IAAI,cAAc,GAAG,KAAK,CAAC;AACd,QAAA,sBAAsB,GAAG,IAAI,8BAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IAC1F,IAAI,cAAc,EAAE;QAClB,OAAO;KACR;IACD,cAAc,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,8BAAkB,CAAC,CAAC,EAAE,CAAC,yCAAyB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC1E,IAAI,CAAC,oCAAwB,CAAC,CAAC,SAAS,CAAC,8BAAkB,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC","file":"lottie-module.js","sourcesContent":["import { ContainerModule } from '@visactor/vrender-core';\nimport { CanvasLottiePicker, CanvasPickerContribution } from '../constants';\nimport { DefaultCanvasLottiePicker } from './lottie-picker';\n\nlet loadLottiePick = false;\nexport const lottieCanvasPickModule = new ContainerModule((bind, unbind, isBound, rebind) => {\n if (loadLottiePick) {\n return;\n }\n loadLottiePick = true;\n bind(CanvasLottiePicker).to(DefaultCanvasLottiePicker).inSingletonScope();\n bind(CanvasPickerContribution).toService(CanvasLottiePicker);\n});\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IGraphicPicker, IGraphicRender } from '@visactor/vrender-core';
|
|
2
|
-
import { RectPickerBase } from '../common/rect-picker-base';
|
|
3
|
-
export declare class DefaultCanvasLottiePicker extends RectPickerBase implements IGraphicPicker {
|
|
4
|
-
readonly canvasRenderer: IGraphicRender;
|
|
5
|
-
constructor(canvasRenderer: IGraphicRender);
|
|
6
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
|
|
4
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
}, __metadata = this && this.__metadata || function(k, v) {
|
|
8
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
9
|
-
}, __param = this && this.__param || function(paramIndex, decorator) {
|
|
10
|
-
return function(target, key) {
|
|
11
|
-
decorator(target, key, paramIndex);
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
Object.defineProperty(exports, "__esModule", {
|
|
16
|
-
value: !0
|
|
17
|
-
}), exports.DefaultCanvasLottiePicker = void 0;
|
|
18
|
-
|
|
19
|
-
const vrender_core_1 = require("@visactor/vrender-core"), rect_picker_base_1 = require("../common/rect-picker-base");
|
|
20
|
-
|
|
21
|
-
let DefaultCanvasLottiePicker = class extends rect_picker_base_1.RectPickerBase {
|
|
22
|
-
constructor(canvasRenderer) {
|
|
23
|
-
super(), this.canvasRenderer = canvasRenderer;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
DefaultCanvasLottiePicker = __decorate([ (0, vrender_core_1.injectable)(), __param(0, (0,
|
|
28
|
-
vrender_core_1.inject)(vrender_core_1.RectRender)), __metadata("design:paramtypes", [ Object ]) ], DefaultCanvasLottiePicker),
|
|
29
|
-
exports.DefaultCanvasLottiePicker = DefaultCanvasLottiePicker;
|
|
30
|
-
//# sourceMappingURL=lottie-picker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/contributions/canvas-picker/lottie-picker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yDAAwE;AAExE,iEAA4D;AAGrD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,iCAAc;IAC3D,YAAgD,cAA8B;QAC5E,KAAK,EAAE,CAAC;QADsC,mBAAc,GAAd,cAAc,CAAgB;IAE9E,CAAC;CACF,CAAA;AAJY,yBAAyB;IADrC,IAAA,yBAAU,GAAE;IAEE,WAAA,IAAA,qBAAM,EAAC,yBAAU,CAAC,CAAA;;GADpB,yBAAyB,CAIrC;AAJY,8DAAyB","file":"lottie-picker.js","sourcesContent":["import { inject, injectable, RectRender } from '@visactor/vrender-core';\nimport type { IGraphicPicker, IGraphicRender } from '@visactor/vrender-core';\nimport { RectPickerBase } from '../common/rect-picker-base';\n\n@injectable()\nexport class DefaultCanvasLottiePicker extends RectPickerBase implements IGraphicPicker {\n constructor(@inject(RectRender) public readonly canvasRenderer: IGraphicRender) {\n super();\n }\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.lottieModule = void 0;
|
|
6
|
-
|
|
7
|
-
const vrender_core_1 = require("@visactor/vrender-core"), lottie_render_1 = require("./lottie-render");
|
|
8
|
-
|
|
9
|
-
let loadLottieModule = !1;
|
|
10
|
-
|
|
11
|
-
exports.lottieModule = new vrender_core_1.ContainerModule((bind => {
|
|
12
|
-
loadLottieModule || (loadLottieModule = !0, bind(lottie_render_1.DefaultCanvasLottieRender).toSelf().inSingletonScope(),
|
|
13
|
-
bind(vrender_core_1.GraphicRender).toService(lottie_render_1.DefaultCanvasLottieRender));
|
|
14
|
-
}));
|
|
15
|
-
//# sourceMappingURL=lottie-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/canvas/lottie-module.ts"],"names":[],"mappings":";;;AAAA,yDAAwE;AACxE,mDAA4D;AAE5D,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAChB,QAAA,YAAY,GAAG,IAAI,8BAAe,CAAC,IAAI,CAAC,EAAE;IACrD,IAAI,gBAAgB,EAAE;QACpB,OAAO;KACR;IACD,gBAAgB,GAAG,IAAI,CAAC;IAExB,IAAI,CAAC,yCAAyB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5D,IAAI,CAAC,4BAAa,CAAC,CAAC,SAAS,CAAC,yCAAyB,CAAC,CAAC;AAC3D,CAAC,CAAC,CAAC","file":"lottie-module.js","sourcesContent":["import { ContainerModule, GraphicRender } from '@visactor/vrender-core';\nimport { DefaultCanvasLottieRender } from './lottie-render';\n\nlet loadLottieModule = false;\nexport const lottieModule = new ContainerModule(bind => {\n if (loadLottieModule) {\n return;\n }\n loadLottieModule = true;\n // lottie渲染器\n bind(DefaultCanvasLottieRender).toSelf().inSingletonScope();\n bind(GraphicRender).toService(DefaultCanvasLottieRender);\n});\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { IContext2d, IDrawContext, IGraphicAttribute, IGraphicRender, IGraphicRenderDrawParams, IMarkAttribute, IThemeAttribute } from '@visactor/vrender-core';
|
|
2
|
-
import { DefaultCanvasRectRender } from '@visactor/vrender-core';
|
|
3
|
-
import type { ILottie } from '../../../graphic/interface/lottie';
|
|
4
|
-
export declare class DefaultCanvasLottieRender extends DefaultCanvasRectRender implements IGraphicRender {
|
|
5
|
-
type: 'glyph';
|
|
6
|
-
numberType: number;
|
|
7
|
-
drawShape(lottie: ILottie, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
|
|
8
|
-
_drawShape(lottie: ILottie, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
|
|
9
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
|
|
4
|
-
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: !0
|
|
11
|
-
}), exports.DefaultCanvasLottieRender = void 0;
|
|
12
|
-
|
|
13
|
-
const vrender_core_1 = require("@visactor/vrender-core"), constants_1 = require("../../../graphic/constants");
|
|
14
|
-
|
|
15
|
-
let DefaultCanvasLottieRender = class extends vrender_core_1.DefaultCanvasRectRender {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments), this.numberType = constants_1.LOTTIE_NUMBER_TYPE;
|
|
18
|
-
}
|
|
19
|
-
drawShape(lottie, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
20
|
-
const _fillCb = fillCb || (() => this._drawShape.call(this, lottie, context, x, y, drawContext, params));
|
|
21
|
-
super.drawShape(lottie, context, x, y, drawContext, params, _fillCb, strokeCb);
|
|
22
|
-
}
|
|
23
|
-
_drawShape(lottie, context, x, y, drawContext, params) {
|
|
24
|
-
var _a;
|
|
25
|
-
const lottieAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : (0,
|
|
26
|
-
vrender_core_1.getTheme)(lottie, null == params ? void 0 : params.theme).rect, {x: originX = lottieAttribute.x, y: originY = lottieAttribute.y} = lottie.attribute;
|
|
27
|
-
context.setCommonStyle(lottie, lottie.attribute, originX - x, originY - y, lottieAttribute);
|
|
28
|
-
const canvas = lottie.canvas;
|
|
29
|
-
if (canvas) {
|
|
30
|
-
const pattern = context.createPattern(canvas, "no-repeat"), dpr = context.dpr;
|
|
31
|
-
pattern.setTransform && pattern.setTransform(new DOMMatrix([ 1 / dpr, 0, 0, 1 / dpr, x, y ])),
|
|
32
|
-
context.fillStyle = pattern;
|
|
33
|
-
}
|
|
34
|
-
context.fill();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
DefaultCanvasLottieRender = __decorate([ (0, vrender_core_1.injectable)() ], DefaultCanvasLottieRender),
|
|
39
|
-
exports.DefaultCanvasLottieRender = DefaultCanvasLottieRender;
|
|
40
|
-
//# sourceMappingURL=lottie-render.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/canvas/lottie-render.ts"],"names":[],"mappings":";;;;;;;;;AASA,yDAAuF;AACvF,0DAAgE;AAIzD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,sCAAuB;IAA/D;;QAEL,eAAU,GAAW,8BAAkB,CAAC;IA8C1C,CAAC;IA5CC,SAAS,CACP,MAAe,EACf,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAEZ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;QACzG,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACjF,CAAC;IAED,UAAU,CACR,MAAe,EACf,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC;;QAEjC,MAAM,eAAe,GAAG,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAA,uBAAQ,EAAC,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QAC/E,MAAM,EAAE,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;QAC5F,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,eAAe,CAAC,CAAC;QAE5F,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC7B,IAAI,MAAM,EAAE;YAEV,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YAC3D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YACxB,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5F,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC;SAC7B;QACD,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;CACF,CAAA;AAhDY,yBAAyB;IADrC,IAAA,yBAAU,GAAE;GACA,yBAAyB,CAgDrC;AAhDY,8DAAyB","file":"lottie-render.js","sourcesContent":["import type {\n IContext2d,\n IDrawContext,\n IGraphicAttribute,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IMarkAttribute,\n IThemeAttribute\n} from '@visactor/vrender-core';\nimport { DefaultCanvasRectRender, getTheme, injectable } from '@visactor/vrender-core';\nimport { LOTTIE_NUMBER_TYPE } from '../../../graphic/constants';\nimport type { ILottie } from '../../../graphic/interface/lottie';\n\n@injectable()\nexport class DefaultCanvasLottieRender extends DefaultCanvasRectRender implements IGraphicRender {\n type: 'glyph';\n numberType: number = LOTTIE_NUMBER_TYPE;\n\n drawShape(\n lottie: ILottie,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ): void {\n const _fillCb = fillCb || (() => this._drawShape.call(this, lottie, context, x, y, drawContext, params));\n super.drawShape(lottie, context, x, y, drawContext, params, _fillCb, strokeCb);\n }\n\n _drawShape(\n lottie: ILottie,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams\n ): void {\n const lottieAttribute = this.tempTheme ?? getTheme(lottie, params?.theme).rect;\n const { x: originX = lottieAttribute.x, y: originY = lottieAttribute.y } = lottie.attribute;\n context.setCommonStyle(lottie, lottie.attribute, originX - x, originY - y, lottieAttribute);\n // 设置pattern,绘制lottie\n const canvas = lottie.canvas;\n if (canvas) {\n // const _ctx = canvas.getContext('2d');\n const pattern = context.createPattern(canvas, 'no-repeat');\n const dpr = context.dpr;\n pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, x, y]));\n context.fillStyle = pattern;\n }\n context.fill();\n }\n}\n"]}
|
package/es/graphic/Lottie.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { IRectGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
-
import { Rect } from '@visactor/vrender-core';
|
|
3
|
-
import type { ILottie, ILottieGraphicAttribute } from './interface/lottie';
|
|
4
|
-
import type { AnimationItem } from 'lottie-web';
|
|
5
|
-
export declare class Lottie extends Rect implements ILottie {
|
|
6
|
-
type: any;
|
|
7
|
-
attribute: ILottieGraphicAttribute;
|
|
8
|
-
lottieInstance?: AnimationItem;
|
|
9
|
-
canvas?: any;
|
|
10
|
-
static NOWORK_ANIMATE_ATTR: {
|
|
11
|
-
strokeSeg: number;
|
|
12
|
-
boundsPadding: number;
|
|
13
|
-
pickMode: number;
|
|
14
|
-
boundsMode: number;
|
|
15
|
-
customPickShape: number;
|
|
16
|
-
pickable: number;
|
|
17
|
-
childrenPickable: number;
|
|
18
|
-
visible: number;
|
|
19
|
-
zIndex: number;
|
|
20
|
-
layout: number;
|
|
21
|
-
keepDirIn3d: number;
|
|
22
|
-
globalZIndex: number;
|
|
23
|
-
outerBorder: number;
|
|
24
|
-
innerBorder: number;
|
|
25
|
-
lineDash: number;
|
|
26
|
-
lineCap: number;
|
|
27
|
-
lineJoin: number;
|
|
28
|
-
miterLimit: number;
|
|
29
|
-
strokeBoundsBuffer: number;
|
|
30
|
-
scaleCenter: number;
|
|
31
|
-
anchor: number;
|
|
32
|
-
anchor3d: number;
|
|
33
|
-
postMatrix: number;
|
|
34
|
-
backgroundMode: number;
|
|
35
|
-
background: number;
|
|
36
|
-
texture: number;
|
|
37
|
-
cursor: number;
|
|
38
|
-
html: number;
|
|
39
|
-
};
|
|
40
|
-
constructor(params: ILottieGraphicAttribute);
|
|
41
|
-
setAttributes(params: Partial<ILottieGraphicAttribute>, forceUpdateTag?: boolean, context?: any): void;
|
|
42
|
-
setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: any): void;
|
|
43
|
-
getGraphicTheme(): Required<IRectGraphicAttribute>;
|
|
44
|
-
initLottieWeb(data: string): void;
|
|
45
|
-
renderNextFrame: () => void;
|
|
46
|
-
release(): void;
|
|
47
|
-
releaseLottieInstance(): void;
|
|
48
|
-
}
|
|
49
|
-
export declare function createLottie(attributes: ILottieGraphicAttribute): ILottie;
|
package/es/graphic/Lottie.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { LOTTIE_NUMBER_TYPE } from "./constants";
|
|
2
|
-
|
|
3
|
-
import { getTheme, NOWORK_ANIMATE_ATTR, Rect, vglobal } from "@visactor/vrender-core";
|
|
4
|
-
|
|
5
|
-
import bodymovin from "lottie-web";
|
|
6
|
-
|
|
7
|
-
export class Lottie extends Rect {
|
|
8
|
-
constructor(params) {
|
|
9
|
-
super(params), this.type = "lottie", this.renderNextFrame = () => {
|
|
10
|
-
this.stage.renderNextFrame();
|
|
11
|
-
}, this.numberType = LOTTIE_NUMBER_TYPE, this.initLottieWeb(this.attribute.data);
|
|
12
|
-
}
|
|
13
|
-
setAttributes(params, forceUpdateTag, context) {
|
|
14
|
-
return params.data && this.initLottieWeb(params.data), super.setAttributes(params, forceUpdateTag, context);
|
|
15
|
-
}
|
|
16
|
-
setAttribute(key, value, forceUpdateTag, context) {
|
|
17
|
-
return "data" === key && this.initLottieWeb(value), super.setAttribute(key, value, forceUpdateTag, context);
|
|
18
|
-
}
|
|
19
|
-
getGraphicTheme() {
|
|
20
|
-
return getTheme(this).rect;
|
|
21
|
-
}
|
|
22
|
-
initLottieWeb(data) {
|
|
23
|
-
if ("browser" !== vglobal.env) return;
|
|
24
|
-
this.lottieInstance && this.releaseLottieInstance();
|
|
25
|
-
const theme = this.getGraphicTheme(), {width: width = theme.width, height: height = theme.height} = this.attribute, canvas = vglobal.createCanvas({
|
|
26
|
-
width: width,
|
|
27
|
-
height: height,
|
|
28
|
-
dpr: vglobal.devicePixelRatio
|
|
29
|
-
}), params = {
|
|
30
|
-
rendererSettings: {
|
|
31
|
-
context: canvas.getContext("2d")
|
|
32
|
-
},
|
|
33
|
-
animType: "canvas",
|
|
34
|
-
loop: !0
|
|
35
|
-
};
|
|
36
|
-
"string" == typeof data ? params.path = data : params.animationData = data, this.lottieInstance = bodymovin.loadAnimation(params),
|
|
37
|
-
this.canvas = canvas, this.lottieInstance.addEventListener("drawnFrame", this.renderNextFrame);
|
|
38
|
-
}
|
|
39
|
-
release() {
|
|
40
|
-
super.release(), this.releaseLottieInstance();
|
|
41
|
-
}
|
|
42
|
-
releaseLottieInstance() {
|
|
43
|
-
this.lottieInstance.removeEventListener("drawnFrame", this.renderNextFrame), this.lottieInstance.destroy(),
|
|
44
|
-
this.lottieInstance = null;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
Lottie.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
49
|
-
|
|
50
|
-
export function createLottie(attributes) {
|
|
51
|
-
return new Lottie(attributes);
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=Lottie.js.map
|
package/es/graphic/Lottie.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/Lottie.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAA2B,mBAAmB,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAG/G,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,MAAM,OAAO,MAAO,SAAQ,IAAI;IAQ9B,YAAY,MAA+B;QACzC,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,SAAI,GAAQ,QAAQ,CAAC;QA4DrB,oBAAe,GAAG,GAAG,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAC/B,CAAC,CAAC;QArDA,IAAI,CAAC,UAAU,GAAG,kBAAkB,CAAC;QACrC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,aAAa,CAAC,MAAwC,EAAE,cAAwB,EAAE,OAAa;QAC7F,IAAI,MAAM,CAAC,IAAI,EAAE;YACf,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SACjC;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,YAAY,CAAC,GAAW,EAAE,KAAU,EAAE,cAAwB,EAAE,OAAa;QAC3E,IAAI,GAAG,KAAK,MAAM,EAAE;YAClB,IAAI,CAAC,a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AK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC/B,CAAC;IAED,qBAAqB;QACnB,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5E,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;;AApEM,0BAAmB,GAAG,mBAAmB,CAAC;AAuEnD,MAAM,UAAU,YAAY,CAAC,UAAmC;IAC9D,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC","file":"Lottie.js","sourcesContent":["import { min } from '@visactor/vutils';\nimport { LOTTIE_NUMBER_TYPE } from './constants';\nimport type { IRectGraphicAttribute } from '@visactor/vrender-core';\nimport { getTheme, GraphicType, IContext2d, NOWORK_ANIMATE_ATTR, Rect, vglobal } from '@visactor/vrender-core';\nimport type { ILottie, ILottieGraphicAttribute } from './interface/lottie';\nimport type { AnimationItem } from 'lottie-web';\nimport bodymovin from 'lottie-web';\n\nexport class Lottie extends Rect implements ILottie {\n type: any = 'lottie';\n declare attribute: ILottieGraphicAttribute;\n declare lottieInstance?: AnimationItem;\n declare canvas?: any;\n\n static NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;\n\n constructor(params: ILottieGraphicAttribute) {\n super(params);\n this.numberType = LOTTIE_NUMBER_TYPE;\n this.initLottieWeb(this.attribute.data);\n }\n\n setAttributes(params: Partial<ILottieGraphicAttribute>, forceUpdateTag?: boolean, context?: any): void {\n if (params.data) {\n this.initLottieWeb(params.data);\n }\n return super.setAttributes(params, forceUpdateTag, context);\n }\n\n setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: any): void {\n if (key === 'data') {\n this.initLottieWeb(value);\n }\n return super.setAttribute(key, value, forceUpdateTag, context);\n }\n\n getGraphicTheme(): Required<IRectGraphicAttribute> {\n return getTheme(this).rect;\n }\n\n initLottieWeb(data: string) {\n // 必须是浏览器环境才行\n if (vglobal.env !== 'browser') {\n return;\n }\n if (this.lottieInstance) {\n this.releaseLottieInstance();\n }\n const theme = this.getGraphicTheme();\n const { width = theme.width, height = theme.height } = this.attribute;\n const canvas = vglobal.createCanvas({ width, height, dpr: vglobal.devicePixelRatio });\n const params: any = {\n // wrapper: svgContainer,\n rendererSettings: {\n context: canvas.getContext('2d')\n },\n animType: 'canvas',\n loop: true\n };\n if (typeof data === 'string') {\n params.path = data;\n } else {\n params.animationData = data;\n }\n this.lottieInstance = bodymovin.loadAnimation(params);\n this.canvas = canvas;\n this.lottieInstance.addEventListener('drawnFrame', this.renderNextFrame);\n }\n\n renderNextFrame = () => {\n this.stage.renderNextFrame();\n };\n\n release(): void {\n super.release();\n this.releaseLottieInstance();\n }\n\n releaseLottieInstance() {\n this.lottieInstance.removeEventListener('drawnFrame', this.renderNextFrame);\n this.lottieInstance.destroy();\n this.lottieInstance = null;\n }\n}\n\nexport function createLottie(attributes: ILottieGraphicAttribute): ILottie {\n return new Lottie(attributes);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const LOTTIE_NUMBER_TYPE: number;
|
package/es/graphic/constants.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC,kBAAkB,EAAE,CAAC","file":"constants.js","sourcesContent":["import { Generator } from '@visactor/vrender-core';\n\nexport const LOTTIE_NUMBER_TYPE = Generator.GenAutoIncrementId();\n"]}
|