strata-react 2.1.8 → 2.1.9
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/UPGRADING.md +4 -0
- package/dist/index.js +33 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/UPGRADING.md
CHANGED
|
@@ -11,6 +11,10 @@ time. While the version is 0.x, any release may break.
|
|
|
11
11
|
|
|
12
12
|
Every PR that changes what an app sees adds a line here (see `CLAUDE.md`, "Changelog").
|
|
13
13
|
|
|
14
|
+
## 2026-11-29 (ChoiceGrid and PlaceBoard: a word fits its tile)
|
|
15
|
+
|
|
16
|
+
- A `ChoiceGrid` or `PlaceBoard` picture that is a string of letters three or more long is drawn smaller, by its length, so it fits its tile. Baselines of tiles showing words move; emoji, numerals and nodes do not.
|
|
17
|
+
|
|
14
18
|
## 2026-11-28 (PlaceBoard and PageHeader: the board stays still)
|
|
15
19
|
|
|
16
20
|
- A locked `PlaceBoard` with `check` keeps the Check in the DOM, invisible, `inert` and `aria-hidden` (so `queryByRole("button", { name: "Check" })` is still null, but a `hidden: true` query finds it). A shot of a locked board grows by the Check's room.
|
package/dist/index.js
CHANGED
|
@@ -12875,9 +12875,19 @@ function useBeckon(on, open, ms) {
|
|
|
12875
12875
|
className: lit.beat % 2 ? "beckon" : "beckon-again"
|
|
12876
12876
|
} : null;
|
|
12877
12877
|
}
|
|
12878
|
+
const TILE = "min(var(--type-picture-size, 4.5rem), 75cqi)";
|
|
12879
|
+
const WORD$1 = /^\p{L}[\p{L}\p{M}' -]*$/u;
|
|
12880
|
+
const WORD_SHARE = 140;
|
|
12881
|
+
const letters = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
12878
12882
|
/** A tile's picture: the `type-picture` step, but never more than 75% of the tile it sits in (the tile is a size
|
|
12879
|
-
* container), so an app that grows the step on a wide screen does not push a picture out of a small tile.
|
|
12880
|
-
|
|
12883
|
+
* container), so an app that grows the step on a wide screen does not push a picture out of a small tile. A word of
|
|
12884
|
+
* three letters or more (`content` a string of letters) is made smaller still, so the whole word fits across the tile:
|
|
12885
|
+
* the longer the word, the smaller. */
|
|
12886
|
+
function pictureInTile(content) {
|
|
12887
|
+
if (typeof content !== "string" || !WORD$1.test(content)) return { fontSize: TILE };
|
|
12888
|
+
const n = [...letters.segment(content)].length;
|
|
12889
|
+
return n <= 2 ? { fontSize: TILE } : { fontSize: `min(var(--type-picture-size, 4.5rem), 75cqi, ${Math.round(WORD_SHARE / n * 10) / 10}cqi)` };
|
|
12890
|
+
}
|
|
12881
12891
|
|
|
12882
12892
|
// src/components/choice-grid.tsx
|
|
12883
12893
|
const minSide = {
|
|
@@ -12914,12 +12924,15 @@ function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, ma
|
|
|
12914
12924
|
"data-choice": s,
|
|
12915
12925
|
"data-beckon": key === lit?.key || void 0,
|
|
12916
12926
|
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"), (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"),
|
|
12917
|
-
children: [
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12927
|
+
children: [(() => {
|
|
12928
|
+
const drawn = renderPicture(item);
|
|
12929
|
+
return /* @__PURE__ */ jsx("span", {
|
|
12930
|
+
"aria-hidden": true,
|
|
12931
|
+
className: cn("type-picture transition-state", s === "wrong" && "opacity-40"),
|
|
12932
|
+
style: pictureInTile(drawn),
|
|
12933
|
+
children: drawn
|
|
12934
|
+
});
|
|
12935
|
+
})(), mark && /* @__PURE__ */ jsx(Status, {
|
|
12923
12936
|
tone: s === "wrong" || s === "picked" ? "neutral" : "success",
|
|
12924
12937
|
className: "max-w-full truncate",
|
|
12925
12938
|
children: mark
|
|
@@ -13071,15 +13084,18 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
13071
13084
|
else buttons.current.delete(key);
|
|
13072
13085
|
};
|
|
13073
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"));
|
|
13074
|
-
const picture = (p, placed) =>
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
|
|
13081
|
-
|
|
13082
|
-
|
|
13087
|
+
const picture = (p, placed) => {
|
|
13088
|
+
const drawn = renderPiece(p);
|
|
13089
|
+
return /* @__PURE__ */ jsx("span", {
|
|
13090
|
+
"aria-hidden": true,
|
|
13091
|
+
className: "type-picture",
|
|
13092
|
+
style: placed ? {
|
|
13093
|
+
...placedPicture,
|
|
13094
|
+
...pictureInTile(drawn)
|
|
13095
|
+
} : pictureInTile(drawn),
|
|
13096
|
+
children: drawn
|
|
13097
|
+
});
|
|
13098
|
+
};
|
|
13083
13099
|
const piece = (p, placed) => {
|
|
13084
13100
|
const key = pieceKey(p);
|
|
13085
13101
|
const isHeld = held !== void 0 && pieceKey(held) === key;
|