spell-ui 0.8.10 → 0.8.12
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/dist/_util/string.d.ts +7 -0
- package/dist/components/ui-modal/ModalDialogs.d.ts +7 -9
- package/dist/components/ui-modal/UIModal.d.ts +5 -0
- package/dist/components/ui-modal/UIModal.en.d.ts +5 -0
- package/dist/components/ui-toast/ToastStack.d.ts +9 -0
- package/dist/core.js +468 -453
- package/dist/core.js.map +1 -1
- package/dist/index.js +96 -96
- package/dist/jsx.d.ts +10 -0
- package/dist/runtime/runtime.types.d.ts +6 -1
- package/dist/{ui-modal.editor-CkkJRgab.js → ui-modal.editor-B6gmmGsR.js} +2 -2
- package/dist/ui-modal.editor-B6gmmGsR.js.map +1 -0
- package/dist/ui-modal.js +59 -66
- package/dist/ui-modal.js.map +1 -1
- package/dist/ui-property-editor.js +1 -1
- package/dist/ui-root.js +1 -0
- package/dist/ui-root.js.map +1 -1
- package/dist/ui-toast.js +89 -84
- package/dist/ui-toast.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui-modal.editor-CkkJRgab.js.map +0 -1
package/dist/ui-modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-modal.js","names":["this","ref={(element) => this.dialog = element}","<Show when={this.heading}>\n <div id={this.headerId} class={UIT.HEADER} part={this.dialogPart(UIT.HEADER)}>\n {this.heading}\n </div>\n </Show>","class={UIT.HEADER}","part={this.dialogPart(UIT.HEADER)}","<div id={this.headerId} class={UIT.HEADER} part={this.dialogPart(UIT.HEADER)}>\n {this.heading}\n </div>","<dialog\n ref={(element) => this.dialog = element}\n class={this.rootClass}\n part={this.dialogPart(this.rootPart)}\n aria-labelledby={isServer ? this.serverLabelledBy() : void 0}\n onCancel={this.onCancel}\n onClose={this.onClose}\n onPointerDown={this.onPointerDown}\n onClick={this.onDialogClick}\n >\n <Show when={this.heading}>\n <div id={this.headerId} class={UIT.HEADER} part={this.dialogPart(UIT.HEADER)}>\n {this.heading}\n </div>\n </Show>\n <Show when={this.content}>\n <div class={UIT.CONTENT} part={this.dialogPart(UIT.CONTENT)}>\n {this.content}\n </div>\n </Show>\n <slot />\n {this.closeButton.draw()}\n </dialog>","<Show when={this.content}>\n <div class={UIT.CONTENT} part={this.dialogPart(UIT.CONTENT)}>\n {this.content}\n </div>\n </Show>","part={this.dialogPart(UIT.CONTENT)}","<div class={UIT.CONTENT} part={this.dialogPart(UIT.CONTENT)}>\n {this.content}\n </div>","part={this.dialogPart(this.rootPart)}","aria-labelledby={isServer ? this.serverLabelledBy() : void 0}","_elementSetup_dec","_a","_init","E.UIComponent","E.protoMerged","E.untracked","E.whileConnected","E.on","E.state","E.onChange","E.Disclosure","E.CloseButton","UIT.CLOSE","CLOSABLE","_$readShallow","UIT.HEADER","_$setAttribute","UIT.CONTENT","_$getOwner","__name","E.proto","E.protoMerged","__name","modalCSS","UIT.HEADING","UIT.CONTENT","E.after","UIT.BUTTON","E.isBrowser","HEADER","Key","__decoratorStart","__publicField","__name$1","ToggleCommands","HEADING","__decorateElement","ModalActions","__decoratorMetadata","__runInitializers","AnimationLookup","BUTTON","CONTENT","__privateAdd","CLOSE","getOwner$1","_tmpl$","_tmpl$2","_onNameChanged_dec","_onSlotChange_dec","_slottedHeading_dec","_onClose_dec","_closedBy_dec","_onCommand_dec","_watchPlacement_dec","_requestClose_dec","_elementSetup_dec$1","_a$1","_init$1","_slottedHeading","_DialogComponent","UIComponent","protoMerged","untracked","whileConnected","on","state","onChange","args","reason","Disclosure","visible","dialog","event","box","x","y","closedBy","CloseButton","found","kind","action","detail","originalEvent","soon","keyframes","animation","UI","wasShown","isModeless","isNative","generation","animations","name","CLOSABLE$1","child","hasHeader","header","reflected","label","heading","_self$","_el$","_el$3","_el$5","_el$6","addEvent","ref","element","insert","createComponent","Show","_el$2","effect","readShallow","_p$","setAttribute","className","a","_el$4","t","isServer","target","domElement","DialogComponent","delegateEvents","modalVocabulary","UIModal_default","_shownClass_dec","_overlayKind_dec","_rootPart_dec","_elementSetup_dec","_vocabulary_dec","_a","_init","_UIModal","proto","UIModal","ModalDialogs","document","options","isApproved","value","flags","result","message","modal","SIZE","TINY","CLOSABLE","content","field","input","actions","ACTIONS","canDeny","CANCEL","approve","OK","APPROVE_CLASS","COLOR","PRIMARY","drawn","APPROVE_EVENT","HIDE_EVENT","resolve","paragraph","MESSAGE_LINES","size","MEDIUM","words","FONT_SIZE_CLASS","markdown","MARKDOWN","SANITIZED","BREAKS","PARAGRAPH_MARGIN","MARKDOWN_MARKS","mark","wait","after","DRAW_WAIT","DRAWN_EVENT","NATIVE_LOOK","LABEL_LAYOUT","button","actionClass","text","vocabulary","noun","isBrowser"],"sources":["../src/components/ui-modal/DialogComponent.tsx","../src/components/ui-modal/UIModal.en.ts","../src/components/ui-modal/UIModal.tsx","../src/components/ui-modal/ModalDialogs.ts","../src/components/ui-modal/index.ts"],"sourcesContent":["import { Show } from \"solid-js\"\nimport { isServer, type JSX } from \"@solidjs/web\"\n\nimport { E, UI, UIT } from \"spell/ui/core\"\nimport { type DialogAttributes, type DialogEventName } from \"./UIModal.types\"\n\n/****************\n * ### `DialogComponent`\n * The base of the components behind `<ui-modal>` and `<ui-flyout>`:\n * everything they do, on a shadow `<dialog class=\"ui … <noun>\" part=\"<rootPart>\">` shown with `showModal()`.\n * The browser gives it the focus trap, the `inert` page, the top layer and the `::backdrop` (the dimmer).\n * A subclass may be MODELESS (`isModeless`: `<ui-flyout modeless>`): `show()`, the page left usable;\n * a click on the page closes the dialog, and still lands where it went.\n *\n * - A subclass adds only its names and looks:\n * `vocabulary`, `elementSetup.styleSheets` (and `animation`), `rootPart`, `overlayKind`, `shownClass`.\n *\n * - In the modal family, not `src/elements/`: a flyout IS Fomantic's side modal\n * (the same parts, buttons, events and dismissal), and nothing else shares it yet.\n * A third, non-modal overlay would move it to `src/elements/` (`agents/CODE-DEBT.md`, `ui`).\n *\n * - Every dialog vocabulary MUST name (each family's tests check it; types can't):\n * - attributes `closable`, `closedby`, `heading`, `content`\n * - events `ui-opening`, `ui-opened`, `ui-closing`, `ui-closed`, `ui-approving`, `ui-denying`\n * - parts `rootPart`, `header`, `content`, `close`; text `close`.\n *\n * - Shown by the shared `visible` / `hidden` (`UIComponent`, \"Shown or hidden\"), starting hidden\n * (`elementSetup.visible`): `<ui-modal visible>`, `modal.visible = true`.\n * - Controlled (`isVisible`): a person's `ui-opening` / `ui-closing` (with a `reason`) come first and can veto;\n * `ui-opened` / `ui-closed` follow once the transition has finished.\n * - The `<dialog>` opens with `showModal()` and closes with `close()` as `visible` changes (`onVisibleChange()`).\n *\n * - Dismissal, by `closedby` (read when it opens; `closedBy` says what an absent one means):\n * - Escape: through `UI.overlays` (kind `overlayKind`: scroll lock, keyboard scope, focus restore),\n * so only the topmost overlay closes, and `ui-closing` can veto.\n * The dialog's own `cancel` is always prevented.\n * - A click on the `::backdrop`: the browser's light dismiss (`<dialog closedby>`)\n * when `UI.browser.supports.dialogClosedBy`, reported as `cancel`;\n * else `UI.overlays`' outside click, which tells a backdrop click from one on the dialog by where the pointer is.\n * - A close the browser forces anyway (a repeated Escape it won't let a page veto) is followed:\n * a `ui-closing` that can't veto, then `visible` off.\n *\n * - Opening as a PERSON'S action, so `ui-opening` fires:\n * an invoker command, `<button commandfor=\"id\" command=\"--show\">`\n * (`ToggleCommands`; `--close` closes, `--toggle` flips).\n * Writing `visible` (or `hidden`) is the app's own decision, and fires nothing.\n *\n * - Buttons: a click on an approve / deny element fires the cancelable `ui-approving` / `ui-denying`, then closes.\n * - Those elements (`ModalActionSelectors`):\n * Fomantic's `.approve` / `.deny` classes, `<ui-button color=\"positive\">` / `\"negative\"` (and the old\n * `<ui-button color=\"negative\">`).\n * - The `closable` icon closes (reason `close`).\n *\n * - `closable=\"false\"` is Fomantic's `closable: false` AND `closeIcon: false`:\n * no icon, and (unless `closedby` is set) `closedby=\"none\"`, so Escape and the dimmer do nothing.\n *\n * - Its name: the DOM element's `aria-label`, else the `heading` shorthand, else a slotted `<ui-header>`\n * (by element reflection: an idref can't reach into the light DOM from the shadow root).\n ****************/\nexport abstract class DialogComponent<\n V extends E.ComponentVocabulary = E.ComponentVocabulary\n> extends E.UIComponent<V> {\n /** Starts hidden, unless the page writes `visible`. */\n @E.protoMerged static elementSetup: Partial<E.ElementSetup> = { visible: \"hidden\" }\n\n /** Part name of the `<dialog>`, e.g. `modal`. */\n declare rootPart: string\n\n /** `UI.overlays` kind: `modal` or `flyout`. */\n declare overlayKind: E.OverlayKind\n\n /**\n * Hook: shown without blocking the page (`show()`, not `showModal()`).\n * - No `::backdrop`, no scroll lock, no focus trap.\n * - A click on the page lands, and closes it (light dismiss, `closedby=\"any\"`).\n * - Default `false`; `<ui-flyout modeless>`.\n */\n protected get isModeless(): boolean {\n return false\n }\n\n // The dialog attributes this base reads (see the class docs):\n // each vocabulary's getters, declared here since `V` is unknown to this class.\n\n /** `closable`: the close icon; `false` (written) is also Fomantic's `closable: false`. */\n declare closable: boolean\n\n /** `closedby`: what dismisses it, as written; see `closedBy` for what it means. */\n declare closedby: DialogAttributes[\"closedby\"] | undefined\n\n /** `heading`: the heading shorthand (old name `header`). */\n declare heading: string | undefined\n\n /** `content`: the content shorthand. */\n declare content: string | undefined\n\n /** The dialog. */\n protected dialog?: HTMLDialogElement\n\n /**\n * This element's `UI.overlays` entry; its Escape / outside options follow `closedby` when it opens.\n * - `kind` is the subclass's `overlayKind`, set in the constructor (a prototype value TypeScript can't see here).\n */\n private readonly overlayEntry: E.OverlayEntry = {\n element: this.domElement,\n kind: \"modal\",\n onDismiss: (reason: E.DismissReason) => void this.requestClose(reason)\n }\n\n constructor(...args: ConstructorParameters<typeof E.UIComponent>) {\n super(...args)\n this.overlayEntry.kind = this.overlayKind\n }\n\n ////////////////\n // ## Shown or hidden\n ////////////////\n\n /** Fomantic's class word on the `<dialog>` while it shows: `active` (a modal), `visible` (a flyout). */\n declare shownClass: string\n\n /** Bumped on every show / hide, so a late `ui-opened` / `ui-closed` of an earlier one is dropped. */\n private generation = 0\n\n /** Fomantic's shown class (`shownClass`), just before the noun while `visible`. */\n protected get extraClass(): string | undefined {\n return this.isVisible ? this.shownClass : undefined\n }\n\n /**\n * Shown or hidden, as `visible` (`isVisible`): `ui-opening` / `ui-closing` first, `ui-opened` / `ui-closed` once\n * its transition ends (`onVisibleChange()`).\n */\n readonly disclosure = new E.Disclosure({\n component: this,\n member: \"isVisible\",\n detail: (visible, originalEvent): UIT.ModalOpenDetail | UIT.ModalCloseDetail =>\n visible ? { visible, originalEvent } : { visible, reason: this.closeReason, originalEvent },\n afterDetail: (visible): UIT.ModalOpenDetail => ({ visible })\n })\n\n /** Why the latest close was asked for: `ui-closing`'s `reason`. */\n private closeReason: UIT.ModalCloseReason = \"escape\"\n\n /** Show, dispatching the cancelable `ui-opening` first; true when applied. */\n requestOpen(originalEvent?: Event): boolean {\n return this.disclosure.open(originalEvent)\n }\n\n /** Hide for `reason`, dispatching the cancelable `ui-closing` first; true when applied. */\n @E.untracked\n requestClose(reason: UIT.ModalCloseReason, originalEvent?: Event): boolean {\n if (!this.isVisible) return false\n this.isDismissing = true\n E.soon(() => (this.isDismissing = false))\n this.closeReason = reason\n return this.disclosure.close(originalEvent)\n }\n\n /**\n * `visible` changed (`UIComponent`'s hook): open or close the `<dialog>`;\n * resolves once its transition has ended, with `ui-opened` / `ui-closed`.\n * - `animation`:\n * - the family's own (`elementSetup.animation`): the sheet's transition (`UIModal.css`, `UIFlyout.css`)\n * - another one (the element's own `animation`): run on the `<dialog>` through `UI.transitions`\n * - `none`: at once (motion off, or the element's first draw)\n * - `ui-closed` only when it was shown: a modal that starts hidden fires nothing.\n */\n protected async onVisibleChange(visible: boolean, animation: UIT.Animation): Promise<void> {\n const dialog = this.dialog\n if (!dialog) return\n const keyframes = UIT.AnimationLookup.keyframesBeside(animation, this.elementSetup.animation)\n if (visible) {\n this.show()\n if (keyframes) await UI.transitions.animate({ element: dialog, name: keyframes, direction: UIT.IN })\n if ((await this.transitionsEnd()) && this.isVisible) this.disclosure.sendAfter(true)\n return\n }\n const wasShown = UI.overlays.isOpen(this.overlayEntry)\n if (keyframes && wasShown) await UI.transitions.animate({ element: dialog, name: keyframes, direction: UIT.OUT })\n // shown again while the keyframes ran\n if (this.isVisible) return\n this.hide()\n if (!wasShown || !(await this.transitionsEnd())) return\n if (!this.isVisible && this.domElement.isConnected) this.disclosure.sendAfter(false)\n }\n\n /**\n * Shown again when it comes back into the page while `visible`; closed, quietly, when it leaves.\n * - Not on the first connect: the dialog isn't drawn yet, and `onVisibleChange()` runs once it is.\n */\n @E.whileConnected\n protected watchPlacement() {\n if (this.isVisible && this.isReady) this.show()\n return () => this.hide()\n }\n\n /**\n * `showModal()` (`show()` when `isModeless`) and register with `UI.overlays`; nothing when already open.\n * - Modeless: the overlay entry isn't `modal` (no scroll lock), and the page stays usable.\n * - A click on the page LIGHT-DISMISSES it (`any`, the default), through the overlay entry, never the browser's:\n * the click still lands where it went.\n * - Its opener (`commandfor`) and a click inside don't count.\n * - `closedby` is applied here:\n * natively when supported (the browser's light dismiss), else by the overlay entry's outside-click handling.\n * - A `<dialog>` that other keyframes animated out (`hidden` on it) shows again first.\n */\n private show() {\n const dialog = this.dialog\n if (!dialog) return\n const isModeless = this.isModeless\n const closedBy = this.closedBy\n // modeless: our own outside-click handling, which lets the click through (the browser's needs a backdrop)\n const isNative = UI.browser.supports.dialogClosedBy && !isModeless\n if (isNative) dialog.setAttribute(\"closedby\", closedBy)\n else dialog.removeAttribute(\"closedby\")\n this.overlayEntry.closeOnEscape = closedBy !== \"none\"\n this.overlayEntry.closeOnOutsideClick = !isNative && closedBy === \"any\"\n this.overlayEntry.modal = !isModeless\n UI.transitions.reveal(dialog)\n if (!dialog.open) {\n if (isModeless) dialog.show()\n else dialog.showModal()\n UI.focus.enter(dialog)\n }\n UI.overlays.open(this.overlayEntry)\n }\n\n /** `close()` the dialog, THEN leave `UI.overlays` (whose focus restore needs the page no longer `inert`). */\n private hide() {\n const dialog = this.dialog\n if (dialog?.open) dialog.close()\n UI.overlays.close(this.overlayEntry)\n }\n\n /** Once the dialog's own transitions end: `true` unless another show / hide started meanwhile. */\n private async transitionsEnd(): Promise<boolean> {\n const generation = ++this.generation\n const animations = this.dialog?.getAnimations() ?? []\n await Promise.allSettled(animations.map((animation) => animation.finished))\n return generation === this.generation\n }\n\n /** `send()` one of the events every dialog vocabulary names (see the class docs). */\n private fire(name: DialogEventName, detail: object): boolean {\n return this.send(name as E.EventName<V>, detail)\n }\n\n /** An invoker command aimed at the DOM element (`UIT.ToggleCommands`). */\n @E.on(\"command\")\n protected onCommand(event: Event) {\n const action = UIT.ToggleCommands.action(event, this.isVisible)\n if (action === \"show\") this.requestOpen(event)\n else if (action === \"close\") this.requestClose(\"close\", event)\n }\n\n ////////////////\n // ## Dismissal\n ////////////////\n\n /** A dismissal was asked for in this task: the dialog's own `cancel` for the same key press is ignored. */\n private isDismissing = false\n\n /** The last press started on the `::backdrop`. */\n private pressStartedOnBackdrop = false\n\n /**\n * What dismisses it: an explicit `closedby` wins;\n * else `none` for `closable=\"false\"` (Fomantic's `closable: false`), else `any`.\n * - NOTE: `closedby` has a vocabulary default, so whether it was written is read off the DOM element.\n * - Untracked.\n */\n @E.untracked\n private get closedBy(): NonNullable<DialogAttributes[\"closedby\"]> {\n if (this.domElement.hasAttribute(\"closedby\")) return this.closedby ?? \"any\"\n // NOTE: an absent boolean also converts to `false`, so `closable` must be present to mean \"closable: false\"\n const isOff = this.domElement.hasAttribute(CLOSABLE) && !this.closable\n return isOff ? \"none\" : \"any\"\n }\n\n /** Remember whether a press started on the `::backdrop` (the dialog itself, outside its box). */\n private readonly onPointerDown = (event: PointerEvent) => {\n const dialog = this.dialog\n if (!dialog || event.target !== dialog) return void (this.pressStartedOnBackdrop = false)\n const box = dialog.getBoundingClientRect()\n const { clientX: x, clientY: y } = event\n this.pressStartedOnBackdrop = x < box.left || x > box.right || y < box.top || y > box.bottom\n }\n\n /**\n * The dialog's `cancel`: Escape the overlay didn't take, or the browser's light dismiss (`closedby`).\n * - Always prevented; the element decides, by `closedby`, and `ui-closing` may veto.\n */\n private readonly onCancel = (event: Event) => {\n event.preventDefault()\n const reason = this.pressStartedOnBackdrop ? \"outside\" : \"escape\"\n this.pressStartedOnBackdrop = false\n if (this.isDismissing) return\n const closedBy = this.closedBy\n if (closedBy === \"none\" || (reason === \"outside\" && closedBy !== \"any\")) return\n this.requestClose(reason, event)\n }\n\n /**\n * The dialog closed while the element thinks it's open: the browser forced it -- follow.\n * - `close` is queued as a task:\n * one from an earlier close can arrive after a quick re-open, when the dialog is open again -- ignored.\n */\n @E.untracked\n private readonly onClose = (event: Event) => {\n if (this.dialog?.open || !this.domElement.isConnected) return\n this.closeReason = \"escape\"\n this.disclosure.adopt(false, event)\n }\n\n ////////////////\n // ## Buttons\n ////////////////\n\n /** The close icon, while `closable`. */\n readonly closeButton = new E.CloseButton({\n owner: this,\n shows: () => !!this.closable,\n label: () => this.closeText,\n part: this.dialogPart(UIT.CLOSE),\n onClick: (event) => this.onCloseIcon(event)\n })\n\n /**\n * The close icon's label (`translationForKey(\"close\")`).\n * - Not a cast in the JSX, for the reason `dialogPart()` is a method.\n */\n private get closeText(): string {\n return this.translationForKey(UIT.CLOSE as E.TextKey<V>)\n }\n\n /** Close icon. */\n private readonly onCloseIcon = (event: MouseEvent) => {\n event.stopPropagation()\n this.requestClose(\"close\", event)\n }\n\n /** A click inside: an approve / deny element asks, then closes. */\n private readonly onDialogClick = (event: MouseEvent) => {\n const found = DialogComponent.actionFor(event, this.domElement)\n if (!found) return\n const [kind, action] = found\n const detail: UIT.ModalActionDetail = { action, originalEvent: event }\n if (!this.fire(kind === \"approve\" ? \"ui-approving\" : \"ui-denying\", detail)) return\n this.requestClose(kind, event)\n }\n\n ////////////////\n // ## The name\n ////////////////\n\n /** The DOM element's `aria-label`, forwarded to the dialog. */\n get ariaLabel(): string | undefined {\n return this.attributes[\"aria-label\"] ?? undefined\n }\n\n /**\n * First slotted `<ui-header>` (any tag whose noun is `header`), which names the dialog.\n * - Read on the server too, NO `isServer` guard:\n * the static render (`spell/ui/static`, on linkedom elements) names the dialog by it (`serverLabelledBy()`).\n */\n @E.state accessor slottedHeading: Element | undefined = this.findHeading()\n\n /** Id of the `heading` shorthand, from `UI.ids` once rendering. */\n private headerId = \"\"\n\n /** The light DOM's slotted children changed: look for the heading again. */\n @E.on(\"slotchange\", { target: \"renderRoot\" })\n protected onSlotChange() {\n this.slottedHeading = this.findHeading()\n }\n\n /** First child element whose definition's noun is `header` (a `<ui-header>`, or a translated one). */\n private findHeading(): Element | undefined {\n for (const child of this.domElement.children) {\n if (E.UIComponent.registry.definitions.get(child.localName)?.vocabulary.noun === UIT.HEADER) return child\n }\n return undefined\n }\n\n /** The dialog's name: its `aria-label`, else `aria-labelledby` the `heading` shorthand, else the slotted heading. */\n @E.onChange(\"isReady\", \"ariaLabel\", \"heading\", \"slottedHeading\")\n protected onNameChanged(\n _isReady: boolean,\n label: string | undefined,\n header: string | undefined,\n heading: Element | undefined\n ) {\n const dialog = this.dialog\n if (!dialog) return\n const hasHeader = !!header\n const reflected = dialog as unknown as { ariaLabelledByElements: Element[] | null }\n if (label) dialog.setAttribute(\"aria-label\", label)\n else dialog.removeAttribute(\"aria-label\")\n // NOTE: setting the reflected list (even to `null`, the platform's \"none\") rewrites the attribute,\n // so it goes first\n reflected.ariaLabelledByElements = !label && !hasHeader && heading ? [heading] : null\n if (!label && hasHeader) dialog.setAttribute(\"aria-labelledby\", this.headerId)\n }\n\n /**\n * The dialog's `aria-labelledby` in a server render (`spell/ui/static`):\n * the `heading` shorthand's id, else the slotted heading's,\n * unless the DOM element has an `aria-label` (which the static output moves onto the dialog).\n * - Why: on a server no effect applies and no element reflects.\n * - SIDE EFFECT: gives the slotted heading (the render's parsed copy) an id if it has none.\n */\n private serverLabelledBy(): string | undefined {\n if (this.ariaLabel) return undefined\n if (this.heading) return this.headerId\n const heading = this.slottedHeading\n return heading ? UI.ids.ensure(heading, `ui-${this.elementDefinition.vocabulary.noun}-heading`) : undefined\n }\n\n ////////////////\n // ## Rendering\n ////////////////\n\n render(): JSX.Element {\n this.headerId = UI.ids.next(`ui-${this.elementDefinition.vocabulary.noun}`)\n return (\n <dialog\n ref={(element) => (this.dialog = element)}\n class={this.rootClass}\n part={this.dialogPart(this.rootPart)}\n aria-labelledby={isServer ? this.serverLabelledBy() : undefined}\n onCancel={this.onCancel}\n onClose={this.onClose}\n onPointerDown={this.onPointerDown}\n onClick={this.onDialogClick}\n >\n <Show when={this.heading}>\n <div id={this.headerId} class={UIT.HEADER} part={this.dialogPart(UIT.HEADER)}>\n {this.heading}\n </div>\n </Show>\n <Show when={this.content}>\n <div class={UIT.CONTENT} part={this.dialogPart(UIT.CONTENT)}>\n {this.content}\n </div>\n </Show>\n <slot />\n {this.closeButton.draw()}\n </dialog>\n )\n }\n\n /**\n * `part` value of one of the parts every dialog vocabulary names (see the class docs).\n * - A method, not a cast in the JSX:\n * Solid's SSR compile (`hoistProps`) hoists a `<Show>`'s children into a module-level constructor,\n * and passes it every free identifier they use.\n * That includes the type parameter `V` of a `PartName<V>` cast, as a VALUE (\"V is not defined\").\n */\n private dialogPart(name: string): string {\n return this.partForName(name as E.PartName<V>)\n }\n\n /**\n * The approve / deny element `event` activated, with which it is; `undefined` for none.\n * - The innermost light-DOM element on its path (in `domElement`'s tree)\n * matching `UIT.ModalActionSelectors`, up to `domElement` (`UIT.ModalActions`, the toast's walk too).\n */\n private static actionFor(event: Event, domElement: Element): [UIT.ModalAction, Element] | undefined {\n for (const target of UIT.ModalActions.lightPath(event, domElement)) {\n const action = UIT.ModalActions.of(target)\n if (action) return [action, target]\n }\n return undefined\n }\n}\n\n/** The attribute of the close icon (and of Fomantic's `closable: false`). */\nconst CLOSABLE = \"closable\"\n","/**\n * Every name `<ui-modal>` uses: tag, attributes (kind + allowed values), events, slots, parts, states, texts.\n * Schema: `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - Class words come out through `ClassBuilder`, in Fomantic's grammar:\n * `<ui-modal size=\"tiny\" appearance=\"basic\" vertical-align=\"top\" visible>` => `ui tiny basic top aligned active modal`;\n * `active`, Fomantic's shown-modal class, is the element's own while it shows (the shared `visible` / `hidden`).\n * - Sizes are WIDTHS here (Fomantic's modal ratios), not text sizes:\n * `UIModal.css` reads the size class, never `--ui-scale`.\n * - A modal OWNS the `header`, `content`, `description` and `actions` parts:\n * slotted ones get `:state(in-modal)` and style themselves from `UIParts.css`,\n * reading `--_ui-modal-basic` / `--_ui-modal-header-size` (`UIModal.css`).\n * - `closedby` mirrors `<dialog closedby>`:\n * `any` (Fomantic's `closable: true`), `closerequest` (Escape only), `none`.\n * - `closable` is the close ICON (Fomantic's `closeIcon`).\n * `closable=\"false\"` also brings back Fomantic's `closable: false` (dismissal `none`), unless `closedby` is set.\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/****************\n * ### `<ui-modal>`\n * A modal dialog: `<dialog class=\"ui ... modal\" part=\"modal\">`, shown with `showModal()`.\n ****************/\nexport const modalVocabulary = {\n tag: \"ui-modal\",\n icon: \"window restore outline\",\n topics: [\"dialogs\", \"overlays\", \"popups\", \"modules\"],\n aka: [\"dialog\", \"popup window\", \"lightbox\", \"confirm\", \"alert dialog\"],\n noun: \"modal\",\n partOfSpeech: \"structure\",\n description: \"A modal displays content that temporarily blocks interactions with the main view of a site.\",\n attributes: [\n {\n name: \"size\",\n group: \"appearance\",\n kind: \"size\",\n description: \"Width, `mini` ... `massive` (Fomantic's ratios of the default width); `medium` is the default.\"\n },\n {\n name: \"appearance\",\n group: \"appearance\",\n kind: \"multiple\",\n values: [\"basic\"],\n // each word draws itself: no key after it\n classes: {},\n replaces: [{ from: \"basic\", value: \"basic\" }],\n description: \"The look: `basic`, no box: light text straight on the dimmer. Old name: `basic`.\"\n },\n { name: \"inverted\", group: \"appearance\", kind: \"keyOnly\", description: \"The dark scheme.\" },\n { name: \"fullscreen\", group: \"appearance\", kind: \"keyOnly\", description: \"Nearly the whole viewport wide.\" },\n {\n name: \"overlay\",\n group: \"appearance\",\n kind: \"keyOnly\",\n description: \"With `fullscreen`: covers the whole viewport, edge to edge (`overlay fullscreen`).\"\n },\n {\n name: \"scrolling\",\n group: \"layout\",\n kind: \"keyOnly\",\n description: \"Scrolls inside itself when taller than the viewport.\"\n },\n {\n name: \"vertical-align\",\n group: \"layout\",\n kind: \"verticalAlign\",\n values: [\"top\", \"bottom\"],\n description: \"Pinned near the `top` or `bottom` of the viewport instead of centred (`top aligned`).\"\n },\n {\n name: \"closable\",\n group: \"behaviour\",\n kind: \"boolean\",\n description:\n \"Shows a close icon (Fomantic's `closeIcon` setting). `closable=\\\"false\\\"` is also Fomantic's `closable: \" +\n 'false` setting: no icon AND `closedby=\"none\"` (Escape and the dimmer do nothing), unless `closedby` is ' +\n \"set, which wins for dismissal. Absent: no icon, dismissed by `closedby` (default `any`).\"\n },\n {\n name: \"closedby\",\n group: \"behaviour\",\n kind: \"enum\",\n values: [\"any\", \"closerequest\", \"none\"],\n default: \"any\",\n property: \"closedBy\",\n description:\n \"What dismisses it, as `<dialog closedby>` (Fomantic's `closable` setting, in three steps): `any` -- \" +\n \"Escape or a click on the dimmer (default); `closerequest` -- Escape only; `none` -- only its own \" +\n 'buttons. Read when it opens; when set, it wins over `closable=\"false\"`.'\n },\n {\n name: \"heading\",\n replaces: [\"header\"],\n group: \"name\",\n kind: \"string\",\n description:\n \"Shorthand for a header; a slotted `<ui-header>` is the rich version (and names the dialog). Its old name was `header`.\"\n },\n {\n name: \"content\",\n group: \"content\",\n kind: \"string\",\n description: \"Shorthand for a content block of text; a slotted `<ui-content>` is the rich version.\"\n }\n ],\n events: [\n {\n name: \"ui-opening\",\n detail: \"{ visible: true, originalEvent?: Event }\",\n cancelable: true,\n description: \"About to show (a person's action, not a `visible` write); `preventDefault()` keeps it hidden.\"\n },\n {\n name: \"ui-opened\",\n detail: \"{ visible: true }\",\n description: \"Shown, its entry transition finished (Fomantic's `onVisible`).\"\n },\n {\n name: \"ui-closing\",\n detail: \"{ visible: false, reason: ModalCloseReason, originalEvent?: Event }\",\n cancelable: true,\n description:\n \"About to hide: Escape, the dimmer, the close icon, approve or deny. `preventDefault()` keeps it shown.\"\n },\n {\n name: \"ui-closed\",\n detail: \"{ visible: false }\",\n description: \"Hidden, its exit transition finished (Fomantic's `onHidden`).\"\n },\n {\n name: \"ui-approving\",\n detail: \"{ action: Element, originalEvent?: Event }\",\n cancelable: true,\n description:\n 'An approve button (`.approve` / `.ok` / `.positive`, `<ui-button color=\"positive\">`) was activated; ' +\n \"`preventDefault()` keeps the modal shown (Fomantic's `onApprove` returning `false`).\"\n },\n {\n name: \"ui-denying\",\n detail: \"{ action: Element, originalEvent?: Event }\",\n cancelable: true,\n description:\n 'A deny button (`.deny` / `.cancel` / `.negative`, `<ui-button color=\"negative\">`) was activated; ' +\n \"`preventDefault()` keeps the modal shown.\"\n }\n ],\n slots: [\n {\n name: \"\",\n description: \"Content parts: `<ui-header>`, `<ui-content>` (`image`, `scrolling`), `<ui-actions>` with buttons.\"\n }\n ],\n parts: [\n { name: \"modal\", description: \"The `<dialog>` box; its `::backdrop` is the dimmer.\" },\n { name: \"header\", description: \"The `header` shorthand.\" },\n { name: \"content\", description: \"The `content` shorthand.\" },\n { name: \"close\", description: \"The close icon of a `closable` modal.\" }\n ],\n states: [],\n texts: [\n { key: \"close\", text: \"Close\", description: \"Accessible name of the close icon.\" },\n { key: \"ok\", text: \"OK\", description: \"Approve button of `UI.modals.confirm()` / `alert()` / `prompt()`.\" },\n { key: \"cancel\", text: \"Cancel\", description: \"Deny button of `UI.modals.confirm()` / `prompt()`.\" }\n ],\n ownsParts: [\"header\", \"content\", \"description\", \"actions\"]\n} as const satisfies E.ComponentVocabulary\n","import { E } from \"spell/ui/core\"\nimport { modalVocabulary } from \"./UIModal.en\"\nimport { DialogComponent } from \"./DialogComponent\"\nimport type { Vocabulary } from \"./UIModal.types\"\n\nimport modalCSS from \"./UIModal.css?inline\"\n\n/****************\n * ### `UIModal`\n * The component behind `<ui-modal>`:\n * a modal dialog, a shadow `<dialog class=\"ui … modal\" part=\"modal\">` shown with `showModal()`.\n *\n * - The browser gives it the focus trap, the `inert` page, the top layer and the `::backdrop`:\n * the dimmer, themed by the shared `--ui-dimmer-*` tokens. No `<ui-dimmer>` element.\n * - All of its behaviour is `DialogComponent`'s, which `<ui-flyout>` shares:\n * this class only names and styles it.\n * - shared: `visible` / `hidden`, `closedby`, approve / deny, the close icon, invoker commands, its name\n * - `UI.modals.confirm()` / `alert()` / `prompt()` draw one of these (`ModalDialogs`, registered by the barrel).\n ****************/\nexport class UIModal extends DialogComponent<Vocabulary> {\n @E.proto static vocabulary = modalVocabulary\n @E.protoMerged static elementSetup = {\n styleSheets: { modal: modalCSS },\n // the sheet's own transition is Fomantic's `scale`: faded in from 80%\n animation: \"scale\"\n } satisfies Partial<E.ElementSetup>\n @E.proto static rootPart = \"modal\"\n @E.proto static overlayKind = \"modal\" as const\n @E.proto static shownClass = \"active\"\n}\n\n/** The vocabulary's attribute getters, typed (see \"Attributes\" in `UIComponent`). */\nexport interface UIModal extends E.AttributeValues<typeof modalVocabulary> {}\n","import { E, UI, UIT } from \"spell/ui/core\"\nimport { modalVocabulary } from \"./UIModal.en\"\nimport { type Vocabulary } from \"./UIModal.types\"\n\n/****************\n * ### `ModalDialogs`\n * The dialogs behind `UI.modals.confirm()` / `alert()` / `prompt()` (Fomantic's `$.modal('confirm', …)`):\n * a `<ui-modal>` built for the call, appended to `<body>`, shown (`visible`), and removed once hidden.\n *\n * - Markup: `<ui-modal size=\"tiny\" closedby=\"closerequest\" closable heading=\"title\">` holding\n * - a `<ui-content>`: the message as a `<p>`, or for `prompt()` a `<label>` around it and an `<input>`\n * - `size`: the message's text size (`ui-font-size-big`), the title and buttons keeping theirs\n * - `markdown`, and the message has Markdown in it (`hasMarkdown()`):\n * a `<ui-markdown sanitized breaks>` instead of the `<p>`, its family imported the first time one is needed;\n * the dialog shows once it has drawn, so it never opens on a half-drawn message\n * - `<ui-actions>`: a deny button (`cancel`, first: it takes the initial focus, the least destructive choice)\n * and a primary approve button.\n * - Escape denies (`closedby=\"closerequest\"`: no dimmer clicks, so a stray click can't answer).\n * - So does its close ✕ (`closable`), on unless `options.closable` is `false`.\n * - The promise settles once the modal is HIDDEN (`ui-closed`), so a caller can open the next dialog straight away.\n * - Button texts: `okText` / `cancelText`, else the translated `ok` / `cancel` texts (`UI.i18n`).\n * - Everything is light DOM built with `createElement` / `textContent`: never `innerHTML` with caller text.\n * - Other families' tags (`<ui-content>`, `<ui-actions>`, `<ui-button>`) are looked up at CALL time,\n * by class noun, in the vocabulary registry (`UI.vocabulary`).\n * - Why: importing their vocabulary files would reach into other families' files,\n * which `AGENTS.md` keeps behind `spell/ui/core`.\n * - The family barrel imports `parts` and `button`, so both are defined before any dialog opens.\n * - Registered by the family barrel as `UI.modals`' provider; the runtime never imports it.\n ****************/\nexport class ModalDialogs implements E.ModalProvider {\n /** Page the dialogs are made in; a test passes its own. */\n readonly document: Document\n\n constructor({ document = globalThis.document }: ModalDialogsProps = {}) {\n this.document = document\n }\n\n /** Ask a yes / no question: resolves `true` on approve, `false` on deny or Escape. */\n confirm(options: E.ModalOptions): Promise<boolean> {\n return this.run(options, { canDeny: true }, (isApproved) => isApproved)\n }\n\n /** Tell `options.message`: resolves once the dialog has hidden, however it closed. */\n alert(options: E.ModalOptions): Promise<void> {\n return this.run(options, { canDeny: false }, () => undefined)\n }\n\n /** Ask for one line of text: resolves with it on approve, `undefined` on deny or Escape. */\n prompt(options: E.ModalOptions): Promise<string | undefined> {\n return this.run(options, { canDeny: true, input: options.value ?? \"\" }, (isApproved, value) =>\n isApproved ? value : undefined\n )\n }\n\n /**\n * Build, open and await one dialog; `result()` turns \"approved?\" and the input's value into the answer.\n * - SIDE EFFECT: a `<ui-modal>` in `<body>` until it has hidden.\n * - Throws when the parts or `<ui-button>` aren't registered (`tagFor()`).\n */\n private run<T>(options: E.ModalOptions, flags: DialogFlags, result: (isApproved: boolean, value: string) => T) {\n if (flags.input === undefined && options.markdown && ModalDialogs.hasMarkdown(options.message)) {\n return this.markdown(options).then((message) => this.open(options, flags, result, message))\n }\n return this.open(options, flags, result)\n }\n\n /**\n * `run()`, once its message is ready: `message` is the drawn Markdown, else the plain `<p>` is made here.\n * - Plain text opens at once, in the same task as the call: callers and tests find the dialog straight away.\n */\n private open<T>(\n options: E.ModalOptions,\n { canDeny, input }: DialogFlags,\n result: (isApproved: boolean, value: string) => T,\n message?: HTMLElement\n ): Promise<T> {\n const modal = this.document.createElement(modalVocabulary.tag) as HTMLElement & { visible: boolean }\n modal.setAttribute(SIZE, TINY)\n modal.setAttribute(\"closedby\", \"closerequest\")\n if (options.closable !== false) modal.setAttribute(CLOSABLE, \"\")\n if (options.title) modal.setAttribute(UIT.HEADING, options.title)\n else modal.setAttribute(\"aria-label\", options.message)\n const content = this.document.createElement(ModalDialogs.tagFor(UIT.CONTENT))\n const field = input === undefined ? undefined : this.input(input)\n content.append(field ? this.label(options.message, field) : (message ?? this.paragraph(options)))\n const actions = this.document.createElement(ModalDialogs.tagFor(ACTIONS))\n if (canDeny) actions.append(this.button(options.cancelText ?? UI.i18n.t(CANCEL), CANCEL))\n const approve = this.button(options.okText ?? UI.i18n.t(OK), APPROVE_CLASS)\n approve.setAttribute(COLOR, options.okColor ?? PRIMARY)\n actions.append(approve)\n modal.append(content, actions)\n field?.addEventListener(\"keydown\", (event) => {\n if (event.key === UIT.Key.enter) approve.click()\n })\n const drawn = message && ModalDialogs.drawn(message)\n this.document.body.append(modal)\n if (drawn) void drawn.then(() => (modal.visible = true))\n else modal.visible = true\n return new Promise<T>((resolve) => {\n let isApproved = false\n modal.addEventListener(APPROVE_EVENT, () => (isApproved = true))\n modal.addEventListener(\n HIDE_EVENT,\n () => {\n modal.remove()\n resolve(result(isApproved, field?.value ?? \"\"))\n },\n { once: true }\n )\n })\n }\n\n /**\n * The message as a paragraph, a `\\n` in it a line break.\n * - `size`: its words in a `<span>` of that text size, so the paragraph's own margins stay the dialog's\n * (`1em` of its 16px), on the 4px grid whatever the size.\n */\n private paragraph({ message, size }: E.ModalOptions): HTMLParagraphElement {\n const paragraph = this.document.createElement(\"p\")\n paragraph.style.whiteSpace = MESSAGE_LINES\n if (size && size !== MEDIUM) {\n const words = this.document.createElement(\"span\")\n words.className = FONT_SIZE_CLASS + size\n words.textContent = message\n paragraph.append(words)\n } else paragraph.textContent = message\n return paragraph\n }\n\n /**\n * The message as a `<ui-markdown sanitized breaks>`, importing its family the first time.\n * - `sanitized`: the message may hold what someone typed, so raw HTML in it goes through DOMPurify\n * (no scripts, event handlers or `javascript:` links).\n * - `breaks`: each `\\n` a line break, as in the plain `<p>`.\n * - Its text is the element's text content, never markup: `<ui-markdown>` reads it as Markdown.\n * - rejects if the family can't be imported\n */\n private async markdown({ message, size }: E.ModalOptions): Promise<HTMLElement> {\n await import(\"spell/ui/components/ui-markdown\")\n const markdown = this.document.createElement(ModalDialogs.tagFor(MARKDOWN))\n markdown.toggleAttribute(SANITIZED, true)\n markdown.toggleAttribute(BREAKS, true)\n if (size && size !== MEDIUM) markdown.setAttribute(SIZE, size)\n // the plain `<p>`'s margins, so the dialog keeps its spacing\n markdown.style.marginBlock = PARAGRAPH_MARGIN\n markdown.textContent = message\n return markdown\n }\n\n /**\n * Whether `message` has Markdown in it: a heading, a list, a quote, a fence, bold or italic, code, a link.\n * - So a plain message stays a plain `<p>`, drawn exactly as before `markdown` was asked for.\n * - Static: pure text.\n */\n static hasMarkdown(message: string): boolean {\n return MARKDOWN_MARKS.some((mark) => mark.test(message))\n }\n\n /**\n * Resolves once `markdown` has drawn (`ui-drawn`), or after `DRAW_WAIT` seconds whatever happened:\n * a message that can't draw still opens, showing its error.\n */\n private static drawn(markdown: HTMLElement): Promise<void> {\n return new Promise<void>((resolve) => {\n const wait = E.after(DRAW_WAIT, resolve)\n markdown.addEventListener(\n DRAWN_EVENT,\n () => {\n wait.cancel()\n resolve()\n },\n { once: true }\n )\n })\n }\n\n /** `prompt()`'s text input, focused when the dialog opens. */\n private input(value: string): HTMLInputElement {\n const input = this.document.createElement(\"input\")\n input.type = \"text\"\n input.value = value\n input.autofocus = true\n return input\n }\n\n /** The message as the input's `<label>`, in the opt-in native look (`native.css`). */\n private label(message: string, input: HTMLInputElement): HTMLLabelElement {\n const label = this.document.createElement(\"label\")\n label.className = NATIVE_LOOK\n label.style.cssText = LABEL_LAYOUT\n const words = this.document.createElement(\"span\")\n words.style.whiteSpace = MESSAGE_LINES\n words.textContent = message\n label.append(words, input)\n return label\n }\n\n /** A `<ui-button>` with Fomantic's action class (`approve` / `cancel`). */\n private button(text: string, actionClass: string): HTMLElement {\n const button = this.document.createElement(ModalDialogs.tagFor(UIT.BUTTON))\n button.className = actionClass\n button.textContent = text\n return button\n }\n\n /**\n * Canonical tag of the registered component whose class noun is `noun` (`button` => `ui-button`).\n * - Throws when none is registered: a dialog built from undefined elements would look right and not work.\n * - Static: it reads only the page-wide vocabulary registry.\n */\n private static tagFor(noun: string): string {\n for (const vocabulary of UI.vocabulary.vocabularies.values()) if (vocabulary.noun === noun) return vocabulary.tag\n throw new Error(\n `UI.modals: no component with the class noun \"${noun}\" is registered; ` +\n `import its family (\\`spell/ui/components/ui-parts\\`, \\`ui-button\\`) before opening a dialog`\n )\n }\n}\n\n/** How `run()` builds a dialog: a deny button or not; `prompt()`'s input and its starting text. */\ntype DialogFlags = { canDeny: boolean; input?: string }\n\n/** Constructor props for `ModalDialogs`. */\nexport type ModalDialogsProps = {\n /** page to build in. Default: the global `document`. */\n document?: Document\n}\n\n/** An approve element was activated: the dialog answers yes. */\nconst APPROVE_EVENT: E.EventName<Vocabulary> = \"ui-approving\"\n\n/** Hidden: the call settles. */\nconst HIDE_EVENT: E.EventName<Vocabulary> = \"ui-closed\"\n\n/** `<ui-modal>` width attribute (canonical name). */\nconst SIZE = \"size\"\n\n/** `<ui-modal>`'s close ✕ attribute (canonical name). */\nconst CLOSABLE = \"closable\"\n\n/** The dialogs' width. */\nconst TINY = \"tiny\"\n\n/** The size word that's the default: no class, no attribute. */\nconst MEDIUM = \"medium\"\n\n/** A plain message's text size: `sizes.css`' utility, `ui-font-size-<size>`. */\nconst FONT_SIZE_CLASS = \"ui-font-size-\"\n\n/** Class noun of `<ui-markdown>`. */\nconst MARKDOWN = \"markdown\"\n\n/** `<ui-markdown>`'s attribute: its markup through DOMPurify. */\nconst SANITIZED = \"sanitized\"\n\n/** `<ui-markdown>`'s attribute: a single newline is a line break. */\nconst BREAKS = \"breaks\"\n\n/** The browser's margin above and below a `<p>`, which a Markdown message keeps too. */\nconst PARAGRAPH_MARGIN = \"1em\"\n\n/** `<ui-markdown>` has drawn its text. */\nconst DRAWN_EVENT = \"ui-drawn\"\n\n/** The longest a Markdown message holds its dialog back while it draws, in seconds. */\nconst DRAW_WAIT = 1\n\n/**\n * What makes a message Markdown: any one of them.\n * - a heading (`# Won`), a list item (`- one`, `1. one`), a quote (`> said`), a fence (```` ``` ````)\n * - bold or italic (`**big**`, `__big__`, `*so*`, `_so_`), code (`` `x` ``), a link (`[here](/x)`)\n * - Italic needs a mark against a word on both sides, so `5 * 3 * 2` and `snake_case_name` stay plain.\n */\nconst MARKDOWN_MARKS = [\n /^#{1,6}\\s/m,\n /^\\s*(?:[-*+]|\\d+[.)])\\s+\\S/m,\n /^>\\s?/m,\n /^```/m,\n /(\\*\\*|__)\\S(?:.*?\\S)?\\1/,\n /(?<![\\w*])\\*[^\\s*](?:[^*]*[^\\s*])?\\*(?![\\w*])/,\n /(?<!\\w)_[^\\s_](?:[^_]*[^\\s_])?_(?!\\w)/,\n /`[^`\\n]+`/,\n /\\[[^\\]\\n]+\\]\\([^)\\s]+\\)/\n]\n\n/** Class noun of the actions part (`<ui-actions>`). */\nconst ACTIONS = \"actions\"\n\n/** `<ui-button>` colour of the approve button. */\nconst PRIMARY = \"primary\"\n\n/** `<ui-button>`'s `color`, which `PRIMARY` is a value of (epic `ui-gaps` P4). */\nconst COLOR = \"color\"\n\n/** Fomantic's approve class of a button. */\nconst APPROVE_CLASS = \"approve\"\n\n/** Fomantic's deny class of a button, and the text key of its label. */\nconst CANCEL = \"cancel\"\n\n/** Text key of the approve button's label. */\nconst OK = \"ok\"\n\n/** `native.css`'s opt-in class, for the prompt's input. */\nconst NATIVE_LOOK = \"ui-native\"\n\n/** A message's lines: each `\\n` in it a line break, so a long message reads a sentence or phrase a line. */\nconst MESSAGE_LINES = \"pre-line\"\n\n/** The prompt's label: message above a full-width input. */\nconst LABEL_LAYOUT = \"display: grid; gap: 0.5em\"\n","/**\n * The modal family: defines `<ui-modal>` and exports its component, `UIModal`.\n * - SIDE EFFECTS:\n * - defines `<ui-modal>`, the owner of the `header`, `content`, `description` and `actions` parts,\n * and those parts and `<ui-button>` too (`UI.modals.*` builds its dialogs from them)\n * - registers `ModalDialogs` as `UI.modals`' provider once the runtime has loaded,\n * so `UI.modals.confirm()` / `alert()` / `prompt()` work\n * - Also exports `DialogComponent`, the base `<ui-flyout>` (`spell/ui/components/ui-flyout`) builds on.\n * - Also the library's `spell/ui/ui-modal` entry (its size is in `notes/report.md`).\n */\n\nimport { E, UI } from \"spell/ui/core\"\nimport { DialogComponent } from \"./DialogComponent\"\nimport { UIModal } from \"./UIModal\"\nimport { ModalDialogs } from \"./ModalDialogs\"\n\nimport \"spell/ui/components/ui-parts\"\nimport \"spell/ui/components/ui-button\"\n\nUIModal.define()\nif (E.isBrowser()) void UI.load().then(() => UI.modals.register(new ModalDialogs()))\n\nexport { DialogComponent, UIModal, ModalDialogs }\nexport type { DialogAttributes } from \"./UIModal.types\"\n"],"mappings":";;;;;;;A,2FAAA4D,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAvD,GAAAC,GAAAC,GAAAyD,GA2DsBC,IAAf,MAAe,0BAEZ,IAAAzD,GAER,IAAA,CAACC,CAAE,GAuFH,IAAA,CAACC,CAAE,GAyCH,IAAA,CAACC,EAAE,GA0DH,IAAA,CAACC,EAAK,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<div id={this.headerId} class={UIT.HEADER} part={this.dialogPart(UIT.HEADER)}>\n {this.heading}\n </div>\n </Show>","class={UIT.HEADER}","part={this.dialogPart(UIT.HEADER)}","<div id={this.headerId} class={UIT.HEADER} part={this.dialogPart(UIT.HEADER)}>\n {this.heading}\n </div>","<dialog\n ref={(element) => this.dialog = element}\n class={this.rootClass}\n part={this.dialogPart(this.rootPart)}\n aria-labelledby={isServer ? this.serverLabelledBy() : void 0}\n onCancel={this.onCancel}\n onClose={this.onClose}\n onPointerDown={this.onPointerDown}\n onClick={this.onDialogClick}\n >\n <Show when={this.heading}>\n <div id={this.headerId} class={UIT.HEADER} part={this.dialogPart(UIT.HEADER)}>\n {this.heading}\n </div>\n </Show>\n <Show when={this.content}>\n <div class={UIT.CONTENT} part={this.dialogPart(UIT.CONTENT)}>\n {this.content}\n </div>\n </Show>\n <slot />\n {this.closeButton.draw()}\n </dialog>","<Show when={this.content}>\n <div class={UIT.CONTENT} part={this.dialogPart(UIT.CONTENT)}>\n {this.content}\n </div>\n </Show>","part={this.dialogPart(UIT.CONTENT)}","<div class={UIT.CONTENT} part={this.dialogPart(UIT.CONTENT)}>\n {this.content}\n </div>","part={this.dialogPart(this.rootPart)}","aria-labelledby={isServer ? this.serverLabelledBy() : void 0}","_elementSetup_dec","_a","_init","E.UIComponent","E.protoMerged","E.untracked","E.whileConnected","E.on","E.state","E.onChange","E.Disclosure","E.CloseButton","UIT.CLOSE","CLOSABLE","_$readShallow","UIT.HEADER","_$setAttribute","UIT.CONTENT","_$getOwner","__name","E.proto","E.protoMerged","__name","modalCSS","E.hasMarkdown","UIT.HEADING","UIT.CONTENT","E.after","UIT.BUTTON","E.isBrowser","HEADER","Key","__decoratorStart","__publicField","__name$1","ToggleCommands","HEADING","__decorateElement","ModalActions","__decoratorMetadata","__runInitializers","AnimationLookup","BUTTON","CONTENT","__privateAdd","CLOSE","getOwner$1","_tmpl$","_tmpl$2","_onNameChanged_dec","_onSlotChange_dec","_slottedHeading_dec","_onClose_dec","_closedBy_dec","_onCommand_dec","_watchPlacement_dec","_requestClose_dec","_elementSetup_dec$1","_a$1","_init$1","_slottedHeading","_DialogComponent","UIComponent","protoMerged","untracked","whileConnected","on","state","onChange","args","reason","Disclosure","visible","dialog","event","box","x","y","closedBy","CloseButton","found","kind","action","detail","originalEvent","soon","keyframes","animation","UI","wasShown","isModeless","isNative","generation","animations","name","CLOSABLE$1","child","hasHeader","header","reflected","label","heading","_self$","_el$","_el$3","_el$5","_el$6","addEvent","ref","element","insert","createComponent","Show","_el$2","effect","readShallow","_p$","setAttribute","className","a","_el$4","t","isServer","target","domElement","DialogComponent","delegateEvents","modalVocabulary","UIModal_default","_shownClass_dec","_overlayKind_dec","_rootPart_dec","_elementSetup_dec","_vocabulary_dec","_a","_init","_UIModal","proto","UIModal","ModalDialogs","document","options","isApproved","value","hasMarkdown","flags","result","message","modal","SIZE","TINY","CLOSABLE","content","field","input","actions","ACTIONS","canDeny","CANCEL","approve","OK","APPROVE_CLASS","COLOR","PRIMARY","drawn","APPROVE_EVENT","HIDE_EVENT","resolve","paragraph","MESSAGE_LINES","size","MEDIUM","words","FONT_SIZE_CLASS","markdown","MARKDOWN","SANITIZED","BREAKS","PARAGRAPH_MARGIN","wait","after","DRAW_WAIT","DRAWN_EVENT","NATIVE_LOOK","LABEL_LAYOUT","button","actionClass","text","vocabulary","noun","isBrowser"],"sources":["../src/components/ui-modal/DialogComponent.tsx","../src/components/ui-modal/UIModal.en.ts","../src/components/ui-modal/UIModal.tsx","../src/components/ui-modal/ModalDialogs.ts","../src/components/ui-modal/index.ts"],"sourcesContent":["import { Show } from \"solid-js\"\nimport { isServer, type JSX } from \"@solidjs/web\"\n\nimport { E, UI, UIT } from \"spell/ui/core\"\nimport { type DialogAttributes, type DialogEventName } from \"./UIModal.types\"\n\n/****************\n * ### `DialogComponent`\n * The base of the components behind `<ui-modal>` and `<ui-flyout>`:\n * everything they do, on a shadow `<dialog class=\"ui … <noun>\" part=\"<rootPart>\">` shown with `showModal()`.\n * The browser gives it the focus trap, the `inert` page, the top layer and the `::backdrop` (the dimmer).\n * A subclass may be MODELESS (`isModeless`: `<ui-flyout modeless>`): `show()`, the page left usable;\n * a click on the page closes the dialog, and still lands where it went.\n *\n * - A subclass adds only its names and looks:\n * `vocabulary`, `elementSetup.styleSheets` (and `animation`), `rootPart`, `overlayKind`, `shownClass`.\n *\n * - In the modal family, not `src/elements/`: a flyout IS Fomantic's side modal\n * (the same parts, buttons, events and dismissal), and nothing else shares it yet.\n * A third, non-modal overlay would move it to `src/elements/` (`agents/CODE-DEBT.md`, `ui`).\n *\n * - Every dialog vocabulary MUST name (each family's tests check it; types can't):\n * - attributes `closable`, `closedby`, `heading`, `content`\n * - events `ui-opening`, `ui-opened`, `ui-closing`, `ui-closed`, `ui-approving`, `ui-denying`\n * - parts `rootPart`, `header`, `content`, `close`; text `close`.\n *\n * - Shown by the shared `visible` / `hidden` (`UIComponent`, \"Shown or hidden\"), starting hidden\n * (`elementSetup.visible`): `<ui-modal visible>`, `modal.visible = true`.\n * - Controlled (`isVisible`): a person's `ui-opening` / `ui-closing` (with a `reason`) come first and can veto;\n * `ui-opened` / `ui-closed` follow once the transition has finished.\n * - The `<dialog>` opens with `showModal()` and closes with `close()` as `visible` changes (`onVisibleChange()`).\n *\n * - Dismissal, by `closedby` (read when it opens; `closedBy` says what an absent one means):\n * - Escape: through `UI.overlays` (kind `overlayKind`: scroll lock, keyboard scope, focus restore),\n * so only the topmost overlay closes, and `ui-closing` can veto.\n * The dialog's own `cancel` is always prevented.\n * - A click on the `::backdrop`: the browser's light dismiss (`<dialog closedby>`)\n * when `UI.browser.supports.dialogClosedBy`, reported as `cancel`;\n * else `UI.overlays`' outside click, which tells a backdrop click from one on the dialog by where the pointer is.\n * - A close the browser forces anyway (a repeated Escape it won't let a page veto) is followed:\n * a `ui-closing` that can't veto, then `visible` off.\n *\n * - Opening as a PERSON'S action, so `ui-opening` fires:\n * an invoker command, `<button commandfor=\"id\" command=\"--show\">`\n * (`ToggleCommands`; `--close` closes, `--toggle` flips).\n * Writing `visible` (or `hidden`) is the app's own decision, and fires nothing.\n *\n * - Buttons: a click on an approve / deny element fires the cancelable `ui-approving` / `ui-denying`, then closes.\n * - Those elements (`ModalActionSelectors`):\n * Fomantic's `.approve` / `.deny` classes, `<ui-button color=\"positive\">` / `\"negative\"` (and the old\n * `<ui-button color=\"negative\">`).\n * - The `closable` icon closes (reason `close`).\n *\n * - `closable=\"false\"` is Fomantic's `closable: false` AND `closeIcon: false`:\n * no icon, and (unless `closedby` is set) `closedby=\"none\"`, so Escape and the dimmer do nothing.\n *\n * - Its name: the DOM element's `aria-label`, else the `heading` shorthand, else a slotted `<ui-header>`\n * (by element reflection: an idref can't reach into the light DOM from the shadow root).\n ****************/\nexport abstract class DialogComponent<\n V extends E.ComponentVocabulary = E.ComponentVocabulary\n> extends E.UIComponent<V> {\n /** Starts hidden, unless the page writes `visible`. */\n @E.protoMerged static elementSetup: Partial<E.ElementSetup> = { visible: \"hidden\" }\n\n /** Part name of the `<dialog>`, e.g. `modal`. */\n declare rootPart: string\n\n /** `UI.overlays` kind: `modal` or `flyout`. */\n declare overlayKind: E.OverlayKind\n\n /**\n * Hook: shown without blocking the page (`show()`, not `showModal()`).\n * - No `::backdrop`, no scroll lock, no focus trap.\n * - A click on the page lands, and closes it (light dismiss, `closedby=\"any\"`).\n * - Default `false`; `<ui-flyout modeless>`.\n */\n protected get isModeless(): boolean {\n return false\n }\n\n // The dialog attributes this base reads (see the class docs):\n // each vocabulary's getters, declared here since `V` is unknown to this class.\n\n /** `closable`: the close icon; `false` (written) is also Fomantic's `closable: false`. */\n declare closable: boolean\n\n /** `closedby`: what dismisses it, as written; see `closedBy` for what it means. */\n declare closedby: DialogAttributes[\"closedby\"] | undefined\n\n /** `heading`: the heading shorthand (old name `header`). */\n declare heading: string | undefined\n\n /** `content`: the content shorthand. */\n declare content: string | undefined\n\n /** The dialog. */\n protected dialog?: HTMLDialogElement\n\n /**\n * This element's `UI.overlays` entry; its Escape / outside options follow `closedby` when it opens.\n * - `kind` is the subclass's `overlayKind`, set in the constructor (a prototype value TypeScript can't see here).\n */\n private readonly overlayEntry: E.OverlayEntry = {\n element: this.domElement,\n kind: \"modal\",\n onDismiss: (reason: E.DismissReason) => void this.requestClose(reason)\n }\n\n constructor(...args: ConstructorParameters<typeof E.UIComponent>) {\n super(...args)\n this.overlayEntry.kind = this.overlayKind\n }\n\n ////////////////\n // ## Shown or hidden\n ////////////////\n\n /** Fomantic's class word on the `<dialog>` while it shows: `active` (a modal), `visible` (a flyout). */\n declare shownClass: string\n\n /** Bumped on every show / hide, so a late `ui-opened` / `ui-closed` of an earlier one is dropped. */\n private generation = 0\n\n /** Fomantic's shown class (`shownClass`), just before the noun while `visible`. */\n protected get extraClass(): string | undefined {\n return this.isVisible ? this.shownClass : undefined\n }\n\n /**\n * Shown or hidden, as `visible` (`isVisible`): `ui-opening` / `ui-closing` first, `ui-opened` / `ui-closed` once\n * its transition ends (`onVisibleChange()`).\n */\n readonly disclosure = new E.Disclosure({\n component: this,\n member: \"isVisible\",\n detail: (visible, originalEvent): UIT.ModalOpenDetail | UIT.ModalCloseDetail =>\n visible ? { visible, originalEvent } : { visible, reason: this.closeReason, originalEvent },\n afterDetail: (visible): UIT.ModalOpenDetail => ({ visible })\n })\n\n /** Why the latest close was asked for: `ui-closing`'s `reason`. */\n private closeReason: UIT.ModalCloseReason = \"escape\"\n\n /** Show, dispatching the cancelable `ui-opening` first; true when applied. */\n requestOpen(originalEvent?: Event): boolean {\n return this.disclosure.open(originalEvent)\n }\n\n /** Hide for `reason`, dispatching the cancelable `ui-closing` first; true when applied. */\n @E.untracked\n requestClose(reason: UIT.ModalCloseReason, originalEvent?: Event): boolean {\n if (!this.isVisible) return false\n this.isDismissing = true\n E.soon(() => (this.isDismissing = false))\n this.closeReason = reason\n return this.disclosure.close(originalEvent)\n }\n\n /**\n * `visible` changed (`UIComponent`'s hook): open or close the `<dialog>`;\n * resolves once its transition has ended, with `ui-opened` / `ui-closed`.\n * - `animation`:\n * - the family's own (`elementSetup.animation`): the sheet's transition (`UIModal.css`, `UIFlyout.css`)\n * - another one (the element's own `animation`): run on the `<dialog>` through `UI.transitions`\n * - `none`: at once (motion off, or the element's first draw)\n * - `ui-closed` only when it was shown: a modal that starts hidden fires nothing.\n */\n protected async onVisibleChange(visible: boolean, animation: UIT.Animation): Promise<void> {\n const dialog = this.dialog\n if (!dialog) return\n const keyframes = UIT.AnimationLookup.keyframesBeside(animation, this.elementSetup.animation)\n if (visible) {\n this.show()\n if (keyframes) await UI.transitions.animate({ element: dialog, name: keyframes, direction: UIT.IN })\n if ((await this.transitionsEnd()) && this.isVisible) this.disclosure.sendAfter(true)\n return\n }\n const wasShown = UI.overlays.isOpen(this.overlayEntry)\n if (keyframes && wasShown) await UI.transitions.animate({ element: dialog, name: keyframes, direction: UIT.OUT })\n // shown again while the keyframes ran\n if (this.isVisible) return\n this.hide()\n if (!wasShown || !(await this.transitionsEnd())) return\n if (!this.isVisible && this.domElement.isConnected) this.disclosure.sendAfter(false)\n }\n\n /**\n * Shown again when it comes back into the page while `visible`; closed, quietly, when it leaves.\n * - Not on the first connect: the dialog isn't drawn yet, and `onVisibleChange()` runs once it is.\n */\n @E.whileConnected\n protected watchPlacement() {\n if (this.isVisible && this.isReady) this.show()\n return () => this.hide()\n }\n\n /**\n * `showModal()` (`show()` when `isModeless`) and register with `UI.overlays`; nothing when already open.\n * - Modeless: the overlay entry isn't `modal` (no scroll lock), and the page stays usable.\n * - A click on the page LIGHT-DISMISSES it (`any`, the default), through the overlay entry, never the browser's:\n * the click still lands where it went.\n * - Its opener (`commandfor`) and a click inside don't count.\n * - `closedby` is applied here:\n * natively when supported (the browser's light dismiss), else by the overlay entry's outside-click handling.\n * - A `<dialog>` that other keyframes animated out (`hidden` on it) shows again first.\n */\n private show() {\n const dialog = this.dialog\n if (!dialog) return\n const isModeless = this.isModeless\n const closedBy = this.closedBy\n // modeless: our own outside-click handling, which lets the click through (the browser's needs a backdrop)\n const isNative = UI.browser.supports.dialogClosedBy && !isModeless\n if (isNative) dialog.setAttribute(\"closedby\", closedBy)\n else dialog.removeAttribute(\"closedby\")\n this.overlayEntry.closeOnEscape = closedBy !== \"none\"\n this.overlayEntry.closeOnOutsideClick = !isNative && closedBy === \"any\"\n this.overlayEntry.modal = !isModeless\n UI.transitions.reveal(dialog)\n if (!dialog.open) {\n if (isModeless) dialog.show()\n else dialog.showModal()\n UI.focus.enter(dialog)\n }\n UI.overlays.open(this.overlayEntry)\n }\n\n /** `close()` the dialog, THEN leave `UI.overlays` (whose focus restore needs the page no longer `inert`). */\n private hide() {\n const dialog = this.dialog\n if (dialog?.open) dialog.close()\n UI.overlays.close(this.overlayEntry)\n }\n\n /** Once the dialog's own transitions end: `true` unless another show / hide started meanwhile. */\n private async transitionsEnd(): Promise<boolean> {\n const generation = ++this.generation\n const animations = this.dialog?.getAnimations() ?? []\n await Promise.allSettled(animations.map((animation) => animation.finished))\n return generation === this.generation\n }\n\n /** `send()` one of the events every dialog vocabulary names (see the class docs). */\n private fire(name: DialogEventName, detail: object): boolean {\n return this.send(name as E.EventName<V>, detail)\n }\n\n /** An invoker command aimed at the DOM element (`UIT.ToggleCommands`). */\n @E.on(\"command\")\n protected onCommand(event: Event) {\n const action = UIT.ToggleCommands.action(event, this.isVisible)\n if (action === \"show\") this.requestOpen(event)\n else if (action === \"close\") this.requestClose(\"close\", event)\n }\n\n ////////////////\n // ## Dismissal\n ////////////////\n\n /** A dismissal was asked for in this task: the dialog's own `cancel` for the same key press is ignored. */\n private isDismissing = false\n\n /** The last press started on the `::backdrop`. */\n private pressStartedOnBackdrop = false\n\n /**\n * What dismisses it: an explicit `closedby` wins;\n * else `none` for `closable=\"false\"` (Fomantic's `closable: false`), else `any`.\n * - NOTE: `closedby` has a vocabulary default, so whether it was written is read off the DOM element.\n * - Untracked.\n */\n @E.untracked\n private get closedBy(): NonNullable<DialogAttributes[\"closedby\"]> {\n if (this.domElement.hasAttribute(\"closedby\")) return this.closedby ?? \"any\"\n // NOTE: an absent boolean also converts to `false`, so `closable` must be present to mean \"closable: false\"\n const isOff = this.domElement.hasAttribute(CLOSABLE) && !this.closable\n return isOff ? \"none\" : \"any\"\n }\n\n /** Remember whether a press started on the `::backdrop` (the dialog itself, outside its box). */\n private readonly onPointerDown = (event: PointerEvent) => {\n const dialog = this.dialog\n if (!dialog || event.target !== dialog) return void (this.pressStartedOnBackdrop = false)\n const box = dialog.getBoundingClientRect()\n const { clientX: x, clientY: y } = event\n this.pressStartedOnBackdrop = x < box.left || x > box.right || y < box.top || y > box.bottom\n }\n\n /**\n * The dialog's `cancel`: Escape the overlay didn't take, or the browser's light dismiss (`closedby`).\n * - Always prevented; the element decides, by `closedby`, and `ui-closing` may veto.\n */\n private readonly onCancel = (event: Event) => {\n event.preventDefault()\n const reason = this.pressStartedOnBackdrop ? \"outside\" : \"escape\"\n this.pressStartedOnBackdrop = false\n if (this.isDismissing) return\n const closedBy = this.closedBy\n if (closedBy === \"none\" || (reason === \"outside\" && closedBy !== \"any\")) return\n this.requestClose(reason, event)\n }\n\n /**\n * The dialog closed while the element thinks it's open: the browser forced it -- follow.\n * - `close` is queued as a task:\n * one from an earlier close can arrive after a quick re-open, when the dialog is open again -- ignored.\n */\n @E.untracked\n private readonly onClose = (event: Event) => {\n if (this.dialog?.open || !this.domElement.isConnected) return\n this.closeReason = \"escape\"\n this.disclosure.adopt(false, event)\n }\n\n ////////////////\n // ## Buttons\n ////////////////\n\n /** The close icon, while `closable`. */\n readonly closeButton = new E.CloseButton({\n owner: this,\n shows: () => !!this.closable,\n label: () => this.closeText,\n part: this.dialogPart(UIT.CLOSE),\n onClick: (event) => this.onCloseIcon(event)\n })\n\n /**\n * The close icon's label (`translationForKey(\"close\")`).\n * - Not a cast in the JSX, for the reason `dialogPart()` is a method.\n */\n private get closeText(): string {\n return this.translationForKey(UIT.CLOSE as E.TextKey<V>)\n }\n\n /** Close icon. */\n private readonly onCloseIcon = (event: MouseEvent) => {\n event.stopPropagation()\n this.requestClose(\"close\", event)\n }\n\n /** A click inside: an approve / deny element asks, then closes. */\n private readonly onDialogClick = (event: MouseEvent) => {\n const found = DialogComponent.actionFor(event, this.domElement)\n if (!found) return\n const [kind, action] = found\n const detail: UIT.ModalActionDetail = { action, originalEvent: event }\n if (!this.fire(kind === \"approve\" ? \"ui-approving\" : \"ui-denying\", detail)) return\n this.requestClose(kind, event)\n }\n\n ////////////////\n // ## The name\n ////////////////\n\n /** The DOM element's `aria-label`, forwarded to the dialog. */\n get ariaLabel(): string | undefined {\n return this.attributes[\"aria-label\"] ?? undefined\n }\n\n /**\n * First slotted `<ui-header>` (any tag whose noun is `header`), which names the dialog.\n * - Read on the server too, NO `isServer` guard:\n * the static render (`spell/ui/static`, on linkedom elements) names the dialog by it (`serverLabelledBy()`).\n */\n @E.state accessor slottedHeading: Element | undefined = this.findHeading()\n\n /** Id of the `heading` shorthand, from `UI.ids` once rendering. */\n private headerId = \"\"\n\n /** The light DOM's slotted children changed: look for the heading again. */\n @E.on(\"slotchange\", { target: \"renderRoot\" })\n protected onSlotChange() {\n this.slottedHeading = this.findHeading()\n }\n\n /** First child element whose definition's noun is `header` (a `<ui-header>`, or a translated one). */\n private findHeading(): Element | undefined {\n for (const child of this.domElement.children) {\n if (E.UIComponent.registry.definitions.get(child.localName)?.vocabulary.noun === UIT.HEADER) return child\n }\n return undefined\n }\n\n /** The dialog's name: its `aria-label`, else `aria-labelledby` the `heading` shorthand, else the slotted heading. */\n @E.onChange(\"isReady\", \"ariaLabel\", \"heading\", \"slottedHeading\")\n protected onNameChanged(\n _isReady: boolean,\n label: string | undefined,\n header: string | undefined,\n heading: Element | undefined\n ) {\n const dialog = this.dialog\n if (!dialog) return\n const hasHeader = !!header\n const reflected = dialog as unknown as { ariaLabelledByElements: Element[] | null }\n if (label) dialog.setAttribute(\"aria-label\", label)\n else dialog.removeAttribute(\"aria-label\")\n // NOTE: setting the reflected list (even to `null`, the platform's \"none\") rewrites the attribute,\n // so it goes first\n reflected.ariaLabelledByElements = !label && !hasHeader && heading ? [heading] : null\n if (!label && hasHeader) dialog.setAttribute(\"aria-labelledby\", this.headerId)\n }\n\n /**\n * The dialog's `aria-labelledby` in a server render (`spell/ui/static`):\n * the `heading` shorthand's id, else the slotted heading's,\n * unless the DOM element has an `aria-label` (which the static output moves onto the dialog).\n * - Why: on a server no effect applies and no element reflects.\n * - SIDE EFFECT: gives the slotted heading (the render's parsed copy) an id if it has none.\n */\n private serverLabelledBy(): string | undefined {\n if (this.ariaLabel) return undefined\n if (this.heading) return this.headerId\n const heading = this.slottedHeading\n return heading ? UI.ids.ensure(heading, `ui-${this.elementDefinition.vocabulary.noun}-heading`) : undefined\n }\n\n ////////////////\n // ## Rendering\n ////////////////\n\n render(): JSX.Element {\n this.headerId = UI.ids.next(`ui-${this.elementDefinition.vocabulary.noun}`)\n return (\n <dialog\n ref={(element) => (this.dialog = element)}\n class={this.rootClass}\n part={this.dialogPart(this.rootPart)}\n aria-labelledby={isServer ? this.serverLabelledBy() : undefined}\n onCancel={this.onCancel}\n onClose={this.onClose}\n onPointerDown={this.onPointerDown}\n onClick={this.onDialogClick}\n >\n <Show when={this.heading}>\n <div id={this.headerId} class={UIT.HEADER} part={this.dialogPart(UIT.HEADER)}>\n {this.heading}\n </div>\n </Show>\n <Show when={this.content}>\n <div class={UIT.CONTENT} part={this.dialogPart(UIT.CONTENT)}>\n {this.content}\n </div>\n </Show>\n <slot />\n {this.closeButton.draw()}\n </dialog>\n )\n }\n\n /**\n * `part` value of one of the parts every dialog vocabulary names (see the class docs).\n * - A method, not a cast in the JSX:\n * Solid's SSR compile (`hoistProps`) hoists a `<Show>`'s children into a module-level constructor,\n * and passes it every free identifier they use.\n * That includes the type parameter `V` of a `PartName<V>` cast, as a VALUE (\"V is not defined\").\n */\n private dialogPart(name: string): string {\n return this.partForName(name as E.PartName<V>)\n }\n\n /**\n * The approve / deny element `event` activated, with which it is; `undefined` for none.\n * - The innermost light-DOM element on its path (in `domElement`'s tree)\n * matching `UIT.ModalActionSelectors`, up to `domElement` (`UIT.ModalActions`, the toast's walk too).\n */\n private static actionFor(event: Event, domElement: Element): [UIT.ModalAction, Element] | undefined {\n for (const target of UIT.ModalActions.lightPath(event, domElement)) {\n const action = UIT.ModalActions.of(target)\n if (action) return [action, target]\n }\n return undefined\n }\n}\n\n/** The attribute of the close icon (and of Fomantic's `closable: false`). */\nconst CLOSABLE = \"closable\"\n","/**\n * Every name `<ui-modal>` uses: tag, attributes (kind + allowed values), events, slots, parts, states, texts.\n * Schema: `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n * - Class words come out through `ClassBuilder`, in Fomantic's grammar:\n * `<ui-modal size=\"tiny\" appearance=\"basic\" vertical-align=\"top\" visible>` => `ui tiny basic top aligned active modal`;\n * `active`, Fomantic's shown-modal class, is the element's own while it shows (the shared `visible` / `hidden`).\n * - Sizes are WIDTHS here (Fomantic's modal ratios), not text sizes:\n * `UIModal.css` reads the size class, never `--ui-scale`.\n * - A modal OWNS the `header`, `content`, `description` and `actions` parts:\n * slotted ones get `:state(in-modal)` and style themselves from `UIParts.css`,\n * reading `--_ui-modal-basic` / `--_ui-modal-header-size` (`UIModal.css`).\n * - `closedby` mirrors `<dialog closedby>`:\n * `any` (Fomantic's `closable: true`), `closerequest` (Escape only), `none`.\n * - `closable` is the close ICON (Fomantic's `closeIcon`).\n * `closable=\"false\"` also brings back Fomantic's `closable: false` (dismissal `none`), unless `closedby` is set.\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/****************\n * ### `<ui-modal>`\n * A modal dialog: `<dialog class=\"ui ... modal\" part=\"modal\">`, shown with `showModal()`.\n ****************/\nexport const modalVocabulary = {\n tag: \"ui-modal\",\n icon: \"window restore outline\",\n topics: [\"dialogs\", \"overlays\", \"popups\", \"modules\"],\n aka: [\"dialog\", \"popup window\", \"lightbox\", \"confirm\", \"alert dialog\"],\n noun: \"modal\",\n partOfSpeech: \"structure\",\n description: \"A modal displays content that temporarily blocks interactions with the main view of a site.\",\n attributes: [\n {\n name: \"size\",\n group: \"appearance\",\n kind: \"size\",\n description: \"Width, `mini` ... `massive` (Fomantic's ratios of the default width); `medium` is the default.\"\n },\n {\n name: \"appearance\",\n group: \"appearance\",\n kind: \"multiple\",\n values: [\"basic\"],\n // each word draws itself: no key after it\n classes: {},\n replaces: [{ from: \"basic\", value: \"basic\" }],\n description: \"The look: `basic`, no box: light text straight on the dimmer. Old name: `basic`.\"\n },\n { name: \"inverted\", group: \"appearance\", kind: \"keyOnly\", description: \"The dark scheme.\" },\n {\n name: \"transparent\",\n group: \"appearance\",\n kind: \"keyOnly\",\n description:\n \"See-through: no box, no shadow, no padding, drawn as written. Its text keeps its colour \" +\n \"(`appearance=\\\"basic\\\"` turns it light). In Spell, a modal naming none of its parts is laid out \" +\n \"for you, unless it says `transparent`.\"\n },\n { name: \"fullscreen\", group: \"appearance\", kind: \"keyOnly\", description: \"Nearly the whole viewport wide.\" },\n {\n name: \"overlay\",\n group: \"appearance\",\n kind: \"keyOnly\",\n description: \"With `fullscreen`: covers the whole viewport, edge to edge (`overlay fullscreen`).\"\n },\n {\n name: \"scrolling\",\n group: \"layout\",\n kind: \"keyOnly\",\n description: \"Scrolls inside itself when taller than the viewport.\"\n },\n {\n name: \"vertical-align\",\n group: \"layout\",\n kind: \"verticalAlign\",\n values: [\"top\", \"bottom\"],\n description: \"Pinned near the `top` or `bottom` of the viewport instead of centred (`top aligned`).\"\n },\n {\n name: \"closable\",\n group: \"behaviour\",\n kind: \"boolean\",\n description:\n \"Shows a close icon (Fomantic's `closeIcon` setting). `closable=\\\"false\\\"` is also Fomantic's `closable: \" +\n 'false` setting: no icon AND `closedby=\"none\"` (Escape and the dimmer do nothing), unless `closedby` is ' +\n \"set, which wins for dismissal. Absent: no icon, dismissed by `closedby` (default `any`).\"\n },\n {\n name: \"closedby\",\n group: \"behaviour\",\n kind: \"enum\",\n values: [\"any\", \"closerequest\", \"none\"],\n default: \"any\",\n property: \"closedBy\",\n description:\n \"What dismisses it, as `<dialog closedby>` (Fomantic's `closable` setting, in three steps): `any` -- \" +\n \"Escape or a click on the dimmer (default); `closerequest` -- Escape only; `none` -- only its own \" +\n 'buttons. Read when it opens; when set, it wins over `closable=\"false\"`.'\n },\n {\n name: \"heading\",\n replaces: [\"header\"],\n group: \"name\",\n kind: \"string\",\n description:\n \"Shorthand for a header; a slotted `<ui-header>` is the rich version (and names the dialog). Its old name was `header`.\"\n },\n {\n name: \"content\",\n group: \"content\",\n kind: \"string\",\n description: \"Shorthand for a content block of text; a slotted `<ui-content>` is the rich version.\"\n }\n ],\n events: [\n {\n name: \"ui-opening\",\n detail: \"{ visible: true, originalEvent?: Event }\",\n cancelable: true,\n description: \"About to show (a person's action, not a `visible` write); `preventDefault()` keeps it hidden.\"\n },\n {\n name: \"ui-opened\",\n detail: \"{ visible: true }\",\n description: \"Shown, its entry transition finished (Fomantic's `onVisible`).\"\n },\n {\n name: \"ui-closing\",\n detail: \"{ visible: false, reason: ModalCloseReason, originalEvent?: Event }\",\n cancelable: true,\n description:\n \"About to hide: Escape, the dimmer, the close icon, approve or deny. `preventDefault()` keeps it shown.\"\n },\n {\n name: \"ui-closed\",\n detail: \"{ visible: false }\",\n description: \"Hidden, its exit transition finished (Fomantic's `onHidden`).\"\n },\n {\n name: \"ui-approving\",\n detail: \"{ action: Element, originalEvent?: Event }\",\n cancelable: true,\n description:\n 'An approve button (`.approve` / `.ok` / `.positive`, `<ui-button color=\"positive\">`) was activated; ' +\n \"`preventDefault()` keeps the modal shown (Fomantic's `onApprove` returning `false`).\"\n },\n {\n name: \"ui-denying\",\n detail: \"{ action: Element, originalEvent?: Event }\",\n cancelable: true,\n description:\n 'A deny button (`.deny` / `.cancel` / `.negative`, `<ui-button color=\"negative\">`) was activated; ' +\n \"`preventDefault()` keeps the modal shown.\"\n }\n ],\n slots: [\n {\n name: \"\",\n description: \"Content parts: `<ui-header>`, `<ui-content>` (`image`, `scrolling`), `<ui-actions>` with buttons.\"\n }\n ],\n parts: [\n { name: \"modal\", description: \"The `<dialog>` box; its `::backdrop` is the dimmer.\" },\n { name: \"header\", description: \"The `header` shorthand.\" },\n { name: \"content\", description: \"The `content` shorthand.\" },\n { name: \"close\", description: \"The close icon of a `closable` modal.\" }\n ],\n states: [],\n texts: [\n { key: \"close\", text: \"Close\", description: \"Accessible name of the close icon.\" },\n { key: \"ok\", text: \"OK\", description: \"Approve button of `UI.modals.confirm()` / `alert()` / `prompt()`.\" },\n { key: \"cancel\", text: \"Cancel\", description: \"Deny button of `UI.modals.confirm()` / `prompt()`.\" }\n ],\n ownsParts: [\"header\", \"content\", \"description\", \"actions\"]\n} as const satisfies E.ComponentVocabulary\n","import { E } from \"spell/ui/core\"\nimport { modalVocabulary } from \"./UIModal.en\"\nimport { DialogComponent } from \"./DialogComponent\"\nimport type { Vocabulary } from \"./UIModal.types\"\n\nimport modalCSS from \"./UIModal.css?inline\"\n\n/****************\n * ### `UIModal`\n * The component behind `<ui-modal>`:\n * a modal dialog, a shadow `<dialog class=\"ui … modal\" part=\"modal\">` shown with `showModal()`.\n *\n * - The browser gives it the focus trap, the `inert` page, the top layer and the `::backdrop`:\n * the dimmer, themed by the shared `--ui-dimmer-*` tokens. No `<ui-dimmer>` element.\n * - All of its behaviour is `DialogComponent`'s, which `<ui-flyout>` shares:\n * this class only names and styles it.\n * - shared: `visible` / `hidden`, `closedby`, approve / deny, the close icon, invoker commands, its name\n * - `UI.modals.confirm()` / `alert()` / `prompt()` draw one of these (`ModalDialogs`, registered by the barrel).\n ****************/\nexport class UIModal extends DialogComponent<Vocabulary> {\n @E.proto static vocabulary = modalVocabulary\n @E.protoMerged static elementSetup = {\n styleSheets: { modal: modalCSS },\n // the sheet's own transition is Fomantic's `scale`: faded in from 80%\n animation: \"scale\"\n } satisfies Partial<E.ElementSetup>\n @E.proto static rootPart = \"modal\"\n @E.proto static overlayKind = \"modal\" as const\n @E.proto static shownClass = \"active\"\n}\n\n/** The vocabulary's attribute getters, typed (see \"Attributes\" in `UIComponent`). */\nexport interface UIModal extends E.AttributeValues<typeof modalVocabulary> {}\n","import { E, UI, UIT } from \"spell/ui/core\"\nimport { modalVocabulary } from \"./UIModal.en\"\nimport { type Vocabulary } from \"./UIModal.types\"\n\n/****************\n * ### `ModalDialogs`\n * The dialogs behind `UI.modals.confirm()` / `alert()` / `prompt()` (Fomantic's `$.modal('confirm', …)`):\n * a `<ui-modal>` built for the call, appended to `<body>`, shown (`visible`), and removed once hidden.\n *\n * - Markup: `<ui-modal size=\"tiny\" closedby=\"closerequest\" closable heading=\"title\">` holding\n * - a `<ui-content>`: the message as a `<p>`, or for `prompt()` a `<label>` around it and an `<input>`\n * - `size`: the message's text size (`ui-font-size-big`), the title and buttons keeping theirs\n * - `markdown`, and the message has Markdown in it (`hasMarkdown()`, `spell/util/string`):\n * a `<ui-markdown sanitized breaks>` instead of the `<p>` (`prompt()`'s, above its input, in its label),\n * its family imported the first time one is needed;\n * the dialog shows once it has drawn, so it never opens on a half-drawn message\n * - `<ui-actions>`: a deny button (`cancel`, first: it takes the initial focus, the least destructive choice)\n * and a primary approve button.\n * - Escape denies (`closedby=\"closerequest\"`: no dimmer clicks, so a stray click can't answer).\n * - So does its close ✕ (`closable`), on unless `options.closable` is `false`.\n * - The promise settles once the modal is HIDDEN (`ui-closed`), so a caller can open the next dialog straight away.\n * - Button texts: `okText` / `cancelText`, else the translated `ok` / `cancel` texts (`UI.i18n`).\n * - Everything is light DOM built with `createElement` / `textContent`: never `innerHTML` with caller text.\n * - Other families' tags (`<ui-content>`, `<ui-actions>`, `<ui-button>`) are looked up at CALL time,\n * by class noun, in the vocabulary registry (`UI.vocabulary`).\n * - Why: importing their vocabulary files would reach into other families' files,\n * which `AGENTS.md` keeps behind `spell/ui/core`.\n * - The family barrel imports `parts` and `button`, so both are defined before any dialog opens.\n * - Registered by the family barrel as `UI.modals`' provider; the runtime never imports it.\n ****************/\nexport class ModalDialogs implements E.ModalProvider {\n /** Page the dialogs are made in; a test passes its own. */\n readonly document: Document\n\n constructor({ document = globalThis.document }: ModalDialogsProps = {}) {\n this.document = document\n }\n\n /** Ask a yes / no question: resolves `true` on approve, `false` on deny or Escape. */\n confirm(options: E.ModalOptions): Promise<boolean> {\n return this.run(options, { canDeny: true }, (isApproved) => isApproved)\n }\n\n /** Tell `options.message`: resolves once the dialog has hidden, however it closed. */\n alert(options: E.ModalOptions): Promise<void> {\n return this.run(options, { canDeny: false }, () => undefined)\n }\n\n /** Ask for one line of text: resolves with it on approve, `undefined` on deny or Escape. */\n prompt(options: E.ModalOptions): Promise<string | undefined> {\n return this.run(options, { canDeny: true, input: options.value ?? \"\" }, (isApproved, value) =>\n isApproved ? value : undefined\n )\n }\n\n /**\n * Build, open and await one dialog; `result()` turns \"approved?\" and the input's value into the answer.\n * - SIDE EFFECT: a `<ui-modal>` in `<body>` until it has hidden.\n * - Throws when the parts or `<ui-button>` aren't registered (`tagFor()`).\n */\n private run<T>(options: E.ModalOptions, flags: DialogFlags, result: (isApproved: boolean, value: string) => T) {\n if (options.markdown && E.hasMarkdown(options.message)) {\n return this.markdown(options).then((message) => this.open(options, flags, result, message))\n }\n return this.open(options, flags, result)\n }\n\n /**\n * `run()`, once its message is ready: `message` is the drawn Markdown, else the plain `<p>` is made here.\n * - Plain text opens at once, in the same task as the call: callers and tests find the dialog straight away.\n */\n private open<T>(\n options: E.ModalOptions,\n { canDeny, input }: DialogFlags,\n result: (isApproved: boolean, value: string) => T,\n message?: HTMLElement\n ): Promise<T> {\n const modal = this.document.createElement(modalVocabulary.tag) as HTMLElement & { visible: boolean }\n modal.setAttribute(SIZE, TINY)\n modal.setAttribute(\"closedby\", \"closerequest\")\n if (options.closable !== false) modal.setAttribute(CLOSABLE, \"\")\n if (options.title) modal.setAttribute(UIT.HEADING, options.title)\n else modal.setAttribute(\"aria-label\", options.message)\n const content = this.document.createElement(ModalDialogs.tagFor(UIT.CONTENT))\n const field = input === undefined ? undefined : this.input(input)\n content.append(field ? this.label(options.message, field, message) : (message ?? this.paragraph(options)))\n const actions = this.document.createElement(ModalDialogs.tagFor(ACTIONS))\n if (canDeny) actions.append(this.button(options.cancelText ?? UI.i18n.t(CANCEL), CANCEL))\n const approve = this.button(options.okText ?? UI.i18n.t(OK), APPROVE_CLASS)\n approve.setAttribute(COLOR, options.okColor ?? PRIMARY)\n actions.append(approve)\n modal.append(content, actions)\n field?.addEventListener(\"keydown\", (event) => {\n if (event.key === UIT.Key.enter) approve.click()\n })\n const drawn = message && ModalDialogs.drawn(message)\n this.document.body.append(modal)\n if (drawn) void drawn.then(() => (modal.visible = true))\n else modal.visible = true\n return new Promise<T>((resolve) => {\n let isApproved = false\n modal.addEventListener(APPROVE_EVENT, () => (isApproved = true))\n modal.addEventListener(\n HIDE_EVENT,\n () => {\n modal.remove()\n resolve(result(isApproved, field?.value ?? \"\"))\n },\n { once: true }\n )\n })\n }\n\n /**\n * The message as a paragraph, a `\\n` in it a line break.\n * - `size`: its words in a `<span>` of that text size, so the paragraph's own margins stay the dialog's\n * (`1em` of its 16px), on the 4px grid whatever the size.\n */\n private paragraph({ message, size }: E.ModalOptions): HTMLParagraphElement {\n const paragraph = this.document.createElement(\"p\")\n paragraph.style.whiteSpace = MESSAGE_LINES\n if (size && size !== MEDIUM) {\n const words = this.document.createElement(\"span\")\n words.className = FONT_SIZE_CLASS + size\n words.textContent = message\n paragraph.append(words)\n } else paragraph.textContent = message\n return paragraph\n }\n\n /**\n * The message as a `<ui-markdown sanitized breaks>`, importing its family the first time.\n * - `sanitized`: the message may hold what someone typed, so raw HTML in it goes through DOMPurify\n * (no scripts, event handlers or `javascript:` links).\n * - `breaks`: each `\\n` a line break, as in the plain `<p>`.\n * - Its text is the element's text content, never markup: `<ui-markdown>` reads it as Markdown.\n * - rejects if the family can't be imported\n */\n private async markdown({ message, size }: E.ModalOptions): Promise<HTMLElement> {\n await import(\"spell/ui/components/ui-markdown\")\n const markdown = this.document.createElement(ModalDialogs.tagFor(MARKDOWN))\n markdown.toggleAttribute(SANITIZED, true)\n markdown.toggleAttribute(BREAKS, true)\n if (size && size !== MEDIUM) markdown.setAttribute(SIZE, size)\n // the plain `<p>`'s margins, so the dialog keeps its spacing\n markdown.style.marginBlock = PARAGRAPH_MARGIN\n markdown.textContent = message\n return markdown\n }\n\n /**\n * Resolves once `markdown` has drawn (`ui-drawn`), or after `DRAW_WAIT` seconds whatever happened:\n * a message that can't draw still opens, showing its error.\n */\n private static drawn(markdown: HTMLElement): Promise<void> {\n return new Promise<void>((resolve) => {\n const wait = E.after(DRAW_WAIT, resolve)\n markdown.addEventListener(\n DRAWN_EVENT,\n () => {\n wait.cancel()\n resolve()\n },\n { once: true }\n )\n })\n }\n\n /** `prompt()`'s text input, focused when the dialog opens. */\n private input(value: string): HTMLInputElement {\n const input = this.document.createElement(\"input\")\n input.type = \"text\"\n input.value = value\n input.autofocus = true\n return input\n }\n\n /**\n * The message as the input's `<label>`, in the opt-in native look (`native.css`).\n * - `markdown`: the message drawn as Markdown (`markdown()`), in place of its plain words.\n */\n private label(message: string, input: HTMLInputElement, markdown?: HTMLElement): HTMLLabelElement {\n const label = this.document.createElement(\"label\")\n label.className = NATIVE_LOOK\n label.style.cssText = LABEL_LAYOUT\n let words = markdown\n if (!words) {\n words = this.document.createElement(\"span\")\n words.style.whiteSpace = MESSAGE_LINES\n words.textContent = message\n }\n label.append(words, input)\n return label\n }\n\n /** A `<ui-button>` with Fomantic's action class (`approve` / `cancel`). */\n private button(text: string, actionClass: string): HTMLElement {\n const button = this.document.createElement(ModalDialogs.tagFor(UIT.BUTTON))\n button.className = actionClass\n button.textContent = text\n return button\n }\n\n /**\n * Canonical tag of the registered component whose class noun is `noun` (`button` => `ui-button`).\n * - Throws when none is registered: a dialog built from undefined elements would look right and not work.\n * - Static: it reads only the page-wide vocabulary registry.\n */\n private static tagFor(noun: string): string {\n for (const vocabulary of UI.vocabulary.vocabularies.values()) if (vocabulary.noun === noun) return vocabulary.tag\n throw new Error(\n `UI.modals: no component with the class noun \"${noun}\" is registered; ` +\n `import its family (\\`spell/ui/components/ui-parts\\`, \\`ui-button\\`) before opening a dialog`\n )\n }\n}\n\n/** How `run()` builds a dialog: a deny button or not; `prompt()`'s input and its starting text. */\ntype DialogFlags = { canDeny: boolean; input?: string }\n\n/** Constructor props for `ModalDialogs`. */\nexport type ModalDialogsProps = {\n /** page to build in. Default: the global `document`. */\n document?: Document\n}\n\n/** An approve element was activated: the dialog answers yes. */\nconst APPROVE_EVENT: E.EventName<Vocabulary> = \"ui-approving\"\n\n/** Hidden: the call settles. */\nconst HIDE_EVENT: E.EventName<Vocabulary> = \"ui-closed\"\n\n/** `<ui-modal>` width attribute (canonical name). */\nconst SIZE = \"size\"\n\n/** `<ui-modal>`'s close ✕ attribute (canonical name). */\nconst CLOSABLE = \"closable\"\n\n/** The dialogs' width. */\nconst TINY = \"tiny\"\n\n/** The size word that's the default: no class, no attribute. */\nconst MEDIUM = \"medium\"\n\n/** A plain message's text size: `sizes.css`' utility, `ui-font-size-<size>`. */\nconst FONT_SIZE_CLASS = \"ui-font-size-\"\n\n/** Class noun of `<ui-markdown>`. */\nconst MARKDOWN = \"markdown\"\n\n/** `<ui-markdown>`'s attribute: its markup through DOMPurify. */\nconst SANITIZED = \"sanitized\"\n\n/** `<ui-markdown>`'s attribute: a single newline is a line break. */\nconst BREAKS = \"breaks\"\n\n/** The browser's margin above and below a `<p>`, which a Markdown message keeps too. */\nconst PARAGRAPH_MARGIN = \"1em\"\n\n/** `<ui-markdown>` has drawn its text. */\nconst DRAWN_EVENT = \"ui-drawn\"\n\n/** The longest a Markdown message holds its dialog back while it draws, in seconds. */\nconst DRAW_WAIT = 1\n\n/** Class noun of the actions part (`<ui-actions>`). */\nconst ACTIONS = \"actions\"\n\n/** `<ui-button>` colour of the approve button. */\nconst PRIMARY = \"primary\"\n\n/** `<ui-button>`'s `color`, which `PRIMARY` is a value of (epic `ui-gaps` P4). */\nconst COLOR = \"color\"\n\n/** Fomantic's approve class of a button. */\nconst APPROVE_CLASS = \"approve\"\n\n/** Fomantic's deny class of a button, and the text key of its label. */\nconst CANCEL = \"cancel\"\n\n/** Text key of the approve button's label. */\nconst OK = \"ok\"\n\n/** `native.css`'s opt-in class, for the prompt's input. */\nconst NATIVE_LOOK = \"ui-native\"\n\n/** A message's lines: each `\\n` in it a line break, so a long message reads a sentence or phrase a line. */\nconst MESSAGE_LINES = \"pre-line\"\n\n/** The prompt's label: message above a full-width input. */\nconst LABEL_LAYOUT = \"display: grid; gap: 0.5em\"\n","/**\n * The modal family: defines `<ui-modal>` and exports its component, `UIModal`.\n * - SIDE EFFECTS:\n * - defines `<ui-modal>`, the owner of the `header`, `content`, `description` and `actions` parts,\n * and those parts and `<ui-button>` too (`UI.modals.*` builds its dialogs from them)\n * - registers `ModalDialogs` as `UI.modals`' provider once the runtime has loaded,\n * so `UI.modals.confirm()` / `alert()` / `prompt()` work\n * - Also exports `DialogComponent`, the base `<ui-flyout>` (`spell/ui/components/ui-flyout`) builds on.\n * - Also the library's `spell/ui/ui-modal` entry (its size is in `notes/report.md`).\n */\n\nimport { E, UI } from \"spell/ui/core\"\nimport { DialogComponent } from \"./DialogComponent\"\nimport { UIModal } from \"./UIModal\"\nimport { ModalDialogs } from \"./ModalDialogs\"\n\nimport \"spell/ui/components/ui-parts\"\nimport \"spell/ui/components/ui-button\"\n\nUIModal.define()\nif (E.isBrowser()) void UI.load().then(() => UI.modals.register(new ModalDialogs()))\n\nexport { DialogComponent, UIModal, ModalDialogs }\nexport type { DialogAttributes } from \"./UIModal.types\"\n"],"mappings":";;;;;;;A,2FAAA6D,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAxD,GAAAC,GAAAC,GAAA0D,GA2DsBC,IAAf,MAAe,0BAEZ,IAAA1D,GAER,IAAA,CAACC,CAAE,GAuFH,IAAA,CAACC,CAAE,GAyCH,IAAA,CAACC,EAAE,GA0DH,IAAA,CAACC,EAAK,SAAS,CAAA,GAuBf,IAAA,CAACF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AChG,IAAMtD,IAAQ,KAAK,SAAS,cAAc,OAAO;EAEjD,AADA,EAAM,YAAYmF,IAClB,EAAM,MAAM,UAAUC;EACtB,IAAIZ,IAAQE;EAOZ,OANKF,MACH,IAAQ,KAAK,SAAS,cAAc,MAAM,GAC1C,EAAM,MAAM,aAAaH,GACzB,EAAM,cAActB,IAEtB/C,EAAM,OAAOwE,GAAOlB,CAAK,GAClBtD;CACT;CAGA,OAAe,GAAc,GAAkC;EAC7D,IAAMqF,IAAS,KAAK,SAAS,cAAc,aAAa,OAAO7J,EAAU,CAAC;EAG1E,OAFA,EAAO,YAAY8J,GACnB,EAAO,cAAcC,GACdF;CACT;CAOA,OAAe,OAAO,GAAsB;EAC1C,KAAK,IAAMG,KAAcpG,EAAG,WAAW,aAAa,OAAO,GAAG,IAAIoG,EAAW,SAASC,GAAM,OAAOD,EAAW;EAC9G,MAAU,MACR,iDAAiDC,EAAK,8GAExD;CACF;AACF,GAYMxB,KAAyC,gBAGzCC,KAAsC,aAGtCjB,KAAO,QAGPE,KAAW,YAGXD,KAAO,QAGPqB,KAAS,UAGTE,KAAkB,iBAGlBE,KAAW,YAGXC,KAAY,aAGZC,KAAS,UAGTC,KAAmB,OAGnBI,KAAc,YAGdD,KAAY,GAGZzB,KAAU,WAGVO,KAAU,WAGVD,KAAQ,SAGRD,KAAgB,WAGhBH,KAAS,UAGTE,KAAK,MAGLuB,KAAc,aAGdd,IAAgB,YAGhBe,KAAe;AC/QrB9C,EAAQ,OAAO,GACX7G,GAAY,KAAG2D,EAAQ,KAAK,CAAC,CAAC,WAAWA,EAAG,OAAO,SAAS,IAAImD,GAAa,CAAC,CAAC"}
|
|
@@ -471,7 +471,7 @@ var we = class PropertyEditorPages {
|
|
|
471
471
|
"../components/ui-menu/ui-menu.editor.html": () => import("./ui-menu.editor-DJ3PhWtK.js").then((e) => e.default),
|
|
472
472
|
"../components/ui-menu/ui-submenu.editor.html": () => import("./ui-submenu.editor-NdjS0em-.js").then((e) => e.default),
|
|
473
473
|
"../components/ui-message/ui-message.editor.html": () => import("./ui-message.editor-vfT0pyu5.js").then((e) => e.default),
|
|
474
|
-
"../components/ui-modal/ui-modal.editor.html": () => import("./ui-modal.editor-
|
|
474
|
+
"../components/ui-modal/ui-modal.editor.html": () => import("./ui-modal.editor-B6gmmGsR.js").then((e) => e.default),
|
|
475
475
|
"../components/ui-nag/ui-nag.editor.html": () => import("./ui-nag.editor-BJ3Ia2Bi.js").then((e) => e.default),
|
|
476
476
|
"../components/ui-page/ui-page.editor.html": () => import("./ui-page.editor-Bd5mzlj7.js").then((e) => e.default),
|
|
477
477
|
"../components/ui-page-layout/ui-page-layout.editor.html": () => import("./ui-page-layout.editor-xtQW0FZk.js").then((e) => e.default),
|