@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,213 @@
1
+ import { cssFontShorthand, isGradient, paintFills, paintStrokes, unhandledShape, } from './scene.js';
2
+ import { textLines } from './wrap-text.js';
3
+ function applyTransform(context, transform) {
4
+ if (!transform)
5
+ return;
6
+ const originX = transform.originX ?? 0;
7
+ const originY = transform.originY ?? 0;
8
+ context.translate(transform.translateX ?? 0, transform.translateY ?? 0);
9
+ if (originX !== 0 || originY !== 0)
10
+ context.translate(originX, originY);
11
+ if (transform.rotate)
12
+ context.rotate((transform.rotate * Math.PI) / 180);
13
+ context.scale(transform.scaleX ?? 1, transform.scaleY ?? 1);
14
+ if (originX !== 0 || originY !== 0)
15
+ context.translate(-originX, -originY);
16
+ }
17
+ /**
18
+ * A paint as Canvas2D wants it: a colour string, or a gradient object.
19
+ *
20
+ * Built per draw rather than cached. A gradient belongs to the context
21
+ * and to the transform in force when it was made, so one kept across
22
+ * frames would paint against a transform that has moved.
23
+ */
24
+ function paintStyle(context, paint) {
25
+ if (!isGradient(paint))
26
+ return paint;
27
+ const gradient = paint.kind === 'linear'
28
+ ? context.createLinearGradient(paint.from.x, paint.from.y, paint.to.x, paint.to.y)
29
+ : // The inner radius is zero and the two centres are the same,
30
+ // which is the single-circle form both platforms share.
31
+ context.createRadialGradient(paint.center.x, paint.center.y, 0, paint.center.x, paint.center.y, paint.radius);
32
+ for (const stop of paint.stops)
33
+ gradient.addColorStop(stop.offset, stop.color);
34
+ return gradient;
35
+ }
36
+ function applyPaint(context, paint) {
37
+ context.globalAlpha *= paint.opacity ?? 1;
38
+ if (paint.fill && paint.fill !== 'none')
39
+ context.fillStyle = paintStyle(context, paint.fill);
40
+ if (paint.stroke && paint.stroke !== 'none') {
41
+ context.strokeStyle = paintStyle(context, paint.stroke);
42
+ }
43
+ if (paint.strokeWidth !== undefined)
44
+ context.lineWidth = paint.strokeWidth;
45
+ if (paint.lineCap)
46
+ context.lineCap = paint.lineCap;
47
+ if (paint.lineJoin)
48
+ context.lineJoin = paint.lineJoin;
49
+ }
50
+ function paints(paint, context, fillRule) {
51
+ if (paintFills(paint))
52
+ context.fill(fillRule);
53
+ if (paintStrokes(paint))
54
+ context.stroke();
55
+ }
56
+ function pathForClip(context, props) {
57
+ if (props.path !== undefined) {
58
+ if (typeof Path2D === 'undefined') {
59
+ throw new Error('This browser does not support Path2D, which Canvas.Path and path clips require.');
60
+ }
61
+ context.clip(new Path2D(props.path));
62
+ return;
63
+ }
64
+ context.beginPath();
65
+ context.rect(props.x ?? 0, props.y ?? 0, props.width ?? 0, props.height ?? 0);
66
+ context.clip();
67
+ }
68
+ function drawNode(context, node) {
69
+ context.save();
70
+ try {
71
+ switch (node.kind) {
72
+ case 'group':
73
+ context.globalAlpha *= node.props.opacity ?? 1;
74
+ applyTransform(context, node.props.transform);
75
+ for (const child of node.children)
76
+ drawNode(context, child);
77
+ return;
78
+ case 'clip':
79
+ pathForClip(context, node.props);
80
+ for (const child of node.children)
81
+ drawNode(context, child);
82
+ return;
83
+ case 'rect': {
84
+ applyPaint(context, node.props);
85
+ context.beginPath();
86
+ context.rect(node.props.x ?? 0, node.props.y ?? 0, node.props.width, node.props.height);
87
+ paints(node.props, context);
88
+ return;
89
+ }
90
+ case 'rounded-rect': {
91
+ applyPaint(context, node.props);
92
+ context.beginPath();
93
+ const roundRect = context.roundRect;
94
+ if (typeof roundRect === 'function') {
95
+ roundRect.call(context, node.props.x ?? 0, node.props.y ?? 0, node.props.width, node.props.height, node.props.radius);
96
+ }
97
+ else {
98
+ // Older embedded WebViews get a correct shape, not a hard failure.
99
+ const x = node.props.x ?? 0;
100
+ const y = node.props.y ?? 0;
101
+ const radius = Math.min(node.props.radius, node.props.width / 2, node.props.height / 2);
102
+ context.moveTo(x + radius, y);
103
+ context.arcTo(x + node.props.width, y, x + node.props.width, y + node.props.height, radius);
104
+ context.arcTo(x + node.props.width, y + node.props.height, x, y + node.props.height, radius);
105
+ context.arcTo(x, y + node.props.height, x, y, radius);
106
+ context.arcTo(x, y, x + node.props.width, y, radius);
107
+ context.closePath();
108
+ }
109
+ paints(node.props, context);
110
+ return;
111
+ }
112
+ case 'circle':
113
+ applyPaint(context, node.props);
114
+ context.beginPath();
115
+ context.arc(node.props.cx, node.props.cy, node.props.radius, 0, Math.PI * 2);
116
+ paints(node.props, context);
117
+ return;
118
+ case 'ellipse':
119
+ applyPaint(context, node.props);
120
+ context.beginPath();
121
+ context.ellipse(node.props.cx, node.props.cy, node.props.radiusX, node.props.radiusY, 0, 0, Math.PI * 2);
122
+ paints(node.props, context);
123
+ return;
124
+ case 'line':
125
+ applyPaint(context, node.props);
126
+ context.beginPath();
127
+ context.moveTo(node.props.x1, node.props.y1);
128
+ context.lineTo(node.props.x2, node.props.y2);
129
+ // A line is stroke-only; `fill` is accepted as part of the common
130
+ // paint contract but intentionally has no geometrical meaning here.
131
+ if (node.props.stroke !== 'none' && (node.props.strokeWidth ?? 1) > 0)
132
+ context.stroke();
133
+ return;
134
+ case 'text': {
135
+ // `textAlign` is set on the context rather than measured here:
136
+ // that is the renderer aligning against its own metrics, which is
137
+ // the only measurement that can agree with what it rasterises.
138
+ // `textBaseline` is left alone -- alphabetic is its default and
139
+ // is the anchor `TextProps` documents.
140
+ context.font = cssFontShorthand(node.props);
141
+ context.textAlign = node.props.textAlign ?? 'left';
142
+ applyPaint(context, node.props);
143
+ // Wrapped against this context, which is the one about to
144
+ // rasterise the glyphs. The font is set above, so the widths the
145
+ // breaker asks for are the widths it will draw with.
146
+ const lines = textLines(node.props, (run) => context.measureText(run).width);
147
+ for (const line of lines) {
148
+ if (paintFills(node.props))
149
+ context.fillText(line.text, node.props.x, line.y);
150
+ if (paintStrokes(node.props))
151
+ context.strokeText(line.text, node.props.x, line.y);
152
+ }
153
+ return;
154
+ }
155
+ case 'path': {
156
+ if (typeof Path2D === 'undefined') {
157
+ throw new Error('This browser does not support Path2D, which Canvas.Path requires.');
158
+ }
159
+ applyPaint(context, node.props);
160
+ const path = new Path2D(node.props.path);
161
+ const hasFill = node.props.fill !== 'none' &&
162
+ (node.props.fill !== undefined || node.props.stroke === undefined);
163
+ const hasStroke = node.props.stroke !== undefined && node.props.stroke !== 'none';
164
+ if (hasFill)
165
+ context.fill(path, node.props.fillRule);
166
+ if (hasStroke)
167
+ context.stroke(path);
168
+ return;
169
+ }
170
+ default:
171
+ unhandledShape(node, 'the Canvas2D renderer');
172
+ }
173
+ }
174
+ finally {
175
+ context.restore();
176
+ }
177
+ }
178
+ /** Draws one immutable scene snapshot. Exported for custom renderers and deterministic tests. */
179
+ export function renderCanvas2D(context, scene, viewport) {
180
+ const pixelRatio = Math.max(1, viewport.pixelRatio || 1);
181
+ context.setTransform(1, 0, 0, 1, 0, 0);
182
+ context.clearRect(0, 0, viewport.width * pixelRatio, viewport.height * pixelRatio);
183
+ context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
184
+ context.save();
185
+ try {
186
+ const viewBox = viewport.viewBox;
187
+ if (viewBox) {
188
+ const [, , viewWidth, viewHeight] = viewBox;
189
+ if (viewWidth <= 0 || viewHeight <= 0)
190
+ return;
191
+ const scaleX = viewport.width / viewWidth;
192
+ const scaleY = viewport.height / viewHeight;
193
+ if ((viewport.fit ?? 'contain') === 'stretch') {
194
+ context.scale(scaleX, scaleY);
195
+ context.translate(-viewBox[0], -viewBox[1]);
196
+ }
197
+ else {
198
+ const scale = Math.min(scaleX, scaleY);
199
+ const offsetX = (viewport.width - viewWidth * scale) / 2;
200
+ const offsetY = (viewport.height - viewHeight * scale) / 2;
201
+ context.translate(offsetX, offsetY);
202
+ context.scale(scale, scale);
203
+ context.translate(-viewBox[0], -viewBox[1]);
204
+ }
205
+ }
206
+ for (const node of scene)
207
+ drawNode(context, node);
208
+ }
209
+ finally {
210
+ context.restore();
211
+ }
212
+ }
213
+ //# sourceMappingURL=render-canvas-2d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-canvas-2d.js","sourceRoot":"","sources":["../src/render-canvas-2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,gBAAgB,EAChB,UAAU,EACV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