strata-react 2.1.16 → 2.1.18
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/README.md +4 -0
- package/UPGRADING.md +4 -0
- package/dist/index.d.ts +121 -2
- package/dist/index.js +688 -23
- package/dist/index.js.map +1 -1
- package/dist/{microphone-DWh4OaMH.d.ts → microphone-xGKxcK6p.d.ts} +2 -2
- package/dist/strata.bare.css +10 -0
- package/dist/strata.css +21 -0
- package/dist/strata.migrate.css +10 -0
- package/dist/testing.d.ts +3 -1
- package/dist/testing.js +6 -0
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4481,7 +4481,7 @@ function PlayWindowButton({ media, window: w, label, size = "sm", className }) {
|
|
|
4481
4481
|
|
|
4482
4482
|
// src/components/media-spans.tsx
|
|
4483
4483
|
const lower = (label) => label.charAt(0).toLowerCase() + label.slice(1);
|
|
4484
|
-
const WORDS$
|
|
4484
|
+
const WORDS$3 = {
|
|
4485
4485
|
skip: (l) => `Skip ${lower(l)}`,
|
|
4486
4486
|
skipped: (l) => `Skipped ${lower(l)}`,
|
|
4487
4487
|
mute: (l) => `Mute ${lower(l)}`,
|
|
@@ -4493,7 +4493,7 @@ const NOTICE_MS$1 = 6e3;
|
|
|
4493
4493
|
/** Draws the spans' ranges and acts on them as playback reaches them. See the file comment for the rules. */
|
|
4494
4494
|
function useMediaSpans({ spans, kinds = {}, words, onSpan, time, playing, duration, limit = Infinity, seek, volume, setVolume }) {
|
|
4495
4495
|
const w = {
|
|
4496
|
-
...WORDS$
|
|
4496
|
+
...WORDS$3,
|
|
4497
4497
|
...words
|
|
4498
4498
|
};
|
|
4499
4499
|
const list = React.useMemo(() => {
|
|
@@ -7388,7 +7388,7 @@ const MARK_LINE = {
|
|
|
7388
7388
|
dash: "4 3"
|
|
7389
7389
|
}
|
|
7390
7390
|
};
|
|
7391
|
-
const WORDS$
|
|
7391
|
+
const WORDS$2 = {
|
|
7392
7392
|
running: "Reading the waveform",
|
|
7393
7393
|
finished: "Waveform ready",
|
|
7394
7394
|
failed: "Could not read the waveform"
|
|
@@ -7406,7 +7406,7 @@ async function defaultDecode(data) {
|
|
|
7406
7406
|
const clamp$3 = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
7407
7407
|
const clock = (t) => format.runningTime(t);
|
|
7408
7408
|
/** An audio waveform with marks, spans and a playhead: one slider you click, drag or key to seek, zoom, and a range to select. */
|
|
7409
|
-
function Waveform({ label, peaks, source, duration: given, time, onSeek, marks = [], spans = [], underlay, range: controlledRange, onRangeChange, step = 5, bigStep = 30, defaultView, buckets = 2e3, normalise = false, decode = defaultDecode, words = WORDS$
|
|
7409
|
+
function Waveform({ label, peaks, source, duration: given, time, onSeek, marks = [], spans = [], underlay, range: controlledRange, onRangeChange, step = 5, bigStep = 30, defaultView, buckets = 2e3, normalise = false, decode = defaultDecode, words = WORDS$2, disabled, className }) {
|
|
7410
7410
|
const work = useClientWork(async ({ signal, progress }) => {
|
|
7411
7411
|
const data = typeof source === "string" ? await (await fetch(source, { signal })).arrayBuffer() : await source.arrayBuffer();
|
|
7412
7412
|
progress(0, buckets + 2);
|
|
@@ -15637,14 +15637,21 @@ function speakText(text, { lang, rate = .9, onEnd }) {
|
|
|
15637
15637
|
synth.speak(utterance);
|
|
15638
15638
|
return true;
|
|
15639
15639
|
}
|
|
15640
|
-
function
|
|
15640
|
+
function loadClip(part) {
|
|
15641
|
+
const audio = new Audio();
|
|
15642
|
+
audio.preload = "auto";
|
|
15643
|
+
audio.title = part.text;
|
|
15644
|
+
audio.src = part.clip ?? "";
|
|
15645
|
+
return audio;
|
|
15646
|
+
}
|
|
15647
|
+
function playFrom(parts, i, options, loaded) {
|
|
15641
15648
|
const part = parts[i];
|
|
15642
15649
|
if (!part) {
|
|
15643
15650
|
options.onEnd?.();
|
|
15644
15651
|
return;
|
|
15645
15652
|
}
|
|
15646
|
-
const audio =
|
|
15647
|
-
|
|
15653
|
+
const audio = loaded ?? loadClip(part);
|
|
15654
|
+
const following = parts[i + 1];
|
|
15648
15655
|
let settled = false;
|
|
15649
15656
|
const settle = () => {
|
|
15650
15657
|
if (settled) return false;
|
|
@@ -15661,11 +15668,11 @@ function playFrom(parts, i, options) {
|
|
|
15661
15668
|
options.onEnd?.();
|
|
15662
15669
|
} };
|
|
15663
15670
|
playing = entry;
|
|
15671
|
+
const next = following ? loadClip(following) : void 0;
|
|
15664
15672
|
audio.onended = () => {
|
|
15665
|
-
if (settle()) playFrom(parts, i + 1, options);
|
|
15673
|
+
if (settle()) playFrom(parts, i + 1, options, next);
|
|
15666
15674
|
};
|
|
15667
15675
|
audio.onerror = fallBack;
|
|
15668
|
-
audio.src = part.clip ?? "";
|
|
15669
15676
|
audio.play()?.catch(fallBack);
|
|
15670
15677
|
}
|
|
15671
15678
|
/**
|
|
@@ -21623,9 +21630,9 @@ const HANDLE_AT = {
|
|
|
21623
21630
|
sw: "left-0 bottom-0 -translate-x-1/2 translate-y-1/2",
|
|
21624
21631
|
w: "left-0 top-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
21625
21632
|
};
|
|
21626
|
-
const round$
|
|
21633
|
+
const round$5 = (n) => format.integer(Math.round(n));
|
|
21627
21634
|
/** A window said in words. */
|
|
21628
|
-
const describeRegion = (r) => `${r.label}: ${round$
|
|
21635
|
+
const describeRegion = (r) => `${r.label}: ${round$5(r.w)} wide by ${round$5(r.h)} high, ${round$5(r.x)} across and ${round$5(r.y)} down`;
|
|
21629
21636
|
/** Draw and move one or two named windows on a picture, with pointer, keyboard and numbers kept in step; aspect and bounds hold through all three; two windows make a from/to move with a Watch preview. */
|
|
21630
21637
|
function RegionEditor({ label, children, size, regions, onChange, selectedId, onSelectedChange, aspect, min, bounds, step, onDraw, mode = "single", onPreview, duration = 1500, easing = "ease-in-out", fields = true, unit = "px", defaults, angle = 0, onAngleChange, guide, spreadLabels = {
|
|
21631
21638
|
one: "Page",
|
|
@@ -21826,7 +21833,7 @@ function RegionEditor({ label, children, size, regions, onChange, selectedId, on
|
|
|
21826
21833
|
...regions[1],
|
|
21827
21834
|
...moved[1]
|
|
21828
21835
|
}]);
|
|
21829
|
-
setSaid(`Gutter at ${round$
|
|
21836
|
+
setSaid(`Gutter at ${round$5(gutterOf(moved[0], moved[1]))}: ${spreadLabels.left} ${round$5(moved[0].w)} wide, ${spreadLabels.right} ${round$5(moved[1].w)} wide`);
|
|
21830
21837
|
}
|
|
21831
21838
|
};
|
|
21832
21839
|
const split = () => {
|
|
@@ -22538,7 +22545,7 @@ const STROKE = {
|
|
|
22538
22545
|
warning: "var(--warning)",
|
|
22539
22546
|
danger: "var(--danger)"
|
|
22540
22547
|
};
|
|
22541
|
-
const FILL = {
|
|
22548
|
+
const FILL$1 = {
|
|
22542
22549
|
neutral: "var(--muted)",
|
|
22543
22550
|
info: "var(--info-subtle)",
|
|
22544
22551
|
success: "var(--success-subtle)",
|
|
@@ -22596,7 +22603,7 @@ function BoxOverlay({ label, of, boxes, state, onChoose, fillLit = true }) {
|
|
|
22596
22603
|
y: b.y,
|
|
22597
22604
|
width: b.w,
|
|
22598
22605
|
height: b.h,
|
|
22599
|
-
fill: filled ? FILL[tone] : "none",
|
|
22606
|
+
fill: filled ? FILL$1[tone] : "none",
|
|
22600
22607
|
fillOpacity: filled ? .25 : void 0,
|
|
22601
22608
|
stroke: STROKE[tone],
|
|
22602
22609
|
strokeWidth: on ? 3 : 1.5,
|
|
@@ -23886,7 +23893,7 @@ function clockParts(face = "teaching", over = {}) {
|
|
|
23886
23893
|
minuteNumbers: over.minuteNumbers ?? p.minuteNumbers
|
|
23887
23894
|
};
|
|
23888
23895
|
}
|
|
23889
|
-
const WORDS = [
|
|
23896
|
+
const WORDS$1 = [
|
|
23890
23897
|
"twelve",
|
|
23891
23898
|
"one",
|
|
23892
23899
|
"two",
|
|
@@ -23949,7 +23956,7 @@ function dayPart(hours) {
|
|
|
23949
23956
|
*/
|
|
23950
23957
|
function clockWords(hours, minutes, options = {}) {
|
|
23951
23958
|
const m = (Math.round(minutes) % 60 + 60) % 60;
|
|
23952
|
-
const hour = (n) => WORDS[(n % 12 + 12) % 12];
|
|
23959
|
+
const hour = (n) => WORDS$1[(n % 12 + 12) % 12];
|
|
23953
23960
|
let said;
|
|
23954
23961
|
if (m === 0) said = `${hour(hours)} o’clock`;
|
|
23955
23962
|
else if (m === 30) said = `half past ${hour(hours)}`;
|
|
@@ -24646,7 +24653,7 @@ const FRACTION_OUTLINES = [
|
|
|
24646
24653
|
"rectangle",
|
|
24647
24654
|
"triangle"
|
|
24648
24655
|
];
|
|
24649
|
-
const R = 92;
|
|
24656
|
+
const R$1 = 92;
|
|
24650
24657
|
const C = 100;
|
|
24651
24658
|
const RECT = {
|
|
24652
24659
|
x: 6,
|
|
@@ -24665,8 +24672,8 @@ const TRIANGLE = [
|
|
|
24665
24672
|
[192, 182],
|
|
24666
24673
|
[8, 182]
|
|
24667
24674
|
];
|
|
24668
|
-
const poly = (points) => `M${points.map(([x, y]) => `${round(x)} ${round(y)}`).join(" L")} Z`;
|
|
24669
|
-
const round = (n) => Math.round(n * 100) / 100;
|
|
24675
|
+
const poly = (points) => `M${points.map(([x, y]) => `${round$4(x)} ${round$4(y)}`).join(" L")} Z`;
|
|
24676
|
+
const round$4 = (n) => Math.round(n * 100) / 100;
|
|
24670
24677
|
const mid = (a, b) => [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];
|
|
24671
24678
|
const lerp = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
|
|
24672
24679
|
/** Cut points from 0 to 1: equal, or (unequal) each part one size bigger than the one before. */
|
|
@@ -24679,14 +24686,14 @@ function stops(parts, unequal) {
|
|
|
24679
24686
|
return out;
|
|
24680
24687
|
}
|
|
24681
24688
|
function slices(parts, unequal) {
|
|
24682
|
-
if (parts === 1) return [`M8 ${C} A${R} ${R} 0 1 1 192 ${C} A${R} ${R} 0 1 1 8 ${C} Z`];
|
|
24683
|
-
const at = (t) => [C + R * Math.sin(t * 2 * Math.PI), C - R * Math.cos(t * 2 * Math.PI)];
|
|
24689
|
+
if (parts === 1) return [`M8 ${C} A${R$1} ${R$1} 0 1 1 192 ${C} A${R$1} ${R$1} 0 1 1 8 ${C} Z`];
|
|
24690
|
+
const at = (t) => [C + R$1 * Math.sin(t * 2 * Math.PI), C - R$1 * Math.cos(t * 2 * Math.PI)];
|
|
24684
24691
|
const s = stops(parts, unequal);
|
|
24685
24692
|
return s.slice(1).map((end, i) => {
|
|
24686
24693
|
const [x0, y0] = at(s[i]);
|
|
24687
24694
|
const [x1, y1] = at(end);
|
|
24688
24695
|
const large = end - s[i] > .5 ? 1 : 0;
|
|
24689
|
-
return `M${C} ${C} L${round(x0)} ${round(y0)} A${R} ${R} 0 ${large} 1 ${round(x1)} ${round(y1)} Z`;
|
|
24696
|
+
return `M${C} ${C} L${round$4(x0)} ${round$4(y0)} A${R$1} ${R$1} 0 ${large} 1 ${round$4(x1)} ${round$4(y1)} Z`;
|
|
24690
24697
|
});
|
|
24691
24698
|
}
|
|
24692
24699
|
function boxParts(box, parts, cut) {
|
|
@@ -25112,5 +25119,663 @@ function SetClock({ value, onChange, step = 5, geared = true, face = "teaching",
|
|
|
25112
25119
|
});
|
|
25113
25120
|
}
|
|
25114
25121
|
|
|
25115
|
-
|
|
25122
|
+
// src/components/money.tsx
|
|
25123
|
+
/** Every coin, smallest value first. */
|
|
25124
|
+
const COINS = [
|
|
25125
|
+
1,
|
|
25126
|
+
2,
|
|
25127
|
+
5,
|
|
25128
|
+
10,
|
|
25129
|
+
20,
|
|
25130
|
+
50,
|
|
25131
|
+
100,
|
|
25132
|
+
200
|
|
25133
|
+
];
|
|
25134
|
+
/** Every note a Year 1 learner meets, smallest first. */
|
|
25135
|
+
const NOTES = [
|
|
25136
|
+
500,
|
|
25137
|
+
1e3,
|
|
25138
|
+
2e3
|
|
25139
|
+
];
|
|
25140
|
+
const COIN = {
|
|
25141
|
+
1: {
|
|
25142
|
+
mm: 20.3,
|
|
25143
|
+
outline: "round",
|
|
25144
|
+
metal: "copper"
|
|
25145
|
+
},
|
|
25146
|
+
2: {
|
|
25147
|
+
mm: 25.9,
|
|
25148
|
+
outline: "round",
|
|
25149
|
+
metal: "copper"
|
|
25150
|
+
},
|
|
25151
|
+
5: {
|
|
25152
|
+
mm: 18,
|
|
25153
|
+
outline: "round",
|
|
25154
|
+
metal: "silver"
|
|
25155
|
+
},
|
|
25156
|
+
10: {
|
|
25157
|
+
mm: 24.5,
|
|
25158
|
+
outline: "round",
|
|
25159
|
+
metal: "silver"
|
|
25160
|
+
},
|
|
25161
|
+
20: {
|
|
25162
|
+
mm: 21.4,
|
|
25163
|
+
outline: "seven",
|
|
25164
|
+
metal: "silver"
|
|
25165
|
+
},
|
|
25166
|
+
50: {
|
|
25167
|
+
mm: 27.3,
|
|
25168
|
+
outline: "seven",
|
|
25169
|
+
metal: "silver"
|
|
25170
|
+
},
|
|
25171
|
+
100: {
|
|
25172
|
+
mm: 23.43,
|
|
25173
|
+
outline: "twelve",
|
|
25174
|
+
metal: "gold",
|
|
25175
|
+
centre: "silver"
|
|
25176
|
+
},
|
|
25177
|
+
200: {
|
|
25178
|
+
mm: 28.4,
|
|
25179
|
+
outline: "round",
|
|
25180
|
+
metal: "gold",
|
|
25181
|
+
centre: "silver"
|
|
25182
|
+
}
|
|
25183
|
+
};
|
|
25184
|
+
const LARGEST = 28.4;
|
|
25185
|
+
const FILL = {
|
|
25186
|
+
copper: "fill-coin-copper",
|
|
25187
|
+
silver: "fill-coin-silver",
|
|
25188
|
+
gold: "fill-coin-gold"
|
|
25189
|
+
};
|
|
25190
|
+
const round$3 = (n) => Math.round(n * 100) / 100;
|
|
25191
|
+
/** The outline of a coin of radius `r` about (100, 100) as an SVG path: a circle, a Reuleaux heptagon (20p and 50p,
|
|
25192
|
+
* seven arcs each centred on the opposite corner, so the coin is the same width every way) or a twelve-sided polygon. */
|
|
25193
|
+
function coinOutline(outline, r) {
|
|
25194
|
+
if (outline === "round") return `M${100 - r} 100 A${r} ${r} 0 1 1 ${100 + r} 100 A${r} ${r} 0 1 1 ${100 - r} 100 Z`;
|
|
25195
|
+
const n = outline === "seven" ? 7 : 12;
|
|
25196
|
+
const at = (i) => {
|
|
25197
|
+
const t = i / n * 2 * Math.PI;
|
|
25198
|
+
return [round$3(100 + r * Math.sin(t)), round$3(100 - r * Math.cos(t))];
|
|
25199
|
+
};
|
|
25200
|
+
const corners = Array.from({ length: n }, (_, i) => at(i));
|
|
25201
|
+
if (n === 12) return `M${corners.map(([x, y]) => `${x} ${y}`).join(" L")} Z`;
|
|
25202
|
+
const [ax, ay] = corners[0];
|
|
25203
|
+
const [bx, by] = corners[3];
|
|
25204
|
+
const d = round$3(Math.hypot(ax - bx, ay - by));
|
|
25205
|
+
return `M${ax} ${ay} ${corners.slice(1).concat([corners[0]]).map(([x, y]) => `A${d} ${d} 0 0 1 ${x} ${y}`).join(" ")} Z`;
|
|
25206
|
+
}
|
|
25207
|
+
/** A value as it is written on a coin or a note: "20p", "£1", "£10". */
|
|
25208
|
+
function moneyWords(pence) {
|
|
25209
|
+
return pence < 100 ? `${pence}p` : `£${pence / 100}`;
|
|
25210
|
+
}
|
|
25211
|
+
/** A UK coin or note, drawn: its outline, its metal and its value. */
|
|
25212
|
+
function Money({ pence, toScale = false, label, className }) {
|
|
25213
|
+
const written = moneyWords(pence);
|
|
25214
|
+
const coin = COIN[pence];
|
|
25215
|
+
const said = label ?? `A ${written} ${coin ? "coin" : "note"}`;
|
|
25216
|
+
if (!coin) return /* @__PURE__ */ jsxs("svg", {
|
|
25217
|
+
viewBox: "0 0 200 110",
|
|
25218
|
+
role: "img",
|
|
25219
|
+
"aria-label": said,
|
|
25220
|
+
className: cn("block w-full", className),
|
|
25221
|
+
children: [
|
|
25222
|
+
/* @__PURE__ */ jsx("rect", {
|
|
25223
|
+
x: 4,
|
|
25224
|
+
y: 4,
|
|
25225
|
+
width: 192,
|
|
25226
|
+
height: 102,
|
|
25227
|
+
rx: 8,
|
|
25228
|
+
strokeWidth: 3,
|
|
25229
|
+
className: "fill-card stroke-foreground"
|
|
25230
|
+
}),
|
|
25231
|
+
/* @__PURE__ */ jsx("rect", {
|
|
25232
|
+
x: 4,
|
|
25233
|
+
y: 4,
|
|
25234
|
+
width: 46,
|
|
25235
|
+
height: 102,
|
|
25236
|
+
rx: 8,
|
|
25237
|
+
className: "fill-primary"
|
|
25238
|
+
}),
|
|
25239
|
+
/* @__PURE__ */ jsx("rect", {
|
|
25240
|
+
x: 30,
|
|
25241
|
+
y: 4,
|
|
25242
|
+
width: 20,
|
|
25243
|
+
height: 102,
|
|
25244
|
+
className: "fill-primary"
|
|
25245
|
+
}),
|
|
25246
|
+
/* @__PURE__ */ jsx("text", {
|
|
25247
|
+
x: 124,
|
|
25248
|
+
y: 57,
|
|
25249
|
+
textAnchor: "middle",
|
|
25250
|
+
dominantBaseline: "central",
|
|
25251
|
+
fontSize: 52,
|
|
25252
|
+
fontWeight: 700,
|
|
25253
|
+
className: "fill-foreground font-sans",
|
|
25254
|
+
children: written
|
|
25255
|
+
})
|
|
25256
|
+
]
|
|
25257
|
+
});
|
|
25258
|
+
const r = 94 * (toScale ? coin.mm / LARGEST : 1);
|
|
25259
|
+
const outer = coinOutline(coin.outline, r);
|
|
25260
|
+
const centreR = r * .68;
|
|
25261
|
+
const size = written.length > 2 ? .5 : .62;
|
|
25262
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
25263
|
+
viewBox: "0 0 200 200",
|
|
25264
|
+
role: "img",
|
|
25265
|
+
"aria-label": said,
|
|
25266
|
+
className: cn("block aspect-square w-full", className),
|
|
25267
|
+
children: [
|
|
25268
|
+
/* @__PURE__ */ jsx("path", {
|
|
25269
|
+
d: outer,
|
|
25270
|
+
strokeWidth: 3,
|
|
25271
|
+
strokeLinejoin: "round",
|
|
25272
|
+
className: cn(FILL[coin.metal], "stroke-foreground")
|
|
25273
|
+
}),
|
|
25274
|
+
coin.centre ? /* @__PURE__ */ jsx("path", {
|
|
25275
|
+
d: coinOutline("round", centreR),
|
|
25276
|
+
strokeWidth: 2,
|
|
25277
|
+
className: cn(FILL[coin.centre], "stroke-coin-ink"),
|
|
25278
|
+
"data-centre": coin.centre
|
|
25279
|
+
}) : /* @__PURE__ */ jsx("path", {
|
|
25280
|
+
d: coinOutline(coin.outline, r * .86),
|
|
25281
|
+
strokeWidth: 1.5,
|
|
25282
|
+
className: "fill-none stroke-coin-ink"
|
|
25283
|
+
}),
|
|
25284
|
+
/* @__PURE__ */ jsx("text", {
|
|
25285
|
+
x: 100,
|
|
25286
|
+
y: 100,
|
|
25287
|
+
textAnchor: "middle",
|
|
25288
|
+
dominantBaseline: "central",
|
|
25289
|
+
fontSize: round$3(r * size),
|
|
25290
|
+
fontWeight: 700,
|
|
25291
|
+
className: "fill-coin-ink font-sans",
|
|
25292
|
+
children: written
|
|
25293
|
+
})
|
|
25294
|
+
]
|
|
25295
|
+
});
|
|
25296
|
+
}
|
|
25297
|
+
|
|
25298
|
+
// src/components/solid.tsx
|
|
25299
|
+
/** Every shape, in the order a gallery shows them. */
|
|
25300
|
+
const SOLID_SHAPES = [
|
|
25301
|
+
"cube",
|
|
25302
|
+
"cuboid",
|
|
25303
|
+
"sphere",
|
|
25304
|
+
"cylinder",
|
|
25305
|
+
"cone",
|
|
25306
|
+
"pyramid",
|
|
25307
|
+
"prism"
|
|
25308
|
+
];
|
|
25309
|
+
const WORDS = {
|
|
25310
|
+
cube: "A cube",
|
|
25311
|
+
cuboid: "A cuboid",
|
|
25312
|
+
sphere: "A sphere",
|
|
25313
|
+
cylinder: "A cylinder",
|
|
25314
|
+
cone: "A cone",
|
|
25315
|
+
pyramid: "A pyramid",
|
|
25316
|
+
prism: "A triangular prism"
|
|
25317
|
+
};
|
|
25318
|
+
const path = (...points) => `M${points.map(([x, y]) => `${x} ${y}`).join(" L")} Z`;
|
|
25319
|
+
const line = (a, b) => `M${a[0]} ${a[1]} L${b[0]} ${b[1]}`;
|
|
25320
|
+
const TOP$1 = "fill-primary-3";
|
|
25321
|
+
const FRONT = "fill-primary-5";
|
|
25322
|
+
const SIDE = "fill-primary-7";
|
|
25323
|
+
const HIDDEN = {
|
|
25324
|
+
strokeDasharray: "6 6",
|
|
25325
|
+
className: "fill-none stroke-muted-foreground"
|
|
25326
|
+
};
|
|
25327
|
+
/** A box seen from above and to the right: its front corner at (x, y), w wide, h high and d deep (drawn up and right). */
|
|
25328
|
+
function Box({ x, y, w, h, d }) {
|
|
25329
|
+
const dx = d * .7;
|
|
25330
|
+
const dy = -d * .5;
|
|
25331
|
+
const a = [x, y];
|
|
25332
|
+
const b = [x + w, y];
|
|
25333
|
+
const c = [x + w, y + h];
|
|
25334
|
+
const e = [x, y + h];
|
|
25335
|
+
const back = (p) => [p[0] + dx, p[1] + dy];
|
|
25336
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25337
|
+
/* @__PURE__ */ jsx("path", {
|
|
25338
|
+
d: path(a, b, back(b), back(a)),
|
|
25339
|
+
className: TOP$1
|
|
25340
|
+
}),
|
|
25341
|
+
/* @__PURE__ */ jsx("path", {
|
|
25342
|
+
d: path(a, b, c, e),
|
|
25343
|
+
className: FRONT
|
|
25344
|
+
}),
|
|
25345
|
+
/* @__PURE__ */ jsx("path", {
|
|
25346
|
+
d: path(b, back(b), back(c), c),
|
|
25347
|
+
className: SIDE
|
|
25348
|
+
}),
|
|
25349
|
+
/* @__PURE__ */ jsx("path", {
|
|
25350
|
+
d: line(back(e), e),
|
|
25351
|
+
...HIDDEN
|
|
25352
|
+
}),
|
|
25353
|
+
/* @__PURE__ */ jsx("path", {
|
|
25354
|
+
d: line(back(e), back(a)),
|
|
25355
|
+
...HIDDEN
|
|
25356
|
+
}),
|
|
25357
|
+
/* @__PURE__ */ jsx("path", {
|
|
25358
|
+
d: line(back(e), back(c)),
|
|
25359
|
+
...HIDDEN
|
|
25360
|
+
})
|
|
25361
|
+
] });
|
|
25362
|
+
}
|
|
25363
|
+
function Drawing({ shape }) {
|
|
25364
|
+
switch (shape) {
|
|
25365
|
+
case "cube": return /* @__PURE__ */ jsx(Box, {
|
|
25366
|
+
x: 30,
|
|
25367
|
+
y: 70,
|
|
25368
|
+
w: 110,
|
|
25369
|
+
h: 110,
|
|
25370
|
+
d: 60
|
|
25371
|
+
});
|
|
25372
|
+
case "cuboid": return /* @__PURE__ */ jsx(Box, {
|
|
25373
|
+
x: 12,
|
|
25374
|
+
y: 95,
|
|
25375
|
+
w: 140,
|
|
25376
|
+
h: 80,
|
|
25377
|
+
d: 60
|
|
25378
|
+
});
|
|
25379
|
+
case "sphere": return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25380
|
+
/* @__PURE__ */ jsx("circle", {
|
|
25381
|
+
cx: 100,
|
|
25382
|
+
cy: 100,
|
|
25383
|
+
r: 85,
|
|
25384
|
+
className: FRONT
|
|
25385
|
+
}),
|
|
25386
|
+
/* @__PURE__ */ jsx("path", {
|
|
25387
|
+
d: "M15 100 A85 24 0 0 1 185 100",
|
|
25388
|
+
...HIDDEN
|
|
25389
|
+
}),
|
|
25390
|
+
/* @__PURE__ */ jsx("path", {
|
|
25391
|
+
d: "M15 100 A85 24 0 0 0 185 100",
|
|
25392
|
+
className: "fill-none"
|
|
25393
|
+
})
|
|
25394
|
+
] });
|
|
25395
|
+
case "cylinder": return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25396
|
+
/* @__PURE__ */ jsx("path", {
|
|
25397
|
+
d: "M40 45 L40 160 A60 18 0 0 0 160 160 L160 45 Z",
|
|
25398
|
+
className: FRONT
|
|
25399
|
+
}),
|
|
25400
|
+
/* @__PURE__ */ jsx("path", {
|
|
25401
|
+
d: "M40 160 A60 18 0 0 1 160 160",
|
|
25402
|
+
...HIDDEN
|
|
25403
|
+
}),
|
|
25404
|
+
/* @__PURE__ */ jsx("ellipse", {
|
|
25405
|
+
cx: 100,
|
|
25406
|
+
cy: 45,
|
|
25407
|
+
rx: 60,
|
|
25408
|
+
ry: 18,
|
|
25409
|
+
className: TOP$1
|
|
25410
|
+
})
|
|
25411
|
+
] });
|
|
25412
|
+
case "cone": return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
|
|
25413
|
+
d: "M100 15 L35 160 A65 20 0 0 0 165 160 Z",
|
|
25414
|
+
className: FRONT
|
|
25415
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
25416
|
+
d: "M35 160 A65 20 0 0 1 165 160",
|
|
25417
|
+
...HIDDEN
|
|
25418
|
+
})] });
|
|
25419
|
+
case "pyramid": {
|
|
25420
|
+
const apex = [95, 15];
|
|
25421
|
+
const fl = [25, 170];
|
|
25422
|
+
const fr = [135, 170];
|
|
25423
|
+
const br = [180, 135];
|
|
25424
|
+
const bl = [70, 135];
|
|
25425
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25426
|
+
/* @__PURE__ */ jsx("path", {
|
|
25427
|
+
d: path(apex, fl, fr),
|
|
25428
|
+
className: FRONT
|
|
25429
|
+
}),
|
|
25430
|
+
/* @__PURE__ */ jsx("path", {
|
|
25431
|
+
d: path(apex, fr, br),
|
|
25432
|
+
className: SIDE
|
|
25433
|
+
}),
|
|
25434
|
+
/* @__PURE__ */ jsx("path", {
|
|
25435
|
+
d: line(bl, fl),
|
|
25436
|
+
...HIDDEN
|
|
25437
|
+
}),
|
|
25438
|
+
/* @__PURE__ */ jsx("path", {
|
|
25439
|
+
d: line(bl, br),
|
|
25440
|
+
...HIDDEN
|
|
25441
|
+
}),
|
|
25442
|
+
/* @__PURE__ */ jsx("path", {
|
|
25443
|
+
d: line(bl, apex),
|
|
25444
|
+
...HIDDEN
|
|
25445
|
+
})
|
|
25446
|
+
] });
|
|
25447
|
+
}
|
|
25448
|
+
case "prism": {
|
|
25449
|
+
const a = [20, 175];
|
|
25450
|
+
const b = [120, 175];
|
|
25451
|
+
const c = [70, 90];
|
|
25452
|
+
const back = (p) => [p[0] + 60, p[1] - 55];
|
|
25453
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25454
|
+
/* @__PURE__ */ jsx("path", {
|
|
25455
|
+
d: path(c, back(c), back(b), b),
|
|
25456
|
+
className: SIDE
|
|
25457
|
+
}),
|
|
25458
|
+
/* @__PURE__ */ jsx("path", {
|
|
25459
|
+
d: path(a, b, c),
|
|
25460
|
+
className: FRONT
|
|
25461
|
+
}),
|
|
25462
|
+
/* @__PURE__ */ jsx("path", {
|
|
25463
|
+
d: line(back(a), back(b)),
|
|
25464
|
+
...HIDDEN
|
|
25465
|
+
}),
|
|
25466
|
+
/* @__PURE__ */ jsx("path", {
|
|
25467
|
+
d: line(back(a), back(c)),
|
|
25468
|
+
...HIDDEN
|
|
25469
|
+
}),
|
|
25470
|
+
/* @__PURE__ */ jsx("path", {
|
|
25471
|
+
d: line(back(a), a),
|
|
25472
|
+
...HIDDEN
|
|
25473
|
+
})
|
|
25474
|
+
] });
|
|
25475
|
+
}
|
|
25476
|
+
}
|
|
25477
|
+
}
|
|
25478
|
+
/** A 3-D shape drawn with its faces shaded and its hidden edges dashed: cube, cuboid, sphere, cylinder, cone and more. */
|
|
25479
|
+
function Solid({ shape, label, className }) {
|
|
25480
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
25481
|
+
viewBox: "0 0 200 200",
|
|
25482
|
+
role: "img",
|
|
25483
|
+
"aria-label": label ?? WORDS[shape],
|
|
25484
|
+
className: cn("block aspect-square w-full", className),
|
|
25485
|
+
children: /* @__PURE__ */ jsx("g", {
|
|
25486
|
+
strokeWidth: 3,
|
|
25487
|
+
strokeLinejoin: "round",
|
|
25488
|
+
className: "stroke-foreground",
|
|
25489
|
+
children: /* @__PURE__ */ jsx(Drawing, { shape })
|
|
25490
|
+
})
|
|
25491
|
+
});
|
|
25492
|
+
}
|
|
25493
|
+
/** A 3-D shape's name as it is said: "a cube", "a triangular prism". */
|
|
25494
|
+
function solidWords(shape) {
|
|
25495
|
+
return WORDS[shape].replace(/^A/, "a");
|
|
25496
|
+
}
|
|
25497
|
+
|
|
25498
|
+
// src/components/fill-level.tsx
|
|
25499
|
+
const TOP = 20;
|
|
25500
|
+
const BOTTOM = 185;
|
|
25501
|
+
const round$2 = (n) => Math.round(n * 100) / 100;
|
|
25502
|
+
const edge = (y) => {
|
|
25503
|
+
const t = (y - TOP) / 165;
|
|
25504
|
+
return {
|
|
25505
|
+
left: round$2(30 + 15 * t),
|
|
25506
|
+
right: round$2(170 - 15 * t)
|
|
25507
|
+
};
|
|
25508
|
+
};
|
|
25509
|
+
/** How full a glass is, in words: "empty", "a quarter full", "half full", "three quarters full", "full", or "nearly
|
|
25510
|
+
* full" and "nearly empty" between. */
|
|
25511
|
+
function fillWords(level) {
|
|
25512
|
+
if (level <= 0) return "empty";
|
|
25513
|
+
if (level >= 1) return "full";
|
|
25514
|
+
const near = (x) => Math.abs(level - x) < .04;
|
|
25515
|
+
if (near(.25)) return "a quarter full";
|
|
25516
|
+
if (near(.5)) return "half full";
|
|
25517
|
+
if (near(.75)) return "three quarters full";
|
|
25518
|
+
if (level > .85) return "nearly full";
|
|
25519
|
+
if (level < .15) return "nearly empty";
|
|
25520
|
+
return level > .5 ? "more than half full" : "less than half full";
|
|
25521
|
+
}
|
|
25522
|
+
/** A glass filled to a level, from empty to full: the picture of capacity (fuller, half full, empty). */
|
|
25523
|
+
function FillLevel({ level, label, className }) {
|
|
25524
|
+
if (!(level >= 0 && level <= 1)) throw new RangeError(`level must be 0 to 1, not ${level}`);
|
|
25525
|
+
const surface = round$2(BOTTOM - 165 * level);
|
|
25526
|
+
const w = edge(surface);
|
|
25527
|
+
const b = edge(BOTTOM);
|
|
25528
|
+
const t = edge(TOP);
|
|
25529
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
25530
|
+
viewBox: "0 0 200 200",
|
|
25531
|
+
role: "img",
|
|
25532
|
+
"aria-label": label ?? `A glass, ${fillWords(level)}`,
|
|
25533
|
+
className: cn("block aspect-square w-full", className),
|
|
25534
|
+
children: [
|
|
25535
|
+
/* @__PURE__ */ jsx("path", {
|
|
25536
|
+
d: `M${t.left} ${TOP} L${b.left} ${BOTTOM} L${b.right} ${BOTTOM} L${t.right} ${TOP} Z`,
|
|
25537
|
+
className: "fill-card"
|
|
25538
|
+
}),
|
|
25539
|
+
level > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
|
|
25540
|
+
d: `M${w.left} ${surface} L${b.left} ${BOTTOM} L${b.right} ${BOTTOM} L${w.right} ${surface} Z`,
|
|
25541
|
+
className: "fill-info-subtle",
|
|
25542
|
+
"data-level": level
|
|
25543
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
25544
|
+
d: `M${w.left} ${surface} L${w.right} ${surface}`,
|
|
25545
|
+
strokeWidth: 3,
|
|
25546
|
+
className: "stroke-info"
|
|
25547
|
+
})] }),
|
|
25548
|
+
/* @__PURE__ */ jsx("path", {
|
|
25549
|
+
d: `M${t.left} ${TOP} L${b.left} ${BOTTOM} L${b.right} ${BOTTOM} L${t.right} ${TOP}`,
|
|
25550
|
+
strokeWidth: 4,
|
|
25551
|
+
strokeLinejoin: "round",
|
|
25552
|
+
className: "fill-none stroke-foreground"
|
|
25553
|
+
})
|
|
25554
|
+
]
|
|
25555
|
+
});
|
|
25556
|
+
}
|
|
25557
|
+
|
|
25558
|
+
// src/components/balance.tsx
|
|
25559
|
+
const TILT = 14;
|
|
25560
|
+
const ARM = 60;
|
|
25561
|
+
const PIVOT = [100, 62];
|
|
25562
|
+
const round$1 = (n) => Math.round(n * 100) / 100;
|
|
25563
|
+
/** A balance with a picture in each pan, tipped toward the heavier side or level. */
|
|
25564
|
+
function Balance({ left, right, down, label, className }) {
|
|
25565
|
+
const a = (down === "left" ? -1 : down === "right" ? 1 : 0) * TILT * Math.PI / 180;
|
|
25566
|
+
const end = (side) => [round$1(PIVOT[0] + side * ARM * Math.cos(a)), round$1(PIVOT[1] + side * ARM * Math.sin(a))];
|
|
25567
|
+
const [lx, ly] = end(-1);
|
|
25568
|
+
const [rx, ry] = end(1);
|
|
25569
|
+
const said = label ?? `A balance: ${left} on the left, ${right} on the right, ${down === "level" ? "level" : `the ${down} side down`}`;
|
|
25570
|
+
const pan = (x, y, thing, side) => /* @__PURE__ */ jsxs("g", {
|
|
25571
|
+
"data-side": side,
|
|
25572
|
+
children: [
|
|
25573
|
+
/* @__PURE__ */ jsx("path", {
|
|
25574
|
+
d: `M${x} ${y} L${x - 28} ${y + 52} M${x} ${y} L${x + 28} ${y + 52}`,
|
|
25575
|
+
strokeWidth: 2,
|
|
25576
|
+
className: "stroke-muted-foreground"
|
|
25577
|
+
}),
|
|
25578
|
+
/* @__PURE__ */ jsx("text", {
|
|
25579
|
+
x,
|
|
25580
|
+
y: y + 36,
|
|
25581
|
+
textAnchor: "middle",
|
|
25582
|
+
dominantBaseline: "central",
|
|
25583
|
+
fontSize: thing.length > 2 ? 14 : 34,
|
|
25584
|
+
className: "fill-foreground font-sans",
|
|
25585
|
+
children: thing
|
|
25586
|
+
}),
|
|
25587
|
+
/* @__PURE__ */ jsx("path", {
|
|
25588
|
+
d: `M${x - 32} ${y + 52} Q${x} ${y + 72} ${x + 32} ${y + 52} Z`,
|
|
25589
|
+
strokeWidth: 3,
|
|
25590
|
+
className: "fill-card stroke-foreground"
|
|
25591
|
+
})
|
|
25592
|
+
]
|
|
25593
|
+
});
|
|
25594
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
25595
|
+
viewBox: "0 0 200 200",
|
|
25596
|
+
role: "img",
|
|
25597
|
+
"aria-label": said,
|
|
25598
|
+
className: cn("block aspect-square w-full", className),
|
|
25599
|
+
"data-down": down,
|
|
25600
|
+
children: /* @__PURE__ */ jsxs("g", {
|
|
25601
|
+
strokeLinejoin: "round",
|
|
25602
|
+
strokeLinecap: "round",
|
|
25603
|
+
children: [
|
|
25604
|
+
/* @__PURE__ */ jsx("path", {
|
|
25605
|
+
d: `M${PIVOT[0]} ${PIVOT[1]} L${PIVOT[0]} 188 M70 188 L130 188`,
|
|
25606
|
+
strokeWidth: 5,
|
|
25607
|
+
className: "stroke-foreground"
|
|
25608
|
+
}),
|
|
25609
|
+
/* @__PURE__ */ jsx("path", {
|
|
25610
|
+
d: `M${lx} ${ly} L${rx} ${ry}`,
|
|
25611
|
+
strokeWidth: 5,
|
|
25612
|
+
className: "stroke-foreground"
|
|
25613
|
+
}),
|
|
25614
|
+
/* @__PURE__ */ jsx("circle", {
|
|
25615
|
+
cx: PIVOT[0],
|
|
25616
|
+
cy: PIVOT[1],
|
|
25617
|
+
r: 6,
|
|
25618
|
+
className: "fill-primary"
|
|
25619
|
+
}),
|
|
25620
|
+
pan(lx, ly, left, "left"),
|
|
25621
|
+
pan(rx, ry, right, "right")
|
|
25622
|
+
]
|
|
25623
|
+
})
|
|
25624
|
+
});
|
|
25625
|
+
}
|
|
25626
|
+
|
|
25627
|
+
// src/components/length-bar.tsx
|
|
25628
|
+
const SPAN = 184;
|
|
25629
|
+
const THICK = 30;
|
|
25630
|
+
function Along({ length, max, look }) {
|
|
25631
|
+
const unit = SPAN / max;
|
|
25632
|
+
const w = unit * length;
|
|
25633
|
+
const y = 100 - THICK / 2;
|
|
25634
|
+
if (look === "cubes") return Array.from({ length }, (_, i) => /* @__PURE__ */ jsx("rect", {
|
|
25635
|
+
x: 8 + i * unit,
|
|
25636
|
+
y: 100 - unit / 2,
|
|
25637
|
+
width: unit,
|
|
25638
|
+
height: unit,
|
|
25639
|
+
className: "fill-primary"
|
|
25640
|
+
}, i));
|
|
25641
|
+
if (look === "pencil") {
|
|
25642
|
+
const tip = Math.min(unit * 1.2, w / 2);
|
|
25643
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25644
|
+
/* @__PURE__ */ jsx("path", {
|
|
25645
|
+
d: `M8 ${y} L${8 + w - tip} ${y} L${8 + w} 100 L${8 + w - tip} 115 L8 115 Z`,
|
|
25646
|
+
className: "fill-secondary-9"
|
|
25647
|
+
}),
|
|
25648
|
+
/* @__PURE__ */ jsx("path", {
|
|
25649
|
+
d: `M${8 + w - tip} ${y} L${8 + w - tip} 115`,
|
|
25650
|
+
className: "fill-none"
|
|
25651
|
+
}),
|
|
25652
|
+
/* @__PURE__ */ jsx("path", {
|
|
25653
|
+
d: `M${8 + w - tip * .35} ${100 - THICK * .17} L${8 + w} 100 L${8 + w - tip * .35} 105.1 Z`,
|
|
25654
|
+
className: "fill-foreground"
|
|
25655
|
+
})
|
|
25656
|
+
] });
|
|
25657
|
+
}
|
|
25658
|
+
return /* @__PURE__ */ jsx("rect", {
|
|
25659
|
+
x: 8,
|
|
25660
|
+
y,
|
|
25661
|
+
width: w,
|
|
25662
|
+
height: THICK,
|
|
25663
|
+
rx: 6,
|
|
25664
|
+
className: "fill-primary"
|
|
25665
|
+
});
|
|
25666
|
+
}
|
|
25667
|
+
/** Something drawn to a length (a ribbon, a pencil or cubes) on a frame shared by every bar compared. */
|
|
25668
|
+
function LengthBar({ length, max = 10, look = "ribbon", upright = false, label, className }) {
|
|
25669
|
+
if (!Number.isInteger(length) || length < 1 || length > max) throw new RangeError(`length must be a whole number from 1 to ${max}, not ${length}`);
|
|
25670
|
+
const cubes = `${length} cube${length === 1 ? "" : "s"}`;
|
|
25671
|
+
const said = label ?? (look === "cubes" ? upright ? `A tower of ${cubes}` : `A row of ${cubes}` : `A ${look} ${cubes} ${upright ? "tall" : "long"}`);
|
|
25672
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
25673
|
+
viewBox: "0 0 200 200",
|
|
25674
|
+
role: "img",
|
|
25675
|
+
"aria-label": said,
|
|
25676
|
+
className: cn("block aspect-square w-full", className),
|
|
25677
|
+
children: /* @__PURE__ */ jsx("g", {
|
|
25678
|
+
transform: upright ? "rotate(-90 100 100)" : void 0,
|
|
25679
|
+
strokeWidth: 3,
|
|
25680
|
+
strokeLinejoin: "round",
|
|
25681
|
+
className: "stroke-foreground",
|
|
25682
|
+
"data-length": length,
|
|
25683
|
+
children: /* @__PURE__ */ jsx(Along, {
|
|
25684
|
+
length,
|
|
25685
|
+
max,
|
|
25686
|
+
look
|
|
25687
|
+
})
|
|
25688
|
+
})
|
|
25689
|
+
});
|
|
25690
|
+
}
|
|
25691
|
+
|
|
25692
|
+
// src/components/turn-arrow.tsx
|
|
25693
|
+
/** The four ways an arrow points, clockwise from up. */
|
|
25694
|
+
const FACINGS = [
|
|
25695
|
+
"up",
|
|
25696
|
+
"right",
|
|
25697
|
+
"down",
|
|
25698
|
+
"left"
|
|
25699
|
+
];
|
|
25700
|
+
const DEGREES = {
|
|
25701
|
+
up: 0,
|
|
25702
|
+
right: 90,
|
|
25703
|
+
down: 180,
|
|
25704
|
+
left: 270
|
|
25705
|
+
};
|
|
25706
|
+
const round = (n) => Math.round(n * 100) / 100;
|
|
25707
|
+
/** Where an arrow points after a turn: up, a quarter turn clockwise, is right. */
|
|
25708
|
+
function turned(facing, turn) {
|
|
25709
|
+
const step = turn.clockwise ? turn.quarters : -turn.quarters;
|
|
25710
|
+
return FACINGS[((FACINGS.indexOf(facing) + step) % 4 + 4) % 4];
|
|
25711
|
+
}
|
|
25712
|
+
/** A turn as it is said: "a quarter turn clockwise", "a half turn", "a whole turn". A half or a whole turn ends in the
|
|
25713
|
+
* same place either way, so they are said without a direction. */
|
|
25714
|
+
function turnWords(turn) {
|
|
25715
|
+
const size = [
|
|
25716
|
+
"",
|
|
25717
|
+
"a quarter turn",
|
|
25718
|
+
"a half turn",
|
|
25719
|
+
"a three-quarter turn",
|
|
25720
|
+
"a whole turn"
|
|
25721
|
+
][turn.quarters];
|
|
25722
|
+
if (turn.quarters === 2 || turn.quarters === 4) return size;
|
|
25723
|
+
return `${size} ${turn.clockwise ? "clockwise" : "anticlockwise"}`;
|
|
25724
|
+
}
|
|
25725
|
+
const R = 84;
|
|
25726
|
+
/** An arrow pointing up, right, down or left, with a turn drawn round it: the picture of quarter and half turns. */
|
|
25727
|
+
function TurnArrow({ facing, turn, label, className }) {
|
|
25728
|
+
const said = label ?? `An arrow pointing ${facing}${turn ? `, turning ${turnWords(turn)}` : ""}`;
|
|
25729
|
+
let arc = null;
|
|
25730
|
+
if (turn) {
|
|
25731
|
+
const start = DEGREES[facing] + (turn.clockwise ? 12 : -12);
|
|
25732
|
+
const sweep = Math.min(turn.quarters * 90, 336) - 24;
|
|
25733
|
+
const end = start + (turn.clockwise ? sweep : -sweep);
|
|
25734
|
+
const at = (deg, r = R) => {
|
|
25735
|
+
const t = deg * Math.PI / 180;
|
|
25736
|
+
return [round(100 + r * Math.sin(t)), round(100 - r * Math.cos(t))];
|
|
25737
|
+
};
|
|
25738
|
+
const [x0, y0] = at(start);
|
|
25739
|
+
const [x1, y1] = at(end);
|
|
25740
|
+
const large = sweep > 180 ? 1 : 0;
|
|
25741
|
+
const back = end + (turn.clockwise ? -10 : 10);
|
|
25742
|
+
const [ox, oy] = at(back, 93);
|
|
25743
|
+
const [ix, iy] = at(back, 75);
|
|
25744
|
+
arc = {
|
|
25745
|
+
d: `M${x0} ${y0} A${R} ${R} 0 ${large} ${turn.clockwise ? 1 : 0} ${x1} ${y1}`,
|
|
25746
|
+
head: `M${x1} ${y1} L${ox} ${oy} L${ix} ${iy} Z`
|
|
25747
|
+
};
|
|
25748
|
+
}
|
|
25749
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
25750
|
+
viewBox: "0 0 200 200",
|
|
25751
|
+
role: "img",
|
|
25752
|
+
"aria-label": said,
|
|
25753
|
+
className: cn("block aspect-square w-full", className),
|
|
25754
|
+
"data-facing": facing,
|
|
25755
|
+
children: [/* @__PURE__ */ jsx("g", {
|
|
25756
|
+
transform: `rotate(${DEGREES[facing]} 100 100)`,
|
|
25757
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
25758
|
+
d: "M100 30 L140 78 L114 78 L114 165 L86 165 L86 78 L60 78 Z",
|
|
25759
|
+
strokeWidth: 4,
|
|
25760
|
+
strokeLinejoin: "round",
|
|
25761
|
+
className: "fill-primary stroke-foreground"
|
|
25762
|
+
})
|
|
25763
|
+
}), arc && /* @__PURE__ */ jsxs("g", {
|
|
25764
|
+
className: "stroke-secondary-9",
|
|
25765
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
25766
|
+
d: arc.d,
|
|
25767
|
+
strokeWidth: 6,
|
|
25768
|
+
strokeLinecap: "round",
|
|
25769
|
+
className: "fill-none"
|
|
25770
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
25771
|
+
d: arc.head,
|
|
25772
|
+
strokeWidth: 2,
|
|
25773
|
+
strokeLinejoin: "round",
|
|
25774
|
+
className: "fill-secondary-9"
|
|
25775
|
+
})]
|
|
25776
|
+
})]
|
|
25777
|
+
});
|
|
25778
|
+
}
|
|
25779
|
+
|
|
25780
|
+
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, Balance, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, CLOCK_FACE_STYLES, CLOCK_STYLES, COINS, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, Clock, ClockFace, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DIGITAL_CLOCK_STYLES, DataTable, DataView$1 as DataView, Density, Dialog, DigitalClock, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, EventLog, FACINGS, FIT, FRACTION_OUTLINES, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FillLevel, FilmStrip, FolderPicker, FractionShape, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, JsonView, KeysLegend, LEVEL_FLOOR_DB, LengthBar, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, Money, NBSP, NOTES, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RangeSlider, RateChoice, ReadAlong, RegionEditor, RichText, RowAction, SOLID_SHAPES, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SetClock, ShortcutEditor, SideNav, Skeleton, Slider, Solid, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelinePlayer, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, TurnArrow, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, applyOp, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, clockParts, clockWords, cn, coinOutline, colorSchemeScript, commandShortcut, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, dayPart, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, digitalTime, diskThresholds, drawRect, drawingToSvg, ease, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, fillWords, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, fractionParts, fractionWords, frameAt, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, hourAt, inkMatch, inputLevelThresholds, invertOp, isDigitalStyle, isDoubtful, isRefusal, isReservedChord, isSpeaking, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, jsonBranchPaths, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, minutesAt, moneyWords, moveGutter, moveMinuteHand, movePoints, moveRect, newStrokeId, nextBreak, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, pointsBox, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, replay, resample, resamplePeaks, rescaleDrawing, resizeRect, rgbaToBlob, rmsDb, romanHour, safeHref, sayPosition, serialiseSort, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, solidWords, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepMinuteHand, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnWords, turned, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useCountdown, useDifference, useDrawing, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useReadAloud, useRebindableShortcuts, useRecorder, useReserve, useRevealed, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeaking, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
|
|
25116
25781
|
//# sourceMappingURL=index.js.map
|