@joewinke/jatui 0.2.2 → 0.2.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.
- package/dist/components/CommandPalette.svelte +1 -1
- package/dist/components/ConfirmDialog.svelte +1 -1
- package/dist/components/InputDialog.svelte +1 -1
- package/dist/components/Tabs.svelte +6 -6
- package/dist/components/shell/Sidebar.svelte +1 -1
- package/dist/components/shell/Sidebar.svelte.d.ts +1 -1
- package/dist/components/shell/shell.js +63 -60
- package/dist/components/table/DataTable.svelte +10 -1
- package/dist/components/toast/ToastHost.svelte +1 -1
- package/dist/components/toast/ToastItem.svelte +1 -1
- package/dist/components/toast/ToastItem.svelte.d.ts +1 -1
- package/dist/dnd/createDndBoard.js +329 -0
- package/dist/dnd/index.d.ts +2 -2
- package/dist/dnd/index.js +1 -1
- package/dist/dnd/types.d.ts +9 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +4 -4
- package/dist/showcase/AnimatedBeam.svelte +13 -10
- package/dist/stores/commandPalette.js +116 -0
- package/dist/stores/confirmDialog.js +37 -0
- package/dist/stores/inputDialog.js +37 -0
- package/dist/stores/toast.js +53 -0
- package/package.json +2 -2
- package/dist/dnd/createDndBoard.svelte.js +0 -217
- package/dist/stores/commandPalette.svelte.js +0 -82
- package/dist/stores/confirmDialog.svelte.js +0 -31
- package/dist/stores/inputDialog.svelte.js +0 -32
- package/dist/stores/toast.svelte.js +0 -33
- /package/dist/dnd/{createDndBoard.svelte.d.ts → createDndBoard.d.ts} +0 -0
- /package/dist/stores/{commandPalette.svelte.d.ts → commandPalette.d.ts} +0 -0
- /package/dist/stores/{confirmDialog.svelte.d.ts → confirmDialog.d.ts} +0 -0
- /package/dist/stores/{inputDialog.svelte.d.ts → inputDialog.d.ts} +0 -0
- /package/dist/stores/{toast.svelte.d.ts → toast.d.ts} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { tick } from 'svelte';
|
|
3
3
|
import { fly, fade } from 'svelte/transition';
|
|
4
4
|
import { cubicOut } from 'svelte/easing';
|
|
5
|
-
import { commandPalette, type CommandItem } from '../stores/commandPalette.
|
|
5
|
+
import { commandPalette, type CommandItem } from '../stores/commandPalette.js';
|
|
6
6
|
|
|
7
7
|
// Respect prefers-reduced-motion
|
|
8
8
|
const reducedMotion =
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { fly, fade } from 'svelte/transition';
|
|
3
3
|
import { cubicOut } from 'svelte/easing';
|
|
4
4
|
import { tick } from 'svelte';
|
|
5
|
-
import { getPending, confirmDialog, cancelDialog } from '../stores/confirmDialog
|
|
5
|
+
import { getPending, confirmDialog, cancelDialog } from '../stores/confirmDialog';
|
|
6
6
|
|
|
7
7
|
const pending = $derived(getPending());
|
|
8
8
|
const opts = $derived(pending?.options ?? null);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { fly, fade } from 'svelte/transition';
|
|
3
3
|
import { cubicOut } from 'svelte/easing';
|
|
4
4
|
import { tick } from 'svelte';
|
|
5
|
-
import { getPendingInput, submitInput, cancelInput } from '../stores/inputDialog
|
|
5
|
+
import { getPendingInput, submitInput, cancelInput } from '../stores/inputDialog';
|
|
6
6
|
|
|
7
7
|
const pending = $derived(getPendingInput());
|
|
8
8
|
const opts = $derived(pending?.options ?? null);
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
left: 0;
|
|
190
190
|
width: 1px;
|
|
191
191
|
height: 2px;
|
|
192
|
-
background-color:
|
|
192
|
+
background-color: var(--color-primary, oklch(55% 0.2 270));
|
|
193
193
|
transform-origin: left center;
|
|
194
194
|
border-radius: 1px;
|
|
195
195
|
transition:
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
border: none;
|
|
217
217
|
background: transparent;
|
|
218
218
|
cursor: pointer;
|
|
219
|
-
color: oklch
|
|
219
|
+
color: color-mix(in oklch, var(--color-base-content, oklch(20% 0 0)) 60%, transparent);
|
|
220
220
|
transition:
|
|
221
221
|
color var(--motion-fast, 150ms) var(--motion-glide, cubic-bezier(0.16, 1, 0.3, 1));
|
|
222
222
|
white-space: nowrap;
|
|
@@ -224,11 +224,11 @@
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
.tab-btn:hover:not(:disabled) {
|
|
227
|
-
color: oklch
|
|
227
|
+
color: color-mix(in oklch, var(--color-base-content, oklch(20% 0 0)) 85%, transparent);
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
.tab-btn.tab-active {
|
|
231
|
-
color:
|
|
231
|
+
color: var(--color-base-content, oklch(20% 0 0));
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
.tab-btn:disabled {
|
|
@@ -237,13 +237,13 @@
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
.tab-btn:focus-visible {
|
|
240
|
-
outline: 2px solid
|
|
240
|
+
outline: 2px solid var(--color-primary, oklch(55% 0.2 270));
|
|
241
241
|
outline-offset: 2px;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/* Underline: active tab gets primary color */
|
|
245
245
|
.tabs-underline .tab-btn.tab-active {
|
|
246
|
-
color:
|
|
246
|
+
color: var(--color-primary, oklch(55% 0.2 270));
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
/* Underline: button bottom padding so indicator aligns */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* icon — icon-only rail (no width transition — labels/groups hide via class swap)
|
|
8
8
|
* collapsed — completely hidden; mobile uses a Drawer overlay
|
|
9
9
|
*
|
|
10
|
-
* Pass a sidebarState from createSidebarState() (shell.ts) for persistence
|
|
10
|
+
* Pass a sidebarState from createSidebarState() (shell.svelte.ts) for persistence
|
|
11
11
|
* and active-item tracking. Without it, the sidebar is stateless.
|
|
12
12
|
*/
|
|
13
13
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* icon — icon-only rail (no width transition — labels/groups hide via class swap)
|
|
7
7
|
* collapsed — completely hidden; mobile uses a Drawer overlay
|
|
8
8
|
*
|
|
9
|
-
* Pass a sidebarState from createSidebarState() (shell.ts) for persistence
|
|
9
|
+
* Pass a sidebarState from createSidebarState() (shell.svelte.ts) for persistence
|
|
10
10
|
* and active-item tracking. Without it, the sidebar is stateless.
|
|
11
11
|
*/
|
|
12
12
|
import type { Snippet } from 'svelte';
|
|
@@ -1,65 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
* or prop drilling.
|
|
5
|
-
*
|
|
6
|
-
* Persistence: localStorage (fallback to cookie via document.cookie) keyed
|
|
7
|
-
* on `storageKey`. Set storageKey = '' to disable persistence.
|
|
8
|
-
*/
|
|
1
|
+
/* shell.svelte.js generated by Svelte v5.53.11 */
|
|
2
|
+
import * as $ from 'svelte/internal/client';
|
|
3
|
+
|
|
9
4
|
function readStorage(key) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
5
|
+
if (!key || typeof window === 'undefined') return null;
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
return localStorage.getItem(key);
|
|
9
|
+
} catch(_a) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
18
12
|
}
|
|
13
|
+
|
|
19
14
|
function writeStorage(key, value) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
15
|
+
if (!key || typeof window === 'undefined') return;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
localStorage.setItem(key, value);
|
|
19
|
+
} catch(_a) {
|
|
20
|
+
// silently fail if storage unavailable
|
|
21
|
+
}
|
|
28
22
|
}
|
|
23
|
+
|
|
29
24
|
export function createSidebarState(options) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
25
|
+
var _a, _b, _c;
|
|
26
|
+
var storageKey = (_a = options === null || options === void 0 ? void 0 : options.storageKey) !== null && _a !== void 0 ? _a : 'jatui-sidebar';
|
|
27
|
+
var defaultMode = (_b = options === null || options === void 0 ? void 0 : options.defaultMode) !== null && _b !== void 0 ? _b : 'expanded';
|
|
28
|
+
var storedMode = readStorage(storageKey);
|
|
29
|
+
var validModes = ['expanded', 'collapsed', 'icon'];
|
|
30
|
+
var initialMode = storedMode && validModes.includes(storedMode) ? storedMode : defaultMode;
|
|
31
|
+
var mode = $.state($.proxy(initialMode));
|
|
32
|
+
var activeId = $.state($.proxy((_c = options === null || options === void 0 ? void 0 : options.defaultActiveId) !== null && _c !== void 0 ? _c : ''));
|
|
33
|
+
var mobileOpen = $.state(false);
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
get mode() {
|
|
37
|
+
return $.safe_get(mode);
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
get activeId() {
|
|
41
|
+
return $.safe_get(activeId);
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
get mobileOpen() {
|
|
45
|
+
return $.safe_get(mobileOpen);
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
setMode(m) {
|
|
49
|
+
$.set(mode, m, true);
|
|
50
|
+
writeStorage(storageKey, m);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
toggleCollapse() {
|
|
54
|
+
var next = $.safe_get(mode) === 'expanded' ? 'icon' : 'expanded';
|
|
55
|
+
|
|
56
|
+
$.set(mode, next, true);
|
|
57
|
+
writeStorage(storageKey, next);
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
setActive(id) {
|
|
61
|
+
$.set(activeId, id, true);
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
setMobileOpen(open) {
|
|
65
|
+
$.set(mobileOpen, open, true);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -80,7 +80,16 @@
|
|
|
80
80
|
getPaginationRowModel: paginated ? getPaginationRowModel() : undefined,
|
|
81
81
|
renderFallbackValue: '',
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
const instance = createTable(opts);
|
|
84
|
+
// createTable takes a fully-resolved state — unlike the framework adapters it does
|
|
85
|
+
// not fill in defaults, so feature state we never touch (columnPinning, columnVisibility,
|
|
86
|
+
// …) lands undefined and getHeaderGroups() dies reading columnPinning.left. Merge the
|
|
87
|
+
// instance defaults under our reactive slices, the same way the TanStack adapters do.
|
|
88
|
+
instance.setOptions((prev) => ({
|
|
89
|
+
...prev,
|
|
90
|
+
state: { ...instance.initialState, ...opts.state },
|
|
91
|
+
}));
|
|
92
|
+
return instance;
|
|
84
93
|
});
|
|
85
94
|
|
|
86
95
|
const headerGroups = $derived(table.getHeaderGroups());
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/* createDndBoard.svelte.js generated by Svelte v5.53.11 */
|
|
2
|
+
import * as $ from 'svelte/internal/client';
|
|
3
|
+
|
|
4
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
5
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
6
|
+
if (ar || !(i in from)) {
|
|
7
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
8
|
+
|
|
9
|
+
ar[i] = from[i];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
17
|
+
import { extractClosestEdge, attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
18
|
+
import { SvelteMap } from 'svelte/reactivity';
|
|
19
|
+
import { announce } from './announce';
|
|
20
|
+
import { makeItemData, isItemData } from './types';
|
|
21
|
+
|
|
22
|
+
var SHADOW_KEY = '__dnd-shadow__';
|
|
23
|
+
|
|
24
|
+
export function createDndBoard(opts) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
var edges = (_a = opts.edges) !== null && _a !== void 0 ? _a : ['top', 'bottom'];
|
|
27
|
+
var hover = (_b = opts.hover) !== null && _b !== void 0 ? _b : 'indicator';
|
|
28
|
+
var mirror = new SvelteMap();
|
|
29
|
+
var dragging = $.state(null);
|
|
30
|
+
var proposal = $.state(null);
|
|
31
|
+
var seq = new Map();
|
|
32
|
+
var inFlight = 0;
|
|
33
|
+
var seedQueued = false;
|
|
34
|
+
|
|
35
|
+
function seed() {
|
|
36
|
+
mirror.clear();
|
|
37
|
+
|
|
38
|
+
var src = opts.items();
|
|
39
|
+
var entries = src instanceof Map ? src : new Map(Object.entries(src));
|
|
40
|
+
|
|
41
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
42
|
+
var _a = entries_1[_i], id = _a[0], list = _a[1];
|
|
43
|
+
|
|
44
|
+
mirror.set(id, __spreadArray([], list, true));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
$.user_effect(function () {
|
|
49
|
+
opts.items();
|
|
50
|
+
|
|
51
|
+
if ($.safe_get(dragging) || inFlight > 0) {
|
|
52
|
+
seedQueued = true;
|
|
53
|
+
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
seed();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
function placementFrom(dropTargets) {
|
|
61
|
+
var _a;
|
|
62
|
+
var inner = dropTargets[0];
|
|
63
|
+
|
|
64
|
+
if (!inner) return null;
|
|
65
|
+
|
|
66
|
+
var d = inner.data;
|
|
67
|
+
|
|
68
|
+
if (typeof d.container !== 'string') return null;
|
|
69
|
+
|
|
70
|
+
var list = (_a = mirror.get(d.container)) !== null && _a !== void 0 ? _a : [];
|
|
71
|
+
|
|
72
|
+
if (typeof d.index !== 'number') return { container: d.container, index: list.length };
|
|
73
|
+
|
|
74
|
+
var edge = extractClosestEdge(d);
|
|
75
|
+
var after = edge === 'bottom' || edge === 'right';
|
|
76
|
+
|
|
77
|
+
return { container: d.container, index: d.index + (after ? 1 : 0) };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function syncShadow(next) {
|
|
81
|
+
var _a;
|
|
82
|
+
var _b;
|
|
83
|
+
|
|
84
|
+
for (var _i = 0, mirror_1 = mirror; _i < mirror_1.length; _i++) {
|
|
85
|
+
var _c = mirror_1[_i], cid = _c[0], list_1 = _c[1];
|
|
86
|
+
|
|
87
|
+
var idx = list_1.findIndex(function (item) {
|
|
88
|
+
return item[SHADOW_KEY];
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
if (idx !== -1) {
|
|
92
|
+
list_1.splice(idx, 1);
|
|
93
|
+
mirror.set(cid, list_1);
|
|
94
|
+
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!next || !$.safe_get(dragging)) return;
|
|
100
|
+
|
|
101
|
+
var list = __spreadArray([], (_b = mirror.get(next.container)) !== null && _b !== void 0 ? _b : [], true);
|
|
102
|
+
|
|
103
|
+
var shadowItem = (
|
|
104
|
+
_a = {},
|
|
105
|
+
_a[SHADOW_KEY] = true,
|
|
106
|
+
_a.key = ("").concat(SHADOW_KEY, "-").concat($.safe_get(dragging).key),
|
|
107
|
+
_a
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
list.splice(Math.min(next.index, list.length), 0, shadowItem);
|
|
111
|
+
mirror.set(next.container, list);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function consider(next) {
|
|
115
|
+
if ((next === null || next === void 0 ? void 0 : next.container) === ($.safe_get(proposal) === null || $.safe_get(proposal) === void 0 ? void 0 : $.safe_get(proposal).container) && (next === null || next === void 0 ? void 0 : next.index) === ($.safe_get(proposal) === null || $.safe_get(proposal) === void 0 ? void 0 : $.safe_get(proposal).index)) return;
|
|
116
|
+
|
|
117
|
+
$.set(proposal, next, true);
|
|
118
|
+
|
|
119
|
+
if (hover === 'shadow') syncShadow(next);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function applyToMirror(move) {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
var fromList = __spreadArray([], (_a = mirror.get(move.from.container)) !== null && _a !== void 0 ? _a : [], true);
|
|
125
|
+
|
|
126
|
+
var toList = move.from.container === move.to.container
|
|
127
|
+
? fromList
|
|
128
|
+
: __spreadArray([], (_b = mirror.get(move.to.container)) !== null && _b !== void 0 ? _b : [], true);
|
|
129
|
+
|
|
130
|
+
var srcIdx = fromList.findIndex(function (it) {
|
|
131
|
+
return opts.key(it) === opts.key(move.item);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (srcIdx === -1) return;
|
|
135
|
+
|
|
136
|
+
fromList.splice(srcIdx, 1);
|
|
137
|
+
|
|
138
|
+
var destIdx = move.to.index;
|
|
139
|
+
|
|
140
|
+
if (move.from.container === move.to.container && move.to.index > move.from.index) {
|
|
141
|
+
destIdx = Math.max(0, destIdx - 1);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
toList.splice(Math.min(destIdx, toList.length), 0, move.item);
|
|
145
|
+
mirror.set(move.from.container, fromList);
|
|
146
|
+
|
|
147
|
+
if (move.from.container !== move.to.container) {
|
|
148
|
+
mirror.set(move.to.container, toList);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function rollback(move) {
|
|
153
|
+
var _a;
|
|
154
|
+
|
|
155
|
+
for (var _i = 0, mirror_2 = mirror; _i < mirror_2.length; _i++) {
|
|
156
|
+
var _b = mirror_2[_i], cid = _b[0], list = _b[1];
|
|
157
|
+
|
|
158
|
+
var idx = list.findIndex(function (it) {
|
|
159
|
+
return opts.key(it) === opts.key(move.item);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
if (idx !== -1) {
|
|
163
|
+
list.splice(idx, 1);
|
|
164
|
+
mirror.set(cid, list);
|
|
165
|
+
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var fromList = __spreadArray([], (_a = mirror.get(move.from.container)) !== null && _a !== void 0 ? _a : [], true);
|
|
171
|
+
|
|
172
|
+
fromList.splice(Math.min(move.from.index, fromList.length), 0, move.item);
|
|
173
|
+
mirror.set(move.from.container, fromList);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function finalize(dropped) {
|
|
177
|
+
var _a;
|
|
178
|
+
var drag = $.safe_get(dragging);
|
|
179
|
+
var to = dropped ? $.safe_get(proposal) : null;
|
|
180
|
+
|
|
181
|
+
$.set(dragging, null);
|
|
182
|
+
consider(null);
|
|
183
|
+
|
|
184
|
+
if (!drag) return;
|
|
185
|
+
|
|
186
|
+
if (!to || to.container === drag.from.container && to.index === drag.from.index) {
|
|
187
|
+
if (seedQueued && inFlight === 0) {
|
|
188
|
+
seedQueued = false;
|
|
189
|
+
seed();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
var move = { item: drag.item, from: drag.from, to };
|
|
196
|
+
|
|
197
|
+
applyToMirror(move);
|
|
198
|
+
|
|
199
|
+
if (opts.announce) announce(opts.announce(move));
|
|
200
|
+
|
|
201
|
+
var token = ((_a = seq.get(drag.key)) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
202
|
+
|
|
203
|
+
seq.set(drag.key, token);
|
|
204
|
+
inFlight++;
|
|
205
|
+
|
|
206
|
+
opts.commit(move).catch(function (error) {
|
|
207
|
+
var _a;
|
|
208
|
+
|
|
209
|
+
if (seq.get(drag.key) === token) rollback(move);
|
|
210
|
+
|
|
211
|
+
(_a = opts.onError) === null || _a === void 0 ? void 0 : _a.call(opts, error, move);
|
|
212
|
+
}).finally(function () {
|
|
213
|
+
inFlight--;
|
|
214
|
+
|
|
215
|
+
if (inFlight === 0 && seedQueued && !$.safe_get(dragging)) {
|
|
216
|
+
seedQueued = false;
|
|
217
|
+
seed();
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
$.user_effect(function () {
|
|
223
|
+
return monitorForElements({
|
|
224
|
+
canMonitor(_a) {
|
|
225
|
+
var source = _a.source;
|
|
226
|
+
|
|
227
|
+
return isItemData(source.data, opts.type);
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
onDragStart(_a) {
|
|
231
|
+
var source = _a.source;
|
|
232
|
+
var d = source.data;
|
|
233
|
+
|
|
234
|
+
$.set(
|
|
235
|
+
dragging,
|
|
236
|
+
{
|
|
237
|
+
key: d.key,
|
|
238
|
+
item: d.item,
|
|
239
|
+
from: { container: d.container, index: d.index }
|
|
240
|
+
},
|
|
241
|
+
true
|
|
242
|
+
);
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
onDropTargetChange(_a) {
|
|
246
|
+
var location = _a.location;
|
|
247
|
+
|
|
248
|
+
consider(placementFrom(location.current.dropTargets));
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
onDrag(_a) {
|
|
252
|
+
var location = _a.location;
|
|
253
|
+
|
|
254
|
+
consider(placementFrom(location.current.dropTargets));
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
onDrop(_a) {
|
|
258
|
+
var location = _a.location;
|
|
259
|
+
|
|
260
|
+
finalize(location.current.dropTargets.length > 0);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
return {
|
|
266
|
+
get(container) {
|
|
267
|
+
var _a;
|
|
268
|
+
|
|
269
|
+
return (_a = mirror.get(container)) !== null && _a !== void 0 ? _a : [];
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
containers() {
|
|
273
|
+
return __spreadArray([], mirror.keys(), true);
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
get dragging() {
|
|
277
|
+
return $.safe_get(dragging);
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
get proposal() {
|
|
281
|
+
return $.safe_get(proposal);
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
isSource(item) {
|
|
285
|
+
return ($.safe_get(dragging) === null || $.safe_get(dragging) === void 0 ? void 0 : $.safe_get(dragging).key) === opts.key(item);
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
isShadow(item) {
|
|
289
|
+
return !!item[SHADOW_KEY];
|
|
290
|
+
},
|
|
291
|
+
|
|
292
|
+
item(item, container, index) {
|
|
293
|
+
return {
|
|
294
|
+
data() {
|
|
295
|
+
return makeItemData({ type: opts.type, key: opts.key(item), item, container, index });
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
itemTarget(container, index) {
|
|
301
|
+
return {
|
|
302
|
+
data(feedback) {
|
|
303
|
+
return attachClosestEdge({ type: ("").concat(opts.type, "-target"), container, index }, {
|
|
304
|
+
input: feedback.input,
|
|
305
|
+
element: feedback.element,
|
|
306
|
+
allowedEdges: edges
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
|
|
310
|
+
accepts(d) {
|
|
311
|
+
return isItemData(d, opts.type);
|
|
312
|
+
},
|
|
313
|
+
sticky: true
|
|
314
|
+
};
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
containerTarget(container) {
|
|
318
|
+
return {
|
|
319
|
+
data() {
|
|
320
|
+
return { type: ("").concat(opts.type, "-target"), container };
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
accepts(d) {
|
|
324
|
+
return isItemData(d, opts.type);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
package/dist/dnd/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { draggable } from './draggable';
|
|
|
2
2
|
export type { DraggableParams } from './draggable';
|
|
3
3
|
export { dropTarget } from './dropTarget';
|
|
4
4
|
export type { DropTargetParams } from './dropTarget';
|
|
5
|
-
export { createDndBoard } from './createDndBoard
|
|
6
|
-
export type { BoardMove, DndBoardOptions } from './createDndBoard
|
|
5
|
+
export { createDndBoard } from './createDndBoard';
|
|
6
|
+
export type { BoardMove, DndBoardOptions } from './createDndBoard';
|
|
7
7
|
export { default as DropIndicator } from './DropIndicator.svelte';
|
|
8
8
|
export { autoScroll } from './autoScroll';
|
|
9
9
|
export type { AutoScrollParams } from './autoScroll';
|
package/dist/dnd/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { draggable } from './draggable';
|
|
2
2
|
export { dropTarget } from './dropTarget';
|
|
3
|
-
export { createDndBoard } from './createDndBoard
|
|
3
|
+
export { createDndBoard } from './createDndBoard';
|
|
4
4
|
export { default as DropIndicator } from './DropIndicator.svelte';
|
|
5
5
|
export { autoScroll } from './autoScroll';
|
|
6
6
|
export { announce, cleanupAnnouncements } from './announce';
|
package/dist/dnd/types.d.ts
CHANGED
|
@@ -2,7 +2,16 @@ import type { Input } from '@atlaskit/pragmatic-drag-and-drop/types';
|
|
|
2
2
|
export interface DragData extends Record<string | symbol, unknown> {
|
|
3
3
|
readonly type: string;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Module-scoped Symbol brand for board-managed items.
|
|
7
|
+
* ⚠ Symbol identity = module identity. Two copies of this module on one page makes
|
|
8
|
+
* isItemData() return false across the boundary — dnd/ must exist EXACTLY ONCE.
|
|
9
|
+
* Declare all @atlaskit/pragmatic-drag-and-drop* packages as peerDependencies in
|
|
10
|
+
* the host app (host owns the single instance).
|
|
11
|
+
*/
|
|
12
|
+
declare const ITEM: unique symbol;
|
|
5
13
|
export interface ItemDragData<TItem = unknown> extends DragData {
|
|
14
|
+
readonly [ITEM]: true;
|
|
6
15
|
readonly key: string;
|
|
7
16
|
readonly item: TItem;
|
|
8
17
|
readonly container: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,11 +15,11 @@ export { default as UserAvatar } from './components/UserAvatar.svelte';
|
|
|
15
15
|
export { default as SidebarUserFooter } from './components/SidebarUserFooter.svelte';
|
|
16
16
|
export { default as TaskTypeIcon } from './components/TaskTypeIcon.svelte';
|
|
17
17
|
export { default as ConfirmDialog } from './components/ConfirmDialog.svelte';
|
|
18
|
-
export { showConfirm, confirmDialog, cancelDialog, getPending } from './stores/confirmDialog
|
|
19
|
-
export type { ConfirmOptions } from './stores/confirmDialog
|
|
18
|
+
export { showConfirm, confirmDialog, cancelDialog, getPending } from './stores/confirmDialog';
|
|
19
|
+
export type { ConfirmOptions } from './stores/confirmDialog';
|
|
20
20
|
export { default as InputDialog } from './components/InputDialog.svelte';
|
|
21
|
-
export { showInput, submitInput, cancelInput, getPendingInput } from './stores/inputDialog
|
|
22
|
-
export type { InputOptions } from './stores/inputDialog
|
|
21
|
+
export { showInput, submitInput, cancelInput, getPendingInput } from './stores/inputDialog';
|
|
22
|
+
export type { InputOptions } from './stores/inputDialog';
|
|
23
23
|
export { default as SearchDropdown } from './components/SearchDropdown.svelte';
|
|
24
24
|
export { default as FilterDropdown } from './components/FilterDropdown.svelte';
|
|
25
25
|
export { default as ContextMenu } from './components/ContextMenu.svelte';
|
|
@@ -158,16 +158,16 @@ export { play as playSound, registerSound, isSoundEnabled, setSoundEnabled } fro
|
|
|
158
158
|
export { splitText } from './utils/splitText';
|
|
159
159
|
export type { SplitBy, SplitTextOptions, SplitTextResult } from './utils/splitText';
|
|
160
160
|
export { default as ToastHost } from './components/toast/ToastHost.svelte';
|
|
161
|
-
export { showToast, dismissToast, getToasts } from './stores/toast
|
|
162
|
-
export type { Toast, ToastType, ToastOptions, DismissHandle } from './stores/toast
|
|
161
|
+
export { showToast, dismissToast, getToasts } from './stores/toast';
|
|
162
|
+
export type { Toast, ToastType, ToastOptions, DismissHandle } from './stores/toast';
|
|
163
163
|
export { default as Skeleton } from './components/Skeleton.svelte';
|
|
164
164
|
export { default as ProgressBar } from './components/progress/ProgressBar.svelte';
|
|
165
165
|
export { default as ProgressRing } from './components/progress/ProgressRing.svelte';
|
|
166
166
|
export { default as Steps } from './components/progress/Steps.svelte';
|
|
167
167
|
export { default as Tabs } from './components/Tabs.svelte';
|
|
168
168
|
export { default as CommandPalette } from './components/CommandPalette.svelte';
|
|
169
|
-
export { commandPalette } from './stores/commandPalette
|
|
170
|
-
export type { CommandItem } from './stores/commandPalette
|
|
169
|
+
export { commandPalette } from './stores/commandPalette';
|
|
170
|
+
export type { CommandItem } from './stores/commandPalette';
|
|
171
171
|
export { default as AnimatedNumber } from './components/AnimatedNumber.svelte';
|
|
172
172
|
export { default as CopyButton } from './components/CopyButton.svelte';
|
|
173
173
|
export { default as HoldToConfirm } from './components/HoldToConfirm.svelte';
|