strata-react 2.1.9 → 2.1.10
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 +5 -5
- package/dist/index.d.ts +111 -4
- package/dist/index.js +241 -40
- package/dist/index.js.map +1 -1
- package/dist/{microphone-DWh4OaMH.d.ts → microphone-xGKxcK6p.d.ts} +2 -2
- package/dist/panorama.js +1 -1
- package/dist/strata.bare.css +5 -0
- package/dist/strata.css +5 -0
- package/dist/strata.migrate.css +5 -0
- package/dist/testing.d.ts +1 -1
- package/dist/{value-controls-D5zpPQuJ.js → value-controls-i1aGyO_3.js} +61 -2
- package/dist/{value-controls-D5zpPQuJ.js.map → value-controls-i1aGyO_3.js.map} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { a as isDev, i as buttonVariants, n as IconButton, o as useInView, r as
|
|
|
4
4
|
import { t as followAim } from "./follow-CXQsL86O.js";
|
|
5
5
|
import { n as useViewPointers, r as useWheelZoom, t as useSettledStatus } from "./viewer-input-3Qa-o35k.js";
|
|
6
6
|
import { A as StrataQueryProvider, C as toast, D as LoadError, E as EmptyState, F as useLoad, I as usePoll, L as overlaySurface, M as fetchJson, N as staleOf, O as Skeleton, P as toLoad, S as StrataToastRegion, T as DataView$1, _ as clampViewport, a as useMicrophone, b as viewportTransform, d as zoomToBox, f as FIT, g as boxViewport, h as actualPixelsScale, i as explainMicrophoneError, j as createQueryClient, k as StaleNotice, l as readingOrder, m as MIN_SCALE, n as MicrophoneError, o as Thumbnail, p as MAX_SCALE, r as browserMicrophone, s as ThumbnailSkeleton, t as MicrophoneContext, u as regionStyle, v as frameBoxToShares, w as toastTimeout, x as zoomAt, y as regionShares } from "./microphone-Db5o3SHZ.js";
|
|
7
|
-
import { a as
|
|
7
|
+
import { a as AsyncButton, c as ToolbarSeparator, d as keyName, f as useHotkeys, i as Slider, l as KeysLegend, n as NumberField, o as useAsyncAction, r as RangeSlider, s as Toolbar, t as ColorField, u as isTypingTarget } from "./value-controls-i1aGyO_3.js";
|
|
8
8
|
import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-Cwyvgwsw.js";
|
|
9
9
|
import { a as fieldErrorsOf, i as errorPayload, n as describeActionError, o as readErrorBody, r as describeHttpError, t as HttpError } from "./errors-CmuwcWlb.js";
|
|
10
10
|
import { a as PaletteChoice, c as paletteScript, d as usePalette, f as useSystemColorScheme, i as PALETTE_STORAGE_KEY, l as palettes, n as ColorSchemeChoice, o as ThemeProvider, p as Density, r as DEFAULT_PALETTE, s as colorSchemeScript, t as COLOR_SCHEME_STORAGE_KEY, u as useColorScheme } from "./theme-5Mb1ydlA.js";
|
|
@@ -3486,6 +3486,59 @@ function ScheduleTable({ caption, rows, now, className }) {
|
|
|
3486
3486
|
});
|
|
3487
3487
|
}
|
|
3488
3488
|
|
|
3489
|
+
// src/components/concealed.tsx
|
|
3490
|
+
/** Content covered until a person chooses to see it: the reason in words, a named Show / Hide button, and the picture itself supplied by the app (blurred by the server while covered), so nothing is hidden by CSS alone. */
|
|
3491
|
+
function Concealed({ concealed, reason, label, revealed, onRevealedChange, children, className }) {
|
|
3492
|
+
if (!concealed) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
3493
|
+
const Icon = revealed ? EyeOff : Eye;
|
|
3494
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3495
|
+
className: cn("relative", className),
|
|
3496
|
+
"data-concealed": revealed ? "revealed" : "covered",
|
|
3497
|
+
children: [children, /* @__PURE__ */ jsxs("div", {
|
|
3498
|
+
className: "absolute inset-x-0 bottom-0 flex items-center justify-between gap-2 bg-background/85 px-2 py-1",
|
|
3499
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3500
|
+
className: "min-w-0 truncate type-caption text-foreground",
|
|
3501
|
+
children: reason
|
|
3502
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
3503
|
+
icon: Icon,
|
|
3504
|
+
size: "sm",
|
|
3505
|
+
label: `${revealed ? "Hide" : "Show"} ${label}`,
|
|
3506
|
+
onPress: () => onRevealedChange(!revealed)
|
|
3507
|
+
})]
|
|
3508
|
+
})]
|
|
3509
|
+
});
|
|
3510
|
+
}
|
|
3511
|
+
/** Which covered items a person has chosen to see on this screen, and a show-all switch; for this visit only, never stored. */
|
|
3512
|
+
function useRevealed() {
|
|
3513
|
+
const [ids, setIds] = React.useState(/* @__PURE__ */ new Set());
|
|
3514
|
+
const [all, setAllState] = React.useState(false);
|
|
3515
|
+
const isRevealed = React.useCallback((id) => all || ids.has(id), [all, ids]);
|
|
3516
|
+
const set = React.useCallback((id, revealed) => {
|
|
3517
|
+
setIds((prev) => {
|
|
3518
|
+
const next = new Set(prev);
|
|
3519
|
+
if (revealed) next.add(id);
|
|
3520
|
+
else next.delete(id);
|
|
3521
|
+
return next;
|
|
3522
|
+
});
|
|
3523
|
+
if (!revealed) setAllState(false);
|
|
3524
|
+
}, []);
|
|
3525
|
+
const setAll = React.useCallback((on) => {
|
|
3526
|
+
setAllState(on);
|
|
3527
|
+
if (!on) setIds(/* @__PURE__ */ new Set());
|
|
3528
|
+
}, []);
|
|
3529
|
+
return React.useMemo(() => ({
|
|
3530
|
+
isRevealed,
|
|
3531
|
+
set,
|
|
3532
|
+
all,
|
|
3533
|
+
setAll
|
|
3534
|
+
}), [
|
|
3535
|
+
isRevealed,
|
|
3536
|
+
set,
|
|
3537
|
+
all,
|
|
3538
|
+
setAll
|
|
3539
|
+
]);
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3489
3542
|
// src/components/film-strip.tsx
|
|
3490
3543
|
const GAP$1 = 4;
|
|
3491
3544
|
/** `n` of `items` spread evenly from the first to the last (all of them when there are no more than `n`). */
|
|
@@ -12828,7 +12881,7 @@ function nextBeckon(open, last) {
|
|
|
12828
12881
|
const others = open.length > 1 ? open.filter((k) => k !== last) : open;
|
|
12829
12882
|
return others[Math.floor(Math.random() * others.length)] ?? null;
|
|
12830
12883
|
}
|
|
12831
|
-
const SEP$
|
|
12884
|
+
const SEP$2 = "\0";
|
|
12832
12885
|
const REDUCE = "(prefers-reduced-motion: reduce)";
|
|
12833
12886
|
const reduceQuery = () => typeof matchMedia === "function" ? matchMedia(REDUCE) : null;
|
|
12834
12887
|
function subscribeReduce(change) {
|
|
@@ -12845,11 +12898,11 @@ function useReducedMotion() {
|
|
|
12845
12898
|
* open tile, lit beat after beat, still pulses each time (Codex on #400). */
|
|
12846
12899
|
function useBeckon(on, open, ms) {
|
|
12847
12900
|
const [lit, setLit] = React.useState(null);
|
|
12848
|
-
const openKey = open.join(SEP$
|
|
12901
|
+
const openKey = open.join(SEP$2);
|
|
12849
12902
|
const still = useReducedMotion();
|
|
12850
12903
|
React.useEffect(() => {
|
|
12851
12904
|
if (!on || still || openKey === "") return;
|
|
12852
|
-
const keys = openKey.split(SEP$
|
|
12905
|
+
const keys = openKey.split(SEP$2);
|
|
12853
12906
|
let last = null;
|
|
12854
12907
|
let beat = 0;
|
|
12855
12908
|
const t = setInterval(() => {
|
|
@@ -12888,6 +12941,13 @@ function pictureInTile(content) {
|
|
|
12888
12941
|
const n = [...letters.segment(content)].length;
|
|
12889
12942
|
return n <= 2 ? { fontSize: TILE } : { fontSize: `min(var(--type-picture-size, 4.5rem), 75cqi, ${Math.round(WORD_SHARE / n * 10) / 10}cqi)` };
|
|
12890
12943
|
}
|
|
12944
|
+
const CAPTION = "var(--type-body-size, 1rem)";
|
|
12945
|
+
const CAPTION_SHARE = 160;
|
|
12946
|
+
/** A caption's size in its tile: the body step, or smaller for a long caption so it fits across the tile on one line. */
|
|
12947
|
+
function captionInTile(content) {
|
|
12948
|
+
const n = typeof content === "string" ? [...letters.segment(content)].length : 0;
|
|
12949
|
+
return n <= 8 ? { fontSize: `min(${CAPTION}, 20cqi)` } : { fontSize: `min(${CAPTION}, ${Math.round(CAPTION_SHARE / n * 10) / 10}cqi)` };
|
|
12950
|
+
}
|
|
12891
12951
|
|
|
12892
12952
|
// src/components/choice-grid.tsx
|
|
12893
12953
|
const minSide = {
|
|
@@ -12897,11 +12957,11 @@ const minSide = {
|
|
|
12897
12957
|
const closed = (s) => s === "right" || s === "answer" || s === "picked";
|
|
12898
12958
|
const columns = (size, stretch = false) => ({ gridTemplateColumns: `repeat(${stretch ? "auto-fit" : "auto-fill"}, minmax(min(${minSide[size]}px, 100%), 1fr))` });
|
|
12899
12959
|
/** A grid of large picture tiles for answering one question with a tap: each tile open, wrong, right, shown as the answer or (no answer key) picked, with its word; answered tiles cannot be pressed again, and the grid closes once the answer shows. */
|
|
12900
|
-
function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, marks, onChoose, size = "md", stretch = false, beckon = false, beckonMs = 1600, className }) {
|
|
12960
|
+
function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, marks, onChoose, size = "md", stretch = false, beckon = false, beckonMs = 1600, renderCaption, onHover, reading = null, className }) {
|
|
12901
12961
|
const byKey = new Map(items.map((item) => [itemKey(item), item]));
|
|
12902
12962
|
const over = items.some((item) => closed(state(item)));
|
|
12903
12963
|
const disabledKeys = items.filter((item) => over || state(item) !== "open").map(itemKey);
|
|
12904
|
-
const lit = useBeckon(beckon && !over, items.filter((item) => state(item) === "open").map(itemKey), beckonMs);
|
|
12964
|
+
const lit = useBeckon(beckon && !over && reading === null, items.filter((item) => state(item) === "open").map(itemKey), beckonMs);
|
|
12905
12965
|
return /* @__PURE__ */ jsx(GridList, {
|
|
12906
12966
|
"aria-label": label,
|
|
12907
12967
|
layout: "grid",
|
|
@@ -12923,20 +12983,35 @@ function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, ma
|
|
|
12923
12983
|
"aria-label": mark ? `${itemLabel(item)}, ${mark.toLowerCase()}` : itemLabel(item),
|
|
12924
12984
|
"data-choice": s,
|
|
12925
12985
|
"data-beckon": key === lit?.key || void 0,
|
|
12926
|
-
|
|
12927
|
-
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
|
|
12938
|
-
|
|
12939
|
-
|
|
12986
|
+
"data-reading": key === reading || void 0,
|
|
12987
|
+
onPointerEnter: onHover && ((e) => e.pointerType !== "touch" && onHover(item)),
|
|
12988
|
+
className: cn("@container flex aspect-square min-w-0 cursor-pointer flex-col items-center justify-center gap-1 rounded-overlay border-2 border-border bg-card p-2 text-card-foreground select-none outline-offset-2 transition-state press", "hover:border-primary disabled:cursor-default disabled:hover:border-border", key === lit?.key && cn(lit.className, "border-primary"), key === reading && "border-primary ring-4 ring-primary", (s === "right" || s === "answer") && "border-4 border-success bg-success-subtle disabled:hover:border-success", s === "picked" && "border-4 border-primary bg-surface-sunken disabled:hover:border-primary"),
|
|
12989
|
+
children: [
|
|
12990
|
+
(() => {
|
|
12991
|
+
const drawn = renderPicture(item);
|
|
12992
|
+
return /* @__PURE__ */ jsx("span", {
|
|
12993
|
+
"aria-hidden": true,
|
|
12994
|
+
className: cn("type-picture transition-state", s === "wrong" && "opacity-40"),
|
|
12995
|
+
style: pictureInTile(drawn),
|
|
12996
|
+
children: drawn
|
|
12997
|
+
});
|
|
12998
|
+
})(),
|
|
12999
|
+
renderCaption && (() => {
|
|
13000
|
+
const caption = renderCaption(item);
|
|
13001
|
+
return /* @__PURE__ */ jsx("span", {
|
|
13002
|
+
"aria-hidden": true,
|
|
13003
|
+
"data-caption": true,
|
|
13004
|
+
className: cn("type-body max-w-full truncate font-medium", s === "wrong" && "opacity-40"),
|
|
13005
|
+
style: captionInTile(caption),
|
|
13006
|
+
children: caption
|
|
13007
|
+
});
|
|
13008
|
+
})(),
|
|
13009
|
+
mark && /* @__PURE__ */ jsx(Status, {
|
|
13010
|
+
tone: s === "wrong" || s === "picked" ? "neutral" : "success",
|
|
13011
|
+
className: "max-w-full truncate",
|
|
13012
|
+
children: mark
|
|
13013
|
+
})
|
|
13014
|
+
]
|
|
12940
13015
|
}, key);
|
|
12941
13016
|
})
|
|
12942
13017
|
});
|
|
@@ -12957,7 +13032,7 @@ const placedSide = 72;
|
|
|
12957
13032
|
const placedPicture = { "--type-picture-size": "2.5rem" };
|
|
12958
13033
|
const placeSide = 160;
|
|
12959
13034
|
/** Pictures put into places for an answer that is an arrangement (give a number, order, match, sort): two taps (pick up, put down), one tap when there is one place, or a drag. The app owns where each piece is and checks it; the board only moves what the learner asks, and keeps every piece's slot so nothing shifts. */
|
|
12960
|
-
function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places, placeKey, placeLabel, renderPlace, placement, onMove, pileLabel, placeState = () => "open", marks, locked = false, stretch = false, beckon = false, beckonMs = 1600, check, limit, className }) {
|
|
13035
|
+
function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places, placeKey, placeLabel, renderPlace, placement, onMove, pileLabel, placeState = () => "open", marks, locked = false, stretch = false, beckon = false, beckonMs = 1600, check, limit, renderCaption, onHover, onHoverPlace, reading = null, className }) {
|
|
12961
13036
|
const fill = stretch ? "auto-fit" : "auto-fill";
|
|
12962
13037
|
const [heldKey, setHeld] = React.useState(null);
|
|
12963
13038
|
const [follow, setFollow] = React.useState(null);
|
|
@@ -12974,7 +13049,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
12974
13049
|
const only = places.length === 1 ? places[0] : void 0;
|
|
12975
13050
|
const held = locked ? void 0 : pieces.find((p) => pieceKey(p) === heldKey);
|
|
12976
13051
|
const heldAt = held === void 0 ? null : where(held);
|
|
12977
|
-
const lit = useBeckon(beckon && !locked && held === void 0, pieces.filter((p) => where(p) === null).map(pieceKey), beckonMs);
|
|
13052
|
+
const lit = useBeckon(beckon && !locked && held === void 0 && reading === null, pieces.filter((p) => where(p) === null).map(pieceKey), beckonMs);
|
|
12978
13053
|
React.useEffect(() => {
|
|
12979
13054
|
if (follow === null) return;
|
|
12980
13055
|
buttons.current.get(follow)?.focus();
|
|
@@ -13083,7 +13158,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
13083
13158
|
if (el) buttons.current.set(key, el);
|
|
13084
13159
|
else buttons.current.delete(key);
|
|
13085
13160
|
};
|
|
13086
|
-
const pieceClass = (key) => cn("@container relative flex aspect-square w-full min-w-0 cursor-pointer flex-col items-center justify-center gap-1 rounded-overlay border-2 border-border bg-card p-1 text-card-foreground select-none outline-offset-2 transition-state press", "hover:border-primary disabled:cursor-default disabled:hover:border-border", "selected:border-info selected:bg-info-subtle selected:ring-4 selected:ring-info", key === lit?.key && cn(lit.className, "border-primary"));
|
|
13161
|
+
const pieceClass = (key) => cn("@container relative flex aspect-square w-full min-w-0 cursor-pointer flex-col items-center justify-center gap-1 rounded-overlay border-2 border-border bg-card p-1 text-card-foreground select-none outline-offset-2 transition-state press", "hover:border-primary disabled:cursor-default disabled:hover:border-border", "selected:border-info selected:bg-info-subtle selected:ring-4 selected:ring-info", key === lit?.key && cn(lit.className, "border-primary"), key === reading && "border-primary ring-4 ring-primary");
|
|
13087
13162
|
const picture = (p, placed) => {
|
|
13088
13163
|
const drawn = renderPiece(p);
|
|
13089
13164
|
return /* @__PURE__ */ jsx("span", {
|
|
@@ -13096,6 +13171,20 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
13096
13171
|
children: drawn
|
|
13097
13172
|
});
|
|
13098
13173
|
};
|
|
13174
|
+
const caption = (p) => {
|
|
13175
|
+
if (!renderCaption) return null;
|
|
13176
|
+
const text = renderCaption(p);
|
|
13177
|
+
return /* @__PURE__ */ jsx("span", {
|
|
13178
|
+
"aria-hidden": true,
|
|
13179
|
+
"data-caption": true,
|
|
13180
|
+
className: "type-body max-w-full truncate font-medium",
|
|
13181
|
+
style: captionInTile(text),
|
|
13182
|
+
children: text
|
|
13183
|
+
});
|
|
13184
|
+
};
|
|
13185
|
+
const hover = (say) => (e) => {
|
|
13186
|
+
if (e.pointerType !== "touch") say();
|
|
13187
|
+
};
|
|
13099
13188
|
const piece = (p, placed) => {
|
|
13100
13189
|
const key = pieceKey(p);
|
|
13101
13190
|
const isHeld = held !== void 0 && pieceKey(held) === key;
|
|
@@ -13109,15 +13198,19 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
13109
13198
|
"aria-label": placed ? `Take ${name} out of ${placeLabel(only)}` : `Put ${name} in ${placeLabel(only)}`,
|
|
13110
13199
|
"data-beckon": key === lit?.key || void 0,
|
|
13111
13200
|
className: cn(pieceClass(key), "group", isHeld && "border-info bg-info-subtle ring-4 ring-info"),
|
|
13112
|
-
children: [
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
|
|
13116
|
-
|
|
13117
|
-
|
|
13118
|
-
|
|
13201
|
+
children: [
|
|
13202
|
+
picture(p, placed),
|
|
13203
|
+
caption(p),
|
|
13204
|
+
placed && !locked && /* @__PURE__ */ jsx("span", {
|
|
13205
|
+
"aria-hidden": true,
|
|
13206
|
+
"data-remove": true,
|
|
13207
|
+
className: "absolute inset-0 flex items-center justify-center rounded-overlay bg-background/70 text-foreground opacity-0 transition-state group-hover:opacity-100 group-focus-visible:opacity-100",
|
|
13208
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
13209
|
+
className: "size-3/4",
|
|
13210
|
+
strokeWidth: 3
|
|
13211
|
+
})
|
|
13119
13212
|
})
|
|
13120
|
-
|
|
13213
|
+
]
|
|
13121
13214
|
}) : /* @__PURE__ */ jsxs(ToggleButton, {
|
|
13122
13215
|
ref: ref(key),
|
|
13123
13216
|
isSelected: isHeld,
|
|
@@ -13129,15 +13222,21 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
13129
13222
|
"data-held": isHeld || void 0,
|
|
13130
13223
|
"data-beckon": key === lit?.key || void 0,
|
|
13131
13224
|
className: pieceClass(key),
|
|
13132
|
-
children: [
|
|
13133
|
-
|
|
13134
|
-
|
|
13135
|
-
|
|
13136
|
-
|
|
13225
|
+
children: [
|
|
13226
|
+
picture(p, placed),
|
|
13227
|
+
caption(p),
|
|
13228
|
+
isHeld && /* @__PURE__ */ jsx(Status, {
|
|
13229
|
+
tone: "info",
|
|
13230
|
+
className: "absolute inset-x-1 bottom-1 justify-center truncate",
|
|
13231
|
+
children: marks.held
|
|
13232
|
+
})
|
|
13233
|
+
]
|
|
13137
13234
|
});
|
|
13138
13235
|
return /* @__PURE__ */ jsx("div", {
|
|
13139
13236
|
"data-piece": key,
|
|
13140
13237
|
onPointerDownCapture: press(key),
|
|
13238
|
+
onPointerEnter: onHover && hover(() => onHover(p)),
|
|
13239
|
+
"data-reading": key === reading || void 0,
|
|
13141
13240
|
onDragStart: (e) => e.preventDefault(),
|
|
13142
13241
|
className: cn("grid min-w-0 items-start", !locked && "touch-none", drag?.key === key && "opacity-30"),
|
|
13143
13242
|
children: control
|
|
@@ -13185,6 +13284,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
13185
13284
|
return /* @__PURE__ */ jsxs("div", {
|
|
13186
13285
|
ref: zone(key),
|
|
13187
13286
|
"data-place": state,
|
|
13287
|
+
onPointerEnter: onHoverPlace && hover(() => onHoverPlace(s)),
|
|
13188
13288
|
className: cn("grid min-w-0 content-start items-start gap-2 rounded-overlay border-2 border-dashed border-input p-2 transition-state", takes && "border-solid border-info ring-4 ring-info", takes && target(drag?.over === key), state === "right" && "border-solid border-success bg-success-subtle ring-2 ring-success", state === "wrong" && "border-solid border-muted-foreground"),
|
|
13189
13289
|
children: [/* @__PURE__ */ jsxs(Button$1, {
|
|
13190
13290
|
isDisabled: !takes || only !== void 0,
|
|
@@ -13238,17 +13338,17 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
13238
13338
|
}),
|
|
13239
13339
|
drag !== null && createPortal((() => {
|
|
13240
13340
|
const p = pieces.find((q) => pieceKey(q) === drag.key);
|
|
13241
|
-
return p === void 0 ? null : /* @__PURE__ */
|
|
13341
|
+
return p === void 0 ? null : /* @__PURE__ */ jsxs("div", {
|
|
13242
13342
|
"aria-hidden": true,
|
|
13243
13343
|
"data-dragging": true,
|
|
13244
|
-
className: "@container pointer-events-none fixed z-50 flex items-center justify-center rounded-overlay border-2 border-info bg-info-subtle p-1 text-card-foreground shadow-overlay ring-4 ring-info",
|
|
13344
|
+
className: "@container pointer-events-none fixed z-50 flex flex-col items-center justify-center gap-1 rounded-overlay border-2 border-info bg-info-subtle p-1 text-card-foreground shadow-overlay ring-4 ring-info",
|
|
13245
13345
|
style: {
|
|
13246
13346
|
left: drag.x - drag.w / 2,
|
|
13247
13347
|
top: drag.y - drag.h / 2,
|
|
13248
13348
|
width: drag.w,
|
|
13249
13349
|
height: drag.h
|
|
13250
13350
|
},
|
|
13251
|
-
children: picture(p, where(p) !== null)
|
|
13351
|
+
children: [picture(p, where(p) !== null), caption(p)]
|
|
13252
13352
|
});
|
|
13253
13353
|
})(), document.body)
|
|
13254
13354
|
]
|
|
@@ -15561,6 +15661,107 @@ function useSayOnShow(text, { muted = false } = {}) {
|
|
|
15561
15661
|
]);
|
|
15562
15662
|
}
|
|
15563
15663
|
|
|
15664
|
+
// src/lib/read-aloud.ts
|
|
15665
|
+
const SEP$1 = "\0";
|
|
15666
|
+
/** Reads a grid's tiles aloud once, one at a time, and says which is being read so the grid can light it. */
|
|
15667
|
+
function useReadAloud({ keys, say, gapMs = 300 }) {
|
|
15668
|
+
const [reading, setReading] = React.useState(null);
|
|
15669
|
+
const setKey = keys.join(SEP$1);
|
|
15670
|
+
const run = React.useRef({
|
|
15671
|
+
token: 0,
|
|
15672
|
+
spent: false,
|
|
15673
|
+
timer: void 0
|
|
15674
|
+
});
|
|
15675
|
+
const latest = React.useRef({
|
|
15676
|
+
keys,
|
|
15677
|
+
say,
|
|
15678
|
+
gapMs
|
|
15679
|
+
});
|
|
15680
|
+
latest.current = {
|
|
15681
|
+
keys,
|
|
15682
|
+
say,
|
|
15683
|
+
gapMs
|
|
15684
|
+
};
|
|
15685
|
+
const stop = React.useCallback(() => {
|
|
15686
|
+
const r = run.current;
|
|
15687
|
+
r.token += 1;
|
|
15688
|
+
r.spent = true;
|
|
15689
|
+
clearTimeout(r.timer);
|
|
15690
|
+
setReading(null);
|
|
15691
|
+
}, []);
|
|
15692
|
+
React.useEffect(() => {
|
|
15693
|
+
const r = run.current;
|
|
15694
|
+
r.spent = false;
|
|
15695
|
+
return () => {
|
|
15696
|
+
r.token += 1;
|
|
15697
|
+
clearTimeout(r.timer);
|
|
15698
|
+
setReading(null);
|
|
15699
|
+
};
|
|
15700
|
+
}, [setKey]);
|
|
15701
|
+
return {
|
|
15702
|
+
reading,
|
|
15703
|
+
start: React.useCallback(() => {
|
|
15704
|
+
const r = run.current;
|
|
15705
|
+
if (r.spent) return;
|
|
15706
|
+
r.spent = true;
|
|
15707
|
+
const token = ++r.token;
|
|
15708
|
+
const from = (i) => {
|
|
15709
|
+
if (token !== r.token) return;
|
|
15710
|
+
const key = latest.current.keys[i];
|
|
15711
|
+
if (key === void 0) {
|
|
15712
|
+
setReading(null);
|
|
15713
|
+
return;
|
|
15714
|
+
}
|
|
15715
|
+
setReading(key);
|
|
15716
|
+
let said = false;
|
|
15717
|
+
const done = () => {
|
|
15718
|
+
if (said || token !== r.token) return;
|
|
15719
|
+
said = true;
|
|
15720
|
+
r.timer = setTimeout(() => from(i + 1), latest.current.gapMs);
|
|
15721
|
+
};
|
|
15722
|
+
if (!latest.current.say(key, done)) {
|
|
15723
|
+
r.token += 1;
|
|
15724
|
+
setReading(null);
|
|
15725
|
+
}
|
|
15726
|
+
};
|
|
15727
|
+
from(0);
|
|
15728
|
+
}, []),
|
|
15729
|
+
stop
|
|
15730
|
+
};
|
|
15731
|
+
}
|
|
15732
|
+
|
|
15733
|
+
// src/components/read-along.tsx
|
|
15734
|
+
/** A run of words or numbers read aloud a part at a time, each lit as it is said, with the part the question is about left lit and pulsing. */
|
|
15735
|
+
function ReadAlong({ parts, reading = null, target = null, onPress, label, className }) {
|
|
15736
|
+
const drawn = parts.map((p) => /* @__PURE__ */ jsx("span", {
|
|
15737
|
+
"data-part": p.key,
|
|
15738
|
+
"data-reading": p.key === reading || void 0,
|
|
15739
|
+
"data-target": p.key === target && reading === null || void 0,
|
|
15740
|
+
className: cn("inline-block rounded-control px-2 ring-primary transition-state", p.key === reading && "bg-accent text-accent-foreground ring-4", p.key === target && reading === null && "beckon-loop bg-accent text-accent-foreground ring-4"),
|
|
15741
|
+
children: p.text
|
|
15742
|
+
}, p.key));
|
|
15743
|
+
const row = "flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-center";
|
|
15744
|
+
return onPress ? /* @__PURE__ */ jsx(Button$1, {
|
|
15745
|
+
"aria-label": label,
|
|
15746
|
+
onPress,
|
|
15747
|
+
className: cn(row, "cursor-pointer rounded-surface transition-state press", className),
|
|
15748
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
15749
|
+
"aria-hidden": true,
|
|
15750
|
+
className: "contents",
|
|
15751
|
+
children: drawn
|
|
15752
|
+
})
|
|
15753
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
15754
|
+
role: "group",
|
|
15755
|
+
"aria-label": label,
|
|
15756
|
+
className: cn(row, className),
|
|
15757
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
15758
|
+
"aria-hidden": true,
|
|
15759
|
+
className: "contents",
|
|
15760
|
+
children: drawn
|
|
15761
|
+
})
|
|
15762
|
+
});
|
|
15763
|
+
}
|
|
15764
|
+
|
|
15564
15765
|
// src/components/say-again.tsx
|
|
15565
15766
|
/** An icon button that says one sentence aloud, from its recordings when given, else with the browser's voice; hidden where neither can be heard or it is muted. */
|
|
15566
15767
|
function SayAgain({ text, parts, verb = "Say", className, ...options }) {
|
|
@@ -23283,5 +23484,5 @@ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose
|
|
|
23283
23484
|
});
|
|
23284
23485
|
}
|
|
23285
23486
|
|
|
23286
|
-
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, 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, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, ShortcutEditor, SideNav, Skeleton, Slider, 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, 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, cn, colorSchemeScript, commandShortcut, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, drawingToSvg, ease, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, inkMatch, inputLevelThresholds, invertOp, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, moveGutter, 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, safeHref, sayPosition, serialiseSort, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, 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, useRebindableShortcuts, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
|
|
23487
|
+
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, 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, NBSP, 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, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, ShortcutEditor, SideNav, Skeleton, Slider, 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, 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, cn, colorSchemeScript, commandShortcut, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, drawingToSvg, ease, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, inkMatch, inputLevelThresholds, invertOp, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, moveGutter, 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, safeHref, sayPosition, serialiseSort, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, 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, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
|
|
23287
23488
|
//# sourceMappingURL=index.js.map
|