@bridge-ui/vue 0.23.0 → 0.24.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 (37) hide show
  1. package/ai/skills/bridge-ui-overlays/SKILL.md +4 -2
  2. package/dist/Components/ColorField/composables/useColorField.js +1 -1
  3. package/dist/Components/DateField/composables/useDateField.js +1 -1
  4. package/dist/Components/DateRangeField/composables/useDateRangeField.js +1 -1
  5. package/dist/Components/DateTimeField/composables/useDateTimeField.js +1 -1
  6. package/dist/Components/DateTimeRangeField/composables/useDateTimeRangeField.js +1 -1
  7. package/dist/Components/Drawer/Drawer.vue_vue_type_script_setup_true_lang.js +7 -7
  8. package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -0
  9. package/dist/Components/Drawer/composables/useDrawer.js +96 -90
  10. package/dist/Components/Menu/composables/useMenu.d.ts +8 -8
  11. package/dist/Components/Menu/composables/useMenu.js +81 -195
  12. package/dist/Components/Modal/Modal.vue_vue_type_script_setup_true_lang.js +7 -7
  13. package/dist/Components/Modal/composables/useModal.d.ts +1 -0
  14. package/dist/Components/Modal/composables/useModal.js +120 -114
  15. package/dist/Components/Popover/Popover.js +4 -0
  16. package/dist/Components/Popover/Popover.vue.d.ts +39 -0
  17. package/dist/Components/Popover/Popover.vue_vue_type_script_setup_true_lang.js +100 -0
  18. package/dist/Components/Popover/composables/popoverParts.d.ts +52 -0
  19. package/dist/Components/Popover/composables/popoverParts.js +35 -0
  20. package/dist/Components/Popover/composables/usePopover.d.ts +68 -0
  21. package/dist/Components/Popover/composables/usePopover.js +119 -0
  22. package/dist/Components/Popover/composables/usePopoverBase.d.ts +130 -0
  23. package/dist/Components/Popover/composables/usePopoverBase.js +210 -0
  24. package/dist/Components/Popover/index.d.ts +4 -0
  25. package/dist/Components/Popover/index.js +3 -0
  26. package/dist/Components/Popover/popover.types.d.ts +207 -0
  27. package/dist/Components/Resizable/composables/useResizable.js +85 -85
  28. package/dist/Components/Snackbar/Snackbar.vue.d.ts +1 -1
  29. package/dist/Components/TimeField/composables/useTimeField.js +1 -1
  30. package/dist/Components/TimeRangeField/composables/useTimeRangeField.js +1 -1
  31. package/dist/augments.d.ts +5 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +78 -76
  34. package/docs/README.md +1 -0
  35. package/docs/components/Menu.md +4 -0
  36. package/docs/components/Popover.md +210 -0
  37. package/package.json +2 -2
@@ -0,0 +1,210 @@
1
+ import { resolveVnodeRefElement as e } from "../../../Utils/index.js";
2
+ import { computed as t, nextTick as n, onBeforeUnmount as r, ref as i, toValue as a, watch as o } from "vue";
3
+ import { createFocusable as ee, createPositionable as te, hasDocument as s } from "@bridge-ui/core/Runtime";
4
+ import { LAYER_STACK_BASE_Z_INDEX as c, acquireLayerStackOrder as ne, getLayerStackEntry as l, isInsideNestedLayer as re, pushLayerStack as ie, subscribeLayerStack as u } from "@bridge-ui/core/Layer";
5
+ // src/Components/Popover/composables/usePopoverBase.ts
6
+ function d(d) {
7
+ let { id: ae, setShow: f, claimOpen: p, isClickAwayIgnored: m } = d, h = i(!1), g = i(""), _ = i(c), v = i(null), y = i(null), b = i(null), x = !1, S = null, C = !1, w = null, T = null, E = null, D = null, O = null, k = null, A = !1, j = !1, M = null, N = t(() => a(d.show)), P = t(() => a(d.config)), F = t(() => a(d.anchorEl) ?? null), I = t(() => !P.value.persistent), L = t(() => !(!P.value.keepMounted || N.value));
8
+ function R() {
9
+ return F.value ?? y.value;
10
+ }
11
+ function z() {
12
+ R()?.focus({ preventScroll: !0 });
13
+ }
14
+ function B() {
15
+ return y.value ?? R();
16
+ }
17
+ function V(e) {
18
+ return R()?.contains(e) ? !0 : y.value?.contains(e) ?? !1;
19
+ }
20
+ function H(e) {
21
+ return b.value?.contains(e) === !0 || U(e);
22
+ }
23
+ function U(e) {
24
+ return re(e, g.value);
25
+ }
26
+ function W(e) {
27
+ return V(e) || H(e);
28
+ }
29
+ function G() {
30
+ return !I.value || !N.value || j ? !1 : (j = !0, setTimeout(() => {
31
+ j = !1;
32
+ }, 0), f(!1), !0);
33
+ }
34
+ function K(e) {
35
+ let t = e.target, n = e.relatedTarget;
36
+ P.value.closeOnFocusOut === !0 && t instanceof Node && (y.value?.contains(t) === !0 || b.value?.contains(t) === !0 || U(t)) && n instanceof Node && !W(n) && G();
37
+ }
38
+ function q() {
39
+ k?.(), k = null, s() && N.value && P.value.closeOnFocusOut === !0 && (document.addEventListener("focusout", K, !0), k = () => {
40
+ document.removeEventListener("focusout", K, !0);
41
+ });
42
+ }
43
+ function oe() {
44
+ P.value.persistent && N.value || f(!N.value);
45
+ }
46
+ function J() {
47
+ C = !1, E?.destroy(), E = null;
48
+ }
49
+ function se() {
50
+ J();
51
+ let e = R(), t = b.value;
52
+ N.value && e && t && (E = te({
53
+ floating: t,
54
+ reference: e,
55
+ offset: P.value.offset,
56
+ strategy: P.value.strategy,
57
+ placement: P.value.placement,
58
+ matchWidth: P.value.matchWidth === !0,
59
+ arrow: P.value.arrow ? () => v.value : void 0,
60
+ onReferenceHidden: () => {
61
+ C && G();
62
+ }
63
+ }), E.start(), n(() => {
64
+ C = !0;
65
+ }));
66
+ }
67
+ function ce() {
68
+ let e = b.value;
69
+ if (!N.value || P.value.disableAutoFocus || !e) return;
70
+ let t = ee(e);
71
+ t.first() ? t.focusFirst() : d.autoFocusContent && e.focus({ preventScroll: !0 });
72
+ }
73
+ function le(e, t) {
74
+ if (!e.defaultPrevented || !t || x || N.value || !d.restoreFocus) return;
75
+ let n = document.activeElement;
76
+ (!n || n === document.body || b.value?.contains(n)) && z();
77
+ }
78
+ function ue(e) {
79
+ let t = document.activeElement, n = !!(t && b.value?.contains(t));
80
+ A = !0, !G() && !j ? A = !1 : setTimeout(() => {
81
+ A = !1, le(e, n);
82
+ }, 0);
83
+ }
84
+ function Y() {
85
+ if (O?.(), !s() || !N.value) {
86
+ O = null;
87
+ return;
88
+ }
89
+ function e(e) {
90
+ let t = e.target;
91
+ I.value && P.value.closeOnClickAway !== !1 && (W(t) || t instanceof Element && m?.(t) || ue(e));
92
+ }
93
+ document.addEventListener("pointerdown", e, !0), O = () => {
94
+ document.removeEventListener("pointerdown", e, !0);
95
+ };
96
+ }
97
+ function X() {
98
+ T?.setContainer(b.value);
99
+ }
100
+ function de() {
101
+ d.onOpen?.(B()), p && (w = p({
102
+ id: ae,
103
+ requestClose: G,
104
+ contains: H,
105
+ origin: B()
106
+ })), Y();
107
+ }
108
+ function Z(e) {
109
+ if (M) {
110
+ M.open ||= e.open === !0, M.focus ||= e.focus === !0, M.position ||= e.position === !0;
111
+ return;
112
+ }
113
+ let t = {
114
+ open: e.open === !0,
115
+ focus: e.focus === !0,
116
+ position: e.position === !0
117
+ };
118
+ M = t, n(() => {
119
+ M === t && (M = null, !x && N.value && (X(), t.open && de(), t.position && se(), t.focus && ce()));
120
+ });
121
+ }
122
+ function fe() {
123
+ T?.release(), S ??= ne(), T = ie({
124
+ order: S,
125
+ onEscape: _e,
126
+ origin: () => B(),
127
+ container: b.value ?? void 0,
128
+ lockScroll: P.value.disableScrollLock !== !0
129
+ }), g.value = T.id, _.value = T.zIndex, Q();
130
+ }
131
+ function pe() {
132
+ if (A) {
133
+ A = !1;
134
+ return;
135
+ }
136
+ if (!d.restoreFocus || !s()) return;
137
+ let e = b.value, t = document.activeElement;
138
+ e && t && e.contains(t) && z();
139
+ }
140
+ function me(t) {
141
+ let n = e(t);
142
+ y.value !== n && (y.value = n, n && N.value && Z({ position: !0 }));
143
+ }
144
+ function he(t) {
145
+ let n = e(t);
146
+ b.value !== n && (b.value = n, X(), n && N.value && Z({
147
+ focus: !0,
148
+ position: !0
149
+ }));
150
+ }
151
+ function ge(t) {
152
+ v.value = e(t);
153
+ }
154
+ function _e() {
155
+ P.value.closeOnEscape !== !1 && G() && z();
156
+ }
157
+ function Q() {
158
+ let e = l(g.value);
159
+ e && (_.value = e.zIndex);
160
+ }
161
+ function $() {
162
+ M = null, S = null, w?.(), w = null, O?.(), O = null, k?.(), k = null, D?.(), D = null, T?.release(), T = null, g.value = "", _.value = c, J();
163
+ }
164
+ return o(N, (e) => {
165
+ if (j = !1, e) {
166
+ if (A = !1, h.value = !0, !s()) return;
167
+ fe(), q(), D = u(Q), Z({
168
+ open: !0,
169
+ focus: !0,
170
+ position: !0
171
+ });
172
+ } else pe(), $(), P.value.keepMounted || (h.value = !1);
173
+ }, { immediate: !0 }), o(() => P.value.disableScrollLock, (e) => {
174
+ T?.setLockScroll(e !== !0);
175
+ }), o([
176
+ F,
177
+ () => P.value.arrow,
178
+ () => P.value.offset,
179
+ () => P.value.strategy,
180
+ () => P.value.placement,
181
+ () => P.value.matchWidth
182
+ ], () => {
183
+ N.value && Z({ position: !0 });
184
+ }), o(() => P.value.keepMounted, (e) => {
185
+ !e && !N.value && (h.value = !1);
186
+ }), o(() => P.value.closeOnFocusOut, () => {
187
+ N.value && q();
188
+ }), o(() => P.value.disableAutoFocus, () => {
189
+ N.value && Z({ focus: !0 });
190
+ }), r(() => {
191
+ x = !0, $();
192
+ }), {
193
+ toggle: oe,
194
+ mounted: h,
195
+ arrowRef: v,
196
+ triggerRef: y,
197
+ contentRef: b,
198
+ stackZIndex: _,
199
+ setArrowRef: ge,
200
+ requestClose: G,
201
+ setTriggerRef: me,
202
+ setContentRef: he,
203
+ focusReference: z,
204
+ isInsideOverlay: W,
205
+ isInsideReference: V,
206
+ isInsideNestedLayer: U,
207
+ isHiddenWhileMounted: L
208
+ };
209
+ }
210
+ export { d as usePopoverBase };
@@ -0,0 +1,4 @@
1
+ export { usePopover } from './composables/usePopover';
2
+ export type { PopoverOptions } from './composables/usePopover';
3
+ export type { PopoverClasses, PopoverCustomProps, PopoverEmits, PopoverOwnProps, PopoverProps, PopoverRoundedOverrides, PopoverShadowOverrides, PopoverSlots, } from './popover.types';
4
+ export { default as Popover } from './Popover.vue';
@@ -0,0 +1,3 @@
1
+ import { usePopover as e } from "./composables/usePopover.js";
2
+ import t from "./Popover.js";
3
+ export { t as Popover, e as usePopover };
@@ -0,0 +1,207 @@
1
+ import { HTMLAttributes, Slot } from 'vue';
2
+ import { PositionPlacement, PositionStrategy } from '@bridge-ui/core/Runtime';
3
+ import { PopoverRounded, PopoverShadow } from '@bridge-ui/core/Tokens';
4
+ import { MergeHtmlProps, MergeProps } from '@bridge-ui/core/Utils';
5
+ export interface PopoverShadowOverrides {}
6
+ export interface PopoverRoundedOverrides {}
7
+ export interface PopoverClasses {
8
+ /**
9
+ * The classes to apply to the arrow.
10
+ */
11
+ arrow?: string;
12
+ /**
13
+ * The classes to apply to the floating content.
14
+ */
15
+ content?: string;
16
+ /**
17
+ * The classes to apply to the root.
18
+ */
19
+ root?: string;
20
+ /**
21
+ * The classes to apply to the title.
22
+ */
23
+ title?: string;
24
+ /**
25
+ * The classes to apply to the trigger.
26
+ */
27
+ trigger?: string;
28
+ }
29
+ export interface PopoverCustomProps {
30
+ /**
31
+ * Props forwarded to the arrow element.
32
+ */
33
+ arrow?: HTMLAttributes;
34
+ /**
35
+ * Props forwarded to the floating content (`role="dialog"`).
36
+ */
37
+ content?: HTMLAttributes;
38
+ /**
39
+ * Props forwarded to the root wrapper (contains the trigger).
40
+ */
41
+ root?: HTMLAttributes;
42
+ /**
43
+ * Props forwarded to the title element.
44
+ */
45
+ title?: HTMLAttributes;
46
+ /**
47
+ * Props forwarded to the trigger wrapper.
48
+ */
49
+ trigger?: HTMLAttributes;
50
+ }
51
+ export interface PopoverEmits {
52
+ /**
53
+ * Emitted when the user dismisses the popover (Escape, click-away or focus leaving).
54
+ * Not emitted when the parent sets `v-model` to `false` directly.
55
+ */
56
+ close: [];
57
+ }
58
+ /**
59
+ * Anchored, non-modal floating panel for free-form content (forms, filters, cards).
60
+ * Visibility is controlled with `v-model` (not listed here — `defineModel` handles it).
61
+ * Anchor with `anchorEl` or put the opener in the `trigger` slot.
62
+ */
63
+ export interface PopoverOwnProps {
64
+ /**
65
+ * Element that anchors the popover. When set, it is used
66
+ * for positioning and click-away instead of the `trigger` slot wrapper.
67
+ * Not merged into Bridge defaults (DOM nodes must not be deep-merged).
68
+ *
69
+ * @default undefined
70
+ */
71
+ anchorEl?: null | HTMLElement;
72
+ /**
73
+ * Whether to show an arrow pointing at the anchor.
74
+ *
75
+ * @default false
76
+ */
77
+ arrow?: boolean;
78
+ /**
79
+ * The classes to apply to the popover.
80
+ *
81
+ * @default undefined
82
+ */
83
+ classes?: PopoverClasses;
84
+ /**
85
+ * Whether the popover closes when clicking outside the trigger and content.
86
+ *
87
+ * @default true
88
+ */
89
+ closeOnClickAway?: boolean;
90
+ /**
91
+ * Whether the popover closes on escape key press.
92
+ *
93
+ * @default true
94
+ */
95
+ closeOnEscape?: boolean;
96
+ /**
97
+ * Whether the popover closes when focus moves outside the trigger and
98
+ * content (Tab past the last field, for example).
99
+ *
100
+ * @default true
101
+ */
102
+ closeOnFocusOut?: boolean;
103
+ /**
104
+ * Props forwarded to each popover part.
105
+ *
106
+ * @default undefined
107
+ */
108
+ customProps?: PopoverCustomProps;
109
+ /**
110
+ * When true, the popover does not move focus into the content on open.
111
+ *
112
+ * @default false
113
+ */
114
+ disableAutoFocus?: boolean;
115
+ /**
116
+ * When true, body scroll is not locked while the popover is open.
117
+ *
118
+ * @default true
119
+ */
120
+ disableScrollLock?: boolean;
121
+ /**
122
+ * When true, the popover stays mounted in the DOM after closing (hidden).
123
+ *
124
+ * @default false
125
+ */
126
+ keepMounted?: boolean;
127
+ /**
128
+ * When true, the content width matches the trigger / anchor.
129
+ *
130
+ * @default false
131
+ */
132
+ matchWidth?: boolean;
133
+ /**
134
+ * Gap between the anchor and the content (px).
135
+ *
136
+ * @default 8
137
+ */
138
+ offset?: number;
139
+ /**
140
+ * Called when `show` should change (controlled state without `v-model`).
141
+ *
142
+ * @default undefined
143
+ */
144
+ onShowChange?: (show: boolean) => void;
145
+ /**
146
+ * When true, escape, click-away and focus leaving do not close the popover.
147
+ *
148
+ * @default false
149
+ */
150
+ persistent?: boolean;
151
+ /**
152
+ * Preferred placement of the content relative to the anchor.
153
+ *
154
+ * @default "bottom-start"
155
+ */
156
+ placement?: PositionPlacement;
157
+ /**
158
+ * The roundedness of the content.
159
+ *
160
+ * @default "md"
161
+ */
162
+ rounded?: MergeProps<PopoverRounded, PopoverRoundedOverrides>;
163
+ /**
164
+ * The shadow to apply to the content.
165
+ *
166
+ * @default "md"
167
+ */
168
+ shadow?: MergeProps<PopoverShadow, PopoverShadowOverrides>;
169
+ /**
170
+ * CSS position strategy for the content.
171
+ *
172
+ * @default "fixed"
173
+ */
174
+ strategy?: PositionStrategy;
175
+ /**
176
+ * Where to portal the content. Pass `false` to render in place
177
+ * (keeps the natural Tab order after the trigger).
178
+ *
179
+ * @default "body"
180
+ */
181
+ teleportTo?: false | string;
182
+ /**
183
+ * Heading rendered at the top of the content. Labels the dialog
184
+ * (`aria-labelledby`); without it, pass `aria-label` via `customProps.content`.
185
+ * The `title` slot takes precedence.
186
+ *
187
+ * @default undefined
188
+ */
189
+ title?: string;
190
+ }
191
+ export interface PopoverSlots {
192
+ /**
193
+ * The popover content. Receives `close` to dismiss from inside.
194
+ */
195
+ default?: Slot<{
196
+ close: () => void;
197
+ }>;
198
+ /**
199
+ * Custom heading content (labels the dialog).
200
+ */
201
+ title?: Slot<undefined>;
202
+ /**
203
+ * The trigger element that opens the popover.
204
+ */
205
+ trigger?: Slot<undefined>;
206
+ }
207
+ export type PopoverProps = MergeHtmlProps<PopoverOwnProps, HTMLAttributes>;
@@ -4,38 +4,38 @@ import { computed as i, onScopeDispose as a, provide as o, ref as s, useAttrs as
4
4
  import { get as d, isEqual as f } from "es-toolkit/compat";
5
5
  import { getResizableCursor as p, getResizableHandleAria as m, getResizableItemIndexes as h, getResizableLayoutFromKey as g, getResizablePointerDelta as _, isResizablePanelCollapsed as v, resizeResizableLayout as y, resizeResizablePanel as b, resolveResizableLayout as x, resolveResizablePanelConstraints as S, sortResizableItemsByDocumentOrder as ee } from "@bridge-ui/core/Domain";
6
6
  import { resizableOrientationProps as te } from "@bridge-ui/core/Tokens";
7
- import { cn as ne, mergeBridgeUILayeredClasses as C, splitComponentProps as w } from "@bridge-ui/core/Utils";
7
+ import { cn as ne, mergeBridgeUILayeredClasses as C, splitComponentProps as re } from "@bridge-ui/core/Utils";
8
8
  // src/Components/Resizable/composables/useResizable.ts
9
- var T = [
9
+ var ie = [
10
10
  "classes",
11
11
  "disabled",
12
12
  "orientation",
13
13
  "keyboardStep"
14
14
  ];
15
- function E(e) {
15
+ function w(e) {
16
16
  return e ? getComputedStyle(e).direction === "rtl" : !1;
17
17
  }
18
- function D(D, re, ie) {
19
- let O = c(), k = `bridge-resizable${l()}`, A = s(null), j = s([]), M = s({}), N = s(null), P = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), I = {}, L = null, R = i(() => w({
18
+ function T(T, E, D) {
19
+ let O = l(), k = c(), A = `bridge-resizable${O}`, j = s([]), M = s(null), N = s({}), P = s(null), F = {}, I = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Map(), R = null, z = i(() => re({
20
20
  props: {
21
- ...O,
22
- ...D
21
+ ...k,
22
+ ...T
23
23
  },
24
- bridgeKeys: T
25
- })), { merged: z, entry: B } = t({
26
- libDefaults: re,
24
+ bridgeKeys: ie
25
+ })), { merged: B, entry: V } = t({
26
+ libDefaults: E,
27
27
  componentName: "Resizable",
28
- props: () => R.value.componentProps
29
- }), V = n({
30
- entry: B,
31
- props: () => R.value.componentProps
32
- }), H = i(() => C(te, B.value?.tokens?.orientation)), U = i(() => z.value.orientation === "vertical" ? "vertical" : "horizontal"), W = i(() => d(H.value, U.value)), G = i(() => h(j.value)), K = i(() => G.value.panelIds);
33
- function q() {
34
- let e = [...Array.from(P, ([e, t]) => ({
28
+ props: () => z.value.componentProps
29
+ }), H = n({
30
+ entry: V,
31
+ props: () => z.value.componentProps
32
+ }), U = i(() => C(te, V.value?.tokens?.orientation)), W = i(() => B.value.orientation === "vertical" ? "vertical" : "horizontal"), G = i(() => d(U.value, W.value)), K = i(() => h(j.value)), q = i(() => K.value.panelIds);
33
+ function J() {
34
+ let e = [...Array.from(I, ([e, t]) => ({
35
35
  id: e,
36
36
  kind: "panel",
37
37
  element: t().element
38
- })), ...Array.from(F, ([e, t]) => ({
38
+ })), ...Array.from(L, ([e, t]) => ({
39
39
  id: e,
40
40
  kind: "handle",
41
41
  element: t().element
@@ -45,49 +45,49 @@ function D(D, re, ie) {
45
45
  }));
46
46
  f(j.value, t) || (j.value = t);
47
47
  }
48
- function J(e, t) {
49
- return P.set(e, t), q(), () => {
50
- P.delete(e), q();
48
+ function ae(e, t) {
49
+ return I.set(e, t), J(), () => {
50
+ I.delete(e), J();
51
51
  };
52
52
  }
53
- function ae(e, t) {
54
- return F.set(e, t), q(), () => {
55
- F.delete(e), q();
53
+ function oe(e, t) {
54
+ return L.set(e, t), J(), () => {
55
+ L.delete(e), J();
56
56
  };
57
57
  }
58
58
  function Y(e) {
59
- return e.map((e) => P.get(e)?.().constraints ?? {});
59
+ return e.map((e) => I.get(e)?.().constraints ?? {});
60
60
  }
61
61
  function X(e) {
62
- return e.map((e) => M.value[e] ?? 0);
62
+ return e.map((e) => N.value[e] ?? 0);
63
63
  }
64
- u(K, (e) => {
64
+ u(q, (e) => {
65
65
  let t = e.map((e) => {
66
- let t = P.get(e)?.(), n = t?.constraints ?? {};
66
+ let t = I.get(e)?.(), n = t?.constraints ?? {};
67
67
  return t?.collapsed && n.collapsible ? {
68
68
  ...n,
69
69
  defaultSize: n.collapsedSize ?? 0
70
70
  } : n;
71
- }), n = x(t, e.map((e) => M.value[e])), r = Object.fromEntries(e.map((e, t) => [e, n[t] ?? 0]));
72
- f(M.value, r) || (M.value = r);
71
+ }), n = x(t, e.map((e) => N.value[e])), r = Object.fromEntries(e.map((e, t) => [e, n[t] ?? 0]));
72
+ f(N.value, r) || (N.value = r);
73
73
  });
74
74
  function Z(e, t) {
75
- let n = K.value, r = M.value, i = Y(n), a = !1;
75
+ let n = q.value, r = N.value, i = Y(n), a = !1;
76
76
  n.forEach((n, o) => {
77
77
  let s = r[n], c = e[o] ?? 0, l = t?.[o] ?? s;
78
- (s === void 0 || Math.abs(s - c) > 1e-6) && (a = !0), l !== void 0 && !v(i[o], l) && v(i[o], c) && (I[n] = l);
79
- }), a && (M.value = Object.fromEntries(n.map((t, n) => [t, e[n] ?? 0])), ie?.("layoutChange", e));
78
+ (s === void 0 || Math.abs(s - c) > 1e-6) && (a = !0), l !== void 0 && !v(i[o], l) && v(i[o], c) && (F[n] = l);
79
+ }), a && (N.value = Object.fromEntries(n.map((t, n) => [t, e[n] ?? 0])), D?.("layoutChange", e));
80
80
  }
81
81
  function Q(e) {
82
- let t = G.value.handleIndexes[e];
83
- return t === void 0 || t < 0 || t >= K.value.length - 1 ? null : t;
82
+ let t = K.value.handleIndexes[e];
83
+ return t === void 0 || t < 0 || t >= q.value.length - 1 ? null : t;
84
84
  }
85
- function oe(e, t) {
86
- let n = A.value, r = Q(e);
85
+ function $(e, t) {
86
+ let n = M.value, r = Q(e);
87
87
  if (!n || r === null) return;
88
- L?.();
89
- let i = K.value, a = U.value, o = a === "vertical", s = n.getBoundingClientRect(), c = E(n), l = X(i), u = Y(i), d = o ? t.clientY : t.clientX, f = o ? s.height : s.width, m = document.body, h = m.style.cursor, g = m.style.userSelect;
90
- m.style.userSelect = "none", m.style.cursor = p(a), N.value = e;
88
+ R?.();
89
+ let i = q.value, a = W.value, o = a === "vertical", s = n.getBoundingClientRect(), c = w(n), l = X(i), u = Y(i), d = o ? t.clientY : t.clientX, f = o ? s.height : s.width, m = document.body, h = m.style.cursor, g = m.style.userSelect;
90
+ m.style.userSelect = "none", m.style.cursor = p(a), P.value = e;
91
91
  let v = (e) => {
92
92
  let t = _({
93
93
  rtl: c,
@@ -103,30 +103,30 @@ function D(D, re, ie) {
103
103
  panels: u
104
104
  }), l);
105
105
  }, b = () => {
106
- window.removeEventListener("pointermove", v), window.removeEventListener("pointerup", b), window.removeEventListener("pointercancel", b), m.style.cursor = h, m.style.userSelect = g, L = null, N.value = null;
106
+ window.removeEventListener("pointermove", v), window.removeEventListener("pointerup", b), window.removeEventListener("pointercancel", b), m.style.cursor = h, m.style.userSelect = g, R = null, P.value = null;
107
107
  };
108
- window.addEventListener("pointermove", v), window.addEventListener("pointerup", b), window.addEventListener("pointercancel", b), L = b;
108
+ window.addEventListener("pointermove", v), window.addEventListener("pointerup", b), window.addEventListener("pointercancel", b), R = b;
109
109
  }
110
110
  a(() => {
111
- L?.();
111
+ R?.();
112
112
  });
113
- function $(e, t) {
113
+ function se(e, t) {
114
114
  let n = Q(e);
115
115
  if (n === null) return !1;
116
- let r = K.value, i = r[n] ?? "", a = g({
116
+ let r = q.value, i = r[n] ?? "", a = g({
117
117
  key: t,
118
118
  handleIndex: n,
119
119
  layout: X(r),
120
- rtl: E(A.value),
120
+ rtl: w(M.value),
121
121
  panels: Y(r),
122
- orientation: U.value,
123
- expandedSize: I[i],
124
- step: z.value.keyboardStep
122
+ orientation: W.value,
123
+ expandedSize: F[i],
124
+ step: B.value.keyboardStep
125
125
  });
126
126
  return a ? (Z(a), !0) : !1;
127
127
  }
128
- function se(e) {
129
- let t = K.value, n = t.indexOf(e), r = Y(t), i = r[n];
128
+ function ce(e) {
129
+ let t = q.value, n = t.indexOf(e), r = Y(t), i = r[n];
130
130
  if (n < 0 || !i?.collapsible) return;
131
131
  let a = X(t);
132
132
  v(i, a[n]) || Z(b({
@@ -136,10 +136,10 @@ function D(D, re, ie) {
136
136
  size: S(i).collapsedSize
137
137
  }));
138
138
  }
139
- function ce(e) {
140
- let t = K.value, n = t.indexOf(e), r = Y(t), i = r[n], a = X(t);
139
+ function le(e) {
140
+ let t = q.value, n = t.indexOf(e), r = Y(t), i = r[n], a = X(t);
141
141
  if (n < 0 || !v(i, a[n])) return;
142
- let { minSize: o } = S(i), s = I[e] ?? i?.defaultSize ?? 100 / Math.max(t.length, 1);
142
+ let { minSize: o } = S(i), s = F[e] ?? i?.defaultSize ?? 100 / Math.max(t.length, 1);
143
143
  Z(b({
144
144
  index: n,
145
145
  layout: a,
@@ -147,48 +147,48 @@ function D(D, re, ie) {
147
147
  size: Math.max(o, s)
148
148
  }));
149
149
  }
150
- function le(e) {
150
+ function ue(e) {
151
151
  let t = Q(e);
152
152
  if (t === null) return null;
153
- let n = K.value, r = n[t] ?? "";
153
+ let n = q.value, r = n[t] ?? "";
154
154
  return {
155
155
  index: t,
156
- controls: P.get(r)?.().elementId,
156
+ controls: I.get(r)?.().elementId,
157
157
  aria: m(X(n), Y(n), t)
158
158
  };
159
159
  }
160
- let ue = i(() => ({
161
- startDrag: oe,
162
- expandPanel: ce,
163
- id: k,
164
- collapsePanel: se,
165
- registerPanel: J,
166
- resizeFromKey: $,
167
- getHandleState: le,
168
- registerHandle: ae,
169
- layout: M.value,
170
- orientation: U.value,
171
- orientationItem: W.value,
172
- draggingHandleId: N.value,
173
- disabled: z.value.disabled === !0
160
+ let de = i(() => ({
161
+ startDrag: $,
162
+ expandPanel: le,
163
+ id: A,
164
+ collapsePanel: ce,
165
+ registerPanel: ae,
166
+ resizeFromKey: se,
167
+ getHandleState: ue,
168
+ registerHandle: oe,
169
+ layout: N.value,
170
+ orientation: W.value,
171
+ orientationItem: G.value,
172
+ draggingHandleId: P.value,
173
+ disabled: B.value.disabled === !0
174
174
  }));
175
- o(r, ue);
176
- let de = i(() => e({}, R.value.inheritedAttrs, {
177
- id: k,
178
- "data-orientation": U.value,
179
- "data-dragging": N.value ? "" : void 0,
175
+ o(r, de);
176
+ let fe = i(() => e({}, z.value.inheritedAttrs, {
177
+ id: A,
178
+ "data-orientation": W.value,
179
+ "data-dragging": P.value ? "" : void 0,
180
180
  class: ne({
181
- [d(W.value, "root") ?? ""]: !0,
182
- [d(V.value, "root") ?? ""]: !0
181
+ [d(G.value, "root") ?? ""]: !0,
182
+ [d(H.value, "root") ?? ""]: !0
183
183
  })
184
184
  }));
185
185
  return {
186
- layout: M,
187
- rootRef: A,
188
- dragging: i(() => N.value !== null),
189
- panelIds: K,
190
- rootBind: de,
191
- orientation: U
186
+ layout: N,
187
+ rootRef: M,
188
+ dragging: i(() => P.value !== null),
189
+ panelIds: q,
190
+ rootBind: fe,
191
+ orientation: W
192
192
  };
193
193
  }
194
- export { D as useResizable };
194
+ export { T as useResizable };