@shopify/react-native-skia 0.1.134 → 0.1.138

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. package/README.md +4 -47
  2. package/android/build.gradle +1 -2
  3. package/cpp/api/JsiSkFont.h +25 -1
  4. package/cpp/api/JsiSkMatrix.h +12 -0
  5. package/cpp/api/JsiSkTypeface.h +1 -29
  6. package/jestSetup.js +5 -0
  7. package/lib/commonjs/animation/functions/interpolate.js +3 -2
  8. package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
  9. package/lib/commonjs/animation/functions/interpolateColors.js +2 -2
  10. package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -1
  11. package/lib/commonjs/animation/functions/interpolatePaths.js +45 -11
  12. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
  13. package/lib/commonjs/mock/index.js +121 -177
  14. package/lib/commonjs/mock/index.js.map +1 -1
  15. package/lib/commonjs/renderer/components/Group.js +1 -1
  16. package/lib/commonjs/renderer/components/Group.js.map +1 -1
  17. package/lib/commonjs/renderer/processors/Transform.js +8 -15
  18. package/lib/commonjs/renderer/processors/Transform.js.map +1 -1
  19. package/lib/commonjs/skia/core/Data.js +7 -4
  20. package/lib/commonjs/skia/core/Data.js.map +1 -1
  21. package/lib/commonjs/skia/types/Font/Font.js.map +1 -1
  22. package/lib/commonjs/skia/types/Matrix.js +18 -3
  23. package/lib/commonjs/skia/types/Matrix.js.map +1 -1
  24. package/lib/commonjs/skia/web/JsiSkFont.js +6 -0
  25. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  26. package/lib/commonjs/skia/web/JsiSkMatrix.js +4 -0
  27. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  28. package/lib/commonjs/values/api.js +1 -7
  29. package/lib/commonjs/values/api.js.map +1 -1
  30. package/lib/commonjs/values/hooks/useComputedValue.js +2 -2
  31. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  32. package/lib/commonjs/views/SkiaView.web.js +27 -37
  33. package/lib/commonjs/views/SkiaView.web.js.map +1 -1
  34. package/lib/commonjs/web/LoadSkiaWeb.js +29 -0
  35. package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -0
  36. package/lib/commonjs/web/WithSkiaWeb.js +39 -0
  37. package/lib/commonjs/web/WithSkiaWeb.js.map +1 -0
  38. package/lib/commonjs/web/index.js +22 -12
  39. package/lib/commonjs/web/index.js.map +1 -1
  40. package/lib/module/animation/functions/interpolate.js +2 -2
  41. package/lib/module/animation/functions/interpolate.js.map +1 -1
  42. package/lib/module/animation/functions/interpolateColors.js +1 -1
  43. package/lib/module/animation/functions/interpolateColors.js.map +1 -1
  44. package/lib/module/animation/functions/interpolatePaths.js +44 -11
  45. package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
  46. package/lib/module/mock/index.js +103 -147
  47. package/lib/module/mock/index.js.map +1 -1
  48. package/lib/module/renderer/components/Group.js +1 -1
  49. package/lib/module/renderer/components/Group.js.map +1 -1
  50. package/lib/module/renderer/processors/Transform.js +8 -15
  51. package/lib/module/renderer/processors/Transform.js.map +1 -1
  52. package/lib/module/skia/core/Data.js +7 -4
  53. package/lib/module/skia/core/Data.js.map +1 -1
  54. package/lib/module/skia/types/Font/Font.js.map +1 -1
  55. package/lib/module/skia/types/Matrix.js +12 -2
  56. package/lib/module/skia/types/Matrix.js.map +1 -1
  57. package/lib/module/skia/web/JsiSkFont.js +6 -0
  58. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  59. package/lib/module/skia/web/JsiSkMatrix.js +4 -0
  60. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  61. package/lib/module/values/api.js +0 -4
  62. package/lib/module/values/api.js.map +1 -1
  63. package/lib/module/values/hooks/useComputedValue.js +1 -1
  64. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  65. package/lib/module/views/SkiaView.web.js +27 -37
  66. package/lib/module/views/SkiaView.web.js.map +1 -1
  67. package/lib/module/web/LoadSkiaWeb.js +16 -0
  68. package/lib/module/web/LoadSkiaWeb.js.map +1 -0
  69. package/lib/module/web/WithSkiaWeb.js +23 -0
  70. package/lib/module/web/WithSkiaWeb.js.map +1 -0
  71. package/lib/module/web/index.js +2 -9
  72. package/lib/module/web/index.js.map +1 -1
  73. package/lib/typescript/jestSetup.d.ts +1 -0
  74. package/lib/typescript/src/animation/functions/interpolate.d.ts +6 -0
  75. package/lib/typescript/src/animation/functions/interpolatePaths.d.ts +3 -1
  76. package/lib/typescript/src/mock/index.d.ts +11 -42
  77. package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
  78. package/lib/typescript/src/renderer/processors/Transform.d.ts +2 -2
  79. package/lib/typescript/src/skia/types/Font/Font.d.ts +6 -0
  80. package/lib/typescript/src/skia/types/Matrix.d.ts +6 -2
  81. package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +1 -4
  82. package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -0
  83. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +1 -0
  84. package/lib/typescript/src/values/api.d.ts +0 -1
  85. package/lib/typescript/src/views/SkiaView.web.d.ts +4 -6
  86. package/lib/typescript/src/web/LoadSkiaWeb.d.ts +6 -0
  87. package/lib/typescript/src/web/WithSkiaWeb.d.ts +12 -0
  88. package/lib/typescript/src/web/index.d.ts +2 -5
  89. package/package.json +7 -3
  90. package/scripts/setup-canvaskit.js +74 -0
  91. package/src/animation/functions/interpolate.ts +4 -2
  92. package/src/animation/functions/interpolateColors.ts +1 -1
  93. package/src/animation/functions/interpolatePaths.ts +59 -10
  94. package/src/mock/index.ts +103 -149
  95. package/src/renderer/components/Group.tsx +1 -1
  96. package/src/renderer/processors/Transform.ts +7 -10
  97. package/src/skia/core/Data.ts +7 -8
  98. package/src/skia/types/Font/Font.ts +7 -0
  99. package/src/skia/types/Matrix.ts +19 -3
  100. package/src/skia/types/Typeface/Typeface.ts +1 -4
  101. package/src/skia/web/JsiSkFont.ts +6 -0
  102. package/src/skia/web/JsiSkMatrix.ts +4 -0
  103. package/src/values/api.ts +0 -2
  104. package/src/values/hooks/useComputedValue.ts +1 -1
  105. package/src/views/SkiaView.web.tsx +36 -43
  106. package/src/web/LoadSkiaWeb.tsx +24 -0
  107. package/src/web/WithSkiaWeb.tsx +37 -0
  108. package/src/web/index.ts +2 -15
@@ -3,188 +3,132 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.vec = exports.useValueEffect = exports.useValue = exports.useTypeface = exports.useTouchHandler = exports.useTiming = exports.useSpring = exports.useSharedValueEffect = exports.useSVG = exports.usePicture = exports.useImage = exports.useFont = exports.useDataCollection = exports.useData = exports.useComputedValue = exports.useClockValue = exports.timing = exports.spring = exports.runTiming = exports.runSpring = exports.runDecay = exports.rrect = exports.rect = exports.decay = exports.Skia = void 0;
7
-
8
- /**
9
- * Mock implementation for test runners.
10
- *
11
- * Example:
12
- *
13
- * ```js
14
- * jest.mock('@shopify/react-native-skia', () => require('@shopify/react-native-skia/lib/commonjs/mock'));
15
- * ```
16
- */
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
- const MockJSIInstance = {};
19
-
20
- const Noop = () => MockJSIInstance;
21
-
22
- const Skia = {
23
- Point: Noop,
24
- XYWHRect: Noop,
25
- RuntimeShaderBuilder: Noop,
26
- RRectXY: Noop,
27
- RSXform: Noop,
28
- Color: Noop,
29
- ContourMeasureIter: Noop,
30
- Paint: Noop,
31
- PictureRecorder: Noop,
32
- Picture: {
33
- MakePicture: Noop
34
- },
35
- Path: {
36
- Make: Noop,
37
- MakeFromSVGString: Noop,
38
- MakeFromOp: Noop,
39
- MakeFromCmds: Noop,
40
- MakeFromText: Noop
41
- },
42
- Matrix: Noop,
43
- ColorFilter: {
44
- MakeMatrix: Noop,
45
- MakeBlend: Noop,
46
- MakeCompose: Noop,
47
- MakeLerp: Noop,
48
- MakeLinearToSRGBGamma: Noop,
49
- MakeSRGBToLinearGamma: Noop,
50
- MakeLumaColorFilter: Noop
51
- },
52
- Font: Noop,
53
- Typeface: {
54
- MakeFreeTypeFaceFromData: Noop
55
- },
56
- MaskFilter: {
57
- MakeBlur: Noop
58
- },
59
- RuntimeEffect: {
60
- Make: Noop
61
- },
62
- ImageFilter: {
63
- MakeOffset: Noop,
64
- MakeDisplacementMap: Noop,
65
- MakeShader: Noop,
66
- MakeBlur: Noop,
67
- MakeColorFilter: Noop,
68
- MakeCompose: Noop,
69
- MakeDropShadow: Noop,
70
- MakeDropShadowOnly: Noop,
71
- MakeErode: Noop,
72
- MakeDilate: Noop,
73
- MakeBlend: Noop,
74
- MakeRuntimeShader: Noop
75
- },
76
- Shader: {
77
- MakeLinearGradient: Noop,
78
- MakeRadialGradient: Noop,
79
- MakeTwoPointConicalGradient: Noop,
80
- MakeSweepGradient: Noop,
81
- MakeTurbulence: Noop,
82
- MakeFractalNoise: Noop,
83
- MakeBlend: Noop,
84
- MakeColor: Noop
85
- },
86
- PathEffect: {
87
- MakeCorner: Noop,
88
- MakeDash: Noop,
89
- MakeDiscrete: Noop,
90
- MakeCompose: Noop,
91
- MakeSum: Noop,
92
- MakeLine2D: Noop,
93
- MakePath1D: Noop,
94
- MakePath2D: Noop
95
- },
96
- MakeVertices: Noop,
97
- Data: {
98
- fromURI: Noop,
99
- fromBytes: Noop,
100
- fromBase64: Noop
101
- },
102
- Image: {
103
- MakeImageFromEncoded: Noop,
104
- MakeImage: Noop
105
- },
106
- SVG: {
107
- MakeFromData: Noop,
108
- MakeFromString: Noop
109
- },
110
- FontMgr: {
111
- RefDefault: Noop
112
- },
113
- TextBlob: {
114
- MakeFromText: Noop,
115
- MakeFromGlyphs: Noop,
116
- MakeFromRSXform: Noop,
117
- MakeFromRSXformGlyphs: Noop
118
- },
119
- Surface: {
120
- Make: Noop
6
+ exports.vec = exports.Skia = exports.Mock = void 0;
7
+
8
+ var Values = _interopRequireWildcard(require("../values/web"));
9
+
10
+ var ValuesHooks = _interopRequireWildcard(require("../values/hooks"));
11
+
12
+ var BaseSkia = _interopRequireWildcard(require("../skia/types"));
13
+
14
+ var _useSharedValueEffect = require("../external/reanimated/useSharedValueEffect");
15
+
16
+ var timingFunctions = _interopRequireWildcard(require("../animation/timing"));
17
+
18
+ var springFunctions = _interopRequireWildcard(require("../animation/spring"));
19
+
20
+ var decayFunctions = _interopRequireWildcard(require("../animation/decay"));
21
+
22
+ var interpolateFn = _interopRequireWildcard(require("../animation/functions/interpolate"));
23
+
24
+ var interpolatePathFn = _interopRequireWildcard(require("../animation/functions/interpolatePaths"));
25
+
26
+ var interpolateVectorFn = _interopRequireWildcard(require("../animation/functions/interpolateVector"));
27
+
28
+ var _ShaderLib = require("../renderer/components/shaders/ShaderLib");
29
+
30
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
+
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
+
34
+ /* eslint-disable @typescript-eslint/no-explicit-any */
35
+ class Stub {
36
+ constructor() {
37
+ return new Proxy(() => {}, {
38
+ get: () => new Stub(),
39
+ apply: () => new Stub(),
40
+ set: () => true
41
+ });
121
42
  }
122
- };
123
- exports.Skia = Skia;
124
43
 
125
- const vec = (x, y) => ({
126
- x,
127
- y
128
- });
44
+ }
129
45
 
130
- exports.vec = vec;
46
+ const Noop = () => {};
131
47
 
132
- const rect = (x, y, width, height) => ({
133
- x,
134
- y,
135
- width,
136
- height
137
- });
48
+ const Skia = new Stub();
49
+ exports.Skia = Skia;
138
50
 
139
- exports.rect = rect;
51
+ const vec = (x, y) => {
52
+ var _ref;
140
53
 
141
- const rrect = (r, rx, ry) => ({
142
- rect: r,
143
- rx,
144
- ry
145
- });
54
+ return {
55
+ x: x !== null && x !== void 0 ? x : 0,
56
+ y: (_ref = y !== null && y !== void 0 ? y : x) !== null && _ref !== void 0 ? _ref : 0
57
+ };
58
+ };
146
59
 
147
- exports.rrect = rrect;
148
- const useTouchHandler = Noop;
149
- exports.useTouchHandler = useTouchHandler;
150
- const useComputedValue = Noop;
151
- exports.useComputedValue = useComputedValue;
152
- const useValue = Noop;
153
- exports.useValue = useValue;
154
- const useClockValue = Noop;
155
- exports.useClockValue = useClockValue;
156
- const useValueEffect = Noop;
157
- exports.useValueEffect = useValueEffect;
158
- const useTiming = Noop;
159
- exports.useTiming = useTiming;
160
- const runTiming = Noop;
161
- exports.runTiming = runTiming;
162
- const timing = Noop;
163
- exports.timing = timing;
164
- const useSpring = Noop;
165
- exports.useSpring = useSpring;
166
- const runSpring = Noop;
167
- exports.runSpring = runSpring;
168
- const spring = Noop;
169
- exports.spring = spring;
170
- const runDecay = Noop;
171
- exports.runDecay = runDecay;
172
- const decay = Noop;
173
- exports.decay = decay;
174
- const useSharedValueEffect = Noop;
175
- exports.useSharedValueEffect = useSharedValueEffect;
176
- const useData = Noop;
177
- exports.useData = useData;
178
- const useDataCollection = Noop;
179
- exports.useDataCollection = useDataCollection;
180
- const useFont = Noop;
181
- exports.useFont = useFont;
182
- const useImage = Noop;
183
- exports.useImage = useImage;
184
- const usePicture = Noop;
185
- exports.usePicture = usePicture;
186
- const useSVG = Noop;
187
- exports.useSVG = useSVG;
188
- const useTypeface = Noop;
189
- exports.useTypeface = useTypeface;
60
+ exports.vec = vec;
61
+ const Mock = {
62
+ // SkiaExports
63
+ // 1. Skia API. BaseSkia contains the enums, and functions like isPaint etc
64
+ Skia,
65
+ ...BaseSkia,
66
+ // 2. Hooks
67
+ useDataCollection: Noop,
68
+ useRawData: Noop,
69
+ useData: Noop,
70
+ useFont: Noop,
71
+ useTypeface: Noop,
72
+ useImage: Noop,
73
+ usePath: Noop,
74
+ useSVG: Noop,
75
+ useTextPath: Noop,
76
+ usePaint: Noop,
77
+ usePicture: Noop,
78
+ useSvgPath: Noop,
79
+ // 3. Point/Rect/Transform utilities
80
+ vec,
81
+ rect: (x, y, width, height) => ({
82
+ x,
83
+ y,
84
+ width,
85
+ height
86
+ }),
87
+ rrect: (r, rx, ry) => ({
88
+ rect: r,
89
+ rx,
90
+ ry
91
+ }),
92
+ point: vec,
93
+ add: (a, b) => vec(a.x + b.x, a.y + b.y),
94
+ sub: (a, b) => vec(a.x - b.x, a.y - b.y),
95
+ neg: a => vec(-a.x, -a.y),
96
+ dist: (a, b) => Math.hypot(a.x - b.x, a.y - b.y),
97
+ translate: _ref2 => {
98
+ let {
99
+ x,
100
+ y
101
+ } = _ref2;
102
+ return [{
103
+ translateX: x
104
+ }, {
105
+ translateY: y
106
+ }];
107
+ },
108
+ bounds: Noop,
109
+ topLeft: Noop,
110
+ topRight: Noop,
111
+ bottomLeft: Noop,
112
+ bottomRight: Noop,
113
+ center: Noop,
114
+ processTransform2d: Noop,
115
+ // ExternalExports
116
+ useSharedValueEffect: _useSharedValueEffect.useSharedValueEffect,
117
+ // ValueExports
118
+ ...Values,
119
+ ...ValuesHooks,
120
+ // Animations
121
+ ...timingFunctions,
122
+ ...springFunctions,
123
+ ...decayFunctions,
124
+ ...interpolateFn,
125
+ ...interpolatePathFn,
126
+ ...interpolateVectorFn,
127
+ interpolateColors: (_value, _inputRange, _outputRange) => Float32Array.of(0, 0, 0, 0),
128
+ mixColors: (_v, _x, _y) => Float32Array.of(0, 0, 0, 0),
129
+ ShaderLib: _ShaderLib.ShaderLib,
130
+ createDrawing: Noop,
131
+ createDeclaration: Noop
132
+ };
133
+ exports.Mock = Mock;
190
134
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["MockJSIInstance","Noop","Skia","Point","XYWHRect","RuntimeShaderBuilder","RRectXY","RSXform","Color","ContourMeasureIter","Paint","PictureRecorder","Picture","MakePicture","Path","Make","MakeFromSVGString","MakeFromOp","MakeFromCmds","MakeFromText","Matrix","ColorFilter","MakeMatrix","MakeBlend","MakeCompose","MakeLerp","MakeLinearToSRGBGamma","MakeSRGBToLinearGamma","MakeLumaColorFilter","Font","Typeface","MakeFreeTypeFaceFromData","MaskFilter","MakeBlur","RuntimeEffect","ImageFilter","MakeOffset","MakeDisplacementMap","MakeShader","MakeColorFilter","MakeDropShadow","MakeDropShadowOnly","MakeErode","MakeDilate","MakeRuntimeShader","Shader","MakeLinearGradient","MakeRadialGradient","MakeTwoPointConicalGradient","MakeSweepGradient","MakeTurbulence","MakeFractalNoise","MakeColor","PathEffect","MakeCorner","MakeDash","MakeDiscrete","MakeSum","MakeLine2D","MakePath1D","MakePath2D","MakeVertices","Data","fromURI","fromBytes","fromBase64","Image","MakeImageFromEncoded","MakeImage","SVG","MakeFromData","MakeFromString","FontMgr","RefDefault","TextBlob","MakeFromGlyphs","MakeFromRSXform","MakeFromRSXformGlyphs","Surface","vec","x","y","rect","width","height","rrect","r","rx","ry","useTouchHandler","useComputedValue","useValue","useClockValue","useValueEffect","useTiming","runTiming","timing","useSpring","runSpring","spring","runDecay","decay","useSharedValueEffect","useData","useDataCollection","useFont","useImage","usePicture","useSVG","useTypeface"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA,MAAMA,eAAoB,GAAG,EAA7B;;AACA,MAAMC,IAAI,GAAG,MAAMD,eAAnB;;AAEO,MAAME,IAAa,GAAG;AAC3BC,EAAAA,KAAK,EAAEF,IADoB;AAE3BG,EAAAA,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,MAAM8F,SAAS,GAAG9F,IAAlB;;AACA,MAAM+F,MAAM,GAAG/F,IAAf;;AACA,MAAMgG,SAAS,GAAGhG,IAAlB;;AACA,MAAMiG,SAAS,GAAGjG,IAAlB;;AACA,MAAMkG,MAAM,GAAGlG,IAAf;;AACA,MAAMmG,QAAQ,GAAGnG,IAAjB;;AACA,MAAMoG,KAAK,GAAGpG,IAAd;;AAEA,MAAMqG,oBAAoB,GAAGrG,IAA7B;;AAEA,MAAMsG,OAAO,GAAGtG,IAAhB;;AACA,MAAMuG,iBAAiB,GAAGvG,IAA1B;;AACA,MAAMwG,OAAO,GAAGxG,IAAhB;;AACA,MAAMyG,QAAQ,GAAGzG,IAAjB;;AACA,MAAM0G,UAAU,GAAG1G,IAAnB;;AACA,MAAM2G,MAAM,GAAG3G,IAAf;;AACA,MAAM4G,WAAW,GAAG5G,IAApB","sourcesContent":["/**\n * Mock implementation for test runners.\n *\n * Example:\n *\n * ```js\n * jest.mock('@shopify/react-native-skia', () => require('@shopify/react-native-skia/lib/commonjs/mock'));\n * ```\n */\n\nimport type { Skia as SkiaApi, SkRect } from \"../skia/types\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst MockJSIInstance: any = {};\nconst Noop = () => MockJSIInstance;\n\nexport const Skia: SkiaApi = {\n Point: Noop,\n XYWHRect: Noop,\n RuntimeShaderBuilder: Noop,\n RRectXY: Noop,\n RSXform: Noop,\n Color: Noop,\n ContourMeasureIter: Noop,\n Paint: Noop,\n PictureRecorder: Noop,\n Picture: {\n MakePicture: Noop,\n },\n Path: {\n Make: Noop,\n MakeFromSVGString: Noop,\n MakeFromOp: Noop,\n MakeFromCmds: Noop,\n MakeFromText: Noop,\n },\n Matrix: Noop,\n ColorFilter: {\n MakeMatrix: Noop,\n MakeBlend: Noop,\n MakeCompose: Noop,\n MakeLerp: Noop,\n MakeLinearToSRGBGamma: Noop,\n MakeSRGBToLinearGamma: Noop,\n MakeLumaColorFilter: Noop,\n },\n Font: Noop,\n Typeface: {\n MakeFreeTypeFaceFromData: Noop,\n },\n MaskFilter: {\n MakeBlur: Noop,\n },\n RuntimeEffect: {\n Make: Noop,\n },\n ImageFilter: {\n MakeOffset: Noop,\n MakeDisplacementMap: Noop,\n MakeShader: Noop,\n MakeBlur: Noop,\n MakeColorFilter: Noop,\n MakeCompose: Noop,\n MakeDropShadow: Noop,\n MakeDropShadowOnly: Noop,\n MakeErode: Noop,\n MakeDilate: Noop,\n MakeBlend: Noop,\n MakeRuntimeShader: Noop,\n },\n Shader: {\n MakeLinearGradient: Noop,\n MakeRadialGradient: Noop,\n MakeTwoPointConicalGradient: Noop,\n MakeSweepGradient: Noop,\n MakeTurbulence: Noop,\n MakeFractalNoise: Noop,\n MakeBlend: Noop,\n MakeColor: Noop,\n },\n PathEffect: {\n MakeCorner: Noop,\n MakeDash: Noop,\n MakeDiscrete: Noop,\n MakeCompose: Noop,\n MakeSum: Noop,\n MakeLine2D: Noop,\n MakePath1D: Noop,\n MakePath2D: Noop,\n },\n MakeVertices: Noop,\n Data: {\n fromURI: Noop,\n fromBytes: Noop,\n fromBase64: Noop,\n },\n Image: {\n MakeImageFromEncoded: Noop,\n MakeImage: Noop,\n },\n SVG: {\n MakeFromData: Noop,\n MakeFromString: Noop,\n },\n FontMgr: {\n RefDefault: Noop,\n },\n TextBlob: {\n MakeFromText: Noop,\n MakeFromGlyphs: Noop,\n MakeFromRSXform: Noop,\n MakeFromRSXformGlyphs: Noop,\n },\n Surface: {\n Make: Noop,\n },\n};\n\nexport const vec = (x: number, y: number) => ({ x, y });\n\nexport const rect = (x: number, y: number, width: number, height: number) => ({\n x,\n y,\n width,\n height,\n});\n\nexport const rrect = (r: SkRect, rx: number, ry: number) => ({\n rect: r,\n rx,\n ry,\n});\n\nexport const useTouchHandler = Noop;\nexport const useComputedValue = Noop;\nexport const useValue = Noop;\nexport const useClockValue = Noop;\nexport const useValueEffect = Noop;\nexport const useTiming = Noop;\nexport const runTiming = Noop;\nexport const timing = Noop;\nexport const useSpring = Noop;\nexport const runSpring = Noop;\nexport const spring = Noop;\nexport const runDecay = Noop;\nexport const decay = Noop;\n\nexport const useSharedValueEffect = Noop;\n\nexport const useData = Noop;\nexport const useDataCollection = Noop;\nexport const useFont = Noop;\nexport const useImage = Noop;\nexport const usePicture = Noop;\nexport const useSVG = Noop;\nexport const useTypeface = Noop;\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["Stub","constructor","Proxy","get","apply","set","Noop","Skia","vec","x","y","Mock","BaseSkia","useDataCollection","useRawData","useData","useFont","useTypeface","useImage","usePath","useSVG","useTextPath","usePaint","usePicture","useSvgPath","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","useSharedValueEffect","Values","ValuesHooks","timingFunctions","springFunctions","decayFunctions","interpolateFn","interpolatePathFn","interpolateVectorFn","interpolateColors","_value","_inputRange","_outputRange","Float32Array","of","mixColors","_v","_x","_y","ShaderLib","createDrawing","createDeclaration"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAjBA;AAmBA,MAAMA,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;;AAEO,MAAMC,IAAa,GAAG,IAAIP,IAAJ,EAAtB;;;AAEA,MAAMQ,GAAG,GAAG,CAACC,CAAD,EAAaC,CAAb;AAAA;;AAAA,SAA6B;AAAED,IAAAA,CAAC,EAAEA,CA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,cAtDC;AAuDJ,KAAGC,aAvDC;AAwDJ,KAAGC,iBAxDC;AAyDJ,KAAGC,mBAzDC;AA0DJC,EAAAA,iBAAiB,EAAE,CACjBC,MADiB,EAEjBC,WAFiB,EAGjBC,YAHiB,KAIdC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA9DD;AA+DJC,EAAAA,SAAS,EAAE,CAACC,EAAD,EAAaC,EAAb,EAAwBC,EAAxB,KAAsCL,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA/D7C;AAgEJK,EAAAA,SAAS,EAATA,oBAhEI;AAiEJC,EAAAA,aAAa,EAAEjE,IAjEX;AAkEJkE,EAAAA,iBAAiB,EAAElE;AAlEf,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 * 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 useDataCollection: Noop,\n useRawData: Noop,\n useData: Noop,\n useFont: Noop,\n useTypeface: Noop,\n useImage: Noop,\n usePath: Noop,\n useSVG: Noop,\n useTextPath: Noop,\n usePaint: Noop,\n usePicture: Noop,\n useSvgPath: 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 // 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"]}
@@ -55,7 +55,7 @@ const onDraw = (0, _nodes.createDrawing)((ctx, _ref, node) => {
55
55
  canvas.save();
56
56
  }
57
57
 
58
- (0, _processors.processCanvasTransform)(ctx, groupProps);
58
+ (0, _processors.processCanvasTransform)(canvas, groupProps);
59
59
 
60
60
  if (clip) {
61
61
  const op = invertClip ? _types.ClipOp.Difference : _types.ClipOp.Intersect;
@@ -1 +1 @@
1
- {"version":3,"sources":["Group.tsx"],"names":["isSkPaint","obj","__typename__","onDraw","ctx","node","layer","clip","invertClip","groupProps","canvas","opacity","Skia","declarations","children","filter","isDeclarationNode","map","child","draw","drawings","DrawingNode","paint","copy","hasTransform","transform","matrix","hasClip","shouldSave","saveLayer","current","undefined","save","op","ClipOp","Difference","Intersect","visit","restore","Group","props"],"mappings":";;;;;;;AAAA;;AAIA;;AACA;;AAWA;;AACA;;;;;;AAEA,MAAMA,SAAS,GAAIC,GAAD,IAChB,kBAAkBA,GAAlB,IAAyBA,GAAG,CAACC,YAAJ,KAAqB,OADhD;;AASA,MAAMC,MAAM,GAAG,0BACb,CAACC,GAAD,QAAkDC,IAAlD,KAA2D;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA,UAAf;AAA2B,OAAGC;AAA9B,GAAqD;AACzD,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,OAAV;AAAmBC,IAAAA;AAAnB,MAA4BR,GAAlC;AACA,QAAMS,YAAY,GAAGR,IAAI,CAACS,QAAL,CAClBC,MADkB,CACXC,8BADW,EAElBC,GAFkB,CAEbC,KAAD,IAAWA,KAAK,CAACC,IAAN,CAAWf,GAAX,CAFG,CAArB;AAIA,QAAMgB,QAAQ,GAAGf,IAAI,CAACS,QAAL,CAAcC,MAAd,CACdG,KAAD,IAAWA,KAAK,YAAYG,kBADb,CAAjB;AAGA,QAAMC,KAAK,GAAG,8BACZlB,GAAG,CAACQ,IADQ,EAEZR,GAAG,CAACkB,KAAJ,CAAUC,IAAV,EAFY,EAGZZ,OAHY,EAIZF,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AAErC;AAAnB,KAA+BqC,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { RefObject } from \"react\";\n\nimport type { SkPaint } from \"../../skia/types\";\nimport { ClipOp } from \"../../skia/types\";\nimport {\n processCanvasTransform,\n processPaint,\n processClip,\n} from \"../processors\";\nimport type {\n CustomPaintProps,\n TransformProps,\n AnimatedProps,\n ClipDef,\n} from \"../processors\";\nimport { createDrawing, DrawingNode } from \"../nodes\";\nimport { isDeclarationNode } from \"../nodes/Declaration\";\n\nconst isSkPaint = (obj: RefObject<SkPaint> | SkPaint): obj is SkPaint =>\n \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nexport interface GroupProps extends CustomPaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: RefObject<SkPaint> | SkPaint | boolean;\n}\n\nconst onDraw = createDrawing<GroupProps>(\n (ctx, { layer, clip, invertClip, ...groupProps }, node) => {\n const { canvas, opacity, Skia } = ctx;\n const declarations = node.children\n .filter(isDeclarationNode)\n .map((child) => child.draw(ctx));\n\n const drawings = node.children.filter(\n (child) => child instanceof DrawingNode\n );\n const paint = processPaint(\n ctx.Skia,\n ctx.paint.copy(),\n opacity,\n groupProps,\n declarations\n );\n const hasTransform = !!groupProps.transform || !!groupProps.matrix;\n const hasClip = !!clip;\n const shouldSave = hasTransform || hasClip || !!layer;\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(layer.current ?? undefined);\n }\n } else {\n canvas.save();\n }\n processCanvasTransform(ctx, groupProps);\n if (clip) {\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n processClip(Skia, canvas, clip, op);\n }\n }\n node.visit(\n {\n ...ctx,\n paint,\n opacity: groupProps.opacity ? groupProps.opacity * opacity : opacity,\n },\n drawings\n );\n if (shouldSave) {\n canvas.restore();\n }\n }\n);\n\nexport const Group = (props: AnimatedProps<GroupProps>) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
1
+ {"version":3,"sources":["Group.tsx"],"names":["isSkPaint","obj","__typename__","onDraw","ctx","node","layer","clip","invertClip","groupProps","canvas","opacity","Skia","declarations","children","filter","isDeclarationNode","map","child","draw","drawings","DrawingNode","paint","copy","hasTransform","transform","matrix","hasClip","shouldSave","saveLayer","current","undefined","save","op","ClipOp","Difference","Intersect","visit","restore","Group","props"],"mappings":";;;;;;;AAAA;;AAIA;;AACA;;AAWA;;AACA;;;;;;AAEA,MAAMA,SAAS,GAAIC,GAAD,IAChB,kBAAkBA,GAAlB,IAAyBA,GAAG,CAACC,YAAJ,KAAqB,OADhD;;AASA,MAAMC,MAAM,GAAG,0BACb,CAACC,GAAD,QAAkDC,IAAlD,KAA2D;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA,UAAf;AAA2B,OAAGC;AAA9B,GAAqD;AACzD,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,OAAV;AAAmBC,IAAAA;AAAnB,MAA4BR,GAAlC;AACA,QAAMS,YAAY,GAAGR,IAAI,CAACS,QAAL,CAClBC,MADkB,CACXC,8BADW,EAElBC,GAFkB,CAEbC,KAAD,IAAWA,KAAK,CAACC,IAAN,CAAWf,GAAX,CAFG,CAArB;AAIA,QAAMgB,QAAQ,GAAGf,IAAI,CAACS,QAAL,CAAcC,MAAd,CACdG,KAAD,IAAWA,KAAK,YAAYG,kBADb,CAAjB;AAGA,QAAMC,KAAK,GAAG,8BACZlB,GAAG,CAACQ,IADQ,EAEZR,GAAG,CAACkB,KAAJ,CAAUC,IAAV,EAFY,EAGZZ,OAHY,EAIZF,UAJY,EAKZI,YALY,CAAd;AAOA,QAAMW,YAAY,GAAG,CAAC,CAACf,UAAU,CAACgB,SAAb,IAA0B,CAAC,CAAChB,UAAU,CAACiB,MAA5D;AACA,QAAMC,OAAO,GAAG,CAAC,CAACpB,IAAlB;AACA,QAAMqB,UAAU,GAAGJ,YAAY,IAAIG,OAAhB,IAA2B,CAAC,CAACrB,KAAhD;;AACA,MAAIsB,UAAJ,EAAgB;AACd,QAAItB,KAAJ,EAAW;AACT,UAAI,OAAOA,KAAP,KAAiB,SAArB,EAAgC;AAC9BI,QAAAA,MAAM,CAACmB,SAAP;AACD,OAFD,MAEO,IAAI7B,SAAS,CAACM,KAAD,CAAb,EAAsB;AAC3BI,QAAAA,MAAM,CAACmB,SAAP,CAAiBvB,KAAjB;AACD,OAFM,MAEA;AAAA;;AACLI,QAAAA,MAAM,CAACmB,SAAP,mBAAiBvB,KAAK,CAACwB,OAAvB,2DAAkCC,SAAlC;AACD;AACF,KARD,MAQO;AACLrB,MAAAA,MAAM,CAACsB,IAAP;AACD;;AACD,4CAAuBtB,MAAvB,EAA+BD,UAA/B;;AACA,QAAIF,IAAJ,EAAU;AACR,YAAM0B,EAAE,GAAGzB,UAAU,GAAG0B,cAAOC,UAAV,GAAuBD,cAAOE,SAAnD;AACA,mCAAYxB,IAAZ,EAAkBF,MAAlB,EAA0BH,IAA1B,EAAgC0B,EAAhC;AACD;AACF;;AACD5B,EAAAA,IAAI,CAACgC,KAAL,CACE,EACE,GAAGjC,GADL;AAEEkB,IAAAA,KAFF;AAGEX,IAAAA,OAAO,EAAEF,UAAU,CAACE,OAAX,GAAqBF,UAAU,CAACE,OAAX,GAAqBA,OAA1C,GAAoDA;AAH/D,GADF,EAMES,QANF;;AAQA,MAAIQ,UAAJ,EAAgB;AACdlB,IAAAA,MAAM,CAAC4B,OAAP;AACD;AACF,CAjDY,CAAf;;AAoDO,MAAMC,KAAK,GAAIC,KAAD,IAAsC;AACzD,sBAAO;AAAW,IAAA,MAAM,EAAErC;AAAnB,KAA+BqC,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { RefObject } from \"react\";\n\nimport type { SkPaint } from \"../../skia/types\";\nimport { ClipOp } from \"../../skia/types\";\nimport {\n processCanvasTransform,\n processPaint,\n processClip,\n} from \"../processors\";\nimport type {\n CustomPaintProps,\n TransformProps,\n AnimatedProps,\n ClipDef,\n} from \"../processors\";\nimport { createDrawing, DrawingNode } from \"../nodes\";\nimport { isDeclarationNode } from \"../nodes/Declaration\";\n\nconst isSkPaint = (obj: RefObject<SkPaint> | SkPaint): obj is SkPaint =>\n \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nexport interface GroupProps extends CustomPaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: RefObject<SkPaint> | SkPaint | boolean;\n}\n\nconst onDraw = createDrawing<GroupProps>(\n (ctx, { layer, clip, invertClip, ...groupProps }, node) => {\n const { canvas, opacity, Skia } = ctx;\n const declarations = node.children\n .filter(isDeclarationNode)\n .map((child) => child.draw(ctx));\n\n const drawings = node.children.filter(\n (child) => child instanceof DrawingNode\n );\n const paint = processPaint(\n ctx.Skia,\n ctx.paint.copy(),\n opacity,\n groupProps,\n declarations\n );\n const hasTransform = !!groupProps.transform || !!groupProps.matrix;\n const hasClip = !!clip;\n const shouldSave = hasTransform || hasClip || !!layer;\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(layer.current ?? undefined);\n }\n } else {\n canvas.save();\n }\n processCanvasTransform(canvas, groupProps);\n if (clip) {\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n processClip(Skia, canvas, clip, op);\n }\n }\n node.visit(\n {\n ...ctx,\n paint,\n opacity: groupProps.opacity ? groupProps.opacity * opacity : opacity,\n },\n drawings\n );\n if (shouldSave) {\n canvas.restore();\n }\n }\n);\n\nexport const Group = (props: AnimatedProps<GroupProps>) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
@@ -7,40 +7,33 @@ exports.transformOrigin = exports.processCanvasTransform = exports.localMatrix =
7
7
 
8
8
  var _types = require("../../skia/types");
9
9
 
10
- const processCanvasTransform = (_ref, _ref2) => {
11
- let {
12
- canvas,
13
- Skia
14
- } = _ref;
10
+ const processCanvasTransform = (canvas, _ref) => {
15
11
  let {
16
12
  transform,
17
13
  origin,
18
14
  matrix
19
- } = _ref2;
15
+ } = _ref;
20
16
 
21
17
  if (matrix) {
22
18
  if (origin) {
23
- const m3 = Skia.Matrix();
24
- m3.translate(origin.x, origin.y);
25
- m3.concat(matrix);
26
- m3.translate(-origin.x, -origin.y);
27
- canvas.concat(m3);
19
+ canvas.translate(origin.x, origin.y);
20
+ canvas.concat(matrix);
21
+ canvas.translate(-origin.x, -origin.y);
28
22
  } else {
29
23
  canvas.concat(matrix);
30
24
  }
31
25
  } else if (transform) {
32
- const m3 = (0, _types.processTransform)(Skia.Matrix(), origin ? transformOrigin(origin, transform) : transform);
33
- canvas.concat(m3);
26
+ (0, _types.processTransform)(canvas, origin ? transformOrigin(origin, transform) : transform);
34
27
  }
35
28
  };
36
29
 
37
30
  exports.processCanvasTransform = processCanvasTransform;
38
31
 
39
- const localMatrix = (m, _ref3) => {
32
+ const localMatrix = (m, _ref2) => {
40
33
  let {
41
34
  transform,
42
35
  origin
43
- } = _ref3;
36
+ } = _ref2;
44
37
 
45
38
  if (transform) {
46
39
  return (0, _types.processTransform)(m, origin ? transformOrigin(origin, transform) : transform);
@@ -1 +1 @@
1
- {"version":3,"sources":["Transform.ts"],"names":["processCanvasTransform","canvas","Skia","transform","origin","matrix","m3","Matrix","translate","x","y","concat","transformOrigin","localMatrix","m","undefined","translateX","translateY"],"mappings":";;;;;;;AAEA;;AAQO,MAAMA,sBAAsB,GAAG,iBAGjC;AAAA,MAFH;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAEG;AAAA,MADH;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,MAAb;AAAqBC,IAAAA;AAArB,GACG;;AACH,MAAIA,M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AAE,CAACb,MAAM,CAACM;AAAtB,CAL0E,CAArE","sourcesContent":["import type { DrawingContext } from \"../DrawingContext\";\nimport type { SkMatrix, Vector, Transforms2d } from \"../../skia/types\";\nimport { processTransform } from \"../../skia/types\";\n\nexport interface TransformProps {\n transform?: Transforms2d;\n origin?: Vector;\n matrix?: SkMatrix;\n}\n\nexport const processCanvasTransform = (\n { canvas, Skia }: DrawingContext,\n { transform, origin, matrix }: TransformProps\n) => {\n if (matrix) {\n if (origin) {\n const m3 = Skia.Matrix();\n m3.translate(origin.x, origin.y);\n m3.concat(matrix);\n m3.translate(-origin.x, -origin.y);\n canvas.concat(m3);\n } else {\n canvas.concat(matrix);\n }\n } else if (transform) {\n const m3 = processTransform(\n Skia.Matrix(),\n origin ? transformOrigin(origin, transform) : transform\n );\n canvas.concat(m3);\n }\n};\n\nexport const localMatrix = (\n m: SkMatrix,\n { transform, origin }: TransformProps\n) => {\n if (transform) {\n return processTransform(\n m,\n origin ? transformOrigin(origin, transform) : transform\n );\n }\n return undefined;\n};\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"]}
1
+ {"version":3,"sources":["Transform.ts"],"names":["processCanvasTransform","canvas","transform","origin","matrix","translate","x","y","concat","transformOrigin","localMatrix","m","undefined","translateX","translateY"],"mappings":";;;;;;;AACA;;AASO,MAAMA,sBAAsB,GAAG,CACpCC,MADoC,WAGjC;AAAA,MADH;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,MAAb;AAAqBC,IAAAA;AAArB,GACG;;AACH,MAAIA,MAAJ,EAAY;AACV,QAAID,MAAJ,EAAY;AACVF,MAAAA,MAAM,CAACI,SAAP,CAAiBF,MAAM,CAACG,CAAxB,EAA2BH,MAAM,CAACI,CAAlC;AACAN,MAAAA,MAAM,CAACO,MAAP,CAAcJ,MAAd;AACAH,MAAAA,MAAM,CAACI,SAAP,CAAiB,CAACF,MAAM,CAACG,CAAzB,EAA4B,CAACH,MAAM,CAACI,CAApC;AACD,KAJD,MAIO;AACLN,MAAAA,MAAM,CAACO,MAAP,CAAcJ,MAAd;AACD;AACF,GARD,MAQO,IAAIF,SAAJ,EAAe;AACpB,iCACED,MADF,EAEEE,MAAM,GAAGM,eAAe,CAACN,MAAD,EAASD,SAAT,CAAlB,GAAwCA,SAFhD;AAID;AACF,CAlBM;;;;AAoBA,MAAMQ,WAAW,GAAG,CACzBC,CADyB,YAGtB;AAAA,MADH;AAAET,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GACG;;AACH,MAAID,SAAJ,EAAe;AACb,WAAO,6BACLS,CADK,EAELR,MAAM,GAAGM,eAAe,CAACN,MAAD,EAASD,SAAT,CAAlB,GAAwCA,SAFzC,CAAP;AAID;;AACD,SAAOU,SAAP;AACD,CAXM;;;;AAaA,MAAMH,eAAe,GAAG,CAACN,MAAD,EAAiBD,SAAjB,KAA6C,CAC1E;AAAEW,EAAAA,UAAU,EAAEV,MAAM,CAACG;AAArB,CAD0E,EAE1E;AAAEQ,EAAAA,UAAU,EAAEX,MAAM,CAACI;AAArB,CAF0E,EAG1E,GAAGL,SAHuE,EAI1E;AAAEW,EAAAA,UAAU,EAAE,CAACV,MAAM,CAACG;AAAtB,CAJ0E,EAK1E;AAAEQ,EAAAA,UAAU,EAAE,CAACX,MAAM,CAACI;AAAtB,CAL0E,CAArE","sourcesContent":["import type { SkMatrix, Vector, Transforms2d } from \"../../skia/types\";\nimport { processTransform } from \"../../skia/types\";\nimport type { SkCanvas } from \"../../skia/types/Canvas\";\n\nexport interface TransformProps {\n transform?: Transforms2d;\n origin?: Vector;\n matrix?: SkMatrix;\n}\n\nexport const processCanvasTransform = (\n canvas: SkCanvas,\n { transform, origin, matrix }: TransformProps\n) => {\n if (matrix) {\n if (origin) {\n canvas.translate(origin.x, origin.y);\n canvas.concat(matrix);\n canvas.translate(-origin.x, -origin.y);\n } else {\n canvas.concat(matrix);\n }\n } else if (transform) {\n processTransform(\n canvas,\n origin ? transformOrigin(origin, transform) : transform\n );\n }\n};\n\nexport const localMatrix = (\n m: SkMatrix,\n { transform, origin }: TransformProps\n) => {\n if (transform) {\n return processTransform(\n m,\n origin ? transformOrigin(origin, transform) : transform\n );\n }\n return undefined;\n};\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"]}
@@ -28,12 +28,15 @@ const factoryWrapper = (data2, factory, onError) => {
28
28
 
29
29
  const loadDataCollection = (sources, factory, onError) => Promise.all(sources.map(source => loadData(source, factory, onError)));
30
30
 
31
- const loadData = (source, factory, onError) => {
32
- if (source instanceof Uint8Array) {
33
- return new Promise(resolve => resolve(factoryWrapper(_Skia.Skia.Data.fromBytes(source), factory, onError)));
31
+ const loadData = async (source, factory, onError) => {
32
+ if (source === null) {
33
+ return null;
34
+ } else if (source instanceof Uint8Array) {
35
+ return factoryWrapper(_Skia.Skia.Data.fromBytes(source), factory, onError);
34
36
  } else {
35
37
  const uri = typeof source === "string" ? source : resolveAsset(source);
36
- return _Skia.Skia.Data.fromURI(uri).then(d => factoryWrapper(d, factory, onError));
38
+ const d = await _Skia.Skia.Data.fromURI(uri);
39
+ return factoryWrapper(d, factory, onError);
37
40
  }
38
41
  };
39
42
 
@@ -1 +1 @@
1
- {"version":3,"sources":["Data.ts"],"names":["resolveAsset","source","Platform","OS","default","Image","resolveAssetSource","uri","factoryWrapper","data2","factory","onError","factoryResult","Error","loadDataCollection","sources","Promise","all","map","loadData","Uint8Array","resolve","Skia","Data","fromBytes","fromURI","then","d","useLoading","loader","deps","data","setData","prevSourceRef","current","useDataCollection","useRawData","identity","useData"],"mappings":";;;;;;;AACA;;AACA;;AAEA;;AAGA,MAAMA,YAAY,GAAIC,MAAD,IAAwC;AAC3D,SAAOC,sBAASC,EAAT,KAAgB,KAAhB,GACHF,MAAM,CAACG,OADJ,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Id;AAAA,MADHC,IACG,uEADoB,EACpB;AACH,QAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB,qBAAmB,IAAnB,CAAxB;AACA,QAAMC,aAAa,GAAG,oBAAtB;AACA,wBAAU,MAAM;AACd,QAAIA,aAAa,CAACC,OAAd,KAA0BjC,MAA9B,EAAsC;AACpCgC,MAAAA,aAAa,CAACC,OAAd,GAAwBjC,MAAxB;AACA4B,MAAAA,MAAM,GAAGH,IAAT,CAAcM,OAAd;AACD,KAHD,MAGO;AACLA,MAAAA,OAAO,CAAC,IAAD,CAAP;AACD,KANa,CAOd;;AACD,GARD,EAQGF,IARH;AASA,SAAOC,IAAP;AACD,CAjBD;;AAmBO,MAAMI,iBAAiB,GAAG,CAC/BpB,OAD+B,EAE/BL,OAF+B,EAG/BC,OAH+B,EAI/BmB,IAJ+B,KAM/BF,UAAU,CACRb,OADQ,EAER,MAAMD,kBAAkB,CAACC,OAAD,EAAUL,OAAV,EAAmBC,OAAnB,CAFhB,EAGRmB,IAHQ,CANL;;;;AAYA,MAAMM,UAAU,GAAG,CACxBnC,MADwB,EAExBS,OAFwB,EAGxBC,OAHwB,EAIxBmB,IAJwB,KAKrBF,UAAU,CAAC3B,MAAD,EAAS,MAAMkB,QAAQ,CAAClB,MAAD,EAASS,OAAT,EAAkBC,OAAlB,CAAvB,EAAmDmB,IAAnD,CALR;;;;AAOP,MAAMO,QAAQ,GAAIN,IAAD,IAAkBA,IAAnC;;AAEO,MAAMO,OAAO,GAAG,CACrBrC,MADqB,EAErBU,OAFqB,EAGrBmB,IAHqB,KAIlBM,UAAU,CAACnC,MAAD,EAASoC,QAAT,EAAmB1B,OAAnB,EAA4BmB,IAA5B,CAJR","sourcesContent":["import type { DependencyList } from \"react\";\nimport { useRef, useEffect, useState } from \"react\";\nimport { Image, Platform } from \"react-native\";\n\nimport { Skia } from \"../Skia\";\nimport type { SkData, DataSource } from \"../types\";\n\nconst resolveAsset = (source: ReturnType<typeof require>) => {\n return Platform.OS === \"web\"\n ? source.default\n : Image.resolveAssetSource(source).uri;\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 loadDataCollection = <T>(\n sources: DataSource[],\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<(T | null)[]> =>\n Promise.all(sources.map((source) => loadData(source, factory, onError)));\n\nconst loadData = <T>(\n source: DataSource,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<T | null> => {\n 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};\n\ntype Source = DataSource | null | undefined;\n\nconst useLoading = <T>(\n source: Source,\n loader: () => Promise<T | null>,\n deps: DependencyList = []\n) => {\n const [data, setData] = useState<T | null>(null);\n const prevSourceRef = useRef<Source>();\n useEffect(() => {\n if (prevSourceRef.current !== source) {\n prevSourceRef.current = source;\n loader().then(setData);\n } else {\n setData(null);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n return data;\n};\n\nexport const useDataCollection = <T>(\n sources: DataSource[],\n factory: (data: SkData) => T,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) =>\n useLoading(\n sources,\n () => loadDataCollection(sources, factory, onError),\n deps\n );\n\nexport const useRawData = <T>(\n source: DataSource | null | undefined,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) => useLoading(source, () => loadData(source, factory, onError), deps);\n\nconst identity = (data: SkData) => data;\n\nexport const useData = (\n source: DataSource | null | undefined,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) => useRawData(source, identity, onError, deps);\n"]}
1
+ {"version":3,"sources":["Data.ts"],"names":["resolveAsset","source","Platform","OS","default","Image","resolveAssetSource","uri","factoryWrapper","data2","factory","onError","factoryResult","Error","loadDataCollection","sources","Promise","all","map","loadData","Uint8Array","Skia","Data","fromBytes","d","fromURI","useLoading","loader","deps","data","setData","prevSourceRef","current","then","useDataCollection","useRawData","identity","useData"],"mappings":";;;;;;;AACA;;AACA;;AAEA;;AAGA,MAAMA,YAAY,GAAIC,MAAD,IAAwC;AAC3D,SAAOC,sBAASC,EAAT,KAAgB,KAAhB,GACHF,MAAM,CAACG,OADJ,GAEHC,mBAAMC,kBAAN,CAAyBL,MAAzB,EAAiCM,GAFrC;AAGD,CAJD;;AAMA,MAAMC,cAAc,GAAG,CACrBC,KADqB,EAErBC,OAFqB,EAGrBC,OAHqB,KAIlB;AACH,QAAMC,aAAa,GAAGF,OAAO,CAACD,KAAD,CAA7B;;AACA,MAAIG,aAAa,KAAK,IAAtB,EAA4B;AAC1BD,IAAAA,OAAO,IAAIA,OAAO,CAAC,IAAIE,KAAJ,CAAU,qBAAV,CAAD,CAAlB;AACA,WAAO,IAAP;AACD,GAHD,MAGO;AACL,WAAOD,aAAP;AACD;AACF,CAZD;;AAcA,MAAME,kBAAkB,GAAG,CACzBC,OADyB,EAEzBL,OAFyB,EAGzBC,OAHyB,KAKzBK,OAAO,CAACC,GAAR,CAAYF,OAAO,CAACG,GAAR,CAAajB,MAAD,IAAYkB,QAAQ,CAAClB,MAAD,EAASS,OAAT,EAAkBC,OAAlB,CAAhC,CAAZ,CALF;;AAOA,MAAMQ,QAAQ,GAAG,OACflB,MADe,EAEfS,OAFe,EAGfC,OAHe,KAIO;AACtB,MAAIV,MAAM,KAAK,IAAf,EAAqB;AACnB,WAAO,IAAP;AACD,GAFD,MAEO,IAAIA,MAAM,YAAYmB,UAAtB,EAAkC;AACvC,WAAOZ,cAAc,CAACa,WAAKC,IAAL,CAAUC,SAAV,CAAoBtB,MAApB,CAAD,EAA8BS,OAA9B,EA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AAIP,IAAD,IAAkBA,IAAnC;;AAEO,MAAMQ,OAAO,GAAG,CACrBpC,MADqB,EAErBU,OAFqB,EAGrBiB,IAHqB,KAIlBO,UAAU,CAAClC,MAAD,EAASmC,QAAT,EAAmBzB,OAAnB,EAA4BiB,IAA5B,CAJR","sourcesContent":["import type { DependencyList } from \"react\";\nimport { useRef, useEffect, useState } from \"react\";\nimport { Image, Platform } from \"react-native\";\n\nimport { Skia } from \"../Skia\";\nimport type { SkData, DataSource } from \"../types\";\n\nconst resolveAsset = (source: ReturnType<typeof require>) => {\n return Platform.OS === \"web\"\n ? source.default\n : Image.resolveAssetSource(source).uri;\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 loadDataCollection = <T>(\n sources: DataSource[],\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<(T | null)[]> =>\n Promise.all(sources.map((source) => loadData(source, factory, onError)));\n\nconst loadData = async <T>(\n source: DataSource,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<T | null> => {\n if (source === null) {\n return null;\n } else if (source instanceof Uint8Array) {\n return factoryWrapper(Skia.Data.fromBytes(source), factory, onError);\n } else {\n const uri = typeof source === \"string\" ? source : resolveAsset(source);\n const d = await Skia.Data.fromURI(uri);\n return factoryWrapper(d, factory, onError);\n }\n};\n\ntype Source = DataSource | null | undefined;\n\nconst useLoading = <T>(\n source: Source,\n loader: () => Promise<T | null>,\n deps: DependencyList = []\n) => {\n const [data, setData] = useState<T | null>(null);\n const prevSourceRef = useRef<Source>();\n useEffect(() => {\n if (prevSourceRef.current !== source) {\n prevSourceRef.current = source;\n loader().then(setData);\n } else {\n setData(null);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n return data;\n};\n\nexport const useDataCollection = <T>(\n sources: DataSource[],\n factory: (data: SkData) => T,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) =>\n useLoading(\n sources,\n () => loadDataCollection(sources, factory, onError),\n deps\n );\n\nexport const useRawData = <T>(\n source: DataSource | null | undefined,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) => useLoading(source, () => loadData(source, factory, onError), deps);\n\nconst identity = (data: SkData) => data;\n\nexport const useData = (\n source: DataSource | null | undefined,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) => useRawData(source, identity, onError, deps);\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Font.ts"],"names":["fontStyle","weight","width","slant","FontWeight","FontWidth","FontSlant","FontEdging","FontHinting","FontStyle","Normal","Upright","Bold","Italic","BoldItalic"],"mappings":";;;;;;;AAkKA,MAAMA,SAAS,GAAG,CAChBC,MADgB,EAEhBC,KAFgB,EAGhBC,KAHgB,MAID;AAAEF,EAAAA,MAAF;AAAUC,EAAAA,KAAV;AAAiBC,EAAAA;AAAjB,CAJC,CAAlB;;IAYYC,U;;;WAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U;;IAcAC,S;;;WAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;;IAYAC,S;;;WAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;;IAMAC,U;;;WAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U;;IAMAC,W;;;WAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W;;AAOL,MAAMC,SAAS,GAAG;AACvBC,EAAAA,MAAM,EAAEV,SAAS,CAACI,UAAU,CAACM,MAAZ,EAAoBL,SAAS,CAACK,MAA9B,EAAsCJ,SAAS,CAACK,OAAhD,CADM;AAEvBC,EAAAA,IAAI,EAAEZ,SAAS,CAACI,UAAU,CAACQ,IAAZ,EAAkBP,SAAS,CAACK,MAA5B,EAAoCJ,SAAS,CAACK,OAA9C,CAFQ;AAGvBE,EAAAA,MAAM,EAAEb,SAAS,CAACI,UAAU,CAACM,MAAZ,EAAoBL,SAAS,CAACK,MAA9B,EAAsCJ,SAAS,CAACO,MAAhD,CAHM;AAIvBC,EAAAA,UAAU,EAAEd,SAAS,CAACI,UAAU,CAACQ,IAAZ,EAAkBP,SAAS,CAACK,MAA5B,EAAoCJ,SAAS,CAACO,MAA9C;AAJE,CAAlB","sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkPaint } from \"../Paint\";\nimport type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { SkTypeface } from \"../Typeface\";\n\nexport interface FontMetrics {\n ascent: number; // suggested space above the baseline. < 0\n descent: number; // suggested space below the baseline. > 0\n leading: number; // suggested spacing between descent of previous line and ascent of next line.\n bounds?: SkRect; // smallest rect containing all glyphs (relative to 0,0)\n}\n\nexport interface SkFont extends SkJSIInstance<\"Font\"> {\n /**\n * Retrieves the advanceX measurements for each glyph.\n * If paint is not null, its stroking, PathEffect, and MaskFilter fields are respected.\n * One width per glyph is returned in the returned array.\n * @param glyphs\n * @param paint\n */\n getGlyphWidths(glyphs: number[], paint?: SkPaint): number[];\n\n /** Returns the advance width of text.\n The advance is the normal distance to move before drawing additional text.\n Returns the bounding box of text if bounds is not nullptr. The paint\n stroke settings, mask filter, or path effect may modify the bounds.\n\n @param text character storage encoded with SkTextEncoding\n @param byteLength length of character storage in bytes\n @param bounds returns bounding box relative to (0, 0) if not nullptr\n @param paint optional; may be nullptr\n @return number of glyphs represented by text of length byteLength\n */\n measureText: (text: string, paint?: SkPaint) => SkRect;\n\n /**\n * Returns the FontMetrics for this font.\n */\n getMetrics(): FontMetrics;\n\n /**\n * Retrieves the glyph ids for each code point in the provided string. This call is passed to\n * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces\n * may have different ids for the same code point.\n * @param str\n * @param numCodePoints - the number of code points in the string. Defaults to str.length.\n */\n getGlyphIDs(str: string, numCodePoints?: number): number[];\n\n /**\n * Computes any intersections of a thick \"line\" and a run of positionsed glyphs.\n * The thick line is represented as a top and bottom coordinate (positive for\n * below the baseline, negative for above). If there are no intersections\n * (e.g. if this is intended as an underline, and there are no \"collisions\")\n * then the returned array will be empty. If there are intersections, the array\n * will contain pairs of X coordinates [start, end] for each segment that\n * intersected with a glyph.\n *\n * @param glyphs the glyphs to intersect with\n * @param positions x,y coordinates (2 per glyph) for each glyph\n * @param top top of the thick \"line\" to use for intersection testing\n * @param bottom bottom of the thick \"line\" to use for intersection testing\n * @return array of [start, end] x-coordinate pairs. Maybe be empty.\n */\n getGlyphIntercepts(\n glyphs: number[],\n positions: SkPoint[],\n top: number,\n bottom: number\n ): number[];\n\n /**\n * Returns text scale on x-axis. Default value is 1.\n */\n getScaleX(): number;\n\n /**\n * Returns text size in points.\n */\n getSize(): number;\n\n /**\n * Returns text skew on x-axis. Default value is zero.\n */\n getSkewX(): number;\n\n /**\n * Returns embolden effect for this font. Default value is false.\n */\n isEmbolden(): boolean;\n\n /**\n * Returns the Typeface set for this font.\n */\n getTypeface(): SkTypeface | null;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with partial transparency.\n * @param edging\n */\n setEdging(edging: FontEdging): void;\n\n /**\n * Requests, but does not require, to use bitmaps in fonts instead of outlines.\n * @param embeddedBitmaps\n */\n setEmbeddedBitmaps(embeddedBitmaps: boolean): void;\n\n /**\n * Sets level of glyph outline adjustment.\n * @param hinting\n */\n setHinting(hinting: FontHinting): void;\n\n /**\n * Requests, but does not require, linearly scalable font and glyph metrics.\n *\n * For outline fonts 'true' means font and glyph metrics should ignore hinting and rounding.\n * Note that some bitmap formats may not be able to scale linearly and will ignore this flag.\n * @param linearMetrics\n */\n setLinearMetrics(linearMetrics: boolean): void;\n\n /**\n * Sets the text scale on the x-axis.\n * @param sx\n */\n setScaleX(sx: number): void;\n\n /**\n * Sets the text size in points on this font.\n * @param points\n */\n setSize(points: number): void;\n\n /**\n * Sets the text-skew on the x axis for this font.\n * @param sx\n */\n setSkewX(sx: number): void;\n\n /**\n * Set embolden effect for this font.\n * @param embolden\n */\n setEmbolden(embolden: boolean): void;\n\n /**\n * Requests, but does not require, that glyphs respect sub-pixel positioning.\n * @param subpixel\n */\n setSubpixel(subpixel: boolean): void;\n\n /**\n * Sets the typeface to use with this font. null means to clear the typeface and use the\n * default one.\n * @param face\n */\n setTypeface(face: SkTypeface | null): void;\n}\n\nconst fontStyle = (\n weight: FontWeight,\n width: FontWidth,\n slant: FontSlant\n): FontStyle => ({ weight, width, slant });\n\nexport interface FontStyle {\n weight?: FontWeight;\n width?: FontWidth;\n slant?: FontSlant;\n}\n\nexport enum FontWeight {\n Invisible = 0,\n Thin = 100,\n ExtraLight = 200,\n Light = 300,\n Normal = 400,\n Medium = 500,\n SemiBold = 600,\n Bold = 700,\n ExtraBold = 800,\n Black = 900,\n ExtraBlack = 1000,\n}\n\nexport enum FontWidth {\n UltraCondensed = 1,\n ExtraCondensed = 2,\n Condensed = 3,\n SemiCondensed = 4,\n Normal = 5,\n SemiExpanded = 6,\n Expanded = 7,\n ExtraExpanded = 8,\n UltraExpanded = 9,\n}\n\nexport enum FontSlant {\n Upright,\n Italic,\n Oblique,\n}\n\nexport enum FontEdging {\n Alias,\n AntiAlias,\n SubpixelAntiAlias,\n}\n\nexport enum FontHinting {\n None,\n Slight,\n Normal,\n Full,\n}\n\nexport const FontStyle = {\n Normal: fontStyle(FontWeight.Normal, FontWidth.Normal, FontSlant.Upright),\n Bold: fontStyle(FontWeight.Bold, FontWidth.Normal, FontSlant.Upright),\n Italic: fontStyle(FontWeight.Normal, FontWidth.Normal, FontSlant.Italic),\n BoldItalic: fontStyle(FontWeight.Bold, FontWidth.Normal, FontSlant.Italic),\n};\n"]}
1
+ {"version":3,"sources":["Font.ts"],"names":["fontStyle","weight","width","slant","FontWeight","FontWidth","FontSlant","FontEdging","FontHinting","FontStyle","Normal","Upright","Bold","Italic","BoldItalic"],"mappings":";;;;;;;AAyKA,MAAMA,SAAS,GAAG,CAChBC,MADgB,EAEhBC,KAFgB,EAGhBC,KAHgB,MAID;AAAEF,EAAAA,MAAF;AAAUC,EAAAA,KAAV;AAAiBC,EAAAA;AAAjB,CAJC,CAAlB;;IAYYC,U;;;WAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U;;IAcAC,S;;;WAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EA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\nimport type { SkPoint } from \"../Point\";\nimport type { SkTypeface } from \"../Typeface\";\n\nexport interface FontMetrics {\n ascent: number; // suggested space above the baseline. < 0\n descent: number; // suggested space below the baseline. > 0\n leading: number; // suggested spacing between descent of previous line and ascent of next line.\n bounds?: SkRect; // smallest rect containing all glyphs (relative to 0,0)\n}\n\nexport interface SkFont extends SkJSIInstance<\"Font\"> {\n /**\n * Retrieves the total width of the provided text\n * @param text\n * @param paint\n */\n getTextWidth(text: string, paint?: SkPaint): number;\n\n /**\n * Retrieves the advanceX measurements for each glyph.\n * If paint is not null, its stroking, PathEffect, and MaskFilter fields are respected.\n * One width per glyph is returned in the returned array.\n * @param glyphs\n * @param paint\n */\n getGlyphWidths(glyphs: number[], paint?: SkPaint): number[];\n\n /** Returns the advance width of text.\n The advance is the normal distance to move before drawing additional text.\n Returns the bounding box of text if bounds is not nullptr. The paint\n stroke settings, mask filter, or path effect may modify the bounds.\n\n @param text character storage encoded with SkTextEncoding\n @param byteLength length of character storage in bytes\n @param bounds returns bounding box relative to (0, 0) if not nullptr\n @param paint optional; may be nullptr\n @return number of glyphs represented by text of length byteLength\n */\n measureText: (text: string, paint?: SkPaint) => SkRect;\n\n /**\n * Returns the FontMetrics for this font.\n */\n getMetrics(): FontMetrics;\n\n /**\n * Retrieves the glyph ids for each code point in the provided string. This call is passed to\n * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces\n * may have different ids for the same code point.\n * @param str\n * @param numCodePoints - the number of code points in the string. Defaults to str.length.\n */\n getGlyphIDs(str: string, numCodePoints?: number): number[];\n\n /**\n * Computes any intersections of a thick \"line\" and a run of positionsed glyphs.\n * The thick line is represented as a top and bottom coordinate (positive for\n * below the baseline, negative for above). If there are no intersections\n * (e.g. if this is intended as an underline, and there are no \"collisions\")\n * then the returned array will be empty. If there are intersections, the array\n * will contain pairs of X coordinates [start, end] for each segment that\n * intersected with a glyph.\n *\n * @param glyphs the glyphs to intersect with\n * @param positions x,y coordinates (2 per glyph) for each glyph\n * @param top top of the thick \"line\" to use for intersection testing\n * @param bottom bottom of the thick \"line\" to use for intersection testing\n * @return array of [start, end] x-coordinate pairs. Maybe be empty.\n */\n getGlyphIntercepts(\n glyphs: number[],\n positions: SkPoint[],\n top: number,\n bottom: number\n ): number[];\n\n /**\n * Returns text scale on x-axis. Default value is 1.\n */\n getScaleX(): number;\n\n /**\n * Returns text size in points.\n */\n getSize(): number;\n\n /**\n * Returns text skew on x-axis. Default value is zero.\n */\n getSkewX(): number;\n\n /**\n * Returns embolden effect for this font. Default value is false.\n */\n isEmbolden(): boolean;\n\n /**\n * Returns the Typeface set for this font.\n */\n getTypeface(): SkTypeface | null;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with partial transparency.\n * @param edging\n */\n setEdging(edging: FontEdging): void;\n\n /**\n * Requests, but does not require, to use bitmaps in fonts instead of outlines.\n * @param embeddedBitmaps\n */\n setEmbeddedBitmaps(embeddedBitmaps: boolean): void;\n\n /**\n * Sets level of glyph outline adjustment.\n * @param hinting\n */\n setHinting(hinting: FontHinting): void;\n\n /**\n * Requests, but does not require, linearly scalable font and glyph metrics.\n *\n * For outline fonts 'true' means font and glyph metrics should ignore hinting and rounding.\n * Note that some bitmap formats may not be able to scale linearly and will ignore this flag.\n * @param linearMetrics\n */\n setLinearMetrics(linearMetrics: boolean): void;\n\n /**\n * Sets the text scale on the x-axis.\n * @param sx\n */\n setScaleX(sx: number): void;\n\n /**\n * Sets the text size in points on this font.\n * @param points\n */\n setSize(points: number): void;\n\n /**\n * Sets the text-skew on the x axis for this font.\n * @param sx\n */\n setSkewX(sx: number): void;\n\n /**\n * Set embolden effect for this font.\n * @param embolden\n */\n setEmbolden(embolden: boolean): void;\n\n /**\n * Requests, but does not require, that glyphs respect sub-pixel positioning.\n * @param subpixel\n */\n setSubpixel(subpixel: boolean): void;\n\n /**\n * Sets the typeface to use with this font. null means to clear the typeface and use the\n * default one.\n * @param face\n */\n setTypeface(face: SkTypeface | null): void;\n}\n\nconst fontStyle = (\n weight: FontWeight,\n width: FontWidth,\n slant: FontSlant\n): FontStyle => ({ weight, width, slant });\n\nexport interface FontStyle {\n weight?: FontWeight;\n width?: FontWidth;\n slant?: FontSlant;\n}\n\nexport enum FontWeight {\n Invisible = 0,\n Thin = 100,\n ExtraLight = 200,\n Light = 300,\n Normal = 400,\n Medium = 500,\n SemiBold = 600,\n Bold = 700,\n ExtraBold = 800,\n Black = 900,\n ExtraBlack = 1000,\n}\n\nexport enum FontWidth {\n UltraCondensed = 1,\n ExtraCondensed = 2,\n Condensed = 3,\n SemiCondensed = 4,\n Normal = 5,\n SemiExpanded = 6,\n Expanded = 7,\n ExtraExpanded = 8,\n UltraExpanded = 9,\n}\n\nexport enum FontSlant {\n Upright,\n Italic,\n Oblique,\n}\n\nexport enum FontEdging {\n Alias,\n AntiAlias,\n SubpixelAntiAlias,\n}\n\nexport enum FontHinting {\n None,\n Slight,\n Normal,\n Full,\n}\n\nexport const FontStyle = {\n Normal: fontStyle(FontWeight.Normal, FontWidth.Normal, FontSlant.Upright),\n Bold: fontStyle(FontWeight.Bold, FontWidth.Normal, FontSlant.Upright),\n Italic: fontStyle(FontWeight.Normal, FontWidth.Normal, FontSlant.Italic),\n BoldItalic: fontStyle(FontWeight.Bold, FontWidth.Normal, FontSlant.Italic),\n};\n"]}