@iris-ui-kit/vue 0.1.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 (164) hide show
  1. package/LICENSE +21 -0
  2. package/dist/admin.cjs +1869 -0
  3. package/dist/admin.cjs.map +1 -0
  4. package/dist/admin.d.cts +376 -0
  5. package/dist/admin.d.ts +376 -0
  6. package/dist/admin.js +10 -0
  7. package/dist/admin.js.map +1 -0
  8. package/dist/async.cjs +76 -0
  9. package/dist/async.cjs.map +1 -0
  10. package/dist/async.d.cts +59 -0
  11. package/dist/async.d.ts +59 -0
  12. package/dist/async.js +3 -0
  13. package/dist/async.js.map +1 -0
  14. package/dist/behaviors.cjs +659 -0
  15. package/dist/behaviors.cjs.map +1 -0
  16. package/dist/behaviors.d.cts +441 -0
  17. package/dist/behaviors.d.ts +441 -0
  18. package/dist/behaviors.js +3 -0
  19. package/dist/behaviors.js.map +1 -0
  20. package/dist/chunk-3FJUCHCC.js +146 -0
  21. package/dist/chunk-3FJUCHCC.js.map +1 -0
  22. package/dist/chunk-3R3QDLJC.js +172 -0
  23. package/dist/chunk-3R3QDLJC.js.map +1 -0
  24. package/dist/chunk-4FLIW67H.js +137 -0
  25. package/dist/chunk-4FLIW67H.js.map +1 -0
  26. package/dist/chunk-4FQ7XF52.js +3 -0
  27. package/dist/chunk-4FQ7XF52.js.map +1 -0
  28. package/dist/chunk-72PZMU6R.js +99 -0
  29. package/dist/chunk-72PZMU6R.js.map +1 -0
  30. package/dist/chunk-75GSYEJS.js +17 -0
  31. package/dist/chunk-75GSYEJS.js.map +1 -0
  32. package/dist/chunk-7IOJADZC.js +38 -0
  33. package/dist/chunk-7IOJADZC.js.map +1 -0
  34. package/dist/chunk-CIZGSGXN.js +651 -0
  35. package/dist/chunk-CIZGSGXN.js.map +1 -0
  36. package/dist/chunk-F77KIPOH.js +103 -0
  37. package/dist/chunk-F77KIPOH.js.map +1 -0
  38. package/dist/chunk-FJBYAIL4.js +1318 -0
  39. package/dist/chunk-FJBYAIL4.js.map +1 -0
  40. package/dist/chunk-H7HVVPYR.js +66 -0
  41. package/dist/chunk-H7HVVPYR.js.map +1 -0
  42. package/dist/chunk-I6D5VXQK.js +167 -0
  43. package/dist/chunk-I6D5VXQK.js.map +1 -0
  44. package/dist/chunk-PPYNXNGZ.js +73 -0
  45. package/dist/chunk-PPYNXNGZ.js.map +1 -0
  46. package/dist/chunk-QLUIKEMJ.js +1197 -0
  47. package/dist/chunk-QLUIKEMJ.js.map +1 -0
  48. package/dist/chunk-ROJV6RON.js +3 -0
  49. package/dist/chunk-ROJV6RON.js.map +1 -0
  50. package/dist/chunk-S43IHHBU.js +82 -0
  51. package/dist/chunk-S43IHHBU.js.map +1 -0
  52. package/dist/chunk-TCAXRWT6.js +108 -0
  53. package/dist/chunk-TCAXRWT6.js.map +1 -0
  54. package/dist/chunk-TQB5LVOH.js +17 -0
  55. package/dist/chunk-TQB5LVOH.js.map +1 -0
  56. package/dist/chunk-VM2CXEUA.js +46 -0
  57. package/dist/chunk-VM2CXEUA.js.map +1 -0
  58. package/dist/chunk-W2JVHGFR.js +103 -0
  59. package/dist/chunk-W2JVHGFR.js.map +1 -0
  60. package/dist/chunk-WL67XCH5.js +59 -0
  61. package/dist/chunk-WL67XCH5.js.map +1 -0
  62. package/dist/chunk-XCNCIG2I.js +165 -0
  63. package/dist/chunk-XCNCIG2I.js.map +1 -0
  64. package/dist/chunk-XSLBANUV.js +16 -0
  65. package/dist/chunk-XSLBANUV.js.map +1 -0
  66. package/dist/chunk-ZY4NLITM.js +73 -0
  67. package/dist/chunk-ZY4NLITM.js.map +1 -0
  68. package/dist/data.cjs +59 -0
  69. package/dist/data.cjs.map +1 -0
  70. package/dist/data.d.cts +46 -0
  71. package/dist/data.d.ts +46 -0
  72. package/dist/data.js +4 -0
  73. package/dist/data.js.map +1 -0
  74. package/dist/error-boundary.cjs +115 -0
  75. package/dist/error-boundary.cjs.map +1 -0
  76. package/dist/error-boundary.d.cts +60 -0
  77. package/dist/error-boundary.d.ts +60 -0
  78. package/dist/error-boundary.js +4 -0
  79. package/dist/error-boundary.js.map +1 -0
  80. package/dist/floating.cjs +149 -0
  81. package/dist/floating.cjs.map +1 -0
  82. package/dist/floating.d.cts +106 -0
  83. package/dist/floating.d.ts +106 -0
  84. package/dist/floating.js +4 -0
  85. package/dist/floating.js.map +1 -0
  86. package/dist/form.cjs +144 -0
  87. package/dist/form.cjs.map +1 -0
  88. package/dist/form.d.cts +128 -0
  89. package/dist/form.d.ts +128 -0
  90. package/dist/form.js +3 -0
  91. package/dist/form.js.map +1 -0
  92. package/dist/i18n.cjs +112 -0
  93. package/dist/i18n.cjs.map +1 -0
  94. package/dist/i18n.d.cts +99 -0
  95. package/dist/i18n.d.ts +99 -0
  96. package/dist/i18n.js +3 -0
  97. package/dist/i18n.js.map +1 -0
  98. package/dist/index.cjs +18673 -0
  99. package/dist/index.cjs.map +1 -0
  100. package/dist/index.d.cts +8087 -0
  101. package/dist/index.d.ts +8087 -0
  102. package/dist/index.js +13525 -0
  103. package/dist/index.js.map +1 -0
  104. package/dist/layouts.cjs +392 -0
  105. package/dist/layouts.cjs.map +1 -0
  106. package/dist/layouts.d.cts +406 -0
  107. package/dist/layouts.d.ts +406 -0
  108. package/dist/layouts.js +5 -0
  109. package/dist/layouts.js.map +1 -0
  110. package/dist/machine.cjs +19 -0
  111. package/dist/machine.cjs.map +1 -0
  112. package/dist/machine.d.cts +18 -0
  113. package/dist/machine.d.ts +18 -0
  114. package/dist/machine.js +4 -0
  115. package/dist/machine.js.map +1 -0
  116. package/dist/modal-utils.cjs +170 -0
  117. package/dist/modal-utils.cjs.map +1 -0
  118. package/dist/modal-utils.d.cts +43 -0
  119. package/dist/modal-utils.d.ts +43 -0
  120. package/dist/modal-utils.js +3 -0
  121. package/dist/modal-utils.js.map +1 -0
  122. package/dist/motion.cjs +88 -0
  123. package/dist/motion.cjs.map +1 -0
  124. package/dist/motion.d.cts +43 -0
  125. package/dist/motion.d.ts +43 -0
  126. package/dist/motion.js +3 -0
  127. package/dist/motion.js.map +1 -0
  128. package/dist/provider.cjs +272 -0
  129. package/dist/provider.cjs.map +1 -0
  130. package/dist/provider.d.cts +130 -0
  131. package/dist/provider.d.ts +130 -0
  132. package/dist/provider.js +6 -0
  133. package/dist/provider.js.map +1 -0
  134. package/dist/resource.cjs +25 -0
  135. package/dist/resource.cjs.map +1 -0
  136. package/dist/resource.d.cts +17 -0
  137. package/dist/resource.d.ts +17 -0
  138. package/dist/resource.js +3 -0
  139. package/dist/resource.js.map +1 -0
  140. package/dist/skeletons.cjs +1659 -0
  141. package/dist/skeletons.cjs.map +1 -0
  142. package/dist/skeletons.d.cts +179 -0
  143. package/dist/skeletons.d.ts +179 -0
  144. package/dist/skeletons.js +7 -0
  145. package/dist/skeletons.js.map +1 -0
  146. package/dist/skins.cjs +138 -0
  147. package/dist/skins.cjs.map +1 -0
  148. package/dist/skins.d.cts +67 -0
  149. package/dist/skins.d.ts +67 -0
  150. package/dist/skins.js +3 -0
  151. package/dist/skins.js.map +1 -0
  152. package/dist/theme.cjs +106 -0
  153. package/dist/theme.cjs.map +1 -0
  154. package/dist/theme.d.cts +103 -0
  155. package/dist/theme.d.ts +103 -0
  156. package/dist/theme.js +3 -0
  157. package/dist/theme.js.map +1 -0
  158. package/dist/undo.cjs +51 -0
  159. package/dist/undo.cjs.map +1 -0
  160. package/dist/undo.d.cts +48 -0
  161. package/dist/undo.d.ts +48 -0
  162. package/dist/undo.js +3 -0
  163. package/dist/undo.js.map +1 -0
  164. package/package.json +59 -0
package/dist/data.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ import { ShallowRef, ComputedRef } from 'vue';
2
+ import { DataSourceController, DataSourceState, DataSourceConfig, createGroupedView, DataViewColumn, GroupedViewState, GroupedViewConfig } from '@iris-ui-kit/core';
3
+ export { DataSourceConfig, DataSourceController, DataSourceMode, DataSourceMutateOptions, DataSourceQuery, DataSourceState, GroupedViewConfig, GroupedViewState, GroupedViewStore, RowMutateOptions, createClientDataSource, createDataSource, createGroupedView } from '@iris-ui-kit/core';
4
+
5
+ interface UseDataSource<T> extends DataSourceController<T> {
6
+ /**
7
+ * The live data-source state as a reactive ref: rows, total, page/pageSize,
8
+ * sort/multiSort, filters/filterRules, loading/loadingMore, hasMore,
9
+ * selectedKeys, and the per-row pendingRows/rowErrors.
10
+ */
11
+ state: ShallowRef<DataSourceState<T>>;
12
+ }
13
+ /**
14
+ * Vue bridge over the framework-agnostic {@link createDataSource} — the unified
15
+ * data engine (paged/infinite + multi-sort + typed filters + selection +
16
+ * per-row + optimistic mutate). Creates the controller once in `setup()`,
17
+ * mirrors its store into a reactive ref, and returns the controller plus its
18
+ * live `state`. A thin bridge — all logic lives in `@iris-ui-kit/core`.
19
+ *
20
+ * Constructed with `immediate: false` so no fetch fires during `setup()`; the
21
+ * initial load is kicked from `onMounted` and the controller is torn down on
22
+ * scope dispose (aborting any in-flight request) so a late response never
23
+ * writes back to a torn-down instance.
24
+ */
25
+ declare function useDataSource<T>(config: DataSourceConfig<T>): UseDataSource<T>;
26
+
27
+ interface UseGroupedView<Row, K = string> {
28
+ store: ReturnType<typeof createGroupedView<Row, K>>['store'];
29
+ setRows: (rows: readonly Row[], columns?: readonly DataViewColumn<Row>[]) => void;
30
+ toggleGroup: (key: K) => void;
31
+ expandGroup: (key: K) => void;
32
+ collapseGroup: (key: K) => void;
33
+ expandAll: () => void;
34
+ collapseAll: () => void;
35
+ /** Reactive live grouped-view state. */
36
+ state: ComputedRef<GroupedViewState<Row, K>>;
37
+ setConfig: (partial: Partial<GroupedViewConfig<Row, K>>) => void;
38
+ }
39
+ /**
40
+ * Vue bridge over the framework-agnostic {@link createGroupedView}.
41
+ * Creates the controller once, subscribes its store to a reactive ref,
42
+ * and returns the controller plus a computed `state`.
43
+ */
44
+ declare function useGroupedView<Row, K = string>(config: GroupedViewConfig<Row, K>): UseGroupedView<Row, K>;
45
+
46
+ export { type UseDataSource, type UseGroupedView, useDataSource, useGroupedView };
package/dist/data.js ADDED
@@ -0,0 +1,4 @@
1
+ export { createClientDataSource, createDataSource, createGroupedView, useDataSource, useGroupedView } from './chunk-7IOJADZC.js';
2
+ import './chunk-75GSYEJS.js';
3
+ //# sourceMappingURL=data.js.map
4
+ //# sourceMappingURL=data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"data.js"}
@@ -0,0 +1,115 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var core = require('@iris-ui-kit/core');
5
+
6
+ // src/error-boundary/IrisErrorBoundary.ts
7
+
8
+ // src/i18n/context.ts
9
+ var I18nInjectionKey = /* @__PURE__ */ Symbol("IrisI18n");
10
+ var fallbackI18n = null;
11
+ function getFallback() {
12
+ if (fallbackI18n === null) fallbackI18n = core.createI18n();
13
+ return fallbackI18n;
14
+ }
15
+ function useI18n() {
16
+ const i18n = vue.inject(I18nInjectionKey, null) ?? getFallback();
17
+ const state = vue.ref(i18n.getState());
18
+ const unsubscribe = i18n.subscribe((next) => {
19
+ state.value = next;
20
+ });
21
+ vue.onBeforeUnmount(unsubscribe);
22
+ return {
23
+ locale: vue.computed(() => state.value.locale),
24
+ t: (key, params) => {
25
+ void state.value.locale;
26
+ return i18n.t(key, params);
27
+ },
28
+ formatDate: (value, options) => {
29
+ void state.value.locale;
30
+ return i18n.formatDate(value, options);
31
+ },
32
+ formatNumber: (value, options) => {
33
+ void state.value.locale;
34
+ return i18n.formatNumber(value, options);
35
+ },
36
+ formatRelativeTime: (value, unit, options) => {
37
+ void state.value.locale;
38
+ return i18n.formatRelativeTime(value, unit, options);
39
+ },
40
+ setLocale: i18n.setLocale,
41
+ setMessages: i18n.setMessages
42
+ };
43
+ }
44
+
45
+ // src/error-boundary/IrisErrorBoundary.ts
46
+ var IrisErrorBoundary = vue.defineComponent({
47
+ name: "IrisErrorBoundary",
48
+ inheritAttrs: false,
49
+ props: {
50
+ fallback: {
51
+ type: Function,
52
+ default: void 0
53
+ },
54
+ onError: {
55
+ type: Function,
56
+ default: void 0
57
+ }
58
+ },
59
+ setup(props, { attrs, slots }) {
60
+ const { t } = useI18n();
61
+ const error = vue.ref(null);
62
+ const reset = () => {
63
+ error.value = null;
64
+ };
65
+ vue.onErrorCaptured((err, _instance, info) => {
66
+ error.value = err;
67
+ props.onError?.(err, info);
68
+ return false;
69
+ });
70
+ const renderDefaultFallback = () => {
71
+ const message = error.value instanceof Error && error.value.message ? error.value.message : t("errorBoundary.message");
72
+ return vue.h(
73
+ "div",
74
+ {
75
+ ...attrs,
76
+ "data-iris-error-boundary": "",
77
+ role: "alert",
78
+ style: {
79
+ padding: "16px",
80
+ border: "1px solid var(--iris-danger)",
81
+ borderRadius: "var(--iris-radius-md, 6px)",
82
+ color: "var(--iris-danger)",
83
+ ...attrs.style ?? {}
84
+ }
85
+ },
86
+ [
87
+ vue.h("div", { "data-iris-error-boundary-message": "" }, message),
88
+ vue.h(
89
+ "button",
90
+ {
91
+ type: "button",
92
+ "data-iris-error-boundary-retry": "",
93
+ onClick: reset
94
+ },
95
+ t("errorBoundary.retry")
96
+ )
97
+ ]
98
+ );
99
+ };
100
+ return () => {
101
+ if (error.value !== null) {
102
+ const custom = slots.fallback ?? props.fallback;
103
+ if (custom) {
104
+ return custom({ error: error.value, reset });
105
+ }
106
+ return renderDefaultFallback();
107
+ }
108
+ return slots.default?.();
109
+ };
110
+ }
111
+ });
112
+
113
+ exports.IrisErrorBoundary = IrisErrorBoundary;
114
+ //# sourceMappingURL=error-boundary.cjs.map
115
+ //# sourceMappingURL=error-boundary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/i18n/context.ts","../src/i18n/useI18n.ts","../src/error-boundary/IrisErrorBoundary.ts"],"names":["createI18n","inject","ref","onBeforeUnmount","computed","defineComponent","onErrorCaptured","h"],"mappings":";;;;;;;;AAIO,IAAM,gBAAA,0BAA8C,UAAU,CAAA;ACYrE,IAAI,YAAA,GAA4B,IAAA;AAChC,SAAS,WA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,EAA4B,EAAA;AAAA,UAC5B,IAAA,EAAM,OAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,MAAA;AAAA,YACT,MAAA,EAAQ,8BAAA;AAAA,YACR,YAAA,EAAc,4BAAA;AAAA,YACd,KAAA,EAAO,oBAAA;AAAA,YACP,GAAK,KAAA,CAAM,KAAA,IAAgD;AAAC;AAC9D,SACF;AAAA,QACA;AAAA,UACEA,MAAE,KAAA,EAAO,EAAE,kCAAA,EAAoC,EAAA,IAAM,OAAO,CAAA;AAAA,UAC5DA,KAAA;AAAA,YACE,QAAA;AAAA,YACA;AAAA,cACE,IAAA,EAAM,QAAA;AAAA,cACN,gCAAA,EAAkC,EAAA;AAAA,cAClC,OAAA,EAAS;AAAA,aACX;AAAA,YACA,EAAE,qBAAqB;AAAA;AACzB;AACF,OACF;AAAA,IACF,CAAA;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,KAAA,CAAM,UAAU,IAAA,EAAM;AACxB,QAAA,MAAM,MAAA,GAAS,KAAA,CAAM,QAAA,IAAY,KAAA,CAAM,QAAA;AACvC,QAAA,IAAI,MAAA,EAAQ;AACV,UAAA,OAAO,OAAO,EAAE,KAAA,EAAO,KAAA,CAAM,KAAA,EAAO,OAAO,CAAA;AAAA,QAC7C;AACA,QAAA,OAAO,qBAAA,EAAsB;AAAA,MAC/B;AACA,MAAA,OAAO,MAAM,OAAA,IAAU;AAAA,IACzB,CAAA;AAAA,EACF;AACF,CAAC","file":"error-boundary.cjs","sourcesContent":["import { type InjectionKey } from 'vue'\nimport type { I18n } from '@iris-ui-kit/core'\n\n/** Injection key carrying the active {@link I18n} instance to `useI18n`. */\nexport const I18nInjectionKey: InjectionKey<I18n> = Symbol('IrisI18n')\n","import { computed, inject, onBeforeUnmount, ref, type ComputedRef, type Ref } from 'vue'\nimport { createI18n, type I18n, type I18nState } from '@iris-ui-kit/core'\nimport { I18nInjectionKey } from './context'\n\nexport interface UseI18nReturn {\n locale: ComputedRef<string>\n t: I18n['t']\n formatDate: I18n['formatDate']\n formatNumber: I18n['formatNumber']\n formatRelativeTime: I18n['formatRelativeTime']\n setLocale: I18n['setLocale']\n setMessages: I18n['setMessages']\n}\n\n// Shared fallback so components can call `useI18n()` without an enclosing\n// provider — they get English defaults rather than throwing.\nlet fallbackI18n: I18n | null = null\nfunction getFallback(): I18n {\n if (fallbackI18n === null) fallbackI18n = createI18n()\n return fallbackI18n\n}\n\n/**\n * Reactive access to the active locale + translation/formatting helpers.\n * Works with or without an `<IrisI18nProvider>` (falls back to English\n * defaults). `t` / formatters read the live locale at call time, and `locale`\n * is a reactive ref so templates re-render on change.\n */\nexport function useI18n(): UseI18nReturn {\n const i18n = inject(I18nInjectionKey, null) ?? getFallback()\n const state = ref(i18n.getState()) as Ref<I18nState>\n const unsubscribe = i18n.subscribe((next) => {\n state.value = next\n })\n onBeforeUnmount(unsubscribe)\n\n return {\n locale: computed(() => state.value.locale),\n t: (key, params) => {\n void state.value.locale\n return i18n.t(key, params)\n },\n formatDate: (value, options) => {\n void state.value.locale\n return i18n.formatDate(value, options)\n },\n formatNumber: (value, options) => {\n void state.value.locale\n return i18n.formatNumber(value, options)\n },\n formatRelativeTime: (value, unit, options) => {\n void state.value.locale\n return i18n.formatRelativeTime(value, unit, options)\n },\n setLocale: i18n.setLocale,\n setMessages: i18n.setMessages,\n }\n}\n","import { defineComponent, h, onErrorCaptured, ref, type PropType, type VNode } from 'vue'\nimport { useI18n } from '../i18n'\n\n/** Render-customization payload handed to the `#fallback` slot / `fallback` prop. */\nexport interface IrisErrorBoundaryFallbackProps {\n /** The error caught while rendering the guarded subtree. */\n error: unknown\n /** Clears the error and re-attempts rendering the children. */\n reset: () => void\n}\n\n/** Public prop surface of {@link IrisErrorBoundary}. */\nexport interface IrisErrorBoundaryProps {\n /**\n * Custom fallback renderer. Receives `{ error, reset }` and returns the\n * fallback UI. A `#fallback` scoped slot takes precedence when both are given.\n * When neither is supplied the themed DEFAULT fallback renders.\n */\n fallback?: (props: IrisErrorBoundaryFallbackProps) => VNode | VNode[] | string\n /** Invoked with the caught error (and Vue's error-info string) for logging. */\n onError?: (error: unknown, info?: string) => void\n}\n\n/**\n * IrisErrorBoundary: catches errors thrown while rendering its guarded subtree\n * (default slot), switches to a fallback, and exposes `reset()` to clear the\n * error and re-attempt rendering. Catching does NOT rethrow — a single broken\n * subtree no longer crashes the whole tree.\n *\n * Customize via a `#fallback` scoped slot or the `fallback` prop, each receiving\n * `{ error, reset }`. Without either, a themed, accessible (`role=\"alert\"`)\n * default fallback shows the error message + a retry button, i18n'd through\n * `useI18n()` (English defaults without a provider).\n */\nexport const IrisErrorBoundary = defineComponent({\n name: 'IrisErrorBoundary',\n inheritAttrs: false,\n props: {\n fallback: {\n type: Function as PropType<IrisErrorBoundaryProps['fallback']>,\n default: undefined,\n },\n onError: {\n type: Function as PropType<IrisErrorBoundaryProps['onError']>,\n default: undefined,\n },\n },\n setup(props, { attrs, slots }) {\n const { t } = useI18n()\n const error = ref<unknown>(null)\n\n const reset = () => {\n error.value = null\n }\n\n onErrorCaptured((err, _instance, info) => {\n error.value = err\n props.onError?.(err, info)\n // Stop further propagation so the error does not crash the parent tree.\n return false\n })\n\n const renderDefaultFallback = (): VNode => {\n const message =\n error.value instanceof Error && error.value.message\n ? error.value.message\n : t('errorBoundary.message')\n\n return h(\n 'div',\n {\n ...attrs,\n 'data-iris-error-boundary': '',\n role: 'alert',\n style: {\n padding: '16px',\n border: '1px solid var(--iris-danger)',\n borderRadius: 'var(--iris-radius-md, 6px)',\n color: 'var(--iris-danger)',\n ...((attrs.style as Record<string, string> | undefined) ?? {}),\n },\n },\n [\n h('div', { 'data-iris-error-boundary-message': '' }, message),\n h(\n 'button',\n {\n type: 'button',\n 'data-iris-error-boundary-retry': '',\n onClick: reset,\n },\n t('errorBoundary.retry'),\n ),\n ],\n )\n }\n\n return () => {\n if (error.value !== null) {\n const custom = slots.fallback ?? props.fallback\n if (custom) {\n return custom({ error: error.value, reset })\n }\n return renderDefaultFallback()\n }\n return slots.default?.()\n }\n },\n})\n"]}
@@ -0,0 +1,60 @@
1
+ import * as vue from 'vue';
2
+ import { PropType, VNode } from 'vue';
3
+
4
+ /** Render-customization payload handed to the `#fallback` slot / `fallback` prop. */
5
+ interface IrisErrorBoundaryFallbackProps {
6
+ /** The error caught while rendering the guarded subtree. */
7
+ error: unknown;
8
+ /** Clears the error and re-attempts rendering the children. */
9
+ reset: () => void;
10
+ }
11
+ /** Public prop surface of {@link IrisErrorBoundary}. */
12
+ interface IrisErrorBoundaryProps {
13
+ /**
14
+ * Custom fallback renderer. Receives `{ error, reset }` and returns the
15
+ * fallback UI. A `#fallback` scoped slot takes precedence when both are given.
16
+ * When neither is supplied the themed DEFAULT fallback renders.
17
+ */
18
+ fallback?: (props: IrisErrorBoundaryFallbackProps) => VNode | VNode[] | string;
19
+ /** Invoked with the caught error (and Vue's error-info string) for logging. */
20
+ onError?: (error: unknown, info?: string) => void;
21
+ }
22
+ /**
23
+ * IrisErrorBoundary: catches errors thrown while rendering its guarded subtree
24
+ * (default slot), switches to a fallback, and exposes `reset()` to clear the
25
+ * error and re-attempt rendering. Catching does NOT rethrow — a single broken
26
+ * subtree no longer crashes the whole tree.
27
+ *
28
+ * Customize via a `#fallback` scoped slot or the `fallback` prop, each receiving
29
+ * `{ error, reset }`. Without either, a themed, accessible (`role="alert"`)
30
+ * default fallback shows the error message + a retry button, i18n'd through
31
+ * `useI18n()` (English defaults without a provider).
32
+ */
33
+ declare const IrisErrorBoundary: vue.DefineComponent<vue.ExtractPropTypes<{
34
+ fallback: {
35
+ type: PropType<IrisErrorBoundaryProps["fallback"]>;
36
+ default: undefined;
37
+ };
38
+ onError: {
39
+ type: PropType<IrisErrorBoundaryProps["onError"]>;
40
+ default: undefined;
41
+ };
42
+ }>, () => string | VNode<vue.RendererNode, vue.RendererElement, {
43
+ [key: string]: any;
44
+ }> | VNode<vue.RendererNode, vue.RendererElement, {
45
+ [key: string]: any;
46
+ }>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
47
+ fallback: {
48
+ type: PropType<IrisErrorBoundaryProps["fallback"]>;
49
+ default: undefined;
50
+ };
51
+ onError: {
52
+ type: PropType<IrisErrorBoundaryProps["onError"]>;
53
+ default: undefined;
54
+ };
55
+ }>> & Readonly<{}>, {
56
+ onError: ((error: unknown, info?: string) => void) | undefined;
57
+ fallback: ((props: IrisErrorBoundaryFallbackProps) => VNode | VNode[] | string) | undefined;
58
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
59
+
60
+ export { IrisErrorBoundary, type IrisErrorBoundaryFallbackProps, type IrisErrorBoundaryProps };
@@ -0,0 +1,60 @@
1
+ import * as vue from 'vue';
2
+ import { PropType, VNode } from 'vue';
3
+
4
+ /** Render-customization payload handed to the `#fallback` slot / `fallback` prop. */
5
+ interface IrisErrorBoundaryFallbackProps {
6
+ /** The error caught while rendering the guarded subtree. */
7
+ error: unknown;
8
+ /** Clears the error and re-attempts rendering the children. */
9
+ reset: () => void;
10
+ }
11
+ /** Public prop surface of {@link IrisErrorBoundary}. */
12
+ interface IrisErrorBoundaryProps {
13
+ /**
14
+ * Custom fallback renderer. Receives `{ error, reset }` and returns the
15
+ * fallback UI. A `#fallback` scoped slot takes precedence when both are given.
16
+ * When neither is supplied the themed DEFAULT fallback renders.
17
+ */
18
+ fallback?: (props: IrisErrorBoundaryFallbackProps) => VNode | VNode[] | string;
19
+ /** Invoked with the caught error (and Vue's error-info string) for logging. */
20
+ onError?: (error: unknown, info?: string) => void;
21
+ }
22
+ /**
23
+ * IrisErrorBoundary: catches errors thrown while rendering its guarded subtree
24
+ * (default slot), switches to a fallback, and exposes `reset()` to clear the
25
+ * error and re-attempt rendering. Catching does NOT rethrow — a single broken
26
+ * subtree no longer crashes the whole tree.
27
+ *
28
+ * Customize via a `#fallback` scoped slot or the `fallback` prop, each receiving
29
+ * `{ error, reset }`. Without either, a themed, accessible (`role="alert"`)
30
+ * default fallback shows the error message + a retry button, i18n'd through
31
+ * `useI18n()` (English defaults without a provider).
32
+ */
33
+ declare const IrisErrorBoundary: vue.DefineComponent<vue.ExtractPropTypes<{
34
+ fallback: {
35
+ type: PropType<IrisErrorBoundaryProps["fallback"]>;
36
+ default: undefined;
37
+ };
38
+ onError: {
39
+ type: PropType<IrisErrorBoundaryProps["onError"]>;
40
+ default: undefined;
41
+ };
42
+ }>, () => string | VNode<vue.RendererNode, vue.RendererElement, {
43
+ [key: string]: any;
44
+ }> | VNode<vue.RendererNode, vue.RendererElement, {
45
+ [key: string]: any;
46
+ }>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
47
+ fallback: {
48
+ type: PropType<IrisErrorBoundaryProps["fallback"]>;
49
+ default: undefined;
50
+ };
51
+ onError: {
52
+ type: PropType<IrisErrorBoundaryProps["onError"]>;
53
+ default: undefined;
54
+ };
55
+ }>> & Readonly<{}>, {
56
+ onError: ((error: unknown, info?: string) => void) | undefined;
57
+ fallback: ((props: IrisErrorBoundaryFallbackProps) => VNode | VNode[] | string) | undefined;
58
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
59
+
60
+ export { IrisErrorBoundary, type IrisErrorBoundaryFallbackProps, type IrisErrorBoundaryProps };
@@ -0,0 +1,4 @@
1
+ export { IrisErrorBoundary } from './chunk-PPYNXNGZ.js';
2
+ import './chunk-TCAXRWT6.js';
3
+ //# sourceMappingURL=error-boundary.js.map
4
+ //# sourceMappingURL=error-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"error-boundary.js"}
@@ -0,0 +1,149 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var dom = require('@floating-ui/dom');
5
+
6
+ // src/primitives/floating/useFloating.ts
7
+ function useFloating(options) {
8
+ const x = vue.ref(0);
9
+ const y = vue.ref(0);
10
+ const strategy = vue.ref(options.strategy ?? "absolute");
11
+ const finalPlacement = vue.ref(options.placement ?? "bottom");
12
+ const arrowX = vue.ref();
13
+ const arrowY = vue.ref();
14
+ const middleware = vue.shallowRef([]);
15
+ rebuildMiddleware();
16
+ function rebuildMiddleware() {
17
+ const mw = [];
18
+ if (options.offset !== void 0) mw.push(dom.offset(options.offset));
19
+ if (options.flip !== false) mw.push(dom.flip());
20
+ if (options.shift !== false) mw.push(dom.shift({ padding: 8 }));
21
+ if (options.size) {
22
+ const padding = typeof options.size === "number" ? options.size : 8;
23
+ mw.push(
24
+ dom.size({
25
+ padding,
26
+ apply({ availableWidth, availableHeight, elements }) {
27
+ Object.assign(elements.floating.style, {
28
+ maxWidth: `${Math.max(0, Math.floor(availableWidth))}px`,
29
+ maxHeight: `${Math.max(0, Math.floor(availableHeight))}px`
30
+ });
31
+ }
32
+ })
33
+ );
34
+ }
35
+ if (options.arrow?.value) mw.push(dom.arrow({ element: options.arrow.value }));
36
+ if (options.middleware) mw.push(...options.middleware);
37
+ middleware.value = mw;
38
+ }
39
+ let cleanupAutoUpdate = null;
40
+ let epoch = 0;
41
+ async function update() {
42
+ const a = options.anchor.value;
43
+ const f = options.floating.value;
44
+ if (!a || !f) return;
45
+ rebuildMiddleware();
46
+ const token = ++epoch;
47
+ const result = await dom.computePosition(a, f, {
48
+ placement: options.placement ?? "bottom",
49
+ strategy: strategy.value,
50
+ middleware: middleware.value
51
+ });
52
+ if (token !== epoch) return;
53
+ x.value = result.x;
54
+ y.value = result.y;
55
+ finalPlacement.value = result.placement;
56
+ const arrowData = result.middlewareData.arrow;
57
+ arrowX.value = arrowData?.x;
58
+ arrowY.value = arrowData?.y;
59
+ }
60
+ vue.watch(
61
+ [options.open, options.anchor, options.floating],
62
+ ([isOpen, anchorEl, floatingEl]) => {
63
+ cleanupAutoUpdate?.();
64
+ cleanupAutoUpdate = null;
65
+ epoch++;
66
+ if (isOpen && anchorEl && floatingEl) {
67
+ cleanupAutoUpdate = dom.autoUpdate(anchorEl, floatingEl, () => {
68
+ void update();
69
+ });
70
+ }
71
+ },
72
+ { flush: "post", immediate: true }
73
+ );
74
+ vue.onScopeDispose(() => {
75
+ cleanupAutoUpdate?.();
76
+ cleanupAutoUpdate = null;
77
+ epoch++;
78
+ });
79
+ const OPPOSITE = {
80
+ top: "bottom",
81
+ bottom: "top",
82
+ left: "right",
83
+ right: "left"
84
+ };
85
+ const arrowSide = vue.computed(
86
+ () => OPPOSITE[finalPlacement.value.split("-")[0]]
87
+ );
88
+ const floatingStyles = vue.computed(() => ({
89
+ position: strategy.value,
90
+ top: "0",
91
+ left: "0",
92
+ transform: `translate3d(${Math.round(x.value)}px, ${Math.round(y.value)}px, 0)`,
93
+ width: "max-content"
94
+ }));
95
+ return { x, y, strategy, finalPlacement, floatingStyles, update, arrowX, arrowY, arrowSide };
96
+ }
97
+ function useDismiss(options) {
98
+ const escape = options.escape !== false;
99
+ const outsidePointerDown = options.outsidePointerDown !== false;
100
+ const isExcluded = (target) => {
101
+ if (!target || !(target instanceof Node)) return false;
102
+ for (const r of options.exclude) {
103
+ const el = r.value;
104
+ if (!el) continue;
105
+ if (el === target || el.contains(target)) return true;
106
+ }
107
+ return false;
108
+ };
109
+ const onPointerDown = (event) => {
110
+ if (!options.enabled.value) return;
111
+ if (isExcluded(event.target)) return;
112
+ options.onDismiss();
113
+ };
114
+ const onKeyDown = (event) => {
115
+ if (!options.enabled.value) return;
116
+ if (event.key === "Escape") {
117
+ event.stopPropagation();
118
+ options.onDismiss();
119
+ }
120
+ };
121
+ const attach = () => {
122
+ if (typeof document === "undefined") return;
123
+ if (outsidePointerDown) {
124
+ document.addEventListener("pointerdown", onPointerDown, true);
125
+ }
126
+ if (escape) {
127
+ document.addEventListener("keydown", onKeyDown);
128
+ }
129
+ };
130
+ const detach = () => {
131
+ if (typeof document === "undefined") return;
132
+ document.removeEventListener("pointerdown", onPointerDown, true);
133
+ document.removeEventListener("keydown", onKeyDown);
134
+ };
135
+ vue.watch(
136
+ options.enabled,
137
+ (enabled) => {
138
+ detach();
139
+ if (enabled) attach();
140
+ },
141
+ { immediate: true, flush: "post" }
142
+ );
143
+ vue.onScopeDispose(detach);
144
+ }
145
+
146
+ exports.useDismiss = useDismiss;
147
+ exports.useFloating = useFloating;
148
+ //# sourceMappingURL=floating.cjs.map
149
+ //# sourceMappingURL=floating.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/primitives/floating/useFloating.ts","../src/primitives/floating/useDismiss.ts"],"names":["ref","shallowRef","offsetMiddleware","flipMiddleware","shiftMiddleware","sizeMiddleware","arrowMiddleware","computePosition","watch","autoUpdate","onScopeDispose","computed"],"mappings":";;;;;;AA6FO,SAAS,YAAY,OAAA,EAAgD;AAC1E,EAAA,MAAM,CAAA,GAAIA,QAAI,CAAC,CAAA;AACf,EAAA,MAAM,CAAA,GAAIA,QAAI,CAAC,CAAA;AACf,EAAA,MAAM,QAAA,GAAWA,OAAA,CAAc,OAAA,CAAQ,QAAA,IAAY,UAAU,CAAA;AAC7D,EAAA,MAAM,cAAA,GAAiBA,OAAA,CAAe,OAAA,CAAQ,SAAA,IAAa,QAAQ,CAAA;AACnE,EAAA,MAAM,SAASA,OAAA,EAAwB;AACvC,EAAA,MAAM,SAASA,OAAA,EAAwB;AAEvC,EAAA,MAAM,UAAA,GAAaC,cAAA,CAAyB,EAAE,CAAA;AAC9C,EAAA,iBAAA,EAAkB;AAElB,EAAA,SAAS,iBAAA,GAAoB;AAC3B,IAAA,MAAM,KAAmB,EAAC;AAC1B,IAAA,IAAI,OAAA,CAAQ,WAAW,MAAA,EAAW,EAAA,CAAG,KAAKC,UAAA,CAAiB,OAAA,CAAQ,MAAM,CAAC,CAAA;AAC1E,IAAA,IAAI,QAAQ,IAAA,KAAS,KAAA,EAAO,EAAA,CAAG,IAAA,CAAKC,UAAgB,CAAA;AACpD,IAAA,IAAI,OAAA,CAAQ,KAAA,KAAU,KAAA,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ACnD,CAAA;AAEA,EAAAH,SAAAA;AAAA,IACE,OAAA,CAAQ,OAAA;AAAA,IACR,CAAC,OAAA,KAAY;AACX,MAAA,MAAA,EAAO;AACP,MAAA,IAAI,SAAS,MAAA,EAAO;AAAA,IACtB,CAAA;AAAA,IACA,EAAE,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,MAAA;AAAO,GACnC;AAEA,EAAAE,mBAAe,MAAM,CAAA;AACvB","file":"floating.cjs","sourcesContent":["import { computed, onScopeDispose, ref, shallowRef, watch, type ComputedRef, type Ref } from 'vue'\nimport {\n autoUpdate,\n computePosition,\n arrow as arrowMiddleware,\n flip as flipMiddleware,\n offset as offsetMiddleware,\n shift as shiftMiddleware,\n size as sizeMiddleware,\n type Middleware,\n type Placement,\n type Strategy,\n} from '@floating-ui/dom'\n\nexport interface UseFloatingOptions {\n /** Element the floating panel is positioned relative to. */\n anchor: Ref<HTMLElement | null | undefined>\n /** The floating element itself. */\n floating: Ref<HTMLElement | null | undefined>\n /** Whether the floating element is visible. Controls `autoUpdate` lifecycle. */\n open: Ref<boolean>\n /** Default placement. Floating UI may flip it if `flip` is true. */\n placement?: Placement\n /** CSS position strategy. */\n strategy?: Strategy\n /** Pixel offset between anchor and floating element. */\n offset?: number\n /** Flip to the opposite side when the requested side overflows. Default `true`. */\n flip?: boolean\n /** Shift along the cross-axis to stay in view. Default `true`. */\n shift?: boolean\n /**\n * Constrain the floating element to the available viewport space — sets\n * `maxWidth`/`maxHeight` (minus 8px padding) on it so a long dropdown/popover\n * never overflows the screen (pair with `overflow:auto` for scroll). Off by\n * default. Pass a number to override the viewport padding.\n */\n size?: boolean | number\n /** Extra Floating UI middleware to append. */\n middleware?: Middleware[]\n /**\n * Optional ref to an arrow element inside the floating panel. When provided,\n * `arrowX`, `arrowY`, and `arrowSide` in the return value are populated.\n */\n arrow?: Ref<HTMLElement | null | undefined>\n}\n\nexport interface UseFloatingReturn {\n /** Computed x coordinate (px). */\n x: Ref<number>\n /** Computed y coordinate (px). */\n y: Ref<number>\n /** Final strategy (echo of input). */\n strategy: Ref<Strategy>\n /** Final placement, possibly flipped from the input placement. */\n finalPlacement: Ref<Placement>\n /** Ready-to-bind inline style object for the floating element. */\n floatingStyles: ComputedRef<Record<string, string>>\n /** Trigger a manual recompute. Usually not needed — `autoUpdate` handles scrolling/resizing. */\n update: () => Promise<void>\n /** Arrow x offset (px). Present when `arrow` option is set. */\n arrowX: Ref<number | undefined>\n /** Arrow y offset (px). Present when `arrow` option is set. */\n arrowY: Ref<number | undefined>\n /**\n * Side of the floating element the arrow is on.\n * E.g. `'bottom'` placement → `'top'` (arrow at top pointing up).\n */\n arrowSide: ComputedRef<'top' | 'right' | 'bottom' | 'left' | undefined>\n}\n\n/**\n * Reactive Floating UI integration. Subscribes `autoUpdate` whenever\n * `open === true` and both refs are populated; tears it down on close,\n * unmount, or ref clearing. Returns `floatingStyles` ready to be spread onto\n * the floating element.\n *\n * Pure positioning — does NOT render anything, does NOT manage focus,\n * does NOT handle dismiss behavior. Those concerns live in the consuming\n * primitive (Popover, Tooltip, Dialog, Menu, ...).\n *\n * @example\n * const triggerEl = ref<HTMLElement | null>(null)\n * const contentEl = ref<HTMLElement | null>(null)\n * const open = ref(false)\n * const { floatingStyles } = useFloating({\n * anchor: triggerEl,\n * floating: contentEl,\n * open,\n * placement: 'bottom-start',\n * offset: 8,\n * })\n */\nexport function useFloating(options: UseFloatingOptions): UseFloatingReturn {\n const x = ref(0)\n const y = ref(0)\n const strategy = ref<Strategy>(options.strategy ?? 'absolute')\n const finalPlacement = ref<Placement>(options.placement ?? 'bottom')\n const arrowX = ref<number | undefined>()\n const arrowY = ref<number | undefined>()\n\n const middleware = shallowRef<Middleware[]>([])\n rebuildMiddleware()\n\n function rebuildMiddleware() {\n const mw: Middleware[] = []\n if (options.offset !== undefined) mw.push(offsetMiddleware(options.offset))\n if (options.flip !== false) mw.push(flipMiddleware())\n if (options.shift !== false) mw.push(shiftMiddleware({ padding: 8 }))\n if (options.size) {\n const padding = typeof options.size === 'number' ? options.size : 8\n mw.push(\n sizeMiddleware({\n padding,\n apply({ availableWidth, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n maxWidth: `${Math.max(0, Math.floor(availableWidth))}px`,\n maxHeight: `${Math.max(0, Math.floor(availableHeight))}px`,\n })\n },\n }),\n )\n }\n if (options.arrow?.value) mw.push(arrowMiddleware({ element: options.arrow.value }))\n if (options.middleware) mw.push(...options.middleware)\n middleware.value = mw\n }\n\n let cleanupAutoUpdate: (() => void) | null = null\n // Monotonic token bumped on every new positioning cycle and on teardown, so a\n // computePosition() that resolves after the panel closed/re-opened (or after a\n // newer update started) drops its result instead of applying stale coords.\n let epoch = 0\n\n async function update() {\n const a = options.anchor.value\n const f = options.floating.value\n if (!a || !f) return\n rebuildMiddleware()\n const token = ++epoch\n const result = await computePosition(a, f, {\n placement: options.placement ?? 'bottom',\n strategy: strategy.value,\n middleware: middleware.value,\n })\n if (token !== epoch) return\n x.value = result.x\n y.value = result.y\n finalPlacement.value = result.placement\n const arrowData = result.middlewareData.arrow as { x?: number; y?: number } | undefined\n arrowX.value = arrowData?.x\n arrowY.value = arrowData?.y\n }\n\n watch(\n [options.open, options.anchor, options.floating],\n ([isOpen, anchorEl, floatingEl]) => {\n cleanupAutoUpdate?.()\n cleanupAutoUpdate = null\n epoch++\n if (isOpen && anchorEl && floatingEl) {\n cleanupAutoUpdate = autoUpdate(anchorEl, floatingEl, () => {\n void update()\n })\n }\n },\n { flush: 'post', immediate: true },\n )\n\n onScopeDispose(() => {\n cleanupAutoUpdate?.()\n cleanupAutoUpdate = null\n epoch++\n })\n\n const OPPOSITE: Record<string, 'top' | 'right' | 'bottom' | 'left'> = {\n top: 'bottom',\n bottom: 'top',\n left: 'right',\n right: 'left',\n }\n const arrowSide = computed(\n () =>\n OPPOSITE[finalPlacement.value.split('-')[0]] as\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | undefined,\n )\n\n const floatingStyles = computed<Record<string, string>>(() => ({\n position: strategy.value,\n top: '0',\n left: '0',\n transform: `translate3d(${Math.round(x.value)}px, ${Math.round(y.value)}px, 0)`,\n width: 'max-content',\n }))\n\n return { x, y, strategy, finalPlacement, floatingStyles, update, arrowX, arrowY, arrowSide }\n}\n","import { onScopeDispose, watch, type Ref } from 'vue'\n\nexport interface UseDismissOptions {\n /** While true, the dismiss listeners are active. */\n enabled: Ref<boolean>\n /** Elements that, if clicked, should NOT trigger dismiss (typically trigger + content). */\n exclude: Array<Ref<HTMLElement | null | undefined>>\n /** Called when the user attempts to dismiss the surface. */\n onDismiss: () => void\n /** Close on Escape key. Default `true`. */\n escape?: boolean\n /** Close on pointerdown outside the excluded elements. Default `true`. */\n outsidePointerDown?: boolean\n}\n\n/**\n * Listen for the universal \"dismiss\" gestures: Escape key and outside\n * pointer-down. Used by Popover / Dialog / Menu / Combobox. Tooltip does\n * NOT use this — it dismisses on mouseleave/blur instead.\n *\n * Listeners are attached to `document` only while `enabled` is true, and\n * removed on disable / unmount. SSR-safe (no-op without `document`).\n */\nexport function useDismiss(options: UseDismissOptions): void {\n const escape = options.escape !== false\n const outsidePointerDown = options.outsidePointerDown !== false\n\n const isExcluded = (target: EventTarget | null): boolean => {\n if (!target || !(target instanceof Node)) return false\n for (const r of options.exclude) {\n const el = r.value\n if (!el) continue\n if (el === target || el.contains(target)) return true\n }\n return false\n }\n\n const onPointerDown = (event: PointerEvent) => {\n if (!options.enabled.value) return\n if (isExcluded(event.target)) return\n options.onDismiss()\n }\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!options.enabled.value) return\n if (event.key === 'Escape') {\n event.stopPropagation()\n options.onDismiss()\n }\n }\n\n const attach = () => {\n if (typeof document === 'undefined') return\n if (outsidePointerDown) {\n document.addEventListener('pointerdown', onPointerDown, true)\n }\n if (escape) {\n document.addEventListener('keydown', onKeyDown)\n }\n }\n\n const detach = () => {\n if (typeof document === 'undefined') return\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n\n watch(\n options.enabled,\n (enabled) => {\n detach()\n if (enabled) attach()\n },\n { immediate: true, flush: 'post' },\n )\n\n onScopeDispose(detach)\n}\n"]}
@@ -0,0 +1,106 @@
1
+ import { Ref, ComputedRef } from 'vue';
2
+ import { Placement, Strategy, Middleware } from '@floating-ui/dom';
3
+ export { Middleware, Strategy } from '@floating-ui/dom';
4
+
5
+ interface UseFloatingOptions {
6
+ /** Element the floating panel is positioned relative to. */
7
+ anchor: Ref<HTMLElement | null | undefined>;
8
+ /** The floating element itself. */
9
+ floating: Ref<HTMLElement | null | undefined>;
10
+ /** Whether the floating element is visible. Controls `autoUpdate` lifecycle. */
11
+ open: Ref<boolean>;
12
+ /** Default placement. Floating UI may flip it if `flip` is true. */
13
+ placement?: Placement;
14
+ /** CSS position strategy. */
15
+ strategy?: Strategy;
16
+ /** Pixel offset between anchor and floating element. */
17
+ offset?: number;
18
+ /** Flip to the opposite side when the requested side overflows. Default `true`. */
19
+ flip?: boolean;
20
+ /** Shift along the cross-axis to stay in view. Default `true`. */
21
+ shift?: boolean;
22
+ /**
23
+ * Constrain the floating element to the available viewport space — sets
24
+ * `maxWidth`/`maxHeight` (minus 8px padding) on it so a long dropdown/popover
25
+ * never overflows the screen (pair with `overflow:auto` for scroll). Off by
26
+ * default. Pass a number to override the viewport padding.
27
+ */
28
+ size?: boolean | number;
29
+ /** Extra Floating UI middleware to append. */
30
+ middleware?: Middleware[];
31
+ /**
32
+ * Optional ref to an arrow element inside the floating panel. When provided,
33
+ * `arrowX`, `arrowY`, and `arrowSide` in the return value are populated.
34
+ */
35
+ arrow?: Ref<HTMLElement | null | undefined>;
36
+ }
37
+ interface UseFloatingReturn {
38
+ /** Computed x coordinate (px). */
39
+ x: Ref<number>;
40
+ /** Computed y coordinate (px). */
41
+ y: Ref<number>;
42
+ /** Final strategy (echo of input). */
43
+ strategy: Ref<Strategy>;
44
+ /** Final placement, possibly flipped from the input placement. */
45
+ finalPlacement: Ref<Placement>;
46
+ /** Ready-to-bind inline style object for the floating element. */
47
+ floatingStyles: ComputedRef<Record<string, string>>;
48
+ /** Trigger a manual recompute. Usually not needed — `autoUpdate` handles scrolling/resizing. */
49
+ update: () => Promise<void>;
50
+ /** Arrow x offset (px). Present when `arrow` option is set. */
51
+ arrowX: Ref<number | undefined>;
52
+ /** Arrow y offset (px). Present when `arrow` option is set. */
53
+ arrowY: Ref<number | undefined>;
54
+ /**
55
+ * Side of the floating element the arrow is on.
56
+ * E.g. `'bottom'` placement → `'top'` (arrow at top pointing up).
57
+ */
58
+ arrowSide: ComputedRef<'top' | 'right' | 'bottom' | 'left' | undefined>;
59
+ }
60
+ /**
61
+ * Reactive Floating UI integration. Subscribes `autoUpdate` whenever
62
+ * `open === true` and both refs are populated; tears it down on close,
63
+ * unmount, or ref clearing. Returns `floatingStyles` ready to be spread onto
64
+ * the floating element.
65
+ *
66
+ * Pure positioning — does NOT render anything, does NOT manage focus,
67
+ * does NOT handle dismiss behavior. Those concerns live in the consuming
68
+ * primitive (Popover, Tooltip, Dialog, Menu, ...).
69
+ *
70
+ * @example
71
+ * const triggerEl = ref<HTMLElement | null>(null)
72
+ * const contentEl = ref<HTMLElement | null>(null)
73
+ * const open = ref(false)
74
+ * const { floatingStyles } = useFloating({
75
+ * anchor: triggerEl,
76
+ * floating: contentEl,
77
+ * open,
78
+ * placement: 'bottom-start',
79
+ * offset: 8,
80
+ * })
81
+ */
82
+ declare function useFloating(options: UseFloatingOptions): UseFloatingReturn;
83
+
84
+ interface UseDismissOptions {
85
+ /** While true, the dismiss listeners are active. */
86
+ enabled: Ref<boolean>;
87
+ /** Elements that, if clicked, should NOT trigger dismiss (typically trigger + content). */
88
+ exclude: Array<Ref<HTMLElement | null | undefined>>;
89
+ /** Called when the user attempts to dismiss the surface. */
90
+ onDismiss: () => void;
91
+ /** Close on Escape key. Default `true`. */
92
+ escape?: boolean;
93
+ /** Close on pointerdown outside the excluded elements. Default `true`. */
94
+ outsidePointerDown?: boolean;
95
+ }
96
+ /**
97
+ * Listen for the universal "dismiss" gestures: Escape key and outside
98
+ * pointer-down. Used by Popover / Dialog / Menu / Combobox. Tooltip does
99
+ * NOT use this — it dismisses on mouseleave/blur instead.
100
+ *
101
+ * Listeners are attached to `document` only while `enabled` is true, and
102
+ * removed on disable / unmount. SSR-safe (no-op without `document`).
103
+ */
104
+ declare function useDismiss(options: UseDismissOptions): void;
105
+
106
+ export { type UseDismissOptions, type UseFloatingOptions, type UseFloatingReturn, useDismiss, useFloating };