spell-ui 0.8.12 → 0.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README-components.md +5 -3
  2. package/dist/{Dragging-B93hbRxF.js → Dragging-tHPSvf3G.js} +56 -13
  3. package/dist/Dragging-tHPSvf3G.js.map +1 -0
  4. package/dist/_spell-element/DOMElement.d.ts +8 -1
  5. package/dist/_spell-element/drawnWindow.d.ts +62 -0
  6. package/dist/_util/Dragging.d.ts +7 -0
  7. package/dist/components/components.types.d.ts +2 -0
  8. package/dist/components/ui-diagram/UIDiagram.d.ts +3 -0
  9. package/dist/components/ui-graph/GraphLayout.d.ts +54 -0
  10. package/dist/components/ui-graph/UIGraph.d.ts +355 -0
  11. package/dist/components/ui-graph/UIGraph.en.d.ts +137 -0
  12. package/dist/components/ui-graph/UIGraph.es.d.ts +48 -0
  13. package/dist/components/ui-graph/UIGraph.types.d.ts +193 -0
  14. package/dist/components/ui-graph/index.d.ts +5 -0
  15. package/dist/components/ui-json/UIJson.d.ts +275 -10
  16. package/dist/components/ui-json/UIJson.en.d.ts +148 -9
  17. package/dist/components/ui-json/UIJson.es.d.ts +34 -3
  18. package/dist/components/ui-json/index.d.ts +2 -2
  19. package/dist/components/ui-split-panel/UISplitPanel.d.ts +2 -16
  20. package/dist/components/ui-tree/UITree.d.ts +758 -26
  21. package/dist/components/ui-tree/UITree.en.d.ts +113 -3
  22. package/dist/components/ui-tree/UITree.es.d.ts +24 -0
  23. package/dist/components/ui-tree/UITree.types.d.ts +34 -0
  24. package/dist/components/ui-tree/UITreeItem.d.ts +40 -1
  25. package/dist/components/ui-tree/UITreeItem.en.d.ts +9 -0
  26. package/dist/components/ui-tree/UITreeItem.es.d.ts +2 -0
  27. package/dist/components/ui-tree/index.d.ts +3 -2
  28. package/dist/components/ui-tree-diagram/UITreeDiagram.d.ts +3 -0
  29. package/dist/{components.es-DEa8Ep42.js → components.es-DilRG1VO.js} +117 -9
  30. package/dist/components.es-DilRG1VO.js.map +1 -0
  31. package/dist/core.js +713 -671
  32. package/dist/core.js.map +1 -1
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.js +97 -96
  35. package/dist/jsx.d.ts +489 -20
  36. package/dist/ui-diagram.js +2 -2
  37. package/dist/ui-diagram.js.map +1 -1
  38. package/dist/ui-graph.editor-DLsXPyby.js +5 -0
  39. package/dist/ui-graph.editor-DLsXPyby.js.map +1 -0
  40. package/dist/ui-graph.js +1295 -0
  41. package/dist/ui-graph.js.map +1 -0
  42. package/dist/ui-json.editor-BS-v1bqO.js +5 -0
  43. package/dist/ui-json.editor-BS-v1bqO.js.map +1 -0
  44. package/dist/ui-json.js +629 -32
  45. package/dist/ui-json.js.map +1 -1
  46. package/dist/ui-property-editor.js +3 -2
  47. package/dist/ui-property-editor.js.map +1 -1
  48. package/dist/ui-root.js +34 -3
  49. package/dist/ui-root.js.map +1 -1
  50. package/dist/ui-site-nav.js +4 -4
  51. package/dist/ui-site-nav.js.map +1 -1
  52. package/dist/ui-split-panel.js +31 -61
  53. package/dist/ui-split-panel.js.map +1 -1
  54. package/dist/ui-tree-diagram.js +1 -1
  55. package/dist/ui-tree-diagram.js.map +1 -1
  56. package/dist/ui-tree.editor-Bqsa0dYQ.js +5 -0
  57. package/dist/ui-tree.editor-Bqsa0dYQ.js.map +1 -0
  58. package/dist/ui-tree.js +1734 -237
  59. package/dist/ui-tree.js.map +1 -1
  60. package/dist/util/PaneSizes.d.ts +42 -0
  61. package/dist/util/index.d.ts +2 -0
  62. package/package.json +1 -1
  63. package/dist/Dragging-B93hbRxF.js.map +0 -1
  64. package/dist/components.es-DEa8Ep42.js.map +0 -1
  65. package/dist/ui-json.editor-BgZbrB_W.js +0 -5
  66. package/dist/ui-json.editor-BgZbrB_W.js.map +0 -1
  67. package/dist/ui-tree.editor-BoQztwdz.js +0 -5
  68. package/dist/ui-tree.editor-BoQztwdz.js.map +0 -1
@@ -194,10 +194,10 @@ var O = {
194
194
  }
195
195
  onSelecting(e) {
196
196
  e.preventDefault();
197
- let t = this.pageForKey(e.detail.item.getAttribute(q));
198
- if (!t?.href) return;
199
- let { originalEvent: n } = e.detail;
200
- h.isOpenElsewhere(n) || (n?.preventDefault(), this.goTo(t, n));
197
+ let t = e.detail.item, n = this.pageForKey(t.getAttribute(q));
198
+ if (!n?.href) return;
199
+ let { originalEvent: r } = e.detail;
200
+ h.isOpenElsewhere(r) || (r?.preventDefault(), this.goTo(n, r));
201
201
  }
202
202
  goTo(e, t) {
203
203
  let { href: n } = e;
@@ -1 +1 @@
1
- {"version":3,"file":"ui-site-nav.js","names":["ref={(element) => this.box = element}","this","<For each={this.sitePages} keyed={_UISiteNav.keyOf}>\n {(page) => this.row(page, () => this.sitePages)}\n </For>","aria-label={this.label ?? this.translationForKey(\"label\")}","part={this.partForName(\"tree\")}","appearance={this.appearance}","label={this.label ?? this.translationForKey(\"label\")}","<nav\n part={this.partForName(\"nav\")}\n aria-label={this.label ?? this.translationForKey(\"label\")}\n ref={(element) => this.box = element}\n >\n <ui-tree\n part={this.partForName(\"tree\")}\n appearance={this.appearance}\n label={this.label ?? this.translationForKey(\"label\")}\n on-ui-selecting={(event) => this.onSelecting(event)}\n on-ui-opening={(event) => this.onOpening(event, true)}\n on-ui-closing={(event) => this.onOpening(event, false)}\n >\n <For each={this.sitePages} keyed={_UISiteNav.keyOf}>\n {(page) => this.row(page, () => this.sitePages)}\n </For>\n </ui-tree>\n </nav>","<Show when={showsLetter()}>\n <span slot=\"icon\" class=\"letter\" aria-hidden=\"true\">\n {LETTER_OR_DIGIT.exec(page().title)?.[0].toLocaleUpperCase()}\n </span>\n </Show>","<span slot=\"icon\" class=\"letter\" aria-hidden=\"true\">\n {LETTER_OR_DIGIT.exec(page().title)?.[0].toLocaleUpperCase()}\n </span>","<ui-tree-item\n data-page={_UISiteNav.keyOf(page())}\n data-current={this.isCurrent(page()) ? \"\" : void 0}\n label={page().title}\n value={page().href ?? _UISiteNav.keyOf(page())}\n icon={page().icon}\n band={page().band}\n count={page().count === void 0 ? void 0 : String(page().count)}\n badge={page().badge}\n group={page().href ? void 0 : \"\"}\n expandable={page().slot ? \"\" : void 0}\n selected={isMarked() ? \"\" : void 0}\n open={(page().pages?.length || page().slot) && this.isOpen(page()) ? \"\" : void 0}\n aria-current={isMarked() ? \"page\" : void 0}\n title={this.collapsed ? page().title : void 0}\n >\n <Show when={showsLetter()}>\n <span slot=\"icon\" class=\"letter\" aria-hidden=\"true\">\n {LETTER_OR_DIGIT.exec(page().title)?.[0].toLocaleUpperCase()}\n </span>\n </Show>\n <Show when={page().href}>\n {(href) => <a slot=\"label\" class=\"link\" href={href()} tabindex=\"-1\">\n {page().title}\n </a>}\n </Show>\n <Show when={page().starred !== void 0}>{this.star(page)}</Show>\n <Show when={page().pages?.length}>\n <For each={page().pages} keyed={_UISiteNav.keyOf}>\n {(below) => this.row(below, () => page().pages ?? [])}\n </For>\n </Show>\n <Show when={page().slot}>{(name) => <slot name={name()} />}</Show>\n </ui-tree-item>","<Show when={page().href}>\n {(href) => <a slot=\"label\" class=\"link\" href={href()} tabindex=\"-1\">\n {page().title}\n </a>}\n </Show>","<Show when={page().starred !== void 0}>{this.star(page)}</Show>","<Show when={page().pages?.length}>\n <For each={page().pages} keyed={_UISiteNav.keyOf}>\n {(below) => this.row(below, () => page().pages ?? [])}\n </For>\n </Show>","<For each={page().pages} keyed={_UISiteNav.keyOf}>\n {(below) => this.row(below, () => page().pages ?? [])}\n </For>","<Show when={page().slot}>{(name) => <slot name={name()} />}</Show>","data-current={this.isCurrent(page()) ? \"\" : void 0}","label={page().title}","value={page().href ?? _UISiteNav.keyOf(page())}","icon={page().icon}","band={page().band}","count={page().count === void 0 ? void 0 : String(page().count)}","badge={page().badge}","group={page().href ? void 0 : \"\"}","expandable={page().slot ? \"\" : void 0}","selected={isMarked() ? \"\" : void 0}","open={(page().pages?.length || page().slot) && this.isOpen(page()) ? \"\" : void 0}","aria-current={isMarked() ? \"page\" : void 0}","title={this.collapsed ? page().title : void 0}","selected={page().starred ? \"\" : void 0}","icon={page().starred ? STAR : STAR_OUTLINE}","aria-label={label()}","title={label()}","<ui-button\n slot=\"actions\"\n class=\"star\"\n data-star={_UISiteNav.keyOf(page())}\n toggle=\"\"\n selected={page().starred ? \"\" : void 0}\n icon={page().starred ? STAR : STAR_OUTLINE}\n size=\"mini\"\n appearance=\"tertiary\"\n aria-label={label()}\n title={label()}\n onClick={(event) => this.onStar(page(), event)}\n />","E.DOMElement","E.UIComponent","E.proto","E.protoMerged","E.derived","E.state","_$getOwner","_$setAttribute","__name","siteNavCSS","__decoratorStart","__publicField","__name$1","__decorateElement","__decoratorMetadata","__runInitializers","__privateAdd","PrefStore","SitePages","getOwner$1","siteNavVocabulary","UISiteNav_default","_tmpl$","_tmpl$2","_tmpl$3","_tmpl$4","_tmpl$5","_tmpl$6","_openedByPerson_dec","_currentPath_dec","_sitePages_dec","_elementSetup_dec","_vocabulary_dec","_a","_init","_openedByPerson","DOMElement","_UISiteNav","UIComponent","proto","protoMerged","derived","state","isServer","page","path","walk","pages","above","key","GROUP","kept","entries","entry","PREF_STORE","event","DATA_KEY","isOpening","originalEvent","detail","next","preferenceKey","href","first","group","DATA_CURRENT","item","scrollIntoSight","find","found","_self$","_el$","_el$2","ref","element","setAttribute","insert","createComponent","For","effect","_p$","t","a","o","i","isMarked","showsLetter","icon","besideIcons","siblings","each","band","_self$2","_el$3","_el$5","_el$6","_el$7","_el$8","_el$9","Show","_el$4","LETTER_OR_DIGIT","_el$10","_o$","_v$","claimElement","below","_el$11","name","n","h","r","d","l","u","c","w","label","_self$3","_el$12","STAR","STAR_OUTLINE","UISiteNav","delegateEvents"],"sources":["../src/components/ui-site-nav/UISiteNav.en.ts","../src/components/ui-site-nav/UISiteNav.tsx","../src/components/ui-site-nav/index.ts"],"sourcesContent":["/**\n * The English vocabulary of `<ui-site-nav>`: every name the tag uses.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/****************\n * ### `siteNavVocabulary`\n * The names of `<ui-site-nav>`: a site's side navigation, its pages as a tree, the page shown marked.\n ****************/\nexport const siteNavVocabulary = {\n tag: \"ui-site-nav\",\n icon: \"compass outline\",\n topics: [\"navigation\", \"lists\"],\n aka: [\"site navigation\", \"side navigation\", \"sidebar menu\", \"nav menu\", \"site map\", \"page tree\"],\n noun: \"site nav\",\n partOfSpeech: \"structure\",\n description: \"A site nav lists a site's pages as a tree, the page shown marked; a click goes to a page.\",\n skeleton: \"4 line paragraph\",\n attributes: [\n {\n name: \"pages\",\n group: \"content\",\n kind: \"json\",\n reflect: false,\n description:\n \"The site's pages, nested as the navigation nests them: `SiteNavPage[]`, each \" +\n '`{ title, href, id?, pages? }`, e.g. `[{ \"title\": \"Films\", \"href\": \"/films\" }]`. ' +\n \"A page with no `href` only holds pages: a click opens or closes it. \" +\n \"Each may also say `icon`, `band` (`heading` or `subheading`: a heading band over its pages; `group`: a \" +\n \"group's quiet label over them, with no arrow, open while the page shown is under it, a click going to its first \" +\n \"page; its `icon` before its label, its pages a step in), `count`, \" +\n \"`badge` (a word after its title), `starred` (`true` or `false`: a star to mark it a favourite), `open` \" +\n \"(open or closed, whatever the person did: the page decides), `slot` (the name of a slot of this element \" +\n \"whose content shows inside it, after its pages) and `copyOf` (the `id` of the page it's a second copy of: \" +\n \"marked as shown whenever that page is).\"\n },\n {\n name: \"current\",\n group: \"content\",\n kind: \"string\",\n description:\n \"Which page is shown: its `href` or its `id`. None: the page whose `href` is the browser's address.\"\n },\n {\n name: \"label\",\n group: \"content\",\n kind: \"string\",\n description: 'What a screen reader calls the navigation. None: \"Site\".'\n },\n {\n name: \"appearance\",\n group: \"appearance\",\n kind: \"valueOnly\",\n values: [\"nav\"],\n description:\n '`nav`: the docs site\\'s look, its pages a tree with `appearance=\"nav\"`: taller rows, the page shown a ' +\n \"rounded box in the primary colour, and `band` pages as heading bands.\"\n },\n {\n name: \"collapsed\",\n group: \"appearance\",\n kind: \"keyOnly\",\n description:\n \"Only the icons, in one column: each row's title its tooltip, a page with no icon its title's first letter, \" +\n \"and a group with no icon a thin line. None: the titles beside the icons.\"\n },\n {\n name: \"remember\",\n group: \"behaviour\",\n kind: \"string\",\n description:\n \"Keep which pages are open for each person, under this name, across reloads and visits. \" +\n \"None: only for as long as the page is open.\"\n }\n ],\n events: [\n {\n name: \"ui-navigating\",\n cancelable: true,\n detail: \"{ href: string, page: { title: string, href?: string, id?: string }, originalEvent?: Event }\",\n description:\n \"A page was picked, and the browser is about to go there: cancel it to show the page yourself \" +\n \"(a site that shows its pages without loading another).\"\n },\n {\n name: \"ui-opening\",\n cancelable: true,\n detail: \"{ page: { title: string, href?: string, id?: string }, open: boolean, originalEvent?: Event }\",\n description: \"A page's row is about to open: cancel it to keep it closed.\"\n },\n {\n name: \"ui-closing\",\n cancelable: true,\n detail: \"{ page: { title: string, href?: string, id?: string }, open: boolean, originalEvent?: Event }\",\n description: \"A page's row is about to close: cancel it to keep it open.\"\n },\n {\n name: \"ui-starred\",\n detail: \"{ page: { title: string, href?: string, id?: string }, starred: boolean, originalEvent?: Event }\",\n description:\n \"A page's star was clicked: `starred` is what the person asked for. The page decides, and hands the \" +\n \"nav its pages again with the new `starred`.\"\n }\n ],\n slots: [],\n parts: [\n { name: \"nav\", description: \"The navigation landmark around the tree.\" },\n { name: \"tree\", description: \"The `<ui-tree>` of pages.\" }\n ],\n states: [{ name: \"collapsed\", description: \"`collapsed`: only the icons.\" }],\n texts: [\n { key: \"label\", text: \"Site\", description: \"What a screen reader calls the navigation, without `label`.\" },\n { key: \"star\", text: \"Add {title} to favourites\", description: \"A page's star, not starred.\" },\n { key: \"unstar\", text: \"Remove {title} from favourites\", description: \"A page's star, starred.\" }\n ]\n} as const satisfies E.ComponentVocabulary\n","import { For, Show } from \"solid-js\"\nimport { isServer, type JSX } from \"@solidjs/web\"\n\nimport { E } from \"spell/ui/core\"\n// Import directly: in `core`'s util barrel it cost every page 1.9 kB (as `NavPreferences` says)\nimport { PrefStore } from \"spell/util/persist/PrefStore\"\nimport { SitePages } from \"./SitePages\"\nimport { siteNavVocabulary } from \"./UISiteNav.en\"\n\nimport siteNavCSS from \"./UISiteNav.css?inline\"\n\n/****************\n * ### `DOMSiteNavElement`\n * The DOM element of `<ui-site-nav>`: its script API, `revealCurrent()`.\n * Its component (`UISiteNav`) carries it out.\n ****************/\nexport class DOMSiteNavElement extends E.DOMElement<UISiteNav> {\n /** Scroll the page shown's row into sight, in whatever scrolls the nav (never the page itself). */\n revealCurrent() {\n this.component?.revealCurrent()\n }\n}\n\n/****************\n * ### `UISiteNav`\n * The component behind `<ui-site-nav>`: a site's side navigation (epic `mockup` P3).\n * Its pages, from `pages`, are a `<ui-tree>`, nested as the site nests them; the page shown is selected.\n *\n * <nav part=\"nav\" aria-label=\"Site\">\n * <ui-tree part=\"tree\">\n * <ui-tree-item label=\"Films\" value=\"/films\" selected> (a page)\n * <ui-tree-item label=\"Film\" value=\"/films/1\"/> (a page under it)\n * </ui-tree-item>\n * <ui-tree-item label=\"Help\" group>...</ui-tree-item> (no `href`: it only holds pages)\n * </ui-tree>\n * </nav>\n *\n * - Picking a page (a click, Enter or Space on its row) goes there: `ui-navigating`, cancelable, then the browser's\n * address.\n * A site that shows its pages without loading another (a Spell site in Run) cancels it and shows the page itself.\n * - The tree's own selecting is always cancelled: what's selected is `current`, which the page sets.\n * - Which pages are open: the ones the person opened, and every page the shown one is under.\n * - With `remember`, kept for each person across visits (`PrefStore`, `ui-site-nav:<remember>`);\n * without it, for as long as the page is open.\n * - The tree's keys walk it: up and down, right opens, left closes (`<ui-tree>`'s).\n * - Plain data in, no fetching: whatever draws the site hands it its pages, a Spell site's from its site file\n * (`static pages`), a docs site's from its own data.\n * - Its rows are `<ui-tree-item>`s in its shadow DOM, so the tree's look and keys are the same as anywhere.\n * - `appearance=\"nav\"`: the docs site's look (the tree's `appearance=\"nav\"`), and a page's `band`, `count` and\n * `badge` with it (epic `mockup` P5: `<ui-docs-nav>` draws its list with it).\n * - A page with an `href` is a real link (its title an `<a>`): a middle click or Command-click opens it in a new tab,\n * as a link does; a plain click is the tree's pick.\n * - A page with `starred` gets a star at its row's end: a click sends `ui-starred`, and selects nothing.\n * - A page's `open`, when it says one, wins: the page that hands the nav its pages decides (a search opens what\n * matches); the nav's `ui-opening` / `ui-closing` tell it what the person did.\n * - A page's rows are kept by its key across new `pages`, so a row keeps its focus, and its rows ease open and shut.\n * - A page with `slot` shows what the page puts in `<ui-site-nav>`'s slot of that name inside it, after its pages,\n * and can open though it has none yet (a \"Loading...\" under a band).\n * - A page with `copyOf` is a second copy of another (a favourite): marked as shown whenever that page is;\n * `revealCurrent()` still goes to the original.\n * - A page with `band=\"group\"` is a quiet label over its pages, with no arrow (epic `mockup` T34): a Spell site's\n * groups.\n * - It opens by itself while the page shown is under it, and stays open: more than one can be open at once.\n * - A click (or Enter) on it opens it and goes to its first page; on one that's open, and doesn't hold the page shown,\n * it closes it.\n * - A page with no `icon`, beside pages with one, keeps an icon's room, so its title lines up with theirs.\n * - A group's `icon` shows before its label, and its pages are a step in from it (epic `mockup` I20).\n * - Beside a bar (`--ui-site-nav-bar-height`, which `<ui-page-layout>` sets to its menu's height): its first row's\n * middle on the bar's, so the first page's icon lines up with the drawer's button (epic `mockup` I35).\n * - `collapsed`: only the icons, each row's title its tooltip (`:state(collapsed)`), all in one column, no step in;\n * a page with no icon shows its title's first letter, as `<ui-menu>`'s icons-only look does,\n * and a group with no icon is a thin line.\n ****************/\nexport class UISiteNav extends E.UIComponent<typeof siteNavVocabulary> {\n @E.proto static vocabulary = siteNavVocabulary\n @E.protoMerged static elementSetup: Partial<E.ElementSetup> = {\n styleSheets: { \"site-nav\": siteNavCSS },\n DOMElement: DOMSiteNavElement,\n delegatesFocus: false,\n cssStates: [\"collapsed\"]\n }\n\n ////////////////\n // ## Pages\n ////////////////\n\n /** `pages`, the well-formed ones: each with a `title`, and its pages checked the same way. */\n @E.derived\n get sitePages(): readonly SiteNavPage[] {\n return SitePages.wellFormed(this.pages)\n }\n\n /** Which page is shown, as `current` says it, else the browser's address. */\n get currentKey(): string {\n return this.current ?? (isServer ? \"\" : location.pathname)\n }\n\n /** Is `page` the one shown: its `id`, its `href`, or its `href`'s path is `currentKey`? */\n isCurrent(page: SiteNavPage): boolean {\n return SitePages.isShown(page, this.currentKey)\n }\n\n /** Is `page` marked as the one shown: it is, or it's a copy (`copyOf`) of the one that is? */\n isMarked(page: SiteNavPage): boolean {\n return this.isCurrent(page) || (!!page.copyOf && page.copyOf === this.currentKey)\n }\n\n /** The keys of every page the shown one is under: they start open. */\n @E.derived\n get currentPath(): ReadonlySet<string> {\n const path = new Set<string>()\n const walk = (pages: readonly SiteNavPage[], above: readonly string[]): boolean =>\n pages.some((page) => {\n if (!this.isCurrent(page)) return walk(page.pages ?? [], [...above, UISiteNav.keyOf(page)])\n for (const key of above) path.add(key)\n return true\n })\n walk(this.sitePages, [])\n return path\n }\n\n ////////////////\n // ## Open pages\n ////////////////\n\n /** Pages the person opened (`true`) or closed (`false`), by key: over `currentPath`'s. */\n @E.state accessor openedByPerson: ReadonlyMap<string, boolean> = new Map()\n\n /**\n * Is `page` open: as its `open` says, else as the person left it, else open when the shown page is under it.\n * - A group (`band=\"group\"`) is always open while the shown page is under it: it opens by itself.\n */\n isOpen(page: SiteNavPage): boolean {\n if (page.open !== undefined) return page.open\n const key = UISiteNav.keyOf(page)\n if (page.band === GROUP && this.currentPath.has(key)) return true\n return this.openedByPerson.get(key) ?? this.currentPath.has(key)\n }\n\n /** It connected: the pages this person left open, when it `remember`s. */\n onConnect() {\n super.onConnect()\n const key = this.preferenceKey\n if (!key) return\n const kept = PrefStore.getAt(key)\n if (kept && typeof kept === \"object\" && !Array.isArray(kept)) {\n const entries = Object.entries(kept).filter((entry): entry is [string, boolean] => typeof entry[1] === \"boolean\")\n this.openedByPerson = new Map(entries)\n }\n }\n\n /** Where it keeps the open pages: `ui-site-nav:<remember>`, or nowhere. */\n private get preferenceKey(): string | undefined {\n return this.remember ? `${PREF_STORE}:${this.remember}` : undefined\n }\n\n /**\n * A row is opening or closing: the nav's own `ui-opening` / `ui-closing` say which page (the row's are kept in), and\n * cancelling it keeps the row as it was; else remembered, and kept so.\n */\n private onOpening(event: CustomEvent<{ open: boolean; originalEvent?: Event }>, isOpening: boolean) {\n event.stopPropagation()\n const key = (event.target as HTMLElement).getAttribute(DATA_KEY)\n const page = this.pageForKey(key)\n if (key === null || !page) return\n const { originalEvent } = event.detail\n // a group holding the page shown stays open: a click on it goes to its first page instead\n if (page.band === GROUP && !isOpening && this.currentPath.has(key)) {\n event.preventDefault()\n if (UISiteNav.isPick(originalEvent)) this.goToFirstPage(page, originalEvent)\n return\n }\n const detail = { page, open: isOpening, originalEvent }\n if (!this.send(isOpening ? \"ui-opening\" : \"ui-closing\", detail)) {\n event.preventDefault()\n return\n }\n const next = new Map(this.openedByPerson).set(key, isOpening)\n this.openedByPerson = next\n const preferenceKey = this.preferenceKey\n if (preferenceKey) PrefStore.setAt(preferenceKey, Object.fromEntries(next))\n if (page.band === GROUP && isOpening && UISiteNav.isPick(originalEvent)) this.goToFirstPage(page, originalEvent)\n }\n\n /**\n * Was `originalEvent` a pick: a click, Enter or Space, not the tree's arrow keys walking it?\n * - A group opened by the arrow keys only opens: the keys walk the tree without leaving the page.\n */\n private static isPick(originalEvent: Event | undefined): boolean {\n return !(originalEvent instanceof KeyboardEvent && originalEvent.key.startsWith(\"Arrow\"))\n }\n\n ////////////////\n // ## Going to a page\n ////////////////\n\n /**\n * A row was picked: the tree's own selecting is cancelled (`current` says what's selected), and a page with an\n * `href` is gone to, unless `ui-navigating` is cancelled.\n */\n private onSelecting(event: CustomEvent<{ item: HTMLElement; originalEvent?: Event }>) {\n event.preventDefault()\n const page = this.pageForKey(event.detail.item.getAttribute(DATA_KEY))\n if (!page?.href) return\n const { originalEvent } = event.detail\n // a middle or modified click on its link: the browser opens it, as with any link\n if (SitePages.isOpenElsewhere(originalEvent)) return\n originalEvent?.preventDefault()\n this.goTo(page as SiteNavPage & { href: string }, originalEvent)\n }\n\n /** Go to `page`: `ui-navigating`, then the browser's address, unless it's cancelled. */\n private goTo(page: SiteNavPage & { href: string }, originalEvent: Event | undefined) {\n const { href } = page\n if (!this.send(\"ui-navigating\", { href, page, originalEvent })) return\n location.assign(href)\n }\n\n /** Go to the first page under `group` that has an `href`, at any depth; none, nothing. */\n private goToFirstPage(group: SiteNavPage, originalEvent: Event | undefined) {\n const first = SitePages.allOf(group.pages ?? []).find((page): page is SiteNavPage & { href: string } => !!page.href)\n if (first) this.goTo(first, originalEvent)\n }\n\n /** A page's star was clicked: `ui-starred`, saying what the person asked for; nothing is selected. */\n private onStar(page: SiteNavPage, event: MouseEvent) {\n event.stopPropagation()\n this.send(\"ui-starred\", { page, starred: !page.starred, originalEvent: event })\n }\n\n /** The page shown's row, while drawn. */\n get currentItem(): HTMLElement | undefined {\n return this.box?.querySelector<HTMLElement>(`[${DATA_CURRENT}]`) ?? undefined\n }\n\n /** Scroll the page shown's row into sight. Script API. */\n revealCurrent() {\n const item = this.currentItem\n if (item) E.scrollIntoSight(item)\n }\n\n /** The navigation box, while drawn. */\n private box: HTMLElement | undefined\n\n /** The page whose key is `key`, anywhere in the tree. */\n private pageForKey(key: string | null): SiteNavPage | undefined {\n if (key === null) return undefined\n const find = (pages: readonly SiteNavPage[]): SiteNavPage | undefined => {\n for (const page of pages) {\n if (UISiteNav.keyOf(page) === key) return page\n const found = find(page.pages ?? [])\n if (found) return found\n }\n return undefined\n }\n return find(this.sitePages)\n }\n\n ////////////////\n // ## Rendering\n ////////////////\n\n render(): JSX.Element {\n return (\n <nav\n part={this.partForName(\"nav\")}\n aria-label={this.label ?? this.translationForKey(\"label\")}\n ref={(element: HTMLElement) => (this.box = element)}\n >\n <ui-tree\n part={this.partForName(\"tree\")}\n appearance={this.appearance}\n label={this.label ?? this.translationForKey(\"label\")}\n on-ui-selecting={(event: CustomEvent<{ item: HTMLElement }>) => this.onSelecting(event)}\n on-ui-opening={(event: CustomEvent<{ open: boolean }>) => this.onOpening(event, true)}\n on-ui-closing={(event: CustomEvent<{ open: boolean }>) => this.onOpening(event, false)}\n >\n <For each={this.sitePages} keyed={UISiteNav.keyOf}>\n {(page) => this.row(page, () => this.sitePages)}\n </For>\n </ui-tree>\n </nav>\n )\n }\n\n /** One page's row, and its pages' rows inside it; `siblings`, the pages beside it, itself among them. */\n private row(page: () => SiteNavPage, siblings: () => readonly SiteNavPage[]): JSX.Element {\n const isMarked = () => this.isMarked(page())\n /**\n * It has no icon, but a page beside it has: an icon's room, or (`collapsed`) its first letter, stands in.\n * - A group with no icon keeps the room beside groups with one, so the labels line up;\n * `collapsed`, it's a thin line instead (epic `mockup` I20).\n */\n const showsLetter = () => {\n const { icon, band } = page()\n if (icon) return false\n const besideIcons = siblings().some((each) => !!each.icon)\n if (band === GROUP) return !this.collapsed && besideIcons\n return !band && (this.collapsed || besideIcons)\n }\n return (\n <ui-tree-item\n data-page={UISiteNav.keyOf(page())}\n data-current={this.isCurrent(page()) ? \"\" : undefined}\n label={page().title}\n value={page().href ?? UISiteNav.keyOf(page())}\n icon={page().icon}\n band={page().band}\n count={page().count === undefined ? undefined : String(page().count)}\n badge={page().badge}\n group={page().href ? undefined : \"\"}\n expandable={page().slot ? \"\" : undefined}\n selected={isMarked() ? \"\" : undefined}\n open={(page().pages?.length || page().slot) && this.isOpen(page()) ? \"\" : undefined}\n aria-current={isMarked() ? \"page\" : undefined}\n title={this.collapsed ? page().title : undefined}\n >\n <Show when={showsLetter()}>\n <span slot=\"icon\" class=\"letter\" aria-hidden=\"true\">\n {LETTER_OR_DIGIT.exec(page().title)?.[0].toLocaleUpperCase()}\n </span>\n </Show>\n <Show when={page().href}>\n {(href) => (\n <a slot=\"label\" class=\"link\" href={href()} tabindex=\"-1\">\n {page().title}\n </a>\n )}\n </Show>\n <Show when={page().starred !== undefined}>{this.star(page)}</Show>\n <Show when={page().pages?.length}>\n <For each={page().pages} keyed={UISiteNav.keyOf}>\n {(below) => this.row(below, () => page().pages ?? [])}\n </For>\n </Show>\n <Show when={page().slot}>{(name) => <slot name={name()} />}</Show>\n </ui-tree-item>\n )\n }\n\n /** A page's star, at its row's end: a toggle, pressed while it's starred. */\n private star(page: () => SiteNavPage): JSX.Element {\n const label = () => this.translationForKey(page().starred ? \"unstar\" : \"star\", { title: page().title })\n return (\n <ui-button\n slot=\"actions\"\n class=\"star\"\n data-star={UISiteNav.keyOf(page())}\n toggle=\"\"\n selected={page().starred ? \"\" : undefined}\n icon={page().starred ? STAR : STAR_OUTLINE}\n size=\"mini\"\n appearance=\"tertiary\"\n aria-label={label()}\n title={label()}\n onClick={(event: MouseEvent) => this.onStar(page(), event)}\n />\n )\n }\n\n ////////////////\n // ## Helpers\n ////////////////\n\n /** What `page` is known by, to open, find and remember it (`SitePages.keyOf()`). */\n static keyOf(page: SiteNavPage): string {\n return SitePages.keyOf(page)\n }\n}\n\n/** The vocabulary getters, typed (`UIComponent`'s doc). */\nexport interface UISiteNav extends E.AttributeValues<typeof siteNavVocabulary> {}\n\n/** One page of a site, as `<ui-site-nav pages>` takes it. */\nexport type SiteNavPage = {\n /** what the navigation calls it: `Films` */\n title: string\n /** where it is: `/films`; none, a page that only holds pages */\n href?: string\n /** what `current` may call it, when its `href` isn't enough: `film-page` */\n id?: string\n /** an icon before its title */\n icon?: string\n /** the pages under it */\n pages?: readonly SiteNavPage[]\n /**\n * a band over its pages, with `appearance=\"nav\"`:\n * - `heading`: a tinted heading band, with an arrow\n * - `subheading`: a lighter one inside one\n * - `group`: a group's quiet label, no arrow, open while the page shown is under it; a click goes to its first page\n */\n band?: \"heading\" | \"subheading\" | \"group\"\n /** a number in a small round label after its title: how many pages it holds */\n count?: number | string\n /** a word in a small label after its title: `Planned` */\n badge?: string\n /** a star at its row's end, pressed while `true`; none without it */\n starred?: boolean\n /** open or closed, whatever the person did: the page handing in the pages decides */\n open?: boolean\n /** the slot of `<ui-site-nav>` whose content shows inside it, after its pages: a note under a band */\n slot?: string\n /** the `id` of the page this is a second copy of: marked as shown whenever that page is */\n copyOf?: string\n}\n\n/** The store `remember` keeps the open pages in: `ui-site-nav:<remember>`. */\nconst PREF_STORE = \"ui-site-nav\"\n\n/** The attribute a row keeps its page's key in (`data-page`, as the row writes it). */\nconst DATA_KEY = \"data-page\"\n\n/** The attribute on the page shown's row. */\nconst DATA_CURRENT = \"data-current\"\n\n/** The `band` of a group's quiet label over its pages: a Spell site's `group`. */\nconst GROUP = \"group\"\n\n/** What stands for a page with no icon, while `collapsed`: its title's first letter or digit (`<ui-item>`'s too). */\nconst LETTER_OR_DIGIT = /[\\p{L}\\p{N}]/u\n\n/** A star's icons: starred, and not. */\nconst STAR = \"star\"\nconst STAR_OUTLINE = \"star outline\"\n","/**\n * The site nav family: defines `<ui-site-nav>`, and exports its component.\n * - SIDE EFFECT: importing it defines the tag, the tree it draws its pages with, and the button of a page's star.\n * - Also the library's `spell/ui/ui-site-nav` entry.\n */\n\nimport { UISiteNav } from \"./UISiteNav\"\n\nimport \"spell/ui/components/ui-tree\"\nimport \"spell/ui/components/ui-button\"\n\nUISiteNav.define()\n\nexport { UISiteNav, type SiteNavPage } from \"./UISiteNav\"\n"],"mappings":";;;;;;;;;AAWA,IAAasD,IAAoB;CAC/B,KAAK;CACL,MAAM;CACN,QAAQ,CAAC,cAAc,OAAO;CAC9B,KAAK;EAAC;EAAmB;EAAmB;EAAgB;EAAY;EAAY;CAAW;CAC/F,MAAM;CACN,cAAc;CACd,aAAa;CACb,UAAU;CACV,YAAY;EACV;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,SAAS;GACT,aACE;EAUJ;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aACE;EACJ;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,QAAQ,CAAC,KAAK;GACd,aACE;EAEJ;EACA;GACE,MAAM;G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AC5D,aAAa,EAAE,YAAY5B,EAAW;CACtC,YAAY;CACZ,gBAAgB;CAChB,WAAW,CAAC,WAAW;AACzB,CAAA,CAAA,GALeM,EAAAmB,GAAA,IAFJG,CAAA;AAAN,IAAMqF,IAANrF,GA8UDiB,IAAa,eAGbE,IAAW,aAGXS,IAAe,gBAGff,IAAQ,SAGRmD,IAAkB,iBAGlBmB,IAAO,QACPC,IAAe;;A,cC5ZrBC,EAAU,OAAO"}
1
+ {"version":3,"file":"ui-site-nav.js","names":["ref={(element) => this.box = element}","this","<For each={this.sitePages} keyed={_UISiteNav.keyOf}>\n {(page) => this.row(page, () => this.sitePages)}\n </For>","aria-label={this.label ?? this.translationForKey(\"label\")}","part={this.partForName(\"tree\")}","appearance={this.appearance}","label={this.label ?? this.translationForKey(\"label\")}","<nav\n part={this.partForName(\"nav\")}\n aria-label={this.label ?? this.translationForKey(\"label\")}\n ref={(element) => this.box = element}\n >\n <ui-tree\n part={this.partForName(\"tree\")}\n appearance={this.appearance}\n label={this.label ?? this.translationForKey(\"label\")}\n on-ui-selecting={(event) => this.onSelecting(event)}\n on-ui-opening={(event) => this.onOpening(event, true)}\n on-ui-closing={(event) => this.onOpening(event, false)}\n >\n <For each={this.sitePages} keyed={_UISiteNav.keyOf}>\n {(page) => this.row(page, () => this.sitePages)}\n </For>\n </ui-tree>\n </nav>","<Show when={showsLetter()}>\n <span slot=\"icon\" class=\"letter\" aria-hidden=\"true\">\n {LETTER_OR_DIGIT.exec(page().title)?.[0].toLocaleUpperCase()}\n </span>\n </Show>","<span slot=\"icon\" class=\"letter\" aria-hidden=\"true\">\n {LETTER_OR_DIGIT.exec(page().title)?.[0].toLocaleUpperCase()}\n </span>","<ui-tree-item\n data-page={_UISiteNav.keyOf(page())}\n data-current={this.isCurrent(page()) ? \"\" : void 0}\n label={page().title}\n value={page().href ?? _UISiteNav.keyOf(page())}\n icon={page().icon}\n band={page().band}\n count={page().count === void 0 ? void 0 : String(page().count)}\n badge={page().badge}\n group={page().href ? void 0 : \"\"}\n expandable={page().slot ? \"\" : void 0}\n selected={isMarked() ? \"\" : void 0}\n open={(page().pages?.length || page().slot) && this.isOpen(page()) ? \"\" : void 0}\n aria-current={isMarked() ? \"page\" : void 0}\n title={this.collapsed ? page().title : void 0}\n >\n <Show when={showsLetter()}>\n <span slot=\"icon\" class=\"letter\" aria-hidden=\"true\">\n {LETTER_OR_DIGIT.exec(page().title)?.[0].toLocaleUpperCase()}\n </span>\n </Show>\n <Show when={page().href}>\n {(href) => <a slot=\"label\" class=\"link\" href={href()} tabindex=\"-1\">\n {page().title}\n </a>}\n </Show>\n <Show when={page().starred !== void 0}>{this.star(page)}</Show>\n <Show when={page().pages?.length}>\n <For each={page().pages} keyed={_UISiteNav.keyOf}>\n {(below) => this.row(below, () => page().pages ?? [])}\n </For>\n </Show>\n <Show when={page().slot}>{(name) => <slot name={name()} />}</Show>\n </ui-tree-item>","<Show when={page().href}>\n {(href) => <a slot=\"label\" class=\"link\" href={href()} tabindex=\"-1\">\n {page().title}\n </a>}\n </Show>","<Show when={page().starred !== void 0}>{this.star(page)}</Show>","<Show when={page().pages?.length}>\n <For each={page().pages} keyed={_UISiteNav.keyOf}>\n {(below) => this.row(below, () => page().pages ?? [])}\n </For>\n </Show>","<For each={page().pages} keyed={_UISiteNav.keyOf}>\n {(below) => this.row(below, () => page().pages ?? [])}\n </For>","<Show when={page().slot}>{(name) => <slot name={name()} />}</Show>","data-current={this.isCurrent(page()) ? \"\" : void 0}","label={page().title}","value={page().href ?? _UISiteNav.keyOf(page())}","icon={page().icon}","band={page().band}","count={page().count === void 0 ? void 0 : String(page().count)}","badge={page().badge}","group={page().href ? void 0 : \"\"}","expandable={page().slot ? \"\" : void 0}","selected={isMarked() ? \"\" : void 0}","open={(page().pages?.length || page().slot) && this.isOpen(page()) ? \"\" : void 0}","aria-current={isMarked() ? \"page\" : void 0}","title={this.collapsed ? page().title : void 0}","selected={page().starred ? \"\" : void 0}","icon={page().starred ? STAR : STAR_OUTLINE}","aria-label={label()}","title={label()}","<ui-button\n slot=\"actions\"\n class=\"star\"\n data-star={_UISiteNav.keyOf(page())}\n toggle=\"\"\n selected={page().starred ? \"\" : void 0}\n icon={page().starred ? STAR : STAR_OUTLINE}\n size=\"mini\"\n appearance=\"tertiary\"\n aria-label={label()}\n title={label()}\n onClick={(event) => this.onStar(page(), event)}\n />","E.DOMElement","E.UIComponent","E.proto","E.protoMerged","E.derived","E.state","_$getOwner","_$setAttribute","__name","siteNavCSS","__decoratorStart","__publicField","__name$1","__decorateElement","__decoratorMetadata","__runInitializers","__privateAdd","PrefStore","SitePages","getOwner$1","siteNavVocabulary","UISiteNav_default","_tmpl$","_tmpl$2","_tmpl$3","_tmpl$4","_tmpl$5","_tmpl$6","_openedByPerson_dec","_currentPath_dec","_sitePages_dec","_elementSetup_dec","_vocabulary_dec","_a","_init","_openedByPerson","DOMElement","_UISiteNav","UIComponent","proto","protoMerged","derived","state","isServer","page","path","walk","pages","above","key","GROUP","kept","entries","entry","PREF_STORE","event","DATA_KEY","isOpening","originalEvent","detail","next","preferenceKey","item","href","first","group","DATA_CURRENT","scrollIntoSight","find","found","_self$","_el$","_el$2","ref","element","setAttribute","insert","createComponent","For","effect","_p$","t","a","o","i","isMarked","showsLetter","icon","besideIcons","siblings","each","band","_self$2","_el$3","_el$5","_el$6","_el$7","_el$8","_el$9","Show","_el$4","LETTER_OR_DIGIT","_el$10","_o$","_v$","claimElement","below","_el$11","name","n","h","r","d","l","u","c","w","label","_self$3","_el$12","STAR","STAR_OUTLINE","UISiteNav","delegateEvents"],"sources":["../src/components/ui-site-nav/UISiteNav.en.ts","../src/components/ui-site-nav/UISiteNav.tsx","../src/components/ui-site-nav/index.ts"],"sourcesContent":["/**\n * The English vocabulary of `<ui-site-nav>`: every name the tag uses.\n * The shape is `E.ComponentVocabulary` (`spell/ui/vocabulary`).\n */\n\nimport type { E } from \"spell/ui/core\"\n\n/****************\n * ### `siteNavVocabulary`\n * The names of `<ui-site-nav>`: a site's side navigation, its pages as a tree, the page shown marked.\n ****************/\nexport const siteNavVocabulary = {\n tag: \"ui-site-nav\",\n icon: \"compass outline\",\n topics: [\"navigation\", \"lists\"],\n aka: [\"site navigation\", \"side navigation\", \"sidebar menu\", \"nav menu\", \"site map\", \"page tree\"],\n noun: \"site nav\",\n partOfSpeech: \"structure\",\n description: \"A site nav lists a site's pages as a tree, the page shown marked; a click goes to a page.\",\n skeleton: \"4 line paragraph\",\n attributes: [\n {\n name: \"pages\",\n group: \"content\",\n kind: \"json\",\n reflect: false,\n description:\n \"The site's pages, nested as the navigation nests them: `SiteNavPage[]`, each \" +\n '`{ title, href, id?, pages? }`, e.g. `[{ \"title\": \"Films\", \"href\": \"/films\" }]`. ' +\n \"A page with no `href` only holds pages: a click opens or closes it. \" +\n \"Each may also say `icon`, `band` (`heading` or `subheading`: a heading band over its pages; `group`: a \" +\n \"group's quiet label over them, with no arrow, open while the page shown is under it, a click going to its first \" +\n \"page; its `icon` before its label, its pages a step in), `count`, \" +\n \"`badge` (a word after its title), `starred` (`true` or `false`: a star to mark it a favourite), `open` \" +\n \"(open or closed, whatever the person did: the page decides), `slot` (the name of a slot of this element \" +\n \"whose content shows inside it, after its pages) and `copyOf` (the `id` of the page it's a second copy of: \" +\n \"marked as shown whenever that page is).\"\n },\n {\n name: \"current\",\n group: \"content\",\n kind: \"string\",\n description:\n \"Which page is shown: its `href` or its `id`. None: the page whose `href` is the browser's address.\"\n },\n {\n name: \"label\",\n group: \"content\",\n kind: \"string\",\n description: 'What a screen reader calls the navigation. None: \"Site\".'\n },\n {\n name: \"appearance\",\n group: \"appearance\",\n kind: \"valueOnly\",\n values: [\"nav\"],\n description:\n '`nav`: the docs site\\'s look, its pages a tree with `appearance=\"nav\"`: taller rows, the page shown a ' +\n \"rounded box in the primary colour, and `band` pages as heading bands.\"\n },\n {\n name: \"collapsed\",\n group: \"appearance\",\n kind: \"keyOnly\",\n description:\n \"Only the icons, in one column: each row's title its tooltip, a page with no icon its title's first letter, \" +\n \"and a group with no icon a thin line. None: the titles beside the icons.\"\n },\n {\n name: \"remember\",\n group: \"behaviour\",\n kind: \"string\",\n description:\n \"Keep which pages are open for each person, under this name, across reloads and visits. \" +\n \"None: only for as long as the page is open.\"\n }\n ],\n events: [\n {\n name: \"ui-navigating\",\n cancelable: true,\n detail: \"{ href: string, page: { title: string, href?: string, id?: string }, originalEvent?: Event }\",\n description:\n \"A page was picked, and the browser is about to go there: cancel it to show the page yourself \" +\n \"(a site that shows its pages without loading another).\"\n },\n {\n name: \"ui-opening\",\n cancelable: true,\n detail: \"{ page: { title: string, href?: string, id?: string }, open: boolean, originalEvent?: Event }\",\n description: \"A page's row is about to open: cancel it to keep it closed.\"\n },\n {\n name: \"ui-closing\",\n cancelable: true,\n detail: \"{ page: { title: string, href?: string, id?: string }, open: boolean, originalEvent?: Event }\",\n description: \"A page's row is about to close: cancel it to keep it open.\"\n },\n {\n name: \"ui-starred\",\n detail: \"{ page: { title: string, href?: string, id?: string }, starred: boolean, originalEvent?: Event }\",\n description:\n \"A page's star was clicked: `starred` is what the person asked for. The page decides, and hands the \" +\n \"nav its pages again with the new `starred`.\"\n }\n ],\n slots: [],\n parts: [\n { name: \"nav\", description: \"The navigation landmark around the tree.\" },\n { name: \"tree\", description: \"The `<ui-tree>` of pages.\" }\n ],\n states: [{ name: \"collapsed\", description: \"`collapsed`: only the icons.\" }],\n texts: [\n { key: \"label\", text: \"Site\", description: \"What a screen reader calls the navigation, without `label`.\" },\n { key: \"star\", text: \"Add {title} to favourites\", description: \"A page's star, not starred.\" },\n { key: \"unstar\", text: \"Remove {title} from favourites\", description: \"A page's star, starred.\" }\n ]\n} as const satisfies E.ComponentVocabulary\n","import { For, Show } from \"solid-js\"\nimport { isServer, type JSX } from \"@solidjs/web\"\n\nimport { E, type UIT } from \"spell/ui/core\"\n// Import directly: in `core`'s util barrel it cost every page 1.9 kB (as `NavPreferences` says)\nimport { PrefStore } from \"spell/util/persist/PrefStore\"\nimport { SitePages } from \"./SitePages\"\nimport { siteNavVocabulary } from \"./UISiteNav.en\"\n\nimport siteNavCSS from \"./UISiteNav.css?inline\"\n\n/****************\n * ### `DOMSiteNavElement`\n * The DOM element of `<ui-site-nav>`: its script API, `revealCurrent()`.\n * Its component (`UISiteNav`) carries it out.\n ****************/\nexport class DOMSiteNavElement extends E.DOMElement<UISiteNav> {\n /** Scroll the page shown's row into sight, in whatever scrolls the nav (never the page itself). */\n revealCurrent() {\n this.component?.revealCurrent()\n }\n}\n\n/****************\n * ### `UISiteNav`\n * The component behind `<ui-site-nav>`: a site's side navigation (epic `mockup` P3).\n * Its pages, from `pages`, are a `<ui-tree>`, nested as the site nests them; the page shown is selected.\n *\n * <nav part=\"nav\" aria-label=\"Site\">\n * <ui-tree part=\"tree\">\n * <ui-tree-item label=\"Films\" value=\"/films\" selected> (a page)\n * <ui-tree-item label=\"Film\" value=\"/films/1\"/> (a page under it)\n * </ui-tree-item>\n * <ui-tree-item label=\"Help\" group>...</ui-tree-item> (no `href`: it only holds pages)\n * </ui-tree>\n * </nav>\n *\n * - Picking a page (a click, Enter or Space on its row) goes there: `ui-navigating`, cancelable, then the browser's\n * address.\n * A site that shows its pages without loading another (a Spell site in Run) cancels it and shows the page itself.\n * - The tree's own selecting is always cancelled: what's selected is `current`, which the page sets.\n * - Which pages are open: the ones the person opened, and every page the shown one is under.\n * - With `remember`, kept for each person across visits (`PrefStore`, `ui-site-nav:<remember>`);\n * without it, for as long as the page is open.\n * - The tree's keys walk it: up and down, right opens, left closes (`<ui-tree>`'s).\n * - Plain data in, no fetching: whatever draws the site hands it its pages, a Spell site's from its site file\n * (`static pages`), a docs site's from its own data.\n * - Its rows are `<ui-tree-item>`s in its shadow DOM, so the tree's look and keys are the same as anywhere.\n * - `appearance=\"nav\"`: the docs site's look (the tree's `appearance=\"nav\"`), and a page's `band`, `count` and\n * `badge` with it (epic `mockup` P5: `<ui-docs-nav>` draws its list with it).\n * - A page with an `href` is a real link (its title an `<a>`): a middle click or Command-click opens it in a new tab,\n * as a link does; a plain click is the tree's pick.\n * - A page with `starred` gets a star at its row's end: a click sends `ui-starred`, and selects nothing.\n * - A page's `open`, when it says one, wins: the page that hands the nav its pages decides (a search opens what\n * matches); the nav's `ui-opening` / `ui-closing` tell it what the person did.\n * - A page's rows are kept by its key across new `pages`, so a row keeps its focus, and its rows ease open and shut.\n * - A page with `slot` shows what the page puts in `<ui-site-nav>`'s slot of that name inside it, after its pages,\n * and can open though it has none yet (a \"Loading...\" under a band).\n * - A page with `copyOf` is a second copy of another (a favourite): marked as shown whenever that page is;\n * `revealCurrent()` still goes to the original.\n * - A page with `band=\"group\"` is a quiet label over its pages, with no arrow (epic `mockup` T34): a Spell site's\n * groups.\n * - It opens by itself while the page shown is under it, and stays open: more than one can be open at once.\n * - A click (or Enter) on it opens it and goes to its first page; on one that's open, and doesn't hold the page shown,\n * it closes it.\n * - A page with no `icon`, beside pages with one, keeps an icon's room, so its title lines up with theirs.\n * - A group's `icon` shows before its label, and its pages are a step in from it (epic `mockup` I20).\n * - Beside a bar (`--ui-site-nav-bar-height`, which `<ui-page-layout>` sets to its menu's height): its first row's\n * middle on the bar's, so the first page's icon lines up with the drawer's button (epic `mockup` I35).\n * - `collapsed`: only the icons, each row's title its tooltip (`:state(collapsed)`), all in one column, no step in;\n * a page with no icon shows its title's first letter, as `<ui-menu>`'s icons-only look does,\n * and a group with no icon is a thin line.\n ****************/\nexport class UISiteNav extends E.UIComponent<typeof siteNavVocabulary> {\n @E.proto static vocabulary = siteNavVocabulary\n @E.protoMerged static elementSetup: Partial<E.ElementSetup> = {\n styleSheets: { \"site-nav\": siteNavCSS },\n DOMElement: DOMSiteNavElement,\n delegatesFocus: false,\n cssStates: [\"collapsed\"]\n }\n\n ////////////////\n // ## Pages\n ////////////////\n\n /** `pages`, the well-formed ones: each with a `title`, and its pages checked the same way. */\n @E.derived\n get sitePages(): readonly SiteNavPage[] {\n return SitePages.wellFormed(this.pages)\n }\n\n /** Which page is shown, as `current` says it, else the browser's address. */\n get currentKey(): string {\n return this.current ?? (isServer ? \"\" : location.pathname)\n }\n\n /** Is `page` the one shown: its `id`, its `href`, or its `href`'s path is `currentKey`? */\n isCurrent(page: SiteNavPage): boolean {\n return SitePages.isShown(page, this.currentKey)\n }\n\n /** Is `page` marked as the one shown: it is, or it's a copy (`copyOf`) of the one that is? */\n isMarked(page: SiteNavPage): boolean {\n return this.isCurrent(page) || (!!page.copyOf && page.copyOf === this.currentKey)\n }\n\n /** The keys of every page the shown one is under: they start open. */\n @E.derived\n get currentPath(): ReadonlySet<string> {\n const path = new Set<string>()\n const walk = (pages: readonly SiteNavPage[], above: readonly string[]): boolean =>\n pages.some((page) => {\n if (!this.isCurrent(page)) return walk(page.pages ?? [], [...above, UISiteNav.keyOf(page)])\n for (const key of above) path.add(key)\n return true\n })\n walk(this.sitePages, [])\n return path\n }\n\n ////////////////\n // ## Open pages\n ////////////////\n\n /** Pages the person opened (`true`) or closed (`false`), by key: over `currentPath`'s. */\n @E.state accessor openedByPerson: ReadonlyMap<string, boolean> = new Map()\n\n /**\n * Is `page` open: as its `open` says, else as the person left it, else open when the shown page is under it.\n * - A group (`band=\"group\"`) is always open while the shown page is under it: it opens by itself.\n */\n isOpen(page: SiteNavPage): boolean {\n if (page.open !== undefined) return page.open\n const key = UISiteNav.keyOf(page)\n if (page.band === GROUP && this.currentPath.has(key)) return true\n return this.openedByPerson.get(key) ?? this.currentPath.has(key)\n }\n\n /** It connected: the pages this person left open, when it `remember`s. */\n onConnect() {\n super.onConnect()\n const key = this.preferenceKey\n if (!key) return\n const kept = PrefStore.getAt(key)\n if (kept && typeof kept === \"object\" && !Array.isArray(kept)) {\n const entries = Object.entries(kept).filter((entry): entry is [string, boolean] => typeof entry[1] === \"boolean\")\n this.openedByPerson = new Map(entries)\n }\n }\n\n /** Where it keeps the open pages: `ui-site-nav:<remember>`, or nowhere. */\n private get preferenceKey(): string | undefined {\n return this.remember ? `${PREF_STORE}:${this.remember}` : undefined\n }\n\n /**\n * A row is opening or closing: the nav's own `ui-opening` / `ui-closing` say which page (the row's are kept in), and\n * cancelling it keeps the row as it was; else remembered, and kept so.\n */\n private onOpening(event: CustomEvent<{ open: boolean; originalEvent?: Event }>, isOpening: boolean) {\n event.stopPropagation()\n const key = (event.target as HTMLElement).getAttribute(DATA_KEY)\n const page = this.pageForKey(key)\n if (key === null || !page) return\n const { originalEvent } = event.detail\n // a group holding the page shown stays open: a click on it goes to its first page instead\n if (page.band === GROUP && !isOpening && this.currentPath.has(key)) {\n event.preventDefault()\n if (UISiteNav.isPick(originalEvent)) this.goToFirstPage(page, originalEvent)\n return\n }\n const detail = { page, open: isOpening, originalEvent }\n if (!this.send(isOpening ? \"ui-opening\" : \"ui-closing\", detail)) {\n event.preventDefault()\n return\n }\n const next = new Map(this.openedByPerson).set(key, isOpening)\n this.openedByPerson = next\n const preferenceKey = this.preferenceKey\n if (preferenceKey) PrefStore.setAt(preferenceKey, Object.fromEntries(next))\n if (page.band === GROUP && isOpening && UISiteNav.isPick(originalEvent)) this.goToFirstPage(page, originalEvent)\n }\n\n /**\n * Was `originalEvent` a pick: a click, Enter or Space, not the tree's arrow keys walking it?\n * - A group opened by the arrow keys only opens: the keys walk the tree without leaving the page.\n */\n private static isPick(originalEvent: Event | undefined): boolean {\n return !(originalEvent instanceof KeyboardEvent && originalEvent.key.startsWith(\"Arrow\"))\n }\n\n ////////////////\n // ## Going to a page\n ////////////////\n\n /**\n * A row was picked: the tree's own selecting is cancelled (`current` says what's selected), and a page with an\n * `href` is gone to, unless `ui-navigating` is cancelled.\n */\n private onSelecting(event: CustomEvent<{ item: HTMLElement | UIT.TreeItemData; originalEvent?: Event }>) {\n event.preventDefault()\n // its rows are `<ui-tree-item>`s, never `items` data: so always an element\n const item = event.detail.item as HTMLElement\n const page = this.pageForKey(item.getAttribute(DATA_KEY))\n if (!page?.href) return\n const { originalEvent } = event.detail\n // a middle or modified click on its link: the browser opens it, as with any link\n if (SitePages.isOpenElsewhere(originalEvent)) return\n originalEvent?.preventDefault()\n this.goTo(page as SiteNavPage & { href: string }, originalEvent)\n }\n\n /** Go to `page`: `ui-navigating`, then the browser's address, unless it's cancelled. */\n private goTo(page: SiteNavPage & { href: string }, originalEvent: Event | undefined) {\n const { href } = page\n if (!this.send(\"ui-navigating\", { href, page, originalEvent })) return\n location.assign(href)\n }\n\n /** Go to the first page under `group` that has an `href`, at any depth; none, nothing. */\n private goToFirstPage(group: SiteNavPage, originalEvent: Event | undefined) {\n const first = SitePages.allOf(group.pages ?? []).find((page): page is SiteNavPage & { href: string } => !!page.href)\n if (first) this.goTo(first, originalEvent)\n }\n\n /** A page's star was clicked: `ui-starred`, saying what the person asked for; nothing is selected. */\n private onStar(page: SiteNavPage, event: MouseEvent) {\n event.stopPropagation()\n this.send(\"ui-starred\", { page, starred: !page.starred, originalEvent: event })\n }\n\n /** The page shown's row, while drawn. */\n get currentItem(): HTMLElement | undefined {\n return this.box?.querySelector<HTMLElement>(`[${DATA_CURRENT}]`) ?? undefined\n }\n\n /** Scroll the page shown's row into sight. Script API. */\n revealCurrent() {\n const item = this.currentItem\n if (item) E.scrollIntoSight(item)\n }\n\n /** The navigation box, while drawn. */\n private box: HTMLElement | undefined\n\n /** The page whose key is `key`, anywhere in the tree. */\n private pageForKey(key: string | null): SiteNavPage | undefined {\n if (key === null) return undefined\n const find = (pages: readonly SiteNavPage[]): SiteNavPage | undefined => {\n for (const page of pages) {\n if (UISiteNav.keyOf(page) === key) return page\n const found = find(page.pages ?? [])\n if (found) return found\n }\n return undefined\n }\n return find(this.sitePages)\n }\n\n ////////////////\n // ## Rendering\n ////////////////\n\n render(): JSX.Element {\n return (\n <nav\n part={this.partForName(\"nav\")}\n aria-label={this.label ?? this.translationForKey(\"label\")}\n ref={(element: HTMLElement) => (this.box = element)}\n >\n <ui-tree\n part={this.partForName(\"tree\")}\n appearance={this.appearance}\n label={this.label ?? this.translationForKey(\"label\")}\n on-ui-selecting={(event: CustomEvent<{ item: HTMLElement | UIT.TreeItemData }>) => this.onSelecting(event)}\n on-ui-opening={(event: CustomEvent<{ open: boolean }>) => this.onOpening(event, true)}\n on-ui-closing={(event: CustomEvent<{ open: boolean }>) => this.onOpening(event, false)}\n >\n <For each={this.sitePages} keyed={UISiteNav.keyOf}>\n {(page) => this.row(page, () => this.sitePages)}\n </For>\n </ui-tree>\n </nav>\n )\n }\n\n /** One page's row, and its pages' rows inside it; `siblings`, the pages beside it, itself among them. */\n private row(page: () => SiteNavPage, siblings: () => readonly SiteNavPage[]): JSX.Element {\n const isMarked = () => this.isMarked(page())\n /**\n * It has no icon, but a page beside it has: an icon's room, or (`collapsed`) its first letter, stands in.\n * - A group with no icon keeps the room beside groups with one, so the labels line up;\n * `collapsed`, it's a thin line instead (epic `mockup` I20).\n */\n const showsLetter = () => {\n const { icon, band } = page()\n if (icon) return false\n const besideIcons = siblings().some((each) => !!each.icon)\n if (band === GROUP) return !this.collapsed && besideIcons\n return !band && (this.collapsed || besideIcons)\n }\n return (\n <ui-tree-item\n data-page={UISiteNav.keyOf(page())}\n data-current={this.isCurrent(page()) ? \"\" : undefined}\n label={page().title}\n value={page().href ?? UISiteNav.keyOf(page())}\n icon={page().icon}\n band={page().band}\n count={page().count === undefined ? undefined : String(page().count)}\n badge={page().badge}\n group={page().href ? undefined : \"\"}\n expandable={page().slot ? \"\" : undefined}\n selected={isMarked() ? \"\" : undefined}\n open={(page().pages?.length || page().slot) && this.isOpen(page()) ? \"\" : undefined}\n aria-current={isMarked() ? \"page\" : undefined}\n title={this.collapsed ? page().title : undefined}\n >\n <Show when={showsLetter()}>\n <span slot=\"icon\" class=\"letter\" aria-hidden=\"true\">\n {LETTER_OR_DIGIT.exec(page().title)?.[0].toLocaleUpperCase()}\n </span>\n </Show>\n <Show when={page().href}>\n {(href) => (\n <a slot=\"label\" class=\"link\" href={href()} tabindex=\"-1\">\n {page().title}\n </a>\n )}\n </Show>\n <Show when={page().starred !== undefined}>{this.star(page)}</Show>\n <Show when={page().pages?.length}>\n <For each={page().pages} keyed={UISiteNav.keyOf}>\n {(below) => this.row(below, () => page().pages ?? [])}\n </For>\n </Show>\n <Show when={page().slot}>{(name) => <slot name={name()} />}</Show>\n </ui-tree-item>\n )\n }\n\n /** A page's star, at its row's end: a toggle, pressed while it's starred. */\n private star(page: () => SiteNavPage): JSX.Element {\n const label = () => this.translationForKey(page().starred ? \"unstar\" : \"star\", { title: page().title })\n return (\n <ui-button\n slot=\"actions\"\n class=\"star\"\n data-star={UISiteNav.keyOf(page())}\n toggle=\"\"\n selected={page().starred ? \"\" : undefined}\n icon={page().starred ? STAR : STAR_OUTLINE}\n size=\"mini\"\n appearance=\"tertiary\"\n aria-label={label()}\n title={label()}\n onClick={(event: MouseEvent) => this.onStar(page(), event)}\n />\n )\n }\n\n ////////////////\n // ## Helpers\n ////////////////\n\n /** What `page` is known by, to open, find and remember it (`SitePages.keyOf()`). */\n static keyOf(page: SiteNavPage): string {\n return SitePages.keyOf(page)\n }\n}\n\n/** The vocabulary getters, typed (`UIComponent`'s doc). */\nexport interface UISiteNav extends E.AttributeValues<typeof siteNavVocabulary> {}\n\n/** One page of a site, as `<ui-site-nav pages>` takes it. */\nexport type SiteNavPage = {\n /** what the navigation calls it: `Films` */\n title: string\n /** where it is: `/films`; none, a page that only holds pages */\n href?: string\n /** what `current` may call it, when its `href` isn't enough: `film-page` */\n id?: string\n /** an icon before its title */\n icon?: string\n /** the pages under it */\n pages?: readonly SiteNavPage[]\n /**\n * a band over its pages, with `appearance=\"nav\"`:\n * - `heading`: a tinted heading band, with an arrow\n * - `subheading`: a lighter one inside one\n * - `group`: a group's quiet label, no arrow, open while the page shown is under it; a click goes to its first page\n */\n band?: \"heading\" | \"subheading\" | \"group\"\n /** a number in a small round label after its title: how many pages it holds */\n count?: number | string\n /** a word in a small label after its title: `Planned` */\n badge?: string\n /** a star at its row's end, pressed while `true`; none without it */\n starred?: boolean\n /** open or closed, whatever the person did: the page handing in the pages decides */\n open?: boolean\n /** the slot of `<ui-site-nav>` whose content shows inside it, after its pages: a note under a band */\n slot?: string\n /** the `id` of the page this is a second copy of: marked as shown whenever that page is */\n copyOf?: string\n}\n\n/** The store `remember` keeps the open pages in: `ui-site-nav:<remember>`. */\nconst PREF_STORE = \"ui-site-nav\"\n\n/** The attribute a row keeps its page's key in (`data-page`, as the row writes it). */\nconst DATA_KEY = \"data-page\"\n\n/** The attribute on the page shown's row. */\nconst DATA_CURRENT = \"data-current\"\n\n/** The `band` of a group's quiet label over its pages: a Spell site's `group`. */\nconst GROUP = \"group\"\n\n/** What stands for a page with no icon, while `collapsed`: its title's first letter or digit (`<ui-item>`'s too). */\nconst LETTER_OR_DIGIT = /[\\p{L}\\p{N}]/u\n\n/** A star's icons: starred, and not. */\nconst STAR = \"star\"\nconst STAR_OUTLINE = \"star outline\"\n","/**\n * The site nav family: defines `<ui-site-nav>`, and exports its component.\n * - SIDE EFFECT: importing it defines the tag, the tree it draws its pages with, and the button of a page's star.\n * - Also the library's `spell/ui/ui-site-nav` entry.\n */\n\nimport { UISiteNav } from \"./UISiteNav\"\n\nimport \"spell/ui/components/ui-tree\"\nimport \"spell/ui/components/ui-button\"\n\nUISiteNav.define()\n\nexport { UISiteNav, type SiteNavPage } from \"./UISiteNav\"\n"],"mappings":";;;;;;;;;AAWA,IAAasD,IAAoB;CAC/B,KAAK;CACL,MAAM;CACN,QAAQ,CAAC,cAAc,OAAO;CAC9B,KAAK;EAAC;EAAmB;EAAmB;EAAgB;EAAY;EAAY;CAAW;CAC/F,MAAM;CACN,cAAc;CACd,aAAa;CACb,UAAU;CACV,YAAY;EACV;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,SAAS;GACT,aACE;EAUJ;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aACE;EACJ;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;EACf;EACA;GACE,MAAM;GACN,OAAO;GACP,MAAM;GACN,QAAQ,CAAC,KAAK;GACd,aACE;EAEJ;EACA;GACE,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,GAAA,IAFJG,GAEmD;CAC5D,aAAa,EAAE,YAAY5B,EAAW;CACtC,YAAY;CACZ,gBAAgB;CAChB,WAAW,CAAC,WAAW;AACzB,CAAA,CAAA,GALeM,EAAAmB,GAAA,IAFJG,CAAA;AAAN,IAAMqF,IAANrF,GAgVDiB,IAAa,eAGbE,IAAW,aAGXU,IAAe,gBAGfhB,IAAQ,SAGRmD,IAAkB,iBAGlBmB,IAAO,QACPC,IAAe;;A,cC9ZrBC,EAAU,OAAO"}
@@ -1,9 +1,9 @@
1
1
  import "./rolldown-runtime-c6e9CmGy.js";
2
- import { Gt as e, Jt as t, Kt as n, UIComponent as r, Ut as i, Wt as a, Yt as o, beforeNextPaint as s, cssState as c, isSameList as l, on as u, onChange as d, proto as f, protoMerged as p, qt as m, state as h, untracked as g, watches as _ } from "./core.js";
3
- import { For as v } from "solid-js";
4
- import { addEvent as y, createComponent as b, delegateEvents as x, effect as S, getOwner as ee, isServer as C, setAttribute as w, setStyleProperty as T, template as E } from "@solidjs/web";
2
+ import { Gt as e, Jt as t, Kt as n, PaneSizes as r, UIComponent as i, Ut as a, Wt as o, Yt as s, beforeNextPaint as c, cssState as l, isSameList as u, on as d, onChange as f, proto as p, protoMerged as m, qt as h, state as g, untracked as _, watches as v } from "./core.js";
3
+ import { For as y } from "solid-js";
4
+ import { addEvent as b, createComponent as x, delegateEvents as S, effect as C, getOwner as w, isServer as T, setAttribute as E, setStyleProperty as D, template as O } from "@solidjs/web";
5
5
  // src/components/ui-split-panel/UISplitPanel.en.ts
6
- var D = {
6
+ var k = {
7
7
  tag: "ui-split-panel",
8
8
  icon: "columns",
9
9
  topics: ["layout", "containers"],
@@ -85,17 +85,17 @@ var D = {
85
85
  text: "Resize these panes",
86
86
  description: "A bar's name, for a screen reader."
87
87
  }]
88
- }, O = "@layer ui.components{:host{box-sizing:border-box;flex:1 1 0;width:100%;min-width:0;min-height:0;display:flex;position:relative}:host(:state(rows)){flex-direction:column;width:auto;height:100%}:host([hidden]){display:none}::slotted(*){box-sizing:border-box;min-width:0;min-height:0;position:relative;overflow:hidden}.bar{flex:0 0 var(--ui-split-panel-bar-size,0);background:var(--ui-split-panel-bar-background,transparent);pointer-events:none;touch-action:none}:host(:state(resizable)) .bar{flex-basis:var(--ui-split-panel-bar-size,8px);pointer-events:auto;cursor:col-resize;transition:background-color .1s}:host(:state(resizable):state(rows)) .bar{cursor:row-resize}:host(:state(resizable)) .bar:hover,:host(:state(dragging)) .bar:active{background:var(--ui-split-panel-bar-active-background,var(--ui-split-panel-bar-background,transparent))}.bar:focus-visible{outline:var(--ui-focus-ring-width,2px) solid var(--ui-focus-ring-color,currentColor);outline-offset:-1px}}", te = /* @__PURE__ */ E("<slot>"), ne = /* @__PURE__ */ E("<div class=bar>"), k, A, j, M, N, P, F, I, L, R, z, B, V, H, U, W, G, K = class _UISplitPanel extends (V = r, B = [f], z = [p], R = [h({ equals: l })], L = [h, c("dragging")], I = [h({ equals: l })], F = [c("rows")], P = [u("slotchange", { target: "renderRoot" })], N = [_({
88
+ }, ee = "@layer ui.components{:host{box-sizing:border-box;flex:1 1 0;width:100%;min-width:0;min-height:0;display:flex;position:relative}:host(:state(rows)){flex-direction:column;width:auto;height:100%}:host([hidden]){display:none}::slotted(*){box-sizing:border-box;min-width:0;min-height:0;position:relative;overflow:hidden}.bar{flex:0 0 var(--ui-split-panel-bar-size,0);background:var(--ui-split-panel-bar-background,transparent);pointer-events:none;touch-action:none}:host(:state(resizable)) .bar{flex-basis:var(--ui-split-panel-bar-size,8px);pointer-events:auto;cursor:col-resize;transition:background-color .1s}:host(:state(resizable):state(rows)) .bar{cursor:row-resize}:host(:state(resizable)) .bar:hover,:host(:state(dragging)) .bar:active{background:var(--ui-split-panel-bar-active-background,var(--ui-split-panel-bar-background,transparent))}.bar:focus-visible{outline:var(--ui-focus-ring-width,2px) solid var(--ui-focus-ring-color,currentColor);outline-offset:-1px}}", A = /* @__PURE__ */ O("<slot>"), j = /* @__PURE__ */ O("<div class=bar>"), M, N, P, F, I, L, R, z, B, V, H, U, W, G, K, q, J, Y = class _UISplitPanel extends (W = i, U = [p], H = [m], V = [g({ equals: u })], B = [g, l("dragging")], z = [g({ equals: u })], R = [l("rows")], L = [d("slotchange", { target: "renderRoot" })], I = [v({
89
89
  attributes: !0,
90
90
  attributeFilter: ["hidden"],
91
91
  subtree: !0
92
- })], M = [d("panes", "sizesGiven", { writesDOMElement: !0 })], j = [g], A = [g], k = [g], V) {
92
+ })], F = [f("panes", "sizesGiven", { writesDOMElement: !0 })], P = [_], N = [_], M = [_], W) {
93
93
  constructor() {
94
- super(...arguments), o(H, 5, this), m(this, U, o(H, 8, this, [])), o(H, 11, this), m(this, W, o(H, 12, this, !1)), o(H, 15, this), m(this, G, o(H, 16, this, [])), o(H, 19, this), t(this, "sizes", []), t(this, "dragged"), t(this, "drag", o(H, 28, this, /* @__PURE__ */ n((e) => {
94
+ super(...arguments), s(G, 5, this), h(this, K, s(G, 8, this, [])), s(G, 11, this), h(this, q, s(G, 12, this, !1)), s(G, 15, this), h(this, J, s(G, 16, this, [])), s(G, 19, this), t(this, "sizes", []), t(this, "dragged"), t(this, "drag", s(G, 28, this, /* @__PURE__ */ n((e) => {
95
95
  this.dragged && this.moveTo(this.dragged, this.isRows ? e.clientY : e.clientX);
96
- }, "drag"))), o(H, 31, this), t(this, "stopDragging", o(H, 32, this, /* @__PURE__ */ n(() => {
96
+ }, "drag"))), s(G, 31, this), t(this, "stopDragging", s(G, 32, this, /* @__PURE__ */ n(() => {
97
97
  this.dragged && (this.settle(this.dragged), this.dragged = void 0, this.isDragging = !1, this.findBarPlaces(), this.sendSizes());
98
- }, "stopDragging"))), o(H, 35, this);
98
+ }, "stopDragging"))), s(G, 35, this);
99
99
  }
100
100
  get isRows() {
101
101
  return this.rows !== void 0;
@@ -117,24 +117,24 @@ var D = {
117
117
  render() {
118
118
  let e = this;
119
119
  return [(() => {
120
- var e = te();
121
- return e._$owner = ee(), e;
122
- })(), b(v, {
120
+ var e = A();
121
+ return e._$owner = w(), e;
122
+ })(), x(y, {
123
123
  get each() {
124
124
  return e.panes.slice(1);
125
125
  },
126
126
  children: (t, n) => (() => {
127
- var t = ne();
128
- return t._$$keydown = (t) => e.moveByKey(t, n()), y(t, "pointercancel", e.stopDragging), y(t, "pointerup", e.stopDragging, !0), y(t, "pointermove", e.drag, !0), t._$$pointerdown = (t) => e.startDragging(t, n()), S(() => ({
127
+ var t = j();
128
+ return t._$$keydown = (t) => e.moveByKey(t, n()), b(t, "pointercancel", e.stopDragging), b(t, "pointerup", e.stopDragging, !0), b(t, "pointermove", e.drag, !0), t._$$pointerdown = (t) => e.startDragging(t, n()), C(() => ({
129
129
  e: n() === e.panes.length - 2 ? e.lastBarPart : e.partForName("bar"),
130
130
  t: n() * 2 + 1,
131
131
  a: e.resizable ? "separator" : void 0,
132
132
  o: e.resizable ? 0 : void 0,
133
133
  i: e.resizable ? e.translationForKey("resizePanes") : void 0,
134
134
  n: e.isRows ? "horizontal" : "vertical",
135
- s: e.resizable ? e.barPlaces[n()] ?? Z : void 0
135
+ s: e.resizable ? e.barPlaces[n()] ?? Q : void 0
136
136
  }), ({ e, t: n, a: r, o: i, i: a, n: o, s }, c) => {
137
- e !== c?.e && w(t, "part", e), n !== c?.t && T(t, "order", n), r !== c?.a && w(t, "role", r), i !== c?.o && w(t, "tabindex", i), a !== c?.i && w(t, "aria-label", a), o !== c?.n && w(t, "aria-orientation", o), s !== c?.s && w(t, "aria-valuenow", s);
137
+ e !== c?.e && E(t, "part", e), n !== c?.t && D(t, "order", n), r !== c?.a && E(t, "role", r), i !== c?.o && E(t, "tabindex", i), a !== c?.i && E(t, "aria-label", a), o !== c?.n && E(t, "aria-orientation", o), s !== c?.s && E(t, "aria-valuenow", s);
138
138
  }), t;
139
139
  })()
140
140
  })];
@@ -149,7 +149,7 @@ var D = {
149
149
  this.panes = [...this.domElement.children].filter((e) => !e.hasAttribute("hidden"));
150
150
  }
151
151
  onPanesChanged(e, t) {
152
- this.apply(_UISplitPanel.sizesFor(t, e.length)), C || s(() => this.findBarPlaces());
152
+ this.apply(r.sizesFor(t, e.length, { source: "<ui-split-panel>" })), T || c(() => this.findBarPlaces());
153
153
  }
154
154
  findBarPlaces() {
155
155
  let e = this.panes.map((e) => {
@@ -158,7 +158,7 @@ var D = {
158
158
  });
159
159
  this.barPlaces = e.slice(1).map((t, n) => {
160
160
  let r = e[n];
161
- return r + t ? Math.round(r * 100 / (r + t)) : Z;
161
+ return r + t ? Math.round(r * 100 / (r + t)) : Q;
162
162
  });
163
163
  }
164
164
  apply(e) {
@@ -166,7 +166,7 @@ var D = {
166
166
  let t = this.growingPane === void 0 ? 0 : 1;
167
167
  this.panes.forEach((n, r) => {
168
168
  let i = e[r];
169
- n.style.order = String(r * 2), n.style.flex = i.units === "%" ? `${i.value} ${i.value} 0` : i.units === J ? "0 1 auto" : `0 ${t} ${i.value}${i.units}`, n.toggleAttribute(X, i.units === J);
169
+ n.style.order = String(r * 2), n.style.flex = i.units === "%" ? `${i.value} ${i.value} 0` : i.units === Z ? "0 1 auto" : `0 ${t} ${i.value}${i.units}`, n.toggleAttribute(te, i.units === Z);
170
170
  });
171
171
  }
172
172
  startDragging(e, t) {
@@ -180,7 +180,7 @@ var D = {
180
180
  }
181
181
  sendSizes() {
182
182
  this.send("ui-changed", {
183
- sizes: _UISplitPanel.sizeText(this.sizes),
183
+ sizes: r.sizeText(this.sizes),
184
184
  panes: this.panes
185
185
  });
186
186
  }
@@ -217,7 +217,7 @@ var D = {
217
217
  let r = t - e.pointerStart, i = this.growingPane;
218
218
  if (i !== void 0) return this.moveBeside(e, i, r);
219
219
  let { pane1: a, pane2: o, sizes: s } = e;
220
- if (s[a]?.units === J || s[o]?.units === J) return this.moveBesideAuto(e, r);
220
+ if (s[a]?.units === Z || s[o]?.units === Z) return this.moveBesideAuto(e, r);
221
221
  let { lengths: c, bounds: l, bar: u } = e, d = c.map((e, t) => u - t).filter((e) => e >= 0), f = c.map((e, t) => u + 1 + t).filter((e) => e < c.length), [p, m] = r >= 0 ? [d, f] : [f, d], h = /* @__PURE__ */ n((e, t) => e.reduce((e, n) => e + (t === "grow" ? l[n].most - c[n] : c[n] - l[n].least), 0), "room"), g = Math.min(Math.abs(r), h(p, "grow"), h(m, "shrink")), _ = [...c], v = g;
222
222
  for (let e of p) {
223
223
  let t = Math.min(v, l[e].most - c[e]);
@@ -245,7 +245,7 @@ var D = {
245
245
  }));
246
246
  }
247
247
  moveBesideAuto(e, t) {
248
- let { pane1: n, pane2: r, size1: i, size2: a, bounds1: o, bounds2: s, sizes: c } = e, l = [n, r].find((e) => c[e]?.units !== J) ?? n, u = l === n ? i + t : a - t, d = l === n ? o : s, f = Math.round(Math.min(d.most, Math.max(d.least, e.minPixels, u)));
248
+ let { pane1: n, pane2: r, size1: i, size2: a, bounds1: o, bounds2: s, sizes: c } = e, l = [n, r].find((e) => c[e]?.units !== Z) ?? n, u = l === n ? i + t : a - t, d = l === n ? o : s, f = Math.round(Math.min(d.most, Math.max(d.least, e.minPixels, u)));
249
249
  this.apply(c.map((e, t) => t === l ? {
250
250
  value: f,
251
251
  units: "px"
@@ -259,41 +259,11 @@ var D = {
259
259
  } : n === d ? {
260
260
  value: _,
261
261
  units: "px"
262
- } : e.units === "%" || e.units === J ? {
262
+ } : e.units === "%" || e.units === Z ? {
263
263
  value: Math.round(l[n]),
264
264
  units: "px"
265
265
  } : e));
266
266
  }
267
- static sizesFor(e, t) {
268
- let n = e ? e.split(",").slice(0, t) : [];
269
- for (; n.length < t;) n.push(Y);
270
- let r = 0, i = 0, a = n.map((e) => {
271
- let t = e.trim();
272
- if (t === J) return {
273
- value: 0,
274
- units: J
275
- };
276
- let n = Q.exec(t);
277
- if (n) {
278
- let e = n[2] || "px", t = parseFloat(n[1]);
279
- return e === "%" && (i += t), {
280
- value: t,
281
- units: e
282
- };
283
- }
284
- return t !== Y && console.warn(`<ui-split-panel>: the size "${t}" isn't one; it shares what's left`), r++, {
285
- value: Y,
286
- units: "%"
287
- };
288
- }), o = Math.max(1, (100 - i) / Math.max(r, 1));
289
- return a.map(({ value: e, units: t }) => ({
290
- value: e === Y ? o : e,
291
- units: t
292
- }));
293
- }
294
- static sizeText(e) {
295
- return e.map(({ value: e, units: t }) => t === J ? J : `${e}${t}`).join(",");
296
- }
297
267
  static boundsOf(e, t) {
298
268
  let n = getComputedStyle(e), r = t ? n.minHeight : n.minWidth, i = t ? n.maxHeight : n.maxWidth;
299
269
  return {
@@ -308,17 +278,17 @@ var D = {
308
278
  return e.style.flex = n, t ? i : r;
309
279
  }
310
280
  static minimums(e) {
311
- let t = Q.exec(e?.trim() ?? "");
281
+ let t = ne.exec(e?.trim() ?? "");
312
282
  if (!t) return [$, 0];
313
283
  let n = parseFloat(t[1]);
314
284
  return t[2] === "%" ? [n, 0] : [$, n];
315
285
  }
316
286
  };
317
- H = e(V), U = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), i(H, 4, "panes", R, K, U), i(H, 4, "isDragging", L, K, W), i(H, 4, "barPlaces", I, K, G), i(H, 2, "isRows", F, K), i(H, 1, "onSlotChanged", P, K), i(H, 1, "onHiddenChanged", N, K), i(H, 1, "onPanesChanged", M, K), i(H, 1, "moveByKey", k, K), i(H, 13, "vocabulary", B, K), i(H, 13, "elementSetup", z, K), i(H, 5, "drag", j, K), i(H, 5, "stopDragging", A, K), a(H, K), n(K, "UISplitPanel"), t(K, "vocabulary", o(H, 20, K, D)), o(H, 23, K), t(K, "elementSetup", o(H, 24, K, {
318
- styleSheets: { splitPanel: O },
287
+ G = e(W), K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), a(G, 4, "panes", V, Y, K), a(G, 4, "isDragging", B, Y, q), a(G, 4, "barPlaces", z, Y, J), a(G, 2, "isRows", R, Y), a(G, 1, "onSlotChanged", L, Y), a(G, 1, "onHiddenChanged", I, Y), a(G, 1, "onPanesChanged", F, Y), a(G, 1, "moveByKey", M, Y), a(G, 13, "vocabulary", U, Y), a(G, 13, "elementSetup", H, Y), a(G, 5, "drag", P, Y), a(G, 5, "stopDragging", N, Y), o(G, Y), n(Y, "UISplitPanel"), t(Y, "vocabulary", s(G, 20, Y, k)), s(G, 23, Y), t(Y, "elementSetup", s(G, 24, Y, {
288
+ styleSheets: { splitPanel: ee },
319
289
  cssStates: ["resizable"]
320
- })), o(H, 27, K);
321
- var q = K, J = "auto", Y = "*", X = "data-split-fit", Z = 50, Q = /^([0-9]*\.?[0-9]+)(px|em|rem|%)?$/, $ = 5, re = 1e5, ie = 16, ae = 10, oe = {
290
+ })), s(G, 27, Y);
291
+ var X = Y, Z = "auto", te = "data-split-fit", Q = 50, ne = /^([0-9]*\.?[0-9]+)(px|em|rem|%)?$/, $ = 5, re = 1e5, ie = 16, ae = 10, oe = {
322
292
  ArrowLeft: -1,
323
293
  ArrowRight: 1
324
294
  }, se = {
@@ -326,12 +296,12 @@ var q = K, J = "auto", Y = "*", X = "data-split-fit", Z = 50, Q = /^([0-9]*\.?[0
326
296
  ArrowDown: 1
327
297
  };
328
298
  // src/components/ui-split-panel/index.ts
329
- x([
299
+ S([
330
300
  "pointerdown",
331
301
  "pointermove",
332
302
  "pointerup",
333
303
  "keydown"
334
- ]), q.define();
335
- export { q as UISplitPanel };
304
+ ]), X.define();
305
+ export { X as UISplitPanel };
336
306
 
337
307
  //# sourceMappingURL=ui-split-panel.js.map