@shopify/react-native-skia 0.1.156 → 0.1.158
Sign up to get free protection for your applications and to get access to all the features.
- package/android/build.gradle +10 -5
- package/cpp/api/JsiSkContourMeasure.h +7 -5
- package/lib/commonjs/dom/nodes/DrawingNode.js +1 -5
- package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js +2 -8
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Text.js +4 -9
- package/lib/commonjs/dom/nodes/drawings/Text.js.map +1 -1
- package/lib/commonjs/dom/types/Common.js.map +1 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +10 -2
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +10 -1
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/components/Mask.js +1 -3
- package/lib/commonjs/renderer/components/Mask.js.map +1 -1
- package/lib/commonjs/renderer/components/Paint.js +5 -18
- package/lib/commonjs/renderer/components/Paint.js.map +1 -1
- package/lib/commonjs/renderer/useCanvas.js +18 -2
- package/lib/commonjs/renderer/useCanvas.js.map +1 -1
- package/lib/commonjs/skia/core/Picture.js +1 -24
- package/lib/commonjs/skia/core/Picture.js.map +1 -1
- package/lib/commonjs/skia/core/Rect.js +1 -1
- package/lib/commonjs/skia/core/Rect.js.map +1 -1
- package/lib/commonjs/skia/types/ContourMeasure.js.map +1 -1
- package/lib/commonjs/skia/types/Size.js +2 -0
- package/lib/commonjs/skia/types/Size.js.map +1 -0
- package/lib/commonjs/skia/types/index.js +13 -0
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColor.js +8 -0
- package/lib/commonjs/skia/web/JsiSkColor.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js +4 -7
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +4 -2
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +2 -2
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/animation/spring/runSpring.js +1 -1
- package/lib/module/animation/spring/runSpring.js.map +1 -1
- package/lib/module/animation/spring/useSpring.js +1 -1
- package/lib/module/animation/spring/useSpring.js.map +1 -1
- package/lib/module/animation/timing/createTiming.js +6 -2
- package/lib/module/animation/timing/createTiming.js.map +1 -1
- package/lib/module/animation/timing/functions/getResolvedParams.js +10 -6
- package/lib/module/animation/timing/functions/getResolvedParams.js.map +1 -1
- package/lib/module/animation/timing/useTiming.js +3 -1
- package/lib/module/animation/timing/useTiming.js.map +1 -1
- package/lib/module/dom/nodes/DrawingNode.js +2 -6
- package/lib/module/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js +2 -2
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.js +1 -4
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.js +2 -2
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Text.js +4 -9
- package/lib/module/dom/nodes/drawings/Text.js.map +1 -1
- package/lib/module/dom/nodes/paint/Shaders.js +4 -2
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/module/dom/types/Common.js.map +1 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/mock/index.js +10 -7
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +10 -2
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +9 -1
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/components/Mask.js +2 -4
- package/lib/module/renderer/components/Mask.js.map +1 -1
- package/lib/module/renderer/components/Paint.js +3 -14
- package/lib/module/renderer/components/Paint.js.map +1 -1
- package/lib/module/renderer/useCanvas.js +13 -0
- package/lib/module/renderer/useCanvas.js.map +1 -1
- package/lib/module/skia/core/Picture.js +0 -18
- package/lib/module/skia/core/Picture.js.map +1 -1
- package/lib/module/skia/core/Rect.js +1 -1
- package/lib/module/skia/core/Rect.js.map +1 -1
- package/lib/module/skia/core/Vector.js +1 -1
- package/lib/module/skia/core/Vector.js.map +1 -1
- package/lib/module/skia/types/ContourMeasure.js.map +1 -1
- package/lib/module/skia/types/Size.js +2 -0
- package/lib/module/skia/types/Size.js.map +1 -0
- package/lib/module/skia/types/index.js +1 -0
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/Host.js +1 -1
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkColor.js +8 -0
- package/lib/module/skia/web/JsiSkColor.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasure.js +3 -7
- package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/values/web/RNSkAnimation.js +2 -2
- package/lib/module/values/web/RNSkAnimation.js.map +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js +4 -2
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +5 -3
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/useTouchHandler.js +6 -6
- 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/dom/nodes/RenderNode.d.ts +1 -3
- package/lib/typescript/src/dom/types/Common.d.ts +2 -3
- package/lib/typescript/src/dom/types/Drawings.d.ts +1 -3
- package/lib/typescript/src/renderer/Canvas.d.ts +4 -1
- package/lib/typescript/src/renderer/HostComponents.d.ts +1 -5
- package/lib/typescript/src/renderer/components/Paint.d.ts +3 -4
- package/lib/typescript/src/renderer/useCanvas.d.ts +1 -0
- package/lib/typescript/src/skia/core/Picture.d.ts +0 -8
- package/lib/typescript/src/skia/types/ContourMeasure.d.ts +3 -2
- package/lib/typescript/src/skia/types/Size.d.ts +4 -0
- package/lib/typescript/src/skia/types/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkContourMeasure.d.ts +2 -6
- package/package.json +12 -6
- package/src/dom/nodes/DrawingNode.ts +2 -4
- package/src/dom/nodes/RenderNode.ts +1 -13
- package/src/dom/nodes/drawings/Text.ts +4 -4
- package/src/dom/types/Common.ts +2 -4
- package/src/dom/types/Drawings.ts +1 -4
- package/src/mock/index.ts +0 -1
- package/src/renderer/Canvas.tsx +18 -3
- package/src/renderer/HostComponents.ts +1 -4
- package/src/renderer/HostConfig.ts +8 -1
- package/src/renderer/components/Mask.tsx +2 -2
- package/src/renderer/components/Paint.tsx +3 -14
- package/src/renderer/useCanvas.ts +14 -0
- package/src/skia/core/Picture.ts +0 -24
- package/src/skia/core/Rect.ts +1 -1
- package/src/skia/types/ContourMeasure.tsx +3 -2
- package/src/skia/types/Size.ts +4 -0
- package/src/skia/types/index.ts +1 -0
- package/src/skia/web/JsiSkColor.ts +11 -0
- package/src/skia/web/JsiSkContourMeasure.ts +7 -3
- package/src/values/web/RNSkReadonlyValue.ts +4 -2
- package/src/views/SkiaBaseWebView.tsx +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["pd","PixelRatio","get","SkiaBaseWebView","React","Component","constructor","props","createRef","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","onLayout","evt","CanvasKit","global","width","height","nativeEvent","layout","_canvasRef","current","canvas","clientWidth","clientHeight","surface","MakeWebGLCanvasSurface","Error","_surface","JsiSkSurface","_canvas","getCanvas","redraw","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","makeImageSnapshot","rect","_redrawRequests","touches","_touches","renderInCanvas","ref","flush","requestAnimationFrame","bind","setDrawMode","registerValues","_values","v","push","addListener","handleTouchEvent","touchType","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","timestamp","Date","now","createTouchHandler","render","debug","viewProps","display","flex","TouchType","Start","Active","End","Cancelled"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\nimport { PixelRatio, View } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\n\nimport type { DrawMode, SkiaBaseViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst pd = PixelRatio.get();\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayout(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n const { width, height } = evt.nativeEvent.layout;\n this.width = width;\n this.height = height;\n // Reset canvas / surface on layout change\n if (this._canvasRef.current) {\n const canvas = this._canvasRef.current;\n canvas.width = canvas.clientWidth * pd;\n canvas.height = canvas.clientHeight * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(this._canvasRef.current);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(\n canvas: SkCanvas,\n touches: TouchInfo[]\n ): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const touches = [...this._touches];\n this._touches = [];\n this.renderInCanvas(this._canvas!, touches);\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.tick();\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(_values: SkiaValue<unknown>[]) {\n // Unsubscribe from dependency values\n this.unsubscribeAll();\n // Register redraw dependencies on values\n _values.forEach((v) => {\n this._unsubscriptions.push(\n v.addListener(() => {\n this.redraw();\n })\n );\n });\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.redraw();\n }\n\n createTouchHandler(touchType: TouchType) {\n return (evt: PointerEvent) => this.handleTouchEvent(evt, touchType);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <View {...viewProps} onLayout={this.onLayout.bind(this)}>\n <canvas\n ref={this._canvasRef}\n style={{ display: \"flex\", flex: 1 }}\n onPointerDown={this.createTouchHandler(TouchType.Start)}\n onPointerMove={this.createTouchHandler(TouchType.Active)}\n onPointerUp={this.createTouchHandler(TouchType.End)}\n onPointerCancel={this.createTouchHandler(TouchType.Cancelled)}\n onPointerLeave={this.createTouchHandler(TouchType.End)}\n onPointerOut={this.createTouchHandler(TouchType.End)}\n />\n </View>\n );\n }\n}\n"],"mappings":";;;;;;;AACA;;AAGA;;AAIA;;AAGA;;;;;;;;AAEA,MAAMA,EAAE,GAAGC,uBAAA,CAAWC,GAAX,EAAX;;AAEO,MAAeC,eAAf,SAEGC,cAAA,CAAMC,SAFT,CAE2B;EAChCC,WAAW,CAACC,KAAD,EAAgB;IACzB,MAAMA,KAAN;;IADyB,kCAKa,IALb;;IAAA,0CAMmB,EANnB;;IAAA,kCAOU,EAPV;;IAAA,iCAQQ,IARR;;IAAA,iDASNH,cAAA,CAAMI,SAAN,EATM;;IAAA;;IAAA,yCAWD,CAXC;;IAAA,mCAYP,CAZO;;IAAA,+BAcT,CAdS;;IAAA,gCAeR,CAfQ;;IAEzB,KAAKC,KAAL,GAAaF,KAAK,CAACG,IAAN,IAAc,SAA3B;EACD;;EAcOC,cAAc,GAAG;IACvB,KAAKC,gBAAL,CAAsBC,OAAtB,CAA+BC,CAAD,IAAOA,CAAC,EAAtC;;IACA,KAAKF,gBAAL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GAAmC,CAAnC,EAAsCI,GAHtC;MAIjBC,KAAK,EAAEtD,GAAG,CAACuD,QAJM;MAKjBC,IAAI,EAAEb,SALW;MAMjBc,SAAS,EAAEC,IAAI,CAACC,GAAL;IANM,CAAnB;;IAQA,KAAKxC,MAAL;EACD;;EAEDyC,kBAAkB,CAACjB,SAAD,EAAuB;IACvC,OAAQ3C,GAAD,IAAuB,KAAK0C,gBAAL,CAAsB1C,GAAtB,EAA2B2C,SAA3B,CAA9B;EACD;;EAEDkB,MAAM,GAAG;IACP,MAAM;MAAEnE,IAAF;MAAQoE,KAAK,GAAG,KAAhB;MAAuB,GAAGC;IAA1B,IAAwC,KAAKxE,KAAnD;IACA,oBACE,6BAAC,iBAAD,eAAUwE,SAAV;MAAqB,QAAQ,EAAE,KAAKhE,QAAL,CAAcoC,IAAd,CAAmB,IAAnB;IAA/B,iBACE;MACE,GAAG,EAAE,KAAK5B,UADZ;MAEE,KAAK,EAAE;QAAEyD,OAAO,EAAE,MAAX;QAAmBC,IAAI,EAAE;MAAzB,CAFT;MAGE,aAAa,EAAE,KAAKL,kBAAL,CAAwBM,gBAAA,CAAUC,KAAlC,CAHjB;MAIE,aAAa,EAAE,KAAKP,kBAAL,CAAwBM,gBAAA,CAAUE,MAAlC,CAJjB;MAKE,WAAW,EAAE,KAAKR,kBAAL,CAAwBM,gBAAA,CAAUG,GAAlC,CALf;MAME,eAAe,EAAE,KAAKT,kBAAL,CAAwBM,gBAAA,CAAUI,SAAlC,CANnB;MAOE,cAAc,EAAE,KAAKV,kBAAL,CAAwBM,gBAAA,CAAUG,GAAlC,CAPlB;MAQE,YAAY,EAAE,KAAKT,kBAAL,CAAwBM,gBAAA,CAAUG,GAAlC;IARhB,EADF,CADF;EAcD;;AA9J+B"}
|
1
|
+
{"version":3,"names":["pd","PixelRatio","get","SkiaBaseWebView","React","Component","constructor","props","createRef","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","onLayout","evt","CanvasKit","global","width","height","nativeEvent","layout","_canvasRef","current","canvas","surface","MakeWebGLCanvasSurface","Error","_surface","JsiSkSurface","_canvas","getCanvas","redraw","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","makeImageSnapshot","rect","_redrawRequests","touches","_touches","renderInCanvas","ref","flush","requestAnimationFrame","bind","setDrawMode","registerValues","_values","v","push","addListener","handleTouchEvent","touchType","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","timestamp","Date","now","createTouchHandler","render","debug","viewProps","display","flex","TouchType","Start","Active","End","Cancelled"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\nimport { PixelRatio, View } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\n\nimport type { DrawMode, SkiaBaseViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst pd = PixelRatio.get();\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayout(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n const { width, height } = evt.nativeEvent.layout;\n this.width = width;\n this.height = height;\n // Reset canvas / surface on layout change\n if (this._canvasRef.current) {\n const canvas = this._canvasRef.current;\n canvas.width = width * pd;\n canvas.height = height * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(this._canvasRef.current);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(\n canvas: SkCanvas,\n touches: TouchInfo[]\n ): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const touches = [...this._touches];\n this._touches = [];\n this.renderInCanvas(this._canvas!, touches);\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.tick();\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(_values: SkiaValue<unknown>[]) {\n // Unsubscribe from dependency values\n this.unsubscribeAll();\n // Register redraw dependencies on values\n _values.forEach((v) => {\n this._unsubscriptions.push(\n v.addListener(() => {\n this.redraw();\n })\n );\n });\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.redraw();\n }\n\n createTouchHandler(touchType: TouchType) {\n return (evt: PointerEvent) => this.handleTouchEvent(evt, touchType);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <View {...viewProps} onLayout={this.onLayout.bind(this)}>\n <canvas\n ref={this._canvasRef}\n style={{ display: \"flex\", flex: 1 }}\n onPointerDown={this.createTouchHandler(TouchType.Start)}\n onPointerMove={this.createTouchHandler(TouchType.Active)}\n onPointerUp={this.createTouchHandler(TouchType.End)}\n onPointerCancel={this.createTouchHandler(TouchType.Cancelled)}\n onPointerLeave={this.createTouchHandler(TouchType.End)}\n onPointerOut={this.createTouchHandler(TouchType.End)}\n />\n </View>\n );\n }\n}\n"],"mappings":";;;;;;;AACA;;AAGA;;AAIA;;AAGA;;;;;;;;AAEA,MAAMA,EAAE,GAAGC,uBAAA,CAAWC,GAAX,EAAX;;AAEO,MAAeC,eAAf,SAEGC,cAAA,CAAMC,SAFT,CAE2B;EAChCC,WAAW,CAACC,KAAD,EAAgB;IACzB,MAAMA,KAAN;;IADyB,kCAKa,IALb;;IAAA,0CAMmB,EANnB;;IAAA,kCAOU,EAPV;;IAAA,iCAQQ,IARR;;IAAA,iDASNH,cAAA,CAAMI,SAAN,EATM;;IAAA;;IAAA,yCAWD,CAXC;;IAAA,mCAYP,CAZO;;IAAA,+BAcT,CAdS;;IAAA,gCAeR,CAfQ;;IAEzB,KAAKC,KAAL,GAAaF,KAAK,CAACG,IAAN,IAAc,SAA3B;EACD;;EAcOC,cAAc,GAAG;IACvB,KAAKC,gBAAL,CAAsBC,OAAtB,CAA+BC,CAAD,IAAOA,CAAC,EAAtC;;IACA,KAAKF,gBAAL,GAAwB,EAAxB;EACD;;EAEOG,QAAQ,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qD,QAJM;MAKjBC,IAAI,EAAEb,SALW;MAMjBc,SAAS,EAAEC,IAAI,CAACC,GAAL;IANM,CAAnB;;IAQA,KAAKxC,MAAL;EACD;;EAEDyC,kBAAkB,CAACjB,SAAD,EAAuB;IACvC,OAAQzC,GAAD,IAAuB,KAAKwC,gBAAL,CAAsBxC,GAAtB,EAA2ByC,SAA3B,CAA9B;EACD;;EAEDkB,MAAM,GAAG;IACP,MAAM;MAAEjE,IAAF;MAAQkE,KAAK,GAAG,KAAhB;MAAuB,GAAGC;IAA1B,IAAwC,KAAKtE,KAAnD;IACA,oBACE,6BAAC,iBAAD,eAAUsE,SAAV;MAAqB,QAAQ,EAAE,KAAK9D,QAAL,CAAckC,IAAd,CAAmB,IAAnB;IAA/B,iBACE;MACE,GAAG,EAAE,KAAK1B,UADZ;MAEE,KAAK,EAAE;QAAEuD,OAAO,EAAE,MAAX;QAAmBC,IAAI,EAAE;MAAzB,CAFT;MAGE,aAAa,EAAE,KAAKL,kBAAL,CAAwBM,gBAAA,CAAUC,KAAlC,CAHjB;MAIE,aAAa,EAAE,KAAKP,kBAAL,CAAwBM,gBAAA,CAAUE,MAAlC,CAJjB;MAKE,WAAW,EAAE,KAAKR,kBAAL,CAAwBM,gBAAA,CAAUG,GAAlC,CALf;MAME,eAAe,EAAE,KAAKT,kBAAL,CAAwBM,gBAAA,CAAUI,SAAlC,CANnB;MAOE,cAAc,EAAE,KAAKV,kBAAL,CAAwBM,gBAAA,CAAUG,GAAlC,CAPlB;MAQE,YAAY,EAAE,KAAKT,kBAAL,CAAwBM,gBAAA,CAAUG,GAAlC;IARhB,EADF,CADF;EAcD;;AA9J+B"}
|
@@ -16,6 +16,6 @@ import { createSpringEasing } from "./functions/spring";
|
|
16
16
|
*/
|
17
17
|
|
18
18
|
export const runSpring = (value, toOrParams, config, callback) => {
|
19
|
-
return runTiming(value, toOrParams, createSpringEasing(config
|
19
|
+
return runTiming(value, toOrParams, createSpringEasing(config !== null && config !== void 0 ? config : Spring.Config.Default), callback);
|
20
20
|
};
|
21
21
|
//# sourceMappingURL=runSpring.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["runTiming","Spring","createSpringEasing","runSpring","value","toOrParams","config","callback","Config","Default"],"sources":["runSpring.ts"],"sourcesContent":["import type { SkiaMutableValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n SpringConfig,\n AnimationCallback,\n} from \"../types\";\nimport { runTiming } from \"../timing/runTiming\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creates a new animation on an existing value that will be driven by\n * an animation value. The value will be run from / to the value in\n * params and modified by the provided easing curve for the length of\n * the duration. When the value has reached its desired \"to\" value the\n * animation will be stopped.\n *\n * @param value The value to animate\n * @param toOrParams To value or Animation parameters\n * @param config Spring configuration\n * @returns an animation value that can be used to start/stop\n * the animation.\n */\nexport const runSpring = (\n value: SkiaMutableValue<number>,\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaAnimation => {\n return runTiming(\n value,\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n};\n"],"mappings":"AAMA,SAASA,SAAT,QAA0B,qBAA1B;AAEA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAG,CACvBC,KADuB,EAEvBC,UAFuB,EAGvBC,MAHuB,EAIvBC,QAJuB,KAKL;EAClB,OAAOP,SAAS,CACdI,KADc,EAEdC,UAFc,EAGdH,kBAAkB,CAACI,
|
1
|
+
{"version":3,"names":["runTiming","Spring","createSpringEasing","runSpring","value","toOrParams","config","callback","Config","Default"],"sources":["runSpring.ts"],"sourcesContent":["import type { SkiaMutableValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n SpringConfig,\n AnimationCallback,\n} from \"../types\";\nimport { runTiming } from \"../timing/runTiming\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creates a new animation on an existing value that will be driven by\n * an animation value. The value will be run from / to the value in\n * params and modified by the provided easing curve for the length of\n * the duration. When the value has reached its desired \"to\" value the\n * animation will be stopped.\n *\n * @param value The value to animate\n * @param toOrParams To value or Animation parameters\n * @param config Spring configuration\n * @returns an animation value that can be used to start/stop\n * the animation.\n */\nexport const runSpring = (\n value: SkiaMutableValue<number>,\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaAnimation => {\n return runTiming(\n value,\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n};\n"],"mappings":"AAMA,SAASA,SAAT,QAA0B,qBAA1B;AAEA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAG,CACvBC,KADuB,EAEvBC,UAFuB,EAGvBC,MAHuB,EAIvBC,QAJuB,KAKL;EAClB,OAAOP,SAAS,CACdI,KADc,EAEdC,UAFc,EAGdH,kBAAkB,CAACI,MAAD,aAACA,MAAD,cAACA,MAAD,GAAWL,MAAM,CAACO,MAAP,CAAcC,OAAzB,CAHJ,EAIdF,QAJc,CAAhB;AAMD,CAZM"}
|
@@ -9,5 +9,5 @@ import { createSpringEasing } from "./functions/spring";
|
|
9
9
|
* @returns
|
10
10
|
*/
|
11
11
|
|
12
|
-
export const useSpring = (toOrParams, config, callback) => useTiming(toOrParams, createSpringEasing(config
|
12
|
+
export const useSpring = (toOrParams, config, callback) => useTiming(toOrParams, createSpringEasing(config !== null && config !== void 0 ? config : Spring.Config.Default), callback);
|
13
13
|
//# sourceMappingURL=useSpring.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useTiming","Spring","createSpringEasing","useSpring","toOrParams","config","callback","Config","Default"],"sources":["useSpring.ts"],"sourcesContent":["import type { SkiaValue } from \"../../values/types\";\nimport type {\n SpringConfig,\n AnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport { useTiming } from \"../timing\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creats a spring based animation value that will run whenever\n * the animation parameters change.\n * @param toOrParams\n * @param config\n * @returns\n */\nexport const useSpring = (\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaValue<number> =>\n useTiming(\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n"],"mappings":"AAMA,SAASA,SAAT,QAA0B,WAA1B;AAEA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAKvBN,SAAS,CACPI,UADO,EAEPF,kBAAkB,CAACG,
|
1
|
+
{"version":3,"names":["useTiming","Spring","createSpringEasing","useSpring","toOrParams","config","callback","Config","Default"],"sources":["useSpring.ts"],"sourcesContent":["import type { SkiaValue } from \"../../values/types\";\nimport type {\n SpringConfig,\n AnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport { useTiming } from \"../timing\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creats a spring based animation value that will run whenever\n * the animation parameters change.\n * @param toOrParams\n * @param config\n * @returns\n */\nexport const useSpring = (\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaValue<number> =>\n useTiming(\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n"],"mappings":"AAMA,SAASA,SAAT,QAA0B,WAA1B;AAEA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAKvBN,SAAS,CACPI,UADO,EAEPF,kBAAkB,CAACG,MAAD,aAACA,MAAD,cAACA,MAAD,GAAWJ,MAAM,CAACM,MAAP,CAAcC,OAAzB,CAFX,EAGPF,QAHO,CALJ"}
|
@@ -16,15 +16,19 @@ import { timing } from "./functions";
|
|
16
16
|
*/
|
17
17
|
|
18
18
|
export const createTiming = (params, value, callback) => {
|
19
|
+
var _ref, _params$from;
|
20
|
+
|
19
21
|
// Update from to be either the declared from value,
|
20
22
|
// the current value of the value or zero
|
21
23
|
const resolvedParams = { ...params,
|
22
|
-
from: params.from
|
24
|
+
from: (_ref = (_params$from = params.from) !== null && _params$from !== void 0 ? _params$from : value === null || value === void 0 ? void 0 : value.current) !== null && _ref !== void 0 ? _ref : 0
|
23
25
|
}; // Update function for the animation value
|
24
26
|
|
25
27
|
const animationFunction = (t, state) => {
|
28
|
+
var _params$loop, _params$yoyo;
|
29
|
+
|
26
30
|
// Update the input value using the provided update function
|
27
|
-
const nextState = timing(t, params.duration, params.easing, params.loop
|
31
|
+
const nextState = timing(t, params.duration, params.easing, (_params$loop = params.loop) !== null && _params$loop !== void 0 ? _params$loop : false, (_params$yoyo = params.yoyo) !== null && _params$yoyo !== void 0 ? _params$yoyo : false, state !== null && state !== void 0 ? state : {
|
28
32
|
current: params.from,
|
29
33
|
finished: false
|
30
34
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ValueApi","timing","createTiming","params","value","callback","resolvedParams","from","current","animationFunction","t","state","nextState","duration","easing","loop","yoyo","finished","to","createAnimation"],"sources":["createTiming.ts"],"sourcesContent":["import type {\n TimingConfig,\n RequiredAnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport type { AnimationState, SkiaMutableValue } from \"../../values/types\";\nimport { ValueApi } from \"../../values/api\";\n\nimport { timing } from \"./functions\";\n\n/**\n * Creates an animation that is driven by a clock value.\n * The value will be run from / to the value in params and modified\n * by the provided easing curve for the length of the duration. When\n * the value has reached its desired \"to\" value the animation\n * will be stopped. If loop is set to true, the animation will continue\n * to run until stopped.\n *\n * @param params Animation parameters\n * @param config Spring or timing configuration\n * @param value Optional value that the animation will update\n * @params an animation value that can be used to start/stop\n * the animation.\n */\nexport const createTiming = (\n params: RequiredAnimationParams & Required<TimingConfig>,\n value?: SkiaMutableValue<number>,\n callback?: AnimationCallback\n) => {\n // Update from to be either the declared from value,\n // the current value of the value or zero\n const resolvedParams = {\n ...params,\n from: params.from ?? value?.current ?? 0,\n };\n\n // Update function for the animation value\n const animationFunction = (t: number, state: AnimationState | undefined) => {\n // Update the input value using the provided update function\n const nextState = timing(\n t,\n params.duration,\n params.easing,\n params.loop ?? false,\n params.yoyo ?? false,\n state ?? { current: params.from!, finished: false }\n );\n const current =\n nextState.current * (resolvedParams.to - resolvedParams.from!) +\n resolvedParams.from!;\n if (callback && nextState.finished === true) {\n callback(current);\n }\n return {\n ...nextState,\n current,\n };\n };\n\n // Create animation value\n return ValueApi.createAnimation(animationFunction);\n};\n"],"mappings":"AAMA,SAASA,QAAT,QAAyB,kBAAzB;AAEA,SAASC,MAAT,QAAuB,aAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAG,CAC1BC,MAD0B,EAE1BC,KAF0B,EAG1BC,QAH0B,KAIvB;EACH;EACA;EACA,MAAMC,cAAc,GAAG,EACrB,GAAGH,MADkB;IAErBI,IAAI,
|
1
|
+
{"version":3,"names":["ValueApi","timing","createTiming","params","value","callback","resolvedParams","from","current","animationFunction","t","state","nextState","duration","easing","loop","yoyo","finished","to","createAnimation"],"sources":["createTiming.ts"],"sourcesContent":["import type {\n TimingConfig,\n RequiredAnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport type { AnimationState, SkiaMutableValue } from \"../../values/types\";\nimport { ValueApi } from \"../../values/api\";\n\nimport { timing } from \"./functions\";\n\n/**\n * Creates an animation that is driven by a clock value.\n * The value will be run from / to the value in params and modified\n * by the provided easing curve for the length of the duration. When\n * the value has reached its desired \"to\" value the animation\n * will be stopped. If loop is set to true, the animation will continue\n * to run until stopped.\n *\n * @param params Animation parameters\n * @param config Spring or timing configuration\n * @param value Optional value that the animation will update\n * @params an animation value that can be used to start/stop\n * the animation.\n */\nexport const createTiming = (\n params: RequiredAnimationParams & Required<TimingConfig>,\n value?: SkiaMutableValue<number>,\n callback?: AnimationCallback\n) => {\n // Update from to be either the declared from value,\n // the current value of the value or zero\n const resolvedParams = {\n ...params,\n from: params.from ?? value?.current ?? 0,\n };\n\n // Update function for the animation value\n const animationFunction = (t: number, state: AnimationState | undefined) => {\n // Update the input value using the provided update function\n const nextState = timing(\n t,\n params.duration,\n params.easing,\n params.loop ?? false,\n params.yoyo ?? false,\n state ?? { current: params.from!, finished: false }\n );\n const current =\n nextState.current * (resolvedParams.to - resolvedParams.from!) +\n resolvedParams.from!;\n if (callback && nextState.finished === true) {\n callback(current);\n }\n return {\n ...nextState,\n current,\n };\n };\n\n // Create animation value\n return ValueApi.createAnimation(animationFunction);\n};\n"],"mappings":"AAMA,SAASA,QAAT,QAAyB,kBAAzB;AAEA,SAASC,MAAT,QAAuB,aAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAG,CAC1BC,MAD0B,EAE1BC,KAF0B,EAG1BC,QAH0B,KAIvB;EAAA;;EACH;EACA;EACA,MAAMC,cAAc,GAAG,EACrB,GAAGH,MADkB;IAErBI,IAAI,0BAAEJ,MAAM,CAACI,IAAT,uDAAiBH,KAAjB,aAAiBA,KAAjB,uBAAiBA,KAAK,CAAEI,OAAxB,uCAAmC;EAFlB,CAAvB,CAHG,CAQH;;EACA,MAAMC,iBAAiB,GAAG,CAACC,CAAD,EAAYC,KAAZ,KAAkD;IAAA;;IAC1E;IACA,MAAMC,SAAS,GAAGX,MAAM,CACtBS,CADsB,EAEtBP,MAAM,CAACU,QAFe,EAGtBV,MAAM,CAACW,MAHe,kBAItBX,MAAM,CAACY,IAJe,uDAIP,KAJO,kBAKtBZ,MAAM,CAACa,IALe,uDAKP,KALO,EAMtBL,KANsB,aAMtBA,KANsB,cAMtBA,KANsB,GAMb;MAAEH,OAAO,EAAEL,MAAM,CAACI,IAAlB;MAAyBU,QAAQ,EAAE;IAAnC,CANa,CAAxB;IAQA,MAAMT,OAAO,GACXI,SAAS,CAACJ,OAAV,IAAqBF,cAAc,CAACY,EAAf,GAAoBZ,cAAc,CAACC,IAAxD,IACAD,cAAc,CAACC,IAFjB;;IAGA,IAAIF,QAAQ,IAAIO,SAAS,CAACK,QAAV,KAAuB,IAAvC,EAA6C;MAC3CZ,QAAQ,CAACG,OAAD,CAAR;IACD;;IACD,OAAO,EACL,GAAGI,SADE;MAELJ;IAFK,CAAP;EAID,CApBD,CATG,CA+BH;;;EACA,OAAOR,QAAQ,CAACmB,eAAT,CAAyBV,iBAAzB,CAAP;AACD,CArCM"}
|
@@ -21,11 +21,13 @@ export const getResolvedParams = (toOrParams, config) => {
|
|
21
21
|
if (typeof toOrParams === "number") {
|
22
22
|
resolvedParameters.to = toOrParams;
|
23
23
|
} else {
|
24
|
+
var _toOrParams$from, _toOrParams$to, _toOrParams$loop, _toOrParams$yoyo;
|
25
|
+
|
24
26
|
resolvedParameters = {
|
25
|
-
from: toOrParams.from
|
26
|
-
to: toOrParams.to
|
27
|
-
loop: toOrParams.loop
|
28
|
-
yoyo: toOrParams.yoyo
|
27
|
+
from: (_toOrParams$from = toOrParams.from) !== null && _toOrParams$from !== void 0 ? _toOrParams$from : resolvedParameters.from,
|
28
|
+
to: (_toOrParams$to = toOrParams.to) !== null && _toOrParams$to !== void 0 ? _toOrParams$to : resolvedParameters.to,
|
29
|
+
loop: (_toOrParams$loop = toOrParams.loop) !== null && _toOrParams$loop !== void 0 ? _toOrParams$loop : resolvedParameters.loop,
|
30
|
+
yoyo: (_toOrParams$yoyo = toOrParams.yoyo) !== null && _toOrParams$yoyo !== void 0 ? _toOrParams$yoyo : resolvedParameters.yoyo
|
29
31
|
};
|
30
32
|
}
|
31
33
|
|
@@ -33,8 +35,10 @@ export const getResolvedParams = (toOrParams, config) => {
|
|
33
35
|
};
|
34
36
|
|
35
37
|
if (config) {
|
36
|
-
|
37
|
-
|
38
|
+
var _config$duration, _config$easing;
|
39
|
+
|
40
|
+
resolvedConfig.duration = (_config$duration = config.duration) !== null && _config$duration !== void 0 ? _config$duration : DefaultTimingConfig.duration;
|
41
|
+
resolvedConfig.easing = (_config$easing = config.easing) !== null && _config$easing !== void 0 ? _config$easing : DefaultTimingConfig.easing;
|
38
42
|
}
|
39
43
|
|
40
44
|
return { ...resolvedParameters,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["DefaultParameters","to","loop","yoyo","immediate","DefaultTimingConfig","duration","easing","t","getResolvedParams","toOrParams","config","resolvedParameters","from","resolvedConfig"],"sources":["getResolvedParams.ts"],"sourcesContent":["import type {\n RequiredAnimationParams,\n AnimationParams,\n TimingConfig,\n} from \"../../types\";\n\nconst DefaultParameters = {\n to: 1,\n loop: false,\n yoyo: false,\n immediate: true,\n};\n\nconst DefaultTimingConfig = {\n duration: 1000,\n easing: (t: number) => t,\n};\n\n/**\n * Resolves parameters from optional values to a single object\n * @param toOrParams Params or to value\n * @param config timing/spring configuration\n */\nexport const getResolvedParams = (\n toOrParams: number | AnimationParams,\n config?: TimingConfig\n): RequiredAnimationParams & Required<TimingConfig> => {\n let resolvedParameters: RequiredAnimationParams = {\n ...DefaultParameters,\n };\n\n if (typeof toOrParams === \"number\") {\n resolvedParameters.to = toOrParams;\n } else {\n resolvedParameters = {\n from: toOrParams.from ?? resolvedParameters.from,\n to: toOrParams.to ?? resolvedParameters.to,\n loop: toOrParams.loop ?? resolvedParameters.loop,\n yoyo: toOrParams.yoyo ?? resolvedParameters.yoyo,\n };\n }\n\n const resolvedConfig: Required<TimingConfig> = { ...DefaultTimingConfig };\n if (config) {\n resolvedConfig.duration = config.duration ?? DefaultTimingConfig.duration;\n resolvedConfig.easing = config.easing ?? DefaultTimingConfig.easing;\n }\n\n return { ...resolvedParameters, ...resolvedConfig };\n};\n"],"mappings":"AAMA,MAAMA,iBAAiB,GAAG;EACxBC,EAAE,EAAE,CADoB;EAExBC,IAAI,EAAE,KAFkB;EAGxBC,IAAI,EAAE,KAHkB;EAIxBC,SAAS,EAAE;AAJa,CAA1B;AAOA,MAAMC,mBAAmB,GAAG;EAC1BC,QAAQ,EAAE,IADgB;EAE1BC,MAAM,EAAGC,CAAD,IAAeA;AAFG,CAA5B;AAKA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,iBAAiB,GAAG,CAC/BC,UAD+B,EAE/BC,MAF+B,KAGsB;EACrD,IAAIC,kBAA2C,GAAG,EAChD,GAAGZ;EAD6C,CAAlD;;EAIA,IAAI,OAAOU,UAAP,KAAsB,QAA1B,EAAoC;IAClCE,kBAAkB,CAACX,EAAnB,GAAwBS,UAAxB;EACD,CAFD,MAEO;IACLE,kBAAkB,GAAG;MACnBC,IAAI,
|
1
|
+
{"version":3,"names":["DefaultParameters","to","loop","yoyo","immediate","DefaultTimingConfig","duration","easing","t","getResolvedParams","toOrParams","config","resolvedParameters","from","resolvedConfig"],"sources":["getResolvedParams.ts"],"sourcesContent":["import type {\n RequiredAnimationParams,\n AnimationParams,\n TimingConfig,\n} from \"../../types\";\n\nconst DefaultParameters = {\n to: 1,\n loop: false,\n yoyo: false,\n immediate: true,\n};\n\nconst DefaultTimingConfig = {\n duration: 1000,\n easing: (t: number) => t,\n};\n\n/**\n * Resolves parameters from optional values to a single object\n * @param toOrParams Params or to value\n * @param config timing/spring configuration\n */\nexport const getResolvedParams = (\n toOrParams: number | AnimationParams,\n config?: TimingConfig\n): RequiredAnimationParams & Required<TimingConfig> => {\n let resolvedParameters: RequiredAnimationParams = {\n ...DefaultParameters,\n };\n\n if (typeof toOrParams === \"number\") {\n resolvedParameters.to = toOrParams;\n } else {\n resolvedParameters = {\n from: toOrParams.from ?? resolvedParameters.from,\n to: toOrParams.to ?? resolvedParameters.to,\n loop: toOrParams.loop ?? resolvedParameters.loop,\n yoyo: toOrParams.yoyo ?? resolvedParameters.yoyo,\n };\n }\n\n const resolvedConfig: Required<TimingConfig> = { ...DefaultTimingConfig };\n if (config) {\n resolvedConfig.duration = config.duration ?? DefaultTimingConfig.duration;\n resolvedConfig.easing = config.easing ?? DefaultTimingConfig.easing;\n }\n\n return { ...resolvedParameters, ...resolvedConfig };\n};\n"],"mappings":"AAMA,MAAMA,iBAAiB,GAAG;EACxBC,EAAE,EAAE,CADoB;EAExBC,IAAI,EAAE,KAFkB;EAGxBC,IAAI,EAAE,KAHkB;EAIxBC,SAAS,EAAE;AAJa,CAA1B;AAOA,MAAMC,mBAAmB,GAAG;EAC1BC,QAAQ,EAAE,IADgB;EAE1BC,MAAM,EAAGC,CAAD,IAAeA;AAFG,CAA5B;AAKA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,iBAAiB,GAAG,CAC/BC,UAD+B,EAE/BC,MAF+B,KAGsB;EACrD,IAAIC,kBAA2C,GAAG,EAChD,GAAGZ;EAD6C,CAAlD;;EAIA,IAAI,OAAOU,UAAP,KAAsB,QAA1B,EAAoC;IAClCE,kBAAkB,CAACX,EAAnB,GAAwBS,UAAxB;EACD,CAFD,MAEO;IAAA;;IACLE,kBAAkB,GAAG;MACnBC,IAAI,sBAAEH,UAAU,CAACG,IAAb,+DAAqBD,kBAAkB,CAACC,IADzB;MAEnBZ,EAAE,oBAAES,UAAU,CAACT,EAAb,2DAAmBW,kBAAkB,CAACX,EAFrB;MAGnBC,IAAI,sBAAEQ,UAAU,CAACR,IAAb,+DAAqBU,kBAAkB,CAACV,IAHzB;MAInBC,IAAI,sBAAEO,UAAU,CAACP,IAAb,+DAAqBS,kBAAkB,CAACT;IAJzB,CAArB;EAMD;;EAED,MAAMW,cAAsC,GAAG,EAAE,GAAGT;EAAL,CAA/C;;EACA,IAAIM,MAAJ,EAAY;IAAA;;IACVG,cAAc,CAACR,QAAf,uBAA0BK,MAAM,CAACL,QAAjC,+DAA6CD,mBAAmB,CAACC,QAAjE;IACAQ,cAAc,CAACP,MAAf,qBAAwBI,MAAM,CAACJ,MAA/B,2DAAyCF,mBAAmB,CAACE,MAA7D;EACD;;EAED,OAAO,EAAE,GAAGK,kBAAL;IAAyB,GAAGE;EAA5B,CAAP;AACD,CA1BM"}
|
@@ -11,6 +11,8 @@ import { createTiming } from "./createTiming";
|
|
11
11
|
*/
|
12
12
|
|
13
13
|
export const useTiming = (toOrParams, config, callback) => {
|
14
|
+
var _resolvedParameters$f;
|
15
|
+
|
14
16
|
// Resolve parameters - keep a cached version to avoid
|
15
17
|
// unnecesary re-renders.
|
16
18
|
const prevCfgRef = useRef();
|
@@ -24,7 +26,7 @@ export const useTiming = (toOrParams, config, callback) => {
|
|
24
26
|
return prevCfgRef.current;
|
25
27
|
}, [config, toOrParams]); // Create value
|
26
28
|
|
27
|
-
const value = useValue(resolvedParameters.from
|
29
|
+
const value = useValue((_resolvedParameters$f = resolvedParameters.from) !== null && _resolvedParameters$f !== void 0 ? _resolvedParameters$f : 0); // Create timing animation - keep a cached version to avoid
|
28
30
|
// uneccessary recreation of animations
|
29
31
|
|
30
32
|
const prevAnimationRef = useRef();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useEffect","useMemo","useRef","useValue","getResolvedParams","createTiming","useTiming","toOrParams","config","callback","prevCfgRef","resolvedParameters","nextParams","equals","current","value","from","prevAnimationRef","prevParamsRef","animation","undefined","a","b","JSON","stringify"],"sources":["useTiming.ts"],"sourcesContent":["import { useEffect, useMemo, useRef } from \"react\";\n\nimport type { SkiaValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n TimingConfig,\n AnimationCallback,\n} from \"../types\";\nimport { useValue } from \"../../values/hooks/useValue\";\n\nimport { getResolvedParams } from \"./functions\";\nimport { createTiming } from \"./createTiming\";\n\n/**\n * Creats an animation value that will run whenever\n * the animation parameters change. The animation start immediately.\n * @param toOrParams\n * @param config\n * @returns A value that is animated\n */\nexport const useTiming = (\n toOrParams: number | AnimationParams,\n config?: TimingConfig,\n callback?: AnimationCallback\n): SkiaValue<number> => {\n // Resolve parameters - keep a cached version to avoid\n // unnecesary re-renders.\n const prevCfgRef = useRef<ReturnType<typeof getResolvedParams>>();\n const resolvedParameters = useMemo(() => {\n const nextParams = getResolvedParams(toOrParams, config);\n if (!equals(prevCfgRef.current, nextParams)) {\n prevCfgRef.current = nextParams;\n }\n return prevCfgRef.current!;\n }, [config, toOrParams]);\n\n // Create value\n const value = useValue(resolvedParameters.from ?? 0);\n\n // Create timing animation - keep a cached version to avoid\n // uneccessary recreation of animations\n const prevAnimationRef = useRef<SkiaAnimation>();\n const prevParamsRef = useRef<typeof resolvedParameters>();\n const animation = useMemo(() => {\n if (!equals(prevParamsRef.current, resolvedParameters)) {\n prevParamsRef.current = resolvedParameters;\n prevAnimationRef.current = createTiming(\n resolvedParameters,\n value,\n callback\n );\n }\n return prevAnimationRef.current!;\n }, [callback, resolvedParameters, value]);\n\n // Run animation on the value - and stop it on unmount\n useEffect(() => {\n value.animation = animation;\n return () => (value.animation = undefined);\n }, [animation, value]);\n\n // Return the value that is animated\n return value;\n};\n\nconst equals = <T1, T2>(a: T1, b: T2) => {\n return JSON.stringify(a) === JSON.stringify(b);\n};\n"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,OAApB,EAA6BC,MAA7B,QAA2C,OAA3C;AAQA,SAASC,QAAT,QAAyB,6BAAzB;AAEA,SAASC,iBAAT,QAAkC,aAAlC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAID;EACtB;EACA;EACA,MAAMC,UAAU,GAAGR,MAAM,EAAzB;EACA,MAAMS,kBAAkB,GAAGV,OAAO,CAAC,MAAM;IACvC,MAAMW,UAAU,GAAGR,iBAAiB,CAACG,UAAD,EAAaC,MAAb,CAApC;;IACA,IAAI,CAACK,MAAM,CAACH,UAAU,CAACI,OAAZ,EAAqBF,UAArB,CAAX,EAA6C;MAC3CF,UAAU,CAACI,OAAX,GAAqBF,UAArB;IACD;;IACD,OAAOF,UAAU,CAACI,OAAlB;EACD,CANiC,EAM/B,CAACN,MAAD,EAASD,UAAT,CAN+B,CAAlC,CAJsB,CAYtB;;EACA,MAAMQ,KAAK,GAAGZ,QAAQ,
|
1
|
+
{"version":3,"names":["useEffect","useMemo","useRef","useValue","getResolvedParams","createTiming","useTiming","toOrParams","config","callback","prevCfgRef","resolvedParameters","nextParams","equals","current","value","from","prevAnimationRef","prevParamsRef","animation","undefined","a","b","JSON","stringify"],"sources":["useTiming.ts"],"sourcesContent":["import { useEffect, useMemo, useRef } from \"react\";\n\nimport type { SkiaValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n TimingConfig,\n AnimationCallback,\n} from \"../types\";\nimport { useValue } from \"../../values/hooks/useValue\";\n\nimport { getResolvedParams } from \"./functions\";\nimport { createTiming } from \"./createTiming\";\n\n/**\n * Creats an animation value that will run whenever\n * the animation parameters change. The animation start immediately.\n * @param toOrParams\n * @param config\n * @returns A value that is animated\n */\nexport const useTiming = (\n toOrParams: number | AnimationParams,\n config?: TimingConfig,\n callback?: AnimationCallback\n): SkiaValue<number> => {\n // Resolve parameters - keep a cached version to avoid\n // unnecesary re-renders.\n const prevCfgRef = useRef<ReturnType<typeof getResolvedParams>>();\n const resolvedParameters = useMemo(() => {\n const nextParams = getResolvedParams(toOrParams, config);\n if (!equals(prevCfgRef.current, nextParams)) {\n prevCfgRef.current = nextParams;\n }\n return prevCfgRef.current!;\n }, [config, toOrParams]);\n\n // Create value\n const value = useValue(resolvedParameters.from ?? 0);\n\n // Create timing animation - keep a cached version to avoid\n // uneccessary recreation of animations\n const prevAnimationRef = useRef<SkiaAnimation>();\n const prevParamsRef = useRef<typeof resolvedParameters>();\n const animation = useMemo(() => {\n if (!equals(prevParamsRef.current, resolvedParameters)) {\n prevParamsRef.current = resolvedParameters;\n prevAnimationRef.current = createTiming(\n resolvedParameters,\n value,\n callback\n );\n }\n return prevAnimationRef.current!;\n }, [callback, resolvedParameters, value]);\n\n // Run animation on the value - and stop it on unmount\n useEffect(() => {\n value.animation = animation;\n return () => (value.animation = undefined);\n }, [animation, value]);\n\n // Return the value that is animated\n return value;\n};\n\nconst equals = <T1, T2>(a: T1, b: T2) => {\n return JSON.stringify(a) === JSON.stringify(b);\n};\n"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,OAApB,EAA6BC,MAA7B,QAA2C,OAA3C;AAQA,SAASC,QAAT,QAAyB,6BAAzB;AAEA,SAASC,iBAAT,QAAkC,aAAlC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAID;EAAA;;EACtB;EACA;EACA,MAAMC,UAAU,GAAGR,MAAM,EAAzB;EACA,MAAMS,kBAAkB,GAAGV,OAAO,CAAC,MAAM;IACvC,MAAMW,UAAU,GAAGR,iBAAiB,CAACG,UAAD,EAAaC,MAAb,CAApC;;IACA,IAAI,CAACK,MAAM,CAACH,UAAU,CAACI,OAAZ,EAAqBF,UAArB,CAAX,EAA6C;MAC3CF,UAAU,CAACI,OAAX,GAAqBF,UAArB;IACD;;IACD,OAAOF,UAAU,CAACI,OAAlB;EACD,CANiC,EAM/B,CAACN,MAAD,EAASD,UAAT,CAN+B,CAAlC,CAJsB,CAYtB;;EACA,MAAMQ,KAAK,GAAGZ,QAAQ,0BAACQ,kBAAkB,CAACK,IAApB,yEAA4B,CAA5B,CAAtB,CAbsB,CAetB;EACA;;EACA,MAAMC,gBAAgB,GAAGf,MAAM,EAA/B;EACA,MAAMgB,aAAa,GAAGhB,MAAM,EAA5B;EACA,MAAMiB,SAAS,GAAGlB,OAAO,CAAC,MAAM;IAC9B,IAAI,CAACY,MAAM,CAACK,aAAa,CAACJ,OAAf,EAAwBH,kBAAxB,CAAX,EAAwD;MACtDO,aAAa,CAACJ,OAAd,GAAwBH,kBAAxB;MACAM,gBAAgB,CAACH,OAAjB,GAA2BT,YAAY,CACrCM,kBADqC,EAErCI,KAFqC,EAGrCN,QAHqC,CAAvC;IAKD;;IACD,OAAOQ,gBAAgB,CAACH,OAAxB;EACD,CAVwB,EAUtB,CAACL,QAAD,EAAWE,kBAAX,EAA+BI,KAA/B,CAVsB,CAAzB,CAnBsB,CA+BtB;;EACAf,SAAS,CAAC,MAAM;IACde,KAAK,CAACI,SAAN,GAAkBA,SAAlB;IACA,OAAO,MAAOJ,KAAK,CAACI,SAAN,GAAkBC,SAAhC;EACD,CAHQ,EAGN,CAACD,SAAD,EAAYJ,KAAZ,CAHM,CAAT,CAhCsB,CAqCtB;;EACA,OAAOA,KAAP;AACD,CA3CM;;AA6CP,MAAMF,MAAM,GAAG,CAASQ,CAAT,EAAgBC,CAAhB,KAA0B;EACvC,OAAOC,IAAI,CAACC,SAAL,CAAeH,CAAf,MAAsBE,IAAI,CAACC,SAAL,CAAeF,CAAf,CAA7B;AACD,CAFD"}
|
@@ -2,7 +2,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
2
2
|
|
3
3
|
import { JsiDeclarationNode } from "./Node";
|
4
4
|
import { PaintNode } from "./PaintNode";
|
5
|
-
import {
|
5
|
+
import { JsiRenderNode } from "./RenderNode";
|
6
6
|
export class JsiDrawingNode extends JsiRenderNode {
|
7
7
|
constructor(ctx, type, props) {
|
8
8
|
super(ctx, type, props);
|
@@ -46,14 +46,10 @@ export class JsiDrawingNode extends JsiRenderNode {
|
|
46
46
|
}
|
47
47
|
|
48
48
|
renderNode(ctx) {
|
49
|
-
if (this.props.paint
|
49
|
+
if (this.props.paint) {
|
50
50
|
this.draw({ ...ctx,
|
51
51
|
paint: this.props.paint
|
52
52
|
});
|
53
|
-
} else if (this.props.paint && this.props.paint.current != null) {
|
54
|
-
this.draw({ ...ctx,
|
55
|
-
paint: this.props.paint.current.materialize()
|
56
|
-
});
|
57
53
|
} else {
|
58
54
|
this.draw(ctx);
|
59
55
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiDeclarationNode","PaintNode","
|
1
|
+
{"version":3,"names":["JsiDeclarationNode","PaintNode","JsiRenderNode","JsiDrawingNode","constructor","ctx","type","props","derived","deriveProps","setProps","setProp","name","value","hasChanged","addChild","child","Error","insertChildBefore","before","renderNode","paint","draw","children","map","materialize"],"sources":["DrawingNode.ts"],"sourcesContent":["import type {\n DrawingContext,\n DrawingNodeProps,\n Node,\n NodeType,\n RenderNode,\n} from \"../types\";\n\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\nimport { PaintNode } from \"./PaintNode\";\nimport { JsiRenderNode } from \"./RenderNode\";\n\nexport abstract class JsiDrawingNode<P extends DrawingNodeProps, C>\n extends JsiRenderNode<P>\n implements RenderNode<P>\n{\n protected derived?: C;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.derived = this.deriveProps();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.derived = this.deriveProps();\n }\n\n setProp<K extends keyof P>(name: K, value: P[K]) {\n const hasChanged = super.setProp(name, value);\n if (hasChanged) {\n this.derived = this.deriveProps();\n }\n return hasChanged;\n }\n\n addChild(child: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n this.derived = this.deriveProps();\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n this.derived = this.deriveProps();\n }\n\n renderNode(ctx: DrawingContext): void {\n if (this.props.paint) {\n this.draw({ ...ctx, paint: this.props.paint });\n } else {\n this.draw(ctx);\n }\n this.children().map((child) => {\n if (child instanceof PaintNode) {\n const paint = child.materialize();\n this.draw({ ...ctx, paint });\n }\n });\n }\n\n protected abstract draw(ctx: DrawingContext): void;\n protected abstract deriveProps(): C;\n}\n"],"mappings":";;AASA,SAASA,kBAAT,QAAmC,QAAnC;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B,cAA9B;AAEA,OAAO,MAAeC,cAAf,SACGD,aADH,CAGP;EAGEE,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWC,IAAX,EAAiBC,KAAjB;;IADsD;;IAEtD,KAAKC,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDC,QAAQ,CAACH,KAAD,EAAW;IACjB,MAAMG,QAAN,CAAeH,KAAf;IACA,KAAKC,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDE,OAAO,CAAoBC,IAApB,EAA6BC,KAA7B,EAA0C;IAC/C,MAAMC,UAAU,GAAG,MAAMH,OAAN,CAAcC,IAAd,EAAoBC,KAApB,CAAnB;;IACA,IAAIC,UAAJ,EAAgB;MACd,KAAKN,OAAL,GAAe,KAAKC,WAAL,EAAf;IACD;;IACD,OAAOK,UAAP;EACD;;EAEDC,QAAQ,CAACC,KAAD,EAA6B;IACnC,IAAI,EAAEA,KAAK,YAAYhB,kBAAnB,CAAJ,EAA4C;MAC1C,MAAM,IAAIiB,KAAJ,CAAW,cAAaD,KAAK,CAACV,IAAK,OAAM,KAAKA,IAAK,EAAnD,CAAN;IACD;;IACD,MAAMS,QAAN,CAAeC,KAAf;IACA,KAAKR,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDS,iBAAiB,CAACF,KAAD,EAAuBG,MAAvB,EAAoD;IACnE,IAAI,EAAEH,KAAK,YAAYhB,kBAAnB,CAAJ,EAA4C;MAC1C,MAAM,IAAIiB,KAAJ,CAAW,cAAaD,KAAK,CAACV,IAAK,OAAM,KAAKA,IAAK,EAAnD,CAAN;IACD;;IACD,MAAMY,iBAAN,CAAwBF,KAAxB,EAA+BG,MAA/B;IACA,KAAKX,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDW,UAAU,CAACf,GAAD,EAA4B;IACpC,IAAI,KAAKE,KAAL,CAAWc,KAAf,EAAsB;MACpB,KAAKC,IAAL,CAAU,EAAE,GAAGjB,GAAL;QAAUgB,KAAK,EAAE,KAAKd,KAAL,CAAWc;MAA5B,CAAV;IACD,CAFD,MAEO;MACL,KAAKC,IAAL,CAAUjB,GAAV;IACD;;IACD,KAAKkB,QAAL,GAAgBC,GAAhB,CAAqBR,KAAD,IAAW;MAC7B,IAAIA,KAAK,YAAYf,SAArB,EAAgC;QAC9B,MAAMoB,KAAK,GAAGL,KAAK,CAACS,WAAN,EAAd;QACA,KAAKH,IAAL,CAAU,EAAE,GAAGjB,GAAL;UAAUgB;QAAV,CAAV;MACD;IACF,CALD;EAMD;;AAjDH"}
|
@@ -12,11 +12,11 @@ export class JsiSkDOM {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
Layer(props) {
|
15
|
-
return new LayerNode(this.ctx, props
|
15
|
+
return new LayerNode(this.ctx, props !== null && props !== void 0 ? props : {});
|
16
16
|
}
|
17
17
|
|
18
18
|
Group(props) {
|
19
|
-
return new GroupNode(this.ctx, props
|
19
|
+
return new GroupNode(this.ctx, props !== null && props !== void 0 ? props : {});
|
20
20
|
}
|
21
21
|
|
22
22
|
Paint(props) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["FillNode","ImageNode","CircleNode","PathNode","LineNode","PatchNode","PointsNode","RectNode","RRectNode","VerticesNode","TextNode","OvalNode","CustomDrawingNode","TextPathNode","TextBlobNode","GlyphsNode","DiffRectNode","PictureNode","ImageSVGNode","BackdropFilterNode","BoxNode","BoxShadowNode","BlendImageFilterNode","BlurImageFilterNode","BlurMaskFilterNode","DisplacementMapImageFilterNode","DropShadowImageFilterNode","OffsetImageFilterNode","RuntimeShaderImageFilterNode","CornerPathEffectNode","DiscretePathEffectNode","DashPathEffectNode","Path1DPathEffectNode","Path2DPathEffectNode","SumPathEffectNode","Line2DPathEffectNode","BlendNode","MatrixColorFilterNode","LumaColorFilterNode","LinearToSRGBGammaColorFilterNode","SRGBToLinearGammaColorFilterNode","BlendColorFilterNode","LerpColorFilterNode","LinearGradientNode","ShaderNode","ImageShaderNode","TwoPointConicalGradientNode","TurbulenceNode","SweepGradientNode","RadialGradientNode","FractalNoiseNode","ColorNode","MorphologyImageFilterNode","GroupNode","PaintNode","LayerNode","JsiSkDOM","constructor","ctx","Layer","props","Group","Paint","Fill","Image","Circle","Path","CustomDrawing","Line","Oval","Patch","Points","Rect","RRect","Vertices","Text","TextPath","TextBlob","Glyphs","DiffRect","Picture","ImageSVG","BlurMaskFilter","BlendImageFilter","DropShadowImageFilter","DisplacementMapImageFilter","BlurImageFilter","OffsetImageFilter","MorphologyImageFilter","RuntimeShaderImageFilter","MatrixColorFilter","BlendColorFilter","LumaColorFilter","LinearToSRGBGammaColorFilter","SRGBToLinearGammaColorFilter","LerpColorFilter","Shader","ImageShader","ColorShader","SweepGradient","Turbulence","FractalNoise","LinearGradient","RadialGradient","TwoPointConicalGradient","CornerPathEffect","DiscretePathEffect","DashPathEffect","Path1DPathEffect","Path2DPathEffect","SumPathEffect","Line2DPathEffect","Blend","BackdropFilter","Box","BoxShadow"],"sources":["JsiSkDOM.ts"],"sourcesContent":["import type {\n PathProps,\n SkDOM,\n GroupProps,\n ImageProps,\n BlurImageFilterProps,\n MatrixColorFilterProps,\n CircleProps,\n BlurMaskFilterProps,\n LinearGradientProps,\n PaintProps,\n ShaderProps,\n ImageShaderProps,\n CustomDrawingNodeProps,\n LineProps,\n OvalProps,\n PatchProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n VerticesProps,\n TextProps,\n DiffRectProps,\n OffsetImageFilterProps,\n BlendColorFilterProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n FractalNoiseProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n DrawingNodeProps,\n BoxProps,\n BoxShadowProps,\n ChildrenProps,\n} from \"../types\";\nimport type {\n BlendImageFilterProps,\n BlendProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../types/ImageFilters\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../types/PathEffects\";\n\nimport {\n FillNode,\n ImageNode,\n CircleNode,\n PathNode,\n LineNode,\n PatchNode,\n PointsNode,\n RectNode,\n RRectNode,\n VerticesNode,\n TextNode,\n OvalNode,\n CustomDrawingNode,\n TextPathNode,\n TextBlobNode,\n GlyphsNode,\n DiffRectNode,\n PictureNode,\n ImageSVGNode,\n BackdropFilterNode,\n BoxNode,\n BoxShadowNode,\n} from \"./drawings\";\nimport {\n BlendImageFilterNode,\n BlurImageFilterNode,\n BlurMaskFilterNode,\n DisplacementMapImageFilterNode,\n DropShadowImageFilterNode,\n OffsetImageFilterNode,\n RuntimeShaderImageFilterNode,\n CornerPathEffectNode,\n DiscretePathEffectNode,\n DashPathEffectNode,\n Path1DPathEffectNode,\n Path2DPathEffectNode,\n SumPathEffectNode,\n Line2DPathEffectNode,\n BlendNode,\n} from \"./paint\";\nimport {\n MatrixColorFilterNode,\n LumaColorFilterNode,\n LinearToSRGBGammaColorFilterNode,\n SRGBToLinearGammaColorFilterNode,\n BlendColorFilterNode,\n LerpColorFilterNode,\n} from \"./paint/ColorFilters\";\nimport {\n LinearGradientNode,\n ShaderNode,\n ImageShaderNode,\n TwoPointConicalGradientNode,\n TurbulenceNode,\n SweepGradientNode,\n RadialGradientNode,\n FractalNoiseNode,\n ColorNode,\n} from \"./paint/Shaders\";\nimport { MorphologyImageFilterNode } from \"./paint/ImageFilters\";\nimport { GroupNode } from \"./GroupNode\";\nimport { PaintNode } from \"./PaintNode\";\nimport type { NodeContext } from \"./Node\";\nimport { LayerNode } from \"./LayerNode\";\n\nexport class JsiSkDOM implements SkDOM {\n constructor(private ctx: NodeContext) {}\n\n Layer(props?: ChildrenProps) {\n return new LayerNode(this.ctx, props ?? {});\n }\n\n Group(props?: GroupProps) {\n return new GroupNode(this.ctx, props ?? {});\n }\n\n Paint(props: PaintProps) {\n return new PaintNode(this.ctx, props);\n }\n\n // Drawings\n Fill(props?: DrawingNodeProps) {\n return new FillNode(this.ctx, props);\n }\n\n Image(props: ImageProps) {\n return new ImageNode(this.ctx, props);\n }\n\n Circle(props: CircleProps) {\n return new CircleNode(this.ctx, props);\n }\n\n Path(props: PathProps) {\n return new PathNode(this.ctx, props);\n }\n\n CustomDrawing(props: CustomDrawingNodeProps) {\n return new CustomDrawingNode(this.ctx, props);\n }\n\n Line(props: LineProps) {\n return new LineNode(this.ctx, props);\n }\n\n Oval(props: OvalProps) {\n return new OvalNode(this.ctx, props);\n }\n\n Patch(props: PatchProps) {\n return new PatchNode(this.ctx, props);\n }\n\n Points(props: PointsProps) {\n return new PointsNode(this.ctx, props);\n }\n\n Rect(props: RectProps) {\n return new RectNode(this.ctx, props);\n }\n\n RRect(props: RoundedRectProps) {\n return new RRectNode(this.ctx, props);\n }\n\n Vertices(props: VerticesProps) {\n return new VerticesNode(this.ctx, props);\n }\n\n Text(props: TextProps) {\n return new TextNode(this.ctx, props);\n }\n\n TextPath(props: TextPathProps) {\n return new TextPathNode(this.ctx, props);\n }\n\n TextBlob(props: TextBlobProps) {\n return new TextBlobNode(this.ctx, props);\n }\n\n Glyphs(props: GlyphsProps) {\n return new GlyphsNode(this.ctx, props);\n }\n\n DiffRect(props: DiffRectProps) {\n return new DiffRectNode(this.ctx, props);\n }\n\n Picture(props: PictureProps) {\n return new PictureNode(this.ctx, props);\n }\n\n ImageSVG(props: ImageSVGProps) {\n return new ImageSVGNode(this.ctx, props);\n }\n\n // BlurMaskFilters\n BlurMaskFilter(props: BlurMaskFilterProps) {\n return new BlurMaskFilterNode(this.ctx, props);\n }\n\n // ImageFilters\n BlendImageFilter(props: BlendImageFilterProps) {\n return new BlendImageFilterNode(this.ctx, props);\n }\n\n DropShadowImageFilter(props: DropShadowImageFilterProps) {\n return new DropShadowImageFilterNode(this.ctx, props);\n }\n\n DisplacementMapImageFilter(props: DisplacementMapImageFilterProps) {\n return new DisplacementMapImageFilterNode(this.ctx, props);\n }\n\n BlurImageFilter(props: BlurImageFilterProps) {\n return new BlurImageFilterNode(this.ctx, props);\n }\n\n OffsetImageFilter(props: OffsetImageFilterProps) {\n return new OffsetImageFilterNode(this.ctx, props);\n }\n\n MorphologyImageFilter(props: MorphologyImageFilterProps) {\n return new MorphologyImageFilterNode(this.ctx, props);\n }\n\n RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps) {\n return new RuntimeShaderImageFilterNode(this.ctx, props);\n }\n\n // Color Filters\n MatrixColorFilter(props: MatrixColorFilterProps) {\n return new MatrixColorFilterNode(this.ctx, props);\n }\n\n BlendColorFilter(props: BlendColorFilterProps) {\n return new BlendColorFilterNode(this.ctx, props);\n }\n\n LumaColorFilter() {\n return new LumaColorFilterNode(this.ctx);\n }\n\n LinearToSRGBGammaColorFilter() {\n return new LinearToSRGBGammaColorFilterNode(this.ctx);\n }\n\n SRGBToLinearGammaColorFilter() {\n return new SRGBToLinearGammaColorFilterNode(this.ctx);\n }\n\n LerpColorFilter(props: LerpColorFilterProps) {\n return new LerpColorFilterNode(this.ctx, props);\n }\n\n // Shaders\n Shader(props: ShaderProps) {\n return new ShaderNode(this.ctx, props);\n }\n\n ImageShader(props: ImageShaderProps) {\n return new ImageShaderNode(this.ctx, props);\n }\n\n ColorShader(props: ColorProps) {\n return new ColorNode(this.ctx, props);\n }\n\n SweepGradient(props: SweepGradientProps) {\n return new SweepGradientNode(this.ctx, props);\n }\n\n Turbulence(props: TurbulenceProps) {\n return new TurbulenceNode(this.ctx, props);\n }\n\n FractalNoise(props: FractalNoiseProps) {\n return new FractalNoiseNode(this.ctx, props);\n }\n\n LinearGradient(props: LinearGradientProps) {\n return new LinearGradientNode(this.ctx, props);\n }\n\n RadialGradient(props: RadialGradientProps) {\n return new RadialGradientNode(this.ctx, props);\n }\n\n TwoPointConicalGradient(props: TwoPointConicalGradientProps) {\n return new TwoPointConicalGradientNode(this.ctx, props);\n }\n\n // Path Effects\n CornerPathEffect(props: CornerPathEffectProps) {\n return new CornerPathEffectNode(this.ctx, props);\n }\n\n DiscretePathEffect(props: DiscretePathEffectProps) {\n return new DiscretePathEffectNode(this.ctx, props);\n }\n\n DashPathEffect(props: DashPathEffectProps) {\n return new DashPathEffectNode(this.ctx, props);\n }\n\n Path1DPathEffect(props: Path1DPathEffectProps) {\n return new Path1DPathEffectNode(this.ctx, props);\n }\n\n Path2DPathEffect(props: Path2DPathEffectProps) {\n return new Path2DPathEffectNode(this.ctx, props);\n }\n\n SumPathEffect() {\n return new SumPathEffectNode(this.ctx);\n }\n\n Line2DPathEffect(props: Line2DPathEffectProps) {\n return new Line2DPathEffectNode(this.ctx, props);\n }\n\n Blend(props: BlendProps) {\n return new BlendNode(this.ctx, props);\n }\n\n BackdropFilter(props: ChildrenProps) {\n return new BackdropFilterNode(this.ctx, props);\n }\n\n Box(props: BoxProps) {\n return new BoxNode(this.ctx, props);\n }\n\n BoxShadow(props: BoxShadowProps) {\n return new BoxShadowNode(this.ctx, props);\n }\n}\n"],"mappings":"AA2DA,SACEA,QADF,EAEEC,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PathNode","LineNode","PatchNode","PointsNode","RectNode","RRectNode","VerticesNode","TextNode","OvalNode","CustomDrawingNode","TextPathNode","TextBlobNode","GlyphsNode","DiffRectNode","PictureNode","ImageSVGNode","BackdropFilterNode","BoxNode","BoxShadowNode","BlendImageFilterNode","BlurImageFilterNode","BlurMaskFilterNode","DisplacementMapImageFilterNode","DropShadowImageFilterNode","OffsetImageFilterNode","RuntimeShaderImageFilterNode","CornerPathEffectNode","DiscretePathEffectNode","DashPathEffectNode","Path1DPathEffectNode","Path2DPathEffectNode","SumPathEffectNode","Line2DPathEffectNode","BlendNode","MatrixColorFilterNode","LumaColorFilterNode","LinearToSRGBGammaColorFilterNode","SRGBToLinearGammaColorFilterNode","BlendColorFilterNode","LerpColorFilterNode","LinearGradientNode","ShaderNode","ImageShaderNode","TwoPointConicalGradientNode","TurbulenceNode","SweepGradientNode","RadialGradientNode","FractalNoiseNode","ColorNode","MorphologyImageFilterNode","GroupNode","PaintNode","LayerNode","JsiSkDOM","constructor","ctx","Layer","props","Group","Paint","Fill","Image","Circle","Path","CustomDrawing","Line","Oval","Patch","Points","Rect","RRect","Vertices","Text","TextPath","TextBlob","Glyphs","DiffRect","Picture","ImageSVG","BlurMaskFilter","BlendImageFilter","DropShadowImageFilter","DisplacementMapImageFilter","BlurImageFilter","OffsetImageFilter","MorphologyImageFilter","RuntimeShaderImageFilter","MatrixColorFilter","BlendColorFilter","LumaColorFilter","LinearToSRGBGammaColorFilter","SRGBToLinearGammaColorFilter","LerpColorFilter","Shader","ImageShader","ColorShader","SweepGradient","Turbulence","FractalNoise","LinearGradient","RadialGradient","TwoPointConicalGradient","CornerPathEffect","DiscretePathEffect","DashPathEffect","Path1DPathEffect","Path2DPathEffect","SumPathEffect","Line2DPathEffect","Blend","BackdropFilter","Box","BoxShadow"],"sources":["JsiSkDOM.ts"],"sourcesContent":["import type {\n PathProps,\n SkDOM,\n GroupProps,\n ImageProps,\n BlurImageFilterProps,\n MatrixColorFilterProps,\n CircleProps,\n BlurMaskFilterProps,\n LinearGradientProps,\n PaintProps,\n ShaderProps,\n ImageShaderProps,\n CustomDrawingNodeProps,\n LineProps,\n OvalProps,\n PatchProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n VerticesProps,\n TextProps,\n DiffRectProps,\n OffsetImageFilterProps,\n BlendColorFilterProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n FractalNoiseProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n DrawingNodeProps,\n BoxProps,\n BoxShadowProps,\n ChildrenProps,\n} from \"../types\";\nimport type {\n BlendImageFilterProps,\n BlendProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../types/ImageFilters\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../types/PathEffects\";\n\nimport {\n FillNode,\n ImageNode,\n CircleNode,\n PathNode,\n LineNode,\n PatchNode,\n PointsNode,\n RectNode,\n RRectNode,\n VerticesNode,\n TextNode,\n OvalNode,\n CustomDrawingNode,\n TextPathNode,\n TextBlobNode,\n GlyphsNode,\n DiffRectNode,\n PictureNode,\n ImageSVGNode,\n BackdropFilterNode,\n BoxNode,\n BoxShadowNode,\n} from \"./drawings\";\nimport {\n BlendImageFilterNode,\n BlurImageFilterNode,\n BlurMaskFilterNode,\n DisplacementMapImageFilterNode,\n DropShadowImageFilterNode,\n OffsetImageFilterNode,\n RuntimeShaderImageFilterNode,\n CornerPathEffectNode,\n DiscretePathEffectNode,\n DashPathEffectNode,\n Path1DPathEffectNode,\n Path2DPathEffectNode,\n SumPathEffectNode,\n Line2DPathEffectNode,\n BlendNode,\n} from \"./paint\";\nimport {\n MatrixColorFilterNode,\n LumaColorFilterNode,\n LinearToSRGBGammaColorFilterNode,\n SRGBToLinearGammaColorFilterNode,\n BlendColorFilterNode,\n LerpColorFilterNode,\n} from \"./paint/ColorFilters\";\nimport {\n LinearGradientNode,\n ShaderNode,\n ImageShaderNode,\n TwoPointConicalGradientNode,\n TurbulenceNode,\n SweepGradientNode,\n RadialGradientNode,\n FractalNoiseNode,\n ColorNode,\n} from \"./paint/Shaders\";\nimport { MorphologyImageFilterNode } from \"./paint/ImageFilters\";\nimport { GroupNode } from \"./GroupNode\";\nimport { PaintNode } from \"./PaintNode\";\nimport type { NodeContext } from \"./Node\";\nimport { LayerNode } from \"./LayerNode\";\n\nexport class JsiSkDOM implements SkDOM {\n constructor(private ctx: NodeContext) {}\n\n Layer(props?: ChildrenProps) {\n return new LayerNode(this.ctx, props ?? {});\n }\n\n Group(props?: GroupProps) {\n return new GroupNode(this.ctx, props ?? {});\n }\n\n Paint(props: PaintProps) {\n return new PaintNode(this.ctx, props);\n }\n\n // Drawings\n Fill(props?: DrawingNodeProps) {\n return new FillNode(this.ctx, props);\n }\n\n Image(props: ImageProps) {\n return new ImageNode(this.ctx, props);\n }\n\n Circle(props: CircleProps) {\n return new CircleNode(this.ctx, props);\n }\n\n Path(props: PathProps) {\n return new PathNode(this.ctx, props);\n }\n\n CustomDrawing(props: CustomDrawingNodeProps) {\n return new CustomDrawingNode(this.ctx, props);\n }\n\n Line(props: LineProps) {\n return new LineNode(this.ctx, props);\n }\n\n Oval(props: OvalProps) {\n return new OvalNode(this.ctx, props);\n }\n\n Patch(props: PatchProps) {\n return new PatchNode(this.ctx, props);\n }\n\n Points(props: PointsProps) {\n return new PointsNode(this.ctx, props);\n }\n\n Rect(props: RectProps) {\n return new RectNode(this.ctx, props);\n }\n\n RRect(props: RoundedRectProps) {\n return new RRectNode(this.ctx, props);\n }\n\n Vertices(props: VerticesProps) {\n return new VerticesNode(this.ctx, props);\n }\n\n Text(props: TextProps) {\n return new TextNode(this.ctx, props);\n }\n\n TextPath(props: TextPathProps) {\n return new TextPathNode(this.ctx, props);\n }\n\n TextBlob(props: TextBlobProps) {\n return new TextBlobNode(this.ctx, props);\n }\n\n Glyphs(props: GlyphsProps) {\n return new GlyphsNode(this.ctx, props);\n }\n\n DiffRect(props: DiffRectProps) {\n return new DiffRectNode(this.ctx, props);\n }\n\n Picture(props: PictureProps) {\n return new PictureNode(this.ctx, props);\n }\n\n ImageSVG(props: ImageSVGProps) {\n return new ImageSVGNode(this.ctx, props);\n }\n\n // BlurMaskFilters\n BlurMaskFilter(props: BlurMaskFilterProps) {\n return new BlurMaskFilterNode(this.ctx, props);\n }\n\n // ImageFilters\n BlendImageFilter(props: BlendImageFilterProps) {\n return new BlendImageFilterNode(this.ctx, props);\n }\n\n DropShadowImageFilter(props: DropShadowImageFilterProps) {\n return new DropShadowImageFilterNode(this.ctx, props);\n }\n\n DisplacementMapImageFilter(props: DisplacementMapImageFilterProps) {\n return new DisplacementMapImageFilterNode(this.ctx, props);\n }\n\n BlurImageFilter(props: BlurImageFilterProps) {\n return new BlurImageFilterNode(this.ctx, props);\n }\n\n OffsetImageFilter(props: OffsetImageFilterProps) {\n return new OffsetImageFilterNode(this.ctx, props);\n }\n\n MorphologyImageFilter(props: MorphologyImageFilterProps) {\n return new MorphologyImageFilterNode(this.ctx, props);\n }\n\n RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps) {\n return new RuntimeShaderImageFilterNode(this.ctx, props);\n }\n\n // Color Filters\n MatrixColorFilter(props: MatrixColorFilterProps) {\n return new MatrixColorFilterNode(this.ctx, props);\n }\n\n BlendColorFilter(props: BlendColorFilterProps) {\n return new BlendColorFilterNode(this.ctx, props);\n }\n\n LumaColorFilter() {\n return new LumaColorFilterNode(this.ctx);\n }\n\n LinearToSRGBGammaColorFilter() {\n return new LinearToSRGBGammaColorFilterNode(this.ctx);\n }\n\n SRGBToLinearGammaColorFilter() {\n return new SRGBToLinearGammaColorFilterNode(this.ctx);\n }\n\n LerpColorFilter(props: LerpColorFilterProps) {\n return new LerpColorFilterNode(this.ctx, props);\n }\n\n // Shaders\n Shader(props: ShaderProps) {\n return new ShaderNode(this.ctx, props);\n }\n\n ImageShader(props: ImageShaderProps) {\n return new ImageShaderNode(this.ctx, props);\n }\n\n ColorShader(props: ColorProps) {\n return new ColorNode(this.ctx, props);\n }\n\n SweepGradient(props: SweepGradientProps) {\n return new SweepGradientNode(this.ctx, props);\n }\n\n Turbulence(props: TurbulenceProps) {\n return new TurbulenceNode(this.ctx, props);\n }\n\n FractalNoise(props: FractalNoiseProps) {\n return new FractalNoiseNode(this.ctx, props);\n }\n\n LinearGradient(props: LinearGradientProps) {\n return new LinearGradientNode(this.ctx, props);\n }\n\n RadialGradient(props: RadialGradientProps) {\n return new RadialGradientNode(this.ctx, props);\n }\n\n TwoPointConicalGradient(props: TwoPointConicalGradientProps) {\n return new TwoPointConicalGradientNode(this.ctx, props);\n }\n\n // Path Effects\n CornerPathEffect(props: CornerPathEffectProps) {\n return new CornerPathEffectNode(this.ctx, props);\n }\n\n DiscretePathEffect(props: DiscretePathEffectProps) {\n return new DiscretePathEffectNode(this.ctx, props);\n }\n\n DashPathEffect(props: DashPathEffectProps) {\n return new DashPathEffectNode(this.ctx, props);\n }\n\n Path1DPathEffect(props: Path1DPathEffectProps) {\n return new Path1DPathEffectNode(this.ctx, props);\n }\n\n Path2DPathEffect(props: Path2DPathEffectProps) {\n return new Path2DPathEffectNode(this.ctx, props);\n }\n\n SumPathEffect() {\n return new SumPathEffectNode(this.ctx);\n }\n\n Line2DPathEffect(props: Line2DPathEffectProps) {\n return new Line2DPathEffectNode(this.ctx, props);\n }\n\n Blend(props: BlendProps) {\n return new BlendNode(this.ctx, props);\n }\n\n BackdropFilter(props: ChildrenProps) {\n return new BackdropFilterNode(this.ctx, props);\n }\n\n Box(props: BoxProps) {\n return new BoxNode(this.ctx, props);\n }\n\n BoxShadow(props: BoxShadowProps) {\n return new BoxShadowNode(this.ctx, props);\n }\n}\n"],"mappings":"AA2DA,SACEA,QADF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BE,KAA5B,CAAP;EACD;;AAvOoC"}
|
@@ -207,10 +207,8 @@ export class JsiRenderNode extends JsiNode {
|
|
207
207
|
if (layer) {
|
208
208
|
if (typeof layer === "boolean") {
|
209
209
|
canvas.saveLayer();
|
210
|
-
} else if (isSkPaint(layer)) {
|
211
|
-
canvas.saveLayer(layer);
|
212
210
|
} else {
|
213
|
-
canvas.saveLayer(layer
|
211
|
+
canvas.saveLayer(layer);
|
214
212
|
}
|
215
213
|
} else {
|
216
214
|
canvas.save();
|
@@ -237,7 +235,6 @@ export class JsiRenderNode extends JsiNode {
|
|
237
235
|
}
|
238
236
|
|
239
237
|
}
|
240
|
-
export const isSkPaint = obj => "__typename__" in obj && obj.__typename__ === "Paint";
|
241
238
|
|
242
239
|
const concatPaint = (parent, _ref, opacity) => {
|
243
240
|
let {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["StrokeCap","StrokeJoin","PaintStyle","BlendMode","ClipOp","isRRect","isPathDef","processPath","processTransformProps","JsiNode","JsiDeclarationNode","enumKey","paintProps","JsiRenderNode","constructor","ctx","type","props","matrix","Skia","Matrix","onPropChange","setProps","paintCache","setProp","key","value","hasChanged","includes","identity","clipPath","undefined","clipRect","clipRRect","computeMatrix","computeClip","addChild","child","setInvalidate","insertChildBefore","before","clip","getPaintCtx","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","Color","_children","forEach","isColorFilter","cf","materialize","colorFilter","ColorFilter","MakeCompose","isShader","shader","isPathEffect","pe","pathEffect","PathEffect","isImageFilter","filter","imageFilter","ImageFilter","isMaskFilter","maskFilter","render","parentCtx","invertClip","layer","transform","canvas","parent","paint","paintCtx","concatPaint","hasTransform","hasClip","shouldSave","op","Difference","Intersect","saveLayer","isSkPaint","current","save","concat","renderNode","restore","obj","__typename__","alpha","copy","setShader","setColor","cl","getColor","setStrokeWidth","setAntiAlias","setBlendMode","setColorFilter","setImageFilter","setMaskFilter","setPathEffect","setAlphaf","setStrokeCap","setStrokeJoin","setStrokeMiter","setStyle"],"sources":["RenderNode.ts"],"sourcesContent":["import type { RefObject } from \"react\";\n\nimport type {\n SkMatrix,\n SkRect,\n SkRRect,\n SkPath,\n SkPaint,\n} from \"../../skia/types\";\nimport {\n StrokeCap,\n StrokeJoin,\n PaintStyle,\n BlendMode,\n ClipOp,\n isRRect,\n} from \"../../skia/types\";\nimport type {\n RenderNode,\n GroupProps,\n DrawingContext,\n NodeType,\n Node,\n DeclarationNode,\n} from \"../types\";\n\nimport { isPathDef, processPath, processTransformProps } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiNode, JsiDeclarationNode } from \"./Node\";\nimport type { PaintContext } from \"./PaintContext\";\nimport { enumKey } from \"./datatypes/Enum\";\n\nconst paintProps = [\n \"color\",\n \"strokeWidth\",\n \"blendMode\",\n \"strokeCap\",\n \"strokeJoin\",\n \"strokeMiter\",\n \"style\",\n \"antiAlias\",\n \"opacity\",\n];\n\ninterface PaintCache {\n parent: SkPaint;\n child: SkPaint;\n}\n\nexport abstract class JsiRenderNode<P extends GroupProps>\n extends JsiNode<P>\n implements RenderNode<P>\n{\n paintCache: PaintCache | null = null;\n matrix: SkMatrix;\n clipRect?: SkRect;\n clipRRect?: SkRRect;\n clipPath?: SkPath;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.matrix = this.Skia.Matrix();\n this.onPropChange();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.onPropChange();\n this.paintCache = null;\n }\n\n setProp<K extends keyof P>(key: K, value: P[K]) {\n const hasChanged = super.setProp(key, value);\n if (hasChanged) {\n this.onPropChange();\n if (paintProps.includes(key as string)) {\n this.paintCache = null;\n }\n }\n return hasChanged;\n }\n\n protected onPropChange() {\n this.matrix.identity();\n this.clipPath = undefined;\n this.clipRect = undefined;\n this.clipRRect = undefined;\n this.computeMatrix();\n this.computeClip();\n }\n\n addChild(child: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.addChild(child);\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.insertChildBefore(child, before);\n }\n\n private computeClip() {\n const { clip } = this.props;\n if (clip) {\n if (isPathDef(clip)) {\n this.clipPath = processPath(this.Skia, clip);\n } else if (isRRect(clip)) {\n this.clipRRect = clip;\n } else {\n this.clipRect = clip;\n }\n }\n }\n\n private computeMatrix() {\n processTransformProps(this.matrix, this.props);\n }\n\n private getPaintCtx() {\n let ctx: PaintContext | undefined;\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n } = this.props;\n if (\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n opacity !== undefined ||\n antiAlias !== undefined\n ) {\n ctx = {};\n if (color !== undefined) {\n ctx.color = this.Skia.Color(color);\n }\n if (strokeWidth !== undefined) {\n ctx.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n ctx.blendMode = BlendMode[enumKey(blendMode)];\n }\n if (style !== undefined) {\n ctx.style = PaintStyle[enumKey(style)];\n }\n if (strokeJoin !== undefined) {\n ctx.strokeJoin = StrokeJoin[enumKey(strokeJoin)];\n }\n if (strokeCap !== undefined) {\n ctx.strokeCap = StrokeCap[enumKey(strokeCap)];\n }\n if (strokeMiter !== undefined) {\n ctx.strokeMiter = strokeMiter;\n }\n if (opacity !== undefined) {\n ctx.opacity = opacity;\n }\n if (antiAlias !== undefined) {\n ctx.antiAlias = antiAlias;\n }\n }\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n if (child.isColorFilter()) {\n ctx = ctx || {};\n const cf = child.materialize();\n ctx.colorFilter = ctx.colorFilter\n ? this.Skia.ColorFilter.MakeCompose(cf, ctx.colorFilter)\n : cf;\n } else if (child.isShader()) {\n ctx = ctx || {};\n const shader = child.materialize();\n ctx.shader = shader;\n } else if (child.isPathEffect()) {\n ctx = ctx || {};\n const pe = child.materialize();\n ctx.pathEffect = ctx.pathEffect\n ? this.Skia.PathEffect.MakeCompose(pe, ctx.pathEffect)\n : pe;\n } else if (child.isImageFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.imageFilter = ctx.imageFilter\n ? this.Skia.ImageFilter.MakeCompose(filter, ctx.imageFilter)\n : filter;\n } else if (child.isMaskFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.maskFilter = filter;\n }\n }\n });\n return ctx;\n }\n\n render(parentCtx: DrawingContext) {\n const { invertClip, layer, matrix, transform } = this.props;\n const { canvas } = parentCtx;\n\n const opacity =\n this.props.opacity !== undefined\n ? parentCtx.opacity * this.props.opacity\n : parentCtx.opacity;\n\n if (\n this.paintCache === null ||\n this.paintCache.parent !== parentCtx.paint\n ) {\n const paintCtx = this.getPaintCtx();\n const child = paintCtx\n ? concatPaint(parentCtx.paint, paintCtx, parentCtx.opacity)\n : parentCtx.paint;\n this.paintCache = { parent: parentCtx.paint, child };\n }\n const paint = this.paintCache.child;\n // TODO: can we only recreate a new context here if needed?\n const ctx = { ...parentCtx, opacity, paint };\n const hasTransform = matrix !== undefined || transform !== undefined;\n const hasClip =\n this.clipRect !== undefined ||\n this.clipPath !== undefined ||\n this.clipRRect !== undefined;\n const shouldSave = hasTransform || hasClip || !!layer;\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else if (isSkPaint(layer)) {\n canvas.saveLayer(layer);\n } else {\n canvas.saveLayer(\n layer.current ? layer.current.materialize() : undefined\n );\n }\n } else {\n canvas.save();\n }\n }\n\n if (this.matrix) {\n canvas.concat(this.matrix);\n }\n if (this.clipRect) {\n canvas.clipRect(this.clipRect, op, true);\n } else if (this.clipRRect) {\n canvas.clipRRect(this.clipRRect, op, true);\n } else if (this.clipPath) {\n canvas.clipPath(this.clipPath, op, true);\n }\n\n this.renderNode(ctx);\n\n if (shouldSave) {\n canvas.restore();\n }\n }\n\n abstract renderNode(ctx: DrawingContext): void;\n}\n\nexport const isSkPaint = (\n obj: RefObject<DeclarationNode<unknown, SkPaint>> | SkPaint\n): obj is SkPaint => \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nconst concatPaint = (\n parent: SkPaint,\n {\n color,\n strokeWidth,\n shader,\n antiAlias,\n blendMode,\n colorFilter,\n imageFilter,\n maskFilter,\n pathEffect,\n opacity: alpha,\n strokeCap,\n strokeJoin,\n strokeMiter,\n style,\n }: PaintContext,\n opacity: number\n) => {\n const paint = parent.copy();\n if (color !== undefined) {\n paint.setShader(null);\n color[3] *= opacity;\n paint.setColor(color);\n } else {\n const cl = paint.getColor();\n cl[3] *= opacity;\n paint.setColor(cl);\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (shader !== undefined) {\n paint.setShader(shader);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(blendMode);\n }\n if (colorFilter !== undefined) {\n paint.setColorFilter(colorFilter);\n }\n if (imageFilter !== undefined) {\n paint.setImageFilter(imageFilter);\n }\n if (maskFilter !== undefined) {\n paint.setMaskFilter(maskFilter);\n }\n if (pathEffect !== undefined) {\n paint.setPathEffect(pathEffect);\n }\n if (alpha !== undefined) {\n paint.setAlphaf(alpha * opacity);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(strokeCap);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(strokeJoin);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (style !== undefined) {\n paint.setStyle(style);\n }\n return paint;\n};\n"],"mappings":";;AASA,SACEA,SADF,EAEEC,UAFF,EAGEC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AApB,EAA+B;IAC7BiD,KAAK,CAAC4B,cAAN,CAAqBvC,WAArB;EACD;;EACD,IAAIG,UAAU,KAAKzC,SAAnB,EAA8B;IAC5BiD,KAAK,CAAC6B,aAAN,CAAoBrC,UAApB;EACD;;EACD,IAAIP,UAAU,KAAKlC,SAAnB,EAA8B;IAC5BiD,KAAK,CAAC8B,aAAN,CAAoB7C,UAApB;EACD;;EACD,IAAIiC,KAAK,KAAKnE,SAAd,EAAyB;IACvBiD,KAAK,CAAC+B,SAAN,CAAgBb,KAAK,GAAGhD,OAAxB;EACD;;EACD,IAAIF,SAAS,KAAKjB,SAAlB,EAA6B;IAC3BiD,KAAK,CAACgC,YAAN,CAAmBhE,SAAnB;EACD;;EACD,IAAID,UAAU,KAAKhB,SAAnB,EAA8B;IAC5BiD,KAAK,CAACiC,aAAN,CAAoBlE,UAApB;EACD;;EACD,IAAIE,WAAW,KAAKlB,SAApB,EAA+B;IAC7BiD,KAAK,CAACkC,cAAN,CAAqBjE,WAArB;EACD;;EACD,IAAIH,KAAK,KAAKf,SAAd,EAAyB;IACvBiD,KAAK,CAACmC,QAAN,CAAerE,KAAf;EACD;;EACD,OAAOkC,KAAP;AACD,CAtED"}
|
1
|
+
{"version":3,"names":["StrokeCap","StrokeJoin","PaintStyle","BlendMode","ClipOp","isRRect","isPathDef","processPath","processTransformProps","JsiNode","JsiDeclarationNode","enumKey","paintProps","JsiRenderNode","constructor","ctx","type","props","matrix","Skia","Matrix","onPropChange","setProps","paintCache","setProp","key","value","hasChanged","includes","identity","clipPath","undefined","clipRect","clipRRect","computeMatrix","computeClip","addChild","child","setInvalidate","insertChildBefore","before","clip","getPaintCtx","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","Color","_children","forEach","isColorFilter","cf","materialize","colorFilter","ColorFilter","MakeCompose","isShader","shader","isPathEffect","pe","pathEffect","PathEffect","isImageFilter","filter","imageFilter","ImageFilter","isMaskFilter","maskFilter","render","parentCtx","invertClip","layer","transform","canvas","parent","paint","paintCtx","concatPaint","hasTransform","hasClip","shouldSave","op","Difference","Intersect","saveLayer","save","concat","renderNode","restore","alpha","copy","setShader","setColor","cl","getColor","setStrokeWidth","setAntiAlias","setBlendMode","setColorFilter","setImageFilter","setMaskFilter","setPathEffect","setAlphaf","setStrokeCap","setStrokeJoin","setStrokeMiter","setStyle"],"sources":["RenderNode.ts"],"sourcesContent":["import type {\n SkMatrix,\n SkRect,\n SkRRect,\n SkPath,\n SkPaint,\n} from \"../../skia/types\";\nimport {\n StrokeCap,\n StrokeJoin,\n PaintStyle,\n BlendMode,\n ClipOp,\n isRRect,\n} from \"../../skia/types\";\nimport type {\n RenderNode,\n GroupProps,\n DrawingContext,\n NodeType,\n Node,\n} from \"../types\";\n\nimport { isPathDef, processPath, processTransformProps } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiNode, JsiDeclarationNode } from \"./Node\";\nimport type { PaintContext } from \"./PaintContext\";\nimport { enumKey } from \"./datatypes/Enum\";\n\nconst paintProps = [\n \"color\",\n \"strokeWidth\",\n \"blendMode\",\n \"strokeCap\",\n \"strokeJoin\",\n \"strokeMiter\",\n \"style\",\n \"antiAlias\",\n \"opacity\",\n];\n\ninterface PaintCache {\n parent: SkPaint;\n child: SkPaint;\n}\n\nexport abstract class JsiRenderNode<P extends GroupProps>\n extends JsiNode<P>\n implements RenderNode<P>\n{\n paintCache: PaintCache | null = null;\n matrix: SkMatrix;\n clipRect?: SkRect;\n clipRRect?: SkRRect;\n clipPath?: SkPath;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.matrix = this.Skia.Matrix();\n this.onPropChange();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.onPropChange();\n this.paintCache = null;\n }\n\n setProp<K extends keyof P>(key: K, value: P[K]) {\n const hasChanged = super.setProp(key, value);\n if (hasChanged) {\n this.onPropChange();\n if (paintProps.includes(key as string)) {\n this.paintCache = null;\n }\n }\n return hasChanged;\n }\n\n protected onPropChange() {\n this.matrix.identity();\n this.clipPath = undefined;\n this.clipRect = undefined;\n this.clipRRect = undefined;\n this.computeMatrix();\n this.computeClip();\n }\n\n addChild(child: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.addChild(child);\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.insertChildBefore(child, before);\n }\n\n private computeClip() {\n const { clip } = this.props;\n if (clip) {\n if (isPathDef(clip)) {\n this.clipPath = processPath(this.Skia, clip);\n } else if (isRRect(clip)) {\n this.clipRRect = clip;\n } else {\n this.clipRect = clip;\n }\n }\n }\n\n private computeMatrix() {\n processTransformProps(this.matrix, this.props);\n }\n\n private getPaintCtx() {\n let ctx: PaintContext | undefined;\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n } = this.props;\n if (\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n opacity !== undefined ||\n antiAlias !== undefined\n ) {\n ctx = {};\n if (color !== undefined) {\n ctx.color = this.Skia.Color(color);\n }\n if (strokeWidth !== undefined) {\n ctx.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n ctx.blendMode = BlendMode[enumKey(blendMode)];\n }\n if (style !== undefined) {\n ctx.style = PaintStyle[enumKey(style)];\n }\n if (strokeJoin !== undefined) {\n ctx.strokeJoin = StrokeJoin[enumKey(strokeJoin)];\n }\n if (strokeCap !== undefined) {\n ctx.strokeCap = StrokeCap[enumKey(strokeCap)];\n }\n if (strokeMiter !== undefined) {\n ctx.strokeMiter = strokeMiter;\n }\n if (opacity !== undefined) {\n ctx.opacity = opacity;\n }\n if (antiAlias !== undefined) {\n ctx.antiAlias = antiAlias;\n }\n }\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n if (child.isColorFilter()) {\n ctx = ctx || {};\n const cf = child.materialize();\n ctx.colorFilter = ctx.colorFilter\n ? this.Skia.ColorFilter.MakeCompose(cf, ctx.colorFilter)\n : cf;\n } else if (child.isShader()) {\n ctx = ctx || {};\n const shader = child.materialize();\n ctx.shader = shader;\n } else if (child.isPathEffect()) {\n ctx = ctx || {};\n const pe = child.materialize();\n ctx.pathEffect = ctx.pathEffect\n ? this.Skia.PathEffect.MakeCompose(pe, ctx.pathEffect)\n : pe;\n } else if (child.isImageFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.imageFilter = ctx.imageFilter\n ? this.Skia.ImageFilter.MakeCompose(filter, ctx.imageFilter)\n : filter;\n } else if (child.isMaskFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.maskFilter = filter;\n }\n }\n });\n return ctx;\n }\n\n render(parentCtx: DrawingContext) {\n const { invertClip, layer, matrix, transform } = this.props;\n const { canvas } = parentCtx;\n\n const opacity =\n this.props.opacity !== undefined\n ? parentCtx.opacity * this.props.opacity\n : parentCtx.opacity;\n\n if (\n this.paintCache === null ||\n this.paintCache.parent !== parentCtx.paint\n ) {\n const paintCtx = this.getPaintCtx();\n const child = paintCtx\n ? concatPaint(parentCtx.paint, paintCtx, parentCtx.opacity)\n : parentCtx.paint;\n this.paintCache = { parent: parentCtx.paint, child };\n }\n const paint = this.paintCache.child;\n // TODO: can we only recreate a new context here if needed?\n const ctx = { ...parentCtx, opacity, paint };\n const hasTransform = matrix !== undefined || transform !== undefined;\n const hasClip =\n this.clipRect !== undefined ||\n this.clipPath !== undefined ||\n this.clipRRect !== undefined;\n const shouldSave = hasTransform || hasClip || !!layer;\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else {\n canvas.saveLayer(layer);\n }\n } else {\n canvas.save();\n }\n }\n\n if (this.matrix) {\n canvas.concat(this.matrix);\n }\n if (this.clipRect) {\n canvas.clipRect(this.clipRect, op, true);\n } else if (this.clipRRect) {\n canvas.clipRRect(this.clipRRect, op, true);\n } else if (this.clipPath) {\n canvas.clipPath(this.clipPath, op, true);\n }\n\n this.renderNode(ctx);\n\n if (shouldSave) {\n canvas.restore();\n }\n }\n\n abstract renderNode(ctx: DrawingContext): void;\n}\n\nconst concatPaint = (\n parent: SkPaint,\n {\n color,\n strokeWidth,\n shader,\n antiAlias,\n blendMode,\n colorFilter,\n imageFilter,\n maskFilter,\n pathEffect,\n opacity: alpha,\n strokeCap,\n strokeJoin,\n strokeMiter,\n style,\n }: PaintContext,\n opacity: number\n) => {\n const paint = parent.copy();\n if (color !== undefined) {\n paint.setShader(null);\n color[3] *= opacity;\n paint.setColor(color);\n } else {\n const cl = paint.getColor();\n cl[3] *= opacity;\n paint.setColor(cl);\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (shader !== undefined) {\n paint.setShader(shader);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(blendMode);\n }\n if (colorFilter !== undefined) {\n paint.setColorFilter(colorFilter);\n }\n if (imageFilter !== undefined) {\n paint.setImageFilter(imageFilter);\n }\n if (maskFilter !== undefined) {\n paint.setMaskFilter(maskFilter);\n }\n if (pathEffect !== undefined) {\n paint.setPathEffect(pathEffect);\n }\n if (alpha !== undefined) {\n paint.setAlphaf(alpha * opacity);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(strokeCap);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(strokeJoin);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (style !== undefined) {\n paint.setStyle(style);\n }\n return paint;\n};\n"],"mappings":";;AAOA,SACEA,SADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC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AAK,CAAC2B,SAAN,CAAgBb,KAAK,GAAG5C,OAAxB;EACD;;EACD,IAAIF,SAAS,KAAKjB,SAAlB,EAA6B;IAC3BiD,KAAK,CAAC4B,YAAN,CAAmB5D,SAAnB;EACD;;EACD,IAAID,UAAU,KAAKhB,SAAnB,EAA8B;IAC5BiD,KAAK,CAAC6B,aAAN,CAAoB9D,UAApB;EACD;;EACD,IAAIE,WAAW,KAAKlB,SAApB,EAA+B;IAC7BiD,KAAK,CAAC8B,cAAN,CAAqB7D,WAArB;EACD;;EACD,IAAIH,KAAK,KAAKf,SAAd,EAAyB;IACvBiD,KAAK,CAAC+B,QAAN,CAAejE,KAAf;EACD;;EACD,OAAOkC,KAAP;AACD,CAtED"}
|
@@ -22,8 +22,8 @@ export const processGradientProps = (Skia, _ref) => {
|
|
22
22
|
processTransformProps(localMatrix, transform);
|
23
23
|
return {
|
24
24
|
colors: colors.map(color => Skia.Color(color)),
|
25
|
-
positions: positions
|
26
|
-
mode: TileMode[enumKey(mode
|
25
|
+
positions: positions !== null && positions !== void 0 ? positions : null,
|
26
|
+
mode: TileMode[enumKey(mode !== null && mode !== void 0 ? mode : "clamp")],
|
27
27
|
flags,
|
28
28
|
localMatrix
|
29
29
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["TileMode","enumKey","processTransformProps","transformOrigin","origin","transform","translateX","x","translateY","y","processGradientProps","Skia","colors","positions","mode","flags","localMatrix","Matrix","map","color","Color","getRect","props","width","height","rect","undefined","XYWHRect"],"sources":["Gradient.ts"],"sourcesContent":["import type { Skia, SkRect, Transforms2d, Vector } from \"../../../skia/types\";\nimport { TileMode } from \"../../../skia/types\";\nimport type { GradientProps, ImageShaderProps } from \"../../types\";\n\nimport { enumKey } from \"./Enum\";\nimport { processTransformProps } from \"./Transform\";\n\nexport const transformOrigin = (origin: Vector, transform: Transforms2d) => [\n { translateX: origin.x },\n { translateY: origin.y },\n ...transform,\n { translateX: -origin.x },\n { translateY: -origin.y },\n];\n\nexport const processGradientProps = (\n Skia: Skia,\n { colors, positions, mode, flags, ...transform }: GradientProps\n) => {\n const localMatrix = Skia.Matrix();\n processTransformProps(localMatrix, transform);\n return {\n colors: colors.map((color) => Skia.Color(color)),\n positions: positions ?? null,\n mode: TileMode[enumKey(mode ?? \"clamp\")],\n flags,\n localMatrix,\n };\n};\n\nexport const getRect = (\n Skia: Skia,\n props: Omit<ImageShaderProps, \"tx\" | \"ty\" | \"fm\" | \"mm\" | \"fit\" | \"image\">\n): SkRect | undefined => {\n const { x, y, width, height } = props;\n if (props.rect) {\n return props.rect;\n } else if (\n x !== undefined &&\n y !== undefined &&\n width !== undefined &&\n height !== undefined\n ) {\n return Skia.XYWHRect(x, y, width, height);\n } else {\n return undefined;\n }\n};\n"],"mappings":"AACA,SAASA,QAAT,QAAyB,qBAAzB;AAGA,SAASC,OAAT,QAAwB,QAAxB;AACA,SAASC,qBAAT,QAAsC,aAAtC;AAEA,OAAO,MAAMC,eAAe,GAAG,CAACC,MAAD,EAAiBC,SAAjB,KAA6C,CAC1E;EAAEC,UAAU,EAAEF,MAAM,CAACG;AAArB,CAD0E,EAE1E;EAAEC,UAAU,EAAEJ,MAAM,CAACK;AAArB,CAF0E,EAG1E,GAAGJ,SAHuE,EAI1E;EAAEC,UAAU,EAAE,CAACF,MAAM,CAACG;AAAtB,CAJ0E,EAK1E;EAAEC,UAAU,EAAE,CAACJ,MAAM,CAACK;AAAtB,CAL0E,CAArE;AAQP,OAAO,MAAMC,oBAAoB,GAAG,CAClCC,IADkC,WAG/B;EAAA,IADH;IAAEC,MAAF;IAAUC,SAAV;IAAqBC,IAArB;IAA2BC,KAA3B;IAAkC,GAAGV;EAArC,CACG;EACH,MAAMW,WAAW,GAAGL,IAAI,CAACM,MAAL,EAApB;EACAf,qBAAqB,CAACc,WAAD,EAAcX,SAAd,CAArB;EACA,OAAO;IACLO,MAAM,EAAEA,MAAM,CAACM,GAAP,CAAYC,KAAD,IAAWR,IAAI,CAACS,KAAL,CAAWD,KAAX,CAAtB,CADH;IAELN,SAAS,EAAEA,
|
1
|
+
{"version":3,"names":["TileMode","enumKey","processTransformProps","transformOrigin","origin","transform","translateX","x","translateY","y","processGradientProps","Skia","colors","positions","mode","flags","localMatrix","Matrix","map","color","Color","getRect","props","width","height","rect","undefined","XYWHRect"],"sources":["Gradient.ts"],"sourcesContent":["import type { Skia, SkRect, Transforms2d, Vector } from \"../../../skia/types\";\nimport { TileMode } from \"../../../skia/types\";\nimport type { GradientProps, ImageShaderProps } from \"../../types\";\n\nimport { enumKey } from \"./Enum\";\nimport { processTransformProps } from \"./Transform\";\n\nexport const transformOrigin = (origin: Vector, transform: Transforms2d) => [\n { translateX: origin.x },\n { translateY: origin.y },\n ...transform,\n { translateX: -origin.x },\n { translateY: -origin.y },\n];\n\nexport const processGradientProps = (\n Skia: Skia,\n { colors, positions, mode, flags, ...transform }: GradientProps\n) => {\n const localMatrix = Skia.Matrix();\n processTransformProps(localMatrix, transform);\n return {\n colors: colors.map((color) => Skia.Color(color)),\n positions: positions ?? null,\n mode: TileMode[enumKey(mode ?? \"clamp\")],\n flags,\n localMatrix,\n };\n};\n\nexport const getRect = (\n Skia: Skia,\n props: Omit<ImageShaderProps, \"tx\" | \"ty\" | \"fm\" | \"mm\" | \"fit\" | \"image\">\n): SkRect | undefined => {\n const { x, y, width, height } = props;\n if (props.rect) {\n return props.rect;\n } else if (\n x !== undefined &&\n y !== undefined &&\n width !== undefined &&\n height !== undefined\n ) {\n return Skia.XYWHRect(x, y, width, height);\n } else {\n return undefined;\n }\n};\n"],"mappings":"AACA,SAASA,QAAT,QAAyB,qBAAzB;AAGA,SAASC,OAAT,QAAwB,QAAxB;AACA,SAASC,qBAAT,QAAsC,aAAtC;AAEA,OAAO,MAAMC,eAAe,GAAG,CAACC,MAAD,EAAiBC,SAAjB,KAA6C,CAC1E;EAAEC,UAAU,EAAEF,MAAM,CAACG;AAArB,CAD0E,EAE1E;EAAEC,UAAU,EAAEJ,MAAM,CAACK;A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,10 @@ export class TextPathNode extends JsiDrawingNode {
|
|
66
66
|
// line at that position.
|
67
67
|
|
68
68
|
|
69
|
-
const
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
ty
|
74
|
-
} = cont.getPosTan(dist);
|
75
|
-
const adjustedX = px - width / 2 * tx;
|
76
|
-
const adjustedY = py - width / 2 * ty;
|
77
|
-
rsx.push(this.Skia.RSXform(tx, ty, adjustedX, adjustedY));
|
69
|
+
const [p, t] = cont.getPosTan(dist);
|
70
|
+
const adjustedX = p.x - width / 2 * t.x;
|
71
|
+
const adjustedY = p.y - width / 2 * t.y;
|
72
|
+
rsx.push(this.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));
|
78
73
|
dist += width / 2;
|
79
74
|
}
|
80
75
|
|