@hozo/canvas 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +152 -0
  3. package/dist/accessibility.d.ts +20 -0
  4. package/dist/accessibility.d.ts.map +1 -0
  5. package/dist/accessibility.js +9 -0
  6. package/dist/accessibility.js.map +1 -0
  7. package/dist/hit-test.d.ts +96 -0
  8. package/dist/hit-test.d.ts.map +1 -0
  9. package/dist/hit-test.js +354 -0
  10. package/dist/hit-test.js.map +1 -0
  11. package/dist/index.d.ts +80 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +317 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/index.native.d.ts +83 -0
  16. package/dist/index.native.d.ts.map +1 -0
  17. package/dist/index.native.js +435 -0
  18. package/dist/index.native.js.map +1 -0
  19. package/dist/render-canvas-2d.d.ts +6 -0
  20. package/dist/render-canvas-2d.d.ts.map +1 -0
  21. package/dist/render-canvas-2d.js +213 -0
  22. package/dist/render-canvas-2d.js.map +1 -0
  23. package/dist/scene.d.ts +495 -0
  24. package/dist/scene.d.ts.map +1 -0
  25. package/dist/scene.js +591 -0
  26. package/dist/scene.js.map +1 -0
  27. package/dist/viewport.d.ts +9 -0
  28. package/dist/viewport.d.ts.map +1 -0
  29. package/dist/viewport.js +2 -0
  30. package/dist/viewport.js.map +1 -0
  31. package/dist/wrap-text.d.ts +28 -0
  32. package/dist/wrap-text.d.ts.map +1 -0
  33. package/dist/wrap-text.js +148 -0
  34. package/dist/wrap-text.js.map +1 -0
  35. package/package.json +79 -0
  36. package/src/accessibility.ts +28 -0
  37. package/src/hit-test.ts +499 -0
  38. package/src/index.native.tsx +733 -0
  39. package/src/index.tsx +510 -0
  40. package/src/render-canvas-2d.ts +259 -0
  41. package/src/scene.tsx +1037 -0
  42. package/src/viewport.ts +8 -0
  43. package/src/wrap-text.ts +157 -0
@@ -0,0 +1,435 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { activateHozoNavigation, useHozoNavigation } from '@hozo/engine/navigation';
3
+ import { FillType, matchFont, Skia, Canvas as SkiaCanvas, Circle as SkiaCircle, Group as SkiaGroup, Line as SkiaLine, LinearGradient as SkiaLinearGradient, Oval as SkiaOval, Path as SkiaPath, RadialGradient as SkiaRadialGradient, Rect as SkiaRect, RoundedRect as SkiaRoundedRect, Text as SkiaText, } from '@shopify/react-native-skia';
4
+ import { useMemo, useRef, useState } from 'react';
5
+ import { Linking, StyleSheet, Text, View, } from 'react-native';
6
+ import { canvasAccessibilityMode } from './accessibility.js';
7
+ import { canvasNodePoint, hitTestCanvas, } from './hit-test.js';
8
+ import { BoundedCache, Text as CanvasText, Circle, Clip, canvasControls, canvasPressEvent, canvasUnreadableText, Ellipse, Group, isGradient, Line, Path, paintFills, paintStrokes, Rect, RoundedRect, reportUnreadableText, textFontSpec, unhandledShape, useCanvasScene, } from './scene.js';
9
+ import { textLines, wrapText } from './wrap-text.js';
10
+ export { hitTestCanvas, } from './hit-test.js';
11
+ export { CanvasSceneStore } from './scene.js';
12
+ // The rule on its own, for a caller with a measurement of its own --
13
+ // one that already knows its metrics, or is laying out for a font it
14
+ // will load later.
15
+ export { textLines, wrapText } from './wrap-text.js';
16
+ function transformFor(transform) {
17
+ if (!transform)
18
+ return undefined;
19
+ // `Transforms3d` and not `Record<string, number>[]`: Skia's type is a
20
+ // union of one-key objects, and the loose annotation is what let this
21
+ // compile against a stub that checked nothing.
22
+ const result = [];
23
+ if (transform.translateX)
24
+ result.push({ translateX: transform.translateX });
25
+ if (transform.translateY)
26
+ result.push({ translateY: transform.translateY });
27
+ if (transform.rotate)
28
+ result.push({ rotate: (transform.rotate * Math.PI) / 180 });
29
+ if (transform.scaleX !== undefined)
30
+ result.push({ scaleX: transform.scaleX });
31
+ if (transform.scaleY !== undefined)
32
+ result.push({ scaleY: transform.scaleY });
33
+ return result;
34
+ }
35
+ /**
36
+ * One Skia element per painted channel, since Skia paints one at a time.
37
+ *
38
+ * Generic over the shape rather than typed `typeof SkiaRect` with the
39
+ * geometry as `Record<string, unknown>`. That signature erased every
40
+ * geometry prop, so nothing checked that a `Circle` was handed `cx`/`cy`
41
+ * or a `Line` its two points -- and the hand-written module stub this
42
+ * package used to carry declared every component as
43
+ * `ComponentType<Record<string, unknown>>`, so nothing checked the paint
44
+ * props either. Against Skia's own types, with the geometry kept, both are
45
+ * checked.
46
+ */
47
+ /**
48
+ * Containment answered by the same engine that draws the path.
49
+ *
50
+ * Skia parses an SVG path string into an `SkPath`, so the result is
51
+ * cached by that string and by the fill rule -- a pointer moving across a
52
+ * chart would otherwise reparse every path on every frame, and
53
+ * `setFillType` mutates the path rather than returning a new one, so the
54
+ * two rules cannot share an entry.
55
+ *
56
+ * Module level rather than per surface, like `fonts`: a path string means
57
+ * the same shape wherever it is drawn.
58
+ */
59
+ const parsedPaths = new BoundedCache(256);
60
+ const pathHitTest = (path, fillRule, point) => {
61
+ const key = `${fillRule}:${path}`;
62
+ let parsed = parsedPaths.get(key);
63
+ if (parsed === undefined) {
64
+ parsed = Skia.Path.MakeFromSVGString(path);
65
+ parsed?.setFillType(fillRule === 'evenodd' ? FillType.EvenOdd : FillType.Winding);
66
+ parsedPaths.set(key, parsed);
67
+ }
68
+ // A path Skia could not parse contains nothing, which is the same
69
+ // answer the Web surface gives for one `Path2D` rejects.
70
+ return parsed?.contains(point.x, point.y) ?? false;
71
+ };
72
+ /**
73
+ * The system face for a font spec, resolved once per spec.
74
+ *
75
+ * `matchFont` walks the platform's font manager, so calling it per text
76
+ * node per frame would put that walk on every redraw. Keyed by the four
77
+ * fields rather than by object identity, since the spec is rebuilt each
78
+ * render.
79
+ */
80
+ const fonts = new Map();
81
+ function fontFor(props) {
82
+ const spec = textFontSpec(props);
83
+ const key = `${spec.fontStyle} ${spec.fontWeight} ${spec.fontSize} ${spec.fontFamily}`;
84
+ let font = fonts.get(key);
85
+ if (!font) {
86
+ font = matchFont(spec);
87
+ fonts.set(key, font);
88
+ }
89
+ return font;
90
+ }
91
+ /**
92
+ * Where the run starts, given which part of it sits at `x`.
93
+ *
94
+ * Skia's `Text` draws from the left and has no alignment of its own, so
95
+ * this measures. Canvas2D does not measure here -- it is told
96
+ * `textAlign` and aligns against its own metrics, which is the only
97
+ * measurement that can agree with what it rasterises. Two mechanisms for
98
+ * one contract, because each renderer's metrics are its own.
99
+ */
100
+ function alignedX(props, font) {
101
+ const align = props.textAlign ?? 'left';
102
+ if (align === 'left')
103
+ return props.x;
104
+ const width = font.measureText(props.text).width;
105
+ return align === 'center' ? props.x - width / 2 : props.x - width;
106
+ }
107
+ /**
108
+ * A gradient as Skia takes it: a shader element inside the shape.
109
+ *
110
+ * The other half of the same description Canvas2D builds with
111
+ * `createLinearGradient`. Skia wants two parallel arrays where the
112
+ * browser wants a call per stop, so the stops are unzipped here and
113
+ * nowhere else.
114
+ */
115
+ function gradientShader(paint) {
116
+ if (!isGradient(paint))
117
+ return null;
118
+ const colors = paint.stops.map((stop) => stop.color);
119
+ const positions = paint.stops.map((stop) => stop.offset);
120
+ return paint.kind === 'linear' ? (_jsx(SkiaLinearGradient, { start: paint.from, end: paint.to, colors: colors, positions: positions })) : (_jsx(SkiaRadialGradient, { c: paint.center, r: paint.radius, colors: colors, positions: positions }));
121
+ }
122
+ /** The colour Skia is given when the paint is a gradient instead. */
123
+ function colorFor(paint, fallback) {
124
+ // A shape carrying a shader ignores its colour, but the prop is
125
+ // required, so it gets one that says nothing rather than one that
126
+ // would show if the shader ever failed to attach.
127
+ if (isGradient(paint))
128
+ return 'black';
129
+ return paint ?? fallback;
130
+ }
131
+ /**
132
+ * The lines a label would be broken into at a given width.
133
+ *
134
+ * The same rule `maxWidth` follows, for a caller doing its own layout:
135
+ * sizing a card around a legend, deciding how tall a row has to be,
136
+ * placing something under the last line. Withholding it would leave
137
+ * those to a guess, which is what this package did with the
138
+ * measurement until it stopped.
139
+ *
140
+ * `undefined` where there is no renderer to measure with, as
141
+ * `measureCanvasText` is and for the same reason.
142
+ */
143
+ export function wrapCanvasText(props, maxWidth) {
144
+ const font = fontFor(props);
145
+ return wrapText(props.text, maxWidth, (run) => font.measureText(run).width);
146
+ }
147
+ /**
148
+ * What a label will occupy, for a caller placing something against it.
149
+ *
150
+ * Skia's `measureText` returns a rect whose origin is the baseline, so
151
+ * its `y` is the ascent negated and `y + height` is the descent. Ink
152
+ * again, and the same font object the renderer draws with -- a second
153
+ * face resolved separately could measure a different width.
154
+ *
155
+ * Optional to match the Web signature, where there may be no DOM to
156
+ * measure with. Native always has a font manager, so this side always
157
+ * answers; one shape for one API rather than two a caller has to know
158
+ * apart.
159
+ */
160
+ export function measureCanvasText(props) {
161
+ const bounds = fontFor(props).measureText(props.text);
162
+ return { width: bounds.width, ascent: -bounds.y, descent: bounds.y + bounds.height };
163
+ }
164
+ /** Always defined here, and the hit test wants a total function. */
165
+ const measureText = (props) => measureCanvasText(props) ?? { width: 0, ascent: 0, descent: 0 };
166
+ function paintLayers(key, Shape, geometry, paint) {
167
+ const layers = [];
168
+ const hasFill = paintFills(paint);
169
+ const hasStroke = paintStrokes(paint);
170
+ if (hasFill) {
171
+ layers.push(_jsx(Shape, { ...geometry, color: colorFor(paint.fill, 'black'), opacity: paint.opacity, style: "fill", children: gradientShader(paint.fill) }, `${key}:fill`));
172
+ }
173
+ if (hasStroke) {
174
+ layers.push(_jsx(Shape, { ...geometry, color: colorFor(paint.stroke), opacity: paint.opacity, style: "stroke", strokeWidth: paint.strokeWidth ?? 1, strokeCap: paint.lineCap, strokeJoin: paint.lineJoin, children: gradientShader(paint.stroke) }, `${key}:stroke`));
175
+ }
176
+ return layers;
177
+ }
178
+ function renderNode(node, key) {
179
+ switch (node.kind) {
180
+ case 'group':
181
+ return (_jsx(SkiaGroup, { opacity: node.props.opacity, transform: transformFor(node.props.transform), origin: node.props.transform
182
+ ? { x: node.props.transform.originX ?? 0, y: node.props.transform.originY ?? 0 }
183
+ : undefined, children: node.children.map((child, index) => renderNode(child, `${key}.${index}`)) }, key));
184
+ case 'clip': {
185
+ const props = node.props;
186
+ const clip = props.path !== undefined
187
+ ? props.path
188
+ : // `?? 0` on all four, as `pointInClip` and the Canvas2D renderer
189
+ // already do. The union says a rectangle clip has a width, but
190
+ // the scene node is reached through a cast, so nothing enforces
191
+ // it -- and Skia given `undefined` clips to nothing in silence.
192
+ {
193
+ x: props.x ?? 0,
194
+ y: props.y ?? 0,
195
+ width: props.width ?? 0,
196
+ height: props.height ?? 0,
197
+ };
198
+ return (_jsx(SkiaGroup, { clip: clip, children: node.children.map((child, index) => renderNode(child, `${key}.${index}`)) }, key));
199
+ }
200
+ case 'rect':
201
+ return paintLayers(key, SkiaRect, {
202
+ x: node.props.x ?? 0,
203
+ y: node.props.y ?? 0,
204
+ width: node.props.width,
205
+ height: node.props.height,
206
+ }, node.props);
207
+ case 'rounded-rect':
208
+ return paintLayers(key, SkiaRoundedRect, {
209
+ x: node.props.x ?? 0,
210
+ y: node.props.y ?? 0,
211
+ width: node.props.width,
212
+ height: node.props.height,
213
+ r: node.props.radius,
214
+ }, node.props);
215
+ case 'circle':
216
+ return paintLayers(key, SkiaCircle, {
217
+ cx: node.props.cx,
218
+ cy: node.props.cy,
219
+ r: node.props.radius,
220
+ }, node.props);
221
+ case 'ellipse':
222
+ return paintLayers(key, SkiaOval, {
223
+ rect: {
224
+ x: node.props.cx - node.props.radiusX,
225
+ y: node.props.cy - node.props.radiusY,
226
+ width: node.props.radiusX * 2,
227
+ height: node.props.radiusY * 2,
228
+ },
229
+ }, node.props);
230
+ case 'line':
231
+ return paintLayers(key, SkiaLine, {
232
+ p1: { x: node.props.x1, y: node.props.y1 },
233
+ p2: { x: node.props.x2, y: node.props.y2 },
234
+ }, { ...node.props, fill: 'none', stroke: node.props.stroke ?? 'black' });
235
+ case 'text': {
236
+ const font = fontFor(node.props);
237
+ // One Skia element per line. Skia draws a run rather than a
238
+ // paragraph, so the breaking is the shared rule the Web renderer
239
+ // follows and the widths are this font's -- the one about to draw
240
+ // them.
241
+ const lines = textLines(node.props, (run) => font.measureText(run).width);
242
+ return lines.map((line, index) => paintLayers(`${key}:${index}`, SkiaText, {
243
+ font,
244
+ text: line.text,
245
+ x: alignedX({ ...node.props, text: line.text }, font),
246
+ y: line.y,
247
+ }, node.props));
248
+ }
249
+ case 'path':
250
+ return paintLayers(key, SkiaPath, {
251
+ path: node.props.path,
252
+ // `as const` so this stays the enum Skia names rather than
253
+ // widening to `string`. The mapping itself was already right;
254
+ // nothing was checking it.
255
+ fillType: node.props.fillRule === 'evenodd' ? 'evenOdd' : 'winding',
256
+ }, node.props);
257
+ default:
258
+ return unhandledShape(node, 'the Skia renderer');
259
+ }
260
+ }
261
+ function viewportTransform(viewBox, width, height, fit) {
262
+ if (!viewBox || width <= 0 || height <= 0 || viewBox[2] <= 0 || viewBox[3] <= 0)
263
+ return undefined;
264
+ const scaleX = width / viewBox[2];
265
+ const scaleY = height / viewBox[3];
266
+ if ((fit ?? 'contain') === 'stretch') {
267
+ const result = [];
268
+ result.push({ scaleX });
269
+ result.push({ scaleY });
270
+ result.push({ translateX: -viewBox[0] });
271
+ result.push({ translateY: -viewBox[1] });
272
+ return result;
273
+ }
274
+ const scale = Math.min(scaleX, scaleY);
275
+ const result = [];
276
+ result.push({ translateX: (width - viewBox[2] * scale) / 2 });
277
+ result.push({ translateY: (height - viewBox[3] * scale) / 2 });
278
+ result.push({ scale });
279
+ result.push({ translateX: -viewBox[0] });
280
+ result.push({ translateY: -viewBox[1] });
281
+ return result;
282
+ }
283
+ function Scene({ scene, transform }) {
284
+ const nodes = scene.map((node, index) => renderNode(node, `root.${index}`));
285
+ return transform ? _jsx(SkiaGroup, { transform: transform, children: nodes }) : nodes;
286
+ }
287
+ function Root({ children, className, style, width, height, viewBox, fit = 'contain', decorative, accessibilityLabel, accessibleFallback, testID, }) {
288
+ const pressedTarget = useRef(undefined);
289
+ const navigation = useHozoNavigation();
290
+ const { scene, collector, isInteractive, press, activate, interactions, interactionRevision } = useCanvasScene(children);
291
+ const [layout, setLayout] = useState({
292
+ width: width ?? viewBox?.[2] ?? 0,
293
+ height: height ?? viewBox?.[3] ?? 0,
294
+ });
295
+ const onLayout = (event) => {
296
+ const next = event.nativeEvent.layout;
297
+ setLayout((current) => current.width === next.width && current.height === next.height
298
+ ? current
299
+ : { width: next.width, height: next.height });
300
+ };
301
+ const transform = useMemo(() => viewportTransform(viewBox, layout.width, layout.height, fit), [viewBox, layout, fit]);
302
+ const hasValidViewport = !viewBox || (layout.width > 0 && layout.height > 0 && viewBox[2] > 0 && viewBox[3] > 0);
303
+ const nativeClass = { className };
304
+ const accessibilityMode = canvasAccessibilityMode({ decorative, accessibleFallback });
305
+ const fallbackContent = typeof accessibleFallback === 'string' ||
306
+ typeof accessibleFallback === 'number' ||
307
+ typeof accessibleFallback === 'bigint' ? (_jsx(Text, { children: String(accessibleFallback) })) : (accessibleFallback);
308
+ const surfacePoint = (event) => ({
309
+ x: event.nativeEvent.locationX,
310
+ y: event.nativeEvent.locationY,
311
+ });
312
+ const hitAt = (point) => hitTestCanvas(scene, point, { width: layout.width, height: layout.height, viewBox, fit }, isInteractive, { pathContains: pathHitTest, measureText });
313
+ const onStartShouldSetResponder = (event) => {
314
+ pressedTarget.current = undefined;
315
+ if (event.nativeEvent.touches.length !== 1)
316
+ return false;
317
+ const hit = hitAt(surfacePoint(event));
318
+ if (hit) {
319
+ pressedTarget.current = { id: hit.id, touchId: event.nativeEvent.identifier };
320
+ activate(hit.id, canvasPressEvent(hit.point, surfacePoint(event)));
321
+ }
322
+ return hit !== undefined;
323
+ };
324
+ const onResponderRelease = (event) => {
325
+ const startedTarget = pressedTarget.current;
326
+ pressedTarget.current = undefined;
327
+ if (!startedTarget ||
328
+ event.nativeEvent.touches.length > 0 ||
329
+ event.nativeEvent.identifier !== startedTarget.touchId)
330
+ return;
331
+ const point = surfacePoint(event);
332
+ const hit = hitAt(point);
333
+ activate(undefined, undefined);
334
+ if (!hit || hit.id !== startedTarget.id)
335
+ return;
336
+ const destination = press(hit.id, canvasPressEvent(hit.point, point));
337
+ if (destination) {
338
+ void activateHozoNavigation(navigation, destination, Linking.openURL);
339
+ }
340
+ };
341
+ const onResponderTerminate = () => {
342
+ pressedTarget.current = undefined;
343
+ activate(undefined, undefined);
344
+ };
345
+ /**
346
+ * The same hover as the Web surface, from the same event.
347
+ *
348
+ * React Native's `View` declares the whole W3C pointer set and its
349
+ * payload carries `pointerType` and `offsetX`/`offsetY`, so this is the
350
+ * browser's handler with a different import. A tablet with a trackpad
351
+ * and a phone with a mouse both reach it; a finger does not, and is
352
+ * excluded by `pointerType` for the reason the Web side gives.
353
+ *
354
+ * Not verified on a device. The types and the prop declarations are as
355
+ * far as this repository can check from here, and #26 asks for device
356
+ * validation as an item of its own.
357
+ */
358
+ const pointerPoint = (event) => ({
359
+ x: event.nativeEvent.offsetX,
360
+ y: event.nativeEvent.offsetY,
361
+ });
362
+ const onPointerMove = (event) => {
363
+ if (event.nativeEvent.pointerType === 'touch')
364
+ return;
365
+ const point = pointerPoint(event);
366
+ const hit = hitAt(point);
367
+ activate(hit?.id, hit ? canvasPressEvent(hit.point, point) : undefined);
368
+ };
369
+ const onPointerLeave = () => activate(undefined, undefined);
370
+ // Memoised on the scene, which is the only thing that can change the
371
+ // answer. Without this it walked every node on every render of the
372
+ // surface -- a second full traversal beside the snapshot and the
373
+ // redraw, for a list that changes only when a shape is added, removed
374
+ // or renamed.
375
+ //
376
+ // `interactions` is a stable store rather than a value, so it is not a
377
+ // dependency: a handler arriving or leaving mutates it without a new
378
+ // scene. That is why the list is rebuilt whenever the scene is, which
379
+ // is also when a shape's presence could have changed.
380
+ // Only in `label` mode, and that is the whole condition. A
381
+ // `decorative` surface has said it carries no information and a
382
+ // surface with an `accessibleFallback` has supplied it; second-guessing
383
+ // either would be arguing with an author who already answered. What is
384
+ // left is the one where a single name stands for a drawing, and the
385
+ // drawing has words the name does not.
386
+ if (accessibilityMode === 'label') {
387
+ reportUnreadableText(canvasUnreadableText(scene, accessibilityLabel), (message) => console.warn(`[hozo] ${message}`));
388
+ }
389
+ // biome-ignore lint/correctness/useExhaustiveDependencies: the registry revision intentionally invalidates semantic controls without redrawing the scene
390
+ const controls = useMemo(() => canvasControls(scene, interactions, (message) => console.warn(`[hozo] ${message}`)), [scene, interactions, interactionRevision]);
391
+ const pointFor = (id) => canvasNodePoint(scene, id, {
392
+ width: layout.width,
393
+ height: layout.height,
394
+ viewBox,
395
+ fit,
396
+ }) ?? { point: { x: 0, y: 0 }, surfacePoint: { x: 0, y: 0 } };
397
+ return (_jsxs(View, { ...nativeClass, style: [
398
+ styles.root,
399
+ width === undefined ? null : { width },
400
+ height === undefined ? null : { height },
401
+ style,
402
+ ], onLayout: onLayout, accessible: accessibilityMode === 'label', accessibilityRole: accessibilityMode === 'label' ? 'image' : undefined, accessibilityLabel: accessibilityMode === 'label' ? accessibilityLabel : undefined, testID: testID, onStartShouldSetResponder: onStartShouldSetResponder, onResponderRelease: onResponderRelease, onResponderTerminate: onResponderTerminate, onPointerMove: onPointerMove, onPointerLeave: onPointerLeave, children: [collector, _jsx(View, { style: StyleSheet.absoluteFill, accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", pointerEvents: "none", children: _jsx(SkiaCanvas, { style: StyleSheet.absoluteFill, children: hasValidViewport ? _jsx(Scene, { scene: scene, transform: transform }) : null }) }), controls.length > 0 ? (_jsx(View, { style: styles.accessibleFallback, children: controls.map((control) => (_jsx(View, { accessible: true, accessibilityRole: control.destination ? 'link' : 'button', accessibilityLabel: control.label, onAccessibilityTap: () => {
403
+ const point = pointFor(control.id);
404
+ const destination = press(control.id, canvasPressEvent(point.point, point.surfacePoint));
405
+ if (destination) {
406
+ void activateHozoNavigation(navigation, destination, Linking.openURL);
407
+ }
408
+ }, onAccessibilityEscape: () => activate(undefined, undefined) }, control.id))) })) : null, accessibilityMode === 'fallback' ? (_jsxs(View, { style: styles.accessibleFallback, accessible: false, pointerEvents: "none", children: [accessibilityLabel ? _jsx(Text, { children: accessibilityLabel }) : null, fallbackContent] })) : null] }));
409
+ }
410
+ const styles = StyleSheet.create({
411
+ root: { position: 'relative', overflow: 'hidden' },
412
+ accessibleFallback: {
413
+ position: 'absolute',
414
+ width: 1,
415
+ height: 1,
416
+ padding: 0,
417
+ margin: -1,
418
+ overflow: 'hidden',
419
+ },
420
+ });
421
+ /** Canvas root plus the same scene vocabulary exported on Web. */
422
+ export const Canvas = Object.assign(Root, {
423
+ Group,
424
+ Clip,
425
+ // Under a local alias only because React Native's own `Text` is in
426
+ // scope in this module; the public name is the same on both surfaces.
427
+ Text: CanvasText,
428
+ Rect,
429
+ RoundedRect,
430
+ Circle,
431
+ Ellipse,
432
+ Line,
433
+ Path,
434
+ });
435
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACnF,OAAO,EAEL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,MAAM,IAAI,UAAU,EACpB,MAAM,IAAI,UAAU,EACpB,KAAK,IAAI,SAAS,EAClB,IAAI,IAAI,QAAQ,EAChB,cAAc,IAAI,kBAAkB,EACpC,IAAI,IAAI,QAAQ,EAChB,IAAI,IAAI,QAAQ,EAChB,cAAc,IAAI,kBAAkB,EACpC,IAAI,IAAI,QAAQ,EAChB,WAAW,IAAI,eAAe,EAC9B,IAAI,IAAI,QAAQ,GAEjB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAsC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACrF,OAAO,EAGL,OAAO,EAGP,UAAU,EACV,IAAI,EACJ,IAAI,GAEL,MAAM,cAAc,CAAA;AAErB,OAAO,EAAiC,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC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,MAAM,aAC5E,kBAAkB,CAAC,CAAC,CAAC,KAAC,IAAI,cAAE,kBAAkB,GAAQ,CAAC,CAAC,CAAC,IAAI,EAC7D,eAAe,IACX,CACR,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE;IAClD,kBAAkB,EAAE;QAClB,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,CAAC,CAAC;QACV,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAA;AAEF,kEAAkE;AAClE,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;IACxC,KAAK;IACL,IAAI;IACJ,mEAAmE;IACnE,sEAAsE;IACtE,IAAI,EAAE,UAAU;IAChB,IAAI;IACJ,WAAW;IACX,MAAM;IACN,OAAO;IACP,IAAI;IACJ,IAAI;CACL,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { type CanvasScene } from './scene.tsx';
2
+ import type { CanvasViewport } from './viewport.ts';
3
+ export type { CanvasViewport } from './viewport.ts';
4
+ /** Draws one immutable scene snapshot. Exported for custom renderers and deterministic tests. */
5
+ export declare function renderCanvas2D(context: CanvasRenderingContext2D, scene: CanvasScene, viewport: CanvasViewport): void;
6
+ //# sourceMappingURL=render-canvas-2d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-canvas-2d.d.ts","sourceRoot":"","sources":["../src/render-canvas-2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EASjB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGnD,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AA+MnD,iGAAiG;AACjG,wBAAgB,cAAc,CAC5B,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,QA+BzB"}