@entry-ui/qwik 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/lib/_internal/components/primitive/primitive.d.ts +2 -1
  2. package/lib/_internal/components/primitive/primitive.qwik.mjs +1 -0
  3. package/lib/_internal/hooks/index.d.ts +2 -0
  4. package/lib/_internal/hooks/use-id/index.d.ts +2 -0
  5. package/lib/_internal/hooks/use-id/use-id.d.ts +21 -0
  6. package/lib/_internal/hooks/use-id/use-id.qwik.mjs +10 -0
  7. package/lib/_internal/hooks/use-id/use-id.types.d.ts +22 -0
  8. package/lib/_internal/hooks/use-id-manager/index.d.ts +2 -0
  9. package/lib/_internal/hooks/use-id-manager/use-id-manager.d.ts +21 -0
  10. package/lib/_internal/hooks/use-id-manager/use-id-manager.qwik.mjs +25 -0
  11. package/lib/_internal/hooks/use-id-manager/use-id-manager.types.d.ts +56 -0
  12. package/lib/_internal/index.d.ts +1 -0
  13. package/lib/_internal/utilities/error/error.qwik.mjs +10 -0
  14. package/lib/_internal/utilities/warn/warn.qwik.mjs +10 -0
  15. package/lib/components/accordion/contexts/accordion-item-context/accordion-item-context.d.ts +11 -0
  16. package/lib/components/accordion/contexts/accordion-item-context/accordion-item-context.qwik.mjs +10 -0
  17. package/lib/components/accordion/contexts/accordion-item-context/accordion-item-context.types.d.ts +64 -0
  18. package/lib/components/accordion/contexts/accordion-item-context/index.d.ts +2 -0
  19. package/lib/components/accordion/contexts/accordion-item-trigger-context/accordion-item-trigger-context.d.ts +6 -0
  20. package/lib/components/accordion/contexts/accordion-item-trigger-context/accordion-item-trigger-context.qwik.mjs +5 -0
  21. package/lib/components/accordion/contexts/accordion-item-trigger-context/accordion-item-trigger-context.types.d.ts +13 -0
  22. package/lib/components/accordion/contexts/accordion-item-trigger-context/index.d.ts +2 -0
  23. package/lib/components/accordion/contexts/accordion-root-context/accordion-root-context.d.ts +11 -0
  24. package/lib/components/accordion/contexts/accordion-root-context/accordion-root-context.qwik.mjs +10 -0
  25. package/lib/components/accordion/contexts/accordion-root-context/accordion-root-context.types.d.ts +34 -0
  26. package/lib/components/accordion/contexts/accordion-root-context/index.d.ts +2 -0
  27. package/lib/components/accordion/contexts/index.d.ts +3 -0
  28. package/lib/components/accordion/hooks/index.d.ts +3 -0
  29. package/lib/components/accordion/hooks/use-accordion-item-context/index.d.ts +2 -0
  30. package/lib/components/accordion/hooks/use-accordion-item-context/use-accordion-item-context.d.ts +7 -0
  31. package/lib/components/accordion/hooks/use-accordion-item-context/use-accordion-item-context.qwik.mjs +14 -0
  32. package/lib/components/accordion/hooks/use-accordion-item-context/use-accordion-item-context.types.d.ts +28 -0
  33. package/lib/components/accordion/hooks/use-accordion-item-trigger-context/index.d.ts +2 -0
  34. package/lib/components/accordion/hooks/use-accordion-item-trigger-context/use-accordion-item-trigger-context.d.ts +7 -0
  35. package/lib/components/accordion/hooks/use-accordion-item-trigger-context/use-accordion-item-trigger-context.qwik.mjs +11 -0
  36. package/lib/components/accordion/hooks/use-accordion-item-trigger-context/use-accordion-item-trigger-context.types.d.ts +13 -0
  37. package/lib/components/accordion/hooks/use-accordion-root-context/index.d.ts +2 -0
  38. package/lib/components/accordion/hooks/use-accordion-root-context/use-accordion-root-context.d.ts +8 -0
  39. package/lib/components/accordion/hooks/use-accordion-root-context/use-accordion-root-context.qwik.mjs +13 -0
  40. package/lib/components/accordion/hooks/use-accordion-root-context/use-accordion-root-context.types.d.ts +22 -0
  41. package/lib/components/accordion/index.d.ts +2 -0
  42. package/lib/components/accordion/index.qwik.mjs +10 -0
  43. package/lib/components/accordion/parts/accordion-item/accordion-item.d.ts +7 -0
  44. package/lib/components/accordion/parts/accordion-item/accordion-item.qwik.mjs +49 -0
  45. package/lib/components/accordion/parts/accordion-item/accordion-item.types.d.ts +29 -0
  46. package/lib/components/accordion/parts/accordion-item/index.d.ts +2 -0
  47. package/lib/components/accordion/parts/accordion-item-header/accordion-item-header.d.ts +11 -0
  48. package/lib/components/accordion/parts/accordion-item-header/accordion-item-header.qwik.mjs +19 -0
  49. package/lib/components/accordion/parts/accordion-item-header/accordion-item-header.types.d.ts +15 -0
  50. package/lib/components/accordion/parts/accordion-item-header/index.d.ts +2 -0
  51. package/lib/components/accordion/parts/accordion-item-indicator/accordion-item-indicator.d.ts +8 -0
  52. package/lib/components/accordion/parts/accordion-item-indicator/accordion-item-indicator.qwik.mjs +27 -0
  53. package/lib/components/accordion/parts/accordion-item-indicator/accordion-item-indicator.types.d.ts +15 -0
  54. package/lib/components/accordion/parts/accordion-item-indicator/index.d.ts +2 -0
  55. package/lib/components/accordion/parts/accordion-item-panel/accordion-item-panel.d.ts +7 -0
  56. package/lib/components/accordion/parts/accordion-item-panel/accordion-item-panel.qwik.mjs +199 -0
  57. package/lib/components/accordion/parts/accordion-item-panel/accordion-item-panel.types.d.ts +31 -0
  58. package/lib/components/accordion/parts/accordion-item-panel/index.d.ts +2 -0
  59. package/lib/components/accordion/parts/accordion-item-trigger/accordion-item-trigger.d.ts +7 -0
  60. package/lib/components/accordion/parts/accordion-item-trigger/accordion-item-trigger.qwik.mjs +52 -0
  61. package/lib/components/accordion/parts/accordion-item-trigger/accordion-item-trigger.types.d.ts +23 -0
  62. package/lib/components/accordion/parts/accordion-item-trigger/index.d.ts +2 -0
  63. package/lib/components/accordion/parts/accordion-root/accordion-root.d.ts +7 -0
  64. package/lib/components/accordion/parts/accordion-root/accordion-root.qwik.mjs +137 -0
  65. package/lib/components/accordion/parts/accordion-root/accordion-root.types.d.ts +68 -0
  66. package/lib/components/accordion/parts/accordion-root/index.d.ts +2 -0
  67. package/lib/components/accordion/parts/index.d.ts +12 -0
  68. package/lib/components/accordion/parts/index.qwik.mjs +14 -0
  69. package/lib/components/collapsible/contexts/collapsible-root-context/collapsible-root-context.d.ts +11 -0
  70. package/lib/components/collapsible/contexts/collapsible-root-context/collapsible-root-context.qwik.mjs +10 -0
  71. package/lib/components/collapsible/contexts/collapsible-root-context/collapsible-root-context.types.d.ts +58 -0
  72. package/lib/components/collapsible/contexts/collapsible-root-context/index.d.ts +2 -0
  73. package/lib/components/collapsible/contexts/collapsible-trigger-context/collapsible-trigger-context.d.ts +6 -0
  74. package/lib/components/collapsible/contexts/collapsible-trigger-context/collapsible-trigger-context.qwik.mjs +5 -0
  75. package/lib/components/collapsible/contexts/collapsible-trigger-context/collapsible-trigger-context.types.d.ts +13 -0
  76. package/lib/components/collapsible/contexts/collapsible-trigger-context/index.d.ts +2 -0
  77. package/lib/components/collapsible/contexts/index.d.ts +2 -0
  78. package/lib/components/collapsible/hooks/index.d.ts +2 -0
  79. package/lib/components/collapsible/hooks/use-collapsible-root-context/index.d.ts +2 -0
  80. package/lib/components/collapsible/hooks/use-collapsible-root-context/use-collapsible-root-context.d.ts +7 -0
  81. package/lib/components/collapsible/hooks/use-collapsible-root-context/use-collapsible-root-context.qwik.mjs +13 -0
  82. package/lib/components/collapsible/hooks/use-collapsible-root-context/use-collapsible-root-context.types.d.ts +22 -0
  83. package/lib/components/collapsible/hooks/use-collapsible-trigger-context/index.d.ts +2 -0
  84. package/lib/components/collapsible/hooks/use-collapsible-trigger-context/use-collapsible-trigger-context.d.ts +7 -0
  85. package/lib/components/collapsible/hooks/use-collapsible-trigger-context/use-collapsible-trigger-context.qwik.mjs +11 -0
  86. package/lib/components/collapsible/hooks/use-collapsible-trigger-context/use-collapsible-trigger-context.types.d.ts +13 -0
  87. package/lib/components/collapsible/index.d.ts +2 -0
  88. package/lib/components/collapsible/index.qwik.mjs +8 -0
  89. package/lib/components/collapsible/parts/collapsible-indicator/collapsible-indicator.d.ts +8 -0
  90. package/lib/components/collapsible/parts/collapsible-indicator/collapsible-indicator.qwik.mjs +27 -0
  91. package/lib/components/collapsible/parts/collapsible-indicator/collapsible-indicator.types.d.ts +15 -0
  92. package/lib/components/collapsible/parts/collapsible-indicator/index.d.ts +2 -0
  93. package/lib/components/collapsible/parts/collapsible-panel/collapsible-panel.d.ts +7 -0
  94. package/lib/components/collapsible/parts/collapsible-panel/collapsible-panel.qwik.mjs +192 -0
  95. package/lib/components/collapsible/parts/collapsible-panel/collapsible-panel.types.d.ts +31 -0
  96. package/lib/components/collapsible/parts/collapsible-panel/index.d.ts +2 -0
  97. package/lib/components/collapsible/parts/collapsible-root/collapsible-root.d.ts +7 -0
  98. package/lib/components/collapsible/parts/collapsible-root/collapsible-root.qwik.mjs +56 -0
  99. package/lib/components/collapsible/parts/collapsible-root/collapsible-root.types.d.ts +41 -0
  100. package/lib/components/collapsible/parts/collapsible-root/index.d.ts +2 -0
  101. package/lib/components/collapsible/parts/collapsible-trigger/collapsible-trigger.d.ts +7 -0
  102. package/lib/components/collapsible/parts/collapsible-trigger/collapsible-trigger.qwik.mjs +52 -0
  103. package/lib/components/collapsible/parts/collapsible-trigger/collapsible-trigger.types.d.ts +23 -0
  104. package/lib/components/collapsible/parts/collapsible-trigger/index.d.ts +2 -0
  105. package/lib/components/collapsible/parts/index.d.ts +8 -0
  106. package/lib/components/collapsible/parts/index.qwik.mjs +10 -0
  107. package/lib/components/index.d.ts +2 -0
  108. package/lib/hooks/index.d.ts +2 -0
  109. package/lib/hooks/use-counter/index.d.ts +2 -0
  110. package/lib/hooks/use-counter/index.qwik.mjs +4 -0
  111. package/lib/hooks/use-counter/use-counter.d.ts +15 -0
  112. package/lib/hooks/use-counter/use-counter.qwik.mjs +113 -0
  113. package/lib/hooks/use-counter/use-counter.types.d.ts +73 -0
  114. package/lib/hooks/use-lifecycle/index.d.ts +2 -0
  115. package/lib/hooks/use-lifecycle/index.qwik.mjs +4 -0
  116. package/lib/hooks/use-lifecycle/use-lifecycle.d.ts +21 -0
  117. package/lib/hooks/use-lifecycle/use-lifecycle.qwik.mjs +59 -0
  118. package/lib/hooks/use-lifecycle/use-lifecycle.types.d.ts +33 -0
  119. package/lib/hooks/use-lifecycle/utilities/create-global-unmount-observer/create-global-unmount-observer.d.ts +13 -0
  120. package/lib/hooks/use-lifecycle/utilities/create-global-unmount-observer/create-global-unmount-observer.qwik.mjs +91 -0
  121. package/lib/hooks/use-lifecycle/utilities/create-global-unmount-observer/create-global-unmount-observer.types.d.ts +26 -0
  122. package/lib/hooks/use-lifecycle/utilities/create-global-unmount-observer/index.d.ts +2 -0
  123. package/lib/hooks/use-lifecycle/utilities/index.d.ts +1 -0
  124. package/lib/index.qwik.mjs +24 -6
  125. package/lib/types/index.d.ts +1 -0
  126. package/lib/types/signal-or-readonly-signal/index.d.ts +1 -0
  127. package/lib/types/signal-or-readonly-signal/signal-or-readonly-signal.types.d.ts +12 -0
  128. package/lib/utilities/merge-refs/merge-refs.d.ts +1 -1
  129. package/package.json +18 -2
@@ -0,0 +1,73 @@
1
+ import type { ReadonlySignal, QRL } from '@qwik.dev/core';
2
+ /**
3
+ * Configuration parameters for the `useCounter` hook.
4
+ */
5
+ export interface UseCounterParams {
6
+ /**
7
+ * The starting value of the counter.
8
+ * Must be a finite number. It will be automatically clamped if it
9
+ * falls outside the specified `min` and `max` range.
10
+ *
11
+ * @default 0
12
+ */
13
+ initialCount?: number;
14
+ /**
15
+ * The amount by which the counter increases or decreases during
16
+ * increment and decrement operations. Must be a finite number.
17
+ *
18
+ * @default 1
19
+ */
20
+ step?: number;
21
+ /**
22
+ * The lower numerical boundary of the counter.
23
+ * The counter value will never go below this limit.
24
+ * Must be less than or equal to `max`.
25
+ *
26
+ * @default -Number.MAX_VALUE
27
+ */
28
+ min?: number;
29
+ /**
30
+ * The upper numerical boundary of the counter.
31
+ * The counter value will never exceed this limit.
32
+ * Must be greater than or equal to `min`.
33
+ *
34
+ * @default Number.MAX_VALUE
35
+ */
36
+ max?: number;
37
+ }
38
+ /**
39
+ * Represents the object returned by the `useCounter` hook.
40
+ */
41
+ export interface UseCounterReturnValue {
42
+ /**
43
+ * A readonly signal representing the current numeric state of the counter.
44
+ * This signal is read-only, meaning its value can only be modified by calling
45
+ * specific `QRL` functions like `increment$`, `decrement$`, `set$`,
46
+ * or `reset$`, ensuring consistent and predictable state updates.
47
+ */
48
+ count: ReadonlySignal<number>;
49
+ /**
50
+ * A `QRL` function that increases the counter value by the defined `step`.
51
+ * The resulting value is automatically clamped between `min` and `max`.
52
+ * Includes validation to ensure the operation results in a finite number.
53
+ */
54
+ increment$: QRL<() => void>;
55
+ /**
56
+ * A `QRL` function that decreases the counter value by the defined `step`.
57
+ * The resulting value is automatically clamped between `min` and `max`.
58
+ * Includes validation to ensure the operation results in a finite number.
59
+ */
60
+ decrement$: QRL<() => void>;
61
+ /**
62
+ * A `QRL` function that directly sets the counter to a specific numeric value.
63
+ * This function includes built-in validation; the value will only be updated if it
64
+ * is a finite number, and it will be clamped between `min` and `max`.
65
+ */
66
+ set$: QRL<(value: number) => void>;
67
+ /**
68
+ * A `QRL` function that restores the counter to its defined `initialCount`.
69
+ * The `initialCount` value is re-clamped during this operation to ensure
70
+ * it still adheres to the current `min` and `max` constraints.
71
+ */
72
+ reset$: QRL<() => void>;
73
+ }
@@ -0,0 +1,2 @@
1
+ export type { UseLifecycleParams } from './use-lifecycle.types';
2
+ export { useLifecycle } from './use-lifecycle';
@@ -0,0 +1,4 @@
1
+ import { useLifecycle } from "./use-lifecycle.qwik.mjs";
2
+ export {
3
+ useLifecycle
4
+ };
@@ -0,0 +1,21 @@
1
+ import type { UseLifecycleParams } from './use-lifecycle.types';
2
+ /**
3
+ * A hook that manages component lifecycle events with reliable server-to-browser continuity.
4
+ *
5
+ * This hook addresses a fundamental limitation in Qwik's standard `useTask$`: the fact that
6
+ * server-defined cleanup functions are not transferred to the client. Unlike `useVisibleTask$`,
7
+ * which forces eager execution and impacts performance, `useLifecycle` leverages a
8
+ * global `MutationObserver` and the `qresume` event to ensure cleanup logic is
9
+ * consistently executed when an element is removed from the DOM.
10
+ *
11
+ * Lifecycle synchronization is handled via:
12
+ * - **Mounting**: Executes `onMount$` during the initial task run (server or client).
13
+ * - **Unmounting**: Automatically registers the element for tracking upon resumption
14
+ * or client-side mounting, ensuring `onUnmount$` runs even if the component was SSR-ed.
15
+ *
16
+ * @remarks
17
+ * This hook was inspired by and contains logic adapted from the `useMountTask$` implementation
18
+ * in the **Qwik Design System (QDS)**.
19
+ * @see {@link https://github.com/kunai-consulting/qwik-design-system/blob/v2-migration/libs/base/src/hooks/use-unmount.tsx QDS use-unmount implementation}
20
+ */
21
+ export declare const useLifecycle: (params: UseLifecycleParams) => void;
@@ -0,0 +1,59 @@
1
+ import { useTask$, useOnDocument, $ } from "@qwik.dev/core";
2
+ import { isDev, isBrowser } from "@qwik.dev/core/build";
3
+ import { error } from "../../_internal/utilities/error/error.qwik.mjs";
4
+ import { createGlobalUnmountObserver } from "./utilities/create-global-unmount-observer/create-global-unmount-observer.qwik.mjs";
5
+ const globalUnmountObserver = createGlobalUnmountObserver();
6
+ const useLifecycle = (params) => {
7
+ const { element, onMount$, onUnmount$ } = params;
8
+ useTask$(async ({ cleanup }) => {
9
+ if (onMount$) {
10
+ try {
11
+ await Promise.resolve(onMount$());
12
+ } catch (err) {
13
+ if (isDev) {
14
+ error([
15
+ `An error occurred during the 'onMount$' lifecycle execution in 'useLifecycle' hook.`,
16
+ `The mount task failed.`,
17
+ `Check your 'onMount$' logic: ${err instanceof Error ? err.message : String(err)}`
18
+ ]);
19
+ }
20
+ }
21
+ }
22
+ cleanup(async () => {
23
+ if (isBrowser && onUnmount$) {
24
+ const elementRef = element.value;
25
+ if (elementRef) {
26
+ globalUnmountObserver.remove({
27
+ element: elementRef,
28
+ qrl: onUnmount$
29
+ });
30
+ }
31
+ try {
32
+ await Promise.resolve(onUnmount$());
33
+ } catch (err) {
34
+ if (isDev) {
35
+ error([
36
+ `An error occurred during the 'onUnmount$' lifecycle execution in 'useLifecycle'.`,
37
+ `The cleanup task failed.`,
38
+ `Check your 'onUnmount$' logic: ${err instanceof Error ? err.message : String(err)}`
39
+ ]);
40
+ }
41
+ }
42
+ }
43
+ });
44
+ });
45
+ useOnDocument("qresume", $(() => {
46
+ if (onUnmount$) {
47
+ const elementRef = element.value;
48
+ if (elementRef) {
49
+ globalUnmountObserver.add({
50
+ element: elementRef,
51
+ qrl: onUnmount$
52
+ });
53
+ }
54
+ }
55
+ }));
56
+ };
57
+ export {
58
+ useLifecycle
59
+ };
@@ -0,0 +1,33 @@
1
+ import type { SignalOrReadonlySignal } from '@/types';
2
+ import type { QRL } from '@qwik.dev/core';
3
+ /**
4
+ * Configuration parameters for the `useLifecycle` hook.
5
+ */
6
+ export interface UseLifecycleParams {
7
+ /**
8
+ * A signal containing the reference to the target element.
9
+ * This reference is essential for the global unmount observer to track the
10
+ * element's presence in the DOM. It ensures that the unmount logic is
11
+ * correctly associated with the specific node, enabling reliable detection
12
+ * of its removal even across the server-to-browser boundary.
13
+ */
14
+ element: SignalOrReadonlySignal<HTMLElement | undefined | null>;
15
+ /**
16
+ * A `QRL` function executed when the component is first initialized or mounted.
17
+ * Unlike standard effects, this callback is designed to run within the `useTask$`
18
+ * scope, allowing for consistent initialization logic across both server and client
19
+ * environments.
20
+ *
21
+ * @default undefined
22
+ */
23
+ onMount$?: QRL<() => void> | QRL<() => Promise<void>>;
24
+ /**
25
+ * A `QRL` function executed when the element is removed from the DOM.
26
+ * This callback is the primary solution for the "lost cleanup" problem in Qwik.
27
+ * It is reliably triggered by a `MutationObserver` when the associated `element`
28
+ * leaves the document tree.
29
+ *
30
+ * @default undefined
31
+ */
32
+ onUnmount$?: QRL<() => void> | QRL<() => Promise<void>>;
33
+ }
@@ -0,0 +1,13 @@
1
+ import type { CreateGlobalUnmountObserverReturnValue } from './create-global-unmount-observer.types';
2
+ /**
3
+ * A utility that creates a centralized observer to manage element unmounting across the application.
4
+ *
5
+ * This factory function returns an object with methods to track HTMLElements and execute
6
+ * associated cleanup QRLs when those elements are removed from the DOM. It solves
7
+ * the "ghost element" problem in Qwik by using a single `MutationObserver` instance,
8
+ * which is lazily initialized and automatically disconnected when no elements are
9
+ * being tracked, ensuring optimal memory management and performance.
10
+ * The observer uses a `WeakMap` internally to prevent memory leaks, allowing the
11
+ * garbage collector to reclaim elements even if they are still registered in the observer.
12
+ */
13
+ export declare const createGlobalUnmountObserver: () => CreateGlobalUnmountObserverReturnValue;
@@ -0,0 +1,91 @@
1
+ import { isDev } from "@qwik.dev/core/build";
2
+ import { error } from "../../../../_internal/utilities/error/error.qwik.mjs";
3
+ const createGlobalUnmountObserver = () => {
4
+ let isInitialized = false;
5
+ let mutationObserver = void 0;
6
+ const qrlMap = /* @__PURE__ */ new WeakMap();
7
+ const elements = /* @__PURE__ */ new Set();
8
+ const processRemovedElements = () => {
9
+ const toRemove = [];
10
+ for (const element of elements) {
11
+ if (!document.contains(element)) {
12
+ toRemove.push(element);
13
+ }
14
+ }
15
+ for (const element of toRemove) {
16
+ const qrls = qrlMap.get(element);
17
+ if (qrls) {
18
+ const promises = [];
19
+ for (const qrl of qrls) {
20
+ const result = qrl();
21
+ if (result instanceof Promise) {
22
+ promises.push(result);
23
+ }
24
+ }
25
+ if (promises.length > 0) {
26
+ Promise.all(promises).catch((err) => {
27
+ if (isDev) {
28
+ error([
29
+ `An error occurred during the 'onUnmount$' lifecycle execution in 'useLifecycle' hook.`,
30
+ `Check the cleanup logic in your 'onUnmount$' QRL. `,
31
+ `One or more promises rejected during the element removal process: ${err instanceof Error ? err.message : String(err)}`
32
+ ]);
33
+ }
34
+ });
35
+ }
36
+ qrls.clear();
37
+ }
38
+ qrlMap.delete(element);
39
+ elements.delete(element);
40
+ }
41
+ };
42
+ const cleanupObserver = () => {
43
+ if (mutationObserver && elements.size === 0) {
44
+ mutationObserver.disconnect();
45
+ mutationObserver = void 0;
46
+ isInitialized = false;
47
+ }
48
+ };
49
+ const initMutationObserver = () => {
50
+ if (isInitialized || typeof MutationObserver === "undefined") return;
51
+ isInitialized = true;
52
+ mutationObserver = new MutationObserver(() => {
53
+ processRemovedElements();
54
+ cleanupObserver();
55
+ });
56
+ mutationObserver.observe(document.body, {
57
+ childList: true,
58
+ subtree: true
59
+ });
60
+ };
61
+ const add = (params) => {
62
+ const { element, qrl } = params;
63
+ if (!qrlMap.has(element)) {
64
+ qrlMap.set(element, /* @__PURE__ */ new Set());
65
+ }
66
+ const qrls = qrlMap.get(element);
67
+ qrls.add(qrl);
68
+ elements.add(element);
69
+ if (!isInitialized) {
70
+ processRemovedElements();
71
+ }
72
+ initMutationObserver();
73
+ };
74
+ const remove = (params) => {
75
+ const { element, qrl } = params;
76
+ const qrls = qrlMap.get(element);
77
+ if (!qrls) return;
78
+ qrls.delete(qrl);
79
+ if (qrls.size === 0) {
80
+ elements.delete(element);
81
+ cleanupObserver();
82
+ }
83
+ };
84
+ return {
85
+ add,
86
+ remove
87
+ };
88
+ };
89
+ export {
90
+ createGlobalUnmountObserver
91
+ };
@@ -0,0 +1,26 @@
1
+ import type { QRL } from '@qwik.dev/core';
2
+ /**
3
+ * Represents the object returned by the `createGlobalUnmountObserver` utility.
4
+ */
5
+ export interface CreateGlobalUnmountObserverReturnValue {
6
+ /**
7
+ * Registers an element and its cleanup logic to be monitored.
8
+ * If the `MutationObserver` is not yet active, it will be initialized.
9
+ * If the element is already being tracked, the new `QRL` will be added
10
+ * to the existing set of cleanup tasks for that element.
11
+ */
12
+ add: (params: {
13
+ element: HTMLElement;
14
+ qrl: QRL<() => void> | QRL<() => Promise<void>>;
15
+ }) => void;
16
+ /**
17
+ * Unregisters a specific cleanup QRL from an element.
18
+ * If no more `QRL`s are associated with the element, the element is removed
19
+ * from tracking. If no elements are left in the tracking set, the
20
+ * `MutationObserver` is disconnected to free up system resources.
21
+ */
22
+ remove: (params: {
23
+ element: HTMLElement;
24
+ qrl: QRL<() => void> | QRL<() => Promise<void>>;
25
+ }) => void;
26
+ }
@@ -0,0 +1,2 @@
1
+ export type { CreateGlobalUnmountObserverReturnValue } from './create-global-unmount-observer.types';
2
+ export { createGlobalUnmountObserver } from './create-global-unmount-observer';
@@ -0,0 +1 @@
1
+ export * from './create-global-unmount-observer';
@@ -1,22 +1,40 @@
1
- import * as index from "./components/alert/parts/index.qwik.mjs";
2
- import * as index$1 from "./components/separator/parts/index.qwik.mjs";
3
- import * as index$2 from "./components/toggle/parts/index.qwik.mjs";
1
+ import * as index from "./components/accordion/parts/index.qwik.mjs";
2
+ import { useAccordionRootContext } from "./components/accordion/hooks/use-accordion-root-context/use-accordion-root-context.qwik.mjs";
3
+ import { useAccordionItemContext } from "./components/accordion/hooks/use-accordion-item-context/use-accordion-item-context.qwik.mjs";
4
+ import { useAccordionItemTriggerContext } from "./components/accordion/hooks/use-accordion-item-trigger-context/use-accordion-item-trigger-context.qwik.mjs";
5
+ import * as index$1 from "./components/alert/parts/index.qwik.mjs";
6
+ import * as index$2 from "./components/collapsible/parts/index.qwik.mjs";
7
+ import { useCollapsibleRootContext } from "./components/collapsible/hooks/use-collapsible-root-context/use-collapsible-root-context.qwik.mjs";
8
+ import { useCollapsibleTriggerContext } from "./components/collapsible/hooks/use-collapsible-trigger-context/use-collapsible-trigger-context.qwik.mjs";
9
+ import * as index$3 from "./components/separator/parts/index.qwik.mjs";
10
+ import * as index$4 from "./components/toggle/parts/index.qwik.mjs";
4
11
  import { useToggleRootContext } from "./components/toggle/hooks/use-toggle-root-context/use-toggle-root-context.qwik.mjs";
5
12
  import { useBoolean } from "./hooks/use-boolean/use-boolean.qwik.mjs";
6
13
  import { useControllable } from "./hooks/use-controllable/use-controllable.qwik.mjs";
14
+ import { useCounter } from "./hooks/use-counter/use-counter.qwik.mjs";
7
15
  import { useCycle } from "./hooks/use-cycle/use-cycle.qwik.mjs";
16
+ import { useLifecycle } from "./hooks/use-lifecycle/use-lifecycle.qwik.mjs";
8
17
  import { makeEventPreventable } from "./utilities/make-event-preventable/make-event-preventable.qwik.mjs";
9
18
  import { mergeRefs } from "./utilities/merge-refs/merge-refs.qwik.mjs";
10
19
  import { mergeStyles } from "./utilities/merge-styles/merge-styles.qwik.mjs";
11
20
  export {
12
- index as Alert,
13
- index$1 as Separator,
14
- index$2 as Toggle,
21
+ index as Accordion,
22
+ index$1 as Alert,
23
+ index$2 as Collapsible,
24
+ index$3 as Separator,
25
+ index$4 as Toggle,
15
26
  makeEventPreventable,
16
27
  mergeRefs,
17
28
  mergeStyles,
29
+ useAccordionItemContext,
30
+ useAccordionItemTriggerContext,
31
+ useAccordionRootContext,
18
32
  useBoolean,
33
+ useCollapsibleRootContext,
34
+ useCollapsibleTriggerContext,
19
35
  useControllable,
36
+ useCounter,
20
37
  useCycle,
38
+ useLifecycle,
21
39
  useToggleRootContext
22
40
  };
@@ -1,2 +1,3 @@
1
1
  export * from './entry-ui-qwik-event';
2
2
  export * from './entry-ui-qwik-event-state';
3
+ export * from './signal-or-readonly-signal';
@@ -0,0 +1 @@
1
+ export type { SignalOrReadonlySignal } from './signal-or-readonly-signal.types';
@@ -0,0 +1,12 @@
1
+ import type { Signal, ReadonlySignal } from '@qwik.dev/core';
2
+ /**
3
+ * Represents a signal that can be either mutable or readonly.
4
+ *
5
+ * This type is useful for component props or utilities that need to read from a signal
6
+ * without concerned whether it was created as a standard `Signal` (mutable) or
7
+ * a `ReadonlySignal` (typically derived from `useComputed$`). It supports:
8
+ *
9
+ * - `Signal<T>`: A standard, mutable Qwik signal.
10
+ * - `ReadonlySignal<T>`: A readonly signal, such as those returned by `useComputed$`.
11
+ */
12
+ export type SignalOrReadonlySignal<T> = Signal<T> | ReadonlySignal<T>;
@@ -1,6 +1,6 @@
1
1
  import type { PossibleRef } from './merge-refs.types';
2
2
  /**
3
- * Combines multiple references into a single callback ref.
3
+ * Merges multiple references into a single callback ref.
4
4
  *
5
5
  * This utility function allows you to assign a single DOM element to multiple
6
6
  * reference handlers (both Qwik Signals and callback functions). It is particularly
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entry-ui/qwik",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/ZAHON/entry-ui#readme",
@@ -15,10 +15,18 @@
15
15
  "types": "./lib/index.d.ts",
16
16
  "import": "./lib/index.qwik.mjs"
17
17
  },
18
+ "./accordion": {
19
+ "types": "./lib/components/accordion/index.d.ts",
20
+ "import": "./lib/components/accordion/index.qwik.mjs"
21
+ },
18
22
  "./alert": {
19
23
  "types": "./lib/components/alert/index.d.ts",
20
24
  "import": "./lib/components/alert/index.qwik.mjs"
21
25
  },
26
+ "./collapsible": {
27
+ "types": "./lib/components/collapsible/index.d.ts",
28
+ "import": "./lib/components/collapsible/index.qwik.mjs"
29
+ },
22
30
  "./separator": {
23
31
  "types": "./lib/components/separator/index.d.ts",
24
32
  "import": "./lib/components/separator/index.qwik.mjs"
@@ -35,10 +43,18 @@
35
43
  "types": "./lib/hooks/use-controllable/index.d.ts",
36
44
  "import": "./lib/hooks/use-controllable/index.qwik.mjs"
37
45
  },
46
+ "./use-counter": {
47
+ "types": "./lib/hooks/use-counter/index.d.ts",
48
+ "import": "./lib/hooks/use-counter/index.qwik.mjs"
49
+ },
38
50
  "./use-cycle": {
39
51
  "types": "./lib/hooks/use-cycle/index.d.ts",
40
52
  "import": "./lib/hooks/use-cycle/index.qwik.mjs"
41
53
  },
54
+ "./use-lifecycle": {
55
+ "types": "./lib/hooks/use-lifecycle/index.d.ts",
56
+ "import": "./lib/hooks/use-lifecycle/index.qwik.mjs"
57
+ },
42
58
  "./make-event-preventable": {
43
59
  "types": "./lib/utilities/make-event-preventable/index.d.ts",
44
60
  "import": "./lib/utilities/make-event-preventable/index.qwik.mjs"
@@ -92,7 +108,7 @@
92
108
  "qwik": "qwik"
93
109
  },
94
110
  "dependencies": {
95
- "@entry-ui/utilities": "^0.3.0"
111
+ "@entry-ui/utilities": "^0.6.0"
96
112
  },
97
113
  "devDependencies": {
98
114
  "@entry-ui/eslint": "workspace:*",