@innertia-solutions/ui 0.1.9 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/ui",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Innertia Solutions — Nuxt UI layer: components and composables",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -1,67 +0,0 @@
1
- declare global {
2
- interface Window {
3
- HSStaticMethods?: { autoInit?: () => void }
4
- HSSelect?: new (el: HTMLElement) => { destroy?: () => void }
5
- HSThemeAppearance?: { init?: () => void }
6
- }
7
- }
8
-
9
- export default defineNuxtPlugin(() => {
10
- if (!process.client) return
11
-
12
- const initPreline = () => {
13
- try { window.HSStaticMethods?.autoInit?.() } catch (_) {}
14
- try { window.HSThemeAppearance?.init?.() } catch (_) {}
15
- }
16
-
17
- const performMultipleInits = () => {
18
- initPreline()
19
- setTimeout(initPreline, 50)
20
- setTimeout(initPreline, 200)
21
- setTimeout(initPreline, 500)
22
- }
23
-
24
- if (document.readyState === 'loading') {
25
- document.addEventListener('DOMContentLoaded', performMultipleInits)
26
- } else {
27
- nextTick(performMultipleInits)
28
- }
29
-
30
- const nuxtApp = useNuxtApp()
31
-
32
- nuxtApp.hooks.hook('page:finish', () => {
33
- requestAnimationFrame(performMultipleInits)
34
- })
35
-
36
- nuxtApp.hooks.hookOnce('app:mounted', () => {
37
- performMultipleInits()
38
- })
39
-
40
- const observer = new MutationObserver((mutations) => {
41
- const hasPreline = mutations.some(({ addedNodes }) =>
42
- Array.from(addedNodes).some((node) => {
43
- if (node.nodeType !== Node.ELEMENT_NODE) return false
44
- const el = node as Element
45
- return (
46
- el.querySelector?.('[data-hs-overlay],[data-hs-dropdown],[data-hs-select]') ||
47
- el.hasAttribute?.('data-hs-overlay') ||
48
- el.hasAttribute?.('data-hs-dropdown') ||
49
- el.hasAttribute?.('data-hs-select') ||
50
- (typeof el.className === 'string' && el.className.includes('hs-'))
51
- )
52
- })
53
- )
54
- if (hasPreline) {
55
- setTimeout(initPreline, 10)
56
- setTimeout(initPreline, 100)
57
- }
58
- })
59
-
60
- if (document.readyState === 'loading') {
61
- document.addEventListener('DOMContentLoaded', () =>
62
- observer.observe(document.body, { childList: true, subtree: true })
63
- )
64
- } else {
65
- observer.observe(document.body, { childList: true, subtree: true })
66
- }
67
- })