@shopify/react-native-skia 0.1.116 → 0.1.118
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkApi.h +13 -9
- package/cpp/api/JsiSkCanvas.h +9 -1
- package/cpp/api/JsiSkPicture.h +71 -0
- package/cpp/api/JsiSkPictureFactory.h +50 -0
- package/cpp/api/JsiSkPictureRecorder.h +53 -0
- package/lib/commonjs/renderer/Canvas.js +22 -36
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +2 -24
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/components/Drawing.js +31 -0
- package/lib/commonjs/renderer/components/Drawing.js.map +1 -0
- package/lib/commonjs/renderer/components/Group.js +1 -1
- package/lib/commonjs/renderer/components/Group.js.map +1 -1
- package/lib/commonjs/renderer/components/Picture.js +35 -0
- package/lib/commonjs/renderer/components/Picture.js.map +1 -0
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +5 -34
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +19 -8
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -0
- package/lib/commonjs/renderer/components/imageFilters/index.js +4 -17
- package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
- package/lib/commonjs/renderer/components/index.js +26 -0
- package/lib/commonjs/renderer/components/index.js.map +1 -1
- package/lib/commonjs/renderer/components/maskFilters/Blur.js +1 -1
- package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Box.js +126 -0
- package/lib/commonjs/renderer/components/shapes/Box.js.map +1 -0
- package/lib/commonjs/renderer/components/shapes/index.js +13 -0
- package/lib/commonjs/renderer/components/shapes/index.js.map +1 -1
- package/lib/commonjs/renderer/index.js +13 -0
- package/lib/commonjs/renderer/index.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Declaration.js +8 -1
- package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Drawing.js +5 -8
- package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Math.js +19 -1
- package/lib/commonjs/renderer/processors/math/Math.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Matrix3.js +11 -5
- package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
- package/lib/commonjs/renderer/typeddash.js +26 -2
- package/lib/commonjs/renderer/typeddash.js.map +1 -1
- package/lib/commonjs/renderer/useContextBridge.js +35 -0
- package/lib/commonjs/renderer/useContextBridge.js.map +1 -0
- package/lib/commonjs/skia/Canvas.js.map +1 -1
- package/lib/commonjs/skia/Picture/Picture.js +6 -0
- package/lib/commonjs/skia/Picture/Picture.js.map +1 -0
- package/lib/commonjs/skia/Picture/PictureFactory.js +6 -0
- package/lib/commonjs/skia/Picture/PictureFactory.js.map +1 -0
- package/lib/commonjs/skia/Picture/PictureRecorder.js +6 -0
- package/lib/commonjs/skia/Picture/PictureRecorder.js.map +1 -0
- package/lib/commonjs/skia/Picture/index.js +58 -0
- package/lib/commonjs/skia/Picture/index.js.map +1 -0
- package/lib/commonjs/skia/Picture/usePicture.js +30 -0
- package/lib/commonjs/skia/Picture/usePicture.js.map +1 -0
- package/lib/commonjs/skia/Skia.js +2 -0
- package/lib/commonjs/skia/Skia.js.map +1 -1
- package/lib/commonjs/skia/index.js +14 -0
- package/lib/commonjs/skia/index.js.map +1 -1
- package/lib/commonjs/values/hooks/useDerivedValue.js +2 -2
- package/lib/commonjs/values/hooks/useDerivedValue.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +6 -5
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/renderer/Canvas.js +20 -32
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +1 -23
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/components/Drawing.js +17 -0
- package/lib/module/renderer/components/Drawing.js.map +1 -0
- package/lib/module/renderer/components/Group.js +1 -1
- package/lib/module/renderer/components/Group.js.map +1 -1
- package/lib/module/renderer/components/Picture.js +21 -0
- package/lib/module/renderer/components/Picture.js.map +1 -0
- package/lib/module/renderer/components/imageFilters/InnerShadow.js +4 -26
- package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +16 -6
- package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -0
- package/lib/module/renderer/components/imageFilters/index.js +1 -2
- package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
- package/lib/module/renderer/components/index.js +2 -0
- package/lib/module/renderer/components/index.js.map +1 -1
- package/lib/module/renderer/components/maskFilters/Blur.js +1 -1
- package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
- package/lib/module/renderer/components/shapes/Box.js +102 -0
- package/lib/module/renderer/components/shapes/Box.js.map +1 -0
- package/lib/module/renderer/components/shapes/index.js +1 -0
- package/lib/module/renderer/components/shapes/index.js.map +1 -1
- package/lib/module/renderer/index.js +1 -0
- package/lib/module/renderer/index.js.map +1 -1
- package/lib/module/renderer/nodes/Declaration.js +3 -0
- package/lib/module/renderer/nodes/Declaration.js.map +1 -1
- package/lib/module/renderer/nodes/Drawing.js +3 -4
- package/lib/module/renderer/nodes/Drawing.js.map +1 -1
- package/lib/module/renderer/processors/math/Math.js +15 -0
- package/lib/module/renderer/processors/math/Math.js.map +1 -1
- package/lib/module/renderer/processors/math/Matrix3.js +6 -2
- package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
- package/lib/module/renderer/typeddash.js +21 -0
- package/lib/module/renderer/typeddash.js.map +1 -1
- package/lib/module/renderer/useContextBridge.js +21 -0
- package/lib/module/renderer/useContextBridge.js.map +1 -0
- package/lib/module/skia/Canvas.js.map +1 -1
- package/lib/module/skia/Picture/Picture.js +2 -0
- package/lib/module/skia/Picture/Picture.js.map +1 -0
- package/lib/module/skia/Picture/PictureFactory.js +2 -0
- package/lib/module/skia/Picture/PictureFactory.js.map +1 -0
- package/lib/module/skia/Picture/PictureRecorder.js +2 -0
- package/lib/module/skia/Picture/PictureRecorder.js.map +1 -0
- package/lib/module/skia/Picture/index.js +5 -0
- package/lib/module/skia/Picture/index.js.map +1 -0
- package/lib/module/skia/Picture/usePicture.js +19 -0
- package/lib/module/skia/Picture/usePicture.js.map +1 -0
- package/lib/module/skia/Skia.js +2 -0
- package/lib/module/skia/Skia.js.map +1 -1
- package/lib/module/skia/index.js +1 -0
- package/lib/module/skia/index.js.map +1 -1
- package/lib/module/values/hooks/useDerivedValue.js +1 -1
- package/lib/module/values/hooks/useDerivedValue.js.map +1 -1
- package/lib/module/views/SkiaView.js +6 -5
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +5 -10
- package/lib/typescript/src/renderer/components/Drawing.d.ts +7 -0
- package/lib/typescript/src/renderer/components/Picture.d.ts +6 -0
- package/lib/typescript/src/renderer/components/imageFilters/InnerShadow.d.ts +3 -12
- package/lib/typescript/src/renderer/components/imageFilters/{DropShadow.d.ts → Shadow.d.ts} +3 -2
- package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -2
- package/lib/typescript/src/renderer/components/index.d.ts +2 -0
- package/lib/typescript/src/renderer/components/shapes/Box.d.ts +23 -0
- package/lib/typescript/src/renderer/components/shapes/index.d.ts +1 -0
- package/lib/typescript/src/renderer/index.d.ts +1 -0
- package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -0
- package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
- package/lib/typescript/src/renderer/processors/math/Math.d.ts +14 -0
- package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -0
- package/lib/typescript/src/renderer/typeddash.d.ts +1 -0
- package/lib/typescript/src/renderer/useContextBridge.d.ts +5 -0
- package/lib/typescript/src/skia/Canvas.d.ts +6 -0
- package/lib/typescript/src/skia/Picture/Picture.d.ts +26 -0
- package/lib/typescript/src/skia/Picture/PictureFactory.d.ts +8 -0
- package/lib/typescript/src/skia/Picture/PictureRecorder.d.ts +15 -0
- package/lib/typescript/src/skia/Picture/index.d.ts +4 -0
- package/lib/typescript/src/skia/Picture/usePicture.d.ts +11 -0
- package/lib/typescript/src/skia/Skia.d.ts +5 -0
- package/lib/typescript/src/skia/index.d.ts +1 -0
- package/lib/typescript/src/views/SkiaView.d.ts +25 -1
- package/lib/typescript/src/views/types.d.ts +0 -24
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/src/renderer/Canvas.tsx +14 -30
- package/src/renderer/HostConfig.ts +1 -19
- package/src/renderer/components/Drawing.tsx +16 -0
- package/src/renderer/components/Group.tsx +1 -1
- package/src/renderer/components/Picture.tsx +17 -0
- package/src/renderer/components/imageFilters/InnerShadow.tsx +33 -47
- package/src/renderer/components/imageFilters/Shadow.tsx +39 -0
- package/src/renderer/components/imageFilters/index.ts +1 -2
- package/src/renderer/components/index.ts +2 -0
- package/src/renderer/components/maskFilters/Blur.tsx +1 -1
- package/src/renderer/components/shapes/Box.tsx +98 -0
- package/src/renderer/components/shapes/index.ts +1 -0
- package/src/renderer/index.ts +1 -0
- package/src/renderer/nodes/Declaration.tsx +10 -0
- package/src/renderer/nodes/Drawing.tsx +6 -6
- package/src/renderer/processors/math/Math.ts +16 -0
- package/src/renderer/processors/math/Matrix3.ts +35 -31
- package/src/renderer/typeddash.ts +18 -0
- package/src/renderer/useContextBridge.tsx +21 -0
- package/src/skia/Canvas.ts +7 -0
- package/src/skia/Picture/Picture.ts +34 -0
- package/src/skia/Picture/PictureFactory.ts +9 -0
- package/src/skia/Picture/PictureRecorder.ts +18 -0
- package/src/skia/Picture/index.ts +4 -0
- package/src/skia/Picture/usePicture.ts +28 -0
- package/src/skia/Skia.ts +5 -0
- package/src/skia/index.ts +1 -0
- package/src/values/hooks/useDerivedValue.ts +1 -1
- package/src/views/SkiaView.tsx +27 -3
- package/src/views/types.ts +0 -25
- package/lib/commonjs/renderer/components/imageFilters/DropShadow.js.map +0 -1
- package/lib/module/renderer/components/imageFilters/DropShadow.js.map +0 -1
- package/src/renderer/components/imageFilters/DropShadow.tsx +0 -31
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Picture = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
var _Drawing = require("../nodes/Drawing");
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
15
|
+
|
16
|
+
const onDraw = (0, _Drawing.createDrawing)((ctx, _ref) => {
|
17
|
+
let {
|
18
|
+
picture
|
19
|
+
} = _ref;
|
20
|
+
const {
|
21
|
+
canvas
|
22
|
+
} = ctx;
|
23
|
+
canvas.drawPicture(picture);
|
24
|
+
});
|
25
|
+
|
26
|
+
const Picture = props => {
|
27
|
+
return /*#__PURE__*/_react.default.createElement("skDrawing", _extends({
|
28
|
+
onDraw: onDraw
|
29
|
+
}, props, {
|
30
|
+
skipProcessing: true
|
31
|
+
}));
|
32
|
+
};
|
33
|
+
|
34
|
+
exports.Picture = Picture;
|
35
|
+
//# sourceMappingURL=Picture.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["Picture.tsx"],"names":["onDraw","ctx","picture","canvas","drawPicture","Picture","props"],"mappings":";;;;;;;AAAA;;AAGA;;;;;;AAMA,MAAMA,MAAM,GAAG,4BAA4B,CAACC,GAAD,WAAsB;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAaF,GAAnB;AACAE,EAAAA,MAAM,CAACC,WAAP,CAAmBF,OAAnB;AACD,CAHc,CAAf;;AAKO,MAAMG,OAAO,GAAIC,KAAD,IAAyB;AAC9C,sBAAO;AAAW,IAAA,MAAM,EAAEN;AAAnB,KAA+BM,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport type { SkPicture } from \"../../skia\";\nimport { createDrawing } from \"../nodes/Drawing\";\n\nexport interface PictureProps {\n picture: SkPicture;\n}\n\nconst onDraw = createDrawing<PictureProps>((ctx, { picture }) => {\n const { canvas } = ctx;\n canvas.drawPicture(picture);\n});\n\nexport const Picture = (props: PictureProps) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
|
@@ -3,43 +3,20 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
6
|
+
exports.MakeInnerShadow = void 0;
|
9
7
|
|
10
8
|
var _skia = require("../../../skia");
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
var _getInput = require("./getInput");
|
15
|
-
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
19
|
-
|
20
|
-
const onDeclare = (0, _Declaration.createDeclaration)((_ref, children, _ref2) => {
|
21
|
-
let {
|
22
|
-
dx,
|
23
|
-
dy,
|
24
|
-
blur,
|
25
|
-
color,
|
26
|
-
shadowOnly
|
27
|
-
} = _ref;
|
28
|
-
let {
|
29
|
-
opacity
|
30
|
-
} = _ref2;
|
31
|
-
const input = (0, _getInput.getInput)(children);
|
32
|
-
const cl = (0, _skia.processColor)(color, opacity);
|
33
|
-
|
10
|
+
const MakeInnerShadow = (shadowOnly, dx, dy, sigmaX, sigmaY, color, input) => {
|
34
11
|
const sourceGraphic = _skia.Skia.ImageFilter.MakeColorFilter(_skia.Skia.ColorFilter.MakeBlend(0xff000000, _skia.BlendMode.Dst), null);
|
35
12
|
|
36
13
|
const sourceAlpha = _skia.Skia.ImageFilter.MakeColorFilter(_skia.Skia.ColorFilter.MakeBlend(0xff000000, _skia.BlendMode.SrcIn), null);
|
37
14
|
|
38
|
-
const f1 = _skia.Skia.ImageFilter.MakeColorFilter(_skia.Skia.ColorFilter.MakeBlend(
|
15
|
+
const f1 = _skia.Skia.ImageFilter.MakeColorFilter(_skia.Skia.ColorFilter.MakeBlend(color, _skia.BlendMode.SrcOut), null);
|
39
16
|
|
40
17
|
const f2 = _skia.Skia.ImageFilter.MakeOffset(dx, dy, f1);
|
41
18
|
|
42
|
-
const f3 = _skia.Skia.ImageFilter.MakeBlur(
|
19
|
+
const f3 = _skia.Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, _skia.TileMode.Decal, f2);
|
43
20
|
|
44
21
|
const f4 = _skia.Skia.ImageFilter.MakeBlend(_skia.BlendMode.SrcIn, sourceAlpha, f3);
|
45
22
|
|
@@ -48,13 +25,7 @@ const onDeclare = (0, _Declaration.createDeclaration)((_ref, children, _ref2) =>
|
|
48
25
|
}
|
49
26
|
|
50
27
|
return _skia.Skia.ImageFilter.MakeCompose(input, _skia.Skia.ImageFilter.MakeBlend(_skia.BlendMode.SrcOver, sourceGraphic, f4));
|
51
|
-
});
|
52
|
-
|
53
|
-
const InnerShadow = props => {
|
54
|
-
return /*#__PURE__*/_react.default.createElement("skDeclaration", _extends({
|
55
|
-
onDeclare: onDeclare
|
56
|
-
}, props));
|
57
28
|
};
|
58
29
|
|
59
|
-
exports.
|
30
|
+
exports.MakeInnerShadow = MakeInnerShadow;
|
60
31
|
//# sourceMappingURL=InnerShadow.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["InnerShadow.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["InnerShadow.tsx"],"names":["MakeInnerShadow","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","Skia","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","BlendMode","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","TileMode","Decal","f4","MakeCompose","SrcOver"],"mappings":";;;;;;;AACA;;AAGO,MAAMA,eAAe,GAAG,CAC7BC,UAD6B,EAE7BC,EAF6B,EAG7BC,EAH6B,EAI7BC,MAJ6B,EAK7BC,MAL6B,EAM7BC,KAN6B,EAO7BC,KAP6B,KAQ1B;AACH,QAAMC,aAAa,GAAGC,WAAKC,WAAL,CAAiBC,eAAjB,CACpBF,WAAKG,WAAL,CAAiBC,SAAjB,CAA2B,UAA3B,EAAuCC,gBAAUC,GAAjD,CADoB,EAEpB,IAFoB,CAAtB;;AAIA,QAAMC,WAAW,GAAGP,WAAKC,WAAL,CAAiBC,eAAjB,CAClBF,WAAKG,WAAL,CAAiBC,SAAjB,CAA2B,UAA3B,EAAuCC,gBAAUG,KAAjD,CADkB,EAElB,IAFkB,CAApB;;AAIA,QAAMC,EAAE,GAAGT,WAAKC,WAAL,CAAiBC,eAAjB,CACTF,WAAKG,WAAL,CAAiBC,SAAjB,CAA2BP,KAA3B,EAAkCQ,gBAAUK,MAA5C,CADS,EAET,IAFS,CAAX;;AAIA,QAAMC,EAAE,GAAGX,WAAKC,WAAL,CAAiBW,UAAjB,CAA4BnB,EAA5B,EAAgCC,EAAhC,EAAoCe,EAApC,CAAX;;AACA,QAAMI,EAAE,GAAGb,WAAKC,WAAL,CAAiBa,QAAjB,CAA0BnB,MAA1B,EAAkCC,MAAlC,EAA0CmB,eAASC,KAAnD,EAA0DL,EAA1D,CAAX;;AACA,QAAMM,EAAE,GAAGjB,WAAKC,WAAL,CAAiBG,SAAjB,CAA2BC,gBAAUG,KAArC,EAA4CD,WAA5C,EAAyDM,EAAzD,CAAX;;AACA,MAAIrB,UAAJ,EAAgB;AACd,WAAOyB,EAAP;AACD;;AACD,SAAOjB,WAAKC,WAAL,CAAiBiB,WAAjB,CACLpB,KADK,EAELE,WAAKC,WAAL,CAAiBG,SAAjB,CAA2BC,gBAAUc,OAArC,EAA8CpB,aAA9C,EAA6DkB,EAA7D,CAFK,CAAP;AAID,CA/BM","sourcesContent":["import type { SkColor } from \"../../../skia\";\nimport { BlendMode, Skia, TileMode } from \"../../../skia\";\nimport type { SkImageFilter } from \"../../../skia/ImageFilter/ImageFilter\";\n\nexport const MakeInnerShadow = (\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n"]}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.Shadow = void 0;
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
@@ -15,6 +15,8 @@ var _Color = require("../../../skia/Color");
|
|
15
15
|
|
16
16
|
var _getInput = require("./getInput");
|
17
17
|
|
18
|
+
var _InnerShadow = require("./InnerShadow");
|
19
|
+
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
21
|
|
20
22
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
@@ -24,22 +26,31 @@ const onDeclare = (0, _Declaration.createDeclaration)((_ref, children, _ref2) =>
|
|
24
26
|
dx,
|
25
27
|
dy,
|
26
28
|
blur,
|
27
|
-
color,
|
28
|
-
shadowOnly
|
29
|
+
color: cl,
|
30
|
+
shadowOnly,
|
31
|
+
inner
|
29
32
|
} = _ref;
|
30
33
|
let {
|
31
34
|
opacity
|
32
35
|
} = _ref2;
|
33
36
|
const input = (0, _getInput.getInput)(children);
|
34
|
-
const
|
35
|
-
|
37
|
+
const color = (0, _Color.processColor)(cl, opacity);
|
38
|
+
let factory;
|
39
|
+
|
40
|
+
if (inner) {
|
41
|
+
factory = _InnerShadow.MakeInnerShadow.bind(null, shadowOnly);
|
42
|
+
} else {
|
43
|
+
factory = shadowOnly ? _skia.Skia.ImageFilter.MakeDropShadowOnly : _skia.Skia.ImageFilter.MakeDropShadow;
|
44
|
+
}
|
45
|
+
|
46
|
+
return factory(dx, dy, blur, blur, color, input);
|
36
47
|
});
|
37
48
|
|
38
|
-
const
|
49
|
+
const Shadow = props => {
|
39
50
|
return /*#__PURE__*/_react.default.createElement("skDeclaration", _extends({
|
40
51
|
onDeclare: onDeclare
|
41
52
|
}, props));
|
42
53
|
};
|
43
54
|
|
44
|
-
exports.
|
45
|
-
//# sourceMappingURL=
|
55
|
+
exports.Shadow = Shadow;
|
56
|
+
//# sourceMappingURL=Shadow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["Shadow.tsx"],"names":["onDeclare","children","dx","dy","blur","color","cl","shadowOnly","inner","opacity","input","factory","MakeInnerShadow","bind","Skia","ImageFilter","MakeDropShadowOnly","MakeDropShadow","Shadow","props"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAGA;;AAEA;;AACA;;;;;;AAWA,MAAMA,SAAS,GAAG,oCAChB,OAAiDC,QAAjD,YAA2E;AAAA,MAA1E;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAK,EAAEC,EAAvB;AAA2BC,IAAAA,UAA3B;AAAuCC,IAAAA;AAAvC,GAA0E;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AACzE,QAAMC,KAAK,GAAG,wBAAST,QAAT,CAAd;AACA,QAAMI,KAAK,GAAG,yBAAaC,EAAb,EAAiBG,OAAjB,CAAd;AACA,MAAIE,OAAJ;;AACA,MAAIH,KAAJ,EAAW;AACTG,IAAAA,OAAO,GAAGC,6BAAgBC,IAAhB,CAAqB,IAArB,EAA2BN,UAA3B,CAAV;AACD,GAFD,MAEO;AACLI,IAAAA,OAAO,GAAGJ,UAAU,GAChBO,WAAKC,WAAL,CAAiBC,kBADD,GAEhBF,WAAKC,WAAL,CAAiBE,cAFrB;AAGD;;AACD,SAAON,OAAO,CAACT,EAAD,EAAKC,EAAL,EAASC,IAAT,EAAeA,IAAf,EAAqBC,KAArB,EAA4BK,KAA5B,CAAd;AACD,CAbe,CAAlB;;AAgBO,MAAMQ,MAAM,GAAIC,KAAD,IAAuC;AAC3D,sBAAO;AAAe,IAAA,SAAS,EAAEnB;AAA1B,KAAyCmB,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { Color } from \"../../../skia/Color\";\nimport { processColor } from \"../../../skia/Color\";\n\nimport { getInput } from \"./getInput\";\nimport { MakeInnerShadow } from \"./InnerShadow\";\n\nexport interface ShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n inner?: boolean;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<ShadowProps>(\n ({ dx, dy, blur, color: cl, shadowOnly, inner }, children, { opacity }) => {\n const input = getInput(children);\n const color = processColor(cl, opacity);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, shadowOnly);\n } else {\n factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly\n : Skia.ImageFilter.MakeDropShadow;\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n);\n\nexport const Shadow = (props: AnimatedProps<ShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
|
@@ -43,28 +43,15 @@ Object.keys(_DisplacementMap).forEach(function (key) {
|
|
43
43
|
});
|
44
44
|
});
|
45
45
|
|
46
|
-
var
|
46
|
+
var _Shadow = require("./Shadow");
|
47
47
|
|
48
|
-
Object.keys(
|
48
|
+
Object.keys(_Shadow).forEach(function (key) {
|
49
49
|
if (key === "default" || key === "__esModule") return;
|
50
|
-
if (key in exports && exports[key] ===
|
50
|
+
if (key in exports && exports[key] === _Shadow[key]) return;
|
51
51
|
Object.defineProperty(exports, key, {
|
52
52
|
enumerable: true,
|
53
53
|
get: function () {
|
54
|
-
return
|
55
|
-
}
|
56
|
-
});
|
57
|
-
});
|
58
|
-
|
59
|
-
var _InnerShadow = require("./InnerShadow");
|
60
|
-
|
61
|
-
Object.keys(_InnerShadow).forEach(function (key) {
|
62
|
-
if (key === "default" || key === "__esModule") return;
|
63
|
-
if (key in exports && exports[key] === _InnerShadow[key]) return;
|
64
|
-
Object.defineProperty(exports, key, {
|
65
|
-
enumerable: true,
|
66
|
-
get: function () {
|
67
|
-
return _InnerShadow[key];
|
54
|
+
return _Shadow[key];
|
68
55
|
}
|
69
56
|
});
|
70
57
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./Blur\";\nexport * from \"./Offset\";\nexport * from \"./DisplacementMap\";\nexport * from \"./Shadow\";\nexport * from \"./Morphology\";\n"]}
|
@@ -134,6 +134,19 @@ Object.keys(_processors).forEach(function (key) {
|
|
134
134
|
});
|
135
135
|
});
|
136
136
|
|
137
|
+
var _Picture = require("./Picture");
|
138
|
+
|
139
|
+
Object.keys(_Picture).forEach(function (key) {
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
141
|
+
if (key in exports && exports[key] === _Picture[key]) return;
|
142
|
+
Object.defineProperty(exports, key, {
|
143
|
+
enumerable: true,
|
144
|
+
get: function () {
|
145
|
+
return _Picture[key];
|
146
|
+
}
|
147
|
+
});
|
148
|
+
});
|
149
|
+
|
137
150
|
var _Group = require("./Group");
|
138
151
|
|
139
152
|
Object.keys(_Group).forEach(function (key) {
|
@@ -211,4 +224,17 @@ Object.keys(_Defs).forEach(function (key) {
|
|
211
224
|
}
|
212
225
|
});
|
213
226
|
});
|
227
|
+
|
228
|
+
var _Drawing = require("./Drawing");
|
229
|
+
|
230
|
+
Object.keys(_Drawing).forEach(function (key) {
|
231
|
+
if (key === "default" || key === "__esModule") return;
|
232
|
+
if (key in exports && exports[key] === _Drawing[key]) return;
|
233
|
+
Object.defineProperty(exports, key, {
|
234
|
+
enumerable: true,
|
235
|
+
get: function () {
|
236
|
+
return _Drawing[key];
|
237
|
+
}
|
238
|
+
});
|
239
|
+
});
|
214
240
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./shapes\";\nexport * from \"./backdrop\";\nexport * from \"./image\";\nexport * from \"./shaders\";\nexport * from \"./text\";\nexport * from \"./colorFilters\";\nexport * from \"./maskFilters\";\nexport * from \"./imageFilters\";\nexport * from \"./pathEffects\";\nexport * from \"../processors\";\n\nexport * from \"./Group\";\nexport * from \"./Mask\";\nexport * from \"./Paint\";\nexport * from \"./Compose\";\nexport * from \"./Blend\";\nexport * from \"./Defs\";\n"]}
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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shaders\";\nexport * from \"./text\";\nexport * from \"./colorFilters\";\nexport * from \"./maskFilters\";\nexport * from \"./imageFilters\";\nexport * from \"./pathEffects\";\nexport * from \"../processors\";\nexport * from \"./Picture\";\n\nexport * from \"./Group\";\nexport * from \"./Mask\";\nexport * from \"./Paint\";\nexport * from \"./Compose\";\nexport * from \"./Blend\";\nexport * from \"./Defs\";\nexport * from \"./Drawing\";\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Blur.tsx"],"names":["onDeclare","style","blur","respectCTM","Skia","MaskFilter","MakeBlur","BlurStyle","BlurMask","props","defaultProps"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEA;;;;;;AASA,MAAMA,SAAS,GAAG,oCAChB,QAAiC;AAAA,MAAhC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA;AAAf,GAAgC;AAC/B,SAAOC,WAAKC,UAAL,CAAgBC,QAAhB,CACLC,sBAAU,yBAAQN,KAAR,CAAV,CADK,EAELC,IAFK,EAGLC,UAHK,CAAP;AAKD,CAPe,CAAlB;;AAUO,MAAMK,QAAQ,GAAIC,KAAD,IAAyC;AAC/D,sBAAO;AAAe,IAAA,SAAS,EAAET;AAA1B,KAAyCS,KAAzC,EAAP;AACD,CAFM;;;AAIPD,QAAQ,CAACE,YAAT,GAAwB;AACtBT,EAAAA,KAAK,EAAE,QADe;AAEtBE,EAAAA,UAAU,EAAE;AAFU,CAAxB","sourcesContent":["import React from \"react\";\n\nimport { BlurStyle } from \"../../../skia/MaskFilter\";\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { SkEnum } from \"../../processors\";\nimport { enumKey } from \"../../processors\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\n\nexport interface BlurMaskProps {\n style: SkEnum<typeof BlurStyle>;\n blur: number;\n respectCTM: boolean;\n}\n\nconst onDeclare = createDeclaration<BlurMaskProps>(\n ({ style, blur, respectCTM }) => {\n return Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n }\n);\n\nexport const BlurMask = (props: AnimatedProps<BlurMaskProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nBlurMask.defaultProps = {\n style: \"normal\",\n respectCTM:
|
1
|
+
{"version":3,"sources":["Blur.tsx"],"names":["onDeclare","style","blur","respectCTM","Skia","MaskFilter","MakeBlur","BlurStyle","BlurMask","props","defaultProps"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEA;;;;;;AASA,MAAMA,SAAS,GAAG,oCAChB,QAAiC;AAAA,MAAhC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA;AAAf,GAAgC;AAC/B,SAAOC,WAAKC,UAAL,CAAgBC,QAAhB,CACLC,sBAAU,yBAAQN,KAAR,CAAV,CADK,EAELC,IAFK,EAGLC,UAHK,CAAP;AAKD,CAPe,CAAlB;;AAUO,MAAMK,QAAQ,GAAIC,KAAD,IAAyC;AAC/D,sBAAO;AAAe,IAAA,SAAS,EAAET;AAA1B,KAAyCS,KAAzC,EAAP;AACD,CAFM;;;AAIPD,QAAQ,CAACE,YAAT,GAAwB;AACtBT,EAAAA,KAAK,EAAE,QADe;AAEtBE,EAAAA,UAAU,EAAE;AAFU,CAAxB","sourcesContent":["import React from \"react\";\n\nimport { BlurStyle } from \"../../../skia/MaskFilter\";\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { SkEnum } from \"../../processors\";\nimport { enumKey } from \"../../processors\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\n\nexport interface BlurMaskProps {\n style: SkEnum<typeof BlurStyle>;\n blur: number;\n respectCTM: boolean;\n}\n\nconst onDeclare = createDeclaration<BlurMaskProps>(\n ({ style, blur, respectCTM }) => {\n return Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n }\n);\n\nexport const BlurMask = (props: AnimatedProps<BlurMaskProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nBlurMask.defaultProps = {\n style: \"normal\",\n respectCTM: true,\n};\n"]}
|
@@ -0,0 +1,126 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.BoxShadow = exports.Box = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
var _skia = require("../../../skia");
|
11
|
+
|
12
|
+
var _nodes = require("../../nodes");
|
13
|
+
|
14
|
+
var _processors = require("../../processors");
|
15
|
+
|
16
|
+
var _Rects = require("../../processors/Rects");
|
17
|
+
|
18
|
+
var _Declaration = require("../../nodes/Declaration");
|
19
|
+
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
+
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23
|
+
|
24
|
+
const inflate = function (box, dx, dy) {
|
25
|
+
let tx = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
26
|
+
let ty = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
27
|
+
return (0, _processors.rrect)((0, _Rects.rect)(box.rect.x - dx + tx, box.rect.y - dy + ty, box.rect.width + 2 * dx, box.rect.height + 2 * dy), box.rx + dx, box.ry + dy);
|
28
|
+
};
|
29
|
+
|
30
|
+
const deflate = function (box, dx, dy) {
|
31
|
+
let tx = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
32
|
+
let ty = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
33
|
+
return inflate(box, -dx, -dy, tx, ty);
|
34
|
+
};
|
35
|
+
|
36
|
+
const onDeclare = (0, _Declaration.createDeclaration)(_ref => {
|
37
|
+
let {
|
38
|
+
dx,
|
39
|
+
dy,
|
40
|
+
spread,
|
41
|
+
blur,
|
42
|
+
color,
|
43
|
+
inner
|
44
|
+
} = _ref;
|
45
|
+
return {
|
46
|
+
dx,
|
47
|
+
dy,
|
48
|
+
spread,
|
49
|
+
blur,
|
50
|
+
color,
|
51
|
+
inner,
|
52
|
+
__typename__: "BoxShadow"
|
53
|
+
};
|
54
|
+
});
|
55
|
+
|
56
|
+
const BoxShadow = props => {
|
57
|
+
return /*#__PURE__*/_react.default.createElement("skDeclaration", _extends({
|
58
|
+
onDeclare: onDeclare
|
59
|
+
}, props));
|
60
|
+
};
|
61
|
+
|
62
|
+
exports.BoxShadow = BoxShadow;
|
63
|
+
|
64
|
+
const isBoxShadow = s => s.__typename__ === "BoxShadow";
|
65
|
+
|
66
|
+
const onDraw = (0, _nodes.createDrawing)((ctx, _ref2, node) => {
|
67
|
+
let {
|
68
|
+
box: defaultBox
|
69
|
+
} = _ref2;
|
70
|
+
const box = (0, _Rects.isRRect)(defaultBox) ? defaultBox : (0, _processors.rrect)(defaultBox, 0, 0);
|
71
|
+
const {
|
72
|
+
canvas,
|
73
|
+
paint,
|
74
|
+
opacity
|
75
|
+
} = ctx;
|
76
|
+
const shadows = node.visit(ctx).filter(isBoxShadow);
|
77
|
+
shadows.filter(shadow => !shadow.inner).map(shadow => {
|
78
|
+
const {
|
79
|
+
color = "black",
|
80
|
+
blur,
|
81
|
+
spread = 0,
|
82
|
+
dx = 0,
|
83
|
+
dy = 0
|
84
|
+
} = shadow;
|
85
|
+
|
86
|
+
const lPaint = _skia.Skia.Paint();
|
87
|
+
|
88
|
+
lPaint.setColor((0, _skia.processColor)(color, opacity));
|
89
|
+
lPaint.setMaskFilter(_skia.Skia.MaskFilter.MakeBlur(_skia.BlurStyle.Normal, blur, true));
|
90
|
+
canvas.drawRRect(inflate(box, spread, spread, dx, dy), lPaint);
|
91
|
+
});
|
92
|
+
canvas.drawRRect(box, paint);
|
93
|
+
shadows.filter(shadow => shadow.inner).map(shadow => {
|
94
|
+
const {
|
95
|
+
color = "black",
|
96
|
+
blur,
|
97
|
+
spread = 0,
|
98
|
+
dx = 0,
|
99
|
+
dy = 0
|
100
|
+
} = shadow;
|
101
|
+
const delta = (0, _processors.add)((0, _processors.vec)(10, 10), (0, _processors.vec)(Math.abs(dx), Math.abs(dy)));
|
102
|
+
canvas.save();
|
103
|
+
canvas.clipRRect(box, _skia.ClipOp.Intersect, false);
|
104
|
+
|
105
|
+
const lPaint = _skia.Skia.Paint();
|
106
|
+
|
107
|
+
lPaint.setColor((0, _skia.processColor)(color, opacity));
|
108
|
+
lPaint.setMaskFilter(_skia.Skia.MaskFilter.MakeBlur(_skia.BlurStyle.Normal, blur, true));
|
109
|
+
const inner = deflate(box, spread, spread, dx, dy);
|
110
|
+
const outer = inflate(box, delta.x, delta.y);
|
111
|
+
canvas.drawDRRect(outer, inner, lPaint);
|
112
|
+
canvas.restore();
|
113
|
+
});
|
114
|
+
});
|
115
|
+
|
116
|
+
const Box = props => {
|
117
|
+
return /*#__PURE__*/_react.default.createElement("skDrawing", _extends({
|
118
|
+
onDraw: onDraw
|
119
|
+
}, props));
|
120
|
+
};
|
121
|
+
|
122
|
+
exports.Box = Box;
|
123
|
+
Box.defaultProps = {
|
124
|
+
shadows: []
|
125
|
+
};
|
126
|
+
//# sourceMappingURL=Box.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["Box.tsx"],"names":["inflate","box","dx","dy","tx","ty","rect","x","y","width","height","rx","ry","deflate","onDeclare","spread","blur","color","inner","__typename__","BoxShadow","props","isBoxShadow","s","onDraw","ctx","node","defaultBox","canvas","paint","opacity","shadows","visit","filter","shadow","map","lPaint","Skia","Paint","setColor","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","delta","Math","abs","save","clipRRect","ClipOp","Intersect","out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ArB;AACAoB,IAAAA,MAAM,CAAC0B,UAAP,CAAkBD,KAAlB,EAAyBnC,KAAzB,EAAgCkB,MAAhC;AACAR,IAAAA,MAAM,CAAC2B,OAAP;AACD,GAhBH;AAiBD,CAlCc,CAAf;;AAoCO,MAAMC,GAAG,GAAInC,KAAD,IAAoC;AACrD,sBAAO;AAAW,IAAA,MAAM,EAAEG;AAAnB,KAA+BH,KAA/B,EAAP;AACD,CAFM;;;AAIPmC,GAAG,CAACC,YAAJ,GAAmB;AACjB1B,EAAAA,OAAO,EAAE;AADQ,CAAnB","sourcesContent":["import React from \"react\";\n\nimport type { Color, SkRRect } from \"../../../skia\";\nimport { ClipOp, BlurStyle, Skia, processColor } from \"../../../skia\";\nimport { createDrawing } from \"../../nodes\";\nimport type { AnimatedProps, CustomPaintProps } from \"../../processors\";\nimport { add, vec, rrect } from \"../../processors\";\nimport { rect, isRRect } from \"../../processors/Rects\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { SkJSIInstance } from \"../../../skia/JsiInstance\";\nimport type { SkRect } from \"../../../skia/Rect\";\n\nconst inflate = (box: SkRRect, dx: number, dy: number, tx = 0, ty = 0) =>\n rrect(\n rect(\n box.rect.x - dx + tx,\n box.rect.y - dy + ty,\n box.rect.width + 2 * dx,\n box.rect.height + 2 * dy\n ),\n box.rx + dx,\n box.ry + dy\n );\n\nconst deflate = (box: SkRRect, dx: number, dy: number, tx = 0, ty = 0) =>\n inflate(box, -dx, -dy, tx, ty);\n\ninterface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n\ninterface BoxShadowDecl extends BoxShadowProps, SkJSIInstance<\"BoxShadow\"> {}\n\nconst onDeclare = createDeclaration<BoxShadowProps>(\n ({ dx, dy, spread, blur, color, inner }) => {\n return { dx, dy, spread, blur, color, inner, __typename__: \"BoxShadow\" };\n }\n);\n\nexport const BoxShadow = (props: AnimatedProps<BoxShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nconst isBoxShadow = (s: SkJSIInstance<string>): s is BoxShadowDecl =>\n s.__typename__ === \"BoxShadow\";\n\ninterface BoxProps extends CustomPaintProps {\n box: SkRRect | SkRect;\n}\n\nconst onDraw = createDrawing<BoxProps>((ctx, { box: defaultBox }, node) => {\n const box = isRRect(defaultBox) ? defaultBox : rrect(defaultBox, 0, 0);\n const { canvas, paint, opacity } = ctx;\n const shadows = node.visit(ctx).filter<BoxShadowDecl>(isBoxShadow);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(processColor(color, opacity));\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(inflate(box, spread, spread, dx, dy), lPaint);\n });\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = add(vec(10, 10), vec(Math.abs(dx), Math.abs(dy)));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = Skia.Paint();\n lPaint.setColor(processColor(color, opacity));\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(box, spread, spread, dx, dy);\n const outer = inflate(box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n});\n\nexport const Box = (props: AnimatedProps<BoxProps>) => {\n return <skDrawing onDraw={onDraw} {...props} />;\n};\n\nBox.defaultProps = {\n shadows: [],\n};\n"]}
|
@@ -159,4 +159,17 @@ Object.keys(_FitBox).forEach(function (key) {
|
|
159
159
|
}
|
160
160
|
});
|
161
161
|
});
|
162
|
+
|
163
|
+
var _Box = require("./Box");
|
164
|
+
|
165
|
+
Object.keys(_Box).forEach(function (key) {
|
166
|
+
if (key === "default" || key === "__esModule") return;
|
167
|
+
if (key in exports && exports[key] === _Box[key]) return;
|
168
|
+
Object.defineProperty(exports, key, {
|
169
|
+
enumerable: true,
|
170
|
+
get: function () {
|
171
|
+
return _Box[key];
|
172
|
+
}
|
173
|
+
});
|
174
|
+
});
|
162
175
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./Circle\";\nexport * from \"./Rect\";\nexport * from \"./RoundedRect\";\nexport * from \"./DiffRect\";\nexport * from \"./Line\";\nexport * from \"./Path\";\nexport * from \"./Oval\";\nexport * from \"./Points\";\nexport * from \"./Patch\";\nexport * from \"./Vertices\";\nexport * from \"./Fill\";\nexport * from \"./FitBox\";\n"]}
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./Circle\";\nexport * from \"./Rect\";\nexport * from \"./RoundedRect\";\nexport * from \"./DiffRect\";\nexport * from \"./Line\";\nexport * from \"./Path\";\nexport * from \"./Oval\";\nexport * from \"./Points\";\nexport * from \"./Patch\";\nexport * from \"./Vertices\";\nexport * from \"./Fill\";\nexport * from \"./FitBox\";\nexport * from \"./Box\";\n"]}
|
@@ -42,4 +42,17 @@ Object.keys(_nodes).forEach(function (key) {
|
|
42
42
|
}
|
43
43
|
});
|
44
44
|
});
|
45
|
+
|
46
|
+
var _useContextBridge = require("./useContextBridge");
|
47
|
+
|
48
|
+
Object.keys(_useContextBridge).forEach(function (key) {
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
50
|
+
if (key in exports && exports[key] === _useContextBridge[key]) return;
|
51
|
+
Object.defineProperty(exports, key, {
|
52
|
+
enumerable: true,
|
53
|
+
get: function () {
|
54
|
+
return _useContextBridge[key];
|
55
|
+
}
|
56
|
+
});
|
57
|
+
});
|
45
58
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./Canvas\";\nexport * from \"./components\";\nexport * from \"./nodes\";\n"]}
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./Canvas\";\nexport * from \"./components\";\nexport * from \"./nodes\";\nexport * from \"./useContextBridge\";\n"]}
|
@@ -3,7 +3,9 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.createDeclaration = exports.DeclarationNode = void 0;
|
6
|
+
exports.useDeclaration = exports.createDeclaration = exports.DeclarationNode = void 0;
|
7
|
+
|
8
|
+
var _react = require("react");
|
7
9
|
|
8
10
|
var _processors = require("../processors");
|
9
11
|
|
@@ -15,6 +17,11 @@ const createDeclaration = cb => cb;
|
|
15
17
|
|
16
18
|
exports.createDeclaration = createDeclaration;
|
17
19
|
|
20
|
+
const useDeclaration = (cb, deps) => // eslint-disable-next-line react-hooks/exhaustive-deps
|
21
|
+
(0, _react.useCallback)(cb, deps !== null && deps !== void 0 ? deps : []);
|
22
|
+
|
23
|
+
exports.useDeclaration = useDeclaration;
|
24
|
+
|
18
25
|
class DeclarationNode extends _Node.Node {
|
19
26
|
constructor(depMgr, onDeclare, props) {
|
20
27
|
super(depMgr, props);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Declaration.tsx"],"names":["createDeclaration","cb","DeclarationNode","Node","constructor","depMgr","onDeclare","props","memoizable","_props","draw","ctx","children","visit","obj"],"mappings":";;;;;;;
|
1
|
+
{"version":3,"sources":["Declaration.tsx"],"names":["createDeclaration","cb","useDeclaration","deps","DeclarationNode","Node","constructor","depMgr","onDeclare","props","memoizable","_props","draw","ctx","children","visit","obj"],"mappings":";;;;;;;AACA;;AAKA;;AAGA;;;;AAUO,MAAMA,iBAAiB,GAC5BC,EAD+B,IAEJA,EAFtB;;;;AAIA,MAAMC,cAAc,GAAG,CAC5BD,EAD4B,EAE5BE,IAF4B,KAI5B;AACA,wBAAYF,EAAZ,EAAgBE,IAAhB,aAAgBA,IAAhB,cAAgBA,IAAhB,GAAwB,EAAxB,CALK;;;;AAWA,MAAMC,eAAN,SAAiCC,UAAjC,CAAyC;AAG9CC,EAAAA,WAAW,CACTC,MADS,EAETC,SAFS,EAGTC,KAHS,EAIT;AACA,UAAMF,MAAN,EAAcE,KAAd;;AADA;;AAEA,UAAMC,UAAN,GAAmB,CAAC,4BAAWD,KAAX,CAApB;AACA,SAAKD,SAAL,GAAiBA,SAAjB;AACD;;AAEQ,MAALC,KAAK,CAACA,KAAD,EAA0B;AACjC,SAAKC,UAAL,GAAkB,CAAC,4BAAWD,KAAX,CAAnB;AACA,UAAMA,KAAN,GAAcA,KAAd;AACD;;AAEQ,MAALA,KAAK,GAAG;AACV,WAAO,KAAKE,MAAZ;AACD;;AAEDC,EAAAA,IAAI,CAACC,GAAD,EAAsB;AACxB,UAAMC,QAAQ,GAAG,KAAKC,KAAL,CAAWF,GAAX,CAAjB;AACA,UAAMJ,KAAK,GAAG,6BAAY,KAAKA,KAAjB,CAAd;AACA,UAAMO,GAAG,GAAG,KAAKR,SAAL,CAAeC,KAAf,EAAsBK,QAAtB,EAAgCD,GAAhC,CAAZ;AACA,WAAOG,GAAP;AACD;;AA3B6C","sourcesContent":["import type { DependencyList } from \"react\";\nimport { useCallback } from \"react\";\n\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { SkJSIInstance } from \"../../skia/JsiInstance\";\nimport type { AnimatedProps } from \"../processors\";\nimport { isAnimated, materialize } from \"../processors\";\nimport type { DependencyManager } from \"../DependencyManager\";\n\nimport { Node } from \"./Node\";\n\nexport type DeclarationResult = SkJSIInstance<string> | null;\n\ntype DeclarationCallback<T> = (\n props: T,\n children: DeclarationResult[],\n ctx: DrawingContext\n) => DeclarationResult;\n\nexport const createDeclaration = <T,>(\n cb: DeclarationCallback<T>\n): DeclarationCallback<T> => cb;\n\nexport const useDeclaration = <P,>(\n cb: DeclarationCallback<P>,\n deps?: DependencyList\n) =>\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useCallback(cb, deps ?? []);\n\nexport interface DeclarationProps<P> {\n onDeclare: DeclarationCallback<P>;\n}\n\nexport class DeclarationNode<P> extends Node<P> {\n private onDeclare: DeclarationCallback<P>;\n\n constructor(\n depMgr: DependencyManager,\n onDeclare: DeclarationCallback<P>,\n props: AnimatedProps<P>\n ) {\n super(depMgr, props);\n super.memoizable = !isAnimated(props);\n this.onDeclare = onDeclare;\n }\n\n set props(props: AnimatedProps<P>) {\n this.memoizable = !isAnimated(props);\n super.props = props;\n }\n\n get props() {\n return this._props;\n }\n\n draw(ctx: DrawingContext) {\n const children = this.visit(ctx);\n const props = materialize(this.props);\n const obj = this.onDeclare(props, children, ctx);\n return obj;\n }\n}\n"]}
|
@@ -3,9 +3,9 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.useDrawing = exports.createDrawing = exports.DrawingNode = void 0;
|
7
7
|
|
8
|
-
var _react =
|
8
|
+
var _react = require("react");
|
9
9
|
|
10
10
|
var _processors = require("../processors");
|
11
11
|
|
@@ -15,19 +15,16 @@ var _skia = require("../../skia");
|
|
15
15
|
|
16
16
|
var _Node = require("./Node");
|
17
17
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
20
18
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
21
19
|
|
22
20
|
const createDrawing = cb => cb;
|
23
21
|
|
24
22
|
exports.createDrawing = createDrawing;
|
25
23
|
|
26
|
-
const
|
27
|
-
|
28
|
-
};
|
24
|
+
const useDrawing = (cb, deps) => // eslint-disable-next-line react-hooks/exhaustive-deps
|
25
|
+
(0, _react.useCallback)(cb, deps !== null && deps !== void 0 ? deps : []);
|
29
26
|
|
30
|
-
exports.
|
27
|
+
exports.useDrawing = useDrawing;
|
31
28
|
|
32
29
|
class DrawingNode extends _Node.Node {
|
33
30
|
constructor(depMgr, onDraw, skipProcessing, props) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Drawing.tsx"],"names":["createDrawing","cb","
|
1
|
+
{"version":3,"sources":["Drawing.tsx"],"names":["createDrawing","cb","useDrawing","deps","DrawingNode","Node","constructor","depMgr","onDraw","skipProcessing","props","draw","ctx","drawingProps","selectedPaint","paint","opacity","children","map","child","ret","filter","isPaint","forEach"],"mappings":";;;;;;;AACA;;AAGA;;AAEA;;AACA;;AAGA;;;;AAUO,MAAMA,aAAa,GAAQC,EAAL,IAC3BA,EADK;;;;AAGA,MAAMC,UAAU,GAAG,CAAKD,EAAL,EAA4BE,IAA5B,KACxB;AACA,wBAAYF,EAAZ,EAAgBE,IAAhB,aAAgBA,IAAhB,cAAgBA,IAAhB,GAAwB,EAAxB,CAFK;;;;AAUA,MAAMC,WAAN,SAA6BC,UAA7B,CAAqC;AAI1CC,EAAAA,WAAW,CACTC,MADS,EAETC,MAFS,EAGTC,cAHS,EAITC,KAJS,EAKT;AACA,UAAMH,MAAN,EAAcG,KAAd;;AADA;;AAAA;;AAEA,SAAKF,MAAL,GAAcA,MAAd;AACA,SAAKC,cAAL,GAAsBA,cAAtB;AACD;;AAEDE,EAAAA,IAAI,CAACC,GAAD,EAAsB;AACxB,UAAMC,YAAY,GAAG,6BAAY,KAAKH,KAAjB,CAArB;;AACA,QAAI,KAAKD,cAAT,EAAyB;AACvB,WAAKD,MAAL,CAAYI,GAAZ,EAAiBC,YAAjB,EAA+B,IAA/B;AACD,KAFD,MAEO;AACL,YAAMC,aAAa,GAAG,6BAAYF,GAAG,CAACG,KAAhB,EAAuBF,YAAvB,CAAtB;AACA,oCAAaC,aAAb,EAA4BF,GAAG,CAACI,OAAhC,EAAyCH,YAAzC,EAFK,CAGL;AACA;;AACA,OACEC,aADF,EAEE,GAAG,KAAKG,QAAL,CACAC,GADA,CACKC,KAAD,IAAW;AACd;AACA,cAAMC,GAAG,GAAGD,KAAK,CAACR,IAAN,CAAWC,GAAX,CAAZ;;AACA,YAAIQ,GAAJ,EAAS;AACP,iBAAOA,GAAP;AACD,SALa,CAMd;;;AACA,eAAO,IAAP;AACD,OATA,EAUAC,MAVA,CAUOC,aAVP,CAFL,EAaEC,OAbF,CAaWR,KAAD,IAAW;AACnB,aAAKP,MAAL,CAAY,EAAE,GAAGI,GAAL;AAAUG,UAAAA;AAAV,SAAZ,EAA+BF,YAA/B,EAA6C,IAA7C;AACD,OAfD;AAgBD;AACF;;AAzCyC","sourcesContent":["import type { DependencyList, ReactNode } from \"react\";\nimport { useCallback } from \"react\";\n\nimport type { DrawingContext } from \"../DrawingContext\";\nimport { processPaint, selectPaint } from \"../processors\";\nimport type { AnimatedProps } from \"../processors/Animations/Animations\";\nimport { materialize } from \"../processors/Animations/Animations\";\nimport { isPaint } from \"../../skia\";\nimport type { DependencyManager } from \"../DependencyManager\";\n\nimport { Node } from \"./Node\";\n\ntype DrawingCallback<P> = (\n ctx: DrawingContext,\n props: P,\n node: Node<P>\n) => void;\n\ntype OnDrawCallback<P> = (ctx: DrawingContext, props: P, node: Node<P>) => void;\n\nexport const createDrawing = <P,>(cb: OnDrawCallback<P>): DrawingCallback<P> =>\n cb;\n\nexport const useDrawing = <P,>(cb: OnDrawCallback<P>, deps?: DependencyList) =>\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useCallback(cb, deps ?? []);\n\nexport type DrawingProps<T> = {\n onDraw: DrawingCallback<T>;\n skipProcessing?: boolean;\n children?: ReactNode | ReactNode[];\n};\n\nexport class DrawingNode<P> extends Node<P> {\n onDraw: DrawingCallback<P>;\n skipProcessing: boolean;\n\n constructor(\n depMgr: DependencyManager,\n onDraw: DrawingCallback<P>,\n skipProcessing: boolean,\n props: AnimatedProps<P>\n ) {\n super(depMgr, props);\n this.onDraw = onDraw;\n this.skipProcessing = skipProcessing;\n }\n\n draw(ctx: DrawingContext) {\n const drawingProps = materialize(this.props);\n if (this.skipProcessing) {\n this.onDraw(ctx, drawingProps, this);\n } else {\n const selectedPaint = selectPaint(ctx.paint, drawingProps);\n processPaint(selectedPaint, ctx.opacity, drawingProps);\n // to draw only once:\n // onDraw({ ...ctx, paint: selectedPaint }, children);\n [\n selectedPaint,\n ...this.children\n .map((child) => {\n //if (child.type === NodeType.Declaration) {\n const ret = child.draw(ctx);\n if (ret) {\n return ret;\n }\n //}\n return null;\n })\n .filter(isPaint),\n ].forEach((paint) => {\n this.onDraw({ ...ctx, paint }, drawingProps, this);\n });\n }\n }\n}\n"]}
|
@@ -3,9 +3,27 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.mix = void 0;
|
6
|
+
exports.mix = exports.clamp = void 0;
|
7
7
|
|
8
|
+
/**
|
9
|
+
* Linear interpolation
|
10
|
+
* @param value
|
11
|
+
* @param x
|
12
|
+
* @param y
|
13
|
+
*/
|
8
14
|
const mix = (value, x, y) => x * (1 - value) + y * value;
|
15
|
+
/**
|
16
|
+
* @summary Clamps a node with a lower and upper bound.
|
17
|
+
* @example
|
18
|
+
clamp(-1, 0, 100); // 0
|
19
|
+
clamp(1, 0, 100); // 1
|
20
|
+
clamp(101, 0, 100); // 100
|
21
|
+
*/
|
22
|
+
|
9
23
|
|
10
24
|
exports.mix = mix;
|
25
|
+
|
26
|
+
const clamp = (value, lowerBound, upperBound) => Math.min(Math.max(lowerBound, value), upperBound);
|
27
|
+
|
28
|
+
exports.clamp = clamp;
|
11
29
|
//# sourceMappingURL=Math.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Math.ts"],"names":["mix","value","x","y"],"mappings":";;;;;;;
|
1
|
+
{"version":3,"sources":["Math.ts"],"names":["mix","value","x","y","clamp","lowerBound","upperBound","Math","min","max"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,GAAG,GAAG,CAACC,KAAD,EAAgBC,CAAhB,EAA2BC,CAA3B,KACjBD,CAAC,IAAI,IAAID,KAAR,CAAD,GAAkBE,CAAC,GAAGF,KADjB;AAGP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMG,KAAK,GAAG,CAACH,KAAD,EAAgBI,UAAhB,EAAoCC,UAApC,KACnBC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAASJ,UAAT,EAAqBJ,KAArB,CAAT,EAAsCK,UAAtC,CADK","sourcesContent":["/**\n * Linear interpolation\n * @param value\n * @param x\n * @param y\n */\nexport const mix = (value: number, x: number, y: number) =>\n x * (1 - value) + y * value;\n\n/**\n * @summary Clamps a node with a lower and upper bound.\n * @example\n clamp(-1, 0, 100); // 0\n clamp(1, 0, 100); // 1\n clamp(101, 0, 100); // 100\n */\nexport const clamp = (value: number, lowerBound: number, upperBound: number) =>\n Math.min(Math.max(lowerBound, value), upperBound);\n"]}
|