@umriss-ui/dashboard 0.48.0 → 0.50.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/CHANGELOG.md +15 -0
- package/README.md +2 -2
- package/dist/dashboard.css +1 -1
- package/dist/dashboard.js +217 -217
- package/docs/llms-full.md +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,21 @@ 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.50.0 – Straightened: dialogs focus without React's internals, tables work per change, the edges 0.49.0 left (Oct. 2026)
|
|
17
|
+
|
|
18
|
+
No change of its own; the number moves with the other packages (ADR-0066).
|
|
19
|
+
|
|
20
|
+
## 0.49.0 – The second shakedown: lists that shrink, a flood that scrolls, five things the table lacked (Oct. 2026)
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **The dashboard stands flush with its neighbours**: no side padding, at rest and while editing; the edit frame is drawn inside the cards, so nothing moves when editing starts and a host that clips its overflow does not cut the frame.
|
|
25
|
+
- Migration: a dashboard's content is 32 px wider than before; one that relied on the library's side padding gives itself a margin.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- **README links resolve on npm**: links to files the package does not ship point to the repository on GitHub.
|
|
30
|
+
|
|
16
31
|
## 0.48.0 – Released in step with core (Oct. 2026)
|
|
17
32
|
|
|
18
33
|
No change of its own; the number moves with core's touch scale, now an opt-in (ADR-0079): a `md` control of core stays 32 px under a finger unless the application imports `@umriss-ui/core/touch-scale.css`.
|
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ const { Dashboard, WidgetType } = useDashboard({
|
|
|
115
115
|
## Testing
|
|
116
116
|
|
|
117
117
|
Tested under Vitest 5 and Jest 30 on jsdom. The runner lines and the setup file are in
|
|
118
|
-
[`@umriss-ui/core`'s Testing section](
|
|
118
|
+
[`@umriss-ui/core`'s Testing section](https://github.com/romanhaendler/umriss-ui/blob/main/packages/core/README.md#testing); `check:dist` runs a test of the
|
|
119
119
|
installed dashboard (a widget and its title) with exactly those files.
|
|
120
120
|
|
|
121
121
|
## Documentation
|
|
@@ -129,7 +129,7 @@ application governs. An API index lists every export, one search finds across
|
|
|
129
129
|
all six packages, and the header switches the examples to German. What is not
|
|
130
130
|
built yet and what never will be stands in ADR-0064. The vocabulary - dashboard,
|
|
131
131
|
widget, widget type, widget size, options, catalogue - stands in `CONTEXT.md`
|
|
132
|
-
under "Dashboards". Every export is listed in [API.md](API.md).
|
|
132
|
+
under "Dashboards". Every export is listed in [API.md](https://github.com/romanhaendler/umriss-ui/blob/main/packages/dashboard/API.md).
|
|
133
133
|
|
|
134
134
|
For a coding agent the demo stands as one Markdown file inside the installed
|
|
135
135
|
package, `docs/llms-full.md`, pinned to that version. The running documentation of a version is opened as [the repository README describes](https://github.com/romanhaendler/umriss-ui#see-it-running): check out the tag `<package>-v<version>`, then `pnpm start`.
|
package/dist/dashboard.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer umriss.tokens,umriss.base,umriss.components;@layer umriss.components{.
|
|
1
|
+
@layer umriss.tokens,umriss.base,umriss.components;@layer umriss.components{._root_42kfy_17,._root_42kfy_17:before,._root_42kfy_17:after{box-sizing:border-box}._bar_42kfy_36,._bar_42kfy_36:before,._bar_42kfy_36:after{box-sizing:border-box}._mode_42kfy_45,._mode_42kfy_45:before,._mode_42kfy_45:after{box-sizing:border-box}._head_42kfy_60,._head_42kfy_60:before,._head_42kfy_60:after{box-sizing:border-box}._editingHead_42kfy_79,._editingHead_42kfy_79:before,._editingHead_42kfy_79:after{box-sizing:border-box}._grip_42kfy_87,._grip_42kfy_87:before,._grip_42kfy_87:after{box-sizing:border-box}._title_42kfy_92,._title_42kfy_92:before,._title_42kfy_92:after{box-sizing:border-box}._size_42kfy_104,._size_42kfy_104:before,._size_42kfy_104:after{box-sizing:border-box}._item_42kfy_112,._item_42kfy_112:before,._item_42kfy_112:after{box-sizing:border-box}._placeholder_42kfy_122,._placeholder_42kfy_122:before,._placeholder_42kfy_122:after{box-sizing:border-box}._grid_42kfy_128,._grid_42kfy_128:before,._grid_42kfy_128:after{box-sizing:border-box}._headingRow_42kfy_145,._headingRow_42kfy_145:before,._headingRow_42kfy_145:after{box-sizing:border-box}._headingHead_42kfy_75,._headingHead_42kfy_75:before,._headingHead_42kfy_75:after{box-sizing:border-box}._heading_42kfy_75,._heading_42kfy_75:before,._heading_42kfy_75:after{box-sizing:border-box}._body_42kfy_175,._body_42kfy_175:before,._body_42kfy_175:after{box-sizing:border-box}._options_42kfy_203,._options_42kfy_203:before,._options_42kfy_203:after{box-sizing:border-box}._catalogue_42kfy_208,._catalogue_42kfy_208:before,._catalogue_42kfy_208:after{box-sizing:border-box}._entry_42kfy_216,._entry_42kfy_216:before,._entry_42kfy_216:after{box-sizing:border-box}._footprint_42kfy_223,._footprint_42kfy_223:before,._footprint_42kfy_223:after{box-sizing:border-box}._entryText_42kfy_235,._entryText_42kfy_235:before,._entryText_42kfy_235:after{box-sizing:border-box}._root_42kfy_17{container-type:inline-size;width:100%;padding:0 0 var(--u-space-4);border-radius:var(--u-radius-lg);corner-shape:squircle;--_dashboard-row-unit: var(--u-dashboard-row, round(max(50px, 3.125rem), 1px));--_dashboard-gap: var(--u-dashboard-gap, 12px)}._root_42kfy_17[data-editing]{outline:2px solid var(--u-color-accent);outline-offset:-2px}._bar_42kfy_36{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--u-space-2);padding-block:var(--u-space-3)}._mode_42kfy_45{margin-inline-end:auto;padding:5px var(--u-space-2);border-radius:var(--u-radius-xs);corner-shape:squircle;background:var(--u-color-accent);color:var(--u-color-on-accent);font-family:var(--u-font-mono);font-size:var(--u-text-xs);font-weight:var(--u-weight-medium);line-height:var(--u-leading-none);letter-spacing:var(--u-tracking-caps);text-transform:var(--u-transform-caps)}._head_42kfy_60{display:flex;align-items:center;gap:6px;min-width:0;min-height:calc(var(--u-control-height) + 2px);padding:var(--u-space-2) var(--u-space-2) 0 var(--u-space-3);border-radius:var(--u-radius-lg) var(--u-radius-lg) 0 0;corner-shape:squircle}._head_42kfy_60:not(._headingHead_42kfy_75){height:max(calc(var(--u-control-height) + 2px),calc(var(--u-space-2) + var(--u-text-sm) * var(--u-leading-normal)))}._editingHead_42kfy_79{padding-block:0;background:var(--u-color-surface-pressed);touch-action:none;user-select:none;cursor:grab}._grip_42kfy_87{flex:none;color:var(--u-color-text-muted)}._title_42kfy_92{flex:1 1 auto;min-width:0;margin:0;overflow:hidden;font-size:var(--u-text-sm);font-weight:var(--u-weight-medium);line-height:var(--u-leading-normal);white-space:nowrap;text-overflow:ellipsis}._size_42kfy_104{font-family:var(--u-font-mono);font-size:var(--u-text-xs);line-height:var(--u-leading-none);color:var(--u-color-text-muted);white-space:nowrap}._item_42kfy_112[data-dragging]{position:relative;z-index:5;box-shadow:var(--u-shadow-overlay)}._item_42kfy_112[data-dragging] ._editingHead_42kfy_79{cursor:grabbing}._placeholder_42kfy_122{border:2px dashed var(--u-color-accent);border-radius:var(--u-radius-lg);corner-shape:squircle;background:var(--u-color-accent-subtle)}._grid_42kfy_128{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));grid-auto-rows:var(--_dashboard-row-unit);gap:var(--_dashboard-gap);max-width:var(--u-dashboard-max-width, 1560px)}._item_42kfy_112{grid-column:var(--_dashboard-column) / span var(--_dashboard-columns);grid-row:var(--_dashboard-row) / span var(--_dashboard-rows);min-height:0;min-width:0}._headingRow_42kfy_145{display:flex;align-items:stretch}._headingHead_42kfy_75{flex:1 1 auto;align-items:flex-end;padding:0 var(--u-space-2) 0 2px;border-radius:var(--u-radius-md);corner-shape:squircle}._headingRow_42kfy_145[data-editing] ._headingHead_42kfy_75{align-items:center;padding-inline-start:var(--u-space-3);padding-block-end:0}._heading_42kfy_75{flex:1 1 auto;min-width:0;margin:0;padding-block-end:calc(var(--u-space-1) + 2px);font-size:var(--u-text-lg)}._headingRow_42kfy_145[data-editing] ._heading_42kfy_75{padding-block-end:0}._body_42kfy_175{flex:1 1 auto;min-height:0;padding:2px var(--u-space-3) 10px;overflow:auto}._body_42kfy_175:focus-visible{outline:2px solid var(--u-color-accent);outline-offset:-2px}@container (max-width: 755px){._grid_42kfy_128{grid-template-columns:minmax(0,1fr);grid-auto-rows:auto}._item_42kfy_112{grid-column:1;grid-row:auto;order:var(--_dashboard-order, 0);height:calc(var(--_dashboard-rows) * var(--_dashboard-row-unit) + (var(--_dashboard-rows) - 1) * var(--_dashboard-gap))}}._options_42kfy_203{min-width:16rem;padding:var(--u-space-3)}._catalogue_42kfy_208{list-style:none;margin:0;padding:0;display:grid;gap:var(--u-space-3, 12px)}._entry_42kfy_216{display:grid;grid-template-columns:4.5rem 1fr auto;align-items:center;gap:var(--u-space-3, 12px)}._footprint_42kfy_223{aspect-ratio:3 / 1;border-radius:2px;corner-shape:squircle;box-shadow:var(--u-edge)}._footprint_42kfy_223>span{box-sizing:border-box}._footprint_42kfy_223>span{display:block;background:var(--u-color-accent, currentColor);opacity:.5}._entryText_42kfy_235{display:grid}}
|
package/dist/dashboard.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./dashboard.css";
|
|
3
|
-
import { Component as He, useState as
|
|
4
|
-
import { useWording as de, FormField as
|
|
3
|
+
import { Component as He, useState as K, useRef as L, useLayoutEffect as ue, useMemo as ie, Children as Ee, isValidElement as he, useEffect as re, Suspense as Re, useSyncExternalStore as fe, createElement as Le } from "react";
|
|
4
|
+
import { useWording as de, FormField as Te, Input as De, Button as j, Text as Q, GripGlyph as pe, Heading as Ae, Card as Ie, Skeleton as $e, Drawer as Fe, ModalHeader as Pe, ModalBody as Be, Popover as je, announce as V, Menu as Ue, MenuItem as U, MenuSeparator as te } from "@umriss-ui/core";
|
|
5
5
|
import { jsx as r, jsxs as R, Fragment as ne } from "react/jsx-runtime";
|
|
6
|
-
const
|
|
7
|
-
const i = o.widgets.findIndex((a) => a.id === t),
|
|
8
|
-
if (i < 0 || i ===
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
},
|
|
6
|
+
const ke = (t, e) => t.widgets.some((o) => o.id === e && o.locked !== !0), Ve = (t, e) => (o) => {
|
|
7
|
+
const i = o.widgets.findIndex((a) => a.id === t), M = Math.max(0, Math.min(o.widgets.length - 1, e));
|
|
8
|
+
if (i < 0 || i === M) return o;
|
|
9
|
+
const y = [...o.widgets];
|
|
10
|
+
return y.splice(M, 0, ...y.splice(i, 1)), { ...o, widgets: y };
|
|
11
|
+
}, We = (t, e) => (o) => o.widgets.some((i) => i.id === t && i.locked !== !0 && i.size !== e) ? { ...o, widgets: o.widgets.map((i) => i.id === t ? { ...i, size: e } : i) } : o, Ge = (t) => (e) => ke(e, t) ? { ...e, widgets: e.widgets.filter((o) => o.id !== t) } : e, Ye = (t, e) => {
|
|
12
12
|
let o = 1;
|
|
13
13
|
for (; t.widgets.some((i) => i.id === `${e}-${o}`); ) o++;
|
|
14
14
|
return `${e}-${o}`;
|
|
15
|
-
},
|
|
16
|
-
root:
|
|
17
|
-
bar:
|
|
15
|
+
}, Xe = (t) => (e) => ({ ...e, widgets: [...e.widgets, t] }), Je = (t, e) => (o) => ke(o, t) ? { ...o, widgets: o.widgets.map((i) => i.id === t ? { ...i, options: e } : i) } : o, Ke = "_root_42kfy_17", qe = "_bar_42kfy_36", Qe = "_mode_42kfy_45", Ze = "_head_42kfy_60", et = "_editingHead_42kfy_79", tt = "_grip_42kfy_87", nt = "_title_42kfy_92", st = "_size_42kfy_104", rt = "_item_42kfy_112", ot = "_placeholder_42kfy_122", at = "_grid_42kfy_128", it = "_headingRow_42kfy_145", dt = "_headingHead_42kfy_75", ct = "_heading_42kfy_75", lt = "_body_42kfy_175", ut = "_options_42kfy_203", ht = "_catalogue_42kfy_208", ft = "_entry_42kfy_216", pt = "_footprint_42kfy_223", gt = "_entryText_42kfy_235", _ = {
|
|
16
|
+
root: Ke,
|
|
17
|
+
bar: qe,
|
|
18
18
|
mode: Qe,
|
|
19
19
|
head: Ze,
|
|
20
20
|
editingHead: et,
|
|
@@ -34,7 +34,7 @@ const ze = (t, e) => t.widgets.some((o) => o.id === e && o.locked !== !0), Ue =
|
|
|
34
34
|
footprint: pt,
|
|
35
35
|
entryText: gt
|
|
36
36
|
};
|
|
37
|
-
class
|
|
37
|
+
class mt extends He {
|
|
38
38
|
state = { failed: !1 };
|
|
39
39
|
static getDerivedStateFromError() {
|
|
40
40
|
return { failed: !0 };
|
|
@@ -46,245 +46,245 @@ class bt extends He {
|
|
|
46
46
|
return this.state.failed ? this.props.fallback : this.props.children;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
const ce = (t) => typeof t == "object" && t !== null && !Array.isArray(t), ge = (t) => ce(t) && Array.isArray(t.widgets), le = (t) => t.widgets.filter((e) => ce(e) && typeof e.id == "string" && typeof e.type == "string"),
|
|
49
|
+
const ce = (t) => typeof t == "object" && t !== null && !Array.isArray(t), ge = (t) => ce(t) && Array.isArray(t.widgets), le = (t) => t.widgets.filter((e) => ce(e) && typeof e.id == "string" && typeof e.type == "string"), bt = (t) => ({ ...t, widgets: le(t) }), yt = (t, e) => {
|
|
50
50
|
const o = new Set(e.widgets.map((i) => i.id));
|
|
51
51
|
return le(t).filter((i) => !o.has(i.id));
|
|
52
|
-
},
|
|
53
|
-
function
|
|
52
|
+
}, me = (t) => ce(t) && [Object.prototype, null].includes(Object.getPrototypeOf(t)), wt = (t, e) => me(e) ? me(t) ? { ...e, ...t } : e : t === void 0 ? e : t;
|
|
53
|
+
function ze(t, e) {
|
|
54
54
|
const o = /* @__PURE__ */ new Set();
|
|
55
55
|
return {
|
|
56
56
|
...t,
|
|
57
57
|
widgets: le(t).flatMap((i) => {
|
|
58
|
-
const
|
|
59
|
-
return !
|
|
58
|
+
const M = e.get(i.type);
|
|
59
|
+
return !M || o.has(i.id) ? [] : (o.add(i.id), [{ ...i, size: M.sizes[i.size] ? i.size : M.start, options: wt(i.options, M.defaultOptions) }]);
|
|
60
60
|
})
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
const o = /* @__PURE__ */ new Set(), i = (
|
|
65
|
-
for (let c =
|
|
63
|
+
function xe(t, e) {
|
|
64
|
+
const o = /* @__PURE__ */ new Set(), i = (y, a, s, u) => {
|
|
65
|
+
for (let c = y; c < y + u; c++) for (let k = a; k < a + s; k++) if (o.has(c * e + k)) return !1;
|
|
66
66
|
return !0;
|
|
67
67
|
};
|
|
68
|
-
let
|
|
69
|
-
return t.map((
|
|
70
|
-
const a = Math.min(
|
|
71
|
-
for (let s =
|
|
68
|
+
let M = 0;
|
|
69
|
+
return t.map((y) => {
|
|
70
|
+
const a = Math.min(y.columns, e);
|
|
71
|
+
for (let s = M; ; s++) {
|
|
72
72
|
const u = Math.floor(s / e), c = s % e;
|
|
73
|
-
if (!(c + a > e || !i(u, c, a,
|
|
74
|
-
for (let
|
|
75
|
-
return
|
|
73
|
+
if (!(c + a > e || !i(u, c, a, y.rows))) {
|
|
74
|
+
for (let k = u; k < u + y.rows; k++) for (let m = c; m < c + a; m++) o.add(k * e + m);
|
|
75
|
+
return M = s, { column: c, row: u, columns: a, rows: y.rows };
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
function _t(t, e, o, i,
|
|
80
|
+
function _t(t, e, o, i, M, { cell: y, unit: a, gap: s }) {
|
|
81
81
|
let u = o, c = 1 / 0;
|
|
82
|
-
for (let
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
82
|
+
for (let k = 0; k < t.length; k++) {
|
|
83
|
+
const m = [...t];
|
|
84
|
+
m.splice(k, 0, ...m.splice(o, 1));
|
|
85
|
+
const S = xe(m, e)[k], W = (S.column * (y + s) - i) ** 2 + (S.row * (a + s) - M) ** 2;
|
|
86
|
+
W < c && (c = W, u = k);
|
|
87
87
|
}
|
|
88
88
|
return u;
|
|
89
89
|
}
|
|
90
|
-
const
|
|
91
|
-
function
|
|
92
|
-
const [
|
|
90
|
+
const kt = { 3: "¼", 4: "⅓", 6: "½", 8: "⅔", 9: "¾" }, zt = ({ columns: t }) => t >= 12 ? "" : kt[t] ?? `${t}/12`;
|
|
91
|
+
function xt({ grid: t, cards: e, shown: o, drop: i, cancelled: M }) {
|
|
92
|
+
const [y, a] = K(null), s = L(null), u = L({}), c = L(/* @__PURE__ */ new Map()), k = L(null), m = L({ update: () => {
|
|
93
93
|
}, finish: () => {
|
|
94
|
-
} }),
|
|
94
|
+
} }), S = () => {
|
|
95
95
|
const d = s.current, l = d && e.get(d.id);
|
|
96
|
-
if (!d || !
|
|
97
|
-
const
|
|
98
|
-
l.style.transform = `translate(${d.x - d.dx -
|
|
96
|
+
if (!d || !k.current || !l) return;
|
|
97
|
+
const b = k.current.getBoundingClientRect();
|
|
98
|
+
l.style.transform = `translate(${d.x - d.dx - b.left}px, ${d.y - d.dy - b.top}px)`;
|
|
99
99
|
};
|
|
100
100
|
ue(() => {
|
|
101
101
|
const d = /* @__PURE__ */ new Map(), l = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
102
|
-
for (const [
|
|
103
|
-
const p = c.current.get(
|
|
104
|
-
d.set(
|
|
102
|
+
for (const [b, h] of e) {
|
|
103
|
+
const p = c.current.get(b);
|
|
104
|
+
d.set(b, [h.offsetLeft, h.offsetTop]), y && !l && p && b !== y.id && (p[0] !== h.offsetLeft || p[1] !== h.offsetTop) && h.animate([{ transform: `translate(${p[0] - h.offsetLeft}px, ${p[1] - h.offsetTop}px)` }, { transform: "none" }], { duration: 150, easing: "ease-out" });
|
|
105
105
|
}
|
|
106
|
-
c.current = d,
|
|
106
|
+
c.current = d, y && S();
|
|
107
107
|
});
|
|
108
|
-
const
|
|
109
|
-
const d = s.current, l = t.current,
|
|
110
|
-
if (!d || !l || !
|
|
111
|
-
const h = getComputedStyle(l), p = parseFloat(h.columnGap), H = h.gridTemplateColumns.split(" ").length, E = l.getBoundingClientRect(),
|
|
112
|
-
if (
|
|
113
|
-
d.target =
|
|
114
|
-
},
|
|
108
|
+
const W = () => {
|
|
109
|
+
const d = s.current, l = t.current, b = d && e.get(d.id);
|
|
110
|
+
if (!d || !l || !b) return;
|
|
111
|
+
const h = getComputedStyle(l), p = parseFloat(h.columnGap), H = h.gridTemplateColumns.split(" ").length, E = l.getBoundingClientRect(), Y = o[d.from].span, X = { cell: (E.width - (H - 1) * p) / H, gap: p, unit: (b.offsetHeight - (Y.rows - 1) * p) / Y.rows }, A = _t(o.map((F) => F.span), H, d.from, d.x - d.dx - E.left, d.y - d.dy - E.top, X);
|
|
112
|
+
if (A === d.target) return S();
|
|
113
|
+
d.target = A, a({ id: d.id, target: A });
|
|
114
|
+
}, q = (d) => {
|
|
115
115
|
const l = s.current;
|
|
116
116
|
if (s.current = null, window.clearInterval(u.current.timer), u.current.escape && document.removeEventListener("keydown", u.current.escape), l && e.get(l.id)?.style.removeProperty("transform"), a(null), !!l?.started) {
|
|
117
|
-
if (!d) return
|
|
117
|
+
if (!d) return M(o[l.from].title);
|
|
118
118
|
i(l.id, o[l.target].id);
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
ue(() => {
|
|
122
|
-
|
|
122
|
+
m.current = { update: W, finish: q };
|
|
123
123
|
});
|
|
124
|
-
const
|
|
125
|
-
const h =
|
|
126
|
-
if (
|
|
124
|
+
const G = (d, l) => (b) => {
|
|
125
|
+
const h = b.target;
|
|
126
|
+
if (b.button > 0 || h.closest("button") || !b.currentTarget.contains(h)) return;
|
|
127
127
|
const p = e.get(d).getBoundingClientRect();
|
|
128
|
-
s.current = { id: d, from: l, x0:
|
|
129
|
-
},
|
|
128
|
+
s.current = { id: d, from: l, x0: b.clientX, y0: b.clientY, x: b.clientX, y: b.clientY, dx: b.clientX - p.left, dy: b.clientY - p.top, started: !1, target: l }, b.currentTarget.setPointerCapture(b.pointerId);
|
|
129
|
+
}, I = (d) => {
|
|
130
130
|
const l = s.current;
|
|
131
131
|
if (l) {
|
|
132
132
|
if (l.x = d.clientX, l.y = d.clientY, !l.started) {
|
|
133
133
|
if (Math.hypot(l.x - l.x0, l.y - l.y0) <= 4) return;
|
|
134
|
-
l.started = !0, a({ id: l.id, target: l.from }), u.current.escape = (
|
|
134
|
+
l.started = !0, a({ id: l.id, target: l.from }), u.current.escape = (b) => b.key === "Escape" && m.current.finish(!1), document.addEventListener("keydown", u.current.escape), u.current.timer = window.setInterval(() => {
|
|
135
135
|
const h = s.current?.y ?? window.innerHeight / 2, p = Math.ceil((64 - Math.min(h, window.innerHeight - h)) / 4);
|
|
136
|
-
p <= 0 || (window.scrollBy(0, h < window.innerHeight / 2 ? -p : p),
|
|
136
|
+
p <= 0 || (window.scrollBy(0, h < window.innerHeight / 2 ? -p : p), m.current.update());
|
|
137
137
|
}, 16);
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
m.current.update();
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
return {
|
|
143
|
-
drag:
|
|
143
|
+
drag: y,
|
|
144
144
|
/** To go on the placeholder. */
|
|
145
|
-
placeholder:
|
|
145
|
+
placeholder: k,
|
|
146
146
|
/** The pointer handlers of a widget's head. */
|
|
147
147
|
handlers: (d, l) => ({
|
|
148
|
-
onPointerDown:
|
|
149
|
-
onPointerMove:
|
|
150
|
-
onPointerUp: () =>
|
|
151
|
-
onPointerCancel: () =>
|
|
148
|
+
onPointerDown: G(d, l),
|
|
149
|
+
onPointerMove: I,
|
|
150
|
+
onPointerUp: () => m.current.finish(!0),
|
|
151
|
+
onPointerCancel: () => m.current.finish(!1)
|
|
152
152
|
})
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Me(t) {
|
|
156
156
|
return null;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function Mt() {
|
|
159
159
|
return null;
|
|
160
160
|
}
|
|
161
|
-
const
|
|
162
|
-
function
|
|
161
|
+
const St = "heading", Z = (t, e) => t.title?.(e) ?? t.label;
|
|
162
|
+
function vt({ options: t, change: e }) {
|
|
163
163
|
const o = de();
|
|
164
|
-
return /* @__PURE__ */ r(
|
|
164
|
+
return /* @__PURE__ */ r(Te, { label: o.dashboardHeadingField, children: /* @__PURE__ */ r(De, { value: t.text, onChange: (i) => e({ text: i.target.value }) }) });
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function Ct(t) {
|
|
167
167
|
return {
|
|
168
|
-
name:
|
|
168
|
+
name: St,
|
|
169
169
|
label: t.dashboardHeadingLabel,
|
|
170
170
|
sentence: t.dashboardHeadingSentence,
|
|
171
171
|
sizes: { full: { columns: 12, rows: 1 } },
|
|
172
172
|
start: "full",
|
|
173
173
|
defaultOptions: { text: t.dashboardHeadingText },
|
|
174
174
|
title: (e) => e.text || t.dashboardHeadingLabel,
|
|
175
|
-
form:
|
|
175
|
+
form: vt,
|
|
176
176
|
children: () => null
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
-
const ee = (...t) => t.filter(Boolean).join(" "),
|
|
179
|
+
const ee = (...t) => t.filter(Boolean).join(" "), be = 12;
|
|
180
180
|
function Nt({ render: t, ...e }) {
|
|
181
181
|
return t(e);
|
|
182
182
|
}
|
|
183
|
-
const
|
|
183
|
+
const ye = (t, e) => ({ "--_dashboard-column": t.column + 1, "--_dashboard-row": t.row + 1, "--_dashboard-columns": t.columns, "--_dashboard-rows": t.rows, "--_dashboard-order": e }), we = (t) => t.columns * t.rows;
|
|
184
184
|
function Ot({ title: t, editing: e, children: o }) {
|
|
185
|
-
const i =
|
|
185
|
+
const i = L(null), [M, y] = K(!1);
|
|
186
186
|
re(() => {
|
|
187
187
|
const s = i.current;
|
|
188
188
|
if (!s) return;
|
|
189
|
-
const u = () =>
|
|
189
|
+
const u = () => y(s.scrollHeight > s.clientHeight || s.scrollWidth > s.clientWidth), c = new ResizeObserver(u), k = () => {
|
|
190
190
|
c.disconnect(), c.observe(s);
|
|
191
|
-
for (const
|
|
191
|
+
for (const S of s.children) c.observe(S);
|
|
192
192
|
u();
|
|
193
|
-
},
|
|
194
|
-
return
|
|
195
|
-
c.disconnect(),
|
|
193
|
+
}, m = new MutationObserver(k);
|
|
194
|
+
return m.observe(s, { childList: !0 }), k(), () => {
|
|
195
|
+
c.disconnect(), m.disconnect();
|
|
196
196
|
};
|
|
197
197
|
}, []);
|
|
198
|
-
const a =
|
|
198
|
+
const a = M && !e;
|
|
199
199
|
return /* @__PURE__ */ r("div", { ref: i, className: _.body, inert: e, ...a ? { role: "group", tabIndex: 0, "aria-label": t } : {}, children: o });
|
|
200
200
|
}
|
|
201
201
|
const se = (t, e) => (o) => {
|
|
202
202
|
o ? t.set(e, o) : t.delete(e);
|
|
203
203
|
};
|
|
204
|
-
function Ht({ view: t, editor: e, className: o, children: i, catalogue:
|
|
205
|
-
const s = de(), u = ie(() =>
|
|
204
|
+
function Ht({ view: t, editor: e, className: o, children: i, catalogue: M, headingLevel: y = 2, ...a }) {
|
|
205
|
+
const s = de(), u = ie(() => Ct(s), [s]), c = /* @__PURE__ */ new Map();
|
|
206
206
|
for (const n of Ee.toArray(i))
|
|
207
|
-
he(n) && n.type ===
|
|
208
|
-
const { register:
|
|
209
|
-
re(() =>
|
|
210
|
-
const
|
|
211
|
-
const f = c.get(n.type),
|
|
212
|
-
return f &&
|
|
213
|
-
}),
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
}, { drag: E, placeholder:
|
|
217
|
-
grid:
|
|
218
|
-
cards:
|
|
219
|
-
shown:
|
|
207
|
+
he(n) && n.type === Me ? c.set(n.props.name, n.props) : he(n) && n.type === Mt && c.set(u.name, u);
|
|
208
|
+
const { register: k } = e;
|
|
209
|
+
re(() => k(c));
|
|
210
|
+
const m = ze(t, c), S = m.widgets.flatMap((n) => {
|
|
211
|
+
const f = c.get(n.type), z = f?.sizes[n.size];
|
|
212
|
+
return f && z ? [{ widget: n, type: f, span: z }] : [];
|
|
213
|
+
}), q = `h${Math.min(6, y + (S.some(({ type: n }) => n === u) ? 1 : 0))}`, G = L(null), [I] = K(() => /* @__PURE__ */ new Map()), [d] = K(() => /* @__PURE__ */ new Map()), [l] = K(() => /* @__PURE__ */ new Map()), b = L(null), { editing: h } = e, p = m.widgets.length, H = (n, f, z) => {
|
|
214
|
+
const C = m.widgets.findIndex((N) => N.id === n), v = Math.max(0, Math.min(p - 1, z));
|
|
215
|
+
C !== v && (e.step(Ve(n, v)), V(s.dashboardMoved(f, C + 1, v + 1, p)));
|
|
216
|
+
}, { drag: E, placeholder: Y, handlers: X } = xt({
|
|
217
|
+
grid: G,
|
|
218
|
+
cards: I,
|
|
219
|
+
shown: S.map(({ widget: n, type: f, span: z }) => ({ id: n.id, span: z, title: Z(f, n.options) })),
|
|
220
220
|
drop: (n, f) => {
|
|
221
|
-
const
|
|
222
|
-
H(n, Z(
|
|
221
|
+
const z = S.find((C) => C.widget.id === n);
|
|
222
|
+
H(n, Z(z.type, z.widget.options), m.widgets.findIndex((C) => C.id === f));
|
|
223
223
|
},
|
|
224
|
-
cancelled: (n) =>
|
|
225
|
-
}),
|
|
226
|
-
|
|
227
|
-
const
|
|
224
|
+
cancelled: (n) => V(s.dashboardDragCancelled(n))
|
|
225
|
+
}), A = E ? S.findIndex((n) => n.widget.id === E.id) : -1, F = S.map((n, f) => f);
|
|
226
|
+
A >= 0 && F.splice(E.target, 0, ...F.splice(A, 1));
|
|
227
|
+
const w = xe(F.map((n) => S[n].span), be), g = S.map((n, f) => w[F.indexOf(f)]), [x, O] = K(null), P = L(null), B = L(null);
|
|
228
228
|
re(() => {
|
|
229
|
-
|
|
229
|
+
B.current && (I.get(B.current)?.scrollIntoView?.({ block: "nearest" }), B.current = null);
|
|
230
230
|
});
|
|
231
|
-
const
|
|
231
|
+
const T = L(!1);
|
|
232
232
|
re(() => {
|
|
233
|
-
|
|
233
|
+
T.current !== !1 && ((T.current === null ? b.current : d.get(T.current))?.focus(), T.current = !1);
|
|
234
234
|
});
|
|
235
|
-
const
|
|
236
|
-
const f = { id:
|
|
237
|
-
|
|
238
|
-
}, oe =
|
|
235
|
+
const Se = [...c.values()].filter((n) => !M || M.includes(n.name)), ve = (n) => {
|
|
236
|
+
const f = { id: Ye(m, n.name), type: n.name, size: n.start, options: n.defaultOptions };
|
|
237
|
+
B.current = f.id, e.step(Xe(f)), V(s.dashboardAdded(Z(n, f.options), p + 1, p + 1));
|
|
238
|
+
}, oe = x ? c.get(m.widgets.find((n) => n.id === x)?.type ?? "") : void 0, ae = m.widgets.find((n) => n.id === x), Ce = (n, f, z, C, v) => h ? {
|
|
239
239
|
ref: se(d, n.id),
|
|
240
240
|
className: ee(_.head, _.editingHead),
|
|
241
|
-
...
|
|
241
|
+
...X(n.id, z),
|
|
242
242
|
role: "group",
|
|
243
243
|
tabIndex: 0,
|
|
244
|
-
"aria-label": (
|
|
244
|
+
"aria-label": (v ? s.dashboardHeadLocked : s.dashboardHead)(f, C + 1, p),
|
|
245
245
|
onKeyDown: (N) => {
|
|
246
246
|
if (N.target !== N.currentTarget) return;
|
|
247
|
-
const
|
|
248
|
-
|
|
247
|
+
const $ = { ArrowLeft: C - 1, ArrowUp: C - 1, ArrowRight: C + 1, ArrowDown: C + 1, Home: 0, End: p - 1 }[N.key];
|
|
248
|
+
$ !== void 0 && (N.preventDefault(), H(n.id, f, $));
|
|
249
249
|
}
|
|
250
|
-
} : { className: _.head }, Ne = (n, f,
|
|
251
|
-
const
|
|
250
|
+
} : { className: _.head }, Ne = (n, f, z, C, v, N) => {
|
|
251
|
+
const $ = Object.entries(f.sizes).sort(([, D], [, J]) => we(D) - we(J));
|
|
252
252
|
return /* @__PURE__ */ R(
|
|
253
|
-
|
|
253
|
+
Ue,
|
|
254
254
|
{
|
|
255
255
|
align: "end",
|
|
256
|
-
trigger: /* @__PURE__ */ r(
|
|
256
|
+
trigger: /* @__PURE__ */ r(j, { ref: se(l, n.id), size: "sm", variant: "ghost", "aria-label": s.dashboardMenu(z), children: /* @__PURE__ */ r("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", children: /* @__PURE__ */ r("path", { d: "M1.5 5h.01M5 5h.01M8.5 5h.01" }) }) }),
|
|
257
257
|
children: [
|
|
258
|
-
/* @__PURE__ */ r(
|
|
259
|
-
/* @__PURE__ */ r(
|
|
260
|
-
/* @__PURE__ */ r(
|
|
261
|
-
/* @__PURE__ */ r(
|
|
262
|
-
/* @__PURE__ */ r(
|
|
258
|
+
/* @__PURE__ */ r(U, { disabled: !0, children: s.dashboardPlace(v + 1, p) }),
|
|
259
|
+
/* @__PURE__ */ r(U, { disabled: v === 0, onSelect: () => H(n.id, z, 0), children: s.dashboardMoveStart }),
|
|
260
|
+
/* @__PURE__ */ r(U, { disabled: v === 0, onSelect: () => H(n.id, z, v - 1), children: s.dashboardMoveEarlier }),
|
|
261
|
+
/* @__PURE__ */ r(U, { disabled: v === p - 1, onSelect: () => H(n.id, z, v + 1), children: s.dashboardMoveLater }),
|
|
262
|
+
/* @__PURE__ */ r(U, { disabled: v === p - 1, onSelect: () => H(n.id, z, p - 1), children: s.dashboardMoveEnd }),
|
|
263
263
|
N && /* @__PURE__ */ R(ne, { children: [
|
|
264
264
|
/* @__PURE__ */ r(te, {}),
|
|
265
|
-
/* @__PURE__ */ r(
|
|
265
|
+
/* @__PURE__ */ r(U, { disabled: !0, children: s.dashboardLockedLine })
|
|
266
266
|
] }),
|
|
267
|
-
!N &&
|
|
267
|
+
!N && $.length > 1 && /* @__PURE__ */ R(ne, { children: [
|
|
268
268
|
/* @__PURE__ */ r(te, {}),
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
$.map(([D, J]) => /* @__PURE__ */ r(
|
|
270
|
+
U,
|
|
271
271
|
{
|
|
272
|
-
"aria-current":
|
|
272
|
+
"aria-current": D === n.size || void 0,
|
|
273
273
|
onSelect: () => {
|
|
274
|
-
e.step(
|
|
274
|
+
e.step(We(n.id, D)), V(s.dashboardResized(z, s.dashboardSizes[D]));
|
|
275
275
|
},
|
|
276
|
-
children: s.dashboardSizeEntry(s.dashboardSizes[
|
|
276
|
+
children: s.dashboardSizeEntry(s.dashboardSizes[D], zt(J), D === n.size)
|
|
277
277
|
},
|
|
278
|
-
|
|
278
|
+
D
|
|
279
279
|
))
|
|
280
280
|
] }),
|
|
281
281
|
!N && f.form && /* @__PURE__ */ R(ne, { children: [
|
|
282
282
|
/* @__PURE__ */ r(te, {}),
|
|
283
283
|
/* @__PURE__ */ r(
|
|
284
|
-
|
|
284
|
+
U,
|
|
285
285
|
{
|
|
286
286
|
onSelect: () => {
|
|
287
|
-
|
|
287
|
+
P.current = l.get(n.id) ?? null, O(n.id);
|
|
288
288
|
},
|
|
289
289
|
children: s.dashboardOptions
|
|
290
290
|
}
|
|
@@ -292,11 +292,11 @@ function Ht({ view: t, editor: e, className: o, children: i, catalogue: S, headi
|
|
|
292
292
|
] }),
|
|
293
293
|
!N && /* @__PURE__ */ r(te, {}),
|
|
294
294
|
!N && /* @__PURE__ */ r(
|
|
295
|
-
|
|
295
|
+
U,
|
|
296
296
|
{
|
|
297
297
|
tone: "danger",
|
|
298
298
|
onSelect: () => {
|
|
299
|
-
|
|
299
|
+
T.current = (S[C + 1] ?? S[C - 1])?.widget.id ?? null, e.step(Ge(n.id)), V(s.dashboardRemoved(z));
|
|
300
300
|
},
|
|
301
301
|
children: s.dashboardRemove
|
|
302
302
|
}
|
|
@@ -308,136 +308,136 @@ function Ht({ view: t, editor: e, className: o, children: i, catalogue: S, headi
|
|
|
308
308
|
return /* @__PURE__ */ R("div", { role: "group", className: ee(_.root, o), "data-editing": h || void 0, ...a, children: [
|
|
309
309
|
e.allowed && /* @__PURE__ */ r("div", { className: _.bar, children: h ? /* @__PURE__ */ R(ne, { children: [
|
|
310
310
|
/* @__PURE__ */ r("span", { className: _.mode, children: s.dashboardEditing }),
|
|
311
|
-
/* @__PURE__ */ r(
|
|
312
|
-
/* @__PURE__ */ r(
|
|
313
|
-
/* @__PURE__ */ r(
|
|
314
|
-
/* @__PURE__ */ r(
|
|
315
|
-
/* @__PURE__ */ r(
|
|
316
|
-
/* @__PURE__ */ r(
|
|
317
|
-
] }) : /* @__PURE__ */ r(
|
|
311
|
+
/* @__PURE__ */ r(j, { size: "sm", disabled: !e.canUndo, onClick: e.undo, children: s.dashboardUndo }),
|
|
312
|
+
/* @__PURE__ */ r(j, { size: "sm", disabled: !e.canRedo, onClick: e.redo, children: s.dashboardRedo }),
|
|
313
|
+
/* @__PURE__ */ r(j, { size: "sm", disabled: !e.canReset, onClick: e.reset, children: s.dashboardReset }),
|
|
314
|
+
/* @__PURE__ */ r(j, { ref: b, size: "sm", onClick: () => e.setCatalogue(!0), children: s.dashboardAddWidget }),
|
|
315
|
+
/* @__PURE__ */ r(j, { size: "sm", onClick: e.cancel, children: s.dashboardCancel }),
|
|
316
|
+
/* @__PURE__ */ r(j, { size: "sm", variant: "primary", onClick: e.done, children: s.dashboardDone })
|
|
317
|
+
] }) : /* @__PURE__ */ r(j, { size: "sm", onClick: e.edit, children: s.dashboardEdit }) }),
|
|
318
318
|
h && p === 0 && /* @__PURE__ */ r(Q, { children: s.dashboardEmptyEditing }),
|
|
319
319
|
!h && p === 0 && /* @__PURE__ */ r(Q, { children: s.dashboardEmpty }),
|
|
320
|
-
/* @__PURE__ */ R("div", { className: _.grid, ref:
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
return f === u ? /* @__PURE__ */ r("div", { ref: se(
|
|
320
|
+
/* @__PURE__ */ R("div", { className: _.grid, ref: G, children: [
|
|
321
|
+
S.map(({ widget: n, type: f }, z) => {
|
|
322
|
+
const C = ye(g[z], F.indexOf(z)), v = Z(f, n.options), N = m.widgets.findIndex((Oe) => Oe.id === n.id), $ = n.locked === !0, D = Ce(n, v, z, N, $), J = h && Ne(n, f, v, z, N, $);
|
|
323
|
+
return f === u ? /* @__PURE__ */ r("div", { ref: se(I, n.id), className: ee(_.item, _.headingRow), style: C, "data-widget": n.id, "data-editing": h || void 0, "data-dragging": E?.id === n.id || void 0, children: /* @__PURE__ */ R("div", { ...D, className: ee(D.className, _.headingHead), children: [
|
|
324
324
|
h && /* @__PURE__ */ r(pe, { className: _.grip }),
|
|
325
|
-
/* @__PURE__ */ r(
|
|
326
|
-
h &&
|
|
327
|
-
|
|
328
|
-
] }) }, n.id) : /* @__PURE__ */ R(
|
|
329
|
-
/* @__PURE__ */ R("div", { ...
|
|
325
|
+
/* @__PURE__ */ r(Ae, { level: y, size: "lg", className: _.heading, children: n.options.text }),
|
|
326
|
+
h && $ && /* @__PURE__ */ r("span", { className: _.size, children: s.dashboardLocked }),
|
|
327
|
+
J
|
|
328
|
+
] }) }, n.id) : /* @__PURE__ */ R(Ie, { ref: se(I, n.id), className: _.item, style: C, "data-widget": n.id, "data-editing": h || void 0, "data-dragging": E?.id === n.id || void 0, "aria-label": v, children: [
|
|
329
|
+
/* @__PURE__ */ R("div", { ...D, children: [
|
|
330
330
|
h && /* @__PURE__ */ r(pe, { className: _.grip }),
|
|
331
|
-
/* @__PURE__ */ r(
|
|
331
|
+
/* @__PURE__ */ r(q, { className: _.title, children: v }),
|
|
332
332
|
h && /* @__PURE__ */ r("span", { className: _.size, children: s.dashboardSizes[n.size] }),
|
|
333
|
-
h &&
|
|
334
|
-
|
|
333
|
+
h && $ && /* @__PURE__ */ r("span", { className: _.size, children: s.dashboardLocked }),
|
|
334
|
+
J
|
|
335
335
|
] }),
|
|
336
|
-
/* @__PURE__ */ r(Ot, { title:
|
|
336
|
+
/* @__PURE__ */ r(Ot, { title: v, editing: h, children: /* @__PURE__ */ r(mt, { size: n.size, options: n.options, fallback: /* @__PURE__ */ r(Q, { tone: "secondary", children: s.dashboardFailed }), children: /* @__PURE__ */ r(Re, { fallback: /* @__PURE__ */ r($e, { width: "100%", height: "100%" }), children: /* @__PURE__ */ r(Nt, { render: f.children, size: n.size, options: n.options }) }) }) })
|
|
337
337
|
] }, n.id);
|
|
338
338
|
}),
|
|
339
|
-
|
|
339
|
+
A >= 0 && /* @__PURE__ */ r("div", { ref: Y, "aria-hidden": "true", "data-placeholder": !0, className: ee(_.item, _.placeholder), style: ye(g[A], E.target) })
|
|
340
340
|
] }),
|
|
341
|
-
/* @__PURE__ */ R(
|
|
342
|
-
/* @__PURE__ */ r(
|
|
343
|
-
/* @__PURE__ */ r(
|
|
341
|
+
/* @__PURE__ */ R(Fe, { open: e.catalogue, onClose: () => e.setCatalogue(!1), children: [
|
|
342
|
+
/* @__PURE__ */ r(Pe, { title: s.dashboardCatalogue, description: s.dashboardCatalogueSentence }),
|
|
343
|
+
/* @__PURE__ */ r(Be, { children: /* @__PURE__ */ r("ul", { className: _.catalogue, children: Se.map((n) => {
|
|
344
344
|
const f = n.sizes[n.start];
|
|
345
345
|
return /* @__PURE__ */ R("li", { className: _.entry, children: [
|
|
346
|
-
/* @__PURE__ */ r("div", { className: _.footprint, role: "img", "aria-label": s.dashboardFootprint(f.columns, f.rows), children: /* @__PURE__ */ r("span", { style: { width: `${f.columns /
|
|
346
|
+
/* @__PURE__ */ r("div", { className: _.footprint, role: "img", "aria-label": s.dashboardFootprint(f.columns, f.rows), children: /* @__PURE__ */ r("span", { style: { width: `${f.columns / be * 100}%`, height: `${Math.min(1, f.rows / 4) * 100}%` } }) }),
|
|
347
347
|
/* @__PURE__ */ R("div", { className: _.entryText, children: [
|
|
348
348
|
/* @__PURE__ */ r(Q, { as: "strong", weight: "semibold", children: n.label }),
|
|
349
349
|
/* @__PURE__ */ r(Q, { as: "span", size: "sm", tone: "secondary", children: n.sentence })
|
|
350
350
|
] }),
|
|
351
|
-
/* @__PURE__ */ r(
|
|
351
|
+
/* @__PURE__ */ r(j, { size: "sm", "aria-label": s.dashboardAddType(n.label), onClick: () => ve(n), children: s.dashboardAdd })
|
|
352
352
|
] }, n.name);
|
|
353
353
|
}) }) })
|
|
354
354
|
] }),
|
|
355
|
-
oe?.form && ae && /* @__PURE__ */ r(
|
|
355
|
+
oe?.form && ae && /* @__PURE__ */ r(je, { open: !0, anchorRef: P, align: "end", onOpenChange: () => O(null), role: "dialog", "aria-label": s.dashboardOptions, children: /* @__PURE__ */ r("div", { className: _.options, children: oe.form({
|
|
356
356
|
options: ae.options,
|
|
357
357
|
change: (n) => {
|
|
358
|
-
e.step(
|
|
358
|
+
e.step(Je(ae.id, n)), V(s.dashboardOptionsChanged(Z(oe, n)));
|
|
359
359
|
}
|
|
360
360
|
}) }) })
|
|
361
361
|
] });
|
|
362
362
|
}
|
|
363
363
|
const _e = (t, e) => JSON.stringify(t) === JSON.stringify(e);
|
|
364
|
-
function
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
const a =
|
|
368
|
-
u.current = { defaultView: t, allowEdit: o, onViewChange: i, onDraftChange:
|
|
364
|
+
function Tt({ defaultView: t, initialView: e, allowEdit: o = !0, onViewChange: i, onDraftChange: M }) {
|
|
365
|
+
const y = L(null);
|
|
366
|
+
y.current ??= { state: { view: ge(e) ? e : t, draft: null, known: 0 }, listeners: /* @__PURE__ */ new Set(), types: /* @__PURE__ */ new Map(), signature: "" };
|
|
367
|
+
const a = y.current, s = de(), u = L({ defaultView: t, allowEdit: o, onViewChange: i, onDraftChange: M, wording: s });
|
|
368
|
+
u.current = { defaultView: t, allowEdit: o, onViewChange: i, onDraftChange: M, wording: s };
|
|
369
369
|
const c = ie(() => {
|
|
370
|
-
const
|
|
371
|
-
a.state =
|
|
372
|
-
}, l = (
|
|
370
|
+
const G = (w) => (a.listeners.add(w), () => void a.listeners.delete(w)), I = () => a.state, d = (w) => {
|
|
371
|
+
a.state = w, a.listeners.forEach((g) => g());
|
|
372
|
+
}, l = (w) => a.types.size ? ze(w, a.types) : bt(w), b = () => {
|
|
373
373
|
!u.current.allowEdit || a.state.draft || (d({ ...a.state, draft: { steps: [l(a.state.view)], at: 0 } }), u.current.onDraftChange?.(!0));
|
|
374
|
-
}, h = (
|
|
375
|
-
const { view: g, draft:
|
|
376
|
-
if (!
|
|
377
|
-
const O =
|
|
378
|
-
d({ ...a.state, view:
|
|
379
|
-
const { wording:
|
|
380
|
-
|
|
381
|
-
}, p = (
|
|
382
|
-
a.state.draft && d({ ...a.state, catalogue:
|
|
383
|
-
}, H = (
|
|
374
|
+
}, h = (w) => {
|
|
375
|
+
const { view: g, draft: x } = a.state;
|
|
376
|
+
if (!x) return;
|
|
377
|
+
const O = x.steps[x.at], P = w && !_e(O, l(g)), B = { ...O, widgets: [...O.widgets, ...yt(g, x.steps[0])] };
|
|
378
|
+
d({ ...a.state, view: P ? B : g, draft: null, catalogue: !1 }), u.current.onDraftChange?.(!1);
|
|
379
|
+
const { wording: T } = u.current;
|
|
380
|
+
V(w ? P ? T.dashboardKept : T.dashboardLeft : T.dashboardCancelled), P && u.current.onViewChange?.(B);
|
|
381
|
+
}, p = (w) => {
|
|
382
|
+
a.state.draft && d({ ...a.state, catalogue: w });
|
|
383
|
+
}, H = (w) => {
|
|
384
384
|
const { draft: g } = a.state;
|
|
385
385
|
if (!g) return;
|
|
386
|
-
const
|
|
387
|
-
O !==
|
|
388
|
-
}, E = (
|
|
389
|
-
const { draft:
|
|
390
|
-
|
|
391
|
-
},
|
|
392
|
-
a.state.draft && (H(() => l(u.current.defaultView)),
|
|
393
|
-
},
|
|
394
|
-
allowed:
|
|
386
|
+
const x = g.steps[g.at], O = w(x);
|
|
387
|
+
O !== x && d({ ...a.state, draft: { steps: [...g.steps.slice(0, g.at + 1), O], at: g.at + 1 } });
|
|
388
|
+
}, E = (w, g) => {
|
|
389
|
+
const { draft: x } = a.state;
|
|
390
|
+
x?.steps[x.at + w] && (d({ ...a.state, draft: { ...x, at: x.at + w } }), V(g));
|
|
391
|
+
}, Y = () => E(-1, u.current.wording.dashboardUndone), X = () => E(1, u.current.wording.dashboardRedone), A = () => {
|
|
392
|
+
a.state.draft && (H(() => l(u.current.defaultView)), V(u.current.wording.dashboardResetDone));
|
|
393
|
+
}, F = (w, g, x) => ({
|
|
394
|
+
allowed: w,
|
|
395
395
|
editing: g !== null,
|
|
396
|
-
edit:
|
|
396
|
+
edit: b,
|
|
397
397
|
done: () => h(!0),
|
|
398
398
|
cancel: () => h(!1),
|
|
399
|
-
catalogue:
|
|
399
|
+
catalogue: x,
|
|
400
400
|
setCatalogue: p,
|
|
401
401
|
register: (O) => {
|
|
402
402
|
a.types = O;
|
|
403
|
-
const
|
|
404
|
-
|
|
403
|
+
const P = [...O].map(([B, T]) => `${B}:${T.start}:${JSON.stringify(T.sizes)}`).join("|");
|
|
404
|
+
P !== a.signature && (a.signature = P, d({ ...a.state, known: a.state.known + 1 }));
|
|
405
405
|
},
|
|
406
406
|
step: H,
|
|
407
|
-
undo:
|
|
408
|
-
redo:
|
|
409
|
-
reset:
|
|
407
|
+
undo: Y,
|
|
408
|
+
redo: X,
|
|
409
|
+
reset: A,
|
|
410
410
|
canUndo: !!g && g.at > 0,
|
|
411
411
|
canRedo: !!g && g.at < g.steps.length - 1,
|
|
412
412
|
canReset: !!g && !_e(g.steps[g.at], l(u.current.defaultView))
|
|
413
413
|
});
|
|
414
414
|
return {
|
|
415
|
-
get:
|
|
416
|
-
subscribe:
|
|
417
|
-
edit:
|
|
415
|
+
get: I,
|
|
416
|
+
subscribe: G,
|
|
417
|
+
edit: b,
|
|
418
418
|
done: () => h(!0),
|
|
419
419
|
cancel: () => h(!1),
|
|
420
|
-
undo:
|
|
421
|
-
redo:
|
|
422
|
-
reset:
|
|
420
|
+
undo: Y,
|
|
421
|
+
redo: X,
|
|
422
|
+
reset: A,
|
|
423
423
|
catalogue: () => p(!0),
|
|
424
424
|
read: l,
|
|
425
|
-
setView: (
|
|
426
|
-
const g = ge(
|
|
425
|
+
setView: (w) => {
|
|
426
|
+
const g = ge(w) ? w : u.current.defaultView;
|
|
427
427
|
d({ ...a.state, view: g, draft: a.state.draft ? { steps: [l(g)], at: 0 } : null });
|
|
428
428
|
},
|
|
429
|
-
Dashboard: (
|
|
430
|
-
const { view: g, draft:
|
|
431
|
-
return
|
|
429
|
+
Dashboard: (w) => {
|
|
430
|
+
const { view: g, draft: x, catalogue: O } = fe(G, I, I);
|
|
431
|
+
return Le(Ht, { ...w, view: x ? x.steps[x.at] : g, editor: F(u.current.allowEdit, x, !!O) });
|
|
432
432
|
}
|
|
433
433
|
};
|
|
434
|
-
}, [a]), { view:
|
|
434
|
+
}, [a]), { view: k, draft: m, known: S } = fe(c.subscribe, c.get, c.get), W = m ? m.steps[m.at] : k, q = ie(() => c.read(W), [c, W, S]);
|
|
435
435
|
return {
|
|
436
436
|
Dashboard: c.Dashboard,
|
|
437
|
-
WidgetType:
|
|
438
|
-
view:
|
|
437
|
+
WidgetType: Me,
|
|
438
|
+
view: q,
|
|
439
439
|
setView: c.setView,
|
|
440
|
-
editing:
|
|
440
|
+
editing: m !== null,
|
|
441
441
|
edit: c.edit,
|
|
442
442
|
done: c.done,
|
|
443
443
|
cancel: c.cancel,
|
|
@@ -448,7 +448,7 @@ function Lt({ defaultView: t, initialView: e, allowEdit: o = !0, onViewChange: i
|
|
|
448
448
|
};
|
|
449
449
|
}
|
|
450
450
|
export {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
451
|
+
Mt as HeadingType,
|
|
452
|
+
Me as WidgetType,
|
|
453
|
+
Tt as useDashboard
|
|
454
454
|
};
|
package/docs/llms-full.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @umriss-ui/dashboard 0.
|
|
1
|
+
# @umriss-ui/dashboard 0.50.0
|
|
2
2
|
|
|
3
3
|
> React dashboard for data-dense applications - widgets a reader arranges, packed in order on twelve columns.
|
|
4
4
|
|
|
@@ -1160,7 +1160,7 @@ Declares no props of its own.
|
|
|
1160
1160
|
- 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)).
|
|
1161
1161
|
- Where an arrangement is stored, which default a role gets, several dashboards and what stands in a widget are the application's.
|
|
1162
1162
|
|
|
1163
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/dashboard-v0.
|
|
1163
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/dashboard-v0.50.0/docs/adr/0032-what-umriss-is-not.md).
|
|
1164
1164
|
|
|
1165
1165
|
## API index
|
|
1166
1166
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umriss-ui/dashboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.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,14 +54,14 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@umriss-ui/core": "^0.
|
|
57
|
+
"@umriss-ui/core": "^0.50.0",
|
|
58
58
|
"react": ">=19",
|
|
59
59
|
"react-dom": ">=19"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@fontsource/geist-mono": "^5.3.0",
|
|
63
63
|
"@fontsource/geist-sans": "^5.3.0",
|
|
64
|
-
"@umriss-ui/core": "0.
|
|
64
|
+
"@umriss-ui/core": "0.50.0",
|
|
65
65
|
"@umriss-ui/demo": "0.0.0",
|
|
66
66
|
"@types/node": "^22.20.2",
|
|
67
67
|
"@types/react": "^19.0.0",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"build:demo": "vite build --config vite.demo.config.ts",
|
|
83
83
|
"typecheck": "tsc --noEmit",
|
|
84
84
|
"typecheck:demo": "pnpm run props && tsc --noEmit -p tsconfig.demo.json",
|
|
85
|
-
"check:site": "pnpm run props -- --check",
|
|
86
|
-
"preview:demo": "
|
|
85
|
+
"check:site": "pnpm run props -- --check && node --disable-warning=ExperimentalWarning --experimental-strip-types ../../scripts/checkReadmeLinks.ts",
|
|
86
|
+
"preview:demo": "node ../../scripts/preview.mjs dashboard",
|
|
87
87
|
"test:unit": "vitest run",
|
|
88
88
|
"check:dist": "node --disable-warning=ExperimentalWarning --experimental-strip-types ../../scripts/check-dist.ts dashboard.js dashboard.css"
|
|
89
89
|
}
|