@shopify/react-native-skia 1.11.10 → 1.11.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +10 -0
- package/lib/commonjs/sksg/HostConfig.js +3 -1
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.js +10 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/module/sksg/HostConfig.js +3 -1
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/module/specs/NativeSkiaModule.web.js +10 -1
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +2 -0
- package/package.json +5 -4
- package/src/sksg/HostConfig.ts +1 -1
- package/src/specs/NativeSkiaModule.web.ts +12 -2
package/android/build.gradle
CHANGED
@@ -132,6 +132,16 @@ android {
|
|
132
132
|
|
133
133
|
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
134
134
|
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
|
135
|
+
|
136
|
+
// Used to override the NDK path/version on internal CI or by allowing
|
137
|
+
// users to customize the NDK path/version from their root project.
|
138
|
+
if (rootProject.hasProperty("ndkPath")) {
|
139
|
+
ndkPath rootProject.ext.ndkPath
|
140
|
+
}
|
141
|
+
if (rootProject.hasProperty("ndkVersion")) {
|
142
|
+
ndkVersion rootProject.ext.ndkVersion
|
143
|
+
}
|
144
|
+
|
135
145
|
defaultConfig {
|
136
146
|
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
|
137
147
|
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_constants","require","_typeddash","DEBUG","debug","args","console","log","exports","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","_container","children","props","instance","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","resetAfterCommit","container","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","shallowEq","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","_node","getInstanceFromNode","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.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 { Node } from \"./Node\";\nimport type { Container } from \"./Container\";\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;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\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\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: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\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 // 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: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(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(_container: Container) {\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 commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (_container) => {\n debug(\"clearContainer\");\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: newProps,\n children: keepChildren ? [...instance.children] : [],\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: (_node: Instance) => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance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CAAC,yBAAyB,CAAC;IAChC,MAAM,IAAI0B,KAAK,CAAC,sBAAsB,CAAC;EACzC,CAAC;EACD;EACA8C,uBAAuB,EAAEA,CAAA,KAAMC,+BAAoB;EACnDC,wBAAwB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClCC,uBAAuB,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjCC,qBAAqB,EAAGC,KAAe,IAAK,CAAC,CAAC;EAC9CC,mBAAmB,EAAE,SAAAA,CAAUD,KAAK,EAA4B;IAC9D,MAAM,IAAInD,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDqD,kBAAkB,EAAE,SAAAA,CAAUC,cAAc,EAAE5B,SAAS,EAAQ;IAC7D,MAAM,IAAI1B,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDuD,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,MAAM,IAAItD,KAAK,CAAC,2BAA2B,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_constants","require","_typeddash","DEBUG","debug","args","console","log","exports","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","_container","children","props","instance","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","resetAfterCommit","container","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","shallowEq","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","_node","getInstanceFromNode","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.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 { Node } from \"./Node\";\nimport type { Container } from \"./Container\";\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;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\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\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: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\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 // 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: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(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(_container: Container) {\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 commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (_container) => {\n debug(\"clearContainer\");\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: { ...newProps },\n children: keepChildren ? [...instance.children] : [],\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: (_node: Instance) => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\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+BK,MAAMK,cAA8B,GAAAD,OAAA,CAAAC,cAAA,GAAG;EAC5C;AACF;AACA;EACEC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,KAAK;EACxBC,mBAAmB,EAAE,IAAI;EACzBC,iBAAiB,EAAE,KAAK;EACxB;EACAC,eAAe,EAAEC,UAAU;EAC3BC,aAAa,EAAEC,YAAY;EAC3BC,SAAS,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AK,CAAC,2BAA2B,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
|
@@ -1,7 +1,9 @@
|
|
1
|
+
import type { SkPicture } from "../skia/types";
|
1
2
|
import type { ISkiaViewApi } from "../views/types";
|
2
3
|
import type { SkiaPictureView } from "../views/SkiaPictureView.web";
|
3
4
|
export type ISkiaViewApiWeb = ISkiaViewApi & {
|
4
5
|
views: Record<string, SkiaPictureView>;
|
6
|
+
deferedPictures: Record<string, SkPicture>;
|
5
7
|
registerView(nativeId: string, view: SkiaPictureView): void;
|
6
8
|
};
|
7
9
|
declare const _default: {};
|
@@ -8,14 +8,23 @@ exports.default = void 0;
|
|
8
8
|
|
9
9
|
global.SkiaViewApi = {
|
10
10
|
views: {},
|
11
|
+
deferedPictures: {},
|
11
12
|
web: true,
|
12
13
|
registerView(nativeId, view) {
|
14
|
+
// Maybe a picture for this view was already set
|
15
|
+
if (this.deferedPictures[nativeId]) {
|
16
|
+
view.setPicture(this.deferedPictures[nativeId]);
|
17
|
+
}
|
13
18
|
this.views[nativeId] = view;
|
14
19
|
},
|
15
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
16
21
|
setJsiProperty(nativeId, name, value) {
|
17
22
|
if (name === "picture") {
|
18
|
-
this.views[`${nativeId}`]
|
23
|
+
if (!this.views[`${nativeId}`]) {
|
24
|
+
this.deferedPictures[`${nativeId}`] = value;
|
25
|
+
} else {
|
26
|
+
this.views[`${nativeId}`].setPicture(value);
|
27
|
+
}
|
19
28
|
}
|
20
29
|
},
|
21
30
|
requestRedraw(nativeId) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["global","SkiaViewApi","views","web","registerView","nativeId","view","setJsiProperty","name","value","
|
1
|
+
{"version":3,"names":["global","SkiaViewApi","views","deferedPictures","web","registerView","nativeId","view","setPicture","setJsiProperty","name","value","requestRedraw","redraw","makeImageSnapshot","rect","makeImageSnapshotAsync","Promise","resolve","reject","result","Error","_default","exports","default"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["/* eslint-disable import/no-anonymous-default-export */\nimport type { SkPicture, SkRect } from \"../skia/types\";\nimport type { ISkiaViewApi } from \"../views/types\";\nimport type { SkiaPictureView } from \"../views/SkiaPictureView.web\";\n\nexport type ISkiaViewApiWeb = ISkiaViewApi & {\n views: Record<string, SkiaPictureView>;\n deferedPictures: Record<string, SkPicture>;\n registerView(nativeId: string, view: SkiaPictureView): void;\n};\n\nglobal.SkiaViewApi = {\n views: {},\n deferedPictures: {},\n web: true,\n registerView(nativeId: string, view: SkiaPictureView) {\n // Maybe a picture for this view was already set\n if (this.deferedPictures[nativeId]) {\n view.setPicture(this.deferedPictures[nativeId] as SkPicture);\n }\n this.views[nativeId] = view;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setJsiProperty(nativeId: number, name: string, value: any) {\n if (name === \"picture\") {\n if (!this.views[`${nativeId}`]) {\n this.deferedPictures[`${nativeId}`] = value;\n } else {\n this.views[`${nativeId}`].setPicture(value);\n }\n }\n },\n requestRedraw(nativeId: number) {\n this.views[`${nativeId}`].redraw();\n },\n makeImageSnapshot(nativeId: number, rect?: SkRect) {\n return this.views[`${nativeId}`].makeImageSnapshot(rect);\n },\n makeImageSnapshotAsync(nativeId: number, rect?: SkRect) {\n return new Promise((resolve, reject) => {\n const result = this.views[`${nativeId}`].makeImageSnapshot(rect);\n if (result) {\n resolve(result);\n } else {\n reject(new Error(\"Failed to make image snapshot\"));\n }\n });\n },\n} as ISkiaViewApiWeb;\n\n// eslint-disable-next-line import/no-default-export\nexport default {};\n"],"mappings":";;;;;;AAAA;;AAWAA,MAAM,CAACC,WAAW,GAAG;EACnBC,KAAK,EAAE,CAAC,CAAC;EACTC,eAAe,EAAE,CAAC,CAAC;EACnBC,GAAG,EAAE,IAAI;EACTC,YAAYA,CAACC,QAAgB,EAAEC,IAAqB,EAAE;IACpD;IACA,IAAI,IAAI,CAACJ,eAAe,CAACG,QAAQ,CAAC,EAAE;MAClCC,IAAI,CAACC,U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A,GACe,CAAC,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["DefaultEventPriority","shallowEq","DEBUG","debug","args","console","log","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","_container","children","props","instance","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","resetAfterCommit","container","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","_node","getInstanceFromNode","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.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 { Node } from \"./Node\";\nimport type { Container } from \"./Container\";\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;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\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\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: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\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 // 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: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(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(_container: Container) {\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 commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (_container) => {\n debug(\"clearContainer\");\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: newProps,\n children: keepChildren ? [...instance.children] : [],\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: (_node: Instance) => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\n },\n};\n"],"mappings":"AAAA;;AAEA,SAASA,oBAAoB,QAAQ,4BAA4B;AAGjE,SAASC,SAAS,QAAQ,uBAAuB;AAKjD,MAAMC,KAAK,GAAG,KAAK;AACnB,OAAO,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AA+BD,OAAO,MAAMG,cAA8B,GAAG;EAC5C;AACF;AACA;EACEC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,KAAK;EACxBC,mBAAmB,EAAE,IAAI;EACzBC,iBAAiB,EAAE,KAAK;EACxB;EACAC,eAAe,EAAEC,UAAU;EAC3BC,aAAa,EAAEC,YAAY;EAC3BC,SAAS,EAAE,CAAC,CAAC;EAEbC,kBAAkB,EAAGC,sBAAiC,IAAK;IACzDf,KAAK,CAAC,oBAAoB,CAAC;IAC3B,OAAO,IAAI;EACb,CAAC;EAEDgB,mBAAmBA,CAACC,kBAAkB,EAAEC,KAAK,EAAEH,sBAAsB,EAAE;IACrEf,KAAK,CAAC,qBAAqB,CAAC;IAC5B,OAAO,IAAI;EACb,CAAC;EAEDmB,oBAAoBA,CAACD,KAAK,EAAEE,MAAM,EAAE;IAClC,OAAO,KAAK;EACd,CAAC;EAEDC,kBAAkBA,CAChBC,KAAK,EACLP,sBAAsB,EACtBQ,YAAY,EACZC,uBAAuB,EACvB;IACAxB,KAAK,CAAC,oBAAoB,CAAC;IAC3B;IACA,MAAM,IAAIyB,KAAK,CAAC,kCAAkC,CAAC;EACrD,CAAC;EAEDC,cAAcA,CACZC,IAAI,EACJC,iBAAiB,EACjBC,UAAU,EACVN,YAAY,EACZC,uBAAuB,EACvB;IACA;IACA,MAAM;MAAEM,QAAQ;MAAE,GAAGC;IAAM,CAAC,GAAG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M,IAAIyB,KAAK,CAAC,sBAAsB,CAAC;EACzC,CAAC;EACD;EACA6C,uBAAuB,EAAEA,CAAA,KAAMzE,oBAAoB;EACnD0E,wBAAwB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClCC,uBAAuB,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjCC,qBAAqB,EAAGC,KAAe,IAAK,CAAC,CAAC;EAC9CC,mBAAmB,EAAE,SAAAA,CAAUD,KAAK,EAA4B;IAC9D,MAAM,IAAIjD,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDmD,kBAAkB,EAAE,SAAAA,CAAUC,cAAc,EAAE1B,SAAS,EAAQ;IAC7D,MAAM,IAAI1B,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDqD,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,MAAM,IAAIpD,KAAK,CAAC,2BAA2B,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["DefaultEventPriority","shallowEq","DEBUG","debug","args","console","log","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","_container","children","props","instance","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","resetAfterCommit","container","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","_node","getInstanceFromNode","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.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 { Node } from \"./Node\";\nimport type { Container } from \"./Container\";\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;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\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\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: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\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 // 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: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(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(_container: Container) {\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 commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (_container) => {\n debug(\"clearContainer\");\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: { ...newProps },\n children: keepChildren ? [...instance.children] : [],\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: (_node: Instance) => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\n },\n};\n"],"mappings":"AAAA;;AAEA,SAASA,oBAAoB,QAAQ,4BAA4B;AAGjE,SAASC,SAAS,QAAQ,uBAAuB;AAKjD,MAAMC,KAAK,GAAG,KAAK;AACnB,OAAO,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AA+BD,OAAO,MAAMG,cAA8B,GAAG;EAC5C;AACF;AACA;EACEC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,KAAK;EACxBC,mBAAmB,EAAE,IAAI;EACzBC,iBAAiB,EAAE,KAAK;EACxB;EACAC,eAAe,EAAEC,UAAU;EAC3BC,aAAa,EAAEC,YAAY;EAC3BC,SAAS,EAAE,CAAC,CAAC;EAEbC,kBAAkB,EAAGC,sBAAiC,IAAK;IACzDf,KAAK,CAAC,oBAAoB,CAAC;IAC3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skia/types";
|
1
2
|
import type { ISkiaViewApi } from "../views/types";
|
2
3
|
import type { SkiaPictureView } from "../views/SkiaPictureView.web";
|
3
4
|
export type ISkiaViewApiWeb = ISkiaViewApi & {
|
4
5
|
views: Record<string, SkiaPictureView>;
|
6
|
+
deferedPictures: Record<string, SkPicture>;
|
5
7
|
registerView(nativeId: string, view: SkiaPictureView): void;
|
6
8
|
};
|
7
9
|
declare const _default: {};
|
@@ -2,14 +2,23 @@
|
|
2
2
|
|
3
3
|
global.SkiaViewApi = {
|
4
4
|
views: {},
|
5
|
+
deferedPictures: {},
|
5
6
|
web: true,
|
6
7
|
registerView(nativeId, view) {
|
8
|
+
// Maybe a picture for this view was already set
|
9
|
+
if (this.deferedPictures[nativeId]) {
|
10
|
+
view.setPicture(this.deferedPictures[nativeId]);
|
11
|
+
}
|
7
12
|
this.views[nativeId] = view;
|
8
13
|
},
|
9
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
10
15
|
setJsiProperty(nativeId, name, value) {
|
11
16
|
if (name === "picture") {
|
12
|
-
this.views[`${nativeId}`]
|
17
|
+
if (!this.views[`${nativeId}`]) {
|
18
|
+
this.deferedPictures[`${nativeId}`] = value;
|
19
|
+
} else {
|
20
|
+
this.views[`${nativeId}`].setPicture(value);
|
21
|
+
}
|
13
22
|
}
|
14
23
|
},
|
15
24
|
requestRedraw(nativeId) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["global","SkiaViewApi","views","web","registerView","nativeId","view","setJsiProperty","name","value","
|
1
|
+
{"version":3,"names":["global","SkiaViewApi","views","deferedPictures","web","registerView","nativeId","view","setPicture","setJsiProperty","name","value","requestRedraw","redraw","makeImageSnapshot","rect","makeImageSnapshotAsync","Promise","resolve","reject","result","Error"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["/* eslint-disable import/no-anonymous-default-export */\nimport type { SkPicture, SkRect } from \"../skia/types\";\nimport type { ISkiaViewApi } from \"../views/types\";\nimport type { SkiaPictureView } from \"../views/SkiaPictureView.web\";\n\nexport type ISkiaViewApiWeb = ISkiaViewApi & {\n views: Record<string, SkiaPictureView>;\n deferedPictures: Record<string, SkPicture>;\n registerView(nativeId: string, view: SkiaPictureView): void;\n};\n\nglobal.SkiaViewApi = {\n views: {},\n deferedPictures: {},\n web: true,\n registerView(nativeId: string, view: SkiaPictureView) {\n // Maybe a picture for this view was already set\n if (this.deferedPictures[nativeId]) {\n view.setPicture(this.deferedPictures[nativeId] as SkPicture);\n }\n this.views[nativeId] = view;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setJsiProperty(nativeId: number, name: string, value: any) {\n if (name === \"picture\") {\n if (!this.views[`${nativeId}`]) {\n this.deferedPictures[`${nativeId}`] = value;\n } else {\n this.views[`${nativeId}`].setPicture(value);\n }\n }\n },\n requestRedraw(nativeId: number) {\n this.views[`${nativeId}`].redraw();\n },\n makeImageSnapshot(nativeId: number, rect?: SkRect) {\n return this.views[`${nativeId}`].makeImageSnapshot(rect);\n },\n makeImageSnapshotAsync(nativeId: number, rect?: SkRect) {\n return new Promise((resolve, reject) => {\n const result = this.views[`${nativeId}`].makeImageSnapshot(rect);\n if (result) {\n resolve(result);\n } else {\n reject(new Error(\"Failed to make image snapshot\"));\n }\n });\n },\n} as ISkiaViewApiWeb;\n\n// eslint-disable-next-line import/no-default-export\nexport default {};\n"],"mappings":"AAAA;;AAWAA,MAAM,CAACC,WAAW,GAAG;EACnBC,KAAK,EAAE,CAAC,CAAC;EACTC,eAAe,EAAE,CAAC,CAAC;EACnBC,GAAG,EAAE,IAAI;EACTC,YAAYA,CAACC,QAAgB,EAAEC,IAAqB,EAAE;IACpD;IACA,IAAI,IAAI,CAACJ,eAAe,CAACG,QAAQ,CAAC,EAAE;MAClCC,IAAI,CAACC,UAAU,CAAC,IAAI,CAACL,eAAe,CAACG,QAAQ,CAAc,CAAC;IAC9D;IACA,IAAI,CAACJ,KAAK,CAACI,QAAQ,CAAC,GAAGC,IAAI;EAC7B,CAAC;EACD;EACAE,cAAcA,CAACH,QAAgB,EAAEI,IAAY,EAAEC,KAAU,EAAE;IACzD,IAAID,IAAI,KAAK,SAAS,EAAE;MACtB,IAAI,CAAC,IAAI,CAACR,KAAK,CAAC,GAAGI,QAAQ,EAAE,CAAC,EAAE;QAC9B,IAAI,CAACH,eAAe,CAAC,GAAGG,QAAQ,EAAE,CAAC,GAAGK,KAAK;MAC7C,CAAC,MAAM;QACL,IAAI,CAACT,KAAK,CAAC,GAAGI,QAAQ,EAAE,CAAC,CAACE,UAAU,CAACG,KAAK,CAAC;MAC7C;IACF;EACF,CAAC;EACDC,aAAaA,CAACN,QAAgB,EAAE;IAC9B,IAAI,CAACJ,KAAK,CAAC,GAAGI,QAAQ,EAAE,CAAC,CAACO,MAAM,CAAC,CAAC;EACpC,CAAC;EACDC,iBAAiBA,CAACR,QAAgB,EAAES,IAAa,EAAE;IACjD,OAAO,IAAI,CAACb,KAAK,CAAC,GAAGI,QAAQ,EAAE,CAAC,CAACQ,iBAAiB,CAACC,IAAI,CAAC;EAC1D,CAAC;EACDC,sBAAsBA,CAACV,QAAgB,EAAES,IAAa,EAAE;IACtD,OAAO,IAAIE,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,MAAMC,MAAM,GAAG,IAAI,CAAClB,KAAK,CAAC,GAAGI,QAAQ,EAAE,CAAC,CAACQ,iBAAiB,CAACC,IAAI,CAAC;MAChE,IAAIK,MAAM,EAAE;QACVF,OAAO,CAACE,MAAM,CAAC;MACjB,CAAC,MAAM;QACLD,MAAM,CAAC,IAAIE,KAAK,CAAC,+BAA+B,CAAC,CAAC;MACpD;IACF,CAAC,CAAC;EACJ;AACF,CAAoB;;AAEpB;AACA,eAAe,CAAC,CAAC","ignoreList":[]}
|
@@ -1,7 +1,9 @@
|
|
1
|
+
import type { SkPicture } from "../skia/types";
|
1
2
|
import type { ISkiaViewApi } from "../views/types";
|
2
3
|
import type { SkiaPictureView } from "../views/SkiaPictureView.web";
|
3
4
|
export type ISkiaViewApiWeb = ISkiaViewApi & {
|
4
5
|
views: Record<string, SkiaPictureView>;
|
6
|
+
deferedPictures: Record<string, SkPicture>;
|
5
7
|
registerView(nativeId: string, view: SkiaPictureView): void;
|
6
8
|
};
|
7
9
|
declare const _default: {};
|
package/package.json
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
"provenance": true
|
6
6
|
},
|
7
7
|
"bin": {
|
8
|
-
"setup-skia-web": "
|
8
|
+
"setup-skia-web": "scripts/setup-canvaskit.js"
|
9
9
|
},
|
10
10
|
"title": "React Native Skia",
|
11
|
-
"version": "1.11.
|
11
|
+
"version": "1.11.18",
|
12
12
|
"description": "High-performance React Native Graphics using Skia",
|
13
13
|
"main": "lib/module/index.js",
|
14
14
|
"react-native": "src/index.ts",
|
@@ -76,8 +76,8 @@
|
|
76
76
|
"licenseFilename": "LICENSE.md",
|
77
77
|
"readmeFilename": "README.md",
|
78
78
|
"peerDependencies": {
|
79
|
-
"react": ">=18.0",
|
80
|
-
"react-native": ">=0.64",
|
79
|
+
"react": ">=18.0 <19.0.0",
|
80
|
+
"react-native": ">=0.64 <0.78.0",
|
81
81
|
"react-native-reanimated": ">=2.0.0"
|
82
82
|
},
|
83
83
|
"peerDependenciesMeta": {
|
@@ -91,6 +91,7 @@
|
|
91
91
|
"devDependencies": {
|
92
92
|
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
|
93
93
|
"@semantic-release/commit-analyzer": "^13.0.0",
|
94
|
+
"@semantic-release/exec": "^7.0.3",
|
94
95
|
"@semantic-release/github": "^10.3.3",
|
95
96
|
"@semantic-release/release-notes-generator": "^14.0.1",
|
96
97
|
"@types/jest": "29.5.6",
|
package/src/sksg/HostConfig.ts
CHANGED
@@ -1,23 +1,33 @@
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
2
|
-
import type { SkRect } from "../skia/types";
|
2
|
+
import type { SkPicture, SkRect } from "../skia/types";
|
3
3
|
import type { ISkiaViewApi } from "../views/types";
|
4
4
|
import type { SkiaPictureView } from "../views/SkiaPictureView.web";
|
5
5
|
|
6
6
|
export type ISkiaViewApiWeb = ISkiaViewApi & {
|
7
7
|
views: Record<string, SkiaPictureView>;
|
8
|
+
deferedPictures: Record<string, SkPicture>;
|
8
9
|
registerView(nativeId: string, view: SkiaPictureView): void;
|
9
10
|
};
|
10
11
|
|
11
12
|
global.SkiaViewApi = {
|
12
13
|
views: {},
|
14
|
+
deferedPictures: {},
|
13
15
|
web: true,
|
14
16
|
registerView(nativeId: string, view: SkiaPictureView) {
|
17
|
+
// Maybe a picture for this view was already set
|
18
|
+
if (this.deferedPictures[nativeId]) {
|
19
|
+
view.setPicture(this.deferedPictures[nativeId] as SkPicture);
|
20
|
+
}
|
15
21
|
this.views[nativeId] = view;
|
16
22
|
},
|
17
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
18
24
|
setJsiProperty(nativeId: number, name: string, value: any) {
|
19
25
|
if (name === "picture") {
|
20
|
-
this.views[`${nativeId}`]
|
26
|
+
if (!this.views[`${nativeId}`]) {
|
27
|
+
this.deferedPictures[`${nativeId}`] = value;
|
28
|
+
} else {
|
29
|
+
this.views[`${nativeId}`].setPicture(value);
|
30
|
+
}
|
21
31
|
}
|
22
32
|
},
|
23
33
|
requestRedraw(nativeId: number) {
|