@innertia-solutions/innertia-nuxt 0.1.94 → 0.1.95
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.
|
@@ -73,6 +73,19 @@ const triggerId = ref(
|
|
|
73
73
|
`dropdown-trigger-${Math.random().toString(36).substr(2, 9)}`
|
|
74
74
|
);
|
|
75
75
|
|
|
76
|
+
// Self-initialize: a dropdown mounted after Preline's global autoInit (v-if, async data, client
|
|
77
|
+
// toggles) would otherwise render but never open.
|
|
78
|
+
const wrapperEl = ref(null);
|
|
79
|
+
onMounted(() => {
|
|
80
|
+
nextTick(() => {
|
|
81
|
+
const HSDropdown = window.HSDropdown;
|
|
82
|
+
if (!wrapperEl.value || !HSDropdown) return;
|
|
83
|
+
try {
|
|
84
|
+
if (!HSDropdown.getInstance?.(wrapperEl.value, true)) HSDropdown.autoInit?.();
|
|
85
|
+
} catch (_) {}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
76
89
|
// Computed
|
|
77
90
|
const triggerSizeClasses = computed(() => {
|
|
78
91
|
const sizes = {
|
|
@@ -200,7 +213,7 @@ const handleItemClick = (item, event) => {
|
|
|
200
213
|
};
|
|
201
214
|
</script>
|
|
202
215
|
<template>
|
|
203
|
-
<div class="hs-dropdown relative inline-flex" :class="wrapperClass">
|
|
216
|
+
<div ref="wrapperEl" class="hs-dropdown relative inline-flex" :class="wrapperClass">
|
|
204
217
|
<!-- Trigger button -->
|
|
205
218
|
<button
|
|
206
219
|
:id="triggerId"
|
package/package.json
CHANGED
|
@@ -48,7 +48,9 @@ export default defineNuxtPlugin(async () => {
|
|
|
48
48
|
if (node.nodeType !== Node.ELEMENT_NODE) return false
|
|
49
49
|
const el = node as Element
|
|
50
50
|
return (
|
|
51
|
-
|
|
51
|
+
// Class-based components (e.g. App.Dropdown's `.hs-dropdown`) nested inside a newly added
|
|
52
|
+
// wrapper must be detected too, not only when the added node itself carries the class.
|
|
53
|
+
el.querySelector?.('[data-hs-overlay],[data-hs-dropdown],[data-hs-select],.hs-dropdown,.hs-overlay,.hs-select,.hs-tooltip,.hs-accordion,.hs-collapse') ||
|
|
52
54
|
el.hasAttribute?.('data-hs-overlay') ||
|
|
53
55
|
el.hasAttribute?.('data-hs-dropdown') ||
|
|
54
56
|
el.hasAttribute?.('data-hs-select') ||
|