@shopify/react-native-skia 0.1.140 → 0.1.143
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +2 -2
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +1 -1
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +15 -16
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +2 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +69 -27
- package/cpp/api/JsiSkPathFactory.h +1 -1
- package/cpp/api/JsiSkPicture.h +7 -1
- package/cpp/rnskia/RNSkDrawView.cpp +66 -66
- package/cpp/rnskia/RNSkDrawView.h +22 -6
- package/cpp/rnskia/RNSkJsiViewApi.h +2 -2
- package/cpp/rnskia/values/RNSkComputedValue.h +10 -7
- package/cpp/rnskia/values/RNSkReadonlyValue.h +21 -2
- package/cpp/rnskia/values/RNSkValue.h +1 -0
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +1 -1
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +2 -2
- package/ios/RNSkia-iOS/SkiaDrawView.mm +4 -0
- package/lib/commonjs/mock/index.js +3 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.js +1 -1
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/components/Blend.js +20 -5
- package/lib/commonjs/renderer/components/Blend.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.js +18 -5
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/skia/core/Data.js +10 -22
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/Font.js +2 -3
- package/lib/commonjs/skia/core/Font.js.map +1 -1
- package/lib/commonjs/skia/core/Image.js.map +1 -1
- package/lib/commonjs/skia/core/SVG.js.map +1 -1
- package/lib/commonjs/skia/core/Typeface.js.map +1 -1
- package/lib/commonjs/skia/types/Data/Data.js +5 -0
- package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
- package/lib/commonjs/skia/web/Host.js +12 -21
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +50 -28
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +4 -4
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +7 -3
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +61 -19
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +15 -6
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +16 -60
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +7 -3
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +5 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +3 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js +9 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js +9 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.js +3 -3
- package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +4 -2
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +10 -6
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js +3 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +8 -4
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +12 -6
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.js +6 -2
- package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
- package/lib/commonjs/values/index.js +13 -0
- package/lib/commonjs/values/index.js.map +1 -1
- package/lib/commonjs/values/selector.js +24 -0
- package/lib/commonjs/values/selector.js.map +1 -0
- package/lib/commonjs/values/web/RNSkComputedValue.js +8 -0
- package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +4 -0
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/commonjs/views/useTouchHandler.js +13 -20
- package/lib/commonjs/views/useTouchHandler.js.map +1 -1
- package/lib/module/mock/index.js +2 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/DependencyManager.js +2 -2
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/components/Blend.js +21 -5
- package/lib/module/renderer/components/Blend.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.js +13 -4
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/skia/core/Data.js +10 -20
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/Font.js +2 -3
- package/lib/module/skia/core/Font.js.map +1 -1
- package/lib/module/skia/core/Image.js.map +1 -1
- package/lib/module/skia/core/SVG.js.map +1 -1
- package/lib/module/skia/core/Typeface.js.map +1 -1
- package/lib/module/skia/types/Data/Data.js +1 -1
- package/lib/module/skia/types/Data/Data.js.map +1 -1
- package/lib/module/skia/web/Host.js +9 -9
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +40 -29
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +5 -5
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +6 -4
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +4 -3
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +4 -3
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +61 -20
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +2 -2
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +11 -7
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +15 -62
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -4
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +4 -2
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +3 -2
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.js +10 -2
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +10 -2
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.js +4 -4
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +4 -3
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +9 -7
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.js +3 -2
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlobFactory.js +7 -5
- package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFactory.js +2 -2
- package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +10 -5
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/values/hooks/useComputedValue.js +7 -3
- package/lib/module/values/hooks/useComputedValue.js.map +1 -1
- package/lib/module/values/index.js +1 -0
- package/lib/module/values/index.js.map +1 -1
- package/lib/module/values/selector.js +15 -0
- package/lib/module/values/selector.js.map +1 -0
- package/lib/module/values/web/RNSkComputedValue.js +8 -0
- package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js +4 -0
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/module/views/useTouchHandler.js +12 -19
- package/lib/module/views/useTouchHandler.js.map +1 -1
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +7 -2
- package/lib/typescript/src/skia/core/Data.d.ts +3 -5
- package/lib/typescript/src/skia/core/Font.d.ts +2 -2
- package/lib/typescript/src/skia/core/Image.d.ts +2 -2
- package/lib/typescript/src/skia/core/SVG.d.ts +2 -2
- package/lib/typescript/src/skia/core/Typeface.d.ts +2 -2
- package/lib/typescript/src/skia/types/Data/Data.d.ts +10 -3
- package/lib/typescript/src/skia/types/Picture/Picture.d.ts +2 -1
- package/lib/typescript/src/skia/web/Host.d.ts +5 -7
- package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +8 -8
- package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +3 -3
- package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +2 -1
- package/lib/typescript/src/values/index.d.ts +1 -0
- package/lib/typescript/src/values/selector.d.ts +14 -0
- package/lib/typescript/src/values/types.d.ts +4 -0
- package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -0
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -0
- package/package.json +6 -6
- package/src/mock/index.ts +2 -1
- package/src/renderer/DependencyManager.tsx +5 -2
- package/src/renderer/components/Blend.tsx +25 -5
- package/src/renderer/components/imageFilters/Morphology.tsx +2 -2
- package/src/renderer/components/imageFilters/Shadow.tsx +2 -2
- package/src/renderer/processors/Animations/Animations.ts +27 -5
- package/src/skia/core/Data.ts +20 -51
- package/src/skia/core/Font.ts +4 -5
- package/src/skia/core/Image.ts +2 -2
- package/src/skia/core/SVG.ts +2 -2
- package/src/skia/core/Typeface.ts +2 -2
- package/src/skia/types/Data/Data.ts +11 -1
- package/src/skia/types/Picture/Picture.ts +2 -1
- package/src/skia/web/Host.ts +11 -21
- package/src/skia/web/JsiSkCanvas.ts +99 -56
- package/src/skia/web/JsiSkColorFilterFactory.ts +15 -5
- package/src/skia/web/JsiSkFont.ts +11 -4
- package/src/skia/web/JsiSkImage.ts +4 -3
- package/src/skia/web/JsiSkImageFactory.ts +6 -3
- package/src/skia/web/JsiSkImageFilterFactory.ts +124 -52
- package/src/skia/web/JsiSkMatrix.ts +4 -2
- package/src/skia/web/JsiSkPaint.ts +11 -7
- package/src/skia/web/JsiSkPath.ts +30 -56
- package/src/skia/web/JsiSkPathEffectFactory.ts +10 -5
- package/src/skia/web/JsiSkPathFactory.ts +3 -3
- package/src/skia/web/JsiSkPicture.ts +5 -3
- package/src/skia/web/JsiSkPictureRecorder.ts +3 -2
- package/src/skia/web/JsiSkPoint.ts +12 -2
- package/src/skia/web/JsiSkRRect.ts +16 -2
- package/src/skia/web/JsiSkRSXform.ts +1 -1
- package/src/skia/web/JsiSkRect.ts +4 -7
- package/src/skia/web/JsiSkRuntimeEffect.ts +9 -4
- package/src/skia/web/JsiSkShaderFactory.ts +24 -15
- package/src/skia/web/JsiSkSurface.ts +7 -2
- package/src/skia/web/JsiSkTextBlobFactory.ts +14 -8
- package/src/skia/web/JsiSkTypefaceFactory.tsx +4 -2
- package/src/skia/web/JsiSkia.ts +17 -5
- package/src/values/hooks/useComputedValue.ts +6 -3
- package/src/values/index.ts +1 -0
- package/src/values/selector.ts +24 -0
- package/src/values/types.ts +4 -0
- package/src/values/web/RNSkComputedValue.ts +6 -0
- package/src/values/web/RNSkReadonlyValue.ts +4 -0
- package/src/views/useTouchHandler.ts +15 -21
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useTouchHandler.ts"],"names":["useInternalTouchHandler","handlers","deps","multiTouch","prevTouchInfoRef","prevVelocityRef","history","forEach","touches","i","length","touch","
|
1
|
+
{"version":3,"sources":["useTouchHandler.ts"],"names":["useInternalTouchHandler","handlers","deps","multiTouch","prevTouchInfoRef","prevVelocityRef","history","forEach","touches","i","length","touch","prevTouch","current","id","timeDiffseconds","timestamp","distX","x","distY","y","type","TouchType","Start","End","Cancelled","PixelRatio","get","extendedTouchInfo","velocityX","velocityY","onStart","Active","onActive","onEnd","useTouchHandler","useMultiTouchHandler"],"mappings":";;;;;;;AACA;;AACA;;AAUA;;AAEA,MAAMA,uBAAuB,GAAG,UAC9BC,QAD8B,EAIb;AAAA,MAFjBC,IAEiB,uEAFM,EAEN;AAAA,MADjBC,UACiB,uEADJ,KACI;AACjB,QAAMC,gBAAgB,GAAG,mBAAiD,EAAjD,CAAzB;AACA,QAAMC,eAAe,GAAG,mBAA8C,EAA9C,CAAxB;AAEA,SAAO,wBAAaC,OAAD,IAAsC;AACvD;AACAA,IAAAA,OAAO,CAACC,OAAR,CAAiBC,OAAD,IAAa;AAC3B;AACA,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,OAAO,CAACE,MAA5B,EAAoCD,CAAC,EAArC,EAAyC;AAAA;;AACvC,YAAI,CAACN,UAAD,IAAeM,CAAC,GAAG,CAAvB,EAA0B;AACxB;AACD;;AAED,cAAME,KAAK,GAAGH,OAAO,CAACC,CAAD,CAArB;AACA,cAAMG,SAAS,GAAGR,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AACAhB,QAAAA,gBAAgB,CAACS,OAAjB,CAAyBF,KAAK,CAACG,EAA/B,IAAqCH,KAArC;;AAEA,YAAIA,KAAK,CAACU,IAAN,KAAeC,iBAAUC,KAA7B,EAAoC;AAClC,iBAAOlB,eAAe,CAACQ,OAAhB,CAAwBF,KAAK,CAACG,EAA9B,CAAP;AACAb,UAAAA,QAAQ,CAAC8B,OAAT,IAAoB9B,QAAQ,CAAC8B,OAAT,CAAiBpB,KAAjB,CAApB;AACD,SAHD,MAGO,IAAIA,KAAK,CAACU,IAAN,KAAeC,iBAAUU,MAA7B,EAAqC;AAC1C/B,UAAAA,QAAQ,CAACgC,QAAT,IAAqBhC,QAAQ,CAACgC,QAAT,CAAkBL,iBAAlB,CAArB;AACD,SAFM,MAEA;AACL3B,UAAAA,QAAQ,CAACiC,KAAT,IAAkBjC,QAAQ,CAACiC,KAAT,CAAeN,iBAAf,CAAlB;AACD;AACF;AACF,KA/CD,EAFuD,CAkDvD;AACD,GAnDM,EAmDJ1B,IAnDI,CAAP;AAoDD,CA5DD;AA8DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMiC,eAAe,GAAG,UAC7BlC,QAD6B,EAGZ;AAAA,MADjBC,IACiB,uEADM,EACN;AACjB,SAAOF,uBAAuB,CAACC,QAAD,EAAWC,IAAX,EAAiB,KAAjB,CAA9B;AACD,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMkC,oBAAoB,GAAG,UAClCnC,QADkC,EAGjB;AAAA,MADjBC,IACiB,uEADM,EACN;AACjB,SAAOF,uBAAuB,CAACC,QAAD,EAAWC,IAAX,EAAiB,IAAjB,CAA9B;AACD,CALM","sourcesContent":["import type { DependencyList } from \"react\";\nimport { useCallback, useRef } from \"react\";\nimport { PixelRatio } from \"react-native\";\n\nimport type { Vector } from \"../skia/types\";\n\nimport type {\n ExtendedTouchInfo,\n TouchHandlers,\n TouchHandler,\n TouchInfo,\n} from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst useInternalTouchHandler = (\n handlers: TouchHandlers,\n deps: DependencyList = [],\n multiTouch = false\n): TouchHandler => {\n const prevTouchInfoRef = useRef<{ [key: number]: TouchInfo | undefined }>({});\n const prevVelocityRef = useRef<{ [key: number]: Vector | undefined }>({});\n\n return useCallback((history: Array<Array<TouchInfo>>) => {\n // Process all items in the current touch history\n history.forEach((touches) => {\n // Enumerate touches\n for (let i = 0; i < touches.length; i++) {\n if (!multiTouch && i > 0) {\n break;\n }\n\n const touch = touches[i];\n const prevTouch = prevTouchInfoRef.current[touch.id];\n // Calculate the velocity from the previous touch.\n const timeDiffseconds =\n touch.timestamp -\n (prevTouchInfoRef.current[touch.id]?.timestamp ?? touch.timestamp);\n\n const distX = touch.x - (prevTouch?.x ?? touch.x);\n const distY = touch.y - (prevTouch?.y ?? touch.y);\n\n if (\n touch.type !== TouchType.Start &&\n touch.type !== TouchType.End &&\n touch.type !== TouchType.Cancelled &&\n timeDiffseconds > 0\n ) {\n prevVelocityRef.current[touch.id] = {\n x: distX / timeDiffseconds / PixelRatio.get(),\n y: distY / timeDiffseconds / PixelRatio.get(),\n };\n }\n\n const extendedTouchInfo: ExtendedTouchInfo = {\n ...touch,\n velocityX: prevVelocityRef.current[touch.id]?.x ?? 0,\n velocityY: prevVelocityRef.current[touch.id]?.y ?? 0,\n };\n\n // Save previous touch\n prevTouchInfoRef.current[touch.id] = touch;\n\n if (touch.type === TouchType.Start) {\n delete prevVelocityRef.current[touch.id];\n handlers.onStart && handlers.onStart(touch);\n } else if (touch.type === TouchType.Active) {\n handlers.onActive && handlers.onActive(extendedTouchInfo);\n } else {\n handlers.onEnd && handlers.onEnd(extendedTouchInfo);\n }\n }\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n};\n\n/**\n * Provides a callback for handling touch events in the Skia View.\n * This touch handler only handles single touches.\n * @param handlers Callbacks for the different touch states\n * @param deps optional Dependency array to update the handlers\n * @returns A function that can be used from within the onDraw callback to\n * update and handle touch events. Call it with the touches property from\n * the info object.\n */\nexport const useTouchHandler = (\n handlers: TouchHandlers,\n deps: DependencyList = []\n): TouchHandler => {\n return useInternalTouchHandler(handlers, deps, false);\n};\n\n/**\n * Provides a callback for handling touch events in the Skia View.\n * This touch handler handles multiple touches.\n * @param handlers Callbacks for the different touch states\n * @param deps optional Dependency array to update the handlers\n * @returns A function that can be used from within the onDraw callback to\n * update and handle touch events. Call it with the touches property from\n * the info object.\n */\nexport const useMultiTouchHandler = (\n handlers: TouchHandlers,\n deps: DependencyList = []\n): TouchHandler => {\n return useInternalTouchHandler(handlers, deps, true);\n};\n"]}
|
package/lib/module/mock/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
2
|
import * as Values from "../values/web";
|
3
3
|
import * as ValuesHooks from "../values/hooks";
|
4
|
+
import { Selector } from "../values/selector";
|
4
5
|
import * as BaseSkia from "../skia/types";
|
5
6
|
import { useSharedValueEffect } from "../external/reanimated/useSharedValueEffect";
|
6
7
|
import * as timingFunctions from "../animation/timing";
|
@@ -39,7 +40,6 @@ export const Mock = {
|
|
39
40
|
Skia,
|
40
41
|
...BaseSkia,
|
41
42
|
// 2. Hooks
|
42
|
-
useDataCollection: Noop,
|
43
43
|
useRawData: Noop,
|
44
44
|
useData: Noop,
|
45
45
|
useFont: Noop,
|
@@ -88,6 +88,7 @@ export const Mock = {
|
|
88
88
|
// ValueExports
|
89
89
|
...Values,
|
90
90
|
...ValuesHooks,
|
91
|
+
Selector,
|
91
92
|
// Animations
|
92
93
|
...timingFunctions,
|
93
94
|
...springFunctions,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["Values","ValuesHooks","BaseSkia","useSharedValueEffect","timingFunctions","springFunctions","decayFunctions","interpolateFn","interpolatePathFn","interpolateVectorFn","ShaderLib","Stub","constructor","Proxy","get","apply","set","Noop","Skia","vec","x","y","Mock","
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["Values","ValuesHooks","Selector","BaseSkia","useSharedValueEffect","timingFunctions","springFunctions","decayFunctions","interpolateFn","interpolatePathFn","interpolateVectorFn","ShaderLib","Stub","constructor","Proxy","get","apply","set","Noop","Skia","vec","x","y","Mock","useRawData","useData","useFont","useTypeface","useImage","useSVG","usePicture","rect","width","height","rrect","r","rx","ry","point","add","a","b","sub","neg","dist","Math","hypot","translate","translateX","translateY","bounds","topLeft","topRight","bottomLeft","bottomRight","center","processTransform2d","interpolateColors","_value","_inputRange","_outputRange","Float32Array","of","mixColors","_v","_x","_y","createDrawing","createDeclaration"],"mappings":"AAAA;AAGA,OAAO,KAAKA,MAAZ,MAAwB,eAAxB;AACA,OAAO,KAAKC,WAAZ,MAA6B,iBAA7B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,OAAO,KAAKC,QAAZ,MAA0B,eAA1B;AAKA,SAASC,oBAAT,QAAqC,6CAArC;AACA,OAAO,KAAKC,eAAZ,MAAiC,qBAAjC;AACA,OAAO,KAAKC,eAAZ,MAAiC,qBAAjC;AACA,OAAO,KAAKC,cAAZ,MAAgC,oBAAhC;AACA,OAAO,KAAKC,aAAZ,MAA+B,oCAA/B;AACA,OAAO,KAAKC,iBAAZ,MAAmC,yCAAnC;AACA,OAAO,KAAKC,mBAAZ,MAAqC,0CAArC;AACA,SAASC,SAAT,QAA0B,0CAA1B;;AAEA,MAAMC,IAAN,CAAW;AACTC,EAAAA,WAAW,GAAG;AACZ,WAAO,IAAIC,KAAJ,CAAU,MAAM,CAAE,CAAlB,EAAoB;AACzBC,MAAAA,GAAG,EAAE,MAAM,IAAIH,IAAJ,EADc;AAEzBI,MAAAA,KAAK,EAAE,MAAM,IAAIJ,IAAJ,EAFY;AAGzBK,MAAAA,GAAG,EAAE,MAAM;AAHc,KAApB,CAAP;AAKD;;AAPQ;;AAUX,MAAMC,IAAe,GAAG,MAAM,CAAE,CAAhC;;AAEA,OAAO,MAAMC,I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AqDJ,KAAGC,mBArDC;AAsDJ+C,EAAAA,iBAAiB,EAAE,CACjBC,MADiB,EAEjBC,WAFiB,EAGjBC,YAHiB,KAIdC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA1DD;AA2DJC,EAAAA,SAAS,EAAE,CAACC,EAAD,EAAaC,EAAb,EAAwBC,EAAxB,KAAsCL,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA3D7C;AA4DJnD,EAAAA,SA5DI;AA6DJwD,EAAAA,aAAa,EAAEjD,IA7DX;AA8DJkD,EAAAA,iBAAiB,EAAElD;AA9Df,CAPC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Color, Skia as SkiaApi, SkRect, Vector } from \"../skia/types\";\nimport * as Values from \"../values/web\";\nimport * as ValuesHooks from \"../values/hooks\";\nimport { Selector } from \"../values/selector\";\nimport * as BaseSkia from \"../skia/types\";\nimport type * as SkiaExports from \"../skia\";\nimport type * as ExternalExports from \"../external\";\nimport type * as ValueExports from \"../values\";\nimport type * as AnimationExports from \"../animation\";\nimport { useSharedValueEffect } from \"../external/reanimated/useSharedValueEffect\";\nimport * as timingFunctions from \"../animation/timing\";\nimport * as springFunctions from \"../animation/spring\";\nimport * as decayFunctions from \"../animation/decay\";\nimport * as interpolateFn from \"../animation/functions/interpolate\";\nimport * as interpolatePathFn from \"../animation/functions/interpolatePaths\";\nimport * as interpolateVectorFn from \"../animation/functions/interpolateVector\";\nimport { ShaderLib } from \"../renderer/components/shaders/ShaderLib\";\n\nclass Stub {\n constructor() {\n return new Proxy(() => {}, {\n get: () => new Stub(),\n apply: () => new Stub(),\n set: () => true,\n });\n }\n}\n\nconst Noop: () => any = () => {};\n\nexport const Skia: SkiaApi = new Stub() as any;\n\nexport const vec = (x?: number, y?: number) => ({ x: x ?? 0, y: y ?? x ?? 0 });\n\nexport const Mock: typeof SkiaExports &\n typeof ExternalExports &\n typeof ValueExports &\n typeof AnimationExports & {\n createDrawing: () => any;\n createDeclaration: () => any;\n ShaderLib: typeof ShaderLib;\n } = {\n // SkiaExports\n // 1. Skia API. BaseSkia contains the enums, and functions like isPaint etc\n Skia,\n ...BaseSkia,\n // 2. Hooks\n useRawData: Noop,\n useData: Noop,\n useFont: Noop,\n useTypeface: Noop,\n useImage: Noop,\n useSVG: Noop,\n usePicture: Noop,\n // 3. Point/Rect/Transform utilities\n vec,\n rect: (x: number, y: number, width: number, height: number) => ({\n x,\n y,\n width,\n height,\n }),\n rrect: (r: SkRect, rx: number, ry: number) => ({\n rect: r,\n rx,\n ry,\n }),\n point: vec,\n add: (a: Vector, b: Vector) => vec(a.x + b.x, a.y + b.y),\n sub: (a: Vector, b: Vector) => vec(a.x - b.x, a.y - b.y),\n neg: (a: Vector) => vec(-a.x, -a.y),\n dist: (a: Vector, b: Vector) => Math.hypot(a.x - b.x, a.y - b.y),\n translate: ({ x, y }: Vector) =>\n [{ translateX: x }, { translateY: y }] as const,\n\n bounds: Noop,\n topLeft: Noop,\n topRight: Noop,\n bottomLeft: Noop,\n bottomRight: Noop,\n center: Noop,\n processTransform2d: Noop,\n // ExternalExports\n useSharedValueEffect,\n // ValueExports\n ...Values,\n ...ValuesHooks,\n Selector,\n // Animations\n ...timingFunctions,\n ...springFunctions,\n ...decayFunctions,\n ...interpolateFn,\n ...interpolatePathFn,\n ...interpolateVectorFn,\n interpolateColors: (\n _value: number,\n _inputRange: number[],\n _outputRange: Color[]\n ) => Float32Array.of(0, 0, 0, 0),\n mixColors: (_v: number, _x: Color, _y: Color) => Float32Array.of(0, 0, 0, 0),\n ShaderLib,\n createDrawing: Noop,\n createDeclaration: Noop,\n};\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
2
|
|
3
|
-
import { isValue } from "./processors";
|
3
|
+
import { isSelector, isValue } from "./processors";
|
4
4
|
export class DependencyManager {
|
5
5
|
constructor(ref) {
|
6
6
|
_defineProperty(this, "ref", void 0);
|
@@ -21,7 +21,7 @@ export class DependencyManager {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
subscribeNode(node, props) {
|
24
|
-
const values = Object.values(props).filter(isValue);
|
24
|
+
const values = Object.values(props).filter(v => isValue(v) || isSelector(v)).map(v => isSelector(v) ? v.value : v);
|
25
25
|
|
26
26
|
if (values.length > 0) {
|
27
27
|
this.subscriptions.set(node, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["DependencyManager.tsx"],"names":["isValue","DependencyManager","constructor","ref","Map","unSubscribeNode","node","subscription","subscriptions","get","unsubscribe","delete","subscribeNode","props","values","Object","filter","length","set","subscribe","current","Error","forEach","registerValues","clear"],"mappings":";;AAKA,SAASA,
|
1
|
+
{"version":3,"sources":["DependencyManager.tsx"],"names":["isSelector","isValue","DependencyManager","constructor","ref","Map","unSubscribeNode","node","subscription","subscriptions","get","unsubscribe","delete","subscribeNode","props","values","Object","filter","v","map","value","length","set","subscribe","current","Error","forEach","registerValues","clear"],"mappings":";;AAKA,SAASA,UAAT,EAAqBC,OAArB,QAAoC,cAApC;AAMA,OAAO,MAAMC,iBAAN,CAAwB;AAO7BC,EAAAA,WAAW,CAACC,GAAD,EAA2B;AAAA;;AAAA,2CAFlC,IAAIC,GAAJ,EAEkC;;AACpC,SAAKD,GAAL,GAAWA,GAAX;AACD;;AAEDE,EAAAA,eAAe,CAACC,IAAD,EAAa;AAC1B,UAAMC,YAAY,GAAG,KAAKC,aAAL,CAAmBC,GAAnB,CAAuBH,IAAvB,CAArB;;AACA,QAAIC,YAAY,IAAIA,YAAY,CAACG,WAAjC,EAA8C;AAC5CH,MAAAA,YAAY,CAACG,WAAb;AACD;;AACD,SAAKF,aAAL,CAAmBG,MAAnB,CAA0BL,IAA1B;AACD;;AAEDM,EAAAA,aAAa,CAACN,IAAD,EAAaO,KAAb,EAA2B;AACtC,UAAMC,MAAM,GAAGC,MAAM,CAACD,MAAP,CAAcD,KAAd,EACZG,MADY,CACJC,CAAD,IAAOjB,OAAO,CAACiB,CAAD,CAAP,IAAclB,UAAU,CAACkB,CAAD,CAD1B,EAEZC,GAFY,CAEPD,CAAD,IAAQlB,UAAU,CAACkB,CAAD,CAAV,GAAgBA,CAAC,CAACE,KAAlB,GAA2BF,CAF3B,CAAf;;AAIA,QAAIH,MAAM,CAACM,MAAP,GAAgB,CAApB,EAAuB;AACrB,WAAKZ,aAAL,CAAmBa,GAAnB,CAAuBf,IAAvB,EAA6B;AAAEQ,QAAAA,MAAF;AAAUJ,QAAAA,WAAW,EAAE;AAAvB,OAA7B;AACD;AACF;;AAEDY,EAAAA,SAAS,GAAG;AACV,QAAI,KAAKnB,GAAL,CAASoB,OAAT,KAAqB,IAAzB,EAA+B;AAC7B,YAAM,IAAIC,KAAJ,CAAU,uBAAV,CAAN;AACD;;AACD,SAAKhB,aAAL,CAAmBiB,OAAnB,CAA4BlB,YAAD,IAAkB;AAC3C,UAAIA,YAAY,CAACG,WAAb,KAA6B,IAAjC,EAAuC;AACrCH,QAAAA,YAAY,CAACG,WAAb,GAA2B,KAAKP,GAAL,CAASoB,OAAT,CAAkBG,cAAlB,CACzBnB,YAAY,CAACO,MADY,CAA3B;AAGD;AACF,KAND;AAOD;;AAEDJ,EAAAA,WAAW,GAAG;AACZ,SAAKF,aAAL,CAAmBiB,OAAnB,CAA2B,QAAqB;AAAA,UAApB;AAAEf,QAAAA;AAAF,OAAoB;;AAC9C,UAAIA,WAAJ,EAAiB;AACfA,QAAAA,WAAW;AACZ;AACF,KAJD;AAKA,SAAKF,aAAL,CAAmBmB,KAAnB;AACD;;AAjD4B","sourcesContent":["import type { RefObject } from \"react\";\n\nimport type { SkiaView } from \"../views\";\nimport type { SkiaValue } from \"../values\";\n\nimport { isSelector, isValue } from \"./processors\";\nimport type { Node } from \"./nodes\";\n\ntype Unsubscribe = () => void;\ntype Props = { [key: string]: unknown };\n\nexport class DependencyManager {\n ref: RefObject<SkiaView>;\n subscriptions: Map<\n Node,\n { values: SkiaValue<unknown>[]; unsubscribe: null | Unsubscribe }\n > = new Map();\n\n constructor(ref: RefObject<SkiaView>) {\n this.ref = ref;\n }\n\n unSubscribeNode(node: Node) {\n const subscription = this.subscriptions.get(node);\n if (subscription && subscription.unsubscribe) {\n subscription.unsubscribe();\n }\n this.subscriptions.delete(node);\n }\n\n subscribeNode(node: Node, props: Props) {\n const values = Object.values(props)\n .filter((v) => isValue(v) || isSelector(v))\n .map((v) => (isSelector(v) ? v.value : (v as SkiaValue<unknown>)));\n\n if (values.length > 0) {\n this.subscriptions.set(node, { values, unsubscribe: null });\n }\n }\n\n subscribe() {\n if (this.ref.current === null) {\n throw new Error(\"Canvas ref is not set\");\n }\n this.subscriptions.forEach((subscription) => {\n if (subscription.unsubscribe === null) {\n subscription.unsubscribe = this.ref.current!.registerValues(\n subscription.values\n );\n }\n });\n }\n\n unsubscribe() {\n this.subscriptions.forEach(({ unsubscribe }) => {\n if (unsubscribe) {\n unsubscribe();\n }\n });\n this.subscriptions.clear();\n }\n}\n"]}
|
@@ -4,6 +4,11 @@ import React from "react";
|
|
4
4
|
import { isImageFilter, BlendMode, isShader } from "../../skia/types";
|
5
5
|
import { createDeclaration } from "../nodes";
|
6
6
|
import { enumKey } from "../processors/Paint";
|
7
|
+
|
8
|
+
const childrenAreImageFilters = children => children.every(child => isImageFilter(child));
|
9
|
+
|
10
|
+
const childrenAreShaders = children => children.every(child => isShader(child));
|
11
|
+
|
7
12
|
const onDeclare = createDeclaration((_ref, children, _ref2) => {
|
8
13
|
let {
|
9
14
|
mode
|
@@ -11,13 +16,24 @@ const onDeclare = createDeclaration((_ref, children, _ref2) => {
|
|
11
16
|
let {
|
12
17
|
Skia
|
13
18
|
} = _ref2;
|
14
|
-
const [inner, outer] = children;
|
15
19
|
const blend = BlendMode[enumKey(mode)];
|
16
20
|
|
17
|
-
if (
|
18
|
-
return
|
19
|
-
|
20
|
-
|
21
|
+
if (childrenAreImageFilters(children)) {
|
22
|
+
return children.reverse().reduce((inner, outer) => {
|
23
|
+
if (inner === null) {
|
24
|
+
return outer;
|
25
|
+
}
|
26
|
+
|
27
|
+
return Skia.ImageFilter.MakeBlend(blend, outer, inner);
|
28
|
+
}, null);
|
29
|
+
} else if (childrenAreShaders(children)) {
|
30
|
+
return children.reverse().reduce((inner, outer) => {
|
31
|
+
if (inner === null) {
|
32
|
+
return outer;
|
33
|
+
}
|
34
|
+
|
35
|
+
return Skia.Shader.MakeBlend(blend, outer, inner);
|
36
|
+
}, null);
|
21
37
|
}
|
22
38
|
|
23
39
|
throw new Error("<Blend /> can only blend Shaders or ImageFilters");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Blend.tsx"],"names":["React","isImageFilter","BlendMode","isShader","createDeclaration","enumKey","
|
1
|
+
{"version":3,"sources":["Blend.tsx"],"names":["React","isImageFilter","BlendMode","isShader","createDeclaration","enumKey","childrenAreImageFilters","children","every","child","childrenAreShaders","onDeclare","mode","Skia","blend","reverse","reduce","inner","outer","ImageFilter","MakeBlend","Shader","Error","Blend","props"],"mappings":";;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,aAAT,EAAwBC,SAAxB,EAAmCC,QAAnC,QAAmD,kBAAnD;AACA,SAASC,iBAAT,QAAkC,UAAlC;AAEA,SAASC,OAAT,QAAwB,qBAAxB;;AAGA,MAAMC,uBAAuB,GAC3BC,QAD8B,IAG9BA,QAAQ,CAACC,KAAT,CAAgBC,KAAD,IAAWR,aAAa,CAACQ,KAAD,CAAvC,CAHF;;AAKA,MAAMC,kBAAkB,GACtBH,QADyB,IAEEA,QAAQ,CAACC,KAAT,CAAgBC,KAAD,IAAWN,QAAQ,CAACM,KAAD,CAAlC,CAF7B;;AASA,MAAME,SAAS,GAAGP,iBAAiB,CACjC,OAAWG,QAAX,YAAkC;AAAA,MAAjC;AAAEK,IAAAA;AAAF,GAAiC;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAChC,QAAMC,KAAK,GAAGZ,SAAS,CAACG,OAAO,CAACO,IAAD,CAAR,CAAvB;;AACA,MAAIN,uBAAuB,CAACC,QAAD,CAA3B,EAAuC;AACrC,WAAOA,QAAQ,CAACQ,OAAT,GAAmBC,MAAnB,CAAgD,CAACC,KAAD,EAAQC,KAAR,KAAkB;AACvE,UAAID,KAAK,KAAK,IAAd,EAAoB;AAClB,eAAOC,KAAP;AACD;;AACD,aAAOL,IAAI,CAACM,WAAL,CAAiBC,SAAjB,CAA2BN,KAA3B,EAAkCI,KAAlC,EAAyCD,KAAzC,CAAP;AACD,KALM,EAKJ,IALI,CAAP;AAMD,GAPD,MAOO,IAAIP,kBAAkB,CAACH,QAAD,CAAtB,EAAkC;AACvC,WAAOA,QAAQ,CAACQ,OAAT,GAAmBC,MAAnB,CAA2C,CAACC,KAAD,EAAQC,KAAR,KAAkB;AAClE,UAAID,KAAK,KAAK,IAAd,EAAoB;AAClB,eAAOC,KAAP;AACD;;AACD,aAAOL,IAAI,CAACQ,MAAL,CAAYD,SAAZ,CAAsBN,KAAtB,EAA6BI,KAA7B,EAAoCD,KAApC,CAAP;AACD,KALM,EAKJ,IALI,CAAP;AAMD;;AACD,QAAM,IAAIK,KAAJ,CAAU,kDAAV,CAAN;AACD,CAnBgC,CAAnC;AAsBA,OAAO,MAAMC,KAAK,GAAIC,KAAD,IAAsC;AACzD,sBAAO;AAAe,IAAA,SAAS,EAAEb;AAA1B,KAAyCa,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport type { SkImageFilter, SkShader } from \"../../skia/types\";\nimport { isImageFilter, BlendMode, isShader } from \"../../skia/types\";\nimport { createDeclaration } from \"../nodes\";\nimport type { AnimatedProps, SkEnum } from \"../processors\";\nimport { enumKey } from \"../processors/Paint\";\nimport type { DeclarationResult } from \"../nodes/Declaration\";\n\nconst childrenAreImageFilters = (\n children: DeclarationResult[]\n): children is SkImageFilter[] =>\n children.every((child) => isImageFilter(child));\n\nconst childrenAreShaders = (\n children: DeclarationResult[]\n): children is SkShader[] => children.every((child) => isShader(child));\n\ninterface BlendProps {\n mode: SkEnum<typeof BlendMode>;\n children?: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<BlendProps>(\n ({ mode }, children, { Skia }) => {\n const blend = BlendMode[enumKey(mode)];\n if (childrenAreImageFilters(children)) {\n return children.reverse().reduce<SkImageFilter | null>((inner, outer) => {\n if (inner === null) {\n return outer;\n }\n return Skia.ImageFilter.MakeBlend(blend, outer, inner);\n }, null);\n } else if (childrenAreShaders(children)) {\n return children.reverse().reduce<SkShader | null>((inner, outer) => {\n if (inner === null) {\n return outer;\n }\n return Skia.Shader.MakeBlend(blend, outer, inner);\n }, null);\n }\n throw new Error(\"<Blend /> can only blend Shaders or ImageFilters\");\n }\n);\n\nexport const Blend = (props: AnimatedProps<BlendProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
|
@@ -14,7 +14,7 @@ const onDeclare = createDeclaration((_ref, children, _ref2) => {
|
|
14
14
|
} = _ref2;
|
15
15
|
const input = getInput(Skia, children);
|
16
16
|
const r = processRadius(Skia, radius);
|
17
|
-
const factory = operator === "dilate" ? Skia.ImageFilter.MakeDilate : Skia.ImageFilter.MakeErode;
|
17
|
+
const factory = operator === "dilate" ? Skia.ImageFilter.MakeDilate.bind(Skia.ImageFilter) : Skia.ImageFilter.MakeErode.bind(Skia.ImageFilter);
|
18
18
|
return factory(r.x, r.y, input);
|
19
19
|
});
|
20
20
|
export const Morphology = props => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Morphology.tsx"],"names":["React","createDeclaration","processRadius","getInput","onDeclare","children","radius","operator","Skia","input","r","factory","ImageFilter","MakeDilate","MakeErode","x","y","Morphology","props","defaultProps"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,iBAAT,QAAkC,yBAAlC;AAEA,SAASC,aAAT,QAA8B,yBAA9B;AAEA,SAASC,QAAT,QAAyB,YAAzB;AAQA,MAAMC,SAAS,GAAGH,iBAAiB,CACjC,OAAuBI,QAAvB,YAA8C;AAAA,MAA7C;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAA6C;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC5C,QAAMC,KAAK,GAAGN,QAAQ,CAACK,IAAD,EAAOH,QAAP,CAAtB;AACA,QAAMK,CAAC,GAAGR,aAAa,CAACM,IAAD,EAAOF,MAAP,CAAvB;AACA,QAAMK,OAAO,GACXJ,QAAQ,KAAK,QAAb,GACIC,IAAI,CAACI,WAAL,CAAiBC,
|
1
|
+
{"version":3,"sources":["Morphology.tsx"],"names":["React","createDeclaration","processRadius","getInput","onDeclare","children","radius","operator","Skia","input","r","factory","ImageFilter","MakeDilate","bind","MakeErode","x","y","Morphology","props","defaultProps"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,iBAAT,QAAkC,yBAAlC;AAEA,SAASC,aAAT,QAA8B,yBAA9B;AAEA,SAASC,QAAT,QAAyB,YAAzB;AAQA,MAAMC,SAAS,GAAGH,iBAAiB,CACjC,OAAuBI,QAAvB,YAA8C;AAAA,MAA7C;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAA6C;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC5C,QAAMC,KAAK,GAAGN,QAAQ,CAACK,IAAD,EAAOH,QAAP,CAAtB;AACA,QAAMK,CAAC,GAAGR,aAAa,CAACM,IAAD,EAAOF,MAAP,CAAvB;AACA,QAAMK,OAAO,GACXJ,QAAQ,KAAK,QAAb,GACIC,IAAI,CAACI,WAAL,CAAiBC,UAAjB,CAA4BC,IAA5B,CAAiCN,IAAI,CAACI,WAAtC,CADJ,GAEIJ,IAAI,CAACI,WAAL,CAAiBG,SAAjB,CAA2BD,IAA3B,CAAgCN,IAAI,CAACI,WAArC,CAHN;AAIA,SAAOD,OAAO,CAACD,CAAC,CAACM,CAAH,EAAMN,CAAC,CAACO,CAAR,EAAWR,KAAX,CAAd;AACD,CATgC,CAAnC;AAYA,OAAO,MAAMS,UAAU,GAAIC,KAAD,IAA2C;AACnE,sBAAO;AAAe,IAAA,SAAS,EAAEf;AAA1B,KAAyCe,KAAzC,EAAP;AACD,CAFM;AAIPD,UAAU,CAACE,YAAX,GAA0B;AACxBb,EAAAA,QAAQ,EAAE;AADc,CAA1B","sourcesContent":["import React from \"react\";\n\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps, Radius } from \"../../processors\";\nimport { processRadius } from \"../../processors/Radius\";\n\nimport { getInput } from \"./getInput\";\n\nexport interface MorphologyProps {\n operator: \"erode\" | \"dilate\";\n radius: Radius;\n children?: React.ReactNode | React.ReactNode[];\n}\n\nconst onDeclare = createDeclaration<MorphologyProps>(\n ({ radius, operator }, children, { Skia }) => {\n const input = getInput(Skia, children);\n const r = processRadius(Skia, radius);\n const factory =\n operator === \"dilate\"\n ? Skia.ImageFilter.MakeDilate.bind(Skia.ImageFilter)\n : Skia.ImageFilter.MakeErode.bind(Skia.ImageFilter);\n return factory(r.x, r.y, input);\n }\n);\n\nexport const Morphology = (props: AnimatedProps<MorphologyProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nMorphology.defaultProps = {\n operator: \"dilate\",\n};\n"]}
|
@@ -25,7 +25,7 @@ const onDeclare = createDeclaration((_ref, children, _ref2) => {
|
|
25
25
|
if (inner) {
|
26
26
|
factory = MakeInnerShadow.bind(null, Skia, shadowOnly);
|
27
27
|
} else {
|
28
|
-
factory = shadowOnly ? Skia.ImageFilter.MakeDropShadowOnly : Skia.ImageFilter.MakeDropShadow;
|
28
|
+
factory = shadowOnly ? Skia.ImageFilter.MakeDropShadowOnly.bind(Skia.ImageFilter) : Skia.ImageFilter.MakeDropShadow.bind(Skia.ImageFilter);
|
29
29
|
}
|
30
30
|
|
31
31
|
return factory(dx, dy, blur, blur, color, input);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Shadow.tsx"],"names":["React","createDeclaration","processColor","getInput","MakeInnerShadow","onDeclare","children","dx","dy","blur","color","cl","shadowOnly","inner","opacity","Skia","input","factory","bind","ImageFilter","MakeDropShadowOnly","MakeDropShadow","Shadow","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,iBAAT,QAAkC,yBAAlC;AAGA,SAASC,YAAT,QAA6B,wBAA7B;AAEA,SAASC,QAAT,QAAyB,YAAzB;AACA,SAASC,eAAT,QAAgC,eAAhC;AAWA,MAAMC,SAAS,GAAGJ,iBAAiB,CACjC,OAEEK,QAFF,YAIK;AAAA,MAHH;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAK,EAAEC,EAAvB;AAA2BC,IAAAA,UAA3B;AAAuCC,IAAAA;AAAvC,GAGG;AAAA,MADH;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GACG;AACH,QAAMC,KAAK,GAAGb,QAAQ,CAACY,IAAD,EAAOT,QAAP,CAAtB;AACA,QAAMI,KAAK,GAAGR,YAAY,CAACa,IAAD,EAAOJ,EAAP,EAAWG,OAAX,CAA1B;AACA,MAAIG,OAAJ;;AACA,MAAIJ,KAAJ,EAAW;AACTI,IAAAA,OAAO,GAAGb,eAAe,CAACc,IAAhB,CAAqB,IAArB,EAA2BH,IAA3B,EAAiCH,UAAjC,CAAV;AACD,GAFD,MAEO;AACLK,IAAAA,OAAO,GAAGL,UAAU,GAChBG,IAAI,CAACI,WAAL,CAAiBC,
|
1
|
+
{"version":3,"sources":["Shadow.tsx"],"names":["React","createDeclaration","processColor","getInput","MakeInnerShadow","onDeclare","children","dx","dy","blur","color","cl","shadowOnly","inner","opacity","Skia","input","fact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S,EAAElB;AAA1B,KAAyCkB,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { Color } from \"../../../skia/types\";\nimport { processColor } from \"../../processors/Color\";\n\nimport { getInput } from \"./getInput\";\nimport { MakeInnerShadow } from \"./InnerShadow\";\n\nexport interface ShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n inner?: boolean;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<ShadowProps>(\n (\n { dx, dy, blur, color: cl, shadowOnly, inner },\n children,\n { opacity, Skia }\n ) => {\n const input = getInput(Skia, children);\n const color = processColor(Skia, cl, opacity);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly.bind(Skia.ImageFilter)\n : Skia.ImageFilter.MakeDropShadow.bind(Skia.ImageFilter);\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n);\n\nexport const Shadow = (props: AnimatedProps<ShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
|
@@ -12,6 +12,13 @@ export const isValue = value => {
|
|
12
12
|
|
13
13
|
return false;
|
14
14
|
};
|
15
|
+
export const isSelector = value => {
|
16
|
+
if (value) {
|
17
|
+
return typeof value === "object" && "selector" in value && "value" in value && value.selector !== undefined && value.value !== undefined;
|
18
|
+
}
|
19
|
+
|
20
|
+
return false;
|
21
|
+
};
|
15
22
|
export const isAnimated = props => {
|
16
23
|
for (const value of Object.values(props)) {
|
17
24
|
if (isValue(value)) {
|
@@ -25,12 +32,14 @@ export const materialize = props => {
|
|
25
32
|
const result = { ...props
|
26
33
|
};
|
27
34
|
mapKeys(props).forEach(key => {
|
28
|
-
const
|
35
|
+
const prop = props[key];
|
29
36
|
|
30
|
-
if (isValue(
|
31
|
-
result[key] =
|
37
|
+
if (isValue(prop)) {
|
38
|
+
result[key] = prop.current;
|
39
|
+
} else if (isSelector(prop)) {
|
40
|
+
result[key] = prop.selector(prop.value.current);
|
32
41
|
}
|
33
42
|
});
|
34
43
|
return result;
|
35
|
-
};
|
44
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
36
45
|
//# sourceMappingURL=Animations.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Animations.ts"],"names":["mapKeys","isValue","value","undefined","__typename__","isAnimated","props","Object","values","materialize","result","forEach","key","current"],"mappings":"AACA,SAASA,OAAT,QAAwB,iBAAxB;AAEA,OAAO,MAAMC,OAAO,GAAIC,KAAD,IAAiD;AACtE,MAAIA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAArC,EAA2C;AACzC,WAAO,KAAP;AACD;;AACD,MAAI;AACF,QACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,kBAAkBA,KADlB,IAECA,KAAD,CAAyCE,YAAzC,KAA0D,WAH5D,EAIE;AACA,aAAO,IAAP;AACD;AACF,GARD,CAQE,MAAM,CAAE;;AACV,SAAO,KAAP;AACD,CAdM;AAgBP,OAAO,MAAMC,UAAU,GAAOC,KAAJ,IAAgC;AACxD,OAAK,
|
1
|
+
{"version":3,"sources":["Animations.ts"],"names":["mapKeys","isValue","value","undefined","__typename__","isSelector","selector","isAnimated","props","Object","values","materialize","result","forEach","key","prop","current"],"mappings":"AACA,SAASA,OAAT,QAAwB,iBAAxB;AAEA,OAAO,MAAMC,OAAO,GAAIC,KAAD,IAAiD;AACtE,MAAIA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAArC,EAA2C;AACzC,WAAO,KAAP;AACD;;AACD,MAAI;AACF,QACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,kBAAkBA,KADlB,IAECA,KAAD,CAAyCE,YAAzC,KAA0D,WAH5D,EAIE;AACA,aAAO,IAAP;AACD;AACF,GARD,CAQE,MAAM,CAAE;;AACV,SAAO,KAAP;AACD,CAdM;AAgBP,OAAO,MAAMC,UAAU,GACrBH,KADwB,IAKrB;AACH,MAAIA,KAAJ,EAAW;AACT,WACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,cAAcA,KADd,IAEA,WAAWA,KAFX,IAGCA,KAAD,CAAmCI,QAAnC,KAAgDH,SAHhD,IAICD,KAAD,CAAmCA,KAAnC,KAA6CC,SAL/C;AAOD;;AACD,SAAO,KAAP;AACD,CAhBM;AAkBP,OAAO,MAAMI,UAAU,GAAOC,KAAJ,IAAgC;AACxD,OAAK,MAAMN,KAAX,IAAoBO,MAAM,CAACC,MAAP,CAAcF,KAAd,CAApB,EAA0C;AACxC,QAAIP,OAAO,CAACC,KAAD,CAAX,EAAoB;AAClB,aAAO,IAAP;AACD;AACF;;AACD,SAAO,KAAP;AACD,CAPM;AASP,OAAO,MAAMS,WAAW,GAAOH,KAAJ,IAAgC;AACzD,QAAMI,MAAM,GAAG,EAAE,GAAGJ;AAAL,GAAf;AACAR,EAAAA,OAAO,CAACQ,KAAD,CAAP,CAAeK,OAAf,CAAwBC,GAAD,IAAS;AAC9B,UAAMC,IAAI,GAAGP,KAAK,CAACM,GAAD,CAAlB;;AACA,QAAIb,OAAO,CAACc,IAAD,CAAX,EAAmB;AACjBH,MAAAA,MAAM,CAACE,GAAD,CAAN,GAAeC,IAAD,CAAmCC,OAAjD;AACD,KAFD,MAEO,IAAIX,UAAU,CAACU,IAAD,CAAd,EAAsB;AAC3BH,MAAAA,MAAM,CAACE,GAAD,CAAN,GAAcC,IAAI,CAACT,QAAL,CAAcS,IAAI,CAACb,KAAL,CAAWc,OAAzB,CAAd;AACD;AACF,GAPD;AAQA,SAAOJ,MAAP;AACD,CAXM,C,CAaP","sourcesContent":["import type { SkiaSelector, SkiaValue } from \"../../../values\";\nimport { mapKeys } from \"../../typeddash\";\n\nexport const isValue = (value: unknown): value is SkiaValue<unknown> => {\n if (value === undefined || value === null) {\n return false;\n }\n try {\n if (\n typeof value === \"object\" &&\n \"__typename__\" in value &&\n (value as unknown as SkiaValue<unknown>).__typename__ === \"RNSkValue\"\n ) {\n return true;\n }\n } catch {}\n return false;\n};\n\nexport const isSelector = <T, R>(\n value: unknown\n): value is {\n selector: (v: T) => R;\n value: SkiaValue<T>;\n} => {\n if (value) {\n return (\n typeof value === \"object\" &&\n \"selector\" in value &&\n \"value\" in value &&\n (value as Record<string, unknown>).selector !== undefined &&\n (value as Record<string, unknown>).value !== undefined\n );\n }\n return false;\n};\n\nexport const isAnimated = <T>(props: AnimatedProps<T>) => {\n for (const value of Object.values(props)) {\n if (isValue(value)) {\n return true;\n }\n }\n return false;\n};\n\nexport const materialize = <T>(props: AnimatedProps<T>) => {\n const result = { ...props };\n mapKeys(props).forEach((key) => {\n const prop = props[key];\n if (isValue(prop)) {\n result[key] = (prop as SkiaValue<T[typeof key]>).current;\n } else if (isSelector(prop)) {\n result[key] = prop.selector(prop.value.current) as T[typeof key];\n }\n });\n return result as T;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnimatedProp<T, P = any> = T | SkiaValue<T> | SkiaSelector<T, P>;\nexport type AnimatedProps<T> = {\n [K in keyof T]: AnimatedProp<T[K]>;\n};\n"]}
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
import { Image
|
1
|
+
import { useEffect, useState } from "react";
|
2
|
+
import { Image } from "react-native";
|
3
3
|
import { Skia } from "../Skia";
|
4
|
+
import { isRNModule } from "../types";
|
4
5
|
|
5
6
|
const resolveAsset = source => {
|
6
|
-
return
|
7
|
+
return isRNModule(source) ? Image.resolveAssetSource(source).uri : source.default;
|
7
8
|
};
|
8
9
|
|
9
10
|
const factoryWrapper = (data2, factory, onError) => {
|
@@ -17,10 +18,8 @@ const factoryWrapper = (data2, factory, onError) => {
|
|
17
18
|
}
|
18
19
|
};
|
19
20
|
|
20
|
-
const loadDataCollection = (sources, factory, onError) => Promise.all(sources.map(source => loadData(source, factory, onError)));
|
21
|
-
|
22
21
|
const loadData = (source, factory, onError) => {
|
23
|
-
if (source === null) {
|
22
|
+
if (source === null || source === undefined) {
|
24
23
|
return new Promise(resolve => resolve(null));
|
25
24
|
} else if (source instanceof Uint8Array) {
|
26
25
|
return new Promise(resolve => resolve(factoryWrapper(Skia.Data.fromBytes(source), factory, onError)));
|
@@ -30,26 +29,17 @@ const loadData = (source, factory, onError) => {
|
|
30
29
|
}
|
31
30
|
};
|
32
31
|
|
33
|
-
const useLoading =
|
34
|
-
let deps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
32
|
+
const useLoading = (source, loader) => {
|
35
33
|
const [data, setData] = useState(null);
|
36
|
-
const prevSourceRef = useRef();
|
37
34
|
useEffect(() => {
|
38
|
-
|
39
|
-
|
40
|
-
loader().then(setData);
|
41
|
-
} else {
|
42
|
-
setData(null);
|
43
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
44
|
-
|
45
|
-
}, deps);
|
35
|
+
loader().then(setData); // eslint-disable-next-line react-hooks/exhaustive-deps
|
36
|
+
}, [source]);
|
46
37
|
return data;
|
47
38
|
};
|
48
39
|
|
49
|
-
export const
|
50
|
-
export const useRawData = (source, factory, onError, deps) => useLoading(source, () => loadData(source, factory, onError), deps);
|
40
|
+
export const useRawData = (source, factory, onError) => useLoading(source, () => loadData(source, factory, onError));
|
51
41
|
|
52
42
|
const identity = data => data;
|
53
43
|
|
54
|
-
export const useData = (source, onError
|
44
|
+
export const useData = (source, onError) => useRawData(source, identity, onError);
|
55
45
|
//# sourceMappingURL=Data.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Data.ts"],"names":["
|
1
|
+
{"version":3,"sources":["Data.ts"],"names":["useEffect","useState","Image","Skia","isRNModule","resolveAsset","source","resolveAssetSource","uri","default","factoryWrapper","data2","factory","onError","factoryResult","Error","loadData","undefined","Promise","resolve","Uint8Array","Data","fromBytes","fromURI","then","d","useLoading","loader","data","setData","useRawData","identity","useData"],"mappings":"AAA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AAkBf,GAAlB,EAAuBgB,IAAvB,CAA6BC,CAAD,IACjCf,cAAc,CAACe,CAAD,EAAIb,OAAJ,EAAaC,OAAb,CADT,CAAP;AAGD;AACF,CAjBD;;AAkBA,MAAMa,UAAU,GAAG,CACjBpB,MADiB,EAEjBqB,MAFiB,KAGd;AACH,QAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB5B,QAAQ,CAAW,IAAX,CAAhC;AACAD,EAAAA,SAAS,CAAC,MAAM;AACd2B,IAAAA,MAAM,GAAGH,IAAT,CAAcK,OAAd,EADc,CAEd;AACD,GAHQ,EAGN,CAACvB,MAAD,CAHM,CAAT;AAIA,SAAOsB,IAAP;AACD,CAVD;;AAYA,OAAO,MAAME,UAAU,GAAG,CACxBxB,MADwB,EAExBM,OAFwB,EAGxBC,OAHwB,KAIrBa,UAAU,CAACpB,MAAD,EAAS,MAAMU,QAAQ,CAACV,MAAD,EAASM,OAAT,EAAkBC,OAAlB,CAAvB,CAJR;;AAMP,MAAMkB,QAAQ,GAAIH,IAAD,IAAkBA,IAAnC;;AAEA,OAAO,MAAMI,OAAO,GAAG,CACrB1B,MADqB,EAErBO,OAFqB,KAGlBiB,UAAU,CAACxB,MAAD,EAASyB,QAAT,EAAmBlB,OAAnB,CAHR","sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Image } from \"react-native\";\n\nimport { Skia } from \"../Skia\";\nimport { isRNModule } from \"../types\";\nimport type { SkData, DataModule, DataSourceParam } from \"../types\";\n\nconst resolveAsset = (source: DataModule) => {\n return isRNModule(source)\n ? Image.resolveAssetSource(source).uri\n : source.default;\n};\n\nconst factoryWrapper = <T>(\n data2: SkData,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => {\n const factoryResult = factory(data2);\n if (factoryResult === null) {\n onError && onError(new Error(\"Could not load data\"));\n return null;\n } else {\n return factoryResult;\n }\n};\n\nconst loadData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<T | null> => {\n if (source === null || source === undefined) {\n return new Promise((resolve) => resolve(null));\n } else if (source instanceof Uint8Array) {\n return new Promise((resolve) =>\n resolve(factoryWrapper(Skia.Data.fromBytes(source), factory, onError))\n );\n } else {\n const uri = typeof source === \"string\" ? source : resolveAsset(source);\n return Skia.Data.fromURI(uri).then((d) =>\n factoryWrapper(d, factory, onError)\n );\n }\n};\nconst useLoading = <T>(\n source: DataSourceParam,\n loader: () => Promise<T | null>\n) => {\n const [data, setData] = useState<T | null>(null);\n useEffect(() => {\n loader().then(setData);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [source]);\n return data;\n};\n\nexport const useRawData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => useLoading(source, () => loadData(source, factory, onError));\n\nconst identity = (data: SkData) => data;\n\nexport const useData = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, identity, onError);\n"]}
|
@@ -15,8 +15,7 @@ export const useFont = (font, size, onError) => {
|
|
15
15
|
return Skia.Font(typeface);
|
16
16
|
} else {
|
17
17
|
return null;
|
18
|
-
}
|
19
|
-
|
20
|
-
}, [typeface]);
|
18
|
+
}
|
19
|
+
}, [size, typeface]);
|
21
20
|
};
|
22
21
|
//# sourceMappingURL=Font.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Font.ts"],"names":["useMemo","Skia","useTypeface","useFont","font","size","onError","typeface","Font"],"mappings":"AAAA;AACA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,IAAT,QAAqB,SAArB;AAGA,SAASC,WAAT,QAA4B,YAA5B;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,OAAO,GAAG,CACrBC,IADqB,EAErBC,IAFqB,EAGrBC,OAHqB,
|
1
|
+
{"version":3,"sources":["Font.ts"],"names":["useMemo","Skia","useTypeface","useFont","font","size","onError","typeface","Font"],"mappings":"AAAA;AACA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,IAAT,QAAqB,SAArB;AAGA,SAASC,WAAT,QAA4B,YAA5B;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,OAAO,GAAG,CACrBC,IADqB,EAErBC,IAFqB,EAGrBC,OAHqB,KAIlB;AACH,QAAMC,QAAQ,GAAGL,WAAW,CAACE,IAAD,EAAOE,OAAP,CAA5B;AACA,SAAON,OAAO,CAAC,MAAM;AACnB,QAAIO,QAAQ,IAAIF,IAAhB,EAAsB;AACpB,aAAOJ,IAAI,CAACO,IAAL,CAAUD,QAAV,EAAoBF,IAApB,CAAP;AACD,KAFD,MAEO,IAAIE,QAAQ,IAAI,CAACF,IAAjB,EAAuB;AAC5B,aAAOJ,IAAI,CAACO,IAAL,CAAUD,QAAV,CAAP;AACD,KAFM,MAEA;AACL,aAAO,IAAP;AACD;AACF,GARa,EAQX,CAACF,IAAD,EAAOE,QAAP,CARW,CAAd;AASD,CAfM","sourcesContent":["/*global SkiaApi*/\nimport { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useTypeface } from \"./Typeface\";\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size?: number,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface && size) {\n return Skia.Font(typeface, size);\n } else if (typeface && !size) {\n return Skia.Font(typeface);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Image.ts"],"names":["Skia","useRawData","imgFactory","Image","MakeImageFromEncoded","bind","useImage","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,UAAU,GAAGF,IAAI,CAACG,KAAL,CAAWC,oBAAX,CAAgCC,IAAhC,CAAqCL,IAAI,CAACG,KAA1C,CAAnB;AAEA;AACA;AACA;;AACA,OAAO,MAAMG,QAAQ,GAAG,CACtBC,MADsB,EAEtBC,OAFsB,KAGnBP,UAAU,CAACM,MAAD,EAASL,UAAT,EAAqBM,OAArB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type {
|
1
|
+
{"version":3,"sources":["Image.ts"],"names":["Skia","useRawData","imgFactory","Image","MakeImageFromEncoded","bind","useImage","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,UAAU,GAAGF,IAAI,CAACG,KAAL,CAAWC,oBAAX,CAAgCC,IAAhC,CAAqCL,IAAI,CAACG,KAA1C,CAAnB;AAEA;AACA;AACA;;AACA,OAAO,MAAMG,QAAQ,GAAG,CACtBC,MADsB,EAEtBC,OAFsB,KAGnBP,UAAU,CAACM,MAAD,EAASL,UAAT,EAAqBM,OAArB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst imgFactory = Skia.Image.MakeImageFromEncoded.bind(Skia.Image);\n\n/**\n * Returns a Skia Image object\n * */\nexport const useImage = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, imgFactory, onError);\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["SVG.ts"],"names":["Skia","useRawData","svgFactory","SVG","MakeFromData","bind","useSVG","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,UAAU,GAAGF,IAAI,CAACG,GAAL,CAASC,YAAT,CAAsBC,IAAtB,CAA2BL,IAAI,CAACG,GAAhC,CAAnB;AAEA,OAAO,MAAMG,MAAM,GAAG,CACpBC,MADoB,EAEpBC,OAFoB,KAGjBP,UAAU,CAACM,MAAD,EAASL,UAAT,EAAqBM,OAArB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type {
|
1
|
+
{"version":3,"sources":["SVG.ts"],"names":["Skia","useRawData","svgFactory","SVG","MakeFromData","bind","useSVG","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,UAAU,GAAGF,IAAI,CAACG,GAAL,CAASC,YAAT,CAAsBC,IAAtB,CAA2BL,IAAI,CAACG,GAAhC,CAAnB;AAEA,OAAO,MAAMG,MAAM,GAAG,CACpBC,MADoB,EAEpBC,OAFoB,KAGjBP,UAAU,CAACM,MAAD,EAASL,UAAT,EAAqBM,OAArB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst svgFactory = Skia.SVG.MakeFromData.bind(Skia.SVG);\n\nexport const useSVG = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, svgFactory, onError);\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Typeface.ts"],"names":["Skia","useRawData","tfFactory","Typeface","MakeFreeTypeFaceFromData","bind","useTypeface","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,SAAS,GAAGF,IAAI,CAACG,QAAL,CAAcC,wBAAd,CAAuCC,IAAvC,CAA4CL,IAAI,CAACG,QAAjD,CAAlB;AAEA;AACA;AACA;;AACA,OAAO,MAAMG,WAAW,GAAG,CACzBC,MADyB,EAEzBC,OAFyB,KAGtBP,UAAU,CAACM,MAAD,EAASL,SAAT,EAAoBM,OAApB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type {
|
1
|
+
{"version":3,"sources":["Typeface.ts"],"names":["Skia","useRawData","tfFactory","Typeface","MakeFreeTypeFaceFromData","bind","useTypeface","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,SAAS,GAAGF,IAAI,CAACG,QAAL,CAAcC,wBAAd,CAAuCC,IAAvC,CAA4CL,IAAI,CAACG,QAAjD,CAAlB;AAEA;AACA;AACA;;AACA,OAAO,MAAMG,WAAW,GAAG,CACzBC,MADyB,EAEzBC,OAFyB,KAGtBP,UAAU,CAACM,MAAD,EAASL,SAAT,EAAoBM,OAApB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst tfFactory = Skia.Typeface.MakeFreeTypeFaceFromData.bind(Skia.Typeface);\n\n/**\n * Returns a Skia Typeface object\n * */\nexport const useTypeface = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, tfFactory, onError);\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export
|
1
|
+
export const isRNModule = mod => typeof mod === "number";
|
2
2
|
//# sourceMappingURL=Data.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
1
|
+
{"version":3,"sources":["Data.ts"],"names":["isRNModule","mod"],"mappings":"AAaA,OAAO,MAAMA,UAAU,GAAIC,GAAD,IACxB,OAAOA,GAAP,KAAe,QADV","sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport type SkData = SkJSIInstance<\"Data\">;\n\ntype RNModule = number;\ntype ESModule = {\n __esModule: true;\n default: string;\n};\nexport type DataModule = RNModule | ESModule;\nexport type DataSource = DataModule | string | Uint8Array;\nexport type DataSourceParam = DataSource | null | undefined;\n\nexport const isRNModule = (mod: DataModule): mod is RNModule =>\n typeof mod === \"number\";\n"]}
|
@@ -1,9 +1,8 @@
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
2
|
|
3
|
-
/* eslint-disable no-nested-ternary */
|
4
3
|
export class NotImplementedOnRNWeb extends Error {
|
5
|
-
constructor() {
|
6
|
-
super("Not implemented on React Native Web");
|
4
|
+
constructor(msg) {
|
5
|
+
super(msg !== null && msg !== void 0 ? msg : "Not implemented on React Native Web");
|
7
6
|
}
|
8
7
|
|
9
8
|
}
|
@@ -15,7 +14,7 @@ export class Host {
|
|
15
14
|
}
|
16
15
|
|
17
16
|
}
|
18
|
-
export class
|
17
|
+
export class BaseHostObject extends Host {
|
19
18
|
constructor(CanvasKit, ref, typename) {
|
20
19
|
super(CanvasKit);
|
21
20
|
|
@@ -27,12 +26,13 @@ export class HostObject extends Host {
|
|
27
26
|
this.__typename__ = typename;
|
28
27
|
}
|
29
28
|
|
30
|
-
}
|
29
|
+
}
|
30
|
+
export class HostObject extends BaseHostObject {
|
31
|
+
static fromValue(value) {
|
32
|
+
return value.ref;
|
33
|
+
}
|
31
34
|
|
32
|
-
|
33
|
-
export const toUndefinedableValue = value => value === undefined ? undefined : toValue(value);
|
34
|
-
export const toNullableValue = value => value === null ? null : toValue(value);
|
35
|
-
export const toValue = value => value.ref;
|
35
|
+
}
|
36
36
|
export const ckEnum = value => ({
|
37
37
|
value
|
38
38
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","Host","CanvasKit","
|
1
|
+
{"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"mappings":";;AAIA,OAAO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;AAC/CC,EAAAA,WAAW,CAACC,GAAD,EAAe;AACxB,UAAMA,GAAN,aAAMA,GAAN,cAAMA,GAAN,GAAa,qCAAb;AACD;;AAH8C;AAMjD,OAAO,MAAeC,IAAf,CAAoB;AAGzBF,EAAAA,WAAW,CAACG,SAAD,EAAuB;AAAA;;AAChC,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AALwB;AAQ3B,OAAO,MAAeC,cAAf,SACGF,IADH,CAGP;AAIEF,EAAAA,WAAW,CAACG,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;AACrD,UAAMH,SAAN;;AADqD;;AAAA;;AAErD,SAAKE,GAAL,GAAWA,GAAX;AACA,SAAKE,YAAL,GAAoBD,QAApB;AACD;;AARH;AAWA,OAAO,MAAeE,UAAf,SAAuDJ,cAAvD,CAGL;AACgB,SAATK,SAAS,CAAIC,KAAJ,EAAkC;AAChD,WAAQA,KAAD,CAAiCL,GAAxC;AACD;;AAHD;AAMF,OAAO,MAAMM,MAAM,GAAID,KAAD,KAAsC;AAAEA,EAAAA;AAAF,CAAtC,CAAf;AACP,OAAO,MAAME,OAAO,GAClBF,KADqB,IAGrBA,KAAK,KAAKG,SAAV,GAAsBA,SAAtB,GAAkC;AAAEH,EAAAA;AAAF,CAH7B","sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n readonly ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"]}
|