@joewinke/jatui 0.1.30 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,59 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
1
57
  // @vitest-environment jsdom
2
58
  /**
3
59
  * Unit tests for createDndBoard internals.
@@ -7,22 +63,22 @@
7
63
  * and reseed suppression. They work by extracting the board logic functions
8
64
  * that don't depend on runes and driving them directly.
9
65
  */
10
- import { describe, it, expect, vi, beforeEach } from 'vitest';
66
+ import { describe, it, expect } from 'vitest';
11
67
  import { makeItemData, isItemData } from './types';
12
68
  // ---- makeItemData / isItemData -------------------------------------------
13
- describe('makeItemData / isItemData', () => {
14
- it('round-trips through the Symbol brand', () => {
15
- const data = makeItemData({ type: 'card', key: 'a', item: { id: 'a' }, container: 'col1', index: 0 });
69
+ describe('makeItemData / isItemData', function () {
70
+ it('round-trips through the Symbol brand', function () {
71
+ var data = makeItemData({ type: 'card', key: 'a', item: { id: 'a' }, container: 'col1', index: 0 });
16
72
  expect(isItemData(data)).toBe(true);
17
73
  expect(isItemData(data, 'card')).toBe(true);
18
74
  expect(isItemData(data, 'other')).toBe(false);
19
75
  });
20
- it('rejects plain objects without the brand', () => {
76
+ it('rejects plain objects without the brand', function () {
21
77
  expect(isItemData({ type: 'card', key: 'a' })).toBe(false);
22
78
  });
23
- it('preserves all fields', () => {
24
- const item = { id: 'x', name: 'Item X' };
25
- const data = makeItemData({ type: 'board', key: 'x', item, container: 'c1', index: 2 });
79
+ it('preserves all fields', function () {
80
+ var item = { id: 'x', name: 'Item X' };
81
+ var data = makeItemData({ type: 'board', key: 'x', item: item, container: 'c1', index: 2 });
26
82
  expect(data.key).toBe('x');
27
83
  expect(data.item).toBe(item);
28
84
  expect(data.container).toBe('c1');
@@ -30,21 +86,24 @@ describe('makeItemData / isItemData', () => {
30
86
  });
31
87
  });
32
88
  function makeMirror(initial) {
33
- const m = new Map();
34
- for (const [k, v] of Object.entries(initial))
35
- m.set(k, [...v]);
89
+ var m = new Map();
90
+ for (var _i = 0, _a = Object.entries(initial); _i < _a.length; _i++) {
91
+ var _b = _a[_i], k = _b[0], v = _b[1];
92
+ m.set(k, __spreadArray([], v, true));
93
+ }
36
94
  return m;
37
95
  }
38
96
  function applyToMirror(mirror, move, key) {
39
- const fromList = [...(mirror.get(move.from.container) ?? [])];
40
- const toList = move.from.container === move.to.container
97
+ var _a, _b;
98
+ var fromList = __spreadArray([], ((_a = mirror.get(move.from.container)) !== null && _a !== void 0 ? _a : []), true);
99
+ var toList = move.from.container === move.to.container
41
100
  ? fromList
42
- : [...(mirror.get(move.to.container) ?? [])];
43
- const srcIdx = fromList.findIndex((it) => key(it) === key(move.item));
101
+ : __spreadArray([], ((_b = mirror.get(move.to.container)) !== null && _b !== void 0 ? _b : []), true);
102
+ var srcIdx = fromList.findIndex(function (it) { return key(it) === key(move.item); });
44
103
  if (srcIdx === -1)
45
104
  return;
46
105
  fromList.splice(srcIdx, 1);
47
- let destIdx = move.to.index;
106
+ var destIdx = move.to.index;
48
107
  if (move.from.container === move.to.container && move.to.index > move.from.index) {
49
108
  destIdx = Math.max(0, destIdx - 1);
50
109
  }
@@ -55,92 +114,109 @@ function applyToMirror(mirror, move, key) {
55
114
  }
56
115
  }
57
116
  function rollback(mirror, move, key) {
58
- for (const [cid, list] of mirror) {
59
- const idx = list.findIndex((it) => key(it) === key(move.item));
117
+ var _a;
118
+ for (var _i = 0, mirror_1 = mirror; _i < mirror_1.length; _i++) {
119
+ var _b = mirror_1[_i], cid = _b[0], list = _b[1];
120
+ var idx = list.findIndex(function (it) { return key(it) === key(move.item); });
60
121
  if (idx !== -1) {
61
122
  list.splice(idx, 1);
62
123
  mirror.set(cid, list);
63
124
  break;
64
125
  }
65
126
  }
66
- const fromList = [...(mirror.get(move.from.container) ?? [])];
127
+ var fromList = __spreadArray([], ((_a = mirror.get(move.from.container)) !== null && _a !== void 0 ? _a : []), true);
67
128
  fromList.splice(Math.min(move.from.index, fromList.length), 0, move.item);
68
129
  mirror.set(move.from.container, fromList);
69
130
  }
70
- const key = (i) => i.id;
71
- const a = { id: 'a', name: 'A' };
72
- const b = { id: 'b', name: 'B' };
73
- const c = { id: 'c', name: 'C' };
74
- describe('applyToMirror', () => {
75
- it('moves item within same container (downward)', () => {
76
- const mirror = makeMirror({ col: [a, b, c] });
131
+ var key = function (i) { return i.id; };
132
+ var a = { id: 'a', name: 'A' };
133
+ var b = { id: 'b', name: 'B' };
134
+ var c = { id: 'c', name: 'C' };
135
+ describe('applyToMirror', function () {
136
+ it('moves item within same container (downward)', function () {
137
+ var _a;
138
+ var mirror = makeMirror({ col: [a, b, c] });
77
139
  applyToMirror(mirror, { item: a, from: { container: 'col', index: 0 }, to: { container: 'col', index: 2 } }, key);
78
- expect(mirror.get('col')?.map(key)).toEqual(['b', 'a', 'c']);
140
+ expect((_a = mirror.get('col')) === null || _a === void 0 ? void 0 : _a.map(key)).toEqual(['b', 'a', 'c']);
79
141
  });
80
- it('moves item within same container (upward)', () => {
81
- const mirror = makeMirror({ col: [a, b, c] });
142
+ it('moves item within same container (upward)', function () {
143
+ var _a;
144
+ var mirror = makeMirror({ col: [a, b, c] });
82
145
  applyToMirror(mirror, { item: c, from: { container: 'col', index: 2 }, to: { container: 'col', index: 0 } }, key);
83
- expect(mirror.get('col')?.map(key)).toEqual(['c', 'a', 'b']);
146
+ expect((_a = mirror.get('col')) === null || _a === void 0 ? void 0 : _a.map(key)).toEqual(['c', 'a', 'b']);
84
147
  });
85
- it('moves item across containers', () => {
86
- const mirror = makeMirror({ col1: [a, b], col2: [c] });
148
+ it('moves item across containers', function () {
149
+ var _a, _b;
150
+ var mirror = makeMirror({ col1: [a, b], col2: [c] });
87
151
  applyToMirror(mirror, { item: b, from: { container: 'col1', index: 1 }, to: { container: 'col2', index: 0 } }, key);
88
- expect(mirror.get('col1')?.map(key)).toEqual(['a']);
89
- expect(mirror.get('col2')?.map(key)).toEqual(['b', 'c']);
152
+ expect((_a = mirror.get('col1')) === null || _a === void 0 ? void 0 : _a.map(key)).toEqual(['a']);
153
+ expect((_b = mirror.get('col2')) === null || _b === void 0 ? void 0 : _b.map(key)).toEqual(['b', 'c']);
90
154
  });
91
155
  });
92
- describe('rollback', () => {
93
- it('restores item to its original position', () => {
94
- const mirror = makeMirror({ col: [b, c, a] });
156
+ describe('rollback', function () {
157
+ it('restores item to its original position', function () {
158
+ var _a;
159
+ var mirror = makeMirror({ col: [b, c, a] });
95
160
  rollback(mirror, { item: a, from: { container: 'col', index: 0 } }, key);
96
- expect(mirror.get('col')?.map(key)).toEqual(['a', 'b', 'c']);
161
+ expect((_a = mirror.get('col')) === null || _a === void 0 ? void 0 : _a.map(key)).toEqual(['a', 'b', 'c']);
97
162
  });
98
- it('restores item from a different container', () => {
99
- const mirror = makeMirror({ col1: [b], col2: [a, c] });
163
+ it('restores item from a different container', function () {
164
+ var _a, _b;
165
+ var mirror = makeMirror({ col1: [b], col2: [a, c] });
100
166
  rollback(mirror, { item: a, from: { container: 'col1', index: 0 } }, key);
101
- expect(mirror.get('col1')?.map(key)).toEqual(['a', 'b']);
102
- expect(mirror.get('col2')?.map(key)).toEqual(['c']);
167
+ expect((_a = mirror.get('col1')) === null || _a === void 0 ? void 0 : _a.map(key)).toEqual(['a', 'b']);
168
+ expect((_b = mirror.get('col2')) === null || _b === void 0 ? void 0 : _b.map(key)).toEqual(['c']);
103
169
  });
104
170
  });
105
- describe('sequence-token rollback ordering', () => {
106
- it('does not rollback when a newer commit has already completed', async () => {
107
- const seq = new Map();
108
- const mirror = makeMirror({ col1: [a, b], col2: [c] });
109
- const move1 = { item: a, from: { container: 'col1', index: 0 }, to: { container: 'col2', index: 0 } };
110
- const move2 = { item: a, from: { container: 'col2', index: 0 }, to: { container: 'col1', index: 0 } };
111
- const token1 = (seq.get('a') ?? 0) + 1;
112
- seq.set('a', token1);
113
- applyToMirror(mirror, move1, key);
114
- const token2 = (seq.get('a') ?? 0) + 1;
115
- seq.set('a', token2);
116
- applyToMirror(mirror, { ...move2, from: { container: 'col2', index: 0 } }, key);
117
- const shouldRollbackMove1 = seq.get('a') === token1;
118
- expect(shouldRollbackMove1).toBe(false);
119
- const shouldRollbackMove2 = seq.get('a') === token2;
120
- expect(shouldRollbackMove2).toBe(true);
121
- });
122
- it('does rollback when this is the newest commit of the item', async () => {
123
- const seq = new Map();
124
- const mirror = makeMirror({ col1: [a, b], col2: [c] });
125
- const move1 = { item: a, from: { container: 'col1', index: 0 }, to: { container: 'col2', index: 0 } };
126
- const token1 = (seq.get('a') ?? 0) + 1;
127
- seq.set('a', token1);
128
- applyToMirror(mirror, move1, key);
129
- const shouldRollback = seq.get('a') === token1;
130
- expect(shouldRollback).toBe(true);
131
- if (shouldRollback) {
132
- rollback(mirror, move1, key);
133
- }
134
- expect(mirror.get('col1')?.map(key)).toContain('a');
135
- expect(mirror.get('col2')?.map(key)).not.toContain('a');
136
- });
171
+ describe('sequence-token rollback ordering', function () {
172
+ it('does not rollback when a newer commit has already completed', function () { return __awaiter(void 0, void 0, void 0, function () {
173
+ var seq, mirror, move1, move2, token1, token2, shouldRollbackMove1, shouldRollbackMove2;
174
+ var _a, _b;
175
+ return __generator(this, function (_c) {
176
+ seq = new Map();
177
+ mirror = makeMirror({ col1: [a, b], col2: [c] });
178
+ move1 = { item: a, from: { container: 'col1', index: 0 }, to: { container: 'col2', index: 0 } };
179
+ move2 = { item: a, from: { container: 'col2', index: 0 }, to: { container: 'col1', index: 0 } };
180
+ token1 = ((_a = seq.get('a')) !== null && _a !== void 0 ? _a : 0) + 1;
181
+ seq.set('a', token1);
182
+ applyToMirror(mirror, move1, key);
183
+ token2 = ((_b = seq.get('a')) !== null && _b !== void 0 ? _b : 0) + 1;
184
+ seq.set('a', token2);
185
+ applyToMirror(mirror, __assign(__assign({}, move2), { from: { container: 'col2', index: 0 } }), key);
186
+ shouldRollbackMove1 = seq.get('a') === token1;
187
+ expect(shouldRollbackMove1).toBe(false);
188
+ shouldRollbackMove2 = seq.get('a') === token2;
189
+ expect(shouldRollbackMove2).toBe(true);
190
+ return [2 /*return*/];
191
+ });
192
+ }); });
193
+ it('does rollback when this is the newest commit of the item', function () { return __awaiter(void 0, void 0, void 0, function () {
194
+ var seq, mirror, move1, token1, shouldRollback;
195
+ var _a, _b, _c;
196
+ return __generator(this, function (_d) {
197
+ seq = new Map();
198
+ mirror = makeMirror({ col1: [a, b], col2: [c] });
199
+ move1 = { item: a, from: { container: 'col1', index: 0 }, to: { container: 'col2', index: 0 } };
200
+ token1 = ((_a = seq.get('a')) !== null && _a !== void 0 ? _a : 0) + 1;
201
+ seq.set('a', token1);
202
+ applyToMirror(mirror, move1, key);
203
+ shouldRollback = seq.get('a') === token1;
204
+ expect(shouldRollback).toBe(true);
205
+ if (shouldRollback) {
206
+ rollback(mirror, move1, key);
207
+ }
208
+ expect((_b = mirror.get('col1')) === null || _b === void 0 ? void 0 : _b.map(key)).toContain('a');
209
+ expect((_c = mirror.get('col2')) === null || _c === void 0 ? void 0 : _c.map(key)).not.toContain('a');
210
+ return [2 /*return*/];
211
+ });
212
+ }); });
137
213
  });
138
- describe('reseed suppression', () => {
139
- it('suppresses reseed while dragging and applies it after', () => {
140
- let seedCalled = 0;
141
- let dragging = true;
142
- let inFlight = 0;
143
- let seedQueued = false;
214
+ describe('reseed suppression', function () {
215
+ it('suppresses reseed while dragging and applies it after', function () {
216
+ var seedCalled = 0;
217
+ var dragging = true;
218
+ var inFlight = 0;
219
+ var seedQueued = false;
144
220
  function maybeSeed() {
145
221
  if (dragging || inFlight > 0) {
146
222
  seedQueued = true;
@@ -160,11 +236,11 @@ describe('reseed suppression', () => {
160
236
  expect(seedCalled).toBe(1);
161
237
  expect(seedQueued).toBe(false);
162
238
  });
163
- it('suppresses reseed while commits in-flight and applies after all settle', () => {
164
- let seedCalled = 0;
165
- let dragging = false;
166
- let inFlight = 2;
167
- let seedQueued = false;
239
+ it('suppresses reseed while commits in-flight and applies after all settle', function () {
240
+ var seedCalled = 0;
241
+ var dragging = false;
242
+ var inFlight = 2;
243
+ var seedQueued = false;
168
244
  function tryFlush() {
169
245
  if (inFlight === 0 && seedQueued && !dragging) {
170
246
  seedCalled++;
@@ -1,42 +1,50 @@
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 const draggable = ((node, params) => {
4
- let current = params;
5
- let cleanup;
3
+ export var draggable = (function (node, params) {
4
+ var current = params;
5
+ var cleanup;
6
6
  function register() {
7
7
  cleanup = registerDraggable({
8
8
  element: node,
9
9
  dragHandle: current.dragHandle,
10
- canDrag: () => !(current.disabled?.() ?? false),
11
- getInitialData: () => current.data(),
12
- onGenerateDragPreview({ source, nativeSetDragImage }) {
10
+ canDrag: function () { var _a, _b; return !((_b = (_a = current.disabled) === null || _a === void 0 ? void 0 : _a.call(current)) !== null && _b !== void 0 ? _b : false); },
11
+ getInitialData: function () { return current.data(); },
12
+ onGenerateDragPreview: function (_a) {
13
+ var source = _a.source, nativeSetDragImage = _a.nativeSetDragImage;
13
14
  if (!current.preview)
14
15
  return;
15
16
  setCustomNativeDragPreview({
16
- render: ({ container }) => current.preview(container, source.data),
17
- nativeSetDragImage,
17
+ render: function (_a) {
18
+ var container = _a.container;
19
+ return current.preview(container, source.data);
20
+ },
21
+ nativeSetDragImage: nativeSetDragImage,
18
22
  });
19
23
  },
20
- onDragStart({ source }) {
24
+ onDragStart: function (_a) {
25
+ var _b;
26
+ var source = _a.source;
21
27
  node.dataset.dragging = 'true';
22
- current.onDragStart?.(source.data);
28
+ (_b = current.onDragStart) === null || _b === void 0 ? void 0 : _b.call(current, source.data);
23
29
  },
24
- onDrop({ source }) {
30
+ onDrop: function (_a) {
31
+ var _b;
32
+ var source = _a.source;
25
33
  delete node.dataset.dragging;
26
- current.onDrop?.(source.data);
34
+ (_b = current.onDrop) === null || _b === void 0 ? void 0 : _b.call(current, source.data);
27
35
  },
28
36
  });
29
37
  }
30
38
  register();
31
39
  return {
32
- update(next) {
33
- const handleChanged = next.dragHandle !== current.dragHandle;
40
+ update: function (next) {
41
+ var handleChanged = next.dragHandle !== current.dragHandle;
34
42
  current = next;
35
43
  if (handleChanged) {
36
44
  cleanup();
37
45
  register();
38
46
  }
39
47
  },
40
- destroy: () => cleanup(),
48
+ destroy: function () { return cleanup(); },
41
49
  };
42
50
  });
@@ -1,29 +1,43 @@
1
1
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
2
- export const dropTarget = ((node, params) => {
3
- let current = params;
4
- const cleanup = dropTargetForElements({
2
+ export var dropTarget = (function (node, params) {
3
+ var current = params;
4
+ var cleanup = dropTargetForElements({
5
5
  element: node,
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 }) {
6
+ getData: function (_a) {
7
+ var input = _a.input, element = _a.element, source = _a.source;
8
+ return current.data({ input: input, element: element, source: source });
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;
10
19
  node.dataset.dropOver = 'true';
11
- current.onEnter?.(source.data);
20
+ (_b = current.onEnter) === null || _b === void 0 ? void 0 : _b.call(current, source.data);
12
21
  },
13
- onDragLeave() {
22
+ onDragLeave: function () {
23
+ var _a;
14
24
  delete node.dataset.dropOver;
15
- current.onLeave?.();
25
+ (_a = current.onLeave) === null || _a === void 0 ? void 0 : _a.call(current);
16
26
  },
17
- onDrag({ self, source }) {
18
- current.onMove?.(self.data, source.data);
27
+ onDrag: function (_a) {
28
+ var _b;
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);
19
31
  },
20
- onDrop({ self, source }) {
32
+ onDrop: function (_a) {
33
+ var _b;
34
+ var self = _a.self, source = _a.source;
21
35
  delete node.dataset.dropOver;
22
- current.onDropped?.(self.data, source.data);
36
+ (_b = current.onDropped) === null || _b === void 0 ? void 0 : _b.call(current, self.data, source.data);
23
37
  },
24
38
  });
25
39
  return {
26
- update(next) {
40
+ update: function (next) {
27
41
  current = next;
28
42
  },
29
43
  destroy: cleanup,
@@ -2,16 +2,7 @@ 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;
13
5
  export interface ItemDragData<TItem = unknown> extends DragData {
14
- readonly [ITEM]: true;
15
6
  readonly key: string;
16
7
  readonly item: TItem;
17
8
  readonly container: string;
package/dist/dnd/types.js CHANGED
@@ -1,3 +1,14 @@
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
+ };
1
12
  /**
2
13
  * Module-scoped Symbol brand for board-managed items.
3
14
  * ⚠ Symbol identity = module identity. Two copies of this module on one page makes
@@ -5,9 +16,10 @@
5
16
  * Declare all @atlaskit/pragmatic-drag-and-drop* packages as peerDependencies in
6
17
  * the host app (host owns the single instance).
7
18
  */
8
- const ITEM = Symbol('jatui-dnd-item');
19
+ var ITEM = Symbol('jatui-dnd-item');
9
20
  export function makeItemData(args) {
10
- return { ...args, [ITEM]: true };
21
+ var _a;
22
+ return __assign(__assign({}, args), (_a = {}, _a[ITEM] = true, _a));
11
23
  }
12
24
  export function isItemData(data, type) {
13
25
  return data[ITEM] === true && (type === undefined || data.type === type);
package/dist/index.d.ts CHANGED
@@ -91,7 +91,7 @@ export type { Milestone, MilestoneStatus } from './types/milestone';
91
91
  export type { LocationType, BookingStatus, OverrideType, Host, EventType, WeeklyAvailability, DateOverride, Booking, BookingAttendee, TimeSlot, BookingFormData, AvailabilityCounts } from './types/booking';
92
92
  export { DAYS_OF_WEEK, DAYS_SHORT, LOCATION_LABELS, LOCATION_ICONS } from './types/booking';
93
93
  export type { ImageVariantSpec, ImageProcessingSpec, VariantResult, VariantState, } from './types/smartImageEditor';
94
- export { normalizeTimestamp, parseTimestamp, formatRelativeTime, formatFullDate, formatShortDate, formatLastActivity, formatDate, getTimeSinceMs, getTimeSinceMinutes, isWithinMinutes, formatDateTime, taskAge, } from './utils/dateFormatters';
94
+ export { normalizeTimestamp, parseTimestamp, formatRelativeTime, formatFullDate, formatShortDate, formatLastActivity, formatDate, getTimeSinceMs, getTimeSinceMinutes, isWithinMinutes, formatDateTime, taskAge, pacingColor, type PacingLevel, type PacingResult, } from './utils/dateFormatters';
95
95
  export { statusColor, priorityColor, typeIcon, statusLabel, } from './utils/taskUtils';
96
96
  export { stripPhoneNumber, formatPhoneNumber, isCompletePhoneNumber, isValidPhoneNumber, updatePhoneInput } from './utils/phoneFormat';
97
97
  export { toE164, formatPhoneForDisplay, isValidPhone, listCountries, DEFAULT_COUNTRY, PRIORITY_COUNTRIES, type CountryOption, } from './utils/phone';
@@ -142,8 +142,3 @@ export { default as LocationMap } from './components/LocationMap.svelte';
142
142
  export { default as GPSTracker } from './components/GPSTracker.svelte';
143
143
  export type { MapJob, MapAgent } from './types/maps';
144
144
  export { loadGoogleMapsAPI, isGoogleMapsLoaded, isPlacesLoaded, isGeometryLoaded, } from './utils/googleMapsLoader';
145
- export { draggable, dropTarget, autoScroll, announce, cleanupAnnouncements, monitorForElements, } from './dnd/index';
146
- export { createDndBoard } from './dnd/createDndBoard.svelte';
147
- export { default as DropIndicator } from './dnd/DropIndicator.svelte';
148
- export { makeItemData, isItemData } from './dnd/types';
149
- export type { DragData, ItemDragData, ContainerDropData, TargetFeedback, Edge, DraggableParams, DropTargetParams, AutoScrollParams, BoardMove, DndBoardOptions, } from './dnd/index';
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ export { default as AvailabilityModal } from './components/AvailabilityModal.sve
82
82
  export { default as BookingForm } from './components/BookingForm.svelte';
83
83
  export { DAYS_OF_WEEK, DAYS_SHORT, LOCATION_LABELS, LOCATION_ICONS } from './types/booking';
84
84
  // Utilities — date formatting
85
- export { normalizeTimestamp, parseTimestamp, formatRelativeTime, formatFullDate, formatShortDate, formatLastActivity, formatDate, getTimeSinceMs, getTimeSinceMinutes, isWithinMinutes, formatDateTime, taskAge, } from './utils/dateFormatters';
85
+ export { normalizeTimestamp, parseTimestamp, formatRelativeTime, formatFullDate, formatShortDate, formatLastActivity, formatDate, getTimeSinceMs, getTimeSinceMinutes, isWithinMinutes, formatDateTime, taskAge, pacingColor, } from './utils/dateFormatters';
86
86
  // Utilities — task display helpers
87
87
  export { statusColor, priorityColor, typeIcon, statusLabel, } from './utils/taskUtils';
88
88
  // Utilities — phone formatting (legacy US-only)
@@ -141,8 +141,8 @@ export { default as LocationMap } from './components/LocationMap.svelte';
141
141
  export { default as GPSTracker } from './components/GPSTracker.svelte';
142
142
  // Utilities — Google Maps loader
143
143
  export { loadGoogleMapsAPI, isGoogleMapsLoaded, isPlacesLoaded, isGeometryLoaded, } from './utils/googleMapsLoader';
144
- // DnD — pragmatic-drag-and-drop wrappers (peerDep: @atlaskit/pragmatic-drag-and-drop*)
145
- export { draggable, dropTarget, autoScroll, announce, cleanupAnnouncements, monitorForElements, } from './dnd/index';
146
- export { createDndBoard } from './dnd/createDndBoard.svelte';
147
- export { default as DropIndicator } from './dnd/DropIndicator.svelte';
148
- export { makeItemData, isItemData } from './dnd/types';
144
+ // DnD — pragmatic-drag-and-drop wrappers live behind the `@joewinke/jatui/dnd`
145
+ // subpath export, NOT this barrel. Re-exporting them here forced every barrel
146
+ // consumer to install the optional @atlaskit/pragmatic-drag-and-drop* peer deps
147
+ // (and broke bundlers that stub the unresolved optional peer). Import DnD via:
148
+ // import { draggable, DropIndicator } from '@joewinke/jatui/dnd';
@@ -2,7 +2,7 @@
2
2
  * Global promise-based confirm dialog.
3
3
  * Usage: const ok = await showConfirm({ title: '...', body: '...' })
4
4
  */
5
- let pending = $state(null);
5
+ var pending = $state(null);
6
6
  export function getPending() {
7
7
  return pending;
8
8
  }
@@ -11,21 +11,21 @@ export function showConfirm(options) {
11
11
  if (pending) {
12
12
  pending.resolve(false);
13
13
  }
14
- return new Promise((resolve) => {
15
- pending = { options, resolve };
14
+ return new Promise(function (resolve) {
15
+ pending = { options: options, resolve: resolve };
16
16
  });
17
17
  }
18
18
  export function confirmDialog() {
19
19
  if (!pending)
20
20
  return;
21
- const p = pending;
21
+ var p = pending;
22
22
  pending = null;
23
23
  p.resolve(true);
24
24
  }
25
25
  export function cancelDialog() {
26
26
  if (!pending)
27
27
  return;
28
- const p = pending;
28
+ var p = pending;
29
29
  pending = null;
30
30
  p.resolve(false);
31
31
  }
@@ -3,7 +3,7 @@
3
3
  * Usage: const value = await showInput({ title: '...', placeholder: '...' })
4
4
  * Returns the typed string if confirmed, null if cancelled.
5
5
  */
6
- let pending = $state(null);
6
+ var pending = $state(null);
7
7
  export function getPendingInput() {
8
8
  return pending;
9
9
  }
@@ -12,21 +12,21 @@ export function showInput(options) {
12
12
  if (pending) {
13
13
  pending.resolve(null);
14
14
  }
15
- return new Promise((resolve) => {
16
- pending = { options, resolve };
15
+ return new Promise(function (resolve) {
16
+ pending = { options: options, resolve: resolve };
17
17
  });
18
18
  }
19
19
  export function submitInput(value) {
20
20
  if (!pending)
21
21
  return;
22
- const p = pending;
22
+ var p = pending;
23
23
  pending = null;
24
24
  p.resolve(value);
25
25
  }
26
26
  export function cancelInput() {
27
27
  if (!pending)
28
28
  return;
29
- const p = pending;
29
+ var p = pending;
30
30
  pending = null;
31
31
  p.resolve(null);
32
32
  }
@@ -1,7 +1,7 @@
1
1
  // Booking System Types
2
2
  // Generic types for scheduling/booking UI components
3
3
  // Day of week helpers
4
- export const DAYS_OF_WEEK = [
4
+ export var DAYS_OF_WEEK = [
5
5
  'Sunday',
6
6
  'Monday',
7
7
  'Tuesday',
@@ -10,14 +10,14 @@ export const DAYS_OF_WEEK = [
10
10
  'Friday',
11
11
  'Saturday'
12
12
  ];
13
- export const DAYS_SHORT = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
13
+ export var DAYS_SHORT = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
14
14
  // Location type display
15
- export const LOCATION_LABELS = {
15
+ export var LOCATION_LABELS = {
16
16
  remote: 'Video Call',
17
17
  phone: 'Phone Call',
18
18
  in_person: 'In Person'
19
19
  };
20
- export const LOCATION_ICONS = {
20
+ export var LOCATION_ICONS = {
21
21
  remote: 'video',
22
22
  phone: 'phone',
23
23
  in_person: 'map-pin'