@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.
Files changed (53) hide show
  1. package/dist/actions/attention.js +21 -13
  2. package/dist/actions/collapse.js +15 -29
  3. package/dist/actions/floating.js +29 -37
  4. package/dist/actions/listNav.js +108 -137
  5. package/dist/actions/railNav.js +72 -89
  6. package/dist/actions/staggerEntrance.js +19 -23
  7. package/dist/actions/tooltip.js +63 -51
  8. package/dist/assets/sounds/error.js +1 -1
  9. package/dist/assets/sounds/notify.js +1 -1
  10. package/dist/assets/sounds/pop.js +1 -1
  11. package/dist/assets/sounds/send.js +1 -1
  12. package/dist/assets/sounds/success.js +1 -1
  13. package/dist/assets/sounds/toggle.js +1 -1
  14. package/dist/components/graph/theme.js +26 -36
  15. package/dist/components/markup.js +59 -62
  16. package/dist/components/session-nav/transcriptModel.js +49 -66
  17. package/dist/components/shell/shell.js +14 -15
  18. package/dist/components/table/flexRender.js +2 -2
  19. package/dist/data/emojis.js +4 -4
  20. package/dist/dnd/autoScroll.js +10 -12
  21. package/dist/dnd/createDndBoard.js +94 -185
  22. package/dist/dnd/draggable.js +15 -23
  23. package/dist/dnd/dropTarget.js +15 -29
  24. package/dist/dnd/types.d.ts +9 -0
  25. package/dist/dnd/types.js +2 -14
  26. package/dist/showcase/generative/intent.js +19 -21
  27. package/dist/showcase/generative/manifest.js +27 -80
  28. package/dist/showcase/scroll/scrollProgress.js +20 -22
  29. package/dist/showcase/scroll/scrollReveal.js +17 -20
  30. package/dist/stores/commandPalette.js +18 -46
  31. package/dist/stores/confirmDialog.js +9 -9
  32. package/dist/stores/inputDialog.js +9 -9
  33. package/dist/stores/toast.js +10 -33
  34. package/dist/transitions/glide.js +29 -25
  35. package/dist/types/booking.js +4 -4
  36. package/dist/types/comments.js +2 -2
  37. package/dist/types/messaging.js +3 -3
  38. package/dist/types/pipeline.js +2 -2
  39. package/dist/utils/currency.js +2 -4
  40. package/dist/utils/daisyuiColors.js +25 -27
  41. package/dist/utils/dateFormatters.js +44 -44
  42. package/dist/utils/googleMapsLoader.js +46 -100
  43. package/dist/utils/mentionParser.js +30 -30
  44. package/dist/utils/phone.js +21 -27
  45. package/dist/utils/phoneFormat.js +9 -9
  46. package/dist/utils/sound.js +27 -78
  47. package/dist/utils/splitText.js +15 -26
  48. package/dist/utils/taskUtils.js +1 -1
  49. package/dist/utils/themeWipe.js +27 -72
  50. package/dist/utils/viewTransition.js +6 -51
  51. package/package.json +7 -3
  52. package/dist/dnd/createDndBoard.test.d.ts +0 -1
  53. package/dist/dnd/createDndBoard.test.js +0 -261
@@ -1,261 +0,0 @@
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
- };
57
- // @vitest-environment jsdom
58
- /**
59
- * Unit tests for createDndBoard internals.
60
- *
61
- * We can't exercise $effect/$state directly in vitest (no Svelte compiler context),
62
- * so these tests validate the pure-logic layer: sequence-token rollback ordering
63
- * and reseed suppression. They work by extracting the board logic functions
64
- * that don't depend on runes and driving them directly.
65
- */
66
- import { describe, it, expect } from 'vitest';
67
- import { makeItemData, isItemData } from './types';
68
- // ---- makeItemData / isItemData -------------------------------------------
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 });
72
- expect(isItemData(data)).toBe(true);
73
- expect(isItemData(data, 'card')).toBe(true);
74
- expect(isItemData(data, 'other')).toBe(false);
75
- });
76
- it('rejects plain objects without the brand', function () {
77
- expect(isItemData({ type: 'card', key: 'a' })).toBe(false);
78
- });
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 });
82
- expect(data.key).toBe('x');
83
- expect(data.item).toBe(item);
84
- expect(data.container).toBe('c1');
85
- expect(data.index).toBe(2);
86
- });
87
- });
88
- function makeMirror(initial) {
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
- }
94
- return m;
95
- }
96
- function applyToMirror(mirror, move, key) {
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
100
- ? fromList
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); });
103
- if (srcIdx === -1)
104
- return;
105
- fromList.splice(srcIdx, 1);
106
- var destIdx = move.to.index;
107
- if (move.from.container === move.to.container && move.to.index > move.from.index) {
108
- destIdx = Math.max(0, destIdx - 1);
109
- }
110
- toList.splice(Math.min(destIdx, toList.length), 0, move.item);
111
- mirror.set(move.from.container, fromList);
112
- if (move.from.container !== move.to.container) {
113
- mirror.set(move.to.container, toList);
114
- }
115
- }
116
- function rollback(mirror, move, key) {
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); });
121
- if (idx !== -1) {
122
- list.splice(idx, 1);
123
- mirror.set(cid, list);
124
- break;
125
- }
126
- }
127
- var fromList = __spreadArray([], ((_a = mirror.get(move.from.container)) !== null && _a !== void 0 ? _a : []), true);
128
- fromList.splice(Math.min(move.from.index, fromList.length), 0, move.item);
129
- mirror.set(move.from.container, fromList);
130
- }
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] });
139
- applyToMirror(mirror, { item: a, from: { container: 'col', index: 0 }, to: { container: 'col', index: 2 } }, key);
140
- expect((_a = mirror.get('col')) === null || _a === void 0 ? void 0 : _a.map(key)).toEqual(['b', 'a', 'c']);
141
- });
142
- it('moves item within same container (upward)', function () {
143
- var _a;
144
- var mirror = makeMirror({ col: [a, b, c] });
145
- applyToMirror(mirror, { item: c, from: { container: 'col', index: 2 }, to: { container: 'col', index: 0 } }, key);
146
- expect((_a = mirror.get('col')) === null || _a === void 0 ? void 0 : _a.map(key)).toEqual(['c', 'a', 'b']);
147
- });
148
- it('moves item across containers', function () {
149
- var _a, _b;
150
- var mirror = makeMirror({ col1: [a, b], col2: [c] });
151
- applyToMirror(mirror, { item: b, from: { container: 'col1', index: 1 }, to: { container: 'col2', index: 0 } }, key);
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']);
154
- });
155
- });
156
- describe('rollback', function () {
157
- it('restores item to its original position', function () {
158
- var _a;
159
- var mirror = makeMirror({ col: [b, c, a] });
160
- rollback(mirror, { item: a, from: { container: 'col', index: 0 } }, key);
161
- expect((_a = mirror.get('col')) === null || _a === void 0 ? void 0 : _a.map(key)).toEqual(['a', 'b', 'c']);
162
- });
163
- it('restores item from a different container', function () {
164
- var _a, _b;
165
- var mirror = makeMirror({ col1: [b], col2: [a, c] });
166
- rollback(mirror, { item: a, from: { container: 'col1', index: 0 } }, key);
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']);
169
- });
170
- });
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
- }); });
213
- });
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;
220
- function maybeSeed() {
221
- if (dragging || inFlight > 0) {
222
- seedQueued = true;
223
- return;
224
- }
225
- seedCalled++;
226
- seedQueued = false;
227
- }
228
- maybeSeed();
229
- expect(seedCalled).toBe(0);
230
- expect(seedQueued).toBe(true);
231
- dragging = false;
232
- if (inFlight === 0 && seedQueued && !dragging) {
233
- seedCalled++;
234
- seedQueued = false;
235
- }
236
- expect(seedCalled).toBe(1);
237
- expect(seedQueued).toBe(false);
238
- });
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;
244
- function tryFlush() {
245
- if (inFlight === 0 && seedQueued && !dragging) {
246
- seedCalled++;
247
- seedQueued = false;
248
- }
249
- }
250
- if (dragging || inFlight > 0) {
251
- seedQueued = true;
252
- }
253
- expect(seedQueued).toBe(true);
254
- inFlight--;
255
- tryFlush();
256
- expect(seedCalled).toBe(0);
257
- inFlight--;
258
- tryFlush();
259
- expect(seedCalled).toBe(1);
260
- });
261
- });