vlite3 1.2.5 → 1.2.8

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 (53) hide show
  1. package/README.md +5 -1
  2. package/components/Barcode/Barcode.vue.d.ts +1 -1
  3. package/components/Button.vue.js +18 -18
  4. package/components/Chart/GanttChart.vue.d.ts +67 -0
  5. package/components/Chart/GanttChart.vue.js +7 -0
  6. package/components/Chart/GanttChart.vue2.js +911 -0
  7. package/components/Chart/SpeedometerChart.vue.d.ts +54 -0
  8. package/components/Chart/SpeedometerChart.vue.js +558 -0
  9. package/components/Chart/SpeedometerChart.vue2.js +4 -0
  10. package/components/Chart/index.d.ts +3 -1
  11. package/components/Chart/types.d.ts +106 -0
  12. package/components/Chip/Chip.vue.js +10 -9
  13. package/components/Chip/types.d.ts +1 -1
  14. package/components/ChoiceBox/ChoiceBox.vue.d.ts +46 -1
  15. package/components/ChoiceBox/ChoiceBox.vue.js +274 -91
  16. package/components/ChoiceBox/index.d.ts +1 -1
  17. package/components/ColorPicker/ColorPicker.vue.js +1 -1
  18. package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
  19. package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
  20. package/components/DataTable/DataTableHeader.vue.js +33 -30
  21. package/components/Dropdown/Dropdown.vue.d.ts +2 -0
  22. package/components/Dropdown/Dropdown.vue.js +35 -30
  23. package/components/Form/Form.vue.d.ts +10 -1
  24. package/components/Form/Form.vue.js +1 -1
  25. package/components/Form/Form.vue2.js +146 -132
  26. package/components/ImageComparison/ImageComparison.vue.d.ts +29 -0
  27. package/components/ImageComparison/ImageComparison.vue.js +126 -0
  28. package/components/ImageComparison/ImageComparison.vue2.js +4 -0
  29. package/components/ImageComparison/index.d.ts +1 -0
  30. package/components/ImportData/ImportData.vue.js +1 -1
  31. package/components/NavbarCommandPalette.vue.js +1 -1
  32. package/components/OTPInput/OTPInput.vue.d.ts +18 -0
  33. package/components/OTPInput/OTPInput.vue.js +127 -82
  34. package/components/PricingPlan/PricingPlanItem.vue.js +19 -19
  35. package/components/Radio.vue.d.ts +41 -0
  36. package/components/Radio.vue.js +97 -0
  37. package/components/Radio.vue2.js +4 -0
  38. package/components/RadioGroup.vue.d.ts +38 -0
  39. package/components/RadioGroup.vue.js +37 -0
  40. package/components/RadioGroup.vue2.js +4 -0
  41. package/components/Screen/ScreenFilter.vue.js +25 -25
  42. package/components/SidePanel.vue.js +3 -3
  43. package/components/SidePanel.vue2.js +1 -1
  44. package/components/Slider.vue.d.ts +7 -0
  45. package/components/Slider.vue.js +194 -120
  46. package/components/StatusChip/status-map.js +13 -0
  47. package/components/Timeline/Timeline.vue.d.ts +1 -1
  48. package/components/index.d.ts +1 -1
  49. package/index.d.ts +3 -0
  50. package/index.js +138 -128
  51. package/package.json +1 -1
  52. package/style.css +66 -26
  53. package/types/form.type.d.ts +23 -0
@@ -0,0 +1,911 @@
1
+ import { defineComponent as Ye, ref as k, computed as p, onMounted as et, watch as He, onUnmounted as tt, openBlock as r, createElementBlock as i, createElementVNode as s, createStaticVNode as ot, createCommentVNode as h, normalizeStyle as D, Fragment as $, renderList as L, normalizeClass as xe, toDisplayString as b, unref as E, withDirectives as nt, vShow as lt, createBlock as at, Teleport as st, createTextVNode as ze, nextTick as ke } from "vue";
2
+ import { CHART_COLORS as rt, getColor as it, animateProgress as ut } from "./utils.js";
3
+ const ct = {
4
+ key: 0,
5
+ class: "vlite-gantt-toolbar"
6
+ }, dt = {
7
+ key: 0,
8
+ class: "vlite-gantt-zoom-controls"
9
+ }, vt = ["disabled"], ft = ["disabled"], gt = { class: "vlite-gantt-wrapper" }, ht = ["onClick"], yt = { class: "text-xs font-bold text-foreground uppercase tracking-wide" }, mt = { class: "vlite-gantt-group-count" }, xt = ["onClick"], kt = { class: "truncate text-xs font-medium text-foreground" }, pt = {
10
+ key: 0,
11
+ class: "vlite-gantt-progress-badge"
12
+ }, wt = ["width", "height"], bt = ["x1", "x2", "y2"], $t = ["x", "y"], Dt = ["x", "y"], Mt = ["width", "height"], St = ["id"], Lt = ["stop-color"], Ct = ["stop-color"], _t = ["id"], Ht = ["stop-color"], zt = ["stop-color"], Et = ["x1", "x2", "y2"], Tt = ["y1", "x2", "y2"], Wt = ["y", "width", "height"], It = ["d"], Bt = ["d"], Rt = ["d", "fill", "stroke", "opacity", "onMouseenter", "onMousemove", "onClick"], At = ["d", "fill"], Pt = ["d", "fill"], Zt = ["d", "fill"], Ot = ["x", "y", "width", "height", "onMouseenter", "onMousemove", "onMousedown", "onClick"], Ft = ["x", "y", "width", "height", "rx", "ry"], Gt = ["x", "y", "height"], qt = ["x", "y", "height"], Xt = ["x", "y", "fill", "opacity"], jt = { key: 1 }, Nt = ["x1", "x2", "y2", "stroke"], Vt = ["cx", "fill"], Kt = ["x", "fill"], Ut = { class: "font-semibold text-xs mb-1.5" }, Qt = { class: "flex items-center gap-1.5 text-[11px] text-muted-foreground mb-1" }, Jt = { class: "text-[10px] text-muted-foreground" }, Yt = {
13
+ key: 0,
14
+ class: "mt-1.5 flex items-center gap-2"
15
+ }, eo = { class: "vlite-gantt-tooltip-progress-track" }, to = { class: "text-[10px] font-semibold" }, oo = {
16
+ key: 1,
17
+ class: "text-[10px] text-muted-foreground mt-1 opacity-60"
18
+ }, no = {
19
+ key: 2,
20
+ class: "text-[9px] text-muted-foreground mt-1.5 opacity-40"
21
+ }, lo = 16, Y = 5, ao = 4, Ee = 8, io = /* @__PURE__ */ Ye({
22
+ __name: "GanttChart",
23
+ props: {
24
+ tasks: {},
25
+ viewMode: { default: "week" },
26
+ height: { default: 0 },
27
+ rowHeight: { default: 44 },
28
+ barRadius: { default: 6 },
29
+ barHeight: { default: 28 },
30
+ sidebarWidth: { default: 220 },
31
+ showGrid: { type: Boolean, default: !0 },
32
+ showTooltip: { type: Boolean, default: !0 },
33
+ showLabels: { type: Boolean, default: !0 },
34
+ showProgress: { type: Boolean, default: !0 },
35
+ showDependencies: { type: Boolean, default: !0 },
36
+ showTodayLine: { type: Boolean, default: !0 },
37
+ showHeader: { type: Boolean, default: !0 },
38
+ animate: { type: Boolean, default: !0 },
39
+ colors: { default: () => rt },
40
+ todayColor: { default: "var(--color-danger)" },
41
+ locale: { default: "en-US" },
42
+ draggable: { type: Boolean, default: !0 },
43
+ cascadeDependencies: { type: Boolean, default: !1 },
44
+ zoom: { type: Boolean, default: !0 }
45
+ },
46
+ emits: ["task-click", "task-hover", "task-update"],
47
+ setup(u, { emit: Te }) {
48
+ const c = u, P = Te;
49
+ function pe(t) {
50
+ return t instanceof Date ? new Date(t.getTime()) : new Date(t);
51
+ }
52
+ function q(t, o) {
53
+ return (o.getTime() - t.getTime()) / 864e5;
54
+ }
55
+ function y(t, o) {
56
+ const e = new Date(t);
57
+ return e.setDate(e.getDate() + o), e;
58
+ }
59
+ function We(t) {
60
+ const o = new Date(t), e = o.getDay();
61
+ return o.setDate(o.getDate() - (e === 0 ? 6 : e - 1)), o.setHours(0, 0, 0, 0), o;
62
+ }
63
+ function Ie(t) {
64
+ return new Date(t.getFullYear(), t.getMonth(), 1);
65
+ }
66
+ const X = k(), C = k(), ee = k(800);
67
+ let te = null;
68
+ function Be() {
69
+ X.value && (te = new ResizeObserver((t) => {
70
+ ee.value = t[0].contentRect.width || 800;
71
+ }), te.observe(X.value), ee.value = X.value.clientWidth || 800);
72
+ }
73
+ const _ = p(
74
+ () => c.tasks.map((t, o) => ({
75
+ ...t,
76
+ _start: pe(t.start),
77
+ _end: pe(t.end),
78
+ _color: t.color ?? it(c.colors, o),
79
+ _index: o
80
+ }))
81
+ ), j = k(/* @__PURE__ */ new Set());
82
+ function Re(t) {
83
+ const o = new Set(j.value);
84
+ o.has(t) ? o.delete(t) : o.add(t), j.value = o;
85
+ }
86
+ const oe = p(() => {
87
+ const t = /* @__PURE__ */ new Map(), o = [];
88
+ for (const e of _.value)
89
+ e.group ? (t.has(e.group) || t.set(e.group, []), t.get(e.group).push(e)) : o.push(e);
90
+ return { grouped: t, ungrouped: o };
91
+ }), Z = p(() => {
92
+ const t = [];
93
+ for (const [o, e] of oe.value.grouped)
94
+ if (t.push({ type: "group-header", group: o }), !j.value.has(o)) for (const n of e) t.push({ type: "task", group: o, task: n });
95
+ for (const o of oe.value.ungrouped) t.push({ type: "task", task: o });
96
+ return t;
97
+ }), T = p(() => {
98
+ if (!_.value.length) {
99
+ const n = /* @__PURE__ */ new Date();
100
+ return { start: y(n, -7), end: y(n, 30) };
101
+ }
102
+ let t = _.value[0]._start, o = _.value[0]._end;
103
+ for (const n of _.value)
104
+ n._start < t && (t = n._start), n._end > o && (o = n._end);
105
+ const e = c.viewMode === "day" ? 2 : c.viewMode === "week" ? 5 : 15;
106
+ return { start: y(t, -e), end: y(o, e) };
107
+ }), N = p(() => Math.max(1, q(T.value.start, T.value.end))), m = k(1);
108
+ let W = null;
109
+ function Ae(t) {
110
+ if (c.zoom && (t.ctrlKey || t.metaKey)) {
111
+ t.preventDefault();
112
+ const o = C.value;
113
+ if (!o) return;
114
+ const e = o.getBoundingClientRect(), n = t.clientX - e.left, d = (W !== null ? W : o.scrollLeft) + n, f = m.value;
115
+ let v = f * Math.exp(-t.deltaY * 5e-3);
116
+ if (v = Math.max(0.2, Math.min(v, 5)), v === f) return;
117
+ m.value = v;
118
+ const x = v / f;
119
+ W = d * x - n, ke(() => {
120
+ C.value && W !== null && (C.value.scrollLeft = W, W = null);
121
+ });
122
+ }
123
+ }
124
+ function Pe() {
125
+ const t = C.value;
126
+ if (!t) {
127
+ m.value = Math.min(m.value + 0.2, 5);
128
+ return;
129
+ }
130
+ const o = t.clientWidth / 2, e = t.scrollLeft + o, n = m.value;
131
+ m.value = Math.min(n + 0.2, 5);
132
+ const a = m.value / n;
133
+ ke(() => t.scrollLeft = e * a - o);
134
+ }
135
+ function Ze() {
136
+ const t = C.value;
137
+ if (!t) {
138
+ m.value = Math.max(m.value - 0.2, 0.2);
139
+ return;
140
+ }
141
+ const o = t.clientWidth / 2, e = t.scrollLeft + o, n = m.value;
142
+ m.value = Math.max(n - 0.2, 0.2);
143
+ const a = m.value / n;
144
+ ke(() => t.scrollLeft = e * a - o);
145
+ }
146
+ const H = p(() => ({ day: 40, week: 120, month: 180 })[c.viewMode] * m.value), ne = p(() => {
147
+ const t = [], { start: o, end: e } = T.value;
148
+ if (c.viewMode === "day") {
149
+ let n = new Date(o);
150
+ n.setHours(0, 0, 0, 0);
151
+ let a = 0;
152
+ for (; n <= e; )
153
+ t.push({
154
+ label: n.toLocaleDateString(c.locale, { day: "numeric" }),
155
+ sublabel: n.toLocaleDateString(c.locale, { weekday: "short" }),
156
+ x: a * H.value,
157
+ width: H.value
158
+ }), n = y(n, 1), a++;
159
+ } else if (c.viewMode === "week") {
160
+ let n = We(o), a = 0;
161
+ for (; n <= e; )
162
+ t.push({
163
+ label: n.toLocaleDateString(c.locale, { month: "short", day: "numeric" }),
164
+ sublabel: `W${Oe(n)}`,
165
+ x: a * H.value,
166
+ width: H.value
167
+ }), n = y(n, 7), a++;
168
+ } else {
169
+ let n = Ie(o), a = 0;
170
+ for (; n <= e; )
171
+ t.push({
172
+ label: n.toLocaleDateString(c.locale, { month: "long" }),
173
+ sublabel: String(n.getFullYear()),
174
+ x: a * H.value,
175
+ width: H.value
176
+ }), n = new Date(n.getFullYear(), n.getMonth() + 1, 1), a++;
177
+ }
178
+ return t;
179
+ });
180
+ function Oe(t) {
181
+ const o = new Date(t.getTime());
182
+ o.setHours(0, 0, 0, 0), o.setDate(o.getDate() + 3 - (o.getDay() + 6) % 7);
183
+ const e = new Date(o.getFullYear(), 0, 4);
184
+ return 1 + Math.round(((o.getTime() - e.getTime()) / 864e5 - 3 + (e.getDay() + 6) % 7) / 7);
185
+ }
186
+ const M = p(() => ne.value.length * H.value), I = p(() => c.showHeader ? 56 : 0), O = p(() => {
187
+ const t = Z.value.length * c.rowHeight;
188
+ return Math.max(c.height || t, t);
189
+ });
190
+ function le(t) {
191
+ return q(T.value.start, t) / N.value * M.value;
192
+ }
193
+ function ae(t) {
194
+ return t / M.value * N.value;
195
+ }
196
+ const w = p(() => {
197
+ const t = Q.value;
198
+ return Z.value.reduce((o, e, n) => {
199
+ if (e.type !== "task" || !e.task) return o;
200
+ const a = e.task, d = le(a._start), f = le(a._end), v = Math.max(8, f - d), x = v * t, S = n * c.rowHeight + (c.rowHeight - c.barHeight) / 2, he = a.progress != null ? v * Math.min(100, a.progress) / 100 * t : 0;
201
+ return o.push({ task: a, x: d, y: S, fullW: v, w: x, progressW: he, rowIndex: n }), o;
202
+ }, []);
203
+ }), Fe = p(() => {
204
+ if (!c.showDependencies) return [];
205
+ const t = /* @__PURE__ */ new Map();
206
+ for (const e of w.value) t.set(e.task.id, e);
207
+ const o = [];
208
+ for (const e of w.value)
209
+ if (e.task.dependencies?.length)
210
+ for (const n of e.task.dependencies) {
211
+ const a = t.get(n);
212
+ if (!a) continue;
213
+ const d = a.x + a.fullW, f = a.y + c.barHeight / 2, v = e.x, x = e.y + c.barHeight / 2;
214
+ o.push({ d: Ge(d, f, v, x), ad: qe(v, x) });
215
+ }
216
+ return o;
217
+ });
218
+ function Ge(t, o, e, n) {
219
+ const a = lo, d = ao;
220
+ if (e > t + a * 2) {
221
+ if (Math.abs(o - n) < 2) return `M ${t} ${o} L ${e} ${n}`;
222
+ const v = t + (e - t) / 2;
223
+ return se([[t, o], [v, o], [v, n], [e, n]], d);
224
+ }
225
+ const f = t + a;
226
+ if (Math.abs(o - n) < c.rowHeight * 0.5) {
227
+ const v = Math.max(o, n) + c.barHeight / 2 + a;
228
+ return se([[t, o], [f, o], [f, v], [e - a, v], [e - a, n], [e, n]], d);
229
+ }
230
+ return se([[t, o], [f, o], [f, n], [e, n]], d);
231
+ }
232
+ function se(t, o) {
233
+ if (t.length < 2) return "";
234
+ if (t.length === 2) return `M ${t[0][0]} ${t[0][1]} L ${t[1][0]} ${t[1][1]}`;
235
+ const e = [`M ${t[0][0]} ${t[0][1]}`];
236
+ for (let a = 1; a < t.length - 1; a++) {
237
+ const [d, f] = t[a - 1], [v, x] = t[a], [S, he] = t[a + 1], Se = v - d, Le = x - f, Ce = S - v, _e = he - x, ye = Math.hypot(Se, Le), me = Math.hypot(Ce, _e), J = Math.min(o, ye / 2, me / 2);
238
+ e.push(`L ${v - Se / ye * J} ${x - Le / ye * J}`), e.push(`Q ${v} ${x} ${v + Ce / me * J} ${x + _e / me * J}`);
239
+ }
240
+ const n = t[t.length - 1];
241
+ return e.push(`L ${n[0]} ${n[1]}`), e.join(" ");
242
+ }
243
+ function qe(t, o) {
244
+ return `M ${t} ${o} L ${t - Y} ${o - Y * 0.6} L ${t - Y} ${o + Y * 0.6} Z`;
245
+ }
246
+ const F = p(() => {
247
+ const t = /* @__PURE__ */ new Date();
248
+ return t.setHours(12, 0, 0, 0), le(t);
249
+ }), V = p(() => {
250
+ const t = /* @__PURE__ */ new Date();
251
+ return t >= T.value.start && t <= T.value.end;
252
+ });
253
+ function Xe() {
254
+ !C.value || !V.value || C.value.scrollTo({ left: Math.max(0, F.value - (ee.value - c.sidebarWidth) / 2), behavior: "smooth" });
255
+ }
256
+ let l = {
257
+ active: !1,
258
+ barIndex: -1,
259
+ taskId: "",
260
+ mode: "move",
261
+ startMouseX: 0,
262
+ pxDelta: 0,
263
+ origStart: null,
264
+ origEnd: null,
265
+ affectedIds: /* @__PURE__ */ new Set(),
266
+ // cascade set
267
+ rafId: 0
268
+ };
269
+ const B = k(!1), G = k(""), re = k(null), K = k("default"), U = k([]), z = k(null);
270
+ function je(t, o) {
271
+ U.value[o] = t;
272
+ }
273
+ function Ne(t) {
274
+ const o = /* @__PURE__ */ new Set();
275
+ if (!c.cascadeDependencies) return o;
276
+ const e = [t];
277
+ for (; e.length; ) {
278
+ const n = e.shift();
279
+ for (const a of _.value)
280
+ a.dependencies?.includes(n) && !o.has(a.id) && (o.add(a.id), e.push(a.id));
281
+ }
282
+ return o;
283
+ }
284
+ function we(t, o) {
285
+ if (!c.draggable || o.task.milestone) return "move";
286
+ const e = t.currentTarget.closest("svg");
287
+ if (!e) return "move";
288
+ const n = t.clientX - e.getBoundingClientRect().left;
289
+ return n < o.x + Ee ? "resize-left" : n > o.x + o.fullW - Ee ? "resize-right" : "move";
290
+ }
291
+ function Ve(t, o) {
292
+ if (!c.draggable) return;
293
+ const e = w.value[o];
294
+ if (!e || e.task.milestone) return;
295
+ t.preventDefault(), t.stopPropagation();
296
+ const n = we(t, e);
297
+ l.active = !0, l.barIndex = o, l.taskId = e.task.id, l.mode = n, l.startMouseX = t.clientX, l.pxDelta = 0, l.origStart = new Date(e.task._start), l.origEnd = new Date(e.task._end), l.affectedIds = n === "move" ? Ne(e.task.id) : /* @__PURE__ */ new Set(), B.value = !0, G.value = e.task.id, g.value = null, R.value = o, document.addEventListener("mousemove", ie), document.addEventListener("mouseup", ue), document.body.style.cursor = n === "move" ? "grabbing" : "ew-resize", document.body.style.userSelect = "none";
298
+ }
299
+ function ie(t) {
300
+ if (l.active) {
301
+ if (l.pxDelta = t.clientX - l.startMouseX, l.mode !== "move" && l.origStart && l.origEnd) {
302
+ const o = q(l.origStart, l.origEnd), e = ae(l.pxDelta);
303
+ l.mode === "resize-left" && e >= o - 0.5 && (l.pxDelta = (o - 0.5) / N.value * M.value), l.mode === "resize-right" && -e >= o - 0.5 && (l.pxDelta = -(o - 0.5) / N.value * M.value);
304
+ }
305
+ cancelAnimationFrame(l.rafId), l.rafId = requestAnimationFrame(Ke);
306
+ }
307
+ }
308
+ function Ke() {
309
+ const t = l.pxDelta, o = U.value[l.barIndex];
310
+ if (o) {
311
+ if (l.mode === "move") {
312
+ if (o.style.transform = `translateX(${t}px)`, l.affectedIds.size > 0) {
313
+ for (let e = 0; e < w.value.length; e++)
314
+ if (l.affectedIds.has(w.value[e].task.id)) {
315
+ const n = U.value[e];
316
+ n && (n.style.transform = `translateX(${t}px)`);
317
+ }
318
+ }
319
+ } else l.mode === "resize-right" ? (o.style.transform = "translateX(0px)", w.value[l.barIndex] && o.setAttribute("data-resize-px", String(t))) : l.mode === "resize-left" && (o.style.transform = `translateX(${t}px)`, w.value[l.barIndex] && o.setAttribute("data-resize-px", String(-t)));
320
+ if (z.value && l.origStart && l.origEnd) {
321
+ const e = ae(t), n = { month: "short", day: "numeric" };
322
+ let a, d;
323
+ l.mode === "move" ? (a = y(l.origStart, e), d = y(l.origEnd, e)) : l.mode === "resize-left" ? (a = y(l.origStart, e), d = l.origEnd) : (a = l.origStart, d = y(l.origEnd, e));
324
+ const f = w.value[l.barIndex];
325
+ if (f) {
326
+ const v = l.mode === "move" ? f.x + f.fullW / 2 + t : f.x + f.fullW / 2;
327
+ z.value.style.display = "";
328
+ const x = z.value.querySelector("rect"), S = z.value.querySelector("text");
329
+ x && (x.setAttribute("x", String(v - 62)), x.setAttribute("y", String(f.y - 20))), S && (S.setAttribute("x", String(v)), S.setAttribute("y", String(f.y - 10)), S.textContent = `${a.toLocaleDateString(c.locale, n)} — ${d.toLocaleDateString(c.locale, n)}`);
330
+ }
331
+ }
332
+ }
333
+ }
334
+ function ue() {
335
+ if (!l.active) return;
336
+ document.removeEventListener("mousemove", ie), document.removeEventListener("mouseup", ue), document.body.style.cursor = "", document.body.style.userSelect = "", cancelAnimationFrame(l.rafId);
337
+ const t = ae(l.pxDelta), o = Math.round(t * 2) / 2;
338
+ if (Math.abs(o) > 0.1 && l.origStart && l.origEnd) {
339
+ const e = _.value.find((n) => n.id === l.taskId);
340
+ if (e) {
341
+ let n, a;
342
+ if (l.mode === "move" ? (n = y(l.origStart, o), a = y(l.origEnd, o)) : l.mode === "resize-left" ? (n = y(l.origStart, o), a = new Date(l.origEnd)) : (n = new Date(l.origStart), a = y(l.origEnd, o)), P("task-update", e, { start: n, end: a }), l.mode === "move" && l.affectedIds.size > 0)
343
+ for (const d of l.affectedIds) {
344
+ const f = _.value.find((v) => v.id === d);
345
+ f && P("task-update", f, {
346
+ start: y(f._start, o),
347
+ end: y(f._end, o)
348
+ });
349
+ }
350
+ }
351
+ }
352
+ for (const e of U.value)
353
+ e && (e.style.transform = "", e.removeAttribute("data-resize-px"));
354
+ z.value && (z.value.style.display = "none"), l.active = !1, l.barIndex = -1, l.taskId = "", l.pxDelta = 0, l.origStart = null, l.origEnd = null, l.affectedIds.clear(), B.value = !1, G.value = "", R.value = null;
355
+ }
356
+ function be(t, o) {
357
+ if (l.active || !c.draggable || o.task.milestone) {
358
+ K.value = l.active ? "grabbing" : "pointer";
359
+ return;
360
+ }
361
+ K.value = we(t, o) === "move" ? "grab" : "ew-resize";
362
+ }
363
+ const Q = k(c.animate ? 0 : 1);
364
+ let ce = null;
365
+ function de() {
366
+ ce?.(), Q.value = 0, ce = ut(900, (t) => Q.value = t);
367
+ }
368
+ et(() => {
369
+ Be(), c.animate && de();
370
+ }), He(() => c.viewMode, () => {
371
+ m.value = 1, c.animate && de();
372
+ }), He(() => c.tasks.length, () => {
373
+ c.animate && de();
374
+ }), tt(() => {
375
+ ce?.(), te?.disconnect(), document.removeEventListener("mousemove", ie), document.removeEventListener("mouseup", ue), cancelAnimationFrame(l.rafId);
376
+ });
377
+ function ve(t, o, e, n, a) {
378
+ const d = Math.min(a, e / 2, n / 2);
379
+ return d <= 0 || e <= 0 ? `M${t},${o}h${e}v${n}h${-e}Z` : `M${t + d},${o}h${e - 2 * d}q${d},0 ${d},${d}v${n - 2 * d}q0,${d} ${-d},${d}h${-(e - 2 * d)}q${-d},0 ${-d},${-d}v${-(n - 2 * d)}q0,${-d} ${d},${-d}Z`;
380
+ }
381
+ function Ue(t, o, e) {
382
+ return `M${t},${o - e}L${t + e},${o}L${t},${o + e}L${t - e},${o}Z`;
383
+ }
384
+ const g = k(null), R = k(null);
385
+ function $e(t, o) {
386
+ if (!c.showTooltip || l.active) return;
387
+ re.value = o, R.value = o;
388
+ const e = w.value[o];
389
+ if (!e) return;
390
+ P("task-hover", e.task);
391
+ const n = e.task;
392
+ g.value = {
393
+ x: t.clientX,
394
+ y: t.clientY,
395
+ task: n,
396
+ startStr: n._start.toLocaleDateString(c.locale, { month: "short", day: "numeric", year: "numeric" }),
397
+ endStr: n._end.toLocaleDateString(c.locale, { month: "short", day: "numeric", year: "numeric" })
398
+ }, be(t, e);
399
+ }
400
+ function De(t, o) {
401
+ if (l.active) return;
402
+ g.value && (g.value = { ...g.value, x: t.clientX, y: t.clientY });
403
+ const e = w.value[o];
404
+ e && be(t, e);
405
+ }
406
+ function Me() {
407
+ l.active || (g.value = null, R.value = null, re.value = null, K.value = "default", P("task-hover", null));
408
+ }
409
+ function fe(t) {
410
+ l.active || P("task-click", t);
411
+ }
412
+ const ge = k();
413
+ function Qe(t) {
414
+ ge.value && (ge.value.scrollTop = t.target.scrollTop);
415
+ }
416
+ const A = Math.random().toString(36).slice(2, 7);
417
+ function Je(t, o) {
418
+ const e = Math.ceil(q(t, o));
419
+ if (e <= 1) return "1 day";
420
+ if (e < 7) return `${e} days`;
421
+ const n = Math.floor(e / 7), a = e % 7;
422
+ return a === 0 ? `${n} week${n > 1 ? "s" : ""}` : `${n}w ${a}d`;
423
+ }
424
+ return (t, o) => (r(), i("div", {
425
+ ref_key: "containerRef",
426
+ ref: X,
427
+ class: "vlite-gantt-chart w-full select-none"
428
+ }, [
429
+ u.showTodayLine && V.value || u.zoom ? (r(), i("div", ct, [
430
+ u.zoom ? (r(), i("div", dt, [
431
+ s("button", {
432
+ class: "vlite-gantt-btn",
433
+ onClick: Ze,
434
+ disabled: m.value <= 0.4
435
+ }, [...o[0] || (o[0] = [
436
+ s("svg", {
437
+ width: "12",
438
+ height: "12",
439
+ viewBox: "0 0 24 24",
440
+ fill: "none",
441
+ stroke: "currentColor",
442
+ "stroke-width": "2.5",
443
+ "stroke-linecap": "round",
444
+ "stroke-linejoin": "round"
445
+ }, [
446
+ s("circle", {
447
+ cx: "11",
448
+ cy: "11",
449
+ r: "8"
450
+ }),
451
+ s("line", {
452
+ x1: "21",
453
+ y1: "21",
454
+ x2: "16.65",
455
+ y2: "16.65"
456
+ }),
457
+ s("line", {
458
+ x1: "8",
459
+ y1: "11",
460
+ x2: "14",
461
+ y2: "11"
462
+ })
463
+ ], -1),
464
+ s("span", null, "Zoom Out", -1)
465
+ ])], 8, vt),
466
+ s("button", {
467
+ class: "vlite-gantt-btn",
468
+ onClick: Pe,
469
+ disabled: m.value >= 3
470
+ }, [...o[1] || (o[1] = [
471
+ ot('<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" data-v-91cc2885><circle cx="11" cy="11" r="8" data-v-91cc2885></circle><line x1="21" y1="21" x2="16.65" y2="16.65" data-v-91cc2885></line><line x1="11" y1="8" x2="11" y2="14" data-v-91cc2885></line><line x1="8" y1="11" x2="14" y2="11" data-v-91cc2885></line></svg><span data-v-91cc2885>Zoom In</span>', 2)
472
+ ])], 8, ft)
473
+ ])) : h("", !0),
474
+ u.showTodayLine && V.value ? (r(), i("button", {
475
+ key: 1,
476
+ class: "vlite-gantt-btn",
477
+ onClick: Xe
478
+ }, [...o[2] || (o[2] = [
479
+ s("svg", {
480
+ width: "12",
481
+ height: "12",
482
+ viewBox: "0 0 24 24",
483
+ fill: "none",
484
+ stroke: "currentColor",
485
+ "stroke-width": "2.5",
486
+ "stroke-linecap": "round",
487
+ "stroke-linejoin": "round"
488
+ }, [
489
+ s("circle", {
490
+ cx: "12",
491
+ cy: "12",
492
+ r: "10"
493
+ }),
494
+ s("line", {
495
+ x1: "12",
496
+ y1: "8",
497
+ x2: "12",
498
+ y2: "12"
499
+ }),
500
+ s("line", {
501
+ x1: "12",
502
+ y1: "16",
503
+ x2: "12.01",
504
+ y2: "16"
505
+ })
506
+ ], -1),
507
+ s("span", null, "Today", -1)
508
+ ])])) : h("", !0)
509
+ ])) : h("", !0),
510
+ s("div", gt, [
511
+ s("div", {
512
+ class: "vlite-gantt-sidebar",
513
+ style: D({ width: `${u.sidebarWidth}px`, minWidth: `${u.sidebarWidth}px` })
514
+ }, [
515
+ u.showHeader ? (r(), i("div", {
516
+ key: 0,
517
+ class: "vlite-gantt-sidebar-header",
518
+ style: D({ height: `${I.value}px` })
519
+ }, [...o[3] || (o[3] = [
520
+ s("span", { class: "text-xs font-semibold text-muted-foreground uppercase tracking-wider" }, "Tasks", -1)
521
+ ])], 4)) : h("", !0),
522
+ s("div", {
523
+ ref_key: "sidebarRef",
524
+ ref: ge,
525
+ class: "vlite-gantt-sidebar-body",
526
+ style: D({ height: `${O.value}px` })
527
+ }, [
528
+ (r(!0), i($, null, L(Z.value, (e, n) => (r(), i("div", {
529
+ key: `s-${n}`,
530
+ class: "vlite-gantt-sidebar-row",
531
+ style: D({ height: `${u.rowHeight}px` })
532
+ }, [
533
+ e.type === "group-header" ? (r(), i("button", {
534
+ key: 0,
535
+ class: "vlite-gantt-group-toggle",
536
+ onClick: (a) => Re(e.group)
537
+ }, [
538
+ (r(), i("svg", {
539
+ class: xe(["vlite-gantt-chevron", { "vlite-gantt-chevron-collapsed": j.value.has(e.group) }]),
540
+ width: "14",
541
+ height: "14",
542
+ viewBox: "0 0 24 24",
543
+ fill: "none",
544
+ stroke: "currentColor",
545
+ "stroke-width": "2.5",
546
+ "stroke-linecap": "round",
547
+ "stroke-linejoin": "round"
548
+ }, [...o[4] || (o[4] = [
549
+ s("polyline", { points: "6 9 12 15 18 9" }, null, -1)
550
+ ])], 2)),
551
+ s("span", yt, b(e.group), 1),
552
+ s("span", mt, b(oe.value.grouped.get(e.group)?.length ?? 0), 1)
553
+ ], 8, ht)) : (r(), i("div", {
554
+ key: 1,
555
+ class: xe(["vlite-gantt-task-name", {
556
+ "vlite-gantt-task-name-grouped": !!e.group,
557
+ "vlite-gantt-task-name-dragging": B.value && G.value === e.task?.id
558
+ }]),
559
+ onClick: (a) => e.task && fe(e.task)
560
+ }, [
561
+ s("span", {
562
+ class: "vlite-gantt-task-dot",
563
+ style: D({ backgroundColor: e.task?._color })
564
+ }, null, 4),
565
+ s("span", kt, b(e.task?.name), 1),
566
+ u.showProgress && e.task?.progress != null ? (r(), i("span", pt, b(e.task.progress) + "%", 1)) : h("", !0)
567
+ ], 10, xt))
568
+ ], 4))), 128))
569
+ ], 4)
570
+ ], 4),
571
+ s("div", {
572
+ ref_key: "timelineRef",
573
+ ref: C,
574
+ class: "vlite-gantt-timeline",
575
+ onScroll: Qe,
576
+ onWheel: Ae
577
+ }, [
578
+ u.showHeader ? (r(), i("div", {
579
+ key: 0,
580
+ class: "vlite-gantt-timeline-header",
581
+ style: D({ height: `${I.value}px`, width: `${M.value}px` })
582
+ }, [
583
+ (r(), i("svg", {
584
+ width: M.value,
585
+ height: I.value,
586
+ class: "overflow-visible"
587
+ }, [
588
+ (r(!0), i($, null, L(ne.value, (e, n) => (r(), i("g", { key: n }, [
589
+ s("line", {
590
+ x1: e.x,
591
+ y1: 0,
592
+ x2: e.x,
593
+ y2: I.value,
594
+ stroke: "currentColor",
595
+ "stroke-opacity": "0.06"
596
+ }, null, 8, bt),
597
+ s("text", {
598
+ x: e.x + e.width / 2,
599
+ y: I.value / 2 - 5,
600
+ "text-anchor": "middle",
601
+ "dominant-baseline": "middle",
602
+ "font-size": "11",
603
+ "font-weight": "600",
604
+ class: "fill-foreground"
605
+ }, b(e.label), 9, $t),
606
+ e.sublabel ? (r(), i("text", {
607
+ key: 0,
608
+ x: e.x + e.width / 2,
609
+ y: I.value / 2 + 11,
610
+ "text-anchor": "middle",
611
+ "dominant-baseline": "middle",
612
+ "font-size": "10",
613
+ class: "fill-muted-foreground"
614
+ }, b(e.sublabel), 9, Dt)) : h("", !0)
615
+ ]))), 128))
616
+ ], 8, wt))
617
+ ], 4)) : h("", !0),
618
+ s("div", {
619
+ class: "vlite-gantt-timeline-body",
620
+ style: D({ height: `${O.value}px` })
621
+ }, [
622
+ (r(), i("svg", {
623
+ width: M.value,
624
+ height: O.value,
625
+ role: "img",
626
+ "aria-label": "Gantt chart",
627
+ class: "overflow-visible"
628
+ }, [
629
+ s("defs", null, [
630
+ (r(!0), i($, null, L(w.value, (e, n) => (r(), i("linearGradient", {
631
+ key: `g${n}`,
632
+ id: `gg-${E(A)}-${n}`,
633
+ x1: "0",
634
+ y1: "0",
635
+ x2: "1",
636
+ y2: "0"
637
+ }, [
638
+ s("stop", {
639
+ offset: "0%",
640
+ "stop-color": e.task._color,
641
+ "stop-opacity": "1"
642
+ }, null, 8, Lt),
643
+ s("stop", {
644
+ offset: "100%",
645
+ "stop-color": e.task._color,
646
+ "stop-opacity": "0.75"
647
+ }, null, 8, Ct)
648
+ ], 8, St))), 128)),
649
+ (r(!0), i($, null, L(w.value, (e, n) => (r(), i("linearGradient", {
650
+ key: `p${n}`,
651
+ id: `gp-${E(A)}-${n}`,
652
+ x1: "0",
653
+ y1: "0",
654
+ x2: "1",
655
+ y2: "0"
656
+ }, [
657
+ s("stop", {
658
+ offset: "0%",
659
+ "stop-color": e.task._color,
660
+ "stop-opacity": "0.35"
661
+ }, null, 8, Ht),
662
+ s("stop", {
663
+ offset: "100%",
664
+ "stop-color": e.task._color,
665
+ "stop-opacity": "0.15"
666
+ }, null, 8, zt)
667
+ ], 8, _t))), 128))
668
+ ]),
669
+ u.showGrid ? (r(!0), i($, { key: 0 }, L(ne.value, (e, n) => (r(), i("line", {
670
+ key: n,
671
+ x1: e.x,
672
+ y1: 0,
673
+ x2: e.x,
674
+ y2: O.value,
675
+ stroke: "currentColor",
676
+ "stroke-opacity": "0.06",
677
+ "stroke-dasharray": "4 4"
678
+ }, null, 8, Et))), 128)) : h("", !0),
679
+ (r(!0), i($, null, L(Z.value, (e, n) => (r(), i("line", {
680
+ key: n,
681
+ x1: 0,
682
+ y1: (n + 1) * u.rowHeight,
683
+ x2: M.value,
684
+ y2: (n + 1) * u.rowHeight,
685
+ stroke: "currentColor",
686
+ "stroke-opacity": "0.04"
687
+ }, null, 8, Tt))), 128)),
688
+ (r(!0), i($, null, L(Z.value, (e, n) => nt((r(), i("rect", {
689
+ key: `bg${n}`,
690
+ x: 0,
691
+ y: n * u.rowHeight,
692
+ width: M.value,
693
+ height: u.rowHeight,
694
+ fill: "currentColor",
695
+ "fill-opacity": "0.02"
696
+ }, null, 8, Wt)), [
697
+ [lt, e.type === "group-header"]
698
+ ])), 128)),
699
+ (r(!0), i($, null, L(Fe.value, (e, n) => (r(), i("g", {
700
+ key: n,
701
+ class: "vlite-gantt-dep-group"
702
+ }, [
703
+ s("path", {
704
+ d: e.d,
705
+ stroke: "var(--color-muted-foreground)",
706
+ "stroke-width": "1.5",
707
+ "stroke-opacity": "0.35",
708
+ fill: "none",
709
+ "stroke-linejoin": "round"
710
+ }, null, 8, It),
711
+ s("path", {
712
+ d: e.ad,
713
+ fill: "var(--color-muted-foreground)",
714
+ "fill-opacity": "0.5"
715
+ }, null, 8, Bt)
716
+ ]))), 128)),
717
+ (r(!0), i($, null, L(w.value, (e, n) => (r(), i("g", {
718
+ key: e.task.id,
719
+ ref_for: !0,
720
+ ref: (a) => je(a, n),
721
+ class: xe({ "vlite-gantt-bar-dragging": B.value && (G.value === e.task.id || E(l).affectedIds.has(e.task.id)) })
722
+ }, [
723
+ e.task.milestone ? (r(), i("path", {
724
+ key: 0,
725
+ d: Ue(e.x + e.fullW / 2, e.y + u.barHeight / 2, u.barHeight * 0.4),
726
+ fill: `url(#gg-${E(A)}-${n})`,
727
+ stroke: e.task._color,
728
+ "stroke-width": "1.5",
729
+ "stroke-opacity": "0.6",
730
+ class: "cursor-pointer",
731
+ opacity: R.value === n ? 0.9 : 1,
732
+ onMouseenter: (a) => $e(a, n),
733
+ onMousemove: (a) => De(a, n),
734
+ onMouseleave: Me,
735
+ onClick: (a) => fe(e.task)
736
+ }, null, 40, Rt)) : (r(), i($, { key: 1 }, [
737
+ s("path", {
738
+ d: ve(e.x, e.y, e.fullW, u.barHeight, u.barRadius),
739
+ fill: `url(#gp-${E(A)}-${n})`,
740
+ class: "pointer-events-none"
741
+ }, null, 8, At),
742
+ u.showProgress && e.progressW > 0 ? (r(), i("path", {
743
+ key: 0,
744
+ d: ve(e.x, e.y, Math.min(e.progressW, e.fullW), u.barHeight, u.barRadius),
745
+ fill: `url(#gg-${E(A)}-${n})`,
746
+ class: "pointer-events-none"
747
+ }, null, 8, Pt)) : h("", !0),
748
+ u.showProgress ? h("", !0) : (r(), i("path", {
749
+ key: 1,
750
+ d: ve(e.x, e.y, e.w, u.barHeight, u.barRadius),
751
+ fill: `url(#gg-${E(A)}-${n})`,
752
+ class: "pointer-events-none"
753
+ }, null, 8, Zt)),
754
+ s("rect", {
755
+ x: e.x,
756
+ y: e.y,
757
+ width: e.fullW,
758
+ height: u.barHeight,
759
+ fill: "transparent",
760
+ style: D({ cursor: K.value }),
761
+ onMouseenter: (a) => $e(a, n),
762
+ onMousemove: (a) => De(a, n),
763
+ onMouseleave: Me,
764
+ onMousedown: (a) => Ve(a, n),
765
+ onClick: (a) => fe(e.task)
766
+ }, null, 44, Ot),
767
+ R.value === n ? (r(), i("rect", {
768
+ key: 2,
769
+ x: e.x,
770
+ y: e.y,
771
+ width: e.fullW,
772
+ height: u.barHeight,
773
+ rx: u.barRadius,
774
+ ry: u.barRadius,
775
+ fill: "currentColor",
776
+ "fill-opacity": "0.06",
777
+ class: "pointer-events-none"
778
+ }, null, 8, Ft)) : h("", !0),
779
+ u.draggable && !e.task.milestone && (re.value === n || B.value && G.value === e.task.id) ? (r(), i($, { key: 3 }, [
780
+ s("rect", {
781
+ x: e.x,
782
+ y: e.y + 4,
783
+ width: "4",
784
+ height: u.barHeight - 8,
785
+ rx: "2",
786
+ fill: "currentColor",
787
+ "fill-opacity": "0.4",
788
+ class: "pointer-events-none"
789
+ }, null, 8, Gt),
790
+ s("rect", {
791
+ x: e.x + e.fullW - 4,
792
+ y: e.y + 4,
793
+ width: "4",
794
+ height: u.barHeight - 8,
795
+ rx: "2",
796
+ fill: "currentColor",
797
+ "fill-opacity": "0.4",
798
+ class: "pointer-events-none"
799
+ }, null, 8, qt)
800
+ ], 64)) : h("", !0),
801
+ u.showLabels && e.fullW > 60 ? (r(), i("text", {
802
+ key: 4,
803
+ x: e.x + 12,
804
+ y: e.y + u.barHeight / 2,
805
+ "dominant-baseline": "middle",
806
+ "font-size": "11",
807
+ "font-weight": "600",
808
+ fill: u.showProgress ? "currentColor" : "white",
809
+ opacity: Q.value > 0.3 ? 0.85 : 0,
810
+ class: "pointer-events-none"
811
+ }, b(e.task.name), 9, Xt)) : h("", !0)
812
+ ], 64))
813
+ ], 2))), 128)),
814
+ s("g", {
815
+ ref_key: "dragLabelRef",
816
+ ref: z,
817
+ style: { display: "none" }
818
+ }, [...o[5] || (o[5] = [
819
+ s("rect", {
820
+ x: "0",
821
+ y: "0",
822
+ width: "124",
823
+ height: "18",
824
+ rx: "4",
825
+ fill: "var(--color-foreground)",
826
+ "fill-opacity": "0.85"
827
+ }, null, -1),
828
+ s("text", {
829
+ x: "0",
830
+ y: "0",
831
+ "text-anchor": "middle",
832
+ "dominant-baseline": "middle",
833
+ "font-size": "9",
834
+ "font-weight": "600",
835
+ fill: "var(--color-background)"
836
+ }, null, -1)
837
+ ])], 512),
838
+ u.showTodayLine && V.value ? (r(), i("g", jt, [
839
+ s("line", {
840
+ x1: F.value,
841
+ y1: 0,
842
+ x2: F.value,
843
+ y2: O.value,
844
+ stroke: u.todayColor,
845
+ "stroke-width": "2",
846
+ "stroke-opacity": "0.7",
847
+ "stroke-dasharray": "6 3"
848
+ }, null, 8, Nt),
849
+ s("circle", {
850
+ cx: F.value,
851
+ cy: 0,
852
+ r: "4",
853
+ fill: u.todayColor,
854
+ "fill-opacity": "0.9"
855
+ }, null, 8, Vt),
856
+ s("text", {
857
+ x: F.value,
858
+ y: -8,
859
+ "text-anchor": "middle",
860
+ "font-size": "9",
861
+ "font-weight": "700",
862
+ fill: u.todayColor,
863
+ "fill-opacity": "0.9"
864
+ }, "TODAY", 8, Kt)
865
+ ])) : h("", !0)
866
+ ], 8, Mt))
867
+ ], 4)
868
+ ], 544)
869
+ ]),
870
+ (r(), at(st, { to: "body" }, [
871
+ g.value && !B.value ? (r(), i("div", {
872
+ key: 0,
873
+ class: "vlite-chart-tooltip",
874
+ style: D({ left: `${g.value.x + 14}px`, top: `${g.value.y - 12}px` })
875
+ }, [
876
+ s("div", Ut, b(g.value.task.name), 1),
877
+ s("div", Qt, [
878
+ s("span", {
879
+ class: "w-2 h-2 rounded-sm shrink-0",
880
+ style: D({ backgroundColor: g.value.task._color ?? g.value.task.color })
881
+ }, null, 4),
882
+ s("span", null, b(g.value.startStr) + " — " + b(g.value.endStr), 1)
883
+ ]),
884
+ s("div", Jt, b(Je(g.value.task._start, g.value.task._end)), 1),
885
+ u.showProgress && g.value.task.progress != null ? (r(), i("div", Yt, [
886
+ s("div", eo, [
887
+ s("div", {
888
+ class: "vlite-gantt-tooltip-progress-fill",
889
+ style: D({
890
+ width: `${g.value.task.progress}%`,
891
+ backgroundColor: g.value.task._color ?? g.value.task.color
892
+ })
893
+ }, null, 4)
894
+ ]),
895
+ s("span", to, b(g.value.task.progress) + "%", 1)
896
+ ])) : h("", !0),
897
+ g.value.task.group ? (r(), i("div", oo, b(g.value.task.group), 1)) : h("", !0),
898
+ u.draggable && !g.value.task.milestone ? (r(), i("div", no, [
899
+ o[6] || (o[6] = ze(" Drag to move · Edges to resize ", -1)),
900
+ u.cascadeDependencies ? (r(), i($, { key: 0 }, [
901
+ ze(" · Dependents follow")
902
+ ], 64)) : h("", !0)
903
+ ])) : h("", !0)
904
+ ], 4)) : h("", !0)
905
+ ]))
906
+ ], 512));
907
+ }
908
+ });
909
+ export {
910
+ io as default
911
+ };