vlite3 1.4.31 → 1.4.33

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 (102) hide show
  1. package/components/Accordion/Accordion.vue.js +19 -16
  2. package/components/Accordion/AccordionContent.vue.js +2 -2
  3. package/components/Accordion/AccordionItem.vue.js +38 -36
  4. package/components/CategoryManager/CategoryManager.vue2.js +4 -3
  5. package/components/CategoryManager/CategoryNode.vue.js +30 -30
  6. package/components/CategoryMenu/CategoryMenu.vue.js +9 -11
  7. package/components/Chart/GanttChart.vue.d.ts +18 -2
  8. package/components/Chart/GanttChart.vue.js +1 -1
  9. package/components/Chart/GanttChart.vue2.js +1347 -604
  10. package/components/Chart/GanttChartConnectorRouting.d.ts +83 -0
  11. package/components/Chart/GanttChartConnectorRouting.js +405 -0
  12. package/components/Chart/GanttChartDateUtils.d.ts +38 -0
  13. package/components/Chart/GanttChartDateUtils.js +79 -0
  14. package/components/Chart/GanttChartDependencyUtils.d.ts +92 -0
  15. package/components/Chart/GanttChartDependencyUtils.js +109 -0
  16. package/components/Chart/GanttChartResizePreviewUtils.d.ts +52 -0
  17. package/components/Chart/GanttChartResizePreviewUtils.js +53 -0
  18. package/components/Chart/GanttChartTooltipUtils.d.ts +41 -0
  19. package/components/Chart/GanttChartTooltipUtils.js +63 -0
  20. package/components/Chart/index.d.ts +3 -1
  21. package/components/Chart/types.d.ts +92 -2
  22. package/components/Chart/types.js +8 -0
  23. package/components/ColorPicker/ColorIro.vue2.js +155 -0
  24. package/components/ColorPicker/ColorIro.vue3.js +2 -2
  25. package/components/ColorPicker/ColorPicker.vue.d.ts +5 -0
  26. package/components/ColorPicker/ColorPicker.vue.js +111 -65
  27. package/components/ColorPicker/constants.d.ts +2 -0
  28. package/components/ColorPicker/constants.js +4 -0
  29. package/components/ColorPicker/index.d.ts +1 -0
  30. package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
  31. package/components/CommandPalette/{CommandPaletteItem.vue.js → CommandPaletteItem.vue2.js} +1 -1
  32. package/components/Dropdown/Dropdown.vue.js +100 -97
  33. package/components/Dropdown/DropdownMenu.vue.js +1 -1
  34. package/components/Form/AccordionView.vue.js +5 -220
  35. package/components/Form/AccordionView.vue3.js +250 -0
  36. package/components/Form/Form.vue.js +2 -2
  37. package/components/Form/Form.vue2.js +309 -280
  38. package/components/Form/FormField.vue.js +177 -197
  39. package/components/Form/FormFields.vue.js +1 -1
  40. package/components/Form/FormFields.vue2.js +60 -60
  41. package/components/Form/FormSkeleton.vue.js +50 -35
  42. package/components/Form/TableView.vue.js +59 -43
  43. package/components/Form/composables/useForm.js +159 -148
  44. package/components/Form/index.vue2.js +7 -7
  45. package/components/Form/utils/form.utils.d.ts +2 -0
  46. package/components/Form/utils/form.utils.js +17 -13
  47. package/components/GoogleMap.vue.d.ts +1 -1
  48. package/components/Kanban/Kanban.vue.d.ts +16 -2
  49. package/components/Kanban/Kanban.vue.js +2 -2
  50. package/components/Kanban/Kanban.vue2.js +150 -86
  51. package/components/Kanban/types.d.ts +37 -0
  52. package/components/NavbarCommandPalette.vue.js +1 -1
  53. package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +189 -0
  54. package/components/PanZoomViewport/PanZoomViewport.vue.js +7 -0
  55. package/components/PanZoomViewport/PanZoomViewport.vue2.js +536 -0
  56. package/components/PanZoomViewport/index.d.ts +2 -0
  57. package/components/PanZoomViewport/types.d.ts +121 -0
  58. package/components/ScaleGenerator/ScaleGenerator.vue.d.ts +3 -0
  59. package/components/ScaleGenerator/ScaleGenerator.vue.js +5 -108
  60. package/components/ScaleGenerator/ScaleGenerator.vue2.js +143 -2
  61. package/components/ScaleGenerator/types.d.ts +2 -0
  62. package/components/Screen/ScreenFilter.vue.js +19 -18
  63. package/components/SeoProvider/SeoProvider.vue.d.ts +4 -1
  64. package/components/SeoProvider/SeoProvider.vue.js +39 -33
  65. package/components/SeoProvider/domAdapter.d.ts +1 -4
  66. package/components/SeoProvider/domAdapter.js +71 -58
  67. package/components/SeoProvider/index.d.ts +5 -2
  68. package/components/SeoProvider/normalizeSeo.d.ts +10 -49
  69. package/components/SeoProvider/normalizeSeo.js +246 -182
  70. package/components/SeoProvider/plainText.d.ts +8 -0
  71. package/components/SeoProvider/plainText.js +117 -0
  72. package/components/SeoProvider/seoUrl.d.ts +13 -0
  73. package/components/SeoProvider/seoUrl.js +25 -0
  74. package/components/SeoProvider/structuredData.d.ts +100 -0
  75. package/components/SeoProvider/structuredData.js +33 -0
  76. package/components/SeoProvider/types.d.ts +47 -109
  77. package/components/Tabes/Tabes.vue.js +1 -1
  78. package/components/Tabes/Tabes.vue2.js +215 -193
  79. package/components/Tabes/TabesMarkerGeometry.d.ts +34 -0
  80. package/components/Tabes/TabesMarkerGeometry.js +21 -0
  81. package/components/ThemeProvider/ThemeProvider.vue.d.ts +2 -0
  82. package/components/ThemeProvider/ThemeProvider.vue.js +29 -23
  83. package/components/ThemeProvider/index.d.ts +1 -1
  84. package/components/ThemeProvider/themeVars.d.ts +9 -13
  85. package/components/ThemeProvider/themeVars.js +173 -125
  86. package/components/ThemeProvider/types.d.ts +10 -0
  87. package/components/ToastNotification.vue.js +1 -1
  88. package/components/ToastNotification.vue2.js +3 -3
  89. package/components/index.d.ts +3 -2
  90. package/composables/useKeyStroke.d.ts +18 -0
  91. package/composables/useKeyStroke.js +103 -77
  92. package/composables/useTheme.js +1 -1
  93. package/index.d.ts +2 -0
  94. package/index.js +380 -350
  95. package/package.json +12 -4
  96. package/style.css +1 -1
  97. package/utils/environment.d.ts +29 -0
  98. package/utils/environment.js +4 -0
  99. package/utils/functions.js +14 -13
  100. package/components/ColorPicker/ColorIro.vue.js +0 -141
  101. package/components/Form/AccordionView.vue2.js +0 -4
  102. /package/components/Dropdown/{DropdownMenu.vue2.js → DropdownMenu.vue3.js} +0 -0
@@ -0,0 +1,536 @@
1
+ import { defineComponent as Tt, shallowRef as y, computed as p, onMounted as At, nextTick as N, onBeforeUnmount as Mt, watch as W, openBlock as Rt, createElementBlock as Wt, normalizeStyle as Ve, createElementVNode as Bt, normalizeClass as Ot, renderSlot as It } from "vue";
2
+ const Ct = ["tabindex", "aria-label", "aria-keyshortcuts"], Le = 160, _e = 16, Yt = /* @__PURE__ */ Tt({
3
+ __name: "PanZoomViewport",
4
+ props: {
5
+ modelValue: { default: () => ({ scale: 1, x: 0, y: 0 }) },
6
+ contentWidth: {},
7
+ contentHeight: {},
8
+ minScale: { default: 0.1 },
9
+ maxScale: { default: 4 },
10
+ zoomStep: { default: 0.2 },
11
+ wheelZoomSpeed: { default: 2e-3 },
12
+ keyboardPanStep: { default: 40 },
13
+ fitPadding: { default: 24 },
14
+ fitMode: { default: "contain" },
15
+ fitAlignX: { default: "center" },
16
+ fitAlignY: { default: "center" },
17
+ initialFit: { type: Boolean, default: !1 },
18
+ autoFitOnResize: { type: Boolean, default: !1 },
19
+ zoomEnabled: { type: Boolean, default: !0 },
20
+ zoomInEnabled: { type: Boolean, default: !0 },
21
+ zoomOutEnabled: { type: Boolean, default: !0 },
22
+ panEnabled: { type: Boolean, default: !0 },
23
+ pointerPanEnabled: { type: Boolean, default: !0 },
24
+ wheelPanEnabled: { type: Boolean, default: !0 },
25
+ keyboardPanEnabled: { type: Boolean, default: !0 },
26
+ horizontalPanEnabled: { type: Boolean, default: !0 },
27
+ verticalPanEnabled: { type: Boolean, default: !0 },
28
+ panOnWheel: { type: Boolean, default: !0 },
29
+ wheelZoomMode: { default: "modifier" },
30
+ panOnPrimaryDrag: { type: Boolean, default: !1 },
31
+ keyboard: { type: Boolean, default: !0 },
32
+ disabled: { type: Boolean, default: !1 },
33
+ ariaLabel: { default: "Pan and zoom viewport" },
34
+ contentClass: { default: "" }
35
+ },
36
+ emits: ["update:modelValue", "change", "update:viewportSize", "update:contentSize", "update:ready", "pan-start", "pan-end", "zoom-availability-change"],
37
+ setup(K, { expose: $e, emit: qe }) {
38
+ const Ke = { scale: 1, x: 0, y: 0 }, Ae = { width: 0, height: 0 }, a = K, b = qe, s = y(null), B = y(null), v = y({ ...Ae }), w = y({ ...Ae }), M = y(!1), O = y(!1), I = y(!1);
39
+ let C = null, U = null, j = /* @__PURE__ */ new WeakMap(), m = 0, F = 0, Z = 0, x = null, le = "external", ie = "auto", G = !1, re = !1, S = null, ce = 0, se = 0, E = !1, ue = null, Q = null, de = !1, fe = {}, he = {}, H = null;
40
+ const Ue = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, g = (e, t) => typeof e == "number" && Number.isFinite(e) ? e : t, z = (e, t) => {
41
+ const n = g(e, t);
42
+ return n > 0 ? n : t;
43
+ }, Y = y({
44
+ padding: Math.max(0, g(a.fitPadding, 24)),
45
+ alignX: a.fitAlignX,
46
+ alignY: a.fitAlignY
47
+ }), f = p(
48
+ () => a.panEnabled && a.horizontalPanEnabled
49
+ ), h = p(
50
+ () => a.panEnabled && a.verticalPanEnabled
51
+ ), ve = p(
52
+ () => f.value || h.value
53
+ ), D = p(
54
+ () => a.pointerPanEnabled && ve.value
55
+ ), me = p(() => {
56
+ const e = z(a.minScale, 0.1), t = z(a.maxScale, 4);
57
+ return {
58
+ min: e,
59
+ max: Math.max(e, t)
60
+ };
61
+ }), pe = (e) => Number(e.toFixed(4)), V = (e, t, n) => {
62
+ const o = me.value, l = o.min <= 1 && o.max >= 1 ? 1 : o.min, i = (T, A) => {
63
+ const Pe = g(T, A);
64
+ return pe(Math.min(o.max, Math.max(o.min, Pe)));
65
+ }, r = i(t, l), d = i(e, r);
66
+ return n && (!a.zoomEnabled || d > r && !a.zoomInEnabled || d < r && !a.zoomOutEnabled) ? r : d;
67
+ }, X = (e, t = 1, n = !1) => ({
68
+ scale: V(e?.scale, t, n),
69
+ x: f.value ? pe(g(e?.x, 0)) : 0,
70
+ y: h.value ? pe(g(e?.y, 0)) : 0
71
+ }), L = (e, t) => e.scale === t.scale && e.x === t.x && e.y === t.y, ge = (e, t) => e.width === t.width && e.height === t.height, Me = (e, t) => {
72
+ const n = Object.keys(e);
73
+ return n.length !== Object.keys(t).length ? !1 : n.every((o) => e[o] === t[o]);
74
+ }, u = y(
75
+ X(a.modelValue, 1, !1)
76
+ );
77
+ let c = u.value;
78
+ const J = (e = u.value, t = E) => {
79
+ const n = B.value;
80
+ n && (ue === n && Q && L(Q, e) && de === t || (n.style.transform = `translate3d(${e.x}px, ${e.y}px, 0) scale(${e.scale})`, n.style.transition = t ? `transform ${Le}ms ease-out` : "none", ue = n, Q = e, de = t));
81
+ }, Re = p(() => V(
82
+ me.value.max,
83
+ u.value.scale,
84
+ !0
85
+ ) > u.value.scale), We = p(() => V(
86
+ me.value.min,
87
+ u.value.scale,
88
+ !0
89
+ ) < u.value.scale), _ = p(() => ({
90
+ canZoomIn: Re.value,
91
+ canZoomOut: We.value
92
+ })), Be = (e) => typeof window > "u" || typeof window.requestAnimationFrame != "function" ? (e(0), 0) : window.requestAnimationFrame(e), $ = (e) => {
93
+ !e || typeof window > "u" || window.cancelAnimationFrame(e);
94
+ }, ye = /(auto|scroll|overlay)/, be = (e) => {
95
+ if (typeof window > "u") return null;
96
+ let t = s.value?.parentElement ?? null;
97
+ for (; t; ) {
98
+ const n = window.getComputedStyle(t), o = e === "x" ? n.overflowX : n.overflowY;
99
+ if (ye.test(o)) return t;
100
+ t = t.parentElement;
101
+ }
102
+ return null;
103
+ }, P = (e) => (e === "x" ? !f.value : !h.value) ? be(e) ?? s.value : s.value, ee = (e) => {
104
+ const t = e.getBoundingClientRect(), n = e.offsetWidth > 0 ? t.width / e.offsetWidth : 1, o = e.offsetHeight > 0 ? t.height / e.offsetHeight : 1;
105
+ return {
106
+ x: Number.isFinite(n) && n > 1e-3 ? n : 1,
107
+ y: Number.isFinite(o) && o > 1e-3 ? o : 1
108
+ };
109
+ }, je = (e, t) => {
110
+ const n = ++Z;
111
+ N(() => {
112
+ if (n !== Z) return;
113
+ const o = s.value;
114
+ if (!o) return;
115
+ const l = o.getBoundingClientRect(), i = q();
116
+ if (e.horizontalScrollElement) {
117
+ const r = l.left + (oe("x", t) + e.contentX * t) * i.x, d = ee(e.horizontalScrollElement);
118
+ e.horizontalScrollElement.scrollLeft += (r - e.clientX) / d.x;
119
+ }
120
+ if (e.verticalScrollElement) {
121
+ const r = l.top + (oe("y", t) + e.contentY * t) * i.y, d = ee(e.verticalScrollElement);
122
+ e.verticalScrollElement.scrollTop += (r - e.clientY) / d.y;
123
+ }
124
+ });
125
+ }, Ge = (e) => {
126
+ x && (clearTimeout(x), x = null), E = e === "smooth" && !Ue && M.value, E && (x = setTimeout(() => {
127
+ E = !1, x = null, J(u.value, !1);
128
+ }, Le));
129
+ }, we = (e, t, n, o = !0) => {
130
+ const l = X(e, u.value.scale, !1);
131
+ c = l, G = !1;
132
+ const i = u.value, r = t === "wheel" || t === "zoom" ? H : null;
133
+ if (H = null, L(i, l)) {
134
+ J(l, E);
135
+ return;
136
+ }
137
+ if (Ge(n), u.value = l, J(l, E), r && i.scale !== l.scale && je(r, l.scale), (!f.value || !h.value) && i.scale !== l.scale && N(() => k("content")), !o) return;
138
+ const d = { ...l };
139
+ b("update:modelValue", d), b("change", d, { source: t });
140
+ }, Qe = () => {
141
+ $(m), m = 0, we(
142
+ c,
143
+ le,
144
+ ie
145
+ );
146
+ }, R = (e, t, n = "auto", o = !0) => {
147
+ t !== "wheel" && t !== "zoom" && (H = null, Z += 1), c = X(
148
+ e,
149
+ c.scale,
150
+ o
151
+ ), le = t, ie = n, G = o, !m && (m = Be(() => {
152
+ m = 0, we(
153
+ c,
154
+ le,
155
+ ie
156
+ );
157
+ }));
158
+ }, q = () => {
159
+ const e = s.value;
160
+ if (!e) return { x: 1, y: 1 };
161
+ const t = e.getBoundingClientRect(), n = e.offsetWidth > 0 ? t.width / e.offsetWidth : 1, o = e.offsetHeight > 0 ? t.height / e.offsetHeight : 1;
162
+ return {
163
+ x: Number.isFinite(n) && n > 1e-3 ? n : 1,
164
+ y: Number.isFinite(o) && o > 1e-3 ? o : 1
165
+ };
166
+ }, Je = (e) => {
167
+ const t = s.value;
168
+ if (!t) return { x: 0, y: 0 };
169
+ if (e && e !== "center" && e.coordinateSpace === "client")
170
+ return { x: e.x, y: e.y };
171
+ const n = t.getBoundingClientRect(), o = q();
172
+ if (e && e !== "center")
173
+ return {
174
+ x: n.left + e.x * o.x,
175
+ y: n.top + e.y * o.y
176
+ };
177
+ const l = P("x") ?? t, i = P("y") ?? t, r = l.getBoundingClientRect(), d = i.getBoundingClientRect(), T = ee(l), A = ee(i);
178
+ return {
179
+ x: r.left + (l.clientLeft + l.clientWidth / 2) * T.x,
180
+ y: d.top + (i.clientTop + i.clientHeight / 2) * A.y
181
+ };
182
+ }, et = (e) => {
183
+ const t = s.value;
184
+ if (!t) return { x: 0, y: 0 };
185
+ const n = t.getBoundingClientRect(), o = q();
186
+ return {
187
+ x: (e.x - n.left) / o.x,
188
+ y: (e.y - n.top) / o.y
189
+ };
190
+ }, tt = (e) => {
191
+ const t = B.value;
192
+ if (!t) return null;
193
+ const n = f.value ? null : be("x"), o = h.value ? null : be("y");
194
+ if (!n && !o) return null;
195
+ const l = t.getBoundingClientRect(), i = q(), r = z(u.value.scale, 1);
196
+ return {
197
+ clientX: e.x,
198
+ clientY: e.y,
199
+ contentX: (e.x - l.left) / (r * i.x),
200
+ contentY: (e.y - l.top) / (r * i.y),
201
+ horizontalScrollElement: n,
202
+ verticalScrollElement: o
203
+ };
204
+ }, te = (e, t = {}, n) => {
205
+ const o = c, l = V(e, o.scale, !0);
206
+ if (l === o.scale) return;
207
+ const i = Je(t.anchor), r = et(i), d = (r.x - o.x) / o.scale, T = (r.y - o.y) / o.scale;
208
+ H = tt(i), R({
209
+ scale: l,
210
+ x: f.value ? r.x - d * l : 0,
211
+ y: h.value ? r.y - T * l : 0
212
+ }, n, t.behavior);
213
+ }, nt = (e, t = {}) => {
214
+ te(e, t, "zoom");
215
+ }, Oe = p(() => 1 + z(a.zoomStep, 0.2)), Ie = (e = {}) => {
216
+ te(c.scale * Oe.value, e, "zoom");
217
+ }, Ce = (e = {}) => {
218
+ te(c.scale / Oe.value, e, "zoom");
219
+ }, ot = (e, t = {}) => {
220
+ R(e, "external", t.behavior);
221
+ }, ne = (e, t, n, o) => {
222
+ if (!a.panEnabled) return;
223
+ let l = f.value ? g(e, 0) : 0, i = h.value ? g(t, 0) : 0;
224
+ if (n.coordinateSpace === "client") {
225
+ const r = q();
226
+ l /= r.x, i /= r.y;
227
+ }
228
+ l === 0 && i === 0 || R({
229
+ ...c,
230
+ x: c.x + l,
231
+ y: c.y + i
232
+ }, o, n.behavior);
233
+ }, at = (e, t, n = {}) => {
234
+ ne(e, t, n, "pan");
235
+ }, He = (e = {}) => {
236
+ R({ ...Ke }, "reset", e.behavior);
237
+ }, xe = () => {
238
+ const e = s.value, t = B.value;
239
+ if (!e || !t) return;
240
+ const n = P("x"), o = P("y"), l = {
241
+ width: n?.clientWidth ?? e.clientWidth,
242
+ height: o?.clientHeight ?? e.clientHeight
243
+ }, i = {
244
+ width: z(a.contentWidth, Math.max(t.offsetWidth, t.scrollWidth)),
245
+ height: z(a.contentHeight, Math.max(t.offsetHeight, t.scrollHeight))
246
+ };
247
+ ge(v.value, l) || (v.value = l, b("update:viewportSize", { ...l })), ge(w.value, i) || (w.value = i, b("update:contentSize", { ...i }));
248
+ }, Se = (e, t, n, o) => o === "start" ? n : o === "end" ? e - n - t : (e - t) / 2, Ee = (e) => Math.min(
249
+ Math.max(0, g(e, 0)),
250
+ Math.max(
251
+ 0,
252
+ Math.min(v.value.width, v.value.height) / 2 - 0.5
253
+ )
254
+ );
255
+ function oe(e, t) {
256
+ const n = e === "x" ? v.value.width : v.value.height, o = (e === "x" ? w.value.width : w.value.height) * t, l = Ee(Y.value.padding);
257
+ return o + l * 2 >= n ? l : Se(
258
+ n,
259
+ o,
260
+ l,
261
+ e === "x" ? Y.value.alignX : Y.value.alignY
262
+ );
263
+ }
264
+ const ze = (e = {}) => {
265
+ xe();
266
+ const t = v.value, n = w.value, o = e.mode ?? a.fitMode, l = t.width > 0 && n.width > 0, i = t.height > 0 && n.height > 0;
267
+ if (o === "width" && !l || o === "height" && !i || o === "contain" && (!l || !i)) return !1;
268
+ const r = Math.max(0, g(e.padding, a.fitPadding)), d = e.alignX ?? a.fitAlignX, T = e.alignY ?? a.fitAlignY;
269
+ Y.value = { padding: r, alignX: d, alignY: T };
270
+ const A = Ee(r), Pe = Math.max(1, t.width - A * 2), St = Math.max(1, t.height - A * 2), Ze = l ? Pe / n.width : Number.POSITIVE_INFINITY, De = i ? St / n.height : Number.POSITIVE_INFINITY, Et = o === "width" ? Ze : o === "height" ? De : Math.min(Ze, De), Te = V(Et, c.scale, !0), zt = n.width * Te, Pt = n.height * Te;
271
+ return R({
272
+ scale: Te,
273
+ x: f.value ? Se(t.width, zt, A, d) : 0,
274
+ y: h.value ? Se(t.height, Pt, A, T) : 0
275
+ }, "fit", e.behavior), !0;
276
+ }, lt = () => {
277
+ M.value || (M.value = !0, b("update:ready", !0));
278
+ }, k = (e) => {
279
+ e === "viewport" && (re = !0), !F && (F = Be(() => {
280
+ F = 0;
281
+ const t = re && a.autoFitOnResize && M.value;
282
+ re = !1, xe(), t && ze({ behavior: "auto" });
283
+ }));
284
+ }, it = (e) => {
285
+ if (e.deltaMode === 1)
286
+ return { x: e.deltaX * _e, y: e.deltaY * _e };
287
+ if (e.deltaMode === 2) {
288
+ const t = P("x")?.getBoundingClientRect(), n = P("y")?.getBoundingClientRect();
289
+ return {
290
+ x: e.deltaX * (t?.width ?? 1),
291
+ y: e.deltaY * (n?.height ?? 1)
292
+ };
293
+ }
294
+ return { x: e.deltaX, y: e.deltaY };
295
+ }, rt = (e, t, n) => {
296
+ const o = window.getComputedStyle(e), l = ye.test(o.overflowX) && e.scrollWidth > e.clientWidth && (t < 0 && e.scrollLeft > 0 || t > 0 && e.scrollLeft + e.clientWidth < e.scrollWidth - 1), i = ye.test(o.overflowY) && e.scrollHeight > e.clientHeight && (n < 0 && e.scrollTop > 0 || n > 0 && e.scrollTop + e.clientHeight < e.scrollHeight - 1);
297
+ return l || i;
298
+ }, ct = (e, t, n) => {
299
+ const o = s.value;
300
+ let l = e instanceof HTMLElement ? e : null;
301
+ for (; l && l !== o; ) {
302
+ if (rt(l, t, n)) return !0;
303
+ l = l.parentElement;
304
+ }
305
+ return !1;
306
+ }, st = (e) => e instanceof Element && !!e.closest('input, textarea, select, [contenteditable="true"], [data-pan-zoom-ignore]'), Ye = (e) => e instanceof Element && !!e.closest(
307
+ 'a[href], button, input, textarea, select, option, label, summary, [contenteditable="true"], [role="button"], [role="link"], [data-pan-zoom-ignore]'
308
+ ), Xe = (e) => {
309
+ if (a.disabled) return;
310
+ const t = it(e), n = e.ctrlKey || e.metaKey;
311
+ if (a.zoomEnabled && (a.wheelZoomMode === "always" || a.wheelZoomMode === "modifier" && n)) {
312
+ if (!e.cancelable) return;
313
+ e.preventDefault();
314
+ const l = t.y || t.x;
315
+ if (l === 0) return;
316
+ const i = z(a.wheelZoomSpeed, 2e-3), r = c.scale * Math.exp(-l * i);
317
+ te(r, {
318
+ anchor: { x: e.clientX, y: e.clientY, coordinateSpace: "client" },
319
+ behavior: "auto"
320
+ }, "wheel");
321
+ return;
322
+ }
323
+ !a.panEnabled || !a.wheelPanEnabled || !a.panOnWheel || n || t.x === 0 && t.y === 0 || t.x !== 0 && !f.value || t.y !== 0 && !h.value || st(e.target) && e.target === document.activeElement || ct(e.target, t.x, t.y) || e.cancelable && (e.preventDefault(), ne(-t.x, -t.y, {
324
+ coordinateSpace: "client",
325
+ behavior: "auto"
326
+ }, "wheel"));
327
+ }, ut = (e) => {
328
+ if (a.disabled || !D.value || S !== null) return;
329
+ const t = e.button === 1, n = e.button === 0 && I.value, o = e.button === 0 && a.panOnPrimaryDrag && !Ye(e.target);
330
+ !t && !n && !o || (e.preventDefault(), S = e.pointerId, ce = e.clientX, se = e.clientY, O.value = !0, s.value?.focus({ preventScroll: !0 }), s.value?.setPointerCapture(e.pointerId), b("pan-start"));
331
+ }, dt = (e) => {
332
+ if (e.pointerId !== S) return;
333
+ e.cancelable && e.preventDefault();
334
+ const t = e.clientX - ce, n = e.clientY - se;
335
+ ce = e.clientX, se = e.clientY, ne(t, n, {
336
+ coordinateSpace: "client",
337
+ behavior: "auto"
338
+ }, "pointer");
339
+ }, ae = (e) => {
340
+ if (S === null || e && e.pointerId !== S) return;
341
+ const t = S;
342
+ S = null, s.value?.hasPointerCapture(t) && s.value.releasePointerCapture(t), O.value && b("pan-end"), O.value = !1;
343
+ }, ft = (e) => {
344
+ if (a.disabled || !a.keyboard || Ye(e.target)) return;
345
+ const t = e.ctrlKey || e.metaKey;
346
+ if (e.key === " ") {
347
+ if (!D.value) return;
348
+ e.preventDefault(), I.value = !0;
349
+ return;
350
+ }
351
+ if (t && (e.key === "+" || e.key === "=")) {
352
+ if (!a.zoomEnabled) return;
353
+ e.preventDefault(), Ie({ behavior: "auto" });
354
+ return;
355
+ }
356
+ if (t && (e.key === "-" || e.key === "_")) {
357
+ if (!a.zoomEnabled) return;
358
+ e.preventDefault(), Ce({ behavior: "auto" });
359
+ return;
360
+ }
361
+ if (t && e.key === "0") {
362
+ if (!a.zoomEnabled && !ve.value) return;
363
+ e.preventDefault(), He({ behavior: "auto" });
364
+ return;
365
+ }
366
+ if (!a.keyboardPanEnabled || !ve.value) return;
367
+ const n = z(a.keyboardPanStep, 40), l = {
368
+ ArrowLeft: [n, 0],
369
+ ArrowRight: [-n, 0],
370
+ ArrowUp: [0, n],
371
+ ArrowDown: [0, -n]
372
+ }[e.key];
373
+ l && (l[0] !== 0 && !f.value || l[1] !== 0 && !h.value || (e.preventDefault(), ne(l[0], l[1], { behavior: "auto" }, "keyboard")));
374
+ }, ht = (e) => {
375
+ e.key === " " && (I.value = !1);
376
+ }, vt = () => {
377
+ I.value = !1;
378
+ }, mt = () => _.value.canZoomIn, pt = () => _.value.canZoomOut, ke = () => {
379
+ b("zoom-availability-change", { ..._.value });
380
+ }, gt = () => s.value?.focus({ preventScroll: !0 }), yt = () => s.value, Ne = (e) => {
381
+ const t = e === "x" ? a.contentWidth : a.contentHeight;
382
+ return typeof t == "number" && Number.isFinite(t) && t > 0 ? t : e === "x" ? w.value.width : w.value.height;
383
+ }, bt = p(() => {
384
+ if (!a.keyboard || a.disabled) return;
385
+ const e = [];
386
+ return a.zoomEnabled && e.push("Control++", "Meta++", "Control+-", "Meta+-", "Control+0", "Meta+0"), a.keyboardPanEnabled && f.value && e.push("ArrowLeft", "ArrowRight"), a.keyboardPanEnabled && h.value && e.push("ArrowUp", "ArrowDown"), e.length > 0 ? e.join(" ") : void 0;
387
+ }), wt = p(() => {
388
+ const e = typeof a.contentWidth == "number" && Number.isFinite(a.contentWidth) && a.contentWidth > 0 ? a.contentWidth : null, t = typeof a.contentHeight == "number" && Number.isFinite(a.contentHeight) && a.contentHeight > 0 ? a.contentHeight : null, n = {
389
+ width: e ? `${e}px` : "max-content",
390
+ minWidth: e || !f.value ? void 0 : "100%",
391
+ height: t ? `${t}px` : void 0,
392
+ left: f.value ? "0px" : `${oe("x", u.value.scale)}px`,
393
+ top: h.value ? "0px" : `${oe("y", u.value.scale)}px`,
394
+ visibility: M.value ? "visible" : "hidden"
395
+ };
396
+ return Me(fe, n) ? fe : (fe = n, n);
397
+ }), xt = p(() => {
398
+ const e = u.value.scale, t = Ee(Y.value.padding), n = Ne("x") * e + t * 2, o = Ne("y") * e + t * 2, l = n <= v.value.width + 0.5 ? v.value.width : n, i = o <= v.value.height + 0.5 ? v.value.height : o, r = {
399
+ width: f.value ? "100%" : `${l}px`,
400
+ minWidth: "100%",
401
+ height: h.value ? "100%" : `${i}px`,
402
+ minHeight: "100%",
403
+ overflowX: f.value ? "hidden" : "visible",
404
+ overflowY: h.value ? "hidden" : "visible",
405
+ cursor: D.value ? O.value ? "grabbing" : I.value ? "grab" : void 0 : void 0,
406
+ touchAction: D.value && a.panOnPrimaryDrag ? "none" : "manipulation"
407
+ };
408
+ return Me(he, r) ? he : (he = r, r);
409
+ }), Fe = () => {
410
+ if (!C) return;
411
+ C.disconnect(), j = /* @__PURE__ */ new WeakMap();
412
+ const e = /* @__PURE__ */ new Set(), t = P("x"), n = P("y");
413
+ t && e.add(t), n && e.add(n), e.forEach((o) => {
414
+ j.set(o, {
415
+ width: o.offsetWidth,
416
+ height: o.offsetHeight
417
+ }), C?.observe(o);
418
+ });
419
+ };
420
+ return At(async () => {
421
+ s.value?.addEventListener("wheel", Xe, { passive: !1 }), typeof ResizeObserver < "u" && (C = new ResizeObserver((e) => {
422
+ let t = !1;
423
+ e.forEach((n) => {
424
+ if (!(n.target instanceof HTMLElement)) return;
425
+ const o = j.get(n.target), l = {
426
+ width: n.target.offsetWidth,
427
+ height: n.target.offsetHeight
428
+ };
429
+ o && !ge(o, l) && (t = !0), j.set(n.target, l);
430
+ }), k(t ? "viewport" : "content");
431
+ }), U = new ResizeObserver(() => k("content")), B.value && U.observe(B.value)), await N(), Fe(), xe(), a.initialFit && (ze({ behavior: "auto" }), Qe()), J(u.value, E), lt(), ke();
432
+ }), Mt(() => {
433
+ s.value?.removeEventListener("wheel", Xe), C?.disconnect(), U?.disconnect(), C = null, U = null, $(m), $(F), m = 0, F = 0, Z += 1, x && clearTimeout(x), x = null, E = !1, H = null, ue = null, Q = null, de = !1, S = null, O.value = !1;
434
+ }), W(
435
+ () => [a.modelValue?.scale, a.modelValue?.x, a.modelValue?.y],
436
+ () => {
437
+ const e = X(a.modelValue, c.scale, !1);
438
+ L(e, c) || ($(m), m = 0, we(e, "external", "auto", !1));
439
+ }
440
+ ), W(
441
+ () => [a.minScale, a.maxScale],
442
+ () => {
443
+ const e = X(c, c.scale, !1);
444
+ L(e, c) || R(e, "external", "auto", !1);
445
+ }
446
+ ), W(
447
+ () => [a.zoomEnabled, a.zoomInEnabled, a.zoomOutEnabled],
448
+ () => {
449
+ !m || !G || c.scale === u.value.scale || ($(m), m = 0, c = u.value, G = !1, H = null, Z += 1);
450
+ }
451
+ ), W(
452
+ () => [
453
+ a.panEnabled,
454
+ a.pointerPanEnabled,
455
+ a.horizontalPanEnabled,
456
+ a.verticalPanEnabled,
457
+ a.disabled
458
+ ],
459
+ () => {
460
+ (!D.value || a.disabled) && (I.value = !1, ae());
461
+ const e = X(c, c.scale, !1);
462
+ L(e, c) || R(e, "external", "auto"), N(() => {
463
+ Fe(), k("content");
464
+ });
465
+ }
466
+ ), W(
467
+ () => [a.fitPadding, a.fitAlignX, a.fitAlignY],
468
+ ([e, t, n]) => {
469
+ Y.value = {
470
+ padding: Math.max(0, g(e, 24)),
471
+ alignX: t,
472
+ alignY: n
473
+ }, N(() => k("content"));
474
+ }
475
+ ), W(
476
+ () => [a.contentWidth, a.contentHeight],
477
+ () => {
478
+ N(() => k("content"));
479
+ }
480
+ ), W(
481
+ [Re, We],
482
+ () => {
483
+ M.value && ke();
484
+ }
485
+ ), $e({
486
+ zoomIn: Ie,
487
+ zoomOut: Ce,
488
+ setScale: nt,
489
+ setTransform: ot,
490
+ panBy: at,
491
+ reset: He,
492
+ fitToContent: ze,
493
+ canZoomIn: mt,
494
+ canZoomOut: pt,
495
+ focus: gt,
496
+ getViewportElement: yt
497
+ }), (e, t) => (Rt(), Wt("div", {
498
+ ref_key: "viewportRef",
499
+ ref: s,
500
+ class: "vlite-pan-zoom-viewport",
501
+ style: Ve(xt.value),
502
+ tabindex: K.disabled ? -1 : 0,
503
+ role: "region",
504
+ "aria-label": K.ariaLabel,
505
+ "aria-keyshortcuts": bt.value,
506
+ onPointerdown: ut,
507
+ onPointermove: dt,
508
+ onPointerup: ae,
509
+ onPointercancel: ae,
510
+ onLostpointercapture: ae,
511
+ onKeydown: ft,
512
+ onKeyup: ht,
513
+ onBlur: vt
514
+ }, [
515
+ Bt("div", {
516
+ ref_key: "contentRef",
517
+ ref: B,
518
+ class: Ot(["vlite-pan-zoom-viewport-content", K.contentClass]),
519
+ style: Ve(wt.value)
520
+ }, [
521
+ It(e.$slots, "default", {
522
+ transform: u.value,
523
+ viewportSize: v.value,
524
+ contentSize: w.value,
525
+ ready: M.value,
526
+ panning: O.value,
527
+ canZoomIn: _.value.canZoomIn,
528
+ canZoomOut: _.value.canZoomOut
529
+ }, void 0, !0)
530
+ ], 6)
531
+ ], 44, Ct));
532
+ }
533
+ });
534
+ export {
535
+ Yt as default
536
+ };
@@ -0,0 +1,2 @@
1
+ export { default as PanZoomViewport } from './PanZoomViewport.vue';
2
+ export type { PanZoomViewportActionOptions, PanZoomViewportAlignment, PanZoomViewportBehavior, PanZoomViewportChangeMeta, PanZoomViewportChangeSource, PanZoomViewportCoordinateSpace, PanZoomViewportExposed, PanZoomViewportFitMode, PanZoomViewportFitOptions, PanZoomViewportPanOptions, PanZoomViewportPoint, PanZoomViewportProps, PanZoomViewportSize, PanZoomViewportSlotScope, PanZoomViewportTransform, PanZoomViewportWheelZoomMode, PanZoomViewportZoomAvailability, PanZoomViewportZoomOptions, } from './types';
@@ -0,0 +1,121 @@
1
+ /** A complete viewport transform in the viewport's local CSS pixel space. */
2
+ export interface PanZoomViewportTransform {
3
+ scale: number;
4
+ x: number;
5
+ y: number;
6
+ }
7
+ /** Unscaled geometry reported by the viewport and slotted content. */
8
+ export interface PanZoomViewportSize {
9
+ width: number;
10
+ height: number;
11
+ }
12
+ export type PanZoomViewportFitMode = 'contain' | 'width' | 'height';
13
+ export type PanZoomViewportAlignment = 'start' | 'center' | 'end';
14
+ export type PanZoomViewportBehavior = 'auto' | 'smooth';
15
+ export type PanZoomViewportCoordinateSpace = 'local' | 'client';
16
+ export type PanZoomViewportWheelZoomMode = 'modifier' | 'always' | 'disabled';
17
+ export type PanZoomViewportChangeSource = 'external' | 'fit' | 'keyboard' | 'pan' | 'pointer' | 'reset' | 'wheel' | 'zoom';
18
+ export interface PanZoomViewportPoint {
19
+ x: number;
20
+ y: number;
21
+ coordinateSpace?: PanZoomViewportCoordinateSpace;
22
+ }
23
+ export interface PanZoomViewportActionOptions {
24
+ behavior?: PanZoomViewportBehavior;
25
+ }
26
+ export interface PanZoomViewportZoomOptions extends PanZoomViewportActionOptions {
27
+ /** Defaults to the visual center of the viewport. */
28
+ anchor?: 'center' | PanZoomViewportPoint;
29
+ }
30
+ export interface PanZoomViewportPanOptions extends PanZoomViewportActionOptions {
31
+ /** `client` deltas are normalized through any ancestor CSS transforms. */
32
+ coordinateSpace?: PanZoomViewportCoordinateSpace;
33
+ }
34
+ export interface PanZoomViewportFitOptions extends PanZoomViewportActionOptions {
35
+ mode?: PanZoomViewportFitMode;
36
+ padding?: number;
37
+ alignX?: PanZoomViewportAlignment;
38
+ alignY?: PanZoomViewportAlignment;
39
+ }
40
+ export interface PanZoomViewportChangeMeta {
41
+ source: PanZoomViewportChangeSource;
42
+ }
43
+ export interface PanZoomViewportZoomAvailability {
44
+ canZoomIn: boolean;
45
+ canZoomOut: boolean;
46
+ }
47
+ export interface PanZoomViewportProps {
48
+ /** Reactive transform. Omit it to use the component as an uncontrolled viewport. */
49
+ modelValue?: PanZoomViewportTransform;
50
+ /** Optional fixed, unscaled content width. Natural content width is used when omitted. */
51
+ contentWidth?: number;
52
+ /** Optional fixed, unscaled content height. Natural content height is used when omitted. */
53
+ contentHeight?: number;
54
+ minScale?: number;
55
+ maxScale?: number;
56
+ /** Multiplicative step used by zoom-in and zoom-out controls. */
57
+ zoomStep?: number;
58
+ /** Exponential wheel sensitivity. Smaller values zoom more slowly. */
59
+ wheelZoomSpeed?: number;
60
+ /** Local CSS pixels moved by each arrow-key press. */
61
+ keyboardPanStep?: number;
62
+ /** Default inset used by fit-to-content. */
63
+ fitPadding?: number;
64
+ fitMode?: PanZoomViewportFitMode;
65
+ fitAlignX?: PanZoomViewportAlignment;
66
+ fitAlignY?: PanZoomViewportAlignment;
67
+ /** Fit once after the initial content measurement without animating. */
68
+ initialFit?: boolean;
69
+ /** Re-apply the configured fit when the viewport itself resizes. */
70
+ autoFitOnResize?: boolean;
71
+ /** Enable wheel, keyboard, and controller-driven zoom interactions. */
72
+ zoomEnabled?: boolean;
73
+ /** Enable requests that increase scale, subject to the maximum bound. */
74
+ zoomInEnabled?: boolean;
75
+ /** Enable requests that decrease scale, subject to the minimum bound. */
76
+ zoomOutEnabled?: boolean;
77
+ /** Master switch for all component-owned transform translation. */
78
+ panEnabled?: boolean;
79
+ /** Enable Space-, middle-button-, and configured primary-button drag panning. */
80
+ pointerPanEnabled?: boolean;
81
+ /** Enable component-owned translation from ordinary wheel/trackpad input. */
82
+ wheelPanEnabled?: boolean;
83
+ /** Enable component-owned translation from arrow-key input. */
84
+ keyboardPanEnabled?: boolean;
85
+ /** Enable component-owned horizontal transform translation. */
86
+ horizontalPanEnabled?: boolean;
87
+ /** Enable component-owned vertical transform translation. */
88
+ verticalPanEnabled?: boolean;
89
+ /** Pan on ordinary wheel/two-finger trackpad input. */
90
+ panOnWheel?: boolean;
91
+ /** Modifier-only matches Figma-style Ctrl/Command + wheel and trackpad pinch. */
92
+ wheelZoomMode?: PanZoomViewportWheelZoomMode;
93
+ /** Allow direct primary-button/touch drag in addition to Space-drag and middle-drag. */
94
+ panOnPrimaryDrag?: boolean;
95
+ keyboard?: boolean;
96
+ disabled?: boolean;
97
+ ariaLabel?: string;
98
+ contentClass?: string;
99
+ }
100
+ export interface PanZoomViewportSlotScope {
101
+ transform: PanZoomViewportTransform;
102
+ viewportSize: PanZoomViewportSize;
103
+ contentSize: PanZoomViewportSize;
104
+ ready: boolean;
105
+ panning: boolean;
106
+ canZoomIn: boolean;
107
+ canZoomOut: boolean;
108
+ }
109
+ export interface PanZoomViewportExposed {
110
+ zoomIn: (options?: PanZoomViewportZoomOptions) => void;
111
+ zoomOut: (options?: PanZoomViewportZoomOptions) => void;
112
+ setScale: (scale: number, options?: PanZoomViewportZoomOptions) => void;
113
+ setTransform: (transform: PanZoomViewportTransform, options?: PanZoomViewportActionOptions) => void;
114
+ panBy: (deltaX: number, deltaY: number, options?: PanZoomViewportPanOptions) => void;
115
+ reset: (options?: PanZoomViewportActionOptions) => void;
116
+ fitToContent: (options?: PanZoomViewportFitOptions) => boolean;
117
+ canZoomIn: () => boolean;
118
+ canZoomOut: () => boolean;
119
+ focus: () => void;
120
+ getViewportElement: () => HTMLElement | null;
121
+ }
@@ -6,6 +6,7 @@ declare function __VLS_template(): {
6
6
  scale: number;
7
7
  containerWidth: number;
8
8
  targetWidth: number;
9
+ ready: boolean;
9
10
  }): any;
10
11
  };
11
12
  refs: {
@@ -18,9 +19,11 @@ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
18
19
  declare const __VLS_component: import('vue').DefineComponent<ScaleGeneratorProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
19
20
  "update:scale": (value: number) => any;
20
21
  "update:containerWidth": (value: number) => any;
22
+ "update:ready": (value: boolean) => any;
21
23
  }, string, import('vue').PublicProps, Readonly<ScaleGeneratorProps> & Readonly<{
22
24
  "onUpdate:scale"?: (value: number) => any;
23
25
  "onUpdate:containerWidth"?: (value: number) => any;
26
+ "onUpdate:ready"?: (value: boolean) => any;
24
27
  }>, {
25
28
  maxWidth: number;
26
29
  contentClass: string;