@joewinke/jatui 0.2.12 → 0.2.13
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/actions/attention.js +21 -13
- package/dist/actions/collapse.js +15 -29
- package/dist/actions/floating.js +29 -37
- package/dist/actions/listNav.js +108 -137
- package/dist/actions/railNav.js +72 -89
- package/dist/actions/staggerEntrance.js +19 -23
- package/dist/actions/tooltip.js +63 -51
- package/dist/assets/sounds/error.js +1 -1
- package/dist/assets/sounds/notify.js +1 -1
- package/dist/assets/sounds/pop.js +1 -1
- package/dist/assets/sounds/send.js +1 -1
- package/dist/assets/sounds/success.js +1 -1
- package/dist/assets/sounds/toggle.js +1 -1
- package/dist/components/graph/theme.js +26 -36
- package/dist/components/markup.js +59 -62
- package/dist/components/session-nav/transcriptModel.js +49 -66
- package/dist/components/shell/shell.js +14 -15
- package/dist/components/table/flexRender.js +2 -2
- package/dist/data/emojis.js +4 -4
- package/dist/dnd/autoScroll.js +10 -12
- package/dist/dnd/createDndBoard.js +94 -185
- package/dist/dnd/draggable.js +15 -23
- package/dist/dnd/dropTarget.js +15 -29
- package/dist/dnd/types.d.ts +9 -0
- package/dist/dnd/types.js +2 -14
- package/dist/showcase/generative/intent.js +19 -21
- package/dist/showcase/generative/manifest.js +27 -80
- package/dist/showcase/scroll/scrollProgress.js +20 -22
- package/dist/showcase/scroll/scrollReveal.js +17 -20
- package/dist/stores/commandPalette.js +18 -46
- package/dist/stores/confirmDialog.js +9 -9
- package/dist/stores/inputDialog.js +9 -9
- package/dist/stores/toast.js +10 -33
- package/dist/transitions/glide.js +29 -25
- package/dist/types/booking.js +4 -4
- package/dist/types/comments.js +2 -2
- package/dist/types/messaging.js +3 -3
- package/dist/types/pipeline.js +2 -2
- package/dist/utils/currency.js +2 -4
- package/dist/utils/daisyuiColors.js +25 -27
- package/dist/utils/dateFormatters.js +44 -44
- package/dist/utils/googleMapsLoader.js +46 -100
- package/dist/utils/mentionParser.js +30 -30
- package/dist/utils/phone.js +21 -27
- package/dist/utils/phoneFormat.js +9 -9
- package/dist/utils/sound.js +27 -78
- package/dist/utils/splitText.js +15 -26
- package/dist/utils/taskUtils.js +1 -1
- package/dist/utils/themeWipe.js +27 -72
- package/dist/utils/viewTransition.js +6 -51
- package/package.json +7 -3
- package/dist/dnd/createDndBoard.test.d.ts +0 -1
- package/dist/dnd/createDndBoard.test.js +0 -261
|
@@ -1,41 +1,27 @@
|
|
|
1
1
|
/* createDndBoard.svelte.js generated by Svelte v5.53.11 */
|
|
2
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
3
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
17
4
|
import { extractClosestEdge, attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
18
5
|
import { SvelteMap } from 'svelte/reactivity';
|
|
19
6
|
import { announce } from './announce';
|
|
20
7
|
import { makeItemData, isItemData } from './types';
|
|
21
8
|
|
|
22
|
-
|
|
9
|
+
const SHADOW_KEY = '__dnd-shadow__';
|
|
23
10
|
|
|
24
11
|
export function createDndBoard(opts) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var seedQueued = false;
|
|
12
|
+
const edges = opts.edges ?? ['top', 'bottom'];
|
|
13
|
+
const hover = opts.hover ?? 'indicator';
|
|
14
|
+
const mirror = new SvelteMap();
|
|
15
|
+
let dragging = $.state(null);
|
|
16
|
+
let proposal = $.state(null);
|
|
17
|
+
const seq = new Map();
|
|
18
|
+
let inFlight = 0;
|
|
19
|
+
let seedQueued = false;
|
|
34
20
|
|
|
35
21
|
function seed() {
|
|
36
22
|
mirror.clear();
|
|
37
23
|
|
|
38
|
-
|
|
24
|
+
const src = opts.items();
|
|
39
25
|
|
|
40
26
|
// Iterate a real ARRAY, never a Map/iterator directly. This module is
|
|
41
27
|
// downlevelled by the package build (svelte-package emits ES5-ish output:
|
|
@@ -45,13 +31,9 @@ export function createDndBoard(opts) {
|
|
|
45
31
|
// loop never runs; slice on an iterator returns []). Iterating a Map here
|
|
46
32
|
// left the render mirror permanently empty → every board rendered blank.
|
|
47
33
|
// `Array.from(map)` is a runtime call, so it survives the downlevel intact.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
51
|
-
var _a = entries_1[_i], id = _a[0], list = _a[1];
|
|
34
|
+
const entries = src instanceof Map ? Array.from(src) : Object.entries(src);
|
|
52
35
|
|
|
53
|
-
|
|
54
|
-
}
|
|
36
|
+
for (const [id, list] of entries) mirror.set(id, [...list]);
|
|
55
37
|
}
|
|
56
38
|
|
|
57
39
|
// Seed synchronously at creation so the render mirror is populated for the very
|
|
@@ -65,10 +47,10 @@ export function createDndBoard(opts) {
|
|
|
65
47
|
// user_effect with no active reaction → effect_orphan (a 500 on any page that
|
|
66
48
|
// server-renders a board). The synchronous seed above covers the SSR render.
|
|
67
49
|
if (typeof window !== 'undefined') {
|
|
68
|
-
$.user_effect(
|
|
50
|
+
$.user_effect(() => {
|
|
69
51
|
opts.items();
|
|
70
52
|
|
|
71
|
-
if ($.
|
|
53
|
+
if ($.get(dragging) || inFlight > 0) {
|
|
72
54
|
seedQueued = true;
|
|
73
55
|
|
|
74
56
|
return;
|
|
@@ -79,62 +61,52 @@ export function createDndBoard(opts) {
|
|
|
79
61
|
}
|
|
80
62
|
|
|
81
63
|
function placementFrom(dropTargets) {
|
|
82
|
-
|
|
83
|
-
var inner = dropTargets[0];
|
|
64
|
+
const inner = dropTargets[0];
|
|
84
65
|
|
|
85
66
|
if (!inner) return null;
|
|
86
67
|
|
|
87
|
-
|
|
68
|
+
const d = inner.data;
|
|
88
69
|
|
|
89
70
|
if (typeof d.container !== 'string') return null;
|
|
90
71
|
|
|
91
|
-
|
|
72
|
+
const list = mirror.get(d.container) ?? [];
|
|
92
73
|
|
|
93
74
|
if (typeof d.index !== 'number') return { container: d.container, index: list.length };
|
|
94
75
|
|
|
95
|
-
|
|
96
|
-
|
|
76
|
+
const edge = extractClosestEdge(d);
|
|
77
|
+
const after = edge === 'bottom' || edge === 'right';
|
|
97
78
|
|
|
98
79
|
return { container: d.container, index: d.index + (after ? 1 : 0) };
|
|
99
80
|
}
|
|
100
81
|
|
|
101
82
|
function syncShadow(next) {
|
|
102
|
-
var _a;
|
|
103
|
-
var _b;
|
|
104
|
-
|
|
105
83
|
// Array.from — never iterate the SvelteMap directly (downlevel breaks it; see seed()).
|
|
106
|
-
for (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var idx = list_1.findIndex(function (item) {
|
|
110
|
-
return item[SHADOW_KEY];
|
|
111
|
-
});
|
|
84
|
+
for (const [cid, list] of Array.from(mirror)) {
|
|
85
|
+
const idx = list.findIndex((item) => item[SHADOW_KEY]);
|
|
112
86
|
|
|
113
87
|
if (idx !== -1) {
|
|
114
|
-
|
|
115
|
-
mirror.set(cid,
|
|
88
|
+
list.splice(idx, 1);
|
|
89
|
+
mirror.set(cid, list);
|
|
116
90
|
|
|
117
91
|
break;
|
|
118
92
|
}
|
|
119
93
|
}
|
|
120
94
|
|
|
121
|
-
if (!next || !$.
|
|
95
|
+
if (!next || !$.get(dragging)) return;
|
|
122
96
|
|
|
123
|
-
|
|
97
|
+
const list = [...mirror.get(next.container) ?? []];
|
|
124
98
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
_a
|
|
130
|
-
);
|
|
99
|
+
const shadowItem = {
|
|
100
|
+
[SHADOW_KEY]: true,
|
|
101
|
+
key: `${SHADOW_KEY}-${$.get(dragging).key}`
|
|
102
|
+
};
|
|
131
103
|
|
|
132
104
|
list.splice(Math.min(next.index, list.length), 0, shadowItem);
|
|
133
105
|
mirror.set(next.container, list);
|
|
134
106
|
}
|
|
135
107
|
|
|
136
108
|
function consider(next) {
|
|
137
|
-
if (
|
|
109
|
+
if (next?.container === $.get(proposal)?.container && next?.index === $.get(proposal)?.index) return;
|
|
138
110
|
|
|
139
111
|
$.set(proposal, next, true);
|
|
140
112
|
|
|
@@ -142,22 +114,15 @@ export function createDndBoard(opts) {
|
|
|
142
114
|
}
|
|
143
115
|
|
|
144
116
|
function applyToMirror(move) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
var toList = move.from.container === move.to.container
|
|
149
|
-
? fromList
|
|
150
|
-
: __spreadArray([], (_b = mirror.get(move.to.container)) !== null && _b !== void 0 ? _b : [], true);
|
|
151
|
-
|
|
152
|
-
var srcIdx = fromList.findIndex(function (it) {
|
|
153
|
-
return opts.key(it) === opts.key(move.item);
|
|
154
|
-
});
|
|
117
|
+
const fromList = [...mirror.get(move.from.container) ?? []];
|
|
118
|
+
const toList = move.from.container === move.to.container ? fromList : [...mirror.get(move.to.container) ?? []];
|
|
119
|
+
const srcIdx = fromList.findIndex((it) => opts.key(it) === opts.key(move.item));
|
|
155
120
|
|
|
156
121
|
if (srcIdx === -1) return;
|
|
157
122
|
|
|
158
123
|
fromList.splice(srcIdx, 1);
|
|
159
124
|
|
|
160
|
-
|
|
125
|
+
let destIdx = move.to.index;
|
|
161
126
|
|
|
162
127
|
if (move.from.container === move.to.container && move.to.index > move.from.index) {
|
|
163
128
|
destIdx = Math.max(0, destIdx - 1);
|
|
@@ -172,15 +137,9 @@ export function createDndBoard(opts) {
|
|
|
172
137
|
}
|
|
173
138
|
|
|
174
139
|
function rollback(move) {
|
|
175
|
-
var _a;
|
|
176
|
-
|
|
177
140
|
// Array.from — never iterate the SvelteMap directly (downlevel breaks it; see seed()).
|
|
178
|
-
for (
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
var idx = list.findIndex(function (it) {
|
|
182
|
-
return opts.key(it) === opts.key(move.item);
|
|
183
|
-
});
|
|
141
|
+
for (const [cid, list] of Array.from(mirror)) {
|
|
142
|
+
const idx = list.findIndex((it) => opts.key(it) === opts.key(move.item));
|
|
184
143
|
|
|
185
144
|
if (idx !== -1) {
|
|
186
145
|
list.splice(idx, 1);
|
|
@@ -190,16 +149,15 @@ export function createDndBoard(opts) {
|
|
|
190
149
|
}
|
|
191
150
|
}
|
|
192
151
|
|
|
193
|
-
|
|
152
|
+
const fromList = [...mirror.get(move.from.container) ?? []];
|
|
194
153
|
|
|
195
154
|
fromList.splice(Math.min(move.from.index, fromList.length), 0, move.item);
|
|
196
155
|
mirror.set(move.from.container, fromList);
|
|
197
156
|
}
|
|
198
157
|
|
|
199
158
|
function finalize(dropped) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
var to = dropped ? $.safe_get(proposal) : null;
|
|
159
|
+
const drag = $.get(dragging);
|
|
160
|
+
const to = dropped ? $.get(proposal) : null;
|
|
203
161
|
|
|
204
162
|
$.set(dragging, null);
|
|
205
163
|
consider(null);
|
|
@@ -215,27 +173,25 @@ export function createDndBoard(opts) {
|
|
|
215
173
|
return;
|
|
216
174
|
}
|
|
217
175
|
|
|
218
|
-
|
|
176
|
+
const move = { item: drag.item, from: drag.from, to };
|
|
219
177
|
|
|
220
178
|
applyToMirror(move);
|
|
221
179
|
|
|
222
180
|
if (opts.announce) announce(opts.announce(move));
|
|
223
181
|
|
|
224
|
-
|
|
182
|
+
const token = (seq.get(drag.key) ?? 0) + 1;
|
|
225
183
|
|
|
226
184
|
seq.set(drag.key, token);
|
|
227
185
|
inFlight++;
|
|
228
186
|
|
|
229
|
-
opts.commit(move).catch(
|
|
230
|
-
var _a;
|
|
231
|
-
|
|
187
|
+
opts.commit(move).catch((error) => {
|
|
232
188
|
if (seq.get(drag.key) === token) rollback(move);
|
|
233
189
|
|
|
234
|
-
|
|
235
|
-
}).finally(
|
|
190
|
+
opts.onError?.(error, move);
|
|
191
|
+
}).finally(() => {
|
|
236
192
|
inFlight--;
|
|
237
193
|
|
|
238
|
-
if (inFlight === 0 && seedQueued && !$.
|
|
194
|
+
if (inFlight === 0 && seedQueued && !$.get(dragging)) {
|
|
239
195
|
seedQueued = false;
|
|
240
196
|
seed();
|
|
241
197
|
}
|
|
@@ -244,111 +200,64 @@ export function createDndBoard(opts) {
|
|
|
244
200
|
|
|
245
201
|
// Drag monitor — CLIENT ONLY (same effect_orphan reason as the seed effect;
|
|
246
202
|
// monitorForElements also needs the DOM, which does not exist during SSR).
|
|
247
|
-
if (typeof window !== 'undefined') $.user_effect(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
{
|
|
262
|
-
key: d.key,
|
|
263
|
-
item: d.item,
|
|
264
|
-
from: { container: d.container, index: d.index }
|
|
265
|
-
},
|
|
266
|
-
true
|
|
267
|
-
);
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
onDropTargetChange(_a) {
|
|
271
|
-
var location = _a.location;
|
|
272
|
-
|
|
273
|
-
consider(placementFrom(location.current.dropTargets));
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
onDrag(_a) {
|
|
277
|
-
var location = _a.location;
|
|
278
|
-
|
|
279
|
-
consider(placementFrom(location.current.dropTargets));
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
onDrop(_a) {
|
|
283
|
-
var location = _a.location;
|
|
284
|
-
|
|
285
|
-
finalize(location.current.dropTargets.length > 0);
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
return {
|
|
291
|
-
get(container) {
|
|
292
|
-
var _a;
|
|
293
|
-
|
|
294
|
-
return (_a = mirror.get(container)) !== null && _a !== void 0 ? _a : [];
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
containers() {
|
|
298
|
-
return Array.from(mirror.keys());
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
get dragging() {
|
|
302
|
-
return $.safe_get(dragging);
|
|
203
|
+
if (typeof window !== 'undefined') $.user_effect(() => monitorForElements({
|
|
204
|
+
canMonitor: ({ source }) => isItemData(source.data, opts.type),
|
|
205
|
+
onDragStart({ source }) {
|
|
206
|
+
const d = source.data;
|
|
207
|
+
|
|
208
|
+
$.set(
|
|
209
|
+
dragging,
|
|
210
|
+
{
|
|
211
|
+
key: d.key,
|
|
212
|
+
item: d.item,
|
|
213
|
+
from: { container: d.container, index: d.index }
|
|
214
|
+
},
|
|
215
|
+
true
|
|
216
|
+
);
|
|
303
217
|
},
|
|
304
218
|
|
|
305
|
-
|
|
306
|
-
|
|
219
|
+
onDropTargetChange({ location }) {
|
|
220
|
+
consider(placementFrom(location.current.dropTargets));
|
|
307
221
|
},
|
|
308
222
|
|
|
309
|
-
|
|
310
|
-
|
|
223
|
+
onDrag({ location }) {
|
|
224
|
+
consider(placementFrom(location.current.dropTargets));
|
|
311
225
|
},
|
|
312
226
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
227
|
+
onDrop({ location }) {
|
|
228
|
+
finalize(location.current.dropTargets.length > 0);
|
|
229
|
+
}
|
|
230
|
+
}));
|
|
316
231
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
};
|
|
232
|
+
return {
|
|
233
|
+
get: (container) => mirror.get(container) ?? [],
|
|
234
|
+
containers: () => Array.from(mirror.keys()),
|
|
235
|
+
get dragging() {
|
|
236
|
+
return $.get(dragging);
|
|
323
237
|
},
|
|
324
238
|
|
|
325
|
-
|
|
326
|
-
return
|
|
327
|
-
data(feedback) {
|
|
328
|
-
return attachClosestEdge({ type: ("").concat(opts.type, "-target"), container, index }, {
|
|
329
|
-
input: feedback.input,
|
|
330
|
-
element: feedback.element,
|
|
331
|
-
allowedEdges: edges
|
|
332
|
-
});
|
|
333
|
-
},
|
|
334
|
-
|
|
335
|
-
accepts(d) {
|
|
336
|
-
return isItemData(d, opts.type);
|
|
337
|
-
},
|
|
338
|
-
sticky: true
|
|
339
|
-
};
|
|
239
|
+
get proposal() {
|
|
240
|
+
return $.get(proposal);
|
|
340
241
|
},
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
242
|
+
isSource: (item) => $.get(dragging)?.key === opts.key(item),
|
|
243
|
+
isShadow: (item) => !!item[SHADOW_KEY],
|
|
244
|
+
item: (item, container, index) => ({
|
|
245
|
+
data: () => makeItemData({ type: opts.type, key: opts.key(item), item, container, index })
|
|
246
|
+
}),
|
|
247
|
+
|
|
248
|
+
itemTarget: (container, index) => ({
|
|
249
|
+
data: (feedback) => attachClosestEdge({ type: `${opts.type}-target`, container, index }, {
|
|
250
|
+
input: feedback.input,
|
|
251
|
+
element: feedback.element,
|
|
252
|
+
allowedEdges: edges
|
|
253
|
+
}),
|
|
254
|
+
accepts: (d) => isItemData(d, opts.type),
|
|
255
|
+
sticky: true
|
|
256
|
+
}),
|
|
257
|
+
|
|
258
|
+
containerTarget: (container) => ({
|
|
259
|
+
data: () => ({ type: `${opts.type}-target`, container }),
|
|
260
|
+
accepts: (d) => isItemData(d, opts.type)
|
|
261
|
+
})
|
|
353
262
|
};
|
|
354
263
|
}
|
package/dist/dnd/draggable.js
CHANGED
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
import { draggable as registerDraggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
2
2
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export const draggable = ((node, params) => {
|
|
4
|
+
let current = params;
|
|
5
|
+
let cleanup;
|
|
6
6
|
function register() {
|
|
7
7
|
cleanup = registerDraggable({
|
|
8
8
|
element: node,
|
|
9
9
|
dragHandle: current.dragHandle,
|
|
10
|
-
canDrag:
|
|
11
|
-
getInitialData:
|
|
12
|
-
onGenerateDragPreview
|
|
13
|
-
var source = _a.source, nativeSetDragImage = _a.nativeSetDragImage;
|
|
10
|
+
canDrag: () => !(current.disabled?.() ?? false),
|
|
11
|
+
getInitialData: () => current.data(),
|
|
12
|
+
onGenerateDragPreview({ source, nativeSetDragImage }) {
|
|
14
13
|
if (!current.preview)
|
|
15
14
|
return;
|
|
16
15
|
setCustomNativeDragPreview({
|
|
17
|
-
render:
|
|
18
|
-
|
|
19
|
-
return current.preview(container, source.data);
|
|
20
|
-
},
|
|
21
|
-
nativeSetDragImage: nativeSetDragImage,
|
|
16
|
+
render: ({ container }) => current.preview(container, source.data),
|
|
17
|
+
nativeSetDragImage,
|
|
22
18
|
});
|
|
23
19
|
},
|
|
24
|
-
onDragStart
|
|
25
|
-
var _b;
|
|
26
|
-
var source = _a.source;
|
|
20
|
+
onDragStart({ source }) {
|
|
27
21
|
node.dataset.dragging = 'true';
|
|
28
|
-
|
|
22
|
+
current.onDragStart?.(source.data);
|
|
29
23
|
},
|
|
30
|
-
onDrop
|
|
31
|
-
var _b;
|
|
32
|
-
var source = _a.source;
|
|
24
|
+
onDrop({ source }) {
|
|
33
25
|
delete node.dataset.dragging;
|
|
34
|
-
|
|
26
|
+
current.onDrop?.(source.data);
|
|
35
27
|
},
|
|
36
28
|
});
|
|
37
29
|
}
|
|
38
30
|
register();
|
|
39
31
|
return {
|
|
40
|
-
update
|
|
41
|
-
|
|
32
|
+
update(next) {
|
|
33
|
+
const handleChanged = next.dragHandle !== current.dragHandle;
|
|
42
34
|
current = next;
|
|
43
35
|
if (handleChanged) {
|
|
44
36
|
cleanup();
|
|
45
37
|
register();
|
|
46
38
|
}
|
|
47
39
|
},
|
|
48
|
-
destroy:
|
|
40
|
+
destroy: () => cleanup(),
|
|
49
41
|
};
|
|
50
42
|
});
|
package/dist/dnd/dropTarget.js
CHANGED
|
@@ -1,43 +1,29 @@
|
|
|
1
1
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export const dropTarget = ((node, params) => {
|
|
3
|
+
let current = params;
|
|
4
|
+
const cleanup = dropTargetForElements({
|
|
5
5
|
element: node,
|
|
6
|
-
getData:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
canDrop: function (_a) {
|
|
11
|
-
var _b, _c;
|
|
12
|
-
var source = _a.source;
|
|
13
|
-
return (_c = (_b = current.accepts) === null || _b === void 0 ? void 0 : _b.call(current, source.data)) !== null && _c !== void 0 ? _c : true;
|
|
14
|
-
},
|
|
15
|
-
getIsSticky: function () { var _a; return (_a = current.sticky) !== null && _a !== void 0 ? _a : false; },
|
|
16
|
-
onDragEnter: function (_a) {
|
|
17
|
-
var _b;
|
|
18
|
-
var source = _a.source;
|
|
6
|
+
getData: ({ input, element, source }) => current.data({ input, element, source }),
|
|
7
|
+
canDrop: ({ source }) => current.accepts?.(source.data) ?? true,
|
|
8
|
+
getIsSticky: () => current.sticky ?? false,
|
|
9
|
+
onDragEnter({ source }) {
|
|
19
10
|
node.dataset.dropOver = 'true';
|
|
20
|
-
|
|
11
|
+
current.onEnter?.(source.data);
|
|
21
12
|
},
|
|
22
|
-
onDragLeave
|
|
23
|
-
var _a;
|
|
13
|
+
onDragLeave() {
|
|
24
14
|
delete node.dataset.dropOver;
|
|
25
|
-
|
|
15
|
+
current.onLeave?.();
|
|
26
16
|
},
|
|
27
|
-
onDrag
|
|
28
|
-
|
|
29
|
-
var self = _a.self, source = _a.source;
|
|
30
|
-
(_b = current.onMove) === null || _b === void 0 ? void 0 : _b.call(current, self.data, source.data);
|
|
17
|
+
onDrag({ self, source }) {
|
|
18
|
+
current.onMove?.(self.data, source.data);
|
|
31
19
|
},
|
|
32
|
-
onDrop
|
|
33
|
-
var _b;
|
|
34
|
-
var self = _a.self, source = _a.source;
|
|
20
|
+
onDrop({ self, source }) {
|
|
35
21
|
delete node.dataset.dropOver;
|
|
36
|
-
|
|
22
|
+
current.onDropped?.(self.data, source.data);
|
|
37
23
|
},
|
|
38
24
|
});
|
|
39
25
|
return {
|
|
40
|
-
update
|
|
26
|
+
update(next) {
|
|
41
27
|
current = next;
|
|
42
28
|
},
|
|
43
29
|
destroy: cleanup,
|
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/dnd/types.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
/**
|
|
13
2
|
* Module-scoped Symbol brand for board-managed items.
|
|
14
3
|
* ⚠ Symbol identity = module identity. Two copies of this module on one page makes
|
|
@@ -16,10 +5,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
16
5
|
* Declare all @atlaskit/pragmatic-drag-and-drop* packages as peerDependencies in
|
|
17
6
|
* the host app (host owns the single instance).
|
|
18
7
|
*/
|
|
19
|
-
|
|
8
|
+
const ITEM = Symbol('jatui-dnd-item');
|
|
20
9
|
export function makeItemData(args) {
|
|
21
|
-
|
|
22
|
-
return __assign(__assign({}, args), (_a = {}, _a[ITEM] = true, _a));
|
|
10
|
+
return { ...args, [ITEM]: true };
|
|
23
11
|
}
|
|
24
12
|
export function isItemData(data, type) {
|
|
25
13
|
return data[ITEM] === true && (type === undefined || data.type === type);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
const INTENTS_KEY = 'jatui-gen-intents';
|
|
2
2
|
/**
|
|
3
3
|
* Standard ratio buckets, ordered widest to tallest.
|
|
4
4
|
* quantizeRatio maps a measured w×h to the nearest bucket.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
const RATIO_BUCKETS = [
|
|
7
7
|
{ label: '21:9', value: 21 / 9 },
|
|
8
8
|
{ label: '16:9', value: 16 / 9 },
|
|
9
9
|
{ label: '3:2', value: 3 / 2 },
|
|
@@ -15,12 +15,11 @@ var RATIO_BUCKETS = [
|
|
|
15
15
|
export function quantizeRatio(w, h) {
|
|
16
16
|
if (h === 0)
|
|
17
17
|
return '16:9';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
for (
|
|
22
|
-
|
|
23
|
-
var diff = Math.abs(ratio - bucket.value);
|
|
18
|
+
const ratio = w / h;
|
|
19
|
+
let nearest = RATIO_BUCKETS[0];
|
|
20
|
+
let minDiff = Math.abs(ratio - nearest.value);
|
|
21
|
+
for (const bucket of RATIO_BUCKETS) {
|
|
22
|
+
const diff = Math.abs(ratio - bucket.value);
|
|
24
23
|
if (diff < minDiff) {
|
|
25
24
|
minDiff = diff;
|
|
26
25
|
nearest = bucket;
|
|
@@ -34,34 +33,33 @@ export function quantizeRatio(w, h) {
|
|
|
34
33
|
* No-ops in production or when localStorage is unavailable (SSR).
|
|
35
34
|
*/
|
|
36
35
|
export function recordIntent(assetId, el) {
|
|
37
|
-
var _a;
|
|
38
36
|
if (typeof import.meta === 'undefined')
|
|
39
37
|
return;
|
|
40
|
-
if (!
|
|
38
|
+
if (!import.meta.env?.DEV)
|
|
41
39
|
return;
|
|
42
40
|
if (typeof localStorage === 'undefined')
|
|
43
41
|
return;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
existing[assetId] = { assetId
|
|
42
|
+
const rect = el.getBoundingClientRect();
|
|
43
|
+
const w = Math.round(rect.width) || el.offsetWidth;
|
|
44
|
+
const h = Math.round(rect.height) || el.offsetHeight;
|
|
45
|
+
const ratioBucket = quantizeRatio(w, h);
|
|
46
|
+
const intent = new Date().toISOString();
|
|
47
|
+
const existing = readIntents();
|
|
48
|
+
existing[assetId] = { assetId, measuredW: w, measuredH: h, ratioBucket, intent };
|
|
51
49
|
try {
|
|
52
50
|
localStorage.setItem(INTENTS_KEY, JSON.stringify(existing));
|
|
53
51
|
}
|
|
54
|
-
catch
|
|
52
|
+
catch {
|
|
55
53
|
// localStorage full — silently skip
|
|
56
54
|
}
|
|
57
|
-
console.info(
|
|
55
|
+
console.info(`[jatui-gen] no manifest for "${assetId}" — intent recorded (${w}×${h}, ${ratioBucket}). Run: jatui-gen fulfill`);
|
|
58
56
|
}
|
|
59
57
|
function readIntents() {
|
|
60
58
|
try {
|
|
61
|
-
|
|
59
|
+
const raw = localStorage.getItem(INTENTS_KEY);
|
|
62
60
|
return raw ? JSON.parse(raw) : {};
|
|
63
61
|
}
|
|
64
|
-
catch
|
|
62
|
+
catch {
|
|
65
63
|
return {};
|
|
66
64
|
}
|
|
67
65
|
}
|