@vielzeug/refine 1.7.0 → 1.8.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.
Files changed (83) hide show
  1. package/dist/async.cjs +11 -11
  2. package/dist/async.cjs.map +1 -1
  3. package/dist/async.js +1 -2
  4. package/dist/async.js.map +1 -1
  5. package/dist/calendar.cjs +26 -26
  6. package/dist/calendar.cjs.map +1 -1
  7. package/dist/calendar.js +4 -5
  8. package/dist/calendar.js.map +1 -1
  9. package/dist/checkbox-group.cjs +9 -9
  10. package/dist/checkbox-group.cjs.map +1 -1
  11. package/dist/checkbox-group.js +1 -2
  12. package/dist/checkbox-group.js.map +1 -1
  13. package/dist/code-window.cjs +4 -4
  14. package/dist/code-window.cjs.map +1 -1
  15. package/dist/code-window.js +1 -2
  16. package/dist/code-window.js.map +1 -1
  17. package/dist/command-palette.cjs +6 -6
  18. package/dist/command-palette.cjs.map +1 -1
  19. package/dist/command-palette.js +46 -47
  20. package/dist/command-palette.js.map +1 -1
  21. package/dist/content/code-window/code-window.d.ts.map +1 -1
  22. package/dist/content/icon/icon.d.ts.map +1 -1
  23. package/dist/custom-elements.json +3716 -3716
  24. package/dist/datagrid.cjs +2 -2
  25. package/dist/datagrid.js +206 -206
  26. package/dist/datagrid.js.map +1 -1
  27. package/dist/disclosure/tab-panel/tab-panel.d.ts.map +1 -1
  28. package/dist/feedback/async/async.d.ts.map +1 -1
  29. package/dist/feedback/progress/progress.d.ts.map +1 -1
  30. package/dist/file-input.cjs +49 -49
  31. package/dist/file-input.cjs.map +1 -1
  32. package/dist/file-input.js +1 -2
  33. package/dist/file-input.js.map +1 -1
  34. package/dist/icon.cjs +1 -1
  35. package/dist/icon.cjs.map +1 -1
  36. package/dist/icon.js +1 -2
  37. package/dist/icon.js.map +1 -1
  38. package/dist/input.cjs +2 -2
  39. package/dist/input.js +6 -6
  40. package/dist/inputs/calendar/calendar.d.ts.map +1 -1
  41. package/dist/message-composer.cjs +2 -2
  42. package/dist/message-composer.js +6 -6
  43. package/dist/progress.cjs +13 -13
  44. package/dist/progress.cjs.map +1 -1
  45. package/dist/progress.js +3 -4
  46. package/dist/progress.js.map +1 -1
  47. package/dist/radio-group.cjs +11 -11
  48. package/dist/radio-group.cjs.map +1 -1
  49. package/dist/radio-group.js +1 -2
  50. package/dist/radio-group.js.map +1 -1
  51. package/dist/refine.cjs +197 -197
  52. package/dist/refine.cjs.map +1 -1
  53. package/dist/refine.iife.js +258 -258
  54. package/dist/refine.iife.js.map +1 -1
  55. package/dist/refine.js +225 -225
  56. package/dist/refine.js.map +1 -1
  57. package/dist/tab-panel.cjs +7 -7
  58. package/dist/tab-panel.cjs.map +1 -1
  59. package/dist/tab-panel.js +3 -4
  60. package/dist/tab-panel.js.map +1 -1
  61. package/dist/testing/index.d.ts +15 -60
  62. package/dist/testing/index.d.ts.map +1 -1
  63. package/dist/testing.cjs +1 -1
  64. package/dist/testing.cjs.map +1 -1
  65. package/dist/testing.js +7 -24
  66. package/dist/testing.js.map +1 -1
  67. package/dist/textarea.cjs +2 -2
  68. package/dist/textarea.js +6 -6
  69. package/package.json +6 -5
  70. package/dist/keymap/dist/_dev.cjs +0 -2
  71. package/dist/keymap/dist/_dev.cjs.map +0 -1
  72. package/dist/keymap/dist/_dev.js +0 -4
  73. package/dist/keymap/dist/_dev.js.map +0 -1
  74. package/dist/keymap/dist/format.cjs +0 -1
  75. package/dist/keymap/dist/format.js +0 -1
  76. package/dist/keymap/dist/index.cjs +0 -1
  77. package/dist/keymap/dist/index.js +0 -4
  78. package/dist/keymap/dist/keymap.cjs +0 -2
  79. package/dist/keymap/dist/keymap.cjs.map +0 -1
  80. package/dist/keymap/dist/keymap.js +0 -221
  81. package/dist/keymap/dist/keymap.js.map +0 -1
  82. package/dist/keymap/dist/layer.cjs +0 -1
  83. package/dist/keymap/dist/layer.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"command-palette.cjs","names":[],"sources":["../src/overlay/command-palette/command-palette.ts"],"sourcesContent":["import { createKeymap } from '@vielzeug/keymap';\nimport { define, html, ref, prop, getHost, onCleanup, onEvent, onMounted, useEmit } from '@vielzeug/ore';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport type { CommandPaletteItem, OreCommandPaletteEvents, OreCommandPaletteProps } from './command-palette.types';\n\nimport { warn } from '../../_dev';\nimport { announce, lifecycleSignal, createListControl } from '../../headless';\nimport { reducedMotionMixin } from '../../styles';\nimport { useDialogControl } from '../shared/use-dialog';\nimport { buildRows, filterItems, normalizeItem, parseSlottedItems, splitShortcutKeys } from './command-palette-items';\nimport '../../content/icon/icon';\nimport componentStyles from './command-palette.css?inline';\n\nexport type { OreCommandPaletteEvents, OreCommandPaletteProps } from './command-palette.types';\n\n/**\n * A pure data node describing one command. Never rendered directly — `ore-command-palette`\n * reads its attributes/text content and renders the visible row itself.\n *\n * @element ore-command-palette-item\n *\n * @attr {string} value - Value emitted by the `select` event and matched against the search query\n * @attr {string} label - Explicit label text; falls back to the element's text content\n * @attr {string} group - Group heading the item is clustered under\n * @attr {string} shortcut - Display-only keyboard hint rendered at the end of the row, one `<kbd>` per `+`-separated key (e.g. `\"⌘+S\"` renders two keycaps; a literal `+` key isn't representable — spell it out, e.g. `\"Ctrl+Plus\"`)\n * @attr {boolean} disabled - Excludes the item from keyboard navigation and selection\n *\n * @slot icon - Optional leading icon content\n *\n * @example\n * ```html\n * <ore-command-palette-item value=\"new-file\" group=\"File\" shortcut=\"⌘+N\">New File</ore-command-palette-item>\n * ```\n */\nexport const COMMAND_PALETTE_ITEM_TAG = 'ore-command-palette-item' as const;\ndefine(COMMAND_PALETTE_ITEM_TAG, {\n setup() {\n return html``;\n },\n});\n\n/**\n * A searchable, keyboard-driven list of commands presented in a centered modal —\n * the \"⌘K\" pattern popularized by editors and productivity apps. Built on the\n * native `<dialog>` element (focus trap, top-layer stacking, `Escape`-to-close)\n * and `@vielzeug/keymap` for the global shortcut that opens it.\n *\n * @element ore-command-palette\n * @element ore-command-palette-item - Slotted command definition (place in default slot)\n *\n * @attr {boolean} open - Controls the open state of the palette\n * @attr {string} label - Accessible label for the dialog (screen-reader-only heading)\n * @attr {string} placeholder - Placeholder text for the search input\n * @attr {string} shortcut - Global keyboard shortcut (keymap syntax) that toggles the palette. Default `\"mod+k\"`; set to `\"\"` to disable\n * @attr {boolean} no-filter - Disable built-in client-side filtering (for server-driven search)\n * @attr {boolean} loading - Shows a loading row below the search input\n * @attr {string} empty-text - Message shown when no item matches the query\n * @attr {boolean} keep-open-on-select - Keep the palette open after an item is selected\n *\n * @fires open - Fired when the palette opens. detail: `{ reason }`\n * @fires close - Fired when the palette closes. detail: `{ reason }`\n * @fires search - Fired on every keystroke in the search input. detail: `{ query }`\n * @fires select - Fired when a command is chosen (click or `Enter`). detail: `{ value, label, item }`\n *\n * @slot - `<ore-command-palette-item>` elements (alternative/supplement to the `items` prop)\n *\n * @cssprop --command-palette-bg - Panel background color\n * @cssprop --command-palette-border-color - Panel border color\n * @cssprop --command-palette-radius - Panel border radius\n * @cssprop --command-palette-shadow - Panel drop shadow\n * @cssprop --command-palette-max-width - Maximum panel width\n * @cssprop --command-palette-backdrop - Backdrop overlay color\n * @cssprop --command-palette-option-hover-bg - Item background on hover\n * @cssprop --command-palette-option-focus-bg - Item background when keyboard-focused\n *\n * @part dialog - Dialog root container\n * @part panel - Panel container\n * @part input - Search input\n * @part listbox - Listbox of matching commands\n *\n * @example\n * ```html\n * <ore-command-palette label=\"Command palette\" placeholder=\"Type a command…\">\n * <ore-command-palette-item value=\"new-file\" group=\"File\" shortcut=\"⌘+N\">New File</ore-command-palette-item>\n * <ore-command-palette-item value=\"open-file\" group=\"File\" shortcut=\"⌘+O\">Open File…</ore-command-palette-item>\n * <ore-command-palette-item value=\"toggle-theme\" group=\"View\">Toggle Theme</ore-command-palette-item>\n * </ore-command-palette>\n * ```\n */\nexport const COMMAND_PALETTE_TAG = 'ore-command-palette' as const;\ndefine<OreCommandPaletteProps>(COMMAND_PALETTE_TAG, {\n props: {\n 'empty-text': prop.string('No results found.'),\n items: prop.data<OreCommandPaletteProps['items']>(),\n 'keep-open-on-select': prop.bool(false),\n label: prop.string('Command palette'),\n loading: prop.bool(false),\n 'no-filter': prop.bool(false),\n open: prop.bool(false),\n placeholder: prop.string('Type a command or search…'),\n shortcut: prop.string('mod+k'),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreCommandPaletteEvents>();\n const abortSignal = lifecycleSignal(onCleanup);\n\n const dialogRef = ref<HTMLDialogElement>();\n const searchInputRef = ref<HTMLInputElement>();\n const listboxId = 'cmdk-listbox';\n\n let listboxEl: HTMLElement | null = null;\n\n const query = signal('');\n\n // ── Items: slotted <ore-command-palette-item> elements, merged with the `items` prop ──\n // Items are pure data nodes (see `ore-command-palette-item`'s own doc comment) — they're\n // never projected through a `<slot>`, just read directly off the host's light DOM. That\n // sidesteps `useSlots()`/`slotchange` entirely: a plain MutationObserver on the host\n // already covers everything `slotchange` would (an item added or removed) *and* the case\n // it can't — an already-assigned item's own text/attributes changing. For items written\n // as static, inline HTML, the browser's parser can insert the last item before appending\n // its text-node child; without watching `characterData`, that would permanently cache an\n // empty label, since nothing else re-triggers once the element itself stops changing.\n const slottedItems = signal<CommandPaletteItem[]>([]);\n\n const reparseSlottedItems = (): void => {\n slottedItems.value = parseSlottedItems([...el.children]);\n };\n\n reparseSlottedItems();\n\n const lightDomObserver = new MutationObserver(reparseSlottedItems);\n\n lightDomObserver.observe(el, { characterData: true, childList: true, subtree: true });\n onCleanup(() => lightDomObserver.disconnect());\n\n const allItems = computed<CommandPaletteItem[]>(() => {\n const explicit = props.items.value;\n\n return Array.isArray(explicit) ? explicit.map(normalizeItem) : slottedItems.value;\n });\n\n const filteredItems = computed(() => filterItems(allItems.value, query.value, Boolean(props['no-filter'].value)));\n const rows = computed(() => buildRows(filteredItems.value));\n\n // ── Keyboard navigation over the filtered list (Up/Down/Home/End) ──\n const scrollFocusedIntoView = (): void => {\n listboxEl?.querySelector<HTMLElement>('[data-focused]')?.scrollIntoView({ block: 'nearest' });\n };\n\n const list = createListControl<CommandPaletteItem>({\n getItems: () => filteredItems.value,\n isItemDisabled: (item) => item.disabled,\n onNavigate: scrollFocusedIntoView,\n signal: abortSignal,\n });\n const { focusedIndex } = list;\n\n // ── Dialog chrome: native <dialog>, focus trap, Escape, backdrop click ──\n const resetSearch = (): void => {\n query.value = '';\n list.reset();\n };\n\n const { closeWithAnimation, overlay, requestClose, setupNativeListeners } = useDialogControl({\n dialogRef,\n getPanelEl: () => dialogRef.value?.querySelector<HTMLElement>('.panel'),\n host: el,\n initialFocus: computed(() => '.search-input'),\n isPersistent: () => false,\n onCleanup,\n onEvent,\n onNativeClose: (reason) => {\n emit('close', { reason });\n resetSearch();\n },\n onOpen: (reason) => {\n emit('open', { reason });\n list.navigate('first');\n },\n openProp: props.open,\n performClose: () => closeWithAnimation(),\n returnFocus: computed(() => true),\n });\n\n // ── Global keyboard shortcut (opens/closes the palette from anywhere) ──\n const globalKeymap = createKeymap();\n\n globalKeymap.mount(window);\n onCleanup(() => globalKeymap.dispose());\n\n let unbindShortcut: (() => void) | null = null;\n\n watch(\n props.shortcut,\n (shortcutStr) => {\n unbindShortcut?.();\n unbindShortcut = null;\n\n const trimmed = (shortcutStr ?? '').trim();\n\n if (!trimmed) return;\n\n try {\n unbindShortcut = globalKeymap.bind(trimmed, () => {\n overlay.toggle('keyboard', 'trigger');\n });\n } catch (error) {\n warn(`invalid \"shortcut\" value \"${trimmed}\" — ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n { immediate: true },\n );\n\n onMounted(() => {\n setupNativeListeners();\n });\n\n // ── Selection ────────────────────────────────────────────────────────────\n function selectItem(item: CommandPaletteItem): void {\n if (item.disabled) return;\n\n emit('select', { item, label: item.label, value: item.value });\n\n if (props['keep-open-on-select'].value) {\n searchInputRef.value?.focus();\n } else {\n requestClose('trigger');\n }\n }\n\n function handleInput(e: Event): void {\n const value = (e.target as HTMLInputElement).value;\n\n query.value = value;\n list.navigate('first');\n emit('search', { query: value });\n\n const count = filteredItems.value.length;\n\n announce(count === 0 ? props['empty-text'].value! : `${count} result${count === 1 ? '' : 's'} found`);\n }\n\n function handleKeydown(e: KeyboardEvent): void {\n if (list.handleKeydown(e)) return;\n\n if (e.key === 'Enter') {\n // `list.navigate('first')` (called on open and on every keystroke) already keeps\n // the focused row off a disabled item, so this fallback is only ever reached when\n // nothing has been focused yet — but it mirrors `selectItem`'s own disabled guard\n // rather than blindly grabbing index 0, in case that navigate-on-open wiring ever\n // changes.\n const active = list.getActiveItem() ?? filteredItems.value.find((item) => !item.disabled);\n\n if (active) {\n e.preventDefault();\n selectItem(active);\n }\n }\n }\n\n return html`\n <dialog ref=\"${dialogRef}\" class=\"dialog\" part=\"dialog\" aria-label=\"${props.label}\" aria-modal=\"true\">\n <div class=\"panel\" part=\"panel\">\n <div class=\"search\" part=\"search\">\n <span class=\"search-icon\" aria-hidden=\"true\"><ore-icon name=\"search\" size=\"18\"></ore-icon></span>\n <input\n ref=\"${searchInputRef}\"\n class=\"search-input\"\n part=\"input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-controls=\"${listboxId}\"\n aria-activedescendant=\"${() => (focusedIndex.value >= 0 ? `${listboxId}-opt-${focusedIndex.value}` : '')}\"\n placeholder=\"${props.placeholder}\"\n value=\"${query}\"\n @input=\"${handleInput}\"\n @keydown=\"${handleKeydown}\" />\n <span class=\"search-loader\" ?hidden=\"${() => !props.loading.value}\" aria-hidden=\"true\"></span>\n </div>\n <div\n class=\"listbox\"\n part=\"listbox\"\n role=\"listbox\"\n id=\"${listboxId}\"\n aria-label=\"Commands\"\n ref=\"${(listEl: HTMLElement) => {\n listboxEl = listEl;\n }}\">\n <div class=\"empty\" role=\"presentation\" ?hidden=\"${() => props.loading.value || rows.value.length > 0}\">\n ${() => props['empty-text'].value}\n </div>\n ${() =>\n rows.value.map((row) =>\n row.type === 'group'\n ? html`<div class=\"group-heading\" role=\"presentation\">${row.group}</div>`\n : html`<div\n class=\"item\"\n part=\"item\"\n role=\"option\"\n id=\"${`${listboxId}-opt-${row.idx}`}\"\n aria-selected=\"${() => String(focusedIndex.value === row.idx)}\"\n aria-disabled=\"${() => String(row.item.disabled)}\"\n ?data-focused=\"${() => focusedIndex.value === row.idx}\"\n ?data-disabled=\"${() => row.item.disabled}\"\n @click=\"${(e: MouseEvent) => {\n e.stopPropagation();\n selectItem(row.item);\n }}\"\n @pointerenter=\"${() => {\n list.set(row.idx);\n }}\">\n ${\n row.item.icon\n ? html`<span class=\"item-icon\" aria-hidden=\"true\"\n ><ore-icon name=\"${row.item.icon}\" size=\"16\"></ore-icon\n ></span>`\n : ''\n }\n <span class=\"item-label\">${row.item.label}</span>\n ${\n row.item.shortcut\n ? html`<span class=\"item-shortcut\"\n >${splitShortcutKeys(row.item.shortcut).map((key) => html`<kbd>${key}</kbd>`)}</span\n >`\n : ''\n }\n </div>`,\n )}\n </div>\n <div class=\"footer\" part=\"footer\">\n <span class=\"footer-hint\"><kbd>↑</kbd><kbd>↓</kbd> Navigate</span>\n <span class=\"footer-hint\"><kbd>Enter</kbd> Select</span>\n <span class=\"footer-hint\"><kbd>Esc</kbd> Close</span>\n </div>\n </div>\n </dialog>\n `;\n },\n styles: [reducedMotionMixin, componentStyles],\n});\n"],"mappings":"mjBAmCA,IAAa,EAA2B,wCACjC,EAA0B,CAC/B,OAAQ,CACN,MAAO,GAAA,IAAI,EACb,CACF,CAAC,EAkDD,IAAa,EAAsB,mCACJ,EAAqB,CAClD,MAAO,CACL,aAAc,EAAA,KAAK,OAAO,mBAAmB,EAC7C,MAAO,EAAA,KAAK,KAAsC,EAClD,sBAAuB,EAAA,KAAK,KAAK,EAAK,EACtC,MAAO,EAAA,KAAK,OAAO,iBAAiB,EACpC,QAAS,EAAA,KAAK,KAAK,EAAK,EACxB,YAAa,EAAA,KAAK,KAAK,EAAK,EAC5B,KAA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AI,CACrB,EAAE;2CACqB,CACrB,EAAK,IAAI,EAAI,GAAG,CAClB,EAAE;wBAEA,EAAI,KAAK,KACL,EAAA,IAAI;iDACiB,EAAI,KAAK,KAAK;sCAEnC,GACL;iDAC0B,EAAI,KAAK,MAAM;wBAExC,EAAI,KAAK,SACL,EAAA,IAAI;iCACC,EAAA,kBAAkB,EAAI,KAAK,QAAQ,CAAC,CAAC,IAAK,GAAQ,EAAA,IAAI,QAAQ,EAAI,OAAO,EAAE;+BAEhF,GACL;2BAET,EAAE;;;;;;;;;KAUd,EACA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAe,CAC9C,CAAC"}
1
+ {"version":3,"file":"command-palette.cjs","names":[],"sources":["../src/overlay/command-palette/command-palette.ts"],"sourcesContent":["import { createKeymap } from '@vielzeug/keymap';\nimport { define, html, ref, prop, getHost, onCleanup, onEvent, onMounted, useEmit } from '@vielzeug/ore';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport type { CommandPaletteItem, OreCommandPaletteEvents, OreCommandPaletteProps } from './command-palette.types';\n\nimport { warn } from '../../_dev';\nimport { announce, lifecycleSignal, createListControl } from '../../headless';\nimport { reducedMotionMixin } from '../../styles';\nimport { useDialogControl } from '../shared/use-dialog';\nimport { buildRows, filterItems, normalizeItem, parseSlottedItems, splitShortcutKeys } from './command-palette-items';\nimport '../../content/icon/icon';\nimport componentStyles from './command-palette.css?inline';\n\nexport type { OreCommandPaletteEvents, OreCommandPaletteProps } from './command-palette.types';\n\n/**\n * A pure data node describing one command. Never rendered directly — `ore-command-palette`\n * reads its attributes/text content and renders the visible row itself.\n *\n * @element ore-command-palette-item\n *\n * @attr {string} value - Value emitted by the `select` event and matched against the search query\n * @attr {string} label - Explicit label text; falls back to the element's text content\n * @attr {string} group - Group heading the item is clustered under\n * @attr {string} shortcut - Display-only keyboard hint rendered at the end of the row, one `<kbd>` per `+`-separated key (e.g. `\"⌘+S\"` renders two keycaps; a literal `+` key isn't representable — spell it out, e.g. `\"Ctrl+Plus\"`)\n * @attr {boolean} disabled - Excludes the item from keyboard navigation and selection\n *\n * @slot icon - Optional leading icon content\n *\n * @example\n * ```html\n * <ore-command-palette-item value=\"new-file\" group=\"File\" shortcut=\"⌘+N\">New File</ore-command-palette-item>\n * ```\n */\nexport const COMMAND_PALETTE_ITEM_TAG = 'ore-command-palette-item' as const;\ndefine(COMMAND_PALETTE_ITEM_TAG, {\n setup() {\n return html``;\n },\n});\n\n/**\n * A searchable, keyboard-driven list of commands presented in a centered modal —\n * the \"⌘K\" pattern popularized by editors and productivity apps. Built on the\n * native `<dialog>` element (focus trap, top-layer stacking, `Escape`-to-close)\n * and `@vielzeug/keymap` for the global shortcut that opens it.\n *\n * @element ore-command-palette\n * @element ore-command-palette-item - Slotted command definition (place in default slot)\n *\n * @attr {boolean} open - Controls the open state of the palette\n * @attr {string} label - Accessible label for the dialog (screen-reader-only heading)\n * @attr {string} placeholder - Placeholder text for the search input\n * @attr {string} shortcut - Global keyboard shortcut (keymap syntax) that toggles the palette. Default `\"mod+k\"`; set to `\"\"` to disable\n * @attr {boolean} no-filter - Disable built-in client-side filtering (for server-driven search)\n * @attr {boolean} loading - Shows a loading row below the search input\n * @attr {string} empty-text - Message shown when no item matches the query\n * @attr {boolean} keep-open-on-select - Keep the palette open after an item is selected\n *\n * @fires open - Fired when the palette opens. detail: `{ reason }`\n * @fires close - Fired when the palette closes. detail: `{ reason }`\n * @fires search - Fired on every keystroke in the search input. detail: `{ query }`\n * @fires select - Fired when a command is chosen (click or `Enter`). detail: `{ value, label, item }`\n *\n * @slot - `<ore-command-palette-item>` elements (alternative/supplement to the `items` prop)\n *\n * @cssprop --command-palette-bg - Panel background color\n * @cssprop --command-palette-border-color - Panel border color\n * @cssprop --command-palette-radius - Panel border radius\n * @cssprop --command-palette-shadow - Panel drop shadow\n * @cssprop --command-palette-max-width - Maximum panel width\n * @cssprop --command-palette-backdrop - Backdrop overlay color\n * @cssprop --command-palette-option-hover-bg - Item background on hover\n * @cssprop --command-palette-option-focus-bg - Item background when keyboard-focused\n *\n * @part dialog - Dialog root container\n * @part panel - Panel container\n * @part input - Search input\n * @part listbox - Listbox of matching commands\n *\n * @example\n * ```html\n * <ore-command-palette label=\"Command palette\" placeholder=\"Type a command…\">\n * <ore-command-palette-item value=\"new-file\" group=\"File\" shortcut=\"⌘+N\">New File</ore-command-palette-item>\n * <ore-command-palette-item value=\"open-file\" group=\"File\" shortcut=\"⌘+O\">Open File…</ore-command-palette-item>\n * <ore-command-palette-item value=\"toggle-theme\" group=\"View\">Toggle Theme</ore-command-palette-item>\n * </ore-command-palette>\n * ```\n */\nexport const COMMAND_PALETTE_TAG = 'ore-command-palette' as const;\ndefine<OreCommandPaletteProps>(COMMAND_PALETTE_TAG, {\n props: {\n 'empty-text': prop.string('No results found.'),\n items: prop.data<OreCommandPaletteProps['items']>(),\n 'keep-open-on-select': prop.bool(false),\n label: prop.string('Command palette'),\n loading: prop.bool(false),\n 'no-filter': prop.bool(false),\n open: prop.bool(false),\n placeholder: prop.string('Type a command or search…'),\n shortcut: prop.string('mod+k'),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreCommandPaletteEvents>();\n const abortSignal = lifecycleSignal(onCleanup);\n\n const dialogRef = ref<HTMLDialogElement>();\n const searchInputRef = ref<HTMLInputElement>();\n const listboxId = 'cmdk-listbox';\n\n let listboxEl: HTMLElement | null = null;\n\n const query = signal('');\n\n // ── Items: slotted <ore-command-palette-item> elements, merged with the `items` prop ──\n // Items are pure data nodes (see `ore-command-palette-item`'s own doc comment) — they're\n // never projected through a `<slot>`, just read directly off the host's light DOM. That\n // sidesteps `useSlots()`/`slotchange` entirely: a plain MutationObserver on the host\n // already covers everything `slotchange` would (an item added or removed) *and* the case\n // it can't — an already-assigned item's own text/attributes changing. For items written\n // as static, inline HTML, the browser's parser can insert the last item before appending\n // its text-node child; without watching `characterData`, that would permanently cache an\n // empty label, since nothing else re-triggers once the element itself stops changing.\n const slottedItems = signal<CommandPaletteItem[]>([]);\n\n const reparseSlottedItems = (): void => {\n slottedItems.value = parseSlottedItems([...el.children]);\n };\n\n reparseSlottedItems();\n\n const lightDomObserver = new MutationObserver(reparseSlottedItems);\n\n lightDomObserver.observe(el, { characterData: true, childList: true, subtree: true });\n onCleanup(() => lightDomObserver.disconnect());\n\n const allItems = computed<CommandPaletteItem[]>(() => {\n const explicit = props.items.value;\n\n return Array.isArray(explicit) ? explicit.map(normalizeItem) : slottedItems.value;\n });\n\n const filteredItems = computed(() => filterItems(allItems.value, query.value, Boolean(props['no-filter'].value)));\n const rows = computed(() => buildRows(filteredItems.value));\n\n // ── Keyboard navigation over the filtered list (Up/Down/Home/End) ──\n const scrollFocusedIntoView = (): void => {\n listboxEl?.querySelector<HTMLElement>('[data-focused]')?.scrollIntoView({ block: 'nearest' });\n };\n\n const list = createListControl<CommandPaletteItem>({\n getItems: () => filteredItems.value,\n isItemDisabled: (item) => item.disabled,\n onNavigate: scrollFocusedIntoView,\n signal: abortSignal,\n });\n const { focusedIndex } = list;\n\n // ── Dialog chrome: native <dialog>, focus trap, Escape, backdrop click ──\n const resetSearch = (): void => {\n query.value = '';\n list.reset();\n };\n\n const { closeWithAnimation, overlay, requestClose, setupNativeListeners } = useDialogControl({\n dialogRef,\n getPanelEl: () => dialogRef.value?.querySelector<HTMLElement>('.panel'),\n host: el,\n initialFocus: computed(() => '.search-input'),\n isPersistent: () => false,\n onCleanup,\n onEvent,\n onNativeClose: (reason) => {\n emit('close', { reason });\n resetSearch();\n },\n onOpen: (reason) => {\n emit('open', { reason });\n list.navigate('first');\n },\n openProp: props.open,\n performClose: () => closeWithAnimation(),\n returnFocus: computed(() => true),\n });\n\n // ── Global keyboard shortcut (opens/closes the palette from anywhere) ──\n const globalKeymap = createKeymap();\n\n globalKeymap.mount(window);\n onCleanup(() => globalKeymap.dispose());\n\n let unbindShortcut: (() => void) | null = null;\n\n watch(\n props.shortcut,\n (shortcutStr) => {\n unbindShortcut?.();\n unbindShortcut = null;\n\n const trimmed = (shortcutStr ?? '').trim();\n\n if (!trimmed) return;\n\n try {\n unbindShortcut = globalKeymap.bind(trimmed, () => {\n overlay.toggle('keyboard', 'trigger');\n });\n } catch (error) {\n warn(`invalid \"shortcut\" value \"${trimmed}\" — ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n { immediate: true },\n );\n\n onMounted(() => {\n setupNativeListeners();\n });\n\n // ── Selection ────────────────────────────────────────────────────────────\n function selectItem(item: CommandPaletteItem): void {\n if (item.disabled) return;\n\n emit('select', { item, label: item.label, value: item.value });\n\n if (props['keep-open-on-select'].value) {\n searchInputRef.value?.focus();\n } else {\n requestClose('trigger');\n }\n }\n\n function handleInput(e: Event): void {\n const value = (e.target as HTMLInputElement).value;\n\n query.value = value;\n list.navigate('first');\n emit('search', { query: value });\n\n const count = filteredItems.value.length;\n\n announce(count === 0 ? props['empty-text'].value! : `${count} result${count === 1 ? '' : 's'} found`);\n }\n\n function handleKeydown(e: KeyboardEvent): void {\n if (list.handleKeydown(e)) return;\n\n if (e.key === 'Enter') {\n // `list.navigate('first')` (called on open and on every keystroke) already keeps\n // the focused row off a disabled item, so this fallback is only ever reached when\n // nothing has been focused yet — but it mirrors `selectItem`'s own disabled guard\n // rather than blindly grabbing index 0, in case that navigate-on-open wiring ever\n // changes.\n const active = list.getActiveItem() ?? filteredItems.value.find((item) => !item.disabled);\n\n if (active) {\n e.preventDefault();\n selectItem(active);\n }\n }\n }\n\n return html`\n <dialog ref=\"${dialogRef}\" class=\"dialog\" part=\"dialog\" aria-label=\"${props.label}\" aria-modal=\"true\">\n <div class=\"panel\" part=\"panel\">\n <div class=\"search\" part=\"search\">\n <span class=\"search-icon\" aria-hidden=\"true\"><ore-icon name=\"search\" size=\"18\"></ore-icon></span>\n <input\n ref=\"${searchInputRef}\"\n class=\"search-input\"\n part=\"input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-controls=\"${listboxId}\"\n aria-activedescendant=\"${() => (focusedIndex.value >= 0 ? `${listboxId}-opt-${focusedIndex.value}` : '')}\"\n placeholder=\"${props.placeholder}\"\n value=\"${query}\"\n @input=\"${handleInput}\"\n @keydown=\"${handleKeydown}\" />\n <span class=\"search-loader\" ?hidden=\"${() => !props.loading.value}\" aria-hidden=\"true\"></span>\n </div>\n <div\n class=\"listbox\"\n part=\"listbox\"\n role=\"listbox\"\n id=\"${listboxId}\"\n aria-label=\"Commands\"\n ref=\"${(listEl: HTMLElement) => {\n listboxEl = listEl;\n }}\">\n <div class=\"empty\" role=\"presentation\" ?hidden=\"${() => props.loading.value || rows.value.length > 0}\">\n ${() => props['empty-text'].value}\n </div>\n ${() =>\n rows.value.map((row) =>\n row.type === 'group'\n ? html`<div class=\"group-heading\" role=\"presentation\">${row.group}</div>`\n : html`<div\n class=\"item\"\n part=\"item\"\n role=\"option\"\n id=\"${`${listboxId}-opt-${row.idx}`}\"\n aria-selected=\"${() => String(focusedIndex.value === row.idx)}\"\n aria-disabled=\"${() => String(row.item.disabled)}\"\n ?data-focused=\"${() => focusedIndex.value === row.idx}\"\n ?data-disabled=\"${() => row.item.disabled}\"\n @click=\"${(e: MouseEvent) => {\n e.stopPropagation();\n selectItem(row.item);\n }}\"\n @pointerenter=\"${() => {\n list.set(row.idx);\n }}\">\n ${\n row.item.icon\n ? html`<span class=\"item-icon\" aria-hidden=\"true\"\n ><ore-icon name=\"${row.item.icon}\" size=\"16\"></ore-icon\n ></span>`\n : ''\n }\n <span class=\"item-label\">${row.item.label}</span>\n ${\n row.item.shortcut\n ? html`<span class=\"item-shortcut\"\n >${splitShortcutKeys(row.item.shortcut).map((key) => html`<kbd>${key}</kbd>`)}</span\n >`\n : ''\n }\n </div>`,\n )}\n </div>\n <div class=\"footer\" part=\"footer\">\n <span class=\"footer-hint\"><kbd>↑</kbd><kbd>↓</kbd> Navigate</span>\n <span class=\"footer-hint\"><kbd>Enter</kbd> Select</span>\n <span class=\"footer-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;;;;kBAM5D,EAAU;;mBAER,GAAwB,CAC9B,EAAY,CACd,EAAE;kEACsD,EAAM,QAAQ,OAAS,EAAK,MAAM,OAAS,EAAE;oBAC3F,EAAM,aAAa,CAAC,MAAM;;kBAGlC,EAAK,MAAM,IAAK,GACd,EAAI,OAAS,QACT,EAAA,IAAI,kDAAkD,EAAI,MAAM,QAChE,EAAA,IAAI;;;;4BAII,GAAG,EAAU,OAAO,EAAI,MAAM;2CACb,OAAO,EAAa,QAAU,EAAI,GAAG,EAAE;2CACvC,OAAO,EAAI,KAAK,QAAQ,EAAE;2CAC1B,EAAa,QAAU,EAAI,IAAI;4CAC9B,EAAI,KAAK,SAAS;gCAC/B,GAAkB,CAC3B,EAAE,gBAAgB,EAClB,EAAW,EAAI,IAAI,CACrB,EAAE;2CACqB,CACrB,EAAK,IAAI,EAAI,GAAG,CAClB,EAAE;wBAEA,EAAI,KAAK,KACL,EAAA,IAAI;iDACiB,EAAI,KAAK,KAAK;sCAEnC,GACL;iDAC0B,EAAI,KAAK,MAAM;wBAExC,EAAI,KAAK,SACL,EAAA,IAAI;iCACC,EAAA,kBAAkB,EAAI,KAAK,QAAQ,CAAC,CAAC,IAAK,GAAQ,EAAA,IAAI,QAAQ,EAAI,OAAO,EAAE;+BAEhF,GACL;2BAET,EAAE;;;;;;;;;KAUd,EACA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAe,CAC9C,CAAC"}
@@ -3,75 +3,74 @@ import { warn as t } from "./_dev.js";
3
3
  import { lifecycleSignal as n } from "./headless/ore.js";
4
4
  import { createListControl as r } from "./headless/nav.js";
5
5
  import { announce as i } from "./headless/announcer.js";
6
- import { createKeymap as a } from "./keymap/dist/keymap.js";
7
- import "./keymap/dist/index.js";
8
- import { useDialogControl as o } from "./overlay/shared/use-dialog.js";
9
- import { buildRows as s, filterItems as c, normalizeItem as l, parseSlottedItems as u, splitShortcutKeys as d } from "./overlay/command-palette/command-palette-items.js";
10
- import f from "./overlay/command-palette/command-palette.css.js";
11
- import { define as p, getHost as m, html as h, onCleanup as g, onEvent as _, onMounted as v, prop as y, ref as b, useEmit as x } from "@vielzeug/ore";
12
- import { computed as S, signal as C, watch as w } from "@vielzeug/ripple";
6
+ import { useDialogControl as a } from "./overlay/shared/use-dialog.js";
7
+ import { buildRows as o, filterItems as s, normalizeItem as c, parseSlottedItems as l, splitShortcutKeys as u } from "./overlay/command-palette/command-palette-items.js";
8
+ import d from "./overlay/command-palette/command-palette.css.js";
9
+ import { define as f, getHost as p, html as m, onCleanup as h, onEvent as g, onMounted as _, prop as v, ref as y, useEmit as b } from "@vielzeug/ore";
10
+ import { computed as x, signal as S, watch as C } from "@vielzeug/ripple";
11
+ import { createKeymap as w } from "@vielzeug/keymap";
13
12
  //#region src/overlay/command-palette/command-palette.ts
14
13
  var T = "ore-command-palette-item";
15
- p(T, { setup() {
16
- return h``;
14
+ f(T, { setup() {
15
+ return m``;
17
16
  } });
18
17
  var E = "ore-command-palette";
19
- p(E, {
18
+ f(E, {
20
19
  props: {
21
- "empty-text": y.string("No results found."),
22
- items: y.data(),
23
- "keep-open-on-select": y.bool(!1),
24
- label: y.string("Command palette"),
25
- loading: y.bool(!1),
26
- "no-filter": y.bool(!1),
27
- open: y.bool(!1),
28
- placeholder: y.string("Type a command or search…"),
29
- shortcut: y.string("mod+k")
20
+ "empty-text": v.string("No results found."),
21
+ items: v.data(),
22
+ "keep-open-on-select": v.bool(!1),
23
+ label: v.string("Command palette"),
24
+ loading: v.bool(!1),
25
+ "no-filter": v.bool(!1),
26
+ open: v.bool(!1),
27
+ placeholder: v.string("Type a command or search…"),
28
+ shortcut: v.string("mod+k")
30
29
  },
31
30
  setup(e) {
32
- let f = m(), p = x(), y = n(g), T = b(), E = b(), D = "cmdk-listbox", O = null, k = C(""), A = C([]), j = () => {
33
- A.value = u([...f.children]);
31
+ let d = p(), f = b(), v = n(h), T = y(), E = y(), D = "cmdk-listbox", O = null, k = S(""), A = S([]), j = () => {
32
+ A.value = l([...d.children]);
34
33
  };
35
34
  j();
36
35
  let M = new MutationObserver(j);
37
- M.observe(f, {
36
+ M.observe(d, {
38
37
  characterData: !0,
39
38
  childList: !0,
40
39
  subtree: !0
41
- }), g(() => M.disconnect());
42
- let N = S(() => {
40
+ }), h(() => M.disconnect());
41
+ let N = x(() => {
43
42
  let t = e.items.value;
44
- return Array.isArray(t) ? t.map(l) : A.value;
45
- }), P = S(() => c(N.value, k.value, !!e["no-filter"].value)), F = S(() => s(P.value)), I = r({
43
+ return Array.isArray(t) ? t.map(c) : A.value;
44
+ }), P = x(() => s(N.value, k.value, !!e["no-filter"].value)), F = x(() => o(P.value)), I = r({
46
45
  getItems: () => P.value,
47
46
  isItemDisabled: (e) => e.disabled,
48
47
  onNavigate: () => {
49
48
  O?.querySelector("[data-focused]")?.scrollIntoView({ block: "nearest" });
50
49
  },
51
- signal: y
50
+ signal: v
52
51
  }), { focusedIndex: L } = I, R = () => {
53
52
  k.value = "", I.reset();
54
- }, { closeWithAnimation: z, overlay: B, requestClose: V, setupNativeListeners: H } = o({
53
+ }, { closeWithAnimation: z, overlay: B, requestClose: V, setupNativeListeners: H } = a({
55
54
  dialogRef: T,
56
55
  getPanelEl: () => T.value?.querySelector(".panel"),
57
- host: f,
58
- initialFocus: S(() => ".search-input"),
56
+ host: d,
57
+ initialFocus: x(() => ".search-input"),
59
58
  isPersistent: () => !1,
60
- onCleanup: g,
61
- onEvent: _,
59
+ onCleanup: h,
60
+ onEvent: g,
62
61
  onNativeClose: (e) => {
63
- p("close", { reason: e }), R();
62
+ f("close", { reason: e }), R();
64
63
  },
65
64
  onOpen: (e) => {
66
- p("open", { reason: e }), I.navigate("first");
65
+ f("open", { reason: e }), I.navigate("first");
67
66
  },
68
67
  openProp: e.open,
69
68
  performClose: () => z(),
70
- returnFocus: S(() => !0)
71
- }), U = a();
72
- U.mount(window), g(() => U.dispose());
69
+ returnFocus: x(() => !0)
70
+ }), U = w();
71
+ U.mount(window), h(() => U.dispose());
73
72
  let W = null;
74
- w(e.shortcut, (e) => {
73
+ C(e.shortcut, (e) => {
75
74
  W?.(), W = null;
76
75
  let n = (e ?? "").trim();
77
76
  if (n) try {
@@ -81,11 +80,11 @@ p(E, {
81
80
  } catch (e) {
82
81
  t(`invalid "shortcut" value "${n}" — ${e instanceof Error ? e.message : String(e)}`);
83
82
  }
84
- }, { immediate: !0 }), v(() => {
83
+ }, { immediate: !0 }), _(() => {
85
84
  H();
86
85
  });
87
86
  function G(t) {
88
- t.disabled || (p("select", {
87
+ t.disabled || (f("select", {
89
88
  item: t,
90
89
  label: t.label,
91
90
  value: t.value
@@ -93,7 +92,7 @@ p(E, {
93
92
  }
94
93
  function K(t) {
95
94
  let n = t.target.value;
96
- k.value = n, I.navigate("first"), p("search", { query: n });
95
+ k.value = n, I.navigate("first"), f("search", { query: n });
97
96
  let r = P.value.length;
98
97
  i(r === 0 ? e["empty-text"].value : `${r} result${r === 1 ? "" : "s"} found`);
99
98
  }
@@ -103,7 +102,7 @@ p(E, {
103
102
  t && (e.preventDefault(), G(t));
104
103
  }
105
104
  }
106
- return h`
105
+ return m`
107
106
  <dialog ref="${T}" class="dialog" part="dialog" aria-label="${e.label}" aria-modal="true">
108
107
  <div class="panel" part="panel">
109
108
  <div class="search" part="search">
@@ -138,7 +137,7 @@ p(E, {
138
137
  <div class="empty" role="presentation" ?hidden="${() => e.loading.value || F.value.length > 0}">
139
138
  ${() => e["empty-text"].value}
140
139
  </div>
141
- ${() => F.value.map((e) => e.type === "group" ? h`<div class="group-heading" role="presentation">${e.group}</div>` : h`<div
140
+ ${() => F.value.map((e) => e.type === "group" ? m`<div class="group-heading" role="presentation">${e.group}</div>` : m`<div
142
141
  class="item"
143
142
  part="item"
144
143
  role="option"
@@ -153,12 +152,12 @@ p(E, {
153
152
  @pointerenter="${() => {
154
153
  I.set(e.idx);
155
154
  }}">
156
- ${e.item.icon ? h`<span class="item-icon" aria-hidden="true"
155
+ ${e.item.icon ? m`<span class="item-icon" aria-hidden="true"
157
156
  ><ore-icon name="${e.item.icon}" size="16"></ore-icon
158
157
  ></span>` : ""}
159
158
  <span class="item-label">${e.item.label}</span>
160
- ${e.item.shortcut ? h`<span class="item-shortcut"
161
- >${d(e.item.shortcut).map((e) => h`<kbd>${e}</kbd>`)}</span
159
+ ${e.item.shortcut ? m`<span class="item-shortcut"
160
+ >${u(e.item.shortcut).map((e) => m`<kbd>${e}</kbd>`)}</span
162
161
  >` : ""}
163
162
  </div>`)}
164
163
  </div>
@@ -171,7 +170,7 @@ p(E, {
171
170
  </dialog>
172
171
  `;
173
172
  },
174
- styles: [e, f]
173
+ styles: [e, d]
175
174
  });
176
175
  //#endregion
177
176
  export { T as COMMAND_PALETTE_ITEM_TAG, E as COMMAND_PALETTE_TAG };
@@ -1 +1 @@
1
- {"version":3,"file":"command-palette.js","names":[],"sources":["../src/overlay/command-palette/command-palette.ts"],"sourcesContent":["import { createKeymap } from '@vielzeug/keymap';\nimport { define, html, ref, prop, getHost, onCleanup, onEvent, onMounted, useEmit } from '@vielzeug/ore';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport type { CommandPaletteItem, OreCommandPaletteEvents, OreCommandPaletteProps } from './command-palette.types';\n\nimport { warn } from '../../_dev';\nimport { announce, lifecycleSignal, createListControl } from '../../headless';\nimport { reducedMotionMixin } from '../../styles';\nimport { useDialogControl } from '../shared/use-dialog';\nimport { buildRows, filterItems, normalizeItem, parseSlottedItems, splitShortcutKeys } from './command-palette-items';\nimport '../../content/icon/icon';\nimport componentStyles from './command-palette.css?inline';\n\nexport type { OreCommandPaletteEvents, OreCommandPaletteProps } from './command-palette.types';\n\n/**\n * A pure data node describing one command. Never rendered directly — `ore-command-palette`\n * reads its attributes/text content and renders the visible row itself.\n *\n * @element ore-command-palette-item\n *\n * @attr {string} value - Value emitted by the `select` event and matched against the search query\n * @attr {string} label - Explicit label text; falls back to the element's text content\n * @attr {string} group - Group heading the item is clustered under\n * @attr {string} shortcut - Display-only keyboard hint rendered at the end of the row, one `<kbd>` per `+`-separated key (e.g. `\"⌘+S\"` renders two keycaps; a literal `+` key isn't representable — spell it out, e.g. `\"Ctrl+Plus\"`)\n * @attr {boolean} disabled - Excludes the item from keyboard navigation and selection\n *\n * @slot icon - Optional leading icon content\n *\n * @example\n * ```html\n * <ore-command-palette-item value=\"new-file\" group=\"File\" shortcut=\"⌘+N\">New File</ore-command-palette-item>\n * ```\n */\nexport const COMMAND_PALETTE_ITEM_TAG = 'ore-command-palette-item' as const;\ndefine(COMMAND_PALETTE_ITEM_TAG, {\n setup() {\n return html``;\n },\n});\n\n/**\n * A searchable, keyboard-driven list of commands presented in a centered modal —\n * the \"⌘K\" pattern popularized by editors and productivity apps. Built on the\n * native `<dialog>` element (focus trap, top-layer stacking, `Escape`-to-close)\n * and `@vielzeug/keymap` for the global shortcut that opens it.\n *\n * @element ore-command-palette\n * @element ore-command-palette-item - Slotted command definition (place in default slot)\n *\n * @attr {boolean} open - Controls the open state of the palette\n * @attr {string} label - Accessible label for the dialog (screen-reader-only heading)\n * @attr {string} placeholder - Placeholder text for the search input\n * @attr {string} shortcut - Global keyboard shortcut (keymap syntax) that toggles the palette. Default `\"mod+k\"`; set to `\"\"` to disable\n * @attr {boolean} no-filter - Disable built-in client-side filtering (for server-driven search)\n * @attr {boolean} loading - Shows a loading row below the search input\n * @attr {string} empty-text - Message shown when no item matches the query\n * @attr {boolean} keep-open-on-select - Keep the palette open after an item is selected\n *\n * @fires open - Fired when the palette opens. detail: `{ reason }`\n * @fires close - Fired when the palette closes. detail: `{ reason }`\n * @fires search - Fired on every keystroke in the search input. detail: `{ query }`\n * @fires select - Fired when a command is chosen (click or `Enter`). detail: `{ value, label, item }`\n *\n * @slot - `<ore-command-palette-item>` elements (alternative/supplement to the `items` prop)\n *\n * @cssprop --command-palette-bg - Panel background color\n * @cssprop --command-palette-border-color - Panel border color\n * @cssprop --command-palette-radius - Panel border radius\n * @cssprop --command-palette-shadow - Panel drop shadow\n * @cssprop --command-palette-max-width - Maximum panel width\n * @cssprop --command-palette-backdrop - Backdrop overlay color\n * @cssprop --command-palette-option-hover-bg - Item background on hover\n * @cssprop --command-palette-option-focus-bg - Item background when keyboard-focused\n *\n * @part dialog - Dialog root container\n * @part panel - Panel container\n * @part input - Search input\n * @part listbox - Listbox of matching commands\n *\n * @example\n * ```html\n * <ore-command-palette label=\"Command palette\" placeholder=\"Type a command…\">\n * <ore-command-palette-item value=\"new-file\" group=\"File\" shortcut=\"⌘+N\">New File</ore-command-palette-item>\n * <ore-command-palette-item value=\"open-file\" group=\"File\" shortcut=\"⌘+O\">Open File…</ore-command-palette-item>\n * <ore-command-palette-item value=\"toggle-theme\" group=\"View\">Toggle Theme</ore-command-palette-item>\n * </ore-command-palette>\n * ```\n */\nexport const COMMAND_PALETTE_TAG = 'ore-command-palette' as const;\ndefine<OreCommandPaletteProps>(COMMAND_PALETTE_TAG, {\n props: {\n 'empty-text': prop.string('No results found.'),\n items: prop.data<OreCommandPaletteProps['items']>(),\n 'keep-open-on-select': prop.bool(false),\n label: prop.string('Command palette'),\n loading: prop.bool(false),\n 'no-filter': prop.bool(false),\n open: prop.bool(false),\n placeholder: prop.string('Type a command or search…'),\n shortcut: prop.string('mod+k'),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreCommandPaletteEvents>();\n const abortSignal = lifecycleSignal(onCleanup);\n\n const dialogRef = ref<HTMLDialogElement>();\n const searchInputRef = ref<HTMLInputElement>();\n const listboxId = 'cmdk-listbox';\n\n let listboxEl: HTMLElement | null = null;\n\n const query = signal('');\n\n // ── Items: slotted <ore-command-palette-item> elements, merged with the `items` prop ──\n // Items are pure data nodes (see `ore-command-palette-item`'s own doc comment) — they're\n // never projected through a `<slot>`, just read directly off the host's light DOM. That\n // sidesteps `useSlots()`/`slotchange` entirely: a plain MutationObserver on the host\n // already covers everything `slotchange` would (an item added or removed) *and* the case\n // it can't — an already-assigned item's own text/attributes changing. For items written\n // as static, inline HTML, the browser's parser can insert the last item before appending\n // its text-node child; without watching `characterData`, that would permanently cache an\n // empty label, since nothing else re-triggers once the element itself stops changing.\n const slottedItems = signal<CommandPaletteItem[]>([]);\n\n const reparseSlottedItems = (): void => {\n slottedItems.value = parseSlottedItems([...el.children]);\n };\n\n reparseSlottedItems();\n\n const lightDomObserver = new MutationObserver(reparseSlottedItems);\n\n lightDomObserver.observe(el, { characterData: true, childList: true, subtree: true });\n onCleanup(() => lightDomObserver.disconnect());\n\n const allItems = computed<CommandPaletteItem[]>(() => {\n const explicit = props.items.value;\n\n return Array.isArray(explicit) ? explicit.map(normalizeItem) : slottedItems.value;\n });\n\n const filteredItems = computed(() => filterItems(allItems.value, query.value, Boolean(props['no-filter'].value)));\n const rows = computed(() => buildRows(filteredItems.value));\n\n // ── Keyboard navigation over the filtered list (Up/Down/Home/End) ──\n const scrollFocusedIntoView = (): void => {\n listboxEl?.querySelector<HTMLElement>('[data-focused]')?.scrollIntoView({ block: 'nearest' });\n };\n\n const list = createListControl<CommandPaletteItem>({\n getItems: () => filteredItems.value,\n isItemDisabled: (item) => item.disabled,\n onNavigate: scrollFocusedIntoView,\n signal: abortSignal,\n });\n const { focusedIndex } = list;\n\n // ── Dialog chrome: native <dialog>, focus trap, Escape, backdrop click ──\n const resetSearch = (): void => {\n query.value = '';\n list.reset();\n };\n\n const { closeWithAnimation, overlay, requestClose, setupNativeListeners } = useDialogControl({\n dialogRef,\n getPanelEl: () => dialogRef.value?.querySelector<HTMLElement>('.panel'),\n host: el,\n initialFocus: computed(() => '.search-input'),\n isPersistent: () => false,\n onCleanup,\n onEvent,\n onNativeClose: (reason) => {\n emit('close', { reason });\n resetSearch();\n },\n onOpen: (reason) => {\n emit('open', { reason });\n list.navigate('first');\n },\n openProp: props.open,\n performClose: () => closeWithAnimation(),\n returnFocus: computed(() => true),\n });\n\n // ── Global keyboard shortcut (opens/closes the palette from anywhere) ──\n const globalKeymap = createKeymap();\n\n globalKeymap.mount(window);\n onCleanup(() => globalKeymap.dispose());\n\n let unbindShortcut: (() => void) | null = null;\n\n watch(\n props.shortcut,\n (shortcutStr) => {\n unbindShortcut?.();\n unbindShortcut = null;\n\n const trimmed = (shortcutStr ?? '').trim();\n\n if (!trimmed) return;\n\n try {\n unbindShortcut = globalKeymap.bind(trimmed, () => {\n overlay.toggle('keyboard', 'trigger');\n });\n } catch (error) {\n warn(`invalid \"shortcut\" value \"${trimmed}\" — ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n { immediate: true },\n );\n\n onMounted(() => {\n setupNativeListeners();\n });\n\n // ── Selection ────────────────────────────────────────────────────────────\n function selectItem(item: CommandPaletteItem): void {\n if (item.disabled) return;\n\n emit('select', { item, label: item.label, value: item.value });\n\n if (props['keep-open-on-select'].value) {\n searchInputRef.value?.focus();\n } else {\n requestClose('trigger');\n }\n }\n\n function handleInput(e: Event): void {\n const value = (e.target as HTMLInputElement).value;\n\n query.value = value;\n list.navigate('first');\n emit('search', { query: value });\n\n const count = filteredItems.value.length;\n\n announce(count === 0 ? props['empty-text'].value! : `${count} result${count === 1 ? '' : 's'} found`);\n }\n\n function handleKeydown(e: KeyboardEvent): void {\n if (list.handleKeydown(e)) return;\n\n if (e.key === 'Enter') {\n // `list.navigate('first')` (called on open and on every keystroke) already keeps\n // the focused row off a disabled item, so this fallback is only ever reached when\n // nothing has been focused yet — but it mirrors `selectItem`'s own disabled guard\n // rather than blindly grabbing index 0, in case that navigate-on-open wiring ever\n // changes.\n const active = list.getActiveItem() ?? filteredItems.value.find((item) => !item.disabled);\n\n if (active) {\n e.preventDefault();\n selectItem(active);\n }\n }\n }\n\n return html`\n <dialog ref=\"${dialogRef}\" class=\"dialog\" part=\"dialog\" aria-label=\"${props.label}\" aria-modal=\"true\">\n <div class=\"panel\" part=\"panel\">\n <div class=\"search\" part=\"search\">\n <span class=\"search-icon\" aria-hidden=\"true\"><ore-icon name=\"search\" size=\"18\"></ore-icon></span>\n <input\n ref=\"${searchInputRef}\"\n class=\"search-input\"\n part=\"input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-controls=\"${listboxId}\"\n aria-activedescendant=\"${() => (focusedIndex.value >= 0 ? `${listboxId}-opt-${focusedIndex.value}` : '')}\"\n placeholder=\"${props.placeholder}\"\n value=\"${query}\"\n @input=\"${handleInput}\"\n @keydown=\"${handleKeydown}\" />\n <span class=\"search-loader\" ?hidden=\"${() => !props.loading.value}\" aria-hidden=\"true\"></span>\n </div>\n <div\n class=\"listbox\"\n part=\"listbox\"\n role=\"listbox\"\n id=\"${listboxId}\"\n aria-label=\"Commands\"\n ref=\"${(listEl: HTMLElement) => {\n listboxEl = listEl;\n }}\">\n <div class=\"empty\" role=\"presentation\" ?hidden=\"${() => props.loading.value || rows.value.length > 0}\">\n ${() => props['empty-text'].value}\n </div>\n ${() =>\n rows.value.map((row) =>\n row.type === 'group'\n ? html`<div class=\"group-heading\" role=\"presentation\">${row.group}</div>`\n : html`<div\n class=\"item\"\n part=\"item\"\n role=\"option\"\n id=\"${`${listboxId}-opt-${row.idx}`}\"\n aria-selected=\"${() => String(focusedIndex.value === row.idx)}\"\n aria-disabled=\"${() => String(row.item.disabled)}\"\n ?data-focused=\"${() => focusedIndex.value === row.idx}\"\n ?data-disabled=\"${() => row.item.disabled}\"\n @click=\"${(e: MouseEvent) => {\n e.stopPropagation();\n selectItem(row.item);\n }}\"\n @pointerenter=\"${() => {\n list.set(row.idx);\n }}\">\n ${\n row.item.icon\n ? html`<span class=\"item-icon\" aria-hidden=\"true\"\n ><ore-icon name=\"${row.item.icon}\" size=\"16\"></ore-icon\n ></span>`\n : ''\n }\n <span class=\"item-label\">${row.item.label}</span>\n ${\n row.item.shortcut\n ? html`<span class=\"item-shortcut\"\n >${splitShortcutKeys(row.item.shortcut).map((key) => html`<kbd>${key}</kbd>`)}</span\n >`\n : ''\n }\n </div>`,\n )}\n </div>\n <div class=\"footer\" part=\"footer\">\n <span class=\"footer-hint\"><kbd>↑</kbd><kbd>↓</kbd> Navigate</span>\n <span class=\"footer-hint\"><kbd>Enter</kbd> Select</span>\n <span class=\"footer-hint\"><kbd>Esc</kbd> Close</span>\n </div>\n </div>\n </dialog>\n `;\n },\n styles: [reducedMotionMixin, componentStyles],\n});\n"],"mappings":";;;;;;;;;;;;;AAmCA,IAAa,IAA2B;AACxC,EAAO,GAA0B,EAC/B,QAAQ;CACN,OAAO,CAAI;AACb,EACF,CAAC;AAkDD,IAAa,IAAsB;AACnC,EAA+B,GAAqB;CAClD,OAAO;EACL,cAAc,EAAK,OAAO,mBAAmB;EAC7C,OAAO,EAAK,KAAsC;EAClD,uBAAuB,EAAK,KAAK,EAAK;EACtC,OAAO,EAAK,OAAO,iBAAiB;EACpC,SAAS,EAAK,KAAK,EAAK;EACxB,aAAa,EAAK,KAAK,EAAK;EAC5B,MAAM,EAAK,KAAK,EAAK;EACrB,aAAa,EAAK,OAAO,2BAA2B;EACpD,UAAU,EAAK,OAAO,OAAO;CAC/B;CACA,MAAM,GAAO;EACX,IAAM,IAAK,EAAQ,GACb,IAAO,EAAiC,GACxC,IAAc,EAAgB,CAAS,GAEvC,IAAY,EAAuB,GACnC,IAAiB,EAAsB,GACvC,IAAY,gBAEd,IAAgC,MAE9B,IAAQ,EAAO,EAAE,GAWjB,IAAe,EAA6B,CAAC,CAAC,GAE9C,UAAkC;GACtC,EAAa,QAAQ,EAAkB,CAAC,GAAG,EAAG,QAAQ,CAAC;EACzD;EAEA,EAAoB;EAEpB,IAAM,IAAmB,IAAI,iBAAiB,CAAmB;EAGjE,AADA,EAAiB,QAAQ,GAAI;GAAE,eAAe;GAAM,WAAW;GAAM,SAAS;EAAK,CAAC,GACpF,QAAgB,EAAiB,WAAW,CAAC;EAE7C,IAAM,IAAW,QAAqC;GACpD,IAAM,IAAW,EAAM,MAAM;GAE7B,OAAO,MAAM,QAAQ,CAAQ,IAAI,EAAS,IAAI,CAAa,IAAI,EAAa;EAC9E,CAAC,GAEK,IAAgB,QAAe,EAAY,EAAS,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AI,GAAG,EAAE;6CACvC,OAAO,EAAI,KAAK,QAAQ,EAAE;6CAC1B,EAAa,UAAU,EAAI,IAAI;8CAC9B,EAAI,KAAK,SAAS;iCAC/B,MAAkB;GAE3B,AADA,EAAE,gBAAgB,GAClB,EAAW,EAAI,IAAI;EACrB,EAAE;6CACqB;GACrB,EAAK,IAAI,EAAI,GAAG;EAClB,EAAE;wBAEA,EAAI,KAAK,OACL,CAAI;iDACiB,EAAI,KAAK,KAAK;wCAEnC,GACL;iDAC0B,EAAI,KAAK,MAAM;wBAExC,EAAI,KAAK,WACL,CAAI;iCACC,EAAkB,EAAI,KAAK,QAAQ,CAAC,CAAC,KAAK,MAAQ,CAAI,QAAQ,EAAI,OAAO,EAAE;iCAEhF,GACL;2BAET,EAAE;;;;;;;;;;CAUd;CACA,QAAQ,CAAC,GAAoB,CAAe;AAC9C,CAAC"}
1
+ {"version":3,"file":"command-palette.js","names":[],"sources":["../src/overlay/command-palette/command-palette.ts"],"sourcesContent":["import { createKeymap } from '@vielzeug/keymap';\nimport { define, html, ref, prop, getHost, onCleanup, onEvent, onMounted, useEmit } from '@vielzeug/ore';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport type { CommandPaletteItem, OreCommandPaletteEvents, OreCommandPaletteProps } from './command-palette.types';\n\nimport { warn } from '../../_dev';\nimport { announce, lifecycleSignal, createListControl } from '../../headless';\nimport { reducedMotionMixin } from '../../styles';\nimport { useDialogControl } from '../shared/use-dialog';\nimport { buildRows, filterItems, normalizeItem, parseSlottedItems, splitShortcutKeys } from './command-palette-items';\nimport '../../content/icon/icon';\nimport componentStyles from './command-palette.css?inline';\n\nexport type { OreCommandPaletteEvents, OreCommandPaletteProps } from './command-palette.types';\n\n/**\n * A pure data node describing one command. Never rendered directly — `ore-command-palette`\n * reads its attributes/text content and renders the visible row itself.\n *\n * @element ore-command-palette-item\n *\n * @attr {string} value - Value emitted by the `select` event and matched against the search query\n * @attr {string} label - Explicit label text; falls back to the element's text content\n * @attr {string} group - Group heading the item is clustered under\n * @attr {string} shortcut - Display-only keyboard hint rendered at the end of the row, one `<kbd>` per `+`-separated key (e.g. `\"⌘+S\"` renders two keycaps; a literal `+` key isn't representable — spell it out, e.g. `\"Ctrl+Plus\"`)\n * @attr {boolean} disabled - Excludes the item from keyboard navigation and selection\n *\n * @slot icon - Optional leading icon content\n *\n * @example\n * ```html\n * <ore-command-palette-item value=\"new-file\" group=\"File\" shortcut=\"⌘+N\">New File</ore-command-palette-item>\n * ```\n */\nexport const COMMAND_PALETTE_ITEM_TAG = 'ore-command-palette-item' as const;\ndefine(COMMAND_PALETTE_ITEM_TAG, {\n setup() {\n return html``;\n },\n});\n\n/**\n * A searchable, keyboard-driven list of commands presented in a centered modal —\n * the \"⌘K\" pattern popularized by editors and productivity apps. Built on the\n * native `<dialog>` element (focus trap, top-layer stacking, `Escape`-to-close)\n * and `@vielzeug/keymap` for the global shortcut that opens it.\n *\n * @element ore-command-palette\n * @element ore-command-palette-item - Slotted command definition (place in default slot)\n *\n * @attr {boolean} open - Controls the open state of the palette\n * @attr {string} label - Accessible label for the dialog (screen-reader-only heading)\n * @attr {string} placeholder - Placeholder text for the search input\n * @attr {string} shortcut - Global keyboard shortcut (keymap syntax) that toggles the palette. Default `\"mod+k\"`; set to `\"\"` to disable\n * @attr {boolean} no-filter - Disable built-in client-side filtering (for server-driven search)\n * @attr {boolean} loading - Shows a loading row below the search input\n * @attr {string} empty-text - Message shown when no item matches the query\n * @attr {boolean} keep-open-on-select - Keep the palette open after an item is selected\n *\n * @fires open - Fired when the palette opens. detail: `{ reason }`\n * @fires close - Fired when the palette closes. detail: `{ reason }`\n * @fires search - Fired on every keystroke in the search input. detail: `{ query }`\n * @fires select - Fired when a command is chosen (click or `Enter`). detail: `{ value, label, item }`\n *\n * @slot - `<ore-command-palette-item>` elements (alternative/supplement to the `items` prop)\n *\n * @cssprop --command-palette-bg - Panel background color\n * @cssprop --command-palette-border-color - Panel border color\n * @cssprop --command-palette-radius - Panel border radius\n * @cssprop --command-palette-shadow - Panel drop shadow\n * @cssprop --command-palette-max-width - Maximum panel width\n * @cssprop --command-palette-backdrop - Backdrop overlay color\n * @cssprop --command-palette-option-hover-bg - Item background on hover\n * @cssprop --command-palette-option-focus-bg - Item background when keyboard-focused\n *\n * @part dialog - Dialog root container\n * @part panel - Panel container\n * @part input - Search input\n * @part listbox - Listbox of matching commands\n *\n * @example\n * ```html\n * <ore-command-palette label=\"Command palette\" placeholder=\"Type a command…\">\n * <ore-command-palette-item value=\"new-file\" group=\"File\" shortcut=\"⌘+N\">New File</ore-command-palette-item>\n * <ore-command-palette-item value=\"open-file\" group=\"File\" shortcut=\"⌘+O\">Open File…</ore-command-palette-item>\n * <ore-command-palette-item value=\"toggle-theme\" group=\"View\">Toggle Theme</ore-command-palette-item>\n * </ore-command-palette>\n * ```\n */\nexport const COMMAND_PALETTE_TAG = 'ore-command-palette' as const;\ndefine<OreCommandPaletteProps>(COMMAND_PALETTE_TAG, {\n props: {\n 'empty-text': prop.string('No results found.'),\n items: prop.data<OreCommandPaletteProps['items']>(),\n 'keep-open-on-select': prop.bool(false),\n label: prop.string('Command palette'),\n loading: prop.bool(false),\n 'no-filter': prop.bool(false),\n open: prop.bool(false),\n placeholder: prop.string('Type a command or search…'),\n shortcut: prop.string('mod+k'),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreCommandPaletteEvents>();\n const abortSignal = lifecycleSignal(onCleanup);\n\n const dialogRef = ref<HTMLDialogElement>();\n const searchInputRef = ref<HTMLInputElement>();\n const listboxId = 'cmdk-listbox';\n\n let listboxEl: HTMLElement | null = null;\n\n const query = signal('');\n\n // ── Items: slotted <ore-command-palette-item> elements, merged with the `items` prop ──\n // Items are pure data nodes (see `ore-command-palette-item`'s own doc comment) — they're\n // never projected through a `<slot>`, just read directly off the host's light DOM. That\n // sidesteps `useSlots()`/`slotchange` entirely: a plain MutationObserver on the host\n // already covers everything `slotchange` would (an item added or removed) *and* the case\n // it can't — an already-assigned item's own text/attributes changing. For items written\n // as static, inline HTML, the browser's parser can insert the last item before appending\n // its text-node child; without watching `characterData`, that would permanently cache an\n // empty label, since nothing else re-triggers once the element itself stops changing.\n const slottedItems = signal<CommandPaletteItem[]>([]);\n\n const reparseSlottedItems = (): void => {\n slottedItems.value = parseSlottedItems([...el.children]);\n };\n\n reparseSlottedItems();\n\n const lightDomObserver = new MutationObserver(reparseSlottedItems);\n\n lightDomObserver.observe(el, { characterData: true, childList: true, subtree: true });\n onCleanup(() => lightDomObserver.disconnect());\n\n const allItems = computed<CommandPaletteItem[]>(() => {\n const explicit = props.items.value;\n\n return Array.isArray(explicit) ? explicit.map(normalizeItem) : slottedItems.value;\n });\n\n const filteredItems = computed(() => filterItems(allItems.value, query.value, Boolean(props['no-filter'].value)));\n const rows = computed(() => buildRows(filteredItems.value));\n\n // ── Keyboard navigation over the filtered list (Up/Down/Home/End) ──\n const scrollFocusedIntoView = (): void => {\n listboxEl?.querySelector<HTMLElement>('[data-focused]')?.scrollIntoView({ block: 'nearest' });\n };\n\n const list = createListControl<CommandPaletteItem>({\n getItems: () => filteredItems.value,\n isItemDisabled: (item) => item.disabled,\n onNavigate: scrollFocusedIntoView,\n signal: abortSignal,\n });\n const { focusedIndex } = list;\n\n // ── Dialog chrome: native <dialog>, focus trap, Escape, backdrop click ──\n const resetSearch = (): void => {\n query.value = '';\n list.reset();\n };\n\n const { closeWithAnimation, overlay, requestClose, setupNativeListeners } = useDialogControl({\n dialogRef,\n getPanelEl: () => dialogRef.value?.querySelector<HTMLElement>('.panel'),\n host: el,\n initialFocus: computed(() => '.search-input'),\n isPersistent: () => false,\n onCleanup,\n onEvent,\n onNativeClose: (reason) => {\n emit('close', { reason });\n resetSearch();\n },\n onOpen: (reason) => {\n emit('open', { reason });\n list.navigate('first');\n },\n openProp: props.open,\n performClose: () => closeWithAnimation(),\n returnFocus: computed(() => true),\n });\n\n // ── Global keyboard shortcut (opens/closes the palette from anywhere) ──\n const globalKeymap = createKeymap();\n\n globalKeymap.mount(window);\n onCleanup(() => globalKeymap.dispose());\n\n let unbindShortcut: (() => void) | null = null;\n\n watch(\n props.shortcut,\n (shortcutStr) => {\n unbindShortcut?.();\n unbindShortcut = null;\n\n const trimmed = (shortcutStr ?? '').trim();\n\n if (!trimmed) return;\n\n try {\n unbindShortcut = globalKeymap.bind(trimmed, () => {\n overlay.toggle('keyboard', 'trigger');\n });\n } catch (error) {\n warn(`invalid \"shortcut\" value \"${trimmed}\" — ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n { immediate: true },\n );\n\n onMounted(() => {\n setupNativeListeners();\n });\n\n // ── Selection ────────────────────────────────────────────────────────────\n function selectItem(item: CommandPaletteItem): void {\n if (item.disabled) return;\n\n emit('select', { item, label: item.label, value: item.value });\n\n if (props['keep-open-on-select'].value) {\n searchInputRef.value?.focus();\n } else {\n requestClose('trigger');\n }\n }\n\n function handleInput(e: Event): void {\n const value = (e.target as HTMLInputElement).value;\n\n query.value = value;\n list.navigate('first');\n emit('search', { query: value });\n\n const count = filteredItems.value.length;\n\n announce(count === 0 ? props['empty-text'].value! : `${count} result${count === 1 ? '' : 's'} found`);\n }\n\n function handleKeydown(e: KeyboardEvent): void {\n if (list.handleKeydown(e)) return;\n\n if (e.key === 'Enter') {\n // `list.navigate('first')` (called on open and on every keystroke) already keeps\n // the focused row off a disabled item, so this fallback is only ever reached when\n // nothing has been focused yet — but it mirrors `selectItem`'s own disabled guard\n // rather than blindly grabbing index 0, in case that navigate-on-open wiring ever\n // changes.\n const active = list.getActiveItem() ?? filteredItems.value.find((item) => !item.disabled);\n\n if (active) {\n e.preventDefault();\n selectItem(active);\n }\n }\n }\n\n return html`\n <dialog ref=\"${dialogRef}\" class=\"dialog\" part=\"dialog\" aria-label=\"${props.label}\" aria-modal=\"true\">\n <div class=\"panel\" part=\"panel\">\n <div class=\"search\" part=\"search\">\n <span class=\"search-icon\" aria-hidden=\"true\"><ore-icon name=\"search\" size=\"18\"></ore-icon></span>\n <input\n ref=\"${searchInputRef}\"\n class=\"search-input\"\n part=\"input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-controls=\"${listboxId}\"\n aria-activedescendant=\"${() => (focusedIndex.value >= 0 ? `${listboxId}-opt-${focusedIndex.value}` : '')}\"\n placeholder=\"${props.placeholder}\"\n value=\"${query}\"\n @input=\"${handleInput}\"\n @keydown=\"${handleKeydown}\" />\n <span class=\"search-loader\" ?hidden=\"${() => !props.loading.value}\" aria-hidden=\"true\"></span>\n </div>\n <div\n class=\"listbox\"\n part=\"listbox\"\n role=\"listbox\"\n id=\"${listboxId}\"\n aria-label=\"Commands\"\n ref=\"${(listEl: HTMLElement) => {\n listboxEl = listEl;\n }}\">\n <div class=\"empty\" role=\"presentation\" ?hidden=\"${() => props.loading.value || rows.value.length > 0}\">\n ${() => props['empty-text'].value}\n </div>\n ${() =>\n rows.value.map((row) =>\n row.type === 'group'\n ? html`<div class=\"group-heading\" role=\"presentation\">${row.group}</div>`\n : html`<div\n class=\"item\"\n part=\"item\"\n role=\"option\"\n id=\"${`${listboxId}-opt-${row.idx}`}\"\n aria-selected=\"${() => String(focusedIndex.value === row.idx)}\"\n aria-disabled=\"${() => String(row.item.disabled)}\"\n ?data-focused=\"${() => focusedIndex.value === row.idx}\"\n ?data-disabled=\"${() => row.item.disabled}\"\n @click=\"${(e: MouseEvent) => {\n e.stopPropagation();\n selectItem(row.item);\n }}\"\n @pointerenter=\"${() => {\n list.set(row.idx);\n }}\">\n ${\n row.item.icon\n ? html`<span class=\"item-icon\" aria-hidden=\"true\"\n ><ore-icon name=\"${row.item.icon}\" size=\"16\"></ore-icon\n ></span>`\n : ''\n }\n <span class=\"item-label\">${row.item.label}</span>\n ${\n row.item.shortcut\n ? html`<span class=\"item-shortcut\"\n >${splitShortcutKeys(row.item.shortcut).map((key) => html`<kbd>${key}</kbd>`)}</span\n >`\n : ''\n }\n </div>`,\n )}\n </div>\n <div class=\"footer\" part=\"footer\">\n <span class=\"footer-hint\"><kbd>↑</kbd><kbd>↓</kbd> Navigate</span>\n <span class=\"footer-hint\"><kbd>Enter</kbd> Select</span>\n <span class=\"footer-hint\"><kbd>Esc</kbd> Close</span>\n </div>\n </div>\n </dialog>\n `;\n },\n styles: [reducedMotionMixin, componentStyles],\n});\n"],"mappings":";;;;;;;;;;;;AAmCA,IAAa,IAA2B;AACxC,EAAO,GAA0B,EAC/B,QAAQ;CACN,OAAO,CAAI;AACb,EACF,CAAC;AAkDD,IAAa,IAAsB;AACnC,EAA+B,GAAqB;CAClD,OAAO;EACL,cAAc,EAAK,OAAO,mBAAmB;EAC7C,OAAO,EAAK,KAAsC;EAClD,uBAAuB,EAAK,KAAK,EAAK;EACtC,OAAO,EAAK,OAAO,iBAAiB;EACpC,SAAS,EAAK,KAAK,EAAK;EACxB,aAAa,EAAK,KAAK,EAAK;EAC5B,MAAM,EAAK,KAAK,EAAK;EACrB,aAAa,EAAK,OAAO,2BAA2B;EACpD,UAAU,EAAK,OAAO,OAAO;CAC/B;CACA,MAAM,GAAO;EACX,IAAM,IAAK,EAAQ,GACb,IAAO,EAAiC,GACxC,IAAc,EAAgB,CAAS,GAEvC,IAAY,EAAuB,GACnC,IAAiB,EAAsB,GACvC,IAAY,gBAEd,IAAgC,MAE9B,IAAQ,EAAO,EAAE,GAWjB,IAAe,EAA6B,CAAC,CAAC,GAE9C,UAAkC;GACtC,EAAa,QAAQ,EAAkB,CAAC,GAAG,EAAG,QAAQ,CAAC;EACzD;EAEA,EAAoB;EAEpB,IAAM,IAAmB,IAAI,iBAAiB,CAAmB;EAGjE,AADA,EAAiB,QAAQ,GAAI;GAAE,eAAe;GAAM,WAAW;GAAM,SAAS;EAAK,CAAC,GACpF,QAAgB,EAAiB,WAAW,CAAC;EAE7C,IAAM,IAAW,QAAqC;GACpD,IAAM,IAAW,EAAM,MAAM;GAE7B,OAAO,MAAM,QAAQ,CAAQ,IAAI,EAAS,IA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;;;4BAII,GAAG,EAAU,OAAO,EAAI,MAAM;6CACb,OAAO,EAAa,UAAU,EAAI,GAAG,EAAE;6CACvC,OAAO,EAAI,KAAK,QAAQ,EAAE;6CAC1B,EAAa,UAAU,EAAI,IAAI;8CAC9B,EAAI,KAAK,SAAS;iCAC/B,MAAkB;GAE3B,AADA,EAAE,gBAAgB,GAClB,EAAW,EAAI,IAAI;EACrB,EAAE;6CACqB;GACrB,EAAK,IAAI,EAAI,GAAG;EAClB,EAAE;wBAEA,EAAI,KAAK,OACL,CAAI;iDACiB,EAAI,KAAK,KAAK;wCAEnC,GACL;iDAC0B,EAAI,KAAK,MAAM;wBAExC,EAAI,KAAK,WACL,CAAI;iCACC,EAAkB,EAAI,KAAK,QAAQ,CAAC,CAAC,KAAK,MAAQ,CAAI,QAAQ,EAAI,OAAO,EAAE;iCAEhF,GACL;2BAET,EAAE;;;;;;;;;;CAUd;CACA,QAAQ,CAAC,GAAoB,CAAe;AAC9C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"code-window.d.ts","sourceRoot":"","sources":["../../../src/content/code-window/code-window.ts"],"names":[],"mappings":"AAMA,gCAAgC;AAChC,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhD,6CAA6C;AAC7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,eAAe,EAAG,iBAA0B,CAAC"}
1
+ {"version":3,"file":"code-window.d.ts","sourceRoot":"","sources":["../../../src/content/code-window/code-window.ts"],"names":[],"mappings":"AA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