@smilodon/vue 1.4.5 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -288,7 +288,19 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
288
288
  element.setAttribute("placement", props.placement);
289
289
  }
290
290
  if ((_a = props.items) == null ? void 0 : _a.length) {
291
- element.setItems(props.items);
291
+ const first = props.items[0];
292
+ if (first && first.group !== void 0) {
293
+ const map = /* @__PURE__ */ new Map();
294
+ props.items.forEach((it) => {
295
+ const g = it.group ?? "Ungrouped";
296
+ if (!map.has(g)) map.set(g, []);
297
+ map.get(g).push(it);
298
+ });
299
+ const groups = Array.from(map.entries()).map(([label, options]) => ({ label, options }));
300
+ element.setGroupedItems(groups);
301
+ } else {
302
+ element.setItems(props.items);
303
+ }
292
304
  }
293
305
  if ((_b = props.groupedItems) == null ? void 0 : _b.length) {
294
306
  element.setGroupedItems(props.groupedItems);
@@ -376,7 +388,7 @@ const _export_sfc = (sfc, props) => {
376
388
  }
377
389
  return target;
378
390
  };
379
- const Select = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0718553b"]]);
391
+ const Select = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-195defd9"]]);
380
392
  exports.Select = Select;
381
393
  exports.default = Select;
382
394
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/Select.vue"],"sourcesContent":["<!--\n Smilodon Select Component for Vue 3\n \n A production-ready, accessible select component with advanced features:\n - Single and multi-select modes\n - Searchable with client or server-side filtering\n - Infinite scroll and virtual scrolling for large datasets\n - Grouped options\n - Custom rendering\n - Full keyboard navigation\n - WCAG 2.1 AAA compliant\n \n @example\n <Select\n :items=\"items\"\n v-model=\"selectedValue\"\n searchable\n placeholder=\"Select an option...\"\n />\n-->\n\n<template>\n <enhanced-select\n ref=\"selectRef\"\n :class=\"className\"\n :style=\"style\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, onMounted, onBeforeUnmount, computed, render, isVNode, h } from 'vue';\nimport type {\n SelectEventDetail,\n OpenEventDetail,\n CloseEventDetail,\n SearchEventDetail,\n ChangeEventDetail,\n LoadMoreEventDetail,\n ClearEventDetail,\n GroupedItem,\n RendererHelpers,\n} from '@smilodon/core';\n\nexport interface SelectItem {\n value: string | number;\n label: string;\n disabled?: boolean;\n group?: string;\n [key: string]: any;\n}\n\nexport interface SelectProps {\n /** Array of items to display in the select */\n items?: SelectItem[];\n /** Grouped items (alternative to items) */\n groupedItems?: GroupedItem[];\n /** Selected value(s) - for v-model binding */\n modelValue?: string | number | (string | number)[];\n /** Default value for uncontrolled mode */\n defaultValue?: string | number | (string | number)[];\n /** Enable multi-select mode */\n multiple?: boolean;\n /** Enable search functionality */\n searchable?: boolean;\n /** Placeholder text */\n placeholder?: string;\n /** Disable the select */\n disabled?: boolean;\n /** Mark as required */\n required?: boolean;\n /** Show error state */\n error?: boolean;\n /** Enable infinite scroll */\n infiniteScroll?: boolean;\n /** Number of items per page (for infinite scroll) */\n pageSize?: number;\n /** Enable virtual scrolling */\n virtualized?: boolean;\n /** Maximum number of selections (for multi-select) */\n maxSelections?: number;\n /** Dropdown placement */\n placement?: 'bottom' | 'top' | 'auto';\n /** Custom CSS class */\n className?: string;\n /** Custom inline styles */\n style?: Record<string, string>;\n /** Enable expandable dropdown */\n expandable?: boolean;\n\n /** Enable clear control button */\n clearable?: boolean;\n\n /** Clear selected values when clear control is clicked */\n clearSelectionOnClear?: boolean;\n\n /** Clear search query when clear control is clicked */\n clearSearchOnClear?: boolean;\n\n /** ARIA label for clear control */\n clearAriaLabel?: string;\n\n /** Icon text for clear control */\n clearIcon?: string;\n\n /** Custom option renderer returning an HTMLElement */\n optionRenderer?: (item: SelectItem, index: number, helpers: RendererHelpers) => HTMLElement;\n\n /** Custom Vue renderer returning a VNode */\n customRenderer?: (item: SelectItem, index: number) => ReturnType<typeof h>;\n}\n\nexport interface SelectEmits {\n /** Emitted when selection changes - for v-model */\n (e: 'update:modelValue', value: string | number | (string | number)[]): void;\n /** Emitted when selection changes with full details */\n (e: 'change', value: string | number | (string | number)[], selectedItems: SelectItem[]): void;\n /** Emitted when an item is selected */\n (e: 'select', item: SelectItem, index: number): void;\n /** Emitted when dropdown opens */\n (e: 'open'): void;\n /** Emitted when dropdown closes */\n (e: 'close'): void;\n /** Emitted when search query changes */\n (e: 'search', query: string): void;\n /** Emitted when more items are requested (infinite scroll) */\n (e: 'loadMore', page: number): void;\n /** Emitted when user creates a new item (if enabled) */\n (e: 'create', value: string): void;\n /** Emitted when clear control is used */\n (e: 'clear', detail: { clearedSelection: boolean; clearedSearch: boolean }): void;\n}\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n items: () => [],\n multiple: false,\n searchable: false,\n disabled: false,\n required: false,\n error: false,\n infiniteScroll: false,\n pageSize: 50,\n virtualized: true,\n placement: 'auto',\n clearable: false,\n clearSelectionOnClear: true,\n clearSearchOnClear: true,\n});\n\nconst emit = defineEmits<SelectEmits>();\n\nconst selectRef = ref<HTMLElement | null>(null);\nconst isElementReady = ref(false);\nconst internalValue = ref<string | number | (string | number)[] | undefined>(\n props.defaultValue\n);\nconst customRendererCache = new Map<number, HTMLElement>();\n\n// Manual management of renderer wrapper to avoid reactivity on function identity\nconst resolvedOptionRenderer = ref<any>(undefined);\n\n// Watch for structural changes in renderers (presence only)\nwatch(\n [() => !!props.optionRenderer, () => !!props.customRenderer],\n ([hasOption, hasCustom]) => {\n if (hasOption) {\n resolvedOptionRenderer.value = (item: SelectItem, index: number, helpers: RendererHelpers) => {\n // Accessing props inside here is safe - it delegates to current prop\n return props.optionRenderer?.(item, index, helpers) || document.createElement('div');\n };\n } else if (hasCustom) {\n resolvedOptionRenderer.value = (item: SelectItem, index: number) => {\n let container = customRendererCache.get(index);\n if (!container) {\n container = document.createElement('div');\n customRendererCache.set(index, container);\n }\n\n const node = props.customRenderer?.(item, index);\n if (node && isVNode(node)) {\n render(node, container);\n } else if (node) {\n render(h('span', String(node)), container);\n } else {\n render(null, container);\n }\n return container;\n };\n } else {\n resolvedOptionRenderer.value = undefined;\n }\n },\n { immediate: true }\n);\n\n// Sync custom option renderer\n// We watch the stable `resolvedOptionRenderer` ref, which only updates when structure changes.\nwatch(\n resolvedOptionRenderer,\n (renderer) => {\n safeCall((el) => {\n (el as any).optionRenderer = renderer;\n });\n },\n { immediate: true }\n);\n\nconst waitForUpgrade = async () => {\n if (typeof window === 'undefined') return;\n\n // Ensure the module is loaded (it registers the custom element on import)\n if (!customElements.get('enhanced-select')) {\n await import('@smilodon/core');\n }\n\n const el = selectRef.value as any;\n if (!el) return;\n\n // Wait until the element is upgraded and its methods exist.\n // In some environments, the tag can be defined but the particular instance\n // hasn't been upgraded yet when watchers/mounted run.\n try {\n await customElements.whenDefined('enhanced-select');\n } catch {\n // ignore\n }\n\n // Retry a few frames to let the browser upgrade the instance.\n for (let i = 0; i < 5; i++) {\n const candidate = selectRef.value as any;\n if (candidate && typeof candidate.setItems === 'function') {\n isElementReady.value = true;\n if (resolvedOptionRenderer.value) {\n (candidate as any).optionRenderer = resolvedOptionRenderer.value;\n }\n return;\n }\n await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));\n }\n\n isElementReady.value = typeof (selectRef.value as any)?.setItems === 'function';\n if (isElementReady.value && resolvedOptionRenderer.value) {\n (selectRef.value as any).optionRenderer = resolvedOptionRenderer.value;\n }\n};\n\nconst safeCall = (fn: (el: any) => void) => {\n const el = selectRef.value as any;\n if (!el || !isElementReady.value) return;\n fn(el);\n};\n\n// Check if component is controlled\nconst isControlled = computed(() => props.modelValue !== undefined);\n\n// Get current value\nconst currentValue = computed(() =>\n isControlled.value ? props.modelValue : internalValue.value\n);\n\n// Sync items to web component\nwatch(\n () => props.items,\n (newItems) => {\n safeCall((el) => {\n if (newItems) el.setItems(newItems);\n });\n },\n { deep: true }\n);\n\n// Sync grouped items to web component\nwatch(\n () => props.groupedItems,\n (newGroups) => {\n safeCall((el) => {\n if (newGroups) el.setGroupedItems(newGroups);\n });\n },\n { deep: true }\n);\n\n// removed old watcher\n\n// We need to keep rendererRefs in sync with props\n// Wait, the previous replacement put the watch inside the script setup directly after refs.\n// That watch updates rendererRefs.\n// But we ALSO need to update the web component if the *presence* of renderers changes (e.g. going from undefined to defined).\n// The existing watcher below was watching `resolvedOptionRenderer.value`.\n// Since `resolvedOptionRenderer` computed now depends only on PRESENCE (implicitly through logic), it should remain stable.\n// So `watch(() => resolvedOptionRenderer.value)` will only fire when PRESENCE changes.\n// THIS IS EXACTLY WHAT WE WANT. It won't fire on identity change.\n// So the original watcher is actually fine as is!\n// BUT: I changed how `resolvedOptionRenderer` works. Let's double check if I broke the watch logic.\n// The computed property returns a *new function* only if the structure changes (e.g. `hasOptionRenderer` flips).\n// So the watcher below will trigger correctly only when structure changes.\n\n// Wait, I see I didn't include `rendererRefs` update in the previous `replace_string_in_file` properly?\n// Previous call:\n// Replaced `const resolvedOptionRenderer ...` block.\n// Included `rendererRefs` definition and `watch` to update refs.\n\n// But wait, the previous `replace_string_in_file` REPLACED the computed property, but did it include the watch for refs?\n// Yes.\n// So the code looks like:\n// ...\n// const rendererRefs = ...\n// watch( ... updates rendererRefs ... )\n// const resolvedOptionRenderer = computed( ... )\n// ...\n//\n// And further down there is existing code:\n// watch(() => resolvedOptionRenderer.value, ...)\n//\n// This existing code is correct! It will update the WC only when the wrapper function changes (which is stable).\n// So I don't need to change the watcher below.\n// UNLESS: The watcher below relies on `resolvedOptionRenderer.value` changing.\n// If props.customRenderer changes from `undefined` to `fn`, computed re-runs -> new wrapper -> watcher runs -> WC updated. Correct.\n// If props.customRenderer changes from `fn1` to `fn2`, computed (depending on `!!props`? No, computed in Vue tracks all dependencies accessed).\n// Wait! `resolvedOptionRenderer` accesses `rendererRefs`.\n// `rendererRefs` is a local object. It is NOT reactive (it's a plain object).\n// `computed` tracks dependencies. If I access `rendererRefs.customRenderer`, does Vue track it? No.\n// So `resolvedOptionRenderer` will NOT re-run when `rendererRefs` changes. This is GOOD. It's stable.\n// But `watch(() => [props.optionRenderer, props.customRenderer], ...)` updates `rendererRefs`.\n// So when `fn1` -> `fn2`, `rendererRefs` is updated. `resolvedOptionRenderer` is NOT re-computed. The OLD wrapper function is still used.\n// But the wrapper function calls `rendererRefs.customRenderer`. This is the NEW function `fn2`.\n// So it works! The wrapper delegates to the current ref.\n// And `resolvedOptionRenderer.value` (the wrapper) hasn't changed identity, so the watcher below (syncing to WC) does NOT fire.\n// This means `el.optionRenderer = wrapper` is NOT called again.\n// Is this okay? Yes, because `el.optionRenderer` is already set to the wrapper. The wrapper hasn't changed.\n// So the infinite loop is broken.\n\n// HOWEVER: I still need to check if my previous replacement was syntactically correct and complete.\n// I see I replaced `const resolvedOptionRenderer ...` with a block that includes `const rendererRefs ...`.\n// Let's verify `rendererRefs` is reactive or not.\n// `const rendererRefs = { ... }` is NOT reactive. This is intentional.\n// We don't want reactivity to trigger computed re-eval.\n\n// BUT `watch(() => [props.optionRenderer...])` updates it.\n// The watcher needs `props` to be in scope. `props` is defined above.\n// It seems correct.\n\n// One detail:\n// `const resolvedOptionRenderer = computed(() => { ... })`\n// Vue computed properties track dependencies.\n// Inside computed, I access `props.optionRenderer` (to check boolean).\n// So computed depends on `props.optionRenderer`.\n// If `props.optionRenderer` changes from `fn1` to `fn2`, `!!props.optionRenderer` is still `true`.\n// Does the dependency change?\n// Vue tracks access. If I only access `!!props.optionRenderer`, maybe it only tracks the boolean?\n// No, usually it tracks the property.\n// If I use `props.optionRenderer` in `if (props.optionRenderer)`, it tracks it.\n// So if it changes, computed re-runs!\n// And returns a NEW function.\n// So watcher runs -> WC update -> Loop.\n// I need `computed` to NOT depend on the function identity.\n// I should use `!!props.optionRenderer` in a way that doesn't trigger on identity change?\n// Or better: explicit dependencies or a structure that isolates the check.\n// In Vue `computed`, we can't easily control the dependency array like React's `useMemo`.\n// But we can access the boolean via a separate stable computed property or just trust that Vue's dependency tracking is based on value?.\n// No, props are reactive.\n// If I assume Vue computes re-run on prop change:\n// Then the wrapper is recreated.\n// I need `resolvedOptionRenderer` to be a `shallowRef` or generic `ref` that I manually update only when structure changes!\n// `computed` is risky here.\n\n// Better approach for Vue:\n// Use `ref` for the wrapper.\n// Watch `[() => !!props.optionRenderer, () => !!props.customRenderer]` explicitly.\n// When that specific boolean tuple changes, update the wrapper ref.\n// And have the \"Sync custom option renderer\" watch depend on that wrapper ref.\n\n// Let's undo/redo the Vue part with this safer `shallowRef` approach.\n\nwatch(\n () => [props.items, props.groupedItems],\n () => {\n const totalItems = props.groupedItems\n ? props.groupedItems.reduce((count, group) => count + group.options.length, 0)\n : props.items.length;\n\n customRendererCache.forEach((container, index) => {\n if (index >= totalItems) {\n render(null, container);\n customRendererCache.delete(index);\n }\n });\n },\n { deep: true }\n);\n\n// Sync value to web component\nwatch(\n currentValue,\n (newValue) => {\n safeCall((el) => {\n if (newValue !== undefined) {\n // Get current selected values from the element to avoid infinite loop\n const currentSelected = el.getSelectedValues?.() || [];\n const newValues = Array.isArray(newValue) ? newValue : [newValue];\n \n // Only update if values have actually changed\n const hasChanged = \n currentSelected.length !== newValues.length ||\n !currentSelected.every((v: any, i: number) => v === newValues[i]);\n \n if (hasChanged) {\n el.setSelectedValues(newValues);\n }\n }\n });\n },\n { immediate: true }\n);\n\n// Sync configuration\nconst updateConfig = () => {\n safeCall((el) => {\n const config = {\n searchable: props.searchable,\n placeholder: props.placeholder,\n enabled: !props.disabled,\n virtualize: props.virtualized,\n selection: {\n mode: props.multiple ? 'multi' : 'single',\n maxSelections: props.maxSelections,\n },\n infiniteScroll: {\n enabled: props.infiniteScroll,\n pageSize: props.pageSize,\n },\n expandable: {\n enabled: props.expandable,\n },\n clearControl: {\n enabled: props.clearable,\n clearSelection: props.clearSelectionOnClear,\n clearSearch: props.clearSearchOnClear,\n ariaLabel: props.clearAriaLabel,\n icon: props.clearIcon,\n },\n };\n\n el.updateConfig(config);\n });\n};\n\nwatch(\n [\n () => props.searchable,\n () => props.placeholder,\n () => props.disabled,\n () => props.multiple,\n () => props.maxSelections,\n () => props.infiniteScroll,\n () => props.pageSize,\n () => props.virtualized,\n () => props.expandable,\n () => props.clearable,\n () => props.clearSelectionOnClear,\n () => props.clearSearchOnClear,\n () => props.clearAriaLabel,\n () => props.clearIcon,\n ],\n updateConfig\n);\n\n// Event handlers\nconst handleSelect = (e: Event) => {\n const customEvent = e as CustomEvent<SelectEventDetail>;\n const { item, index } = customEvent.detail;\n emit('select', item as SelectItem, index);\n};\n\nconst handleChange = (e: Event) => {\n const customEvent = e as CustomEvent<ChangeEventDetail>;\n const { selectedItems, selectedValues } = customEvent.detail;\n\n const values = selectedValues as (string | number)[];\n\n // Update internal value in uncontrolled mode\n if (!isControlled.value) {\n internalValue.value = props.multiple ? values : values[0];\n }\n\n // Emit events\n const value = props.multiple ? values : values[0];\n emit('update:modelValue', value);\n emit('change', value, selectedItems as SelectItem[]);\n};\n\nconst handleOpen = () => {\n emit('open');\n};\n\nconst handleClose = () => {\n emit('close');\n};\n\nconst handleSearch = (e: Event) => {\n const customEvent = e as CustomEvent<SearchEventDetail>;\n emit('search', customEvent.detail.query);\n};\n\nconst handleLoadMore = (e: Event) => {\n const customEvent = e as CustomEvent<LoadMoreEventDetail>;\n emit('loadMore', customEvent.detail.page);\n};\n\nconst handleCreate = (e: Event) => {\n const customEvent = e as CustomEvent<{ value: string }>;\n emit('create', customEvent.detail.value);\n};\n\nconst handleClear = (e: Event) => {\n const customEvent = e as CustomEvent<ClearEventDetail>;\n emit('clear', {\n clearedSelection: customEvent.detail.clearedSelection,\n clearedSearch: customEvent.detail.clearedSearch,\n });\n};\n\n// Setup event listeners\nonMounted(async () => {\n await waitForUpgrade();\n if (!selectRef.value || !isElementReady.value) return;\n\n const element = selectRef.value as any;\n\n // Initial configuration\n updateConfig();\n\n if (props.placement) {\n element.setAttribute('placement', props.placement);\n }\n\n // Set initial items\n if (props.items?.length) {\n element.setItems(props.items);\n }\n if (props.groupedItems?.length) {\n element.setGroupedItems(props.groupedItems);\n }\n\n // Set initial value\n if (currentValue.value !== undefined) {\n const values = Array.isArray(currentValue.value)\n ? currentValue.value\n : [currentValue.value];\n element.setSelectedValues(values);\n }\n\n // Add event listeners\n element.addEventListener('select', handleSelect as EventListener);\n element.addEventListener('change', handleChange as EventListener);\n element.addEventListener('open', handleOpen as EventListener);\n element.addEventListener('close', handleClose as EventListener);\n element.addEventListener('search', handleSearch as EventListener);\n element.addEventListener('loadMore', handleLoadMore as EventListener);\n element.addEventListener('create', handleCreate as EventListener);\n element.addEventListener('clear', handleClear as EventListener);\n});\n\nonBeforeUnmount(() => {\n customRendererCache.forEach((container) => render(null, container));\n customRendererCache.clear();\n\n if (!selectRef.value) return;\n\n const element = selectRef.value;\n\n // Remove event listeners\n element.removeEventListener('select', handleSelect as EventListener);\n element.removeEventListener('change', handleChange as EventListener);\n element.removeEventListener('open', handleOpen as EventListener);\n element.removeEventListener('close', handleClose as EventListener);\n element.removeEventListener('search', handleSearch as EventListener);\n element.removeEventListener('loadMore', handleLoadMore as EventListener);\n element.removeEventListener('create', handleCreate as EventListener);\n element.removeEventListener('clear', handleClear as EventListener);\n});\n\n// Expose imperative API\ndefineExpose({\n /** Open the dropdown */\n open: () => {\n (selectRef.value as any)?.open();\n },\n /** Close the dropdown */\n close: () => {\n (selectRef.value as any)?.close();\n },\n /** Focus the select */\n focus: () => {\n selectRef.value?.focus();\n },\n /** Set items programmatically */\n setItems: (items: SelectItem[]) => {\n (selectRef.value as any)?.setItems(items);\n },\n /** Set grouped items programmatically */\n setGroupedItems: (groups: GroupedItem[]) => {\n (selectRef.value as any)?.setGroupedItems(groups);\n },\n /** Clear selection */\n clear: () => {\n (selectRef.value as any)?.setSelectedValues([]);\n if (!isControlled.value) {\n internalValue.value = props.multiple ? [] : undefined;\n }\n const value = props.multiple ? [] : '';\n emit('update:modelValue', value);\n emit('change', value, []);\n },\n});\n</script>\n\n<style scoped>\n/* Component uses web component styling from @smilodon/core */\n</style>\n"],"names":["ref","watch","isVNode","render","h","computed","onMounted","onBeforeUnmount","_createBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoIA,UAAM,QAAQ;AAgBd,UAAM,OAAO;AAEb,UAAM,YAAYA,IAAAA,IAAwB,IAAI;AAC9C,UAAM,iBAAiBA,IAAAA,IAAI,KAAK;AAChC,UAAM,gBAAgBA,IAAAA;AAAAA,MACpB,MAAM;AAAA,IAAA;AAER,UAAM,0CAA0B,IAAA;AAGhC,UAAM,yBAAyBA,IAAAA,IAAS,MAAS;AAGjDC,QAAAA;AAAAA,MACE,CAAC,MAAM,CAAC,CAAC,MAAM,gBAAgB,MAAM,CAAC,CAAC,MAAM,cAAc;AAAA,MAC3D,CAAC,CAAC,WAAW,SAAS,MAAM;AAC1B,YAAI,WAAW;AACb,iCAAuB,QAAQ,CAAC,MAAkB,OAAe,YAA6B;;AAE5F,qBAAO,WAAM,mBAAN,+BAAuB,MAAM,OAAO,aAAY,SAAS,cAAc,KAAK;AAAA,UACrF;AAAA,QACF,WAAW,WAAW;AACpB,iCAAuB,QAAQ,CAAC,MAAkB,UAAkB;;AAClE,gBAAI,YAAY,oBAAoB,IAAI,KAAK;AAC7C,gBAAI,CAAC,WAAW;AACd,0BAAY,SAAS,cAAc,KAAK;AACxC,kCAAoB,IAAI,OAAO,SAAS;AAAA,YAC1C;AAEA,kBAAM,QAAO,WAAM,mBAAN,+BAAuB,MAAM;AAC1C,gBAAI,QAAQC,YAAQ,IAAI,GAAG;AACzBC,kBAAAA,OAAO,MAAM,SAAS;AAAA,YACxB,WAAW,MAAM;AACfA,kBAAAA,OAAOC,IAAAA,EAAE,QAAQ,OAAO,IAAI,CAAC,GAAG,SAAS;AAAA,YAC3C,OAAO;AACLD,kBAAAA,OAAO,MAAM,SAAS;AAAA,YACxB;AACA,mBAAO;AAAA,UACT;AAAA,QACF,O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BAAiB,CAAC,WAA0B;;AACzC,wBAAU,UAAV,mBAAyB,gBAAgB;AAAA,MAC5C;AAAA;AAAA,MAEA,OAAO,MAAM;;AACV,wBAAU,UAAV,mBAAyB,kBAAkB;AAC5C,YAAI,CAAC,aAAa,OAAO;AACvB,wBAAc,QAAQ,MAAM,WAAW,CAAA,IAAK;AAAA,QAC9C;AACA,cAAM,QAAQ,MAAM,WAAW,CAAA,IAAK;AACpC,aAAK,qBAAqB,KAAK;AAC/B,aAAK,UAAU,OAAO,EAAE;AAAA,MAC1B;AAAA,IAAA,CACD;;;8BA/kBCK,IAAAA,YAIE,4BAAA;AAAA,iBAHI;AAAA,QAAJ,KAAI;AAAA,QACH,0BAAO,QAAA,SAAS;AAAA,QAChB,0BAAO,QAAA,KAAK;AAAA,MAAA;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/Select.vue"],"sourcesContent":["<!--\n Smilodon Select Component for Vue 3\n \n A production-ready, accessible select component with advanced features:\n - Single and multi-select modes\n - Searchable with client or server-side filtering\n - Infinite scroll and virtual scrolling for large datasets\n - Grouped options\n - Custom rendering\n - Full keyboard navigation\n - WCAG 2.1 AAA compliant\n \n @example\n <Select\n :items=\"items\"\n v-model=\"selectedValue\"\n searchable\n placeholder=\"Select an option...\"\n />\n-->\n\n<template>\n <enhanced-select\n ref=\"selectRef\"\n :class=\"className\"\n :style=\"style\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, onMounted, onBeforeUnmount, computed, render, isVNode, h } from 'vue';\nimport type {\n SelectEventDetail,\n OpenEventDetail,\n CloseEventDetail,\n SearchEventDetail,\n ChangeEventDetail,\n LoadMoreEventDetail,\n ClearEventDetail,\n GroupedItem,\n RendererHelpers,\n} from '@smilodon/core';\n\nexport interface SelectItem {\n value: string | number;\n label: string;\n disabled?: boolean;\n group?: string;\n [key: string]: any;\n}\n\nexport interface SelectProps {\n /** Array of items to display in the select */\n items?: SelectItem[];\n /** Grouped items (alternative to items) */\n groupedItems?: GroupedItem[];\n /** Selected value(s) - for v-model binding */\n modelValue?: string | number | (string | number)[];\n /** Default value for uncontrolled mode */\n defaultValue?: string | number | (string | number)[];\n /** Enable multi-select mode */\n multiple?: boolean;\n /** Enable search functionality */\n searchable?: boolean;\n /** Placeholder text */\n placeholder?: string;\n /** Disable the select */\n disabled?: boolean;\n /** Mark as required */\n required?: boolean;\n /** Show error state */\n error?: boolean;\n /** Enable infinite scroll */\n infiniteScroll?: boolean;\n /** Number of items per page (for infinite scroll) */\n pageSize?: number;\n /** Enable virtual scrolling */\n virtualized?: boolean;\n /** Maximum number of selections (for multi-select) */\n maxSelections?: number;\n /** Dropdown placement */\n placement?: 'bottom' | 'top' | 'auto';\n /** Custom CSS class */\n className?: string;\n /** Custom inline styles */\n style?: Record<string, string>;\n /** Enable expandable dropdown */\n expandable?: boolean;\n\n /** Enable clear control button */\n clearable?: boolean;\n\n /** Clear selected values when clear control is clicked */\n clearSelectionOnClear?: boolean;\n\n /** Clear search query when clear control is clicked */\n clearSearchOnClear?: boolean;\n\n /** ARIA label for clear control */\n clearAriaLabel?: string;\n\n /** Icon text for clear control */\n clearIcon?: string;\n\n /** Custom option renderer returning an HTMLElement */\n optionRenderer?: (item: SelectItem, index: number, helpers: RendererHelpers) => HTMLElement;\n\n /** Custom Vue renderer returning a VNode */\n customRenderer?: (item: SelectItem, index: number) => ReturnType<typeof h>;\n}\n\nexport interface SelectEmits {\n /** Emitted when selection changes - for v-model */\n (e: 'update:modelValue', value: string | number | (string | number)[]): void;\n /** Emitted when selection changes with full details */\n (e: 'change', value: string | number | (string | number)[], selectedItems: SelectItem[]): void;\n /** Emitted when an item is selected */\n (e: 'select', item: SelectItem, index: number): void;\n /** Emitted when dropdown opens */\n (e: 'open'): void;\n /** Emitted when dropdown closes */\n (e: 'close'): void;\n /** Emitted when search query changes */\n (e: 'search', query: string): void;\n /** Emitted when more items are requested (infinite scroll) */\n (e: 'loadMore', page: number): void;\n /** Emitted when user creates a new item (if enabled) */\n (e: 'create', value: string): void;\n /** Emitted when clear control is used */\n (e: 'clear', detail: { clearedSelection: boolean; clearedSearch: boolean }): void;\n}\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n items: () => [],\n multiple: false,\n searchable: false,\n disabled: false,\n required: false,\n error: false,\n infiniteScroll: false,\n pageSize: 50,\n virtualized: true,\n placement: 'auto',\n clearable: false,\n clearSelectionOnClear: true,\n clearSearchOnClear: true,\n});\n\nconst emit = defineEmits<SelectEmits>();\n\nconst selectRef = ref<HTMLElement | null>(null);\nconst isElementReady = ref(false);\nconst internalValue = ref<string | number | (string | number)[] | undefined>(\n props.defaultValue\n);\nconst customRendererCache = new Map<number, HTMLElement>();\n\n// Manual management of renderer wrapper to avoid reactivity on function identity\nconst resolvedOptionRenderer = ref<any>(undefined);\n\n// Watch for structural changes in renderers (presence only)\nwatch(\n [() => !!props.optionRenderer, () => !!props.customRenderer],\n ([hasOption, hasCustom]) => {\n if (hasOption) {\n resolvedOptionRenderer.value = (item: SelectItem, index: number, helpers: RendererHelpers) => {\n // Accessing props inside here is safe - it delegates to current prop\n return props.optionRenderer?.(item, index, helpers) || document.createElement('div');\n };\n } else if (hasCustom) {\n resolvedOptionRenderer.value = (item: SelectItem, index: number) => {\n let container = customRendererCache.get(index);\n if (!container) {\n container = document.createElement('div');\n customRendererCache.set(index, container);\n }\n\n const node = props.customRenderer?.(item, index);\n if (node && isVNode(node)) {\n render(node, container);\n } else if (node) {\n render(h('span', String(node)), container);\n } else {\n render(null, container);\n }\n return container;\n };\n } else {\n resolvedOptionRenderer.value = undefined;\n }\n },\n { immediate: true }\n);\n\n// Sync custom option renderer\n// We watch the stable `resolvedOptionRenderer` ref, which only updates when structure changes.\nwatch(\n resolvedOptionRenderer,\n (renderer) => {\n safeCall((el) => {\n (el as any).optionRenderer = renderer;\n });\n },\n { immediate: true }\n);\n\nconst waitForUpgrade = async () => {\n if (typeof window === 'undefined') return;\n\n // Ensure the module is loaded (it registers the custom element on import)\n if (!customElements.get('enhanced-select')) {\n await import('@smilodon/core');\n }\n\n const el = selectRef.value as any;\n if (!el) return;\n\n // Wait until the element is upgraded and its methods exist.\n // In some environments, the tag can be defined but the particular instance\n // hasn't been upgraded yet when watchers/mounted run.\n try {\n await customElements.whenDefined('enhanced-select');\n } catch {\n // ignore\n }\n\n // Retry a few frames to let the browser upgrade the instance.\n for (let i = 0; i < 5; i++) {\n const candidate = selectRef.value as any;\n if (candidate && typeof candidate.setItems === 'function') {\n isElementReady.value = true;\n if (resolvedOptionRenderer.value) {\n (candidate as any).optionRenderer = resolvedOptionRenderer.value;\n }\n return;\n }\n await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));\n }\n\n isElementReady.value = typeof (selectRef.value as any)?.setItems === 'function';\n if (isElementReady.value && resolvedOptionRenderer.value) {\n (selectRef.value as any).optionRenderer = resolvedOptionRenderer.value;\n }\n};\n\nconst safeCall = (fn: (el: any) => void) => {\n const el = selectRef.value as any;\n if (!el || !isElementReady.value) return;\n fn(el);\n};\n\n// Check if component is controlled\nconst isControlled = computed(() => props.modelValue !== undefined);\n\n// Get current value\nconst currentValue = computed(() =>\n isControlled.value ? props.modelValue : internalValue.value\n);\n\n// Sync items to web component\nwatch(\n () => props.items,\n (newItems) => {\n safeCall((el) => {\n if (newItems) el.setItems(newItems);\n });\n },\n { deep: true }\n);\n\n// Sync grouped items to web component\nwatch(\n () => props.groupedItems,\n (newGroups) => {\n safeCall((el) => {\n if (newGroups) el.setGroupedItems(newGroups);\n });\n },\n { deep: true }\n);\n\n// removed old watcher\n\n// We need to keep rendererRefs in sync with props\n// Wait, the previous replacement put the watch inside the script setup directly after refs.\n// That watch updates rendererRefs.\n// But we ALSO need to update the web component if the *presence* of renderers changes (e.g. going from undefined to defined).\n// The existing watcher below was watching `resolvedOptionRenderer.value`.\n// Since `resolvedOptionRenderer` computed now depends only on PRESENCE (implicitly through logic), it should remain stable.\n// So `watch(() => resolvedOptionRenderer.value)` will only fire when PRESENCE changes.\n// THIS IS EXACTLY WHAT WE WANT. It won't fire on identity change.\n// So the original watcher is actually fine as is!\n// BUT: I changed how `resolvedOptionRenderer` works. Let's double check if I broke the watch logic.\n// The computed property returns a *new function* only if the structure changes (e.g. `hasOptionRenderer` flips).\n// So the watcher below will trigger correctly only when structure changes.\n\n// Wait, I see I didn't include `rendererRefs` update in the previous `replace_string_in_file` properly?\n// Previous call:\n// Replaced `const resolvedOptionRenderer ...` block.\n// Included `rendererRefs` definition and `watch` to update refs.\n\n// But wait, the previous `replace_string_in_file` REPLACED the computed property, but did it include the watch for refs?\n// Yes.\n// So the code looks like:\n// ...\n// const rendererRefs = ...\n// watch( ... updates rendererRefs ... )\n// const resolvedOptionRenderer = computed( ... )\n// ...\n//\n// And further down there is existing code:\n// watch(() => resolvedOptionRenderer.value, ...)\n//\n// This existing code is correct! It will update the WC only when the wrapper function changes (which is stable).\n// So I don't need to change the watcher below.\n// UNLESS: The watcher below relies on `resolvedOptionRenderer.value` changing.\n// If props.customRenderer changes from `undefined` to `fn`, computed re-runs -> new wrapper -> watcher runs -> WC updated. Correct.\n// If props.customRenderer changes from `fn1` to `fn2`, computed (depending on `!!props`? No, computed in Vue tracks all dependencies accessed).\n// Wait! `resolvedOptionRenderer` accesses `rendererRefs`.\n// `rendererRefs` is a local object. It is NOT reactive (it's a plain object).\n// `computed` tracks dependencies. If I access `rendererRefs.customRenderer`, does Vue track it? No.\n// So `resolvedOptionRenderer` will NOT re-run when `rendererRefs` changes. This is GOOD. It's stable.\n// But `watch(() => [props.optionRenderer, props.customRenderer], ...)` updates `rendererRefs`.\n// So when `fn1` -> `fn2`, `rendererRefs` is updated. `resolvedOptionRenderer` is NOT re-computed. The OLD wrapper function is still used.\n// But the wrapper function calls `rendererRefs.customRenderer`. This is the NEW function `fn2`.\n// So it works! The wrapper delegates to the current ref.\n// And `resolvedOptionRenderer.value` (the wrapper) hasn't changed identity, so the watcher below (syncing to WC) does NOT fire.\n// This means `el.optionRenderer = wrapper` is NOT called again.\n// Is this okay? Yes, because `el.optionRenderer` is already set to the wrapper. The wrapper hasn't changed.\n// So the infinite loop is broken.\n\n// HOWEVER: I still need to check if my previous replacement was syntactically correct and complete.\n// I see I replaced `const resolvedOptionRenderer ...` with a block that includes `const rendererRefs ...`.\n// Let's verify `rendererRefs` is reactive or not.\n// `const rendererRefs = { ... }` is NOT reactive. This is intentional.\n// We don't want reactivity to trigger computed re-eval.\n\n// BUT `watch(() => [props.optionRenderer...])` updates it.\n// The watcher needs `props` to be in scope. `props` is defined above.\n// It seems correct.\n\n// One detail:\n// `const resolvedOptionRenderer = computed(() => { ... })`\n// Vue computed properties track dependencies.\n// Inside computed, I access `props.optionRenderer` (to check boolean).\n// So computed depends on `props.optionRenderer`.\n// If `props.optionRenderer` changes from `fn1` to `fn2`, `!!props.optionRenderer` is still `true`.\n// Does the dependency change?\n// Vue tracks access. If I only access `!!props.optionRenderer`, maybe it only tracks the boolean?\n// No, usually it tracks the property.\n// If I use `props.optionRenderer` in `if (props.optionRenderer)`, it tracks it.\n// So if it changes, computed re-runs!\n// And returns a NEW function.\n// So watcher runs -> WC update -> Loop.\n// I need `computed` to NOT depend on the function identity.\n// I should use `!!props.optionRenderer` in a way that doesn't trigger on identity change?\n// Or better: explicit dependencies or a structure that isolates the check.\n// In Vue `computed`, we can't easily control the dependency array like React's `useMemo`.\n// But we can access the boolean via a separate stable computed property or just trust that Vue's dependency tracking is based on value?.\n// No, props are reactive.\n// If I assume Vue computes re-run on prop change:\n// Then the wrapper is recreated.\n// I need `resolvedOptionRenderer` to be a `shallowRef` or generic `ref` that I manually update only when structure changes!\n// `computed` is risky here.\n\n// Better approach for Vue:\n// Use `ref` for the wrapper.\n// Watch `[() => !!props.optionRenderer, () => !!props.customRenderer]` explicitly.\n// When that specific boolean tuple changes, update the wrapper ref.\n// And have the \"Sync custom option renderer\" watch depend on that wrapper ref.\n\n// Let's undo/redo the Vue part with this safer `shallowRef` approach.\n\nwatch(\n () => [props.items, props.groupedItems],\n () => {\n const totalItems = props.groupedItems\n ? props.groupedItems.reduce((count, group) => count + group.options.length, 0)\n : props.items.length;\n\n customRendererCache.forEach((container, index) => {\n if (index >= totalItems) {\n render(null, container);\n customRendererCache.delete(index);\n }\n });\n },\n { deep: true }\n);\n\n// Sync value to web component\nwatch(\n currentValue,\n (newValue) => {\n safeCall((el) => {\n if (newValue !== undefined) {\n // Get current selected values from the element to avoid infinite loop\n const currentSelected = el.getSelectedValues?.() || [];\n const newValues = Array.isArray(newValue) ? newValue : [newValue];\n \n // Only update if values have actually changed\n const hasChanged = \n currentSelected.length !== newValues.length ||\n !currentSelected.every((v: any, i: number) => v === newValues[i]);\n \n if (hasChanged) {\n el.setSelectedValues(newValues);\n }\n }\n });\n },\n { immediate: true }\n);\n\n// Sync configuration\nconst updateConfig = () => {\n safeCall((el) => {\n const config = {\n searchable: props.searchable,\n placeholder: props.placeholder,\n enabled: !props.disabled,\n virtualize: props.virtualized,\n selection: {\n mode: props.multiple ? 'multi' : 'single',\n maxSelections: props.maxSelections,\n },\n infiniteScroll: {\n enabled: props.infiniteScroll,\n pageSize: props.pageSize,\n },\n expandable: {\n enabled: props.expandable,\n },\n clearControl: {\n enabled: props.clearable,\n clearSelection: props.clearSelectionOnClear,\n clearSearch: props.clearSearchOnClear,\n ariaLabel: props.clearAriaLabel,\n icon: props.clearIcon,\n },\n };\n\n el.updateConfig(config);\n });\n};\n\nwatch(\n [\n () => props.searchable,\n () => props.placeholder,\n () => props.disabled,\n () => props.multiple,\n () => props.maxSelections,\n () => props.infiniteScroll,\n () => props.pageSize,\n () => props.virtualized,\n () => props.expandable,\n () => props.clearable,\n () => props.clearSelectionOnClear,\n () => props.clearSearchOnClear,\n () => props.clearAriaLabel,\n () => props.clearIcon,\n ],\n updateConfig\n);\n\n// Event handlers\nconst handleSelect = (e: Event) => {\n const customEvent = e as CustomEvent<SelectEventDetail>;\n const { item, index } = customEvent.detail;\n emit('select', item as SelectItem, index);\n};\n\nconst handleChange = (e: Event) => {\n const customEvent = e as CustomEvent<ChangeEventDetail>;\n const { selectedItems, selectedValues } = customEvent.detail;\n\n const values = selectedValues as (string | number)[];\n\n // Update internal value in uncontrolled mode\n if (!isControlled.value) {\n internalValue.value = props.multiple ? values : values[0];\n }\n\n // Emit events\n const value = props.multiple ? values : values[0];\n emit('update:modelValue', value);\n emit('change', value, selectedItems as SelectItem[]);\n};\n\nconst handleOpen = () => {\n emit('open');\n};\n\nconst handleClose = () => {\n emit('close');\n};\n\nconst handleSearch = (e: Event) => {\n const customEvent = e as CustomEvent<SearchEventDetail>;\n emit('search', customEvent.detail.query);\n};\n\nconst handleLoadMore = (e: Event) => {\n const customEvent = e as CustomEvent<LoadMoreEventDetail>;\n emit('loadMore', customEvent.detail.page);\n};\n\nconst handleCreate = (e: Event) => {\n const customEvent = e as CustomEvent<{ value: string }>;\n emit('create', customEvent.detail.value);\n};\n\nconst handleClear = (e: Event) => {\n const customEvent = e as CustomEvent<ClearEventDetail>;\n emit('clear', {\n clearedSelection: customEvent.detail.clearedSelection,\n clearedSearch: customEvent.detail.clearedSearch,\n });\n};\n\n// Setup event listeners\nonMounted(async () => {\n await waitForUpgrade();\n if (!selectRef.value || !isElementReady.value) return;\n\n const element = selectRef.value as any;\n\n // Initial configuration\n updateConfig();\n\n if (props.placement) {\n element.setAttribute('placement', props.placement);\n }\n\n // Set initial items\n if (props.items?.length) {\n // Auto-convert flat items that include a `group` property into groupedItems\n const first = props.items[0];\n if (first && (first as any).group !== undefined) {\n const map = new Map<string, any[]>();\n props.items.forEach((it: any) => {\n const g = it.group ?? 'Ungrouped';\n if (!map.has(g)) map.set(g, []);\n map.get(g)!.push(it);\n });\n const groups = Array.from(map.entries()).map(([label, options]) => ({ label, options }));\n element.setGroupedItems(groups);\n } else {\n element.setItems(props.items);\n }\n }\n if (props.groupedItems?.length) {\n element.setGroupedItems(props.groupedItems);\n }\n\n // Set initial value\n if (currentValue.value !== undefined) {\n const values = Array.isArray(currentValue.value)\n ? currentValue.value\n : [currentValue.value];\n element.setSelectedValues(values);\n }\n\n // Add event listeners\n element.addEventListener('select', handleSelect as EventListener);\n element.addEventListener('change', handleChange as EventListener);\n element.addEventListener('open', handleOpen as EventListener);\n element.addEventListener('close', handleClose as EventListener);\n element.addEventListener('search', handleSearch as EventListener);\n element.addEventListener('loadMore', handleLoadMore as EventListener);\n element.addEventListener('create', handleCreate as EventListener);\n element.addEventListener('clear', handleClear as EventListener);\n});\n\nonBeforeUnmount(() => {\n customRendererCache.forEach((container) => render(null, container));\n customRendererCache.clear();\n\n if (!selectRef.value) return;\n\n const element = selectRef.value;\n\n // Remove event listeners\n element.removeEventListener('select', handleSelect as EventListener);\n element.removeEventListener('change', handleChange as EventListener);\n element.removeEventListener('open', handleOpen as EventListener);\n element.removeEventListener('close', handleClose as EventListener);\n element.removeEventListener('search', handleSearch as EventListener);\n element.removeEventListener('loadMore', handleLoadMore as EventListener);\n element.removeEventListener('create', handleCreate as EventListener);\n element.removeEventListener('clear', handleClear as EventListener);\n});\n\n// Expose imperative API\ndefineExpose({\n /** Open the dropdown */\n open: () => {\n (selectRef.value as any)?.open();\n },\n /** Close the dropdown */\n close: () => {\n (selectRef.value as any)?.close();\n },\n /** Focus the select */\n focus: () => {\n selectRef.value?.focus();\n },\n /** Set items programmatically */\n setItems: (items: SelectItem[]) => {\n (selectRef.value as any)?.setItems(items);\n },\n /** Set grouped items programmatically */\n setGroupedItems: (groups: GroupedItem[]) => {\n (selectRef.value as any)?.setGroupedItems(groups);\n },\n /** Clear selection */\n clear: () => {\n (selectRef.value as any)?.setSelectedValues([]);\n if (!isControlled.value) {\n internalValue.value = props.multiple ? [] : undefined;\n }\n const value = props.multiple ? [] : '';\n emit('update:modelValue', value);\n emit('change', value, []);\n },\n});\n</script>\n\n<style scoped>\n/* Component uses web component styling from @smilodon/core */\n</style>\n"],"names":["ref","watch","isVNode","render","h","computed","onMounted","onBeforeUnmount","_createBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAGD,aAAa;AAAA;AAAA,MAEX,MAAM,MAAM;;AACT,wBAAU,UAAV,mBAAyB;AAAA,MAC5B;AAAA;AAAA,MAEA,OAAO,MAAM;;AACV,wBAAU,UAAV,mBAAyB;AAAA,MAC5B;AAAA;AAAA,MAEA,OAAO,MAAM;;AACX,wBAAU,UAAV,mBAAiB;AAAA,MACnB;AAAA;AAAA,MAEA,UAAU,CAAC,UAAwB;;AAChC,wBAAU,UAAV,mBAAyB,SAAS;AAAA,MACrC;AAAA;AAAA,MAEA,iBAAiB,CAAC,WAA0B;;AACzC,wBAAU,UAAV,mBAAyB,gBAAgB;AAAA,MAC5C;AAAA;AAAA,MAEA,OAAO,MAAM;;AACV,wBAAU,UAAV,mBAAyB,kBAAkB;AAC5C,YAAI,CAAC,aAAa,OAAO;AACvB,wBAAc,QAAQ,MAAM,WAAW,CAAA,IAAK;AAAA,QAC9C;AACA,cAAM,QAAQ,MAAM,WAAW,CAAA,IAAK;AACpC,aAAK,qBAAqB,KAAK;AAC/B,aAAK,UAAU,OAAO,EAAE;AAAA,MAC1B;AAAA,IAAA,CACD;;;8BA5lBCK,IAAAA,YAIE,4BAAA;AAAA,iBAHI;AAAA,QAAJ,KAAI;AAAA,QACH,0BAAO,QAAA,SAAS;AAAA,QAChB,0BAAO,QAAA,KAAK;AAAA,MAAA;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, watch, isVNode, render, h, computed, onMounted, onBeforeUnmount, resolveComponent, createBlock, openBlock, normalizeStyle, normalizeClass } from "vue";
1
+ import { defineComponent, ref, watch, isVNode, render, h, computed, onMounted, onBeforeUnmount, resolveComponent, openBlock, createBlock, normalizeStyle, normalizeClass } from "vue";
2
2
  const _sfc_main = /* @__PURE__ */ defineComponent({
3
3
  __name: "Select",
4
4
  props: {
@@ -264,7 +264,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
264
264
  element.setAttribute("placement", props.placement);
265
265
  }
266
266
  if ((_a = props.items) == null ? void 0 : _a.length) {
267
- element.setItems(props.items);
267
+ const first = props.items[0];
268
+ if (first && first.group !== void 0) {
269
+ const map = /* @__PURE__ */ new Map();
270
+ props.items.forEach((it) => {
271
+ const g = it.group ?? "Ungrouped";
272
+ if (!map.has(g)) map.set(g, []);
273
+ map.get(g).push(it);
274
+ });
275
+ const groups = Array.from(map.entries()).map(([label, options]) => ({ label, options }));
276
+ element.setGroupedItems(groups);
277
+ } else {
278
+ element.setItems(props.items);
279
+ }
268
280
  }
269
281
  if ((_b = props.groupedItems) == null ? void 0 : _b.length) {
270
282
  element.setGroupedItems(props.groupedItems);
@@ -352,7 +364,7 @@ const _export_sfc = (sfc, props) => {
352
364
  }
353
365
  return target;
354
366
  };
355
- const Select = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0718553b"]]);
367
+ const Select = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-195defd9"]]);
356
368
  export {
357
369
  Select,
358
370
  Select as default
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/Select.vue"],"sourcesContent":["<!--\n Smilodon Select Component for Vue 3\n \n A production-ready, accessible select component with advanced features:\n - Single and multi-select modes\n - Searchable with client or server-side filtering\n - Infinite scroll and virtual scrolling for large datasets\n - Grouped options\n - Custom rendering\n - Full keyboard navigation\n - WCAG 2.1 AAA compliant\n \n @example\n <Select\n :items=\"items\"\n v-model=\"selectedValue\"\n searchable\n placeholder=\"Select an option...\"\n />\n-->\n\n<template>\n <enhanced-select\n ref=\"selectRef\"\n :class=\"className\"\n :style=\"style\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, onMounted, onBeforeUnmount, computed, render, isVNode, h } from 'vue';\nimport type {\n SelectEventDetail,\n OpenEventDetail,\n CloseEventDetail,\n SearchEventDetail,\n ChangeEventDetail,\n LoadMoreEventDetail,\n ClearEventDetail,\n GroupedItem,\n RendererHelpers,\n} from '@smilodon/core';\n\nexport interface SelectItem {\n value: string | number;\n label: string;\n disabled?: boolean;\n group?: string;\n [key: string]: any;\n}\n\nexport interface SelectProps {\n /** Array of items to display in the select */\n items?: SelectItem[];\n /** Grouped items (alternative to items) */\n groupedItems?: GroupedItem[];\n /** Selected value(s) - for v-model binding */\n modelValue?: string | number | (string | number)[];\n /** Default value for uncontrolled mode */\n defaultValue?: string | number | (string | number)[];\n /** Enable multi-select mode */\n multiple?: boolean;\n /** Enable search functionality */\n searchable?: boolean;\n /** Placeholder text */\n placeholder?: string;\n /** Disable the select */\n disabled?: boolean;\n /** Mark as required */\n required?: boolean;\n /** Show error state */\n error?: boolean;\n /** Enable infinite scroll */\n infiniteScroll?: boolean;\n /** Number of items per page (for infinite scroll) */\n pageSize?: number;\n /** Enable virtual scrolling */\n virtualized?: boolean;\n /** Maximum number of selections (for multi-select) */\n maxSelections?: number;\n /** Dropdown placement */\n placement?: 'bottom' | 'top' | 'auto';\n /** Custom CSS class */\n className?: string;\n /** Custom inline styles */\n style?: Record<string, string>;\n /** Enable expandable dropdown */\n expandable?: boolean;\n\n /** Enable clear control button */\n clearable?: boolean;\n\n /** Clear selected values when clear control is clicked */\n clearSelectionOnClear?: boolean;\n\n /** Clear search query when clear control is clicked */\n clearSearchOnClear?: boolean;\n\n /** ARIA label for clear control */\n clearAriaLabel?: string;\n\n /** Icon text for clear control */\n clearIcon?: string;\n\n /** Custom option renderer returning an HTMLElement */\n optionRenderer?: (item: SelectItem, index: number, helpers: RendererHelpers) => HTMLElement;\n\n /** Custom Vue renderer returning a VNode */\n customRenderer?: (item: SelectItem, index: number) => ReturnType<typeof h>;\n}\n\nexport interface SelectEmits {\n /** Emitted when selection changes - for v-model */\n (e: 'update:modelValue', value: string | number | (string | number)[]): void;\n /** Emitted when selection changes with full details */\n (e: 'change', value: string | number | (string | number)[], selectedItems: SelectItem[]): void;\n /** Emitted when an item is selected */\n (e: 'select', item: SelectItem, index: number): void;\n /** Emitted when dropdown opens */\n (e: 'open'): void;\n /** Emitted when dropdown closes */\n (e: 'close'): void;\n /** Emitted when search query changes */\n (e: 'search', query: string): void;\n /** Emitted when more items are requested (infinite scroll) */\n (e: 'loadMore', page: number): void;\n /** Emitted when user creates a new item (if enabled) */\n (e: 'create', value: string): void;\n /** Emitted when clear control is used */\n (e: 'clear', detail: { clearedSelection: boolean; clearedSearch: boolean }): void;\n}\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n items: () => [],\n multiple: false,\n searchable: false,\n disabled: false,\n required: false,\n error: false,\n infiniteScroll: false,\n pageSize: 50,\n virtualized: true,\n placement: 'auto',\n clearable: false,\n clearSelectionOnClear: true,\n clearSearchOnClear: true,\n});\n\nconst emit = defineEmits<SelectEmits>();\n\nconst selectRef = ref<HTMLElement | null>(null);\nconst isElementReady = ref(false);\nconst internalValue = ref<string | number | (string | number)[] | undefined>(\n props.defaultValue\n);\nconst customRendererCache = new Map<number, HTMLElement>();\n\n// Manual management of renderer wrapper to avoid reactivity on function identity\nconst resolvedOptionRenderer = ref<any>(undefined);\n\n// Watch for structural changes in renderers (presence only)\nwatch(\n [() => !!props.optionRenderer, () => !!props.customRenderer],\n ([hasOption, hasCustom]) => {\n if (hasOption) {\n resolvedOptionRenderer.value = (item: SelectItem, index: number, helpers: RendererHelpers) => {\n // Accessing props inside here is safe - it delegates to current prop\n return props.optionRenderer?.(item, index, helpers) || document.createElement('div');\n };\n } else if (hasCustom) {\n resolvedOptionRenderer.value = (item: SelectItem, index: number) => {\n let container = customRendererCache.get(index);\n if (!container) {\n container = document.createElement('div');\n customRendererCache.set(index, container);\n }\n\n const node = props.customRenderer?.(item, index);\n if (node && isVNode(node)) {\n render(node, container);\n } else if (node) {\n render(h('span', String(node)), container);\n } else {\n render(null, container);\n }\n return container;\n };\n } else {\n resolvedOptionRenderer.value = undefined;\n }\n },\n { immediate: true }\n);\n\n// Sync custom option renderer\n// We watch the stable `resolvedOptionRenderer` ref, which only updates when structure changes.\nwatch(\n resolvedOptionRenderer,\n (renderer) => {\n safeCall((el) => {\n (el as any).optionRenderer = renderer;\n });\n },\n { immediate: true }\n);\n\nconst waitForUpgrade = async () => {\n if (typeof window === 'undefined') return;\n\n // Ensure the module is loaded (it registers the custom element on import)\n if (!customElements.get('enhanced-select')) {\n await import('@smilodon/core');\n }\n\n const el = selectRef.value as any;\n if (!el) return;\n\n // Wait until the element is upgraded and its methods exist.\n // In some environments, the tag can be defined but the particular instance\n // hasn't been upgraded yet when watchers/mounted run.\n try {\n await customElements.whenDefined('enhanced-select');\n } catch {\n // ignore\n }\n\n // Retry a few frames to let the browser upgrade the instance.\n for (let i = 0; i < 5; i++) {\n const candidate = selectRef.value as any;\n if (candidate && typeof candidate.setItems === 'function') {\n isElementReady.value = true;\n if (resolvedOptionRenderer.value) {\n (candidate as any).optionRenderer = resolvedOptionRenderer.value;\n }\n return;\n }\n await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));\n }\n\n isElementReady.value = typeof (selectRef.value as any)?.setItems === 'function';\n if (isElementReady.value && resolvedOptionRenderer.value) {\n (selectRef.value as any).optionRenderer = resolvedOptionRenderer.value;\n }\n};\n\nconst safeCall = (fn: (el: any) => void) => {\n const el = selectRef.value as any;\n if (!el || !isElementReady.value) return;\n fn(el);\n};\n\n// Check if component is controlled\nconst isControlled = computed(() => props.modelValue !== undefined);\n\n// Get current value\nconst currentValue = computed(() =>\n isControlled.value ? props.modelValue : internalValue.value\n);\n\n// Sync items to web component\nwatch(\n () => props.items,\n (newItems) => {\n safeCall((el) => {\n if (newItems) el.setItems(newItems);\n });\n },\n { deep: true }\n);\n\n// Sync grouped items to web component\nwatch(\n () => props.groupedItems,\n (newGroups) => {\n safeCall((el) => {\n if (newGroups) el.setGroupedItems(newGroups);\n });\n },\n { deep: true }\n);\n\n// removed old watcher\n\n// We need to keep rendererRefs in sync with props\n// Wait, the previous replacement put the watch inside the script setup directly after refs.\n// That watch updates rendererRefs.\n// But we ALSO need to update the web component if the *presence* of renderers changes (e.g. going from undefined to defined).\n// The existing watcher below was watching `resolvedOptionRenderer.value`.\n// Since `resolvedOptionRenderer` computed now depends only on PRESENCE (implicitly through logic), it should remain stable.\n// So `watch(() => resolvedOptionRenderer.value)` will only fire when PRESENCE changes.\n// THIS IS EXACTLY WHAT WE WANT. It won't fire on identity change.\n// So the original watcher is actually fine as is!\n// BUT: I changed how `resolvedOptionRenderer` works. Let's double check if I broke the watch logic.\n// The computed property returns a *new function* only if the structure changes (e.g. `hasOptionRenderer` flips).\n// So the watcher below will trigger correctly only when structure changes.\n\n// Wait, I see I didn't include `rendererRefs` update in the previous `replace_string_in_file` properly?\n// Previous call:\n// Replaced `const resolvedOptionRenderer ...` block.\n// Included `rendererRefs` definition and `watch` to update refs.\n\n// But wait, the previous `replace_string_in_file` REPLACED the computed property, but did it include the watch for refs?\n// Yes.\n// So the code looks like:\n// ...\n// const rendererRefs = ...\n// watch( ... updates rendererRefs ... )\n// const resolvedOptionRenderer = computed( ... )\n// ...\n//\n// And further down there is existing code:\n// watch(() => resolvedOptionRenderer.value, ...)\n//\n// This existing code is correct! It will update the WC only when the wrapper function changes (which is stable).\n// So I don't need to change the watcher below.\n// UNLESS: The watcher below relies on `resolvedOptionRenderer.value` changing.\n// If props.customRenderer changes from `undefined` to `fn`, computed re-runs -> new wrapper -> watcher runs -> WC updated. Correct.\n// If props.customRenderer changes from `fn1` to `fn2`, computed (depending on `!!props`? No, computed in Vue tracks all dependencies accessed).\n// Wait! `resolvedOptionRenderer` accesses `rendererRefs`.\n// `rendererRefs` is a local object. It is NOT reactive (it's a plain object).\n// `computed` tracks dependencies. If I access `rendererRefs.customRenderer`, does Vue track it? No.\n// So `resolvedOptionRenderer` will NOT re-run when `rendererRefs` changes. This is GOOD. It's stable.\n// But `watch(() => [props.optionRenderer, props.customRenderer], ...)` updates `rendererRefs`.\n// So when `fn1` -> `fn2`, `rendererRefs` is updated. `resolvedOptionRenderer` is NOT re-computed. The OLD wrapper function is still used.\n// But the wrapper function calls `rendererRefs.customRenderer`. This is the NEW function `fn2`.\n// So it works! The wrapper delegates to the current ref.\n// And `resolvedOptionRenderer.value` (the wrapper) hasn't changed identity, so the watcher below (syncing to WC) does NOT fire.\n// This means `el.optionRenderer = wrapper` is NOT called again.\n// Is this okay? Yes, because `el.optionRenderer` is already set to the wrapper. The wrapper hasn't changed.\n// So the infinite loop is broken.\n\n// HOWEVER: I still need to check if my previous replacement was syntactically correct and complete.\n// I see I replaced `const resolvedOptionRenderer ...` with a block that includes `const rendererRefs ...`.\n// Let's verify `rendererRefs` is reactive or not.\n// `const rendererRefs = { ... }` is NOT reactive. This is intentional.\n// We don't want reactivity to trigger computed re-eval.\n\n// BUT `watch(() => [props.optionRenderer...])` updates it.\n// The watcher needs `props` to be in scope. `props` is defined above.\n// It seems correct.\n\n// One detail:\n// `const resolvedOptionRenderer = computed(() => { ... })`\n// Vue computed properties track dependencies.\n// Inside computed, I access `props.optionRenderer` (to check boolean).\n// So computed depends on `props.optionRenderer`.\n// If `props.optionRenderer` changes from `fn1` to `fn2`, `!!props.optionRenderer` is still `true`.\n// Does the dependency change?\n// Vue tracks access. If I only access `!!props.optionRenderer`, maybe it only tracks the boolean?\n// No, usually it tracks the property.\n// If I use `props.optionRenderer` in `if (props.optionRenderer)`, it tracks it.\n// So if it changes, computed re-runs!\n// And returns a NEW function.\n// So watcher runs -> WC update -> Loop.\n// I need `computed` to NOT depend on the function identity.\n// I should use `!!props.optionRenderer` in a way that doesn't trigger on identity change?\n// Or better: explicit dependencies or a structure that isolates the check.\n// In Vue `computed`, we can't easily control the dependency array like React's `useMemo`.\n// But we can access the boolean via a separate stable computed property or just trust that Vue's dependency tracking is based on value?.\n// No, props are reactive.\n// If I assume Vue computes re-run on prop change:\n// Then the wrapper is recreated.\n// I need `resolvedOptionRenderer` to be a `shallowRef` or generic `ref` that I manually update only when structure changes!\n// `computed` is risky here.\n\n// Better approach for Vue:\n// Use `ref` for the wrapper.\n// Watch `[() => !!props.optionRenderer, () => !!props.customRenderer]` explicitly.\n// When that specific boolean tuple changes, update the wrapper ref.\n// And have the \"Sync custom option renderer\" watch depend on that wrapper ref.\n\n// Let's undo/redo the Vue part with this safer `shallowRef` approach.\n\nwatch(\n () => [props.items, props.groupedItems],\n () => {\n const totalItems = props.groupedItems\n ? props.groupedItems.reduce((count, group) => count + group.options.length, 0)\n : props.items.length;\n\n customRendererCache.forEach((container, index) => {\n if (index >= totalItems) {\n render(null, container);\n customRendererCache.delete(index);\n }\n });\n },\n { deep: true }\n);\n\n// Sync value to web component\nwatch(\n currentValue,\n (newValue) => {\n safeCall((el) => {\n if (newValue !== undefined) {\n // Get current selected values from the element to avoid infinite loop\n const currentSelected = el.getSelectedValues?.() || [];\n const newValues = Array.isArray(newValue) ? newValue : [newValue];\n \n // Only update if values have actually changed\n const hasChanged = \n currentSelected.length !== newValues.length ||\n !currentSelected.every((v: any, i: number) => v === newValues[i]);\n \n if (hasChanged) {\n el.setSelectedValues(newValues);\n }\n }\n });\n },\n { immediate: true }\n);\n\n// Sync configuration\nconst updateConfig = () => {\n safeCall((el) => {\n const config = {\n searchable: props.searchable,\n placeholder: props.placeholder,\n enabled: !props.disabled,\n virtualize: props.virtualized,\n selection: {\n mode: props.multiple ? 'multi' : 'single',\n maxSelections: props.maxSelections,\n },\n infiniteScroll: {\n enabled: props.infiniteScroll,\n pageSize: props.pageSize,\n },\n expandable: {\n enabled: props.expandable,\n },\n clearControl: {\n enabled: props.clearable,\n clearSelection: props.clearSelectionOnClear,\n clearSearch: props.clearSearchOnClear,\n ariaLabel: props.clearAriaLabel,\n icon: props.clearIcon,\n },\n };\n\n el.updateConfig(config);\n });\n};\n\nwatch(\n [\n () => props.searchable,\n () => props.placeholder,\n () => props.disabled,\n () => props.multiple,\n () => props.maxSelections,\n () => props.infiniteScroll,\n () => props.pageSize,\n () => props.virtualized,\n () => props.expandable,\n () => props.clearable,\n () => props.clearSelectionOnClear,\n () => props.clearSearchOnClear,\n () => props.clearAriaLabel,\n () => props.clearIcon,\n ],\n updateConfig\n);\n\n// Event handlers\nconst handleSelect = (e: Event) => {\n const customEvent = e as CustomEvent<SelectEventDetail>;\n const { item, index } = customEvent.detail;\n emit('select', item as SelectItem, index);\n};\n\nconst handleChange = (e: Event) => {\n const customEvent = e as CustomEvent<ChangeEventDetail>;\n const { selectedItems, selectedValues } = customEvent.detail;\n\n const values = selectedValues as (string | number)[];\n\n // Update internal value in uncontrolled mode\n if (!isControlled.value) {\n internalValue.value = props.multiple ? values : values[0];\n }\n\n // Emit events\n const value = props.multiple ? values : values[0];\n emit('update:modelValue', value);\n emit('change', value, selectedItems as SelectItem[]);\n};\n\nconst handleOpen = () => {\n emit('open');\n};\n\nconst handleClose = () => {\n emit('close');\n};\n\nconst handleSearch = (e: Event) => {\n const customEvent = e as CustomEvent<SearchEventDetail>;\n emit('search', customEvent.detail.query);\n};\n\nconst handleLoadMore = (e: Event) => {\n const customEvent = e as CustomEvent<LoadMoreEventDetail>;\n emit('loadMore', customEvent.detail.page);\n};\n\nconst handleCreate = (e: Event) => {\n const customEvent = e as CustomEvent<{ value: string }>;\n emit('create', customEvent.detail.value);\n};\n\nconst handleClear = (e: Event) => {\n const customEvent = e as CustomEvent<ClearEventDetail>;\n emit('clear', {\n clearedSelection: customEvent.detail.clearedSelection,\n clearedSearch: customEvent.detail.clearedSearch,\n });\n};\n\n// Setup event listeners\nonMounted(async () => {\n await waitForUpgrade();\n if (!selectRef.value || !isElementReady.value) return;\n\n const element = selectRef.value as any;\n\n // Initial configuration\n updateConfig();\n\n if (props.placement) {\n element.setAttribute('placement', props.placement);\n }\n\n // Set initial items\n if (props.items?.length) {\n element.setItems(props.items);\n }\n if (props.groupedItems?.length) {\n element.setGroupedItems(props.groupedItems);\n }\n\n // Set initial value\n if (currentValue.value !== undefined) {\n const values = Array.isArray(currentValue.value)\n ? currentValue.value\n : [currentValue.value];\n element.setSelectedValues(values);\n }\n\n // Add event listeners\n element.addEventListener('select', handleSelect as EventListener);\n element.addEventListener('change', handleChange as EventListener);\n element.addEventListener('open', handleOpen as EventListener);\n element.addEventListener('close', handleClose as EventListener);\n element.addEventListener('search', handleSearch as EventListener);\n element.addEventListener('loadMore', handleLoadMore as EventListener);\n element.addEventListener('create', handleCreate as EventListener);\n element.addEventListener('clear', handleClear as EventListener);\n});\n\nonBeforeUnmount(() => {\n customRendererCache.forEach((container) => render(null, container));\n customRendererCache.clear();\n\n if (!selectRef.value) return;\n\n const element = selectRef.value;\n\n // Remove event listeners\n element.removeEventListener('select', handleSelect as EventListener);\n element.removeEventListener('change', handleChange as EventListener);\n element.removeEventListener('open', handleOpen as EventListener);\n element.removeEventListener('close', handleClose as EventListener);\n element.removeEventListener('search', handleSearch as EventListener);\n element.removeEventListener('loadMore', handleLoadMore as EventListener);\n element.removeEventListener('create', handleCreate as EventListener);\n element.removeEventListener('clear', handleClear as EventListener);\n});\n\n// Expose imperative API\ndefineExpose({\n /** Open the dropdown */\n open: () => {\n (selectRef.value as any)?.open();\n },\n /** Close the dropdown */\n close: () => {\n (selectRef.value as any)?.close();\n },\n /** Focus the select */\n focus: () => {\n selectRef.value?.focus();\n },\n /** Set items programmatically */\n setItems: (items: SelectItem[]) => {\n (selectRef.value as any)?.setItems(items);\n },\n /** Set grouped items programmatically */\n setGroupedItems: (groups: GroupedItem[]) => {\n (selectRef.value as any)?.setGroupedItems(groups);\n },\n /** Clear selection */\n clear: () => {\n (selectRef.value as any)?.setSelectedValues([]);\n if (!isControlled.value) {\n internalValue.value = props.multiple ? [] : undefined;\n }\n const value = props.multiple ? [] : '';\n emit('update:modelValue', value);\n emit('change', value, []);\n },\n});\n</script>\n\n<style scoped>\n/* Component uses web component styling from @smilodon/core */\n</style>\n"],"names":["_createBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoIA,UAAM,QAAQ;AAgBd,UAAM,OAAO;AAEb,UAAM,YAAY,IAAwB,IAAI;AAC9C,UAAM,iBAAiB,IAAI,KAAK;AAChC,UAAM,gBAAgB;AAAA,MACpB,MA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;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/Select.vue"],"sourcesContent":["<!--\n Smilodon Select Component for Vue 3\n \n A production-ready, accessible select component with advanced features:\n - Single and multi-select modes\n - Searchable with client or server-side filtering\n - Infinite scroll and virtual scrolling for large datasets\n - Grouped options\n - Custom rendering\n - Full keyboard navigation\n - WCAG 2.1 AAA compliant\n \n @example\n <Select\n :items=\"items\"\n v-model=\"selectedValue\"\n searchable\n placeholder=\"Select an option...\"\n />\n-->\n\n<template>\n <enhanced-select\n ref=\"selectRef\"\n :class=\"className\"\n :style=\"style\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, onMounted, onBeforeUnmount, computed, render, isVNode, h } from 'vue';\nimport type {\n SelectEventDetail,\n OpenEventDetail,\n CloseEventDetail,\n SearchEventDetail,\n ChangeEventDetail,\n LoadMoreEventDetail,\n ClearEventDetail,\n GroupedItem,\n RendererHelpers,\n} from '@smilodon/core';\n\nexport interface SelectItem {\n value: string | number;\n label: string;\n disabled?: boolean;\n group?: string;\n [key: string]: any;\n}\n\nexport interface SelectProps {\n /** Array of items to display in the select */\n items?: SelectItem[];\n /** Grouped items (alternative to items) */\n groupedItems?: GroupedItem[];\n /** Selected value(s) - for v-model binding */\n modelValue?: string | number | (string | number)[];\n /** Default value for uncontrolled mode */\n defaultValue?: string | number | (string | number)[];\n /** Enable multi-select mode */\n multiple?: boolean;\n /** Enable search functionality */\n searchable?: boolean;\n /** Placeholder text */\n placeholder?: string;\n /** Disable the select */\n disabled?: boolean;\n /** Mark as required */\n required?: boolean;\n /** Show error state */\n error?: boolean;\n /** Enable infinite scroll */\n infiniteScroll?: boolean;\n /** Number of items per page (for infinite scroll) */\n pageSize?: number;\n /** Enable virtual scrolling */\n virtualized?: boolean;\n /** Maximum number of selections (for multi-select) */\n maxSelections?: number;\n /** Dropdown placement */\n placement?: 'bottom' | 'top' | 'auto';\n /** Custom CSS class */\n className?: string;\n /** Custom inline styles */\n style?: Record<string, string>;\n /** Enable expandable dropdown */\n expandable?: boolean;\n\n /** Enable clear control button */\n clearable?: boolean;\n\n /** Clear selected values when clear control is clicked */\n clearSelectionOnClear?: boolean;\n\n /** Clear search query when clear control is clicked */\n clearSearchOnClear?: boolean;\n\n /** ARIA label for clear control */\n clearAriaLabel?: string;\n\n /** Icon text for clear control */\n clearIcon?: string;\n\n /** Custom option renderer returning an HTMLElement */\n optionRenderer?: (item: SelectItem, index: number, helpers: RendererHelpers) => HTMLElement;\n\n /** Custom Vue renderer returning a VNode */\n customRenderer?: (item: SelectItem, index: number) => ReturnType<typeof h>;\n}\n\nexport interface SelectEmits {\n /** Emitted when selection changes - for v-model */\n (e: 'update:modelValue', value: string | number | (string | number)[]): void;\n /** Emitted when selection changes with full details */\n (e: 'change', value: string | number | (string | number)[], selectedItems: SelectItem[]): void;\n /** Emitted when an item is selected */\n (e: 'select', item: SelectItem, index: number): void;\n /** Emitted when dropdown opens */\n (e: 'open'): void;\n /** Emitted when dropdown closes */\n (e: 'close'): void;\n /** Emitted when search query changes */\n (e: 'search', query: string): void;\n /** Emitted when more items are requested (infinite scroll) */\n (e: 'loadMore', page: number): void;\n /** Emitted when user creates a new item (if enabled) */\n (e: 'create', value: string): void;\n /** Emitted when clear control is used */\n (e: 'clear', detail: { clearedSelection: boolean; clearedSearch: boolean }): void;\n}\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n items: () => [],\n multiple: false,\n searchable: false,\n disabled: false,\n required: false,\n error: false,\n infiniteScroll: false,\n pageSize: 50,\n virtualized: true,\n placement: 'auto',\n clearable: false,\n clearSelectionOnClear: true,\n clearSearchOnClear: true,\n});\n\nconst emit = defineEmits<SelectEmits>();\n\nconst selectRef = ref<HTMLElement | null>(null);\nconst isElementReady = ref(false);\nconst internalValue = ref<string | number | (string | number)[] | undefined>(\n props.defaultValue\n);\nconst customRendererCache = new Map<number, HTMLElement>();\n\n// Manual management of renderer wrapper to avoid reactivity on function identity\nconst resolvedOptionRenderer = ref<any>(undefined);\n\n// Watch for structural changes in renderers (presence only)\nwatch(\n [() => !!props.optionRenderer, () => !!props.customRenderer],\n ([hasOption, hasCustom]) => {\n if (hasOption) {\n resolvedOptionRenderer.value = (item: SelectItem, index: number, helpers: RendererHelpers) => {\n // Accessing props inside here is safe - it delegates to current prop\n return props.optionRenderer?.(item, index, helpers) || document.createElement('div');\n };\n } else if (hasCustom) {\n resolvedOptionRenderer.value = (item: SelectItem, index: number) => {\n let container = customRendererCache.get(index);\n if (!container) {\n container = document.createElement('div');\n customRendererCache.set(index, container);\n }\n\n const node = props.customRenderer?.(item, index);\n if (node && isVNode(node)) {\n render(node, container);\n } else if (node) {\n render(h('span', String(node)), container);\n } else {\n render(null, container);\n }\n return container;\n };\n } else {\n resolvedOptionRenderer.value = undefined;\n }\n },\n { immediate: true }\n);\n\n// Sync custom option renderer\n// We watch the stable `resolvedOptionRenderer` ref, which only updates when structure changes.\nwatch(\n resolvedOptionRenderer,\n (renderer) => {\n safeCall((el) => {\n (el as any).optionRenderer = renderer;\n });\n },\n { immediate: true }\n);\n\nconst waitForUpgrade = async () => {\n if (typeof window === 'undefined') return;\n\n // Ensure the module is loaded (it registers the custom element on import)\n if (!customElements.get('enhanced-select')) {\n await import('@smilodon/core');\n }\n\n const el = selectRef.value as any;\n if (!el) return;\n\n // Wait until the element is upgraded and its methods exist.\n // In some environments, the tag can be defined but the particular instance\n // hasn't been upgraded yet when watchers/mounted run.\n try {\n await customElements.whenDefined('enhanced-select');\n } catch {\n // ignore\n }\n\n // Retry a few frames to let the browser upgrade the instance.\n for (let i = 0; i < 5; i++) {\n const candidate = selectRef.value as any;\n if (candidate && typeof candidate.setItems === 'function') {\n isElementReady.value = true;\n if (resolvedOptionRenderer.value) {\n (candidate as any).optionRenderer = resolvedOptionRenderer.value;\n }\n return;\n }\n await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));\n }\n\n isElementReady.value = typeof (selectRef.value as any)?.setItems === 'function';\n if (isElementReady.value && resolvedOptionRenderer.value) {\n (selectRef.value as any).optionRenderer = resolvedOptionRenderer.value;\n }\n};\n\nconst safeCall = (fn: (el: any) => void) => {\n const el = selectRef.value as any;\n if (!el || !isElementReady.value) return;\n fn(el);\n};\n\n// Check if component is controlled\nconst isControlled = computed(() => props.modelValue !== undefined);\n\n// Get current value\nconst currentValue = computed(() =>\n isControlled.value ? props.modelValue : internalValue.value\n);\n\n// Sync items to web component\nwatch(\n () => props.items,\n (newItems) => {\n safeCall((el) => {\n if (newItems) el.setItems(newItems);\n });\n },\n { deep: true }\n);\n\n// Sync grouped items to web component\nwatch(\n () => props.groupedItems,\n (newGroups) => {\n safeCall((el) => {\n if (newGroups) el.setGroupedItems(newGroups);\n });\n },\n { deep: true }\n);\n\n// removed old watcher\n\n// We need to keep rendererRefs in sync with props\n// Wait, the previous replacement put the watch inside the script setup directly after refs.\n// That watch updates rendererRefs.\n// But we ALSO need to update the web component if the *presence* of renderers changes (e.g. going from undefined to defined).\n// The existing watcher below was watching `resolvedOptionRenderer.value`.\n// Since `resolvedOptionRenderer` computed now depends only on PRESENCE (implicitly through logic), it should remain stable.\n// So `watch(() => resolvedOptionRenderer.value)` will only fire when PRESENCE changes.\n// THIS IS EXACTLY WHAT WE WANT. It won't fire on identity change.\n// So the original watcher is actually fine as is!\n// BUT: I changed how `resolvedOptionRenderer` works. Let's double check if I broke the watch logic.\n// The computed property returns a *new function* only if the structure changes (e.g. `hasOptionRenderer` flips).\n// So the watcher below will trigger correctly only when structure changes.\n\n// Wait, I see I didn't include `rendererRefs` update in the previous `replace_string_in_file` properly?\n// Previous call:\n// Replaced `const resolvedOptionRenderer ...` block.\n// Included `rendererRefs` definition and `watch` to update refs.\n\n// But wait, the previous `replace_string_in_file` REPLACED the computed property, but did it include the watch for refs?\n// Yes.\n// So the code looks like:\n// ...\n// const rendererRefs = ...\n// watch( ... updates rendererRefs ... )\n// const resolvedOptionRenderer = computed( ... )\n// ...\n//\n// And further down there is existing code:\n// watch(() => resolvedOptionRenderer.value, ...)\n//\n// This existing code is correct! It will update the WC only when the wrapper function changes (which is stable).\n// So I don't need to change the watcher below.\n// UNLESS: The watcher below relies on `resolvedOptionRenderer.value` changing.\n// If props.customRenderer changes from `undefined` to `fn`, computed re-runs -> new wrapper -> watcher runs -> WC updated. Correct.\n// If props.customRenderer changes from `fn1` to `fn2`, computed (depending on `!!props`? No, computed in Vue tracks all dependencies accessed).\n// Wait! `resolvedOptionRenderer` accesses `rendererRefs`.\n// `rendererRefs` is a local object. It is NOT reactive (it's a plain object).\n// `computed` tracks dependencies. If I access `rendererRefs.customRenderer`, does Vue track it? No.\n// So `resolvedOptionRenderer` will NOT re-run when `rendererRefs` changes. This is GOOD. It's stable.\n// But `watch(() => [props.optionRenderer, props.customRenderer], ...)` updates `rendererRefs`.\n// So when `fn1` -> `fn2`, `rendererRefs` is updated. `resolvedOptionRenderer` is NOT re-computed. The OLD wrapper function is still used.\n// But the wrapper function calls `rendererRefs.customRenderer`. This is the NEW function `fn2`.\n// So it works! The wrapper delegates to the current ref.\n// And `resolvedOptionRenderer.value` (the wrapper) hasn't changed identity, so the watcher below (syncing to WC) does NOT fire.\n// This means `el.optionRenderer = wrapper` is NOT called again.\n// Is this okay? Yes, because `el.optionRenderer` is already set to the wrapper. The wrapper hasn't changed.\n// So the infinite loop is broken.\n\n// HOWEVER: I still need to check if my previous replacement was syntactically correct and complete.\n// I see I replaced `const resolvedOptionRenderer ...` with a block that includes `const rendererRefs ...`.\n// Let's verify `rendererRefs` is reactive or not.\n// `const rendererRefs = { ... }` is NOT reactive. This is intentional.\n// We don't want reactivity to trigger computed re-eval.\n\n// BUT `watch(() => [props.optionRenderer...])` updates it.\n// The watcher needs `props` to be in scope. `props` is defined above.\n// It seems correct.\n\n// One detail:\n// `const resolvedOptionRenderer = computed(() => { ... })`\n// Vue computed properties track dependencies.\n// Inside computed, I access `props.optionRenderer` (to check boolean).\n// So computed depends on `props.optionRenderer`.\n// If `props.optionRenderer` changes from `fn1` to `fn2`, `!!props.optionRenderer` is still `true`.\n// Does the dependency change?\n// Vue tracks access. If I only access `!!props.optionRenderer`, maybe it only tracks the boolean?\n// No, usually it tracks the property.\n// If I use `props.optionRenderer` in `if (props.optionRenderer)`, it tracks it.\n// So if it changes, computed re-runs!\n// And returns a NEW function.\n// So watcher runs -> WC update -> Loop.\n// I need `computed` to NOT depend on the function identity.\n// I should use `!!props.optionRenderer` in a way that doesn't trigger on identity change?\n// Or better: explicit dependencies or a structure that isolates the check.\n// In Vue `computed`, we can't easily control the dependency array like React's `useMemo`.\n// But we can access the boolean via a separate stable computed property or just trust that Vue's dependency tracking is based on value?.\n// No, props are reactive.\n// If I assume Vue computes re-run on prop change:\n// Then the wrapper is recreated.\n// I need `resolvedOptionRenderer` to be a `shallowRef` or generic `ref` that I manually update only when structure changes!\n// `computed` is risky here.\n\n// Better approach for Vue:\n// Use `ref` for the wrapper.\n// Watch `[() => !!props.optionRenderer, () => !!props.customRenderer]` explicitly.\n// When that specific boolean tuple changes, update the wrapper ref.\n// And have the \"Sync custom option renderer\" watch depend on that wrapper ref.\n\n// Let's undo/redo the Vue part with this safer `shallowRef` approach.\n\nwatch(\n () => [props.items, props.groupedItems],\n () => {\n const totalItems = props.groupedItems\n ? props.groupedItems.reduce((count, group) => count + group.options.length, 0)\n : props.items.length;\n\n customRendererCache.forEach((container, index) => {\n if (index >= totalItems) {\n render(null, container);\n customRendererCache.delete(index);\n }\n });\n },\n { deep: true }\n);\n\n// Sync value to web component\nwatch(\n currentValue,\n (newValue) => {\n safeCall((el) => {\n if (newValue !== undefined) {\n // Get current selected values from the element to avoid infinite loop\n const currentSelected = el.getSelectedValues?.() || [];\n const newValues = Array.isArray(newValue) ? newValue : [newValue];\n \n // Only update if values have actually changed\n const hasChanged = \n currentSelected.length !== newValues.length ||\n !currentSelected.every((v: any, i: number) => v === newValues[i]);\n \n if (hasChanged) {\n el.setSelectedValues(newValues);\n }\n }\n });\n },\n { immediate: true }\n);\n\n// Sync configuration\nconst updateConfig = () => {\n safeCall((el) => {\n const config = {\n searchable: props.searchable,\n placeholder: props.placeholder,\n enabled: !props.disabled,\n virtualize: props.virtualized,\n selection: {\n mode: props.multiple ? 'multi' : 'single',\n maxSelections: props.maxSelections,\n },\n infiniteScroll: {\n enabled: props.infiniteScroll,\n pageSize: props.pageSize,\n },\n expandable: {\n enabled: props.expandable,\n },\n clearControl: {\n enabled: props.clearable,\n clearSelection: props.clearSelectionOnClear,\n clearSearch: props.clearSearchOnClear,\n ariaLabel: props.clearAriaLabel,\n icon: props.clearIcon,\n },\n };\n\n el.updateConfig(config);\n });\n};\n\nwatch(\n [\n () => props.searchable,\n () => props.placeholder,\n () => props.disabled,\n () => props.multiple,\n () => props.maxSelections,\n () => props.infiniteScroll,\n () => props.pageSize,\n () => props.virtualized,\n () => props.expandable,\n () => props.clearable,\n () => props.clearSelectionOnClear,\n () => props.clearSearchOnClear,\n () => props.clearAriaLabel,\n () => props.clearIcon,\n ],\n updateConfig\n);\n\n// Event handlers\nconst handleSelect = (e: Event) => {\n const customEvent = e as CustomEvent<SelectEventDetail>;\n const { item, index } = customEvent.detail;\n emit('select', item as SelectItem, index);\n};\n\nconst handleChange = (e: Event) => {\n const customEvent = e as CustomEvent<ChangeEventDetail>;\n const { selectedItems, selectedValues } = customEvent.detail;\n\n const values = selectedValues as (string | number)[];\n\n // Update internal value in uncontrolled mode\n if (!isControlled.value) {\n internalValue.value = props.multiple ? values : values[0];\n }\n\n // Emit events\n const value = props.multiple ? values : values[0];\n emit('update:modelValue', value);\n emit('change', value, selectedItems as SelectItem[]);\n};\n\nconst handleOpen = () => {\n emit('open');\n};\n\nconst handleClose = () => {\n emit('close');\n};\n\nconst handleSearch = (e: Event) => {\n const customEvent = e as CustomEvent<SearchEventDetail>;\n emit('search', customEvent.detail.query);\n};\n\nconst handleLoadMore = (e: Event) => {\n const customEvent = e as CustomEvent<LoadMoreEventDetail>;\n emit('loadMore', customEvent.detail.page);\n};\n\nconst handleCreate = (e: Event) => {\n const customEvent = e as CustomEvent<{ value: string }>;\n emit('create', customEvent.detail.value);\n};\n\nconst handleClear = (e: Event) => {\n const customEvent = e as CustomEvent<ClearEventDetail>;\n emit('clear', {\n clearedSelection: customEvent.detail.clearedSelection,\n clearedSearch: customEvent.detail.clearedSearch,\n });\n};\n\n// Setup event listeners\nonMounted(async () => {\n await waitForUpgrade();\n if (!selectRef.value || !isElementReady.value) return;\n\n const element = selectRef.value as any;\n\n // Initial configuration\n updateConfig();\n\n if (props.placement) {\n element.setAttribute('placement', props.placement);\n }\n\n // Set initial items\n if (props.items?.length) {\n // Auto-convert flat items that include a `group` property into groupedItems\n const first = props.items[0];\n if (first && (first as any).group !== undefined) {\n const map = new Map<string, any[]>();\n props.items.forEach((it: any) => {\n const g = it.group ?? 'Ungrouped';\n if (!map.has(g)) map.set(g, []);\n map.get(g)!.push(it);\n });\n const groups = Array.from(map.entries()).map(([label, options]) => ({ label, options }));\n element.setGroupedItems(groups);\n } else {\n element.setItems(props.items);\n }\n }\n if (props.groupedItems?.length) {\n element.setGroupedItems(props.groupedItems);\n }\n\n // Set initial value\n if (currentValue.value !== undefined) {\n const values = Array.isArray(currentValue.value)\n ? currentValue.value\n : [currentValue.value];\n element.setSelectedValues(values);\n }\n\n // Add event listeners\n element.addEventListener('select', handleSelect as EventListener);\n element.addEventListener('change', handleChange as EventListener);\n element.addEventListener('open', handleOpen as EventListener);\n element.addEventListener('close', handleClose as EventListener);\n element.addEventListener('search', handleSearch as EventListener);\n element.addEventListener('loadMore', handleLoadMore as EventListener);\n element.addEventListener('create', handleCreate as EventListener);\n element.addEventListener('clear', handleClear as EventListener);\n});\n\nonBeforeUnmount(() => {\n customRendererCache.forEach((container) => render(null, container));\n customRendererCache.clear();\n\n if (!selectRef.value) return;\n\n const element = selectRef.value;\n\n // Remove event listeners\n element.removeEventListener('select', handleSelect as EventListener);\n element.removeEventListener('change', handleChange as EventListener);\n element.removeEventListener('open', handleOpen as EventListener);\n element.removeEventListener('close', handleClose as EventListener);\n element.removeEventListener('search', handleSearch as EventListener);\n element.removeEventListener('loadMore', handleLoadMore as EventListener);\n element.removeEventListener('create', handleCreate as EventListener);\n element.removeEventListener('clear', handleClear as EventListener);\n});\n\n// Expose imperative API\ndefineExpose({\n /** Open the dropdown */\n open: () => {\n (selectRef.value as any)?.open();\n },\n /** Close the dropdown */\n close: () => {\n (selectRef.value as any)?.close();\n },\n /** Focus the select */\n focus: () => {\n selectRef.value?.focus();\n },\n /** Set items programmatically */\n setItems: (items: SelectItem[]) => {\n (selectRef.value as any)?.setItems(items);\n },\n /** Set grouped items programmatically */\n setGroupedItems: (groups: GroupedItem[]) => {\n (selectRef.value as any)?.setGroupedItems(groups);\n },\n /** Clear selection */\n clear: () => {\n (selectRef.value as any)?.setSelectedValues([]);\n if (!isControlled.value) {\n internalValue.value = props.multiple ? [] : undefined;\n }\n const value = props.multiple ? [] : '';\n emit('update:modelValue', value);\n emit('change', value, []);\n },\n});\n</script>\n\n<style scoped>\n/* Component uses web component styling from @smilodon/core */\n</style>\n"],"names":["_createBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoIA,UAAM,QAAQ;AAgBd,UAAM,OAAO;AAEb,UAAM,YAAY,IAAwB,IAAI;AAC9C,UAAM,iBAAiB,IAAI,KAAK;AAChC,UAAM,gBAAgB;AAAA,MACpB,MAAM;AAAA,IAAA;AAER,UAAM,0CAA0B,IAAA;AAGhC,UAAM,yBAAyB,IAAS,MAAS;AAGjD;AAAA,MACE,CAAC,MAAM,CAAC,CAAC,MAAM,gBAAgB,MAAM,CAAC,CAAC,MAAM,cAAc;AAAA,MAC3D,CAAC,CAAC,WAAW,SAAS,MAAM;AAC1B,YAAI,WAAW;AACb,iCAAuB,QAAQ,CAAC,MAAkB,OAAe,YAA6B;;AAE5F,qBAAO,WAAM,mBAAN,+BAAuB,MAAM,OAAO,aAAY,SAAS,cAAc,KAAK;AAAA,UACrF;AAAA,QACF,WAAW,WAAW;AACpB,iCAAuB,QAAQ,CAAC,MAAk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AAI,CAAC;IAClB,mCAAmC;IACnC,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACnB,wCAAwC;IACxC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,8DAA8D;IAC9D,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,wDAAwD;IACxD,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,yCAAyC;IACzC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE;QAAE,gBAAgB,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACnF;;IAodC,wBAAwB;;IAIxB,yBAAyB;;IAIzB,uBAAuB;;IAIvB,iCAAiC;sBACf,UAAU,EAAE;IAG9B,yCAAyC;8BACf,WAAW,EAAE;IAGvC,sBAAsB;;;;;;;;;;;;0BAzemB,OAAO;uBAAiB,OAAO;;;;;;;;;;;;0BAA/B,OAAO;uBAAiB,OAAO;;;cA9D7D,OAAO;WAdV,UAAU,EAAE;cAQT,OAAO;gBAEL,OAAO;cAMT,OAAO;WAEV,OAAO;oBAEE,OAAO;cAEb,MAAM;iBAEH,OAAO;eAIT,QAAQ,GAAG,KAAK,GAAG,MAAM;eASzB,OAAO;2BAGK,OAAO;wBAGV,OAAO;;AA0lB9B,wBASG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smilodon/vue",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "Vue 3 adapter for @smilodon/core - Production-ready accessible select component",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -23,7 +23,7 @@
23
23
  "prepublishOnly": "npm run build"
24
24
  },
25
25
  "peerDependencies": {
26
- "@smilodon/core": "^1.4.4",
26
+ "@smilodon/core": "^1.4.9",
27
27
  "vue": "^3.0.0"
28
28
  },
29
29
  "devDependencies": {