@wildwinter/app-shell 0.50.0 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/dist/{chunk-JOFRUWTP.js → chunk-4QDD6GF3.js} +29 -4
- package/dist/chunk-4QDD6GF3.js.map +1 -0
- package/dist/{chunk-TETY2BTN.js → chunk-NGLZUDOT.js} +3 -3
- package/dist/{chunk-TETY2BTN.js.map → chunk-NGLZUDOT.js.map} +1 -1
- package/dist/controls.css +34 -0
- package/dist/controls.css.map +1 -1
- package/dist/history.cjs +194 -0
- package/dist/history.cjs.map +1 -0
- package/dist/history.d.cts +111 -0
- package/dist/history.d.ts +111 -0
- package/dist/history.js +188 -0
- package/dist/history.js.map +1 -0
- package/dist/index.cjs +22 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/property-list.cjs.map +1 -1
- package/dist/property-list.js +2 -2
- package/dist/value-control.cjs +28 -1
- package/dist/value-control.cjs.map +1 -1
- package/dist/value-control.d.cts +17 -1
- package/dist/value-control.d.ts +17 -1
- package/dist/value-control.js +1 -1
- package/dist/value-rows.cjs +1132 -0
- package/dist/value-rows.cjs.map +1 -0
- package/dist/value-rows.d.cts +77 -0
- package/dist/value-rows.d.ts +77 -0
- package/dist/value-rows.js +305 -0
- package/dist/value-rows.js.map +1 -0
- package/package.json +21 -4
- package/dist/chunk-JOFRUWTP.js.map +0 -1
package/README.md
CHANGED
|
@@ -193,6 +193,49 @@ openKitGallery({
|
|
|
193
193
|
in 0.41 to 0.45 and ruled out by the author; `image` and the `--kit-art-*`
|
|
194
194
|
tokens are gone.
|
|
195
195
|
|
|
196
|
+
## v0.51 (the file-byte history, and rows for structured values)
|
|
197
|
+
|
|
198
|
+
**`@wildwinter/app-shell/history`** (main process): undo and redo for the files
|
|
199
|
+
an app writes, the files-are-truth way. Storyletter's, lifted so Patterpad's
|
|
200
|
+
project-level undo is the same code; the document undo of each app still
|
|
201
|
+
shares nothing.
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
import { History, captureBefore, applyStates } from "@wildwinter/app-shell/history";
|
|
205
|
+
|
|
206
|
+
const history = new History({ write: myOrderedWriter, restorer: (path) => path.endsWith(".patterx") ? trail : undefined });
|
|
207
|
+
history.record("Rename card", "card:c_1", captureBefore(paths), writes); // after the writes land
|
|
208
|
+
const outcome = await history.applyUndo(); // { ok, label } or { ok: false, error, drift? }
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- A repeated key folds into one step; `fold` adds a write nobody asked for to
|
|
212
|
+
the last step; a hundred steps are kept.
|
|
213
|
+
- **Drift is refused**: a file changed since the step (a pull, a merge, the other
|
|
214
|
+
app) refuses the undo or redo, names the file, and drops that step and every
|
|
215
|
+
one below it.
|
|
216
|
+
- A per-file `restorer` decides what counts as drift and what is written back;
|
|
217
|
+
the `write` option is the app's own write path (`applyStates`, all or nothing
|
|
218
|
+
through simple-vc-lib 0.5, by default).
|
|
219
|
+
|
|
220
|
+
**`@wildwinter/app-shell/value-rows`**: a row for a value of any declared type,
|
|
221
|
+
for an extension's fields. The seven scalars are the field row; a `reference`
|
|
222
|
+
picks one of the host's nodes, a `record` is its fields, a `map` is keyed by a
|
|
223
|
+
host's nodes or by text, a `list` adds, moves and removes items (a new item of
|
|
224
|
+
an id list gets a fresh id). The checks are `@wildwinter/toolkit/extensions`'
|
|
225
|
+
(an optional peer, 0.2.0 or later), so the editor and validation agree.
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { valueRows } from "@wildwinter/app-shell/value-rows";
|
|
229
|
+
const rows = valueRows();
|
|
230
|
+
host.append(rows.row(`${nodeId}:${decl.name}`, { decl, value, adapter: { nodes: (kind) => myNodes(kind) }, onCommit }));
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
- **v0.52:** a declaration's `valueHelp` (a sentence per enum value, flag or
|
|
234
|
+
stage, as a manifest gives them) shows the chosen value's under the control,
|
|
235
|
+
and each chosen flag's, in the field row and so in every value row. The
|
|
236
|
+
adapter's optional `label(kind, id)` names a held node the choices leave out,
|
|
237
|
+
so only a node the host says is gone reads as gone.
|
|
238
|
+
|
|
196
239
|
## Roadmap
|
|
197
240
|
|
|
198
241
|
Later slices lift the rest of the common shell from Patterpad (canonical),
|
|
@@ -78,6 +78,23 @@ function rungStrip(opts) {
|
|
|
78
78
|
}
|
|
79
79
|
return strip;
|
|
80
80
|
}
|
|
81
|
+
function valueHelpText(decl, value) {
|
|
82
|
+
const help = decl.valueHelp;
|
|
83
|
+
if (help === void 0) return "";
|
|
84
|
+
const said = (v) => Object.prototype.hasOwnProperty.call(help, v) ? help[v] : void 0;
|
|
85
|
+
if (decl.type === "enum" || decl.type === "quality") {
|
|
86
|
+
const held = typeof value === "string" && value !== "" ? value : typeof decl.default === "string" && decl.default !== "" ? decl.default : decl.type === "enum" ? decl.values?.[0] : decl.stages?.[0];
|
|
87
|
+
return held === void 0 ? "" : said(held) ?? "";
|
|
88
|
+
}
|
|
89
|
+
if (decl.type === "flags") {
|
|
90
|
+
const held = Array.isArray(value) ? value.map(String) : Array.isArray(decl.default) ? decl.default.map(String) : [];
|
|
91
|
+
return held.flatMap((v) => {
|
|
92
|
+
const h = said(v);
|
|
93
|
+
return h === void 0 ? [] : [`${v}: ${h}`];
|
|
94
|
+
}).join("\n");
|
|
95
|
+
}
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
81
98
|
var fallbackFlags = (decl) => Array.isArray(decl.default) ? decl.default.filter((v) => typeof v === "string") : [];
|
|
82
99
|
function fieldValueProblem(decl, value) {
|
|
83
100
|
if (value === void 0 || value === null || value === "") return "";
|
|
@@ -118,6 +135,7 @@ function fieldRow(initial) {
|
|
|
118
135
|
caption.id = `shell-fr-${Math.random().toString(36).slice(2, 9)}`;
|
|
119
136
|
const body = el("div", "shell-fieldrow-body");
|
|
120
137
|
const purpose = el("p", "shell-fieldrow-purpose");
|
|
138
|
+
const valueHelp = el("p", "shell-fieldrow-purpose shell-fieldrow-valuehelp");
|
|
121
139
|
const problem = el("p", "shell-fieldrow-problem");
|
|
122
140
|
problem.setAttribute("role", "status");
|
|
123
141
|
row.append(caption, body);
|
|
@@ -138,6 +156,9 @@ function fieldRow(initial) {
|
|
|
138
156
|
purpose.id = `${caption.id}-p`;
|
|
139
157
|
problem.id = `${caption.id}-m`;
|
|
140
158
|
const sayProblem = () => {
|
|
159
|
+
const help = valueHelpText(opts.decl, opts.value);
|
|
160
|
+
valueHelp.textContent = help;
|
|
161
|
+
valueHelp.hidden = help === "";
|
|
141
162
|
const words = [typing || fieldValueProblem(opts.decl, opts.value), opts.problem ?? ""].filter((w) => w !== "");
|
|
142
163
|
problem.textContent = words.join(" ");
|
|
143
164
|
problem.hidden = words.length === 0;
|
|
@@ -327,7 +348,7 @@ function fieldRow(initial) {
|
|
|
327
348
|
purpose.textContent = decl.purpose ?? "";
|
|
328
349
|
if (decl.purpose) body.append(purpose);
|
|
329
350
|
else purpose.remove();
|
|
330
|
-
body.append(problem);
|
|
351
|
+
body.append(valueHelp, problem);
|
|
331
352
|
sayProblem();
|
|
332
353
|
};
|
|
333
354
|
draw(initial);
|
|
@@ -401,6 +422,10 @@ var keeper = /* @__PURE__ */ (() => {
|
|
|
401
422
|
holds: (row) => memos.has(row)
|
|
402
423
|
};
|
|
403
424
|
})();
|
|
425
|
+
var fieldRowFocus = {
|
|
426
|
+
settle: (row) => keeper.settle(row),
|
|
427
|
+
restore: (row) => keeper.restore(row)
|
|
428
|
+
};
|
|
404
429
|
function fieldRows() {
|
|
405
430
|
const rows = /* @__PURE__ */ new Map();
|
|
406
431
|
return {
|
|
@@ -426,6 +451,6 @@ function fieldRows() {
|
|
|
426
451
|
};
|
|
427
452
|
}
|
|
428
453
|
|
|
429
|
-
export { defaultLabel, fallbackText, fieldRow, fieldRows, fieldValueProblem, rungStrip, stageGateNote };
|
|
430
|
-
//# sourceMappingURL=chunk-
|
|
431
|
-
//# sourceMappingURL=chunk-
|
|
454
|
+
export { defaultLabel, fallbackText, fieldRow, fieldRowFocus, fieldRows, fieldValueProblem, rungStrip, stageGateNote, valueHelpText };
|
|
455
|
+
//# sourceMappingURL=chunk-4QDD6GF3.js.map
|
|
456
|
+
//# sourceMappingURL=chunk-4QDD6GF3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/value-control.ts"],"names":[],"mappings":";;;AAqCO,SAAS,aAAa,IAAA,EAA6B;AACxD,EAAA,MAAM,IAAI,IAAA,CAAK,OAAA;AACf,EAAA,IAAI,CAAA,KAAM,MAAA,IAAa,CAAA,KAAM,IAAA,EAAM;AACjC,IAAA,IAAI,OAAO,CAAA,KAAM,SAAA,EAAW,OAAO,IAAI,MAAA,GAAS,OAAA;AAChD,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA,EAAG,OAAO,CAAA,CAAE,MAAA,KAAW,CAAA,GAAI,MAAA,GAAS,CAAA,CAAE,IAAA,CAAK,IAAI,CAAA;AAClE,IAAA,OAAO,CAAA,KAAM,EAAA,GAAK,MAAA,GAAS,MAAA,CAAO,CAAC,CAAA;AAAA,EACrC;AACA,EAAA,QAAQ,KAAK,IAAA;AAAM,IACjB,KAAK,SAAA;AAAW,MAAA,OAAO,OAAA;AAAA,IACvB,KAAK,QAAA;AAAU,MAAA,OAAO,GAAA;AAAA,IACtB,KAAK,MAAA;AAAQ,MAAA,OAAO,IAAA,CAAK,MAAA,GAAS,CAAC,CAAA,IAAK,MAAA;AAAA,IACxC,KAAK,SAAA;AAAW,MAAA,OAAO,IAAA,CAAK,MAAA,GAAS,CAAC,CAAA,IAAK,aAAA;AAAA,IAC3C,KAAK,OAAA;AAAS,MAAA,OAAO,MAAA;AAAA,IACrB;AAAS,MAAA,OAAO,OAAA;AAAA;AAEpB;AAGO,IAAM,eAAe,CAAC,IAAA,KAAgC,CAAA,SAAA,EAAY,YAAA,CAAa,IAAI,CAAC,CAAA,CAAA;AAOpF,SAAS,cAAc,KA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ACjG;AAAA,GACF;AACF","file":"chunk-4QDD6GF3.js","sourcesContent":["// ---------------------------------------------------------------------------\n// Typed value controls: how both apps show and set a value of a declared type.\n//\n// The first is the quality's. A quality is a step on a ladder, so its value is\n// shown as the LADDER, with the current rung marked, rather than a dropdown that\n// shows one name and hides where it stands (patterkit design/proposals/\n// patter-qualities.md section 4). Storyletter's Board drew it this way first;\n// it lives here so Storyletter's Fields tab, Patterpad's play panel and Game\n// Data rows, and the play inspectors all draw the same strip.\n//\n// An UNSET value (a field or game-data value the node leaves out) names what it\n// falls back to, \"default (x)\", by the family's one rule: the declaration's own\n// default, else the type's (a quality's first stage). A value that is no longer\n// a stage (a deleted one) is shown as such, so it can be put back on the ladder.\n//\n// No Electron, no app state: this module is DOM only, and is its own entry point\n// (`@wildwinter/app-shell/value-control`) so a play inspector outside the apps\n// can take it.\n// ---------------------------------------------------------------------------\n\nimport { el, tagChips } from \"./dom.js\";\n\n/** A declaration as these controls read it: a property's, a field's or a game-data field's. */\nexport interface ValueDeclLike {\n type: string;\n default?: unknown;\n /** enum / flags */\n values?: readonly string[];\n /** quality: the ladder, in order */\n stages?: readonly string[];\n}\n\n/**\n * What an unset value of `decl` falls back to, as the words a control shows: its own default where it has\n * one, else its type's (False, 0, the first value, no flags, the first stage, empty text). The kernel's\n * `defaultFor`, in words; a host reads the same value from the bundle.\n */\nexport function fallbackText(decl: ValueDeclLike): string {\n const d = decl.default;\n if (d !== undefined && d !== null) {\n if (typeof d === \"boolean\") return d ? \"True\" : \"False\";\n if (Array.isArray(d)) return d.length === 0 ? \"none\" : d.join(\", \");\n return d === \"\" ? \"none\" : String(d);\n }\n switch (decl.type) {\n case \"boolean\": return \"False\";\n case \"number\": return \"0\";\n case \"enum\": return decl.values?.[0] ?? \"none\";\n case \"quality\": return decl.stages?.[0] ?? \"first stage\";\n case \"flags\": return \"none\";\n default: return \"empty\";\n }\n}\n\n/** The label an unset value shows: \"default (x)\", naming what it falls back to. */\nexport const defaultLabel = (decl: ValueDeclLike): string => `default (${fallbackText(decl)})`;\n\n/**\n * The quiet line under a ladder that has just been reordered: how many gates order against it. A reorder\n * changes no value, and is the one edit that changes what a gate MEANS without saying so (patter-qualities.md\n * section 2), so the editor says so. Empty when no gate orders the quality.\n */\nexport function stageGateNote(gates: number): string {\n if (gates <= 0) return \"\";\n return gates === 1\n ? \"1 gate compares against this ladder, and it now reads the new order.\"\n : `${gates} gates compare against this ladder, and each now reads the new order.`;\n}\n\nexport interface RungStripOptions {\n /** The ladder, in order. */\n stages: readonly string[];\n /** The value held, or undefined when unset: a field or game-data value the node leaves out. */\n value: string | undefined;\n /** The declaration, for what an unset value falls back to (its default, else the first stage). */\n decl?: ValueDeclLike;\n /** Pick a stage. Absent: the strip is read-only. */\n onPick?: (stage: string) => void;\n /** Clear back to unset. With it, the strip leads with \"default (x)\", which clears the value. */\n onClear?: () => void;\n /** The rollover on a rung that is not the current one (default: `Set to \"x\"`). */\n pickTip?: (stage: string) => string;\n /**\n * The document to build in, for a host outside the apps (a play inspector in a page or a frame of its\n * own). Given, rollovers are plain `title`s and the family's themed tooltips are not mounted; the host\n * styles `.seg`, `.seg-opt` and `.shell-rung` itself. Absent: the apps' document and themed rollovers.\n */\n doc?: Document;\n}\n\n/**\n * A quality's value as its ladder: one rung per stage, in order, the current one marked (`on`). Unset, the\n * rung it falls back to is marked as the fallback (`fallback`), and with `onClear` a leading \"default (x)\"\n * option is the current choice. A value that is not a stage (a deleted one) is shown after the ladder,\n * marked `stray`, until a rung is picked.\n */\nexport function rungStrip(opts: RungStripOptions): HTMLElement {\n const make = opts.doc === undefined ? el : (tag: \"span\" | \"button\", props: { className: string; text?: string; tip?: string; onClick?: () => void }) => {\n const node = opts.doc!.createElement(tag);\n node.className = props.className;\n if (props.text !== undefined) node.textContent = props.text;\n if (props.tip !== undefined) { node.title = props.tip; node.setAttribute(\"aria-label\", props.tip); }\n if (props.onClick) node.addEventListener(\"click\", props.onClick);\n if (tag === \"button\") (node as HTMLButtonElement).type = \"button\";\n return node;\n };\n const strip = make(\"span\", { className: \"seg shell-rungs\" });\n const decl: ValueDeclLike = opts.decl ?? { type: \"quality\", stages: opts.stages };\n const unset = opts.value === undefined;\n const fallback = typeof decl.default === \"string\" && opts.stages.includes(decl.default) ? decl.default : opts.stages[0];\n const readOnly = opts.onPick === undefined;\n if (opts.onClear) {\n strip.append(make(\"button\", {\n className: `seg-opt shell-rung shell-rung-default${unset ? \" on\" : \"\"}`, text: defaultLabel(decl),\n tip: unset ? \"Not set here: the declared default holds\" : \"Clear the value, back to the default\",\n onClick: () => { if (!unset) opts.onClear!(); },\n }));\n }\n for (const stage of opts.stages) {\n const current = opts.value === stage;\n const falls = unset && stage === fallback;\n const rung = make(readOnly ? \"span\" : \"button\", {\n className: `seg-opt shell-rung${current ? \" on\" : \"\"}${falls ? \" fallback\" : \"\"}`, text: stage,\n tip: current ? \"The current stage\" : falls ? \"The stage it falls back to\" : readOnly ? stage : (opts.pickTip?.(stage) ?? `Set to \"${stage}\"`),\n ...(readOnly ? {} : { onClick: () => { if (!current) opts.onPick!(stage); } }),\n });\n strip.append(rung);\n }\n if (!unset && !opts.stages.includes(opts.value!)) {\n strip.append(make(\"span\", {\n className: \"seg-opt shell-rung stray on\", text: opts.value!,\n tip: `\"${opts.value}\" is not one of the stages: pick the one it belongs at now`,\n }));\n }\n return strip;\n}\n\n// ---------------------------------------------------------------------------\n// The field row: ONE control for a node's value of a declared field, driven by\n// the declared type, for the family's seven types (text, multiline, number,\n// boolean, enum, flags, quality). Storyletter's card and outcome Fields and\n// Patterpad's Game Data rows both draw it, which settles the disagreements the\n// parity review found (patterkit design/family-parity-2026-10.md item 10):\n//\n// - the declared purpose is shown, under the control, not hidden in a rollover;\n// - unset says what it falls back to, \"default (x)\", by `defaultLabel`;\n// - flags are a picker of the declared values, not comma-separated text;\n// - multiline is a text area;\n// - a value the declaration refuses (not a number, not one of the values, not\n// a stage) is said under the control, and the app may add its own message;\n// - text commits as typed, and Escape puts back what the field held when it\n// took focus (the family's field rule).\n//\n// Committing as typed means a host that redraws on every change (Patterpad's\n// inspector rebuilds its whole stack) would drop the focus at every keystroke.\n// `fieldRows()` is the answer: it hands back the SAME element for the same key\n// across a redraw, updated in place, and gives the focus (and the caret) back\n// to it once the redraw has put it in the page again.\n// ---------------------------------------------------------------------------\n\n/** A value a field row commits: a flags value is the list of names set. */\nexport type FieldValue = string | number | boolean | string[];\n\n/** A field's declaration as the row reads it: a card field's, an outcome field's or a game-data field's. */\nexport interface FieldDeclLike extends ValueDeclLike {\n name: string;\n /** What the field is for, shown under the control. */\n purpose?: string;\n /** A sentence about each value (an enum's values, the flags, a quality's stages), as an extension's manifest\n * gives them: the chosen value's is shown under the control, and each chosen flag's. */\n valueHelp?: Readonly<Record<string, string>>;\n}\n\n/**\n * The help for what `decl` holds: the chosen enum value's or stage's (the one it falls back to, when unset), or\n * each chosen flag's, \"name: sentence\" a line each. Empty when the declaration describes none of them.\n */\nexport function valueHelpText(decl: FieldDeclLike, value: unknown): string {\n const help = decl.valueHelp;\n if (help === undefined) return \"\";\n const said = (v: string): string | undefined => (Object.prototype.hasOwnProperty.call(help, v) ? help[v] : undefined);\n if (decl.type === \"enum\" || decl.type === \"quality\") {\n const held = typeof value === \"string\" && value !== \"\" ? value\n : typeof decl.default === \"string\" && decl.default !== \"\" ? decl.default\n : decl.type === \"enum\" ? decl.values?.[0] : decl.stages?.[0];\n return held === undefined ? \"\" : said(held) ?? \"\";\n }\n if (decl.type === \"flags\") {\n const held = Array.isArray(value) ? value.map(String) : Array.isArray(decl.default) ? decl.default.map(String) : [];\n return held.flatMap((v) => { const h = said(v); return h === undefined ? [] : [`${v}: ${h}`]; }).join(\"\\n\");\n }\n return \"\";\n}\n\nexport interface FieldRowOptions {\n decl: FieldDeclLike;\n /** The node's own value, typed (a flags value is a string list), or undefined where the node sets none. */\n value: unknown;\n /** Commit a value; `undefined` clears it, back to the default. Absent: the row is read-only. */\n onCommit?: (value: FieldValue | undefined) => void;\n /** Drawn but not editable, as when there is no node to write to. */\n disabled?: boolean;\n /** A message of the app's own about this value (a check the row cannot make), shown under the control. */\n problem?: string;\n /** The caption; default the field's name. */\n label?: string | Node;\n /** Added to the row and its caption, so a row sits in its app's layout. */\n className?: string;\n labelClassName?: string;\n /** The app's class for a text field or select, used instead of the shell's `.field`. */\n controlClassName?: string;\n}\n\nexport interface FieldRowHandle {\n /** The row: its caption, then the control with the purpose and any message under it. */\n readonly el: HTMLElement;\n /** Redraw for a new value, declaration or message, keeping the element. A field being typed in keeps its\n * text: what the author is typing is newer than what the app last stored. */\n update(opts: FieldRowOptions): void;\n}\n\n/** The type's fallback as a value, for a flags picker to start from when the node sets none. */\nconst fallbackFlags = (decl: ValueDeclLike): string[] => (Array.isArray(decl.default) ? decl.default.filter((v): v is string => typeof v === \"string\") : []);\n\n/** What the row says about a value the declaration refuses, or \"\" when it fits. */\nexport function fieldValueProblem(decl: ValueDeclLike, value: unknown): string {\n if (value === undefined || value === null || value === \"\") return \"\";\n switch (decl.type) {\n case \"number\":\n return typeof value === \"number\" && Number.isFinite(value) ? \"\" : \"Not a number.\";\n case \"boolean\":\n return typeof value === \"boolean\" ? \"\" : \"Not True or False.\";\n case \"enum\":\n return decl.values && !decl.values.includes(String(value)) ? `\"${String(value)}\" is not one of the values.` : \"\";\n case \"quality\":\n return decl.stages && !decl.stages.includes(String(value)) ? `\"${String(value)}\" is not one of the stages.` : \"\";\n case \"flags\": {\n if (!Array.isArray(value)) return \"Not a list of flags.\";\n const strays = decl.values ? value.filter((v) => !decl.values!.includes(String(v))) : [];\n if (strays.length === 0) return \"\";\n return strays.length === 1 ? `\"${String(strays[0])}\" is not one of the values.` : `${strays.map((s) => `\"${String(s)}\"`).join(\", \")} are not among the values.`;\n }\n default:\n return \"\";\n }\n}\n\nconst isTextual = (type: string): boolean => type !== \"boolean\" && type !== \"enum\" && type !== \"flags\" && type !== \"quality\";\n\n/** Everything that decides which control is drawn: a change here rebuilds it, anything else updates it. */\nconst controlShape = (o: FieldRowOptions): string => JSON.stringify([\n o.decl.type, o.decl.values ?? null, o.decl.stages ?? null, o.decl.default ?? null,\n o.onCommit === undefined, o.disabled === true, o.controlClassName ?? \"\",\n o.decl.type === \"quality\" && (o.decl.stages?.length ?? 0) === 0,\n]);\n\n/**\n * One declared field's value as a row: the caption, then the control the declared type calls for, with the\n * purpose and any message under it. See the section comment above for the rules it carries.\n */\nexport function fieldRow(initial: FieldRowOptions): FieldRowHandle {\n let opts = initial;\n const row = el(\"div\", `shell-fieldrow${opts.className ? ` ${opts.className}` : \"\"}`);\n const caption = el(\"span\", `shell-fieldrow-label${opts.labelClassName ? ` ${opts.labelClassName}` : \"\"}`);\n caption.id = `shell-fr-${Math.random().toString(36).slice(2, 9)}`;\n const body = el(\"div\", \"shell-fieldrow-body\");\n const purpose = el(\"p\", \"shell-fieldrow-purpose\");\n const valueHelp = el(\"p\", \"shell-fieldrow-purpose shell-fieldrow-valuehelp\");\n const problem = el(\"p\", \"shell-fieldrow-problem\");\n problem.setAttribute(\"role\", \"status\");\n row.append(caption, body);\n\n let shape = \"\";\n /** Redraw the control for the current value; set by whichever control is built. */\n let show: (value: unknown) => void = () => {};\n /** A local problem the control found while typing (a number that is not one yet). */\n let typing = \"\";\n\n const commit = (v: FieldValue | undefined): void => { opts.onCommit?.(v); };\n const editable = (): boolean => opts.onCommit !== undefined && opts.disabled !== true;\n // An app's own field class replaces the shell's `.field`, so its controls look like its other fields.\n const ctl = (base: string): string => (opts.controlClassName ? `${base.replace(/^field /, \"\")} ${opts.controlClassName}` : base);\n const labelledBy = (node: HTMLElement): void => {\n node.setAttribute(\"aria-labelledby\", caption.id);\n const described = [purpose.id, problem.id].filter(Boolean).join(\" \");\n if (described) node.setAttribute(\"aria-describedby\", described);\n };\n purpose.id = `${caption.id}-p`; problem.id = `${caption.id}-m`;\n\n const sayProblem = (): void => {\n // The chosen value's own help travels with every change of value, as the message does.\n const help = valueHelpText(opts.decl, opts.value);\n valueHelp.textContent = help;\n valueHelp.hidden = help === \"\";\n const words = [typing || fieldValueProblem(opts.decl, opts.value), opts.problem ?? \"\"].filter((w) => w !== \"\");\n problem.textContent = words.join(\" \");\n problem.hidden = words.length === 0;\n row.classList.toggle(\"has-problem\", words.length > 0);\n row.classList.toggle(\"shell-fieldrow-textual\", isTextual(opts.decl.type));\n };\n\n const build = (): HTMLElement => {\n const decl = opts.decl;\n typing = \"\";\n if (decl.type === \"quality\" && (decl.stages?.length ?? 0) > 0) {\n const holder = el(\"span\", \"shell-fieldrow-rungs\");\n show = (value) => {\n holder.replaceChildren(rungStrip({\n stages: decl.stages!, value: typeof value === \"string\" && value !== \"\" ? value : undefined, decl,\n ...(editable() ? { onPick: (stage: string) => { opts = { ...opts, value: stage }; show(stage); sayProblem(); commit(stage); }, onClear: () => { opts = { ...opts, value: undefined }; show(undefined); sayProblem(); commit(undefined); } } : {}),\n }));\n const strip = holder.firstElementChild as HTMLElement | null;\n if (strip) { strip.setAttribute(\"role\", \"group\"); labelledBy(strip); }\n };\n return holder;\n }\n if (decl.type === \"boolean\" || decl.type === \"enum\") {\n const sel = el(\"select\", ctl(\"field shell-fieldrow-select\"));\n labelledBy(sel);\n sel.disabled = !editable();\n const choices: Array<[string, string]> = decl.type === \"boolean\"\n ? [[\"true\", \"True\"], [\"false\", \"False\"]]\n : (decl.values ?? []).map((v): [string, string] => [v, v]);\n show = (value) => {\n const current = value === undefined || value === null || value === \"\" ? \"\" : String(value);\n sel.replaceChildren();\n const add = (v: string, label: string): void => { const o = el(\"option\", undefined, label); o.value = v; sel.append(o); };\n add(\"\", defaultLabel(decl));\n for (const [v, label] of choices) add(v, label);\n // A value the declaration no longer offers stays visible, so the author sees what is held.\n if (current !== \"\" && !choices.some(([v]) => v === current)) add(current, current);\n sel.value = current;\n };\n sel.addEventListener(\"change\", () => {\n const raw = sel.value;\n const v: FieldValue | undefined = raw === \"\" ? undefined : decl.type === \"boolean\" ? raw === \"true\" : raw;\n opts = { ...opts, value: v }; sayProblem(); commit(v);\n });\n return sel;\n }\n if (decl.type === \"flags\" && (decl.values?.length ?? 0) > 0) {\n const holder = el(\"span\", \"shell-flags\");\n holder.setAttribute(\"role\", \"group\");\n labelledBy(holder);\n show = (value) => {\n const unset = !Array.isArray(value);\n const held = unset ? fallbackFlags(decl) : (value as unknown[]).map(String);\n holder.replaceChildren();\n const chip = (text: string, cls: string, pressed: boolean | undefined, tip: string, onClick?: () => void): void => {\n const b = el(onClick && editable() ? \"button\" : \"span\", { className: `shell-flag${cls}`, text, tip });\n b.setAttribute(\"aria-label\", `${text}: ${tip}`); // the tip alone would hide the value's name\n if (b instanceof HTMLButtonElement) { b.type = \"button\"; b.addEventListener(\"click\", onClick!); }\n if (pressed !== undefined) b.setAttribute(\"aria-pressed\", String(pressed));\n holder.append(b);\n };\n const set = (next: string[] | undefined): void => { opts = { ...opts, value: next }; show(next); sayProblem(); commit(next); };\n chip(defaultLabel(decl), ` shell-flag-default${unset ? \" on\" : \"\"}`, undefined,\n unset ? \"Not set here: the declared default holds\" : \"Clear the value, back to the default\",\n unset ? undefined : () => set(undefined));\n for (const v of decl.values!) {\n const on = held.includes(v);\n chip(v, `${on ? \" on\" : \"\"}${on && unset ? \" fallback\" : \"\"}`, on, on ? `Unset ${v}` : `Set ${v}`,\n () => set(on ? held.filter((x) => x !== v) : decl.values!.filter((x) => x === v || held.includes(x)).concat(held.filter((x) => !decl.values!.includes(x)))));\n }\n // A held value the declaration does not offer: shown, struck, and a click drops it.\n for (const v of held.filter((x) => !decl.values!.includes(x))) {\n chip(v, \" stray on\", true, `\"${v}\" is not one of the values: click to drop it`, () => set(held.filter((x) => x !== v)));\n }\n };\n return holder;\n }\n if (decl.type === \"flags\") {\n // No values declared to pick from: the shell's chip editor, each name typed.\n const holder = el(\"span\", \"shell-fieldrow-chips\");\n show = (value) => {\n const box = { values: Array.isArray(value) ? (value as unknown[]).map(String) : [] };\n const chips = tagChips(box, () => {\n const next = box.values.length > 0 ? [...box.values] : undefined;\n opts = { ...opts, value: next }; sayProblem(); commit(next);\n });\n const input = chips.querySelector(\"input\");\n if (input) { labelledBy(input); input.placeholder = Array.isArray(value) ? \"Add value\" : defaultLabel(decl); input.disabled = !editable(); }\n chips.querySelectorAll(\"button\").forEach((b) => { (b as HTMLButtonElement).disabled = !editable(); });\n holder.replaceChildren(chips);\n };\n return holder;\n }\n // text, multiline, number, and any type the row does not know: typed, committed as typed.\n const multiline = decl.type === \"multiline\";\n const field = multiline ? el(\"textarea\", ctl(\"field shell-fieldrow-text\")) : el(\"input\", ctl(\"field shell-fieldrow-text\"));\n if (field instanceof HTMLInputElement) {\n field.type = \"text\";\n if (decl.type === \"number\") field.inputMode = \"decimal\";\n } else field.rows = 3;\n labelledBy(field);\n field.placeholder = defaultLabel(decl);\n field.disabled = !editable();\n const asText = (value: unknown): string =>\n value === undefined || value === null ? \"\" : Array.isArray(value) ? value.join(\", \") : String(value);\n const read = (raw: string): { value?: FieldValue; bad?: string } => {\n if (raw.trim() === \"\") return {};\n if (decl.type !== \"number\") return { value: raw };\n const n = Number(raw.trim());\n return Number.isFinite(n) ? { value: n } : { bad: \"Not a number.\" };\n };\n let atFocus = \"\";\n show = (value) => {\n // What the author is typing is newer than the stored value, so a focused field keeps its text.\n // So does one the author was in when a redraw took the row out of the page, until they leave it.\n if (field.ownerDocument.activeElement === field || keeper.restoring(field) || keeper.holds(row)) return;\n field.value = asText(value);\n };\n const take = (): void => {\n const r = read(field.value);\n typing = r.bad ?? \"\";\n if (r.bad === undefined) opts = { ...opts, value: r.value };\n sayProblem();\n if (r.bad === undefined) commit(r.value);\n };\n field.addEventListener(\"focus\", () => { if (!keeper.restoring(field)) atFocus = field.value; });\n field.addEventListener(\"input\", take);\n field.addEventListener(\"keydown\", (e) => {\n if ((e as KeyboardEvent).key !== \"Escape\" || field.value === atFocus) return;\n field.value = atFocus;\n take();\n });\n return field;\n };\n\n const draw = (next: FieldRowOptions): void => {\n const decl = next.decl;\n const label = next.label ?? decl.name;\n if (typeof label === \"string\") caption.textContent = label; else caption.replaceChildren(label);\n caption.className = `shell-fieldrow-label${next.labelClassName ? ` ${next.labelClassName}` : \"\"}`;\n row.className = `shell-fieldrow${next.className ? ` ${next.className}` : \"\"}`;\n const nextShape = controlShape(next);\n opts = next;\n if (nextShape !== shape) {\n shape = nextShape;\n body.replaceChildren(build());\n }\n show(next.value);\n purpose.textContent = decl.purpose ?? \"\";\n if (decl.purpose) body.append(purpose); else purpose.remove();\n body.append(valueHelp, problem);\n sayProblem();\n };\n\n draw(initial);\n keeper.watch(row);\n return { el: row, update: draw };\n}\n\n// --- keeping the focus across a redraw -------------------------------------\n//\n// A host that rebuilds its view takes the row out of the page and puts it back.\n// Taking a focused element out drops its focus, which is the same thing as\n// the author losing their place mid-word. So a row remembers whether the\n// author was in it, and where the caret was, and the cache gives both back\n// once the row is in the page again (a microtask: after the host's redraw).\n\ninterface FocusMemo { field: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement; start: number | null; end: number | null }\n\nconst keeper = (() => {\n const memos = new WeakMap<HTMLElement, FocusMemo>();\n const restoringNow = new WeakSet<Element>();\n /** When each row was last handed back by the cache, to tell a move's late blur from the author's. */\n const redrawn = new WeakMap<HTMLElement, number>();\n const put = (row: HTMLElement): void => {\n const memo = memos.get(row);\n if (!memo) return;\n const doc = row.ownerDocument;\n const active = doc.activeElement;\n if (!row.isConnected || !memo.field.isConnected || !row.contains(memo.field)) return;\n if (active && active !== doc.body && !row.contains(active)) { memos.delete(row); return; }\n if (active === memo.field && memo.field.matches(\":focus\")) return;\n restoringNow.add(memo.field);\n try {\n memo.field.focus({ preventScroll: true });\n if (!(memo.field instanceof HTMLSelectElement) && memo.start !== null) memo.field.setSelectionRange(memo.start, memo.end ?? memo.start);\n } finally { restoringNow.delete(memo.field); }\n };\n return {\n watch(row: HTMLElement): void {\n const note = (e: Event): void => {\n const t = e.target;\n if (!(t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement)) return;\n const text = !(t instanceof HTMLSelectElement);\n memos.set(row, { field: t, start: text ? (t as HTMLInputElement).selectionStart : null, end: text ? (t as HTMLInputElement).selectionEnd : null });\n };\n row.addEventListener(\"focusin\", note);\n row.addEventListener(\"input\", note);\n row.addEventListener(\"keyup\", note);\n row.addEventListener(\"mouseup\", note);\n // A blur the author made (the row still in the page) forgets; one caused by the row leaving the page\n // does not, and is what the cache puts back. Chromium drops the focus of a moved element LATE: the\n // blur arrives after the redraw, the row already back in the page, so a blur to nowhere just after a\n // redraw is the move's, and the focus goes straight back.\n // Chromium may also fire that blur synchronously, as the host clears its view and before the cache\n // has handed the row back: so the decision waits for the microtask, by which time a row the redraw\n // asked for again is marked as redrawn since the blur.\n row.addEventListener(\"focusout\", (e) => {\n const at = performance.now();\n const late = (e as FocusEvent).relatedTarget === null && at - (redrawn.get(row) ?? -Infinity) < 250;\n if (late && memos.has(row)) { queueMicrotask(() => put(row)); return; }\n queueMicrotask(() => {\n if ((redrawn.get(row) ?? -Infinity) >= at) { put(row); return; }\n if (row.isConnected && !row.contains(row.ownerDocument.activeElement)) memos.delete(row);\n });\n });\n },\n /** Give the focus back to the row, if the author was in it and has not gone anywhere else since. */\n restore(row: HTMLElement): void {\n if (!memos.has(row)) return;\n redrawn.set(row, performance.now());\n // At the microtask, not now: the event that caused the redraw may still note the caret.\n queueMicrotask(() => put(row));\n },\n restoring: (field: Element): boolean => restoringNow.has(field),\n /** Forget the row's focus if the author has since gone somewhere else (before the row is redrawn). */\n settle(row: HTMLElement): void {\n const active = row.ownerDocument.activeElement;\n if (active && active !== row.ownerDocument.body && !row.contains(active)) memos.delete(row);\n },\n /** The row the author is in (before a redraw takes it out). */\n holds: (row: HTMLElement): boolean => memos.has(row),\n };\n})();\n\n/**\n * The focus keeping `fieldRows` does, for a host (or a structured row) that keeps row elements itself: call\n * `settle` before it updates a row and `restore` once the row is back in the page.\n */\nexport const fieldRowFocus = {\n settle: (row: HTMLElement): void => keeper.settle(row),\n restore: (row: HTMLElement): void => keeper.restore(row),\n};\n\nexport interface FieldRows {\n /**\n * The row for `key` (a node and a field, say `${nodeId}:${field}`): the same element as last time when\n * there was one, updated for these options, else a new one. A row the author was typing in gets its focus\n * and caret back once the redraw has put it in the page.\n */\n row(key: string, opts: FieldRowOptions): HTMLElement;\n /** Forget every row not asked for since the last sweep (call at the end of a redraw). */\n sweep(): void;\n}\n\n/** A cache of field rows for a host that redraws its whole view on every change. */\nexport function fieldRows(): FieldRows {\n const rows = new Map<string, { handle: FieldRowHandle; used: boolean }>();\n return {\n row(key, opts) {\n const had = rows.get(key);\n if (had) {\n had.used = true;\n keeper.settle(had.handle.el);\n had.handle.update(opts);\n keeper.restore(had.handle.el);\n return had.handle.el;\n }\n const handle = fieldRow(opts);\n rows.set(key, { handle, used: true });\n return handle.el;\n },\n sweep() {\n for (const [key, entry] of rows) { if (!entry.used) rows.delete(key); else entry.used = false; }\n },\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultLabel, fallbackText } from './chunk-
|
|
1
|
+
import { defaultLabel, fallbackText } from './chunk-4QDD6GF3.js';
|
|
2
2
|
import { el, iconBtn, moveItem, labelled, tagChips, stageChips } from './chunk-W4WC4FO5.js';
|
|
3
3
|
|
|
4
4
|
// src/settings.ts
|
|
@@ -563,5 +563,5 @@ function mountPropertyList(host, decls, opts = {}) {
|
|
|
563
563
|
}
|
|
564
564
|
|
|
565
565
|
export { PROPERTY_NAME_HINT, PROPERTY_TYPES, RESERVED_PROPERTY_NAMES, bindPropertyName, bindPropertyRef, defaultControl, dupGuard, expandableRow, firstIllegalPropertyName, focusNewRow, isCaseOnlyPropertyName, isValidPropertyName, mountPropertyList, mountSettingsDialog, propertyNameProblem, propertyNameify, propertyRefProblem, revalidatePropertyRefs, revealRow, revealRowWhenReady };
|
|
566
|
-
//# sourceMappingURL=chunk-
|
|
567
|
-
//# sourceMappingURL=chunk-
|
|
566
|
+
//# sourceMappingURL=chunk-NGLZUDOT.js.map
|
|
567
|
+
//# sourceMappingURL=chunk-NGLZUDOT.js.map
|