gridsmith-ui 0.31.0 → 0.32.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 (66) hide show
  1. package/CHANGELOG.md +64 -1
  2. package/dist/charts.d.ts +101 -30
  3. package/dist/charts.js +181 -106
  4. package/dist/charts.js.map +1 -1
  5. package/dist/chat.js +6 -6
  6. package/dist/{chunk-OWQ7M6R7.js → chunk-2724SJO2.js} +141 -24
  7. package/dist/chunk-2724SJO2.js.map +1 -0
  8. package/dist/{chunk-BKYWKMUN.js → chunk-DO6DLTFK.js} +11 -9
  9. package/dist/chunk-DO6DLTFK.js.map +1 -0
  10. package/dist/{chunk-GP2COVJC.js → chunk-H732QL56.js} +4 -4
  11. package/dist/{chunk-GP2COVJC.js.map → chunk-H732QL56.js.map} +1 -1
  12. package/dist/{chunk-XSQD3UGY.js → chunk-HCEHTJ5E.js} +17 -4
  13. package/dist/chunk-HCEHTJ5E.js.map +1 -0
  14. package/dist/{chunk-YFHTREH5.js → chunk-HUVZQOU4.js} +5 -5
  15. package/dist/{chunk-YFHTREH5.js.map → chunk-HUVZQOU4.js.map} +1 -1
  16. package/dist/{chunk-EKWXPSTI.js → chunk-JHZ22HQP.js} +75 -24
  17. package/dist/chunk-JHZ22HQP.js.map +1 -0
  18. package/dist/{chunk-3J67NISC.js → chunk-NGZJK57C.js} +15 -11
  19. package/dist/chunk-NGZJK57C.js.map +1 -0
  20. package/dist/{chunk-U7WBI4AV.js → chunk-OVHM55JF.js} +5 -5
  21. package/dist/{chunk-U7WBI4AV.js.map → chunk-OVHM55JF.js.map} +1 -1
  22. package/dist/{chunk-OFACAHRV.js → chunk-QY2RA2HO.js} +5 -5
  23. package/dist/{chunk-OFACAHRV.js.map → chunk-QY2RA2HO.js.map} +1 -1
  24. package/dist/{chunk-HUNEJIKV.js → chunk-R2IAK3J3.js} +3 -3
  25. package/dist/{chunk-HUNEJIKV.js.map → chunk-R2IAK3J3.js.map} +1 -1
  26. package/dist/{chunk-V73LHNRL.js → chunk-RS624TD5.js} +29 -10
  27. package/dist/chunk-RS624TD5.js.map +1 -0
  28. package/dist/{chunk-V2ARGHJN.js → chunk-SIEU4H3H.js} +9 -9
  29. package/dist/chunk-SIEU4H3H.js.map +1 -0
  30. package/dist/{chunk-DBHVJ7Z3.js → chunk-SS3C24IJ.js} +3 -2
  31. package/dist/chunk-SS3C24IJ.js.map +1 -0
  32. package/dist/{chunk-LE72KHIE.js → chunk-TMPPBXX3.js} +3 -3
  33. package/dist/{chunk-LE72KHIE.js.map → chunk-TMPPBXX3.js.map} +1 -1
  34. package/dist/{chunk-GT6M74IZ.js → chunk-WSKPESAX.js} +12 -10
  35. package/dist/chunk-WSKPESAX.js.map +1 -0
  36. package/dist/{chunk-2Q4HOGEI.js → chunk-XBVZIN26.js} +15 -5
  37. package/dist/chunk-XBVZIN26.js.map +1 -0
  38. package/dist/data-grid.js +10 -10
  39. package/dist/data-grid.js.map +1 -1
  40. package/dist/editor-mentions.js +2 -2
  41. package/dist/editor.js +4 -3
  42. package/dist/editor.js.map +1 -1
  43. package/dist/index.d.ts +53 -6
  44. package/dist/index.js +557 -232
  45. package/dist/index.js.map +1 -1
  46. package/dist/kanban.js +10 -9
  47. package/dist/kanban.js.map +1 -1
  48. package/dist/resizable.d.ts +11 -2
  49. package/dist/resizable.js +97 -22
  50. package/dist/resizable.js.map +1 -1
  51. package/dist/roots.css +2 -2
  52. package/dist/tokens.css +6 -6
  53. package/dist/virtualized.js +10 -9
  54. package/dist/virtualized.js.map +1 -1
  55. package/dist-static/tokens.css +6 -6
  56. package/package.json +1 -1
  57. package/dist/chunk-2Q4HOGEI.js.map +0 -1
  58. package/dist/chunk-3J67NISC.js.map +0 -1
  59. package/dist/chunk-BKYWKMUN.js.map +0 -1
  60. package/dist/chunk-DBHVJ7Z3.js.map +0 -1
  61. package/dist/chunk-EKWXPSTI.js.map +0 -1
  62. package/dist/chunk-GT6M74IZ.js.map +0 -1
  63. package/dist/chunk-OWQ7M6R7.js.map +0 -1
  64. package/dist/chunk-V2ARGHJN.js.map +0 -1
  65. package/dist/chunk-V73LHNRL.js.map +0 -1
  66. package/dist/chunk-XSQD3UGY.js.map +0 -1
package/dist/chat.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { Divider, CodeBlock, Link } from './chunk-OFACAHRV.js';
3
- import './chunk-GT6M74IZ.js';
4
- import { useKeyboardScroll } from './chunk-GP2COVJC.js';
5
- import './chunk-HUNEJIKV.js';
6
- import './chunk-XSQD3UGY.js';
2
+ import { Divider, CodeBlock, Link } from './chunk-QY2RA2HO.js';
3
+ import './chunk-WSKPESAX.js';
4
+ import { useKeyboardScroll } from './chunk-H732QL56.js';
5
+ import './chunk-R2IAK3J3.js';
6
+ import './chunk-HCEHTJ5E.js';
7
7
  import './chunk-53F7GVBQ.js';
8
- import { cn, FOCUS_INSET } from './chunk-OWQ7M6R7.js';
8
+ import { cn, FOCUS_INSET } from './chunk-2724SJO2.js';
9
9
  import { memo, useState, Children, isValidElement } from 'react';
10
10
  import Markdown from 'react-markdown';
11
11
  import remarkGfm from 'remark-gfm';
@@ -102,6 +102,10 @@ function pathAbove(to, from) {
102
102
  const up = to.replace(/\/+$/, "");
103
103
  return from.startsWith(`${up}/`) && from.replace(/\/+$/, "") !== up;
104
104
  }
105
+ function pageAddress() {
106
+ const { pathname, hash } = location;
107
+ return /^#!?\//.test(hash) ? pathname + hash.replace(/\?.*$/, "") : pathname;
108
+ }
105
109
  var ROW = 'tr, li, [role="row"], [data-card], [data-row]';
106
110
  function deletedRow(before, now) {
107
111
  const refilled = now.length === before.length;
@@ -139,6 +143,53 @@ function focusForTheMoment(el) {
139
143
  }
140
144
  var HEADING = 'h1, h2, h3, h4, h5, h6, [role="heading"]';
141
145
  var LAST_RESORT_MS = 200;
146
+ function focusLandings() {
147
+ let landed = false;
148
+ const onIn = () => {
149
+ landed = true;
150
+ };
151
+ document.addEventListener("focusin", onIn, true);
152
+ return { get landed() {
153
+ return landed;
154
+ }, stop: () => {
155
+ if (typeof document !== "undefined") document.removeEventListener("focusin", onIn, true);
156
+ } };
157
+ }
158
+ var SCROLL_KEYS = /* @__PURE__ */ new Set(["PageDown", "PageUp", "Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight", " "]);
159
+ var unreachable = (el) => el.matches(":disabled") || !!el.closest("[inert]");
160
+ function onMovingOn(control, done) {
161
+ let live = true;
162
+ const end = () => {
163
+ if (live) done();
164
+ };
165
+ const onFocusIn = (e) => {
166
+ if (e.target !== control) end();
167
+ };
168
+ const onFocusOut = (e) => {
169
+ if (e.target !== control) return;
170
+ queueMicrotask(() => {
171
+ if (typeof document === "undefined") return;
172
+ if (control.isConnected && !unreachable(control) && isRendered(control) && document.activeElement !== control) end();
173
+ });
174
+ };
175
+ const onKey = (e) => {
176
+ const active = document.activeElement;
177
+ if (SCROLL_KEYS.has(e.key) && (!active || active === document.body || active === control && e.key !== " ")) end();
178
+ };
179
+ const listeners = [
180
+ ["focusin", onFocusIn, { capture: true }],
181
+ ["focusout", onFocusOut, { capture: true }],
182
+ ["pointerdown", end, { capture: true }],
183
+ ["wheel", end, { capture: true, passive: true }],
184
+ ["touchmove", end, { capture: true, passive: true }],
185
+ ["keydown", onKey, { capture: true }]
186
+ ];
187
+ for (const [type, fn, opts] of listeners) document.addEventListener(type, fn, opts);
188
+ return () => {
189
+ live = false;
190
+ if (typeof document !== "undefined") for (const [type, fn, opts] of listeners) document.removeEventListener(type, fn, opts);
191
+ };
192
+ }
142
193
  function placesOf(el) {
143
194
  const places = [];
144
195
  for (let c = el, box = el.parentElement; box && box !== document.body && box.parentElement && box.parentElement !== document.body; c = box, box = box.parentElement) {
@@ -171,6 +222,46 @@ function landLastResort(places, closing) {
171
222
  }
172
223
  return mainCounts && focusForTheMoment(main);
173
224
  }
225
+ var DIALOG = 'dialog, [role="dialog"], [role="alertdialog"], [aria-modal="true"]';
226
+ function pointOf(el) {
227
+ const point = document.createRange();
228
+ point.selectNodeContents(el);
229
+ return point;
230
+ }
231
+ function landWhereTabGoes(point, places) {
232
+ const at = point.startContainer;
233
+ const from = at instanceof Element ? at : at.parentElement;
234
+ if (!from?.isConnected) return landLastResort(places);
235
+ const dialog = from.closest(DIALOG);
236
+ let layer = dialog;
237
+ if (!layer) for (let el = from; el && el !== document.body; el = el.parentElement) layer = el;
238
+ if (!layer) return landLastResort(places);
239
+ const stops = tabStops(layer);
240
+ const next = stops.findIndex((s) => point.comparePoint(s, 0) === 1);
241
+ const to = next >= 0 ? stops[next] : stops.at(-1);
242
+ if (to) {
243
+ to.focus();
244
+ if (document.activeElement === to) return true;
245
+ }
246
+ return !dialog && landLastResort(places);
247
+ }
248
+ var OPEN_TO_FOCUS = "ds-open-to-focus";
249
+ function openToFocus(target, step) {
250
+ if (!target.closest("[inert]")) {
251
+ step();
252
+ return;
253
+ }
254
+ target.dispatchEvent(new CustomEvent(OPEN_TO_FOCUS, { bubbles: true, detail: { target, step, done: false, at: performance.now() } }));
255
+ }
256
+ function focusOutOf(el) {
257
+ const root = el.closest(DIALOG) ?? document.body;
258
+ const before = tabStops(root).filter((s) => !el.contains(s) && el.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_PRECEDING).at(-1);
259
+ if (before) {
260
+ before.focus();
261
+ if (document.activeElement === before) return true;
262
+ }
263
+ return landLastResort(placesOf(el), el);
264
+ }
174
265
  function rememberFocus(el, { ignoreRoute = false } = {}) {
175
266
  const { href, pathname } = location;
176
267
  const row = el.closest(ROW);
@@ -217,10 +308,12 @@ function rememberFocus(el, { ignoreRoute = false } = {}) {
217
308
  };
218
309
  const neighbour = () => inRow(byKey(keyOf(before)) ?? before) || inRow(byKey(keyOf(after)) ?? after) || !!list?.isConnected && land(tabStops(list)[0]);
219
310
  const lastResort = () => {
311
+ const landings = focusLandings();
220
312
  setTimeout(() => {
313
+ landings.stop();
221
314
  if (typeof document === "undefined") return;
222
315
  const active = document.activeElement;
223
- if (active && active !== document.body && active.isConnected || pageChanged()) return;
316
+ if (active && active !== document.body && active.isConnected || landings.landed || pageChanged()) return;
224
317
  landLastResort(places);
225
318
  }, LAST_RESORT_MS);
226
319
  return false;
@@ -238,20 +331,17 @@ function rememberFocus(el, { ignoreRoute = false } = {}) {
238
331
  const fromList = changes.some((c) => c.target === list || c.target === list.parentNode);
239
332
  if (!(fromList && neighbour())) lastResort();
240
333
  });
241
- const onFocusIn = (e) => {
242
- if (e.target !== el) stop();
243
- };
244
334
  const timer = setTimeout(() => stop(), 1e4);
335
+ const quit = onMovingOn(el, () => stop());
245
336
  function stop() {
246
337
  observer.disconnect();
247
338
  clearTimeout(timer);
248
- if (typeof document !== "undefined") document.removeEventListener("focusin", onFocusIn, true);
339
+ quit();
249
340
  unwatch = null;
250
341
  }
251
342
  observer.observe(list, { childList: true });
252
343
  if (list.parentNode) observer.observe(list.parentNode, { childList: true });
253
344
  for (const { box } of places) observer.observe(box, { childList: true });
254
- document.addEventListener("focusin", onFocusIn, true);
255
345
  unwatch = stop;
256
346
  };
257
347
  return {
@@ -315,6 +405,12 @@ function useFocusKeptInList(listRef) {
315
405
  }, [listRef]);
316
406
  }
317
407
  var openers = /* @__PURE__ */ new WeakMap();
408
+ function registerOpenerRoot(el, resolve) {
409
+ openers.set(el, resolve);
410
+ return () => {
411
+ if (openers.get(el) === resolve) openers.delete(el);
412
+ };
413
+ }
318
414
  var waiting = /* @__PURE__ */ new WeakMap();
319
415
  var WATCH_MS = 1e4;
320
416
  function rememberOpener(active, root) {
@@ -324,7 +420,8 @@ function rememberOpener(active, root) {
324
420
  if (controller) own = rememberFocus(controller);
325
421
  let around = null;
326
422
  for (let n = active; n && !around; n = n.parentElement) {
327
- const opener = openers.get(n);
423
+ const entry = openers.get(n);
424
+ const opener = typeof entry === "function" ? entry() : entry;
328
425
  if (opener) around = { root: n, opener };
329
426
  }
330
427
  const back = own ?? around?.opener;
@@ -364,6 +461,7 @@ function rememberOpener(active, root) {
364
461
  return {
365
462
  el: own?.el ?? null,
366
463
  restore(fallback) {
464
+ if (around && own && !own.el.isConnected && !around.root.isConnected && around.root.contains(own.el)) return around.opener.restore() || own.restore(fallback);
367
465
  if (own?.restore(fallback)) return true;
368
466
  return !!around && !around.root.isConnected && around.opener.restore();
369
467
  }
@@ -405,24 +503,27 @@ function mayStop(root) {
405
503
  const disabled = (el) => (el instanceof HTMLButtonElement || el instanceof HTMLInputElement || el instanceof HTMLSelectElement || el instanceof HTMLTextAreaElement) && el.disabled;
406
504
  return Array.from(root.querySelectorAll(`${FOCUSABLE}, button:disabled, input:disabled, select:disabled, textarea:disabled`)).filter((el) => disabled(el) ? !(el instanceof HTMLInputElement && el.type === "hidden") : isTabStop(el)).sort((a, b) => a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
407
505
  }
408
- function focusAfterSelfRemoval(control, { item, group, to } = {}) {
506
+ var watched = /* @__PURE__ */ new WeakSet();
507
+ var hasSelfRemovalWatch = (control) => watched.has(control);
508
+ function focusAfterSelfRemoval(control, { item, group, to, samePage, defer, removedOnly, point } = {}) {
409
509
  const goes = item ?? control;
410
510
  const within = group === void 0 ? goes.parentElement : group;
411
511
  const stops = within ? mayStop(within).filter((el) => !goes.contains(el)) : [];
412
512
  const before = stops.filter((el) => goes.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_PRECEDING).reverse();
413
513
  const after = stops.filter((el) => goes.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING);
414
514
  const stopsOf = (el) => [...isTabStop(el) ? [el] : [], ...tabStops(el)];
415
- const index = stopsOf(goes).indexOf(control);
416
515
  const neighbour = (step) => {
516
+ const index = stopsOf(goes).indexOf(control);
417
517
  for (let el = goes[step]; el; el = el[step]) {
418
518
  const own = stopsOf(el);
419
519
  if (own.length) return own[Math.max(0, Math.min(index, own.length - 1))];
420
520
  }
421
521
  return null;
422
522
  };
423
- const sameBefore = neighbour("previousElementSibling");
424
- const sameAfter = neighbour("nextElementSibling");
425
- const gone = () => !control.isConnected || control instanceof HTMLButtonElement && control.disabled;
523
+ const sameBefore = within ? neighbour("previousElementSibling") : null;
524
+ const sameAfter = within ? neighbour("nextElementSibling") : null;
525
+ const disabled = () => control.matches(":disabled");
526
+ const gone = () => !control.isConnected || !removedOnly && disabled();
426
527
  const lost = () => {
427
528
  const active = document.activeElement;
428
529
  return !active || active === document.body || !active.isConnected || active === control;
@@ -435,25 +536,41 @@ function focusAfterSelfRemoval(control, { item, group, to } = {}) {
435
536
  const landOnGroup = () => !!within?.isConnected && focusForTheMoment(within);
436
537
  const places = within ? [] : placesOf(goes);
437
538
  const landTo = (el) => land(el) || !!el && el.isConnected && !isTabStop(el) && isRendered(el) && focusForTheMoment(el);
438
- const place = () => landTo(typeof to === "function" ? to() : to) || land(sameBefore) || before.some(land) || land(sameAfter) || after.some(land) || (within ? landOnGroup() : landLastResort(places));
539
+ const place = () => landTo(typeof to === "function" ? to() : to) || land(sameBefore) || before.some(land) || land(sameAfter) || after.some(land) || (within ? landOnGroup() : point ? landWhereTabGoes(point, places) : landLastResort(places));
439
540
  if (typeof MutationObserver === "undefined") return () => {
440
541
  };
441
- const observer = new MutationObserver(() => {
542
+ const path = samePage && typeof location !== "undefined" ? pageAddress() : null;
543
+ const samePlace = () => path === null || pageAddress() === path;
544
+ let on = true;
545
+ const look = () => {
442
546
  if (!gone()) return;
443
- stop();
444
- if (lost()) place();
445
- });
446
- const onFocusIn = (e) => {
447
- if (e.target !== control) stop();
547
+ if (!defer) {
548
+ stop();
549
+ if (lost() && samePlace()) place();
550
+ return;
551
+ }
552
+ observer.disconnect();
553
+ clearTimeout(timer);
554
+ setTimeout(() => {
555
+ if (typeof document === "undefined") return;
556
+ const act = on && gone() && lost() && samePlace();
557
+ stop();
558
+ if (act) place();
559
+ }, defer);
448
560
  };
561
+ const observer = new MutationObserver(look);
449
562
  const timer = setTimeout(() => stop(), 1e4);
563
+ const quit = onMovingOn(control, () => stop());
450
564
  function stop() {
565
+ on = false;
451
566
  observer.disconnect();
452
567
  clearTimeout(timer);
453
- if (typeof document !== "undefined") document.removeEventListener("focusin", onFocusIn, true);
568
+ watched.delete(control);
569
+ quit();
454
570
  }
455
571
  observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["disabled"] });
456
- document.addEventListener("focusin", onFocusIn, true);
572
+ watched.add(control);
573
+ look();
457
574
  return stop;
458
575
  }
459
576
  var layers = [];
@@ -910,6 +1027,6 @@ function usePosition(triggerRef, floatingRef, open, options = {}) {
910
1027
  return pos;
911
1028
  }
912
1029
 
913
- export { ACTIVE_RING, CONTROL_ANCESTOR, ERROR_ACTIVE_RING, ERROR_FOCUS_RING, ERROR_FOCUS_WITHIN_RING, ERROR_HAS_FOCUS_RING, FIELD, FIELD_FOCUS_RING, FIELD_FOCUS_WITHIN_RING, FIELD_HAS_FOCUS_RING, FOCUSABLE, FOCUS_INSET, FOCUS_INSET_WHILE_STOP, FOCUS_RING, FOCUS_ROOM, GLASS_BACKDROP, GLASS_DROPDOWN, GLASS_OVERLAY, GLASS_SURFACE, GROUP_FOCUS_RING, OVERLAY_CLOSE_ATTR, OVERLAY_SURFACE, PEER_FOCUS_RING, ZOOM_KEYS, atLeastFocusRoom, cn, focusAfterRemoval, focusAfterSelfRemoval, focusInitial, hasTabStop, inertOutside, isTabStop, lockBodyScroll, rememberFocus, rememberOpener, rovingTabStop, tabStops, unlockBodyScroll, useCloseOnFocusOut, useFocusBeforeOpen, useFocusKeptInList, useFocusLeave, useFocusTrap, useGridKeyboard, useLatest, useNonModalDialog, useOverlayLayer, usePopupFocus, usePosition, usePressMarks, useReturnFocus };
914
- //# sourceMappingURL=chunk-OWQ7M6R7.js.map
915
- //# sourceMappingURL=chunk-OWQ7M6R7.js.map
1030
+ export { ACTIVE_RING, CONTROL_ANCESTOR, ERROR_ACTIVE_RING, ERROR_FOCUS_RING, ERROR_FOCUS_WITHIN_RING, ERROR_HAS_FOCUS_RING, FIELD, FIELD_FOCUS_RING, FIELD_FOCUS_WITHIN_RING, FIELD_HAS_FOCUS_RING, FOCUSABLE, FOCUS_INSET, FOCUS_INSET_WHILE_STOP, FOCUS_RING, FOCUS_ROOM, GLASS_BACKDROP, GLASS_DROPDOWN, GLASS_OVERLAY, GLASS_SURFACE, GROUP_FOCUS_RING, LAST_RESORT_MS, OPEN_TO_FOCUS, OVERLAY_CLOSE_ATTR, OVERLAY_SURFACE, PEER_FOCUS_RING, ZOOM_KEYS, atLeastFocusRoom, cn, focusAfterRemoval, focusAfterSelfRemoval, focusInitial, focusOutOf, hasSelfRemovalWatch, hasTabStop, inertOutside, isTabStop, lockBodyScroll, onMovingOn, openToFocus, pageAddress, pointOf, registerOpenerRoot, rememberFocus, rememberOpener, rovingTabStop, tabStops, unlockBodyScroll, useCloseOnFocusOut, useFocusBeforeOpen, useFocusKeptInList, useFocusLeave, useFocusTrap, useGridKeyboard, useLatest, useNonModalDialog, useOverlayLayer, usePopupFocus, usePosition, usePressMarks, useReturnFocus };
1031
+ //# sourceMappingURL=chunk-2724SJO2.js.map
1032
+ //# sourceMappingURL=chunk-2724SJO2.js.map