@adecore/ui 0.33.2 → 0.34.0

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 (63) hide show
  1. package/dist/Banner.d.ts +2 -1
  2. package/dist/Banner.js +92 -51
  3. package/dist/CopyButton.d.ts +24 -0
  4. package/dist/CopyButton.js +144 -0
  5. package/dist/ErrorBoundary.js +16 -18
  6. package/dist/ProjectSwitcher.js +66 -73
  7. package/dist/RelativeTime.d.ts +9 -0
  8. package/dist/RelativeTime.js +38 -0
  9. package/dist/Segmented.d.ts +4 -1
  10. package/dist/Segmented.js +111 -86
  11. package/dist/Toasts.js +1 -1
  12. package/dist/combobox/index.parts.d.ts +1 -0
  13. package/dist/combobox/index.parts.js +1 -0
  14. package/dist/combobox/parts.d.ts +32 -0
  15. package/dist/combobox/parts.js +556 -0
  16. package/dist/command-palette/index.parts.d.ts +2 -0
  17. package/dist/command-palette/index.parts.js +3 -0
  18. package/dist/command-palette/parts.d.ts +32 -0
  19. package/dist/command-palette/parts.js +422 -0
  20. package/dist/format/datetime.d.ts +1 -0
  21. package/dist/format/datetime.js +8 -0
  22. package/dist/format/duration.d.ts +1 -0
  23. package/dist/format/duration.js +24 -1
  24. package/dist/format/index.d.ts +2 -2
  25. package/dist/format/index.js +2 -2
  26. package/dist/index.d.ts +7 -0
  27. package/dist/index.js +5 -0
  28. package/dist/locales/en.d.ts +8 -0
  29. package/dist/locales/en.js +8 -0
  30. package/dist/locales/nl.d.ts +8 -0
  31. package/dist/locales/nl.js +8 -0
  32. package/dist/match.d.ts +1 -0
  33. package/dist/match.js +47 -0
  34. package/dist/segmented-keys.d.ts +3 -0
  35. package/dist/segmented-keys.js +33 -0
  36. package/dist/theme.css +15 -0
  37. package/dist/toast-store.d.ts +1 -0
  38. package/dist/toast-store.js +16 -6
  39. package/dist/workspace/TabStrip.d.ts +2 -1
  40. package/dist/workspace/TabStrip.js +432 -372
  41. package/package.json +1 -1
  42. package/src/Banner.tsx +33 -9
  43. package/src/CopyButton.tsx +86 -0
  44. package/src/ErrorBoundary.tsx +3 -4
  45. package/src/ProjectSwitcher.tsx +4 -2
  46. package/src/RelativeTime.tsx +44 -0
  47. package/src/Segmented.tsx +60 -33
  48. package/src/Toasts.tsx +1 -1
  49. package/src/combobox/index.parts.ts +12 -0
  50. package/src/combobox/parts.tsx +147 -0
  51. package/src/command-palette/index.parts.ts +16 -0
  52. package/src/command-palette/parts.tsx +145 -0
  53. package/src/format/datetime.ts +5 -0
  54. package/src/format/duration.ts +25 -1
  55. package/src/format/index.ts +2 -1
  56. package/src/index.ts +7 -0
  57. package/src/locales/en.ts +8 -0
  58. package/src/locales/nl.ts +8 -0
  59. package/src/match.ts +50 -0
  60. package/src/segmented-keys.ts +33 -0
  61. package/src/theme.css +15 -0
  62. package/src/toast-store.ts +16 -6
  63. package/src/workspace/TabStrip.tsx +31 -2
@@ -25,7 +25,7 @@ function tabIndexForKey(key, index, count) {
25
25
  }
26
26
  }
27
27
  export function TabStrip(t0) {
28
- const $ = _c(93);
28
+ const $ = _c(95);
29
29
  let className;
30
30
  let insertAt;
31
31
  let items;
@@ -42,6 +42,7 @@ export function TabStrip(t0) {
42
42
  let render;
43
43
  let renderTab;
44
44
  let t1;
45
+ let t2;
45
46
  let value;
46
47
  if ($[0] !== t0) {
47
48
  ({
@@ -51,6 +52,7 @@ export function TabStrip(t0) {
51
52
  renderTab,
52
53
  focused: t1,
53
54
  insertAt,
55
+ pressToClose: t2,
54
56
  onClose,
55
57
  onDoubleClick,
56
58
  onContextMenu,
@@ -80,7 +82,8 @@ export function TabStrip(t0) {
80
82
  $[14] = render;
81
83
  $[15] = renderTab;
82
84
  $[16] = t1;
83
- $[17] = value;
85
+ $[17] = t2;
86
+ $[18] = value;
84
87
  } else {
85
88
  className = $[1];
86
89
  insertAt = $[2];
@@ -98,17 +101,19 @@ export function TabStrip(t0) {
98
101
  render = $[14];
99
102
  renderTab = $[15];
100
103
  t1 = $[16];
101
- value = $[17];
104
+ t2 = $[17];
105
+ value = $[18];
102
106
  }
103
107
  const focused = t1 === undefined ? true : t1;
108
+ const pressToClose = t2 === undefined ? false : t2;
104
109
  const {
105
110
  t
106
111
  } = useTranslation("ui");
107
112
  const strip = useRef(null);
108
113
  const closingFocus = useRef(null);
109
- let t2;
110
- if ($[18] !== items) {
111
- t2 = () => {
114
+ let t3;
115
+ if ($[19] !== items) {
116
+ t3 = () => {
112
117
  if (closingFocus.current && !items.some(item => item.id === closingFocus.current)) {
113
118
  closingFocus.current = null;
114
119
  const target = strip.current?.querySelector("[aria-selected=\"true\"]") ?? strip.current?.querySelector("[role=\"tab\"]");
@@ -117,15 +122,15 @@ export function TabStrip(t0) {
117
122
  });
118
123
  }
119
124
  };
120
- $[18] = items;
121
- $[19] = t2;
125
+ $[19] = items;
126
+ $[20] = t3;
122
127
  } else {
123
- t2 = $[19];
128
+ t3 = $[20];
124
129
  }
125
- useLayoutEffect(t2);
126
- let t3;
127
- if ($[20] !== onClose) {
128
- t3 = (id, action) => {
130
+ useLayoutEffect(t3);
131
+ let t4;
132
+ if ($[21] !== onClose) {
133
+ t4 = (id, action) => {
129
134
  if (strip.current?.contains(strip.current.ownerDocument.activeElement)) {
130
135
  closingFocus.current = id;
131
136
  }
@@ -135,27 +140,27 @@ export function TabStrip(t0) {
135
140
  onClose?.(id);
136
141
  }
137
142
  };
138
- $[20] = onClose;
139
- $[21] = t3;
143
+ $[21] = onClose;
144
+ $[22] = t4;
140
145
  } else {
141
- t3 = $[21];
146
+ t4 = $[22];
142
147
  }
143
- const close = t3;
144
- let t4;
145
- if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
146
- t4 = {
148
+ const close = t4;
149
+ let t5;
150
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
151
+ t5 = {
147
152
  start: false,
148
153
  end: false
149
154
  };
150
- $[22] = t4;
155
+ $[23] = t5;
151
156
  } else {
152
- t4 = $[22];
157
+ t5 = $[23];
153
158
  }
154
- const [edges, setEdges] = useState(t4);
159
+ const [edges, setEdges] = useState(t5);
155
160
  const [insertion, setInsertion] = useState(0);
156
- let t5;
157
- if ($[23] !== insertAt) {
158
- t5 = () => {
161
+ let t6;
162
+ if ($[24] !== insertAt) {
163
+ t6 = () => {
159
164
  const element = strip.current;
160
165
  if (!element) {
161
166
  return;
@@ -173,16 +178,16 @@ export function TabStrip(t0) {
173
178
  setInsertion(after?.offsetLeft ?? (last ? last.offsetLeft + last.offsetWidth : 0));
174
179
  }
175
180
  };
176
- $[23] = insertAt;
177
- $[24] = t5;
181
+ $[24] = insertAt;
182
+ $[25] = t6;
178
183
  } else {
179
- t5 = $[24];
184
+ t6 = $[25];
180
185
  }
181
- const measure = t5;
186
+ const measure = t6;
182
187
  const revealing = useRef(false);
183
- let t6;
184
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
185
- t6 = () => {
188
+ let t7;
189
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
190
+ t7 = () => {
186
191
  const element_0 = strip.current;
187
192
  const selected = element_0?.querySelector("[aria-selected=\"true\"]");
188
193
  if (!revealing.current || !element_0 || !selected) {
@@ -198,44 +203,44 @@ export function TabStrip(t0) {
198
203
  element_0.scrollLeft = left;
199
204
  }
200
205
  };
201
- $[25] = t6;
202
- } else {
203
- t6 = $[25];
204
- }
205
- const reveal = t6;
206
- let t7;
207
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
208
- t7 = () => {
209
- revealing.current = true;
210
- };
211
206
  $[26] = t7;
212
207
  } else {
213
208
  t7 = $[26];
214
209
  }
210
+ const reveal = t7;
215
211
  let t8;
216
- if ($[27] !== value) {
217
- t8 = [value];
218
- $[27] = value;
219
- $[28] = t8;
212
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
213
+ t8 = () => {
214
+ revealing.current = true;
215
+ };
216
+ $[27] = t8;
220
217
  } else {
221
- t8 = $[28];
218
+ t8 = $[27];
222
219
  }
223
- useLayoutEffect(t7, t8);
224
220
  let t9;
225
- if ($[29] !== measure) {
226
- t9 = () => {
221
+ if ($[28] !== value) {
222
+ t9 = [value];
223
+ $[28] = value;
224
+ $[29] = t9;
225
+ } else {
226
+ t9 = $[29];
227
+ }
228
+ useLayoutEffect(t8, t9);
229
+ let t10;
230
+ if ($[30] !== measure) {
231
+ t10 = () => {
227
232
  reveal();
228
233
  measure();
229
234
  };
230
- $[29] = measure;
231
- $[30] = t9;
235
+ $[30] = measure;
236
+ $[31] = t10;
232
237
  } else {
233
- t9 = $[30];
238
+ t10 = $[31];
234
239
  }
235
- useLayoutEffect(t9);
236
- let t10;
237
- if ($[31] !== measure) {
238
- t10 = () => {
240
+ useLayoutEffect(t10);
241
+ let t11;
242
+ if ($[32] !== measure) {
243
+ t11 = () => {
239
244
  const element_1 = strip.current;
240
245
  if (!element_1 || typeof ResizeObserver === "undefined") {
241
246
  return;
@@ -248,93 +253,95 @@ export function TabStrip(t0) {
248
253
  element_1.querySelectorAll("[data-document-tab]").forEach(tab_0 => observer.observe(tab_0));
249
254
  return () => observer.disconnect();
250
255
  };
251
- $[31] = measure;
252
- $[32] = t10;
253
- } else {
254
- t10 = $[32];
255
- }
256
- useEffect(t10);
257
- const gap = _temp2;
258
- let t11;
259
- if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
260
- t11 = index => strip.current?.querySelectorAll("[role=\"tab\"]")[index]?.focus();
256
+ $[32] = measure;
261
257
  $[33] = t11;
262
258
  } else {
263
259
  t11 = $[33];
264
260
  }
261
+ useEffect(t11);
262
+ const gap = _temp2;
265
263
  let t12;
266
- if ($[34] !== close || $[35] !== items || $[36] !== onClose || $[37] !== onContextMenu || $[38] !== onDoubleClick || $[39] !== onDragEnd || $[40] !== onDragStart || $[41] !== onValueChange || $[42] !== value) {
267
- t12 = {
264
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
265
+ t12 = index => strip.current?.querySelectorAll("[role=\"tab\"]")[index]?.focus();
266
+ $[34] = t12;
267
+ } else {
268
+ t12 = $[34];
269
+ }
270
+ let t13;
271
+ if ($[35] !== close || $[36] !== items || $[37] !== onClose || $[38] !== onContextMenu || $[39] !== onDoubleClick || $[40] !== onDragEnd || $[41] !== onDragStart || $[42] !== onValueChange || $[43] !== pressToClose || $[44] !== value) {
272
+ t13 = {
268
273
  items,
269
274
  value,
270
275
  onValueChange,
276
+ pressToClose,
271
277
  onClose,
272
278
  onDoubleClick,
273
279
  onContextMenu,
274
280
  onDragStart,
275
281
  onDragEnd,
276
282
  close,
277
- focus: t11
283
+ focus: t12
278
284
  };
279
- $[34] = close;
280
- $[35] = items;
281
- $[36] = onClose;
282
- $[37] = onContextMenu;
283
- $[38] = onDoubleClick;
284
- $[39] = onDragEnd;
285
- $[40] = onDragStart;
286
- $[41] = onValueChange;
287
- $[42] = value;
288
- $[43] = t12;
289
- } else {
290
- t12 = $[43];
291
- }
292
- const context = t12;
293
- const t13 = ref ?? null;
294
- let t14;
295
- if ($[44] !== t13) {
296
- t14 = [strip, t13];
297
- $[44] = t13;
298
- $[45] = t14;
285
+ $[35] = close;
286
+ $[36] = items;
287
+ $[37] = onClose;
288
+ $[38] = onContextMenu;
289
+ $[39] = onDoubleClick;
290
+ $[40] = onDragEnd;
291
+ $[41] = onDragStart;
292
+ $[42] = onValueChange;
293
+ $[43] = pressToClose;
294
+ $[44] = value;
295
+ $[45] = t13;
299
296
  } else {
300
- t14 = $[45];
297
+ t13 = $[45];
301
298
  }
299
+ const context = t13;
300
+ const t14 = ref ?? null;
302
301
  let t15;
303
- if ($[46] !== props || $[47] !== t) {
304
- t15 = props["aria-label"] ?? t("workspace.tabs");
305
- $[46] = props;
306
- $[47] = t;
307
- $[48] = t15;
302
+ if ($[46] !== t14) {
303
+ t15 = [strip, t14];
304
+ $[46] = t14;
305
+ $[47] = t15;
308
306
  } else {
309
- t15 = $[48];
307
+ t15 = $[47];
310
308
  }
311
309
  let t16;
312
- if ($[49] !== className) {
313
- t16 = clsx("ade-tab-strip scroll-fade-x", className);
314
- $[49] = className;
310
+ if ($[48] !== props || $[49] !== t) {
311
+ t16 = props["aria-label"] ?? t("workspace.tabs");
312
+ $[48] = props;
313
+ $[49] = t;
315
314
  $[50] = t16;
316
315
  } else {
317
316
  t16 = $[50];
318
317
  }
319
- const t17 = focused || undefined;
320
- const t18 = edges.start || undefined;
321
- const t19 = edges.end || undefined;
322
- let t20;
323
- if ($[51] !== measure || $[52] !== props) {
324
- t20 = event_0 => {
318
+ let t17;
319
+ if ($[51] !== className) {
320
+ t17 = clsx("ade-tab-strip scroll-fade-x", className);
321
+ $[51] = className;
322
+ $[52] = t17;
323
+ } else {
324
+ t17 = $[52];
325
+ }
326
+ const t18 = focused || undefined;
327
+ const t19 = edges.start || undefined;
328
+ const t20 = edges.end || undefined;
329
+ let t21;
330
+ if ($[53] !== measure || $[54] !== props) {
331
+ t21 = event_0 => {
325
332
  props.onScroll?.(event_0);
326
333
  measure();
327
334
  };
328
- $[51] = measure;
329
- $[52] = props;
330
- $[53] = t20;
335
+ $[53] = measure;
336
+ $[54] = props;
337
+ $[55] = t21;
331
338
  } else {
332
- t20 = $[53];
339
+ t21 = $[55];
333
340
  }
334
- let t21;
335
341
  let t22;
336
- if ($[54] !== props) {
337
- t21 = event_1 => {
342
+ let t23;
343
+ if ($[56] !== props) {
344
+ t22 = event_1 => {
338
345
  props.onWheel?.(event_1);
339
346
  if (event_1.defaultPrevented) {
340
347
  return;
@@ -344,146 +351,146 @@ export function TabStrip(t0) {
344
351
  event_1.currentTarget.scrollLeft = event_1.currentTarget.scrollLeft + event_1.deltaY;
345
352
  }
346
353
  };
347
- t22 = event_2 => {
354
+ t23 = event_2 => {
348
355
  props.onPointerDown?.(event_2);
349
356
  if (event_2.target === event_2.currentTarget || event_2.pointerType === "touch") {
350
357
  revealing.current = false;
351
358
  }
352
359
  };
353
- $[54] = props;
354
- $[55] = t21;
355
- $[56] = t22;
360
+ $[56] = props;
361
+ $[57] = t22;
362
+ $[58] = t23;
356
363
  } else {
357
- t21 = $[55];
358
- t22 = $[56];
364
+ t22 = $[57];
365
+ t23 = $[58];
359
366
  }
360
- let t23;
361
- if ($[57] !== onTabDragOver || $[58] !== props) {
362
- t23 = event_3 => {
367
+ let t24;
368
+ if ($[59] !== onTabDragOver || $[60] !== props) {
369
+ t24 = event_3 => {
363
370
  props.onDragOver?.(event_3);
364
371
  if (!event_3.defaultPrevented) {
365
372
  onTabDragOver?.(gap(event_3), event_3);
366
373
  }
367
374
  };
368
- $[57] = onTabDragOver;
369
- $[58] = props;
370
- $[59] = t23;
375
+ $[59] = onTabDragOver;
376
+ $[60] = props;
377
+ $[61] = t24;
371
378
  } else {
372
- t23 = $[59];
379
+ t24 = $[61];
373
380
  }
374
- let t24;
375
- if ($[60] !== onTabDrop || $[61] !== props) {
376
- t24 = event_4 => {
381
+ let t25;
382
+ if ($[62] !== onTabDrop || $[63] !== props) {
383
+ t25 = event_4 => {
377
384
  props.onDrop?.(event_4);
378
385
  if (!event_4.defaultPrevented) {
379
386
  onTabDrop?.(gap(event_4), event_4);
380
387
  }
381
388
  };
382
- $[60] = onTabDrop;
383
- $[61] = props;
384
- $[62] = t24;
389
+ $[62] = onTabDrop;
390
+ $[63] = props;
391
+ $[64] = t25;
385
392
  } else {
386
- t24 = $[62];
393
+ t25 = $[64];
387
394
  }
388
- let t25;
389
- if ($[63] !== context || $[64] !== items || $[65] !== renderTab) {
390
- let t26;
391
- if ($[67] !== context || $[68] !== renderTab) {
392
- t26 = item_0 => /*#__PURE__*/_jsx(TabContext.Provider, {
395
+ let t26;
396
+ if ($[65] !== context || $[66] !== items || $[67] !== renderTab) {
397
+ let t27;
398
+ if ($[69] !== context || $[70] !== renderTab) {
399
+ t27 = item_0 => /*#__PURE__*/_jsx(TabContext.Provider, {
393
400
  value: context,
394
401
  children: renderTab ? renderTab(item_0) : /*#__PURE__*/_jsx(DocumentTab, {
395
402
  item: item_0
396
403
  })
397
404
  }, item_0.id);
398
- $[67] = context;
399
- $[68] = renderTab;
400
- $[69] = t26;
405
+ $[69] = context;
406
+ $[70] = renderTab;
407
+ $[71] = t27;
401
408
  } else {
402
- t26 = $[69];
409
+ t27 = $[71];
403
410
  }
404
- t25 = items.map(t26);
405
- $[63] = context;
406
- $[64] = items;
407
- $[65] = renderTab;
408
- $[66] = t25;
411
+ t26 = items.map(t27);
412
+ $[65] = context;
413
+ $[66] = items;
414
+ $[67] = renderTab;
415
+ $[68] = t26;
409
416
  } else {
410
- t25 = $[66];
417
+ t26 = $[68];
411
418
  }
412
- let t26;
413
- if ($[70] !== insertAt || $[71] !== insertion) {
414
- t26 = insertAt !== undefined && insertAt !== null && /*#__PURE__*/_jsx("span", {
419
+ let t27;
420
+ if ($[72] !== insertAt || $[73] !== insertion) {
421
+ t27 = insertAt !== undefined && insertAt !== null && /*#__PURE__*/_jsx("span", {
415
422
  "aria-hidden": "true",
416
423
  className: "ade-tab-insertion",
417
424
  style: {
418
425
  left: insertion
419
426
  }
420
427
  });
421
- $[70] = insertAt;
422
- $[71] = insertion;
423
- $[72] = t26;
428
+ $[72] = insertAt;
429
+ $[73] = insertion;
430
+ $[74] = t27;
424
431
  } else {
425
- t26 = $[72];
432
+ t27 = $[74];
426
433
  }
427
- let t27;
428
- if ($[73] !== t25 || $[74] !== t26) {
429
- t27 = /*#__PURE__*/_jsxs(_Fragment, {
430
- children: [t25, t26]
434
+ let t28;
435
+ if ($[75] !== t26 || $[76] !== t27) {
436
+ t28 = /*#__PURE__*/_jsxs(_Fragment, {
437
+ children: [t26, t27]
431
438
  });
432
- $[73] = t25;
433
- $[74] = t26;
434
- $[75] = t27;
439
+ $[75] = t26;
440
+ $[76] = t27;
441
+ $[77] = t28;
435
442
  } else {
436
- t27 = $[75];
443
+ t28 = $[77];
437
444
  }
438
- let t28;
439
- if ($[76] !== props || $[77] !== t15 || $[78] !== t16 || $[79] !== t17 || $[80] !== t18 || $[81] !== t19 || $[82] !== t20 || $[83] !== t21 || $[84] !== t22 || $[85] !== t23 || $[86] !== t24 || $[87] !== t27) {
440
- t28 = {
445
+ let t29;
446
+ if ($[78] !== props || $[79] !== t16 || $[80] !== t17 || $[81] !== t18 || $[82] !== t19 || $[83] !== t20 || $[84] !== t21 || $[85] !== t22 || $[86] !== t23 || $[87] !== t24 || $[88] !== t25 || $[89] !== t28) {
447
+ t29 = {
441
448
  ...props,
442
449
  role: "tablist",
443
- "aria-label": t15,
444
- className: t16,
445
- "data-focused": t17,
446
- "data-fade-start": t18,
447
- "data-fade-end": t19,
448
- onScroll: t20,
449
- onWheel: t21,
450
- onPointerDown: t22,
451
- onDragOver: t23,
452
- onDrop: t24,
453
- children: t27
450
+ "aria-label": t16,
451
+ className: t17,
452
+ "data-focused": t18,
453
+ "data-fade-start": t19,
454
+ "data-fade-end": t20,
455
+ onScroll: t21,
456
+ onWheel: t22,
457
+ onPointerDown: t23,
458
+ onDragOver: t24,
459
+ onDrop: t25,
460
+ children: t28
454
461
  };
455
- $[76] = props;
456
- $[77] = t15;
457
- $[78] = t16;
458
- $[79] = t17;
459
- $[80] = t18;
460
- $[81] = t19;
461
- $[82] = t20;
462
- $[83] = t21;
463
- $[84] = t22;
464
- $[85] = t23;
465
- $[86] = t24;
466
- $[87] = t27;
467
- $[88] = t28;
468
- } else {
469
- t28 = $[88];
470
- }
471
- let t29;
472
- if ($[89] !== render || $[90] !== t14 || $[91] !== t28) {
473
- t29 = {
462
+ $[78] = props;
463
+ $[79] = t16;
464
+ $[80] = t17;
465
+ $[81] = t18;
466
+ $[82] = t19;
467
+ $[83] = t20;
468
+ $[84] = t21;
469
+ $[85] = t22;
470
+ $[86] = t23;
471
+ $[87] = t24;
472
+ $[88] = t25;
473
+ $[89] = t28;
474
+ $[90] = t29;
475
+ } else {
476
+ t29 = $[90];
477
+ }
478
+ let t30;
479
+ if ($[91] !== render || $[92] !== t15 || $[93] !== t29) {
480
+ t30 = {
474
481
  render,
475
- ref: t14,
482
+ ref: t15,
476
483
  defaultTagName: "div",
477
- props: t28
484
+ props: t29
478
485
  };
479
- $[89] = render;
480
- $[90] = t14;
481
- $[91] = t28;
482
- $[92] = t29;
486
+ $[91] = render;
487
+ $[92] = t15;
488
+ $[93] = t29;
489
+ $[94] = t30;
483
490
  } else {
484
- t29 = $[92];
491
+ t30 = $[94];
485
492
  }
486
- return useRender(t29);
493
+ return useRender(t30);
487
494
  }
488
495
  function _temp2(event) {
489
496
  const rects = Array.from(event.currentTarget.querySelectorAll("[data-document-tab]"), _temp);
@@ -495,7 +502,7 @@ function _temp(tab_1) {
495
502
  const TabContext = createContext(null);
496
503
  /** A tab with application-owned metadata and menus, rendered inside TabStrip's renderTab slot. */
497
504
  export function DocumentTab(t0) {
498
- const $ = _c(92);
505
+ const $ = _c(107);
499
506
  let className;
500
507
  let closeShortcut;
501
508
  let item;
@@ -585,180 +592,229 @@ export function DocumentTab(t0) {
585
592
  const close = t2;
586
593
  const closable = item.closable !== false && (onClose ?? context.onClose) !== undefined;
587
594
  let t3;
588
- if ($[20] !== className) {
589
- t3 = clsx("ade-document-tab", className);
590
- $[20] = className;
591
- $[21] = t3;
595
+ if ($[20] !== closable || $[21] !== context.pressToClose || $[22] !== item.pinned) {
596
+ t3 = event => !!context.pressToClose && closable && !item.pinned && (event.button === 1 || event.button === 0 && event.shiftKey && !event.metaKey && !event.ctrlKey && !event.altKey);
597
+ $[20] = closable;
598
+ $[21] = context.pressToClose;
599
+ $[22] = item.pinned;
600
+ $[23] = t3;
592
601
  } else {
593
- t3 = $[21];
602
+ t3 = $[23];
594
603
  }
595
- const t4 = item.id === value || undefined;
596
- const t5 = !!item.detail || undefined;
597
- let t6;
598
- if ($[22] !== context || $[23] !== item.id || $[24] !== props) {
599
- t6 = event => {
600
- props.onContextMenu?.(event);
601
- context.onContextMenu?.(item.id, event);
604
+ const closesOnPress = t3;
605
+ let t4;
606
+ if ($[24] !== className) {
607
+ t4 = clsx("ade-document-tab", className);
608
+ $[24] = className;
609
+ $[25] = t4;
610
+ } else {
611
+ t4 = $[25];
612
+ }
613
+ const t5 = item.id === value || undefined;
614
+ const t6 = !!item.detail || undefined;
615
+ let t7;
616
+ if ($[26] !== context || $[27] !== item.id || $[28] !== props) {
617
+ t7 = event_0 => {
618
+ props.onContextMenu?.(event_0);
619
+ context.onContextMenu?.(item.id, event_0);
602
620
  };
603
- $[22] = context;
604
- $[23] = item.id;
605
- $[24] = props;
606
- $[25] = t6;
621
+ $[26] = context;
622
+ $[27] = item.id;
623
+ $[28] = props;
624
+ $[29] = t7;
607
625
  } else {
608
- t6 = $[25];
626
+ t7 = $[29];
609
627
  }
610
- const t7 = item.hint ?? item.label;
611
- const t8 = item.id === value;
612
- const t9 = item.id === value || value === null && index === 0 ? 0 : -1;
613
- const t10 = !!(onDragStart ?? context.onDragStart);
614
- let t11;
615
- if ($[26] !== item.id || $[27] !== onValueChange) {
616
- t11 = () => onValueChange(item.id);
617
- $[26] = item.id;
618
- $[27] = onValueChange;
619
- $[28] = t11;
628
+ let t8;
629
+ if ($[30] !== closesOnPress || $[31] !== props) {
630
+ t8 = event_1 => {
631
+ props.onMouseDown?.(event_1);
632
+ if (closesOnPress(event_1)) {
633
+ event_1.preventDefault();
634
+ }
635
+ };
636
+ $[30] = closesOnPress;
637
+ $[31] = props;
638
+ $[32] = t8;
620
639
  } else {
621
- t11 = $[28];
640
+ t8 = $[32];
622
641
  }
623
- let t12;
624
- if ($[29] !== context.onDoubleClick || $[30] !== item.id || $[31] !== onDoubleClick) {
625
- t12 = event_0 => (onDoubleClick ?? context.onDoubleClick)?.(item.id, event_0);
626
- $[29] = context.onDoubleClick;
627
- $[30] = item.id;
628
- $[31] = onDoubleClick;
629
- $[32] = t12;
642
+ let t9;
643
+ if ($[33] !== close || $[34] !== closesOnPress || $[35] !== props) {
644
+ t9 = event_2 => {
645
+ props.onAuxClick?.(event_2);
646
+ if (event_2.button === 1 && closesOnPress(event_2)) {
647
+ event_2.preventDefault();
648
+ close();
649
+ }
650
+ };
651
+ $[33] = close;
652
+ $[34] = closesOnPress;
653
+ $[35] = props;
654
+ $[36] = t9;
630
655
  } else {
631
- t12 = $[32];
656
+ t9 = $[36];
632
657
  }
633
- let t13;
634
- if ($[33] !== context.onDragStart || $[34] !== item.id || $[35] !== onDragStart) {
635
- t13 = event_1 => {
636
- event_1.stopPropagation();
637
- (onDragStart ?? context.onDragStart)?.(item.id, event_1);
658
+ const t10 = item.hint ?? item.label;
659
+ const t11 = item.id === value;
660
+ const t12 = item.id === value || value === null && index === 0 ? 0 : -1;
661
+ const t13 = !!(onDragStart ?? context.onDragStart);
662
+ let t14;
663
+ if ($[37] !== close || $[38] !== closesOnPress || $[39] !== item.id || $[40] !== onValueChange) {
664
+ t14 = event_3 => {
665
+ if (closesOnPress(event_3)) {
666
+ close();
667
+ return;
668
+ }
669
+ onValueChange(item.id);
638
670
  };
639
- $[33] = context.onDragStart;
640
- $[34] = item.id;
641
- $[35] = onDragStart;
642
- $[36] = t13;
671
+ $[37] = close;
672
+ $[38] = closesOnPress;
673
+ $[39] = item.id;
674
+ $[40] = onValueChange;
675
+ $[41] = t14;
643
676
  } else {
644
- t13 = $[36];
677
+ t14 = $[41];
645
678
  }
646
- const t14 = onDragEnd ?? context.onDragEnd;
647
679
  let t15;
648
- if ($[37] !== closable || $[38] !== close || $[39] !== context || $[40] !== index || $[41] !== items || $[42] !== onValueChange) {
649
- t15 = event_2 => {
650
- const next = tabIndexForKey(event_2.key, index, items.length);
680
+ if ($[42] !== context.onDoubleClick || $[43] !== item.id || $[44] !== onDoubleClick) {
681
+ t15 = event_4 => (onDoubleClick ?? context.onDoubleClick)?.(item.id, event_4);
682
+ $[42] = context.onDoubleClick;
683
+ $[43] = item.id;
684
+ $[44] = onDoubleClick;
685
+ $[45] = t15;
686
+ } else {
687
+ t15 = $[45];
688
+ }
689
+ let t16;
690
+ if ($[46] !== context.onDragStart || $[47] !== item.id || $[48] !== onDragStart) {
691
+ t16 = event_5 => {
692
+ event_5.stopPropagation();
693
+ (onDragStart ?? context.onDragStart)?.(item.id, event_5);
694
+ };
695
+ $[46] = context.onDragStart;
696
+ $[47] = item.id;
697
+ $[48] = onDragStart;
698
+ $[49] = t16;
699
+ } else {
700
+ t16 = $[49];
701
+ }
702
+ const t17 = onDragEnd ?? context.onDragEnd;
703
+ let t18;
704
+ if ($[50] !== closable || $[51] !== close || $[52] !== context || $[53] !== index || $[54] !== items || $[55] !== onValueChange) {
705
+ t18 = event_6 => {
706
+ const next = tabIndexForKey(event_6.key, index, items.length);
651
707
  if (next !== null) {
652
- event_2.preventDefault();
708
+ event_6.preventDefault();
653
709
  onValueChange(items[next].id);
654
710
  context.focus(next);
655
711
  } else {
656
- if (event_2.key === "Delete" && closable) {
657
- event_2.preventDefault();
712
+ if (event_6.key === "Delete" && closable) {
713
+ event_6.preventDefault();
658
714
  close();
659
715
  }
660
716
  }
661
717
  };
662
- $[37] = closable;
663
- $[38] = close;
664
- $[39] = context;
665
- $[40] = index;
666
- $[41] = items;
667
- $[42] = onValueChange;
668
- $[43] = t15;
718
+ $[50] = closable;
719
+ $[51] = close;
720
+ $[52] = context;
721
+ $[53] = index;
722
+ $[54] = items;
723
+ $[55] = onValueChange;
724
+ $[56] = t18;
669
725
  } else {
670
- t15 = $[43];
726
+ t18 = $[56];
671
727
  }
672
- let t16;
673
- if ($[44] !== item.label) {
674
- t16 = /*#__PURE__*/_jsx("span", {
728
+ let t19;
729
+ if ($[57] !== item.label) {
730
+ t19 = /*#__PURE__*/_jsx("span", {
675
731
  className: "truncate",
676
732
  children: item.label
677
733
  });
678
- $[44] = item.label;
679
- $[45] = t16;
734
+ $[57] = item.label;
735
+ $[58] = t19;
680
736
  } else {
681
- t16 = $[45];
737
+ t19 = $[58];
682
738
  }
683
- let t17;
684
- if ($[46] !== item.unsaved || $[47] !== t) {
685
- t17 = item.unsaved && /*#__PURE__*/_jsx("span", {
739
+ let t20;
740
+ if ($[59] !== item.unsaved || $[60] !== t) {
741
+ t20 = item.unsaved && /*#__PURE__*/_jsx("span", {
686
742
  className: "ade-tab-unsaved",
687
743
  children: /*#__PURE__*/_jsx("span", {
688
744
  className: "sr-only",
689
745
  children: typeof item.unsaved === "string" ? item.unsaved : t("workspace.unsaved")
690
746
  })
691
747
  });
692
- $[46] = item.unsaved;
693
- $[47] = t;
694
- $[48] = t17;
748
+ $[59] = item.unsaved;
749
+ $[60] = t;
750
+ $[61] = t20;
695
751
  } else {
696
- t17 = $[48];
752
+ t20 = $[61];
697
753
  }
698
- let t18;
699
- if ($[49] !== item.attention || $[50] !== item.detail || $[51] !== item.icon || $[52] !== item.panelId || $[53] !== item.tabId || $[54] !== t10 || $[55] !== t11 || $[56] !== t12 || $[57] !== t13 || $[58] !== t14 || $[59] !== t15 || $[60] !== t16 || $[61] !== t17 || $[62] !== t8 || $[63] !== t9) {
700
- t18 = /*#__PURE__*/_jsxs("button", {
754
+ let t21;
755
+ if ($[62] !== item.attention || $[63] !== item.detail || $[64] !== item.icon || $[65] !== item.panelId || $[66] !== item.tabId || $[67] !== t11 || $[68] !== t12 || $[69] !== t13 || $[70] !== t14 || $[71] !== t15 || $[72] !== t16 || $[73] !== t17 || $[74] !== t18 || $[75] !== t19 || $[76] !== t20) {
756
+ t21 = /*#__PURE__*/_jsxs("button", {
701
757
  type: "button",
702
758
  role: "tab",
703
759
  id: item.tabId,
704
760
  "aria-controls": item.panelId,
705
- "aria-selected": t8,
706
- tabIndex: t9,
761
+ "aria-selected": t11,
762
+ tabIndex: t12,
707
763
  className: "ade-document-tab-open",
708
- draggable: t10,
709
- onClick: t11,
710
- onDoubleClick: t12,
711
- onDragStart: t13,
712
- onDragEnd: t14,
713
- onKeyDown: t15,
714
- children: [item.icon, t16, item.detail, item.attention, t17]
764
+ draggable: t13,
765
+ onClick: t14,
766
+ onDoubleClick: t15,
767
+ onDragStart: t16,
768
+ onDragEnd: t17,
769
+ onKeyDown: t18,
770
+ children: [item.icon, t19, item.detail, item.attention, t20]
715
771
  });
716
- $[49] = item.attention;
717
- $[50] = item.detail;
718
- $[51] = item.icon;
719
- $[52] = item.panelId;
720
- $[53] = item.tabId;
721
- $[54] = t10;
722
- $[55] = t11;
723
- $[56] = t12;
724
- $[57] = t13;
725
- $[58] = t14;
726
- $[59] = t15;
727
- $[60] = t16;
728
- $[61] = t17;
729
- $[62] = t8;
730
- $[63] = t9;
731
- $[64] = t18;
732
- } else {
733
- t18 = $[64];
772
+ $[62] = item.attention;
773
+ $[63] = item.detail;
774
+ $[64] = item.icon;
775
+ $[65] = item.panelId;
776
+ $[66] = item.tabId;
777
+ $[67] = t11;
778
+ $[68] = t12;
779
+ $[69] = t13;
780
+ $[70] = t14;
781
+ $[71] = t15;
782
+ $[72] = t16;
783
+ $[73] = t17;
784
+ $[74] = t18;
785
+ $[75] = t19;
786
+ $[76] = t20;
787
+ $[77] = t21;
788
+ } else {
789
+ t21 = $[77];
734
790
  }
735
- let t19;
736
- if ($[65] !== t18 || $[66] !== t7) {
737
- t19 = /*#__PURE__*/_jsx(Tooltip, {
738
- label: t7,
739
- children: t18
791
+ let t22;
792
+ if ($[78] !== t10 || $[79] !== t21) {
793
+ t22 = /*#__PURE__*/_jsx(Tooltip, {
794
+ label: t10,
795
+ children: t21
740
796
  });
741
- $[65] = t18;
742
- $[66] = t7;
743
- $[67] = t19;
797
+ $[78] = t10;
798
+ $[79] = t21;
799
+ $[80] = t22;
744
800
  } else {
745
- t19 = $[67];
801
+ t22 = $[80];
746
802
  }
747
- let t20;
748
- if ($[68] !== item.pinned) {
749
- t20 = item.pinned && /*#__PURE__*/_jsx(Icon, {
803
+ let t23;
804
+ if ($[81] !== item.pinned) {
805
+ t23 = item.pinned && /*#__PURE__*/_jsx(Icon, {
750
806
  icon: Pin,
751
807
  size: 12,
752
808
  className: "shrink-0 text-text-muted"
753
809
  });
754
- $[68] = item.pinned;
755
- $[69] = t20;
810
+ $[81] = item.pinned;
811
+ $[82] = t23;
756
812
  } else {
757
- t20 = $[69];
813
+ t23 = $[82];
758
814
  }
759
- let t21;
760
- if ($[70] !== closable || $[71] !== close || $[72] !== closeShortcut || $[73] !== item.label || $[74] !== t) {
761
- t21 = closable && /*#__PURE__*/_jsx(IconButton, {
815
+ let t24;
816
+ if ($[83] !== closable || $[84] !== close || $[85] !== closeShortcut || $[86] !== item.label || $[87] !== t) {
817
+ t24 = closable && /*#__PURE__*/_jsx(IconButton, {
762
818
  icon: X,
763
819
  size: "2xs",
764
820
  label: t("workspace.closeTab", {
@@ -768,63 +824,67 @@ export function DocumentTab(t0) {
768
824
  className: "ade-document-tab-close",
769
825
  onClick: close
770
826
  });
771
- $[70] = closable;
772
- $[71] = close;
773
- $[72] = closeShortcut;
774
- $[73] = item.label;
775
- $[74] = t;
776
- $[75] = t21;
827
+ $[83] = closable;
828
+ $[84] = close;
829
+ $[85] = closeShortcut;
830
+ $[86] = item.label;
831
+ $[87] = t;
832
+ $[88] = t24;
777
833
  } else {
778
- t21 = $[75];
834
+ t24 = $[88];
779
835
  }
780
- let t22;
781
- if ($[76] !== t19 || $[77] !== t20 || $[78] !== t21) {
782
- t22 = /*#__PURE__*/_jsxs(_Fragment, {
783
- children: [t19, t20, t21]
836
+ let t25;
837
+ if ($[89] !== t22 || $[90] !== t23 || $[91] !== t24) {
838
+ t25 = /*#__PURE__*/_jsxs(_Fragment, {
839
+ children: [t22, t23, t24]
784
840
  });
785
- $[76] = t19;
786
- $[77] = t20;
787
- $[78] = t21;
788
- $[79] = t22;
841
+ $[89] = t22;
842
+ $[90] = t23;
843
+ $[91] = t24;
844
+ $[92] = t25;
789
845
  } else {
790
- t22 = $[79];
846
+ t25 = $[92];
791
847
  }
792
- let t23;
793
- if ($[80] !== item.id || $[81] !== props || $[82] !== t22 || $[83] !== t3 || $[84] !== t4 || $[85] !== t5 || $[86] !== t6) {
794
- t23 = {
848
+ let t26;
849
+ if ($[93] !== item.id || $[94] !== props || $[95] !== t25 || $[96] !== t4 || $[97] !== t5 || $[98] !== t6 || $[99] !== t7 || $[100] !== t8 || $[101] !== t9) {
850
+ t26 = {
795
851
  ...props,
796
- className: t3,
852
+ className: t4,
797
853
  "data-document-tab": item.id,
798
- "data-active": t4,
799
- "data-detail": t5,
800
- onContextMenu: t6,
801
- children: t22
854
+ "data-active": t5,
855
+ "data-detail": t6,
856
+ onContextMenu: t7,
857
+ onMouseDown: t8,
858
+ onAuxClick: t9,
859
+ children: t25
802
860
  };
803
- $[80] = item.id;
804
- $[81] = props;
805
- $[82] = t22;
806
- $[83] = t3;
807
- $[84] = t4;
808
- $[85] = t5;
809
- $[86] = t6;
810
- $[87] = t23;
811
- } else {
812
- t23 = $[87];
861
+ $[93] = item.id;
862
+ $[94] = props;
863
+ $[95] = t25;
864
+ $[96] = t4;
865
+ $[97] = t5;
866
+ $[98] = t6;
867
+ $[99] = t7;
868
+ $[100] = t8;
869
+ $[101] = t9;
870
+ $[102] = t26;
871
+ } else {
872
+ t26 = $[102];
813
873
  }
814
- let t24;
815
- if ($[88] !== ref || $[89] !== render || $[90] !== t23) {
816
- t24 = {
874
+ let t27;
875
+ if ($[103] !== ref || $[104] !== render || $[105] !== t26) {
876
+ t27 = {
817
877
  render,
818
878
  ref,
819
879
  defaultTagName: "span",
820
- props: t23
880
+ props: t26
821
881
  };
822
- $[88] = ref;
823
- $[89] = render;
824
- $[90] = t23;
825
- $[91] = t24;
882
+ $[103] = ref;
883
+ $[104] = render;
884
+ $[105] = t26;
885
+ $[106] = t27;
826
886
  } else {
827
- t24 = $[91];
887
+ t27 = $[106];
828
888
  }
829
- return useRender(t24);
889
+ return useRender(t27);
830
890
  }