@k2b/ui 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -327,14 +327,14 @@ export function createHoverPreview(options = {}) {
327
327
  leave,
328
328
  focusOut,
329
329
  toggled: visible => {
330
- if (!visible) {
331
- // Light dismissal by the browser: an outside click or another popover.
330
+ // Light dismissal by the browser: an outside click or another popover.
331
+ // The event of a close this controller made itself arrives later, when
332
+ // the pointer may already wait on the next anchor; that delay stays.
333
+ if (!visible && open()) {
332
334
  clear();
333
335
  pinned = undefined;
334
- if (open()) {
335
- setOpen(false);
336
- listen(false);
337
- }
336
+ setOpen(false);
337
+ listen(false);
338
338
  }
339
339
  options.onOpenChange?.(visible);
340
340
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["feedback/HoverPreview.tsx"],"sourcesContent":["import { type Accessor, createEffect, createSignal, createUniqueId, type JSX, onCleanup, onMount, Show } from \"solid-js\";\nimport { returnFocus, ringOnReturn } from \"../internal/focus-return\";\nimport { positionTooltipSurface } from \"./tooltip-position\";\n\n/** A resting pointer moving from one anchor to another swaps the card this fast. */\nconst SWAP_DELAY = 90;\n/** Grace period for the pointer to travel from an anchor into the card. */\nconst CLOSE_DELAY = 180;\n/** Distance to the region and to the boundary edges. */\nconst GAP = 8;\n/** Keys the wiring between a controller and its `<HoverPreview>`. */\nconst INTERNALS = Symbol(\"k2b-hover-preview\");\n\n/**\n * Where the card opens. By default it opens to the right of its anchor,\n * centered on it or aligned with its bottom edge, and flips or clamps to stay\n * in the viewport. With `beside`, it opens right of that region, such as a list\n * column, top-aligned with the anchor and clamped into `within` (default: the\n * viewport); when the card does not fit there, it does not open at all.\n */\nexport type HoverPreviewPlacement =\n | { align?: \"center\" | \"end\" }\n | { beside: () => HTMLElement | null | undefined; within?: () => HTMLElement | null | undefined };\n\nexport type HoverPreviewOptions<T> = {\n /** Milliseconds a resting mouse waits on an anchor before the card opens. Defaults to 250. */\n openDelay?: number;\n /**\n * How keyboard users open the card: `\"space\"` (default) toggles it with Space\n * on the focused anchor and leaves focus there; `\"focus\"` opens it after the\n * open delay whenever an anchor receives focus.\n */\n keyboard?: \"space\" | \"focus\";\n placement?: HoverPreviewPlacement;\n /** Anchors whose value is disabled open no card; an open card closes once its value becomes disabled. */\n disabled?: (value: T) => boolean;\n /** Runs whenever the card opens or closes, including light dismissal by the browser. */\n onOpenChange?: (open: boolean) => void;\n};\n\nexport type HoverPreviewController<T> = {\n /** Id of the card element, for `aria-controls`. */\n readonly id: string;\n /**\n * Registers an anchor element for `value`; use the result as a `ref`.\n * `trigger` is the control that toggles the card for this anchor; Escape\n * returns focus there when focus is inside the card. Defaults to the anchor.\n */\n anchor: (value: T, trigger?: () => HTMLElement | null | undefined) => (element: HTMLElement) => void;\n /** The value whose card is open, or `undefined` while closed. */\n active: Accessor<T | undefined>;\n /** Opens the card for `value` at once and moves focus into it, or closes it when it is already pinned open. */\n toggle: (value: T) => void;\n /** Closes the card; it reopens for the same anchor only after the pointer left it. */\n close: () => void;\n /** Wiring for `<HoverPreview>`; not part of the public contract. */\n readonly [INTERNALS]: Internals<T>;\n};\n\ntype Anchor<T> = { value: T; element: HTMLElement; trigger?: () => HTMLElement | null | undefined };\n\ntype Internals<T> = {\n current: Accessor<Anchor<T> | undefined>;\n bind: (surface: HTMLElement) => void;\n enterSurface: () => void;\n leave: () => void;\n focusOut: (event: FocusEvent) => void;\n toggled: (open: boolean) => void;\n};\n\n/** Elements that use Space themselves; Space on them never toggles the card. */\nconst OWNS_SPACE = [\n \"button, input, select, textarea, summary, [contenteditable]:not([contenteditable='false'])\",\n ...[\"button\", \"checkbox\", \"switch\", \"radio\", \"option\", \"menuitem\", \"menuitemcheckbox\", \"menuitemradio\", \"tab\", \"treeitem\"].map(\n (role) => `[role='${role}']`,\n ),\n].join(\", \");\n\n/** Open light-dismiss popovers, such as a menu or a date picker, close when another one opens. */\nconst AUTO_POPOVER = \":is([popover=''], [popover='auto' i]):popover-open\";\n\n/**\n * Creates the behavior of one hover preview card shared by a group of anchors,\n * such as the rows of a list. Render the card with `<HoverPreview preview={…}>`.\n */\nexport function createHoverPreview<T>(options: HoverPreviewOptions<T> = {}): HoverPreviewController<T> {\n const id = `k2b-hover-preview-${createUniqueId()}`;\n const anchors = new Set<Anchor<T>>();\n const [current, setCurrent] = createSignal<Anchor<T>>();\n const [open, setOpen] = createSignal(false);\n let surface: HTMLElement | undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n /** The anchor whose open delay runs while the card is closed. */\n let pending: Anchor<T> | undefined;\n /** The anchor that Space or `toggle()` opened the card for; only it outlasts the pointer leaving. */\n let pinned: Anchor<T> | undefined;\n let dismissed: Anchor<T> | undefined;\n let ring = true;\n let observer: ResizeObserver | undefined;\n\n const placement = (): HoverPreviewPlacement => options.placement ?? {};\n const region = () => {\n const value = placement();\n return \"beside\" in value ? value : undefined;\n };\n const focusTarget = (anchor: Anchor<T>) => anchor.trigger?.() ?? anchor.element;\n const anchorOf = (node: Node) => [...anchors].find((anchor) => anchor.element.contains(node));\n const clear = () => {\n clearTimeout(timer);\n timer = undefined;\n if (pending && !open()) document.removeEventListener(\"keydown\", escape);\n pending = undefined;\n };\n /** A passive card never closes a menu or another popover someone opened on purpose. */\n const blocked = () =>\n [...document.querySelectorAll(AUTO_POPOVER)].some((popover) => popover !== surface && !(surface && popover.contains(surface)));\n\n /** The boundary rectangle, never larger than the viewport. */\n const bounds = (within: Element | null | undefined) => {\n const rect = within?.getBoundingClientRect();\n return {\n top: Math.max(0, rect?.top ?? 0),\n right: Math.min(window.innerWidth, rect?.right ?? window.innerWidth),\n bottom: Math.min(window.innerHeight, rect?.bottom ?? window.innerHeight),\n };\n };\n /** Room right of the region for the card plus a gap on both sides. Works while the card is hidden. */\n const hasRoom = () => {\n const beside = region();\n if (!beside || !surface) return true;\n const area = beside.beside()?.getBoundingClientRect();\n if (!area) return false;\n const width = surface.getBoundingClientRect().width || Number.parseFloat(getComputedStyle(surface).width) || 0;\n return bounds(beside.within?.()).right - area.right >= width + 2 * GAP;\n };\n const position = () => {\n const anchor = current();\n if (!surface || !anchor) return;\n const beside = region();\n if (beside) {\n const area = beside.beside()?.getBoundingClientRect() ?? anchor.element.getBoundingClientRect();\n const box = bounds(beside.within?.());\n const height = surface.getBoundingClientRect().height;\n const top = anchor.element.getBoundingClientRect().top;\n surface.style.left = `${Math.round(area.right + GAP)}px`;\n surface.style.top = `${Math.round(Math.max(box.top + GAP, Math.min(top, box.bottom - height - GAP)))}px`;\n return;\n }\n positionTooltipSurface(surface, anchor.element, \"right\");\n const value = placement();\n if (!(\"beside\" in value) && value.align === \"end\") {\n const height = surface.getBoundingClientRect().height;\n const bottom = anchor.element.getBoundingClientRect().bottom;\n surface.style.top = `${Math.round(Math.max(8, Math.min(bottom - height, window.innerHeight - height - 8)))}px`;\n }\n };\n\n const escape = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\") return;\n if (!open()) {\n // Escape during the open delay works as if the card had opened and closed.\n if (pending) dismissed = pending;\n clear();\n return;\n }\n // Focus in the card goes back to the trigger: handled here, so the browser\n // neither returns it itself nor lights the ring for this key. A card the\n // pointer opened leaves the key to other handlers, such as an open modeless dialog.\n if (surface?.contains(document.activeElement)) event.preventDefault();\n dismiss();\n };\n // A card beside a region belongs to a row of a scrolling list: once the list\n // scrolls, another row sits under the pointer, so the card closes. A card\n // beside its anchor follows it.\n const scroll = (event: Event) => {\n const target = event.target;\n if (!region()) return position();\n if (!(target instanceof Node) || surface?.contains(target)) return;\n const anchor = current();\n if (!anchor || target.contains(anchor.element)) hide();\n };\n const resize = () => {\n if (hasRoom()) position();\n else hide();\n };\n const listen = (on: boolean) => {\n if (on) {\n document.addEventListener(\"keydown\", escape);\n window.addEventListener(\"scroll\", scroll, true);\n window.addEventListener(\"resize\", resize);\n return;\n }\n document.removeEventListener(\"keydown\", escape);\n window.removeEventListener(\"scroll\", scroll, true);\n window.removeEventListener(\"resize\", resize);\n };\n\n const hide = () => {\n clear();\n pinned = undefined;\n if (!open()) return;\n setOpen(false);\n listen(false);\n try {\n surface?.hidePopover();\n } catch {\n // The card may already be disconnected during cleanup.\n }\n };\n const dismiss = () => {\n const anchor = current();\n dismissed = anchor;\n // Before hiding, so the popover does not return focus on its own.\n if (anchor && surface?.contains(document.activeElement)) returnFocus(focusTarget(anchor), ring);\n hide();\n };\n /**\n * Opens the card for `anchor` or moves it there; `pin` keeps it open after\n * the pointer leaves. Moving the card to another anchor drops an earlier pin.\n * Returns whether it is open for `anchor`.\n */\n const show = (anchor: Anchor<T>, pin: boolean): boolean => {\n clear();\n if (!surface || dismissed === anchor) return false;\n if (options.disabled?.(anchor.value) || !hasRoom()) {\n hide();\n return false;\n }\n if (!open() || current() !== anchor) {\n ring = ringOnReturn(focusTarget(anchor));\n setCurrent(anchor);\n if (!open()) {\n try {\n surface.showPopover();\n } catch {\n return false;\n }\n setOpen(true);\n listen(true);\n }\n position();\n pinned = undefined;\n }\n if (pin) pinned = anchor;\n return true;\n };\n /** Shows `anchor` after `delay`; a keyboard swap (`follow`) carries an existing pin along. */\n const schedule = (anchor: Anchor<T>, delay: number, follow = false) => {\n clear();\n if (!open()) {\n pending = anchor;\n document.addEventListener(\"keydown\", escape);\n }\n timer = setTimeout(() => {\n if (open()) show(anchor, follow && pinned !== undefined);\n else if (blocked()) clear();\n else show(anchor, false);\n }, delay);\n };\n const leave = () => {\n clear();\n dismissed = undefined;\n if (pinned && pinned === current()) return;\n timer = setTimeout(() => {\n // Focus holds the card open inside it, and on the anchor where focus opens it.\n const focused = document.activeElement;\n const held = surface?.contains(focused) || (options.keyboard === \"focus\" && current()?.element.contains(focused));\n if (!held) hide();\n }, CLOSE_DELAY);\n };\n const focusOut = (event: FocusEvent) => {\n const next = event.relatedTarget;\n if (next instanceof Node && (surface?.contains(next) || anchorOf(next))) return;\n pinned = undefined;\n leave();\n };\n\n createEffect(() => {\n const anchor = current();\n if (open() && anchor && options.disabled?.(anchor.value)) hide();\n });\n // Only an open card holds global listeners, so a server render that\n // disposes the controller touches no browser globals.\n onCleanup(() => {\n hide();\n observer?.disconnect();\n });\n\n const anchor =\n (value: T, trigger?: () => HTMLElement | null | undefined) =>\n (element: HTMLElement): void => {\n const entry: Anchor<T> = { value, element, trigger };\n anchors.add(entry);\n const pointerEnter = (event: PointerEvent) => {\n // Touch and pen have no resting hover; the card stays a mouse affordance.\n if (event.pointerType !== \"mouse\") return;\n clear();\n if ((open() && current() === entry) || dismissed === entry) return;\n schedule(entry, open() ? SWAP_DELAY : (options.openDelay ?? 250));\n };\n // The open delay counts from the moment the mouse rests. An open card\n // swaps on entering another anchor and ignores movement inside it.\n const pointerMove = (event: PointerEvent) => {\n if (event.pointerType === \"mouse\" && !open() && dismissed !== entry) schedule(entry, options.openDelay ?? 250);\n };\n // A press acts on the row, such as opening it or its menu; a card about to open stays closed.\n const pointerDown = () => clear();\n const focusIn = () => {\n if (open()) {\n if (current() === entry) clear();\n else schedule(entry, SWAP_DELAY, true);\n return;\n }\n clear();\n if (options.keyboard === \"focus\" && dismissed !== entry) schedule(entry, options.openDelay ?? 250);\n };\n const keyDown = (event: KeyboardEvent) => {\n if (options.keyboard === \"focus\" || event.key !== \" \" || event.defaultPrevented) return;\n // Shift+Space keeps scrolling up; other modifiers belong to shortcuts.\n if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) return;\n if (event.target instanceof Element && event.target.matches(OWNS_SPACE)) return;\n event.preventDefault();\n // A held key toggles once; its repeats only keep the page from scrolling.\n if (event.repeat) return;\n if (open() && current() === entry) {\n dismiss();\n return;\n }\n dismissed = undefined;\n show(entry, true);\n };\n element.addEventListener(\"pointerenter\", pointerEnter);\n element.addEventListener(\"pointermove\", pointerMove);\n element.addEventListener(\"pointerdown\", pointerDown);\n element.addEventListener(\"pointerleave\", leave);\n element.addEventListener(\"focusin\", focusIn);\n element.addEventListener(\"focusout\", focusOut);\n element.addEventListener(\"keydown\", keyDown);\n onCleanup(() => {\n anchors.delete(entry);\n if (current() === entry) hide();\n element.removeEventListener(\"pointerenter\", pointerEnter);\n element.removeEventListener(\"pointermove\", pointerMove);\n element.removeEventListener(\"pointerdown\", pointerDown);\n element.removeEventListener(\"pointerleave\", leave);\n element.removeEventListener(\"focusin\", focusIn);\n element.removeEventListener(\"focusout\", focusOut);\n element.removeEventListener(\"keydown\", keyDown);\n });\n };\n\n return {\n id,\n anchor,\n active: () => (open() ? current()?.value : undefined),\n toggle: (value) => {\n const entry = [...anchors].find((candidate) => candidate.value === value);\n if (!entry || !surface) return;\n clear();\n if (open() && pinned === entry && current() === entry) {\n dismiss();\n return;\n }\n // A hover may have opened the card before this click or key press pinned it.\n ring = ringOnReturn(focusTarget(entry));\n dismissed = undefined;\n if (show(entry, true)) surface.focus();\n },\n close: dismiss,\n [INTERNALS]: {\n current,\n bind: (element) => {\n surface = element;\n observer = new ResizeObserver(() => {\n if (open()) position();\n });\n observer.observe(element);\n },\n enterSurface: clear,\n leave,\n focusOut,\n toggled: (visible) => {\n if (!visible) {\n // Light dismissal by the browser: an outside click or another popover.\n clear();\n pinned = undefined;\n if (open()) {\n setOpen(false);\n listen(false);\n }\n }\n options.onOpenChange?.(visible);\n },\n },\n };\n}\n\nexport type HoverPreviewProps<T> = {\n preview: HoverPreviewController<T>;\n /** Accessible name of the card. */\n label: string;\n /** `\"content\"` (default) sizes the card to its content up to 32rem; `\"fixed\"` keeps one 22rem × 20rem box for every anchor. */\n size?: \"content\" | \"fixed\";\n class?: string;\n /** Plain content stays mounted while the card is closed; a function renders the open anchor's value. */\n children: JSX.Element | ((value: T) => JSX.Element);\n};\n\n/**\n * A non-modal card that opens beside the anchor a resting mouse points at.\n * Native popover owns the top layer and light dismissal.\n */\nexport function HoverPreview<T>(props: HoverPreviewProps<T>): JSX.Element {\n const state = props.preview[INTERNALS];\n let surface!: HTMLDivElement;\n onMount(() => state.bind(surface));\n const content = () => {\n const children = props.children;\n if (typeof children !== \"function\") return children;\n return (\n <Show when={state.current()} keyed>\n {(anchor) => children(anchor.value)}\n </Show>\n );\n };\n return (\n <div\n ref={surface}\n id={props.preview.id}\n popover=\"auto\"\n role=\"dialog\"\n aria-label={props.label}\n tabIndex={-1}\n class={props.class ? `k2b-hover-preview ${props.class}` : \"k2b-hover-preview\"}\n data-size={props.size ?? \"content\"}\n onPointerEnter={() => state.enterSurface()}\n onPointerLeave={() => state.leave()}\n on:focusout={(event) => state.focusOut(event)}\n onToggle={(event) => state.toggled(event.newState === \"open\")}\n >\n {content()}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAwB,YAAY,EAAE,YAAY,EAAE,cAAc,EAAY,SAAS,EAAE,OAAO,EAAE,IAAI,QAAQ,UAAU;AACxH,SAAS,WAAW,EAAE,YAAY,QAAQ,0BAA0B;AACpE,SAAS,sBAAsB,QAAQ,oBAAoB;;AAE3D;AACA,MAAM,UAAU,GAAG,EAAE;AACrB;AACA,MAAM,WAAW,GAAG,GAAG;AACvB;AACA,MAAM,GAAG,GAAG,CAAC;AACb;AACA,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAmDA;AACA,MAAM,UAAU,GAAG,CACjB,4FAA4F,EAC5F,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,GAAG,CAC3H,IAAI,IAAK,UAAU,IAAI,IAC1B,CAAC,CACF,CAAC,IAAI,CAAC,IAAI,CAAC;;AAEZ;AACA,MAAM,YAAY,GAAG,oDAAoD;;AAEzE;AACA;AACA;AACA;AACA,OAAO,SAAS,kBAAkB,CAAI,OAA+B,GAAG,CAAC,CAAC,EAA6B;EACrG,MAAM,EAAE,GAAG,qBAAqB,cAAc,CAAC,CAAC,EAAE;EAClD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAY,CAAC;EACpC,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AO,CAAC,CAAC;MAAA;MAAE,KAAK;MAAA,UAC9B,MAAM,IAAK,QAAQ,CAAC,MAAM,CAAC,KAAK;IAAC;EAGzC,CAAC;EACD;IAAA;IAAA,gCAae,KAAK,IAAK,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC;IAAA,qCAD/C,KAAK,IAAK,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;IAAA,sCAD7B,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;IAAA,sCADnB,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;IAAA,YARrC,OAAO;IAAA,mDAAP,OAAO;IAAA,eAaX,OAAO;IAAA;MAAA,UAZJ,KAAK,CAAC,OAAO,CAAC,EAAE;QAAA,OAGR,KAAK,CAAC,KAAK;QAAA,OAEhB,KAAK,CAAC,KAAK,GAAG,qBAAqB,KAAK,CAAC,KAAK,EAAE,GAAG,mBAAmB;QAAA,OAClE,KAAK,CAAC,IAAI,IAAI,SAAS;MAAA;MAAA;MAAA;MAAA;MAAA;IAAA;MAAA;MAAA;MAAA;MAAA;IAAA;IAAA;EAAA;AASxC","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["feedback/HoverPreview.tsx"],"sourcesContent":["import { type Accessor, createEffect, createSignal, createUniqueId, type JSX, onCleanup, onMount, Show } from \"solid-js\";\nimport { returnFocus, ringOnReturn } from \"../internal/focus-return\";\nimport { positionTooltipSurface } from \"./tooltip-position\";\n\n/** A resting pointer moving from one anchor to another swaps the card this fast. */\nconst SWAP_DELAY = 90;\n/** Grace period for the pointer to travel from an anchor into the card. */\nconst CLOSE_DELAY = 180;\n/** Distance to the region and to the boundary edges. */\nconst GAP = 8;\n/** Keys the wiring between a controller and its `<HoverPreview>`. */\nconst INTERNALS = Symbol(\"k2b-hover-preview\");\n\n/**\n * Where the card opens. By default it opens to the right of its anchor,\n * centered on it or aligned with its bottom edge, and flips or clamps to stay\n * in the viewport. With `beside`, it opens right of that region, such as a list\n * column, top-aligned with the anchor and clamped into `within` (default: the\n * viewport); when the card does not fit there, it does not open at all.\n */\nexport type HoverPreviewPlacement =\n | { align?: \"center\" | \"end\" }\n | { beside: () => HTMLElement | null | undefined; within?: () => HTMLElement | null | undefined };\n\nexport type HoverPreviewOptions<T> = {\n /** Milliseconds a resting mouse waits on an anchor before the card opens. Defaults to 250. */\n openDelay?: number;\n /**\n * How keyboard users open the card: `\"space\"` (default) toggles it with Space\n * on the focused anchor and leaves focus there; `\"focus\"` opens it after the\n * open delay whenever an anchor receives focus.\n */\n keyboard?: \"space\" | \"focus\";\n placement?: HoverPreviewPlacement;\n /** Anchors whose value is disabled open no card; an open card closes once its value becomes disabled. */\n disabled?: (value: T) => boolean;\n /** Runs whenever the card opens or closes, including light dismissal by the browser. */\n onOpenChange?: (open: boolean) => void;\n};\n\nexport type HoverPreviewController<T> = {\n /** Id of the card element, for `aria-controls`. */\n readonly id: string;\n /**\n * Registers an anchor element for `value`; use the result as a `ref`.\n * `trigger` is the control that toggles the card for this anchor; Escape\n * returns focus there when focus is inside the card. Defaults to the anchor.\n */\n anchor: (value: T, trigger?: () => HTMLElement | null | undefined) => (element: HTMLElement) => void;\n /** The value whose card is open, or `undefined` while closed. */\n active: Accessor<T | undefined>;\n /** Opens the card for `value` at once and moves focus into it, or closes it when it is already pinned open. */\n toggle: (value: T) => void;\n /** Closes the card; it reopens for the same anchor only after the pointer left it. */\n close: () => void;\n /** Wiring for `<HoverPreview>`; not part of the public contract. */\n readonly [INTERNALS]: Internals<T>;\n};\n\ntype Anchor<T> = { value: T; element: HTMLElement; trigger?: () => HTMLElement | null | undefined };\n\ntype Internals<T> = {\n current: Accessor<Anchor<T> | undefined>;\n bind: (surface: HTMLElement) => void;\n enterSurface: () => void;\n leave: () => void;\n focusOut: (event: FocusEvent) => void;\n toggled: (open: boolean) => void;\n};\n\n/** Elements that use Space themselves; Space on them never toggles the card. */\nconst OWNS_SPACE = [\n \"button, input, select, textarea, summary, [contenteditable]:not([contenteditable='false'])\",\n ...[\"button\", \"checkbox\", \"switch\", \"radio\", \"option\", \"menuitem\", \"menuitemcheckbox\", \"menuitemradio\", \"tab\", \"treeitem\"].map(\n (role) => `[role='${role}']`,\n ),\n].join(\", \");\n\n/** Open light-dismiss popovers, such as a menu or a date picker, close when another one opens. */\nconst AUTO_POPOVER = \":is([popover=''], [popover='auto' i]):popover-open\";\n\n/**\n * Creates the behavior of one hover preview card shared by a group of anchors,\n * such as the rows of a list. Render the card with `<HoverPreview preview={…}>`.\n */\nexport function createHoverPreview<T>(options: HoverPreviewOptions<T> = {}): HoverPreviewController<T> {\n const id = `k2b-hover-preview-${createUniqueId()}`;\n const anchors = new Set<Anchor<T>>();\n const [current, setCurrent] = createSignal<Anchor<T>>();\n const [open, setOpen] = createSignal(false);\n let surface: HTMLElement | undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n /** The anchor whose open delay runs while the card is closed. */\n let pending: Anchor<T> | undefined;\n /** The anchor that Space or `toggle()` opened the card for; only it outlasts the pointer leaving. */\n let pinned: Anchor<T> | undefined;\n let dismissed: Anchor<T> | undefined;\n let ring = true;\n let observer: ResizeObserver | undefined;\n\n const placement = (): HoverPreviewPlacement => options.placement ?? {};\n const region = () => {\n const value = placement();\n return \"beside\" in value ? value : undefined;\n };\n const focusTarget = (anchor: Anchor<T>) => anchor.trigger?.() ?? anchor.element;\n const anchorOf = (node: Node) => [...anchors].find((anchor) => anchor.element.contains(node));\n const clear = () => {\n clearTimeout(timer);\n timer = undefined;\n if (pending && !open()) document.removeEventListener(\"keydown\", escape);\n pending = undefined;\n };\n /** A passive card never closes a menu or another popover someone opened on purpose. */\n const blocked = () =>\n [...document.querySelectorAll(AUTO_POPOVER)].some((popover) => popover !== surface && !(surface && popover.contains(surface)));\n\n /** The boundary rectangle, never larger than the viewport. */\n const bounds = (within: Element | null | undefined) => {\n const rect = within?.getBoundingClientRect();\n return {\n top: Math.max(0, rect?.top ?? 0),\n right: Math.min(window.innerWidth, rect?.right ?? window.innerWidth),\n bottom: Math.min(window.innerHeight, rect?.bottom ?? window.innerHeight),\n };\n };\n /** Room right of the region for the card plus a gap on both sides. Works while the card is hidden. */\n const hasRoom = () => {\n const beside = region();\n if (!beside || !surface) return true;\n const area = beside.beside()?.getBoundingClientRect();\n if (!area) return false;\n const width = surface.getBoundingClientRect().width || Number.parseFloat(getComputedStyle(surface).width) || 0;\n return bounds(beside.within?.()).right - area.right >= width + 2 * GAP;\n };\n const position = () => {\n const anchor = current();\n if (!surface || !anchor) return;\n const beside = region();\n if (beside) {\n const area = beside.beside()?.getBoundingClientRect() ?? anchor.element.getBoundingClientRect();\n const box = bounds(beside.within?.());\n const height = surface.getBoundingClientRect().height;\n const top = anchor.element.getBoundingClientRect().top;\n surface.style.left = `${Math.round(area.right + GAP)}px`;\n surface.style.top = `${Math.round(Math.max(box.top + GAP, Math.min(top, box.bottom - height - GAP)))}px`;\n return;\n }\n positionTooltipSurface(surface, anchor.element, \"right\");\n const value = placement();\n if (!(\"beside\" in value) && value.align === \"end\") {\n const height = surface.getBoundingClientRect().height;\n const bottom = anchor.element.getBoundingClientRect().bottom;\n surface.style.top = `${Math.round(Math.max(8, Math.min(bottom - height, window.innerHeight - height - 8)))}px`;\n }\n };\n\n const escape = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\") return;\n if (!open()) {\n // Escape during the open delay works as if the card had opened and closed.\n if (pending) dismissed = pending;\n clear();\n return;\n }\n // Focus in the card goes back to the trigger: handled here, so the browser\n // neither returns it itself nor lights the ring for this key. A card the\n // pointer opened leaves the key to other handlers, such as an open modeless dialog.\n if (surface?.contains(document.activeElement)) event.preventDefault();\n dismiss();\n };\n // A card beside a region belongs to a row of a scrolling list: once the list\n // scrolls, another row sits under the pointer, so the card closes. A card\n // beside its anchor follows it.\n const scroll = (event: Event) => {\n const target = event.target;\n if (!region()) return position();\n if (!(target instanceof Node) || surface?.contains(target)) return;\n const anchor = current();\n if (!anchor || target.contains(anchor.element)) hide();\n };\n const resize = () => {\n if (hasRoom()) position();\n else hide();\n };\n const listen = (on: boolean) => {\n if (on) {\n document.addEventListener(\"keydown\", escape);\n window.addEventListener(\"scroll\", scroll, true);\n window.addEventListener(\"resize\", resize);\n return;\n }\n document.removeEventListener(\"keydown\", escape);\n window.removeEventListener(\"scroll\", scroll, true);\n window.removeEventListener(\"resize\", resize);\n };\n\n const hide = () => {\n clear();\n pinned = undefined;\n if (!open()) return;\n setOpen(false);\n listen(false);\n try {\n surface?.hidePopover();\n } catch {\n // The card may already be disconnected during cleanup.\n }\n };\n const dismiss = () => {\n const anchor = current();\n dismissed = anchor;\n // Before hiding, so the popover does not return focus on its own.\n if (anchor && surface?.contains(document.activeElement)) returnFocus(focusTarget(anchor), ring);\n hide();\n };\n /**\n * Opens the card for `anchor` or moves it there; `pin` keeps it open after\n * the pointer leaves. Moving the card to another anchor drops an earlier pin.\n * Returns whether it is open for `anchor`.\n */\n const show = (anchor: Anchor<T>, pin: boolean): boolean => {\n clear();\n if (!surface || dismissed === anchor) return false;\n if (options.disabled?.(anchor.value) || !hasRoom()) {\n hide();\n return false;\n }\n if (!open() || current() !== anchor) {\n ring = ringOnReturn(focusTarget(anchor));\n setCurrent(anchor);\n if (!open()) {\n try {\n surface.showPopover();\n } catch {\n return false;\n }\n setOpen(true);\n listen(true);\n }\n position();\n pinned = undefined;\n }\n if (pin) pinned = anchor;\n return true;\n };\n /** Shows `anchor` after `delay`; a keyboard swap (`follow`) carries an existing pin along. */\n const schedule = (anchor: Anchor<T>, delay: number, follow = false) => {\n clear();\n if (!open()) {\n pending = anchor;\n document.addEventListener(\"keydown\", escape);\n }\n timer = setTimeout(() => {\n if (open()) show(anchor, follow && pinned !== undefined);\n else if (blocked()) clear();\n else show(anchor, false);\n }, delay);\n };\n const leave = () => {\n clear();\n dismissed = undefined;\n if (pinned && pinned === current()) return;\n timer = setTimeout(() => {\n // Focus holds the card open inside it, and on the anchor where focus opens it.\n const focused = document.activeElement;\n const held = surface?.contains(focused) || (options.keyboard === \"focus\" && current()?.element.contains(focused));\n if (!held) hide();\n }, CLOSE_DELAY);\n };\n const focusOut = (event: FocusEvent) => {\n const next = event.relatedTarget;\n if (next instanceof Node && (surface?.contains(next) || anchorOf(next))) return;\n pinned = undefined;\n leave();\n };\n\n createEffect(() => {\n const anchor = current();\n if (open() && anchor && options.disabled?.(anchor.value)) hide();\n });\n // Only an open card holds global listeners, so a server render that\n // disposes the controller touches no browser globals.\n onCleanup(() => {\n hide();\n observer?.disconnect();\n });\n\n const anchor =\n (value: T, trigger?: () => HTMLElement | null | undefined) =>\n (element: HTMLElement): void => {\n const entry: Anchor<T> = { value, element, trigger };\n anchors.add(entry);\n const pointerEnter = (event: PointerEvent) => {\n // Touch and pen have no resting hover; the card stays a mouse affordance.\n if (event.pointerType !== \"mouse\") return;\n clear();\n if ((open() && current() === entry) || dismissed === entry) return;\n schedule(entry, open() ? SWAP_DELAY : (options.openDelay ?? 250));\n };\n // The open delay counts from the moment the mouse rests. An open card\n // swaps on entering another anchor and ignores movement inside it.\n const pointerMove = (event: PointerEvent) => {\n if (event.pointerType === \"mouse\" && !open() && dismissed !== entry) schedule(entry, options.openDelay ?? 250);\n };\n // A press acts on the row, such as opening it or its menu; a card about to open stays closed.\n const pointerDown = () => clear();\n const focusIn = () => {\n if (open()) {\n if (current() === entry) clear();\n else schedule(entry, SWAP_DELAY, true);\n return;\n }\n clear();\n if (options.keyboard === \"focus\" && dismissed !== entry) schedule(entry, options.openDelay ?? 250);\n };\n const keyDown = (event: KeyboardEvent) => {\n if (options.keyboard === \"focus\" || event.key !== \" \" || event.defaultPrevented) return;\n // Shift+Space keeps scrolling up; other modifiers belong to shortcuts.\n if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) return;\n if (event.target instanceof Element && event.target.matches(OWNS_SPACE)) return;\n event.preventDefault();\n // A held key toggles once; its repeats only keep the page from scrolling.\n if (event.repeat) return;\n if (open() && current() === entry) {\n dismiss();\n return;\n }\n dismissed = undefined;\n show(entry, true);\n };\n element.addEventListener(\"pointerenter\", pointerEnter);\n element.addEventListener(\"pointermove\", pointerMove);\n element.addEventListener(\"pointerdown\", pointerDown);\n element.addEventListener(\"pointerleave\", leave);\n element.addEventListener(\"focusin\", focusIn);\n element.addEventListener(\"focusout\", focusOut);\n element.addEventListener(\"keydown\", keyDown);\n onCleanup(() => {\n anchors.delete(entry);\n if (current() === entry) hide();\n element.removeEventListener(\"pointerenter\", pointerEnter);\n element.removeEventListener(\"pointermove\", pointerMove);\n element.removeEventListener(\"pointerdown\", pointerDown);\n element.removeEventListener(\"pointerleave\", leave);\n element.removeEventListener(\"focusin\", focusIn);\n element.removeEventListener(\"focusout\", focusOut);\n element.removeEventListener(\"keydown\", keyDown);\n });\n };\n\n return {\n id,\n anchor,\n active: () => (open() ? current()?.value : undefined),\n toggle: (value) => {\n const entry = [...anchors].find((candidate) => candidate.value === value);\n if (!entry || !surface) return;\n clear();\n if (open() && pinned === entry && current() === entry) {\n dismiss();\n return;\n }\n // A hover may have opened the card before this click or key press pinned it.\n ring = ringOnReturn(focusTarget(entry));\n dismissed = undefined;\n if (show(entry, true)) surface.focus();\n },\n close: dismiss,\n [INTERNALS]: {\n current,\n bind: (element) => {\n surface = element;\n observer = new ResizeObserver(() => {\n if (open()) position();\n });\n observer.observe(element);\n },\n enterSurface: clear,\n leave,\n focusOut,\n toggled: (visible) => {\n // Light dismissal by the browser: an outside click or another popover.\n // The event of a close this controller made itself arrives later, when\n // the pointer may already wait on the next anchor; that delay stays.\n if (!visible && open()) {\n clear();\n pinned = undefined;\n setOpen(false);\n listen(false);\n }\n options.onOpenChange?.(visible);\n },\n },\n };\n}\n\nexport type HoverPreviewProps<T> = {\n preview: HoverPreviewController<T>;\n /** Accessible name of the card. */\n label: string;\n /** `\"content\"` (default) sizes the card to its content up to 32rem; `\"fixed\"` keeps one 22rem × 20rem box for every anchor. */\n size?: \"content\" | \"fixed\";\n class?: string;\n /** Plain content stays mounted while the card is closed; a function renders the open anchor's value. */\n children: JSX.Element | ((value: T) => JSX.Element);\n};\n\n/**\n * A non-modal card that opens beside the anchor a resting mouse points at.\n * Native popover owns the top layer and light dismissal.\n */\nexport function HoverPreview<T>(props: HoverPreviewProps<T>): JSX.Element {\n const state = props.preview[INTERNALS];\n let surface!: HTMLDivElement;\n onMount(() => state.bind(surface));\n const content = () => {\n const children = props.children;\n if (typeof children !== \"function\") return children;\n return (\n <Show when={state.current()} keyed>\n {(anchor) => children(anchor.value)}\n </Show>\n );\n };\n return (\n <div\n ref={surface}\n id={props.preview.id}\n popover=\"auto\"\n role=\"dialog\"\n aria-label={props.label}\n tabIndex={-1}\n class={props.class ? `k2b-hover-preview ${props.class}` : \"k2b-hover-preview\"}\n data-size={props.size ?? \"content\"}\n onPointerEnter={() => state.enterSurface()}\n onPointerLeave={() => state.leave()}\n on:focusout={(event) => state.focusOut(event)}\n onToggle={(event) => state.toggled(event.newState === \"open\")}\n >\n {content()}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAwB,YAAY,EAAE,YAAY,EAAE,cAAc,EAAY,SAAS,EAAE,OAAO,EAAE,IAAI,QAAQ,UAAU;AACxH,SAAS,WAAW,EAAE,YAAY,QAAQ,0BAA0B;AACpE,SAAS,sBAAsB,QAAQ,oBAAoB;;AAE3D;AACA,MAAM,UAAU,GAAG,EAAE;AACrB;AACA,MAAM,WAAW,GAAG,GAAG;AACvB;AACA,MAAM,GAAG,GAAG,CAAC;AACb;AACA,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAmDA;AACA,MAAM,UAAU,GAAG,CACjB,4FAA4F,EAC5F,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,GAAG,CAC3H,IAAI,IAAK,UAAU,IAAI,IAC1B,C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,OAAwB;EAC5B,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;EAClC,MAAM,OAAO,GAAG,MAAM;IACpB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ;IAC/B,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,OAAO,QAAQ;IACnD,yBACG,IAAI;MAAA,IAAC,IAAI;QAAA,OAAE,KAAK,CAAC,OAAO,CAAC,CAAC;MAAA;MAAE,KAAK;MAAA,UAC9B,MAAM,IAAK,QAAQ,CAAC,MAAM,CAAC,KAAK;IAAC;EAGzC,CAAC;EACD;IAAA;IAAA,gCAae,KAAK,IAAK,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC;IAAA,qCAD/C,KAAK,IAAK,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;IAAA,sCAD7B,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;IAAA,sCADnB,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;IAAA,YARrC,OAAO;IAAA,mDAAP,OAAO;IAAA,eAaX,OAAO;IAAA;MAAA,UAZJ,KAAK,CAAC,OAAO,CAAC,EAAE;QAAA,OAGR,KAAK,CAAC,KAAK;QAAA,OAEhB,KAAK,CAAC,KAAK,GAAG,qBAAqB,KAAK,CAAC,KAAK,EAAE,GAAG,mBAAmB;QAAA,OAClE,KAAK,CAAC,IAAI,IAAI,SAAS;MAAA;MAAA;MAAA;MAAA;MAAA;IAAA;MAAA;MAAA;MAAA;MAAA;IAAA;IAAA;EAAA;AASxC","ignoreList":[]}
@@ -21,7 +21,7 @@ var _tmpl$ = /*#__PURE__*/_$template(`<button type=button class=k2b-app-workspac
21
21
  _tmpl$3 = /*#__PURE__*/_$template(`<div class=k2b-app-workspace__main-primary data-workspace-main-region=main>`),
22
22
  _tmpl$4 = /*#__PURE__*/_$template(`<section>`),
23
23
  _tmpl$5 = /*#__PURE__*/_$template(`<aside>`),
24
- _tmpl$6 = /*#__PURE__*/_$template(`<aside><div class=k2b-app-workspace__sidebar-desktop>`),
24
+ _tmpl$6 = /*#__PURE__*/_$template(`<div class=k2b-app-workspace__sidebar-desktop>`),
25
25
  _tmpl$7 = /*#__PURE__*/_$template(`<script>`),
26
26
  _tmpl$8 = /*#__PURE__*/_$template(`<footer>`),
27
27
  _tmpl$9 = /*#__PURE__*/_$template(`<span aria-hidden=true><i>`),
@@ -57,7 +57,7 @@ var _tmpl$ = /*#__PURE__*/_$template(`<button type=button class=k2b-app-workspac
57
57
  import { Link } from "@k2b/ssr/nav";
58
58
  import { children, createContext, createMemo, createSignal, createUniqueId, For, mergeProps, onCleanup, onMount, Show, useContext } from "solid-js";
59
59
  import { useUiMessages } from "../intl/messages";
60
- import { installAppWorkspaceController } from "./app-workspace-controller";
60
+ import { APP_WORKSPACE_SIDEBAR_HIDE_EVENT, installAppWorkspaceController } from "./app-workspace-controller";
61
61
  import { APP_WORKSPACE_DETAIL_DEFAULT, APP_WORKSPACE_DETAIL_MAX, APP_WORKSPACE_DETAIL_MIN, APP_WORKSPACE_DRAWER_DEFAULT, APP_WORKSPACE_DRAWER_MAX, APP_WORKSPACE_DRAWER_MIN, APP_WORKSPACE_PANE_DEFAULT, APP_WORKSPACE_PANE_MAX, APP_WORKSPACE_PANE_MIN, APP_WORKSPACE_SIDEBAR_COLLAPSED, APP_WORKSPACE_SIDEBAR_DEFAULT, APP_WORKSPACE_SIDEBAR_MAX, APP_WORKSPACE_SIDEBAR_MIN, appWorkspaceLayoutStyle, appWorkspacePanelVariable } from "./app-workspace-state";
62
62
  import { SidebarItemPreview } from "./SidebarItemPreview";
63
63
  import { createScrollFade } from "./scroll-fade";
@@ -512,44 +512,72 @@ function AppWorkspaceSidebar(props) {
512
512
  const minSize = () => props.minSize ?? (props.collapsible ? APP_WORKSPACE_SIDEBAR_COLLAPSED : APP_WORKSPACE_SIDEBAR_MIN);
513
513
  const maxSize = () => props.maxSize ?? APP_WORKSPACE_SIDEBAR_MAX;
514
514
  const generatedId = createUniqueId();
515
- const domId = `k2b-workspace-sidebar-${generatedId}`;
516
- const resolved = children(() => props.children);
515
+ const domId = () => props.id ?? `k2b-workspace-sidebar-${generatedId}`;
516
+ // Hidden navigation is not rendered at all, so its labels are neither shown
517
+ // nor reachable; reading the children lazily keeps them from being created.
518
+ const resolved = children(() => props.hidden ? undefined : props.children);
517
519
  const slots = createMemo(() => flatten(resolved()).filter(sidebarChildSlot));
518
520
  const desktop = createMemo(() => slots().find(slot => slot.kind === SIDEBAR_DESKTOP));
521
+ let aside;
522
+ onMount(() => {
523
+ const requestHide = () => props.onHiddenChange?.(true);
524
+ aside?.addEventListener(APP_WORKSPACE_SIDEBAR_HIDE_EVENT, requestHide);
525
+ onCleanup(() => aside?.removeEventListener(APP_WORKSPACE_SIDEBAR_HIDE_EVENT, requestHide));
526
+ });
519
527
  return [(() => {
520
- var _el$7 = _$getNextElement(_tmpl$6),
521
- _el$8 = _el$7.firstChild;
522
- _$setAttribute(_el$7, "id", domId);
523
- _$insert(_el$8, () => desktop()?.children);
528
+ var _el$7 = _$getNextElement(_tmpl$5);
529
+ var _ref$ = aside;
530
+ typeof _ref$ === "function" ? _$use(_ref$, _el$7) : aside = _el$7;
531
+ _$insert(_el$7, _$createComponent(Show, {
532
+ get when() {
533
+ return !props.hidden;
534
+ },
535
+ get children() {
536
+ var _el$8 = _$getNextElement(_tmpl$6);
537
+ _$insert(_el$8, () => desktop()?.children);
538
+ return _el$8;
539
+ }
540
+ }));
524
541
  _$effect(_p$ => {
525
- var _v$39 = `k2b-app-workspace__sidebar ${props.class ?? ""}`,
526
- _v$40 = props.label,
527
- _v$41 = props.mobile === "stacked" ? "stacked" : undefined,
528
- _v$42 = resizable() ? "true" : "false",
529
- _v$43 = props.collapsible ? "true" : "false";
530
- _v$39 !== _p$.e && _$className(_el$7, _p$.e = _v$39);
531
- _v$40 !== _p$.t && _$setAttribute(_el$7, "aria-label", _p$.t = _v$40);
532
- _v$41 !== _p$.a && _$setAttribute(_el$7, "data-mobile", _p$.a = _v$41);
533
- _v$42 !== _p$.o && _$setAttribute(_el$7, "data-workspace-resizable", _p$.o = _v$42);
534
- _v$43 !== _p$.i && _$setAttribute(_el$7, "data-workspace-collapsible", _p$.i = _v$43);
542
+ var _v$39 = domId(),
543
+ _v$40 = `k2b-app-workspace__sidebar ${props.class ?? ""}`,
544
+ _v$41 = props.label,
545
+ _v$42 = props.hidden || undefined,
546
+ _v$43 = props.mobile === "stacked" ? "stacked" : undefined,
547
+ _v$44 = resizable() ? "true" : "false",
548
+ _v$45 = props.collapsible ? "true" : "false",
549
+ _v$46 = props.onHiddenChange ? "true" : undefined;
550
+ _v$39 !== _p$.e && _$setAttribute(_el$7, "id", _p$.e = _v$39);
551
+ _v$40 !== _p$.t && _$className(_el$7, _p$.t = _v$40);
552
+ _v$41 !== _p$.a && _$setAttribute(_el$7, "aria-label", _p$.a = _v$41);
553
+ _v$42 !== _p$.o && _$setProperty(_el$7, "hidden", _p$.o = _v$42);
554
+ _v$43 !== _p$.i && _$setAttribute(_el$7, "data-mobile", _p$.i = _v$43);
555
+ _v$44 !== _p$.n && _$setAttribute(_el$7, "data-workspace-resizable", _p$.n = _v$44);
556
+ _v$45 !== _p$.s && _$setAttribute(_el$7, "data-workspace-collapsible", _p$.s = _v$45);
557
+ _v$46 !== _p$.h && _$setAttribute(_el$7, "data-workspace-hideable", _p$.h = _v$46);
535
558
  return _p$;
536
559
  }, {
537
560
  e: undefined,
538
561
  t: undefined,
539
562
  a: undefined,
540
563
  o: undefined,
541
- i: undefined
564
+ i: undefined,
565
+ n: undefined,
566
+ s: undefined,
567
+ h: undefined
542
568
  });
543
569
  return _el$7;
544
570
  })(), _$createComponent(Show, {
545
571
  get when() {
546
- return resizable();
572
+ return _$memo(() => !!resizable())() && !props.hidden;
547
573
  },
548
574
  get children() {
549
575
  return _$createComponent(ResizeHandle, {
550
576
  kind: "sidebar",
551
577
  edge: "end",
552
- controls: domId,
578
+ get controls() {
579
+ return domId();
580
+ },
553
581
  get defaultSize() {
554
582
  return defaultSize();
555
583
  },
@@ -586,8 +614,8 @@ const AppWorkspaceSidebarBody = props => {
586
614
  createScrollFade(() => body, () => props.scrollFade !== false);
587
615
  return [(() => {
588
616
  var _el$9 = _$getNextElement(_tmpl$2);
589
- var _ref$ = body;
590
- typeof _ref$ === "function" ? _$use(_ref$, _el$9) : body = _el$9;
617
+ var _ref$2 = body;
618
+ typeof _ref$2 === "function" ? _$use(_ref$2, _el$9) : body = _el$9;
591
619
  _$spread(_el$9, _$mergeProps({
592
620
  get ["class"]() {
593
621
  return `k2b-app-workspace__sidebar-body ${props.class ?? ""}`;
@@ -692,10 +720,10 @@ const AppWorkspaceSidebarSection = props => {
692
720
  _$setAttribute(_el$15, "aria-controls", id);
693
721
  _$insert(_el$15, title, _el$18, _co$);
694
722
  _$effect(_p$ => {
695
- var _v$44 = open(),
696
- _v$45 = open() ? "ti ti-chevron-down" : "ti ti-chevron-right";
697
- _v$44 !== _p$.e && _$setAttribute(_el$15, "aria-expanded", _p$.e = _v$44);
698
- _v$45 !== _p$.t && _$className(_el$16, _p$.t = _v$45);
723
+ var _v$47 = open(),
724
+ _v$48 = open() ? "ti ti-chevron-down" : "ti ti-chevron-right";
725
+ _v$47 !== _p$.e && _$setAttribute(_el$15, "aria-expanded", _p$.e = _v$47);
726
+ _v$48 !== _p$.t && _$className(_el$16, _p$.t = _v$48);
699
727
  return _p$;
700
728
  }, {
701
729
  e: undefined,
@@ -994,12 +1022,12 @@ function AppWorkspaceSidebarItem(props) {
994
1022
  _el$54.$$click = select;
995
1023
  _$insert(_el$54, content);
996
1024
  _$effect(_p$ => {
997
- var _v$49 = actionSlot()?.disabled,
998
- _v$50 = actionSlot()?.visibility === "hover" ? "hover" : undefined,
999
- _v$51 = label();
1000
- _v$49 !== _p$.e && _$setProperty(_el$54, "disabled", _p$.e = _v$49);
1001
- _v$50 !== _p$.t && _$setAttribute(_el$54, "data-visibility", _p$.t = _v$50);
1002
- _v$51 !== _p$.a && _$setAttribute(_el$54, "aria-label", _p$.a = _v$51);
1025
+ var _v$52 = actionSlot()?.disabled,
1026
+ _v$53 = actionSlot()?.visibility === "hover" ? "hover" : undefined,
1027
+ _v$54 = label();
1028
+ _v$52 !== _p$.e && _$setProperty(_el$54, "disabled", _p$.e = _v$52);
1029
+ _v$53 !== _p$.t && _$setAttribute(_el$54, "data-visibility", _p$.t = _v$53);
1030
+ _v$54 !== _p$.a && _$setAttribute(_el$54, "aria-label", _p$.a = _v$54);
1003
1031
  return _p$;
1004
1032
  }, {
1005
1033
  e: undefined,
@@ -1015,12 +1043,12 @@ function AppWorkspaceSidebarItem(props) {
1015
1043
  _el$53.$$click = select;
1016
1044
  _$insert(_el$53, content);
1017
1045
  _$effect(_p$ => {
1018
- var _v$46 = actionSlot()?.href,
1019
- _v$47 = actionSlot()?.visibility === "hover" ? "hover" : undefined,
1020
- _v$48 = label();
1021
- _v$46 !== _p$.e && _$setAttribute(_el$53, "href", _p$.e = _v$46);
1022
- _v$47 !== _p$.t && _$setAttribute(_el$53, "data-visibility", _p$.t = _v$47);
1023
- _v$48 !== _p$.a && _$setAttribute(_el$53, "aria-label", _p$.a = _v$48);
1046
+ var _v$49 = actionSlot()?.href,
1047
+ _v$50 = actionSlot()?.visibility === "hover" ? "hover" : undefined,
1048
+ _v$51 = label();
1049
+ _v$49 !== _p$.e && _$setAttribute(_el$53, "href", _p$.e = _v$49);
1050
+ _v$50 !== _p$.t && _$setAttribute(_el$53, "data-visibility", _p$.t = _v$50);
1051
+ _v$51 !== _p$.a && _$setAttribute(_el$53, "aria-label", _p$.a = _v$51);
1024
1052
  return _p$;
1025
1053
  }, {
1026
1054
  e: undefined,
@@ -1267,10 +1295,10 @@ const AppWorkspaceNavTree = props => {
1267
1295
  var _el$55 = _$getNextElement(_tmpl$27),
1268
1296
  _el$56 = _el$55.firstChild;
1269
1297
  _$effect(_p$ => {
1270
- var _v$52 = usesIconDisclosure() ? "" : undefined,
1271
- _v$53 = iconClass(rowIcon());
1272
- _v$52 !== _p$.e && _$setAttribute(_el$55, "data-k2b-nav-tree-toggle", _p$.e = _v$52);
1273
- _v$53 !== _p$.t && _$className(_el$56, _p$.t = _v$53);
1298
+ var _v$55 = usesIconDisclosure() ? "" : undefined,
1299
+ _v$56 = iconClass(rowIcon());
1300
+ _v$55 !== _p$.e && _$setAttribute(_el$55, "data-k2b-nav-tree-toggle", _p$.e = _v$55);
1301
+ _v$56 !== _p$.t && _$className(_el$56, _p$.t = _v$56);
1274
1302
  return _p$;
1275
1303
  }, {
1276
1304
  e: undefined,
@@ -1291,10 +1319,10 @@ const AppWorkspaceNavTree = props => {
1291
1319
  var _el$59 = _$getNextElement(_tmpl$29);
1292
1320
  _$insert(_el$59, () => item.meta);
1293
1321
  _$effect(_p$ => {
1294
- var _v$54 = `k2b-app-workspace__sidebar-item-meta ${hasChildren() ? "" : "k2b-app-workspace__nav-tree-leaf-meta"}`,
1295
- _v$55 = item.metaVisibility === "hover" ? "hover" : undefined;
1296
- _v$54 !== _p$.e && _$className(_el$59, _p$.e = _v$54);
1297
- _v$55 !== _p$.t && _$setAttribute(_el$59, "data-visibility", _p$.t = _v$55);
1322
+ var _v$57 = `k2b-app-workspace__sidebar-item-meta ${hasChildren() ? "" : "k2b-app-workspace__nav-tree-leaf-meta"}`,
1323
+ _v$58 = item.metaVisibility === "hover" ? "hover" : undefined;
1324
+ _v$57 !== _p$.e && _$className(_el$59, _p$.e = _v$57);
1325
+ _v$58 !== _p$.t && _$setAttribute(_el$59, "data-visibility", _p$.t = _v$58);
1298
1326
  return _p$;
1299
1327
  }, {
1300
1328
  e: undefined,
@@ -1377,8 +1405,8 @@ const AppWorkspaceNavTree = props => {
1377
1405
  _$addEventListener(_el$62, "dragenter", item.onDragEnter);
1378
1406
  _el$62.$$keydown = onKeyDown;
1379
1407
  _el$62.addEventListener("focus", () => setFocusedId(item.id));
1380
- var _ref$2 = treeItem;
1381
- typeof _ref$2 === "function" ? _$use(_ref$2, _el$62) : treeItem = _el$62;
1408
+ var _ref$3 = treeItem;
1409
+ typeof _ref$3 === "function" ? _$use(_ref$3, _el$62) : treeItem = _el$62;
1382
1410
  _$setAttribute(_el$62, "aria-level", depth + 1);
1383
1411
  _$setAttribute(_el$62, "data-k2b-nav-tree-parent-id", parentId);
1384
1412
  _$insert(_el$62, row, _el$65, _co$0);
@@ -1393,16 +1421,16 @@ const AppWorkspaceNavTree = props => {
1393
1421
  }
1394
1422
  }), _el$67, _co$1);
1395
1423
  _$effect(_p$ => {
1396
- var _v$56 = selected(),
1397
- _v$57 = hasChildren() ? isExpanded(item.id) : undefined,
1398
- _v$58 = item.disabled ? "true" : undefined,
1399
- _v$59 = item.disabled ? -1 : tabStopId() === item.id ? 0 : -1,
1400
- _v$60 = item.id;
1401
- _v$56 !== _p$.e && _$setAttribute(_el$62, "aria-selected", _p$.e = _v$56);
1402
- _v$57 !== _p$.t && _$setAttribute(_el$62, "aria-expanded", _p$.t = _v$57);
1403
- _v$58 !== _p$.a && _$setAttribute(_el$62, "aria-disabled", _p$.a = _v$58);
1404
- _v$59 !== _p$.o && _$setAttribute(_el$62, "tabindex", _p$.o = _v$59);
1405
- _v$60 !== _p$.i && _$setAttribute(_el$62, "data-k2b-nav-tree-id", _p$.i = _v$60);
1424
+ var _v$59 = selected(),
1425
+ _v$60 = hasChildren() ? isExpanded(item.id) : undefined,
1426
+ _v$61 = item.disabled ? "true" : undefined,
1427
+ _v$62 = item.disabled ? -1 : tabStopId() === item.id ? 0 : -1,
1428
+ _v$63 = item.id;
1429
+ _v$59 !== _p$.e && _$setAttribute(_el$62, "aria-selected", _p$.e = _v$59);
1430
+ _v$60 !== _p$.t && _$setAttribute(_el$62, "aria-expanded", _p$.t = _v$60);
1431
+ _v$61 !== _p$.a && _$setAttribute(_el$62, "aria-disabled", _p$.a = _v$61);
1432
+ _v$62 !== _p$.o && _$setAttribute(_el$62, "tabindex", _p$.o = _v$62);
1433
+ _v$63 !== _p$.i && _$setAttribute(_el$62, "data-k2b-nav-tree-id", _p$.i = _v$63);
1406
1434
  return _p$;
1407
1435
  }, {
1408
1436
  e: undefined,
@@ -1418,14 +1446,14 @@ const AppWorkspaceNavTree = props => {
1418
1446
  });
1419
1447
  return (() => {
1420
1448
  var _el$68 = _$getNextElement(_tmpl$33);
1421
- var _ref$3 = root;
1422
- typeof _ref$3 === "function" ? _$use(_ref$3, _el$68) : root = _el$68;
1449
+ var _ref$4 = root;
1450
+ typeof _ref$4 === "function" ? _$use(_ref$4, _el$68) : root = _el$68;
1423
1451
  _$insert(_el$68, () => renderItems(roots, 0));
1424
1452
  _$effect(_p$ => {
1425
- var _v$61 = `k2b-app-workspace__nav-tree ${props.class ?? ""}`,
1426
- _v$62 = props.ariaLabel;
1427
- _v$61 !== _p$.e && _$className(_el$68, _p$.e = _v$61);
1428
- _v$62 !== _p$.t && _$setAttribute(_el$68, "aria-label", _p$.t = _v$62);
1453
+ var _v$64 = `k2b-app-workspace__nav-tree ${props.class ?? ""}`,
1454
+ _v$65 = props.ariaLabel;
1455
+ _v$64 !== _p$.e && _$className(_el$68, _p$.e = _v$64);
1456
+ _v$65 !== _p$.t && _$setAttribute(_el$68, "aria-label", _p$.t = _v$65);
1429
1457
  return _p$;
1430
1458
  }, {
1431
1459
  e: undefined,
@@ -1549,20 +1577,20 @@ const AppWorkspace = props => {
1549
1577
  },
1550
1578
  get children() {
1551
1579
  var _el$77 = _$getNextElement(_tmpl$36);
1552
- var _ref$4 = root;
1553
- typeof _ref$4 === "function" ? _$use(_ref$4, _el$77) : root = _el$77;
1580
+ var _ref$5 = root;
1581
+ typeof _ref$5 === "function" ? _$use(_ref$5, _el$77) : root = _el$77;
1554
1582
  _$insert(_el$77, () => props.children);
1555
1583
  _$effect(_p$ => {
1556
- var _v$63 = `k2b-app-workspace ${props.class ?? ""}`,
1557
- _v$64 = props.mobileSurface,
1558
- _v$65 = initialLayoutState()?.sidebarCollapsed === undefined ? undefined : String(initialLayoutState()?.sidebarCollapsed),
1559
- _v$66 = props.resizable === false ? "false" : "true",
1560
- _v$67 = appWorkspaceLayoutStyle(initialLayoutState());
1561
- _v$63 !== _p$.e && _$className(_el$77, _p$.e = _v$63);
1562
- _v$64 !== _p$.t && _$setAttribute(_el$77, "data-mobile-surface", _p$.t = _v$64);
1563
- _v$65 !== _p$.a && _$setAttribute(_el$77, "data-sidebar-collapsed", _p$.a = _v$65);
1564
- _v$66 !== _p$.o && _$setAttribute(_el$77, "data-workspace-resizable", _p$.o = _v$66);
1565
- _p$.i = _$style(_el$77, _v$67, _p$.i);
1584
+ var _v$66 = `k2b-app-workspace ${props.class ?? ""}`,
1585
+ _v$67 = props.mobileSurface,
1586
+ _v$68 = initialLayoutState()?.sidebarCollapsed === undefined ? undefined : String(initialLayoutState()?.sidebarCollapsed),
1587
+ _v$69 = props.resizable === false ? "false" : "true",
1588
+ _v$70 = appWorkspaceLayoutStyle(initialLayoutState());
1589
+ _v$66 !== _p$.e && _$className(_el$77, _p$.e = _v$66);
1590
+ _v$67 !== _p$.t && _$setAttribute(_el$77, "data-mobile-surface", _p$.t = _v$67);
1591
+ _v$68 !== _p$.a && _$setAttribute(_el$77, "data-sidebar-collapsed", _p$.a = _v$68);
1592
+ _v$69 !== _p$.o && _$setAttribute(_el$77, "data-workspace-resizable", _p$.o = _v$69);
1593
+ _p$.i = _$style(_el$77, _v$70, _p$.i);
1566
1594
  return _p$;
1567
1595
  }, {
1568
1596
  e: undefined,