@shopify/react-native-skia 2.2.6 → 2.2.7
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/lib/commonjs/sksg/Container.d.ts +3 -31
- package/lib/commonjs/sksg/Container.js +5 -120
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/Container.native.d.ts +14 -0
- package/lib/commonjs/sksg/Container.native.js +81 -0
- package/lib/commonjs/sksg/Container.native.js.map +1 -0
- package/lib/commonjs/sksg/HostConfig.d.ts +1 -1
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/commonjs/sksg/StaticContainer.d.ts +24 -0
- package/lib/commonjs/sksg/StaticContainer.js +70 -0
- package/lib/commonjs/sksg/StaticContainer.js.map +1 -0
- package/lib/module/sksg/Container.d.ts +3 -31
- package/lib/module/sksg/Container.js +2 -116
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/Container.native.d.ts +14 -0
- package/lib/module/sksg/Container.native.js +73 -0
- package/lib/module/sksg/Container.native.js.map +1 -0
- package/lib/module/sksg/HostConfig.d.ts +1 -1
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/module/sksg/StaticContainer.d.ts +24 -0
- package/lib/module/sksg/StaticContainer.js +62 -0
- package/lib/module/sksg/StaticContainer.js.map +1 -0
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +3 -31
- package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +11 -0
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +1 -29
- package/lib/typescript/lib/commonjs/sksg/StaticContainer.d.ts +23 -0
- package/lib/typescript/lib/module/sksg/Container.d.ts +3 -30
- package/lib/typescript/lib/module/sksg/Container.native.d.ts +11 -0
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +1 -29
- package/lib/typescript/lib/module/sksg/StaticContainer.d.ts +22 -0
- package/lib/typescript/src/sksg/Container.d.ts +3 -31
- package/lib/typescript/src/sksg/Container.native.d.ts +14 -0
- package/lib/typescript/src/sksg/HostConfig.d.ts +1 -1
- package/lib/typescript/src/sksg/StaticContainer.d.ts +24 -0
- package/package.json +1 -1
- package/src/sksg/Container.native.ts +86 -0
- package/src/sksg/Container.ts +3 -144
- package/src/sksg/HostConfig.ts +1 -1
- package/src/sksg/Reconciler.ts +1 -1
- package/src/sksg/StaticContainer.ts +83 -0
@@ -1,27 +1,6 @@
|
|
1
1
|
import type { SharedValue } from "react-native-reanimated";
|
2
|
-
import type { Skia,
|
3
|
-
import
|
4
|
-
import type { Recording } from "./Recorder/Recorder";
|
5
|
-
import "../views/api";
|
6
|
-
export declare abstract class Container {
|
7
|
-
protected Skia: Skia;
|
8
|
-
private _root;
|
9
|
-
protected recording: Recording | null;
|
10
|
-
protected unmounted: boolean;
|
11
|
-
constructor(Skia: Skia);
|
12
|
-
get root(): Node[];
|
13
|
-
set root(value: Node[]);
|
14
|
-
mount(): void;
|
15
|
-
unmount(): void;
|
16
|
-
drawOnCanvas(canvas: SkCanvas): void;
|
17
|
-
abstract redraw(): void;
|
18
|
-
}
|
19
|
-
declare class StaticContainer extends Container {
|
20
|
-
private nativeId;
|
21
|
-
private onSize?;
|
22
|
-
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
23
|
-
redraw(): void;
|
24
|
-
}
|
2
|
+
import type { Skia, SkSize } from "../skia/types";
|
3
|
+
import { Container, StaticContainer } from "./StaticContainer";
|
25
4
|
declare class ReanimatedContainer extends Container {
|
26
5
|
private nativeId;
|
27
6
|
private onSize?;
|
@@ -29,12 +8,5 @@ declare class ReanimatedContainer extends Container {
|
|
29
8
|
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
30
9
|
redraw(): void;
|
31
10
|
}
|
32
|
-
declare
|
33
|
-
private nativeId;
|
34
|
-
private onSize?;
|
35
|
-
private mapperId;
|
36
|
-
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
37
|
-
redraw(): void;
|
38
|
-
}
|
39
|
-
export declare const createContainer: (Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize>) => StaticContainer | ReanimatedContainer | NativeReanimatedContainer;
|
11
|
+
export declare const createContainer: (Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize>) => StaticContainer | ReanimatedContainer;
|
40
12
|
export {};
|
@@ -3,15 +3,14 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.createContainer =
|
6
|
+
exports.createContainer = void 0;
|
7
7
|
var _ReanimatedProxy = _interopRequireDefault(require("../external/reanimated/ReanimatedProxy"));
|
8
8
|
var _renderHelpers = require("../external/reanimated/renderHelpers");
|
9
9
|
var _Recorder = require("./Recorder/Recorder");
|
10
10
|
var _Visitor = require("./Recorder/Visitor");
|
11
11
|
var _Player = require("./Recorder/Player");
|
12
12
|
var _DrawingContext = require("./Recorder/DrawingContext");
|
13
|
-
var
|
14
|
-
require("../views/api");
|
13
|
+
var _StaticContainer = require("./StaticContainer");
|
15
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
16
15
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
17
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
@@ -36,76 +35,7 @@ const drawOnscreen = (Skia, nativeId, recording, onSize) => {
|
|
36
35
|
//console.log("Recording time: ", end - start);
|
37
36
|
SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
|
38
37
|
};
|
39
|
-
|
40
|
-
"worklet";
|
41
|
-
|
42
|
-
//const start = performance.now();
|
43
|
-
if (onSize) {
|
44
|
-
const size = SkiaViewApi.size(nativeId);
|
45
|
-
if (size.width !== onSize.value.width || size.height !== onSize.value.height) {
|
46
|
-
onSize.value = size;
|
47
|
-
}
|
48
|
-
}
|
49
|
-
const picture = recorder.play();
|
50
|
-
//const end = performance.now();
|
51
|
-
//console.log("Recording time: ", end - start);
|
52
|
-
SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
|
53
|
-
};
|
54
|
-
class Container {
|
55
|
-
constructor(Skia) {
|
56
|
-
this.Skia = Skia;
|
57
|
-
_defineProperty(this, "_root", []);
|
58
|
-
_defineProperty(this, "recording", null);
|
59
|
-
_defineProperty(this, "unmounted", false);
|
60
|
-
}
|
61
|
-
get root() {
|
62
|
-
return this._root;
|
63
|
-
}
|
64
|
-
set root(value) {
|
65
|
-
this._root = value;
|
66
|
-
}
|
67
|
-
mount() {
|
68
|
-
this.unmounted = false;
|
69
|
-
}
|
70
|
-
unmount() {
|
71
|
-
this.unmounted = true;
|
72
|
-
}
|
73
|
-
drawOnCanvas(canvas) {
|
74
|
-
if (!this.recording) {
|
75
|
-
throw new Error("No recording to draw");
|
76
|
-
}
|
77
|
-
const ctx = (0, _DrawingContext.createDrawingContext)(this.Skia, this.recording.paintPool, canvas);
|
78
|
-
(0, _Player.replay)(ctx, this.recording.commands);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
exports.Container = Container;
|
82
|
-
class StaticContainer extends Container {
|
83
|
-
constructor(Skia, nativeId, onSize) {
|
84
|
-
super(Skia);
|
85
|
-
this.nativeId = nativeId;
|
86
|
-
this.onSize = onSize;
|
87
|
-
}
|
88
|
-
redraw() {
|
89
|
-
const recorder = new _Recorder.Recorder();
|
90
|
-
(0, _Visitor.visit)(recorder, this.root);
|
91
|
-
this.recording = recorder.getRecording();
|
92
|
-
const isOnScreen = this.nativeId !== -1;
|
93
|
-
if (isOnScreen) {
|
94
|
-
if (this.onSize) {
|
95
|
-
const size = SkiaViewApi.size(this.nativeId);
|
96
|
-
if (size.width !== this.onSize.value.width || size.height !== this.onSize.value.height) {
|
97
|
-
this.onSize.value = size;
|
98
|
-
}
|
99
|
-
}
|
100
|
-
const rec = this.Skia.PictureRecorder();
|
101
|
-
const canvas = rec.beginRecording();
|
102
|
-
this.drawOnCanvas(canvas);
|
103
|
-
const picture = rec.finishRecordingAsPicture();
|
104
|
-
SkiaViewApi.setJsiProperty(this.nativeId, "picture", picture);
|
105
|
-
}
|
106
|
-
}
|
107
|
-
}
|
108
|
-
class ReanimatedContainer extends Container {
|
38
|
+
class ReanimatedContainer extends _StaticContainer.Container {
|
109
39
|
constructor(Skia, nativeId, onSize) {
|
110
40
|
super(Skia);
|
111
41
|
this.nativeId = nativeId;
|
@@ -148,56 +78,11 @@ class ReanimatedContainer extends Container {
|
|
148
78
|
})(this.onSize);
|
149
79
|
}
|
150
80
|
}
|
151
|
-
class NativeReanimatedContainer extends Container {
|
152
|
-
constructor(Skia, nativeId, onSize) {
|
153
|
-
super(Skia);
|
154
|
-
this.nativeId = nativeId;
|
155
|
-
this.onSize = onSize;
|
156
|
-
_defineProperty(this, "mapperId", null);
|
157
|
-
}
|
158
|
-
redraw() {
|
159
|
-
if (this.mapperId !== null) {
|
160
|
-
_ReanimatedProxy.default.stopMapper(this.mapperId);
|
161
|
-
}
|
162
|
-
if (this.unmounted) {
|
163
|
-
return;
|
164
|
-
}
|
165
|
-
const {
|
166
|
-
nativeId,
|
167
|
-
Skia
|
168
|
-
} = this;
|
169
|
-
const recorder = new _ReanimatedRecorder.ReanimatedRecorder(Skia);
|
170
|
-
(0, _Visitor.visit)(recorder, this.root);
|
171
|
-
const sharedValues = recorder.getSharedValues();
|
172
|
-
const sharedRecorder = recorder.getRecorder();
|
173
|
-
_ReanimatedProxy.default.runOnUI(onSize => {
|
174
|
-
"worklet";
|
175
|
-
|
176
|
-
nativeDrawOnscreen(nativeId, sharedRecorder, onSize);
|
177
|
-
})(this.onSize);
|
178
|
-
if (sharedValues.length > 0) {
|
179
|
-
const {
|
180
|
-
onSize
|
181
|
-
} = this;
|
182
|
-
this.mapperId = _ReanimatedProxy.default.startMapper(() => {
|
183
|
-
"worklet";
|
184
|
-
|
185
|
-
sharedRecorder.applyUpdates(sharedValues);
|
186
|
-
nativeDrawOnscreen(nativeId, sharedRecorder, onSize);
|
187
|
-
}, sharedValues);
|
188
|
-
}
|
189
|
-
}
|
190
|
-
}
|
191
81
|
const createContainer = (Skia, nativeId, onSize) => {
|
192
|
-
const web = global.SkiaViewApi && global.SkiaViewApi.web;
|
193
82
|
if (_renderHelpers.HAS_REANIMATED_3 && nativeId !== -1) {
|
194
|
-
|
195
|
-
return new NativeReanimatedContainer(Skia, nativeId, onSize);
|
196
|
-
} else {
|
197
|
-
return new ReanimatedContainer(Skia, nativeId, onSize);
|
198
|
-
}
|
83
|
+
return new ReanimatedContainer(Skia, nativeId, onSize);
|
199
84
|
} else {
|
200
|
-
return new StaticContainer(Skia, nativeId);
|
85
|
+
return new _StaticContainer.StaticContainer(Skia, nativeId);
|
201
86
|
}
|
202
87
|
};
|
203
88
|
exports.createContainer = createContainer;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_Recorder","_Visitor","_Player","_DrawingContext","_ReanimatedRecorder","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","drawOnscreen","Skia","nativeId","recording","onSize","size","SkiaViewApi","width","height","rec","PictureRecorder","canvas","beginRecording","ctx","createDrawingContext","paintPool","replay","commands","picture","finishRecordingAsPicture","setJsiProperty","nativeDrawOnscreen","recorder","play","Container","constructor","root","_root","mount","unmounted","unmount","drawOnCanvas","Error","exports","StaticContainer","redraw","Recorder","visit","getRecording","isOnScreen","ReanimatedContainer","mapperId","Rea","stopMapper","record","animationValues","startMapper","Array","from","runOnUI","NativeReanimatedContainer","ReanimatedRecorder","sharedValues","getSharedValues","sharedRecorder","getRecorder","length","applyUpdates","createContainer","web","global","HAS_REANIMATED_3"],"sources":["Container.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas, SkSize } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\n\nimport \"../views/api\";\n\nconst drawOnscreen = (\n Skia: Skia,\n nativeId: number,\n recording: Recording,\n onSize?: SharedValue<SkSize>\n) => {\n \"worklet\";\n if (onSize) {\n const size = SkiaViewApi.size(nativeId);\n if (\n size.width !== onSize.value.width ||\n size.height !== onSize.value.height\n ) {\n onSize.value = size;\n }\n }\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nconst nativeDrawOnscreen = (\n nativeId: number,\n recorder: JsiRecorder,\n onSize?: SharedValue<SkSize>\n) => {\n \"worklet\";\n\n //const start = performance.now();\n if (onSize) {\n const size = SkiaViewApi.size(nativeId);\n if (\n size.width !== onSize.value.width ||\n size.height !== onSize.value.height\n ) {\n onSize.value = size;\n }\n }\n const picture = recorder.play();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nexport abstract class Container {\n private _root: Node[] = [];\n protected recording: Recording | null = null;\n protected unmounted = false;\n\n constructor(protected Skia: Skia) {}\n\n get root() {\n return this._root;\n }\n\n set root(value: Node[]) {\n this._root = value;\n }\n\n mount() {\n this.unmounted = false;\n }\n\n unmount() {\n this.unmounted = true;\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nclass StaticContainer extends Container {\n constructor(\n Skia: Skia,\n private nativeId: number,\n private onSize?: SharedValue<SkSize>\n ) {\n super(Skia);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n if (this.onSize) {\n const size = SkiaViewApi.size(this.nativeId);\n if (\n size.width !== this.onSize.value.width ||\n size.height !== this.onSize.value.height\n ) {\n this.onSize.value = size;\n }\n }\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(\n Skia: Skia,\n private nativeId: number,\n private onSize?: SharedValue<SkSize>\n ) {\n super(Skia);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n const { nativeId, Skia, recording } = this;\n if (animationValues.size > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n Rea.runOnUI((onSize?: SharedValue<SkSize>) => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!, onSize);\n })(this.onSize);\n }\n}\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(\n Skia: Skia,\n private nativeId: number,\n private onSize?: SharedValue<SkSize>\n ) {\n super(Skia);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const { nativeId, Skia } = this;\n const recorder = new ReanimatedRecorder(Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n Rea.runOnUI((onSize?: SharedValue<SkSize>) => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder, onSize);\n })(this.onSize);\n if (sharedValues.length > 0) {\n const { onSize } = this;\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder, onSize);\n }, sharedValues);\n }\n }\n}\n\nexport const createContainer = (\n Skia: Skia,\n nativeId: number,\n onSize?: SharedValue<SkSize>\n) => {\n const web = global.SkiaViewApi && global.SkiaViewApi.web;\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n if (!web) {\n return new NativeReanimatedContainer(Skia, nativeId, onSize);\n } else {\n return new ReanimatedContainer(Skia, nativeId, onSize);\n }\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAEAA,OAAA;AAAsB,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAA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CAAE7C,MAA4B,IAAK;MAC5C,SAAS;;MACTiB,kBAAkB,CAACnB,QAAQ,EAAEoD,cAAc,EAAElD,MAAM,CAAC;IACtD,CAAC,CAAC,CAAC,IAAI,CAACA,MAAM,CAAC;IACf,IAAIgD,YAAY,CAACI,MAAM,GAAG,CAAC,EAAE;MAC3B,MAAM;QAAEpD;MAAO,CAAC,GAAG,IAAI;MACvB,IAAI,CAACqC,QAAQ,GAAGC,wBAAG,CAACI,WAAW,CAAC,MAAM;QACpC,SAAS;;QACTQ,cAAc,CAACG,YAAY,CAACL,YAAY,CAAC;QACzC/B,kBAAkB,CAACnB,QAAQ,EAAEoD,cAAc,EAAElD,MAAM,CAAC;MACtD,CAAC,EAAEgD,YAAY,CAAC;IAClB;EACF;AACF;AAEO,MAAMM,eAAe,GAAGA,CAC7BzD,IAAU,EACVC,QAAgB,EAChBE,MAA4B,KACzB;EACH,MAAMuD,GAAG,GAAGC,MAAM,CAACtD,WAAW,IAAIsD,MAAM,CAACtD,WAAW,CAACqD,GAAG;EACxD,IAAIE,+BAAgB,IAAI3D,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,IAAI,CAACyD,GAAG,EAAE;MACR,OAAO,IAAIT,yBAAyB,CAACjD,IAAI,EAAEC,QAAQ,EAAEE,MAAM,CAAC;IAC9D,CAAC,MAAM;MACL,OAAO,IAAIoC,mBAAmB,CAACvC,IAAI,EAAEC,QAAQ,EAAEE,MAAM,CAAC;IACxD;EACF,CAAC,MAAM;IACL,OAAO,IAAI8B,eAAe,CAACjC,IAAI,EAAEC,QAAQ,CAAC;EAC5C;AACF,CAAC;AAAC+B,OAAA,CAAAyB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_Recorder","_Visitor","_Player","_DrawingContext","_StaticContainer","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","drawOnscreen","Skia","nativeId","recording","onSize","size","SkiaViewApi","width","height","rec","PictureRecorder","canvas","beginRecording","ctx","createDrawingContext","paintPool","replay","commands","picture","finishRecordingAsPicture","setJsiProperty","ReanimatedContainer","Container","constructor","redraw","mapperId","Rea","stopMapper","unmounted","recorder","Recorder","visit","root","record","getRecording","animationValues","startMapper","Array","from","runOnUI","createContainer","HAS_REANIMATED_3","StaticContainer","exports"],"sources":["Container.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkSize } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\n\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\n\nconst drawOnscreen = (\n Skia: Skia,\n nativeId: number,\n recording: Recording,\n onSize?: SharedValue<SkSize>\n) => {\n \"worklet\";\n if (onSize) {\n const size = SkiaViewApi.size(nativeId);\n if (\n size.width !== onSize.value.width ||\n size.height !== onSize.value.height\n ) {\n onSize.value = size;\n }\n }\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(\n Skia: Skia,\n private nativeId: number,\n private onSize?: SharedValue<SkSize>\n ) {\n super(Skia);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n const { nativeId, Skia, recording } = this;\n if (animationValues.size > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n Rea.runOnUI((onSize?: SharedValue<SkSize>) => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!, onSize);\n })(this.onSize);\n }\n}\n\nexport const createContainer = (\n Skia: Skia,\n nativeId: number,\n onSize?: SharedValue<SkSize>\n) => {\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n return new ReanimatedContainer(Skia, nativeId, onSize);\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AAA+D,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ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EO,MAAMoC,eAAe,GAAGA,CAC7BvC,IAAU,EACVC,QAAgB,EAChBE,MAA4B,KACzB;EACH,IAAIqC,+BAAgB,IAAIvC,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,OAAO,IAAImB,mBAAmB,CAACpB,IAAI,EAAEC,QAAQ,EAAEE,MAAM,CAAC;EACxD,CAAC,MAAM;IACL,OAAO,IAAIsC,gCAAe,CAACzC,IAAI,EAAEC,QAAQ,CAAC;EAC5C;AACF,CAAC;AAACyC,OAAA,CAAAH,eAAA,GAAAA,eAAA","ignoreList":[]}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
2
|
+
import type { Skia, SkSize } from "../skia/types";
|
3
|
+
import { Container, StaticContainer } from "./StaticContainer";
|
4
|
+
import "../skia/NativeSetup";
|
5
|
+
import "../views/api";
|
6
|
+
declare class NativeReanimatedContainer extends Container {
|
7
|
+
private nativeId;
|
8
|
+
private onSize?;
|
9
|
+
private mapperId;
|
10
|
+
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
11
|
+
redraw(): void;
|
12
|
+
}
|
13
|
+
export declare const createContainer: (Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize>) => StaticContainer | NativeReanimatedContainer;
|
14
|
+
export {};
|
@@ -0,0 +1,81 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createContainer = void 0;
|
7
|
+
var _ReanimatedProxy = _interopRequireDefault(require("../external/reanimated/ReanimatedProxy"));
|
8
|
+
var _renderHelpers = require("../external/reanimated/renderHelpers");
|
9
|
+
var _ReanimatedRecorder = require("./Recorder/ReanimatedRecorder");
|
10
|
+
var _StaticContainer = require("./StaticContainer");
|
11
|
+
var _Visitor = require("./Recorder/Visitor");
|
12
|
+
require("../skia/NativeSetup");
|
13
|
+
require("../views/api");
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
17
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
18
|
+
const nativeDrawOnscreen = (nativeId, recorder, onSize) => {
|
19
|
+
"worklet";
|
20
|
+
|
21
|
+
//const start = performance.now();
|
22
|
+
if (onSize) {
|
23
|
+
const size = SkiaViewApi.size(nativeId);
|
24
|
+
if (size.width !== onSize.value.width || size.height !== onSize.value.height) {
|
25
|
+
onSize.value = size;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
const picture = recorder.play();
|
29
|
+
//const end = performance.now();
|
30
|
+
//console.log("Recording time: ", end - start);
|
31
|
+
SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
|
32
|
+
};
|
33
|
+
class NativeReanimatedContainer extends _StaticContainer.Container {
|
34
|
+
constructor(Skia, nativeId, onSize) {
|
35
|
+
super(Skia);
|
36
|
+
this.nativeId = nativeId;
|
37
|
+
this.onSize = onSize;
|
38
|
+
_defineProperty(this, "mapperId", null);
|
39
|
+
}
|
40
|
+
redraw() {
|
41
|
+
if (this.mapperId !== null) {
|
42
|
+
_ReanimatedProxy.default.stopMapper(this.mapperId);
|
43
|
+
}
|
44
|
+
if (this.unmounted) {
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
const {
|
48
|
+
nativeId,
|
49
|
+
Skia
|
50
|
+
} = this;
|
51
|
+
const recorder = new _ReanimatedRecorder.ReanimatedRecorder(Skia);
|
52
|
+
(0, _Visitor.visit)(recorder, this.root);
|
53
|
+
const sharedValues = recorder.getSharedValues();
|
54
|
+
const sharedRecorder = recorder.getRecorder();
|
55
|
+
_ReanimatedProxy.default.runOnUI(onSize => {
|
56
|
+
"worklet";
|
57
|
+
|
58
|
+
nativeDrawOnscreen(nativeId, sharedRecorder, onSize);
|
59
|
+
})(this.onSize);
|
60
|
+
if (sharedValues.length > 0) {
|
61
|
+
const {
|
62
|
+
onSize
|
63
|
+
} = this;
|
64
|
+
this.mapperId = _ReanimatedProxy.default.startMapper(() => {
|
65
|
+
"worklet";
|
66
|
+
|
67
|
+
sharedRecorder.applyUpdates(sharedValues);
|
68
|
+
nativeDrawOnscreen(nativeId, sharedRecorder, onSize);
|
69
|
+
}, sharedValues);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
const createContainer = (Skia, nativeId, onSize) => {
|
74
|
+
if (_renderHelpers.HAS_REANIMATED_3 && nativeId !== -1) {
|
75
|
+
return new NativeReanimatedContainer(Skia, nativeId, onSize);
|
76
|
+
} else {
|
77
|
+
return new _StaticContainer.StaticContainer(Skia, nativeId);
|
78
|
+
}
|
79
|
+
};
|
80
|
+
exports.createContainer = createContainer;
|
81
|
+
//# sourceMappingURL=Container.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_ReanimatedRecorder","_StaticContainer","_Visitor","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","nativeDrawOnscreen","nativeId","recorder","onSize","size","SkiaViewApi","width","height","picture","play","setJsiProperty","NativeReanimatedContainer","Container","constructor","Skia","redraw","mapperId","Rea","stopMapper","unmounted","ReanimatedRecorder","visit","root","sharedValues","getSharedValues","sharedRecorder","getRecorder","runOnUI","length","startMapper","applyUpdates","createContainer","HAS_REANIMATED_3","StaticContainer","exports"],"sources":["Container.native.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkSize } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\nconst nativeDrawOnscreen = (\n nativeId: number,\n recorder: JsiRecorder,\n onSize?: SharedValue<SkSize>\n) => {\n \"worklet\";\n\n //const start = performance.now();\n if (onSize) {\n const size = SkiaViewApi.size(nativeId);\n if (\n size.width !== onSize.value.width ||\n size.height !== onSize.value.height\n ) {\n onSize.value = size;\n }\n }\n const picture = recorder.play();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(\n Skia: Skia,\n private nativeId: number,\n private onSize?: SharedValue<SkSize>\n ) {\n super(Skia);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const { nativeId, Skia } = this;\n const recorder = new ReanimatedRecorder(Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n Rea.runOnUI((onSize?: SharedValue<SkSize>) => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder, onSize);\n })(this.onSize);\n if (sharedValues.length > 0) {\n const { onSize } = this;\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder, onSize);\n }, sharedValues);\n }\n }\n}\n\nexport const createContainer = (\n Skia: Skia,\n nativeId: number,\n onSize?: SharedValue<SkSize>\n) => {\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n return new NativeReanimatedContainer(Skia, nativeId, onSize);\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEAA,OAAA;AACAA,OAAA;AAAsB,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,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,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEtB,MAAMgB,kBAAkB,GAAGA,CACzBC,QAAgB,EAChBC,QAAqB,EACrBC,M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IAAK;MAC5C,SAAS;;MACTH,kBAAkB,CAACC,QAAQ,EAAEwB,cAAc,EAAEtB,MAAM,CAAC;IACtD,CAAC,CAAC,CAAC,IAAI,CAACA,MAAM,CAAC;IACf,IAAIoB,YAAY,CAACK,MAAM,GAAG,CAAC,EAAE;MAC3B,MAAM;QAAEzB;MAAO,CAAC,GAAG,IAAI;MACvB,IAAI,CAACa,QAAQ,GAAGC,wBAAG,CAACY,WAAW,CAAC,MAAM;QACpC,SAAS;;QACTJ,cAAc,CAACK,YAAY,CAACP,YAAY,CAAC;QACzCvB,kBAAkB,CAACC,QAAQ,EAAEwB,cAAc,EAAEtB,MAAM,CAAC;MACtD,CAAC,EAAEoB,YAAY,CAAC;IAClB;EACF;AACF;AAEO,MAAMQ,eAAe,GAAGA,CAC7BjB,IAAU,EACVb,QAAgB,EAChBE,MAA4B,KACzB;EACH,IAAI6B,+BAAgB,IAAI/B,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,OAAO,IAAIU,yBAAyB,CAACG,IAAI,EAAEb,QAAQ,EAAEE,MAAM,CAAC;EAC9D,CAAC,MAAM;IACL,OAAO,IAAI8B,gCAAe,CAACnB,IAAI,EAAEb,QAAQ,CAAC;EAC5C;AACF,CAAC;AAACiC,OAAA,CAAAH,eAAA,GAAAA,eAAA","ignoreList":[]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { HostConfig } from "react-reconciler";
|
2
2
|
import type { NodeType } from "../dom/types";
|
3
3
|
import type { Node } from "./Node";
|
4
|
-
import type { Container } from "./
|
4
|
+
import type { Container } from "./StaticContainer";
|
5
5
|
export declare const debug: (...args: Parameters<typeof console.log>) => void;
|
6
6
|
type Instance = Node;
|
7
7
|
type Props = object;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_constants","_typeddash","NoEventPriority","DEBUG","debug","args","console","log","exports","currentUpdatePriority","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","_oldProps","keepChildren","_newChildSet","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","_node","getInstanceFromNode","prepareScopeUpdate","_scopeInstance","getInstanceFromScope","shouldAttemptEagerTransition","trackSchedulerEvent","resolveEventType","resolveEventTimeStamp","requestPostPaintCallback","maySuspendCommit","preloadInstance","startSuspendingCommit","suspendInstance","waitForCommitToBeReady","NotPendingTransition","HostTransitionContext","createContext","setCurrentUpdatePriority","newPriority","getCurrentUpdatePriority","resolveUpdatePriority","resetFormInstance"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport { createContext } from \"react\";\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\ntype EventPriority = number;\nconst NoEventPriority = 0;\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 = object;\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>;\nlet currentUpdatePriority: EventPriority = NoEventPriority;\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 {};\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return {};\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: 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 _type,\n _oldProps,\n newProps,\n keepChildren,\n _newChildSet\n ) {\n debug(\"cloneInstance\");\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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shouldAttemptEagerTransition: () => false,\n trackSchedulerEvent: () => {},\n resolveEventType: () => null,\n resolveEventTimeStamp: () => -1.1,\n requestPostPaintCallback() {},\n maySuspendCommit: () => false,\n preloadInstance: () => true, // true indicates already loaded\n startSuspendingCommit() {},\n suspendInstance() {},\n waitForCommitToBeReady: () => null,\n NotPendingTransition: null,\n HostTransitionContext: createContext(null),\n setCurrentUpdatePriority(newPriority: number) {\n currentUpdatePriority = newPriority;\n },\n getCurrentUpdatePriority() {\n return currentUpdatePriority;\n },\n resolveUpdatePriority() {\n if (currentUpdatePriority !== NoEventPriority) {\n return currentUpdatePriority;\n }\n return DefaultEventPriority;\n },\n resetFormInstance() {},\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAGA,IAAAE,UAAA,GAAAF,OAAA;AANA;;AAYA,MAAMG,eAAe,GAAG,CAAC;AAEzB,MAAMC,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;AA8BF,IAAIK,qBAAoC,GAAGP,eAAe;AAEnD,MAAMQ,cAA8B,GAAAF,OAAA,CAAAE,cAAA,GAAG;EAC5C;AACF;AACA;EACEC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,KAAK;EACxBC,mBAAmB,EAAE,IAAI;EACzBC,iBAAiB,EAAE,KAAK;EACxB;E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Ac,EAAmB;IAC/D,MAAM,IAAIrD,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACD;EACA;EACAuD,4BAA4B,EAAEA,CAAA,KAAM,KAAK;EACzCC,mBAAmB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC7BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,qBAAqB,EAAEA,CAAA,KAAM,CAAC,GAAG;EACjCC,wBAAwBA,CAAA,EAAG,CAAC,CAAC;EAC7BC,gBAAgB,EAAEA,CAAA,KAAM,KAAK;EAC7BC,eAAe,EAAEA,CAAA,KAAM,IAAI;EAAE;EAC7BC,qBAAqBA,CAAA,EAAG,CAAC,CAAC;EAC1BC,eAAeA,CAAA,EAAG,CAAC,CAAC;EACpBC,sBAAsB,EAAEA,CAAA,KAAM,IAAI;EAClCC,oBAAoB,EAAE,IAAI;EAC1BC,qBAAqB,eAAE,IAAAC,oBAAa,EAAC,IAAI,CAAC;EAC1CC,wBAAwBA,CAACC,WAAmB,EAAE;IAC5C3F,qBAAqB,GAAG2F,WAAW;EACrC,CAAC;EACDC,wBAAwBA,CAAA,EAAG;IACzB,OAAO5F,qBAAqB;EAC9B,CAAC;EACD6F,qBAAqBA,CAAA,EAAG;IACtB,IAAI7F,qBAAqB,KAAKP,eAAe,EAAE;MAC7C,OAAOO,qBAAqB;IAC9B;IACA,OAAOoE,+BAAoB;EAC7B,CAAC;EACD0B,iBAAiBA,CAAA,EAAG,CAAC;AACvB,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_react","require","_constants","_typeddash","NoEventPriority","DEBUG","debug","args","console","log","exports","currentUpdatePriority","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","_oldProps","keepChildren","_newChildSet","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","_node","getInstanceFromNode","prepareScopeUpdate","_scopeInstance","getInstanceFromScope","shouldAttemptEagerTransition","trackSchedulerEvent","resolveEventType","resolveEventTimeStamp","requestPostPaintCallback","maySuspendCommit","preloadInstance","startSuspendingCommit","suspendInstance","waitForCommitToBeReady","NotPendingTransition","HostTransitionContext","createContext","setCurrentUpdatePriority","newPriority","getCurrentUpdatePriority","resolveUpdatePriority","resetFormInstance"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport { createContext } from \"react\";\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 \"./StaticContainer\";\n\ntype EventPriority = number;\nconst NoEventPriority = 0;\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 = object;\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>;\nlet currentUpdatePriority: EventPriority = NoEventPriority;\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 {};\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return {};\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: 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 _type,\n _oldProps,\n newProps,\n keepChildren,\n _newChildSet\n ) {\n debug(\"cloneInstance\");\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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shouldAttemptEagerTransition: () => false,\n trackSchedulerEvent: () => {},\n resolveEventType: () => null,\n resolveEventTimeStamp: () => -1.1,\n requestPostPaintCallback() {},\n maySuspendCommit: () => false,\n preloadInstance: () => true, // true indicates already loaded\n startSuspendingCommit() {},\n suspendInstance() {},\n waitForCommitToBeReady: () => null,\n NotPendingTransition: null,\n HostTransitionContext: createContext(null),\n setCurrentUpdatePriority(newPriority: number) {\n currentUpdatePriority = newPriority;\n },\n getCurrentUpdatePriority() {\n return currentUpdatePriority;\n },\n resolveUpdatePriority() {\n if (currentUpdatePriority !== NoEventPriority) {\n return currentUpdatePriority;\n }\n return DefaultEventPriority;\n },\n resetFormInstance() {},\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAGA,IAAAE,UAAA,GAAAF,OAAA;AANA;;AAYA,MAAMG,eAAe,GAAG,CAAC;AAEzB,MAAMC,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;AA8BF,IAAIK,qBAAoC,GAAGP,eAAe;AAEnD,MAAMQ,cAA8B,GAAAF,OAAA,CAAAE,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,EAAE,CAAC,CAAC;EAEbC,kBAAkB,EAAGC,sBAAiC,IAAK;IACzDjB,KAAK,CAAC,oBA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CAAA,KAAM,CAAC,CAAC;EAC7BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,qBAAqB,EAAEA,CAAA,KAAM,CAAC,GAAG;EACjCC,wBAAwBA,CAAA,EAAG,CAAC,CAAC;EAC7BC,gBAAgB,EAAEA,CAAA,KAAM,KAAK;EAC7BC,eAAe,EAAEA,CAAA,KAAM,IAAI;EAAE;EAC7BC,qBAAqBA,CAAA,EAAG,CAAC,CAAC;EAC1BC,eAAeA,CAAA,EAAG,CAAC,CAAC;EACpBC,sBAAsB,EAAEA,CAAA,KAAM,IAAI;EAClCC,oBAAoB,EAAE,IAAI;EAC1BC,qBAAqB,eAAE,IAAAC,oBAAa,EAAC,IAAI,CAAC;EAC1CC,wBAAwBA,CAACC,WAAmB,EAAE;IAC5C3F,qBAAqB,GAAG2F,WAAW;EACrC,CAAC;EACDC,wBAAwBA,CAAA,EAAG;IACzB,OAAO5F,qBAAqB;EAC9B,CAAC;EACD6F,qBAAqBA,CAAA,EAAG;IACtB,IAAI7F,qBAAqB,KAAKP,eAAe,EAAE;MAC7C,OAAOO,qBAAqB;IAC9B;IACA,OAAOoE,+BAAoB;EAC7B,CAAC;EACD0B,iBAAiBA,CAAA,EAAG,CAAC;AACvB,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactReconciler","_interopRequireDefault","require","_types","_HostConfig","_Container","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","skiaReconciler","ReactReconciler","sksgHostConfig","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","onSize","container","createContainer","root","console","error","sg","children","type","NodeType","Group","props","isDeclaration","updateContainer","element","Promise","resolve","debug","render","mount","redraw","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount","exports"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport type { SharedValue } from \"react-native-reanimated\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia, SkSize } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport type { Container } from \"./
|
1
|
+
{"version":3,"names":["_reactReconciler","_interopRequireDefault","require","_types","_HostConfig","_Container","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","skiaReconciler","ReactReconciler","sksgHostConfig","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","onSize","container","createContainer","root","console","error","sg","children","type","NodeType","Group","props","isDeclaration","updateContainer","element","Promise","resolve","debug","render","mount","redraw","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount","exports"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport type { SharedValue } from \"react-native-reanimated\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia, SkSize } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport type { Container } from \"./StaticContainer\";\nimport { createContainer } from \"./Container\";\n\nimport \"./Elements\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(public Skia: Skia, nativeId = -1, onSize?: SharedValue<SkSize>) {\n this.container = createContainer(Skia, nativeId, onSize);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n private updateContainer(element: ReactNode) {\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(element, this.root, null, () => {\n debug(\"updateContainer\");\n resolve(true);\n });\n });\n }\n\n async render(element: ReactNode) {\n this.container.mount();\n await this.updateContainer(element);\n this.container.redraw();\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n getPicture() {\n const recorder = this.Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n this.drawOnCanvas(canvas);\n return recorder.finishRecordingAsPicture();\n }\n\n unmount() {\n this.container.unmount();\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n resolve(true);\n });\n });\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAEAA,OAAA;AAAoB,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aA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B,cAAc,CAACwB,eAAe,CAACC,OAAO,EAAE,IAAI,CAACX,IAAI,EAAE,IAAI,EAAE,MAAM;QAC7D,IAAAc,iBAAK,EAAC,iBAAiB,CAAC;QACxBD,OAAO,CAAC,IAAI,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,MAAME,MAAMA,CAACJ,OAAkB,EAAE;IAC/B,IAAI,CAACb,SAAS,CAACkB,KAAK,CAAC,CAAC;IACtB,MAAM,IAAI,CAACN,eAAe,CAACC,OAAO,CAAC;IACnC,IAAI,CAACb,SAAS,CAACmB,MAAM,CAAC,CAAC;EACzB;EAEAC,YAAYA,CAACC,MAAgB,EAAE;IAC7B,IAAI,CAACrB,SAAS,CAACoB,YAAY,CAACC,MAAM,CAAC;EACrC;EAEAC,UAAUA,CAAA,EAAG;IACX,MAAMC,QAAQ,GAAG,IAAI,CAAC1B,IAAI,CAAC2B,eAAe,CAAC,CAAC;IAC5C,MAAMH,MAAM,GAAGE,QAAQ,CAACE,cAAc,CAAC,CAAC;IACxC,IAAI,CAACL,YAAY,CAACC,MAAM,CAAC;IACzB,OAAOE,QAAQ,CAACG,wBAAwB,CAAC,CAAC;EAC5C;EAEAC,OAAOA,CAAA,EAAG;IACR,IAAI,CAAC3B,SAAS,CAAC2B,OAAO,CAAC,CAAC;IACxB,OAAO,IAAIb,OAAO,CAAEC,OAAO,IAAK;MAC9B3B,cAAc,CAACwB,eAAe,CAAC,IAAI,EAAE,IAAI,CAACV,IAAI,EAAE,IAAI,EAAE,MAAM;QAC1D,IAAAc,iBAAK,EAAC,kBAAkB,CAAC;QACzBD,OAAO,CAAC,IAAI,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF;AAACa,OAAA,CAAAjC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
2
|
+
import type { Skia, SkCanvas, SkSize } from "../skia/types";
|
3
|
+
import type { Node } from "./Node";
|
4
|
+
import type { Recording } from "./Recorder/Recorder";
|
5
|
+
import "../views/api";
|
6
|
+
export declare abstract class Container {
|
7
|
+
protected Skia: Skia;
|
8
|
+
private _root;
|
9
|
+
protected recording: Recording | null;
|
10
|
+
protected unmounted: boolean;
|
11
|
+
constructor(Skia: Skia);
|
12
|
+
get root(): Node[];
|
13
|
+
set root(value: Node[]);
|
14
|
+
mount(): void;
|
15
|
+
unmount(): void;
|
16
|
+
drawOnCanvas(canvas: SkCanvas): void;
|
17
|
+
abstract redraw(): void;
|
18
|
+
}
|
19
|
+
export declare class StaticContainer extends Container {
|
20
|
+
private nativeId;
|
21
|
+
private onSize?;
|
22
|
+
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
23
|
+
redraw(): void;
|
24
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.StaticContainer = exports.Container = void 0;
|
7
|
+
var _Recorder = require("./Recorder/Recorder");
|
8
|
+
var _Visitor = require("./Recorder/Visitor");
|
9
|
+
var _Player = require("./Recorder/Player");
|
10
|
+
var _DrawingContext = require("./Recorder/DrawingContext");
|
11
|
+
require("../views/api");
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
15
|
+
class Container {
|
16
|
+
constructor(Skia) {
|
17
|
+
this.Skia = Skia;
|
18
|
+
_defineProperty(this, "_root", []);
|
19
|
+
_defineProperty(this, "recording", null);
|
20
|
+
_defineProperty(this, "unmounted", false);
|
21
|
+
}
|
22
|
+
get root() {
|
23
|
+
return this._root;
|
24
|
+
}
|
25
|
+
set root(value) {
|
26
|
+
this._root = value;
|
27
|
+
}
|
28
|
+
mount() {
|
29
|
+
this.unmounted = false;
|
30
|
+
}
|
31
|
+
unmount() {
|
32
|
+
this.unmounted = true;
|
33
|
+
}
|
34
|
+
drawOnCanvas(canvas) {
|
35
|
+
if (!this.recording) {
|
36
|
+
throw new Error("No recording to draw");
|
37
|
+
}
|
38
|
+
const ctx = (0, _DrawingContext.createDrawingContext)(this.Skia, this.recording.paintPool, canvas);
|
39
|
+
(0, _Player.replay)(ctx, this.recording.commands);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
exports.Container = Container;
|
43
|
+
class StaticContainer extends Container {
|
44
|
+
constructor(Skia, nativeId, onSize) {
|
45
|
+
super(Skia);
|
46
|
+
this.nativeId = nativeId;
|
47
|
+
this.onSize = onSize;
|
48
|
+
}
|
49
|
+
redraw() {
|
50
|
+
const recorder = new _Recorder.Recorder();
|
51
|
+
(0, _Visitor.visit)(recorder, this.root);
|
52
|
+
this.recording = recorder.getRecording();
|
53
|
+
const isOnScreen = this.nativeId !== -1;
|
54
|
+
if (isOnScreen) {
|
55
|
+
if (this.onSize) {
|
56
|
+
const size = SkiaViewApi.size(this.nativeId);
|
57
|
+
if (size.width !== this.onSize.value.width || size.height !== this.onSize.value.height) {
|
58
|
+
this.onSize.value = size;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
const rec = this.Skia.PictureRecorder();
|
62
|
+
const canvas = rec.beginRecording();
|
63
|
+
this.drawOnCanvas(canvas);
|
64
|
+
const picture = rec.finishRecordingAsPicture();
|
65
|
+
SkiaViewApi.setJsiProperty(this.nativeId, "picture", picture);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
exports.StaticContainer = StaticContainer;
|
70
|
+
//# sourceMappingURL=StaticContainer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_Recorder","require","_Visitor","_Player","_DrawingContext","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Container","constructor","Skia","root","_root","mount","unmounted","unmount","drawOnCanvas","canvas","recording","Error","ctx","createDrawingContext","paintPool","replay","commands","exports","StaticContainer","nativeId","onSize","redraw","recorder","Recorder","visit","getRecording","isOnScreen","size","SkiaViewApi","width","height","rec","PictureRecorder","beginRecording","picture","finishRecordingAsPicture","setJsiProperty"],"sources":["StaticContainer.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { Skia, SkCanvas, SkSize } from \"../skia/types\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\n\nimport \"../views/api\";\n\nexport abstract class Container {\n private _root: Node[] = [];\n protected recording: Recording | null = null;\n protected unmounted = false;\n\n constructor(protected Skia: Skia) {}\n\n get root() {\n return this._root;\n }\n\n set root(value: Node[]) {\n this._root = value;\n }\n\n mount() {\n this.unmounted = false;\n }\n\n unmount() {\n this.unmounted = true;\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nexport class StaticContainer extends Container {\n constructor(\n Skia: Skia,\n private nativeId: number,\n private onSize?: SharedValue<SkSize>\n ) {\n super(Skia);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n if (this.onSize) {\n const size = SkiaViewApi.size(this.nativeId);\n if (\n size.width !== this.onSize.value.width ||\n size.height !== this.onSize.value.height\n ) {\n this.onSize.value = size;\n }\n }\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n"],"mappings":";;;;;;AAMA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEAA,OAAA;AAAsB,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,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEf,MAAegB,SAAS,CAAC;EAK9BC,WAAWA,CAAWC,IAAU,EAAE;IAAA,KAAZA,IAAU,GAAVA,IAA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;IACvC,IAAIO,UAAU,EAAE;MACd,IAAI,IAAI,CAACN,MAAM,EAAE;QACf,MAAMO,IAAI,GAAGC,WAAW,CAACD,IAAI,CAAC,IAAI,CAACR,QAAQ,CAAC;QAC5C,IACEQ,IAAI,CAACE,KAAK,KAAK,IAAI,CAACT,MAAM,CAAChC,KAAK,CAACyC,KAAK,IACtCF,IAAI,CAACG,MAAM,KAAK,IAAI,CAACV,MAAM,CAAChC,KAAK,CAAC0C,MAAM,EACxC;UACA,IAAI,CAACV,MAAM,CAAChC,KAAK,GAAGuC,IAAI;QAC1B;MACF;MACA,MAAMI,GAAG,GAAG,IAAI,CAAC7B,IAAI,CAAC8B,eAAe,CAAC,CAAC;MACvC,MAAMvB,MAAM,GAAGsB,GAAG,CAACE,cAAc,CAAC,CAAC;MACnC,IAAI,CAACzB,YAAY,CAACC,MAAM,CAAC;MACzB,MAAMyB,OAAO,GAAGH,GAAG,CAACI,wBAAwB,CAAC,CAAC;MAC9CP,WAAW,CAACQ,cAAc,CAAC,IAAI,CAACjB,QAAQ,EAAE,SAAS,EAAEe,OAAO,CAAC;IAC/D;EACF;AACF;AAACjB,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
|
@@ -1,27 +1,6 @@
|
|
1
1
|
import type { SharedValue } from "react-native-reanimated";
|
2
|
-
import type { Skia,
|
3
|
-
import
|
4
|
-
import type { Recording } from "./Recorder/Recorder";
|
5
|
-
import "../views/api";
|
6
|
-
export declare abstract class Container {
|
7
|
-
protected Skia: Skia;
|
8
|
-
private _root;
|
9
|
-
protected recording: Recording | null;
|
10
|
-
protected unmounted: boolean;
|
11
|
-
constructor(Skia: Skia);
|
12
|
-
get root(): Node[];
|
13
|
-
set root(value: Node[]);
|
14
|
-
mount(): void;
|
15
|
-
unmount(): void;
|
16
|
-
drawOnCanvas(canvas: SkCanvas): void;
|
17
|
-
abstract redraw(): void;
|
18
|
-
}
|
19
|
-
declare class StaticContainer extends Container {
|
20
|
-
private nativeId;
|
21
|
-
private onSize?;
|
22
|
-
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
23
|
-
redraw(): void;
|
24
|
-
}
|
2
|
+
import type { Skia, SkSize } from "../skia/types";
|
3
|
+
import { Container, StaticContainer } from "./StaticContainer";
|
25
4
|
declare class ReanimatedContainer extends Container {
|
26
5
|
private nativeId;
|
27
6
|
private onSize?;
|
@@ -29,12 +8,5 @@ declare class ReanimatedContainer extends Container {
|
|
29
8
|
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
30
9
|
redraw(): void;
|
31
10
|
}
|
32
|
-
declare
|
33
|
-
private nativeId;
|
34
|
-
private onSize?;
|
35
|
-
private mapperId;
|
36
|
-
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
37
|
-
redraw(): void;
|
38
|
-
}
|
39
|
-
export declare const createContainer: (Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize>) => StaticContainer | ReanimatedContainer | NativeReanimatedContainer;
|
11
|
+
export declare const createContainer: (Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize>) => StaticContainer | ReanimatedContainer;
|
40
12
|
export {};
|