@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.
- package/LICENSE +21 -0
- package/README.md +152 -0
- package/dist/accessibility.d.ts +20 -0
- package/dist/accessibility.d.ts.map +1 -0
- package/dist/accessibility.js +9 -0
- package/dist/accessibility.js.map +1 -0
- package/dist/hit-test.d.ts +96 -0
- package/dist/hit-test.d.ts.map +1 -0
- package/dist/hit-test.js +354 -0
- package/dist/hit-test.js.map +1 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +317 -0
- package/dist/index.js.map +1 -0
- package/dist/index.native.d.ts +83 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/index.native.js +435 -0
- package/dist/index.native.js.map +1 -0
- package/dist/render-canvas-2d.d.ts +6 -0
- package/dist/render-canvas-2d.d.ts.map +1 -0
- package/dist/render-canvas-2d.js +213 -0
- package/dist/render-canvas-2d.js.map +1 -0
- package/dist/scene.d.ts +495 -0
- package/dist/scene.d.ts.map +1 -0
- package/dist/scene.js +591 -0
- package/dist/scene.js.map +1 -0
- package/dist/viewport.d.ts +9 -0
- package/dist/viewport.d.ts.map +1 -0
- package/dist/viewport.js +2 -0
- package/dist/viewport.js.map +1 -0
- package/dist/wrap-text.d.ts +28 -0
- package/dist/wrap-text.d.ts.map +1 -0
- package/dist/wrap-text.js +148 -0
- package/dist/wrap-text.js.map +1 -0
- package/package.json +79 -0
- package/src/accessibility.ts +28 -0
- package/src/hit-test.ts +499 -0
- package/src/index.native.tsx +733 -0
- package/src/index.tsx +510 -0
- package/src/render-canvas-2d.ts +259 -0
- package/src/scene.tsx +1037 -0
- package/src/viewport.ts +8 -0
- package/src/wrap-text.ts +157 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hit-test.js","sourceRoot":"","sources":["../src/hit-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,YAAY,EAEZ,cA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AAA;gBACxC,IAAI,GAAG;oBAAE,OAAO,GAAG,CAAA;gBACnB,SAAQ;YACV,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;gBAAE,SAAQ;YACjD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;YAC9B,IAAI,CAAC,OAAO;gBAAE,SAAQ;YACtB,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;YAC/C,IAAI,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC3C,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,CAAA;YACvD,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC,CAAA;IAED,OAAO,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;AACjC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type CanvasAccessibilityProps } from './accessibility.ts';
|
|
3
|
+
import { type CanvasTextMetrics } from './hit-test.ts';
|
|
4
|
+
import { Clip, Group, type TextProps } from './scene.tsx';
|
|
5
|
+
export type { CanvasAccessibilityProps, CanvasAccessibleFallback } from './accessibility.ts';
|
|
6
|
+
export { type CanvasHitTestResult, type CanvasHitTestViewport, type CanvasPathHitTest, type CanvasPoint, type CanvasRendererQueries, type CanvasTextMeasure, type CanvasTextMetrics, hitTestCanvas, } from './hit-test.ts';
|
|
7
|
+
export { type CanvasViewport, renderCanvas2D } from './render-canvas-2d.ts';
|
|
8
|
+
export type { CanvasDestination, CanvasInteractionProps, CanvasPaintProps, CanvasPressEvent, CanvasScene, CanvasSceneNode, CanvasTransform, CircleProps, ClipProps, EllipseProps, GroupProps, LineProps, PathProps, RectProps, RoundedRectProps, } from './scene.tsx';
|
|
9
|
+
export { CanvasSceneStore } from './scene.tsx';
|
|
10
|
+
export { textLines, wrapText } from './wrap-text.ts';
|
|
11
|
+
/**
|
|
12
|
+
* What a label will occupy, for a caller placing something against it.
|
|
13
|
+
*
|
|
14
|
+
* The measurement this package took internally and kept. Sizing a
|
|
15
|
+
* tooltip against a label, or deciding where a line has to break, meant
|
|
16
|
+
* guessing at metrics only Hozo could see.
|
|
17
|
+
*
|
|
18
|
+
* `undefined` where there is no renderer to ask -- a server, a test --
|
|
19
|
+
* which is the refusal a path hit test makes there for the same reason.
|
|
20
|
+
* A guess would be a layout that moves on hydration.
|
|
21
|
+
*/
|
|
22
|
+
export declare function measureCanvasText(props: TextProps): CanvasTextMetrics | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The lines a label would be broken into at a given width.
|
|
25
|
+
*
|
|
26
|
+
* The same rule `maxWidth` follows, for a caller doing its own layout:
|
|
27
|
+
* sizing a card around a legend, deciding how tall a row has to be,
|
|
28
|
+
* placing something under the last line. Withholding it would leave
|
|
29
|
+
* those to a guess, which is what this package did with the
|
|
30
|
+
* measurement until it stopped.
|
|
31
|
+
*
|
|
32
|
+
* `undefined` where there is no renderer to measure with, as
|
|
33
|
+
* `measureCanvasText` is and for the same reason.
|
|
34
|
+
*/
|
|
35
|
+
export declare function wrapCanvasText(props: TextProps, maxWidth: number): string[] | undefined;
|
|
36
|
+
export type CanvasProps = CanvasAccessibilityProps & {
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
className?: string;
|
|
39
|
+
style?: CSSProperties;
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
viewBox?: readonly [x: number, y: number, width: number, height: number];
|
|
43
|
+
fit?: 'contain' | 'stretch';
|
|
44
|
+
testID?: string;
|
|
45
|
+
};
|
|
46
|
+
declare function Root({ children, className, style, width, height, viewBox, fit, decorative, accessibilityLabel, accessibleFallback, testID, }: CanvasProps): import("react").JSX.Element;
|
|
47
|
+
/** Canvas root plus its platform-neutral scene vocabulary. */
|
|
48
|
+
export declare const Canvas: typeof Root & {
|
|
49
|
+
Group: typeof Group;
|
|
50
|
+
Clip: typeof Clip;
|
|
51
|
+
Text: {
|
|
52
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: TextProps): null;
|
|
53
|
+
displayName: string;
|
|
54
|
+
};
|
|
55
|
+
Rect: {
|
|
56
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").RectProps): null;
|
|
57
|
+
displayName: string;
|
|
58
|
+
};
|
|
59
|
+
RoundedRect: {
|
|
60
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").RoundedRectProps): null;
|
|
61
|
+
displayName: string;
|
|
62
|
+
};
|
|
63
|
+
Circle: {
|
|
64
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").CircleProps): null;
|
|
65
|
+
displayName: string;
|
|
66
|
+
};
|
|
67
|
+
Ellipse: {
|
|
68
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").EllipseProps): null;
|
|
69
|
+
displayName: string;
|
|
70
|
+
};
|
|
71
|
+
Line: {
|
|
72
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").LineProps): null;
|
|
73
|
+
displayName: string;
|
|
74
|
+
};
|
|
75
|
+
Path: {
|
|
76
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").PathProps): null;
|
|
77
|
+
displayName: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,K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,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACxE,GAAG,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAUD,iBAAS,IAAI,CAAC,EACZ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,GAAe,EACf,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,MAAM,GACP,EAAE,WAAW,+BA8Sb;AAeD,8DAA8D;AAC9D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWjB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { activateHozoNavigation, useHozoNavigation } from '@hozo/engine/navigation';
|
|
3
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
4
|
+
import { canvasAccessibilityMode } from './accessibility.js';
|
|
5
|
+
import { canvasNodePoint, hitTestCanvas, } from './hit-test.js';
|
|
6
|
+
import { renderCanvas2D } from './render-canvas-2d.js';
|
|
7
|
+
import { BoundedCache, Circle, Clip, canvasControls, canvasPressEvent, canvasUnreadableText, cssFontShorthand, Ellipse, Group, Line, Path, Rect, RoundedRect, reportUnreadableText, Text, useCanvasScene, } from './scene.js';
|
|
8
|
+
import { wrapText } from './wrap-text.js';
|
|
9
|
+
export { hitTestCanvas, } from './hit-test.js';
|
|
10
|
+
export { renderCanvas2D } from './render-canvas-2d.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
|
+
/**
|
|
17
|
+
* A run of text, measured the way the renderer measures it.
|
|
18
|
+
*
|
|
19
|
+
* `actualBoundingBox*` rather than `fontBoundingBox*`: the ink, not the
|
|
20
|
+
* line box. A label sits where its glyphs are, and the font box of a
|
|
21
|
+
* run with no descenders reaches below anything on screen.
|
|
22
|
+
*/
|
|
23
|
+
function measureWith(context, props) {
|
|
24
|
+
context.save();
|
|
25
|
+
context.font = cssFontShorthand(props);
|
|
26
|
+
const metrics = context.measureText(props.text);
|
|
27
|
+
context.restore();
|
|
28
|
+
return {
|
|
29
|
+
width: metrics.width,
|
|
30
|
+
ascent: metrics.actualBoundingBoxAscent ?? 0,
|
|
31
|
+
descent: metrics.actualBoundingBoxDescent ?? 0,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A context to measure with for a caller that is not inside a surface.
|
|
36
|
+
*
|
|
37
|
+
* Text metrics read nothing from a canvas but its `font`, so a caller
|
|
38
|
+
* laying out before anything has mounted gets the numbers the drawing
|
|
39
|
+
* context would have given. Made once and kept: an element per
|
|
40
|
+
* measurement would be the expensive part of this.
|
|
41
|
+
*/
|
|
42
|
+
let measuringContext;
|
|
43
|
+
function sharedContext() {
|
|
44
|
+
if (measuringContext === undefined) {
|
|
45
|
+
measuringContext = globalThis.document?.createElement('canvas').getContext('2d') ?? null;
|
|
46
|
+
}
|
|
47
|
+
return measuringContext;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* What a label will occupy, for a caller placing something against it.
|
|
51
|
+
*
|
|
52
|
+
* The measurement this package took internally and kept. Sizing a
|
|
53
|
+
* tooltip against a label, or deciding where a line has to break, meant
|
|
54
|
+
* guessing at metrics only Hozo could see.
|
|
55
|
+
*
|
|
56
|
+
* `undefined` where there is no renderer to ask -- a server, a test --
|
|
57
|
+
* which is the refusal a path hit test makes there for the same reason.
|
|
58
|
+
* A guess would be a layout that moves on hydration.
|
|
59
|
+
*/
|
|
60
|
+
export function measureCanvasText(props) {
|
|
61
|
+
const context = sharedContext();
|
|
62
|
+
return context ? measureWith(context, props) : undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The lines a label would be broken into at a given width.
|
|
66
|
+
*
|
|
67
|
+
* The same rule `maxWidth` follows, for a caller doing its own layout:
|
|
68
|
+
* sizing a card around a legend, deciding how tall a row has to be,
|
|
69
|
+
* placing something under the last line. Withholding it would leave
|
|
70
|
+
* those to a guess, which is what this package did with the
|
|
71
|
+
* measurement until it stopped.
|
|
72
|
+
*
|
|
73
|
+
* `undefined` where there is no renderer to measure with, as
|
|
74
|
+
* `measureCanvasText` is and for the same reason.
|
|
75
|
+
*/
|
|
76
|
+
export function wrapCanvasText(props, maxWidth) {
|
|
77
|
+
const context = sharedContext();
|
|
78
|
+
if (!context)
|
|
79
|
+
return undefined;
|
|
80
|
+
return wrapText(props.text, maxWidth, (run) => measureWith(context, { ...props, text: run }).width);
|
|
81
|
+
}
|
|
82
|
+
const useIsoLayoutEffect = typeof document === 'undefined' ? useEffect : useLayoutEffect;
|
|
83
|
+
function Root({ children, className, style, width, height, viewBox, fit = 'contain', decorative, accessibilityLabel, accessibleFallback, testID, }) {
|
|
84
|
+
const canvasRef = useRef(null);
|
|
85
|
+
const pressedTargets = useRef(new Map());
|
|
86
|
+
const navigation = useHozoNavigation();
|
|
87
|
+
const { scene, collector, isInteractive, press, activate, interactions, interactionRevision } = useCanvasScene(children);
|
|
88
|
+
const [size, setSize] = useState(() => ({
|
|
89
|
+
width: width ?? viewBox?.[2] ?? 300,
|
|
90
|
+
height: height ?? viewBox?.[3] ?? 150,
|
|
91
|
+
pixelRatio: 1,
|
|
92
|
+
}));
|
|
93
|
+
useIsoLayoutEffect(() => {
|
|
94
|
+
const canvas = canvasRef.current;
|
|
95
|
+
if (!canvas)
|
|
96
|
+
return;
|
|
97
|
+
const measure = () => {
|
|
98
|
+
const bounds = canvas.getBoundingClientRect();
|
|
99
|
+
const next = {
|
|
100
|
+
width: width ?? (bounds.width || viewBox?.[2] || 300),
|
|
101
|
+
height: height ?? (bounds.height || viewBox?.[3] || 150),
|
|
102
|
+
pixelRatio: globalThis.devicePixelRatio || 1,
|
|
103
|
+
};
|
|
104
|
+
setSize((current) => current.width === next.width &&
|
|
105
|
+
current.height === next.height &&
|
|
106
|
+
current.pixelRatio === next.pixelRatio
|
|
107
|
+
? current
|
|
108
|
+
: next);
|
|
109
|
+
};
|
|
110
|
+
measure();
|
|
111
|
+
if (typeof ResizeObserver === 'undefined')
|
|
112
|
+
return;
|
|
113
|
+
const observer = new ResizeObserver(measure);
|
|
114
|
+
observer.observe(canvas);
|
|
115
|
+
return () => observer.disconnect();
|
|
116
|
+
}, [width, height, viewBox]);
|
|
117
|
+
useIsoLayoutEffect(() => {
|
|
118
|
+
const context = canvasRef.current?.getContext('2d');
|
|
119
|
+
if (!context)
|
|
120
|
+
return;
|
|
121
|
+
renderCanvas2D(context, scene, { ...size, viewBox, fit });
|
|
122
|
+
}, [scene, size, viewBox, fit]);
|
|
123
|
+
const rootStyle = {
|
|
124
|
+
...style,
|
|
125
|
+
...(width === undefined ? null : { width }),
|
|
126
|
+
...(height === undefined ? null : { height }),
|
|
127
|
+
};
|
|
128
|
+
const accessibilityMode = canvasAccessibilityMode({ decorative, accessibleFallback });
|
|
129
|
+
const surfacePoint = (event) => {
|
|
130
|
+
const bounds = event.currentTarget.getBoundingClientRect();
|
|
131
|
+
return {
|
|
132
|
+
x: ((event.clientX - bounds.left) * size.width) / (bounds.width || size.width || 1),
|
|
133
|
+
y: ((event.clientY - bounds.top) * size.height) / (bounds.height || size.height || 1),
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Containment answered by the same engine that draws the path.
|
|
138
|
+
*
|
|
139
|
+
* `Path2D` objects are cached by their string: constructing one parses
|
|
140
|
+
* the path, and a pointer moving across a chart would otherwise reparse
|
|
141
|
+
* every path on every frame.
|
|
142
|
+
*
|
|
143
|
+
* The context is the offscreen one this surface already draws with, and
|
|
144
|
+
* `isPointInPath` reads no state from it beyond the path and the point.
|
|
145
|
+
*/
|
|
146
|
+
const paths = useRef(new BoundedCache(256));
|
|
147
|
+
const pathHitTest = (path, fillRule, point) => {
|
|
148
|
+
const context = canvasRef.current?.getContext('2d');
|
|
149
|
+
if (!context)
|
|
150
|
+
return false;
|
|
151
|
+
let path2d = paths.current.get(path);
|
|
152
|
+
if (!path2d) {
|
|
153
|
+
path2d = new Path2D(path);
|
|
154
|
+
paths.current.set(path, path2d);
|
|
155
|
+
}
|
|
156
|
+
// Reset first. `isPointInPath` reads the point in the context's
|
|
157
|
+
// *current* transform, and the point handed here is already in the
|
|
158
|
+
// path's own coordinates -- the hit test inverted the viewport and
|
|
159
|
+
// every ancestor to get it there. Relying on the render pass having
|
|
160
|
+
// left an identity transform behind would work today and break the
|
|
161
|
+
// first time something drew after it.
|
|
162
|
+
context.save();
|
|
163
|
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
164
|
+
const inside = context.isPointInPath(path2d, point.x, point.y, fillRule);
|
|
165
|
+
context.restore();
|
|
166
|
+
return inside;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* A run measured by the context that will draw it.
|
|
170
|
+
*
|
|
171
|
+
* Falls back to the shared one before this surface has mounted, which
|
|
172
|
+
* agrees with it: text metrics read nothing from a canvas but its
|
|
173
|
+
* `font`.
|
|
174
|
+
*/
|
|
175
|
+
const measureText = (props) => {
|
|
176
|
+
const context = canvasRef.current?.getContext('2d');
|
|
177
|
+
if (context)
|
|
178
|
+
return measureWith(context, props);
|
|
179
|
+
return measureCanvasText(props) ?? { width: 0, ascent: 0, descent: 0 };
|
|
180
|
+
};
|
|
181
|
+
const hitAt = (point) => hitTestCanvas(scene, point, { width: size.width, height: size.height, viewBox, fit }, isInteractive, { pathContains: pathHitTest, measureText });
|
|
182
|
+
const onPointerDown = (event) => {
|
|
183
|
+
pressedTargets.current.delete(event.pointerId);
|
|
184
|
+
if (!event.isPrimary || (event.button !== 0 && event.button !== 1))
|
|
185
|
+
return;
|
|
186
|
+
const hit = hitAt(surfacePoint(event));
|
|
187
|
+
if (!hit)
|
|
188
|
+
return;
|
|
189
|
+
if (event.button === 1 && interactions.destination(hit.id))
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
pressedTargets.current.set(event.pointerId, hit.id);
|
|
192
|
+
if (event.pointerType === 'touch') {
|
|
193
|
+
activate(hit.id, canvasPressEvent(hit.point, surfacePoint(event)));
|
|
194
|
+
}
|
|
195
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
196
|
+
};
|
|
197
|
+
const onPointerUp = (event) => {
|
|
198
|
+
const startedTarget = pressedTargets.current.get(event.pointerId);
|
|
199
|
+
pressedTargets.current.delete(event.pointerId);
|
|
200
|
+
if (!startedTarget)
|
|
201
|
+
return;
|
|
202
|
+
const point = surfacePoint(event);
|
|
203
|
+
const hit = hitAt(point);
|
|
204
|
+
// The finger has gone, so it indicates nothing -- whether or not the
|
|
205
|
+
// release also counted as a press.
|
|
206
|
+
if (event.pointerType === 'touch')
|
|
207
|
+
activate(undefined, undefined);
|
|
208
|
+
if (!hit || hit.id !== startedTarget)
|
|
209
|
+
return;
|
|
210
|
+
const pressEvent = canvasPressEvent(hit.point, point, event);
|
|
211
|
+
const destination = press(hit.id, pressEvent);
|
|
212
|
+
if (!destination)
|
|
213
|
+
return;
|
|
214
|
+
const newContext = event.button === 1 || event.ctrlKey || event.metaKey || event.shiftKey;
|
|
215
|
+
if (newContext || destination.external) {
|
|
216
|
+
window.open(destination.href, '_blank', 'noopener,noreferrer');
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
void activateHozoNavigation(navigation, destination, (href) => window.location.assign(href));
|
|
220
|
+
};
|
|
221
|
+
const onPointerCancel = (event) => {
|
|
222
|
+
pressedTargets.current.delete(event.pointerId);
|
|
223
|
+
activate(undefined, undefined);
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* What a mouse or a pen indicates by being over it.
|
|
227
|
+
*
|
|
228
|
+
* `pointerType` decides whether this counts, and it has to: a finger
|
|
229
|
+
* emits `pointermove` too, but only while it is touching, so treating
|
|
230
|
+
* that as hover would make a tap indicate the shape it landed on and
|
|
231
|
+
* keep indicating it after the finger left. Touch indicates by holding
|
|
232
|
+
* instead, which is what the press handlers below do.
|
|
233
|
+
*/
|
|
234
|
+
const onPointerMove = (event) => {
|
|
235
|
+
if (event.pointerType === 'touch')
|
|
236
|
+
return;
|
|
237
|
+
const point = surfacePoint(event);
|
|
238
|
+
const hit = hitAt(point);
|
|
239
|
+
activate(hit?.id, hit ? canvasPressEvent(hit.point, point) : undefined);
|
|
240
|
+
};
|
|
241
|
+
const onPointerLeave = () => activate(undefined, undefined);
|
|
242
|
+
// Warned always rather than in development only: this package has no
|
|
243
|
+
// build-time channel to say it in, and a control nobody can reach is
|
|
244
|
+
// not a development-only problem. `canvasControls` says it once per
|
|
245
|
+
// shape.
|
|
246
|
+
// Memoised on the scene, which is the only thing that can change the
|
|
247
|
+
// answer. Without this it walked every node on every render of the
|
|
248
|
+
// surface -- a second full traversal beside the snapshot and the
|
|
249
|
+
// redraw, for a list that changes only when a shape is added, removed
|
|
250
|
+
// or renamed.
|
|
251
|
+
//
|
|
252
|
+
// `interactions` is a stable store rather than a value, so it is not a
|
|
253
|
+
// dependency: a handler arriving or leaving mutates it without a new
|
|
254
|
+
// scene. That is why the list is rebuilt whenever the scene is, which
|
|
255
|
+
// is also when a shape's presence could have changed.
|
|
256
|
+
// Only in `label` mode, and that is the whole condition. A
|
|
257
|
+
// `decorative` surface has said it carries no information and a
|
|
258
|
+
// surface with an `accessibleFallback` has supplied it; second-guessing
|
|
259
|
+
// either would be arguing with an author who already answered. What is
|
|
260
|
+
// left is the one where a single name stands for a drawing, and the
|
|
261
|
+
// drawing has words the name does not.
|
|
262
|
+
if (accessibilityMode === 'label') {
|
|
263
|
+
reportUnreadableText(canvasUnreadableText(scene, accessibilityLabel), (message) => console.warn(`[hozo] ${message}`));
|
|
264
|
+
}
|
|
265
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: the registry revision intentionally invalidates semantic controls without redrawing the scene
|
|
266
|
+
const controls = useMemo(() => canvasControls(scene, interactions, (message) => console.warn(`[hozo] ${message}`)), [scene, interactions, interactionRevision]);
|
|
267
|
+
/**
|
|
268
|
+
* Where a keyboard "is" when it reaches a shape.
|
|
269
|
+
*
|
|
270
|
+
* Its centre in scene coordinates, and the same in surface coordinates
|
|
271
|
+
* only because there is nothing better: a keyboard has no cursor, and a
|
|
272
|
+
* tooltip still has to be told somewhere to appear. A chart that wants
|
|
273
|
+
* to place it from the datum rather than from the point already knows
|
|
274
|
+
* which shape it is.
|
|
275
|
+
*/
|
|
276
|
+
const pointFor = (id) => canvasNodePoint(scene, id, { width: size.width, height: size.height, viewBox, fit }) ?? {
|
|
277
|
+
point: { x: 0, y: 0 },
|
|
278
|
+
surfacePoint: { x: 0, y: 0 },
|
|
279
|
+
};
|
|
280
|
+
return (_jsxs(_Fragment, { children: [_jsx("canvas", { ref: canvasRef, className: className, style: rootStyle, width: Math.max(1, Math.round(size.width * size.pixelRatio)), height: Math.max(1, Math.round(size.height * size.pixelRatio)), "aria-hidden": accessibilityMode === 'label' ? undefined : true, "aria-label": accessibilityMode === 'label' ? accessibilityLabel : undefined, role: accessibilityMode === 'label' ? 'img' : undefined, "data-testid": testID, onPointerDown: onPointerDown, onPointerUp: onPointerUp, onPointerCancel: onPointerCancel, onPointerMove: onPointerMove, onPointerLeave: onPointerLeave, onLostPointerCapture: onPointerCancel, children: collector }), controls.length > 0 ? (_jsx("div", { style: accessibleOnlyStyle, "data-hozo-canvas-controls": "", children: controls.map((control) => {
|
|
281
|
+
const point = pointFor(control.id);
|
|
282
|
+
if (control.destination) {
|
|
283
|
+
return (_jsx("a", { href: control.destination.href, target: control.destination.external ? '_blank' : undefined, rel: control.destination.external ? 'noreferrer noopener' : undefined, "data-hozo-navigation-replace": control.destination.replace ? '' : undefined, onClick: (event) => {
|
|
284
|
+
const pressEvent = canvasPressEvent(point.point, point.surfacePoint, event);
|
|
285
|
+
press(control.id, pressEvent);
|
|
286
|
+
if (pressEvent.defaultPrevented)
|
|
287
|
+
event.preventDefault();
|
|
288
|
+
}, onFocus: () => activate(control.id, canvasPressEvent(point.point, point.surfacePoint)), onBlur: () => activate(undefined, undefined), children: control.label }, control.id));
|
|
289
|
+
}
|
|
290
|
+
return (_jsx("button", { type: "button", onClick: () => press(control.id, canvasPressEvent(point.point, point.surfacePoint)), onFocus: () => activate(control.id, canvasPressEvent(point.point, point.surfacePoint)), onBlur: () => activate(undefined, undefined), children: control.label }, control.id));
|
|
291
|
+
}) })) : null, accessibilityMode === 'fallback' ? (_jsx("div", { style: accessibleOnlyStyle, role: accessibilityLabel ? 'group' : undefined, "aria-label": accessibilityLabel, "data-hozo-canvas-fallback": "", children: accessibleFallback })) : null] }));
|
|
292
|
+
}
|
|
293
|
+
const accessibleOnlyStyle = {
|
|
294
|
+
position: 'absolute',
|
|
295
|
+
width: 1,
|
|
296
|
+
height: 1,
|
|
297
|
+
padding: 0,
|
|
298
|
+
margin: -1,
|
|
299
|
+
overflow: 'hidden',
|
|
300
|
+
clip: 'rect(0, 0, 0, 0)',
|
|
301
|
+
clipPath: 'inset(50%)',
|
|
302
|
+
whiteSpace: 'nowrap',
|
|
303
|
+
border: 0,
|
|
304
|
+
};
|
|
305
|
+
/** Canvas root plus its platform-neutral scene vocabulary. */
|
|
306
|
+
export const Canvas = Object.assign(Root, {
|
|
307
|
+
Group,
|
|
308
|
+
Clip,
|
|
309
|
+
Text,
|
|
310
|
+
Rect,
|
|
311
|
+
RoundedRect,
|
|
312
|
+
Circle,
|
|
313
|
+
Ellipse,
|
|
314
|
+
Line,
|
|
315
|
+
Path,
|
|
316
|
+
});
|
|
317
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACnF,OAAO,EAIL,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAA;AAEd,OAAO,EAAiC,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC3F,OAAO,EAGL,eAAe,EACf,aAAa,GACd,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EACL,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,oBAAoB,EACpB,IAAI,EAEJ,cAAc,GACf,MAAM,YAAa,CAAA;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAGzC,OAAO,EAQL,aAAa,GACd,MAAM,eAAe,CAAA;AACtB,OAAO,EAAuB,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAkB3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAa,CAAA;AAC9C,qEAAqE;AACrE,qEAAqE;AACrE,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,OAAiC,EAAE,KAAgB;IACtE,OAAO,CAAC,IAAI,EAAE,CAAA;IACd,OAAO,CAAC,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACtC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E,CACP,CAAC,CAAC,CAAC,IAAI,EACP,iBAAiB,KAAK,UAAU,CAAC,CAAC,CAAC,CAClC,cACE,KAAK,EAAE,mBAAmB,EAC1B,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,gBAClC,kBAAkB,+BACJ,EAAE,YAE3B,kBAAkB,GACf,CACP,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,CAAA;AACH,CAAC;AAED,MAAM,mBAAmB,GAAkB;IACzC,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC,CAAC;IACV,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,YAAY;IACtB,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,CAAC;CACV,CAAA;AAED,8DAA8D;AAC9D,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;IACxC,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,WAAW;IACX,MAAM;IACN,OAAO;IACP,IAAI;IAEJ,IAAI;CACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type CanvasAccessibilityProps } from './accessibility.ts';
|
|
4
|
+
import { type CanvasTextMetrics } from './hit-test.ts';
|
|
5
|
+
import { Clip, Group, type TextProps } from './scene.tsx';
|
|
6
|
+
export type { CanvasAccessibilityProps, CanvasAccessibleFallback } from './accessibility.ts';
|
|
7
|
+
export { type CanvasHitTestResult, type CanvasHitTestViewport, type CanvasPathHitTest, type CanvasPoint, type CanvasRendererQueries, type CanvasTextMeasure, type CanvasTextMetrics, hitTestCanvas, } from './hit-test.ts';
|
|
8
|
+
export type { CanvasDestination, CanvasInteractionProps, CanvasPaintProps, CanvasPressEvent, CanvasScene, CanvasSceneNode, CanvasTransform, CircleProps, ClipProps, EllipseProps, GroupProps, LineProps, PathProps, RectProps, RoundedRectProps, } from './scene.tsx';
|
|
9
|
+
export { CanvasSceneStore } from './scene.tsx';
|
|
10
|
+
export type { CanvasViewport } from './viewport.ts';
|
|
11
|
+
export { textLines, wrapText } from './wrap-text.ts';
|
|
12
|
+
export type CanvasProps = CanvasAccessibilityProps & {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: StyleProp<ViewStyle>;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
viewBox?: readonly [x: number, y: number, width: number, height: number];
|
|
19
|
+
fit?: 'contain' | 'stretch';
|
|
20
|
+
testID?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The lines a label would be broken into at a given width.
|
|
24
|
+
*
|
|
25
|
+
* The same rule `maxWidth` follows, for a caller doing its own layout:
|
|
26
|
+
* sizing a card around a legend, deciding how tall a row has to be,
|
|
27
|
+
* placing something under the last line. Withholding it would leave
|
|
28
|
+
* those to a guess, which is what this package did with the
|
|
29
|
+
* measurement until it stopped.
|
|
30
|
+
*
|
|
31
|
+
* `undefined` where there is no renderer to measure with, as
|
|
32
|
+
* `measureCanvasText` is and for the same reason.
|
|
33
|
+
*/
|
|
34
|
+
export declare function wrapCanvasText(props: TextProps, maxWidth: number): string[] | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* What a label will occupy, for a caller placing something against it.
|
|
37
|
+
*
|
|
38
|
+
* Skia's `measureText` returns a rect whose origin is the baseline, so
|
|
39
|
+
* its `y` is the ascent negated and `y + height` is the descent. Ink
|
|
40
|
+
* again, and the same font object the renderer draws with -- a second
|
|
41
|
+
* face resolved separately could measure a different width.
|
|
42
|
+
*
|
|
43
|
+
* Optional to match the Web signature, where there may be no DOM to
|
|
44
|
+
* measure with. Native always has a font manager, so this side always
|
|
45
|
+
* answers; one shape for one API rather than two a caller has to know
|
|
46
|
+
* apart.
|
|
47
|
+
*/
|
|
48
|
+
export declare function measureCanvasText(props: TextProps): CanvasTextMetrics | undefined;
|
|
49
|
+
declare function Root({ children, className, style, width, height, viewBox, fit, decorative, accessibilityLabel, accessibleFallback, testID, }: CanvasProps): import("react").JSX.Element;
|
|
50
|
+
/** Canvas root plus the same scene vocabulary exported on Web. */
|
|
51
|
+
export declare const Canvas: typeof Root & {
|
|
52
|
+
Group: typeof Group;
|
|
53
|
+
Clip: typeof Clip;
|
|
54
|
+
Text: {
|
|
55
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: TextProps): null;
|
|
56
|
+
displayName: string;
|
|
57
|
+
};
|
|
58
|
+
Rect: {
|
|
59
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").RectProps): null;
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
62
|
+
RoundedRect: {
|
|
63
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").RoundedRectProps): null;
|
|
64
|
+
displayName: string;
|
|
65
|
+
};
|
|
66
|
+
Circle: {
|
|
67
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").CircleProps): null;
|
|
68
|
+
displayName: string;
|
|
69
|
+
};
|
|
70
|
+
Ellipse: {
|
|
71
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").EllipseProps): null;
|
|
72
|
+
displayName: string;
|
|
73
|
+
};
|
|
74
|
+
Line: {
|
|
75
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").LineProps): null;
|
|
76
|
+
displayName: string;
|
|
77
|
+
};
|
|
78
|
+
Path: {
|
|
79
|
+
({ onPress, onActiveChange, accessibilityLabel, disabled, href, external, replace, ...props }: import("./scene.tsx").PathProps): null;
|
|
80
|
+
displayName: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../src/index.native.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAsB,KAAK,SAAS,EAA6B,MAAM,OAAO,CAAA;AACrF,OAAO,EAKL,KAAK,SAAS,EAId,KAAK,SAAS,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,KAAK,wBAAwB,EAA2B,MAAM,oBAAoB,CAAA;AAC3F,OAAO,EAEL,KAAK,iBAAiB,EAGvB,MAAM,eAAe,CAAA;AACtB,OAAO,EASL,IAAI,EAMJ,KAAK,EASL,KAAK,SAAS,EAIf,MAAM,aAAa,CAAA;AAGpB,YAAY,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,aAAa,GACd,MAAM,eAAe,CAAA;AACtB,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,SAAS,EACT,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,gBAAgB,GACjB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAInD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG,wBAAwB,GAAG;IACnD,QAAQ,CAAC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