react-semaphor 0.1.569 → 0.1.570
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/appearance/index.js +6 -3
- package/dist/appearance-runtime/index.js +1 -1
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +570 -432
- package/dist/briefings/index.js +2 -2
- package/dist/chunks/appearance-context-BwBp25ZG.js +162 -0
- package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +80 -0
- package/dist/chunks/assistant-chat-B-Ddyy8b.js +5940 -0
- package/dist/chunks/{bookmark-impact-Czg6FGt5.js → bookmark-impact-DCYD-6Fr.js} +1 -1
- package/dist/chunks/brand-B4BdpAB_.js +54 -0
- package/dist/chunks/{card-filter-builder-BS982X7x.js → card-filter-builder-0VvKmRst.js} +72 -72
- package/dist/chunks/{comparison-window-caption-lLTgzOkM.js → comparison-window-caption-PtcDWvkN.js} +2 -2
- package/dist/chunks/{dashboard-BiYSbxZv.js → dashboard-DxGIr1vZ.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Bdj7luOr.js → dashboard-briefing-launcher-B-quOOOQ.js} +183 -182
- package/dist/chunks/{dashboard-controls-TViDsnb8.js → dashboard-controls-Caodx80b.js} +285 -280
- package/dist/chunks/{dashboard-json-Dg9dQd9U.js → dashboard-json-Ct-AGDHF.js} +3 -3
- package/dist/chunks/{dates-BsPrWZIP.js → dates-B9mL8BHE.js} +13 -12
- package/dist/chunks/edit-Bpdh_P_a.js +226 -0
- package/dist/chunks/{edit-dashboard-visual-C6hoIeEJ.js → edit-dashboard-visual-DeDTuYB5.js} +2256 -2268
- package/dist/chunks/{filter-reach-copy-hcQ4os0u.js → filter-reach-copy-BSY33ro5.js} +1425 -1282
- package/dist/chunks/{filter-value-text-CVxEEDVl.js → filter-value-text-DvvSNlho.js} +1 -1
- package/dist/chunks/index-BVKzKl5d.js +90 -0
- package/dist/chunks/{index-RNaTnE3m.js → index-CV_Kzou0.js} +233 -223
- package/dist/chunks/{index-G4q89J6O.js → index-y3HUzRNk.js} +61 -60
- package/dist/chunks/{layout-grid-BIcoFfdS.js → layout-grid-8rR-LPTk.js} +1 -1
- package/dist/chunks/{list-filter-C6tYkHyv.js → list-filter-C1-uTgjR.js} +1 -1
- package/dist/chunks/paintbrush-aR17Z3C9.js +27 -0
- package/dist/chunks/{palette-NjHOE_6B.js → palette-a5FCZKFI.js} +1 -1
- package/dist/chunks/{_commonjsHelpers-Bid1ZNYj.js → pickers-DkqmtnTL.js} +179 -166
- package/dist/chunks/{pivot-result-contract-expectations-DkmueDTW.js → pivot-result-contract-expectations-C-HnUKYe.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-Xc8_GFju.js → report-preferences-dialog-Yvhv3WX2.js} +79 -79
- package/dist/chunks/{resolve-dashboard-input-context-KqvcLcTM.js → resolve-dashboard-input-context-Lkbwycwe.js} +5179 -5391
- package/dist/chunks/resolver-DG_tfEpt.js +156 -0
- package/dist/chunks/{save-C6VmEJTA.js → save-D985VvYp.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-BeXXyoD4.js → saved-dashboard-context-DC_TEd6y.js} +3 -3
- package/dist/chunks/schema-C9NPiIru.js +2568 -0
- package/dist/chunks/{semaphor-ready-indicator-BNkaANsG.js → semaphor-ready-indicator-ByFvqHEO.js} +33935 -34031
- package/dist/chunks/{shelf-drop-preview-context-C_issPBA.js → shelf-drop-preview-context-CjoVaK6J.js} +50 -50
- package/dist/chunks/{stored-dashboard-B6_StAty.js → stored-dashboard-C0hekXiI.js} +189 -188
- package/dist/chunks/{code-editor-BsxHzm9u.js → style-sheet-parts-C7qGZuH1.js} +2400 -2036
- package/dist/chunks/{table-export-sheet-BWP2joD1.js → table-export-sheet-CP8zSOhj.js} +1 -1
- package/dist/chunks/{temporal-input-presentation-scSWQXAB.js → temporal-input-presentation-CqbJjIuu.js} +14 -14
- package/dist/chunks/{upload-BRW4Mwrd.js → upload-CiGNKJ_0.js} +1 -1
- package/dist/chunks/{variable-draft-BQ3OMjvy.js → variable-draft-9-huI1h4.js} +2 -2
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +1911 -1859
- package/dist/format-utils/index.js +8 -8
- package/dist/index.js +332 -335
- package/dist/layouts/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/appearance/index.d.ts +1 -0
- package/dist/types/brand-studio/brand-studio-draft.d.ts +7 -0
- package/dist/types/brand-studio/index.d.ts +1 -1
- package/dist/types/components/briefings/briefing-author/run-model.d.ts +1 -2
- package/dist/types/components/providers/appearance-runtime-provider.d.ts +4 -1
- package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -2
- package/dist/types/components/sharing-and-management/utils/types.d.ts +0 -72
- package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +0 -1
- package/dist/types/components/visual/data-table/types/data-table.d.ts +0 -9
- package/dist/types/components/visual/data-table/utils/pagination-utils.d.ts +0 -19
- package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -1
- package/dist/types/lib/appearance/aliases.d.ts +42 -0
- package/dist/types/lib/appearance/compiler.d.ts +6 -0
- package/dist/types/lib/appearance/defaults.d.ts +6 -0
- package/dist/types/lib/appearance/index.d.ts +2 -0
- package/dist/types/lib/appearance/normalize-organization.d.ts +17 -0
- package/dist/types/lib/appearance/resolver.d.ts +2 -2
- package/dist/types/lib/appearance/types.d.ts +38 -1
- package/dist/types/lib/charts/types.d.ts +6 -2
- package/dist/types/lib/dashboard/semantic-dataset-references.d.ts +0 -1
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +0 -2
- package/dist/types/lib/dashboard-variables/types.d.ts +1 -6
- package/dist/types/lib/download-pdf.d.ts +0 -1
- package/dist/types/lib/hooks/use-dashboard.d.ts +3 -4
- package/dist/types/lib/stores/dashboard-store.d.ts +15 -6
- package/dist/types/lib/stores/editor-store.d.ts +0 -1
- package/dist/types/lib/stores/table-actions.d.ts +0 -1
- package/dist/types/lib/table-formatting/table-formatting-css.d.ts +0 -5
- package/dist/types/lib/types/common-types.d.ts +3 -2
- package/dist/types/lib/types/summary-types.d.ts +0 -5
- package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +4 -4
- package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +10 -10
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +68 -68
- package/dist/types/shared/assistant-protocol/context.d.ts +18 -18
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +212 -42
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +4 -1
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +30 -30
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +4 -4
- package/dist/types/shared/dashboard-authoring/dashboard-style/bounds.d.ts +17 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/brand.d.ts +20 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/edit-words.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/edit.d.ts +19 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/index.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/layers.d.ts +19 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/legacy.d.ts +21 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/parse.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/pickers.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/types.d.ts +122 -0
- package/dist/types/shared/dashboard-authoring/dashboard-style/view.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +11 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +20 -0
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +7 -7
- package/package.json +6 -3
- package/dist/chunks/appearance-context-DEYtWinQ.js +0 -126
- package/dist/chunks/appearance-runtime-provider-B-M8gwlZ.js +0 -81
- package/dist/chunks/assistant-chat-Dzf2Mbph.js +0 -8847
- package/dist/chunks/color-CJvdlFM_.js +0 -2162
- package/dist/chunks/index-CLIro-EG.js +0 -425
- package/dist/types/components/sharing-and-management/utils/group-types.d.ts +0 -105
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const k = {
|
|
2
2
|
/** Widest first. */
|
|
3
3
|
breakpoints: ["lg", "md", "sm", "xs", "xxs"],
|
|
4
4
|
columns: { lg: 48, md: 36, sm: 24, xs: 12, xxs: 6 },
|
|
@@ -8,42 +8,44 @@ const v = {
|
|
|
8
8
|
customizable: ["sm", "xs"],
|
|
9
9
|
/** The preview canvas widths: Laptop, Tablet, Phone, Small phone (Desktop is at least `minContainerWidthPx.lg`; RL-D19). */
|
|
10
10
|
previewWidthPx: { md: 1024, sm: 820, xs: 390, xxs: 360 }
|
|
11
|
-
}, b =
|
|
12
|
-
function
|
|
11
|
+
}, b = k.columns.lg;
|
|
12
|
+
function Q(n) {
|
|
13
13
|
return n === "sm" || n === "xs";
|
|
14
14
|
}
|
|
15
|
-
function Mt(n) {
|
|
16
|
-
return n === "lg" || J(n);
|
|
17
|
-
}
|
|
18
15
|
function kt(n) {
|
|
19
|
-
return n === "
|
|
16
|
+
return n === "lg" || Q(n);
|
|
17
|
+
}
|
|
18
|
+
function vt(n) {
|
|
19
|
+
return n === "md" || kt(n);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const Wt = [
|
|
22
22
|
"table",
|
|
23
23
|
"matrixTable",
|
|
24
24
|
"detailTable"
|
|
25
|
-
],
|
|
25
|
+
], Ht = new Set(Wt);
|
|
26
26
|
function _t(n) {
|
|
27
|
-
return typeof n == "string" &&
|
|
27
|
+
return typeof n == "string" && Ht.has(n);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function zt(n) {
|
|
30
30
|
var t, i;
|
|
31
31
|
return ((t = n == null ? void 0 : n.cards) == null ? void 0 : t.find((o) => o.id === n.activeCardId)) ?? ((i = n == null ? void 0 : n.cards) == null ? void 0 : i[0]);
|
|
32
32
|
}
|
|
33
33
|
function U(n) {
|
|
34
34
|
var i;
|
|
35
|
-
const t = (i =
|
|
35
|
+
const t = (i = zt(n)) == null ? void 0 : i.type;
|
|
36
36
|
return t === "kpi" ? "kpi" : t === "text" ? "text" : _t(t) ? "table" : "chart";
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function it(n) {
|
|
39
39
|
return n === "kpi" || n === "text" ? "short" : "tall";
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const E = {
|
|
42
42
|
kpi: { h: 15, minH: 12, minW: 6 },
|
|
43
43
|
chart: { h: 30, minH: 16, minW: 12 },
|
|
44
44
|
table: { h: 38, minH: 18, minW: 12 },
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
// One line fits at every gap: 6 rows is 42 px of card at the widest gap (24), where the text
|
|
46
|
+
// card's padding tightens to 8 px (dashboard-card.tsx); a heading line is about 23 px.
|
|
47
|
+
text: { h: 10, minH: 6, minW: 12 }
|
|
48
|
+
}, C = {
|
|
47
49
|
kpi: 48,
|
|
48
50
|
chart: 24,
|
|
49
51
|
table: 48,
|
|
@@ -56,16 +58,16 @@ function q(n) {
|
|
|
56
58
|
(e) => Array.from({ length: e }, () => 48 / e)
|
|
57
59
|
);
|
|
58
60
|
}
|
|
59
|
-
const
|
|
61
|
+
const at = {
|
|
60
62
|
full: 48,
|
|
61
63
|
half: 24,
|
|
62
64
|
third: 16,
|
|
63
65
|
quarter: 12
|
|
64
|
-
},
|
|
65
|
-
function
|
|
66
|
+
}, It = ["full", "half", "third", "quarter"];
|
|
67
|
+
function Ot(n) {
|
|
66
68
|
let t = "full", i = 1 / 0;
|
|
67
|
-
for (const o of
|
|
68
|
-
const e = Math.abs(
|
|
69
|
+
for (const o of It) {
|
|
70
|
+
const e = Math.abs(at[o] - n);
|
|
69
71
|
e < i && (t = o, i = e);
|
|
70
72
|
}
|
|
71
73
|
return t;
|
|
@@ -78,43 +80,43 @@ function O(n) {
|
|
|
78
80
|
for (const i of n) t = Math.max(t, i.y + i.h);
|
|
79
81
|
return t;
|
|
80
82
|
}
|
|
81
|
-
function
|
|
83
|
+
function ot(n, t) {
|
|
82
84
|
for (const i of n) if (P(i, t)) return i;
|
|
83
85
|
}
|
|
84
|
-
function
|
|
86
|
+
function At(n) {
|
|
85
87
|
return n.slice().sort((t, i) => t.y > i.y || t.y === i.y && t.x > i.x ? 1 : t.y === i.y && t.x === i.x ? 0 : -1);
|
|
86
88
|
}
|
|
87
|
-
function
|
|
89
|
+
function ft(n, t, i) {
|
|
88
90
|
t.y += 1;
|
|
89
91
|
const o = n.findIndex((e) => e.i === t.i);
|
|
90
92
|
for (let e = o + 1; e < n.length; e += 1) {
|
|
91
93
|
const r = n[e];
|
|
92
94
|
if (!r.static) {
|
|
93
95
|
if (r.y > t.y + t.h) break;
|
|
94
|
-
P(t, r) &&
|
|
96
|
+
P(t, r) && ft(n, r, i + t.h);
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
t.y = i;
|
|
98
100
|
}
|
|
99
|
-
function
|
|
100
|
-
for (t.y = Math.min(O(n), t.y); t.y > 0 && !
|
|
101
|
+
function Et(n, t, i) {
|
|
102
|
+
for (t.y = Math.min(O(n), t.y); t.y > 0 && !ot(n, t); ) t.y -= 1;
|
|
101
103
|
let o;
|
|
102
|
-
for (; o =
|
|
103
|
-
|
|
104
|
+
for (; o = ot(n, t); )
|
|
105
|
+
ft(i, t, o.y + o.h);
|
|
104
106
|
return t.y = Math.max(t.y, 0), t.x = Math.max(t.x, 0), t;
|
|
105
107
|
}
|
|
106
108
|
function g(n) {
|
|
107
|
-
const t = n.map((r) => ({ ...r })), i = t.filter((r) => r.static), o =
|
|
109
|
+
const t = n.map((r) => ({ ...r })), i = t.filter((r) => r.static), o = At(t), e = /* @__PURE__ */ new Map();
|
|
108
110
|
for (const r of o) {
|
|
109
111
|
let s = { ...r };
|
|
110
|
-
s.static || (s =
|
|
112
|
+
s.static || (s = Et(i, s, o), i.push(s)), e.set(r, s);
|
|
111
113
|
}
|
|
112
114
|
return t.map((r) => e.get(r));
|
|
113
115
|
}
|
|
114
|
-
function
|
|
116
|
+
function St(n) {
|
|
115
117
|
return g(n).every((i, o) => i.y === n[o].y && i.x === n[o].x);
|
|
116
118
|
}
|
|
117
|
-
function
|
|
119
|
+
function Bt(n) {
|
|
118
120
|
for (let t = 0; t < n.length; t += 1)
|
|
119
121
|
for (let i = t + 1; i < n.length; i += 1)
|
|
120
122
|
if (P(n[t], n[i])) return !0;
|
|
@@ -137,67 +139,67 @@ function F(n) {
|
|
|
137
139
|
}
|
|
138
140
|
return i.length && t.push(i), t;
|
|
139
141
|
}
|
|
140
|
-
function
|
|
142
|
+
function Lt(n) {
|
|
141
143
|
return new Map(n.map((t, i) => [t, i]));
|
|
142
144
|
}
|
|
143
|
-
function
|
|
144
|
-
const e = (
|
|
145
|
+
function Tt(n, t, i, o) {
|
|
146
|
+
const e = (d) => t.get(d) ?? "chart", r = A(n, i).map((d) => d.i), s = r.find((d) => e(d) === "text"), a = o ? r : [
|
|
145
147
|
...s ? [s] : [],
|
|
146
|
-
...r.filter((
|
|
147
|
-
...r.filter((
|
|
148
|
-
...r.filter((
|
|
149
|
-
...r.filter((
|
|
150
|
-
], f = (
|
|
151
|
-
const m = a[
|
|
148
|
+
...r.filter((d) => e(d) === "kpi"),
|
|
149
|
+
...r.filter((d) => e(d) === "chart"),
|
|
150
|
+
...r.filter((d) => e(d) === "table"),
|
|
151
|
+
...r.filter((d) => e(d) === "text" && d !== s)
|
|
152
|
+
], f = (d) => {
|
|
153
|
+
const m = a[d];
|
|
152
154
|
if (!o) return a.filter((M) => e(M) === e(m));
|
|
153
|
-
let
|
|
154
|
-
for (;
|
|
155
|
-
let l =
|
|
155
|
+
let p = d;
|
|
156
|
+
for (; p > 0 && e(a[p - 1]) === e(m); ) p -= 1;
|
|
157
|
+
let l = d;
|
|
156
158
|
for (; l < a.length - 1 && e(a[l + 1]) === e(m); ) l += 1;
|
|
157
|
-
return a.slice(
|
|
158
|
-
}, y = (
|
|
159
|
-
const m = a[
|
|
160
|
-
if (
|
|
161
|
-
if (
|
|
162
|
-
const l = f(
|
|
163
|
-
if (
|
|
159
|
+
return a.slice(p, l + 1);
|
|
160
|
+
}, y = (d) => {
|
|
161
|
+
const m = a[d], p = e(m);
|
|
162
|
+
if (p === "table") return b;
|
|
163
|
+
if (p === "text") return m === s ? b : b / 2;
|
|
164
|
+
const l = f(d);
|
|
165
|
+
if (p === "kpi") return q(l.length)[l.indexOf(m)];
|
|
164
166
|
const M = l.indexOf(m);
|
|
165
167
|
return l.length === 1 || l.length % 2 === 1 && M === 0 ? b : b / 2;
|
|
166
168
|
};
|
|
167
|
-
let x = 0,
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
x > 0 && x + l > b && (x = 0,
|
|
171
|
-
const M = { i:
|
|
172
|
-
return x += l, u = Math.max(u,
|
|
169
|
+
let x = 0, c = 0, u = 0;
|
|
170
|
+
const h = a.map((d, m) => {
|
|
171
|
+
const p = E[e(d)], l = Math.min(y(m), b);
|
|
172
|
+
x > 0 && x + l > b && (x = 0, c += u, u = 0);
|
|
173
|
+
const M = { i: d, x, y: c, w: l, h: p.h, minW: Math.min(p.minW, b), minH: p.minH };
|
|
174
|
+
return x += l, u = Math.max(u, p.h), M;
|
|
173
175
|
});
|
|
174
|
-
return { items: g(
|
|
176
|
+
return { items: g(h), order: a };
|
|
175
177
|
}
|
|
176
|
-
function
|
|
178
|
+
function $(n) {
|
|
177
179
|
return Math.floor(n + 0.5);
|
|
178
180
|
}
|
|
179
|
-
function
|
|
180
|
-
const s =
|
|
181
|
+
function ct(n, t, i, o, e, r) {
|
|
182
|
+
const s = k.columns[t], a = { i: n.i, x: i, y: o, w: e, h: n.h }, f = r ?? n.minW;
|
|
181
183
|
return f !== void 0 && (a.minW = Math.max(1, Math.min(f, e, s))), n.minH !== void 0 && (a.minH = n.minH), n.maxW !== void 0 && (a.maxW = Math.max(e, Math.min(n.maxW, s))), n.maxH !== void 0 && (a.maxH = n.maxH), n.static !== void 0 && (a.static = n.static), n.isResizable !== void 0 && (a.isResizable = n.isResizable), n.isDraggable !== void 0 && (a.isDraggable = n.isDraggable), a;
|
|
182
184
|
}
|
|
183
|
-
function
|
|
185
|
+
function dt(n) {
|
|
184
186
|
return g(
|
|
185
187
|
n.map((t) => {
|
|
186
|
-
let i =
|
|
188
|
+
let i = $(t.x * 0.75), e = $((t.x + t.w) * 0.75) - i;
|
|
187
189
|
e === 0 && (e = 1, i === 36 && (i = 35));
|
|
188
|
-
const r = t.minW === void 0 ? void 0 : Math.min(Math.max(1,
|
|
189
|
-
return
|
|
190
|
+
const r = t.minW === void 0 ? void 0 : Math.min(Math.max(1, $(t.minW * 0.75)), e);
|
|
191
|
+
return ct(t, "md", i, t.y, e, r);
|
|
190
192
|
})
|
|
191
193
|
);
|
|
192
194
|
}
|
|
193
|
-
function
|
|
194
|
-
const i = new Map(
|
|
195
|
+
function Ct(n, t) {
|
|
196
|
+
const i = new Map(dt(n).map((r) => [r.i, r])), o = new Map(t.map((r) => [r.i, r])), e = k.columns.lg;
|
|
195
197
|
return n.map((r) => {
|
|
196
198
|
const s = o.get(r.i), a = i.get(r.i);
|
|
197
199
|
if (!s || !a) return r;
|
|
198
200
|
const f = { ...r };
|
|
199
201
|
if (s.x !== a.x || s.w !== a.w) {
|
|
200
|
-
const y = Math.min(e - 1,
|
|
202
|
+
const y = Math.min(e - 1, $(s.x * 1.3333333333333333)), x = Math.min(e, Math.max(y + 1, $((s.x + s.w) * (4 / 3))));
|
|
201
203
|
f.x = y, f.w = x - y;
|
|
202
204
|
}
|
|
203
205
|
return (s.y !== a.y || s.h !== a.h) && (f.y = s.y, f.h = s.h), f;
|
|
@@ -209,12 +211,12 @@ function K(n, t, i) {
|
|
|
209
211
|
for (const r of n) {
|
|
210
212
|
let s = 0;
|
|
211
213
|
for (const a of r)
|
|
212
|
-
o.set(a.source.i,
|
|
214
|
+
o.set(a.source.i, ct(a.source, t, a.x, e, a.w)), s = Math.max(s, a.source.h);
|
|
213
215
|
e += s;
|
|
214
216
|
}
|
|
215
217
|
return g(i.map((r) => o.get(r.i)));
|
|
216
218
|
}
|
|
217
|
-
function
|
|
219
|
+
function et(n, t, i) {
|
|
218
220
|
const o = [];
|
|
219
221
|
for (const e of n) {
|
|
220
222
|
let r;
|
|
@@ -230,17 +232,17 @@ function ot(n, t, i) {
|
|
|
230
232
|
}
|
|
231
233
|
return o;
|
|
232
234
|
}
|
|
233
|
-
function
|
|
234
|
-
if (n === "md") return
|
|
235
|
-
const e =
|
|
236
|
-
return n === "sm" ? K(
|
|
235
|
+
function ut(n, t, i, o) {
|
|
236
|
+
if (n === "md") return dt(t);
|
|
237
|
+
const e = k.columns[n], r = F(A(t, o)), s = (a) => i.get(a.i) ?? "chart";
|
|
238
|
+
return n === "sm" ? K(et(r, e, (a) => s(a) === "table" || s(a) === "text"), "sm", t) : n === "xs" ? K(et(r, e, (a) => s(a) !== "kpi"), "xs", t) : K(
|
|
237
239
|
r.flatMap((a) => a.map((f) => [{ source: f, x: 0, w: e }])),
|
|
238
240
|
"xxs",
|
|
239
241
|
t
|
|
240
242
|
);
|
|
241
243
|
}
|
|
242
|
-
function
|
|
243
|
-
const o =
|
|
244
|
+
function _(n, t, i) {
|
|
245
|
+
const o = E[t];
|
|
244
246
|
return { i: n, x: 0, y: 0, w: i, h: o.h, minW: Math.min(o.minW, i), minH: o.minH };
|
|
245
247
|
}
|
|
246
248
|
function Y(n, t) {
|
|
@@ -249,7 +251,7 @@ function Y(n, t) {
|
|
|
249
251
|
function X(n, t, i) {
|
|
250
252
|
return n.map((o) => o.y >= t ? { ...o, y: o.y + i } : o);
|
|
251
253
|
}
|
|
252
|
-
function
|
|
254
|
+
function $t(n, t, i) {
|
|
253
255
|
const o = (f, y) => !t.some((x) => P({ ...n, i: "\0", x: f, y }, x)), e = n.x + n.w;
|
|
254
256
|
if (e + n.w <= i && o(e, n.y)) return { x: e, y: n.y };
|
|
255
257
|
const r = Math.max(i - n.w, 0), s = n.y + n.h, a = [s, ...t.map((f) => f.y + f.h).filter((f) => f > s).sort((f, y) => f - y)];
|
|
@@ -257,7 +259,7 @@ function Ct(n, t, i) {
|
|
|
257
259
|
for (let y = 0; y <= r; y += 1) if (o(y, f)) return { x: y, y: f };
|
|
258
260
|
return { x: 0, y: s };
|
|
259
261
|
}
|
|
260
|
-
function
|
|
262
|
+
function mt(n, t) {
|
|
261
263
|
const i = Math.max(1, Math.min(n.w, t));
|
|
262
264
|
return {
|
|
263
265
|
...n,
|
|
@@ -267,248 +269,252 @@ function ut(n, t) {
|
|
|
267
269
|
...n.maxW !== void 0 ? { maxW: Math.max(i, Math.min(n.maxW, t)) } : {}
|
|
268
270
|
};
|
|
269
271
|
}
|
|
270
|
-
function
|
|
271
|
-
const e = n.find((f) => f.i === t), r =
|
|
272
|
+
function lt(n, t, i, o) {
|
|
273
|
+
const e = n.find((f) => f.i === t), r = mt(e, o), { x: s, y: a } = $t(r, n.filter((f) => f.i !== t), o);
|
|
272
274
|
return [...n, { ...r, i, x: s, y: a }];
|
|
273
275
|
}
|
|
274
|
-
function
|
|
275
|
-
var
|
|
276
|
+
function Rt(n, t, i, o, e) {
|
|
277
|
+
var h, d;
|
|
276
278
|
const r = o == null ? void 0 : o.position;
|
|
277
279
|
if (r && typeof r == "object" && "beside" in r)
|
|
278
|
-
return g(Y(
|
|
279
|
-
const s = o != null && o.width ?
|
|
280
|
+
return g(Y(lt(n, r.beside, t, b), e.frameOrder));
|
|
281
|
+
const s = o != null && o.width ? at[o.width] : void 0;
|
|
280
282
|
let a = n.slice();
|
|
281
283
|
const f = (m) => g(Y([...a, m], e.frameOrder));
|
|
282
284
|
if (r === "top") {
|
|
283
|
-
const m =
|
|
285
|
+
const m = _(t, i, s ?? C[i]);
|
|
284
286
|
return a = X(a, 0, m.h), f(m);
|
|
285
287
|
}
|
|
286
288
|
if (r === "end")
|
|
287
|
-
return f({ ...
|
|
288
|
-
const y = r === void 0 && s !== void 0, x = r && typeof r == "object" && "after" in r ? r.after : y ? (
|
|
289
|
-
if (y && x === void 0) return f(
|
|
289
|
+
return f({ ..._(t, i, s ?? C[i]), y: O(a) });
|
|
290
|
+
const y = r === void 0 && s !== void 0, x = r && typeof r == "object" && "after" in r ? r.after : y ? (h = A(a, e.frameOrder).at(-1)) == null ? void 0 : h.i : void 0;
|
|
291
|
+
if (y && x === void 0) return f(_(t, i, s));
|
|
290
292
|
if (x !== void 0) {
|
|
291
|
-
const m =
|
|
293
|
+
const m = _(t, i, s ?? C[i]), l = F(A(a, e.frameOrder)).find((W) => W.some((v) => v.i === x)), M = l.find((W) => W.i === x), z = l[l.length - 1];
|
|
292
294
|
if (b - (z.x + z.w) >= m.w) {
|
|
293
|
-
const W = new Set(l.filter((
|
|
294
|
-
return a = a.map((
|
|
295
|
+
const W = new Set(l.filter((v) => v.x > M.x).map((v) => v.i));
|
|
296
|
+
return a = a.map((v) => W.has(v.i) ? { ...v, x: v.x + m.w } : v), f({ ...m, x: M.x + M.w, y: M.y });
|
|
295
297
|
}
|
|
296
|
-
const
|
|
297
|
-
return a = X(a,
|
|
298
|
+
const B = Math.max(...l.map((W) => W.y + W.h));
|
|
299
|
+
return a = X(a, B, m.h), f({ ...m, x: 0, y: B });
|
|
298
300
|
}
|
|
299
|
-
const
|
|
301
|
+
const c = (m) => e.kinds.get(m.i) ?? "chart", u = F(A(a, e.frameOrder));
|
|
300
302
|
if (i === "kpi") {
|
|
301
|
-
const m = ((
|
|
302
|
-
let
|
|
303
|
-
for (;
|
|
304
|
-
if (
|
|
305
|
-
const w = m === 1 ? u[0][0].y + u[0][0].h : 0, D =
|
|
303
|
+
const m = ((d = u[0]) == null ? void 0 : d.length) === 1 && c(u[0][0]) === "text" ? 1 : 0;
|
|
304
|
+
let p = m;
|
|
305
|
+
for (; p < u.length && u[p].every((w) => c(w) === "kpi"); ) p += 1;
|
|
306
|
+
if (p === m) {
|
|
307
|
+
const w = m === 1 ? u[0][0].y + u[0][0].h : 0, D = _(t, i, q(1)[0]);
|
|
306
308
|
return a = X(a, w, D.h), f({ ...D, y: w });
|
|
307
309
|
}
|
|
308
|
-
const l = u.slice(m,
|
|
309
|
-
let
|
|
310
|
-
const
|
|
310
|
+
const l = u.slice(m, p).flat(), M = new Set(l.map((w) => w.i)), z = Math.min(...l.map((w) => w.y)), S = Math.max(...l.map((w) => w.y + w.h)), B = [...l, _(t, i, 12)], W = q(B.length);
|
|
311
|
+
let v = 0, G = z, L = 0;
|
|
312
|
+
const bt = B.map((w, D) => {
|
|
311
313
|
const N = W[D];
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
return
|
|
315
|
-
}),
|
|
316
|
-
return g(Y([...
|
|
314
|
+
v > 0 && v + N > b && (v = 0, G += L, L = 0);
|
|
315
|
+
const Mt = { ...w, x: v, y: G, w: N, ...w.minW !== void 0 ? { minW: Math.min(w.minW, N) } : {} };
|
|
316
|
+
return v += N, L = Math.max(L, w.h), Mt;
|
|
317
|
+
}), nt = G + L, gt = a.filter((w) => !M.has(w.i)).map((w) => w.y >= z && nt > S ? { ...w, y: w.y + (nt - S) } : w);
|
|
318
|
+
return g(Y([...gt, ...bt], e.frameOrder));
|
|
317
319
|
}
|
|
318
320
|
if (i === "chart") {
|
|
319
|
-
const m = u[u.length - 1],
|
|
320
|
-
return
|
|
321
|
+
const m = u[u.length - 1], p = (m == null ? void 0 : m.length) === 1 ? m[0] : void 0;
|
|
322
|
+
return p && c(p) === "chart" && (p.x + p.w <= 24 || p.x >= 24) ? f({ ..._(t, i, 24), x: p.x + p.w <= 24 ? 24 : 0, y: p.y }) : f({ ..._(t, i, 24), y: O(a) });
|
|
321
323
|
}
|
|
322
|
-
return f({ ...
|
|
324
|
+
return f({ ..._(t, i, b), y: O(a) });
|
|
323
325
|
}
|
|
324
|
-
function
|
|
326
|
+
function ht(n, t, i) {
|
|
325
327
|
const o = Math.max(1, Math.min(i, Math.round(t.w * i / b)));
|
|
326
|
-
return [...n,
|
|
328
|
+
return [...n, mt({ ...t, x: 0, y: O(n), w: o }, i)];
|
|
327
329
|
}
|
|
328
|
-
const
|
|
329
|
-
function
|
|
330
|
+
const tt = ["md", "sm", "xs", "xxs"], pt = [];
|
|
331
|
+
function T(n) {
|
|
330
332
|
const t = n.map((i) => i.id);
|
|
331
333
|
return {
|
|
332
334
|
frames: n,
|
|
333
335
|
ids: t,
|
|
334
336
|
kinds: new Map(n.map((i) => [i.id, U(i)])),
|
|
335
|
-
frameOrder:
|
|
337
|
+
frameOrder: Lt(t)
|
|
336
338
|
};
|
|
337
339
|
}
|
|
338
|
-
function
|
|
340
|
+
function H(n) {
|
|
339
341
|
return typeof n == "number" && Number.isFinite(n) ? Math.round(n) : void 0;
|
|
340
342
|
}
|
|
341
|
-
function
|
|
343
|
+
function R(n, t, i) {
|
|
342
344
|
const o = new Set(i.ids), e = /* @__PURE__ */ new Map();
|
|
343
345
|
if (!Array.isArray(n)) return e;
|
|
344
346
|
for (const r of n) {
|
|
345
347
|
if (!r || typeof r != "object") continue;
|
|
346
348
|
const s = r, a = s.i;
|
|
347
349
|
if (typeof a != "string" || !o.has(a) || e.has(a)) continue;
|
|
348
|
-
const f = i.kinds.get(a) ?? "chart", y =
|
|
350
|
+
const f = i.kinds.get(a) ?? "chart", y = H(s.minH), x = Math.max(1, Math.min(H(s.w) ?? Math.min(C[f], t), t)), c = Math.max(H(s.h) ?? E[f].h, y ?? 1, 1), u = {
|
|
349
351
|
i: a,
|
|
350
|
-
x: Math.max(0, Math.min(
|
|
351
|
-
y: Math.max(0,
|
|
352
|
+
x: Math.max(0, Math.min(H(s.x) ?? 0, t - x)),
|
|
353
|
+
y: Math.max(0, H(s.y) ?? Number.MAX_SAFE_INTEGER),
|
|
352
354
|
w: x,
|
|
353
|
-
h:
|
|
354
|
-
},
|
|
355
|
-
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
const m =
|
|
359
|
-
m !== void 0 && (u.maxH = Math.max(m,
|
|
355
|
+
h: c
|
|
356
|
+
}, h = H(s.minW);
|
|
357
|
+
h !== void 0 && (u.minW = Math.max(1, Math.min(h, x))), y !== void 0 && (u.minH = Math.max(1, Math.min(y, c)));
|
|
358
|
+
const d = H(s.maxW);
|
|
359
|
+
d !== void 0 && (u.maxW = Math.max(d, x));
|
|
360
|
+
const m = H(s.maxH);
|
|
361
|
+
m !== void 0 && (u.maxH = Math.max(m, c)), typeof s.static == "boolean" && (u.static = s.static), typeof s.isResizable == "boolean" && (u.isResizable = s.isResizable), typeof s.isDraggable == "boolean" && (u.isDraggable = s.isDraggable), e.set(a, V(u, i));
|
|
360
362
|
}
|
|
361
363
|
return e;
|
|
362
364
|
}
|
|
363
|
-
function
|
|
365
|
+
function V(n, t) {
|
|
366
|
+
const i = E[t.kinds.get(n.i) ?? "chart"].minH;
|
|
367
|
+
return n.minH !== void 0 && n.minH > i ? { ...n, minH: i } : n;
|
|
368
|
+
}
|
|
369
|
+
function Dt(n, t) {
|
|
364
370
|
return t.ids.every((i) => n.has(i));
|
|
365
371
|
}
|
|
366
372
|
function j(n, t) {
|
|
367
373
|
return t.ids.flatMap((i) => n.has(i) ? [n.get(i)] : []);
|
|
368
374
|
}
|
|
369
|
-
function
|
|
375
|
+
function Z(n, t) {
|
|
370
376
|
const i = g(j(n, t)), o = new Map(i.map((r) => [r.i, r]));
|
|
371
377
|
let e = O(i);
|
|
372
378
|
for (const r of t.ids) {
|
|
373
379
|
if (o.has(r)) continue;
|
|
374
|
-
const s = t.kinds.get(r) ?? "chart", a =
|
|
380
|
+
const s = t.kinds.get(r) ?? "chart", a = E[s], f = C[s];
|
|
375
381
|
o.set(r, { i: r, x: 0, y: e, w: f, h: a.h, minW: Math.min(a.minW, f), minH: a.minH }), e += a.h;
|
|
376
382
|
}
|
|
377
383
|
return g(t.ids.map((r) => o.get(r)));
|
|
378
384
|
}
|
|
379
|
-
function
|
|
385
|
+
function Nt(n, t) {
|
|
380
386
|
const i = b / t;
|
|
381
387
|
return n.map((o) => {
|
|
382
388
|
if (!o || typeof o != "object") return o;
|
|
383
|
-
const e = o, r =
|
|
389
|
+
const e = o, r = H(e.x), s = H(e.w);
|
|
384
390
|
if (r === void 0 || s === void 0) return e;
|
|
385
391
|
const a = Math.round(r * i), f = Math.round((r + s) * i);
|
|
386
392
|
return { ...e, x: a, w: Math.max(1, f - a) };
|
|
387
393
|
});
|
|
388
394
|
}
|
|
389
|
-
function
|
|
395
|
+
function Ft(n) {
|
|
390
396
|
const t = n.layouts ?? {};
|
|
391
397
|
if (Array.isArray(t.lg)) return t.lg;
|
|
392
398
|
if (Array.isArray(n.layout)) return n.layout;
|
|
393
|
-
for (const i of
|
|
399
|
+
for (const i of tt) {
|
|
394
400
|
const o = t[i];
|
|
395
|
-
if (Array.isArray(o)) return
|
|
401
|
+
if (Array.isArray(o)) return Nt(o, k.columns[i]);
|
|
396
402
|
}
|
|
397
403
|
return [];
|
|
398
404
|
}
|
|
399
|
-
function
|
|
405
|
+
function rt(n, t) {
|
|
400
406
|
var i;
|
|
401
407
|
return (i = n.layouts) == null ? void 0 : i[t];
|
|
402
408
|
}
|
|
403
|
-
function
|
|
409
|
+
function xt(n, t, i, o) {
|
|
404
410
|
let e = g(j(n, o));
|
|
405
411
|
for (const r of t)
|
|
406
|
-
n.has(r.i) || (e =
|
|
407
|
-
return g(
|
|
412
|
+
n.has(r.i) || (e = ht(e, r, k.columns[i]));
|
|
413
|
+
return g(J(e, o));
|
|
408
414
|
}
|
|
409
|
-
function
|
|
415
|
+
function J(n, t) {
|
|
410
416
|
return n.slice().sort((i, o) => (t.frameOrder.get(i.i) ?? 0) - (t.frameOrder.get(o.i) ?? 0));
|
|
411
417
|
}
|
|
412
|
-
const
|
|
413
|
-
function
|
|
418
|
+
const jt = ["i", "x", "y", "w", "h", "minW", "minH", "maxW", "maxH", "static", "isResizable", "isDraggable"];
|
|
419
|
+
function yt(n, t) {
|
|
414
420
|
return !Array.isArray(n) || n.length !== t.length ? !1 : t.every((i, o) => {
|
|
415
421
|
const e = n[o];
|
|
416
|
-
return !!e &&
|
|
422
|
+
return !!e && jt.every((r) => e[r] === i[r]);
|
|
417
423
|
});
|
|
418
424
|
}
|
|
419
|
-
function
|
|
425
|
+
function Pt(n, t) {
|
|
420
426
|
const i = new Map(t.map((o) => [o.i, o]));
|
|
421
427
|
return n.length === t.length && n.every((o) => {
|
|
422
428
|
const e = i.get(o.i);
|
|
423
429
|
return !!e && e.x === o.x && e.y === o.y && e.w === o.w && e.h === o.h;
|
|
424
430
|
});
|
|
425
431
|
}
|
|
426
|
-
function
|
|
427
|
-
return
|
|
432
|
+
function Gt(n, t) {
|
|
433
|
+
return k.breakpoints.every((i) => yt(n[i], t[i]));
|
|
428
434
|
}
|
|
429
|
-
function
|
|
430
|
-
return
|
|
435
|
+
function Kt(n) {
|
|
436
|
+
return k.customizable.filter((t) => n.includes(t));
|
|
431
437
|
}
|
|
432
|
-
function
|
|
438
|
+
function wt(n, t, i) {
|
|
433
439
|
const o = { lg: n };
|
|
434
|
-
for (const e of
|
|
435
|
-
o[e] = i[e] ??
|
|
440
|
+
for (const e of tt)
|
|
441
|
+
o[e] = i[e] ?? ut(e, n, t.kinds, t.frameOrder);
|
|
436
442
|
return o;
|
|
437
443
|
}
|
|
438
|
-
function
|
|
444
|
+
function Yt(n, t) {
|
|
439
445
|
return F(A(n, t.frameOrder)).map((i) => ({
|
|
440
|
-
tiles: i.map((o) => ({ frameId: o.i, kind: t.kinds.get(o.i) ?? "chart", width:
|
|
446
|
+
tiles: i.map((o) => ({ frameId: o.i, kind: t.kinds.get(o.i) ?? "chart", width: Ot(o.w) }))
|
|
441
447
|
}));
|
|
442
448
|
}
|
|
443
|
-
function
|
|
444
|
-
const t =
|
|
445
|
-
for (const f of
|
|
446
|
-
const y =
|
|
447
|
-
if (
|
|
449
|
+
function Xt(n) {
|
|
450
|
+
const t = T(n.frames ?? pt), i = Z(R(Ft(n), b, t), t), o = Array.isArray(n.customizedBreakpoints), e = {}, r = [];
|
|
451
|
+
for (const f of tt) {
|
|
452
|
+
const y = k.columns[f], x = R(rt(n, f), y, t), c = Dt(x, t) && t.ids.length > 0;
|
|
453
|
+
if (Q(f)) {
|
|
448
454
|
if (o && n.customizedBreakpoints.includes(f)) {
|
|
449
|
-
e[f] =
|
|
455
|
+
e[f] = xt(x, i, f, t), r.push(f);
|
|
450
456
|
continue;
|
|
451
457
|
}
|
|
452
|
-
if (!o &&
|
|
453
|
-
const
|
|
454
|
-
|
|
458
|
+
if (!o && c) {
|
|
459
|
+
const h = g(j(x, t));
|
|
460
|
+
Pt(h, ut(f, i, t.kinds, t.frameOrder)) || (e[f] = h, r.push(f));
|
|
455
461
|
}
|
|
456
462
|
continue;
|
|
457
463
|
}
|
|
458
|
-
!o &&
|
|
464
|
+
!o && c && (e[f] = g(j(x, t)));
|
|
459
465
|
}
|
|
460
|
-
const s =
|
|
461
|
-
return { layouts: s, customizedBreakpoints: r, rows:
|
|
466
|
+
const s = wt(i, t, e), a = k.breakpoints.some((f) => !yt(rt(n, f), s[f]));
|
|
467
|
+
return { layouts: s, customizedBreakpoints: r, rows: Yt(i, t), repaired: a };
|
|
462
468
|
}
|
|
463
469
|
function I(n) {
|
|
464
470
|
return { ok: !1, failure: n };
|
|
465
471
|
}
|
|
466
|
-
function
|
|
467
|
-
const o =
|
|
472
|
+
function st(n, t, i) {
|
|
473
|
+
const o = E[i];
|
|
468
474
|
return n.map((e) => e.i === t ? { ...e, h: o.h, minH: o.minH, minW: Math.min(o.minW, e.w) } : e);
|
|
469
475
|
}
|
|
470
|
-
function
|
|
471
|
-
const i =
|
|
476
|
+
function Ut(n, t) {
|
|
477
|
+
const i = Xt(n), o = n.frames ?? pt;
|
|
472
478
|
let e = o, r = i.layouts.lg, s = i.customizedBreakpoints.slice();
|
|
473
479
|
const a = {};
|
|
474
|
-
for (const
|
|
480
|
+
for (const c of s) a[c] = i.layouts[c];
|
|
475
481
|
switch (t.kind) {
|
|
476
482
|
case "frame_added": {
|
|
477
|
-
const { frame:
|
|
478
|
-
if (o.some((l) => l.id ===
|
|
479
|
-
return I({ code: "frame_already_on_sheet", frameId:
|
|
480
|
-
const
|
|
481
|
-
if (
|
|
482
|
-
return I({ code: "position_target_not_found", frameId:
|
|
483
|
-
if (
|
|
484
|
-
else if (
|
|
485
|
-
const l = o.findIndex((M) => M.id ===
|
|
486
|
-
e = [...o.slice(0, l + 1),
|
|
487
|
-
} else e = [...o,
|
|
488
|
-
const m =
|
|
489
|
-
r =
|
|
490
|
-
const
|
|
483
|
+
const { frame: c, placement: u } = t;
|
|
484
|
+
if (o.some((l) => l.id === c.id))
|
|
485
|
+
return I({ code: "frame_already_on_sheet", frameId: c.id, message: `A frame with id ${c.id} is already on this sheet.` });
|
|
486
|
+
const h = u == null ? void 0 : u.position, d = typeof h == "object" ? "after" in h ? h.after : h.beside : void 0;
|
|
487
|
+
if (d !== void 0 && !o.some((l) => l.id === d))
|
|
488
|
+
return I({ code: "position_target_not_found", frameId: d, message: `No frame ${d} on this sheet to place the new frame next to.` });
|
|
489
|
+
if (h === "top") e = [c, ...o];
|
|
490
|
+
else if (d !== void 0) {
|
|
491
|
+
const l = o.findIndex((M) => M.id === d);
|
|
492
|
+
e = [...o.slice(0, l + 1), c, ...o.slice(l + 1)];
|
|
493
|
+
} else e = [...o, c];
|
|
494
|
+
const m = T(e);
|
|
495
|
+
r = Rt(r, c.id, m.kinds.get(c.id), u, m);
|
|
496
|
+
const p = r.find((l) => l.i === c.id);
|
|
491
497
|
for (const l of s) {
|
|
492
|
-
const M =
|
|
493
|
-
a[l] = g(
|
|
498
|
+
const M = k.columns[l], z = a[l], S = typeof h == "object" && "beside" in h ? lt(z, h.beside, c.id, M) : ht(z, p, M);
|
|
499
|
+
a[l] = g(J(S, m));
|
|
494
500
|
}
|
|
495
501
|
break;
|
|
496
502
|
}
|
|
497
503
|
case "frame_removed": {
|
|
498
|
-
if (!o.some((
|
|
504
|
+
if (!o.some((c) => c.id === t.frameId))
|
|
499
505
|
return I({ code: "frame_not_on_sheet", frameId: t.frameId, message: `No frame ${t.frameId} on this sheet.` });
|
|
500
|
-
e = o.filter((
|
|
501
|
-
for (const
|
|
502
|
-
a[
|
|
506
|
+
e = o.filter((c) => c.id !== t.frameId), r = g(r.filter((c) => c.i !== t.frameId));
|
|
507
|
+
for (const c of s)
|
|
508
|
+
a[c] = g(a[c].filter((u) => u.i !== t.frameId));
|
|
503
509
|
break;
|
|
504
510
|
}
|
|
505
511
|
case "frame_updated": {
|
|
506
|
-
const
|
|
507
|
-
if (
|
|
512
|
+
const c = o.findIndex((d) => d.id === t.frame.id);
|
|
513
|
+
if (c < 0)
|
|
508
514
|
return I({ code: "frame_not_on_sheet", frameId: t.frame.id, message: `No frame ${t.frame.id} on this sheet.` });
|
|
509
|
-
e = o.map((
|
|
510
|
-
const u = U(o[
|
|
511
|
-
if (u ===
|
|
515
|
+
e = o.map((d, m) => m === c ? t.frame : d);
|
|
516
|
+
const u = U(o[c]), h = U(t.frame);
|
|
517
|
+
if (u === h)
|
|
512
518
|
return {
|
|
513
519
|
ok: !0,
|
|
514
520
|
frames: e,
|
|
@@ -517,50 +523,54 @@ function Xt(n, t) {
|
|
|
517
523
|
changed: !0,
|
|
518
524
|
layoutsChanged: !1
|
|
519
525
|
};
|
|
520
|
-
if (t.resizeForNewKind &&
|
|
521
|
-
r = g(
|
|
522
|
-
for (const
|
|
523
|
-
a[
|
|
526
|
+
if (t.resizeForNewKind && it(u) !== it(h)) {
|
|
527
|
+
r = g(st(r, t.frame.id, h));
|
|
528
|
+
for (const d of s)
|
|
529
|
+
a[d] = g(st(a[d], t.frame.id, h));
|
|
524
530
|
}
|
|
525
531
|
break;
|
|
526
532
|
}
|
|
527
533
|
case "grid_edited": {
|
|
528
|
-
if (!
|
|
534
|
+
if (!vt(t.breakpoint))
|
|
529
535
|
return I({ code: "breakpoint_not_editable", breakpoint: String(t.breakpoint), message: `The ${String(t.breakpoint)} layout is derived; edit Desktop, Tablet or Phone.` });
|
|
530
|
-
const
|
|
536
|
+
const c = T(o);
|
|
531
537
|
if (t.breakpoint === "md") {
|
|
532
|
-
const u = [
|
|
533
|
-
r =
|
|
538
|
+
const u = [...R(t.items, k.columns.md, c).values()];
|
|
539
|
+
r = Z(new Map(Ct(r, u).map((h) => [h.i, h])), c);
|
|
534
540
|
} else if (t.breakpoint === "lg")
|
|
535
|
-
r =
|
|
541
|
+
r = Z(R(t.items, b, c), c);
|
|
536
542
|
else {
|
|
537
543
|
const u = t.breakpoint;
|
|
538
|
-
a[u] =
|
|
544
|
+
a[u] = xt(R(t.items, k.columns[u], c), r, u, c), s.includes(u) || (s = Kt([...s, u]));
|
|
539
545
|
}
|
|
540
546
|
break;
|
|
541
547
|
}
|
|
542
548
|
case "reset_to_automatic": {
|
|
543
|
-
if (!
|
|
549
|
+
if (!Q(t.breakpoint))
|
|
544
550
|
return I({ code: "breakpoint_not_editable", breakpoint: String(t.breakpoint), message: "Only Tablet and Phone can go back to automatic." });
|
|
545
|
-
s = s.filter((
|
|
551
|
+
s = s.filter((c) => c !== t.breakpoint), delete a[t.breakpoint];
|
|
546
552
|
break;
|
|
547
553
|
}
|
|
548
554
|
case "arrange": {
|
|
549
|
-
const
|
|
550
|
-
e = u.order.map((
|
|
551
|
-
for (const
|
|
555
|
+
const c = T(o), u = Tt(r, c.kinds, c.frameOrder, t.keepOrder === !0), h = new Map(o.map((d) => [d.id, d]));
|
|
556
|
+
e = u.order.map((d) => h.get(d)), e.every((d, m) => d === o[m]) && (e = o), r = u.items, s = [];
|
|
557
|
+
for (const d of k.customizable) delete a[d];
|
|
552
558
|
break;
|
|
553
559
|
}
|
|
554
560
|
}
|
|
555
|
-
const f =
|
|
556
|
-
r =
|
|
557
|
-
|
|
561
|
+
const f = T(e);
|
|
562
|
+
r = J(r, f).map((c) => V(c, f));
|
|
563
|
+
for (const c of k.customizable) {
|
|
564
|
+
const u = a[c];
|
|
565
|
+
u && (a[c] = u.map((h) => V(h, f)));
|
|
566
|
+
}
|
|
567
|
+
const y = wt(r, f, a), x = !Gt(y, i.layouts) || s.join() !== i.customizedBreakpoints.join();
|
|
558
568
|
return { ok: !0, frames: e, layouts: y, customizedBreakpoints: s, changed: e !== o || x, layoutsChanged: x };
|
|
559
569
|
}
|
|
560
|
-
function
|
|
570
|
+
function qt(n, t) {
|
|
561
571
|
const i = [...t].sort().join("\0");
|
|
562
|
-
for (const o of
|
|
563
|
-
const e = n[o], r =
|
|
572
|
+
for (const o of k.breakpoints) {
|
|
573
|
+
const e = n[o], r = k.columns[o];
|
|
564
574
|
if (!Array.isArray(e)) throw new Error(`Layout ${o} is missing.`);
|
|
565
575
|
if (e.map((s) => s.i).sort().join("\0") !== i) throw new Error(`Layout ${o} doesn't hold exactly the sheet's frames.`);
|
|
566
576
|
for (const s of e) {
|
|
@@ -572,14 +582,14 @@ function Ut(n, t) {
|
|
|
572
582
|
if (s.maxW !== void 0 && s.maxW < s.w) throw new Error(`Layout ${o}: ${s.i} maxW below w.`);
|
|
573
583
|
if (s.maxH !== void 0 && s.maxH < s.h) throw new Error(`Layout ${o}: ${s.i} maxH below h.`);
|
|
574
584
|
}
|
|
575
|
-
if (
|
|
576
|
-
if (!
|
|
585
|
+
if (Bt(e)) throw new Error(`Layout ${o} has overlapping items.`);
|
|
586
|
+
if (!St(e)) throw new Error(`Layout ${o} isn't packed.`);
|
|
577
587
|
}
|
|
578
588
|
}
|
|
579
589
|
export {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
590
|
+
k as D,
|
|
591
|
+
Ut as a,
|
|
592
|
+
qt as b,
|
|
583
593
|
_t as i,
|
|
584
|
-
|
|
594
|
+
Xt as r
|
|
585
595
|
};
|