spell-ui 0.8.16 → 0.8.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/{UIInput-B3K0w4ow.js → UIInput-8s1aiaw1.js} +2 -2
  2. package/dist/UIInput-8s1aiaw1.js.map +1 -0
  3. package/dist/{UIRuntime-DxC1O7ON.js → UIRuntime-BaokNnwk.js} +8 -4
  4. package/dist/UIRuntime-BaokNnwk.js.map +1 -0
  5. package/dist/_spell-element/UIComponent.d.ts +7 -0
  6. package/dist/_spell-element/elements.types.d.ts +6 -0
  7. package/dist/_spell-element/vocabulary.types.d.ts +22 -0
  8. package/dist/_util/dom.d.ts +1 -1
  9. package/dist/components/ui-graph/UIGraph.d.ts +17 -0
  10. package/dist/components/ui-graph/UIGraph.en.d.ts +17 -0
  11. package/dist/components/ui-graph/UIGraph.es.d.ts +6 -0
  12. package/dist/components/ui-modal/ChoiceRows.d.ts +61 -0
  13. package/dist/components/ui-modal/ModalDialogs.d.ts +15 -1
  14. package/dist/components/ui-modal/UIModal.d.ts +6 -2
  15. package/dist/components/ui-modal/UIModal.en.d.ts +6 -2
  16. package/dist/components/ui-modal/UIModal.es.d.ts +1 -0
  17. package/dist/components/ui-tree/UITree.d.ts +5 -0
  18. package/dist/components/ui-tree/UITree.en.d.ts +5 -0
  19. package/dist/components/ui-tree/UITree.es.d.ts +3 -0
  20. package/dist/{components.es-eyezTRd7.js → components.es-jY2nBwuP.js} +11 -3
  21. package/dist/components.es-jY2nBwuP.js.map +1 -0
  22. package/dist/core.js +456 -431
  23. package/dist/core.js.map +1 -1
  24. package/dist/runtime/Modals.d.ts +7 -2
  25. package/dist/runtime/Styles.d.ts +7 -1
  26. package/dist/runtime/runtime.types.d.ts +26 -1
  27. package/dist/ui-calendar.js +1 -1
  28. package/dist/ui-graph.js +22 -0
  29. package/dist/ui-graph.js.map +1 -1
  30. package/dist/ui-input.js +1 -1
  31. package/dist/ui-modal.js +183 -97
  32. package/dist/ui-modal.js.map +1 -1
  33. package/dist/ui-root.js +1 -1
  34. package/dist/ui-search.js +1 -1
  35. package/dist/ui-tree.js +6 -1
  36. package/dist/ui-tree.js.map +1 -1
  37. package/dist/vocabulary/hooks.generated.d.ts +7 -0
  38. package/package.json +1 -1
  39. package/dist/UIInput-B3K0w4ow.js.map +0 -1
  40. package/dist/UIRuntime-DxC1O7ON.js.map +0 -1
  41. package/dist/components.es-eyezTRd7.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { Disposer, ModalOptions, ModalProvider } from './runtime.types';
1
+ import { ChooseModalOptions, Disposer, ModalOptions, ModalProvider } from './runtime.types';
2
2
  /****************
3
3
  * ### `Modals`
4
4
  * Promise-based dialogs, as `UI.modals`: `confirm()`, `alert()`, `prompt()` -- the Fomantic
5
- * `$.modal('confirm', ...)` shortcuts.
5
+ * `$.modal('confirm', ...)` shortcuts -- and `choose()`, a pick from a list.
6
6
  * - A thin front door: the `ui-modal` family registers its provider (`register()`) when it's imported, so the
7
7
  * runtime chunk carries no modal markup.
8
8
  * - Until then every method throws, rather than falling back to `window.confirm()` with different behaviour;
@@ -37,6 +37,11 @@ export declare class Modals {
37
37
  alert(options: ModalOptions | string): Promise<void>;
38
38
  /** Resolves with the entered text, or `undefined` on deny / dismiss. */
39
39
  prompt(options: ModalOptions | string): Promise<string | undefined>;
40
+ /**
41
+ * Resolves with the positions of the rows picked, or `undefined` on deny / dismiss (epic `language` P66).
42
+ * - One: a row picks itself; several (`options.several`): each row turns on and off, and OK picks them.
43
+ */
44
+ choose(options: ChooseModalOptions): Promise<number[] | undefined>;
40
45
  /** `Modals.provider`; throws until the `ui-modal` family has registered one. */
41
46
  private get registeredProvider();
42
47
  /** Options for `input`: a bare string is the message. */
@@ -114,7 +114,13 @@ export declare class Styles {
114
114
  private startApp;
115
115
  /** Recompute one root's `adoptedStyleSheets`. */
116
116
  private push;
117
- /** Re-push every live root; drops collected ones. */
117
+ /**
118
+ * Re-push every live root; drops collected ones.
119
+ * - Skips a root out of the page's document for the moment: its element being moved through a detached template's
120
+ * (Solid inserts a child before the new parent is on the page), where the browser refuses the page's sheets
121
+ * ("Sharing constructed stylesheets in multiple documents is not allowed"; epic `editor` P37).
122
+ * Its own sheets came when it was made; it keeps them.
123
+ */
118
124
  private refreshRoots;
119
125
  /** Put the page sheets onto `document.adoptedStyleSheets`, keeping anything else already there. */
120
126
  private refreshPage;
@@ -363,7 +363,7 @@ export type ToastProvider = {
363
363
  /** remove a toast early */
364
364
  dismiss(id: string): void;
365
365
  };
366
- /** Options for `UI.modals.confirm/alert/prompt()`. */
366
+ /** Options for `UI.modals.confirm/alert/prompt/choose()`. */
367
367
  export type ModalOptions = {
368
368
  /** header text */
369
369
  title?: string;
@@ -394,6 +394,29 @@ export type ModalOptions = {
394
394
  */
395
395
  closable?: boolean;
396
396
  };
397
+ /**
398
+ * Options for `UI.modals.choose()`: a dialog's, and its rows (epic `language` P66).
399
+ * - Up to 20 rows: a button each. More: a list that scrolls, with a search box above it.
400
+ */
401
+ export type ChooseModalOptions = ModalOptions & {
402
+ /** what's picked from, one row each */
403
+ rows: readonly ChoiceRow[];
404
+ /** pick several: each row turns on and off, and OK picks them; else a row picks itself, and the dialog closes */
405
+ several?: boolean;
406
+ /** several: the fewest that may be picked; default 1 */
407
+ least?: number;
408
+ /** several: the most that may be picked; default every row */
409
+ most?: number;
410
+ /** how many rows show before the rows scroll; default every button, or 10 of a list */
411
+ shown?: number;
412
+ };
413
+ /** One row of `UI.modals.choose()`. */
414
+ export type ChoiceRow = {
415
+ /** its words */
416
+ title: string;
417
+ /** a color to draw as a chip before them, Spell UI's hue name (`red`) or any CSS color */
418
+ color?: string;
419
+ };
397
420
  /** What the modal component registers as `Modals.provider`. */
398
421
  export type ModalProvider = {
399
422
  /** resolves `true` on approve, `false` on deny / dismiss */
@@ -402,6 +425,8 @@ export type ModalProvider = {
402
425
  alert(options: ModalOptions): Promise<void>;
403
426
  /** resolves with the entered text, or `undefined` on deny / dismiss */
404
427
  prompt(options: ModalOptions): Promise<string | undefined>;
428
+ /** resolves with the positions of the rows picked, or `undefined` on deny / dismiss */
429
+ choose(options: ChooseModalOptions): Promise<number[] | undefined>;
405
430
  };
406
431
  export { ApiError, answerOf, fetchOk, fetchText, type ApiErrorCause, type ApiMethod, type ApiRequest, type ApiResponseType, type ApiUrlData, type FetchFailure } from '../_util/fetching';
407
432
  /** Text `UI.sources.load()` fetched. */
@@ -1,7 +1,7 @@
1
1
  import "./rolldown-runtime-c6e9CmGy.js";
2
2
  import { A as e, C as t, D as n, F as r, Gt as i, IconGlyph as a, Jt as o, Kt as s, NativeFallback as c, PopoverPanel as l, RUNTIME_KEY as u, UI as d, Ut as f, Wt as p, Yt as m, controlled as h, cssState as g, derived as _, escapeRegExp as v, et as ee, h as te, lazy as ne, n as re, numberToWord as ie, on as ae, onChange as y, proto as b, protoMerged as oe, qt as x, state as S, untracked as C, v as se, w as ce } from "./core.js";
3
3
  import { FormComponent as le } from "./forms.js";
4
- import { t as ue } from "./UIInput-B3K0w4ow.js";
4
+ import { t as ue } from "./UIInput-8s1aiaw1.js";
5
5
  import { For as w, Show as T } from "solid-js";
6
6
  import { addEvent as E, className as D, createComponent as O, delegateEvents as de, effect as k, insert as A, isServer as j, memo as fe, readShallow as M, ref as N, setAttribute as P, spread as pe, style as me, template as F } from "@solidjs/web";
7
7
  // src/components/ui-calendar/UICalendar.en.ts
package/dist/ui-graph.js CHANGED
@@ -666,6 +666,28 @@ var se = {
666
666
  text: "Loading …",
667
667
  description: "A node whose children are loading."
668
668
  }
669
+ ],
670
+ hooks: [
671
+ {
672
+ name: "nodeLabel",
673
+ words: "give the label of (a node)",
674
+ description: "A node's text; by default its `label`, else its id."
675
+ },
676
+ {
677
+ name: "nodeClass",
678
+ words: "give the class of (a node)",
679
+ description: "Extra class names on a node, for the subclass's own sheet."
680
+ },
681
+ {
682
+ name: "edgeLabel",
683
+ words: "give the label of (an edge)",
684
+ description: "An edge's text, at its middle; none: no text."
685
+ },
686
+ {
687
+ name: "edgeClass",
688
+ words: "give the class of (an edge)",
689
+ description: "Extra class names on an edge, for the subclass's own sheet."
690
+ }
669
691
  ]
670
692
  }, ce = "@layer ui.components.graph.types{:host{font-family:var(--ui-graph-font-family,var(--ui-font-family));display:block}.ui.graph,.ui.graph :is(.node,.edge-group,.port,.pin){--_ui-graph-height:var(--ui-graph-height,28em);--_ui-graph-background:var(--ui-graph-background,var(--ui-surface));--_ui-graph-border-color:var(--ui-graph-border-color,var(--ui-border-color));--_ui-graph-radius:var(--ui-graph-radius,var(--ui-radius-m));--_ui-graph-node-background:var(--ui-graph-node-background,var(--ui-surface-muted));--_ui-graph-node-border-color:var(--ui-graph-node-border-color,var(--ui-border-color-strong));--_ui-graph-container-background:var(--ui-graph-container-background,transparent);--_ui-graph-container-border-color:var(--ui-graph-container-border-color,var(--ui-border-color-strong));--_ui-graph-label-color:var(--ui-graph-label-color,var(--ui-text-color));--_ui-graph-port-color:var(--ui-graph-port-color,var(--ui-text-muted));--_ui-graph-edge-color:var(--ui-graph-edge-color,var(--ui-text-light));--_ui-graph-edge-label-color:var(--ui-graph-edge-label-color,var(--ui-text-muted));--_ui-graph-highlight-color:var(--ui-graph-highlight-color,var(--ui-primary));--_ui-graph-selected-color:var(--ui-graph-selected-color,var(--ui-orange,var(--ui-primary)))}.ui.graph{height:var(--_ui-graph-height);border:1px solid var(--_ui-graph-border-color);border-radius:var(--_ui-graph-radius);background:var(--_ui-graph-background);flex-direction:column;display:flex;position:relative;overflow:hidden}.breadcrumbs{border-bottom:1px solid var(--_ui-graph-border-color);flex:none;padding:.5em .75em;display:block}.breadcrumbs ui-breadcrumb:not([selected]){cursor:var(--ui-control-cursor,pointer)}.toolbar{z-index:1;gap:.25em;display:flex;position:absolute;bottom:.5em;right:.5em}.toolbar button{border:1px solid var(--_ui-graph-border-color);border-radius:var(--ui-radius-s,4px);background:var(--_ui-graph-background);color:var(--ui-text-color);font:inherit;cursor:var(--ui-control-cursor,pointer);padding:.25em .75em;font-size:.8125em}.toolbar button:hover{border-color:var(--_ui-graph-highlight-color)}.canvas{cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;flex:auto;width:100%;min-height:0;display:block}:host(:state(panning)) .canvas{cursor:grabbing}.modal-graph-box{padding:1em}}@layer ui.components.graph.content{.canvas{& .box{fill:var(--_ui-graph-node-background);stroke:var(--_ui-graph-node-border-color);stroke-width:1px;rx:4px}& .container>.box{fill:var(--_ui-graph-container-background);stroke:var(--_ui-graph-container-border-color);stroke-dasharray:4 3}& .label{fill:var(--_ui-graph-label-color);dominant-baseline:central}& .container>.label{font-weight:var(--ui-font-weight-semibold)}& .node{cursor:var(--ui-control-cursor,pointer)}& .loading>.label{fill:var(--_ui-graph-port-color)}& .port-dot{fill:var(--_ui-graph-background);stroke:var(--_ui-graph-port-color);stroke-width:1.25px}& .port-label{fill:var(--_ui-graph-port-color);dominant-baseline:central}& .pin-mark{fill:var(--_ui-graph-node-border-color)}& .edge{fill:none;stroke:var(--_ui-graph-edge-color);stroke-width:1.25px;pointer-events:none}& .edge-hit{fill:none;stroke:#0000;stroke-width:8px;cursor:var(--ui-control-cursor,pointer)}& .edge-label{fill:var(--_ui-graph-edge-label-color);paint-order:stroke;stroke:var(--_ui-graph-background);stroke-width:3px;pointer-events:none}& .toggle{cursor:var(--ui-control-cursor,pointer)}& .toggle-target{fill:#0000}& .toggle-circle{fill:var(--_ui-graph-edge-color)}& .toggle-mark{fill:none;stroke:var(--ui-text-inverted-color);stroke-width:1.5px;stroke-linecap:round}& .toggle:focus{outline:none}& .toggle:focus-visible .toggle-circle{fill:var(--_ui-graph-highlight-color)}}}@layer ui.components.graph.variations;@layer ui.components.graph.states{.canvas{& .node.lit>.box,& .node:hover>.box{stroke:var(--_ui-graph-highlight-color)}& .edge-group.lit .edge,& .edge-group:hover .edge{stroke:var(--_ui-graph-highlight-color);stroke-width:2.25px}& .port.lit .port-dot,& .port:hover .port-dot,& .pin.lit .pin-mark{fill:var(--_ui-graph-highlight-color);stroke:var(--_ui-graph-highlight-color)}& .node.selected>.box,& .edge-group.selected .edge{stroke:var(--_ui-graph-selected-color);stroke-width:2.5px}& .port.selected .port-dot{fill:var(--_ui-graph-selected-color);stroke:var(--_ui-graph-selected-color)}}}", le = /* @__PURE__ */ j("<svg><rect></svg>", 2), ue = /* @__PURE__ */ j("<svg><text></svg>", 2), de = /* @__PURE__ */ j("<div><div><button type=button></button></div><svg role=group><g><!><!><!><!></g></svg><ui-modal size=large closable><div>", 1), fe = /* @__PURE__ */ j("<ui-breadcrumbs divider=›>", 1), pe = /* @__PURE__ */ j("<ui-breadcrumb>", 1), me = /* @__PURE__ */ j("<svg><g><!><!><!><!></svg>", 2), he = /* @__PURE__ */ j("<title>"), ge = /* @__PURE__ */ j("<svg><g role=button tabindex=0><title></title><circle r=10></circle><circle r=6></circle><path></svg>", 2), _e = /* @__PURE__ */ j("<svg><g><circle></svg>", 2), ve = /* @__PURE__ */ j("<svg><g><path></path><text text-anchor=middle></svg>", 2), ye = /* @__PURE__ */ j("<svg><text text-anchor=middle></svg>", 2), be = /* @__PURE__ */ j("<svg><g><path></path><path></svg>", 2), F, I, L, R, xe, Se, Ce, we, z, Te, Ee, De, Oe, ke, Ae, je, Me, Ne, Pe, Fe, Ie, Le, Re, ze, Be, B, V, H, U, W, G, K, q, J, Y, DOMGraphElement = class extends e {
671
693
  static {