@shopify/react-native-skia 1.9.1 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +1 -0
  2. package/lib/commonjs/dom/nodes/datatypes/Gradient.js +14 -2
  3. package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
  4. package/lib/commonjs/index.d.ts +1 -1
  5. package/lib/commonjs/index.js +8 -8
  6. package/lib/commonjs/index.js.map +1 -1
  7. package/lib/commonjs/renderer/Canvas.d.ts +9 -10
  8. package/lib/commonjs/renderer/Canvas.js +67 -59
  9. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  10. package/lib/commonjs/renderer/CanvasOld.d.ts +11 -0
  11. package/lib/commonjs/renderer/CanvasOld.js +96 -0
  12. package/lib/commonjs/renderer/CanvasOld.js.map +1 -0
  13. package/lib/commonjs/sksg/Container.js +11 -6
  14. package/lib/commonjs/sksg/Container.js.map +1 -1
  15. package/lib/commonjs/sksg/HostConfig2.d.ts +19 -0
  16. package/lib/commonjs/sksg/HostConfig2.js +159 -0
  17. package/lib/commonjs/sksg/HostConfig2.js.map +1 -0
  18. package/lib/commonjs/sksg/Recorder/Core.js +1 -0
  19. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
  20. package/lib/commonjs/sksg/Recorder/Player.js +2 -2
  21. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  22. package/lib/commonjs/sksg/Recorder/Recorder.js +0 -1
  23. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
  24. package/lib/commonjs/sksg/Recorder/commands/Box.js +1 -1
  25. package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -1
  26. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js +1 -1
  27. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js.map +1 -1
  28. package/lib/commonjs/sksg/Recorder/commands/Drawing.js +4 -4
  29. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
  30. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +1 -1
  31. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  32. package/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +0 -1
  33. package/lib/commonjs/sksg/Recorder/commands/Paint.js +2 -14
  34. package/lib/commonjs/sksg/Recorder/commands/Paint.js.map +1 -1
  35. package/lib/commonjs/sksg/Recorder/commands/Shaders.js +1 -1
  36. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
  37. package/lib/module/dom/nodes/datatypes/Gradient.d.ts +1 -0
  38. package/lib/module/dom/nodes/datatypes/Gradient.js +12 -1
  39. package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
  40. package/lib/module/index.d.ts +1 -1
  41. package/lib/module/index.js +1 -1
  42. package/lib/module/index.js.map +1 -1
  43. package/lib/module/renderer/Canvas.d.ts +9 -10
  44. package/lib/module/renderer/Canvas.js +65 -55
  45. package/lib/module/renderer/Canvas.js.map +1 -1
  46. package/lib/module/renderer/CanvasOld.d.ts +11 -0
  47. package/lib/module/renderer/CanvasOld.js +87 -0
  48. package/lib/module/renderer/CanvasOld.js.map +1 -0
  49. package/lib/module/sksg/Container.js +11 -6
  50. package/lib/module/sksg/Container.js.map +1 -1
  51. package/lib/module/sksg/HostConfig2.d.ts +19 -0
  52. package/lib/module/sksg/HostConfig2.js +152 -0
  53. package/lib/module/sksg/HostConfig2.js.map +1 -0
  54. package/lib/module/sksg/Recorder/Core.js +1 -0
  55. package/lib/module/sksg/Recorder/Core.js.map +1 -1
  56. package/lib/module/sksg/Recorder/Player.js +2 -2
  57. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  58. package/lib/module/sksg/Recorder/Recorder.js +0 -1
  59. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  60. package/lib/module/sksg/Recorder/commands/Box.js +2 -2
  61. package/lib/module/sksg/Recorder/commands/Box.js.map +1 -1
  62. package/lib/module/sksg/Recorder/commands/ColorFilters.js +2 -2
  63. package/lib/module/sksg/Recorder/commands/ColorFilters.js.map +1 -1
  64. package/lib/module/sksg/Recorder/commands/Drawing.js +5 -5
  65. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
  66. package/lib/module/sksg/Recorder/commands/ImageFilters.js +2 -2
  67. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  68. package/lib/module/sksg/Recorder/commands/Paint.d.ts +0 -1
  69. package/lib/module/sksg/Recorder/commands/Paint.js +1 -12
  70. package/lib/module/sksg/Recorder/commands/Paint.js.map +1 -1
  71. package/lib/module/sksg/Recorder/commands/Shaders.js +2 -2
  72. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
  73. package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +1 -0
  74. package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -2
  75. package/lib/typescript/lib/commonjs/renderer/CanvasOld.d.ts +3 -0
  76. package/lib/typescript/lib/commonjs/sksg/HostConfig2.d.ts +44 -0
  77. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +0 -1
  78. package/lib/typescript/lib/module/dom/nodes/datatypes/Gradient.d.ts +1 -0
  79. package/lib/typescript/lib/module/index.d.ts +1 -1
  80. package/lib/typescript/lib/module/mock/index.d.ts +1 -0
  81. package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -3
  82. package/lib/typescript/lib/module/renderer/CanvasOld.d.ts +3 -0
  83. package/lib/typescript/lib/module/sksg/HostConfig2.d.ts +43 -0
  84. package/lib/typescript/lib/module/sksg/Recorder/commands/Paint.d.ts +0 -1
  85. package/lib/typescript/src/dom/nodes/datatypes/Gradient.d.ts +1 -0
  86. package/lib/typescript/src/index.d.ts +1 -1
  87. package/lib/typescript/src/renderer/Canvas.d.ts +9 -10
  88. package/lib/typescript/src/renderer/CanvasOld.d.ts +11 -0
  89. package/lib/typescript/src/sksg/HostConfig2.d.ts +19 -0
  90. package/lib/typescript/src/sksg/Recorder/commands/Paint.d.ts +0 -1
  91. package/package.json +1 -1
  92. package/src/dom/nodes/datatypes/Gradient.ts +17 -1
  93. package/src/index.ts +1 -1
  94. package/src/renderer/Canvas.tsx +80 -78
  95. package/src/renderer/CanvasOld.tsx +126 -0
  96. package/src/sksg/Container.ts +6 -2
  97. package/src/sksg/HostConfig2.ts +247 -0
  98. package/src/sksg/Recorder/Core.ts +1 -0
  99. package/src/sksg/Recorder/Player.ts +2 -2
  100. package/src/sksg/Recorder/Recorder.ts +0 -1
  101. package/src/sksg/Recorder/commands/Box.ts +2 -2
  102. package/src/sksg/Recorder/commands/ColorFilters.ts +2 -2
  103. package/src/sksg/Recorder/commands/Drawing.ts +5 -4
  104. package/src/sksg/Recorder/commands/ImageFilters.ts +2 -2
  105. package/src/sksg/Recorder/commands/Paint.ts +1 -17
  106. package/src/sksg/Recorder/commands/Shaders.ts +2 -1
  107. package/lib/commonjs/renderer/Canvas2.d.ts +0 -10
  108. package/lib/commonjs/renderer/Canvas2.js +0 -104
  109. package/lib/commonjs/renderer/Canvas2.js.map +0 -1
  110. package/lib/commonjs/renderer/Canvas2.web.d.ts +0 -3
  111. package/lib/commonjs/renderer/Canvas2.web.js +0 -9
  112. package/lib/commonjs/renderer/Canvas2.web.js.map +0 -1
  113. package/lib/module/renderer/Canvas2.d.ts +0 -10
  114. package/lib/module/renderer/Canvas2.js +0 -97
  115. package/lib/module/renderer/Canvas2.js.map +0 -1
  116. package/lib/module/renderer/Canvas2.web.d.ts +0 -3
  117. package/lib/module/renderer/Canvas2.web.js +0 -3
  118. package/lib/module/renderer/Canvas2.web.js.map +0 -1
  119. package/lib/typescript/lib/commonjs/renderer/Canvas2.d.ts +0 -3
  120. package/lib/typescript/lib/commonjs/renderer/Canvas2.web.d.ts +0 -2
  121. package/lib/typescript/lib/module/renderer/Canvas2.d.ts +0 -1
  122. package/lib/typescript/lib/module/renderer/Canvas2.web.d.ts +0 -1
  123. package/lib/typescript/src/renderer/Canvas2.d.ts +0 -10
  124. package/lib/typescript/src/renderer/Canvas2.web.d.ts +0 -3
  125. package/src/renderer/Canvas2.tsx +0 -128
  126. 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,I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C3B,CAAC;EAEDqE,wBAAwB,EAAEA,CAAClD,SAAS,EAAEnB,KAAK,KAAK;IAC9CmB,SAAS,CAACC,IAAI,CAAChB,MAAM,CAACe,SAAS,CAACC,IAAI,CAACf,OAAO,CAACL,KAAK,CAAC,EAAE,CAAC,CAAC;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":[]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
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",
@@ -1 +1 @@
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// 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;AAAA,IACYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,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;E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W,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":[]}
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;\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;AAAA,IACYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CA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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,7 +13,7 @@ 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
19
  if ((0, _Core.isGroup)(command)) {
@@ -119,7 +119,7 @@ const play = (ctx, command) => {
119
119
  ctx.paints.pop();
120
120
  });
121
121
  }
122
- };
122
+ }
123
123
  const replay = (ctx, commands) => {
124
124
  "worklet";
125
125
 
@@ -1 +1 @@
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\nconst 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"],"mapp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ACzD,IAAAC,mBAAU,EAACrF,GAAG,EAAEC,OAAO,CAACmB,KAAK,CAAC;MAChC,CAAC,MAAM,IAAI,IAAAF,mBAAa,EAACjB,OAAO,EAAEO,iBAAW,CAAC8E,WAAW,CAAC,EAAE;QAC1D,IAAAC,oBAAW,EAACvF,GAAG,EAAEC,OAAO,CAACmB,KAAK,CAAC;MACjC,CAAC,MAAM,IAAI,IAAAF,mBAAa,EAACjB,OAAO,EAAEO,iBAAW,CAACgF,YAAY,CAAC,EAAE;QAC3D,IAAAC,qBAAY,EAACzF,GAAG,EAAEC,OAAO,CAACmB,KAAK,CAAC;MAClC,CAAC,MAAM,IAAI,IAAAF,mBAAa,EAACjB,OAAO,EAAEO,iBAAW,CAACkF,aAAa,CAAC,EAAE;QAC5D,IAAAC,sBAAa,EAAC3F,GAAG,EAAEC,OAAO,CAACmB,KAAK,CAAC;MACnC,CAAC,MAAM,IAAI,IAAAF,mBAAa,EAACjB,OAAO,EAAEO,iBAAW,CAACoF,SAAS,CAAC,EAAE;QACxD,IAAAC,kBAAS,EAAC7F,GAAG,EAAEC,OAAO,CAACmB,KAAK,CAAC;MAC/B,CAAC,MAAM;QACL0E,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,CAAC;AAEM,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":[]}
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,IAAAH,eAAS,EAACN,OAAO,EAAEO,iBAAW,CAACG,SAAS,CAAC,EAAE;IACpDX,GAAG,CAACY,gBAAgB,CAAC,CAAC;IACtB,MAAMC,KAAK,GAAGb,GAAG,CAACc,iBAAiB,CAACC,GAAG,CAAC,CAAC;IACzCf,GAAG,CAACgB,MAAM,CAACC,SAAS,CAACJ,KAAK,CAAC;EAC7B,CAAC,MAAM,IA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C9F,OAAO,CAAEH,OAAO,IAAK;IAC5BF,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC;AAACkG,OAAA,CAAAF,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -32,7 +32,6 @@ class Recorder {
32
32
  const prop = props[key];
33
33
  if ((0, _utils.isSharedValue)(prop)) {
34
34
  this.animationValues.add(prop);
35
- props[key] = prop.value;
36
35
  animatedProps[key] = prop;
37
36
  hasAnimatedProps = true;
38
37
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_utils","_Node","_Core","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Recorder","constructor","Set","cursors","push","commands","getRecording","paintPool","animationValues","processProps","props","animatedProps","hasAnimatedProps","key","prop","isSharedValue","add","undefined","command","length","saveGroup","children","type","CommandType","Group","restoreGroup","pop","savePaint","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","isPathEffect","Error","PushPathEffect","pushImageFilter","imageFilterType","isImageFilter","PushImageFilter","pushColorFilter","colorFilterType","isColorFilter","PushColorFilter","pushShader","shaderType","isShader","NodeType","Blend","PushShader","pushBlurMaskFilter","PushBlurMaskFilter","composePathEffect","ComposePathEffect","composeColorFilter","ComposeColorFilter","composeImageFilter","ComposeImageFilter","saveCTM","SaveCTM","restoreCTM","RestoreCTM","drawPaint","DrawPaint","saveLayer","SaveLayer","saveBackdropFilter","SaveBackdropFilter","drawBox","boxProps","shadows","forEach","shadow","DrawBox","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","exports"],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport { NodeType } from \"../../dom/types\";\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PaintProps,\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 BoxProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\nimport type { SkPaint } from \"../../skia/types\";\n\nimport { CommandType } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nexport interface Recording {\n commands: Command[];\n paintPool: SkPaint[];\n}\n\ninterface AnimationValues {\n animationValues: Set<SharedValue<unknown>>;\n}\n\nexport class Recorder {\n commands: Command[] = [];\n cursors: Command[][] = [];\n animationValues: Set<SharedValue<unknown>> = new Set();\n\n constructor() {\n this.cursors.push(this.commands);\n }\n\n getRecording(): Recording & AnimationValues {\n return {\n commands: this.commands,\n paintPool: [],\n animationValues: this.animationValues,\n };\n }\n\n private processProps(props: Record<string, unknown>) {\n const animatedProps: Record<string, SharedValue<unknown>> = {};\n let hasAnimatedProps = false;\n\n for (const key in props) {\n const prop = props[key];\n if (isSharedValue(prop)) {\n this.animationValues.add(prop);\n props[key] = prop.value;\n animatedProps[key] = prop;\n hasAnimatedProps = true;\n }\n }\n\n return {\n props,\n animatedProps: hasAnimatedProps ? animatedProps : undefined,\n };\n }\n\n private add(command: Command) {\n if (command.props) {\n const { animatedProps } = this.processProps(\n command.props as Record<string, unknown>\n );\n if (animatedProps) {\n command.animatedProps = animatedProps;\n }\n }\n this.cursors[this.cursors.length - 1].push(command);\n }\n\n saveGroup() {\n const children: Command[] = [];\n this.add({ type: CommandType.Group, children });\n this.cursors.push(children);\n }\n\n restoreGroup() {\n this.cursors.pop();\n }\n\n savePaint(props: AnimatedProps<PaintProps>) {\n this.add({ type: CommandType.SavePaint, props });\n }\n\n restorePaint() {\n this.add({ type: CommandType.RestorePaint });\n }\n\n restorePaintDeclaration() {\n this.add({ type: CommandType.RestorePaintDeclaration });\n }\n\n materializePaint() {\n this.add({ type: CommandType.MaterializePaint });\n }\n\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>) {\n if (!isPathEffect(pathEffectType)) {\n throw new Error(\"Invalid color filter type: \" + pathEffectType);\n }\n this.add({\n type: CommandType.PushPathEffect,\n pathEffectType,\n props,\n });\n }\n\n pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isImageFilter(imageFilterType)) {\n throw new Error(\"Invalid color filter type: \" + imageFilterType);\n }\n this.add({\n type: CommandType.PushImageFilter,\n imageFilterType,\n props,\n });\n }\n\n pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isColorFilter(colorFilterType)) {\n throw new Error(\"Invalid color filter type: \" + colorFilterType);\n }\n this.add({\n type: CommandType.PushColorFilter,\n colorFilterType,\n props,\n });\n }\n\n pushShader(shaderType: NodeType, props: AnimatedProps<unknown>) {\n if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {\n throw new Error(\"Invalid color filter type: \" + shaderType);\n }\n this.add({ type: CommandType.PushShader, shaderType, props });\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>) {\n this.add({ type: CommandType.PushBlurMaskFilter, props });\n }\n\n composePathEffect() {\n this.add({ type: CommandType.ComposePathEffect });\n }\n\n composeColorFilter() {\n this.add({ type: CommandType.ComposeColorFilter });\n }\n\n composeImageFilter() {\n this.add({ type: CommandType.ComposeImageFilter });\n }\n\n saveCTM(props: AnimatedProps<CTMProps>) {\n this.add({ type: CommandType.SaveCTM, props });\n }\n\n restoreCTM() {\n this.add({ type: CommandType.RestoreCTM });\n }\n\n drawPaint() {\n this.add({ type: CommandType.DrawPaint });\n }\n\n saveLayer() {\n this.add({ type: CommandType.SaveLayer });\n }\n\n saveBackdropFilter() {\n this.add({ type: CommandType.SaveBackdropFilter });\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ) {\n shadows.forEach((shadow) => {\n if (shadow.props) {\n if (shadow.props) {\n const { animatedProps } = this.processProps(\n shadow.props as unknown as Record<string, unknown>\n );\n if (animatedProps) {\n shadow.animatedProps = animatedProps;\n }\n }\n }\n });\n this.add({ type: CommandType.DrawBox, props: boxProps, shadows });\n }\n\n drawImage(props: AnimatedProps<ImageProps>) {\n this.add({ type: CommandType.DrawImage, props });\n }\n\n drawCircle(props: AnimatedProps<CircleProps>) {\n this.add({ type: CommandType.DrawCircle, props });\n }\n drawPoints(props: AnimatedProps<PointsProps>) {\n this.add({ type: CommandType.DrawPoints, props });\n }\n\n drawPath(props: AnimatedProps<PathProps>) {\n this.add({ type: CommandType.DrawPath, props });\n }\n\n drawRect(props: AnimatedProps<RectProps>) {\n this.add({ type: CommandType.DrawRect, props });\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>) {\n this.add({ type: CommandType.DrawRRect, props });\n }\n\n drawOval(props: AnimatedProps<OvalProps>) {\n this.add({ type: CommandType.DrawOval, props });\n }\n\n drawLine(props: AnimatedProps<LineProps>) {\n this.add({ type: CommandType.DrawLine, props });\n }\n\n drawPatch(props: AnimatedProps<PatchProps>) {\n this.add({ type: CommandType.DrawPatch, props });\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>) {\n this.add({ type: CommandType.DrawVertices, props });\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>) {\n this.add({ type: CommandType.DrawDiffRect, props });\n }\n\n drawText(props: AnimatedProps<TextProps>) {\n this.add({ type: CommandType.DrawText, props });\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>) {\n this.add({ type: CommandType.DrawTextPath, props });\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>) {\n this.add({ type: CommandType.DrawTextBlob, props });\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>) {\n this.add({ type: CommandType.DrawGlyphs, props });\n }\n\n drawPicture(props: AnimatedProps<PictureProps>) {\n this.add({ type: CommandType.DrawPicture, props });\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>) {\n this.add({ type: CommandType.DrawImageSVG, props });\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>) {\n this.add({ type: CommandType.DrawParagraph, props });\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>) {\n this.add({ type: CommandType.DrawAtlas, props });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AA4BA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAA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AG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAACwF,YAAY;MAAErG;IAAM,CAAC,CAAC;EACrD;EAEAsG,aAAaA,CAACtG,KAAoC,EAAE;IAClD,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAAC0F,aAAa;MAAEvG;IAAM,CAAC,CAAC;EACtD;EAEAwG,SAASA,CAACxG,KAAgC,EAAE;IAC1C,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAAC4F,SAAS;MAAEzG;IAAM,CAAC,CAAC;EAClD;AACF;AAAC0G,OAAA,CAAApH,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_types","require","_utils","_Node","_Core","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Recorder","constructor","Set","cursors","push","commands","getRecording","paintPool","animationValues","processProps","props","animatedProps","hasAnimatedProps","key","prop","isSharedValue","add","undefined","command","length","saveGroup","children","type","CommandType","Group","restoreGroup","pop","savePaint","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","isPathEffect","Error","PushPathEffect","pushImageFilter","imageFilterType","isImageFilter","PushImageFilter","pushColorFilter","colorFilterType","isColorFilter","PushColorFilter","pushShader","shaderType","isShader","NodeType","Blend","PushShader","pushBlurMaskFilter","PushBlurMaskFilter","composePathEffect","ComposePathEffect","composeColorFilter","ComposeColorFilter","composeImageFilter","ComposeImageFilter","saveCTM","SaveCTM","restoreCTM","RestoreCTM","drawPaint","DrawPaint","saveLayer","SaveLayer","saveBackdropFilter","SaveBackdropFilter","drawBox","boxProps","shadows","forEach","shadow","DrawBox","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","exports"],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport { NodeType } from \"../../dom/types\";\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PaintProps,\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 BoxProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\nimport type { SkPaint } from \"../../skia/types\";\n\nimport { CommandType } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nexport interface Recording {\n commands: Command[];\n paintPool: SkPaint[];\n}\n\ninterface AnimationValues {\n animationValues: Set<SharedValue<unknown>>;\n}\n\nexport class Recorder {\n commands: Command[] = [];\n cursors: Command[][] = [];\n animationValues: Set<SharedValue<unknown>> = new Set();\n\n constructor() {\n this.cursors.push(this.commands);\n }\n\n getRecording(): Recording & AnimationValues {\n return {\n commands: this.commands,\n paintPool: [],\n animationValues: this.animationValues,\n };\n }\n\n private processProps(props: Record<string, unknown>) {\n const animatedProps: Record<string, SharedValue<unknown>> = {};\n let hasAnimatedProps = false;\n\n for (const key in props) {\n const prop = props[key];\n if (isSharedValue(prop)) {\n this.animationValues.add(prop);\n animatedProps[key] = prop;\n hasAnimatedProps = true;\n }\n }\n\n return {\n props,\n animatedProps: hasAnimatedProps ? animatedProps : undefined,\n };\n }\n\n private add(command: Command) {\n if (command.props) {\n const { animatedProps } = this.processProps(\n command.props as Record<string, unknown>\n );\n if (animatedProps) {\n command.animatedProps = animatedProps;\n }\n }\n this.cursors[this.cursors.length - 1].push(command);\n }\n\n saveGroup() {\n const children: Command[] = [];\n this.add({ type: CommandType.Group, children });\n this.cursors.push(children);\n }\n\n restoreGroup() {\n this.cursors.pop();\n }\n\n savePaint(props: AnimatedProps<PaintProps>) {\n this.add({ type: CommandType.SavePaint, props });\n }\n\n restorePaint() {\n this.add({ type: CommandType.RestorePaint });\n }\n\n restorePaintDeclaration() {\n this.add({ type: CommandType.RestorePaintDeclaration });\n }\n\n materializePaint() {\n this.add({ type: CommandType.MaterializePaint });\n }\n\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>) {\n if (!isPathEffect(pathEffectType)) {\n throw new Error(\"Invalid color filter type: \" + pathEffectType);\n }\n this.add({\n type: CommandType.PushPathEffect,\n pathEffectType,\n props,\n });\n }\n\n pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isImageFilter(imageFilterType)) {\n throw new Error(\"Invalid color filter type: \" + imageFilterType);\n }\n this.add({\n type: CommandType.PushImageFilter,\n imageFilterType,\n props,\n });\n }\n\n pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isColorFilter(colorFilterType)) {\n throw new Error(\"Invalid color filter type: \" + colorFilterType);\n }\n this.add({\n type: CommandType.PushColorFilter,\n colorFilterType,\n props,\n });\n }\n\n pushShader(shaderType: NodeType, props: AnimatedProps<unknown>) {\n if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {\n throw new Error(\"Invalid color filter type: \" + shaderType);\n }\n this.add({ type: CommandType.PushShader, shaderType, props });\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>) {\n this.add({ type: CommandType.PushBlurMaskFilter, props });\n }\n\n composePathEffect() {\n this.add({ type: CommandType.ComposePathEffect });\n }\n\n composeColorFilter() {\n this.add({ type: CommandType.ComposeColorFilter });\n }\n\n composeImageFilter() {\n this.add({ type: CommandType.ComposeImageFilter });\n }\n\n saveCTM(props: AnimatedProps<CTMProps>) {\n this.add({ type: CommandType.SaveCTM, props });\n }\n\n restoreCTM() {\n this.add({ type: CommandType.RestoreCTM });\n }\n\n drawPaint() {\n this.add({ type: CommandType.DrawPaint });\n }\n\n saveLayer() {\n this.add({ type: CommandType.SaveLayer });\n }\n\n saveBackdropFilter() {\n this.add({ type: CommandType.SaveBackdropFilter });\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ) {\n shadows.forEach((shadow) => {\n if (shadow.props) {\n if (shadow.props) {\n const { animatedProps } = this.processProps(\n shadow.props as unknown as Record<string, unknown>\n );\n if (animatedProps) {\n shadow.animatedProps = animatedProps;\n }\n }\n }\n });\n this.add({ type: CommandType.DrawBox, props: boxProps, shadows });\n }\n\n drawImage(props: AnimatedProps<ImageProps>) {\n this.add({ type: CommandType.DrawImage, props });\n }\n\n drawCircle(props: AnimatedProps<CircleProps>) {\n this.add({ type: CommandType.DrawCircle, props });\n }\n drawPoints(props: AnimatedProps<PointsProps>) {\n this.add({ type: CommandType.DrawPoints, props });\n }\n\n drawPath(props: AnimatedProps<PathProps>) {\n this.add({ type: CommandType.DrawPath, props });\n }\n\n drawRect(props: AnimatedProps<RectProps>) {\n this.add({ type: CommandType.DrawRect, props });\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>) {\n this.add({ type: CommandType.DrawRRect, props });\n }\n\n drawOval(props: AnimatedProps<OvalProps>) {\n this.add({ type: CommandType.DrawOval, props });\n }\n\n drawLine(props: AnimatedProps<LineProps>) {\n this.add({ type: CommandType.DrawLine, props });\n }\n\n drawPatch(props: AnimatedProps<PatchProps>) {\n this.add({ type: CommandType.DrawPatch, props });\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>) {\n this.add({ type: CommandType.DrawVertices, props });\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>) {\n this.add({ type: CommandType.DrawDiffRect, props });\n }\n\n drawText(props: AnimatedProps<TextProps>) {\n this.add({ type: CommandType.DrawText, props });\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>) {\n this.add({ type: CommandType.DrawTextPath, props });\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>) {\n this.add({ type: CommandType.DrawTextBlob, props });\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>) {\n this.add({ type: CommandType.DrawGlyphs, props });\n }\n\n drawPicture(props: AnimatedProps<PictureProps>) {\n this.add({ type: CommandType.DrawPicture, props });\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>) {\n this.add({ type: CommandType.DrawImageSVG, props });\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>) {\n this.add({ type: CommandType.DrawParagraph, props });\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>) {\n this.add({ type: CommandType.DrawAtlas, props });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AA4BA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAA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ACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAACwF,YAAY;MAAErG;IAAM,CAAC,CAAC;EACrD;EAEAsG,aAAaA,CAACtG,KAAoC,EAAE;IAClD,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAAC0F,aAAa;MAAEvG;IAAM,CAAC,CAAC;EACtD;EAEAwG,SAASA,CAACxG,KAAgC,EAAE;IAC1C,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAAC4F,SAAS;MAAEzG;IAAM,CAAC,CAAC;EAClD;AACF;AAAC0G,OAAA,CAAApH,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -40,7 +40,7 @@ const drawBox = (ctx, command) => {
40
40
  dy = 0
41
41
  } = shadow;
42
42
  const lPaint = Skia.Paint();
43
- lPaint.setColor(Skia.Color(color));
43
+ lPaint.setColor((0, _nodes.processColor)(Skia, color));
44
44
  lPaint.setAlphaf(paint.getAlphaf() * opacity);
45
45
  lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(_types.BlurStyle.Normal, blur, true));
46
46
  canvas.drawRRect((0, _nodes.inflate)(Skia, box, spread, spread, dx, dy), lPaint);
@@ -1 +1 @@
1
- {"version":3,"names":["_nodes","require","_types","_Core","isBoxCommand","command","type","CommandType","DrawBox","exports","drawBox","ctx","shadows","forEach","shadow","materializeProps","map","props","paint","Skia","canvas","box","defaultBox","opacity","getAlphaf","isRRect","RRectXY","filter","inner","color","blur","spread","dx","dy","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","inflate","delta","Point","Math","abs","save","clipRRect","ClipOp","Intersect","deflate","outer","x","y","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import { deflate, inflate } from \"../../../dom/nodes\";\nimport type { BoxProps, BoxShadowProps } from \"../../../dom/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { Command } from \"../Core\";\nimport { CommandType, materializeProps } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\ninterface BoxCommand extends Command<CommandType.DrawBox> {\n props: BoxProps;\n shadows: { props: BoxShadowProps }[];\n}\n\nexport const isBoxCommand = (command: Command): command is BoxCommand => {\n \"worklet\";\n return command.type === CommandType.DrawBox;\n};\n\nexport const drawBox = (ctx: DrawingContext, command: BoxCommand) => {\n \"worklet\";\n command.shadows.forEach((shadow) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n materializeProps(shadow as any);\n });\n const shadows = command.shadows.map((shadow) => shadow.props);\n const { paint, Skia, canvas } = ctx;\n const { box: defaultBox } = command.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(Skia, box, spread, spread, dx, dy);\n const outer = inflate(Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });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K,CAACM,SAAS,CAAC,CAAC,GAAGD,OAAO,CAAC;IAE7CW,MAAM,CAACK,aAAa,CAClBpB,IAAI,CAACqB,UAAU,CAACC,QAAQ,CAACC,gBAAS,CAACC,MAAM,EAAEb,IAAI,EAAE,IAAI,CACvD,CAAC;IACD,MAAMF,KAAK,GAAG,IAAA0B,cAAO,EAACnC,IAAI,EAAEE,GAAG,EAAEU,MAAM,EAAEA,MAAM,EAAEC,EAAE,EAAEC,EAAE,CAAC;IACxD,MAAMsB,KAAK,GAAG,IAAAV,cAAO,EAAC1B,IAAI,EAAEE,GAAG,EAAEyB,KAAK,CAACU,CAAC,EAAEV,KAAK,CAACW,CAAC,CAAC;IAClDrC,MAAM,CAACsC,UAAU,CAACH,KAAK,EAAE3B,KAAK,EAAEM,MAAM,CAAC;IACvCd,MAAM,CAACuC,OAAO,CAAC,CAAC;EAClB,CAAC,CAAC;AACN,CAAC;AAAClD,OAAA,CAAAC,OAAA,GAAAA,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_nodes","require","_types","_Core","isBoxCommand","command","type","CommandType","DrawBox","exports","drawBox","ctx","shadows","forEach","shadow","materializeProps","map","props","paint","Skia","canvas","box","defaultBox","opacity","getAlphaf","isRRect","RRectXY","filter","inner","color","blur","spread","dx","dy","lPaint","Paint","setColor","processColor","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","inflate","delta","Point","Math","abs","save","clipRRect","ClipOp","Intersect","Color","deflate","outer","x","y","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import { deflate, inflate, processColor } from \"../../../dom/nodes\";\nimport type { BoxProps, BoxShadowProps } from \"../../../dom/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { Command } from \"../Core\";\nimport { CommandType, materializeProps } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\ninterface BoxCommand extends Command<CommandType.DrawBox> {\n props: BoxProps;\n shadows: { props: BoxShadowProps }[];\n}\n\nexport const isBoxCommand = (command: Command): command is BoxCommand => {\n \"worklet\";\n return command.type === CommandType.DrawBox;\n};\n\nexport const drawBox = (ctx: DrawingContext, command: BoxCommand) => {\n \"worklet\";\n command.shadows.forEach((shadow) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n materializeProps(shadow as any);\n });\n const shadows = command.shadows.map((shadow) => shadow.props);\n const { paint, Skia, canvas } = ctx;\n const { box: defaultBox } = command.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(processColor(Skia, color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(Skia, box, spread, spread, dx, dy);\n const outer = inflate(Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AAQO,MAAMG,YAA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,CAACC,MAAM,EAAEb,IAAI,EAAE,IAAI,CACvD,CAAC;IACD,MAAMF,KAAK,GAAG,IAAA2B,cAAO,EAACpC,IAAI,EAAEE,GAAG,EAAEU,MAAM,EAAEA,MAAM,EAAEC,EAAE,EAAEC,EAAE,CAAC;IACxD,MAAMuB,KAAK,GAAG,IAAAX,cAAO,EAAC1B,IAAI,EAAEE,GAAG,EAAEyB,KAAK,CAACW,CAAC,EAAEX,KAAK,CAACY,CAAC,CAAC;IAClDtC,MAAM,CAACuC,UAAU,CAACH,KAAK,EAAE5B,KAAK,EAAEM,MAAM,CAAC;IACvCd,MAAM,CAACwC,OAAO,CAAC,CAAC;EAClB,CAAC,CAAC;AACN,CAAC;AAACnD,OAAA,CAAAC,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -40,7 +40,7 @@ const pushColorFilter = (ctx, command) => {
40
40
  const {
41
41
  mode
42
42
  } = props;
43
- const color = ctx.Skia.Color(props.color);
43
+ const color = (0, _nodes.processColor)(ctx.Skia, props.color);
44
44
  cf = ctx.Skia.ColorFilter.MakeBlend(color, _types2.BlendMode[(0, _nodes.enumKey)(mode)]);
45
45
  } else if (isColorFilter(command, _types.NodeType.MatrixColorFilter)) {
46
46
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["_nodes","require","_types","_types2","_Core","isPushColorFilter","command","type","CommandType","PushColorFilter","exports","isColorFilter","colorFilterType","composeColorFilters","ctx","colorFilters","length","outer","pop","inner","push","Skia","ColorFilter","MakeCompose","pushColorFilter","cf","NodeType","BlendColorFilter","props","mode","color","Color","MakeBlend","BlendMode","enumKey","MatrixColorFilter","matrix","MakeMatrix","LerpColorFilter","t","second","first","Error","MakeLerp","LumaColorFilter","MakeLumaColorFilter","LinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","SRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma"],"sources":["ColorFilters.ts"],"sourcesContent":["import { enumKey } from \"../../../dom/nodes\";\nimport type {\n BlendColorFilterProps,\n LerpColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../../dom/types\";\nimport { NodeType } from \"../../../dom/types\";\nimport type { SkColorFilter } from \"../../../skia/types\";\nimport { BlendMode } from \"../../../skia/types\";\nimport { CommandType } from \"../Core\";\nimport type { Command } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nexport const isPushColorFilter = (\n command: Command\n): command is Command<CommandType.PushColorFilter> => {\n \"worklet\";\n return command.type === CommandType.PushColorFilter;\n};\n\ntype Props = {\n [NodeType.BlendColorFilter]: BlendColorFilterProps;\n [NodeType.MatrixColorFilter]: MatrixColorFilterProps;\n [NodeType.LerpColorFilter]: LerpColorFilterProps;\n [NodeType.LumaColorFilter]: Record<string, never>;\n [NodeType.LinearToSRGBGammaColorFilter]: Record<string, never>;\n [NodeType.SRGBToLinearGammaColorFilter]: Record<string, never>;\n};\n\ninterface PushColorFilter<T extends keyof Props>\n extends Command<CommandType.PushColorFilter> {\n colorFilterType: T;\n props: Props[T];\n}\n\nconst isColorFilter = <T extends keyof Props>(\n command: Command<CommandType.PushColorFilter>,\n type: T\n): command is PushColorFilter<T> => {\n \"worklet\";\n return command.colorFilterType === type;\n};\n\nexport const composeColorFilters = (ctx: DrawingContext) => {\n \"worklet\";\n if (ctx.colorFilters.length > 1) {\n const outer = ctx.colorFilters.pop()!;\n const inner = ctx.colorFilters.pop()!;\n ctx.colorFilters.push(ctx.Skia.ColorFilter.MakeCompose(outer, inner));\n }\n};\n\nexport const pushColorFilter = (\n ctx: DrawingContext,\n command: Command<CommandType.PushColorFilter>\n) => {\n \"worklet\";\n let cf: SkColorFilter | undefined;\n if (isColorFilter(command, NodeType.BlendColorFilter)) {\n const { props } = command;\n const { mode } = props;\n const color = ctx.Skia.Color(props.color);\n cf = ctx.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n } else if (isColorFilter(command, NodeType.MatrixColorFilter)) {\n const { matrix } = command.props;\n cf = ctx.Skia.ColorFilter.MakeMatrix(matrix);\n } else if (isColorFilter(command, NodeType.LerpColorFilter)) {\n const { props } = command;\n const { t } = props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n if (!first || !second) {\n throw new Error(\"LerpColorFilter requires two color filters\");\n }\n cf = ctx.Skia.ColorFilter.MakeLerp(t, first, second);\n } else if (isColorFilter(command, NodeType.LumaColorFilter)) {\n cf = ctx.Skia.ColorFilter.MakeLumaColorFilter();\n } else if (isColorFilter(command, NodeType.LinearToSRGBGammaColorFilter)) {\n cf = ctx.Skia.ColorFilter.MakeLinearToSRGBGamma();\n } else if (isColorFilter(command, NodeType.SRGBToLinearGammaColorFilter)) {\n cf = ctx.Skia.ColorFilter.MakeSRGBToLinearGamma();\n }\n if (!cf) {\n throw new Error(`Unknown color filter type: ${command.colorFilterType}`);\n }\n ctx.colorFilters.push(cf);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAIO,MAAMI,iBAAiB,GAC5BC,OAAgB,IACoC;EACpD,SAAS;;EACT,OAAOA,OAAO,CAACC,IAAI,KAAKC,iBAAW,CAACC,eAAe;AACrD,CAAC;AAACC,OAAA,CAAAL,iBAAA,GAAAA,iBAAA;AAiBF,MAAMM,aAAa,GAAGA,CACpBL,OAA6C,EAC7CC,IAAO,KAC2B;EAClC,SAAS;;EACT,OAAOD,OAAO,CAACM,eAAe,KAAKL,IAAI;AACzC,CAAC;AAEM,MAAMM,mBAAmB,GAAIC,GAAmB,IAAK;EAC1D,SAAS;;EACT,IAAIA,GAAG,CAACC,YAAY,CAACC,MAAM,GAAG,CAAC,EAAE;IAC/B,MAAMC,KAAK,GAAGH,GAAG,CAACC,YAAY,CAACG,GAAG,CAAC,CAAE;IACrC,MAAMC,KAAK,GAAGL,GAAG,CAACC,YAAY,CAACG,GAAG,CAAC,CAAE;IACrCJ,G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,CAACD,MAAM,EAAE;MACrB,MAAM,IAAIE,KAAK,CAAC,4CAA4C,CAAC;IAC/D;IACAjB,EAAE,GAAGX,GAAG,CAACO,IAAI,CAACC,WAAW,CAACqB,QAAQ,CAACJ,CAAC,EAAEE,KAAK,EAAED,MAAM,CAAC;EACtD,CAAC,MAAM,IAAI7B,aAAa,CAACL,OAAO,EAAEoB,eAAQ,CAACkB,eAAe,CAAC,EAAE;IAC3DnB,EAAE,GAAGX,GAAG,CAACO,IAAI,CAACC,WAAW,CAACuB,mBAAmB,CAAC,CAAC;EACjD,CAAC,MAAM,IAAIlC,aAAa,CAACL,OAAO,EAAEoB,eAAQ,CAACoB,4BAA4B,CAAC,EAAE;IACxErB,EAAE,GAAGX,GAAG,CAACO,IAAI,CAACC,WAAW,CAACyB,qBAAqB,CAAC,CAAC;EACnD,CAAC,MAAM,IAAIpC,aAAa,CAACL,OAAO,EAAEoB,eAAQ,CAACsB,4BAA4B,CAAC,EAAE;IACxEvB,EAAE,GAAGX,GAAG,CAACO,IAAI,CAACC,WAAW,CAAC2B,qBAAqB,CAAC,CAAC;EACnD;EACA,IAAI,CAACxB,EAAE,EAAE;IACP,MAAM,IAAIiB,KAAK,CAAC,8BAA8BpC,OAAO,CAACM,eAAe,EAAE,CAAC;EAC1E;EACAE,GAAG,CAACC,YAAY,CAACK,IAAI,CAACK,EAAE,CAAC;AAC3B,CAAC;AAACf,OAAA,CAAAc,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_nodes","require","_types","_types2","_Core","isPushColorFilter","command","type","CommandType","PushColorFilter","exports","isColorFilter","colorFilterType","composeColorFilters","ctx","colorFilters","length","outer","pop","inner","push","Skia","ColorFilter","MakeCompose","pushColorFilter","cf","NodeType","BlendColorFilter","props","mode","color","processColor","MakeBlend","BlendMode","enumKey","MatrixColorFilter","matrix","MakeMatrix","LerpColorFilter","t","second","first","Error","MakeLerp","LumaColorFilter","MakeLumaColorFilter","LinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","SRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma"],"sources":["ColorFilters.ts"],"sourcesContent":["import { enumKey, processColor } from \"../../../dom/nodes\";\nimport type {\n BlendColorFilterProps,\n LerpColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../../dom/types\";\nimport { NodeType } from \"../../../dom/types\";\nimport type { SkColorFilter } from \"../../../skia/types\";\nimport { BlendMode } from \"../../../skia/types\";\nimport { CommandType } from \"../Core\";\nimport type { Command } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nexport const isPushColorFilter = (\n command: Command\n): command is Command<CommandType.PushColorFilter> => {\n \"worklet\";\n return command.type === CommandType.PushColorFilter;\n};\n\ntype Props = {\n [NodeType.BlendColorFilter]: BlendColorFilterProps;\n [NodeType.MatrixColorFilter]: MatrixColorFilterProps;\n [NodeType.LerpColorFilter]: LerpColorFilterProps;\n [NodeType.LumaColorFilter]: Record<string, never>;\n [NodeType.LinearToSRGBGammaColorFilter]: Record<string, never>;\n [NodeType.SRGBToLinearGammaColorFilter]: Record<string, never>;\n};\n\ninterface PushColorFilter<T extends keyof Props>\n extends Command<CommandType.PushColorFilter> {\n colorFilterType: T;\n props: Props[T];\n}\n\nconst isColorFilter = <T extends keyof Props>(\n command: Command<CommandType.PushColorFilter>,\n type: T\n): command is PushColorFilter<T> => {\n \"worklet\";\n return command.colorFilterType === type;\n};\n\nexport const composeColorFilters = (ctx: DrawingContext) => {\n \"worklet\";\n if (ctx.colorFilters.length > 1) {\n const outer = ctx.colorFilters.pop()!;\n const inner = ctx.colorFilters.pop()!;\n ctx.colorFilters.push(ctx.Skia.ColorFilter.MakeCompose(outer, inner));\n }\n};\n\nexport const pushColorFilter = (\n ctx: DrawingContext,\n command: Command<CommandType.PushColorFilter>\n) => {\n \"worklet\";\n let cf: SkColorFilter | undefined;\n if (isColorFilter(command, NodeType.BlendColorFilter)) {\n const { props } = command;\n const { mode } = props;\n const color = processColor(ctx.Skia, props.color);\n cf = ctx.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n } else if (isColorFilter(command, NodeType.MatrixColorFilter)) {\n const { matrix } = command.props;\n cf = ctx.Skia.ColorFilter.MakeMatrix(matrix);\n } else if (isColorFilter(command, NodeType.LerpColorFilter)) {\n const { props } = command;\n const { t } = props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n if (!first || !second) {\n throw new Error(\"LerpColorFilter requires two color filters\");\n }\n cf = ctx.Skia.ColorFilter.MakeLerp(t, first, second);\n } else if (isColorFilter(command, NodeType.LumaColorFilter)) {\n cf = ctx.Skia.ColorFilter.MakeLumaColorFilter();\n } else if (isColorFilter(command, NodeType.LinearToSRGBGammaColorFilter)) {\n cf = ctx.Skia.ColorFilter.MakeLinearToSRGBGamma();\n } else if (isColorFilter(command, NodeType.SRGBToLinearGammaColorFilter)) {\n cf = ctx.Skia.ColorFilter.MakeSRGBToLinearGamma();\n }\n if (!cf) {\n throw new Error(`Unknown color filter type: ${command.colorFilterType}`);\n }\n ctx.colorFilters.push(cf);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAIO,MAAMI,iBAAiB,GAC5BC,OAAgB,IACoC;EACpD,SAAS;;EACT,OAAOA,OAAO,CAACC,IAAI,KAAKC,iBAAW,CAACC,eAAe;AACrD,CAAC;AAACC,OAAA,CAAAL,iBAAA,GAAAA,iBAAA;AAiBF,MAAMM,aAAa,GAAGA,CACpBL,OAA6C,EAC7CC,IAAO,KAC2B;EAClC,SAAS;;EACT,OAAOD,OAAO,CAACM,eAAe,KAAKL,IAAI;AACzC,CAAC;AAEM,MAAMM,mBAAmB,GAAIC,GAAmB,IAAK;EAC1D,SAAS;;EACT,IAAIA,GAAG,CAACC,YAAY,CAACC,MAAM,GAAG,CAAC,EAAE;I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AM,GAAG1B,GAAG,CAACC,YAAY,CAACG,GAAG,CAAC,CAAC;IACrC,MAAMuB,KAAK,GAAG3B,GAAG,CAACC,YAAY,CAACG,GAAG,CAAC,CAAC;IACpC,IAAI,CAACuB,KAAK,IAAI,CAACD,MAAM,EAAE;MACrB,MAAM,IAAIE,KAAK,CAAC,4CAA4C,CAAC;IAC/D;IACAjB,EAAE,GAAGX,GAAG,CAACO,IAAI,CAACC,WAAW,CAACqB,QAAQ,CAACJ,CAAC,EAAEE,KAAK,EAAED,MAAM,CAAC;EACtD,CAAC,MAAM,IAAI7B,aAAa,CAACL,OAAO,EAAEoB,eAAQ,CAACkB,eAAe,CAAC,EAAE;IAC3DnB,EAAE,GAAGX,GAAG,CAACO,IAAI,CAACC,WAAW,CAACuB,mBAAmB,CAAC,CAAC;EACjD,CAAC,MAAM,IAAIlC,aAAa,CAACL,OAAO,EAAEoB,eAAQ,CAACoB,4BAA4B,CAAC,EAAE;IACxErB,EAAE,GAAGX,GAAG,CAACO,IAAI,CAACC,WAAW,CAACyB,qBAAqB,CAAC,CAAC;EACnD,CAAC,MAAM,IAAIpC,aAAa,CAACL,OAAO,EAAEoB,eAAQ,CAACsB,4BAA4B,CAAC,EAAE;IACxEvB,EAAE,GAAGX,GAAG,CAACO,IAAI,CAACC,WAAW,CAAC2B,qBAAqB,CAAC,CAAC;EACnD;EACA,IAAI,CAACxB,EAAE,EAAE;IACP,MAAM,IAAIiB,KAAK,CAAC,8BAA8BpC,OAAO,CAACM,eAAe,EAAE,CAAC;EAC1E;EACAE,GAAG,CAACC,YAAY,CAACK,IAAI,CAACK,EAAE,CAAC;AAC3B,CAAC;AAACf,OAAA,CAAAc,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -53,7 +53,7 @@ const drawBox = (ctx, props, children) => {
53
53
  dy = 0
54
54
  } = shadow;
55
55
  const lPaint = Skia.Paint();
56
- lPaint.setColor(Skia.Color(color));
56
+ lPaint.setColor((0, _nodes.processColor)(Skia, color));
57
57
  lPaint.setAlphaf(paint.getAlphaf() * opacity);
58
58
  lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(_types.BlurStyle.Normal, blur, true));
59
59
  canvas.drawRRect((0, _nodes.inflate)(Skia, box, spread, spread, dx, dy), lPaint);
@@ -71,7 +71,7 @@ const drawBox = (ctx, props, children) => {
71
71
  canvas.save();
72
72
  canvas.clipRRect(box, _types.ClipOp.Intersect, false);
73
73
  const lPaint = Skia.Paint();
74
- lPaint.setColor(Skia.Color(color));
74
+ lPaint.setColor((0, _nodes.processColor)(Skia, color));
75
75
  lPaint.setAlphaf(paint.getAlphaf() * opacity);
76
76
  lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(_types.BlurStyle.Normal, blur, true));
77
77
  const inner = (0, _nodes.deflate)(Skia, box, spread, spread, dx, dy);
@@ -131,7 +131,7 @@ const drawVertices = (ctx, props) => {
131
131
  blendMode
132
132
  } = props;
133
133
  const vertexMode = mode ? _types.VertexMode[(0, _nodes.enumKey)(mode)] : _types.VertexMode.Triangles;
134
- const vertices = ctx.Skia.MakeVertices(vertexMode, props.vertices, textures, colors ? colors.map(c => ctx.Skia.Color(c)) : undefined, indices);
134
+ const vertices = ctx.Skia.MakeVertices(vertexMode, props.vertices, textures, colors ? colors.map(c => (0, _nodes.processColor)(ctx.Skia, c)) : undefined, indices);
135
135
  const defaultBlendMode = colors ? _types.BlendMode.DstOver : _types.BlendMode.SrcOver;
136
136
  const blend = blendMode ? _types.BlendMode[(0, _nodes.enumKey)(blendMode)] : defaultBlendMode;
137
137
  ctx.canvas.drawVertices(vertices, blend, ctx.paint);
@@ -223,7 +223,7 @@ const drawPatch = (ctx, props) => {
223
223
  // C c1 c2 tl (the redundant point in the last command is removed)
224
224
 
225
225
  const points = [patch[0].pos, patch[0].c2, patch[1].c1, patch[1].pos, patch[1].c2, patch[2].c1, patch[2].pos, patch[2].c2, patch[3].c1, patch[3].pos, patch[3].c2, patch[0].c1];
226
- const colors = props.colors ? props.colors.map(c => ctx.Skia.Color(c)) : undefined;
226
+ const colors = props.colors ? props.colors.map(c => (0, _nodes.processColor)(ctx.Skia, c)) : undefined;
227
227
  ctx.canvas.drawPatch(points, colors, texture, mode, ctx.paint);
228
228
  };
229
229
  exports.drawPatch = drawPatch;