@editora/ui-core 0.1.12 → 0.1.14

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 (141) hide show
  1. package/README.md +95 -5
  2. package/dist/alert-dialog.cjs.js +18 -18
  3. package/dist/alert-dialog.esm.js +130 -117
  4. package/dist/app-header.cjs.js +22 -2
  5. package/dist/app-header.esm.js +22 -2
  6. package/dist/badge.cjs.js +5 -5
  7. package/dist/badge.esm.js +9 -8
  8. package/dist/color-picker.cjs.js +4 -4
  9. package/dist/color-picker.esm.js +40 -31
  10. package/dist/combobox.cjs.js +21 -21
  11. package/dist/combobox.esm.js +79 -40
  12. package/dist/command-palette.cjs.js +1 -1
  13. package/dist/command-palette.esm.js +2 -2
  14. package/dist/components/date-time-utils.d.ts +2 -1
  15. package/dist/components/date-time-utils.d.ts.map +1 -1
  16. package/dist/components/ui-alert-dialog.d.ts +2 -0
  17. package/dist/components/ui-alert-dialog.d.ts.map +1 -1
  18. package/dist/components/ui-app-header.d.ts.map +1 -1
  19. package/dist/components/ui-badge.d.ts.map +1 -1
  20. package/dist/components/ui-color-picker.d.ts.map +1 -1
  21. package/dist/components/ui-combobox.d.ts +4 -1
  22. package/dist/components/ui-combobox.d.ts.map +1 -1
  23. package/dist/components/ui-context-menu.d.ts +6 -0
  24. package/dist/components/ui-context-menu.d.ts.map +1 -1
  25. package/dist/components/ui-date-picker.d.ts +3 -0
  26. package/dist/components/ui-date-picker.d.ts.map +1 -1
  27. package/dist/components/ui-date-range-picker.d.ts +3 -0
  28. package/dist/components/ui-date-range-picker.d.ts.map +1 -1
  29. package/dist/components/ui-date-range-time-picker.d.ts +3 -0
  30. package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
  31. package/dist/components/ui-date-time-picker.d.ts +3 -0
  32. package/dist/components/ui-date-time-picker.d.ts.map +1 -1
  33. package/dist/components/ui-dialog.d.ts +3 -0
  34. package/dist/components/ui-dialog.d.ts.map +1 -1
  35. package/dist/components/ui-drawer.d.ts +14 -0
  36. package/dist/components/ui-drawer.d.ts.map +1 -1
  37. package/dist/components/ui-floating-toolbar.d.ts +3 -0
  38. package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
  39. package/dist/components/ui-gantt.d.ts +30 -1
  40. package/dist/components/ui-gantt.d.ts.map +1 -1
  41. package/dist/components/ui-hover-card.d.ts +3 -0
  42. package/dist/components/ui-hover-card.d.ts.map +1 -1
  43. package/dist/components/ui-menu.d.ts +1 -0
  44. package/dist/components/ui-menu.d.ts.map +1 -1
  45. package/dist/components/ui-menubar.d.ts +1 -0
  46. package/dist/components/ui-menubar.d.ts.map +1 -1
  47. package/dist/components/ui-positioner.d.ts.map +1 -1
  48. package/dist/components/ui-quick-actions.d.ts.map +1 -1
  49. package/dist/components/ui-radio.d.ts +47 -0
  50. package/dist/components/ui-radio.d.ts.map +1 -0
  51. package/dist/components/ui-select.d.ts +8 -0
  52. package/dist/components/ui-select.d.ts.map +1 -1
  53. package/dist/components/ui-selection-popup.d.ts.map +1 -1
  54. package/dist/components/ui-stepper.d.ts.map +1 -1
  55. package/dist/components/ui-time-picker.d.ts +3 -0
  56. package/dist/components/ui-time-picker.d.ts.map +1 -1
  57. package/dist/context-menu.cjs.js +12 -12
  58. package/dist/context-menu.esm.js +160 -133
  59. package/dist/date-field.cjs.js +1 -1
  60. package/dist/date-field.esm.js +3 -2
  61. package/dist/date-picker.cjs.js +13 -13
  62. package/dist/date-picker.esm.js +101 -67
  63. package/dist/date-range-picker.cjs.js +14 -14
  64. package/dist/date-range-picker.esm.js +99 -65
  65. package/dist/date-range-time-picker.cjs.js +13 -13
  66. package/dist/date-range-time-picker.esm.js +77 -45
  67. package/dist/date-time-picker.cjs.js +13 -13
  68. package/dist/date-time-picker.esm.js +133 -101
  69. package/dist/date-time-utils-66480de4.js +1 -0
  70. package/dist/date-time-utils-a2c7af25.mjs +307 -0
  71. package/dist/dialog.cjs.js +29 -20
  72. package/dist/dialog.esm.js +90 -70
  73. package/dist/drawer.cjs.js +16 -16
  74. package/dist/drawer.esm.js +216 -98
  75. package/dist/floating-toolbar.cjs.js +6 -16
  76. package/dist/floating-toolbar.esm.js +57 -40
  77. package/dist/gantt.cjs.js +656 -74
  78. package/dist/gantt.esm.js +1050 -100
  79. package/dist/hover-card.cjs.js +4 -4
  80. package/dist/hover-card.esm.js +62 -39
  81. package/dist/index.cjs.js +1 -1
  82. package/dist/index.d.ts +2 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.esm.js +300 -286
  85. package/dist/menu.cjs.js +2 -2
  86. package/dist/menu.esm.js +118 -110
  87. package/dist/menubar.cjs.js +5 -5
  88. package/dist/menubar.esm.js +83 -78
  89. package/dist/{overlayManager-ece06517.js → overlayManager-0eda4e08.js} +1 -1
  90. package/dist/{overlayManager-86454af7.mjs → overlayManager-5bbd4dc3.mjs} +1 -1
  91. package/dist/popover.cjs.js +1 -1
  92. package/dist/popover.esm.js +2 -2
  93. package/dist/portal-c69756c0.js +1 -0
  94. package/dist/portal-fe73e5cc.mjs +123 -0
  95. package/dist/portal.d.ts +29 -3
  96. package/dist/portal.d.ts.map +1 -1
  97. package/dist/positioner-33529bb8.js +1 -0
  98. package/dist/positioner-e9770c66.mjs +582 -0
  99. package/dist/positioner.cjs.js +2 -2
  100. package/dist/positioner.esm.js +36 -26
  101. package/dist/primitives/positioner.d.ts +199 -1
  102. package/dist/primitives/positioner.d.ts.map +1 -1
  103. package/dist/quick-actions.cjs.js +10 -4
  104. package/dist/quick-actions.esm.js +27 -21
  105. package/dist/radio.cjs.js +259 -0
  106. package/dist/radio.esm.js +455 -0
  107. package/dist/{runtime-4ac0107b.mjs → runtime-161f68a2.mjs} +24 -23
  108. package/dist/runtime-3f13807b.js +1 -0
  109. package/dist/runtime.cjs.js +1 -1
  110. package/dist/runtime.d.ts +2 -0
  111. package/dist/runtime.d.ts.map +1 -1
  112. package/dist/runtime.esm.js +39 -24
  113. package/dist/scroll-lock-31da444f.mjs +56 -0
  114. package/dist/scroll-lock-d7b0df21.js +1 -0
  115. package/dist/scroll-lock.d.ts.map +1 -1
  116. package/dist/select.cjs.js +14 -15
  117. package/dist/select.esm.js +117 -97
  118. package/dist/selection-popup.cjs.js +4 -7
  119. package/dist/selection-popup.esm.js +8 -11
  120. package/dist/split-button.cjs.js +1 -1
  121. package/dist/split-button.esm.js +2 -2
  122. package/dist/standalone/radio.d.ts +2 -0
  123. package/dist/standalone/radio.d.ts.map +1 -0
  124. package/dist/stepper.cjs.js +19 -50
  125. package/dist/stepper.esm.js +17 -48
  126. package/dist/time-field.cjs.js +1 -1
  127. package/dist/time-field.esm.js +3 -2
  128. package/dist/time-picker.cjs.js +15 -15
  129. package/dist/time-picker.esm.js +100 -68
  130. package/dist/tooltip.cjs.js +1 -1
  131. package/dist/tooltip.esm.js +2 -1
  132. package/package.json +1 -1
  133. package/dist/date-time-utils-5cf58cd0.js +0 -1
  134. package/dist/date-time-utils-bdceb7af.mjs +0 -273
  135. package/dist/portal-1cf392ca.mjs +0 -114
  136. package/dist/portal-d8d7fbca.js +0 -1
  137. package/dist/positioner-accc6e5f.js +0 -1
  138. package/dist/positioner-fbd61bf1.mjs +0 -132
  139. package/dist/runtime-5f282bc8.js +0 -1
  140. package/dist/scroll-lock-48793569.js +0 -1
  141. package/dist/scroll-lock-9de6d328.mjs +0 -53
@@ -0,0 +1,582 @@
1
+ const k = [
2
+ "top",
3
+ "top-start",
4
+ "top-end",
5
+ "right",
6
+ "right-start",
7
+ "right-end",
8
+ "bottom",
9
+ "bottom-start",
10
+ "bottom-end",
11
+ "left",
12
+ "left-start",
13
+ "left-end"
14
+ ];
15
+ function S(e) {
16
+ return e instanceof HTMLElement;
17
+ }
18
+ function I(e) {
19
+ return !!e && typeof e.top == "number" && typeof e.left == "number";
20
+ }
21
+ function V(e) {
22
+ return !!e && typeof e.getBoundingClientRect == "function";
23
+ }
24
+ function L(e) {
25
+ const t = e.x ?? 0, n = e.y ?? 0;
26
+ return typeof DOMRect.fromRect == "function" ? DOMRect.fromRect({ x: t, y: n, width: e.width, height: e.height }) : new DOMRect(t, n, e.width, e.height);
27
+ }
28
+ function A(e) {
29
+ return e instanceof DOMRect ? e : L({
30
+ x: e.x ?? e.left,
31
+ y: e.y ?? e.top,
32
+ width: e.width,
33
+ height: e.height
34
+ });
35
+ }
36
+ function y(e) {
37
+ return S(e) ? e.getBoundingClientRect() : I(e) ? A(e) : A(e.getBoundingClientRect());
38
+ }
39
+ function j(e, t) {
40
+ var i;
41
+ const n = (i = t == null ? void 0 : t.getClientRects) == null ? void 0 : i.call(t, e);
42
+ if (n)
43
+ return Array.from(n).map((o) => A(o)).filter((o) => o.width > 0 || o.height > 0);
44
+ const r = (S(e) || V(e)) && typeof e.getClientRects == "function" ? e.getClientRects() : null;
45
+ return r ? Array.from(r).map((o) => A(o)).filter((o) => o.width > 0 || o.height > 0) : [];
46
+ }
47
+ function q(e, t, n, r) {
48
+ if (!n)
49
+ return y(e);
50
+ const i = j(e, r);
51
+ if (i.length === 0)
52
+ return y(e);
53
+ const { side: o } = w(t);
54
+ return o === "bottom" || o === "right" ? i[i.length - 1] || y(e) : i[0] || y(e);
55
+ }
56
+ function W(e) {
57
+ return S(e) ? e : V(e) && e.contextElement instanceof HTMLElement ? e.contextElement : null;
58
+ }
59
+ function N(e, t, n) {
60
+ if (n)
61
+ return n;
62
+ const r = W(e) || (t instanceof HTMLElement ? t : null);
63
+ return r && window.getComputedStyle(r).direction === "rtl" ? "rtl" : "ltr";
64
+ }
65
+ function me(e, t, n) {
66
+ return {
67
+ getBoundingClientRect: () => L({
68
+ x: e,
69
+ y: t,
70
+ width: 0,
71
+ height: 0
72
+ }),
73
+ contextElement: n
74
+ };
75
+ }
76
+ function he(e, t) {
77
+ const n = L({
78
+ x: e.x ?? e.left,
79
+ y: e.y ?? e.top,
80
+ width: e.width,
81
+ height: e.height
82
+ });
83
+ return {
84
+ getBoundingClientRect: () => n,
85
+ contextElement: t
86
+ };
87
+ }
88
+ function ge(e, t) {
89
+ return {
90
+ getBoundingClientRect: () => A(e.getBoundingClientRect()),
91
+ getClientRects: () => e.getClientRects(),
92
+ contextElement: t
93
+ };
94
+ }
95
+ function X() {
96
+ const e = window.innerWidth || document.documentElement.clientWidth || 0, t = window.innerHeight || document.documentElement.clientHeight || 0;
97
+ return {
98
+ top: 0,
99
+ left: 0,
100
+ right: e,
101
+ bottom: t,
102
+ width: e,
103
+ height: t
104
+ };
105
+ }
106
+ function F(e) {
107
+ return {
108
+ top: e.top,
109
+ left: e.left,
110
+ right: e.right,
111
+ bottom: e.bottom,
112
+ width: e.width,
113
+ height: e.height
114
+ };
115
+ }
116
+ function Y(e, t) {
117
+ const n = Math.max(e.left, t.left), r = Math.max(e.top, t.top), i = Math.min(e.right, t.right), o = Math.min(e.bottom, t.bottom);
118
+ return {
119
+ top: r,
120
+ left: n,
121
+ right: i,
122
+ bottom: o,
123
+ width: Math.max(0, i - n),
124
+ height: Math.max(0, o - r)
125
+ };
126
+ }
127
+ function _(e) {
128
+ const t = window.getComputedStyle(e), n = `${t.overflow}${t.overflowX}${t.overflowY}`;
129
+ return /(auto|scroll|overlay|hidden|clip)/.test(n);
130
+ }
131
+ function P(e) {
132
+ const t = [];
133
+ let n = (e == null ? void 0 : e.parentElement) ?? null;
134
+ for (; n && n !== document.body && n !== document.documentElement; )
135
+ _(n) && t.push(n), n = n.parentElement;
136
+ return t.push(window), t;
137
+ }
138
+ function G(e, t, n) {
139
+ let r = n instanceof HTMLElement ? F(n.getBoundingClientRect()) : X();
140
+ if (n instanceof HTMLElement)
141
+ return r;
142
+ const i = /* @__PURE__ */ new Set(), o = W(e);
143
+ return o && P(o).forEach((c) => {
144
+ c instanceof Element && i.add(c);
145
+ }), t instanceof HTMLElement && P(t).forEach((c) => {
146
+ c instanceof Element && i.add(c);
147
+ }), i.forEach((c) => {
148
+ r = Y(r, F(c.getBoundingClientRect()));
149
+ }), r;
150
+ }
151
+ function w(e) {
152
+ const [t, n] = e.split("-");
153
+ return {
154
+ side: t,
155
+ align: n || "center"
156
+ };
157
+ }
158
+ function U(e) {
159
+ return e === "top" ? "bottom" : e === "bottom" ? "top" : e === "left" ? "right" : "left";
160
+ }
161
+ function J(e) {
162
+ const { side: t, align: n } = w(e);
163
+ return `${U(t)}${n === "center" ? "" : `-${n}`}`;
164
+ }
165
+ function H(e, t, n, r = 0, i = 0, o = !1) {
166
+ const { side: c, align: l } = w(n);
167
+ let a = 0, d = 0;
168
+ return c === "top" || c === "bottom" ? (l === "start" ? a = o ? e.right - t.width : e.left : l === "end" ? a = o ? e.left : e.right - t.width : a = e.left + (e.width - t.width) / 2, d = c === "top" ? e.top - t.height - r : e.bottom + r, a += i) : (l === "start" ? d = e.top : l === "end" ? d = e.bottom - t.height : d = e.top + (e.height - t.height) / 2, a = c === "left" ? e.left - t.width - r : e.right + r, d += i), { x: a, y: d };
169
+ }
170
+ function O(e, t, n) {
171
+ return Math.min(n, Math.max(t, e));
172
+ }
173
+ function z(e) {
174
+ return Math.max(0, e.top) + Math.max(0, e.right) + Math.max(0, e.bottom) + Math.max(0, e.left);
175
+ }
176
+ function D(e, t) {
177
+ const { side: n } = w(e);
178
+ return Math.max(0, t[n]);
179
+ }
180
+ function K(e, t) {
181
+ const { side: n } = w(e);
182
+ return n === "top" || n === "bottom" ? Math.max(0, t.left) + Math.max(0, t.right) : Math.max(0, t.top) + Math.max(0, t.bottom);
183
+ }
184
+ function R(e, t = {}) {
185
+ const n = t.padding ?? e.padding, r = t.elementContext === "reference" ? {
186
+ x: e.rects.reference.left,
187
+ y: e.rects.reference.top,
188
+ width: e.rects.reference.width,
189
+ height: e.rects.reference.height
190
+ } : {
191
+ x: e.x,
192
+ y: e.y,
193
+ width: e.rects.floating.width,
194
+ height: e.rects.floating.height
195
+ };
196
+ return {
197
+ top: e.boundary.top + n - r.y,
198
+ right: r.x + r.width - (e.boundary.right - n),
199
+ bottom: r.y + r.height - (e.boundary.bottom - n),
200
+ left: e.boundary.left + n - r.x
201
+ };
202
+ }
203
+ function Q(e = 0) {
204
+ return {
205
+ name: "offset",
206
+ options: e,
207
+ fn(t) {
208
+ const n = typeof e == "number" ? { mainAxis: e, crossAxis: 0 } : { mainAxis: e.mainAxis ?? 0, crossAxis: e.crossAxis ?? 0 }, r = H(
209
+ t.rects.reference,
210
+ t.rects.floating,
211
+ t.placement,
212
+ n.mainAxis,
213
+ n.crossAxis,
214
+ t.rtl
215
+ );
216
+ return {
217
+ x: r.x,
218
+ y: r.y,
219
+ data: {
220
+ x: r.x - t.x,
221
+ y: r.y - t.y
222
+ }
223
+ };
224
+ }
225
+ };
226
+ }
227
+ function Z(e = {}) {
228
+ return {
229
+ name: "flip",
230
+ options: e,
231
+ fn(t) {
232
+ var a;
233
+ const n = (a = e.fallbackPlacements) != null && a.length ? e.fallbackPlacements : [J(t.initialPlacement)], i = [t.placement, ...n].map((d) => {
234
+ const f = t.getAnchorRect(d), s = t.getCoords(d, f), g = R({
235
+ ...t,
236
+ x: s.x,
237
+ y: s.y,
238
+ rects: { ...t.rects, reference: f }
239
+ }, { padding: e.padding ?? t.padding });
240
+ return { placement: d, overflow: g, coords: s, reference: f };
241
+ }), o = i[0];
242
+ if (!o || D(t.placement, o.overflow) <= 0)
243
+ return { data: { overflows: i.map(({ placement: d, overflow: f }) => ({ placement: d, overflow: f })) } };
244
+ const l = i.find(({ placement: d, overflow: f }) => D(d, f) <= 0 && K(d, f) <= 0) || i.reduce((d, f) => z(f.overflow) < z(d.overflow) ? f : d, o);
245
+ return l.placement === t.placement ? { data: { overflows: i.map(({ placement: d, overflow: f }) => ({ placement: d, overflow: f })) } } : {
246
+ x: l.coords.x,
247
+ y: l.coords.y,
248
+ placement: l.placement,
249
+ data: { overflows: i.map(({ placement: d, overflow: f }) => ({ placement: d, overflow: f })) }
250
+ };
251
+ }
252
+ };
253
+ }
254
+ function ee(e = {}) {
255
+ return {
256
+ name: "autoPlacement",
257
+ options: e,
258
+ fn(t) {
259
+ var o;
260
+ const n = (o = e.allowedPlacements) != null && o.length ? e.allowedPlacements : k, r = n.map((c) => {
261
+ const l = t.getAnchorRect(c), a = t.getCoords(c, l), d = R({
262
+ ...t,
263
+ x: a.x,
264
+ y: a.y,
265
+ rects: { ...t.rects, reference: l }
266
+ }, { padding: e.padding ?? t.padding });
267
+ return { placement: c, overflow: d, coords: a, reference: l };
268
+ }), i = r.reduce((c, l) => {
269
+ const a = z(l.overflow), d = z(c.overflow);
270
+ if (a !== d)
271
+ return a < d ? l : c;
272
+ const f = Math.max(0, t.boundary.right - l.coords.x) * Math.max(0, t.boundary.bottom - l.coords.y), s = Math.max(0, t.boundary.right - c.coords.x) * Math.max(0, t.boundary.bottom - c.coords.y);
273
+ return f > s ? l : c;
274
+ }, r[0]);
275
+ if (i)
276
+ return {
277
+ x: i.coords.x,
278
+ y: i.coords.y,
279
+ placement: i.placement,
280
+ data: {
281
+ index: n.indexOf(i.placement),
282
+ overflows: r.map(({ placement: c, overflow: l }) => ({ placement: c, overflow: l }))
283
+ }
284
+ };
285
+ }
286
+ };
287
+ }
288
+ function te(e = {}) {
289
+ return {
290
+ name: "shift",
291
+ options: e,
292
+ fn(t) {
293
+ const n = e.mainAxis ?? !0, r = e.crossAxis ?? !0, { side: i } = w(t.placement), o = R(t, { padding: e.padding ?? t.padding });
294
+ let c = t.x, l = t.y;
295
+ return i === "top" || i === "bottom" ? (r && (c += Math.max(0, o.left) - Math.max(0, o.right)), n && (l += i === "top" ? Math.max(0, o.top) : -Math.max(0, o.bottom))) : (r && (l += Math.max(0, o.top) - Math.max(0, o.bottom)), n && (c += i === "left" ? Math.max(0, o.left) : -Math.max(0, o.right))), {
296
+ x: c,
297
+ y: l,
298
+ data: {
299
+ x: c - t.x,
300
+ y: l - t.y
301
+ }
302
+ };
303
+ }
304
+ };
305
+ }
306
+ function ne(e = {}) {
307
+ return {
308
+ name: "size",
309
+ options: e,
310
+ fn(t) {
311
+ var o;
312
+ const n = e.padding ?? t.padding, r = Math.max(0, t.boundary.right - t.x - n), i = Math.max(0, t.boundary.bottom - t.y - n);
313
+ return (o = e.apply) == null || o.call(e, {
314
+ availableWidth: r,
315
+ availableHeight: i,
316
+ rects: t.rects,
317
+ elements: t.elements
318
+ }), {
319
+ data: {
320
+ availableWidth: r,
321
+ availableHeight: i
322
+ }
323
+ };
324
+ }
325
+ };
326
+ }
327
+ function re(e = {}) {
328
+ return {
329
+ name: "arrow",
330
+ options: e,
331
+ fn(t) {
332
+ var u, x, b;
333
+ const { side: n } = w(t.placement), r = e.padding ?? 8, i = (u = e.element) == null ? void 0 : u.getBoundingClientRect(), o = (i == null ? void 0 : i.width) || ((x = e.element) == null ? void 0 : x.offsetWidth) || 0, c = (i == null ? void 0 : i.height) || ((b = e.element) == null ? void 0 : b.offsetHeight) || 0, l = t.rects.reference.left + t.rects.reference.width / 2, a = t.rects.reference.top + t.rects.reference.height / 2;
334
+ if (n === "top" || n === "bottom") {
335
+ const C = o / 2, E = r, p = Math.max(E, t.rects.floating.width - r - o), M = l - t.x - C, h = O(M, E, p);
336
+ return {
337
+ data: {
338
+ x: h,
339
+ centerOffset: M - h
340
+ }
341
+ };
342
+ }
343
+ const d = c / 2, f = r, s = Math.max(f, t.rects.floating.height - r - c), g = a - t.y - d, m = O(g, f, s);
344
+ return {
345
+ data: {
346
+ y: m,
347
+ centerOffset: g - m
348
+ }
349
+ };
350
+ }
351
+ };
352
+ }
353
+ function ie(e = {}) {
354
+ return {
355
+ name: "hide",
356
+ options: e,
357
+ fn(t) {
358
+ const n = e.padding ?? t.padding, r = R(t, {
359
+ elementContext: "reference",
360
+ padding: n
361
+ }), i = R(t, { padding: n }), o = Object.values(r).some((l) => l > 0), c = Object.values(i).some((l) => l > 0);
362
+ return {
363
+ data: {
364
+ referenceHidden: o,
365
+ escaped: c,
366
+ referenceHiddenOffsets: r,
367
+ escapedOffsets: i
368
+ }
369
+ };
370
+ }
371
+ };
372
+ }
373
+ function oe(e) {
374
+ var r;
375
+ const t = typeof e.boundaryPadding == "number" ? e.boundaryPadding : 4, n = [];
376
+ return e.autoPlacement ? n.push(ee({
377
+ padding: t,
378
+ allowedPlacements: e.allowedPlacements
379
+ })) : e.flip && n.push(Z({
380
+ padding: t,
381
+ fallbackPlacements: e.fallbackPlacements
382
+ })), n.push(Q({
383
+ mainAxis: typeof e.offset == "number" ? e.offset : 8,
384
+ crossAxis: typeof e.crossOffset == "number" ? e.crossOffset : 0
385
+ })), (e.shift || e.fitViewport) && n.push(te({ padding: t })), (e.matchWidth || e.fitViewport) && n.push(ne({ padding: t })), e.arrow && n.push(re({
386
+ element: e.arrow,
387
+ padding: e.arrowPadding
388
+ })), e.hideWhenDetached && n.push(ie({ padding: t })), (r = e.middleware) != null && r.length && n.push(...e.middleware), n;
389
+ }
390
+ function ce(e, t, n) {
391
+ if (!n)
392
+ return;
393
+ typeof n.x == "number" && (e.x = n.x), typeof n.y == "number" && (e.y = n.y);
394
+ const i = (typeof n.reset == "object" ? n.reset.placement : void 0) || n.placement;
395
+ if (i && i !== e.placement) {
396
+ e.placement = i, e.rects = e.getRects(i);
397
+ const o = e.getCoords(i, e.rects.reference);
398
+ e.x = typeof n.x == "number" ? n.x : o.x, e.y = typeof n.y == "number" ? n.y : o.y;
399
+ }
400
+ typeof n.x == "number" && (e.x = n.x), typeof n.y == "number" && (e.y = n.y), n.data !== void 0 && (e.middlewareData[t.name] = n.data);
401
+ }
402
+ function T(e, t, n = {}) {
403
+ var p, M;
404
+ const r = S(t) ? t.getBoundingClientRect() : t, i = n.placement || "bottom", o = n.strategy || "fixed", c = typeof n.boundaryPadding == "number" ? n.boundaryPadding : 4, l = N(e, t, n.dir) === "rtl", a = (h) => {
405
+ var v, $;
406
+ return (($ = (v = n.platform) == null ? void 0 : v.getElementRects) == null ? void 0 : $.call(v, {
407
+ anchor: e,
408
+ floating: t,
409
+ placement: h,
410
+ inline: !!n.inline
411
+ })) ?? {
412
+ reference: q(e, h, !!n.inline, n.platform),
413
+ floating: r
414
+ };
415
+ }, d = (h) => a(h).reference, f = a(i), s = H(f.reference, f.floating, i, 0, 0, l), g = {}, m = ((M = (p = n.platform) == null ? void 0 : p.getClippingRect) == null ? void 0 : M.call(p, { anchor: e, floating: t, boundary: n.boundary ?? null })) ?? G(e, t, n.boundary ?? null), u = {
416
+ x: s.x,
417
+ y: s.y,
418
+ initialPlacement: i,
419
+ placement: i,
420
+ strategy: o,
421
+ rects: f,
422
+ elements: {
423
+ anchor: e,
424
+ floating: t
425
+ },
426
+ boundary: m,
427
+ padding: c,
428
+ rtl: l,
429
+ middlewareData: g,
430
+ getRects: a,
431
+ getAnchorRect: d,
432
+ getCoords: (h, v = d(h)) => H(v, u.rects.floating, h, 0, 0, l)
433
+ };
434
+ oe(n).forEach((h) => {
435
+ ce(u, h, h.fn(u));
436
+ });
437
+ const x = g.size, b = g.hide, C = (x == null ? void 0 : x.availableWidth) ?? Math.max(0, u.boundary.right - u.x - c), E = (x == null ? void 0 : x.availableHeight) ?? Math.max(0, u.boundary.bottom - u.y - c);
438
+ return {
439
+ x: u.x,
440
+ y: u.y,
441
+ placement: u.placement,
442
+ strategy: o,
443
+ availableWidth: C,
444
+ availableHeight: E,
445
+ middlewareData: g,
446
+ referenceHidden: b == null ? void 0 : b.referenceHidden,
447
+ escaped: b == null ? void 0 : b.escaped,
448
+ rects: u.rects
449
+ };
450
+ }
451
+ function B(e, t) {
452
+ return t !== "absolute" ? e : {
453
+ ...e,
454
+ x: e.x + window.scrollX,
455
+ y: e.y + window.scrollY
456
+ };
457
+ }
458
+ function le(e, t) {
459
+ if (typeof IntersectionObserver > "u")
460
+ return () => {
461
+ };
462
+ let n = () => {
463
+ };
464
+ return (() => {
465
+ n();
466
+ const i = e.getBoundingClientRect(), o = document.documentElement, c = `${-Math.floor(i.top)}px ${-Math.floor(o.clientWidth - i.right)}px ${-Math.floor(o.clientHeight - i.bottom)}px ${-Math.floor(i.left)}px`, l = new IntersectionObserver(() => t(), {
467
+ rootMargin: c,
468
+ threshold: 1
469
+ });
470
+ l.observe(e), n = () => l.disconnect();
471
+ })(), () => n();
472
+ }
473
+ function de(e, t, n, r) {
474
+ let i = 0, o = 0, c = null, l = null, a = null;
475
+ const d = [], f = W(e), s = () => {
476
+ i || (i = requestAnimationFrame(() => {
477
+ i = 0, n();
478
+ }));
479
+ };
480
+ if (r.observeWindowResize && (window.addEventListener("resize", s), d.push(() => window.removeEventListener("resize", s))), r.observeScroll && (window.addEventListener("scroll", s, { passive: !0, capture: !0 }), d.push(() => window.removeEventListener("scroll", s, !0))), (r.observeAncestorScroll || r.observeAncestorResize ? /* @__PURE__ */ new Set([
481
+ ...f ? P(f) : [],
482
+ ...P(t)
483
+ ]) : /* @__PURE__ */ new Set()).forEach((m) => {
484
+ m !== window && (r.observeAncestorScroll && (m.addEventListener("scroll", s, { passive: !0 }), d.push(() => m.removeEventListener("scroll", s))), r.observeAncestorResize && (m.addEventListener("resize", s), d.push(() => m.removeEventListener("resize", s))));
485
+ }), f && r.observeLayoutShift && d.push(le(f, s)), typeof ResizeObserver < "u" && (r.observeAnchorResize && f && (l = new ResizeObserver(s), l.observe(f)), r.observeFloatingResize && (a = new ResizeObserver(s), a.observe(t))), r.animationFrame) {
486
+ c = y(e);
487
+ const m = () => {
488
+ const u = y(e);
489
+ c && (c.top !== u.top || c.left !== u.left || c.width !== u.width || c.height !== u.height) && s(), c = u, o = requestAnimationFrame(m);
490
+ };
491
+ o = requestAnimationFrame(m);
492
+ }
493
+ return () => {
494
+ d.forEach((m) => m()), l && l.disconnect(), a && a.disconnect(), i && cancelAnimationFrame(i), o && cancelAnimationFrame(o);
495
+ };
496
+ }
497
+ function ae(e, t, n, r = {}) {
498
+ return de(e, t, n, {
499
+ observeWindowResize: r.observeWindowResize ?? !0,
500
+ observeScroll: r.observeScroll ?? !0,
501
+ observeAncestorScroll: r.observeAncestorScroll ?? !0,
502
+ observeAncestorResize: r.observeAncestorResize ?? !0,
503
+ observeLayoutShift: r.observeLayoutShift ?? !0,
504
+ observeAnchorResize: r.observeAnchorResize ?? !0,
505
+ observeFloatingResize: r.observeFloatingResize ?? !0,
506
+ animationFrame: r.animationFrame ?? !1
507
+ });
508
+ }
509
+ function fe(e, t, n, r) {
510
+ const { side: i } = w(t.placement), o = n.left + n.width / 2, c = n.top + n.height / 2;
511
+ if (i === "top" || i === "bottom") {
512
+ const a = Math.max(8, r.width - 8), d = O(o - t.x, 8, a);
513
+ e.style.left = `${Math.round(d)}px`;
514
+ } else {
515
+ const a = Math.max(8, r.height - 8), d = O(c - t.y, 8, a);
516
+ e.style.top = `${Math.round(d)}px`;
517
+ }
518
+ }
519
+ function se(e, t) {
520
+ var r;
521
+ const n = (r = t.middlewareData) == null ? void 0 : r.arrow;
522
+ n && (typeof n.x == "number" && (e.style.left = `${Math.round(n.x)}px`), typeof n.y == "number" && (e.style.top = `${Math.round(n.y)}px`));
523
+ }
524
+ function ue(e, t, n, r) {
525
+ var i;
526
+ if (e.style.position = n, e.style.left = `${Math.round(t.x)}px`, e.style.top = `${Math.round(t.y)}px`, e.style.setProperty("--ui-positioner-x", `${Math.round(t.x)}px`), e.style.setProperty("--ui-positioner-y", `${Math.round(t.y)}px`), r.matchWidth) {
527
+ const o = y(r.anchor);
528
+ e.style.width = `${Math.round(o.width)}px`;
529
+ }
530
+ r.fitViewport && (e.style.maxWidth = `${Math.round(t.availableWidth)}px`, e.style.maxHeight = `${Math.round(t.availableHeight)}px`), e.setAttribute("data-placement", t.placement), typeof t.referenceHidden == "boolean" || typeof t.escaped == "boolean" ? (e.setAttribute("data-reference-hidden", t.referenceHidden ? "true" : "false"), e.setAttribute("data-escaped", t.escaped ? "true" : "false")) : (e.removeAttribute("data-reference-hidden"), e.removeAttribute("data-escaped")), r.arrow instanceof HTMLElement && ((i = t.middlewareData) != null && i.arrow ? se(r.arrow, t) : fe(r.arrow, t, y(r.anchor), e.getBoundingClientRect()));
531
+ }
532
+ function xe(e) {
533
+ if (!(e.floating instanceof HTMLElement))
534
+ throw new Error("createPositioner requires a valid floating HTMLElement");
535
+ const t = e.strategy || "fixed", n = e.floating;
536
+ let r = B(
537
+ T(e.anchor, n, e),
538
+ t
539
+ );
540
+ const i = ae(e.anchor, n, o, {
541
+ observeWindowResize: e.observeWindowResize ?? !0,
542
+ observeScroll: e.observeScroll ?? !0,
543
+ observeAncestorScroll: e.observeAncestorScroll ?? !0,
544
+ observeAncestorResize: e.observeAncestorResize ?? !0,
545
+ observeLayoutShift: e.observeLayoutShift ?? !0,
546
+ observeAnchorResize: e.observeAnchorResize ?? !0,
547
+ // When the positioner constrains the floating box, observing that same box
548
+ // can create resize feedback loops in real browsers.
549
+ observeFloatingResize: e.observeFloatingResize ?? !(e.fitViewport || e.matchWidth),
550
+ animationFrame: e.animationFrame ?? !1
551
+ });
552
+ function o() {
553
+ var l;
554
+ const c = B(
555
+ T(e.anchor, n, e),
556
+ t
557
+ );
558
+ return r = c, ue(n, c, t, e), (l = e.onUpdate) == null || l.call(e, c), r;
559
+ }
560
+ return o(), {
561
+ update: o,
562
+ destroy() {
563
+ i();
564
+ }
565
+ };
566
+ }
567
+ export {
568
+ ae as a,
569
+ me as b,
570
+ T as c,
571
+ he as d,
572
+ ge as e,
573
+ R as f,
574
+ Z as g,
575
+ ee as h,
576
+ ne as i,
577
+ re as j,
578
+ ie as k,
579
+ xe as l,
580
+ Q as o,
581
+ te as s
582
+ };
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./ElementBase-1b301e7f.js"),a=require("./positioner-accc6e5f.js"),h=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./ElementBase-1b301e7f.js"),c=require("./positioner-33529bb8.js"),h=`
2
2
  :host {
3
3
  display: contents;
4
4
  color-scheme: light dark;
5
5
  }
6
- `;function l(s,t=0){const e=Number(s);return Number.isFinite(e)?e:t}function i(s){if(s==null)return!1;const t=s.toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function f(s){return new Set(["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"]).has(s)?s:"bottom"}function d(s){return s==="absolute"?"absolute":"fixed"}class c extends u.ElementBase{constructor(){super(...arguments),this._positioner=null,this._observer=null}static get observedAttributes(){return["open","placement","strategy","offset","cross-offset","flip","shift","match-width","fit-viewport","anchor","headless"]}connectedCallback(){super.connectedCallback(),this._observer=new MutationObserver(()=>this._syncPositioner()),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot","id"]}),this._syncPositioner()}disconnectedCallback(){var t;(t=this._observer)==null||t.disconnect(),this._observer=null,this._destroyPositioner(),super.disconnectedCallback()}attributeChangedCallback(t,e,o){e!==o&&this._syncPositioner()}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}updatePosition(){var t;(t=this._positioner)==null||t.update()}_destroyPositioner(){var t;(t=this._positioner)==null||t.destroy(),this._positioner=null}_resolveAnchor(){const t=this.getAttribute("anchor");if(t){const o=this.getRootNode(),r=o instanceof ShadowRoot||o instanceof Document?o.querySelector(t):null;if(r instanceof HTMLElement)return r;const n=document.querySelector(t);if(n instanceof HTMLElement)return n}const e=this.querySelector('[slot="anchor"]');return e instanceof HTMLElement?e:null}_resolveFloating(){const t=this.querySelector('[slot="content"]');return t instanceof HTMLElement?t:Array.from(this.children).find(e=>e.getAttribute("slot")!=="anchor")}_syncPositioner(){if(!this.isConnected)return;if(this.hasAttribute("headless")||!this.hasAttribute("open")){this._destroyPositioner();return}const t=this._resolveAnchor(),e=this._resolveFloating();if(!(t instanceof HTMLElement)||!(e instanceof HTMLElement)){this._destroyPositioner();return}this._destroyPositioner(),this._positioner=a.createPositioner({anchor:t,floating:e,placement:f(this.getAttribute("placement")),strategy:d(this.getAttribute("strategy")),offset:l(this.getAttribute("offset"),8),crossOffset:l(this.getAttribute("cross-offset"),0),flip:!this.hasAttribute("flip")||i(this.getAttribute("flip")),shift:!this.hasAttribute("shift")||i(this.getAttribute("shift")),matchWidth:i(this.getAttribute("match-width")),fitViewport:i(this.getAttribute("fit-viewport")),arrow:this.querySelector('[slot="arrow"], .arrow'),onUpdate:o=>{this.dispatchEvent(new CustomEvent("position-change",{detail:o,bubbles:!0,composed:!0}))}})}render(){this.setContent(`<style>${h}</style><slot name="anchor"></slot><slot name="content"></slot><slot></slot>`)}shouldRenderOnAttributeChange(){return!1}}typeof customElements<"u"&&!customElements.get("ui-positioner")&&customElements.define("ui-positioner",c);exports.UIPositioner=c;
6
+ `;function r(s,t=0){const e=Number(s);return Number.isFinite(e)?e:t}function o(s){if(s==null)return!1;const t=s.toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function d(s){return new Set(["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"]).has(s)?s:"bottom"}function f(s){return s==="absolute"?"absolute":"fixed"}class a extends u.ElementBase{constructor(){super(...arguments),this._positioner=null,this._observer=null}static get observedAttributes(){return["open","placement","strategy","offset","cross-offset","flip","shift","match-width","fit-viewport","auto-placement","hide-when-detached","inline","boundary-padding","dir","anchor","headless"]}connectedCallback(){super.connectedCallback(),this._observer=new MutationObserver(()=>this._syncPositioner()),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot","id"]}),this._syncPositioner()}disconnectedCallback(){var t;(t=this._observer)==null||t.disconnect(),this._observer=null,this._destroyPositioner(),super.disconnectedCallback()}attributeChangedCallback(t,e,i){e!==i&&this._syncPositioner()}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}updatePosition(){var t;(t=this._positioner)==null||t.update()}_destroyPositioner(){var t;(t=this._positioner)==null||t.destroy(),this._positioner=null}_resolveAnchor(){const t=this.getAttribute("anchor");if(t){const i=this.getRootNode(),n=i instanceof ShadowRoot||i instanceof Document?i.querySelector(t):null;if(n instanceof HTMLElement)return n;const l=document.querySelector(t);if(l instanceof HTMLElement)return l}const e=this.querySelector('[slot="anchor"]');return e instanceof HTMLElement?e:null}_resolveFloating(){const t=this.querySelector('[slot="content"]');return t instanceof HTMLElement?t:Array.from(this.children).find(e=>e.getAttribute("slot")!=="anchor")}_syncPositioner(){if(!this.isConnected)return;if(this.hasAttribute("headless")||!this.hasAttribute("open")){this._destroyPositioner();return}const t=this._resolveAnchor(),e=this._resolveFloating();if(!(t instanceof HTMLElement)||!(e instanceof HTMLElement)){this._destroyPositioner();return}this._destroyPositioner(),this._positioner=c.createPositioner({anchor:t,floating:e,placement:d(this.getAttribute("placement")),strategy:f(this.getAttribute("strategy")),dir:this.getAttribute("dir")==="rtl"?"rtl":"ltr",offset:r(this.getAttribute("offset"),8),crossOffset:r(this.getAttribute("cross-offset"),0),flip:!this.hasAttribute("flip")||o(this.getAttribute("flip")),shift:!this.hasAttribute("shift")||o(this.getAttribute("shift")),matchWidth:o(this.getAttribute("match-width")),fitViewport:o(this.getAttribute("fit-viewport")),autoPlacement:o(this.getAttribute("auto-placement")),hideWhenDetached:o(this.getAttribute("hide-when-detached")),inline:o(this.getAttribute("inline")),boundaryPadding:r(this.getAttribute("boundary-padding"),4),arrow:this.querySelector('[slot="arrow"], .arrow'),onUpdate:i=>{this.dispatchEvent(new CustomEvent("position-change",{detail:i,bubbles:!0,composed:!0}))}})}render(){this.setContent(`<style>${h}</style><slot name="anchor"></slot><slot name="content"></slot><slot></slot>`)}shouldRenderOnAttributeChange(){return!1}}typeof customElements<"u"&&!customElements.get("ui-positioner")&&customElements.define("ui-positioner",a);exports.UIPositioner=a;