@visactor/vrender-kits 0.20.11-alpha.2 → 0.20.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/cjs/env/contributions/feishu-contribution.js +2 -1
  2. package/cjs/env/contributions/lynx-contribution.js +1 -2
  3. package/cjs/event/extension/drag.js +1 -1
  4. package/cjs/event/extension/gesture.js +1 -1
  5. package/cjs/index.d.ts +0 -3
  6. package/cjs/index.js +9 -11
  7. package/cjs/index.js.map +1 -1
  8. package/cjs/jsx/index.js +1 -2
  9. package/cjs/picker/canvas-picker-service.d.ts +2 -3
  10. package/cjs/picker/canvas-picker-service.js +4 -7
  11. package/cjs/picker/canvas-picker-service.js.map +1 -1
  12. package/cjs/picker/contributions/constants.d.ts +0 -1
  13. package/cjs/picker/contributions/constants.js +7 -7
  14. package/cjs/picker/contributions/constants.js.map +1 -1
  15. package/cjs/picker/math-picker-service.d.ts +2 -3
  16. package/cjs/picker/math-picker-service.js +3 -5
  17. package/cjs/picker/math-picker-service.js.map +1 -1
  18. package/cjs/register/register-image.js +2 -1
  19. package/cjs/register/register-path.js +1 -2
  20. package/dist/index.es.js +8 -824
  21. package/es/env/contributions/feishu-contribution.js +2 -1
  22. package/es/env/contributions/lynx-contribution.js +1 -2
  23. package/es/event/extension/drag.js +1 -1
  24. package/es/event/extension/gesture.js +1 -1
  25. package/es/index.d.ts +0 -3
  26. package/es/index.js +0 -6
  27. package/es/index.js.map +1 -1
  28. package/es/jsx/index.js +1 -2
  29. package/es/picker/canvas-picker-service.d.ts +2 -3
  30. package/es/picker/canvas-picker-service.js +5 -7
  31. package/es/picker/canvas-picker-service.js.map +1 -1
  32. package/es/picker/contributions/constants.d.ts +0 -1
  33. package/es/picker/contributions/constants.js +0 -2
  34. package/es/picker/contributions/constants.js.map +1 -1
  35. package/es/picker/math-picker-service.d.ts +2 -3
  36. package/es/picker/math-picker-service.js +4 -5
  37. package/es/picker/math-picker-service.js.map +1 -1
  38. package/es/register/register-image.js +2 -1
  39. package/es/register/register-path.js +1 -2
  40. package/package.json +3 -4
  41. package/cjs/graphic/Lottie.d.ts +0 -49
  42. package/cjs/graphic/Lottie.js +0 -62
  43. package/cjs/graphic/Lottie.js.map +0 -1
  44. package/cjs/graphic/constants.d.ts +0 -1
  45. package/cjs/graphic/constants.js +0 -9
  46. package/cjs/graphic/constants.js.map +0 -1
  47. package/cjs/graphic/interface/lottie.d.ts +0 -10
  48. package/cjs/graphic/interface/lottie.js +0 -6
  49. package/cjs/graphic/interface/lottie.js.map +0 -1
  50. package/cjs/picker/contributions/canvas-picker/lottie-module.d.ts +0 -2
  51. package/cjs/picker/contributions/canvas-picker/lottie-module.js +0 -15
  52. package/cjs/picker/contributions/canvas-picker/lottie-module.js.map +0 -1
  53. package/cjs/picker/contributions/canvas-picker/lottie-picker.d.ts +0 -6
  54. package/cjs/picker/contributions/canvas-picker/lottie-picker.js +0 -30
  55. package/cjs/picker/contributions/canvas-picker/lottie-picker.js.map +0 -1
  56. package/cjs/render/contributions/canvas/lottie-module.d.ts +0 -2
  57. package/cjs/render/contributions/canvas/lottie-module.js +0 -15
  58. package/cjs/render/contributions/canvas/lottie-module.js.map +0 -1
  59. package/cjs/render/contributions/canvas/lottie-render.d.ts +0 -9
  60. package/cjs/render/contributions/canvas/lottie-render.js +0 -40
  61. package/cjs/render/contributions/canvas/lottie-render.js.map +0 -1
  62. package/es/graphic/Lottie.d.ts +0 -49
  63. package/es/graphic/Lottie.js +0 -53
  64. package/es/graphic/Lottie.js.map +0 -1
  65. package/es/graphic/constants.d.ts +0 -1
  66. package/es/graphic/constants.js +0 -3
  67. package/es/graphic/constants.js.map +0 -1
  68. package/es/graphic/interface/lottie.d.ts +0 -10
  69. package/es/graphic/interface/lottie.js +0 -2
  70. package/es/graphic/interface/lottie.js.map +0 -1
  71. package/es/picker/contributions/canvas-picker/lottie-module.d.ts +0 -2
  72. package/es/picker/contributions/canvas-picker/lottie-module.js +0 -13
  73. package/es/picker/contributions/canvas-picker/lottie-module.js.map +0 -1
  74. package/es/picker/contributions/canvas-picker/lottie-picker.d.ts +0 -6
  75. package/es/picker/contributions/canvas-picker/lottie-picker.js +0 -26
  76. package/es/picker/contributions/canvas-picker/lottie-picker.js.map +0 -1
  77. package/es/render/contributions/canvas/lottie-module.d.ts +0 -2
  78. package/es/render/contributions/canvas/lottie-module.js +0 -11
  79. package/es/render/contributions/canvas/lottie-module.js.map +0 -1
  80. package/es/render/contributions/canvas/lottie-render.d.ts +0 -9
  81. package/es/render/contributions/canvas/lottie-render.js +0 -36
  82. package/es/render/contributions/canvas/lottie-render.js.map +0 -1
@@ -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,0DA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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"]}
@@ -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;
@@ -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
@@ -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,aAAa,CAAC,KAAK,CAAC,CAAC;SAC3B;QACD,OAAO,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,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AC,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;
@@ -1,3 +0,0 @@
1
- import { Generator } from "@visactor/vrender-core";
2
-
3
- export const LOTTIE_NUMBER_TYPE = Generator.GenAutoIncrementId();
@@ -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"]}
@@ -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,2 +0,0 @@
1
- export { };
2
- //# sourceMappingURL=lottie.js.map
@@ -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,2 +0,0 @@
1
- import { ContainerModule } from '@visactor/vrender-core';
2
- export declare const lottieCanvasPickModule: ContainerModule;
@@ -1,13 +0,0 @@
1
- import { ContainerModule } from "@visactor/vrender-core";
2
-
3
- import { CanvasLottiePicker, CanvasPickerContribution } from "../constants";
4
-
5
- import { DefaultCanvasLottiePicker } from "./lottie-picker";
6
-
7
- let loadLottiePick = !1;
8
-
9
- export const lottieCanvasPickModule = new ContainerModule(((bind, unbind, isBound, rebind) => {
10
- loadLottiePick || (loadLottiePick = !0, bind(CanvasLottiePicker).to(DefaultCanvasLottiePicker).inSingletonScope(),
11
- bind(CanvasPickerContribution).toService(CanvasLottiePicker));
12
- }));
13
- //# sourceMappingURL=lottie-module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/picker/contributions/canvas-picker/lottie-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,IAAI,cAAc,GAAG,KAAK,CAAC;AAC3B,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,eAAe,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,kBAAkB,CAAC,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC1E,IAAI,CAAC,wBAAwB,CAAC,CAAC,SAAS,CAAC,kBAAkB,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,26 +0,0 @@
1
- var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
2
- var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
3
- 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);
4
- return c > 3 && r && Object.defineProperty(target, key, r), r;
5
- }, __metadata = this && this.__metadata || function(k, v) {
6
- if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
7
- }, __param = this && this.__param || function(paramIndex, decorator) {
8
- return function(target, key) {
9
- decorator(target, key, paramIndex);
10
- };
11
- };
12
-
13
- import { inject, injectable, RectRender } from "@visactor/vrender-core";
14
-
15
- import { RectPickerBase } from "../common/rect-picker-base";
16
-
17
- let DefaultCanvasLottiePicker = class extends RectPickerBase {
18
- constructor(canvasRenderer) {
19
- super(), this.canvasRenderer = canvasRenderer;
20
- }
21
- };
22
-
23
- DefaultCanvasLottiePicker = __decorate([ injectable(), __param(0, inject(RectRender)), __metadata("design:paramtypes", [ Object ]) ], DefaultCanvasLottiePicker);
24
-
25
- export { DefaultCanvasLottiePicker };
26
- //# sourceMappingURL=lottie-picker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/picker/contributions/canvas-picker/lottie-picker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGrD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,cAAc;IAC3D,YAAgD,cAA8B;QAC5E,KAAK,EAAE,CAAC;QADsC,mBAAc,GAAd,cAAc,CAAgB;IAE9E,CAAC;CACF,CAAA;AAJY,yBAAyB;IADrC,UAAU,EAAE;IAEE,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;;GADpB,yBAAyB,CAIrC;SAJY,yBAAyB","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,2 +0,0 @@
1
- import { ContainerModule } from '@visactor/vrender-core';
2
- export declare const lottieModule: ContainerModule;
@@ -1,11 +0,0 @@
1
- import { ContainerModule, GraphicRender } from "@visactor/vrender-core";
2
-
3
- import { DefaultCanvasLottieRender } from "./lottie-render";
4
-
5
- let loadLottieModule = !1;
6
-
7
- export const lottieModule = new ContainerModule((bind => {
8
- loadLottieModule || (loadLottieModule = !0, bind(DefaultCanvasLottieRender).toSelf().inSingletonScope(),
9
- bind(GraphicRender).toService(DefaultCanvasLottieRender));
10
- }));
11
- //# sourceMappingURL=lottie-module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/render/contributions/canvas/lottie-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;IACrD,IAAI,gBAAgB,EAAE;QACpB,OAAO;KACR;IACD,gBAAgB,GAAG,IAAI,CAAC;IAExB,IAAI,CAAC,yBAAyB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5D,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,yBAAyB,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,36 +0,0 @@
1
- var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
2
- var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
3
- 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);
4
- return c > 3 && r && Object.defineProperty(target, key, r), r;
5
- };
6
-
7
- import { DefaultCanvasRectRender, getTheme, injectable } from "@visactor/vrender-core";
8
-
9
- import { LOTTIE_NUMBER_TYPE } from "../../../graphic/constants";
10
-
11
- let DefaultCanvasLottieRender = class extends DefaultCanvasRectRender {
12
- constructor() {
13
- super(...arguments), this.numberType = LOTTIE_NUMBER_TYPE;
14
- }
15
- drawShape(lottie, context, x, y, drawContext, params, fillCb, strokeCb) {
16
- const _fillCb = fillCb || (() => this._drawShape.call(this, lottie, context, x, y, drawContext, params));
17
- super.drawShape(lottie, context, x, y, drawContext, params, _fillCb, strokeCb);
18
- }
19
- _drawShape(lottie, context, x, y, drawContext, params) {
20
- var _a;
21
- const lottieAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : getTheme(lottie, null == params ? void 0 : params.theme).rect, {x: originX = lottieAttribute.x, y: originY = lottieAttribute.y} = lottie.attribute;
22
- context.setCommonStyle(lottie, lottie.attribute, originX - x, originY - y, lottieAttribute);
23
- const canvas = lottie.canvas;
24
- if (canvas) {
25
- const pattern = context.createPattern(canvas, "no-repeat"), dpr = context.dpr;
26
- pattern.setTransform && pattern.setTransform(new DOMMatrix([ 1 / dpr, 0, 0, 1 / dpr, x, y ])),
27
- context.fillStyle = pattern;
28
- }
29
- context.fill();
30
- }
31
- };
32
-
33
- DefaultCanvasLottieRender = __decorate([ injectable() ], DefaultCanvasLottieRender);
34
-
35
- export { DefaultCanvasLottieRender };
36
- //# sourceMappingURL=lottie-render.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/render/contributions/canvas/lottie-render.ts"],"names":[],"mappings":";;;;;;AASA,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIzD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,uBAAuB;IAA/D;;QAEL,eAAU,GAAW,kBAAkB,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,E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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"]}