@umriss-ui/dashboard 0.56.0 → 0.58.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.
package/API.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @umriss-ui/dashboard API
2
2
 
3
- Generated by the props step (`pnpm --filter @umriss-ui/dashboard props`); do not edit. First sentences only; the full text is `docs/llms-full.md`.
3
+ Generated by the props step (`pnpm --filter @umriss-ui/dashboard props`); do not edit. Lists every export, and the props, options and returns of each component and hook, with first sentences only; the full text is `docs/llms-full.md`. What stands under `## Experimental`, or is marked `(experimental)`, may change in a minor release; everything else is the surface a break costs a major for (ADR-0083).
4
4
 
5
5
  ## Components
6
6
 
@@ -14,7 +14,7 @@ Generated by the props step (`pnpm --filter @umriss-ui/dashboard props`); do not
14
14
  ## Types
15
15
 
16
16
  - DashboardOptions — What `useDashboard` takes. [defaultView, initialView, allowEdit, onViewChange, onDraftChange]
17
- - DashboardParts — What `useDashboard` hands back. [Dashboard, WidgetType, view, setView, editing, edit, done, catalogue, cancel, undo, redo, reset]
17
+ - DashboardParts — What `useDashboard` hands back. [Dashboard, WidgetType, view, setView, editing, edit, done, openCatalogue, cancel, undo, redo, reset, catalogue]
18
18
  - DashboardProps — The props of `Dashboard`.
19
19
  - DashboardView — The arrangement of a dashboard: which widgets, in what order, at which sizes, with which options. [widgets]
20
20
  - DashboardWidget — One widget in a view. [id, type, size, options, locked]
@@ -22,7 +22,7 @@ Generated by the props step (`pnpm --filter @umriss-ui/dashboard props`); do not
22
22
  - SizeSpan — The room a size takes on the twelve columns, in columns and rows. [columns, rows]
23
23
  - WidgetContent — What a widget's content is told. [size, options]
24
24
  - WidgetFormProps — What a type's form is given.
25
- - WidgetSize — The closed set of names a widget's size comes from.
25
+ - WidgetSize — The closed set of names a widget's size comes from. = "small" | "medium" | "wide" | "tall" | "large" | "full"
26
26
  - WidgetTypeProps — The props of `WidgetType`.
27
27
 
28
28
  ## Props
@@ -62,8 +62,35 @@ Generated by the props step (`pnpm --filter @umriss-ui/dashboard props`); do not
62
62
  - editing: boolean — Whether the editing mode is on.
63
63
  - edit: () => void — Enters the editing mode.
64
64
  - done: () => void — Leaves the mode, keeps the changes and reports them once if there are any.
65
- - catalogue: () => void — Opens the catalogue.
65
+ - openCatalogue: () => void — Opens the catalogue.
66
66
  - cancel: () => void — Leaves the mode and puts the arrangement back as it was before `edit`.
67
67
  - undo: () => void — Goes one step back in the draft.
68
68
  - redo: () => void — Goes one step forward again.
69
69
  - reset: () => void — Steps to the `defaultView`; `undo` brings the arrangement back.
70
+ - catalogue: () => void — The old name of `openCatalogue`. (deprecated)
71
+
72
+ #### props of Dashboard (DashboardProps)
73
+
74
+ - children?: ReactNode — The `WidgetType`s of this dashboard.
75
+ - catalogue?: ReadonlyArray<string> — The `name`s of the widget types the catalogue lists. (default: every declared type)
76
+ - headingLevel?: 2 | 3 | 4 | 5 | 6 — The level of the heading the heading widgets stand in - the one that fits the page's outline. (default: 2)
77
+ - ref?: Ref<HTMLDivElement> | undefined — Receives the component's root element.
78
+
79
+ #### props of WidgetType (WidgetTypeProps)
80
+
81
+ - name: string — The name a view refers to this type by.
82
+ - label: string — The type's name for a reader, and the title of its frame unless `title` says otherwise.
83
+ - sentence: string — One sentence on what the type shows.
84
+ - sizes: Partial<Record<WidgetSize, SizeSpan>> — The sizes the type offers, each with the columns (of twelve) and rows it takes.
85
+ - start: WidgetSize — The size a new widget of this type starts at.
86
+ - defaultOptions?: Options — The options a new widget starts with, and the ones a stored widget's missing keys are read from: stored plain options are spread over them, one level deep.
87
+ - title?: (options: NoInfer<Options>) => string — The title of a frame as a function of its options; the `label` without it.
88
+ - form?: (props: WidgetFormProps<NoInfer<Options>>) => ReactNode — The form for the options, opened from the widget's menu.
89
+ - children: (content: WidgetContent<NoInfer<Options>>) => ReactNode — The content, as a function of the size and the options.
90
+
91
+ ## Other props
92
+
93
+ #### props (WidgetFormProps)
94
+
95
+ - options: Options — The widget's current options.
96
+ - change: (options: Options) => void — Replaces the options; one step of the draft.
package/CHANGELOG.md CHANGED
@@ -13,6 +13,35 @@ one section before an upgrade reads that one.
13
13
 
14
14
  The dashboard joins the other five packages' one number at its first version: they are released together, and a package without a change of its own still gets a heading for it.
15
15
 
16
+ ## 0.58.0 – The candidate for 1.0: `openCatalogue()`, the stored view is promised (Nov. 2026)
17
+
18
+ This is the last minor before `1.0.0`, and the surface is frozen with it. Every old name below works for this minor, warns once in development, and is removed in `1.0.0`; nothing else will differ between the two.
19
+
20
+ ### Added
21
+
22
+ - **`DashboardView` is the supported storage format - an addition is a minor release**, renaming or removing `widgets`, `type` or `size` a major one.
23
+
24
+ ### Changed
25
+
26
+ - **`catalogue()` in `useDashboard`'s return is `openCatalogue()`.**
27
+ - Migration: Call `openCatalogue()`; `catalogue()` works for this minor with a warning and is removed in 1.0.0. The prop `catalogue` of `Dashboard` stays.
28
+
29
+ ## 0.57.0 – `API.md` lists the props of `Dashboard`; an example of the editing actions (Nov. 2026)
30
+
31
+ ### Added
32
+
33
+ - **`API.md` lists the whole surface:** the props of `Dashboard` and `WidgetType` under `useDashboard`. What is marked `@experimental` will stand under a heading of its own, and a deprecated member last in its table.
34
+ - **An example** of the editing actions (`edit`, `undo`, `redo`, `done`) in an application's own header.
35
+
36
+ ### Changed
37
+
38
+ - **The package names Node 22 in `engines` and peers `react` and `react-dom` as `^19`** (was `>=19`), so that a later React is not promised before it has run (ADR-0083).
39
+ - Migration: nothing on Node 22 and React 19.
40
+
41
+ ### Fixed
42
+
43
+ - **The browser floors are the ones the source needs: Chrome 125, Firefox 121, Safari 17.5.** The documents named Chrome 123 and Firefox 120, though `round()` and `:has()` were in use; nothing changes in a browser. A test now derives the three numbers from the source. A build that pins `cssTarget` or `browserslist` to `chrome123` or `firefox120` raises them to `chrome125` and `firefox121`.
44
+
16
45
  ## 0.56.0 – Released in step with the table (Nov. 2026)
17
46
 
18
47
  No change of its own; the number moves with the table, whose columns now take `align` and stand at the start, centred or at the end.
package/README.md CHANGED
@@ -108,6 +108,9 @@ const { Dashboard, WidgetType } = useDashboard({
108
108
  dashboard's boundary never sees the error, and it can reset the application's
109
109
  data layer. Without one, a widget gets another try by itself when its size or
110
110
  its options change.
111
+ - **`DashboardView` is the storage format.** What an application stores of it keeps
112
+ reading after an upgrade: an addition to it is a minor release, and renaming or
113
+ removing `widgets`, `type` or `size` is a major one.
111
114
  - **The application's, not the library's:** where an arrangement is stored,
112
115
  which default a role gets, several dashboards, sharing, and what stands in a
113
116
  widget.
@@ -126,7 +129,7 @@ source and the props table generated from `src/`, each prop linked to the
126
129
  examples that show it; the scenario walks through a dispatcher's start screen
127
130
  at other widths, while it is rearranged, when something goes wrong and what the
128
131
  application governs. An API index lists every export, one search finds across
129
- all six packages, and the header switches the examples to German. What is not
132
+ all seven packages, and the header switches the examples to German. What is not
130
133
  built yet and what never will be stands in ADR-0064. The vocabulary - dashboard,
131
134
  widget, widget type, widget size, options, catalogue - stands in `CONTEXT.md`
132
135
  under "Dashboards". Every export is listed in [API.md](https://github.com/romanhaendler/umriss-ui/blob/main/packages/dashboard/API.md).
package/dist/dashboard.js CHANGED
@@ -1,40 +1,40 @@
1
1
  "use client";
2
2
  import "./dashboard.css";
3
- import { Component as Te, useState as Q, useRef as R, useLayoutEffect as ye, useMemo as fe, Children as Ie, isValidElement as _e, useEffect as Z, useId as Ae, Suspense as $e, useSyncExternalStore as ze, createElement as Pe } from "react";
4
- import { useWording as pe, FormField as Fe, Input as Be, Button as F, Text as ne, GripGlyph as xe, Heading as je, Card as Ue, Skeleton as Ve, Drawer as We, ModalHeader as Ge, ModalBody as Ye, Popover as Ke, announce as P, Menu as Xe, MenuItem as B, MenuSeparator as oe } from "@umriss-ui/core";
5
- import { jsx as o, jsxs as D, Fragment as ae } from "react/jsx-runtime";
6
- const He = (n, t) => n.widgets.some((r) => r.id === t && r.locked !== !0), Je = (n, t) => (r) => {
7
- const i = r.widgets.findIndex((a) => a.id === n), M = Math.max(0, Math.min(r.widgets.length - 1, t));
8
- if (i < 0 || i === M) return r;
3
+ import { Component as Te, useState as Q, useRef as E, useLayoutEffect as ye, useMemo as fe, Children as Ie, isValidElement as _e, useEffect as Z, useId as Ae, Suspense as $e, useSyncExternalStore as ze, createElement as Pe } from "react";
4
+ import { useWording as pe, FormField as Fe, Input as je, Button as F, Text as ne, GripGlyph as xe, Heading as Be, Card as Ue, Skeleton as Ve, Drawer as We, ModalHeader as Ge, ModalBody as Ye, Popover as Ke, announce as P, Menu as Xe, MenuItem as j, MenuSeparator as oe, warnOnce as Je } from "@umriss-ui/core";
5
+ import { jsx as o, jsxs as R, Fragment as ae } from "react/jsx-runtime";
6
+ const He = (n, t) => n.widgets.some((r) => r.id === t && r.locked !== !0), qe = (n, t) => (r) => {
7
+ const d = r.widgets.findIndex((a) => a.id === n), M = Math.max(0, Math.min(r.widgets.length - 1, t));
8
+ if (d < 0 || d === M) return r;
9
9
  const b = [...r.widgets];
10
- return b.splice(M, 0, ...b.splice(i, 1)), { ...r, widgets: b };
11
- }, qe = (n, t) => (r) => r.widgets.some((i) => i.id === n && i.locked !== !0 && i.size !== t) ? { ...r, widgets: r.widgets.map((i) => i.id === n ? { ...i, size: t } : i) } : r, Qe = (n) => (t) => He(t, n) ? { ...t, widgets: t.widgets.filter((r) => r.id !== n) } : t, Ze = (n, t) => {
10
+ return b.splice(M, 0, ...b.splice(d, 1)), { ...r, widgets: b };
11
+ }, Qe = (n, t) => (r) => r.widgets.some((d) => d.id === n && d.locked !== !0 && d.size !== t) ? { ...r, widgets: r.widgets.map((d) => d.id === n ? { ...d, size: t } : d) } : r, Ze = (n) => (t) => He(t, n) ? { ...t, widgets: t.widgets.filter((r) => r.id !== n) } : t, et = (n, t) => {
12
12
  let r = 1;
13
- for (; n.widgets.some((i) => i.id === `${t}-${r}`); ) r++;
13
+ for (; n.widgets.some((d) => d.id === `${t}-${r}`); ) r++;
14
14
  return `${t}-${r}`;
15
- }, et = (n) => (t) => ({ ...t, widgets: [...t.widgets, n] }), tt = (n, t) => (r) => He(r, n) ? { ...r, widgets: r.widgets.map((i) => i.id === n ? { ...i, options: t } : i) } : r, nt = "_root_1pgwl_17", st = "_bar_1pgwl_36", rt = "_mode_1pgwl_46", ot = "_head_1pgwl_61", at = "_editingHead_1pgwl_80", it = "_grip_1pgwl_88", dt = "_title_1pgwl_93", ct = "_size_1pgwl_120", lt = "_item_1pgwl_128", ut = "_placeholder_1pgwl_138", ht = "_grid_1pgwl_144", ft = "_headingRow_1pgwl_161", pt = "_headingHead_1pgwl_76", gt = "_heading_1pgwl_76", mt = "_body_1pgwl_191", bt = "_options_1pgwl_219", wt = "_catalogue_1pgwl_224", yt = "_entry_1pgwl_232", _t = "_footprint_1pgwl_239", zt = "_entryText_1pgwl_251", x = {
16
- root: nt,
17
- bar: st,
18
- mode: rt,
19
- head: ot,
20
- editingHead: at,
21
- grip: it,
22
- title: dt,
23
- size: ct,
24
- item: lt,
25
- placeholder: ut,
26
- grid: ht,
27
- headingRow: ft,
28
- headingHead: pt,
29
- heading: gt,
30
- body: mt,
31
- options: bt,
32
- catalogue: wt,
33
- entry: yt,
34
- footprint: _t,
35
- entryText: zt
15
+ }, tt = (n) => (t) => ({ ...t, widgets: [...t.widgets, n] }), nt = (n, t) => (r) => He(r, n) ? { ...r, widgets: r.widgets.map((d) => d.id === n ? { ...d, options: t } : d) } : r, st = "_root_1pgwl_17", rt = "_bar_1pgwl_36", ot = "_mode_1pgwl_46", at = "_head_1pgwl_61", it = "_editingHead_1pgwl_80", dt = "_grip_1pgwl_88", ct = "_title_1pgwl_93", lt = "_size_1pgwl_120", ut = "_item_1pgwl_128", ht = "_placeholder_1pgwl_138", ft = "_grid_1pgwl_144", pt = "_headingRow_1pgwl_161", gt = "_headingHead_1pgwl_76", mt = "_heading_1pgwl_76", bt = "_body_1pgwl_191", wt = "_options_1pgwl_219", yt = "_catalogue_1pgwl_224", _t = "_entry_1pgwl_232", zt = "_footprint_1pgwl_239", xt = "_entryText_1pgwl_251", x = {
16
+ root: st,
17
+ bar: rt,
18
+ mode: ot,
19
+ head: at,
20
+ editingHead: it,
21
+ grip: dt,
22
+ title: ct,
23
+ size: lt,
24
+ item: ut,
25
+ placeholder: ht,
26
+ grid: ft,
27
+ headingRow: pt,
28
+ headingHead: gt,
29
+ heading: mt,
30
+ body: bt,
31
+ options: wt,
32
+ catalogue: yt,
33
+ entry: _t,
34
+ footprint: zt,
35
+ entryText: xt
36
36
  };
37
- class xt extends Te {
37
+ class Mt extends Te {
38
38
  state = { failed: !1 };
39
39
  static getDerivedStateFromError() {
40
40
  return { failed: !0 };
@@ -46,64 +46,64 @@ class xt extends Te {
46
46
  return this.state.failed ? this.props.fallback : this.props.children;
47
47
  }
48
48
  }
49
- const ge = (n) => typeof n == "object" && n !== null && !Array.isArray(n), Me = (n) => ge(n) && Array.isArray(n.widgets), me = (n) => n.widgets.filter((t) => ge(t) && typeof t.id == "string" && typeof t.type == "string"), Mt = (n) => ({ ...n, widgets: me(n) }), kt = (n, t) => {
50
- const r = new Set(t.widgets.map((i) => i.id));
51
- return me(n).filter((i) => !r.has(i.id));
52
- }, ke = (n) => ge(n) && [Object.prototype, null].includes(Object.getPrototypeOf(n)), St = (n, t) => ke(t) ? ke(n) ? { ...t, ...n } : t : n === void 0 ? t : n;
49
+ const ge = (n) => typeof n == "object" && n !== null && !Array.isArray(n), Me = (n) => ge(n) && Array.isArray(n.widgets), me = (n) => n.widgets.filter((t) => ge(t) && typeof t.id == "string" && typeof t.type == "string"), Ct = (n) => ({ ...n, widgets: me(n) }), kt = (n, t) => {
50
+ const r = new Set(t.widgets.map((d) => d.id));
51
+ return me(n).filter((d) => !r.has(d.id));
52
+ }, Ce = (n) => ge(n) && [Object.prototype, null].includes(Object.getPrototypeOf(n)), St = (n, t) => Ce(t) ? Ce(n) ? { ...t, ...n } : t : n === void 0 ? t : n;
53
53
  function ve(n, t) {
54
54
  const r = /* @__PURE__ */ new Set();
55
55
  return {
56
56
  ...n,
57
- widgets: me(n).flatMap((i) => {
58
- const M = t.get(i.type);
59
- return !M || r.has(i.id) ? [] : (r.add(i.id), [{ ...i, size: Object.hasOwn(M.sizes, i.size) ? i.size : M.start, options: St(i.options, M.defaultOptions) }]);
57
+ widgets: me(n).flatMap((d) => {
58
+ const M = t.get(d.type);
59
+ return !M || r.has(d.id) ? [] : (r.add(d.id), [{ ...d, size: Object.hasOwn(M.sizes, d.size) ? d.size : M.start, options: St(d.options, M.defaultOptions) }]);
60
60
  })
61
61
  };
62
62
  }
63
63
  function de(n, t) {
64
- const r = /* @__PURE__ */ new Set(), i = (b, a, s, d) => {
65
- for (let c = b; c < b + d; c++) for (let w = a; w < a + s; w++) if (r.has(c * t + w)) return !1;
64
+ const r = /* @__PURE__ */ new Set(), d = (b, a, s, c) => {
65
+ for (let i = b; i < b + c; i++) for (let w = a; w < a + s; w++) if (r.has(i * t + w)) return !1;
66
66
  return !0;
67
67
  };
68
68
  let M = 0;
69
69
  return n.map((b) => {
70
70
  const a = Math.min(b.columns, t);
71
71
  for (let s = M; ; s++) {
72
- const d = Math.floor(s / t), c = s % t;
73
- if (!(c + a > t || !i(d, c, a, b.rows))) {
74
- for (let w = d; w < d + b.rows; w++) for (let h = c; h < c + a; h++) r.add(w * t + h);
75
- return M = s, { column: c, row: d, columns: a, rows: b.rows };
72
+ const c = Math.floor(s / t), i = s % t;
73
+ if (!(i + a > t || !d(c, i, a, b.rows))) {
74
+ for (let w = c; w < c + b.rows; w++) for (let h = i; h < i + a; h++) r.add(w * t + h);
75
+ return M = s, { column: i, row: c, columns: a, rows: b.rows };
76
76
  }
77
77
  }
78
78
  });
79
79
  }
80
- function Ct(n, t, r, i, M, { cell: b, unit: a, gap: s }) {
81
- let d = r, c = 1 / 0;
80
+ function Ot(n, t, r, d, M, { cell: b, unit: a, gap: s }) {
81
+ let c = r, i = 1 / 0;
82
82
  for (let w = 0; w < n.length; w++) {
83
83
  const h = [...n];
84
84
  h.splice(w, 0, ...h.splice(r, 1));
85
- const _ = de(h, t)[w], j = (_.column * (b + s) - i) ** 2 + (_.row * (a + s) - M) ** 2;
86
- j < c && (c = j, d = w);
85
+ const _ = de(h, t)[w], B = (_.column * (b + s) - d) ** 2 + (_.row * (a + s) - M) ** 2;
86
+ B < i && (i = B, c = w);
87
87
  }
88
- return d;
88
+ return c;
89
89
  }
90
- function Ot(n, t, r, i) {
90
+ function Ht(n, t, r, d) {
91
91
  const M = de(n, t)[r];
92
92
  let b = r, a = 1 / 0, s = 1 / 0;
93
- for (let d = 0; d < n.length; d++) {
94
- if (d === r) continue;
95
- const c = [...n];
96
- c.splice(d, 0, ...c.splice(r, 1));
97
- const w = de(c, t)[d], h = (w.row - M.row) * i;
93
+ for (let c = 0; c < n.length; c++) {
94
+ if (c === r) continue;
95
+ const i = [...n];
96
+ i.splice(c, 0, ...i.splice(r, 1));
97
+ const w = de(i, t)[c], h = (w.row - M.row) * d;
98
98
  if (h <= 0) continue;
99
99
  const _ = Math.abs(w.column - M.column);
100
- (h < a || h === a && _ < s) && (b = d, a = h, s = _);
100
+ (h < a || h === a && _ < s) && (b = c, a = h, s = _);
101
101
  }
102
102
  return b;
103
103
  }
104
- const Ht = { 3: "¼", 4: "⅓", 6: "½", 8: "⅔", 9: "¾" }, vt = ({ columns: n }) => n >= 12 ? "" : Ht[n] ?? `${n}/12`;
105
- function Nt({ grid: n, cards: t, shown: r, drop: i, cancelled: M }) {
106
- const [b, a] = Q(null), s = R(null), d = R({}), c = R(/* @__PURE__ */ new Map()), w = R(null), h = R({ update: () => {
104
+ const vt = { 3: "¼", 4: "⅓", 6: "½", 8: "⅔", 9: "¾" }, Nt = ({ columns: n }) => n >= 12 ? "" : vt[n] ?? `${n}/12`;
105
+ function Dt({ grid: n, cards: t, shown: r, drop: d, cancelled: M }) {
106
+ const [b, a] = Q(null), s = E(null), c = E({}), i = E(/* @__PURE__ */ new Map()), w = E(null), h = E({ update: () => {
107
107
  }, finish: () => {
108
108
  } }), _ = () => {
109
109
  const l = s.current, u = l && t.get(l.id);
@@ -113,31 +113,31 @@ function Nt({ grid: n, cards: t, shown: r, drop: i, cancelled: M }) {
113
113
  };
114
114
  ye(() => {
115
115
  const l = /* @__PURE__ */ new Map(), u = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
116
- for (const [g, k] of t) {
117
- const p = c.current.get(g);
118
- l.set(g, [k.offsetLeft, k.offsetTop]), b && !u && p && g !== b.id && (p[0] !== k.offsetLeft || p[1] !== k.offsetTop) && k.animate([{ transform: `translate(${p[0] - k.offsetLeft}px, ${p[1] - k.offsetTop}px)` }, { transform: "none" }], { duration: 150, easing: "ease-out" });
116
+ for (const [g, C] of t) {
117
+ const p = i.current.get(g);
118
+ l.set(g, [C.offsetLeft, C.offsetTop]), b && !u && p && g !== b.id && (p[0] !== C.offsetLeft || p[1] !== C.offsetTop) && C.animate([{ transform: `translate(${p[0] - C.offsetLeft}px, ${p[1] - C.offsetTop}px)` }, { transform: "none" }], { duration: 150, easing: "ease-out" });
119
119
  }
120
- c.current = l, b && _();
120
+ i.current = l, b && _();
121
121
  });
122
- const j = () => {
122
+ const B = () => {
123
123
  const l = s.current, u = n.current, g = l && t.get(l.id);
124
124
  if (!l || !u || !g) return;
125
- const k = getComputedStyle(u), p = parseFloat(k.columnGap), C = k.gridTemplateColumns.split(" ").length, U = u.getBoundingClientRect(), V = r[l.from].span, W = { cell: (U.width - (C - 1) * p) / C, gap: p, unit: (g.offsetHeight - (V.rows - 1) * p) / V.rows }, L = Ct(r.map((T) => T.span), C, l.from, l.x - l.dx - U.left, l.y - l.dy - U.top, W);
125
+ const C = getComputedStyle(u), p = parseFloat(C.columnGap), S = C.gridTemplateColumns.split(" ").length, U = u.getBoundingClientRect(), V = r[l.from].span, W = { cell: (U.width - (S - 1) * p) / S, gap: p, unit: (g.offsetHeight - (V.rows - 1) * p) / V.rows }, L = Ot(r.map((T) => T.span), S, l.from, l.x - l.dx - U.left, l.y - l.dy - U.top, W);
126
126
  if (L === l.target) return _();
127
127
  l.target = L, a({ id: l.id, target: L });
128
128
  }, ee = (l) => {
129
129
  const u = s.current;
130
- if (s.current = null, window.clearInterval(d.current.timer), d.current.escape && document.removeEventListener("keydown", d.current.escape), u && t.get(u.id)?.style.removeProperty("transform"), a(null), !!u?.started) {
130
+ if (s.current = null, window.clearInterval(c.current.timer), c.current.escape && document.removeEventListener("keydown", c.current.escape), u && t.get(u.id)?.style.removeProperty("transform"), a(null), !!u?.started) {
131
131
  if (!l) return M(r[u.from].title);
132
- i(u.id, r[u.target].id);
132
+ d(u.id, r[u.target].id);
133
133
  }
134
134
  };
135
135
  ye(() => {
136
- h.current = { update: j, finish: ee };
136
+ h.current = { update: B, finish: ee };
137
137
  });
138
138
  const K = (l, u) => (g) => {
139
- const k = g.target;
140
- if (g.button > 0 || k.closest("button") || !g.currentTarget.contains(k)) return;
139
+ const C = g.target;
140
+ if (g.button > 0 || C.closest("button") || !g.currentTarget.contains(C)) return;
141
141
  const p = t.get(l).getBoundingClientRect();
142
142
  s.current = { id: l, from: u, x0: g.clientX, y0: g.clientY, x: g.clientX, y: g.clientY, dx: g.clientX - p.left, dy: g.clientY - p.top, started: !1, target: u }, g.currentTarget.setPointerCapture(g.pointerId);
143
143
  }, A = (l) => {
@@ -145,9 +145,9 @@ function Nt({ grid: n, cards: t, shown: r, drop: i, cancelled: M }) {
145
145
  if (u) {
146
146
  if (u.x = l.clientX, u.y = l.clientY, !u.started) {
147
147
  if (Math.hypot(u.x - u.x0, u.y - u.y0) <= 4) return;
148
- u.started = !0, a({ id: u.id, target: u.from }), d.current.escape = (g) => g.key === "Escape" && h.current.finish(!1), document.addEventListener("keydown", d.current.escape), d.current.timer = window.setInterval(() => {
149
- const k = s.current?.y ?? window.innerHeight / 2, p = Math.ceil((64 - Math.min(k, window.innerHeight - k)) / 4);
150
- p <= 0 || (window.scrollBy(0, k < window.innerHeight / 2 ? -p : p), h.current.update());
148
+ u.started = !0, a({ id: u.id, target: u.from }), c.current.escape = (g) => g.key === "Escape" && h.current.finish(!1), document.addEventListener("keydown", c.current.escape), c.current.timer = window.setInterval(() => {
149
+ const C = s.current?.y ?? window.innerHeight / 2, p = Math.ceil((64 - Math.min(C, window.innerHeight - C)) / 4);
150
+ p <= 0 || (window.scrollBy(0, C < window.innerHeight / 2 ? -p : p), h.current.update());
151
151
  }, 16);
152
152
  }
153
153
  h.current.update();
@@ -173,11 +173,11 @@ function Et() {
173
173
  return null;
174
174
  }
175
175
  const Rt = "heading", q = (n, t) => n.title?.(t) ?? n.label;
176
- function Dt({ options: n, change: t }) {
176
+ function Lt({ options: n, change: t }) {
177
177
  const r = pe();
178
- return /* @__PURE__ */ o(Fe, { label: r.dashboardHeadingField, children: /* @__PURE__ */ o(Be, { value: n.text, onChange: (i) => t({ text: i.target.value }) }) });
178
+ return /* @__PURE__ */ o(Fe, { label: r.dashboardHeadingField, children: /* @__PURE__ */ o(je, { value: n.text, onChange: (d) => t({ text: d.target.value }) }) });
179
179
  }
180
- function Lt(n) {
180
+ function Tt(n) {
181
181
  return {
182
182
  name: Rt,
183
183
  label: n.dashboardHeadingLabel,
@@ -186,48 +186,48 @@ function Lt(n) {
186
186
  start: "full",
187
187
  defaultOptions: { text: n.dashboardHeadingText },
188
188
  title: (t) => t.text || n.dashboardHeadingLabel,
189
- form: Dt,
189
+ form: Lt,
190
190
  children: () => null
191
191
  };
192
192
  }
193
193
  const se = (...n) => n.filter(Boolean).join(" "), he = 12;
194
- function Tt({ render: n, ...t }) {
194
+ function It({ render: n, ...t }) {
195
195
  return n(t);
196
196
  }
197
- const Se = (n, t) => ({ "--_dashboard-column": n.column + 1, "--_dashboard-row": n.row + 1, "--_dashboard-columns": n.columns, "--_dashboard-rows": n.rows, "--_dashboard-order": t }), Ce = (n) => n.columns * n.rows;
198
- function It({ title: n, editing: t, children: r }) {
199
- const i = R(null), [M, b] = Q(!1);
197
+ const ke = (n, t) => ({ "--_dashboard-column": n.column + 1, "--_dashboard-row": n.row + 1, "--_dashboard-columns": n.columns, "--_dashboard-rows": n.rows, "--_dashboard-order": t }), Se = (n) => n.columns * n.rows;
198
+ function At({ title: n, editing: t, children: r }) {
199
+ const d = E(null), [M, b] = Q(!1);
200
200
  Z(() => {
201
- const s = i.current;
201
+ const s = d.current;
202
202
  if (!s) return;
203
- const d = () => b(s.scrollHeight > s.clientHeight || s.scrollWidth > s.clientWidth), c = new ResizeObserver(d), w = () => {
204
- c.disconnect(), c.observe(s);
205
- for (const _ of s.children) c.observe(_);
206
- d();
203
+ const c = () => b(s.scrollHeight > s.clientHeight || s.scrollWidth > s.clientWidth), i = new ResizeObserver(c), w = () => {
204
+ i.disconnect(), i.observe(s);
205
+ for (const _ of s.children) i.observe(_);
206
+ c();
207
207
  }, h = new MutationObserver(w);
208
208
  return h.observe(s, { childList: !0 }), w(), () => {
209
- c.disconnect(), h.disconnect();
209
+ i.disconnect(), h.disconnect();
210
210
  };
211
211
  }, []);
212
212
  const a = M && !t;
213
- return /* @__PURE__ */ o("div", { ref: i, className: x.body, "data-widget-body": "", inert: t, ...a ? { role: "group", tabIndex: 0, "aria-label": n } : {}, children: r });
213
+ return /* @__PURE__ */ o("div", { ref: d, className: x.body, "data-widget-body": "", inert: t, ...a ? { role: "group", tabIndex: 0, "aria-label": n } : {}, children: r });
214
214
  }
215
215
  const ie = (n, t) => (r) => {
216
216
  r ? n.set(t, r) : n.delete(t);
217
217
  };
218
- function At({ view: n, editor: t, className: r, children: i, catalogue: M, headingLevel: b = 2, ...a }) {
219
- const s = pe(), d = fe(() => Lt(s), [s]), c = /* @__PURE__ */ new Map();
220
- for (const e of Ie.toArray(i))
221
- _e(e) && e.type === Ne ? c.set(e.props.name, e.props) : _e(e) && e.type === Et && c.set(d.name, d);
218
+ function $t({ view: n, editor: t, className: r, children: d, catalogue: M, headingLevel: b = 2, ...a }) {
219
+ const s = pe(), c = fe(() => Tt(s), [s]), i = /* @__PURE__ */ new Map();
220
+ for (const e of Ie.toArray(d))
221
+ _e(e) && e.type === Ne ? i.set(e.props.name, e.props) : _e(e) && e.type === Et && i.set(c.name, c);
222
222
  const { register: w } = t;
223
- Z(() => w(c));
224
- const h = ve(n, c), _ = h.widgets.flatMap((e) => {
225
- const f = c.get(e.type), y = f?.sizes[e.size];
223
+ Z(() => w(i));
224
+ const h = ve(n, i), _ = h.widgets.flatMap((e) => {
225
+ const f = i.get(e.type), y = f?.sizes[e.size];
226
226
  return f && y ? [{ widget: e, type: f, span: y }] : [];
227
- }), ee = `h${Math.min(6, b + (_.some(({ type: e }) => e === d) ? 1 : 0))}`, K = R(null), [A] = Q(() => /* @__PURE__ */ new Map()), [l] = Q(() => /* @__PURE__ */ new Map()), [u] = Q(() => /* @__PURE__ */ new Map()), g = R(null), k = R(null), { editing: p } = t, C = h.widgets.length, U = _.map(({ widget: e, type: f }) => q(f, e.options)), V = Ae(), W = (e, f) => U.filter((y) => y === e).length > 1 ? s.dashboardHead(e, f + 1, C) : e, L = (e, f, y) => {
228
- const N = h.widgets.findIndex((H) => H.id === e), O = Math.max(0, Math.min(C - 1, y));
229
- N !== O && (t.step(Je(e, O)), P(s.dashboardMoved(f, N + 1, O + 1, C)));
230
- }, { drag: T, placeholder: z, handlers: m } = Nt({
227
+ }), ee = `h${Math.min(6, b + (_.some(({ type: e }) => e === c) ? 1 : 0))}`, K = E(null), [A] = Q(() => /* @__PURE__ */ new Map()), [l] = Q(() => /* @__PURE__ */ new Map()), [u] = Q(() => /* @__PURE__ */ new Map()), g = E(null), C = E(null), { editing: p } = t, S = h.widgets.length, U = _.map(({ widget: e, type: f }) => q(f, e.options)), V = Ae(), W = (e, f) => U.filter((y) => y === e).length > 1 ? s.dashboardHead(e, f + 1, S) : e, L = (e, f, y) => {
228
+ const N = h.widgets.findIndex((H) => H.id === e), O = Math.max(0, Math.min(S - 1, y));
229
+ N !== O && (t.step(qe(e, O)), P(s.dashboardMoved(f, N + 1, O + 1, S)));
230
+ }, { drag: T, placeholder: z, handlers: m } = Dt({
231
231
  grid: K,
232
232
  cards: A,
233
233
  shown: _.map(({ widget: e, type: f, span: y }) => ({ id: e.id, span: y, title: q(f, e.options) })),
@@ -236,76 +236,76 @@ function At({ view: n, editor: t, className: r, children: i, catalogue: M, headi
236
236
  L(e, q(y.type, y.widget.options), h.widgets.findIndex((N) => N.id === f));
237
237
  },
238
238
  cancelled: (e) => P(s.dashboardDragCancelled(e))
239
- }), S = T ? _.findIndex((e) => e.widget.id === T.id) : -1, v = _.map((e, f) => f);
240
- S >= 0 && v.splice(T.target, 0, ...v.splice(S, 1));
241
- const G = de(v.map((e) => _[e].span), he), X = _.map((e, f) => G[v.indexOf(f)]), [I, be] = Q(null), we = R(null), re = R(null);
239
+ }), k = T ? _.findIndex((e) => e.widget.id === T.id) : -1, v = _.map((e, f) => f);
240
+ k >= 0 && v.splice(T.target, 0, ...v.splice(k, 1));
241
+ const G = de(v.map((e) => _[e].span), he), X = _.map((e, f) => G[v.indexOf(f)]), [I, be] = Q(null), we = E(null), re = E(null);
242
242
  Z(() => {
243
243
  re.current && (A.get(re.current)?.scrollIntoView?.({ block: "nearest" }), re.current = null);
244
244
  });
245
- const te = R(!1);
245
+ const te = E(!1);
246
246
  Z(() => {
247
247
  te.current !== !1 && ((te.current === null ? g.current : l.get(te.current))?.focus(), te.current = !1);
248
248
  });
249
- const J = R(null);
249
+ const J = E(null);
250
250
  Z(() => {
251
251
  const e = J.current;
252
- J.current = null, (e === "add" ? g.current : e === "edit" ? k.current : null)?.focus();
252
+ J.current = null, (e === "add" ? g.current : e === "edit" ? C.current : null)?.focus();
253
253
  });
254
- const Ee = [...c.values()].filter((e) => !M || M.includes(e.name)), Re = (e) => {
255
- const f = { id: Ze(h, e.name), type: e.name, size: e.start, options: e.defaultOptions };
256
- re.current = f.id, t.step(et(f)), P(s.dashboardAdded(q(e, f.options), C + 1, C + 1));
257
- }, ce = I ? c.get(h.widgets.find((e) => e.id === I)?.type ?? "") : void 0, le = h.widgets.find((e) => e.id === I), De = (e, f, y, N, O) => p ? {
254
+ const De = [...i.values()].filter((e) => !M || M.includes(e.name)), Ee = (e) => {
255
+ const f = { id: et(h, e.name), type: e.name, size: e.start, options: e.defaultOptions };
256
+ re.current = f.id, t.step(tt(f)), P(s.dashboardAdded(q(e, f.options), S + 1, S + 1));
257
+ }, ce = I ? i.get(h.widgets.find((e) => e.id === I)?.type ?? "") : void 0, le = h.widgets.find((e) => e.id === I), Re = (e, f, y, N, O) => p ? {
258
258
  ref: ie(l, e.id),
259
259
  className: se(x.head, x.editingHead),
260
260
  ...m(e.id, y),
261
261
  role: "group",
262
262
  tabIndex: 0,
263
- "aria-label": (O ? s.dashboardHeadLocked : s.dashboardHead)(f, N + 1, C),
263
+ "aria-label": (O ? s.dashboardHeadLocked : s.dashboardHead)(f, N + 1, S),
264
264
  "aria-describedby": V,
265
265
  onKeyDown: (H) => {
266
266
  if (H.target !== H.currentTarget) return;
267
- const $ = { ArrowUp: -1, ArrowDown: 1 }[H.key], E = $ ? h.widgets.findIndex((Y) => Y.id === _[Ot(_.map((ue) => ue.span), he, y, $)]?.widget.id) : { ArrowLeft: N - 1, ArrowRight: N + 1, Home: 0, End: C - 1 }[H.key];
268
- E !== void 0 && (H.preventDefault(), L(e.id, f, E));
267
+ const $ = { ArrowUp: -1, ArrowDown: 1 }[H.key], D = $ ? h.widgets.findIndex((Y) => Y.id === _[Ht(_.map((ue) => ue.span), he, y, $)]?.widget.id) : { ArrowLeft: N - 1, ArrowRight: N + 1, Home: 0, End: S - 1 }[H.key];
268
+ D !== void 0 && (H.preventDefault(), L(e.id, f, D));
269
269
  }
270
270
  } : { className: x.head }, Le = (e, f, y, N, O, H) => {
271
- const $ = Object.entries(f.sizes).sort(([, E], [, Y]) => Ce(E) - Ce(Y));
272
- return /* @__PURE__ */ D(
271
+ const $ = Object.entries(f.sizes).sort(([, D], [, Y]) => Se(D) - Se(Y));
272
+ return /* @__PURE__ */ R(
273
273
  Xe,
274
274
  {
275
275
  align: "end",
276
276
  trigger: /* @__PURE__ */ o(F, { ref: ie(u, e.id), size: "sm", variant: "ghost", "aria-label": s.dashboardMenu(W(y, O)), children: /* @__PURE__ */ o("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", children: /* @__PURE__ */ o("path", { d: "M1.5 5h.01M5 5h.01M8.5 5h.01" }) }) }),
277
277
  children: [
278
- /* @__PURE__ */ o(B, { disabled: !0, children: s.dashboardPlace(O + 1, C) }),
279
- /* @__PURE__ */ o(B, { disabled: O === 0, onSelect: () => L(e.id, y, 0), children: s.dashboardMoveStart }),
280
- /* @__PURE__ */ o(B, { disabled: O === 0, onSelect: () => L(e.id, y, O - 1), children: s.dashboardMoveEarlier }),
281
- /* @__PURE__ */ o(B, { disabled: O === C - 1, onSelect: () => L(e.id, y, O + 1), children: s.dashboardMoveLater }),
282
- /* @__PURE__ */ o(B, { disabled: O === C - 1, onSelect: () => L(e.id, y, C - 1), children: s.dashboardMoveEnd }),
283
- H && /* @__PURE__ */ D(ae, { children: [
278
+ /* @__PURE__ */ o(j, { disabled: !0, children: s.dashboardPlace(O + 1, S) }),
279
+ /* @__PURE__ */ o(j, { disabled: O === 0, onSelect: () => L(e.id, y, 0), children: s.dashboardMoveStart }),
280
+ /* @__PURE__ */ o(j, { disabled: O === 0, onSelect: () => L(e.id, y, O - 1), children: s.dashboardMoveEarlier }),
281
+ /* @__PURE__ */ o(j, { disabled: O === S - 1, onSelect: () => L(e.id, y, O + 1), children: s.dashboardMoveLater }),
282
+ /* @__PURE__ */ o(j, { disabled: O === S - 1, onSelect: () => L(e.id, y, S - 1), children: s.dashboardMoveEnd }),
283
+ H && /* @__PURE__ */ R(ae, { children: [
284
284
  /* @__PURE__ */ o(oe, {}),
285
- /* @__PURE__ */ o(B, { disabled: !0, children: s.dashboardLockedLine })
285
+ /* @__PURE__ */ o(j, { disabled: !0, children: s.dashboardLockedLine })
286
286
  ] }),
287
- !H && $.length > 1 && /* @__PURE__ */ D(ae, { children: [
287
+ !H && $.length > 1 && /* @__PURE__ */ R(ae, { children: [
288
288
  /* @__PURE__ */ o(oe, {}),
289
- $.map(([E, Y]) => /* @__PURE__ */ D(
290
- B,
289
+ $.map(([D, Y]) => /* @__PURE__ */ R(
290
+ j,
291
291
  {
292
292
  role: "menuitemradio",
293
- "aria-checked": E === e.size,
293
+ "aria-checked": D === e.size,
294
294
  onSelect: () => {
295
- t.step(qe(e.id, E)), P(s.dashboardResized(y, s.dashboardSizes[E]));
295
+ t.step(Qe(e.id, D)), P(s.dashboardResized(y, s.dashboardSizes[D]));
296
296
  },
297
297
  children: [
298
- /* @__PURE__ */ o("span", { "aria-hidden": "true", style: { display: "inline-block", width: "1.25em" }, children: E === e.size ? "✓" : "" }),
299
- s.dashboardSizeEntry(s.dashboardSizes[E], vt(Y))
298
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", style: { display: "inline-block", width: "1.25em" }, children: D === e.size ? "✓" : "" }),
299
+ s.dashboardSizeEntry(s.dashboardSizes[D], Nt(Y))
300
300
  ]
301
301
  },
302
- E
302
+ D
303
303
  ))
304
304
  ] }),
305
- !H && f.form && /* @__PURE__ */ D(ae, { children: [
305
+ !H && f.form && /* @__PURE__ */ R(ae, { children: [
306
306
  /* @__PURE__ */ o(oe, {}),
307
307
  /* @__PURE__ */ o(
308
- B,
308
+ j,
309
309
  {
310
310
  onSelect: () => {
311
311
  we.current = u.get(e.id) ?? null, be(e.id);
@@ -316,11 +316,11 @@ function At({ view: n, editor: t, className: r, children: i, catalogue: M, headi
316
316
  ] }),
317
317
  !H && /* @__PURE__ */ o(oe, {}),
318
318
  !H && /* @__PURE__ */ o(
319
- B,
319
+ j,
320
320
  {
321
321
  tone: "danger",
322
322
  onSelect: () => {
323
- te.current = (_[N + 1] ?? _[N - 1])?.widget.id ?? null, t.step(Qe(e.id)), P(s.dashboardRemoved(y));
323
+ te.current = (_[N + 1] ?? _[N - 1])?.widget.id ?? null, t.step(Ze(e.id)), P(s.dashboardRemoved(y));
324
324
  },
325
325
  children: s.dashboardRemove
326
326
  }
@@ -329,7 +329,7 @@ function At({ view: n, editor: t, className: r, children: i, catalogue: M, headi
329
329
  }
330
330
  );
331
331
  };
332
- return /* @__PURE__ */ D(
332
+ return /* @__PURE__ */ R(
333
333
  "div",
334
334
  {
335
335
  role: "group",
@@ -340,7 +340,7 @@ function At({ view: n, editor: t, className: r, children: i, catalogue: M, headi
340
340
  a.onKeyDown?.(e), !(e.key !== "Escape" || e.defaultPrevented || !p || T || t.catalogue || I || e.target.closest('[role="menu"], [role="dialog"]')) && (J.current = "edit", t.cancel());
341
341
  },
342
342
  children: [
343
- t.allowed && /* @__PURE__ */ o("div", { className: x.bar, children: p ? /* @__PURE__ */ D(ae, { children: [
343
+ t.allowed && /* @__PURE__ */ o("div", { className: x.bar, children: p ? /* @__PURE__ */ R(ae, { children: [
344
344
  /* @__PURE__ */ o("span", { className: x.mode, children: s.dashboardEditing }),
345
345
  /* @__PURE__ */ o(F, { size: "sm", disabled: !t.canUndo, onClick: t.undo, children: s.dashboardUndo }),
346
346
  /* @__PURE__ */ o(F, { size: "sm", disabled: !t.canRedo, onClick: t.redo, children: s.dashboardRedo }),
@@ -354,51 +354,51 @@ function At({ view: n, editor: t, className: r, children: i, catalogue: M, headi
354
354
  /* @__PURE__ */ o(F, { size: "sm", variant: "primary", onClick: () => {
355
355
  J.current = "edit", t.done();
356
356
  }, children: s.dashboardDone })
357
- ] }) : /* @__PURE__ */ o(F, { ref: k, size: "sm", onClick: () => {
357
+ ] }) : /* @__PURE__ */ o(F, { ref: C, size: "sm", onClick: () => {
358
358
  J.current = "add", t.edit();
359
359
  }, children: s.dashboardEdit }) }),
360
360
  p && /* @__PURE__ */ o("span", { id: V, hidden: !0, children: s.dashboardHeadHint }),
361
- p && C === 0 && /* @__PURE__ */ o(ne, { children: s.dashboardEmptyEditing }),
362
- !p && C === 0 && /* @__PURE__ */ o(ne, { children: s.dashboardEmpty }),
363
- /* @__PURE__ */ D("div", { className: x.grid, ref: K, children: [
361
+ p && S === 0 && /* @__PURE__ */ o(ne, { children: s.dashboardEmptyEditing }),
362
+ !p && S === 0 && /* @__PURE__ */ o(ne, { children: s.dashboardEmpty }),
363
+ /* @__PURE__ */ R("div", { className: x.grid, ref: K, children: [
364
364
  _.map(({ widget: e, type: f }, y) => {
365
- const N = Se(X[y], v.indexOf(y)), O = q(f, e.options), H = h.widgets.findIndex((ue) => ue.id === e.id), $ = e.locked === !0, E = De(e, O, y, H, $), Y = p && Le(e, f, O, y, H, $);
366
- return f === d ? /* @__PURE__ */ o("div", { ref: ie(A, e.id), className: se(x.item, x.headingRow), style: N, "data-widget": e.id, "data-editing": p || void 0, "data-dragging": T?.id === e.id || void 0, children: /* @__PURE__ */ D("div", { ...E, className: se(E.className, x.headingHead), children: [
365
+ const N = ke(X[y], v.indexOf(y)), O = q(f, e.options), H = h.widgets.findIndex((ue) => ue.id === e.id), $ = e.locked === !0, D = Re(e, O, y, H, $), Y = p && Le(e, f, O, y, H, $);
366
+ return f === c ? /* @__PURE__ */ o("div", { ref: ie(A, e.id), className: se(x.item, x.headingRow), style: N, "data-widget": e.id, "data-editing": p || void 0, "data-dragging": T?.id === e.id || void 0, children: /* @__PURE__ */ R("div", { ...D, className: se(D.className, x.headingHead), children: [
367
367
  p && /* @__PURE__ */ o(xe, { className: x.grip }),
368
- /* @__PURE__ */ o(je, { level: b, size: "lg", className: x.heading, children: e.options.text }),
368
+ /* @__PURE__ */ o(Be, { level: b, size: "lg", className: x.heading, children: e.options.text }),
369
369
  p && $ && /* @__PURE__ */ o("span", { className: x.size, children: s.dashboardLocked }),
370
370
  Y
371
- ] }) }, e.id) : /* @__PURE__ */ D(Ue, { ref: ie(A, e.id), className: x.item, style: N, "data-widget": e.id, "data-editing": p || void 0, "data-dragging": T?.id === e.id || void 0, "aria-label": W(O, H), children: [
372
- /* @__PURE__ */ D("div", { ...E, children: [
371
+ ] }) }, e.id) : /* @__PURE__ */ R(Ue, { ref: ie(A, e.id), className: x.item, style: N, "data-widget": e.id, "data-editing": p || void 0, "data-dragging": T?.id === e.id || void 0, "aria-label": W(O, H), children: [
372
+ /* @__PURE__ */ R("div", { ...D, children: [
373
373
  p && /* @__PURE__ */ o(xe, { className: x.grip }),
374
374
  /* @__PURE__ */ o(ee, { className: x.title, children: O }),
375
375
  p && /* @__PURE__ */ o("span", { className: x.size, children: s.dashboardSizes[e.size] }),
376
376
  p && $ && /* @__PURE__ */ o("span", { className: x.size, children: s.dashboardLocked }),
377
377
  Y
378
378
  ] }),
379
- /* @__PURE__ */ o(It, { title: W(O, H), editing: p, children: /* @__PURE__ */ o(xt, { size: e.size, options: e.options, fallback: /* @__PURE__ */ o(ne, { tone: "secondary", children: s.dashboardFailed }), children: /* @__PURE__ */ o($e, { fallback: /* @__PURE__ */ o(Ve, { width: "100%", height: "100%" }), children: /* @__PURE__ */ o(Tt, { render: f.children, size: e.size, options: e.options }) }) }) })
379
+ /* @__PURE__ */ o(At, { title: W(O, H), editing: p, children: /* @__PURE__ */ o(Mt, { size: e.size, options: e.options, fallback: /* @__PURE__ */ o(ne, { tone: "secondary", children: s.dashboardFailed }), children: /* @__PURE__ */ o($e, { fallback: /* @__PURE__ */ o(Ve, { width: "100%", height: "100%" }), children: /* @__PURE__ */ o(It, { render: f.children, size: e.size, options: e.options }) }) }) })
380
380
  ] }, e.id);
381
381
  }),
382
- S >= 0 && /* @__PURE__ */ o("div", { ref: z, "aria-hidden": "true", "data-placeholder": !0, className: se(x.item, x.placeholder), style: Se(X[S], T.target) })
382
+ k >= 0 && /* @__PURE__ */ o("div", { ref: z, "aria-hidden": "true", "data-placeholder": !0, className: se(x.item, x.placeholder), style: ke(X[k], T.target) })
383
383
  ] }),
384
- /* @__PURE__ */ D(We, { open: t.catalogue, onClose: () => t.setCatalogue(!1), children: [
384
+ /* @__PURE__ */ R(We, { open: t.catalogue, onClose: () => t.setCatalogue(!1), children: [
385
385
  /* @__PURE__ */ o(Ge, { title: s.dashboardCatalogue, description: s.dashboardCatalogueSentence }),
386
- /* @__PURE__ */ o(Ye, { children: /* @__PURE__ */ o("ul", { className: x.catalogue, children: Ee.map((e) => {
386
+ /* @__PURE__ */ o(Ye, { children: /* @__PURE__ */ o("ul", { className: x.catalogue, children: De.map((e) => {
387
387
  const f = e.sizes[e.start];
388
- return /* @__PURE__ */ D("li", { className: x.entry, children: [
388
+ return /* @__PURE__ */ R("li", { className: x.entry, children: [
389
389
  /* @__PURE__ */ o("div", { className: x.footprint, role: "img", "aria-label": s.dashboardFootprint(f.columns, f.rows), children: /* @__PURE__ */ o("span", { style: { width: `${f.columns / he * 100}%`, height: `${Math.min(1, f.rows / 4) * 100}%` } }) }),
390
- /* @__PURE__ */ D("div", { className: x.entryText, children: [
390
+ /* @__PURE__ */ R("div", { className: x.entryText, children: [
391
391
  /* @__PURE__ */ o(ne, { as: "strong", weight: "semibold", children: e.label }),
392
392
  /* @__PURE__ */ o(ne, { as: "span", size: "sm", tone: "secondary", children: e.sentence })
393
393
  ] }),
394
- /* @__PURE__ */ o(F, { size: "sm", "aria-label": s.dashboardAddType(e.label), onClick: () => Re(e), children: s.dashboardAdd })
394
+ /* @__PURE__ */ o(F, { size: "sm", "aria-label": s.dashboardAddType(e.label), onClick: () => Ee(e), children: s.dashboardAdd })
395
395
  ] }, e.name);
396
396
  }) }) })
397
397
  ] }),
398
398
  ce?.form && le && /* @__PURE__ */ o(Ke, { open: !0, anchorRef: we, align: "end", onOpenChange: () => be(null), role: "dialog", "aria-label": s.dashboardOptions, children: /* @__PURE__ */ o("div", { className: x.options, children: ce.form({
399
399
  options: le.options,
400
400
  change: (e) => {
401
- t.step(tt(le.id, e)), P(s.dashboardOptionsChanged(q(ce, e)));
401
+ t.step(nt(le.id, e)), P(s.dashboardOptionsChanged(q(ce, e)));
402
402
  }
403
403
  }) }) })
404
404
  ]
@@ -406,97 +406,100 @@ function At({ view: n, editor: t, className: r, children: i, catalogue: M, headi
406
406
  );
407
407
  }
408
408
  const Oe = (n, t) => JSON.stringify(n) === JSON.stringify(t);
409
- function Bt({ defaultView: n, initialView: t, allowEdit: r = !0, onViewChange: i, onDraftChange: M }) {
410
- const b = R(null);
409
+ function Bt({ defaultView: n, initialView: t, allowEdit: r = !0, onViewChange: d, onDraftChange: M }) {
410
+ const b = E(null);
411
411
  b.current ??= { state: { view: Me(t) ? t : n, draft: null, known: 0 }, listeners: /* @__PURE__ */ new Set(), types: /* @__PURE__ */ new Map(), signature: "" };
412
- const a = b.current, s = pe(), d = R({ defaultView: n, allowEdit: r, onViewChange: i, onDraftChange: M, wording: s });
413
- d.current = { defaultView: n, allowEdit: r, onViewChange: i, onDraftChange: M, wording: s };
414
- const c = fe(() => {
412
+ const a = b.current, s = pe(), c = E({ defaultView: n, allowEdit: r, onViewChange: d, onDraftChange: M, wording: s });
413
+ c.current = { defaultView: n, allowEdit: r, onViewChange: d, onDraftChange: M, wording: s };
414
+ const i = fe(() => {
415
415
  const K = (z) => (a.listeners.add(z), () => void a.listeners.delete(z)), A = () => a.state, l = (z) => {
416
416
  a.state = z, a.listeners.forEach((m) => m());
417
- }, u = (z) => a.types.size ? ve(z, a.types) : Mt(z), g = () => {
418
- !d.current.allowEdit || a.state.draft || (l({ ...a.state, draft: { steps: [u(a.state.view)], at: 0 } }), d.current.onDraftChange?.(!0), P(d.current.wording.dashboardEditing));
419
- }, k = (z) => {
420
- const { view: m, draft: S } = a.state;
421
- if (!S) return;
422
- const v = S.steps[S.at], G = z && !Oe(v, u(m)), X = { ...v, widgets: [...v.widgets, ...kt(m, S.steps[0])] };
423
- l({ ...a.state, view: G ? X : m, draft: null, catalogue: !1 }), d.current.onDraftChange?.(!1);
424
- const { wording: I } = d.current;
425
- P(z ? G ? I.dashboardKept : I.dashboardLeft : I.dashboardCancelled), G && d.current.onViewChange?.(X);
417
+ }, u = (z) => a.types.size ? ve(z, a.types) : Ct(z), g = () => {
418
+ !c.current.allowEdit || a.state.draft || (l({ ...a.state, draft: { steps: [u(a.state.view)], at: 0 } }), c.current.onDraftChange?.(!0), P(c.current.wording.dashboardEditing));
419
+ }, C = (z) => {
420
+ const { view: m, draft: k } = a.state;
421
+ if (!k) return;
422
+ const v = k.steps[k.at], G = z && !Oe(v, u(m)), X = { ...v, widgets: [...v.widgets, ...kt(m, k.steps[0])] };
423
+ l({ ...a.state, view: G ? X : m, draft: null, catalogue: !1 }), c.current.onDraftChange?.(!1);
424
+ const { wording: I } = c.current;
425
+ P(z ? G ? I.dashboardKept : I.dashboardLeft : I.dashboardCancelled), G && c.current.onViewChange?.(X);
426
426
  }, p = (z) => {
427
427
  a.state.draft && l({ ...a.state, catalogue: z });
428
- }, C = (z) => {
428
+ }, S = (z) => {
429
429
  const { draft: m } = a.state;
430
430
  if (!m) return;
431
- const S = m.steps[m.at], v = z(S);
432
- v !== S && l({ ...a.state, draft: { steps: [...m.steps.slice(0, m.at + 1), v], at: m.at + 1 } });
431
+ const k = m.steps[m.at], v = z(k);
432
+ v !== k && l({ ...a.state, draft: { steps: [...m.steps.slice(0, m.at + 1), v], at: m.at + 1 } });
433
433
  }, U = (z, m) => {
434
- const { draft: S } = a.state;
435
- S?.steps[S.at + z] && (l({ ...a.state, draft: { ...S, at: S.at + z } }), P(m));
436
- }, V = () => U(-1, d.current.wording.dashboardUndone), W = () => U(1, d.current.wording.dashboardRedone), L = () => {
437
- a.state.draft && (C(() => u(d.current.defaultView)), P(d.current.wording.dashboardResetDone));
438
- }, T = (z, m, S) => ({
434
+ const { draft: k } = a.state;
435
+ k?.steps[k.at + z] && (l({ ...a.state, draft: { ...k, at: k.at + z } }), P(m));
436
+ }, V = () => U(-1, c.current.wording.dashboardUndone), W = () => U(1, c.current.wording.dashboardRedone), L = () => {
437
+ a.state.draft && (S(() => u(c.current.defaultView)), P(c.current.wording.dashboardResetDone));
438
+ }, T = (z, m, k) => ({
439
439
  allowed: z,
440
440
  editing: m !== null,
441
441
  edit: g,
442
- done: () => k(!0),
443
- cancel: () => k(!1),
444
- catalogue: S,
442
+ done: () => C(!0),
443
+ cancel: () => C(!1),
444
+ catalogue: k,
445
445
  setCatalogue: p,
446
446
  register: (v) => {
447
447
  a.types = v;
448
448
  const G = [...v].map(([X, I]) => `${X}:${I.start}:${JSON.stringify(I.sizes)}`).join("|");
449
449
  G !== a.signature && (a.signature = G, l({ ...a.state, known: a.state.known + 1 }));
450
450
  },
451
- step: C,
451
+ step: S,
452
452
  undo: V,
453
453
  redo: W,
454
454
  reset: L,
455
455
  canUndo: !!m && m.at > 0,
456
456
  canRedo: !!m && m.at < m.steps.length - 1,
457
- canReset: !!m && !Oe(m.steps[m.at], u(d.current.defaultView))
457
+ canReset: !!m && !Oe(m.steps[m.at], u(c.current.defaultView))
458
458
  });
459
459
  return {
460
460
  get: A,
461
461
  subscribe: K,
462
462
  edit: g,
463
- done: () => k(!0),
464
- cancel: () => k(!1),
463
+ done: () => C(!0),
464
+ cancel: () => C(!1),
465
465
  undo: V,
466
466
  redo: W,
467
467
  reset: L,
468
- catalogue: () => p(!0),
468
+ openCatalogue: () => p(!0),
469
469
  read: u,
470
470
  setView: (z) => {
471
- const m = Me(z) ? z : d.current.defaultView;
471
+ const m = Me(z) ? z : c.current.defaultView;
472
472
  l({ ...a.state, view: m, draft: a.state.draft ? { steps: [u(m)], at: 0 } : null });
473
473
  },
474
474
  Dashboard: (z) => {
475
- const { view: m, draft: S, catalogue: v } = ze(K, A, A);
476
- return Pe(At, { ...z, view: S ? S.steps[S.at] : m, editor: T(d.current.allowEdit, S, !!v) });
475
+ const { view: m, draft: k, catalogue: v } = ze(K, A, A);
476
+ return Pe($t, { ...z, view: k ? k.steps[k.at] : m, editor: T(c.current.allowEdit, k, !!v) });
477
477
  }
478
478
  };
479
479
  }, [a]);
480
480
  Z(
481
481
  () => () => {
482
- b.current?.state.draft && d.current.onDraftChange?.(!1);
482
+ b.current?.state.draft && c.current.onDraftChange?.(!1);
483
483
  },
484
484
  []
485
485
  );
486
- const { view: w, draft: h, known: _ } = ze(c.subscribe, c.get, c.get), j = h ? h.steps[h.at] : w, ee = fe(() => c.read(j), [c, j, _]);
486
+ const { view: w, draft: h, known: _ } = ze(i.subscribe, i.get, i.get), B = h ? h.steps[h.at] : w, ee = fe(() => i.read(B), [i, B, _]);
487
487
  return {
488
- Dashboard: c.Dashboard,
488
+ Dashboard: i.Dashboard,
489
489
  WidgetType: Ne,
490
490
  view: ee,
491
- setView: c.setView,
491
+ setView: i.setView,
492
492
  editing: h !== null,
493
- edit: c.edit,
494
- done: c.done,
495
- cancel: c.cancel,
496
- catalogue: c.catalogue,
497
- undo: c.undo,
498
- redo: c.redo,
499
- reset: c.reset
493
+ edit: i.edit,
494
+ done: i.done,
495
+ cancel: i.cancel,
496
+ openCatalogue: i.openCatalogue,
497
+ undo: i.undo,
498
+ redo: i.redo,
499
+ reset: i.reset,
500
+ catalogue: () => {
501
+ Je("@umriss-ui/dashboard", "deprecated:useDashboard catalogue", "useDashboard's catalogue() is deprecated and goes in the next major release; use openCatalogue()."), i.openCatalogue();
502
+ }
500
503
  };
501
504
  }
502
505
  export {
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ export declare interface DashboardParts {
37
37
  /** Leaves the mode, keeps the changes and reports them once if there are any. */
38
38
  done: () => void;
39
39
  /** Opens the catalogue. Does nothing outside the editing mode. */
40
- catalogue: () => void;
40
+ openCatalogue: () => void;
41
41
  /** Leaves the mode and puts the arrangement back as it was before `edit`. */
42
42
  cancel: () => void;
43
43
  /** Goes one step back in the draft. Does nothing at the first. */
@@ -46,6 +46,9 @@ export declare interface DashboardParts {
46
46
  redo: () => void;
47
47
  /** Steps to the `defaultView`; `undo` brings the arrangement back. */
48
48
  reset: () => void;
49
+ /** The old name of `openCatalogue`.
50
+ @deprecated since 0.58 - use openCatalogue. */
51
+ catalogue: () => void;
49
52
  }
50
53
 
51
54
  /** The props of `Dashboard`. */
@@ -63,7 +66,9 @@ export declare interface DashboardProps extends HTMLAttributes<HTMLDivElement>,
63
66
  }
64
67
 
65
68
  /** The arrangement of a dashboard: which widgets, in what order, at which
66
- sizes, with which options. An object, so that more can join it later. */
69
+ sizes, with which options. An object, so that more can join it later.
70
+ It is the supported storage format: an addition is a minor release, and renaming
71
+ or removing `widgets`, `type` or `size` is a major one. */
67
72
  export declare interface DashboardView {
68
73
  /** The widgets, in the order they are drawn and read. */
69
74
  widgets: ReadonlyArray<DashboardWidget>;
package/docs/llms-full.md CHANGED
@@ -1,4 +1,4 @@
1
- # @umriss-ui/dashboard 0.56.0
1
+ # @umriss-ui/dashboard 0.58.0
2
2
 
3
3
  > React dashboard for data-dense applications - widgets a reader arranges, packed in order on twelve columns.
4
4
 
@@ -689,6 +689,46 @@ export default function PrintTheDashboard() {
689
689
  }
690
690
  ```
691
691
 
692
+ ##### The editing actions in the application's own header
693
+
694
+ The parts hand over the editing actions, so an application can offer them in its own page header too: Edit, Undo, Redo and Done do the same there as in the dashboard's own bar, which stays where it is. Redo does nothing at the last step of the draft.
695
+
696
+ ```tsx
697
+ import { Button, ButtonGroup, Stack, Text } from "@umriss-ui/core";
698
+ import { HeadingType, useDashboard } from "@umriss-ui/dashboard";
699
+ import type { DashboardView, HeadingOptions } from "@umriss-ui/dashboard";
700
+
701
+ const VIEW: DashboardView = {
702
+ widgets: [
703
+ { id: "h1", type: "heading", size: "full", options: { text: "Dispatch, today" } satisfies HeadingOptions },
704
+ { id: "a", type: "figure", size: "wide", options: { label: "Tours out", value: "14 of 18" } },
705
+ { id: "b", type: "figure", size: "wide", options: { label: "Pallets on hand", value: "412" } },
706
+ ],
707
+ };
708
+
709
+ export default function RedoFromAnOwnHeader() {
710
+ const { Dashboard, WidgetType, editing, edit, undo, redo, done } = useDashboard({ defaultView: VIEW });
711
+ return (
712
+ <Stack gap={3}>
713
+ <ButtonGroup aria-label="Dispatch actions" size="sm">
714
+ <Button onClick={edit} disabled={editing}>Edit</Button>
715
+ <Button onClick={undo} disabled={!editing}>Undo</Button>
716
+ <Button onClick={redo} disabled={!editing}>Redo</Button>
717
+ <Button variant="primary" onClick={done} disabled={!editing}>Done</Button>
718
+ </ButtonGroup>
719
+ <Dashboard headingLevel={4} aria-label="Dispatch, today">
720
+ <HeadingType />
721
+ <WidgetType name="figure" label="Figure" sentence="One figure with its name." sizes={{ wide: { columns: 6, rows: 2 } }} start="wide" defaultOptions={{ label: "", value: "" }} title={(options) => options.label}>
722
+ {({ options }) => (
723
+ <Text size="2xl" weight="semibold">{options.value}</Text>
724
+ )}
725
+ </WidgetType>
726
+ </Dashboard>
727
+ </Stack>
728
+ );
729
+ }
730
+ ```
731
+
692
732
  #### When to use something else
693
733
 
694
734
  - A layout the developer fixes, which the reader does not arrange → `Grid`, `Stack` and `Splitter` from @umriss-ui/core
@@ -713,7 +753,7 @@ Every move, size, removal, addition, undo, redo, reset, "Done" and "Cancel" is a
713
753
 
714
754
  | Prop | Type | Default | Description |
715
755
  |---|---|---|---|
716
- | `defaultView` *required* | `DashboardView` | — | The arrangement the application gives a reader who has none of their own.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
756
+ | `defaultView` *required* | `DashboardView` | — | The arrangement the application gives a reader who has none of their own.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 8 more |
717
757
  | `initialView` | `DashboardView` | the `defaultView` | The reader's kept arrangement, read once when the hook first runs; a different value on a later render is ignored, as React ignores a changed `defaultValue`. To go to another, call `setView`.<br>Shown in: [An arrangement from an older release](#dashboard), [A widget every reader keeps](#dashboard) |
718
758
  | `allowEdit` | `boolean` | `true` | Whether the reader may edit. Without it no bar is drawn and the mode cannot be entered.<br>Shown in: [The start screen of a dispatcher](#dashboard), [A widget for one role](#dashboard), [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
719
759
 
@@ -728,26 +768,27 @@ Every move, size, removal, addition, undo, redo, reset, "Done" and "Cancel" is a
728
768
 
729
769
  | Prop | Type | Default | Description |
730
770
  |---|---|---|---|
731
- | `Dashboard` *required* | `(props: ``DashboardProps``) => ReactNode` | — | The dashboard. One per `useDashboard`.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
732
- | `WidgetType` *required* | `typeof WidgetType` | — | Declares a widget type inside `Dashboard`.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
771
+ | `Dashboard` *required* | `(props: ``DashboardProps``) => ReactNode` | — | The dashboard. One per `useDashboard`.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 8 more |
772
+ | `WidgetType` *required* | `typeof WidgetType` | — | Declares a widget type inside `Dashboard`.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
733
773
  | `view` *required* | `DashboardView` | — | The arrangement in view: the draft while the mode is on.<br>Shown in: [A widget every reader keeps](#dashboard) |
734
774
  | `setView` *required* | `(view: ``DashboardView``) => void` | — | Goes to a whole arrangement. Not reported.<br>Shown in: [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
735
- | `editing` *required* | `boolean` | — | Whether the editing mode is on.<br>Shown in: [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
736
- | `edit` *required* | `() => void` | — | Enters the editing mode. Does nothing where editing is not allowed.<br>Shown in: [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
737
- | `done` *required* | `() => void` | — | Leaves the mode, keeps the changes and reports them once if there are any.<br>Shown in: [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
738
- | `catalogue` *required* | `() => void` | — | Opens the catalogue. Does nothing outside the editing mode.<br>Shown in: [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
775
+ | `editing` *required* | `boolean` | — | Whether the editing mode is on.<br>Shown in: [The editing actions in the application's own header](#dashboard), [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
776
+ | `edit` *required* | `() => void` | — | Enters the editing mode. Does nothing where editing is not allowed.<br>Shown in: [The editing actions in the application's own header](#dashboard), [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
777
+ | `done` *required* | `() => void` | — | Leaves the mode, keeps the changes and reports them once if there are any.<br>Shown in: [The editing actions in the application's own header](#dashboard), [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
778
+ | `openCatalogue` *required* | `() => void` | — | Opens the catalogue. Does nothing outside the editing mode.<br>Shown in: [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
739
779
  | `cancel` *required* | `() => void` | — | Leaves the mode and puts the arrangement back as it was before `edit`.<br>Shown in: [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
740
- | `undo` *required* | `() => void` | — | Goes one step back in the draft. Does nothing at the first.<br>Shown in: [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
741
- | `redo` *required* | `() => void` | — | Goes one step forward again. Does nothing at the last. |
780
+ | `undo` *required* | `() => void` | — | Goes one step back in the draft. Does nothing at the first.<br>Shown in: [The editing actions in the application's own header](#dashboard), [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
781
+ | `redo` *required* | `() => void` | — | Goes one step forward again. Does nothing at the last.<br>Shown in: [The editing actions in the application's own header](#dashboard) |
742
782
  | `reset` *required* | `() => void` | — | Steps to the `defaultView`; `undo` brings the arrangement back.<br>Shown in: [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
783
+ | `catalogue` *required* | `() => void` | — | *Deprecated* since 0.58 - use openCatalogue. The old name of `openCatalogue`. |
743
784
 
744
785
  ##### `DashboardProps`
745
786
 
746
787
  | Prop | Type | Default | Description |
747
788
  |---|---|---|---|
748
- | `children` | `ReactNode` | — | The `WidgetType`s of this dashboard.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
789
+ | `children` | `ReactNode` | — | The `WidgetType`s of this dashboard.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
749
790
  | `catalogue` | `ReadonlyArray<string>` | every declared type | The `name`s of the widget types the catalogue lists.<br>Shown in: [The start screen of a dispatcher](#dashboard) |
750
- | `headingLevel` | `2 \| 3 \| 4 \| 5 \| 6` | `2` | The level of the heading the heading widgets stand in - the one that fits the page's outline. A widget's title stands one level below it when the dashboard holds a heading widget, and at this level when not; never deeper than 6.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
791
+ | `headingLevel` | `2 \| 3 \| 4 \| 5 \| 6` | `2` | The level of the heading the heading widgets stand in - the one that fits the page's outline. A widget's title stands one level below it when the dashboard holds a heading widget, and at this level when not; never deeper than 6.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 8 more |
751
792
  | `ref` | `Ref<HTMLDivElement> \| undefined` | — | Receives the component's root element. From `RefProp`. |
752
793
 
753
794
  Also takes every attribute of `<div>`.
@@ -756,16 +797,16 @@ Also takes every attribute of `<div>`.
756
797
 
757
798
  | Prop | Type | Default | Description |
758
799
  |---|---|---|---|
759
- | `widgets` *required* | `ReadonlyArray<``DashboardWidget``>` | — | The widgets, in the order they are drawn and read.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
800
+ | `widgets` *required* | `ReadonlyArray<``DashboardWidget``>` | — | The widgets, in the order they are drawn and read.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 8 more |
760
801
 
761
802
  ##### `DashboardWidget`
762
803
 
763
804
  | Prop | Type | Default | Description |
764
805
  |---|---|---|---|
765
- | `id` *required* | `string` | — | Unique within the view.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
766
- | `type` *required* | `string` | — | The `name` of the widget type it is an instance of.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
767
- | `size` *required* | `WidgetSize`<br>`"small" \| "medium" \| "wide" \| "tall" \| "large" \| "full"` | — | One of the sizes its type offers.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
768
- | `options` *required* | `unknown` | — | The type's own options, typed through the hook.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
806
+ | `id` *required* | `string` | — | Unique within the view.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
807
+ | `type` *required* | `string` | — | The `name` of the widget type it is an instance of.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
808
+ | `size` *required* | `WidgetSize`<br>`"small" \| "medium" \| "wide" \| "tall" \| "large" \| "full"` | — | One of the sizes its type offers.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
809
+ | `options` *required* | `unknown` | — | The type's own options, typed through the hook.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
769
810
  | `locked` | `boolean` | — | Set by the application, never by the dashboard: the reader can move the widget but not resize it, change its options or remove it. Only `true` locks. Kept through every edit.<br>Shown in: [A widget every reader keeps](#dashboard) |
770
811
 
771
812
  ##### `WidgetSize`
@@ -776,29 +817,29 @@ Declares no props of its own.
776
817
 
777
818
  | Prop | Type | Default | Description |
778
819
  |---|---|---|---|
779
- | `columns` *required* | `number` | — | Columns of twelve.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
780
- | `rows` *required* | `number` | — | Rows of the fixed row unit.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
820
+ | `columns` *required* | `number` | — | Columns of twelve.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
821
+ | `rows` *required* | `number` | — | Rows of the fixed row unit.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
781
822
 
782
823
  ##### `WidgetTypeProps<Options>`
783
824
 
784
825
  | Prop | Type | Default | Description |
785
826
  |---|---|---|---|
786
- | `name` *required* | `string` | — | The name a view refers to this type by. Unique within the dashboard.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
787
- | `label` *required* | `string` | — | The type's name for a reader, and the title of its frame unless `title` says otherwise.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
788
- | `sentence` *required* | `string` | — | One sentence on what the type shows.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
789
- | `sizes` *required* | `Partial<Record<``WidgetSize``, ``SizeSpan``>>` | — | The sizes the type offers, each with the columns (of twelve) and rows it takes.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
790
- | `start` *required* | `WidgetSize`<br>`"small" \| "medium" \| "wide" \| "tall" \| "large" \| "full"` | — | The size a new widget of this type starts at. One of `sizes`.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
791
- | `defaultOptions` | `Options` | — | The options a new widget starts with, and the ones a stored widget's missing keys are read from: stored plain options are spread over them, one level deep. Their type is the options type of `title` and of the content. A widget without options leaves them out.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
792
- | `title` | `(options: NoInfer<Options>) => string` | — | The title of a frame as a function of its options; the `label` without it.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [A widget for one role](#dashboard) and 4 more |
827
+ | `name` *required* | `string` | — | The name a view refers to this type by. Unique within the dashboard.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
828
+ | `label` *required* | `string` | — | The type's name for a reader, and the title of its frame unless `title` says otherwise.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
829
+ | `sentence` *required* | `string` | — | One sentence on what the type shows.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
830
+ | `sizes` *required* | `Partial<Record<``WidgetSize``, ``SizeSpan``>>` | — | The sizes the type offers, each with the columns (of twelve) and rows it takes.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
831
+ | `start` *required* | `WidgetSize`<br>`"small" \| "medium" \| "wide" \| "tall" \| "large" \| "full"` | — | The size a new widget of this type starts at. One of `sizes`.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
832
+ | `defaultOptions` | `Options` | — | The options a new widget starts with, and the ones a stored widget's missing keys are read from: stored plain options are spread over them, one level deep. Their type is the options type of `title` and of the content. A widget without options leaves them out.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
833
+ | `title` | `(options: NoInfer<Options>) => string` | — | The title of a frame as a function of its options; the `label` without it.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [A widget for one role](#dashboard) and 5 more |
793
834
  | `form` | `(props: ``WidgetFormProps``<NoInfer<Options>>) => ReactNode` | — | The form for the options, opened from the widget's menu. Without it the menu has no options entry.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
794
- | `children` *required* | `(content: ``WidgetContent``<NoInfer<Options>>) => ReactNode` | — | The content, as a function of the size and the options.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 6 more |
835
+ | `children` *required* | `(content: ``WidgetContent``<NoInfer<Options>>) => ReactNode` | — | The content, as a function of the size and the options.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Headings that divide the dashboard](#dashboard) and 7 more |
795
836
 
796
837
  ##### `WidgetContent<Options>`
797
838
 
798
839
  | Prop | Type | Default | Description |
799
840
  |---|---|---|---|
800
841
  | `size` *required* | `WidgetSize`<br>`"small" \| "medium" \| "wide" \| "tall" \| "large" \| "full"` | — | The size the widget stands at.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [Arrange the start screen (Scenarios)](#arrange-the-start-screen) |
801
- | `options` *required* | `Options` | — | The widget's options.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [A widget for one role](#dashboard) and 3 more |
842
+ | `options` *required* | `Options` | — | The widget's options.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Your own component as a widget](#dashboard), [A widget for one role](#dashboard) and 4 more |
802
843
 
803
844
  ##### `WidgetFormProps<Options>`
804
845
 
@@ -811,7 +852,7 @@ Declares no props of its own.
811
852
 
812
853
  | Prop | Type | Default | Description |
813
854
  |---|---|---|---|
814
- | `text` *required* | `string` | — | The title across the full width.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Headings that divide the dashboard](#dashboard), [Print the dashboard](#dashboard) and 1 more |
855
+ | `text` *required* | `string` | — | The title across the full width.<br>Shown in: [The start screen of a dispatcher](#dashboard), [Headings that divide the dashboard](#dashboard), [Print the dashboard](#dashboard) and 2 more |
815
856
 
816
857
  #### Known limits
817
858
 
@@ -820,7 +861,7 @@ Declares no props of its own.
820
861
  - Never: stacks of widgets that share one place, coordinates and free placement, a layout per breakpoint, dense packing, dragging from the catalogue to a chosen place ([ADR-0064](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0064-a-dashboard-a-user-arranges-is-a-sequence-on-fixed-columns.md)).
821
862
  - Where an arrangement is stored, which default a role gets, several dashboards and what stands in a widget are the application's.
822
863
 
823
- What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/dashboard-v0.56.0/docs/adr/0032-what-umriss-is-not.md).
864
+ What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/dashboard-v0.58.0/docs/adr/0032-what-umriss-is-not.md).
824
865
 
825
866
  ## API index
826
867
 
@@ -1177,7 +1218,7 @@ function Stage({ shown }: { shown: Case }) {
1177
1218
  rearranging: [
1178
1219
  <Button key="edit" onClick={edit} disabled={parts.editing}>Edit</Button>,
1179
1220
  <Button key="undo" onClick={() => { parts.undo(); setSaid("One step back, not all of them."); }} disabled={!parts.editing}>Undo</Button>,
1180
- <Button key="catalogue" onClick={() => { parts.catalogue(); setSaid("Every widget type with its name, a sentence and the room it takes. A new widget shows something at once and stands at the end."); }} disabled={!parts.editing}>Add a widget</Button>,
1221
+ <Button key="catalogue" onClick={() => { parts.openCatalogue(); setSaid("Every widget type with its name, a sentence and the room it takes. A new widget shows something at once and stands at the end."); }} disabled={!parts.editing}>Add a widget</Button>,
1181
1222
  <Button key="done" onClick={() => { parts.done(); setSaid("Only now, and once, the application is told the whole arrangement."); }} disabled={!parts.editing}>Done</Button>,
1182
1223
  ],
1183
1224
  wrong: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umriss-ui/dashboard",
3
- "version": "0.56.0",
3
+ "version": "0.58.0",
4
4
  "description": "React dashboard for data-dense applications - widgets a reader arranges, packed in order on twelve columns.",
5
5
  "license": "MIT",
6
6
  "author": "Roman Händler",
@@ -54,15 +54,18 @@
54
54
  "default": "./dist/dashboard.css"
55
55
  }
56
56
  },
57
+ "engines": {
58
+ "node": ">=22"
59
+ },
57
60
  "peerDependencies": {
58
- "@umriss-ui/core": "^0.56.0",
59
- "react": ">=19",
60
- "react-dom": ">=19"
61
+ "@umriss-ui/core": "^0.58.0",
62
+ "react": "^19",
63
+ "react-dom": "^19"
61
64
  },
62
65
  "devDependencies": {
63
66
  "@fontsource/geist-mono": "^5.3.0",
64
67
  "@fontsource/geist-sans": "^5.3.0",
65
- "@umriss-ui/core": "0.56.0",
68
+ "@umriss-ui/core": "0.58.0",
66
69
  "@umriss-ui/demo": "0.0.0",
67
70
  "@types/node": "^22.20.2",
68
71
  "@types/react": "^19.0.0",