gridsmith-ui 0.31.1 → 0.33.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 (84) hide show
  1. package/CHANGELOG.md +78 -1
  2. package/README.md +4 -2
  3. package/dist/charts.d.ts +111 -31
  4. package/dist/charts.js +288 -148
  5. package/dist/charts.js.map +1 -1
  6. package/dist/chat.js +6 -6
  7. package/dist/{chunk-EZ3ZGFGA.js → chunk-2724SJO2.js} +12 -4
  8. package/dist/chunk-2724SJO2.js.map +1 -0
  9. package/dist/{chunk-I6JJ7KKP.js → chunk-6NRLTG5W.js} +16 -11
  10. package/dist/chunk-6NRLTG5W.js.map +1 -0
  11. package/dist/{chunk-BHTAVJIG.js → chunk-6XCWKLJZ.js} +41 -6
  12. package/dist/chunk-6XCWKLJZ.js.map +1 -0
  13. package/dist/{chunk-TH272DIC.js → chunk-AB4UQ4G5.js} +125 -235
  14. package/dist/chunk-AB4UQ4G5.js.map +1 -0
  15. package/dist/{chunk-IOHGE4EW.js → chunk-AVSP6NDX.js} +8 -8
  16. package/dist/chunk-AVSP6NDX.js.map +1 -0
  17. package/dist/chunk-F2XMZOUP.js +81 -0
  18. package/dist/chunk-F2XMZOUP.js.map +1 -0
  19. package/dist/{chunk-HQFTP7Y5.js → chunk-FF57N3P7.js} +10 -8
  20. package/dist/chunk-FF57N3P7.js.map +1 -0
  21. package/dist/chunk-GIA4BMGI.js +18 -0
  22. package/dist/chunk-GIA4BMGI.js.map +1 -0
  23. package/dist/{chunk-DR6WEI3A.js → chunk-HCEHTJ5E.js} +3 -3
  24. package/dist/{chunk-DR6WEI3A.js.map → chunk-HCEHTJ5E.js.map} +1 -1
  25. package/dist/{chunk-IZW5XHKA.js → chunk-OWGF362U.js} +10 -8
  26. package/dist/chunk-OWGF362U.js.map +1 -0
  27. package/dist/chunk-P3NUUIL6.js +9 -0
  28. package/dist/chunk-P3NUUIL6.js.map +1 -0
  29. package/dist/{chunk-W3GY5ROH.js → chunk-R2IAK3J3.js} +3 -3
  30. package/dist/{chunk-W3GY5ROH.js.map → chunk-R2IAK3J3.js.map} +1 -1
  31. package/dist/chunk-R7FG4ZQ5.js +16 -0
  32. package/dist/chunk-R7FG4ZQ5.js.map +1 -0
  33. package/dist/{chunk-V73LHNRL.js → chunk-RS624TD5.js} +29 -10
  34. package/dist/chunk-RS624TD5.js.map +1 -0
  35. package/dist/{chunk-DBHVJ7Z3.js → chunk-SS3C24IJ.js} +3 -2
  36. package/dist/chunk-SS3C24IJ.js.map +1 -0
  37. package/dist/{chunk-K3NAFQ4S.js → chunk-TMPPBXX3.js} +3 -3
  38. package/dist/{chunk-K3NAFQ4S.js.map → chunk-TMPPBXX3.js.map} +1 -1
  39. package/dist/{chunk-NDL2JGQ7.js → chunk-UBLBVCQN.js} +5 -5
  40. package/dist/{chunk-NDL2JGQ7.js.map → chunk-UBLBVCQN.js.map} +1 -1
  41. package/dist/{chunk-2TCCSKL3.js → chunk-WD6T57ZJ.js} +5 -5
  42. package/dist/{chunk-2TCCSKL3.js.map → chunk-WD6T57ZJ.js.map} +1 -1
  43. package/dist/{chunk-SLGGZ3MU.js → chunk-WSKPESAX.js} +12 -10
  44. package/dist/chunk-WSKPESAX.js.map +1 -0
  45. package/dist/chunk-ZQV26NND.js +213 -0
  46. package/dist/chunk-ZQV26NND.js.map +1 -0
  47. package/dist/dashboard.d.ts +207 -0
  48. package/dist/dashboard.js +1210 -0
  49. package/dist/dashboard.js.map +1 -0
  50. package/dist/data-grid.js +11 -10
  51. package/dist/data-grid.js.map +1 -1
  52. package/dist/editor-mentions.js +2 -2
  53. package/dist/editor.js +3 -2
  54. package/dist/editor.js.map +1 -1
  55. package/dist/index.d.ts +94 -12
  56. package/dist/index.js +601 -316
  57. package/dist/index.js.map +1 -1
  58. package/dist/kanban.js +9 -9
  59. package/dist/resizable.d.ts +11 -2
  60. package/dist/resizable.js +97 -22
  61. package/dist/resizable.js.map +1 -1
  62. package/dist/roots.css +2 -2
  63. package/dist/tokens.css +6 -6
  64. package/dist/utils.d.ts +51 -1
  65. package/dist/utils.js +55 -4
  66. package/dist/utils.js.map +1 -1
  67. package/dist/virtualized.js +9 -8
  68. package/dist/virtualized.js.map +1 -1
  69. package/dist-static/tokens.css +6 -6
  70. package/package.json +6 -1
  71. package/dist/chunk-BHTAVJIG.js.map +0 -1
  72. package/dist/chunk-DBHVJ7Z3.js.map +0 -1
  73. package/dist/chunk-EZ3ZGFGA.js.map +0 -1
  74. package/dist/chunk-HQFTP7Y5.js.map +0 -1
  75. package/dist/chunk-I6JJ7KKP.js.map +0 -1
  76. package/dist/chunk-IOHGE4EW.js.map +0 -1
  77. package/dist/chunk-IZW5XHKA.js.map +0 -1
  78. package/dist/chunk-KSJTMSYA.js +0 -71
  79. package/dist/chunk-KSJTMSYA.js.map +0 -1
  80. package/dist/chunk-LJYSVZMI.js +0 -25
  81. package/dist/chunk-LJYSVZMI.js.map +0 -1
  82. package/dist/chunk-SLGGZ3MU.js.map +0 -1
  83. package/dist/chunk-TH272DIC.js.map +0 -1
  84. package/dist/chunk-V73LHNRL.js.map +0 -1
package/dist/tokens.css CHANGED
@@ -151,7 +151,7 @@
151
151
  --ds-nav-h-track-border: var(--ds-border-width);
152
152
  --ds-nav-h-track-gap: 0px;
153
153
  --ds-nav-h-badge-bg: var(--ds-accent-primary);
154
- --ds-nav-v-active-bg: var(--ds-tab-active-bg);
154
+ --ds-nav-v-active-bg: var(--ds-accent-subtle);
155
155
  --ds-nav-v-active-text: var(--ds-accent-ink);
156
156
  --ds-nav-v-active-rail: var(--ds-border-width-thick);
157
157
  --ds-nav-v-item-radius: var(--ds-radius-sm);
@@ -159,7 +159,7 @@
159
159
  --ds-nav-v-track-padding: var(--ds-space-1);
160
160
  --ds-nav-v-active-muted: var(--ds-text-secondary);
161
161
  --ds-nav-v-badge-bg: var(--ds-accent-primary);
162
- --ds-tree-active-bg: var(--ds-tab-active-bg);
162
+ --ds-tree-active-bg: var(--ds-accent-subtle);
163
163
  --ds-tree-active-text: var(--ds-accent-ink);
164
164
  --ds-tree-active-muted: var(--ds-text-muted);
165
165
  --ds-tree-active-rail: var(--ds-border-width-thick);
@@ -184,7 +184,7 @@
184
184
  --ds-nav-h-track-border: var(--ds-border-width);
185
185
  --ds-nav-h-track-gap: 0px;
186
186
  --ds-nav-h-badge-bg: var(--ds-accent-primary);
187
- --ds-nav-v-active-bg: var(--ds-tab-active-bg);
187
+ --ds-nav-v-active-bg: var(--ds-accent-subtle);
188
188
  --ds-nav-v-active-text: var(--ds-accent-ink);
189
189
  --ds-nav-v-active-rail: var(--ds-border-width-thick);
190
190
  --ds-nav-v-item-radius: var(--ds-radius-sm);
@@ -192,7 +192,7 @@
192
192
  --ds-nav-v-track-padding: var(--ds-space-1);
193
193
  --ds-nav-v-active-muted: var(--ds-text-secondary);
194
194
  --ds-nav-v-badge-bg: var(--ds-accent-primary);
195
- --ds-tree-active-bg: var(--ds-tab-active-bg);
195
+ --ds-tree-active-bg: var(--ds-accent-subtle);
196
196
  --ds-tree-active-text: var(--ds-accent-ink);
197
197
  --ds-tree-active-muted: var(--ds-text-muted);
198
198
  --ds-tree-active-rail: var(--ds-border-width-thick);
@@ -469,7 +469,7 @@
469
469
  --ds-nav-h-track-border: var(--ds-border-width);
470
470
  --ds-nav-h-track-gap: 0px;
471
471
  --ds-nav-h-badge-bg: var(--ds-accent-primary);
472
- --ds-nav-v-active-bg: var(--ds-tab-active-bg);
472
+ --ds-nav-v-active-bg: var(--ds-accent-subtle);
473
473
  --ds-nav-v-active-text: var(--ds-accent-ink);
474
474
  --ds-nav-v-active-rail: var(--ds-border-width-thick);
475
475
  --ds-nav-v-item-radius: var(--ds-radius-sm);
@@ -477,7 +477,7 @@
477
477
  --ds-nav-v-track-padding: var(--ds-space-1);
478
478
  --ds-nav-v-active-muted: var(--ds-text-secondary);
479
479
  --ds-nav-v-badge-bg: var(--ds-accent-primary);
480
- --ds-tree-active-bg: var(--ds-tab-active-bg);
480
+ --ds-tree-active-bg: var(--ds-accent-subtle);
481
481
  --ds-tree-active-text: var(--ds-accent-ink);
482
482
  --ds-tree-active-muted: var(--ds-text-muted);
483
483
  --ds-tree-active-rail: var(--ds-border-width-thick);
package/dist/utils.d.ts CHANGED
@@ -326,4 +326,54 @@ type CategoryKind = "names" | "scale";
326
326
  */
327
327
  declare function categoryKind(labels: ReadonlyArray<unknown>, locale?: string): CategoryKind;
328
328
 
329
- export { ACTIVE_RING, type CategoryKind, type DateInput, type DateRangeWords, ERROR_ACTIVE_RING, ERROR_FOCUS_RING, ERROR_FOCUS_WITHIN_RING, ERROR_HAS_FOCUS_RING, FIELD_FOCUS_RING, FIELD_FOCUS_WITHIN_RING, FIELD_HAS_FOCUS_RING, FOCUS_INSET, FOCUS_RING, FOCUS_WITHIN_RING, GLASS_BACKDROP, GLASS_DROPDOWN, GLASS_OVERLAY, GLASS_SURFACE, GROUP_FOCUS_RING, HAS_FOCUS_RING, type Occurrence, PEER_FOCUS_RING, type Recurrence, type RecurrenceFrequency, type RecurrencePreset, type RecurrenceScope, type RepeatChange, type RepeatingEvent, TIME_ZOOMS, type TimeZoom, type WeekOfMonth, type Weekday, canonicalTimeZone, categoryKind, cn, countEdited, dateOfDay, dayOf, deleteOccurrence, describeRecurrence, endDayOf, formatDateRange, nthOf, occurrenceOn, occurrences, parseRRule, readRecurrence, recurrencePresets, requestLocale, sameRecurrence, saveOccurrence, timeExtent, timeZoneOffset, toRRule };
329
+ /**
330
+ * Sprint 32 (A2) — a dashboard's layout, as plain data: its widgets in reading order, each with a width in columns of 12
331
+ * and a height in rows of a fixed height. The grid lays them out as text is laid out: left to right, then the next row,
332
+ * each taking the first space after the one before that fits it (CSS grid's sparse auto-placement, never `dense`), so
333
+ * what's on screen, what a screen reader reads and where Tab goes are one order by construction.
334
+ *
335
+ * Server-safe: no React and no browser, so `gridsmith-ui/utils` exports the helpers (normaliseLayout, moveItem,
336
+ * resizeItem, addItem, removeItem) and a page that only adds a widget, or a test that checks a layout, needs no drag
337
+ * code. The rest is the grid's own: where widgets land (`placeLayout`, a copy of the browser's placement rule, held equal
338
+ * to Chrome's by a Chrome test), where a key or a pointer would take one (`stepTarget`, `nearestIndex`) and the words a
339
+ * screen reader hears for a size. Where things land is worked out here, from the layout, never measured from the
340
+ * screen: measuring a preview feeds back into it, the flicker sortable grids are known for.
341
+ */
342
+ interface DashboardLayoutItem {
343
+ id: string;
344
+ /** Its width, in columns of 12. */
345
+ w: number;
346
+ /** Its height, in rows. */
347
+ h: number;
348
+ /** The narrowest it may be made, in columns (default 3, a quarter of the width; a widget is never narrower). */
349
+ minW?: number;
350
+ /** The shortest it may be made, in rows (default 2). */
351
+ minH?: number;
352
+ /** The widest it may be made, in columns (default 12). */
353
+ maxW?: number;
354
+ /** The tallest it may be made, in rows. */
355
+ maxH?: number;
356
+ }
357
+ type DashboardLayout = DashboardLayoutItem[];
358
+ /**
359
+ * The layout the grid draws (A2, "always valid"): whatever a page passes (a width past 12, a size under its minimum, a
360
+ * repeated id, an entry with no id), each widget once, in order, with whole sizes inside its limits and the 12 columns.
361
+ * Fields of the page's own on an entry are kept. Normalising twice changes nothing.
362
+ */
363
+ declare function normaliseLayout(layout: readonly DashboardLayoutItem[] | null | undefined): DashboardLayout;
364
+ /** The layout with a widget moved to a place in the order (from 0; past either end, to that end). */
365
+ declare function moveItem(layout: readonly DashboardLayoutItem[], id: string, toIndex: number): DashboardLayout;
366
+ /** The layout with a widget given a new width, height or both, held to its limits. */
367
+ declare function resizeItem(layout: readonly DashboardLayoutItem[], id: string, size: {
368
+ w?: number;
369
+ h?: number;
370
+ }): DashboardLayout;
371
+ /**
372
+ * The layout with a widget added at a place in the order (from 0), else at the end. An id already in the layout isn't
373
+ * added again: ids are unique, and the widget there keeps its place.
374
+ */
375
+ declare function addItem(layout: readonly DashboardLayoutItem[], item: DashboardLayoutItem, index?: number): DashboardLayout;
376
+ /** The layout without a widget; the rest flow up to fill its place. */
377
+ declare function removeItem(layout: readonly DashboardLayoutItem[], id: string): DashboardLayout;
378
+
379
+ export { ACTIVE_RING, type CategoryKind, type DashboardLayout, type DashboardLayoutItem, type DateInput, type DateRangeWords, ERROR_ACTIVE_RING, ERROR_FOCUS_RING, ERROR_FOCUS_WITHIN_RING, ERROR_HAS_FOCUS_RING, FIELD_FOCUS_RING, FIELD_FOCUS_WITHIN_RING, FIELD_HAS_FOCUS_RING, FOCUS_INSET, FOCUS_RING, FOCUS_WITHIN_RING, GLASS_BACKDROP, GLASS_DROPDOWN, GLASS_OVERLAY, GLASS_SURFACE, GROUP_FOCUS_RING, HAS_FOCUS_RING, type Occurrence, PEER_FOCUS_RING, type Recurrence, type RecurrenceFrequency, type RecurrencePreset, type RecurrenceScope, type RepeatChange, type RepeatingEvent, TIME_ZOOMS, type TimeZoom, type WeekOfMonth, type Weekday, addItem, canonicalTimeZone, categoryKind, cn, countEdited, dateOfDay, dayOf, deleteOccurrence, describeRecurrence, endDayOf, formatDateRange, moveItem, normaliseLayout, nthOf, occurrenceOn, occurrences, parseRRule, readRecurrence, recurrencePresets, removeItem, requestLocale, resizeItem, sameRecurrence, saveOccurrence, timeExtent, timeZoneOffset, toRRule };
package/dist/utils.js CHANGED
@@ -668,9 +668,9 @@ function dayOf(value) {
668
668
  return back.getUTCFullYear() === y && back.getUTCMonth() === mo && back.getUTCDate() === d ? day : NaN;
669
669
  }
670
670
  function dateOfDay(day) {
671
- const whole2 = Math.floor(day);
672
- const u = new Date(whole2 * DAY_MS);
673
- return new Date(u.getUTCFullYear(), u.getUTCMonth(), u.getUTCDate(), 0, 0, 0, Math.round((day - whole2) * DAY_MS));
671
+ const whole3 = Math.floor(day);
672
+ const u = new Date(whole3 * DAY_MS);
673
+ return new Date(u.getUTCFullYear(), u.getUTCMonth(), u.getUTCDate(), 0, 0, 0, Math.round((day - whole3) * DAY_MS));
674
674
  }
675
675
  function isWholeDay(value) {
676
676
  return typeof value === "string" ? DATE_ONLY.test(value.trim()) : Number.isInteger(dayOf(value));
@@ -882,6 +882,57 @@ function categoryKind(labels, locale) {
882
882
  return "scale";
883
883
  }
884
884
 
885
- export { ACTIVE_RING, ERROR_ACTIVE_RING, ERROR_FOCUS_RING, ERROR_FOCUS_WITHIN_RING, ERROR_HAS_FOCUS_RING, FIELD_FOCUS_RING, FIELD_FOCUS_WITHIN_RING, FIELD_HAS_FOCUS_RING, FOCUS_INSET, FOCUS_RING, FOCUS_WITHIN_RING, GLASS_BACKDROP, GLASS_DROPDOWN, GLASS_OVERLAY, GLASS_SURFACE, GROUP_FOCUS_RING, HAS_FOCUS_RING, PEER_FOCUS_RING, TIME_ZOOMS, canonicalTimeZone, categoryKind, cn, countEdited, dateOfDay, dayOf, deleteOccurrence, describeRecurrence, endDayOf, formatDateRange, nthOf, occurrenceOn, occurrences, parseRRule, readRecurrence, recurrencePresets, requestLocale, sameRecurrence, saveOccurrence, timeExtent, timeZoneOffset, toRRule };
885
+ // ../../showcase/src/lib/dashboard-layout.ts
886
+ var DASHBOARD_COLUMNS = 12;
887
+ var MIN_W = 3;
888
+ var DEFAULT_MIN_H = 2;
889
+ var DASHBOARD_MAX_ROWS = 100;
890
+ var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
891
+ var whole2 = (value, fallback) => typeof value === "number" && Number.isFinite(value) ? Math.round(value) : fallback;
892
+ function sizeLimits(item) {
893
+ const minW = clamp(whole2(item.minW, MIN_W), MIN_W, DASHBOARD_COLUMNS);
894
+ const maxW = clamp(whole2(item.maxW, DASHBOARD_COLUMNS), minW, DASHBOARD_COLUMNS);
895
+ const minH = clamp(whole2(item.minH, DEFAULT_MIN_H), 1, DASHBOARD_MAX_ROWS);
896
+ const maxH = clamp(whole2(item.maxH, DASHBOARD_MAX_ROWS), minH, DASHBOARD_MAX_ROWS);
897
+ return { minW, maxW, minH, maxH };
898
+ }
899
+ function normaliseItem(item) {
900
+ const limits = sizeLimits(item);
901
+ const next = { ...item, w: clamp(whole2(item.w, limits.minW), limits.minW, limits.maxW), h: clamp(whole2(item.h, limits.minH), limits.minH, limits.maxH) };
902
+ for (const key of ["minW", "maxW", "minH", "maxH"]) if (item[key] !== void 0) next[key] = limits[key];
903
+ return next;
904
+ }
905
+ function normaliseLayout(layout) {
906
+ const seen = /* @__PURE__ */ new Set();
907
+ const out = [];
908
+ for (const item of Array.isArray(layout) ? layout : []) {
909
+ if (!item || typeof item.id !== "string" || item.id === "" || seen.has(item.id)) continue;
910
+ seen.add(item.id);
911
+ out.push(normaliseItem(item));
912
+ }
913
+ return out;
914
+ }
915
+ function moveItem(layout, id, toIndex) {
916
+ const items = normaliseLayout(layout);
917
+ const from = items.findIndex((item2) => item2.id === id);
918
+ if (from < 0) return items;
919
+ const [item] = items.splice(from, 1);
920
+ items.splice(clamp(whole2(toIndex, from), 0, items.length), 0, item);
921
+ return items;
922
+ }
923
+ function resizeItem(layout, id, size) {
924
+ return normaliseLayout(layout).map((item) => item.id === id ? normaliseItem({ ...item, ...size.w !== void 0 ? { w: size.w } : {}, ...size.h !== void 0 ? { h: size.h } : {} }) : item);
925
+ }
926
+ function addItem(layout, item, index) {
927
+ const items = normaliseLayout(layout);
928
+ if (!item || typeof item.id !== "string" || item.id === "" || items.some((it) => it.id === item.id)) return items;
929
+ items.splice(clamp(whole2(index, items.length), 0, items.length), 0, normaliseItem(item));
930
+ return items;
931
+ }
932
+ function removeItem(layout, id) {
933
+ return normaliseLayout(layout).filter((item) => item.id !== id);
934
+ }
935
+
936
+ export { ACTIVE_RING, ERROR_ACTIVE_RING, ERROR_FOCUS_RING, ERROR_FOCUS_WITHIN_RING, ERROR_HAS_FOCUS_RING, FIELD_FOCUS_RING, FIELD_FOCUS_WITHIN_RING, FIELD_HAS_FOCUS_RING, FOCUS_INSET, FOCUS_RING, FOCUS_WITHIN_RING, GLASS_BACKDROP, GLASS_DROPDOWN, GLASS_OVERLAY, GLASS_SURFACE, GROUP_FOCUS_RING, HAS_FOCUS_RING, PEER_FOCUS_RING, TIME_ZOOMS, addItem, canonicalTimeZone, categoryKind, cn, countEdited, dateOfDay, dayOf, deleteOccurrence, describeRecurrence, endDayOf, formatDateRange, moveItem, normaliseLayout, nthOf, occurrenceOn, occurrences, parseRRule, readRecurrence, recurrencePresets, removeItem, requestLocale, resizeItem, sameRecurrence, saveOccurrence, timeExtent, timeZoneOffset, toRRule };
886
937
  //# sourceMappingURL=utils.js.map
887
938
  //# sourceMappingURL=utils.js.map