@shopify/react-native-skia 1.9.0 → 1.10.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/cpp/api/JsiSkCanvas.h +1 -1
- package/lib/commonjs/index.d.ts +1 -1
- package/lib/commonjs/index.js +8 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +9 -10
- package/lib/commonjs/renderer/Canvas.js +67 -59
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/CanvasOld.d.ts +11 -0
- package/lib/commonjs/renderer/CanvasOld.js +96 -0
- package/lib/commonjs/renderer/CanvasOld.js.map +1 -0
- package/lib/commonjs/sksg/Container.js +12 -8
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig2.d.ts +19 -0
- package/lib/commonjs/sksg/HostConfig2.js +159 -0
- package/lib/commonjs/sksg/HostConfig2.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/Core.d.ts +42 -37
- package/lib/commonjs/sksg/Recorder/Core.js +46 -38
- package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +6 -2
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Recorder.d.ts +4 -0
- package/lib/commonjs/sksg/Recorder/Recorder.js +14 -2
- package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Visitor.js +6 -0
- package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/module/index.d.ts +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +9 -10
- package/lib/module/renderer/Canvas.js +65 -55
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/CanvasOld.d.ts +11 -0
- package/lib/module/renderer/CanvasOld.js +87 -0
- package/lib/module/renderer/CanvasOld.js.map +1 -0
- package/lib/module/sksg/Container.js +12 -8
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/HostConfig2.d.ts +19 -0
- package/lib/module/sksg/HostConfig2.js +152 -0
- package/lib/module/sksg/HostConfig2.js.map +1 -0
- package/lib/module/sksg/Recorder/Core.d.ts +42 -37
- package/lib/module/sksg/Recorder/Core.js +44 -37
- package/lib/module/sksg/Recorder/Core.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +7 -3
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/Recorder.d.ts +4 -0
- package/lib/module/sksg/Recorder/Recorder.js +14 -2
- package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Visitor.js +6 -0
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -2
- package/lib/typescript/lib/commonjs/renderer/CanvasOld.d.ts +3 -0
- package/lib/typescript/lib/commonjs/sksg/HostConfig2.d.ts +44 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +2 -0
- package/lib/typescript/lib/module/index.d.ts +1 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -3
- package/lib/typescript/lib/module/renderer/CanvasOld.d.ts +3 -0
- package/lib/typescript/lib/module/sksg/HostConfig2.d.ts +43 -0
- package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +9 -10
- package/lib/typescript/src/renderer/CanvasOld.d.ts +11 -0
- package/lib/typescript/src/sksg/HostConfig2.d.ts +19 -0
- package/lib/typescript/src/sksg/Recorder/Core.d.ts +42 -37
- package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +4 -0
- package/package.json +3 -2
- package/src/index.ts +1 -1
- package/src/renderer/Canvas.tsx +80 -78
- package/src/renderer/CanvasOld.tsx +126 -0
- package/src/sksg/Container.ts +7 -4
- package/src/sksg/HostConfig2.ts +247 -0
- package/src/sksg/Recorder/Core.ts +11 -0
- package/src/sksg/Recorder/Player.ts +7 -3
- package/src/sksg/Recorder/Recorder.ts +16 -2
- package/src/sksg/Recorder/Visitor.ts +6 -0
- package/lib/commonjs/renderer/Canvas2.d.ts +0 -10
- package/lib/commonjs/renderer/Canvas2.js +0 -104
- package/lib/commonjs/renderer/Canvas2.js.map +0 -1
- package/lib/commonjs/renderer/Canvas2.web.d.ts +0 -3
- package/lib/commonjs/renderer/Canvas2.web.js +0 -9
- package/lib/commonjs/renderer/Canvas2.web.js.map +0 -1
- package/lib/module/renderer/Canvas2.d.ts +0 -10
- package/lib/module/renderer/Canvas2.js +0 -97
- package/lib/module/renderer/Canvas2.js.map +0 -1
- package/lib/module/renderer/Canvas2.web.d.ts +0 -3
- package/lib/module/renderer/Canvas2.web.js +0 -3
- package/lib/module/renderer/Canvas2.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas2.d.ts +0 -3
- package/lib/typescript/lib/commonjs/renderer/Canvas2.web.d.ts +0 -2
- package/lib/typescript/lib/module/renderer/Canvas2.d.ts +0 -1
- package/lib/typescript/lib/module/renderer/Canvas2.web.d.ts +0 -1
- package/lib/typescript/src/renderer/Canvas2.d.ts +0 -10
- package/lib/typescript/src/renderer/Canvas2.web.d.ts +0 -3
- package/src/renderer/Canvas2.tsx +0 -128
- package/src/renderer/Canvas2.web.tsx +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Rea","HAS_REANIMATED_3","Recorder","visit","replay","createDrawingContext","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","paintPool","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","dispose","Container","constructor","_defineProperty","drawOnCanvas","Error","StaticContainer","redraw","recorder","root","getRecording","isOnScreen","ReanimatedContainer","mapperId","stopMapper","record","animationValues","size","startMapper","Array","from","createContainer"],"sources":["Container.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //
|
|
1
|
+
{"version":3,"names":["Rea","HAS_REANIMATED_3","Recorder","visit","replay","createDrawingContext","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","paintPool","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","dispose","Container","constructor","_defineProperty","drawOnCanvas","Error","StaticContainer","redraw","recorder","root","getRecording","isOnScreen","ReanimatedContainer","mapperId","stopMapper","record","animationValues","size","startMapper","Array","from","runOnUI","createContainer"],"sources":["Container.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n rec.dispose();\n picture.dispose();\n};\n\nexport abstract class Container {\n public root: Node[] = [];\n protected recording: Recording | null = null;\n\n constructor(protected Skia: Skia, protected nativeId: number) {}\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n //console.log(this.recording.commands);\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nclass StaticContainer extends Container {\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n const { nativeId, Skia, recording } = this;\n if (animationValues.size > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n Rea.runOnUI(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n })();\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n return HAS_REANIMATED_3 && nativeId !== -1\n ? new ReanimatedContainer(Skia, nativeId)\n : new StaticContainer(Skia, nativeId);\n};\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,wCAAwC;AAExD,SAASC,gBAAgB,QAAQ,sCAAsC;AAIvE,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,MAAMC,YAAY,GAAGA,CAACC,IAAU,EAAEC,QAAgB,EAAEC,SAAoB,KAAK;EAC3E,SAAS;;EAET,MAAMC,GAAG,GAAGH,IAAI,CAACI,eAAe,CAAC,CAAC;EAClC,MAAMC,MAAM,GAAGF,GAAG,CAACG,cAAc,CAAC,CAAC;EACnC;;EAEA,MAAMC,GAAG,GAAGT,oBAAoB,CAACE,IAAI,EAAEE,SAAS,CAACM,SAAS,EAAEH,MAAM,CAAC;EACnER,MAAM,CAACU,GAAG,EAAEL,SAAS,CAACO,QAAQ,CAAC;EAC/B,MAAMC,OAAO,GAAGP,GAAG,CAACQ,wBAAwB,CAAC,CAAC;EAC9C;EACA;EACAC,WAAW,CAACC,cAAc,CAACZ,QAAQ,EAAE,SAAS,EAAES,OAAO,CAAC;EACxDP,GAAG,CAACW,OAAO,CAAC,CAAC;EACbJ,OAAO,CAACI,OAAO,CAAC,CAAC;AACnB,CAAC;AAED,OAAO,MAAeC,SAAS,CAAC;EAI9BC,WAAWA,CAAWhB,IAAU,EAAYC,QAAgB,EAAE;IAAA,KAAxCD,IAAU,GAAVA,IAAU;IAAA,KAAYC,QAAgB,GAAhBA,QAAgB;IAAAgB,eAAA,eAHtC,EAAE;IAAAA,eAAA,oBACgB,IAAI;EAEmB;EAE/DC,YAAYA,CAACb,MAAgB,EAAE;IAC7B,IAAI,CAAC,IAAI,CAACH,SAAS,EAAE;MACnB,MAAM,IA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} from "../dom/types";
|
|
3
|
+
import type { Container } from "./Container";
|
|
4
|
+
import type { Node } from "./Node";
|
|
5
|
+
export declare const debug: (message?: any, ...optionalParams: any[]) => void;
|
|
6
|
+
type Instance = Node<unknown>;
|
|
7
|
+
type Props = object;
|
|
8
|
+
type TextInstance = Node<unknown>;
|
|
9
|
+
type SuspenseInstance = Instance;
|
|
10
|
+
type HydratableInstance = Instance;
|
|
11
|
+
type PublicInstance = Instance;
|
|
12
|
+
type HostContext = null;
|
|
13
|
+
type UpdatePayload = Container;
|
|
14
|
+
type ChildSet = unknown;
|
|
15
|
+
type TimeoutHandle = NodeJS.Timeout;
|
|
16
|
+
type NoTimeout = -1;
|
|
17
|
+
type SkiaHostConfig = HostConfig<NodeType, Props, Container, Instance, TextInstance, SuspenseInstance, HydratableInstance, PublicInstance, HostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>;
|
|
18
|
+
export declare const sksgHostConfig: SkiaHostConfig;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/*global NodeJS*/
|
|
2
|
+
|
|
3
|
+
import { DefaultEventPriority } from "react-reconciler/constants";
|
|
4
|
+
import { shallowEq } from "../renderer/typeddash";
|
|
5
|
+
const DEBUG = false;
|
|
6
|
+
export const debug = (...args) => {
|
|
7
|
+
if (DEBUG) {
|
|
8
|
+
console.log(...args);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const appendNode = (parent, child) => {
|
|
12
|
+
parent.children.push(child);
|
|
13
|
+
};
|
|
14
|
+
const removeNode = (parent, child) => {
|
|
15
|
+
parent.children.splice(parent.children.indexOf(child), 1);
|
|
16
|
+
};
|
|
17
|
+
const insertBefore = (parent, child, before) => {
|
|
18
|
+
parent.children.splice(parent.children.indexOf(before), 0, child);
|
|
19
|
+
};
|
|
20
|
+
export const sksgHostConfig = {
|
|
21
|
+
/**
|
|
22
|
+
* This function is used by the reconciler in order to calculate current time for prioritising work.
|
|
23
|
+
*/
|
|
24
|
+
supportsMutation: true,
|
|
25
|
+
isPrimaryRenderer: false,
|
|
26
|
+
supportsPersistence: false,
|
|
27
|
+
supportsHydration: false,
|
|
28
|
+
//supportsMicrotask: true,
|
|
29
|
+
|
|
30
|
+
scheduleTimeout: setTimeout,
|
|
31
|
+
cancelTimeout: clearTimeout,
|
|
32
|
+
noTimeout: -1,
|
|
33
|
+
appendChildToContainer(container, child) {
|
|
34
|
+
debug("appendChildToContainer");
|
|
35
|
+
container.root.push(child);
|
|
36
|
+
},
|
|
37
|
+
appendChild(parent, child) {
|
|
38
|
+
debug("appendChild", parent, child);
|
|
39
|
+
appendNode(parent, child);
|
|
40
|
+
},
|
|
41
|
+
getRootHostContext: _rootContainerInstance => {
|
|
42
|
+
debug("getRootHostContext");
|
|
43
|
+
return null;
|
|
44
|
+
},
|
|
45
|
+
getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {
|
|
46
|
+
debug("getChildHostContext");
|
|
47
|
+
return null;
|
|
48
|
+
},
|
|
49
|
+
shouldSetTextContent(_type, _props) {
|
|
50
|
+
return false;
|
|
51
|
+
},
|
|
52
|
+
createTextInstance(_text, _rootContainerInstance, _hostContext, _internalInstanceHandle) {
|
|
53
|
+
debug("createTextInstance");
|
|
54
|
+
// return SpanNode({}, text) as SkNode;
|
|
55
|
+
throw new Error("Text nodes are not supported yet");
|
|
56
|
+
},
|
|
57
|
+
createInstance(type, propsWithChildren, _container, _hostContext, _internalInstanceHandle) {
|
|
58
|
+
debug("createInstance", type);
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
const {
|
|
61
|
+
children,
|
|
62
|
+
...props
|
|
63
|
+
} = propsWithChildren;
|
|
64
|
+
debug("createInstance", type);
|
|
65
|
+
const instance = {
|
|
66
|
+
type,
|
|
67
|
+
props,
|
|
68
|
+
children: []
|
|
69
|
+
};
|
|
70
|
+
return instance;
|
|
71
|
+
},
|
|
72
|
+
appendInitialChild(parentInstance, child) {
|
|
73
|
+
debug("appendInitialChild");
|
|
74
|
+
appendNode(parentInstance, child);
|
|
75
|
+
},
|
|
76
|
+
finalizeInitialChildren(parentInstance, _type, _props, _rootContainerInstance, _hostContext) {
|
|
77
|
+
debug("finalizeInitialChildren", parentInstance);
|
|
78
|
+
return false;
|
|
79
|
+
},
|
|
80
|
+
commitMount() {
|
|
81
|
+
// if finalizeInitialChildren = true
|
|
82
|
+
debug("commitMount");
|
|
83
|
+
},
|
|
84
|
+
prepareForCommit(_containerInfo) {
|
|
85
|
+
debug("prepareForCommit");
|
|
86
|
+
return null;
|
|
87
|
+
},
|
|
88
|
+
resetAfterCommit(container) {
|
|
89
|
+
debug("resetAfterCommit");
|
|
90
|
+
container.redraw();
|
|
91
|
+
},
|
|
92
|
+
getPublicInstance(node) {
|
|
93
|
+
debug("getPublicInstance");
|
|
94
|
+
return node;
|
|
95
|
+
},
|
|
96
|
+
prepareUpdate: (_instance, type, oldProps, newProps, rootContainerInstance, _hostContext) => {
|
|
97
|
+
debug("prepareUpdate");
|
|
98
|
+
const propsAreEqual = shallowEq(oldProps, newProps);
|
|
99
|
+
if (propsAreEqual) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
debug("update ", type);
|
|
103
|
+
return rootContainerInstance;
|
|
104
|
+
},
|
|
105
|
+
commitUpdate(instance, _updatePayload, type, prevProps, nextProps, _internalHandle) {
|
|
106
|
+
debug("commitUpdate: ", type);
|
|
107
|
+
if (shallowEq(prevProps, nextProps)) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
|
+
const {
|
|
112
|
+
children,
|
|
113
|
+
...props
|
|
114
|
+
} = nextProps;
|
|
115
|
+
instance.props = props;
|
|
116
|
+
},
|
|
117
|
+
commitTextUpdate: (_textInstance, _oldText, _newText) => {
|
|
118
|
+
// textInstance.instance = newText;
|
|
119
|
+
},
|
|
120
|
+
clearContainer: container => {
|
|
121
|
+
debug("clearContainer");
|
|
122
|
+
container.root = [];
|
|
123
|
+
},
|
|
124
|
+
preparePortalMount: () => {
|
|
125
|
+
debug("preparePortalMount");
|
|
126
|
+
},
|
|
127
|
+
removeChild: (parent, child) => {
|
|
128
|
+
removeNode(parent, child);
|
|
129
|
+
},
|
|
130
|
+
removeChildFromContainer: (container, child) => {
|
|
131
|
+
container.root.splice(container.root.indexOf(child), 1);
|
|
132
|
+
},
|
|
133
|
+
insertInContainerBefore: (container, child, before) => {
|
|
134
|
+
container.root.splice(container.root.indexOf(before), 0, child);
|
|
135
|
+
},
|
|
136
|
+
insertBefore: (parent, child, before) => {
|
|
137
|
+
insertBefore(parent, child, before);
|
|
138
|
+
},
|
|
139
|
+
// see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
|
140
|
+
getCurrentEventPriority: () => DefaultEventPriority,
|
|
141
|
+
beforeActiveInstanceBlur: () => {},
|
|
142
|
+
afterActiveInstanceBlur: () => {},
|
|
143
|
+
detachDeletedInstance: () => {},
|
|
144
|
+
getInstanceFromNode: function (_node) {
|
|
145
|
+
return null;
|
|
146
|
+
},
|
|
147
|
+
prepareScopeUpdate: function (_scopeInstance, _instance) {},
|
|
148
|
+
getInstanceFromScope: function (_scopeInstance) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=HostConfig2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DefaultEventPriority","shallowEq","DEBUG","debug","args","console","log","appendNode","parent","child","children","push","removeNode","splice","indexOf","insertBefore","before","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","appendChildToContainer","container","root","appendChild","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","_container","props","instance","appendInitialChild","parentInstance","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","resetAfterCommit","redraw","getPublicInstance","node","prepareUpdate","_instance","oldProps","newProps","rootContainerInstance","propsAreEqual","commitUpdate","_updatePayload","prevProps","nextProps","_internalHandle","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","preparePortalMount","removeChild","removeChildFromContainer","insertInContainerBefore","getCurrentEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","getInstanceFromNode","_node","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig2.ts"],"sourcesContent":["/*global NodeJS*/\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport type { NodeType } from \"../dom/types\";\nimport { shallowEq } from \"../renderer/typeddash\";\n\nimport type { Container } from \"./Container\";\nimport type { Node } from \"./Node\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ntype Instance = Node<unknown>;\n\ntype Props = object;\ntype TextInstance = Node<unknown>;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = unknown;\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nconst appendNode = (parent: Node<unknown>, child: Node<unknown>) => {\n parent.children.push(child);\n};\n\nconst removeNode = (parent: Node<unknown>, child: Node<unknown>) => {\n parent.children.splice(parent.children.indexOf(child), 1);\n};\n\nconst insertBefore = (\n parent: Node<unknown>,\n child: Node<unknown>,\n before: Node<unknown>\n) => {\n parent.children.splice(parent.children.indexOf(before), 0, child);\n};\n\nexport const sksgHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n supportsMutation: true,\n isPrimaryRenderer: false,\n supportsPersistence: false,\n supportsHydration: false,\n //supportsMicrotask: true,\n\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n appendChildToContainer(container, child) {\n debug(\"appendChildToContainer\");\n container.root.push(child);\n },\n\n appendChild(parent, child) {\n debug(\"appendChild\", parent, child);\n appendNode(parent, child);\n },\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n propsWithChildren,\n _container,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createInstance\", type);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { children, ...props } = propsWithChildren as any;\n debug(\"createInstance\", type);\n const instance = {\n type,\n props,\n children: [],\n };\n return instance;\n },\n\n appendInitialChild(parentInstance, child) {\n debug(\"appendInitialChild\");\n appendNode(parentInstance, child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n prepareUpdate: (\n _instance,\n type,\n oldProps,\n newProps,\n rootContainerInstance,\n _hostContext\n ) => {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n debug(\"update \", type);\n return rootContainerInstance;\n },\n\n commitUpdate(\n instance,\n _updatePayload,\n type,\n prevProps,\n nextProps,\n _internalHandle\n ) {\n debug(\"commitUpdate: \", type);\n if (shallowEq(prevProps, nextProps)) {\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { children, ...props } = nextProps as any;\n instance.props = props;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.root = [];\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n removeChild: (parent, child) => {\n removeNode(parent, child);\n },\n\n removeChildFromContainer: (container, child) => {\n container.root.splice(container.root.indexOf(child), 1);\n },\n\n insertInContainerBefore: (container, child, before) => {\n container.root.splice(container.root.indexOf(before), 0, child);\n },\n\n insertBefore: (parent, child, before) => {\n insertBefore(parent, child, before);\n },\n\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: () => {},\n\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n return null;\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {},\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n return null;\n },\n};\n"],"mappings":"AAAA;;AAEA,SAASA,oBAAoB,QAAQ,4BAA4B;AAGjE,SAASC,SAAS,QAAQ,uBAAuB;AAKjD,MAAMC,KAAK,GAAG,KAAK;AACnB,OAAO,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG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EAEDyE,WAAW,EAAEA,CAACpE,MAAM,EAAEC,KAAK,KAAK;IAC9BG,UAAU,CAACJ,MAAM,EAAEC,KAAK,CAAC;EAC3B,CAAC;EAEDoE,wBAAwB,EAAEA,CAACjD,SAAS,EAAEnB,KAAK,KAAK;IAC9CmB,SAAS,CAACC,IAAI,CAAChB,MAAM,CAACe,SAAS,CAACC,IAAI,CAACf,OAAO,CAACL,KAAK,CAAC,EAAE,CAAC,CAAC;EACzD,CAAC;EAEDqE,uBAAuB,EAAEA,CAAClD,SAAS,EAAEnB,KAAK,EAAEO,MAAM,KAAK;IACrDY,SAAS,CAACC,IAAI,CAAChB,MAAM,CAACe,SAAS,CAACC,IAAI,CAACf,OAAO,CAACE,MAAM,CAAC,EAAE,CAAC,EAAEP,KAAK,CAAC;EACjE,CAAC;EAEDM,YAAY,EAAEA,CAACP,MAAM,EAAEC,KAAK,EAAEO,MAAM,KAAK;IACvCD,YAAY,CAACP,MAAM,EAAEC,KAAK,EAAEO,MAAM,CAAC;EACrC,CAAC;EAED;EACA+D,uBAAuB,EAAEA,CAAA,KAAM/E,oBAAoB;EACnDgF,wBAAwB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClCC,uBAAuB,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjCC,qBAAqB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAE/BC,mBAAmB,EAAE,SAAAA,CAAUC,KAAK,EAA4B;IAC9D,OAAO,IAAI;EACb,CAAC;EACDC,kBAAkB,EAAE,SAAAA,CAAUC,cAAc,EAAE1B,SAAS,EAAQ,CAAC,CAAC;EACjE2B,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,OAAO,IAAI;EACb;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
import type { SharedValue } from "react-native-reanimated";
|
|
2
2
|
import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, DrawingNodeProps } from "../../dom/types";
|
|
3
3
|
export declare enum CommandType {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
4
|
+
Group = 0,
|
|
5
|
+
SavePaint = 1,
|
|
6
|
+
RestorePaint = 2,
|
|
7
|
+
SaveCTM = 3,
|
|
8
|
+
RestoreCTM = 4,
|
|
9
|
+
PushColorFilter = 5,
|
|
10
|
+
PushBlurMaskFilter = 6,
|
|
11
|
+
PushImageFilter = 7,
|
|
12
|
+
PushPathEffect = 8,
|
|
13
|
+
PushShader = 9,
|
|
14
|
+
ComposeColorFilter = 10,
|
|
15
|
+
ComposeImageFilter = 11,
|
|
16
|
+
ComposePathEffect = 12,
|
|
17
|
+
MaterializePaint = 13,
|
|
18
|
+
SaveBackdropFilter = 14,
|
|
19
|
+
SaveLayer = 15,
|
|
20
|
+
RestorePaintDeclaration = 16,
|
|
21
|
+
DrawBox = 17,
|
|
22
|
+
DrawImage = 18,
|
|
23
|
+
DrawCircle = 19,
|
|
24
|
+
DrawPaint = 20,
|
|
25
|
+
DrawPoints = 21,
|
|
26
|
+
DrawPath = 22,
|
|
27
|
+
DrawRect = 23,
|
|
28
|
+
DrawRRect = 24,
|
|
29
|
+
DrawOval = 25,
|
|
30
|
+
DrawLine = 26,
|
|
31
|
+
DrawPatch = 27,
|
|
32
|
+
DrawVertices = 28,
|
|
33
|
+
DrawDiffRect = 29,
|
|
34
|
+
DrawText = 30,
|
|
35
|
+
DrawTextPath = 31,
|
|
36
|
+
DrawTextBlob = 32,
|
|
37
|
+
DrawGlyphs = 33,
|
|
38
|
+
DrawPicture = 34,
|
|
39
|
+
DrawImageSVG = 35,
|
|
40
|
+
DrawParagraph = 36,
|
|
41
|
+
DrawAtlas = 37
|
|
41
42
|
}
|
|
42
43
|
export type Command<T extends CommandType = CommandType> = {
|
|
43
44
|
type: T;
|
|
@@ -48,6 +49,10 @@ export declare const materializeProps: (command: {
|
|
|
48
49
|
animatedProps?: Record<string, SharedValue<unknown>>;
|
|
49
50
|
}) => void;
|
|
50
51
|
export declare const isCommand: <T extends CommandType>(command: Command, type: T) => command is Command<T>;
|
|
52
|
+
interface GroupCommand extends Command<CommandType.Group> {
|
|
53
|
+
children: Command[];
|
|
54
|
+
}
|
|
55
|
+
export declare const isGroup: (command: Command) => command is GroupCommand;
|
|
51
56
|
interface Props {
|
|
52
57
|
[CommandType.DrawImage]: ImageProps;
|
|
53
58
|
[CommandType.DrawCircle]: CircleProps;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// export enum CommandType {
|
|
2
2
|
// // Context
|
|
3
|
+
// Group = "Group",
|
|
3
4
|
// SavePaint = "SavePaint",
|
|
4
5
|
// RestorePaint = "RestorePaint",
|
|
5
6
|
// SaveCTM = "SaveCTM",
|
|
@@ -40,43 +41,44 @@
|
|
|
40
41
|
// DrawAtlas = "DrawAtlas",
|
|
41
42
|
// }
|
|
42
43
|
export let CommandType = /*#__PURE__*/function (CommandType) {
|
|
43
|
-
CommandType[CommandType["
|
|
44
|
-
CommandType[CommandType["
|
|
45
|
-
CommandType[CommandType["
|
|
46
|
-
CommandType[CommandType["
|
|
47
|
-
CommandType[CommandType["
|
|
48
|
-
CommandType[CommandType["
|
|
49
|
-
CommandType[CommandType["
|
|
50
|
-
CommandType[CommandType["
|
|
51
|
-
CommandType[CommandType["
|
|
52
|
-
CommandType[CommandType["
|
|
53
|
-
CommandType[CommandType["
|
|
54
|
-
CommandType[CommandType["
|
|
55
|
-
CommandType[CommandType["
|
|
56
|
-
CommandType[CommandType["
|
|
57
|
-
CommandType[CommandType["
|
|
58
|
-
CommandType[CommandType["
|
|
59
|
-
CommandType[CommandType["
|
|
60
|
-
CommandType[CommandType["
|
|
61
|
-
CommandType[CommandType["
|
|
62
|
-
CommandType[CommandType["
|
|
63
|
-
CommandType[CommandType["
|
|
64
|
-
CommandType[CommandType["
|
|
65
|
-
CommandType[CommandType["
|
|
66
|
-
CommandType[CommandType["
|
|
67
|
-
CommandType[CommandType["
|
|
68
|
-
CommandType[CommandType["
|
|
69
|
-
CommandType[CommandType["
|
|
70
|
-
CommandType[CommandType["
|
|
71
|
-
CommandType[CommandType["
|
|
72
|
-
CommandType[CommandType["
|
|
73
|
-
CommandType[CommandType["
|
|
74
|
-
CommandType[CommandType["
|
|
75
|
-
CommandType[CommandType["
|
|
76
|
-
CommandType[CommandType["
|
|
77
|
-
CommandType[CommandType["
|
|
78
|
-
CommandType[CommandType["
|
|
79
|
-
CommandType[CommandType["
|
|
44
|
+
CommandType[CommandType["Group"] = 0] = "Group";
|
|
45
|
+
CommandType[CommandType["SavePaint"] = 1] = "SavePaint";
|
|
46
|
+
CommandType[CommandType["RestorePaint"] = 2] = "RestorePaint";
|
|
47
|
+
CommandType[CommandType["SaveCTM"] = 3] = "SaveCTM";
|
|
48
|
+
CommandType[CommandType["RestoreCTM"] = 4] = "RestoreCTM";
|
|
49
|
+
CommandType[CommandType["PushColorFilter"] = 5] = "PushColorFilter";
|
|
50
|
+
CommandType[CommandType["PushBlurMaskFilter"] = 6] = "PushBlurMaskFilter";
|
|
51
|
+
CommandType[CommandType["PushImageFilter"] = 7] = "PushImageFilter";
|
|
52
|
+
CommandType[CommandType["PushPathEffect"] = 8] = "PushPathEffect";
|
|
53
|
+
CommandType[CommandType["PushShader"] = 9] = "PushShader";
|
|
54
|
+
CommandType[CommandType["ComposeColorFilter"] = 10] = "ComposeColorFilter";
|
|
55
|
+
CommandType[CommandType["ComposeImageFilter"] = 11] = "ComposeImageFilter";
|
|
56
|
+
CommandType[CommandType["ComposePathEffect"] = 12] = "ComposePathEffect";
|
|
57
|
+
CommandType[CommandType["MaterializePaint"] = 13] = "MaterializePaint";
|
|
58
|
+
CommandType[CommandType["SaveBackdropFilter"] = 14] = "SaveBackdropFilter";
|
|
59
|
+
CommandType[CommandType["SaveLayer"] = 15] = "SaveLayer";
|
|
60
|
+
CommandType[CommandType["RestorePaintDeclaration"] = 16] = "RestorePaintDeclaration";
|
|
61
|
+
CommandType[CommandType["DrawBox"] = 17] = "DrawBox";
|
|
62
|
+
CommandType[CommandType["DrawImage"] = 18] = "DrawImage";
|
|
63
|
+
CommandType[CommandType["DrawCircle"] = 19] = "DrawCircle";
|
|
64
|
+
CommandType[CommandType["DrawPaint"] = 20] = "DrawPaint";
|
|
65
|
+
CommandType[CommandType["DrawPoints"] = 21] = "DrawPoints";
|
|
66
|
+
CommandType[CommandType["DrawPath"] = 22] = "DrawPath";
|
|
67
|
+
CommandType[CommandType["DrawRect"] = 23] = "DrawRect";
|
|
68
|
+
CommandType[CommandType["DrawRRect"] = 24] = "DrawRRect";
|
|
69
|
+
CommandType[CommandType["DrawOval"] = 25] = "DrawOval";
|
|
70
|
+
CommandType[CommandType["DrawLine"] = 26] = "DrawLine";
|
|
71
|
+
CommandType[CommandType["DrawPatch"] = 27] = "DrawPatch";
|
|
72
|
+
CommandType[CommandType["DrawVertices"] = 28] = "DrawVertices";
|
|
73
|
+
CommandType[CommandType["DrawDiffRect"] = 29] = "DrawDiffRect";
|
|
74
|
+
CommandType[CommandType["DrawText"] = 30] = "DrawText";
|
|
75
|
+
CommandType[CommandType["DrawTextPath"] = 31] = "DrawTextPath";
|
|
76
|
+
CommandType[CommandType["DrawTextBlob"] = 32] = "DrawTextBlob";
|
|
77
|
+
CommandType[CommandType["DrawGlyphs"] = 33] = "DrawGlyphs";
|
|
78
|
+
CommandType[CommandType["DrawPicture"] = 34] = "DrawPicture";
|
|
79
|
+
CommandType[CommandType["DrawImageSVG"] = 35] = "DrawImageSVG";
|
|
80
|
+
CommandType[CommandType["DrawParagraph"] = 36] = "DrawParagraph";
|
|
81
|
+
CommandType[CommandType["DrawAtlas"] = 37] = "DrawAtlas";
|
|
80
82
|
return CommandType;
|
|
81
83
|
}({});
|
|
82
84
|
export const materializeProps = command => {
|
|
@@ -93,6 +95,11 @@ export const isCommand = (command, type) => {
|
|
|
93
95
|
|
|
94
96
|
return command.type === type;
|
|
95
97
|
};
|
|
98
|
+
export const isGroup = command => {
|
|
99
|
+
"worklet";
|
|
100
|
+
|
|
101
|
+
return command.type === CommandType.Group;
|
|
102
|
+
};
|
|
96
103
|
export const isDrawCommand = (command, type) => {
|
|
97
104
|
"worklet";
|
|
98
105
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CommandType","materializeProps","command","animatedProps","key","props","value","isCommand","type","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\nexport const materializeProps = (command: {\n props: Record<string, unknown>;\n animatedProps?: Record<string, SharedValue<unknown>>;\n}) => {\n \"worklet\";\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n command.props[key] = command.animatedProps[key].value;\n }\n }\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":"AA2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;
|
|
1
|
+
{"version":3,"names":["CommandType","materializeProps","command","animatedProps","key","props","value","isCommand","type","isGroup","Group","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// Group = \"Group\",\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n Group,\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\nexport const materializeProps = (command: {\n props: Record<string, unknown>;\n animatedProps?: Record<string, SharedValue<unknown>>;\n}) => {\n \"worklet\";\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n command.props[key] = command.animatedProps[key].value;\n }\n }\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface GroupCommand extends Command<CommandType.Group> {\n children: Command[];\n}\n\nexport const isGroup = (command: Command): command is GroupCommand => {\n \"worklet\";\n return command.type === CommandType.Group;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":"AA2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAA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AKA,IAAI;AAC9B,CAAC","ignoreList":[]}
|
|
@@ -6,10 +6,14 @@ import { setBlurMaskFilter, isPushImageFilter, pushImageFilter, composeImageFilt
|
|
|
6
6
|
import { setPaintProperties } from "./commands/Paint";
|
|
7
7
|
import { composePathEffects, isPushPathEffect, pushPathEffect } from "./commands/PathEffects";
|
|
8
8
|
import { isPushShader, pushShader } from "./commands/Shaders";
|
|
9
|
-
import { CommandType, isCommand, isDrawCommand, materializeProps } from "./Core";
|
|
10
|
-
|
|
9
|
+
import { CommandType, isCommand, isDrawCommand, isGroup, materializeProps } from "./Core";
|
|
10
|
+
function play(ctx, command) {
|
|
11
11
|
"worklet";
|
|
12
12
|
|
|
13
|
+
if (isGroup(command)) {
|
|
14
|
+
command.children.forEach(child => play(ctx, child));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
13
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
18
|
materializeProps(command);
|
|
15
19
|
if (isCommand(command, CommandType.SaveBackdropFilter)) {
|
|
@@ -109,7 +113,7 @@ const play = (ctx, command) => {
|
|
|
109
113
|
ctx.paints.pop();
|
|
110
114
|
});
|
|
111
115
|
}
|
|
112
|
-
}
|
|
116
|
+
}
|
|
113
117
|
export const replay = (ctx, commands) => {
|
|
114
118
|
"worklet";
|
|
115
119
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","materializeProps","play","ctx","command","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","forEach","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n materializeProps,\n type Command,\n} from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nconst play = (ctx: DrawingContext, command: Command) => {\n \"worklet\";\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n materializeProps(command as any);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n};\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC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C,EAAE;QAC5DjF,aAAa,CAAC+B,GAAG,EAAEC,OAAO,CAACW,KAAK,CAAC;MACnC,CAAC,MAAM,IAAIf,aAAa,CAACI,OAAO,EAAEN,WAAW,CAACwD,SAAS,CAAC,EAAE;QACxDnF,SAAS,CAACgC,GAAG,EAAEC,OAAO,CAACW,KAAK,CAAC;MAC/B,CAAC,MAAM;QACLwC,OAAO,CAACC,IAAI,CAAC,oBAAoBpD,OAAO,CAACqD,IAAI,EAAE,CAAC;MAClD;MACAtD,GAAG,CAACa,MAAM,CAACL,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF,CAAC;AAED,OAAO,MAAM+C,MAAM,GAAGA,CAACvD,GAAmB,EAAEwD,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAAC3B,OAAO,CAAE5B,OAAO,IAAK;IAC5BF,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","isGroup","materializeProps","play","ctx","command","children","forEach","child","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeProps,\n type Command,\n} from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, command: Command) {\n \"worklet\";\n if (isGroup(command)) {\n command.children.forEach((child) => play(ctx, child));\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n materializeProps(command as any);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,SAAS,QACJ,oBAAoB;AAC3B,SAASC,OAAO,EAAEC,YAAY,QAAQ,gBAAgB;AACtD,SACEC,mBAAmB,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AAa,CAAC,EAAE;QAC5DpF,aAAa,CAACgC,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MACnC,CAAC,MAAM,IAAInB,aAAa,CAACK,OAAO,EAAEP,WAAW,CAAC2D,SAAS,CAAC,EAAE;QACxDtF,SAAS,CAACiC,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MAC/B,CAAC,MAAM;QACLuC,OAAO,CAACC,IAAI,CAAC,oBAAoBtD,OAAO,CAACuD,IAAI,EAAE,CAAC;MAClD;MACAxD,GAAG,CAACgB,MAAM,CAACL,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEA,OAAO,MAAM8C,MAAM,GAAGA,CAACzD,GAAmB,EAAE0D,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAACvD,OAAO,CAAEF,OAAO,IAAK;IAC5BF,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -13,10 +13,14 @@ interface AnimationValues {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class Recorder {
|
|
15
15
|
commands: Command[];
|
|
16
|
+
cursors: Command[][];
|
|
16
17
|
animationValues: Set<SharedValue<unknown>>;
|
|
18
|
+
constructor();
|
|
17
19
|
getRecording(): Recording & AnimationValues;
|
|
18
20
|
private processProps;
|
|
19
21
|
private add;
|
|
22
|
+
saveGroup(): void;
|
|
23
|
+
restoreGroup(): void;
|
|
20
24
|
savePaint(props: AnimatedProps<PaintProps>): void;
|
|
21
25
|
restorePaint(): void;
|
|
22
26
|
restorePaintDeclaration(): void;
|
|
@@ -8,7 +8,9 @@ import { CommandType } from "./Core";
|
|
|
8
8
|
export class Recorder {
|
|
9
9
|
constructor() {
|
|
10
10
|
_defineProperty(this, "commands", []);
|
|
11
|
+
_defineProperty(this, "cursors", []);
|
|
11
12
|
_defineProperty(this, "animationValues", new Set());
|
|
13
|
+
this.cursors.push(this.commands);
|
|
12
14
|
}
|
|
13
15
|
getRecording() {
|
|
14
16
|
return {
|
|
@@ -24,7 +26,6 @@ export class Recorder {
|
|
|
24
26
|
const prop = props[key];
|
|
25
27
|
if (isSharedValue(prop)) {
|
|
26
28
|
this.animationValues.add(prop);
|
|
27
|
-
props[key] = prop.value;
|
|
28
29
|
animatedProps[key] = prop;
|
|
29
30
|
hasAnimatedProps = true;
|
|
30
31
|
}
|
|
@@ -43,7 +44,18 @@ export class Recorder {
|
|
|
43
44
|
command.animatedProps = animatedProps;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
this.
|
|
47
|
+
this.cursors[this.cursors.length - 1].push(command);
|
|
48
|
+
}
|
|
49
|
+
saveGroup() {
|
|
50
|
+
const children = [];
|
|
51
|
+
this.add({
|
|
52
|
+
type: CommandType.Group,
|
|
53
|
+
children
|
|
54
|
+
});
|
|
55
|
+
this.cursors.push(children);
|
|
56
|
+
}
|
|
57
|
+
restoreGroup() {
|
|
58
|
+
this.cursors.pop();
|
|
47
59
|
}
|
|
48
60
|
savePaint(props) {
|
|
49
61
|
this.add({
|