@shopify/react-native-skia 0.1.188 → 0.1.190
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkMatrix.h +6 -6
- package/ios/RNSkia-iOS/ViewScreenshotService.mm +13 -1
- package/jestSetup.js +17 -3
- package/lib/commonjs/Platform/IPlatform.d.ts +12 -0
- package/lib/commonjs/Platform/IPlatform.js +6 -0
- package/lib/commonjs/Platform/IPlatform.js.map +1 -0
- package/lib/commonjs/Platform/Platform.d.ts +2 -0
- package/lib/commonjs/Platform/Platform.js +24 -0
- package/lib/commonjs/Platform/Platform.js.map +1 -0
- package/lib/commonjs/Platform/Platform.web.d.ts +2 -0
- package/lib/commonjs/Platform/Platform.web.js +157 -0
- package/lib/commonjs/Platform/Platform.web.js.map +1 -0
- package/lib/commonjs/Platform/index.d.ts +1 -0
- package/lib/commonjs/Platform/index.js +19 -0
- package/lib/commonjs/Platform/index.js.map +1 -0
- package/lib/commonjs/skia/NativeSetup.js +3 -3
- package/lib/commonjs/skia/NativeSetup.js.map +1 -1
- package/lib/commonjs/skia/core/Data.js +2 -8
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/Image.js +3 -3
- package/lib/commonjs/skia/core/Image.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix.d.ts +6 -6
- package/lib/commonjs/skia/types/Matrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +6 -6
- package/lib/commonjs/skia/web/JsiSkMatrix.js +6 -0
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.d.ts +6 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +32 -25
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.js +2 -2
- package/lib/commonjs/views/SkiaDomView.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +2 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +3 -2
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/useTouchHandler.js +3 -3
- package/lib/commonjs/views/useTouchHandler.js.map +1 -1
- package/lib/commonjs/web/WithSkiaWeb.js +2 -2
- package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
- package/lib/module/Platform/IPlatform.d.ts +12 -0
- package/lib/module/Platform/IPlatform.js +2 -0
- package/lib/module/Platform/IPlatform.js.map +1 -0
- package/lib/module/Platform/Platform.d.ts +2 -0
- package/lib/module/Platform/Platform.js +14 -0
- package/lib/module/Platform/Platform.js.map +1 -0
- package/lib/module/Platform/Platform.web.d.ts +2 -0
- package/lib/module/Platform/Platform.web.js +143 -0
- package/lib/module/Platform/Platform.web.js.map +1 -0
- package/lib/module/Platform/index.d.ts +1 -0
- package/lib/module/Platform/index.js +2 -0
- package/lib/module/Platform/index.js.map +1 -0
- package/lib/module/skia/NativeSetup.js +2 -2
- package/lib/module/skia/NativeSetup.js.map +1 -1
- package/lib/module/skia/core/Data.js +2 -7
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/Image.js +2 -2
- package/lib/module/skia/core/Image.js.map +1 -1
- package/lib/module/skia/types/Matrix.d.ts +6 -6
- package/lib/module/skia/types/Matrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.d.ts +6 -6
- package/lib/module/skia/web/JsiSkMatrix.js +6 -0
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.d.ts +6 -1
- package/lib/module/views/SkiaBaseWebView.js +31 -24
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.js +2 -2
- package/lib/module/views/SkiaDomView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +2 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaView.js +2 -2
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/useTouchHandler.js +3 -3
- package/lib/module/views/useTouchHandler.js.map +1 -1
- package/lib/module/web/WithSkiaWeb.js +1 -1
- package/lib/module/web/WithSkiaWeb.js.map +1 -1
- package/lib/typescript/src/Platform/IPlatform.d.ts +12 -0
- package/lib/typescript/src/Platform/Platform.d.ts +2 -0
- package/lib/typescript/src/Platform/Platform.web.d.ts +2 -0
- package/lib/typescript/src/Platform/index.d.ts +1 -0
- package/lib/typescript/src/skia/types/Matrix.d.ts +6 -6
- package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +6 -6
- package/lib/typescript/src/views/SkiaBaseWebView.d.ts +6 -1
- package/package.json +9 -9
- package/src/Platform/IPlatform.ts +20 -0
- package/src/Platform/Platform.ts +28 -0
- package/src/Platform/Platform.web.tsx +136 -0
- package/src/Platform/index.ts +1 -0
- package/src/skia/NativeSetup.ts +2 -2
- package/src/skia/core/Data.ts +4 -15
- package/src/skia/core/Image.ts +2 -3
- package/src/skia/types/Matrix.ts +6 -6
- package/src/skia/web/JsiSkMatrix.ts +6 -0
- package/src/views/SkiaBaseWebView.tsx +24 -19
- package/src/views/SkiaDomView.tsx +2 -2
- package/src/views/SkiaPictureView.tsx +2 -2
- package/src/views/SkiaView.tsx +2 -2
- package/src/views/useTouchHandler.ts +3 -3
- package/src/web/WithSkiaWeb.tsx +2 -1
package/cpp/api/JsiSkMatrix.h
CHANGED
@@ -47,39 +47,39 @@ public:
|
|
47
47
|
JSI_HOST_FUNCTION(concat) {
|
48
48
|
auto m3 = JsiSkMatrix::fromValue(runtime, arguments[0]);
|
49
49
|
getObject()->preConcat(*m3);
|
50
|
-
return
|
50
|
+
return thisValue.asObject(runtime);
|
51
51
|
}
|
52
52
|
|
53
53
|
JSI_HOST_FUNCTION(translate) {
|
54
54
|
auto x = arguments[0].asNumber();
|
55
55
|
auto y = arguments[1].asNumber();
|
56
56
|
getObject()->preTranslate(x, y);
|
57
|
-
return
|
57
|
+
return thisValue.asObject(runtime);
|
58
58
|
}
|
59
59
|
|
60
60
|
JSI_HOST_FUNCTION(scale) {
|
61
61
|
auto x = arguments[0].asNumber();
|
62
62
|
auto y = count > 1 ? arguments[1].asNumber() : 1;
|
63
63
|
getObject()->preScale(x, y);
|
64
|
-
return
|
64
|
+
return thisValue.asObject(runtime);
|
65
65
|
}
|
66
66
|
|
67
67
|
JSI_HOST_FUNCTION(skew) {
|
68
68
|
auto x = arguments[0].asNumber();
|
69
69
|
auto y = arguments[1].asNumber();
|
70
70
|
getObject()->preSkew(x, y);
|
71
|
-
return
|
71
|
+
return thisValue.asObject(runtime);
|
72
72
|
}
|
73
73
|
|
74
74
|
JSI_HOST_FUNCTION(rotate) {
|
75
75
|
auto a = arguments[0].asNumber();
|
76
76
|
getObject()->preRotate(SkRadiansToDegrees(a));
|
77
|
-
return
|
77
|
+
return thisValue.asObject(runtime);
|
78
78
|
}
|
79
79
|
|
80
80
|
JSI_HOST_FUNCTION(identity) {
|
81
81
|
getObject()->setIdentity();
|
82
|
-
return
|
82
|
+
return thisValue.asObject(runtime);
|
83
83
|
}
|
84
84
|
|
85
85
|
JSI_HOST_FUNCTION(get) {
|
@@ -33,6 +33,15 @@
|
|
33
33
|
UIGraphicsImageRendererFormat *format =
|
34
34
|
[UIGraphicsImageRendererFormat defaultFormat];
|
35
35
|
format.opaque = NO;
|
36
|
+
|
37
|
+
// Explicitly ask for the standard format to get ARGB 32bits and not 64bits.
|
38
|
+
if (@available(iOS 12.0, *)) {
|
39
|
+
format.preferredRange = UIGraphicsImageRendererFormatRangeStandard;
|
40
|
+
} else {
|
41
|
+
// Fallback on earlier versions
|
42
|
+
format.prefersExtendedRange = false;
|
43
|
+
}
|
44
|
+
|
36
45
|
UIGraphicsImageRenderer *renderer =
|
37
46
|
[[UIGraphicsImageRenderer alloc] initWithSize:size format:format];
|
38
47
|
|
@@ -68,9 +77,12 @@
|
|
68
77
|
(void *)dataRef);
|
69
78
|
|
70
79
|
// Make SkImageInfo
|
80
|
+
// We're using kBGRA_8888_SkColorType since this is what we get when the
|
81
|
+
// UIGraphicsImageRenderer uses the standard format (the extended is using
|
82
|
+
// 64bits so it is not suitable for us).
|
71
83
|
SkImageInfo info =
|
72
84
|
SkImageInfo::Make(static_cast<int>(width), static_cast<int>(height),
|
73
|
-
|
85
|
+
kBGRA_8888_SkColorType, kPremul_SkAlphaType);
|
74
86
|
|
75
87
|
// ... and then create the SkImage itself!
|
76
88
|
return SkImage::MakeRasterData(info, skData, bytesPerRow);
|
package/jestSetup.js
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
/* globals jest */
|
2
|
-
jest.mock("@shopify/react-native-skia", () =>
|
3
|
-
|
4
|
-
);
|
2
|
+
jest.mock("@shopify/react-native-skia", () => {
|
3
|
+
jest.mock("@shopify/react-native-skia/lib/commonjs/Platform", () => {
|
4
|
+
const Noop = () => undefined;
|
5
|
+
return {
|
6
|
+
OS: "web",
|
7
|
+
PixelRatio: 1,
|
8
|
+
requireNativeComponent: Noop,
|
9
|
+
resolveAsset: Noop,
|
10
|
+
findNodeHandle: Noop,
|
11
|
+
NativeModules: Noop,
|
12
|
+
View: Noop,
|
13
|
+
};
|
14
|
+
});
|
15
|
+
return require("@shopify/react-native-skia/lib/commonjs/mock").Mock(
|
16
|
+
global.CanvasKit
|
17
|
+
);
|
18
|
+
});
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { HostComponent, NodeHandle, ViewComponent } from "react-native";
|
3
|
+
import type { DataModule } from "../skia/types";
|
4
|
+
export interface IPlatform {
|
5
|
+
OS: string;
|
6
|
+
requireNativeComponent: <T>(viewName: string) => HostComponent<T>;
|
7
|
+
PixelRatio: number;
|
8
|
+
NativeModules: Record<string, any>;
|
9
|
+
findNodeHandle: (componentOrHandle: null | number | React.Component<any, any> | React.ComponentClass<any>) => null | NodeHandle;
|
10
|
+
resolveAsset: (source: DataModule) => string;
|
11
|
+
View: typeof ViewComponent;
|
12
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["IPlatform.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { HostComponent, NodeHandle, ViewComponent } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\n\nexport interface IPlatform {\n OS: string;\n requireNativeComponent: <T>(viewName: string) => HostComponent<T>;\n PixelRatio: number;\n NativeModules: Record<string, any>;\n findNodeHandle: (\n componentOrHandle:\n | null\n | number\n | React.Component<any, any>\n | React.ComponentClass<any>\n ) => null | NodeHandle;\n resolveAsset: (source: DataModule) => string;\n View: typeof ViewComponent;\n}\n"],"mappings":""}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Platform = void 0;
|
7
|
+
|
8
|
+
var _reactNative = require("react-native");
|
9
|
+
|
10
|
+
var _types = require("../skia/types");
|
11
|
+
|
12
|
+
const Platform = {
|
13
|
+
OS: _reactNative.Platform.OS,
|
14
|
+
PixelRatio: _reactNative.PixelRatio.get(),
|
15
|
+
requireNativeComponent: _reactNative.requireNativeComponent,
|
16
|
+
resolveAsset: source => {
|
17
|
+
return (0, _types.isRNModule)(source) ? _reactNative.Image.resolveAssetSource(source).uri : source.default;
|
18
|
+
},
|
19
|
+
findNodeHandle: _reactNative.findNodeHandle,
|
20
|
+
NativeModules: _reactNative.NativeModules,
|
21
|
+
View: _reactNative.View
|
22
|
+
};
|
23
|
+
exports.Platform = Platform;
|
24
|
+
//# sourceMappingURL=Platform.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["Platform","OS","RNPlatform","PixelRatio","get","requireNativeComponent","resolveAsset","source","isRNModule","Image","resolveAssetSource","uri","default","findNodeHandle","NativeModules","View"],"sources":["Platform.ts"],"sourcesContent":["import {\n Image,\n PixelRatio,\n requireNativeComponent,\n Platform as RNPlatform,\n findNodeHandle,\n NativeModules,\n View,\n} from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\nexport const Platform: IPlatform = {\n OS: RNPlatform.OS,\n PixelRatio: PixelRatio.get(),\n requireNativeComponent,\n resolveAsset: (source: DataModule) => {\n return isRNModule(source)\n ? Image.resolveAssetSource(source).uri\n : source.default;\n },\n findNodeHandle,\n NativeModules,\n View,\n};\n"],"mappings":";;;;;;;AAAA;;AAWA;;AAIO,MAAMA,QAAmB,GAAG;EACjCC,EAAE,EAAEC,qBAAA,CAAWD,EADkB;EAEjCE,UAAU,EAAEA,uBAAA,CAAWC,GAAX,EAFqB;EAGjCC,sBAAsB,EAAtBA,mCAHiC;EAIjCC,YAAY,EAAGC,MAAD,IAAwB;IACpC,OAAO,IAAAC,iBAAA,EAAWD,MAAX,IACHE,kBAAA,CAAMC,kBAAN,CAAyBH,MAAzB,EAAiCI,GAD9B,GAEHJ,MAAM,CAACK,OAFX;EAGD,CARgC;EASjCC,cAAc,EAAdA,2BATiC;EAUjCC,aAAa,EAAbA,0BAViC;EAWjCC,IAAI,EAAJA;AAXiC,CAA5B"}
|
@@ -0,0 +1,157 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Platform = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _types = require("../skia/types");
|
11
|
+
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
13
|
+
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
15
|
+
|
16
|
+
// eslint-disable-next-line max-len
|
17
|
+
// https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/useElementLayout/index.js
|
18
|
+
const DOM_LAYOUT_HANDLER_NAME = "__reactLayoutHandler";
|
19
|
+
let resizeObserver = null;
|
20
|
+
|
21
|
+
const getObserver = () => {
|
22
|
+
if (resizeObserver == null) {
|
23
|
+
resizeObserver = new window.ResizeObserver(function (entries) {
|
24
|
+
entries.forEach(entry => {
|
25
|
+
const node = entry.target;
|
26
|
+
const {
|
27
|
+
left,
|
28
|
+
top,
|
29
|
+
width,
|
30
|
+
height
|
31
|
+
} = entry.contentRect;
|
32
|
+
const onLayout = node[DOM_LAYOUT_HANDLER_NAME];
|
33
|
+
|
34
|
+
if (typeof onLayout === "function") {
|
35
|
+
// setTimeout 0 is taken from react-native-web (UIManager)
|
36
|
+
setTimeout(() => onLayout({
|
37
|
+
timeStamp: Date.now(),
|
38
|
+
nativeEvent: {
|
39
|
+
layout: {
|
40
|
+
x: left,
|
41
|
+
y: top,
|
42
|
+
width,
|
43
|
+
height
|
44
|
+
}
|
45
|
+
},
|
46
|
+
currentTarget: 0,
|
47
|
+
target: 0,
|
48
|
+
bubbles: false,
|
49
|
+
cancelable: false,
|
50
|
+
defaultPrevented: false,
|
51
|
+
eventPhase: 0,
|
52
|
+
|
53
|
+
isDefaultPrevented() {
|
54
|
+
throw new Error("Method not supported on web.");
|
55
|
+
},
|
56
|
+
|
57
|
+
isPropagationStopped() {
|
58
|
+
throw new Error("Method not supported on web.");
|
59
|
+
},
|
60
|
+
|
61
|
+
persist() {
|
62
|
+
throw new Error("Method not supported on web.");
|
63
|
+
},
|
64
|
+
|
65
|
+
preventDefault() {
|
66
|
+
throw new Error("Method not supported on web.");
|
67
|
+
},
|
68
|
+
|
69
|
+
stopPropagation() {
|
70
|
+
throw new Error("Method not supported on web.");
|
71
|
+
},
|
72
|
+
|
73
|
+
isTrusted: true,
|
74
|
+
type: ""
|
75
|
+
}), 0);
|
76
|
+
}
|
77
|
+
});
|
78
|
+
});
|
79
|
+
}
|
80
|
+
|
81
|
+
return resizeObserver;
|
82
|
+
};
|
83
|
+
|
84
|
+
const useElementLayout = (ref, onLayout) => {
|
85
|
+
const observer = getObserver();
|
86
|
+
(0, _react.useLayoutEffect)(() => {
|
87
|
+
const node = ref.current;
|
88
|
+
|
89
|
+
if (node !== null) {
|
90
|
+
node[DOM_LAYOUT_HANDLER_NAME] = onLayout;
|
91
|
+
}
|
92
|
+
}, [ref, onLayout]);
|
93
|
+
(0, _react.useLayoutEffect)(() => {
|
94
|
+
const node = ref.current;
|
95
|
+
|
96
|
+
if (node != null && observer != null) {
|
97
|
+
if (typeof node[DOM_LAYOUT_HANDLER_NAME] === "function") {
|
98
|
+
observer.observe(node);
|
99
|
+
} else {
|
100
|
+
observer.unobserve(node);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
return () => {
|
105
|
+
if (node != null && observer != null) {
|
106
|
+
observer.unobserve(node);
|
107
|
+
}
|
108
|
+
};
|
109
|
+
}, [observer, ref]);
|
110
|
+
};
|
111
|
+
|
112
|
+
const View = _ref => {
|
113
|
+
let {
|
114
|
+
children,
|
115
|
+
onLayout,
|
116
|
+
style: rawStyle
|
117
|
+
} = _ref;
|
118
|
+
const style = (0, _react.useMemo)(() => rawStyle ?? {}, [rawStyle]);
|
119
|
+
const ref = (0, _react.useRef)(null);
|
120
|
+
useElementLayout(ref, onLayout);
|
121
|
+
const cssStyles = (0, _react.useMemo)(() => {
|
122
|
+
return { ...style,
|
123
|
+
display: "flex",
|
124
|
+
flexDirection: style.flexDirection || "column",
|
125
|
+
flexWrap: style.flexWrap || "nowrap",
|
126
|
+
justifyContent: style.justifyContent || "flex-start",
|
127
|
+
alignItems: style.alignItems || "stretch",
|
128
|
+
alignContent: style.alignContent || "stretch"
|
129
|
+
};
|
130
|
+
}, [style]);
|
131
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
132
|
+
ref: ref,
|
133
|
+
style: cssStyles
|
134
|
+
}, children);
|
135
|
+
};
|
136
|
+
|
137
|
+
const Platform = {
|
138
|
+
OS: "web",
|
139
|
+
PixelRatio: window.devicePixelRatio,
|
140
|
+
requireNativeComponent: () => {
|
141
|
+
throw new Error("requireNativeComponent is not supported on the web");
|
142
|
+
},
|
143
|
+
resolveAsset: source => {
|
144
|
+
if ((0, _types.isRNModule)(source)) {
|
145
|
+
throw new Error("Image source is a number - this is not supported on the web");
|
146
|
+
}
|
147
|
+
|
148
|
+
return source.default;
|
149
|
+
},
|
150
|
+
findNodeHandle: () => {
|
151
|
+
throw new Error("findNodeHandle is not supported on the web");
|
152
|
+
},
|
153
|
+
NativeModules: {},
|
154
|
+
View
|
155
|
+
};
|
156
|
+
exports.Platform = Platform;
|
157
|
+
//# sourceMappingURL=Platform.web.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["DOM_LAYOUT_HANDLER_NAME","resizeObserver","getObserver","window","ResizeObserver","entries","forEach","entry","node","target","left","top","width","height","contentRect","onLayout","setTimeout","timeStamp","Date","now","nativeEvent","layout","x","y","currentTarget","bubbles","cancelable","defaultPrevented","eventPhase","isDefaultPrevented","Error","isPropagationStopped","persist","preventDefault","stopPropagation","isTrusted","type","useElementLayout","ref","observer","useLayoutEffect","current","observe","unobserve","View","children","style","rawStyle","useMemo","useRef","cssStyles","display","flexDirection","flexWrap","justifyContent","alignItems","alignContent","Platform","OS","PixelRatio","devicePixelRatio","requireNativeComponent","resolveAsset","source","isRNModule","default","findNodeHandle","NativeModules"],"sources":["Platform.web.tsx"],"sourcesContent":["import type { RefObject, CSSProperties } from \"react\";\nimport React, { useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { LayoutChangeEvent, ViewComponent, ViewProps } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\n// eslint-disable-next-line max-len\n// https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/useElementLayout/index.js\nconst DOM_LAYOUT_HANDLER_NAME = \"__reactLayoutHandler\";\ntype OnLayout = ((event: LayoutChangeEvent) => void) | undefined;\ntype Div = HTMLDivElement & {\n __reactLayoutHandler: OnLayout;\n};\n\nlet resizeObserver: ResizeObserver | null = null;\n\nconst getObserver = () => {\n if (resizeObserver == null) {\n resizeObserver = new window.ResizeObserver(function (entries) {\n entries.forEach((entry) => {\n const node = entry.target as Div;\n const { left, top, width, height } = entry.contentRect;\n const onLayout = node[DOM_LAYOUT_HANDLER_NAME];\n if (typeof onLayout === \"function\") {\n // setTimeout 0 is taken from react-native-web (UIManager)\n setTimeout(\n () =>\n onLayout({\n timeStamp: Date.now(),\n nativeEvent: { layout: { x: left, y: top, width, height } },\n currentTarget: 0,\n target: 0,\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isDefaultPrevented() {\n throw new Error(\"Method not supported on web.\");\n },\n isPropagationStopped() {\n throw new Error(\"Method not supported on web.\");\n },\n persist() {\n throw new Error(\"Method not supported on web.\");\n },\n preventDefault() {\n throw new Error(\"Method not supported on web.\");\n },\n stopPropagation() {\n throw new Error(\"Method not supported on web.\");\n },\n isTrusted: true,\n type: \"\",\n }),\n 0\n );\n }\n });\n });\n }\n return resizeObserver;\n};\n\nconst useElementLayout = (ref: RefObject<Div>, onLayout: OnLayout) => {\n const observer = getObserver();\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node !== null) {\n node[DOM_LAYOUT_HANDLER_NAME] = onLayout;\n }\n }, [ref, onLayout]);\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node != null && observer != null) {\n if (typeof node[DOM_LAYOUT_HANDLER_NAME] === \"function\") {\n observer.observe(node);\n } else {\n observer.unobserve(node);\n }\n }\n return () => {\n if (node != null && observer != null) {\n observer.unobserve(node);\n }\n };\n }, [observer, ref]);\n};\n\nconst View = (({ children, onLayout, style: rawStyle }: ViewProps) => {\n const style = useMemo(() => (rawStyle ?? {}) as CSSProperties, [rawStyle]);\n const ref = useRef<Div>(null);\n useElementLayout(ref, onLayout);\n const cssStyles = useMemo(() => {\n return {\n ...style,\n display: \"flex\",\n flexDirection: style.flexDirection || \"column\",\n flexWrap: style.flexWrap || \"nowrap\",\n justifyContent: style.justifyContent || \"flex-start\",\n alignItems: style.alignItems || \"stretch\",\n alignContent: style.alignContent || \"stretch\",\n };\n }, [style]);\n\n return (\n <div ref={ref} style={cssStyles}>\n {children}\n </div>\n );\n}) as unknown as typeof ViewComponent;\n\nexport const Platform: IPlatform = {\n OS: \"web\",\n PixelRatio: window.devicePixelRatio,\n requireNativeComponent: () => {\n throw new Error(\"requireNativeComponent is not supported on the web\");\n },\n resolveAsset: (source: DataModule) => {\n if (isRNModule(source)) {\n throw new Error(\n \"Image source is a number - this is not supported on the web\"\n );\n }\n return source.default;\n },\n findNodeHandle: () => {\n throw new Error(\"findNodeHandle is not supported on the web\");\n },\n NativeModules: {},\n View,\n};\n"],"mappings":"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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./Platform";
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
|
7
|
+
var _Platform = require("./Platform");
|
8
|
+
|
9
|
+
Object.keys(_Platform).forEach(function (key) {
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
11
|
+
if (key in exports && exports[key] === _Platform[key]) return;
|
12
|
+
Object.defineProperty(exports, key, {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _Platform[key];
|
16
|
+
}
|
17
|
+
});
|
18
|
+
});
|
19
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Platform\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var
|
3
|
+
var _Platform = require("../Platform");
|
4
4
|
|
5
|
-
if (
|
5
|
+
if (_Platform.Platform.OS !== "web" && global.SkiaApi == null) {
|
6
6
|
// Initialize RN Skia
|
7
|
-
const SkiaModule =
|
7
|
+
const SkiaModule = _Platform.Platform.NativeModules.RNSkia;
|
8
8
|
|
9
9
|
if (SkiaModule == null || typeof SkiaModule.install !== "function") {
|
10
10
|
throw new Error("Native RNSkia Module cannot be found! Make sure you correctly " + "installed native dependencies and rebuilt your app.");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Platform","OS","global","SkiaApi","SkiaModule","NativeModules","RNSkia","install","Error","result"],"sources":["NativeSetup.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"names":["Platform","OS","global","SkiaApi","SkiaModule","NativeModules","RNSkia","install","Error","result"],"sources":["NativeSetup.ts"],"sourcesContent":["import { Platform } from \"../Platform\";\n\nif (Platform.OS !== \"web\" && global.SkiaApi == null) {\n // Initialize RN Skia\n const SkiaModule = Platform.NativeModules.RNSkia;\n if (SkiaModule == null || typeof SkiaModule.install !== \"function\") {\n throw new Error(\n \"Native RNSkia Module cannot be found! Make sure you correctly \" +\n \"installed native dependencies and rebuilt your app.\"\n );\n }\n const result = SkiaModule.install();\n if (result !== true) {\n throw new Error(\n `Native Skia Module failed to correctly install JSI Bindings! Result: ${result}`\n );\n }\n}\n"],"mappings":";;AAAA;;AAEA,IAAIA,kBAAA,CAASC,EAAT,KAAgB,KAAhB,IAAyBC,MAAM,CAACC,OAAP,IAAkB,IAA/C,EAAqD;EACnD;EACA,MAAMC,UAAU,GAAGJ,kBAAA,CAASK,aAAT,CAAuBC,MAA1C;;EACA,IAAIF,UAAU,IAAI,IAAd,IAAsB,OAAOA,UAAU,CAACG,OAAlB,KAA8B,UAAxD,EAAoE;IAClE,MAAM,IAAIC,KAAJ,CACJ,mEACE,qDAFE,CAAN;EAID;;EACD,MAAMC,MAAM,GAAGL,UAAU,CAACG,OAAX,EAAf;;EACA,IAAIE,MAAM,KAAK,IAAf,EAAqB;IACnB,MAAM,IAAID,KAAJ,CACH,wEAAuEC,MAAO,EAD3E,CAAN;EAGD;AACF"}
|
@@ -7,15 +7,9 @@ exports.useRawData = exports.useData = void 0;
|
|
7
7
|
|
8
8
|
var _react = require("react");
|
9
9
|
|
10
|
-
var _reactNative = require("react-native");
|
11
|
-
|
12
10
|
var _Skia = require("../Skia");
|
13
11
|
|
14
|
-
var
|
15
|
-
|
16
|
-
const resolveAsset = source => {
|
17
|
-
return (0, _types.isRNModule)(source) ? _reactNative.Image.resolveAssetSource(source).uri : source.default;
|
18
|
-
};
|
12
|
+
var _Platform = require("../../Platform");
|
19
13
|
|
20
14
|
const factoryWrapper = (data2, factory, onError) => {
|
21
15
|
const factoryResult = factory(data2);
|
@@ -34,7 +28,7 @@ const loadData = (source, factory, onError) => {
|
|
34
28
|
} else if (source instanceof Uint8Array) {
|
35
29
|
return new Promise(resolve => resolve(factoryWrapper(_Skia.Skia.Data.fromBytes(source), factory, onError)));
|
36
30
|
} else {
|
37
|
-
const uri = typeof source === "string" ? source : resolveAsset(source);
|
31
|
+
const uri = typeof source === "string" ? source : _Platform.Platform.resolveAsset(source);
|
38
32
|
return _Skia.Skia.Data.fromURI(uri).then(d => factoryWrapper(d, factory, onError));
|
39
33
|
}
|
40
34
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["factoryWrapper","data2","factory","onError","factoryResult","Error","loadData","source","undefined","Promise","resolve","Uint8Array","Skia","Data","fromBytes","uri","Platform","resolveAsset","fromURI","then","d","useLoading","loader","mounted","useRef","data","setData","useState","dataRef","useEffect","current","value","dispose","useRawData","identity","useData"],"sources":["Data.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport type { SkData, DataSourceParam, JsiDisposable } from \"../types\";\nimport { Platform } from \"../../Platform\";\n\nconst factoryWrapper = <T>(\n data2: SkData,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => {\n const factoryResult = factory(data2);\n if (factoryResult === null) {\n onError && onError(new Error(\"Could not load data\"));\n return null;\n } else {\n return factoryResult;\n }\n};\n\nconst loadData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T | null,\n onError?: (err: Error) => void\n): Promise<T | null> => {\n if (source === null || source === undefined) {\n return new Promise((resolve) => resolve(null));\n } else if (source instanceof Uint8Array) {\n return new Promise((resolve) =>\n resolve(factoryWrapper(Skia.Data.fromBytes(source), factory, onError))\n );\n } else {\n const uri =\n typeof source === \"string\" ? source : Platform.resolveAsset(source);\n return Skia.Data.fromURI(uri).then((d) =>\n factoryWrapper(d, factory, onError)\n );\n }\n};\nconst useLoading = <T extends JsiDisposable>(\n source: DataSourceParam,\n loader: () => Promise<T | null>\n) => {\n const mounted = useRef(false);\n const [data, setData] = useState<T | null>(null);\n const dataRef = useRef<T | null>(null);\n useEffect(() => {\n mounted.current = true;\n loader().then((value) => {\n if (mounted.current) {\n setData(value);\n dataRef.current = value;\n }\n });\n return () => {\n dataRef.current?.dispose();\n mounted.current = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [source]);\n return data;\n};\n\nexport const useRawData = <T extends JsiDisposable>(\n source: DataSourceParam,\n factory: (data: SkData) => T | null,\n onError?: (err: Error) => void\n) => useLoading(source, () => loadData<T>(source, factory, onError));\n\nconst identity = (data: SkData) => data;\n\nexport const useData = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, identity, onError);\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA,MAAMA,cAAc,GAAG,CACrBC,KADqB,EAErBC,OAFqB,EAGrBC,OAHqB,KAIlB;EACH,MAAMC,aAAa,GAAGF,OAAO,CAACD,KAAD,CAA7B;;EACA,IAAIG,aAAa,KAAK,IAAtB,EAA4B;IAC1BD,OAAO,IAAIA,OAAO,CAAC,IAAIE,KAAJ,CAAU,qBAAV,CAAD,CAAlB;IACA,OAAO,IAAP;EACD,CAHD,MAGO;IACL,OAAOD,aAAP;EACD;AACF,CAZD;;AAcA,MAAME,QAAQ,GAAG,CACfC,MADe,EAEfL,OAFe,EAGfC,OAHe,KAIO;EACtB,IAAII,MAAM,KAAK,IAAX,IAAmBA,MAAM,KAAKC,SAAlC,EAA6C;IAC3C,OAAO,IAAIC,OAAJ,CAAaC,OAAD,IAAaA,OAAO,CAAC,IAAD,CAAhC,CAAP;EACD,CAFD,MAEO,IAAIH,MAAM,YAAYI,UAAtB,EAAkC;IACvC,OAAO,IAAIF,OAAJ,CAAaC,OAAD,IACjBA,OAAO,CAACV,cAAc,CAACY,UAAA,CAAKC,IAAL,CAAUC,SAAV,CAAoBP,MAApB,CAAD,EAA8BL,OAA9B,EAAuCC,OAAvC,CAAf,CADF,CAAP;EAGD,CAJM,MAIA;IACL,MAAMY,GAAG,GACP,OAAOR,MAAP,KAAkB,QAAlB,GAA6BA,MAA7B,GAAsCS,kBAAA,CAASC,YAAT,CAAsBV,MAAtB,CADxC;IAEA,OAAOK,UAAA,CAAKC,IAAL,CAAUK,OAAV,CAAkBH,GAAlB,EAAuBI,IAAvB,CAA6BC,CAAD,IACjCpB,cAAc,CAACoB,CAAD,EAAIlB,OAAJ,EAAaC,OAAb,CADT,CAAP;EAGD;AACF,CAlBD;;AAmBA,MAAMkB,UAAU,GAAG,CACjBd,MADiB,EAEjBe,MAFiB,KAGd;EACH,MAAMC,OAAO,GAAG,IAAAC,aAAA,EAAO,KAAP,CAAhB;EACA,MAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB,IAAAC,eAAA,EAAmB,IAAnB,CAAxB;EACA,MAAMC,OAAO,GAAG,IAAAJ,aAAA,EAAiB,IAAjB,CAAhB;EACA,IAAAK,gBAAA,EAAU,MAAM;IACdN,OAAO,CAACO,OAAR,GAAkB,IAAlB;IACAR,MAAM,GAAGH,IAAT,CAAeY,KAAD,IAAW;MACvB,IAAIR,OAAO,CAACO,OAAZ,EAAqB;QACnBJ,OAAO,CAACK,KAAD,CAAP;QACAH,OAAO,CAACE,OAAR,GAAkBC,KAAlB;MACD;IACF,CALD;IAMA,OAAO,MAAM;MAAA;;MACX,oBAAAH,OAAO,CAACE,OAAR,sEAAiBE,OAAjB;MACAT,OAAO,CAACO,OAAR,GAAkB,KAAlB;IACD,CAHD,CARc,CAYd;EACD,CAbD,EAaG,CAACvB,MAAD,CAbH;EAcA,OAAOkB,IAAP;AACD,CAtBD;;AAwBO,MAAMQ,UAAU,GAAG,CACxB1B,MADwB,EAExBL,OAFwB,EAGxBC,OAHwB,KAIrBkB,UAAU,CAACd,MAAD,EAAS,MAAMD,QAAQ,CAAIC,MAAJ,EAAYL,OAAZ,EAAqBC,OAArB,CAAvB,CAJR;;;;AAMP,MAAM+B,QAAQ,GAAIT,IAAD,IAAkBA,IAAnC;;AAEO,MAAMU,OAAO,GAAG,CACrB5B,MADqB,EAErBJ,OAFqB,KAGlB8B,UAAU,CAAC1B,MAAD,EAAS2B,QAAT,EAAmB/B,OAAnB,CAHR"}
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.useImage = exports.makeImageFromView = void 0;
|
7
7
|
|
8
|
-
var
|
8
|
+
var _Platform = require("../../Platform");
|
9
9
|
|
10
10
|
var _Skia = require("../Skia");
|
11
11
|
|
@@ -36,7 +36,7 @@ const makeImageFromView = function (viewRef) {
|
|
36
36
|
let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
37
37
|
|
38
38
|
// In web implementation we just delegate the work to the provided callback
|
39
|
-
if (
|
39
|
+
if (_Platform.Platform.OS === "web") {
|
40
40
|
if (callback) {
|
41
41
|
return callback(viewRef);
|
42
42
|
} else {
|
@@ -44,7 +44,7 @@ const makeImageFromView = function (viewRef) {
|
|
44
44
|
}
|
45
45
|
}
|
46
46
|
|
47
|
-
const viewTag =
|
47
|
+
const viewTag = _Platform.Platform.findNodeHandle(viewRef.current);
|
48
48
|
|
49
49
|
if (viewTag !== null && viewTag !== 0) {
|
50
50
|
return _Skia.Skia.Image.MakeImageFromViewTag(viewTag);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["imgFactory","Skia","Image","MakeImageFromEncoded","bind","useImage","source","onError","useRawData","makeImageFromView","viewRef","callback","Platform","OS","Promise","reject","Error","viewTag","findNodeHandle","current","MakeImageFromViewTag"],"sources":["Image.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"names":["imgFactory","Skia","Image","MakeImageFromEncoded","bind","useImage","source","onError","useRawData","makeImageFromView","viewRef","callback","Platform","OS","Promise","reject","Error","viewTag","findNodeHandle","current","MakeImageFromViewTag"],"sources":["Image.ts"],"sourcesContent":["import { Platform } from \"../../Platform\";\nimport { Skia } from \"../Skia\";\nimport type { DataSourceParam, SkImage } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst imgFactory = Skia.Image.MakeImageFromEncoded.bind(Skia.Image);\n\n/**\n * Returns a Skia Image object\n * */\nexport const useImage = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, imgFactory, onError);\n\n/**\n * Creates an image from a given view reference. NOTE: This method has different implementations\n * on web/native. On web, the callback is called with the view ref and the callback is expected to\n * return a promise that resolves to a Skia Image object. On native, the view ref is used to\n * find the view tag and the Skia Image object is created from the view tag. This means that on web\n * you will need to implement the logic to create the image from the view ref yourself.\n * @param viewRef Ref to the view we're creating an image from\n * @returns A promise that resolves to a Skia Image object or rejects\n * with an error id the view tag is invalid.\n */\nexport const makeImageFromView = <\n T extends\n | number\n | React.Component<unknown, unknown>\n | React.ComponentClass<unknown>\n>(\n viewRef: React.RefObject<T>,\n callback:\n | null\n | ((viewRef: React.RefObject<T>) => Promise<SkImage | null>) = null\n) => {\n // In web implementation we just delegate the work to the provided callback\n if (Platform.OS === \"web\") {\n if (callback) {\n return callback(viewRef);\n } else {\n Promise.reject(\n new Error(\n \"Callback is required on web in the makeImageFromView function.\"\n )\n );\n }\n }\n const viewTag = Platform.findNodeHandle(viewRef.current);\n if (viewTag !== null && viewTag !== 0) {\n return Skia.Image.MakeImageFromViewTag(viewTag);\n }\n return Promise.reject(new Error(\"Invalid view tag\"));\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;AAEA,MAAMA,UAAU,GAAGC,UAAA,CAAKC,KAAL,CAAWC,oBAAX,CAAgCC,IAAhC,CAAqCH,UAAA,CAAKC,KAA1C,CAAnB;AAEA;AACA;AACA;;;AACO,MAAMG,QAAQ,GAAG,CACtBC,MADsB,EAEtBC,OAFsB,KAGnB,IAAAC,gBAAA,EAAWF,MAAX,EAAmBN,UAAnB,EAA+BO,OAA/B,CAHE;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAME,iBAAiB,GAAG,UAM/BC,OAN+B,EAU5B;EAAA,IAHHC,QAGG,uEAD8D,IAC9D;;EACH;EACA,IAAIC,kBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;IACzB,IAAIF,QAAJ,EAAc;MACZ,OAAOA,QAAQ,CAACD,OAAD,CAAf;IACD,CAFD,MAEO;MACLI,OAAO,CAACC,MAAR,CACE,IAAIC,KAAJ,CACE,gEADF,CADF;IAKD;EACF;;EACD,MAAMC,OAAO,GAAGL,kBAAA,CAASM,cAAT,CAAwBR,OAAO,CAACS,OAAhC,CAAhB;;EACA,IAAIF,OAAO,KAAK,IAAZ,IAAoBA,OAAO,KAAK,CAApC,EAAuC;IACrC,OAAOhB,UAAA,CAAKC,KAAL,CAAWkB,oBAAX,CAAgCH,OAAhC,CAAP;EACD;;EACD,OAAOH,OAAO,CAACC,MAAR,CAAe,IAAIC,KAAJ,CAAU,kBAAV,CAAf,CAAP;AACD,CA5BM"}
|
@@ -13,12 +13,12 @@ export declare enum MatrixIndex {
|
|
13
13
|
}
|
14
14
|
export declare const isMatrix: (obj: unknown) => obj is SkMatrix;
|
15
15
|
export interface SkMatrix extends SkJSIInstance<"Matrix"> {
|
16
|
-
concat: (matrix: SkMatrix) =>
|
17
|
-
translate: (x: number, y: number) =>
|
18
|
-
scale: (x: number, y?: number) =>
|
19
|
-
skew: (x: number, y: number) =>
|
20
|
-
rotate: (theta: number) =>
|
21
|
-
identity: () =>
|
16
|
+
concat: (matrix: SkMatrix) => SkMatrix;
|
17
|
+
translate: (x: number, y: number) => SkMatrix;
|
18
|
+
scale: (x: number, y?: number) => SkMatrix;
|
19
|
+
skew: (x: number, y: number) => SkMatrix;
|
20
|
+
rotate: (theta: number) => SkMatrix;
|
21
|
+
identity: () => SkMatrix;
|
22
22
|
get: () => number[];
|
23
23
|
}
|
24
24
|
declare type Transform2dName = "translateX" | "translateY" | "scale" | "skewX" | "skewY" | "scaleX" | "scaleY" | "rotateZ" | "rotate";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["MatrixIndex","isMatrix","obj","__typename__","processTransform","m","transforms","transform","key","Object","keys","value","translate","scale","skew","rotate","toDegrees","exhaustiveCheck","a","Error","rad","Math","PI"],"sources":["Matrix.ts"],"sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\nimport type { SkCanvas } from \"./Canvas\";\nexport enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n Persp2 = 8,\n}\n\nexport const isMatrix = (obj: unknown): obj is SkMatrix =>\n obj !== null && (obj as SkJSIInstance<string>).__typename__ === \"Matrix\";\n\nexport interface SkMatrix extends SkJSIInstance<\"Matrix\"> {\n concat: (matrix: SkMatrix) =>
|
1
|
+
{"version":3,"names":["MatrixIndex","isMatrix","obj","__typename__","processTransform","m","transforms","transform","key","Object","keys","value","translate","scale","skew","rotate","toDegrees","exhaustiveCheck","a","Error","rad","Math","PI"],"sources":["Matrix.ts"],"sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\nimport type { SkCanvas } from \"./Canvas\";\nexport enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n Persp2 = 8,\n}\n\nexport const isMatrix = (obj: unknown): obj is SkMatrix =>\n obj !== null && (obj as SkJSIInstance<string>).__typename__ === \"Matrix\";\n\nexport interface SkMatrix extends SkJSIInstance<\"Matrix\"> {\n concat: (matrix: SkMatrix) => SkMatrix;\n translate: (x: number, y: number) => SkMatrix;\n scale: (x: number, y?: number) => SkMatrix;\n skew: (x: number, y: number) => SkMatrix;\n rotate: (theta: number) => SkMatrix;\n identity: () => SkMatrix;\n get: () => number[];\n}\n\ntype Transform2dName =\n | \"translateX\"\n | \"translateY\"\n | \"scale\"\n | \"skewX\"\n | \"skewY\"\n | \"scaleX\"\n | \"scaleY\"\n | \"rotateZ\"\n | \"rotate\";\n\ntype Transformations = {\n readonly [Name in Transform2dName]: number;\n};\n\nexport type Transforms2d = readonly (\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"rotate\">\n)[];\n\nexport interface TransformProp {\n transform?: Transforms2d;\n}\n\nexport const processTransform = <T extends SkMatrix | SkCanvas>(\n m: T,\n transforms: Transforms2d\n) => {\n for (const transform of transforms) {\n const key = Object.keys(transform)[0] as Transform2dName;\n const value = (transform as Pick<Transformations, typeof key>)[key];\n if (key === \"translateX\") {\n m.translate(value, 0);\n continue;\n }\n if (key === \"translateY\") {\n m.translate(0, value);\n continue;\n }\n if (key === \"scale\") {\n m.scale(value, value);\n continue;\n }\n if (key === \"scaleX\") {\n m.scale(value, 1);\n continue;\n }\n if (key === \"scaleY\") {\n m.scale(1, value);\n continue;\n }\n if (key === \"skewX\") {\n m.skew(value, 0);\n continue;\n }\n if (key === \"skewY\") {\n m.skew(0, value);\n continue;\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n if (isMatrix(m)) {\n m.rotate(value);\n } else {\n m.rotate(toDegrees(value), 0, 0);\n }\n continue;\n }\n exhaustiveCheck(key);\n }\n return m;\n};\n\nconst exhaustiveCheck = (a: never): never => {\n throw new Error(`Unknown transformation: ${a}`);\n};\n\nexport const toDegrees = (rad: number) => {\n return (rad * 180) / Math.PI;\n};\n"],"mappings":";;;;;;IAEYA,W;;;WAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W;;AAYL,MAAMC,QAAQ,GAAIC,GAAD,IACtBA,GAAG,KAAK,IAAR,IAAiBA,GAAD,CAA+BC,YAA/B,KAAgD,QAD3D;;;;AA2CA,MAAMC,gBAAgB,GAAG,CAC9BC,CAD8B,EAE9BC,UAF8B,KAG3B;EACH,KAAK,MAAMC,SAAX,IAAwBD,UAAxB,EAAoC;IAClC,MAAME,GAAG,GAAGC,MAAM,CAACC,IAAP,CAAYH,SAAZ,EAAuB,CAAvB,CAAZ;IACA,MAAMI,KAAK,GAAIJ,SAAD,CAAiDC,GAAjD,CAAd;;IACA,IAAIA,GAAG,KAAK,YAAZ,EAA0B;MACxBH,CAAC,CAACO,SAAF,CAAYD,KAAZ,EAAmB,CAAnB;MACA;IACD;;IACD,IAAIH,GAAG,KAAK,YAAZ,EAA0B;MACxBH,CAAC,CAACO,SAAF,CAAY,CAAZ,EAAeD,KAAf;MACA;IACD;;IACD,IAAIH,GAAG,KAAK,OAAZ,EAAqB;MACnBH,CAAC,CAACQ,KAAF,CAAQF,KAAR,EAAeA,KAAf;MACA;IACD;;IACD,IAAIH,GAAG,KAAK,QAAZ,EAAsB;MACpBH,CAAC,CAACQ,KAAF,CAAQF,KAAR,EAAe,CAAf;MACA;IACD;;IACD,IAAIH,GAAG,KAAK,QAAZ,EAAsB;MACpBH,CAAC,CAACQ,KAAF,CAAQ,CAAR,EAAWF,KAAX;MACA;IACD;;IACD,IAAIH,GAAG,KAAK,OAAZ,EAAqB;MACnBH,CAAC,CAACS,IAAF,CAAOH,KAAP,EAAc,CAAd;MACA;IACD;;IACD,IAAIH,GAAG,KAAK,OAAZ,EAAqB;MACnBH,CAAC,CAACS,IAAF,CAAO,CAAP,EAAUH,KAAV;MACA;IACD;;IACD,IAAIH,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,SAAhC,EAA2C;MACzC,IAAIP,QAAQ,CAACI,CAAD,CAAZ,EAAiB;QACfA,CAAC,CAACU,MAAF,CAASJ,KAAT;MACD,CAFD,MAEO;QACLN,CAAC,CAACU,MAAF,CAASC,SAAS,CAACL,KAAD,CAAlB,EAA2B,CAA3B,EAA8B,CAA9B;MACD;;MACD;IACD;;IACDM,eAAe,CAACT,GAAD,CAAf;EACD;;EACD,OAAOH,CAAP;AACD,CA9CM;;;;AAgDP,MAAMY,eAAe,GAAIC,CAAD,IAAqB;EAC3C,MAAM,IAAIC,KAAJ,CAAW,2BAA0BD,CAAE,EAAvC,CAAN;AACD,CAFD;;AAIO,MAAMF,SAAS,GAAII,GAAD,IAAiB;EACxC,OAAQA,GAAG,GAAG,GAAP,GAAcC,IAAI,CAACC,EAA1B;AACD,CAFM"}
|
@@ -3,11 +3,11 @@ import type { SkMatrix } from "../types";
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkMatrix extends HostObject<Matrix3x3, "Matrix"> implements SkMatrix {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: Matrix3x3);
|
6
|
-
concat(matrix: SkMatrix):
|
7
|
-
translate(x: number, y: number):
|
8
|
-
scale(x: number, y?: number):
|
9
|
-
skew(x: number, y: number):
|
10
|
-
rotate(value: number):
|
11
|
-
identity():
|
6
|
+
concat(matrix: SkMatrix): this;
|
7
|
+
translate(x: number, y: number): this;
|
8
|
+
scale(x: number, y?: number): this;
|
9
|
+
skew(x: number, y: number): this;
|
10
|
+
rotate(value: number): this;
|
11
|
+
identity(): this;
|
12
12
|
get(): number[];
|
13
13
|
}
|
@@ -14,26 +14,32 @@ class JsiSkMatrix extends _Host.HostObject {
|
|
14
14
|
|
15
15
|
concat(matrix) {
|
16
16
|
this.ref.set(this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix)));
|
17
|
+
return this;
|
17
18
|
}
|
18
19
|
|
19
20
|
translate(x, y) {
|
20
21
|
this.concat(new JsiSkMatrix(this.CanvasKit, Float32Array.of(...this.CanvasKit.Matrix.translated(x, y))));
|
22
|
+
return this;
|
21
23
|
}
|
22
24
|
|
23
25
|
scale(x, y) {
|
24
26
|
this.concat(new JsiSkMatrix(this.CanvasKit, Float32Array.of(...this.CanvasKit.Matrix.scaled(x, y ?? x))));
|
27
|
+
return this;
|
25
28
|
}
|
26
29
|
|
27
30
|
skew(x, y) {
|
28
31
|
this.concat(new JsiSkMatrix(this.CanvasKit, Float32Array.of(...this.CanvasKit.Matrix.skewed(x, y))));
|
32
|
+
return this;
|
29
33
|
}
|
30
34
|
|
31
35
|
rotate(value) {
|
32
36
|
this.concat(new JsiSkMatrix(this.CanvasKit, Float32Array.of(...this.CanvasKit.Matrix.rotated(value))));
|
37
|
+
return this;
|
33
38
|
}
|
34
39
|
|
35
40
|
identity() {
|
36
41
|
this.ref.set(this.CanvasKit.Matrix.identity());
|
42
|
+
return this;
|
37
43
|
}
|
38
44
|
|
39
45
|
get() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkMatrix","HostObject","constructor","CanvasKit","ref","concat","matrix","set","Matrix","multiply","fromValue","translate","x","y","Float32Array","of","translated","scale","scaled","skew","skewed","rotate","value","rotated","identity","get","Array","from"],"sources":["JsiSkMatrix.ts"],"sourcesContent":["import type { CanvasKit, Matrix3x3 } from \"canvaskit-wasm\";\n\nimport type { SkMatrix } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkMatrix\n extends HostObject<Matrix3x3, \"Matrix\">\n implements SkMatrix\n{\n constructor(CanvasKit: CanvasKit, ref: Matrix3x3) {\n super(CanvasKit, ref, \"Matrix\");\n }\n\n concat(matrix: SkMatrix) {\n this.ref.set(\n this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))\n );\n }\n\n translate(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.translated(x, y))\n )\n );\n }\n\n scale(x: number, y?: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.scaled(x, y ?? x))\n )\n );\n }\n\n skew(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.skewed(x, y))\n )\n );\n }\n\n rotate(value: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.rotated(value))\n )\n );\n }\n\n identity() {\n this.ref.set(this.CanvasKit.Matrix.identity());\n }\n\n get() {\n return Array.from(this.ref);\n }\n}\n"],"mappings":";;;;;;;AAIA;;AAEO,MAAMA,WAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAuC;IAChD,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;EACD;;EAEDC,MAAM,CAACC,MAAD,EAAmB;IACvB,KAAKF,GAAL,CAASG,GAAT,CACE,KAAKJ,SAAL,CAAeK,MAAf,CAAsBC,QAAtB,CAA+B,KAAKL,GAApC,EAAyCJ,WAAW,CAACU,SAAZ,CAAsBJ,MAAtB,CAAzC,CADF;
|
1
|
+
{"version":3,"names":["JsiSkMatrix","HostObject","constructor","CanvasKit","ref","concat","matrix","set","Matrix","multiply","fromValue","translate","x","y","Float32Array","of","translated","scale","scaled","skew","skewed","rotate","value","rotated","identity","get","Array","from"],"sources":["JsiSkMatrix.ts"],"sourcesContent":["import type { CanvasKit, Matrix3x3 } from \"canvaskit-wasm\";\n\nimport type { SkMatrix } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkMatrix\n extends HostObject<Matrix3x3, \"Matrix\">\n implements SkMatrix\n{\n constructor(CanvasKit: CanvasKit, ref: Matrix3x3) {\n super(CanvasKit, ref, \"Matrix\");\n }\n\n concat(matrix: SkMatrix) {\n this.ref.set(\n this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))\n );\n return this;\n }\n\n translate(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.translated(x, y))\n )\n );\n return this;\n }\n\n scale(x: number, y?: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.scaled(x, y ?? x))\n )\n );\n return this;\n }\n\n skew(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.skewed(x, y))\n )\n );\n return this;\n }\n\n rotate(value: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.rotated(value))\n )\n );\n return this;\n }\n\n identity() {\n this.ref.set(this.CanvasKit.Matrix.identity());\n return this;\n }\n\n get() {\n return Array.from(this.ref);\n }\n}\n"],"mappings":";;;;;;;AAIA;;AAEO,MAAMA,WAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAuC;IAChD,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;EACD;;EAEDC,MAAM,CAACC,MAAD,EAAmB;IACvB,KAAKF,GAAL,CAASG,GAAT,CACE,KAAKJ,SAAL,CAAeK,MAAf,CAAsBC,QAAtB,CAA+B,KAAKL,GAApC,EAAyCJ,WAAW,CAACU,SAAZ,CAAsBJ,MAAtB,CAAzC,CADF;IAGA,OAAO,IAAP;EACD;;EAEDK,SAAS,CAACC,CAAD,EAAYC,CAAZ,EAAuB;IAC9B,KAAKR,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBQ,UAAtB,CAAiCJ,CAAjC,EAAoCC,CAApC,CAAnB,CAFF,CADF;IAMA,OAAO,IAAP;EACD;;EAEDI,KAAK,CAACL,CAAD,EAAYC,CAAZ,EAAwB;IAC3B,KAAKR,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBU,MAAtB,CAA6BN,CAA7B,EAAgCC,CAAC,IAAID,CAArC,CAAnB,CAFF,CADF;IAMA,OAAO,IAAP;EACD;;EAEDO,IAAI,CAACP,CAAD,EAAYC,CAAZ,EAAuB;IACzB,KAAKR,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBY,MAAtB,CAA6BR,CAA7B,EAAgCC,CAAhC,CAAnB,CAFF,CADF;IAMA,OAAO,IAAP;EACD;;EAEDQ,MAAM,CAACC,KAAD,EAAgB;IACpB,KAAKjB,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBe,OAAtB,CAA8BD,KAA9B,CAAnB,CAFF,CADF;IAMA,OAAO,IAAP;EACD;;EAEDE,QAAQ,GAAG;IACT,KAAKpB,GAAL,CAASG,GAAT,CAAa,KAAKJ,SAAL,CAAeK,MAAf,CAAsBgB,QAAtB,EAAb;IACA,OAAO,IAAP;EACD;;EAEDC,GAAG,GAAG;IACJ,OAAOC,KAAK,CAACC,IAAN,CAAW,KAAKvB,GAAhB,CAAP;EACD;;AA3DH"}
|
@@ -17,7 +17,7 @@ export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps>
|
|
17
17
|
protected width: number;
|
18
18
|
protected height: number;
|
19
19
|
private unsubscribeAll;
|
20
|
-
private
|
20
|
+
private onLayoutEvent;
|
21
21
|
protected getSize(): {
|
22
22
|
width: number;
|
23
23
|
height: number;
|
@@ -58,5 +58,10 @@ export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps>
|
|
58
58
|
registerValues(_values: SkiaValue<unknown>[]): void;
|
59
59
|
private handleTouchEvent;
|
60
60
|
createTouchHandler(touchType: TouchType): (evt: PointerEvent) => void;
|
61
|
+
private onStart;
|
62
|
+
private onActive;
|
63
|
+
private onCancel;
|
64
|
+
private onEnd;
|
65
|
+
private onLayout;
|
61
66
|
render(): JSX.Element;
|
62
67
|
}
|