@smilodon/vue 1.4.10 → 1.4.11

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/README.md CHANGED
@@ -9,7 +9,7 @@ Production-ready, accessible select component for Vue 3 applications.
9
9
  👉 **[Complete Vue Guide](./COMPLETE-GUIDE.md)** 👈
10
10
 
11
11
  The complete guide includes:
12
- - ✅ All 60+ CSS variables for complete customization
12
+ - ✅ Complete styling token coverage for colors, layout, chips, motion, and accessibility
13
13
  - ✅ Vue 3-specific patterns (Composition API, v-model, computed)
14
14
  - ✅ Complete API reference with TypeScript types
15
15
  - ✅ Pinia store integration examples
@@ -77,6 +77,54 @@ or
77
77
  pnpm add @smilodon/vue @smilodon/core
78
78
  ```
79
79
 
80
+ ## Nuxt Integration
81
+
82
+ Nuxt works well with `@smilodon/vue`, but the underlying `enhanced-select` custom element must be treated as a custom element by the Vue compiler.
83
+
84
+ ### `nuxt.config.ts`
85
+
86
+ ```ts
87
+ export default defineNuxtConfig({
88
+ vue: {
89
+ compilerOptions: {
90
+ isCustomElement: (tag) => tag === 'enhanced-select',
91
+ },
92
+ },
93
+ })
94
+ ```
95
+
96
+ ### Client usage in Nuxt
97
+
98
+ ```vue
99
+ <script setup lang="ts">
100
+ import { ref } from 'vue'
101
+ import { Select } from '@smilodon/vue'
102
+
103
+ const value = ref<string | number>('')
104
+ const items = [
105
+ { value: 'nuxt', label: 'Nuxt' },
106
+ { value: 'vite', label: 'Vite' },
107
+ { value: 'astro', label: 'Astro' },
108
+ ]
109
+ </script>
110
+
111
+ <template>
112
+ <Select
113
+ v-model="value"
114
+ :items="items"
115
+ searchable
116
+ clearable
117
+ placeholder="Choose a stack"
118
+ />
119
+ </template>
120
+ ```
121
+
122
+ ### Nuxt notes
123
+
124
+ - Keep browser-only imperative access inside `onMounted()`.
125
+ - Pass plain objects/arrays through props when data originates from server routes.
126
+ - If you style globally, target `::part()` hooks or CSS variables rather than internal markup.
127
+
80
128
  ## Quick Start
81
129
 
82
130
  ```vue
package/dist/index.cjs CHANGED
@@ -44,6 +44,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
44
44
  placement: { default: "auto" },
45
45
  className: {},
46
46
  style: {},
47
+ classMap: {},
47
48
  expandable: { type: Boolean },
48
49
  clearable: { type: Boolean, default: false },
49
50
  clearSelectionOnClear: { type: Boolean, default: true },
@@ -51,9 +52,17 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
51
52
  clearAriaLabel: {},
52
53
  clearIcon: {},
53
54
  optionRenderer: {},
54
- customRenderer: {}
55
+ customRenderer: {},
56
+ trackingEnabled: { type: Boolean, default: false },
57
+ trackEvents: { type: Boolean, default: true },
58
+ trackStyling: { type: Boolean, default: true },
59
+ trackLimitations: { type: Boolean, default: true },
60
+ emitDiagnostics: { type: Boolean, default: false },
61
+ trackingMaxEntries: { default: 200 },
62
+ limitationPolicies: {},
63
+ autoMitigateRuntimeModeSwitch: { type: Boolean, default: true }
55
64
  },
56
- emits: ["update:modelValue", "change", "select", "open", "close", "search", "loadMore", "create", "clear"],
65
+ emits: ["update:modelValue", "change", "select", "open", "close", "search", "loadMore", "create", "clear", "diagnostic"],
57
66
  setup(__props, { expose: __expose, emit: __emit }) {
58
67
  const props = __props;
59
68
  const emit = __emit;
@@ -105,6 +114,15 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
105
114
  },
106
115
  { immediate: true }
107
116
  );
117
+ vue.watch(
118
+ () => props.classMap,
119
+ (map) => {
120
+ safeCall((el) => {
121
+ el.classMap = map;
122
+ });
123
+ },
124
+ { immediate: true, deep: true }
125
+ );
108
126
  const waitForUpgrade = async () => {
109
127
  var _a;
110
128
  if (typeof window === "undefined") return;
@@ -124,6 +142,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
124
142
  if (resolvedOptionRenderer.value) {
125
143
  candidate.optionRenderer = resolvedOptionRenderer.value;
126
144
  }
145
+ if (props.classMap) {
146
+ candidate.classMap = props.classMap;
147
+ }
127
148
  return;
128
149
  }
129
150
  await new Promise((resolve) => requestAnimationFrame(() => resolve()));
@@ -132,12 +153,15 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
132
153
  if (isElementReady.value && resolvedOptionRenderer.value) {
133
154
  selectRef.value.optionRenderer = resolvedOptionRenderer.value;
134
155
  }
156
+ if (isElementReady.value && props.classMap) {
157
+ selectRef.value.classMap = props.classMap;
158
+ }
135
159
  };
136
- const safeCall = (fn) => {
160
+ function safeCall(fn) {
137
161
  const el = selectRef.value;
138
162
  if (!el || !isElementReady.value) return;
139
163
  fn(el);
140
- };
164
+ }
141
165
  const isControlled = vue.computed(() => props.modelValue !== void 0);
142
166
  const currentValue = vue.computed(
143
167
  () => isControlled.value ? props.modelValue : internalValue.value
@@ -252,6 +276,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
252
276
  clearSearch: props.clearSearchOnClear,
253
277
  ariaLabel: props.clearAriaLabel,
254
278
  icon: props.clearIcon
279
+ },
280
+ tracking: {
281
+ enabled: props.trackingEnabled,
282
+ events: props.trackEvents,
283
+ styling: props.trackStyling,
284
+ limitations: props.trackLimitations,
285
+ emitDiagnostics: props.emitDiagnostics,
286
+ maxEntries: props.trackingMaxEntries
287
+ },
288
+ limitations: {
289
+ policies: props.limitationPolicies,
290
+ autoMitigateRuntimeModeSwitch: props.autoMitigateRuntimeModeSwitch
255
291
  }
256
292
  };
257
293
  el.updateConfig(config);
@@ -272,7 +308,15 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
272
308
  () => props.clearSelectionOnClear,
273
309
  () => props.clearSearchOnClear,
274
310
  () => props.clearAriaLabel,
275
- () => props.clearIcon
311
+ () => props.clearIcon,
312
+ () => props.trackingEnabled,
313
+ () => props.trackEvents,
314
+ () => props.trackStyling,
315
+ () => props.trackLimitations,
316
+ () => props.emitDiagnostics,
317
+ () => props.trackingMaxEntries,
318
+ () => props.limitationPolicies,
319
+ () => props.autoMitigateRuntimeModeSwitch
276
320
  ],
277
321
  updateConfig
278
322
  );
@@ -317,6 +361,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
317
361
  clearedSearch: customEvent.detail.clearedSearch
318
362
  });
319
363
  };
364
+ const handleDiagnostic = (e) => {
365
+ const customEvent = e;
366
+ emit("diagnostic", customEvent.detail);
367
+ };
320
368
  vue.onMounted(async () => {
321
369
  var _a, _b;
322
370
  await waitForUpgrade();
@@ -356,6 +404,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
356
404
  element.addEventListener("loadMore", handleLoadMore);
357
405
  element.addEventListener("create", handleCreate);
358
406
  element.addEventListener("clear", handleClear);
407
+ element.addEventListener("diagnostic", handleDiagnostic);
359
408
  });
360
409
  vue.onBeforeUnmount(() => {
361
410
  customRendererCache.forEach((container) => vue.render(null, container));
@@ -370,6 +419,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
370
419
  element.removeEventListener("loadMore", handleLoadMore);
371
420
  element.removeEventListener("create", handleCreate);
372
421
  element.removeEventListener("clear", handleClear);
422
+ element.removeEventListener("diagnostic", handleDiagnostic);
373
423
  });
374
424
  __expose({
375
425
  /** Open the dropdown */
@@ -407,16 +457,40 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
407
457
  const value = props.multiple ? [] : "";
408
458
  emit("update:modelValue", value);
409
459
  emit("change", value, []);
460
+ },
461
+ /** Runtime capability report */
462
+ getCapabilities: () => {
463
+ var _a, _b;
464
+ return (_b = (_a = selectRef.value) == null ? void 0 : _a.getCapabilities) == null ? void 0 : _b.call(_a);
465
+ },
466
+ /** Known limitations report */
467
+ getKnownLimitations: () => {
468
+ var _a, _b;
469
+ return ((_b = (_a = selectRef.value) == null ? void 0 : _a.getKnownLimitations) == null ? void 0 : _b.call(_a)) || [];
470
+ },
471
+ /** Tracking snapshot */
472
+ getTrackingSnapshot: () => {
473
+ var _a, _b;
474
+ return ((_b = (_a = selectRef.value) == null ? void 0 : _a.getTrackingSnapshot) == null ? void 0 : _b.call(_a)) || { events: [], styles: [], limitations: [] };
475
+ },
476
+ /** Clear tracking entries */
477
+ clearTracking: (source) => {
478
+ var _a, _b;
479
+ (_b = (_a = selectRef.value) == null ? void 0 : _a.clearTracking) == null ? void 0 : _b.call(_a, source);
480
+ },
481
+ /** Update limitation policies */
482
+ setLimitationPolicies: (policies) => {
483
+ var _a, _b;
484
+ (_b = (_a = selectRef.value) == null ? void 0 : _a.setLimitationPolicies) == null ? void 0 : _b.call(_a, policies);
410
485
  }
411
486
  });
412
487
  return (_ctx, _cache) => {
413
- const _component_enhanced_select = vue.resolveComponent("enhanced-select");
414
- return vue.openBlock(), vue.createBlock(_component_enhanced_select, {
488
+ return vue.openBlock(), vue.createElementBlock("enhanced-select", {
415
489
  ref_key: "selectRef",
416
490
  ref: selectRef,
417
491
  class: vue.normalizeClass(__props.className),
418
492
  style: vue.normalizeStyle(__props.style)
419
- }, null, 8, ["class", "style"]);
493
+ }, null, 6);
420
494
  };
421
495
  }
422
496
  });
@@ -427,7 +501,7 @@ const _export_sfc = (sfc, props) => {
427
501
  }
428
502
  return target;
429
503
  };
430
- const Select = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-39dd1344"]]);
504
+ const Select = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-854fa07c"]]);
431
505
  exports.Select = Select;
432
506
  exports.default = Select;
433
507
  //# 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 /** Custom renderer for group headers when groupedItems are used */\n groupHeaderRenderer?: (group: GroupedItem, index: number) => ReturnType<typeof h>;\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// Sync custom group header renderer\nwatch(\n () => props.groupHeaderRenderer,\n (renderer) => {\n safeCall((el) => {\n if (renderer) {\n el.groupHeaderRenderer = (group: any, idx: number) => {\n const container = document.createElement('div');\n const node = renderer(group, idx);\n if (node && isVNode(node)) {\n render(node, container);\n } else if (node) {\n render(h('span', String(node)), container);\n }\n return container;\n };\n }\n });\n }\n);\n\n// Sync custom group header renderer\nwatch(\n () => props.groupHeaderRenderer,\n (renderer) => {\n safeCall((el) => {\n if (renderer) {\n el.groupHeaderRenderer = (group: any, idx: number) => {\n const container = document.createElement('div');\n const node = renderer(group, idx);\n if (node && isVNode(node)) {\n render(node, container);\n } else if (node) {\n render(h('span', String(node)), container);\n }\n return container;\n };\n }\n });\n }\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsIA,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,MA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IAAK;AACpC,aAAK,qBAAqB,KAAK;AAC/B,aAAK,UAAU,OAAO,EAAE;AAAA,MAC1B;AAAA,IAAA,CACD;;;8BAxoBCK,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 ClassMap,\n RendererHelpers,\n DiagnosticEventDetail,\n LimitationPolicyMap,\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 /** Custom renderer for group headers when groupedItems are used */\n groupHeaderRenderer?: (group: GroupedItem, index: number) => ReturnType<typeof h>;\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 /** State-class mapping for utility CSS frameworks */\n classMap?: ClassMap;\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 /** Enable runtime tracking */\n trackingEnabled?: boolean;\n\n /** Track emitted events */\n trackEvents?: boolean;\n\n /** Track styling changes */\n trackStyling?: boolean;\n\n /** Track limitations and policy updates */\n trackLimitations?: boolean;\n\n /** Emit diagnostic events */\n emitDiagnostics?: boolean;\n\n /** Max entries retained per tracking channel */\n trackingMaxEntries?: number;\n\n /** Limitation control policies */\n limitationPolicies?: LimitationPolicyMap;\n\n /** Automatically mitigate mode switching limitation */\n autoMitigateRuntimeModeSwitch?: boolean;\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 /** Emitted when runtime diagnostics are enabled */\n (e: 'diagnostic', detail: DiagnosticEventDetail): 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 trackingEnabled: false,\n trackEvents: true,\n trackStyling: true,\n trackLimitations: true,\n emitDiagnostics: false,\n trackingMaxEntries: 200,\n autoMitigateRuntimeModeSwitch: 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\nwatch(\n () => props.classMap,\n (map) => {\n safeCall((el) => {\n (el as any).classMap = map;\n });\n },\n { immediate: true, deep: 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 if (props.classMap) {\n (candidate as any).classMap = props.classMap;\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 if (isElementReady.value && props.classMap) {\n (selectRef.value as any).classMap = props.classMap;\n }\n};\n\nfunction 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// Sync custom group header renderer\nwatch(\n () => props.groupHeaderRenderer,\n (renderer) => {\n safeCall((el) => {\n if (renderer) {\n el.groupHeaderRenderer = (group: any, idx: number) => {\n const container = document.createElement('div');\n const node = renderer(group, idx);\n if (node && isVNode(node)) {\n render(node, container);\n } else if (node) {\n render(h('span', String(node)), container);\n }\n return container;\n };\n }\n });\n }\n);\n\n// Sync custom group header renderer\nwatch(\n () => props.groupHeaderRenderer,\n (renderer) => {\n safeCall((el) => {\n if (renderer) {\n el.groupHeaderRenderer = (group: any, idx: number) => {\n const container = document.createElement('div');\n const node = renderer(group, idx);\n if (node && isVNode(node)) {\n render(node, container);\n } else if (node) {\n render(h('span', String(node)), container);\n }\n return container;\n };\n }\n });\n }\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 tracking: {\n enabled: props.trackingEnabled,\n events: props.trackEvents,\n styling: props.trackStyling,\n limitations: props.trackLimitations,\n emitDiagnostics: props.emitDiagnostics,\n maxEntries: props.trackingMaxEntries,\n },\n limitations: {\n policies: props.limitationPolicies,\n autoMitigateRuntimeModeSwitch: props.autoMitigateRuntimeModeSwitch,\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 () => props.trackingEnabled,\n () => props.trackEvents,\n () => props.trackStyling,\n () => props.trackLimitations,\n () => props.emitDiagnostics,\n () => props.trackingMaxEntries,\n () => props.limitationPolicies,\n () => props.autoMitigateRuntimeModeSwitch,\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\nconst handleDiagnostic = (e: Event) => {\n const customEvent = e as CustomEvent<DiagnosticEventDetail>;\n emit('diagnostic', customEvent.detail);\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 element.addEventListener('diagnostic', handleDiagnostic 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 element.removeEventListener('diagnostic', handleDiagnostic 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 /** Runtime capability report */\n getCapabilities: () => {\n return (selectRef.value as any)?.getCapabilities?.();\n },\n /** Known limitations report */\n getKnownLimitations: () => {\n return (selectRef.value as any)?.getKnownLimitations?.() || [];\n },\n /** Tracking snapshot */\n getTrackingSnapshot: () => {\n return (selectRef.value as any)?.getTrackingSnapshot?.() || { events: [], styles: [], limitations: [] };\n },\n /** Clear tracking entries */\n clearTracking: (source?: 'event' | 'style' | 'limitation' | 'all') => {\n (selectRef.value as any)?.clearTracking?.(source);\n },\n /** Update limitation policies */\n setLimitationPolicies: (policies: LimitationPolicyMap) => {\n (selectRef.value as any)?.setLimitationPolicies?.(policies);\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","_createElementBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqKA,UAAM,QAAQ;AAuBd,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,mB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AyB,kBAAzB,4BAAyC;AAAA,MAC5C;AAAA;AAAA,MAEA,uBAAuB,CAAC,aAAkC;;AACvD,8BAAU,UAAV,mBAAyB,0BAAzB,4BAAiD;AAAA,MACpD;AAAA,IAAA,CACD;;8BA7uBCK,IAAAA,mBAIE,mBAAA;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, openBlock, createBlock, normalizeStyle, normalizeClass } from "vue";
1
+ import { defineComponent, ref, watch, isVNode, render, h, computed, onMounted, onBeforeUnmount, openBlock, createElementBlock, normalizeStyle, normalizeClass } from "vue";
2
2
  const _sfc_main = /* @__PURE__ */ defineComponent({
3
3
  __name: "Select",
4
4
  props: {
@@ -20,6 +20,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  placement: { default: "auto" },
21
21
  className: {},
22
22
  style: {},
23
+ classMap: {},
23
24
  expandable: { type: Boolean },
24
25
  clearable: { type: Boolean, default: false },
25
26
  clearSelectionOnClear: { type: Boolean, default: true },
@@ -27,9 +28,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
28
  clearAriaLabel: {},
28
29
  clearIcon: {},
29
30
  optionRenderer: {},
30
- customRenderer: {}
31
+ customRenderer: {},
32
+ trackingEnabled: { type: Boolean, default: false },
33
+ trackEvents: { type: Boolean, default: true },
34
+ trackStyling: { type: Boolean, default: true },
35
+ trackLimitations: { type: Boolean, default: true },
36
+ emitDiagnostics: { type: Boolean, default: false },
37
+ trackingMaxEntries: { default: 200 },
38
+ limitationPolicies: {},
39
+ autoMitigateRuntimeModeSwitch: { type: Boolean, default: true }
31
40
  },
32
- emits: ["update:modelValue", "change", "select", "open", "close", "search", "loadMore", "create", "clear"],
41
+ emits: ["update:modelValue", "change", "select", "open", "close", "search", "loadMore", "create", "clear", "diagnostic"],
33
42
  setup(__props, { expose: __expose, emit: __emit }) {
34
43
  const props = __props;
35
44
  const emit = __emit;
@@ -81,6 +90,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
81
90
  },
82
91
  { immediate: true }
83
92
  );
93
+ watch(
94
+ () => props.classMap,
95
+ (map) => {
96
+ safeCall((el) => {
97
+ el.classMap = map;
98
+ });
99
+ },
100
+ { immediate: true, deep: true }
101
+ );
84
102
  const waitForUpgrade = async () => {
85
103
  var _a;
86
104
  if (typeof window === "undefined") return;
@@ -100,6 +118,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
100
118
  if (resolvedOptionRenderer.value) {
101
119
  candidate.optionRenderer = resolvedOptionRenderer.value;
102
120
  }
121
+ if (props.classMap) {
122
+ candidate.classMap = props.classMap;
123
+ }
103
124
  return;
104
125
  }
105
126
  await new Promise((resolve) => requestAnimationFrame(() => resolve()));
@@ -108,12 +129,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
108
129
  if (isElementReady.value && resolvedOptionRenderer.value) {
109
130
  selectRef.value.optionRenderer = resolvedOptionRenderer.value;
110
131
  }
132
+ if (isElementReady.value && props.classMap) {
133
+ selectRef.value.classMap = props.classMap;
134
+ }
111
135
  };
112
- const safeCall = (fn) => {
136
+ function safeCall(fn) {
113
137
  const el = selectRef.value;
114
138
  if (!el || !isElementReady.value) return;
115
139
  fn(el);
116
- };
140
+ }
117
141
  const isControlled = computed(() => props.modelValue !== void 0);
118
142
  const currentValue = computed(
119
143
  () => isControlled.value ? props.modelValue : internalValue.value
@@ -228,6 +252,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
228
252
  clearSearch: props.clearSearchOnClear,
229
253
  ariaLabel: props.clearAriaLabel,
230
254
  icon: props.clearIcon
255
+ },
256
+ tracking: {
257
+ enabled: props.trackingEnabled,
258
+ events: props.trackEvents,
259
+ styling: props.trackStyling,
260
+ limitations: props.trackLimitations,
261
+ emitDiagnostics: props.emitDiagnostics,
262
+ maxEntries: props.trackingMaxEntries
263
+ },
264
+ limitations: {
265
+ policies: props.limitationPolicies,
266
+ autoMitigateRuntimeModeSwitch: props.autoMitigateRuntimeModeSwitch
231
267
  }
232
268
  };
233
269
  el.updateConfig(config);
@@ -248,7 +284,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
248
284
  () => props.clearSelectionOnClear,
249
285
  () => props.clearSearchOnClear,
250
286
  () => props.clearAriaLabel,
251
- () => props.clearIcon
287
+ () => props.clearIcon,
288
+ () => props.trackingEnabled,
289
+ () => props.trackEvents,
290
+ () => props.trackStyling,
291
+ () => props.trackLimitations,
292
+ () => props.emitDiagnostics,
293
+ () => props.trackingMaxEntries,
294
+ () => props.limitationPolicies,
295
+ () => props.autoMitigateRuntimeModeSwitch
252
296
  ],
253
297
  updateConfig
254
298
  );
@@ -293,6 +337,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
293
337
  clearedSearch: customEvent.detail.clearedSearch
294
338
  });
295
339
  };
340
+ const handleDiagnostic = (e) => {
341
+ const customEvent = e;
342
+ emit("diagnostic", customEvent.detail);
343
+ };
296
344
  onMounted(async () => {
297
345
  var _a, _b;
298
346
  await waitForUpgrade();
@@ -332,6 +380,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
332
380
  element.addEventListener("loadMore", handleLoadMore);
333
381
  element.addEventListener("create", handleCreate);
334
382
  element.addEventListener("clear", handleClear);
383
+ element.addEventListener("diagnostic", handleDiagnostic);
335
384
  });
336
385
  onBeforeUnmount(() => {
337
386
  customRendererCache.forEach((container) => render(null, container));
@@ -346,6 +395,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
346
395
  element.removeEventListener("loadMore", handleLoadMore);
347
396
  element.removeEventListener("create", handleCreate);
348
397
  element.removeEventListener("clear", handleClear);
398
+ element.removeEventListener("diagnostic", handleDiagnostic);
349
399
  });
350
400
  __expose({
351
401
  /** Open the dropdown */
@@ -383,16 +433,40 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
383
433
  const value = props.multiple ? [] : "";
384
434
  emit("update:modelValue", value);
385
435
  emit("change", value, []);
436
+ },
437
+ /** Runtime capability report */
438
+ getCapabilities: () => {
439
+ var _a, _b;
440
+ return (_b = (_a = selectRef.value) == null ? void 0 : _a.getCapabilities) == null ? void 0 : _b.call(_a);
441
+ },
442
+ /** Known limitations report */
443
+ getKnownLimitations: () => {
444
+ var _a, _b;
445
+ return ((_b = (_a = selectRef.value) == null ? void 0 : _a.getKnownLimitations) == null ? void 0 : _b.call(_a)) || [];
446
+ },
447
+ /** Tracking snapshot */
448
+ getTrackingSnapshot: () => {
449
+ var _a, _b;
450
+ return ((_b = (_a = selectRef.value) == null ? void 0 : _a.getTrackingSnapshot) == null ? void 0 : _b.call(_a)) || { events: [], styles: [], limitations: [] };
451
+ },
452
+ /** Clear tracking entries */
453
+ clearTracking: (source) => {
454
+ var _a, _b;
455
+ (_b = (_a = selectRef.value) == null ? void 0 : _a.clearTracking) == null ? void 0 : _b.call(_a, source);
456
+ },
457
+ /** Update limitation policies */
458
+ setLimitationPolicies: (policies) => {
459
+ var _a, _b;
460
+ (_b = (_a = selectRef.value) == null ? void 0 : _a.setLimitationPolicies) == null ? void 0 : _b.call(_a, policies);
386
461
  }
387
462
  });
388
463
  return (_ctx, _cache) => {
389
- const _component_enhanced_select = resolveComponent("enhanced-select");
390
- return openBlock(), createBlock(_component_enhanced_select, {
464
+ return openBlock(), createElementBlock("enhanced-select", {
391
465
  ref_key: "selectRef",
392
466
  ref: selectRef,
393
467
  class: normalizeClass(__props.className),
394
468
  style: normalizeStyle(__props.style)
395
- }, null, 8, ["class", "style"]);
469
+ }, null, 6);
396
470
  };
397
471
  }
398
472
  });
@@ -403,7 +477,7 @@ const _export_sfc = (sfc, props) => {
403
477
  }
404
478
  return target;
405
479
  };
406
- const Select = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-39dd1344"]]);
480
+ const Select = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-854fa07c"]]);
407
481
  export {
408
482
  Select,
409
483
  Select as default