@object-ui/plugin-kanban 4.0.3 → 4.0.4

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.
@@ -1,820 +0,0 @@
1
- import { n as e, r as t, t as n } from "./plus-CHsXVJSY.js";
2
- import { t as r } from "./chevron-down-C0JUlGjk.js";
3
- import { a as i, d as a, f as o, i as s, l as c, n as l, o as u, r as d, s as f, t as p, u as m } from "./sortable.esm-LJG1TjKd.js";
4
- import * as h from "react";
5
- import { Badge as g, Button as _, Card as v, CardContent as y, CardDescription as b, CardHeader as x, CardTitle as S, Input as C } from "@object-ui/components";
6
- import { flushSync as w } from "react-dom";
7
- var T = e("chevron-right", [["path", {
8
- d: "m9 18 6-6-6-6",
9
- key: "mthhwq"
10
- }]]), E = e("triangle-alert", [
11
- ["path", {
12
- d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
13
- key: "wmoenq"
14
- }],
15
- ["path", {
16
- d: "M12 9v4",
17
- key: "juzpu7"
18
- }],
19
- ["path", {
20
- d: "M12 17h.01",
21
- key: "p32p05"
22
- }]
23
- ]);
24
- //#endregion
25
- //#region ../../node_modules/.pnpm/@tanstack+virtual-core@3.14.0/node_modules/@tanstack/virtual-core/dist/esm/utils.js
26
- function D(e, t, n) {
27
- let r = n.initialDeps ?? [], i, a = !0;
28
- function o() {
29
- let o;
30
- n.key && n.debug?.call(n) && (o = Date.now());
31
- let s = e();
32
- if (!(s.length !== r.length || s.some((e, t) => r[t] !== e))) return i;
33
- r = s;
34
- let c;
35
- if (n.key && n.debug?.call(n) && (c = Date.now()), i = t(...s), n.key && n.debug?.call(n)) {
36
- let e = Math.round((Date.now() - o) * 100) / 100, t = Math.round((Date.now() - c) * 100) / 100, r = t / 16, i = (e, t) => {
37
- for (e = String(e); e.length < t;) e = " " + e;
38
- return e;
39
- };
40
- console.info(`%c⏱ ${i(t, 5)} /${i(e, 5)} ms`, `
41
- font-size: .6rem;
42
- font-weight: bold;
43
- color: hsl(${Math.max(0, Math.min(120 - 120 * r, 120))}deg 100% 31%);`, n?.key);
44
- }
45
- return n?.onChange && !(a && n.skipInitialOnChange) && n.onChange(i), a = !1, i;
46
- }
47
- return o.updateDeps = (e) => {
48
- r = e;
49
- }, o;
50
- }
51
- function O(e, t) {
52
- if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
53
- return e;
54
- }
55
- var k = (e, t) => Math.abs(e - t) < 1.01, A = (e, t, n) => {
56
- let r;
57
- return function(...i) {
58
- e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
59
- };
60
- }, j = (e) => {
61
- let { offsetWidth: t, offsetHeight: n } = e;
62
- return {
63
- width: t,
64
- height: n
65
- };
66
- }, M = (e) => e, N = (e) => {
67
- let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1), r = [];
68
- for (let e = t; e <= n; e++) r.push(e);
69
- return r;
70
- }, P = (e, t) => {
71
- let n = e.scrollElement;
72
- if (!n) return;
73
- let r = e.targetWindow;
74
- if (!r) return;
75
- let i = (e) => {
76
- let { width: n, height: r } = e;
77
- t({
78
- width: Math.round(n),
79
- height: Math.round(r)
80
- });
81
- };
82
- if (i(j(n)), !r.ResizeObserver) return () => {};
83
- let a = new r.ResizeObserver((t) => {
84
- let r = () => {
85
- let e = t[0];
86
- if (e?.borderBoxSize) {
87
- let t = e.borderBoxSize[0];
88
- if (t) {
89
- i({
90
- width: t.inlineSize,
91
- height: t.blockSize
92
- });
93
- return;
94
- }
95
- }
96
- i(j(n));
97
- };
98
- e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
99
- });
100
- return a.observe(n, { box: "border-box" }), () => {
101
- a.unobserve(n);
102
- };
103
- }, F = { passive: !0 }, I = typeof window > "u" ? !0 : "onscrollend" in window, L = (e, t) => {
104
- let n = e.scrollElement;
105
- if (!n) return;
106
- let r = e.targetWindow;
107
- if (!r) return;
108
- let i = 0, a = e.options.useScrollendEvent && I ? () => void 0 : A(r, () => {
109
- t(i, !1);
110
- }, e.options.isScrollingResetDelay), o = (r) => () => {
111
- let { horizontal: o, isRtl: s } = e.options;
112
- i = o ? n.scrollLeft * (s && -1 || 1) : n.scrollTop, a(), t(i, r);
113
- }, s = o(!0), c = o(!1);
114
- n.addEventListener("scroll", s, F);
115
- let l = e.options.useScrollendEvent && I;
116
- return l && n.addEventListener("scrollend", c, F), () => {
117
- n.removeEventListener("scroll", s), l && n.removeEventListener("scrollend", c);
118
- };
119
- }, R = (e, t, n) => {
120
- if (t?.borderBoxSize) {
121
- let e = t.borderBoxSize[0];
122
- if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
123
- }
124
- return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
125
- }, z = (e, { adjustments: t = 0, behavior: n }, r) => {
126
- var i, a;
127
- let o = e + t;
128
- (a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
129
- [r.options.horizontal ? "left" : "top"]: o,
130
- behavior: n
131
- });
132
- }, B = class {
133
- constructor(e) {
134
- this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => {
135
- var e;
136
- return ((e = this.targetWindow?.performance)?.now)?.call(e) ?? Date.now();
137
- }, this.observer = /* @__PURE__ */ (() => {
138
- let e = null, t = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((e) => {
139
- e.forEach((e) => {
140
- let t = () => {
141
- let t = e.target, n = this.indexFromElement(t);
142
- if (!t.isConnected) {
143
- this.observer.unobserve(t);
144
- return;
145
- }
146
- this.shouldMeasureDuringScroll(n) && this.resizeItem(n, this.options.measureElement(t, e, this));
147
- };
148
- this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(t) : t();
149
- });
150
- }));
151
- return {
152
- disconnect: () => {
153
- var n;
154
- (n = t()) == null || n.disconnect(), e = null;
155
- },
156
- observe: (e) => t()?.observe(e, { box: "border-box" }),
157
- unobserve: (e) => t()?.unobserve(e)
158
- };
159
- })(), this.range = null, this.setOptions = (e) => {
160
- Object.entries(e).forEach(([t, n]) => {
161
- n === void 0 && delete e[t];
162
- }), this.options = {
163
- debug: !1,
164
- initialOffset: 0,
165
- overscan: 1,
166
- paddingStart: 0,
167
- paddingEnd: 0,
168
- scrollPaddingStart: 0,
169
- scrollPaddingEnd: 0,
170
- horizontal: !1,
171
- getItemKey: M,
172
- rangeExtractor: N,
173
- onChange: () => {},
174
- measureElement: R,
175
- initialRect: {
176
- width: 0,
177
- height: 0
178
- },
179
- scrollMargin: 0,
180
- gap: 0,
181
- indexAttribute: "data-index",
182
- initialMeasurementsCache: [],
183
- lanes: 1,
184
- isScrollingResetDelay: 150,
185
- enabled: !0,
186
- isRtl: !1,
187
- useScrollendEvent: !1,
188
- useAnimationFrameWithResizeObserver: !1,
189
- laneAssignmentMode: "estimate",
190
- ...e
191
- };
192
- }, this.notify = (e) => {
193
- var t, n;
194
- (n = (t = this.options).onChange) == null || n.call(t, this, e);
195
- }, this.maybeNotify = D(() => (this.calculateRange(), [
196
- this.isScrolling,
197
- this.range ? this.range.startIndex : null,
198
- this.range ? this.range.endIndex : null
199
- ]), (e) => {
200
- this.notify(e);
201
- }, {
202
- key: process.env.NODE_ENV !== "production" && "maybeNotify",
203
- debug: () => this.options.debug,
204
- initialDeps: [
205
- this.isScrolling,
206
- this.range ? this.range.startIndex : null,
207
- this.range ? this.range.endIndex : null
208
- ]
209
- }), this.cleanup = () => {
210
- this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.rafId != null && this.targetWindow && (this.targetWindow.cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollState = null, this.scrollElement = null, this.targetWindow = null;
211
- }, this._didMount = () => () => {
212
- this.cleanup();
213
- }, this._willUpdate = () => {
214
- let e = this.options.enabled ? this.options.getScrollElement() : null;
215
- if (this.scrollElement !== e) {
216
- if (this.cleanup(), !e) {
217
- this.maybeNotify();
218
- return;
219
- }
220
- this.scrollElement = e, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = this.scrollElement?.window ?? null, this.elementsCache.forEach((e) => {
221
- this.observer.observe(e);
222
- }), this.unsubs.push(this.options.observeElementRect(this, (e) => {
223
- this.scrollRect = e, this.maybeNotify();
224
- })), this.unsubs.push(this.options.observeElementOffset(this, (e, t) => {
225
- this.scrollAdjustments = 0, this.scrollDirection = t ? this.getScrollOffset() < e ? "forward" : "backward" : null, this.scrollOffset = e, this.isScrolling = t, this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify();
226
- })), this._scrollToOffset(this.getScrollOffset(), {
227
- adjustments: void 0,
228
- behavior: void 0
229
- });
230
- }
231
- }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, t) => {
232
- let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
233
- for (let i = t - 1; i >= 0; i--) {
234
- let t = e[i];
235
- if (n.has(t.lane)) continue;
236
- let a = r.get(t.lane);
237
- if (a == null || t.end > a.end ? r.set(t.lane, t) : t.end < a.end && n.set(t.lane, !0), n.size === this.options.lanes) break;
238
- }
239
- return r.size === this.options.lanes ? Array.from(r.values()).sort((e, t) => e.end === t.end ? e.index - t.index : e.end - t.end)[0] : void 0;
240
- }, this.getMeasurementOptions = D(() => [
241
- this.options.count,
242
- this.options.paddingStart,
243
- this.options.scrollMargin,
244
- this.options.getItemKey,
245
- this.options.enabled,
246
- this.options.lanes,
247
- this.options.laneAssignmentMode
248
- ], (e, t, n, r, i, a, o) => (this.prevLanes !== void 0 && this.prevLanes !== a && (this.lanesChangedFlag = !0), this.prevLanes = a, this.pendingMeasuredCacheIndexes = [], {
249
- count: e,
250
- paddingStart: t,
251
- scrollMargin: n,
252
- getItemKey: r,
253
- enabled: i,
254
- lanes: a,
255
- laneAssignmentMode: o
256
- }), { key: !1 }), this.getMeasurements = D(() => [this.getMeasurementOptions(), this.itemSizeCache], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o }, s) => {
257
- if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
258
- if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
259
- this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => {
260
- this.itemSizeCache.set(e.key, e.size);
261
- }));
262
- let c = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
263
- this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
264
- let l = this.measurementsCache.slice(0, c), u = Array(a).fill(void 0);
265
- for (let e = 0; e < c; e++) {
266
- let t = l[e];
267
- t && (u[t.lane] = e);
268
- }
269
- for (let i = c; i < e; i++) {
270
- let e = r(i), a = this.laneAssignments.get(i), c, d, f = o === "estimate" || s.has(e);
271
- if (a !== void 0 && this.options.lanes > 1) {
272
- c = a;
273
- let e = u[c], r = e === void 0 ? void 0 : l[e];
274
- d = r ? r.end + this.options.gap : t + n;
275
- } else {
276
- let e = this.options.lanes === 1 ? l[i - 1] : this.getFurthestMeasurement(l, i);
277
- d = e ? e.end + this.options.gap : t + n, c = e ? e.lane : i % this.options.lanes, this.options.lanes > 1 && f && this.laneAssignments.set(i, c);
278
- }
279
- let p = s.get(e), m = typeof p == "number" ? p : this.options.estimateSize(i), h = d + m;
280
- l[i] = {
281
- index: i,
282
- start: d,
283
- size: m,
284
- end: h,
285
- key: e,
286
- lane: c
287
- }, u[c] = i;
288
- }
289
- return this.measurementsCache = l, l;
290
- }, {
291
- key: process.env.NODE_ENV !== "production" && "getMeasurements",
292
- debug: () => this.options.debug
293
- }), this.calculateRange = D(() => [
294
- this.getMeasurements(),
295
- this.getSize(),
296
- this.getScrollOffset(),
297
- this.options.lanes
298
- ], (e, t, n, r) => this.range = e.length > 0 && t > 0 ? H({
299
- measurements: e,
300
- outerSize: t,
301
- scrollOffset: n,
302
- lanes: r
303
- }) : null, {
304
- key: process.env.NODE_ENV !== "production" && "calculateRange",
305
- debug: () => this.options.debug
306
- }), this.getVirtualIndexes = D(() => {
307
- let e = null, t = null, n = this.calculateRange();
308
- return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
309
- this.isScrolling,
310
- e,
311
- t
312
- ]), [
313
- this.options.rangeExtractor,
314
- this.options.overscan,
315
- this.options.count,
316
- e,
317
- t
318
- ];
319
- }, (e, t, n, r, i) => r === null || i === null ? [] : e({
320
- startIndex: r,
321
- endIndex: i,
322
- overscan: t,
323
- count: n
324
- }), {
325
- key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
326
- debug: () => this.options.debug
327
- }), this.indexFromElement = (e) => {
328
- let t = this.options.indexAttribute, n = e.getAttribute(t);
329
- return n ? parseInt(n, 10) : (console.warn(`Missing attribute name '${t}={index}' on measured element.`), -1);
330
- }, this.shouldMeasureDuringScroll = (e) => {
331
- if (!this.scrollState || this.scrollState.behavior !== "smooth") return !0;
332
- let t = this.scrollState.index ?? this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;
333
- if (t !== void 0 && this.range) {
334
- let n = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2)), r = Math.max(0, t - n), i = Math.min(this.options.count - 1, t + n);
335
- return e >= r && e <= i;
336
- }
337
- return !0;
338
- }, this.measureElement = (e) => {
339
- if (!e) {
340
- this.elementsCache.forEach((e, t) => {
341
- e.isConnected || (this.observer.unobserve(e), this.elementsCache.delete(t));
342
- });
343
- return;
344
- }
345
- let t = this.indexFromElement(e), n = this.options.getItemKey(t), r = this.elementsCache.get(n);
346
- r !== e && (r && this.observer.unobserve(r), this.observer.observe(e), this.elementsCache.set(n, e)), (!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(t) && this.resizeItem(t, this.options.measureElement(e, void 0, this));
347
- }, this.resizeItem = (e, t) => {
348
- let n = this.measurementsCache[e];
349
- if (!n) return;
350
- let r = t - (this.itemSizeCache.get(n.key) ?? n.size);
351
- r !== 0 && (this.scrollState?.behavior !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange === void 0 ? n.start < this.getScrollOffset() + this.scrollAdjustments : this.shouldAdjustScrollPositionOnItemSizeChange(n, r, this)) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", r), this._scrollToOffset(this.getScrollOffset(), {
352
- adjustments: this.scrollAdjustments += r,
353
- behavior: void 0
354
- })), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, t)), this.notify(!1));
355
- }, this.getVirtualItems = D(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
356
- let n = [];
357
- for (let r = 0, i = e.length; r < i; r++) {
358
- let i = t[e[r]];
359
- n.push(i);
360
- }
361
- return n;
362
- }, {
363
- key: process.env.NODE_ENV !== "production" && "getVirtualItems",
364
- debug: () => this.options.debug
365
- }), this.getVirtualItemForOffset = (e) => {
366
- let t = this.getMeasurements();
367
- if (t.length !== 0) return O(t[V(0, t.length - 1, (e) => O(t[e]).start, e)]);
368
- }, this.getMaxScrollOffset = () => {
369
- if (!this.scrollElement) return 0;
370
- if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
371
- {
372
- let e = this.scrollElement.document.documentElement;
373
- return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight;
374
- }
375
- }, this.getOffsetForAlignment = (e, t, n = 0) => {
376
- if (!this.scrollElement) return 0;
377
- let r = this.getSize(), i = this.getScrollOffset();
378
- t === "auto" && (t = e >= i + r ? "end" : "start"), t === "center" ? e += (n - r) / 2 : t === "end" && (e -= r);
379
- let a = this.getMaxScrollOffset();
380
- return Math.max(Math.min(a, e), 0);
381
- }, this.getOffsetForIndex = (e, t = "auto") => {
382
- e = Math.max(0, Math.min(e, this.options.count - 1));
383
- let n = this.getSize(), r = this.getScrollOffset(), i = this.measurementsCache[e];
384
- if (!i) return;
385
- if (t === "auto") if (i.end >= r + n - this.options.scrollPaddingEnd) t = "end";
386
- else if (i.start <= r + this.options.scrollPaddingStart) t = "start";
387
- else return [r, t];
388
- if (t === "end" && e === this.options.count - 1) return [this.getMaxScrollOffset(), t];
389
- let a = t === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
390
- return [this.getOffsetForAlignment(a, t, i.size), t];
391
- }, this.scrollToOffset = (e, { align: t = "start", behavior: n = "auto" } = {}) => {
392
- let r = this.getOffsetForAlignment(e, t), i = this.now();
393
- this.scrollState = {
394
- index: null,
395
- align: t,
396
- behavior: n,
397
- startedAt: i,
398
- lastTargetOffset: r,
399
- stableFrames: 0
400
- }, this._scrollToOffset(r, {
401
- adjustments: void 0,
402
- behavior: n
403
- }), this.scheduleScrollReconcile();
404
- }, this.scrollToIndex = (e, { align: t = "auto", behavior: n = "auto" } = {}) => {
405
- e = Math.max(0, Math.min(e, this.options.count - 1));
406
- let r = this.getOffsetForIndex(e, t);
407
- if (!r) return;
408
- let [i, a] = r, o = this.now();
409
- this.scrollState = {
410
- index: e,
411
- align: a,
412
- behavior: n,
413
- startedAt: o,
414
- lastTargetOffset: i,
415
- stableFrames: 0
416
- }, this._scrollToOffset(i, {
417
- adjustments: void 0,
418
- behavior: n
419
- }), this.scheduleScrollReconcile();
420
- }, this.scrollBy = (e, { behavior: t = "auto" } = {}) => {
421
- let n = this.getScrollOffset() + e, r = this.now();
422
- this.scrollState = {
423
- index: null,
424
- align: "start",
425
- behavior: t,
426
- startedAt: r,
427
- lastTargetOffset: n,
428
- stableFrames: 0
429
- }, this._scrollToOffset(n, {
430
- adjustments: void 0,
431
- behavior: t
432
- }), this.scheduleScrollReconcile();
433
- }, this.getTotalSize = () => {
434
- let e = this.getMeasurements(), t;
435
- if (e.length === 0) t = this.options.paddingStart;
436
- else if (this.options.lanes === 1) t = e[e.length - 1]?.end ?? 0;
437
- else {
438
- let n = Array(this.options.lanes).fill(null), r = e.length - 1;
439
- for (; r >= 0 && n.some((e) => e === null);) {
440
- let t = e[r];
441
- n[t.lane] === null && (n[t.lane] = t.end), r--;
442
- }
443
- t = Math.max(...n.filter((e) => e !== null));
444
- }
445
- return Math.max(t - this.options.scrollMargin + this.options.paddingEnd, 0);
446
- }, this._scrollToOffset = (e, { adjustments: t, behavior: n }) => {
447
- this.options.scrollToFn(e, {
448
- behavior: n,
449
- adjustments: t
450
- }, this);
451
- }, this.measure = () => {
452
- this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.notify(!1);
453
- }, this.setOptions(e);
454
- }
455
- scheduleScrollReconcile() {
456
- if (!this.targetWindow) {
457
- this.scrollState = null;
458
- return;
459
- }
460
- this.rafId ??= this.targetWindow.requestAnimationFrame(() => {
461
- this.rafId = null, this.reconcileScroll();
462
- });
463
- }
464
- reconcileScroll() {
465
- if (!this.scrollState || !this.scrollElement) return;
466
- if (this.now() - this.scrollState.startedAt > 5e3) {
467
- this.scrollState = null;
468
- return;
469
- }
470
- let e = this.scrollState.index == null ? void 0 : this.getOffsetForIndex(this.scrollState.index, this.scrollState.align), t = e ? e[0] : this.scrollState.lastTargetOffset, n = t !== this.scrollState.lastTargetOffset;
471
- if (!n && k(t, this.getScrollOffset())) {
472
- if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
473
- this.scrollState = null;
474
- return;
475
- }
476
- } else this.scrollState.stableFrames = 0, n && (this.scrollState.lastTargetOffset = t, this.scrollState.behavior = "auto", this._scrollToOffset(t, {
477
- adjustments: void 0,
478
- behavior: "auto"
479
- }));
480
- this.scheduleScrollReconcile();
481
- }
482
- }, V = (e, t, n, r) => {
483
- for (; e <= t;) {
484
- let i = (e + t) / 2 | 0, a = n(i);
485
- if (a < r) e = i + 1;
486
- else if (a > r) t = i - 1;
487
- else return i;
488
- }
489
- return e > 0 ? e - 1 : 0;
490
- };
491
- function H({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
492
- let i = e.length - 1, a = (t) => e[t].start;
493
- if (e.length <= r) return {
494
- startIndex: 0,
495
- endIndex: i
496
- };
497
- let o = V(0, i, a, n), s = o;
498
- if (r === 1) for (; s < i && e[s].end < n + t;) s++;
499
- else if (r > 1) {
500
- let a = Array(r).fill(0);
501
- for (; s < i && a.some((e) => e < n + t);) {
502
- let t = e[s];
503
- a[t.lane] = t.end, s++;
504
- }
505
- let c = Array(r).fill(n + t);
506
- for (; o >= 0 && c.some((e) => e >= n);) {
507
- let t = e[o];
508
- c[t.lane] = t.start, o--;
509
- }
510
- o = Math.max(0, o - o % r), s = Math.min(i, s + (r - 1 - s % r));
511
- }
512
- return {
513
- startIndex: o,
514
- endIndex: s
515
- };
516
- }
517
- //#endregion
518
- //#region ../../node_modules/.pnpm/@tanstack+react-virtual@3.13.24_react-dom@19.2.5_react@19.2.5__react@19.2.5/node_modules/@tanstack/react-virtual/dist/esm/index.js
519
- var U = typeof document < "u" ? h.useLayoutEffect : h.useEffect;
520
- function W({ useFlushSync: e = !0, ...t }) {
521
- let n = h.useReducer(() => ({}), {})[1], r = {
522
- ...t,
523
- onChange: (r, i) => {
524
- var a;
525
- e && i ? w(n) : n(), (a = t.onChange) == null || a.call(t, r, i);
526
- }
527
- }, [i] = h.useState(() => new B(r));
528
- return i.setOptions(r), U(() => i._didMount(), []), U(() => i._willUpdate()), i;
529
- }
530
- function G(e) {
531
- return W({
532
- observeElementRect: P,
533
- observeElementOffset: L,
534
- scrollToFn: z,
535
- ...e
536
- });
537
- }
538
- //#endregion
539
- //#region src/KanbanEnhanced.tsx
540
- var K = t(), q = (...e) => e.filter(Boolean).join(" ");
541
- function J(e, t) {
542
- if (!t || t.length === 0) return {};
543
- for (let n of t) {
544
- let t = e[n.field];
545
- if (t == null) continue;
546
- let r = !1, i = String(t);
547
- switch (n.operator) {
548
- case "equals":
549
- r = i === String(n.value);
550
- break;
551
- case "not_equals":
552
- r = i !== String(n.value);
553
- break;
554
- case "contains":
555
- r = i.toLowerCase().includes(String(n.value).toLowerCase());
556
- break;
557
- case "in":
558
- r = Array.isArray(n.value) && n.value.includes(i);
559
- break;
560
- }
561
- if (r) return {
562
- ...n.backgroundColor ? { backgroundColor: n.backgroundColor } : {},
563
- ...n.borderColor ? { borderColor: n.borderColor } : {}
564
- };
565
- }
566
- return {};
567
- }
568
- function Y({ card: e, conditionalFormatting: t }) {
569
- let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: s, isDragging: c } = d({ id: e.id }), l = {
570
- transform: o.Transform.toString(a),
571
- transition: s,
572
- opacity: c ? .5 : void 0
573
- }, u = J(e, t);
574
- return /* @__PURE__ */ (0, K.jsx)("div", {
575
- ref: i,
576
- style: l,
577
- ...n,
578
- ...r,
579
- children: /* @__PURE__ */ (0, K.jsxs)(v, {
580
- className: "mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",
581
- style: u,
582
- children: [
583
- e.coverImage && /* @__PURE__ */ (0, K.jsx)("div", {
584
- className: "w-full h-32 overflow-hidden rounded-t-lg",
585
- children: /* @__PURE__ */ (0, K.jsx)("img", {
586
- src: e.coverImage,
587
- alt: "",
588
- className: "w-full h-full object-cover",
589
- loading: "lazy"
590
- })
591
- }),
592
- /* @__PURE__ */ (0, K.jsxs)(x, {
593
- className: "p-4",
594
- children: [/* @__PURE__ */ (0, K.jsx)(S, {
595
- className: "text-sm font-medium tracking-tight text-foreground group-hover:text-primary transition-colors",
596
- children: e.title
597
- }), e.description && /* @__PURE__ */ (0, K.jsx)(b, {
598
- className: "text-xs text-muted-foreground",
599
- children: e.description
600
- })]
601
- }),
602
- e.badges && e.badges.length > 0 && /* @__PURE__ */ (0, K.jsx)(y, {
603
- className: "p-4 pt-0",
604
- children: /* @__PURE__ */ (0, K.jsx)("div", {
605
- className: "flex flex-wrap gap-1",
606
- children: e.badges.map((e, t) => /* @__PURE__ */ (0, K.jsx)(g, {
607
- variant: e.variant || "default",
608
- className: "text-xs",
609
- children: e.label
610
- }, t))
611
- })
612
- })
613
- ]
614
- })
615
- });
616
- }
617
- function X({ cards: e, parentRef: t, conditionalFormatting: n }) {
618
- let r = G({
619
- count: e.length,
620
- getScrollElement: () => t.current,
621
- estimateSize: () => 120,
622
- overscan: 5
623
- });
624
- return /* @__PURE__ */ (0, K.jsx)("div", {
625
- style: {
626
- height: `${r.getTotalSize()}px`,
627
- width: "100%",
628
- position: "relative"
629
- },
630
- children: r.getVirtualItems().map((t) => {
631
- let r = e[t.index];
632
- return /* @__PURE__ */ (0, K.jsx)("div", {
633
- style: {
634
- position: "absolute",
635
- top: 0,
636
- left: 0,
637
- width: "100%",
638
- transform: `translateY(${t.start}px)`
639
- },
640
- children: /* @__PURE__ */ (0, K.jsx)(Y, {
641
- card: r,
642
- conditionalFormatting: n
643
- })
644
- }, r.id);
645
- })
646
- });
647
- }
648
- function Z({ columnId: e, onAdd: t }) {
649
- let [r, i] = h.useState(!1), [a, o] = h.useState(""), s = h.useRef(null), c = () => {
650
- let n = a.trim();
651
- n && (t(e, n), o("")), i(!1);
652
- };
653
- return r ? /* @__PURE__ */ (0, K.jsx)("div", {
654
- className: "mt-2 space-y-2",
655
- children: /* @__PURE__ */ (0, K.jsx)(C, {
656
- ref: s,
657
- value: a,
658
- onChange: (e) => o(e.target.value),
659
- onKeyDown: (e) => {
660
- e.key === "Enter" ? (e.preventDefault(), c()) : e.key === "Escape" && (o(""), i(!1));
661
- },
662
- onBlur: c,
663
- placeholder: "Enter card title...",
664
- className: "text-sm",
665
- autoFocus: !0
666
- })
667
- }) : /* @__PURE__ */ (0, K.jsxs)(_, {
668
- variant: "ghost",
669
- size: "sm",
670
- className: "w-full mt-2 text-muted-foreground hover:text-foreground",
671
- onClick: () => {
672
- i(!0), setTimeout(() => s.current?.focus(), 0);
673
- },
674
- children: [/* @__PURE__ */ (0, K.jsx)(n, { className: "h-4 w-4 mr-1" }), "Add Card"]
675
- });
676
- }
677
- function Q({ column: e, cards: t, onToggle: n, enableVirtual: i, quickAdd: a, onQuickAdd: o, conditionalFormatting: c }) {
678
- let l = t || [], u = h.useRef(null), { setNodeRef: f } = d({
679
- id: e.id,
680
- data: { type: "column" }
681
- }), m = e.limit && l.length >= e.limit, v = e.limit && l.length >= e.limit * .8;
682
- return /* @__PURE__ */ (0, K.jsxs)("div", {
683
- ref: f,
684
- className: q("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all", e.collapsed ? "w-16" : "w-80", e.className),
685
- children: [/* @__PURE__ */ (0, K.jsxs)("div", {
686
- className: "p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",
687
- children: [/* @__PURE__ */ (0, K.jsxs)("div", {
688
- className: "flex items-center gap-2 flex-1 min-w-0",
689
- children: [/* @__PURE__ */ (0, K.jsx)(_, {
690
- variant: "ghost",
691
- size: "sm",
692
- className: "h-6 w-6 p-0",
693
- onClick: () => n(!e.collapsed),
694
- children: e.collapsed ? /* @__PURE__ */ (0, K.jsx)(T, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, K.jsx)(r, { className: "h-4 w-4" })
695
- }), !e.collapsed && /* @__PURE__ */ (0, K.jsxs)(K.Fragment, { children: [/* @__PURE__ */ (0, K.jsx)("h3", {
696
- className: " text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",
697
- children: e.title
698
- }), /* @__PURE__ */ (0, K.jsxs)("div", {
699
- className: "flex items-center gap-2",
700
- children: [
701
- /* @__PURE__ */ (0, K.jsxs)("span", {
702
- className: q(" text-xs", m ? "text-destructive" : v ? "text-yellow-500" : "text-muted-foreground"),
703
- children: [l.length, e.limit && ` / ${e.limit}`]
704
- }),
705
- m && /* @__PURE__ */ (0, K.jsx)(g, {
706
- variant: "destructive",
707
- className: "text-xs",
708
- children: "Full"
709
- }),
710
- v && !m && /* @__PURE__ */ (0, K.jsx)(E, { className: "h-3 w-3 text-yellow-500" })
711
- ]
712
- })] })]
713
- }), e.collapsed && /* @__PURE__ */ (0, K.jsxs)("div", {
714
- className: "flex flex-col items-center gap-1",
715
- children: [/* @__PURE__ */ (0, K.jsx)("span", {
716
- className: " text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",
717
- children: e.title
718
- }), /* @__PURE__ */ (0, K.jsx)(g, {
719
- variant: "secondary",
720
- className: "text-xs",
721
- children: l.length
722
- })]
723
- })]
724
- }), !e.collapsed && /* @__PURE__ */ (0, K.jsxs)("div", {
725
- ref: u,
726
- className: "flex-1 p-4 overflow-y-auto",
727
- style: { maxHeight: "600px" },
728
- children: [/* @__PURE__ */ (0, K.jsx)(p, {
729
- items: l.map((e) => e.id),
730
- strategy: s,
731
- children: i ? /* @__PURE__ */ (0, K.jsx)(X, {
732
- cards: l,
733
- parentRef: u,
734
- conditionalFormatting: c
735
- }) : /* @__PURE__ */ (0, K.jsx)("div", {
736
- className: "space-y-2",
737
- children: l.map((e) => /* @__PURE__ */ (0, K.jsx)(Y, {
738
- card: e,
739
- conditionalFormatting: c
740
- }, e.id))
741
- })
742
- }), a && o && /* @__PURE__ */ (0, K.jsx)(Z, {
743
- columnId: e.id,
744
- onAdd: o
745
- })]
746
- })]
747
- });
748
- }
749
- function $({ columns: e, onCardMove: t, onColumnToggle: n, enableVirtualScrolling: r = !1, virtualScrollThreshold: o = 50, className: s, quickAdd: d, onQuickAdd: p, conditionalFormatting: g }) {
750
- let [_, v] = h.useState(null), y = h.useMemo(() => (e || []).map((e) => ({
751
- ...e,
752
- cards: e.cards || []
753
- })), [e]), [b, x] = h.useState(y);
754
- h.useEffect(() => {
755
- x(y);
756
- }, [y]);
757
- let S = a(m(f, { activationConstraint: { distance: 8 } })), C = (e) => {
758
- let { active: t } = e;
759
- v(T(t.id));
760
- }, w = (e) => {
761
- let { active: n, over: r } = e;
762
- if (v(null), !r) return;
763
- let i = n.id, a = r.id;
764
- if (i === a) return;
765
- let o = E(i), s = E(a) || D(a);
766
- if (!(!o || !s)) if (o.id === s.id) {
767
- let e = [...o.cards], t = l(e, e.findIndex((e) => e.id === i), e.findIndex((e) => e.id === a));
768
- x((e) => e.map((e) => e.id === o.id ? {
769
- ...e,
770
- cards: t
771
- } : e));
772
- } else {
773
- let e = [...o.cards], n = [...s.cards], r = e.findIndex((e) => e.id === i), c = a === s.id ? n.length : n.findIndex((e) => e.id === a), [l] = e.splice(r, 1);
774
- n.splice(c, 0, l), x((t) => t.map((t) => t.id === o.id ? {
775
- ...t,
776
- cards: e
777
- } : t.id === s.id ? {
778
- ...t,
779
- cards: n
780
- } : t)), t && t(i, o.id, s.id, c);
781
- }
782
- }, T = h.useCallback((e) => {
783
- for (let t of b) {
784
- let n = t.cards.find((t) => t.id === e);
785
- if (n) return n;
786
- }
787
- return null;
788
- }, [b]), E = h.useCallback((e) => b.find((t) => t.cards.some((t) => t.id === e)) || null, [b]), D = h.useCallback((e) => b.find((t) => t.id === e) || null, [b]), O = h.useCallback((e, t) => {
789
- x((n) => n.map((n) => n.id === e ? {
790
- ...n,
791
- collapsed: t
792
- } : n)), n?.(e, t);
793
- }, [n]);
794
- return /* @__PURE__ */ (0, K.jsxs)(i, {
795
- sensors: S,
796
- collisionDetection: c,
797
- onDragStart: C,
798
- onDragEnd: w,
799
- children: [/* @__PURE__ */ (0, K.jsx)("div", {
800
- className: q("flex gap-4 overflow-x-auto p-4", s),
801
- children: b.map((e) => {
802
- let t = r && e.cards.length > o;
803
- return /* @__PURE__ */ (0, K.jsx)(Q, {
804
- column: e,
805
- cards: e.cards,
806
- onToggle: (t) => O(e.id, t),
807
- enableVirtual: t,
808
- quickAdd: d,
809
- onQuickAdd: p,
810
- conditionalFormatting: g
811
- }, e.id);
812
- })
813
- }), /* @__PURE__ */ (0, K.jsx)(u, { children: _ ? /* @__PURE__ */ (0, K.jsx)(Y, {
814
- card: _,
815
- conditionalFormatting: g
816
- }) : null })]
817
- });
818
- }
819
- //#endregion
820
- export { $ as KanbanEnhanced, $ as default };