@shopify/react-native-skia 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/cpp/api/JsiSkCanvas.h +1 -1
  2. package/lib/commonjs/index.d.ts +1 -1
  3. package/lib/commonjs/index.js +8 -8
  4. package/lib/commonjs/index.js.map +1 -1
  5. package/lib/commonjs/renderer/Canvas.d.ts +9 -10
  6. package/lib/commonjs/renderer/Canvas.js +67 -59
  7. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  8. package/lib/commonjs/renderer/CanvasOld.d.ts +11 -0
  9. package/lib/commonjs/renderer/CanvasOld.js +96 -0
  10. package/lib/commonjs/renderer/CanvasOld.js.map +1 -0
  11. package/lib/commonjs/sksg/Container.js +12 -8
  12. package/lib/commonjs/sksg/Container.js.map +1 -1
  13. package/lib/commonjs/sksg/HostConfig2.d.ts +19 -0
  14. package/lib/commonjs/sksg/HostConfig2.js +159 -0
  15. package/lib/commonjs/sksg/HostConfig2.js.map +1 -0
  16. package/lib/commonjs/sksg/Recorder/Core.d.ts +42 -37
  17. package/lib/commonjs/sksg/Recorder/Core.js +46 -38
  18. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
  19. package/lib/commonjs/sksg/Recorder/Player.js +6 -2
  20. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  21. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +4 -0
  22. package/lib/commonjs/sksg/Recorder/Recorder.js +14 -2
  23. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
  24. package/lib/commonjs/sksg/Recorder/Visitor.js +6 -0
  25. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
  26. package/lib/module/index.d.ts +1 -1
  27. package/lib/module/index.js +1 -1
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/module/renderer/Canvas.d.ts +9 -10
  30. package/lib/module/renderer/Canvas.js +65 -55
  31. package/lib/module/renderer/Canvas.js.map +1 -1
  32. package/lib/module/renderer/CanvasOld.d.ts +11 -0
  33. package/lib/module/renderer/CanvasOld.js +87 -0
  34. package/lib/module/renderer/CanvasOld.js.map +1 -0
  35. package/lib/module/sksg/Container.js +12 -8
  36. package/lib/module/sksg/Container.js.map +1 -1
  37. package/lib/module/sksg/HostConfig2.d.ts +19 -0
  38. package/lib/module/sksg/HostConfig2.js +152 -0
  39. package/lib/module/sksg/HostConfig2.js.map +1 -0
  40. package/lib/module/sksg/Recorder/Core.d.ts +42 -37
  41. package/lib/module/sksg/Recorder/Core.js +44 -37
  42. package/lib/module/sksg/Recorder/Core.js.map +1 -1
  43. package/lib/module/sksg/Recorder/Player.js +7 -3
  44. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  45. package/lib/module/sksg/Recorder/Recorder.d.ts +4 -0
  46. package/lib/module/sksg/Recorder/Recorder.js +14 -2
  47. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  48. package/lib/module/sksg/Recorder/Visitor.js +6 -0
  49. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  50. package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -2
  51. package/lib/typescript/lib/commonjs/renderer/CanvasOld.d.ts +3 -0
  52. package/lib/typescript/lib/commonjs/sksg/HostConfig2.d.ts +44 -0
  53. package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +1 -0
  54. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +2 -0
  55. package/lib/typescript/lib/module/index.d.ts +1 -1
  56. package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -3
  57. package/lib/typescript/lib/module/renderer/CanvasOld.d.ts +3 -0
  58. package/lib/typescript/lib/module/sksg/HostConfig2.d.ts +43 -0
  59. package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +1 -0
  60. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +2 -0
  61. package/lib/typescript/src/index.d.ts +1 -1
  62. package/lib/typescript/src/renderer/Canvas.d.ts +9 -10
  63. package/lib/typescript/src/renderer/CanvasOld.d.ts +11 -0
  64. package/lib/typescript/src/sksg/HostConfig2.d.ts +19 -0
  65. package/lib/typescript/src/sksg/Recorder/Core.d.ts +42 -37
  66. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +4 -0
  67. package/package.json +3 -2
  68. package/src/index.ts +1 -1
  69. package/src/renderer/Canvas.tsx +80 -78
  70. package/src/renderer/CanvasOld.tsx +126 -0
  71. package/src/sksg/Container.ts +7 -4
  72. package/src/sksg/HostConfig2.ts +247 -0
  73. package/src/sksg/Recorder/Core.ts +11 -0
  74. package/src/sksg/Recorder/Player.ts +7 -3
  75. package/src/sksg/Recorder/Recorder.ts +16 -2
  76. package/src/sksg/Recorder/Visitor.ts +6 -0
  77. package/lib/commonjs/renderer/Canvas2.d.ts +0 -10
  78. package/lib/commonjs/renderer/Canvas2.js +0 -104
  79. package/lib/commonjs/renderer/Canvas2.js.map +0 -1
  80. package/lib/commonjs/renderer/Canvas2.web.d.ts +0 -3
  81. package/lib/commonjs/renderer/Canvas2.web.js +0 -9
  82. package/lib/commonjs/renderer/Canvas2.web.js.map +0 -1
  83. package/lib/module/renderer/Canvas2.d.ts +0 -10
  84. package/lib/module/renderer/Canvas2.js +0 -97
  85. package/lib/module/renderer/Canvas2.js.map +0 -1
  86. package/lib/module/renderer/Canvas2.web.d.ts +0 -3
  87. package/lib/module/renderer/Canvas2.web.js +0 -3
  88. package/lib/module/renderer/Canvas2.web.js.map +0 -1
  89. package/lib/typescript/lib/commonjs/renderer/Canvas2.d.ts +0 -3
  90. package/lib/typescript/lib/commonjs/renderer/Canvas2.web.d.ts +0 -2
  91. package/lib/typescript/lib/module/renderer/Canvas2.d.ts +0 -1
  92. package/lib/typescript/lib/module/renderer/Canvas2.web.d.ts +0 -1
  93. package/lib/typescript/src/renderer/Canvas2.d.ts +0 -10
  94. package/lib/typescript/src/renderer/Canvas2.web.d.ts +0 -3
  95. package/src/renderer/Canvas2.tsx +0 -128
  96. package/src/renderer/Canvas2.web.tsx +0 -6
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.sksgHostConfig = exports.debug = void 0;
7
+ var _constants = require("react-reconciler/constants");
8
+ var _typeddash = require("../renderer/typeddash");
9
+ /*global NodeJS*/
10
+
11
+ const DEBUG = false;
12
+ const debug = (...args) => {
13
+ if (DEBUG) {
14
+ console.log(...args);
15
+ }
16
+ };
17
+ exports.debug = debug;
18
+ const appendNode = (parent, child) => {
19
+ parent.children.push(child);
20
+ };
21
+ const removeNode = (parent, child) => {
22
+ parent.children.splice(parent.children.indexOf(child), 1);
23
+ };
24
+ const insertBefore = (parent, child, before) => {
25
+ parent.children.splice(parent.children.indexOf(before), 0, child);
26
+ };
27
+ const sksgHostConfig = exports.sksgHostConfig = {
28
+ /**
29
+ * This function is used by the reconciler in order to calculate current time for prioritising work.
30
+ */
31
+ supportsMutation: true,
32
+ isPrimaryRenderer: false,
33
+ supportsPersistence: false,
34
+ supportsHydration: false,
35
+ //supportsMicrotask: true,
36
+
37
+ scheduleTimeout: setTimeout,
38
+ cancelTimeout: clearTimeout,
39
+ noTimeout: -1,
40
+ appendChildToContainer(container, child) {
41
+ debug("appendChildToContainer");
42
+ container.root.push(child);
43
+ },
44
+ appendChild(parent, child) {
45
+ debug("appendChild", parent, child);
46
+ appendNode(parent, child);
47
+ },
48
+ getRootHostContext: _rootContainerInstance => {
49
+ debug("getRootHostContext");
50
+ return null;
51
+ },
52
+ getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {
53
+ debug("getChildHostContext");
54
+ return null;
55
+ },
56
+ shouldSetTextContent(_type, _props) {
57
+ return false;
58
+ },
59
+ createTextInstance(_text, _rootContainerInstance, _hostContext, _internalInstanceHandle) {
60
+ debug("createTextInstance");
61
+ // return SpanNode({}, text) as SkNode;
62
+ throw new Error("Text nodes are not supported yet");
63
+ },
64
+ createInstance(type, propsWithChildren, _container, _hostContext, _internalInstanceHandle) {
65
+ debug("createInstance", type);
66
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
+ const {
68
+ children,
69
+ ...props
70
+ } = propsWithChildren;
71
+ debug("createInstance", type);
72
+ const instance = {
73
+ type,
74
+ props,
75
+ children: []
76
+ };
77
+ return instance;
78
+ },
79
+ appendInitialChild(parentInstance, child) {
80
+ debug("appendInitialChild");
81
+ appendNode(parentInstance, child);
82
+ },
83
+ finalizeInitialChildren(parentInstance, _type, _props, _rootContainerInstance, _hostContext) {
84
+ debug("finalizeInitialChildren", parentInstance);
85
+ return false;
86
+ },
87
+ commitMount() {
88
+ // if finalizeInitialChildren = true
89
+ debug("commitMount");
90
+ },
91
+ prepareForCommit(_containerInfo) {
92
+ debug("prepareForCommit");
93
+ return null;
94
+ },
95
+ resetAfterCommit(container) {
96
+ debug("resetAfterCommit");
97
+ container.redraw();
98
+ },
99
+ getPublicInstance(node) {
100
+ debug("getPublicInstance");
101
+ return node;
102
+ },
103
+ prepareUpdate: (_instance, type, oldProps, newProps, rootContainerInstance, _hostContext) => {
104
+ debug("prepareUpdate");
105
+ const propsAreEqual = (0, _typeddash.shallowEq)(oldProps, newProps);
106
+ if (propsAreEqual) {
107
+ return null;
108
+ }
109
+ debug("update ", type);
110
+ return rootContainerInstance;
111
+ },
112
+ commitUpdate(instance, _updatePayload, type, prevProps, nextProps, _internalHandle) {
113
+ debug("commitUpdate: ", type);
114
+ if ((0, _typeddash.shallowEq)(prevProps, nextProps)) {
115
+ return;
116
+ }
117
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
118
+ const {
119
+ children,
120
+ ...props
121
+ } = nextProps;
122
+ instance.props = props;
123
+ },
124
+ commitTextUpdate: (_textInstance, _oldText, _newText) => {
125
+ // textInstance.instance = newText;
126
+ },
127
+ clearContainer: container => {
128
+ debug("clearContainer");
129
+ container.root = [];
130
+ },
131
+ preparePortalMount: () => {
132
+ debug("preparePortalMount");
133
+ },
134
+ removeChild: (parent, child) => {
135
+ removeNode(parent, child);
136
+ },
137
+ removeChildFromContainer: (container, child) => {
138
+ container.root.splice(container.root.indexOf(child), 1);
139
+ },
140
+ insertInContainerBefore: (container, child, before) => {
141
+ container.root.splice(container.root.indexOf(before), 0, child);
142
+ },
143
+ insertBefore: (parent, child, before) => {
144
+ insertBefore(parent, child, before);
145
+ },
146
+ // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
147
+ getCurrentEventPriority: () => _constants.DefaultEventPriority,
148
+ beforeActiveInstanceBlur: () => {},
149
+ afterActiveInstanceBlur: () => {},
150
+ detachDeletedInstance: () => {},
151
+ getInstanceFromNode: function (_node) {
152
+ return null;
153
+ },
154
+ prepareScopeUpdate: function (_scopeInstance, _instance) {},
155
+ getInstanceFromScope: function (_scopeInstance) {
156
+ return null;
157
+ }
158
+ };
159
+ //# sourceMappingURL=HostConfig2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_constants","require","_typeddash","DEBUG","debug","args","console","log","exports","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","shallowEq","commitUpdate","_updatePayload","prevProps","nextProps","_internalHandle","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","preparePortalMount","removeChild","removeChildFromContainer","insertInContainerBefore","getCurrentEventPriority","DefaultEventPriority","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":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AALA;;AAUA,MAAME,KAAK,GAAG,KAAK;AACZ,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AAACG,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AA+BF,MAAMK,UAAU,GAAGA,CAACC,MAAqB,EAAEC,KAAoB,KAAK;EAClED,MAAM,CAACE,QAAQ,CAACC,IAAI,CAACF,KAAK,CAAC;AAC7B,CAAC;AAED,MAAMG,UAAU,GAAGA,CAACJ,MAAqB,EAAEC,KAAoB,KAAK;EAClED,MAAM,CAACE,QAAQ,CAACG,MAAM,CAACL,MAAM,CAACE,QAAQ,CAACI,OAAO,CAACL,KA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C;EACzD,CAAC;EAEDsE,uBAAuB,EAAEA,CAACnD,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;EACAgE,uBAAuB,EAAEA,CAAA,KAAMC,+BAAoB;EACnDC,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,EAAE5B,SAAS,EAAQ,CAAC,CAAC;EACjE6B,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
- SavePaint = 0,
5
- RestorePaint = 1,
6
- SaveCTM = 2,
7
- RestoreCTM = 3,
8
- PushColorFilter = 4,
9
- PushBlurMaskFilter = 5,
10
- PushImageFilter = 6,
11
- PushPathEffect = 7,
12
- PushShader = 8,
13
- ComposeColorFilter = 9,
14
- ComposeImageFilter = 10,
15
- ComposePathEffect = 11,
16
- MaterializePaint = 12,
17
- SaveBackdropFilter = 13,
18
- SaveLayer = 14,
19
- RestorePaintDeclaration = 15,
20
- DrawBox = 16,
21
- DrawImage = 17,
22
- DrawCircle = 18,
23
- DrawPaint = 19,
24
- DrawPoints = 20,
25
- DrawPath = 21,
26
- DrawRect = 22,
27
- DrawRRect = 23,
28
- DrawOval = 24,
29
- DrawLine = 25,
30
- DrawPatch = 26,
31
- DrawVertices = 27,
32
- DrawDiffRect = 28,
33
- DrawText = 29,
34
- DrawTextPath = 30,
35
- DrawTextBlob = 31,
36
- DrawGlyphs = 32,
37
- DrawPicture = 33,
38
- DrawImageSVG = 34,
39
- DrawParagraph = 35,
40
- DrawAtlas = 36
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;
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.materializeProps = exports.isDrawCommand = exports.isCommand = exports.CommandType = void 0;
6
+ exports.materializeProps = exports.isGroup = exports.isDrawCommand = exports.isCommand = exports.CommandType = void 0;
7
7
  // export enum CommandType {
8
8
  // // Context
9
+ // Group = "Group",
9
10
  // SavePaint = "SavePaint",
10
11
  // RestorePaint = "RestorePaint",
11
12
  // SaveCTM = "SaveCTM",
@@ -46,43 +47,44 @@ exports.materializeProps = exports.isDrawCommand = exports.isCommand = exports.C
46
47
  // DrawAtlas = "DrawAtlas",
47
48
  // }
48
49
  let CommandType = exports.CommandType = /*#__PURE__*/function (CommandType) {
49
- CommandType[CommandType["SavePaint"] = 0] = "SavePaint";
50
- CommandType[CommandType["RestorePaint"] = 1] = "RestorePaint";
51
- CommandType[CommandType["SaveCTM"] = 2] = "SaveCTM";
52
- CommandType[CommandType["RestoreCTM"] = 3] = "RestoreCTM";
53
- CommandType[CommandType["PushColorFilter"] = 4] = "PushColorFilter";
54
- CommandType[CommandType["PushBlurMaskFilter"] = 5] = "PushBlurMaskFilter";
55
- CommandType[CommandType["PushImageFilter"] = 6] = "PushImageFilter";
56
- CommandType[CommandType["PushPathEffect"] = 7] = "PushPathEffect";
57
- CommandType[CommandType["PushShader"] = 8] = "PushShader";
58
- CommandType[CommandType["ComposeColorFilter"] = 9] = "ComposeColorFilter";
59
- CommandType[CommandType["ComposeImageFilter"] = 10] = "ComposeImageFilter";
60
- CommandType[CommandType["ComposePathEffect"] = 11] = "ComposePathEffect";
61
- CommandType[CommandType["MaterializePaint"] = 12] = "MaterializePaint";
62
- CommandType[CommandType["SaveBackdropFilter"] = 13] = "SaveBackdropFilter";
63
- CommandType[CommandType["SaveLayer"] = 14] = "SaveLayer";
64
- CommandType[CommandType["RestorePaintDeclaration"] = 15] = "RestorePaintDeclaration";
65
- CommandType[CommandType["DrawBox"] = 16] = "DrawBox";
66
- CommandType[CommandType["DrawImage"] = 17] = "DrawImage";
67
- CommandType[CommandType["DrawCircle"] = 18] = "DrawCircle";
68
- CommandType[CommandType["DrawPaint"] = 19] = "DrawPaint";
69
- CommandType[CommandType["DrawPoints"] = 20] = "DrawPoints";
70
- CommandType[CommandType["DrawPath"] = 21] = "DrawPath";
71
- CommandType[CommandType["DrawRect"] = 22] = "DrawRect";
72
- CommandType[CommandType["DrawRRect"] = 23] = "DrawRRect";
73
- CommandType[CommandType["DrawOval"] = 24] = "DrawOval";
74
- CommandType[CommandType["DrawLine"] = 25] = "DrawLine";
75
- CommandType[CommandType["DrawPatch"] = 26] = "DrawPatch";
76
- CommandType[CommandType["DrawVertices"] = 27] = "DrawVertices";
77
- CommandType[CommandType["DrawDiffRect"] = 28] = "DrawDiffRect";
78
- CommandType[CommandType["DrawText"] = 29] = "DrawText";
79
- CommandType[CommandType["DrawTextPath"] = 30] = "DrawTextPath";
80
- CommandType[CommandType["DrawTextBlob"] = 31] = "DrawTextBlob";
81
- CommandType[CommandType["DrawGlyphs"] = 32] = "DrawGlyphs";
82
- CommandType[CommandType["DrawPicture"] = 33] = "DrawPicture";
83
- CommandType[CommandType["DrawImageSVG"] = 34] = "DrawImageSVG";
84
- CommandType[CommandType["DrawParagraph"] = 35] = "DrawParagraph";
85
- CommandType[CommandType["DrawAtlas"] = 36] = "DrawAtlas";
50
+ CommandType[CommandType["Group"] = 0] = "Group";
51
+ CommandType[CommandType["SavePaint"] = 1] = "SavePaint";
52
+ CommandType[CommandType["RestorePaint"] = 2] = "RestorePaint";
53
+ CommandType[CommandType["SaveCTM"] = 3] = "SaveCTM";
54
+ CommandType[CommandType["RestoreCTM"] = 4] = "RestoreCTM";
55
+ CommandType[CommandType["PushColorFilter"] = 5] = "PushColorFilter";
56
+ CommandType[CommandType["PushBlurMaskFilter"] = 6] = "PushBlurMaskFilter";
57
+ CommandType[CommandType["PushImageFilter"] = 7] = "PushImageFilter";
58
+ CommandType[CommandType["PushPathEffect"] = 8] = "PushPathEffect";
59
+ CommandType[CommandType["PushShader"] = 9] = "PushShader";
60
+ CommandType[CommandType["ComposeColorFilter"] = 10] = "ComposeColorFilter";
61
+ CommandType[CommandType["ComposeImageFilter"] = 11] = "ComposeImageFilter";
62
+ CommandType[CommandType["ComposePathEffect"] = 12] = "ComposePathEffect";
63
+ CommandType[CommandType["MaterializePaint"] = 13] = "MaterializePaint";
64
+ CommandType[CommandType["SaveBackdropFilter"] = 14] = "SaveBackdropFilter";
65
+ CommandType[CommandType["SaveLayer"] = 15] = "SaveLayer";
66
+ CommandType[CommandType["RestorePaintDeclaration"] = 16] = "RestorePaintDeclaration";
67
+ CommandType[CommandType["DrawBox"] = 17] = "DrawBox";
68
+ CommandType[CommandType["DrawImage"] = 18] = "DrawImage";
69
+ CommandType[CommandType["DrawCircle"] = 19] = "DrawCircle";
70
+ CommandType[CommandType["DrawPaint"] = 20] = "DrawPaint";
71
+ CommandType[CommandType["DrawPoints"] = 21] = "DrawPoints";
72
+ CommandType[CommandType["DrawPath"] = 22] = "DrawPath";
73
+ CommandType[CommandType["DrawRect"] = 23] = "DrawRect";
74
+ CommandType[CommandType["DrawRRect"] = 24] = "DrawRRect";
75
+ CommandType[CommandType["DrawOval"] = 25] = "DrawOval";
76
+ CommandType[CommandType["DrawLine"] = 26] = "DrawLine";
77
+ CommandType[CommandType["DrawPatch"] = 27] = "DrawPatch";
78
+ CommandType[CommandType["DrawVertices"] = 28] = "DrawVertices";
79
+ CommandType[CommandType["DrawDiffRect"] = 29] = "DrawDiffRect";
80
+ CommandType[CommandType["DrawText"] = 30] = "DrawText";
81
+ CommandType[CommandType["DrawTextPath"] = 31] = "DrawTextPath";
82
+ CommandType[CommandType["DrawTextBlob"] = 32] = "DrawTextBlob";
83
+ CommandType[CommandType["DrawGlyphs"] = 33] = "DrawGlyphs";
84
+ CommandType[CommandType["DrawPicture"] = 34] = "DrawPicture";
85
+ CommandType[CommandType["DrawImageSVG"] = 35] = "DrawImageSVG";
86
+ CommandType[CommandType["DrawParagraph"] = 36] = "DrawParagraph";
87
+ CommandType[CommandType["DrawAtlas"] = 37] = "DrawAtlas";
86
88
  return CommandType;
87
89
  }({});
88
90
  const materializeProps = command => {
@@ -101,6 +103,12 @@ const isCommand = (command, type) => {
101
103
  return command.type === type;
102
104
  };
103
105
  exports.isCommand = isCommand;
106
+ const isGroup = command => {
107
+ "worklet";
108
+
109
+ return command.type === CommandType.Group;
110
+ };
111
+ exports.isGroup = isGroup;
104
112
  const isDrawCommand = (command, type) => {
105
113
  "worklet";
106
114
 
@@ -1 +1 @@
1
- {"version":3,"names":["CommandType","exports","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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GhC,IAAK;EACJ,SAAS;;EACT,IAAIA,OAAO,CAACC,aAAa,EAAE;IACzB,KAAK,MAAMC,GAAG,IAAIF,OAAO,CAACC,aAAa,EAAE;MACvCD,OAAO,CAACG,KAAK,CAACD,GAAG,CAAC,GAAGF,OAAO,CAACC,aAAa,CAACC,GAAG,CAAC,CAACE,KAAK;IACvD;EACF;AACF,CAAC;AAACN,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAEK,MAAMM,SAAS,GAAGA,CACvBL,OAAgB,EAChBM,IAAO,KACmB;EAC1B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACR,OAAA,CAAAO,SAAA,GAAAA,SAAA;AA+BK,MAAME,aAAa,GAAGA,CAC3BP,OAAgB,EAChBM,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACR,OAAA,CAAAS,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["CommandType","exports","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;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WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAgDhB,MAAME,gBAAgB,GAAIC,OAGhC,IAAK;EACJ,SAAS;;EACT,IAAIA,OAAO,CAACC,aAAa,EAAE;IACzB,KAAK,MAAMC,GAAG,IAAIF,OAAO,CAACC,aAAa,EAAE;MACvCD,OAAO,CAACG,KAAK,CAACD,GAAG,CAAC,GAAGF,OAAO,CAACC,aAAa,CAACC,GAAG,CAAC,CAACE,KAAK;IACvD;EACF;AACF,CAAC;AAACN,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAEK,MAAMM,SAAS,GAAGA,CACvBL,OAAgB,EAChBM,IAAO,KACmB;EAC1B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACR,OAAA,CAAAO,SAAA,GAAAA,SAAA;AAMK,MAAME,OAAO,GAAIP,OAAgB,IAA8B;EACpE,SAAS;;EACT,OAAOA,OAAO,CAACM,IAAI,KAAKT,WAAW,CAACW,KAAK;AAC3C,CAAC;AAACV,OAAA,CAAAS,OAAA,GAAAA,OAAA;AA+BK,MAAME,aAAa,GAAGA,CAC3BT,OAAgB,EAChBM,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACR,OAAA,CAAAW,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -13,9 +13,13 @@ var _Paint = require("./commands/Paint");
13
13
  var _PathEffects = require("./commands/PathEffects");
14
14
  var _Shaders = require("./commands/Shaders");
15
15
  var _Core = require("./Core");
16
- const play = (ctx, command) => {
16
+ function play(ctx, command) {
17
17
  "worklet";
18
18
 
19
+ if ((0, _Core.isGroup)(command)) {
20
+ command.children.forEach(child => play(ctx, child));
21
+ return;
22
+ }
19
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
24
  (0, _Core.materializeProps)(command);
21
25
  if ((0, _Core.isCommand)(command, _Core.CommandType.SaveBackdropFilter)) {
@@ -115,7 +119,7 @@ const play = (ctx, command) => {
115
119
  ctx.paints.pop();
116
120
  });
117
121
  }
118
- };
122
+ }
119
123
  const replay = (ctx, commands) => {
120
124
  "worklet";
121
125
 
@@ -1 +1 @@
1
- {"version":3,"names":["_Drawing","require","_Box","_ColorFilters","_CTM","_ImageFilters","_Paint","_PathEffects","_Shaders","_Core","play","ctx","command","materializeProps","isCommand","CommandType","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","isDrawCommand","SavePaint","props","paints","push","savePaint","setPaintProperties","Skia","RestorePaint","restorePaint","ComposeColorFilter","composeColorFilters","RestorePaintDeclaration","Error","MaterializePaint","isPushColorFilter","pushColorFilter","isPushShader","pushShader","isPushImageFilter","pushImageFilter","isPushPathEffect","pushPathEffect","ComposePathEffect","composePathEffects","ComposeImageFilter","composeImageFilters","PushBlurMaskFilter","setBlurMaskFilter","SaveCTM","saveCTM","RestoreCTM","restore","forEach","p","isBoxCommand","drawBox","DrawPaint","drawPaint","DrawImage","drawImage","DrawCircle","drawCircle","DrawPoints","drawPoints","DrawPath","drawPath","DrawRect","drawRect","DrawRRect","drawRRect","DrawOval","drawOval","DrawLine","drawLine","DrawPatch","drawPatch","DrawVertices","drawVertices","DrawDiffRect","drawDiffRect","DrawText","drawText","DrawTextPath","drawTextPath","DrawTextBlob","drawTextBlob","DrawGlyphs","drawGlyphs","DrawPicture","drawPicture","DrawImageSVG","drawImageSVG","DrawParagraph","drawParagraph","DrawAtlas","drawAtlas","console","warn","type","replay","commands","exports"],"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,IAAAA,QAAA,GAAAC,OAAA;AAqBA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AASA,MAAMS,IAAI,GAAGA,CAACC,GAAmB,EAAEC,OAAgB,KAAK;EACtD,SAAS;;EAET;EACA,IAAAC,sBAAgB,EAACD,OAAc,CAAC;EAChC,IAAI,IAAAE,eAAS,EAACF,OAAO,EAAEG,iBAAW,CAACC,kBAAkB,CAAC,EAAE;IACtDL,GAAG,CAACM,kBAAkB,CAAC,CAAC;EAC1B,CAAC,MAAM,IAAI,IAAAH,eAAS,EAACF,OAAO,EAAEG,iBAAW,CAACG,SAAS,CAAC,EAAE;IACpDP,GAAG,CAACQ,gBAAgB,CAAC,CAAC;IACtB,MAAMC,KAAK,GAAGT,GAAG,CAACU,iBAAiB,CAACC,GAAG,CAAC,CAAC;IACzCX,GAAG,CAACY,M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ChD,OAAO,CAAE9C,OAAO,IAAK;IAC5BF,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC;AAAC+F,OAAA,CAAAF,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_Drawing","require","_Box","_ColorFilters","_CTM","_ImageFilters","_Paint","_PathEffects","_Shaders","_Core","play","ctx","command","isGroup","children","forEach","child","materializeProps","isCommand","CommandType","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","isDrawCommand","SavePaint","props","paints","push","savePaint","setPaintProperties","Skia","RestorePaint","restorePaint","ComposeColorFilter","composeColorFilters","RestorePaintDeclaration","Error","MaterializePaint","isPushColorFilter","pushColorFilter","isPushShader","pushShader","isPushImageFilter","pushImageFilter","isPushPathEffect","pushPathEffect","ComposePathEffect","composePathEffects","ComposeImageFilter","composeImageFilters","PushBlurMaskFilter","setBlurMaskFilter","SaveCTM","saveCTM","RestoreCTM","restore","p","isBoxCommand","drawBox","DrawPaint","drawPaint","DrawImage","drawImage","DrawCircle","drawCircle","DrawPoints","drawPoints","DrawPath","drawPath","DrawRect","drawRect","DrawRRect","drawRRect","DrawOval","drawOval","DrawLine","drawLine","DrawPatch","drawPatch","DrawVertices","drawVertices","DrawDiffRect","drawDiffRect","DrawText","drawText","DrawTextPath","drawTextPath","DrawTextBlob","drawTextBlob","DrawGlyphs","drawGlyphs","DrawPicture","drawPicture","DrawImageSVG","drawImageSVG","DrawParagraph","drawParagraph","DrawAtlas","drawAtlas","console","warn","type","replay","commands","exports"],"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,IAAAA,QAAA,GAAAC,OAAA;AAqBA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAUA,SAASS,IAAIA,CAACC,GAAmB,EAAEC,OAAgB,EAAE;EACnD,SAAS;;EACT,IAAI,IAAAC,aAAO,EAACD,OAAO,CAAC,EAAE;IACpBA,OAAO,CAACE,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAKN,IAAI,CAACC,GAAG,EAAEK,KAAK,CAAC,CAAC;IACrD;EACF;EACA;EACA,IAAAC,sBAAgB,EAACL,OAAc,CAAC;EAChC,IAAI,IAAAM,eAAS,EAACN,OAAO,EAAEO,iBAAW,CAACC,kBAAkB,CAAC,EAAE;IACtDT,GAAG,CAACU,kBAAkB,CAAC,CAAC;EAC1B,CAAC,MAAM,IAAI,IA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L0E,OAAO,CAACC,IAAI,CAAC,oBAAoB9F,OAAO,CAAC+F,IAAI,EAAE,CAAC;MAClD;MACAhG,GAAG,CAACqB,MAAM,CAACN,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEO,MAAMkF,MAAM,GAAGA,CAACjG,GAAmB,EAAEkG,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAAC9F,OAAO,CAAEH,OAAO,IAAK;IAC5BF,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC;AAACkG,OAAA,CAAAF,MAAA,GAAAA,MAAA","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;
@@ -14,7 +14,9 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
14
14
  class Recorder {
15
15
  constructor() {
16
16
  _defineProperty(this, "commands", []);
17
+ _defineProperty(this, "cursors", []);
17
18
  _defineProperty(this, "animationValues", new Set());
19
+ this.cursors.push(this.commands);
18
20
  }
19
21
  getRecording() {
20
22
  return {
@@ -30,7 +32,6 @@ class Recorder {
30
32
  const prop = props[key];
31
33
  if ((0, _utils.isSharedValue)(prop)) {
32
34
  this.animationValues.add(prop);
33
- props[key] = prop.value;
34
35
  animatedProps[key] = prop;
35
36
  hasAnimatedProps = true;
36
37
  }
@@ -49,7 +50,18 @@ class Recorder {
49
50
  command.animatedProps = animatedProps;
50
51
  }
51
52
  }
52
- this.commands.push(command);
53
+ this.cursors[this.cursors.length - 1].push(command);
54
+ }
55
+ saveGroup() {
56
+ const children = [];
57
+ this.add({
58
+ type: _Core.CommandType.Group,
59
+ children
60
+ });
61
+ this.cursors.push(children);
62
+ }
63
+ restoreGroup() {
64
+ this.cursors.pop();
53
65
  }
54
66
  savePaint(props) {
55
67
  this.add({