@slotted/react 0.1.0-beta.15 → 0.1.0-beta.16
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/dist/{action-sheet-Klu-YxIk.js → action-sheet-dNnB26br.js} +20 -20
- package/dist/action-sheet.js +1 -1
- package/dist/{attachment-DKKiNUKe.js → attachment-C1wBuup6.js} +2 -0
- package/dist/attachment.js +1 -1
- package/dist/calendar-wqDIW4Z8.js +469 -0
- package/dist/calendar.js +1 -1
- package/dist/{column-manager-e234Ey_u.js → column-manager-C8fN_mDy.js} +6 -6
- package/dist/column-manager.js +1 -1
- package/dist/dashboard-grid-ByThIV_n.js +1066 -0
- package/dist/dashboard-grid.js +1 -1
- package/dist/{data-grid-B5feiNsE.js → data-grid-aHlR2FHu.js} +4 -4
- package/dist/data-grid.js +1 -1
- package/dist/{data-list-CUvUS2AX.js → data-list-Cu6LtnDX.js} +1 -1
- package/dist/data-list.js +1 -1
- package/dist/{date-picker-Dys-z9mZ.js → date-picker-B5V8NZCT.js} +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/{date-range-picker-Cu95hHyO.js → date-range-picker-B89Q973N.js} +1 -1
- package/dist/date-range-picker.js +1 -1
- package/dist/{datetime-picker-B7eWKoN3.js → datetime-picker-Cx6Z52Ka.js} +1 -1
- package/dist/datetime-picker.js +1 -1
- package/dist/{datetime-range-picker-Cm42pY3M.js → datetime-range-picker-DYshAlgq.js} +1 -1
- package/dist/datetime-range-picker.js +1 -1
- package/dist/docs/calendar.json +19 -1
- package/dist/docs/calendar.md +3 -1
- package/dist/docs/dashboard-grid.json +26 -4
- package/dist/docs/dashboard-grid.md +5 -2
- package/dist/docs/drawer.json +13 -4
- package/dist/docs/drawer.md +5 -4
- package/dist/docs/link.json +16 -0
- package/dist/docs/link.md +3 -1
- package/dist/docs/list-item.json +10 -2
- package/dist/docs/list-item.md +20 -13
- package/dist/docs/markdown.json +7 -0
- package/dist/docs/markdown.md +1 -0
- package/dist/docs/message-scroller.json +1 -1
- package/dist/docs/prompt-composer.json +9 -2
- package/dist/docs/prompt-composer.md +3 -1
- package/dist/{drawer-CFpBsLG6.js → drawer-Du1aC1px.js} +17 -4
- package/dist/drawer.js +2 -2
- package/dist/{event-calendar-liaKOKOH.js → event-calendar-CEIyV-fW.js} +520 -520
- package/dist/event-calendar.js +1 -1
- package/dist/{filter-bar-vJzwcDZj.js → filter-bar-BHzy0o7n.js} +8 -8
- package/dist/filter-bar.js +1 -1
- package/dist/{import-export-center-BIB7sRCl.js → import-export-center-BX1Bhj8c.js} +1 -1
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +124 -124
- package/dist/{link-rGL3Lr2t.js → link-YvD_Wov8.js} +23 -22
- package/dist/link.js +1 -1
- package/dist/list-item-2z75VYyp.js +160 -0
- package/dist/list-item.js +1 -1
- package/dist/markdown-gfrgwq6-.js +311 -0
- package/dist/markdown.js +1 -1
- package/dist/{prompt-composer-BDOi4rVK.js → prompt-composer-C57BzYrn.js} +109 -77
- package/dist/prompt-composer.js +2 -2
- package/dist/styles/action-sheet.css +1 -1
- package/dist/styles/calendar.css +3 -1
- package/dist/styles/chart.css +1 -1
- package/dist/styles/column-manager.css +1 -1
- package/dist/styles/command-palette.css +1 -1
- package/dist/styles/dashboard-grid.css +3 -1
- package/dist/styles/data-grid.css +1 -1
- package/dist/styles/date-picker.css +3 -1
- package/dist/styles/date-range-picker.css +3 -1
- package/dist/styles/datetime-picker.css +3 -1
- package/dist/styles/datetime-range-picker.css +3 -1
- package/dist/styles/detail-panel.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/event-calendar.css +1 -1
- package/dist/styles/filter-bar.css +4 -2
- package/dist/styles/import-export-center.css +2 -2
- package/dist/styles/index.css +11 -11
- package/dist/styles/link.css +1 -1
- package/dist/styles/markdown.css +1 -1
- package/dist/styles/message.css +1 -1
- package/dist/styles/prompt-composer.css +1 -1
- package/dist/styles/section.css +1 -1
- package/dist/styles/stat-card.css +1 -1
- package/dist/styles/table.css +2 -2
- package/dist/styles/upload.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/{table-_xX87qua.js → table-BHuKvsgJ.js} +4 -4
- package/dist/table.js +1 -1
- package/dist/types/calendar/calendar.d.ts +2 -1
- package/dist/types/calendar/calendar.d.ts.map +1 -1
- package/dist/types/calendar/calendar.types.d.ts +11 -0
- package/dist/types/calendar/calendar.types.d.ts.map +1 -1
- package/dist/types/calendar/index.d.ts +1 -1
- package/dist/types/calendar/index.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-grid.d.ts +1 -1
- package/dist/types/dashboard-grid/dashboard-grid.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-grid.types.d.ts +23 -3
- package/dist/types/dashboard-grid/dashboard-grid.types.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-widget.d.ts +1 -1
- package/dist/types/dashboard-grid/dashboard-widget.d.ts.map +1 -1
- package/dist/types/dashboard-grid/index.d.ts +1 -1
- package/dist/types/dashboard-grid/index.d.ts.map +1 -1
- package/dist/types/drawer/drawer-parts.d.ts +3 -1
- package/dist/types/drawer/drawer-parts.d.ts.map +1 -1
- package/dist/types/drawer/drawer.types.d.ts +2 -0
- package/dist/types/drawer/drawer.types.d.ts.map +1 -1
- package/dist/types/drawer/index.d.ts +2 -2
- package/dist/types/drawer/index.d.ts.map +1 -1
- package/dist/types/link/index.d.ts +1 -1
- package/dist/types/link/index.d.ts.map +1 -1
- package/dist/types/link/link.d.ts +1 -1
- package/dist/types/link/link.d.ts.map +1 -1
- package/dist/types/link/link.types.d.ts +7 -0
- package/dist/types/link/link.types.d.ts.map +1 -1
- package/dist/types/list-item/list-item-content.d.ts +3 -3
- package/dist/types/list-item/list-item-content.d.ts.map +1 -1
- package/dist/types/list-item/list-item-nesting.d.ts +15 -0
- package/dist/types/list-item/list-item-nesting.d.ts.map +1 -0
- package/dist/types/list-item/list-item-parts.d.ts +3 -3
- package/dist/types/list-item/list-item-parts.d.ts.map +1 -1
- package/dist/types/markdown/markdown.d.ts +1 -1
- package/dist/types/markdown/markdown.d.ts.map +1 -1
- package/dist/types/markdown/markdown.types.d.ts +6 -1
- package/dist/types/markdown/markdown.types.d.ts.map +1 -1
- package/dist/types/prompt-composer/index.d.ts +2 -2
- package/dist/types/prompt-composer/index.d.ts.map +1 -1
- package/dist/types/prompt-composer/prompt-composer.d.ts +8 -1
- package/dist/types/prompt-composer/prompt-composer.d.ts.map +1 -1
- package/dist/types/prompt-composer/prompt-composer.types.d.ts +7 -1
- package/dist/types/prompt-composer/prompt-composer.types.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/calendar-DZx00W81.js +0 -457
- package/dist/dashboard-grid-B9-_lwn6.js +0 -1048
- package/dist/list-item-CHaJYl5r.js +0 -125
- package/dist/markdown-B_lMpWz0.js +0 -306
|
@@ -1,1048 +0,0 @@
|
|
|
1
|
-
import { r as e } from "./i18n-D7xXDd8-.js";
|
|
2
|
-
import { n as t, t as n } from "./icon-D04-_QFA.js";
|
|
3
|
-
import { _ as r, c as i, d as a, g as o, n as s, p as c, t as l } from "./menu-parts-BDdCTmko.js";
|
|
4
|
-
/* empty css */
|
|
5
|
-
import { n as u, t as d } from "./icon-button-DbSZKGT4.js";
|
|
6
|
-
import { a as f, c as p, i as m, o as ee, s as h } from "./card-DRmq8_5e.js";
|
|
7
|
-
import { i as g, o as _, r as v } from "./skeleton-DeEOmm1y.js";
|
|
8
|
-
import { i as y, n as b, o as x, r as S, t as C } from "./result-state-BMYhelu1.js";
|
|
9
|
-
import { keyedProps as te, selectorKeyProps as ne, withSelectorKey as w } from "@slotted/core/selector-key";
|
|
10
|
-
import { createControllable as re } from "@slotted/core/state";
|
|
11
|
-
import { Children as ie, Fragment as ae, createContext as oe, isValidElement as se, memo as ce, useCallback as T, useContext as le, useEffect as ue, useId as de, useImperativeHandle as fe, useLayoutEffect as pe, useMemo as E, useRef as D, useState as me } from "react";
|
|
12
|
-
import { Fragment as he, jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
13
|
-
import { dashboardGridMessages as ge, dragMessages as _e } from "@slotted/core/i18n";
|
|
14
|
-
import { getLiveAnnouncer as ve } from "@slotted/core/live-announcer";
|
|
15
|
-
import { createDragController as A } from "@slotted/core/drag";
|
|
16
|
-
import { cellAt as ye, dashboardKeyIntent as be, gridStyle as xe, handleShortcuts as Se, layoutsEqual as Ce, materializeLayout as j, measureTiles as we, moveTile as M, moveTileBy as Te, parseDashboardLayout as N, parseDuration as Ee, playFlip as De, playResize as Oe, resizeTileBy as ke, resizeTileInClass as Ae, resolveColumns as je, resolveTiles as Me, serializeDashboardLayout as P, setTileHidden as F, sizeClassOf as Ne, spanFromTravel as Pe, swapTiles as Fe, tileStyle as Ie } from "@slotted/core/dashboard-grid";
|
|
17
|
-
//#region src/dashboard-grid/dashboard-grid-context.ts
|
|
18
|
-
var Le = oe(null);
|
|
19
|
-
function I(e) {
|
|
20
|
-
let t = le(Le);
|
|
21
|
-
if (t === null) throw Error(`${e} must be rendered inside a DashboardGrid`);
|
|
22
|
-
return t;
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region src/dashboard-grid/dashboard-grid-defaults.tsx
|
|
26
|
-
var L = {
|
|
27
|
-
columns: 12,
|
|
28
|
-
editBar: !0,
|
|
29
|
-
headingLevel: 3
|
|
30
|
-
}, R = oe(L);
|
|
31
|
-
function Re() {
|
|
32
|
-
return le(R);
|
|
33
|
-
}
|
|
34
|
-
function ze({ children: e, ...t }) {
|
|
35
|
-
let n = Re();
|
|
36
|
-
return /* @__PURE__ */ O(R.Provider, {
|
|
37
|
-
value: {
|
|
38
|
-
columns: t.columns ?? n.columns,
|
|
39
|
-
editBar: t.editBar ?? n.editBar,
|
|
40
|
-
headingLevel: t.headingLevel ?? n.headingLevel
|
|
41
|
-
},
|
|
42
|
-
children: e
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/dashboard-grid/dashboard-grid.tsx
|
|
47
|
-
var Be = [], z = "dashboard-grid", Ve = "\0placeholder";
|
|
48
|
-
function He(e, t, n, r = Object.is) {
|
|
49
|
-
let [i, a] = me(t), o = e === void 0 ? i : e, s = D({
|
|
50
|
-
controlled: e,
|
|
51
|
-
value: o,
|
|
52
|
-
onRequest: n,
|
|
53
|
-
equals: r
|
|
54
|
-
});
|
|
55
|
-
return s.current = {
|
|
56
|
-
controlled: e,
|
|
57
|
-
value: o,
|
|
58
|
-
onRequest: n,
|
|
59
|
-
equals: r
|
|
60
|
-
}, [o, T((e, t, n, r) => {
|
|
61
|
-
let { controlled: i, value: o, onRequest: c, equals: l } = s.current;
|
|
62
|
-
if (l(o, e)) return !1;
|
|
63
|
-
let u = !0;
|
|
64
|
-
return re({
|
|
65
|
-
controlled: i,
|
|
66
|
-
initial: o,
|
|
67
|
-
equals: l,
|
|
68
|
-
onRequest: (e) => {
|
|
69
|
-
c?.(e.value, Object.assign(e, r ?? {})), u = !e.cancelled;
|
|
70
|
-
}
|
|
71
|
-
}).request(e, t, n) && (s.current.value = e, a(e)), u;
|
|
72
|
-
}, [])];
|
|
73
|
-
}
|
|
74
|
-
function Ue(e) {
|
|
75
|
-
return e.detail === 0 ? "keyboard" : "pointer";
|
|
76
|
-
}
|
|
77
|
-
function We(e) {
|
|
78
|
-
return e === null || typeof getComputedStyle != "function" ? "ltr" : getComputedStyle(e).direction === "rtl" ? "rtl" : "ltr";
|
|
79
|
-
}
|
|
80
|
-
function Ge(e) {
|
|
81
|
-
return e !== null && e.clientWidth > 0 ? Ne(e.clientWidth) : "expanded";
|
|
82
|
-
}
|
|
83
|
-
function Ke(e) {
|
|
84
|
-
let { props: t } = e;
|
|
85
|
-
return {
|
|
86
|
-
key: t.value,
|
|
87
|
-
...t.defaultColumns === void 0 ? {} : { defaultColumns: t.defaultColumns },
|
|
88
|
-
...t.defaultRows === void 0 ? {} : { defaultRows: t.defaultRows },
|
|
89
|
-
...t.minColumns === void 0 ? {} : { minColumns: t.minColumns },
|
|
90
|
-
...t.maxColumns === void 0 ? {} : { maxColumns: t.maxColumns },
|
|
91
|
-
...t.minRows === void 0 ? {} : { minRows: t.minRows },
|
|
92
|
-
...t.maxRows === void 0 ? {} : { maxRows: t.maxRows },
|
|
93
|
-
...t.movable === void 0 ? {} : { movable: t.movable },
|
|
94
|
-
...t.resizable === void 0 ? {} : { resizable: t.resizable },
|
|
95
|
-
...t.removable === void 0 ? {} : { removable: t.removable }
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
function qe(e, t) {
|
|
99
|
-
let n = getComputedStyle(e), r = parseFloat(n.columnGap) || 0, i = parseFloat(n.rowGap) || 0;
|
|
100
|
-
return {
|
|
101
|
-
columns: t,
|
|
102
|
-
track: (e.clientWidth - r * (t - 1)) / Math.max(1, t),
|
|
103
|
-
columnGap: r,
|
|
104
|
-
row: parseFloat(n.gridAutoRows) || 0,
|
|
105
|
-
rowGap: i
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function Je(e, t, n) {
|
|
109
|
-
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect();
|
|
110
|
-
return {
|
|
111
|
-
inlineStart: n ? i.right - r.right : r.left - i.left,
|
|
112
|
-
blockStart: r.top - i.top,
|
|
113
|
-
inlineSize: r.width,
|
|
114
|
-
blockSize: r.height
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
var Ye = [
|
|
118
|
-
"inset-inline-start",
|
|
119
|
-
"inset-block-start",
|
|
120
|
-
"inline-size",
|
|
121
|
-
"block-size",
|
|
122
|
-
"translate"
|
|
123
|
-
];
|
|
124
|
-
function Xe(e, t) {
|
|
125
|
-
e.style.setProperty("inset-inline-start", `${t.inlineStart}px`), e.style.setProperty("inset-block-start", `${t.blockStart}px`), e.style.setProperty("inline-size", `${t.inlineSize}px`), e.style.setProperty("block-size", `${t.blockSize}px`);
|
|
126
|
-
}
|
|
127
|
-
function Ze(e) {
|
|
128
|
-
if (e !== void 0) for (let t of Ye) e.style.removeProperty(t);
|
|
129
|
-
}
|
|
130
|
-
function Qe(e, t) {
|
|
131
|
-
let n = Object.keys(e.tile), r = Object.keys(e.can);
|
|
132
|
-
return e.order === t.order && e.dragging === t.dragging && e.resizing === t.resizing && e.edge === t.edge && e.readout === t.readout && n.every((n) => e.tile[n] === t.tile[n]) && r.every((n) => e.can[n] === t.can[n]);
|
|
133
|
-
}
|
|
134
|
-
function B({ "aria-label": o, "aria-labelledby": c, children: d, columns: f, defaultEditing: p = !1, defaultLayout: m = Be, editBar: ee, editing: h, headingLevel: g, layout: _, messages: v, onEditingChange: b, onLayoutChange: re, ref: oe, render: ce, style: le, ...Se }) {
|
|
135
|
-
let N = Re(), P = e(ge, v), Ne = e(_e), I = E(() => je(f ?? N.columns), [f, N.columns]), L = ee ?? N.editBar, R = g ?? N.headingLevel, ze = `${de()}-edit-status`, Ye = E(() => {
|
|
136
|
-
let e = /* @__PURE__ */ new Map();
|
|
137
|
-
return ie.forEach(d, (t) => {
|
|
138
|
-
if (!se(t)) return;
|
|
139
|
-
let n = t.props.value;
|
|
140
|
-
typeof n == "string" && !e.has(n) && e.set(n, t);
|
|
141
|
-
}), e;
|
|
142
|
-
}, [d]), B = E(() => [...Ye.values()].map(Ke), [Ye]), $e = E(() => new Map([...Ye].map(([e, t]) => [e, t.props.title])), [Ye]), [V, et] = He(_, m, re, Ce), [H, tt] = He(h, p, b), U = E(() => Me(V, B, I), [
|
|
143
|
-
V,
|
|
144
|
-
B,
|
|
145
|
-
I
|
|
146
|
-
]), W = E(() => U.filter((e) => !e.hidden), [U]), [G, nt] = me(null), rt = D(null), [K, it] = me(null), at = D(null), ot = D(null), q = D(/* @__PURE__ */ new Map()), st = D(/* @__PURE__ */ new Map()), ct = D(/* @__PURE__ */ new Map()), [lt, ut] = me(0), dt = T((e, t, n) => {
|
|
147
|
-
let r = e.get(t);
|
|
148
|
-
if (n === null) {
|
|
149
|
-
if (r === void 0) return;
|
|
150
|
-
e.delete(t);
|
|
151
|
-
} else {
|
|
152
|
-
if (r === n) return;
|
|
153
|
-
e.set(t, n);
|
|
154
|
-
}
|
|
155
|
-
ut((e) => e + 1);
|
|
156
|
-
}, []), ft = T((e, t) => dt(q.current, e, t), [dt]), pt = T((e, t) => dt(st.current, e, t), [dt]), mt = T((e, t) => dt(ct.current, e, t), [dt]), [J, ht] = me("expanded");
|
|
157
|
-
ue(() => {
|
|
158
|
-
if (!K || typeof ResizeObserver > "u") return;
|
|
159
|
-
let e = new ResizeObserver(() => ht(Ge(K)));
|
|
160
|
-
return e.observe(K), ht(Ge(K)), () => e.disconnect();
|
|
161
|
-
}, [K]);
|
|
162
|
-
let gt = D(null), _t = D(null), Y = D(null), vt = T(() => {
|
|
163
|
-
let e = new Map(q.current), t = rt.current?.key;
|
|
164
|
-
t !== void 0 && e.delete(t), ot.current && e.set(Ve, ot.current), gt.current = we(e);
|
|
165
|
-
}, []), X = T((e) => {
|
|
166
|
-
vt(), rt.current = e, nt(e);
|
|
167
|
-
}, [vt]), yt = T((e) => {
|
|
168
|
-
let t = K?.ownerDocument;
|
|
169
|
-
t && e !== "" && ve(t).announce(e);
|
|
170
|
-
}, [K]), Z = D({
|
|
171
|
-
layout: V,
|
|
172
|
-
widgets: B,
|
|
173
|
-
grid: I,
|
|
174
|
-
tiles: U,
|
|
175
|
-
visible: W,
|
|
176
|
-
t: P,
|
|
177
|
-
dragT: Ne,
|
|
178
|
-
titles: $e,
|
|
179
|
-
editing: H
|
|
180
|
-
});
|
|
181
|
-
Z.current = {
|
|
182
|
-
layout: V,
|
|
183
|
-
widgets: B,
|
|
184
|
-
grid: I,
|
|
185
|
-
tiles: U,
|
|
186
|
-
visible: W,
|
|
187
|
-
t: P,
|
|
188
|
-
dragT: Ne,
|
|
189
|
-
titles: $e,
|
|
190
|
-
editing: H
|
|
191
|
-
};
|
|
192
|
-
let Q = T((e) => Z.current.titles.get(e) ?? e, []), $ = T((e, t, n, r, i) => {
|
|
193
|
-
let a = Z.current, o = j(e, a.widgets, a.grid);
|
|
194
|
-
return !Ce(o, j(a.layout, a.widgets, a.grid)) && (gt.current === null && vt(), et(o, t, r, { change: n }) ? (yt(i(o)), !0) : (gt.current = null, !1));
|
|
195
|
-
}, [
|
|
196
|
-
yt,
|
|
197
|
-
vt,
|
|
198
|
-
et
|
|
199
|
-
]), bt = T(() => Ge(K), [K]), xt = T((e, t) => (n) => {
|
|
200
|
-
let r = Z.current, i = Me(n, r.widgets, r.grid).filter((e) => !e.hidden), a = i.findIndex((t) => t.key === e), o = i[a];
|
|
201
|
-
return o === void 0 ? "" : t === "expanded" ? r.t("moved", {
|
|
202
|
-
title: Q(e),
|
|
203
|
-
row: o.y + 1,
|
|
204
|
-
column: o.x + 1
|
|
205
|
-
}) : r.t("movedInOrder", {
|
|
206
|
-
title: Q(e),
|
|
207
|
-
position: a + 1,
|
|
208
|
-
total: i.length
|
|
209
|
-
});
|
|
210
|
-
}, [Q]), St = T((e, t) => (n) => {
|
|
211
|
-
let r = Z.current, i = Me(n, r.widgets, r.grid).find((t) => t.key === e);
|
|
212
|
-
return i === void 0 ? "" : r.t("resized", {
|
|
213
|
-
title: Q(e),
|
|
214
|
-
columns: t === "medium" ? i.medium : i.w,
|
|
215
|
-
rows: i.h
|
|
216
|
-
});
|
|
217
|
-
}, [Q]), Ct = T((e, t, n, r) => {
|
|
218
|
-
let i = Z.current, a = bt(), o = Te(i.layout, i.widgets, i.grid, e, t, a);
|
|
219
|
-
Y.current = e, $(o, n, {
|
|
220
|
-
kind: "move",
|
|
221
|
-
key: e
|
|
222
|
-
}, r, xt(e, a)) || (Y.current = null);
|
|
223
|
-
}, [
|
|
224
|
-
$,
|
|
225
|
-
xt,
|
|
226
|
-
bt
|
|
227
|
-
]), wt = T((e, t, n, r) => {
|
|
228
|
-
let i = Z.current, a = bt(), o = ke(i.layout, i.widgets, i.grid, e, t, a);
|
|
229
|
-
Y.current = e, $(o, n, {
|
|
230
|
-
kind: "resize",
|
|
231
|
-
key: e
|
|
232
|
-
}, r, St(e, a)) || (Y.current = null);
|
|
233
|
-
}, [
|
|
234
|
-
$,
|
|
235
|
-
St,
|
|
236
|
-
bt
|
|
237
|
-
]), Tt = T((e, t, n) => {
|
|
238
|
-
let r = Z.current, i = r.visible.findIndex((t) => t.key === e), a = r.visible[i];
|
|
239
|
-
if (a === void 0 || !a.removable) return;
|
|
240
|
-
let o = r.visible[i + 1] ?? r.visible[i - 1];
|
|
241
|
-
Y.current = o?.key ?? `${z}:add`;
|
|
242
|
-
let s = F(r.layout, r.widgets, r.grid, e, !0);
|
|
243
|
-
$(s, t, {
|
|
244
|
-
kind: "hide",
|
|
245
|
-
key: e
|
|
246
|
-
}, n, () => r.t("hidden", { title: Q(e) })) || (Y.current = null);
|
|
247
|
-
}, [$, Q]), Et = T((e, t, n) => {
|
|
248
|
-
let r = Z.current;
|
|
249
|
-
Y.current = e;
|
|
250
|
-
let i = F(r.layout, r.widgets, r.grid, e, !1);
|
|
251
|
-
$(i, t, {
|
|
252
|
-
kind: "show",
|
|
253
|
-
key: e
|
|
254
|
-
}, n, () => r.t("shown", { title: Q(e) }));
|
|
255
|
-
}, [$, Q]), Dt = D(null), Ot = D(null), kt = D(!1);
|
|
256
|
-
pe(() => {
|
|
257
|
-
if (H && !kt.current) {
|
|
258
|
-
let e = Z.current;
|
|
259
|
-
Dt.current = j(e.layout, e.widgets, e.grid), Ot.current = K?.ownerDocument.activeElement ?? null;
|
|
260
|
-
}
|
|
261
|
-
if (!H && kt.current) {
|
|
262
|
-
let e = K?.ownerDocument, t = e?.activeElement ?? null, n = t === null || t === e?.body || !t.isConnected, r = Ot.current;
|
|
263
|
-
n && r instanceof HTMLElement && r.isConnected && r.focus(), Dt.current = null, Ot.current = null;
|
|
264
|
-
}
|
|
265
|
-
kt.current = H;
|
|
266
|
-
}, [H, K]);
|
|
267
|
-
let At = T((e, t) => {
|
|
268
|
-
tt(!1, e, t);
|
|
269
|
-
}, [tt]), jt = T((e, t) => {
|
|
270
|
-
let n = Z.current, r = Dt.current;
|
|
271
|
-
r !== null && $(r, "dismiss", {
|
|
272
|
-
kind: "cancel",
|
|
273
|
-
key: null
|
|
274
|
-
}, t, () => n.t("cancelled")), tt(!1, e, t);
|
|
275
|
-
}, [$, tt]), Mt = T((e, t) => {
|
|
276
|
-
let n = Z.current;
|
|
277
|
-
$(Be, e, {
|
|
278
|
-
kind: "reset",
|
|
279
|
-
key: null
|
|
280
|
-
}, t, () => n.t("resetDone"));
|
|
281
|
-
}, [$]), Nt = T((e, t) => {
|
|
282
|
-
let n = be(t, We(t.currentTarget));
|
|
283
|
-
if (n === null) return;
|
|
284
|
-
let r = Z.current.visible.find((t) => t.key === e);
|
|
285
|
-
if (r === void 0) return;
|
|
286
|
-
t.preventDefault(), t.stopPropagation();
|
|
287
|
-
let i = t.nativeEvent;
|
|
288
|
-
n.kind === "move" && r.movable && Ct(e, n.direction, "keyboard", i), n.kind === "resize" && r.resizable && wt(e, {
|
|
289
|
-
columns: n.columns,
|
|
290
|
-
rows: n.rows
|
|
291
|
-
}, "keyboard", i), n.kind === "hide" && Tt(e, "remove", i);
|
|
292
|
-
}, [
|
|
293
|
-
Tt,
|
|
294
|
-
Ct,
|
|
295
|
-
wt
|
|
296
|
-
]), Pt = D(null), Ft = T((e, t, n) => {
|
|
297
|
-
if (n.button !== 0 || Pt.current !== null) return;
|
|
298
|
-
let r = Z.current, i = r.visible.find((t) => t.key === e), a = at.current, o = q.current.get(e);
|
|
299
|
-
if (i === void 0 || !i.resizable || a === null || o === void 0) return;
|
|
300
|
-
n.preventDefault(), n.stopPropagation();
|
|
301
|
-
let s = bt();
|
|
302
|
-
if (s === "compact") return;
|
|
303
|
-
let c = n.currentTarget, l = We(a) === "rtl", u = qe(a, r.grid[s]), d = Je(o, a, l), f = {
|
|
304
|
-
x: n.clientX,
|
|
305
|
-
y: n.clientY
|
|
306
|
-
}, p = s === "medium" ? i.medium : i.w, m = t === "start" || t === "bottom-start", ee = t === "end" || t === "bottom-end", h = t !== "start" && t !== "end", g = {
|
|
307
|
-
x: i.x,
|
|
308
|
-
y: i.y,
|
|
309
|
-
w: p,
|
|
310
|
-
h: i.h
|
|
311
|
-
}, _ = j(r.layout, r.widgets, r.grid);
|
|
312
|
-
Xe(o, d), X({
|
|
313
|
-
kind: "resize",
|
|
314
|
-
key: e,
|
|
315
|
-
edge: t,
|
|
316
|
-
preview: _,
|
|
317
|
-
sizeClass: s
|
|
318
|
-
});
|
|
319
|
-
let v = (n) => {
|
|
320
|
-
let r = n.clientX - f.x, a = n.clientY - f.y, c = l ? -r : r, v = u.track, y = ee ? Math.max(v, d.inlineSize + c) : m ? Math.max(v, d.inlineSize - c) : d.inlineSize, b = h ? Math.max(u.row, d.blockSize + a) : d.blockSize;
|
|
321
|
-
o.style.setProperty("inline-size", `${y}px`), o.style.setProperty("block-size", `${b}px`);
|
|
322
|
-
let x = m ? d.inlineSize - y : 0;
|
|
323
|
-
o.style.setProperty("translate", `${l ? -x : x}px 0px`);
|
|
324
|
-
let S = Pe({
|
|
325
|
-
span: p,
|
|
326
|
-
track: u.track,
|
|
327
|
-
gap: u.columnGap,
|
|
328
|
-
travel: y - d.inlineSize
|
|
329
|
-
}), C = h ? Pe({
|
|
330
|
-
span: i.h,
|
|
331
|
-
track: u.row,
|
|
332
|
-
gap: u.rowGap,
|
|
333
|
-
travel: b - d.blockSize
|
|
334
|
-
}) : i.h, te = m ? i.x + i.w - S : i.x;
|
|
335
|
-
if (S === g.w && C === g.h && te === g.x) return;
|
|
336
|
-
g = {
|
|
337
|
-
x: te,
|
|
338
|
-
y: i.y,
|
|
339
|
-
w: S,
|
|
340
|
-
h: C
|
|
341
|
-
};
|
|
342
|
-
let ne = Z.current;
|
|
343
|
-
_ = Ae(ne.layout, ne.widgets, ne.grid, e, g, s), X({
|
|
344
|
-
kind: "resize",
|
|
345
|
-
key: e,
|
|
346
|
-
edge: t,
|
|
347
|
-
preview: _,
|
|
348
|
-
sizeClass: s
|
|
349
|
-
});
|
|
350
|
-
}, y = (t, n) => {
|
|
351
|
-
Pt.current?.();
|
|
352
|
-
let r = o.getBoundingClientRect();
|
|
353
|
-
_t.current = {
|
|
354
|
-
key: e,
|
|
355
|
-
box: {
|
|
356
|
-
left: r.left,
|
|
357
|
-
top: r.top,
|
|
358
|
-
width: r.width,
|
|
359
|
-
height: r.height
|
|
360
|
-
}
|
|
361
|
-
}, Ze(o), X(null), t && $(_, "pointer", {
|
|
362
|
-
kind: "resize",
|
|
363
|
-
key: e
|
|
364
|
-
}, n, St(e, s));
|
|
365
|
-
}, b = (e) => y(!0, e), x = () => y(!1), S = (e) => {
|
|
366
|
-
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), y(!1));
|
|
367
|
-
}, C = c.ownerDocument;
|
|
368
|
-
c.setPointerCapture?.(n.pointerId), c.addEventListener("pointermove", v), c.addEventListener("pointerup", b), c.addEventListener("pointercancel", x), C.addEventListener("keydown", S, !0), Pt.current = () => {
|
|
369
|
-
Pt.current = null, c.removeEventListener("pointermove", v), c.removeEventListener("pointerup", b), c.removeEventListener("pointercancel", x), C.removeEventListener("keydown", S, !0), c.hasPointerCapture?.(n.pointerId) && c.releasePointerCapture(n.pointerId);
|
|
370
|
-
};
|
|
371
|
-
}, [
|
|
372
|
-
$,
|
|
373
|
-
St,
|
|
374
|
-
X,
|
|
375
|
-
bt
|
|
376
|
-
]);
|
|
377
|
-
ue(() => () => Pt.current?.(), []), ue(() => {
|
|
378
|
-
let e = at.current;
|
|
379
|
-
if (!K || !H || e === null) return;
|
|
380
|
-
let t = K.ownerDocument, n = () => Z.current.visible.map((e) => e.key), r = null, i = null, a = "expanded", o = !1, s = null, c = (t) => {
|
|
381
|
-
let n = t.target?.closest("[data-part=\"widget\"]"), i = n?.dataset.key;
|
|
382
|
-
if (!n || i === void 0 || n.parentElement !== e) return;
|
|
383
|
-
let a = n.getBoundingClientRect();
|
|
384
|
-
r = {
|
|
385
|
-
x: t.clientX,
|
|
386
|
-
y: t.clientY,
|
|
387
|
-
grabX: t.clientX - a.left,
|
|
388
|
-
grabY: t.clientY - a.top,
|
|
389
|
-
key: i
|
|
390
|
-
};
|
|
391
|
-
};
|
|
392
|
-
e.addEventListener("pointerdown", c, !0);
|
|
393
|
-
let l = (e, t) => {
|
|
394
|
-
let n = Z.current;
|
|
395
|
-
if (t.startsWith("swap:")) return Fe(n.layout, n.widgets, n.grid, e, t.slice(5));
|
|
396
|
-
let [r, i] = t.split(",").map(Number);
|
|
397
|
-
return M(n.layout, n.widgets, n.grid, e, {
|
|
398
|
-
x: r ?? 0,
|
|
399
|
-
y: i ?? 0
|
|
400
|
-
});
|
|
401
|
-
}, u = A({
|
|
402
|
-
document: t,
|
|
403
|
-
restoreFocus: !1,
|
|
404
|
-
preview: !1,
|
|
405
|
-
autoScroll: { axis: "y" },
|
|
406
|
-
t: (e, t) => Z.current.dragT(e, t),
|
|
407
|
-
silent: [
|
|
408
|
-
"pickedUp",
|
|
409
|
-
"moved",
|
|
410
|
-
"dropped",
|
|
411
|
-
"cancelled"
|
|
412
|
-
],
|
|
413
|
-
resolveTarget: (t) => {
|
|
414
|
-
let n = u.state.items[0];
|
|
415
|
-
if (n === void 0 || r === null || s === null) return null;
|
|
416
|
-
let c = e.getBoundingClientRect();
|
|
417
|
-
if (a === "expanded") {
|
|
418
|
-
let e = t.x - r.grabX, a = t.y - r.grabY, l = Z.current.visible.find((e) => e.key === n), u = l ? l.w * s.track + (l.w - 1) * s.columnGap : 0, d = o ? e + u - s.track / 2 : e + s.track / 2, f = ye({
|
|
419
|
-
x: d,
|
|
420
|
-
y: a + s.row / 2
|
|
421
|
-
}, {
|
|
422
|
-
left: c.left,
|
|
423
|
-
top: c.top,
|
|
424
|
-
width: c.width
|
|
425
|
-
}, {
|
|
426
|
-
columns: s.columns,
|
|
427
|
-
row: s.row,
|
|
428
|
-
gap: s.columnGap
|
|
429
|
-
}, o ? "rtl" : "ltr");
|
|
430
|
-
i = `${f.x},${f.y}`;
|
|
431
|
-
} else for (let [e, r] of q.current) {
|
|
432
|
-
if (e === n) continue;
|
|
433
|
-
let a = r.getBoundingClientRect();
|
|
434
|
-
if (t.x >= a.left && t.x <= a.right && t.y >= a.top && t.y <= a.bottom) {
|
|
435
|
-
i = `swap:${e}`;
|
|
436
|
-
break;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
return i === null ? null : {
|
|
440
|
-
kind: "on",
|
|
441
|
-
container: z,
|
|
442
|
-
key: i
|
|
443
|
-
};
|
|
444
|
-
},
|
|
445
|
-
onTargetChange: ({ state: e }) => {
|
|
446
|
-
let t = e.items[0];
|
|
447
|
-
t !== void 0 && e.target?.kind === "on" && X({
|
|
448
|
-
kind: "move",
|
|
449
|
-
key: t,
|
|
450
|
-
preview: l(t, e.target.key)
|
|
451
|
-
});
|
|
452
|
-
},
|
|
453
|
-
onDrop: ({ items: e, target: t, reason: n, event: r }) => {
|
|
454
|
-
let i = e[0];
|
|
455
|
-
i !== void 0 && t.kind === "on" && (Y.current = null, $(l(i, t.key), n === "keyboard" ? "keyboard" : "pointer", {
|
|
456
|
-
kind: "move",
|
|
457
|
-
key: i
|
|
458
|
-
}, r, xt(i, a)));
|
|
459
|
-
}
|
|
460
|
-
}), d = u.registerContainer({
|
|
461
|
-
key: z,
|
|
462
|
-
items: n,
|
|
463
|
-
orientation: "grid",
|
|
464
|
-
targets: ["on"],
|
|
465
|
-
element: () => e,
|
|
466
|
-
itemElement: (e) => q.current.get(e) ?? null,
|
|
467
|
-
label: () => Z.current.t("editBar"),
|
|
468
|
-
itemLabel: Q
|
|
469
|
-
}), f = !1, p = null, m = (e) => {
|
|
470
|
-
f && (f = !1, e.preventDefault(), e.stopPropagation());
|
|
471
|
-
};
|
|
472
|
-
K.addEventListener("click", m, !0);
|
|
473
|
-
let ee = u.subscribe((t) => {
|
|
474
|
-
if (t.status !== "dragging") {
|
|
475
|
-
if (p !== null) {
|
|
476
|
-
let e = q.current.get(p);
|
|
477
|
-
if (e) {
|
|
478
|
-
let t = e.getBoundingClientRect();
|
|
479
|
-
_t.current = {
|
|
480
|
-
key: p,
|
|
481
|
-
box: {
|
|
482
|
-
left: t.left,
|
|
483
|
-
top: t.top,
|
|
484
|
-
width: t.width,
|
|
485
|
-
height: t.height
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
Ze(e), f = t.reason === "pointer" || t.reason === null, window.setTimeout(() => {
|
|
490
|
-
f = !1;
|
|
491
|
-
}, 0), p = null, i = null, rt.current?.kind === "move" && X(null);
|
|
492
|
-
}
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
|
-
let n = t.items[0];
|
|
496
|
-
if (n === void 0 || r === null) return;
|
|
497
|
-
let c = q.current.get(n);
|
|
498
|
-
c !== void 0 && (p === null && (p = n, a = Ge(K), o = We(e) === "rtl", s = qe(e, Z.current.grid[a]), Xe(c, Je(c, e, o)), X({
|
|
499
|
-
kind: "move",
|
|
500
|
-
key: n,
|
|
501
|
-
preview: j(Z.current.layout, Z.current.widgets, Z.current.grid)
|
|
502
|
-
})), t.point !== null && c.style.setProperty("translate", `${t.point.x - r.x}px ${t.point.y - r.y}px`));
|
|
503
|
-
}), h = [];
|
|
504
|
-
for (let e of Z.current.visible) {
|
|
505
|
-
if (!e.movable) continue;
|
|
506
|
-
let t = q.current.get(e.key);
|
|
507
|
-
if (t === void 0) continue;
|
|
508
|
-
let n = ct.current.get(e.key), r = st.current.get(e.key);
|
|
509
|
-
n && h.push(u.attachDraggable(t, {
|
|
510
|
-
container: z,
|
|
511
|
-
key: e.key,
|
|
512
|
-
handle: () => n,
|
|
513
|
-
canDrag: (e) => e.pointerType !== "touch"
|
|
514
|
-
})), r && h.push(u.attachDraggable(t, {
|
|
515
|
-
container: z,
|
|
516
|
-
key: e.key,
|
|
517
|
-
handle: () => r,
|
|
518
|
-
delay: { touch: 0 }
|
|
519
|
-
}));
|
|
520
|
-
}
|
|
521
|
-
return () => {
|
|
522
|
-
for (let e of h) e();
|
|
523
|
-
e.removeEventListener("pointerdown", c, !0), K.removeEventListener("click", m, !0), ee(), d(), u.destroy();
|
|
524
|
-
};
|
|
525
|
-
}, [
|
|
526
|
-
K,
|
|
527
|
-
H,
|
|
528
|
-
lt,
|
|
529
|
-
$,
|
|
530
|
-
xt,
|
|
531
|
-
X,
|
|
532
|
-
Q
|
|
533
|
-
]);
|
|
534
|
-
let It = E(() => JSON.stringify(j(V, B, I)), [
|
|
535
|
-
V,
|
|
536
|
-
B,
|
|
537
|
-
I
|
|
538
|
-
]);
|
|
539
|
-
pe(() => {
|
|
540
|
-
if (K === null) return;
|
|
541
|
-
let e = getComputedStyle(K), t = {
|
|
542
|
-
duration: Ee(e.getPropertyValue("--slotted-duration-medium")),
|
|
543
|
-
easing: e.getPropertyValue("--slotted-easing-standard").trim() || "ease"
|
|
544
|
-
}, n = gt.current;
|
|
545
|
-
if (n !== null) {
|
|
546
|
-
gt.current = null;
|
|
547
|
-
let e = new Map(q.current), r = rt.current?.key;
|
|
548
|
-
r !== void 0 && e.delete(r), ot.current && e.set(Ve, ot.current), De(e, n, t);
|
|
549
|
-
}
|
|
550
|
-
let r = _t.current;
|
|
551
|
-
if (r !== null && rt.current === null) {
|
|
552
|
-
_t.current = null;
|
|
553
|
-
let e = q.current.get(r.key);
|
|
554
|
-
e && Oe(e, r.box, t);
|
|
555
|
-
}
|
|
556
|
-
let i = Y.current;
|
|
557
|
-
if (i === null) return;
|
|
558
|
-
Y.current = null;
|
|
559
|
-
let a = i === `${z}:add` ? K.querySelector("[data-part=\"add\"]") : Z.current.editing ? st.current.get(i) : null;
|
|
560
|
-
a && a !== K.ownerDocument.activeElement && a.focus();
|
|
561
|
-
}, [
|
|
562
|
-
It,
|
|
563
|
-
G,
|
|
564
|
-
K
|
|
565
|
-
]), fe(oe, () => ({
|
|
566
|
-
get element() {
|
|
567
|
-
return K;
|
|
568
|
-
},
|
|
569
|
-
focusWidget: (e) => {
|
|
570
|
-
((Z.current.editing ? st.current.get(e) : void 0) ?? q.current.get(e)?.querySelector("a[href], button:not([disabled]), [tabindex]:not([tabindex=\"-1\"])"))?.focus();
|
|
571
|
-
},
|
|
572
|
-
commitEditing: () => At("programmatic"),
|
|
573
|
-
cancelEditing: () => jt("programmatic")
|
|
574
|
-
}), [
|
|
575
|
-
jt,
|
|
576
|
-
At,
|
|
577
|
-
K
|
|
578
|
-
]);
|
|
579
|
-
let Lt = E(() => G === null ? U : Me(G.preview, B, I), [
|
|
580
|
-
G,
|
|
581
|
-
U,
|
|
582
|
-
B,
|
|
583
|
-
I
|
|
584
|
-
]), Rt = E(() => Lt.filter((e) => !e.hidden), [Lt]), zt = E(() => {
|
|
585
|
-
let e = /* @__PURE__ */ new Map(), t = j(V, B, I), n = (e) => !Ce(j(e, B, I), t);
|
|
586
|
-
for (let t of W) {
|
|
587
|
-
let r = (e) => H && n(Te(V, B, I, t.key, e, J)), i = (e, r) => H && n(ke(V, B, I, t.key, {
|
|
588
|
-
columns: e,
|
|
589
|
-
rows: r
|
|
590
|
-
}, J));
|
|
591
|
-
e.set(t.key, {
|
|
592
|
-
up: r("up"),
|
|
593
|
-
down: r("down"),
|
|
594
|
-
left: r("left"),
|
|
595
|
-
right: r("right"),
|
|
596
|
-
wider: i(1, 0),
|
|
597
|
-
narrower: i(-1, 0),
|
|
598
|
-
taller: i(0, 1),
|
|
599
|
-
shorter: i(0, -1)
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
return e;
|
|
603
|
-
}, [
|
|
604
|
-
W,
|
|
605
|
-
H,
|
|
606
|
-
V,
|
|
607
|
-
B,
|
|
608
|
-
I,
|
|
609
|
-
J
|
|
610
|
-
]), Bt = D(/* @__PURE__ */ new Map()), Vt = E(() => {
|
|
611
|
-
let e = /* @__PURE__ */ new Map(), t = new Map(Rt.map((e, t) => [e.key, t]));
|
|
612
|
-
for (let n of W) {
|
|
613
|
-
let r = Lt.find((e) => e.key === n.key) ?? n, i = G !== null && G.key === n.key, a = i && G.kind === "resize", o = {
|
|
614
|
-
tile: r,
|
|
615
|
-
order: G === null || J === "expanded" ? void 0 : t.get(n.key),
|
|
616
|
-
dragging: i && G.kind === "move",
|
|
617
|
-
resizing: a,
|
|
618
|
-
edge: a ? G.edge : null,
|
|
619
|
-
readout: a ? P("size", {
|
|
620
|
-
columns: G.sizeClass === "medium" ? r.medium : r.w,
|
|
621
|
-
rows: r.h
|
|
622
|
-
}) : null,
|
|
623
|
-
can: zt.get(n.key)
|
|
624
|
-
}, s = Bt.current.get(n.key);
|
|
625
|
-
e.set(n.key, s !== void 0 && Qe(s, o) ? s : o);
|
|
626
|
-
}
|
|
627
|
-
return e;
|
|
628
|
-
}, [
|
|
629
|
-
Lt,
|
|
630
|
-
Rt,
|
|
631
|
-
W,
|
|
632
|
-
G,
|
|
633
|
-
P,
|
|
634
|
-
zt,
|
|
635
|
-
J
|
|
636
|
-
]);
|
|
637
|
-
pe(() => {
|
|
638
|
-
Bt.current = Vt;
|
|
639
|
-
}, [Vt]);
|
|
640
|
-
let Ht = E(() => ({
|
|
641
|
-
editing: H,
|
|
642
|
-
t: P,
|
|
643
|
-
headingLevel: R,
|
|
644
|
-
statusId: ze,
|
|
645
|
-
sizeClass: J,
|
|
646
|
-
slots: Vt,
|
|
647
|
-
registerWidget: ft,
|
|
648
|
-
registerHandle: pt,
|
|
649
|
-
registerCard: mt,
|
|
650
|
-
move: Ct,
|
|
651
|
-
resize: wt,
|
|
652
|
-
hide: Tt,
|
|
653
|
-
onHandleKeyDown: Nt,
|
|
654
|
-
onResizePointerDown: Ft
|
|
655
|
-
}), [
|
|
656
|
-
H,
|
|
657
|
-
P,
|
|
658
|
-
R,
|
|
659
|
-
ze,
|
|
660
|
-
J,
|
|
661
|
-
Vt,
|
|
662
|
-
ft,
|
|
663
|
-
pt,
|
|
664
|
-
mt,
|
|
665
|
-
Ct,
|
|
666
|
-
wt,
|
|
667
|
-
Tt,
|
|
668
|
-
Nt,
|
|
669
|
-
Ft
|
|
670
|
-
]), Ut = U.filter((e) => e.hidden), Wt = /* @__PURE__ */ O("p", {
|
|
671
|
-
"data-part": "edit-status",
|
|
672
|
-
"data-part-edit-status": "",
|
|
673
|
-
id: ze,
|
|
674
|
-
...L ? {} : {
|
|
675
|
-
"data-ui": "visually-hidden",
|
|
676
|
-
...ne("ui", "visually-hidden")
|
|
677
|
-
},
|
|
678
|
-
children: P("editStatus")
|
|
679
|
-
}), Gt = Ut.length === 0 ? null : /* @__PURE__ */ k(r, { children: [/* @__PURE__ */ O(s, { render: ({ ref: e, ...r }) => /* @__PURE__ */ O(u, {
|
|
680
|
-
...r,
|
|
681
|
-
size: "sm",
|
|
682
|
-
variant: "outline",
|
|
683
|
-
tone: "secondary",
|
|
684
|
-
start: /* @__PURE__ */ O(n, { children: /* @__PURE__ */ O(t, { name: "plus" }) }),
|
|
685
|
-
render: (t) => /* @__PURE__ */ O("button", {
|
|
686
|
-
...w(t, "part", "add"),
|
|
687
|
-
ref: e
|
|
688
|
-
}),
|
|
689
|
-
children: P("add")
|
|
690
|
-
}) }), /* @__PURE__ */ O(l, { children: Ut.map((e) => /* @__PURE__ */ O(i, {
|
|
691
|
-
onSelect: (t) => Et(e.key, t.reason === "keyboard" ? "keyboard" : "pointer", t.source),
|
|
692
|
-
children: /* @__PURE__ */ O(a, { children: Q(e.key) })
|
|
693
|
-
}, e.key)) })] }), Kt = (e, t, n) => /* @__PURE__ */ O(u, {
|
|
694
|
-
size: "sm",
|
|
695
|
-
tone: e === "done" ? "accent" : "secondary",
|
|
696
|
-
variant: e === "done" ? "solid" : e === "cancel" ? "outline" : "ghost",
|
|
697
|
-
onClick: n,
|
|
698
|
-
render: (t) => /* @__PURE__ */ O("button", { ...w(t, "part", e) }),
|
|
699
|
-
children: t
|
|
700
|
-
}), qt = G === null ? null : Lt.find((e) => e.key === G.key), Jt = te({
|
|
701
|
-
...Se,
|
|
702
|
-
style: {
|
|
703
|
-
...xe(I),
|
|
704
|
-
...le
|
|
705
|
-
},
|
|
706
|
-
"data-ui": "dashboard-grid",
|
|
707
|
-
"data-part": "root",
|
|
708
|
-
...H ? { "data-editing": "" } : {},
|
|
709
|
-
ref: it,
|
|
710
|
-
children: /* @__PURE__ */ k(he, { children: [
|
|
711
|
-
H && L ? /* @__PURE__ */ k("div", {
|
|
712
|
-
"data-part": "edit-bar",
|
|
713
|
-
"data-part-edit-bar": "",
|
|
714
|
-
role: "group",
|
|
715
|
-
"aria-label": P("editBar"),
|
|
716
|
-
children: [Wt, /* @__PURE__ */ k("div", {
|
|
717
|
-
"data-part": "edit-actions",
|
|
718
|
-
"data-part-edit-actions": "",
|
|
719
|
-
children: [
|
|
720
|
-
Gt,
|
|
721
|
-
Kt("reset", P("reset"), (e) => Mt(Ue(e), e.nativeEvent)),
|
|
722
|
-
Kt("cancel", P("cancel"), (e) => jt(Ue(e), e.nativeEvent)),
|
|
723
|
-
Kt("done", P("done"), (e) => At("submit", e.nativeEvent))
|
|
724
|
-
]
|
|
725
|
-
})]
|
|
726
|
-
}) : null,
|
|
727
|
-
H && !L ? Wt : null,
|
|
728
|
-
/* @__PURE__ */ k("ul", {
|
|
729
|
-
ref: at,
|
|
730
|
-
"data-part": "grid",
|
|
731
|
-
"data-part-grid": "",
|
|
732
|
-
...G === null ? {} : { "data-gesture": "" },
|
|
733
|
-
role: "list",
|
|
734
|
-
"aria-label": o,
|
|
735
|
-
"aria-labelledby": c,
|
|
736
|
-
hidden: W.length === 0 || void 0,
|
|
737
|
-
children: [W.map((e) => /* @__PURE__ */ O(ae, { children: Ye.get(e.key) }, e.key)), qt ? /* @__PURE__ */ O("li", {
|
|
738
|
-
ref: ot,
|
|
739
|
-
"data-part": "placeholder",
|
|
740
|
-
"data-part-placeholder": "",
|
|
741
|
-
"aria-hidden": "true",
|
|
742
|
-
style: {
|
|
743
|
-
...Ie(qt),
|
|
744
|
-
...J === "expanded" ? {} : { order: Rt.findIndex((e) => e.key === qt.key) }
|
|
745
|
-
}
|
|
746
|
-
}) : null]
|
|
747
|
-
}),
|
|
748
|
-
W.length === 0 ? /* @__PURE__ */ O("div", {
|
|
749
|
-
"data-part": "empty",
|
|
750
|
-
"data-part-empty": "",
|
|
751
|
-
children: /* @__PURE__ */ O(C, {
|
|
752
|
-
status: "empty",
|
|
753
|
-
reach: "section",
|
|
754
|
-
live: "polite",
|
|
755
|
-
children: /* @__PURE__ */ k(S, { children: [/* @__PURE__ */ O(x, { children: P("empty") }), H ? /* @__PURE__ */ O(y, { children: P("emptyEditing") }) : null] })
|
|
756
|
-
})
|
|
757
|
-
}) : null
|
|
758
|
-
] })
|
|
759
|
-
});
|
|
760
|
-
return /* @__PURE__ */ O(Le.Provider, {
|
|
761
|
-
value: Ht,
|
|
762
|
-
children: ce === void 0 ? /* @__PURE__ */ O("div", { ...Jt }) : ce(Jt)
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
//#endregion
|
|
766
|
-
//#region src/dashboard-grid/dashboard-widget.tsx
|
|
767
|
-
var $e = [
|
|
768
|
-
"start",
|
|
769
|
-
"end",
|
|
770
|
-
"bottom",
|
|
771
|
-
"bottom-start",
|
|
772
|
-
"bottom-end"
|
|
773
|
-
];
|
|
774
|
-
function V(e, t) {
|
|
775
|
-
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
776
|
-
}
|
|
777
|
-
var et = (e) => e.reason === "keyboard" ? "keyboard" : "pointer";
|
|
778
|
-
function H({ register: e, triggerRef: r, ...i }) {
|
|
779
|
-
let a = D(r);
|
|
780
|
-
a.current = r;
|
|
781
|
-
let o = T((t) => {
|
|
782
|
-
e(t), V(a.current, t);
|
|
783
|
-
}, [e]);
|
|
784
|
-
return /* @__PURE__ */ O("button", {
|
|
785
|
-
...w(i, "part", "handle"),
|
|
786
|
-
type: "button",
|
|
787
|
-
ref: o,
|
|
788
|
-
children: /* @__PURE__ */ O(n, { children: /* @__PURE__ */ O(t, { name: "grip-horizontal" }) })
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
function tt({ headingLevel: e, defaultColumns: t, defaultRows: n, minColumns: r, maxColumns: i, minRows: a, maxRows: o, movable: s, resizable: c, removable: l, loading: u = !1, ref: d, ...f }) {
|
|
792
|
-
let { value: p } = f, m = I("DashboardWidget"), ee = m.slots.get(p), h = `${de()}-title`, g = `${h}-description`, y = _(), b = v({
|
|
793
|
-
delay: y.delay ?? 0,
|
|
794
|
-
loading: u,
|
|
795
|
-
minDuration: y.minDuration ?? 0
|
|
796
|
-
}), { registerWidget: x, registerHandle: S, registerCard: C } = m, te = T((e) => {
|
|
797
|
-
x(p, e), V(d, e);
|
|
798
|
-
}, [
|
|
799
|
-
d,
|
|
800
|
-
x,
|
|
801
|
-
p
|
|
802
|
-
]), ne = T((e) => C(p, e), [C, p]), w = T((e) => S(p, e), [S, p]);
|
|
803
|
-
return ee === void 0 ? null : /* @__PURE__ */ O(U, {
|
|
804
|
-
...f,
|
|
805
|
-
headingLevel: e ?? m.headingLevel,
|
|
806
|
-
drawnSlot: ee,
|
|
807
|
-
painted: b,
|
|
808
|
-
titleId: h,
|
|
809
|
-
descriptionId: g,
|
|
810
|
-
setWidget: te,
|
|
811
|
-
setCard: ne,
|
|
812
|
-
setHandle: w,
|
|
813
|
-
t: m.t,
|
|
814
|
-
editing: m.editing,
|
|
815
|
-
sizeClass: m.sizeClass,
|
|
816
|
-
statusId: m.statusId,
|
|
817
|
-
move: m.move,
|
|
818
|
-
resize: m.resize,
|
|
819
|
-
hide: m.hide,
|
|
820
|
-
onHandleKeyDown: m.onHandleKeyDown,
|
|
821
|
-
onResizePointerDown: m.onResizePointerDown
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
var U = ce(function({ value: e, title: _, description: v, children: ne, headingLevel: re, busy: ie = !1, status: ae = "ready", skeleton: oe, emptyTitle: se, emptyDescription: ce, emptyAction: T, errorTitle: le, errorDescription: ue, onRetry: de, detailHref: fe, onDetail: pe, actions: E, footer: D, fill: me, size: ge, render: _e, style: ve, drawnSlot: A, painted: ye, titleId: be, descriptionId: xe, setWidget: Ce, setCard: j, setHandle: we, t: M, editing: Te, sizeClass: N, statusId: Ee, move: De, resize: Oe, hide: ke, onHandleKeyDown: Ae, onResizePointerDown: je, ...Me }) {
|
|
825
|
-
let { tile: P, can: F } = A, Ne = `h${re}`, Pe = { title: _ }, Fe = N !== "expanded", Le = fe === void 0 ? pe === void 0 ? null : /* @__PURE__ */ O(d, {
|
|
826
|
-
"aria-label": M("detail", Pe),
|
|
827
|
-
size: "sm",
|
|
828
|
-
tone: "secondary",
|
|
829
|
-
variant: "ghost",
|
|
830
|
-
onClick: pe,
|
|
831
|
-
render: (e) => /* @__PURE__ */ O("button", { ...w(e, "part", "detail") }),
|
|
832
|
-
children: /* @__PURE__ */ O(n, {
|
|
833
|
-
directional: !0,
|
|
834
|
-
children: /* @__PURE__ */ O(t, { name: "external" })
|
|
835
|
-
})
|
|
836
|
-
}) : /* @__PURE__ */ O(d, {
|
|
837
|
-
"aria-label": M("detail", Pe),
|
|
838
|
-
size: "sm",
|
|
839
|
-
tone: "secondary",
|
|
840
|
-
variant: "ghost",
|
|
841
|
-
render: ({ type: e, disabled: t, ...n }) => /* @__PURE__ */ O("a", {
|
|
842
|
-
...w(n, "part", "detail"),
|
|
843
|
-
href: fe,
|
|
844
|
-
onClick: pe
|
|
845
|
-
}),
|
|
846
|
-
children: /* @__PURE__ */ O(n, {
|
|
847
|
-
directional: !0,
|
|
848
|
-
children: /* @__PURE__ */ O(t, { name: "external" })
|
|
849
|
-
})
|
|
850
|
-
}), I = (t) => (n) => De(e, t, et(n), n.source), L = (t, n) => (r) => Oe(e, {
|
|
851
|
-
columns: t,
|
|
852
|
-
rows: n
|
|
853
|
-
}, et(r), r.source), R = P.resizable && N !== "compact", Re = Te && (P.movable || R || P.removable) ? /* @__PURE__ */ k(r, { children: [/* @__PURE__ */ O(s, {
|
|
854
|
-
onKeyDown: (t) => Ae(e, t),
|
|
855
|
-
render: ({ ref: e, ...t }) => /* @__PURE__ */ O(H, {
|
|
856
|
-
...t,
|
|
857
|
-
"aria-label": M("handle", Pe),
|
|
858
|
-
"aria-describedby": Ee,
|
|
859
|
-
"aria-keyshortcuts": Se(P.removable),
|
|
860
|
-
register: we,
|
|
861
|
-
triggerRef: e
|
|
862
|
-
})
|
|
863
|
-
}), /* @__PURE__ */ k(l, { children: [
|
|
864
|
-
P.movable ? /* @__PURE__ */ k(he, { children: [
|
|
865
|
-
/* @__PURE__ */ k(i, {
|
|
866
|
-
disabled: !F.up,
|
|
867
|
-
onSelect: I("up"),
|
|
868
|
-
children: [/* @__PURE__ */ O(a, { children: M("moveUp") }), /* @__PURE__ */ O(c, { keys: "Alt+ArrowUp" })]
|
|
869
|
-
}),
|
|
870
|
-
/* @__PURE__ */ k(i, {
|
|
871
|
-
disabled: !F.down,
|
|
872
|
-
onSelect: I("down"),
|
|
873
|
-
children: [/* @__PURE__ */ O(a, { children: M("moveDown") }), /* @__PURE__ */ O(c, { keys: "Alt+ArrowDown" })]
|
|
874
|
-
}),
|
|
875
|
-
Fe ? null : /* @__PURE__ */ k(he, { children: [/* @__PURE__ */ k(i, {
|
|
876
|
-
disabled: !F.left,
|
|
877
|
-
onSelect: I("left"),
|
|
878
|
-
children: [/* @__PURE__ */ O(a, { children: M("moveStart") }), /* @__PURE__ */ O(c, { keys: "Alt+ArrowLeft" })]
|
|
879
|
-
}), /* @__PURE__ */ k(i, {
|
|
880
|
-
disabled: !F.right,
|
|
881
|
-
onSelect: I("right"),
|
|
882
|
-
children: [/* @__PURE__ */ O(a, { children: M("moveEnd") }), /* @__PURE__ */ O(c, { keys: "Alt+ArrowRight" })]
|
|
883
|
-
})] })
|
|
884
|
-
] }) : null,
|
|
885
|
-
P.movable && R ? /* @__PURE__ */ O(o, {}) : null,
|
|
886
|
-
R ? /* @__PURE__ */ k(he, { children: [
|
|
887
|
-
/* @__PURE__ */ k(i, {
|
|
888
|
-
disabled: !F.wider,
|
|
889
|
-
onSelect: L(1, 0),
|
|
890
|
-
children: [/* @__PURE__ */ O(a, { children: M("wider") }), /* @__PURE__ */ O(c, { keys: "Shift+ArrowRight" })]
|
|
891
|
-
}),
|
|
892
|
-
/* @__PURE__ */ k(i, {
|
|
893
|
-
disabled: !F.narrower,
|
|
894
|
-
onSelect: L(-1, 0),
|
|
895
|
-
children: [/* @__PURE__ */ O(a, { children: M("narrower") }), /* @__PURE__ */ O(c, { keys: "Shift+ArrowLeft" })]
|
|
896
|
-
}),
|
|
897
|
-
/* @__PURE__ */ k(i, {
|
|
898
|
-
disabled: !F.taller,
|
|
899
|
-
onSelect: L(0, 1),
|
|
900
|
-
children: [/* @__PURE__ */ O(a, { children: M("taller") }), /* @__PURE__ */ O(c, { keys: "Shift+ArrowDown" })]
|
|
901
|
-
}),
|
|
902
|
-
/* @__PURE__ */ k(i, {
|
|
903
|
-
disabled: !F.shorter,
|
|
904
|
-
onSelect: L(0, -1),
|
|
905
|
-
children: [/* @__PURE__ */ O(a, { children: M("shorter") }), /* @__PURE__ */ O(c, { keys: "Shift+ArrowUp" })]
|
|
906
|
-
})
|
|
907
|
-
] }) : null,
|
|
908
|
-
P.removable ? /* @__PURE__ */ k(he, { children: [P.movable || R ? /* @__PURE__ */ O(o, {}) : null, /* @__PURE__ */ k(i, {
|
|
909
|
-
tone: "danger",
|
|
910
|
-
onSelect: (t) => ke(e, "remove", t.source),
|
|
911
|
-
children: [/* @__PURE__ */ O(a, { children: M("hide") }), /* @__PURE__ */ O(c, { keys: "Delete" })]
|
|
912
|
-
})] }) : null
|
|
913
|
-
] })] }) : null, ze = (e) => /* @__PURE__ */ O("div", {
|
|
914
|
-
"data-part": "message",
|
|
915
|
-
"data-part-message": "",
|
|
916
|
-
children: /* @__PURE__ */ k(C, {
|
|
917
|
-
status: e,
|
|
918
|
-
reach: "section",
|
|
919
|
-
align: "center",
|
|
920
|
-
live: e === "error" ? "polite" : "off",
|
|
921
|
-
children: [
|
|
922
|
-
/* @__PURE__ */ k(S, { children: [/* @__PURE__ */ O(x, { children: e === "empty" ? se ?? M("emptyTitle") : le ?? M("errorTitle") }), (e === "empty" ? ce : ue) === void 0 ? null : /* @__PURE__ */ O(y, { children: e === "empty" ? ce : ue })] }),
|
|
923
|
-
e === "empty" && T !== void 0 ? /* @__PURE__ */ O(b, { children: T }) : null,
|
|
924
|
-
e === "error" && de !== void 0 ? /* @__PURE__ */ O(b, { children: /* @__PURE__ */ O(u, {
|
|
925
|
-
size: "sm",
|
|
926
|
-
tone: "secondary",
|
|
927
|
-
variant: "outline",
|
|
928
|
-
start: /* @__PURE__ */ O(n, { children: /* @__PURE__ */ O(t, { name: "rotate-ccw" }) }),
|
|
929
|
-
onClick: de,
|
|
930
|
-
render: (e) => /* @__PURE__ */ O("button", { ...w(e, "part", "retry") }),
|
|
931
|
-
children: M("retry")
|
|
932
|
-
}) }) : null
|
|
933
|
-
]
|
|
934
|
-
})
|
|
935
|
-
}), Be = ye ? /* @__PURE__ */ O("div", {
|
|
936
|
-
"data-part": "skeleton",
|
|
937
|
-
"data-part-skeleton": "",
|
|
938
|
-
children: oe ?? /* @__PURE__ */ O(g, { shape: "block" })
|
|
939
|
-
}) : ae === "empty" ? ze("empty") : ae === "error" ? ze("error") : ne, z = te({
|
|
940
|
-
...Me,
|
|
941
|
-
style: {
|
|
942
|
-
...Ie(P),
|
|
943
|
-
...A.order === void 0 ? {} : { order: A.order },
|
|
944
|
-
...ve
|
|
945
|
-
},
|
|
946
|
-
"data-part": "widget",
|
|
947
|
-
"data-key": e,
|
|
948
|
-
"data-status": ae,
|
|
949
|
-
...ye ? { "data-loading": "" } : {},
|
|
950
|
-
...P.movable ? { "data-movable": "" } : {},
|
|
951
|
-
...P.resizable ? { "data-resizable": "" } : {},
|
|
952
|
-
...A.dragging ? { "data-dragging": "" } : {},
|
|
953
|
-
...A.resizing ? { "data-resizing": "" } : {},
|
|
954
|
-
ref: Ce,
|
|
955
|
-
children: /* @__PURE__ */ k(he, { children: [
|
|
956
|
-
/* @__PURE__ */ k(p, {
|
|
957
|
-
fill: me,
|
|
958
|
-
size: ge,
|
|
959
|
-
render: (e) => /* @__PURE__ */ O("article", {
|
|
960
|
-
...e,
|
|
961
|
-
ref: j,
|
|
962
|
-
"aria-labelledby": be,
|
|
963
|
-
"aria-describedby": v === void 0 ? void 0 : xe,
|
|
964
|
-
"aria-busy": ye || ie || void 0
|
|
965
|
-
}),
|
|
966
|
-
children: [
|
|
967
|
-
/* @__PURE__ */ k(m, { children: [
|
|
968
|
-
/* @__PURE__ */ O(Ne, {
|
|
969
|
-
"data-part": "title",
|
|
970
|
-
"data-part-title": "",
|
|
971
|
-
id: be,
|
|
972
|
-
children: _
|
|
973
|
-
}),
|
|
974
|
-
v === void 0 ? null : /* @__PURE__ */ O("p", {
|
|
975
|
-
"data-part": "description",
|
|
976
|
-
"data-part-description": "",
|
|
977
|
-
id: xe,
|
|
978
|
-
children: v
|
|
979
|
-
}),
|
|
980
|
-
E !== void 0 || Le !== null ? /* @__PURE__ */ k(h, { children: [E, Le] }) : null
|
|
981
|
-
] }),
|
|
982
|
-
/* @__PURE__ */ k(ee, { children: [ie && !ye ? /* @__PURE__ */ O("span", {
|
|
983
|
-
"data-part": "busy-indicator",
|
|
984
|
-
"data-part-busy-indicator": "",
|
|
985
|
-
"aria-hidden": "true"
|
|
986
|
-
}) : null, Be] }),
|
|
987
|
-
D === void 0 ? null : /* @__PURE__ */ O(f, { children: D })
|
|
988
|
-
]
|
|
989
|
-
}),
|
|
990
|
-
Re,
|
|
991
|
-
Te && R ? $e.map((t) => /* @__PURE__ */ O("span", {
|
|
992
|
-
"data-part": "resize-handle",
|
|
993
|
-
"data-part-resize-handle": "",
|
|
994
|
-
"data-edge": t,
|
|
995
|
-
...A.edge === t ? { "data-active": "" } : {},
|
|
996
|
-
"aria-hidden": "true",
|
|
997
|
-
onPointerDown: (n) => je(e, t, n)
|
|
998
|
-
}, t)) : null,
|
|
999
|
-
A.readout === null ? null : /* @__PURE__ */ O("span", {
|
|
1000
|
-
"data-part": "size-readout",
|
|
1001
|
-
"data-part-size-readout": "",
|
|
1002
|
-
"data-edge": A.edge ?? void 0,
|
|
1003
|
-
"aria-hidden": "true",
|
|
1004
|
-
children: A.readout
|
|
1005
|
-
})
|
|
1006
|
-
] })
|
|
1007
|
-
});
|
|
1008
|
-
return _e === void 0 ? /* @__PURE__ */ O("li", { ...z }) : _e(z);
|
|
1009
|
-
}), W = [];
|
|
1010
|
-
function G() {
|
|
1011
|
-
try {
|
|
1012
|
-
return typeof window > "u" ? null : window.localStorage;
|
|
1013
|
-
} catch {
|
|
1014
|
-
return null;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
function nt({ key: e, storage: t, defaultLayout: n = W }) {
|
|
1018
|
-
let r = E(() => t === void 0 ? G() : t, [t]), [i, a] = me(() => {
|
|
1019
|
-
let t;
|
|
1020
|
-
try {
|
|
1021
|
-
t = r?.getItem(e) ?? null;
|
|
1022
|
-
} catch {
|
|
1023
|
-
t = null;
|
|
1024
|
-
}
|
|
1025
|
-
return (t === null ? null : N(t)) ?? n;
|
|
1026
|
-
});
|
|
1027
|
-
return {
|
|
1028
|
-
layout: i,
|
|
1029
|
-
onLayoutChange: T((t) => {
|
|
1030
|
-
a(t);
|
|
1031
|
-
try {
|
|
1032
|
-
r?.setItem(e, P(t));
|
|
1033
|
-
} catch {}
|
|
1034
|
-
}, [e, r]),
|
|
1035
|
-
clear: T(() => {
|
|
1036
|
-
a(n);
|
|
1037
|
-
try {
|
|
1038
|
-
r?.removeItem(e);
|
|
1039
|
-
} catch {}
|
|
1040
|
-
}, [
|
|
1041
|
-
n,
|
|
1042
|
-
e,
|
|
1043
|
-
r
|
|
1044
|
-
])
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
//#endregion
|
|
1048
|
-
export { ze as a, L as i, tt as n, Re as o, B as r, nt as t };
|