@capillaryjs/capillary-viz 1.2.0 → 1.3.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 +10 -0
- package/README.md +16 -2
- package/dist/components/BlockGraph.d.ts +12 -0
- package/dist/components/BlockGraph.d.ts.map +1 -1
- package/dist/grouping.d.ts.map +1 -1
- package/dist/index.js +1404 -1303
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/styles/structural.css +28 -5
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
var Ft = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var c = (
|
|
4
|
-
import { Emitter as D, DerivedEmitter as
|
|
5
|
-
import { Component as Ne, Placeholder as
|
|
6
|
-
function
|
|
2
|
+
var Ut = (e, t, r) => t in e ? Ft(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var c = (e, t, r) => Ut(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { Emitter as D, DerivedEmitter as L, WritableProjection as Ht, BaseEmitter as ct, FetchState as S, combineFetchStates as Vt, defaultDiagnosticScope as Wt, Diagnostics as m, diagnosticInfo as Yt, EventBubble as Ye } from "@capillaryjs/capillary";
|
|
5
|
+
import { Component as Ne, Placeholder as Ce, Button as fe, css as ne, OptionGroup as Gt, readDeclarativeRegions as Xt, OptionGroupHeaderEnd as Zt, OptionsBox as Jt, Checkbox as me, GroupBox as ze } from "@capillaryjs/capillary-ui";
|
|
6
|
+
function ut([e, t, r]) {
|
|
7
7
|
return {
|
|
8
|
-
"--c1":
|
|
9
|
-
"--c2":
|
|
8
|
+
"--c1": e,
|
|
9
|
+
"--c2": t,
|
|
10
10
|
"--c3": r,
|
|
11
|
-
...Te(
|
|
12
|
-
...Te(
|
|
11
|
+
...Te(e, "--colored-dark") ? {} : { "--colored-dark": e },
|
|
12
|
+
...Te(t, "--colored-base") ? {} : { "--colored-base": t },
|
|
13
13
|
...Te(r, "--colored-light") ? {} : { "--colored-light": r }
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
function Te(
|
|
17
|
-
return
|
|
16
|
+
function Te(e, t) {
|
|
17
|
+
return e.trim().replaceAll(" ", "") === `var(${t})`;
|
|
18
18
|
}
|
|
19
|
-
class
|
|
20
|
-
constructor(
|
|
19
|
+
class V {
|
|
20
|
+
constructor(t) {
|
|
21
21
|
c(this, "key");
|
|
22
22
|
c(this, "label");
|
|
23
23
|
c(this, "categories$");
|
|
@@ -30,10 +30,10 @@ class H {
|
|
|
30
30
|
c(this, "visibilityEmitters", /* @__PURE__ */ new Map());
|
|
31
31
|
c(this, "releaseCategoryDefaults");
|
|
32
32
|
c(this, "disposed", !1);
|
|
33
|
-
|
|
34
|
-
new Set(
|
|
35
|
-
{ owner: this, purpose: `${this.key} hidden categories`, equals:
|
|
36
|
-
), this.visibleCategoriesEmitter = new
|
|
33
|
+
se(t, "Criterion options"), this.key = F(t.key, "Criterion key"), this.label = Ke(t.label, "Criterion label"), ke(t.categories$, "Criterion categories$"), this.categories$ = t.categories$, this.allowResorting = t.allowResorting ?? !1, this.ownedCategories = t.ownedCategories, this.hidden$ = new D(
|
|
34
|
+
new Set(t.initialHiddenKeys ?? []),
|
|
35
|
+
{ owner: this, purpose: `${this.key} hidden categories`, equals: er }
|
|
36
|
+
), this.visibleCategoriesEmitter = new L(
|
|
37
37
|
[this.categories$, this.hidden$],
|
|
38
38
|
([r, i]) => Object.freeze(
|
|
39
39
|
r.filter(({ key: n }) => !i.has(n))
|
|
@@ -43,37 +43,37 @@ class H {
|
|
|
43
43
|
Array.isArray(r) && this.applyFirstSeenDefaults(r);
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
visibility(
|
|
46
|
+
visibility(t) {
|
|
47
47
|
this.assertActive();
|
|
48
|
-
const r = F(
|
|
48
|
+
const r = F(t, "Category key");
|
|
49
49
|
let i = this.visibilityEmitters.get(r);
|
|
50
|
-
return i == null && (i = new
|
|
50
|
+
return i == null && (i = new tr(this.hidden$, r, this), this.visibilityEmitters.set(r, i)), i;
|
|
51
51
|
}
|
|
52
|
-
setAllVisible(
|
|
52
|
+
setAllVisible(t, r) {
|
|
53
53
|
this.assertActive();
|
|
54
54
|
const i = new Set(this.categories$.get().map(({ key: s }) => s)), n = new Set(this.hidden$.get());
|
|
55
55
|
for (const s of i)
|
|
56
|
-
|
|
56
|
+
t ? n.delete(s) : n.add(s);
|
|
57
57
|
return this.hidden$.set(n, r ?? `${this.key} category visibility changed`);
|
|
58
58
|
}
|
|
59
|
-
pruneHidden(
|
|
59
|
+
pruneHidden(t) {
|
|
60
60
|
this.assertActive();
|
|
61
61
|
const r = new Set(this.categories$.get().map(({ key: n }) => n)), i = new Set([...this.hidden$.get()].filter((n) => r.has(n)));
|
|
62
|
-
return this.hidden$.set(i,
|
|
62
|
+
return this.hidden$.set(i, t ?? `${this.key} hidden categories pruned`);
|
|
63
63
|
}
|
|
64
64
|
dispose() {
|
|
65
|
-
var
|
|
65
|
+
var t;
|
|
66
66
|
if (!this.disposed) {
|
|
67
67
|
this.disposed = !0, this.releaseCategoryDefaults();
|
|
68
68
|
for (const r of this.visibilityEmitters.values()) r.dispose();
|
|
69
|
-
this.visibilityEmitters.clear(), this.visibleCategoriesEmitter.dispose(), this.hidden$.dispose(), (
|
|
69
|
+
this.visibilityEmitters.clear(), this.visibleCategoriesEmitter.dispose(), this.hidden$.dispose(), (t = this.ownedCategories) == null || t.dispose();
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
applyFirstSeenDefaults(
|
|
73
|
-
|
|
72
|
+
applyFirstSeenDefaults(t) {
|
|
73
|
+
pt(t, `${this.label} categories`);
|
|
74
74
|
const r = new Set(this.hidden$.get());
|
|
75
75
|
let i = !1;
|
|
76
|
-
for (const n of
|
|
76
|
+
for (const n of t)
|
|
77
77
|
this.seenKeys.has(n.key) || (this.seenKeys.add(n.key), n.hiddenByDefault === !0 && !r.has(n.key) && (r.add(n.key), i = !0));
|
|
78
78
|
i && this.hidden$.set(r, `${this.key} first-seen defaults applied`);
|
|
79
79
|
}
|
|
@@ -81,82 +81,82 @@ class H {
|
|
|
81
81
|
if (this.disposed) throw new Error(`Criterion "${this.key}" is disposed`);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
purpose: `${
|
|
84
|
+
function $i(e) {
|
|
85
|
+
se(e, "Static criterion options");
|
|
86
|
+
const t = dt(e.categories, `${e.label} categories`), r = new D(t, {
|
|
87
|
+
purpose: `${e.key} static categories`
|
|
88
88
|
});
|
|
89
|
-
return new
|
|
89
|
+
return new V({ ...e, categories$: r, ownedCategories: r });
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
if (
|
|
91
|
+
function xi(e) {
|
|
92
|
+
if (se(e, "Derived criterion options"), ke(e.source$, "Derived criterion source$"), typeof e.extractKeys != "function")
|
|
93
93
|
throw new TypeError("Derived criterion extractKeys must be a function");
|
|
94
|
-
if (typeof
|
|
94
|
+
if (typeof e.describe != "function")
|
|
95
95
|
throw new TypeError("Derived criterion describe must be a function");
|
|
96
|
-
const
|
|
97
|
-
[
|
|
98
|
-
([r]) =>
|
|
99
|
-
{ purpose: `${
|
|
96
|
+
const t = new L(
|
|
97
|
+
[e.source$],
|
|
98
|
+
([r]) => Qt(r, e),
|
|
99
|
+
{ purpose: `${e.key} derived categories` }
|
|
100
100
|
);
|
|
101
|
-
return new
|
|
102
|
-
...
|
|
103
|
-
allowResorting:
|
|
104
|
-
categories$:
|
|
105
|
-
ownedCategories:
|
|
101
|
+
return new V({
|
|
102
|
+
...e,
|
|
103
|
+
allowResorting: e.allowResorting ?? !0,
|
|
104
|
+
categories$: t,
|
|
105
|
+
ownedCategories: t
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
if (!Array.isArray(
|
|
108
|
+
function Qt(e, t) {
|
|
109
|
+
if (!Array.isArray(e)) throw new TypeError("Derived category items must be an array");
|
|
110
110
|
const r = /* @__PURE__ */ new Map();
|
|
111
111
|
let i = 0;
|
|
112
|
-
for (const o of
|
|
113
|
-
const a =
|
|
112
|
+
for (const o of e) {
|
|
113
|
+
const a = Oe(t.extractKeys(o));
|
|
114
114
|
if (a.length === 0) {
|
|
115
115
|
i += 1;
|
|
116
116
|
continue;
|
|
117
117
|
}
|
|
118
118
|
for (const l of a) r.set(l, (r.get(l) ?? 0) + 1);
|
|
119
119
|
}
|
|
120
|
-
const n = [...r].filter(([, o]) => o > 0).map(([o, a]) => ({ key: o, count: a, label:
|
|
121
|
-
n.sort(
|
|
120
|
+
const n = [...r].filter(([, o]) => o > 0).map(([o, a]) => ({ key: o, count: a, label: t.describe(o, a).label }));
|
|
121
|
+
n.sort(t.compare ?? ((o, a) => a.count - o.count || o.label.localeCompare(a.label) || o.key.localeCompare(a.key)));
|
|
122
122
|
const s = n.map(({ key: o, count: a }) => {
|
|
123
|
-
const l =
|
|
124
|
-
return
|
|
123
|
+
const l = t.describe(o, a);
|
|
124
|
+
return Me({
|
|
125
125
|
key: o,
|
|
126
126
|
...l,
|
|
127
127
|
generated: !0,
|
|
128
|
-
predicate: (u) =>
|
|
128
|
+
predicate: (u) => Oe(t.extractKeys(u)).includes(o)
|
|
129
129
|
}, "Derived category");
|
|
130
130
|
});
|
|
131
|
-
if (i > 0 &&
|
|
132
|
-
const { key: o, ...a } =
|
|
133
|
-
s.push(
|
|
131
|
+
if (i > 0 && t.unmatched != null) {
|
|
132
|
+
const { key: o, ...a } = t.unmatched;
|
|
133
|
+
s.push(Me({
|
|
134
134
|
key: o,
|
|
135
135
|
...a,
|
|
136
136
|
generated: !0,
|
|
137
|
-
predicate: (l) =>
|
|
137
|
+
predicate: (l) => Oe(t.extractKeys(l)).length === 0
|
|
138
138
|
}, "Derived unmatched category"));
|
|
139
139
|
}
|
|
140
|
-
return
|
|
140
|
+
return dt(s, "Derived categories");
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
const r = [
|
|
145
|
-
for (const i of
|
|
146
|
-
return new
|
|
142
|
+
function Ci(e, t) {
|
|
143
|
+
ke(e, "filterByHidden items$"), rr(t);
|
|
144
|
+
const r = [e];
|
|
145
|
+
for (const i of t) r.push(i.categories$, i.hidden$);
|
|
146
|
+
return new L(
|
|
147
147
|
r,
|
|
148
|
-
(i) => i[0].filter((s) => !
|
|
148
|
+
(i) => i[0].filter((s) => !t.some((o, a) => {
|
|
149
149
|
const l = i[a * 2 + 1], u = i[a * 2 + 2];
|
|
150
150
|
return l.some((d) => u.has(d.key) && d.predicate(s));
|
|
151
151
|
})),
|
|
152
152
|
{ purpose: "items filtered by hidden visualization categories" }
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
if (
|
|
155
|
+
function zi(e, t) {
|
|
156
|
+
if (ke(e, "categoryCounts items$"), !(t instanceof V))
|
|
157
157
|
throw new TypeError("categoryCounts criterion must be a GroupingCriterion");
|
|
158
|
-
return new
|
|
159
|
-
[
|
|
158
|
+
return new L(
|
|
159
|
+
[e, t.categories$],
|
|
160
160
|
(r) => {
|
|
161
161
|
const i = r[0], n = r[1];
|
|
162
162
|
return new Map(n.map((s) => [
|
|
@@ -164,116 +164,102 @@ function xi(t, e) {
|
|
|
164
164
|
i.filter((o) => s.predicate(o)).length
|
|
165
165
|
]));
|
|
166
166
|
},
|
|
167
|
-
{ purpose: `${
|
|
167
|
+
{ purpose: `${t.key} unfiltered category counts` }
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
return
|
|
172
|
-
}
|
|
173
|
-
class
|
|
174
|
-
constructor(r, i
|
|
175
|
-
super(
|
|
176
|
-
owner:
|
|
177
|
-
purpose: `${
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
170
|
+
function er(e, t) {
|
|
171
|
+
return e === t || e.size === t.size && [...e].every((r) => t.has(r));
|
|
172
|
+
}
|
|
173
|
+
class tr extends Ht {
|
|
174
|
+
constructor(t, r, i) {
|
|
175
|
+
super(t, {
|
|
176
|
+
owner: i,
|
|
177
|
+
purpose: `${r} category visibility`,
|
|
178
|
+
read: (n) => n.has(r) ? "hidden" : "visible",
|
|
179
|
+
write: (n, s) => {
|
|
180
|
+
if (s !== "hidden" && s !== "visible")
|
|
181
|
+
throw new TypeError("Category visibility must be hidden or visible");
|
|
182
|
+
const o = new Set(n);
|
|
183
|
+
return s === "hidden" ? o.add(r) : o.delete(r), o;
|
|
184
|
+
}
|
|
184
185
|
});
|
|
185
186
|
}
|
|
186
|
-
set(
|
|
187
|
-
|
|
188
|
-
throw new TypeError("Category visibility must be hidden or visible");
|
|
189
|
-
const n = new Set(this.source.get());
|
|
190
|
-
return r === "hidden" ? n.add(this.categoryKey) : n.delete(this.categoryKey), this.source.set(n, i ?? `${this.categoryKey} visibility changed`);
|
|
191
|
-
}
|
|
192
|
-
dispose() {
|
|
193
|
-
this.release(), super.dispose();
|
|
194
|
-
}
|
|
195
|
-
updateFromSource(r) {
|
|
196
|
-
this.setSnapshot({
|
|
197
|
-
value: r.value.has(this.categoryKey) ? "hidden" : "visible",
|
|
198
|
-
fetchState: r.fetchState,
|
|
199
|
-
error: r.error,
|
|
200
|
-
parentEvent: r.event,
|
|
201
|
-
cause: "hidden category membership changed"
|
|
202
|
-
});
|
|
187
|
+
set(t, r) {
|
|
188
|
+
return super.set(t, r);
|
|
203
189
|
}
|
|
204
190
|
}
|
|
205
|
-
function
|
|
206
|
-
const r = (
|
|
191
|
+
function Oe(e) {
|
|
192
|
+
const r = (e == null ? [] : typeof e == "string" ? [e] : [...e]).map((i) => F(i, "Extracted category key"));
|
|
207
193
|
return [...new Set(r)];
|
|
208
194
|
}
|
|
209
|
-
function
|
|
210
|
-
return
|
|
195
|
+
function dt(e, t) {
|
|
196
|
+
return pt(e, t), Object.freeze(e.map((r) => Me(r, t)));
|
|
211
197
|
}
|
|
212
|
-
function
|
|
213
|
-
|
|
198
|
+
function Me(e, t) {
|
|
199
|
+
se(e, t);
|
|
214
200
|
const r = {
|
|
215
|
-
...
|
|
216
|
-
key: F(
|
|
217
|
-
label: Ke(
|
|
218
|
-
colors:
|
|
201
|
+
...e,
|
|
202
|
+
key: F(e.key, `${t} key`),
|
|
203
|
+
label: Ke(e.label, `${t} label`),
|
|
204
|
+
colors: ht(e.colors, `${t} colors`)
|
|
219
205
|
};
|
|
220
|
-
if (typeof
|
|
221
|
-
throw new TypeError(`${
|
|
222
|
-
return
|
|
206
|
+
if (typeof e.predicate != "function")
|
|
207
|
+
throw new TypeError(`${t} predicate must be a function`);
|
|
208
|
+
return e.colorKey !== void 0 && F(e.colorKey, `${t} colorKey`), Object.freeze(r);
|
|
223
209
|
}
|
|
224
|
-
function
|
|
225
|
-
if (!Array.isArray(
|
|
210
|
+
function pt(e, t) {
|
|
211
|
+
if (!Array.isArray(e)) throw new TypeError(`${t} must be an array`);
|
|
226
212
|
const r = /* @__PURE__ */ new Set();
|
|
227
|
-
for (const i of
|
|
228
|
-
|
|
229
|
-
const n = F(i.key, `${
|
|
230
|
-
if (r.has(n)) throw new Error(`${
|
|
231
|
-
if (r.add(n), Ke(i.label, `${
|
|
232
|
-
throw new TypeError(`${
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function
|
|
236
|
-
if (!Array.isArray(
|
|
237
|
-
const
|
|
238
|
-
for (const r of
|
|
239
|
-
if (!(r instanceof
|
|
213
|
+
for (const i of e) {
|
|
214
|
+
se(i, t);
|
|
215
|
+
const n = F(i.key, `${t} key`);
|
|
216
|
+
if (r.has(n)) throw new Error(`${t} contains duplicate key "${n}"`);
|
|
217
|
+
if (r.add(n), Ke(i.label, `${t} label`), ht(i.colors, `${t} colors`), typeof i.predicate != "function")
|
|
218
|
+
throw new TypeError(`${t} predicate must be a function`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function rr(e) {
|
|
222
|
+
if (!Array.isArray(e)) throw new TypeError("Criteria must be an array");
|
|
223
|
+
const t = /* @__PURE__ */ new Set();
|
|
224
|
+
for (const r of e) {
|
|
225
|
+
if (!(r instanceof V))
|
|
240
226
|
throw new TypeError("Criteria must contain GroupingCriterion instances");
|
|
241
|
-
if (
|
|
242
|
-
|
|
227
|
+
if (t.has(r.key)) throw new Error(`Duplicate criterion key "${r.key}"`);
|
|
228
|
+
t.add(r.key);
|
|
243
229
|
}
|
|
244
230
|
}
|
|
245
|
-
function
|
|
246
|
-
if (!Array.isArray(
|
|
247
|
-
throw new TypeError(`${
|
|
248
|
-
return Object.freeze([...
|
|
231
|
+
function ht(e, t) {
|
|
232
|
+
if (!Array.isArray(e) || e.length !== 3 || e.some((r) => typeof r != "string" || r.trim() === ""))
|
|
233
|
+
throw new TypeError(`${t} must contain three non-empty CSS color values`);
|
|
234
|
+
return Object.freeze([...e]);
|
|
249
235
|
}
|
|
250
|
-
function
|
|
251
|
-
if (
|
|
252
|
-
throw new TypeError(`${
|
|
236
|
+
function ke(e, t) {
|
|
237
|
+
if (e == null || typeof e != "object" && typeof e != "function" || typeof Reflect.get(e, "get") != "function" || typeof Reflect.get(e, "getFetchState") != "function" || typeof Reflect.get(e, "getError") != "function" || typeof Reflect.get(e, "subscribe") != "function")
|
|
238
|
+
throw new TypeError(`${t} must be a readable emitter`);
|
|
253
239
|
}
|
|
254
|
-
function
|
|
255
|
-
if (
|
|
256
|
-
throw new TypeError(`${
|
|
240
|
+
function se(e, t) {
|
|
241
|
+
if (e == null || typeof e != "object" || Array.isArray(e))
|
|
242
|
+
throw new TypeError(`${t} must be an object`);
|
|
257
243
|
}
|
|
258
|
-
function F(
|
|
259
|
-
if (typeof
|
|
260
|
-
throw new TypeError(`${
|
|
261
|
-
return
|
|
244
|
+
function F(e, t) {
|
|
245
|
+
if (typeof e != "string" || e.trim() === "")
|
|
246
|
+
throw new TypeError(`${t} must be a non-empty string`);
|
|
247
|
+
return e;
|
|
262
248
|
}
|
|
263
|
-
function Ke(
|
|
264
|
-
if (typeof
|
|
265
|
-
throw new TypeError(`${
|
|
266
|
-
return
|
|
249
|
+
function Ke(e, t) {
|
|
250
|
+
if (typeof e != "string" || e.trim() === "")
|
|
251
|
+
throw new TypeError(`${t} must be a non-empty string`);
|
|
252
|
+
return e;
|
|
267
253
|
}
|
|
268
|
-
function Re(
|
|
269
|
-
if (!Array.isArray(
|
|
270
|
-
if (!Array.isArray(
|
|
254
|
+
function Re(e, t, r = {}) {
|
|
255
|
+
if (!Array.isArray(e)) throw new TypeError("Block layout items must be an array");
|
|
256
|
+
if (!Array.isArray(t)) throw new TypeError("Block layout splits must be an array");
|
|
271
257
|
const i = r.readabilityThreshold ?? 0.02;
|
|
272
258
|
if (!Number.isFinite(i) || i < 0 || i > 1)
|
|
273
259
|
throw new RangeError("Block readability threshold must be between zero and one");
|
|
274
|
-
const n = [], s = Object.freeze([...
|
|
260
|
+
const n = [], s = Object.freeze([...e]), o = ft({
|
|
275
261
|
items: s,
|
|
276
|
-
splits:
|
|
262
|
+
splits: t,
|
|
277
263
|
splitIndex: 0,
|
|
278
264
|
path: Object.freeze([]),
|
|
279
265
|
criterion: null,
|
|
@@ -286,28 +272,28 @@ function Re(t, e, r = {}) {
|
|
|
286
272
|
});
|
|
287
273
|
return Object.freeze({ valid: n.length === 0, root: o, issues: Object.freeze(n) });
|
|
288
274
|
}
|
|
289
|
-
function
|
|
290
|
-
if (!(
|
|
275
|
+
function ir(e) {
|
|
276
|
+
if (!(e instanceof V))
|
|
291
277
|
throw new TypeError("criterionSnapshot requires a GroupingCriterion");
|
|
292
278
|
return Object.freeze({
|
|
293
|
-
key:
|
|
294
|
-
label:
|
|
295
|
-
categories:
|
|
296
|
-
allowResorting:
|
|
279
|
+
key: e.key,
|
|
280
|
+
label: e.label,
|
|
281
|
+
categories: e.categories$.get(),
|
|
282
|
+
allowResorting: e.allowResorting
|
|
297
283
|
});
|
|
298
284
|
}
|
|
299
|
-
function
|
|
300
|
-
if (
|
|
301
|
-
let r =
|
|
302
|
-
for (const i of
|
|
285
|
+
function _(e, t) {
|
|
286
|
+
if (t == null) return null;
|
|
287
|
+
let r = e;
|
|
288
|
+
for (const i of t) {
|
|
303
289
|
const n = r.children.find((s) => s.criterionKey === i.criterionKey && s.categoryKey === i.categoryKey);
|
|
304
290
|
if (n == null) return null;
|
|
305
291
|
r = n;
|
|
306
292
|
}
|
|
307
293
|
return r;
|
|
308
294
|
}
|
|
309
|
-
class
|
|
310
|
-
constructor(
|
|
295
|
+
class nr {
|
|
296
|
+
constructor(t, r, i = {}) {
|
|
311
297
|
c(this, "layout$");
|
|
312
298
|
c(this, "selectedPath$");
|
|
313
299
|
c(this, "selectedBlock$");
|
|
@@ -317,15 +303,15 @@ class rr {
|
|
|
317
303
|
c(this, "selectedItemsEmitter");
|
|
318
304
|
c(this, "releases", []);
|
|
319
305
|
c(this, "disposed", !1);
|
|
320
|
-
this.options = i, this.layoutEmitter = new
|
|
306
|
+
this.options = i, this.layoutEmitter = new sr(t, r, i), this.layout$ = this.layoutEmitter, this.selectedPath$ = new D(null, {
|
|
321
307
|
owner: this,
|
|
322
308
|
purpose: "selected block path",
|
|
323
|
-
equals:
|
|
324
|
-
}), this.selectedBlockEmitter = new
|
|
309
|
+
equals: ar
|
|
310
|
+
}), this.selectedBlockEmitter = new L(
|
|
325
311
|
[this.layout$, this.selectedPath$],
|
|
326
|
-
([n, s]) =>
|
|
312
|
+
([n, s]) => _(n.root, s),
|
|
327
313
|
{ owner: this, purpose: "selected block" }
|
|
328
|
-
), this.selectedBlock$ = this.selectedBlockEmitter, this.selectedItemsEmitter = new
|
|
314
|
+
), this.selectedBlock$ = this.selectedBlockEmitter, this.selectedItemsEmitter = new L(
|
|
329
315
|
[this.selectedBlock$],
|
|
330
316
|
([n]) => (n == null ? void 0 : n.items) ?? Object.freeze([]),
|
|
331
317
|
{ owner: this, purpose: "selected block items" }
|
|
@@ -334,35 +320,35 @@ class rr {
|
|
|
334
320
|
this.selectedPath$.subscribe(() => this.reconcileSelection(), { emitCurrent: !1 })
|
|
335
321
|
);
|
|
336
322
|
}
|
|
337
|
-
select(
|
|
323
|
+
select(t, r) {
|
|
338
324
|
this.assertActive();
|
|
339
|
-
const i =
|
|
340
|
-
if (
|
|
325
|
+
const i = mt(t);
|
|
326
|
+
if (_(this.layout$.get().root, i) == null)
|
|
341
327
|
throw new Error("Cannot select a path absent from the current block layout");
|
|
342
328
|
return this.selectedPath$.set(i, r ?? "block selected");
|
|
343
329
|
}
|
|
344
|
-
clear(
|
|
345
|
-
return this.assertActive(), this.selectedPath$.set(null,
|
|
330
|
+
clear(t) {
|
|
331
|
+
return this.assertActive(), this.selectedPath$.set(null, t ?? "block selection cleared");
|
|
346
332
|
}
|
|
347
333
|
dispose() {
|
|
348
334
|
if (!this.disposed) {
|
|
349
335
|
this.disposed = !0;
|
|
350
|
-
for (const
|
|
336
|
+
for (const t of this.releases.splice(0)) t();
|
|
351
337
|
this.selectedItemsEmitter.dispose(), this.selectedBlockEmitter.dispose(), this.selectedPath$.dispose(), this.layoutEmitter.dispose();
|
|
352
338
|
}
|
|
353
339
|
}
|
|
354
340
|
reconcileSelection() {
|
|
355
|
-
const
|
|
356
|
-
|
|
341
|
+
const t = this.selectedPath$.get();
|
|
342
|
+
t == null || _(this.layout$.get().root, t) != null || this.selectedPath$.set(null, "block selection no longer exists");
|
|
357
343
|
}
|
|
358
344
|
assertActive() {
|
|
359
345
|
if (this.disposed) throw new Error("Block selection model is disposed");
|
|
360
346
|
}
|
|
361
347
|
}
|
|
362
|
-
function
|
|
363
|
-
return new
|
|
348
|
+
function Ti(e, t, r = {}) {
|
|
349
|
+
return new nr(e, t, r);
|
|
364
350
|
}
|
|
365
|
-
class
|
|
351
|
+
class sr extends ct {
|
|
366
352
|
constructor(r, i, n) {
|
|
367
353
|
super(Re([], [], n), {
|
|
368
354
|
purpose: "reactive block layout",
|
|
@@ -370,7 +356,7 @@ class ir extends Pe {
|
|
|
370
356
|
});
|
|
371
357
|
c(this, "releases", []);
|
|
372
358
|
c(this, "categoryReleases", []);
|
|
373
|
-
this.items$ = r, this.splits$ = i, this.options = n,
|
|
359
|
+
this.items$ = r, this.splits$ = i, this.options = n, Ge(r, "Block selection items$"), Ge(i, "Block selection splits$"), this.releases.push(
|
|
374
360
|
r.subscribe(({ event: s }) => this.recompute(s), { emitCurrent: !1 }),
|
|
375
361
|
i.subscribe(({ event: s }) => {
|
|
376
362
|
this.subscribeCategories(), this.recompute(s);
|
|
@@ -394,19 +380,19 @@ class ir extends Pe {
|
|
|
394
380
|
const i = this.splits$.get(), n = [
|
|
395
381
|
this.items$,
|
|
396
382
|
this.splits$,
|
|
397
|
-
...i.map(({ categories$:
|
|
398
|
-
], s = n.map((
|
|
383
|
+
...i.map(({ categories$: p }) => p)
|
|
384
|
+
], s = n.map((p) => p.getFetchState()), o = n.map((p) => p.getError()).filter(cr);
|
|
399
385
|
let a, l = null;
|
|
400
386
|
try {
|
|
401
387
|
a = Re(
|
|
402
388
|
this.items$.get(),
|
|
403
|
-
i.map(
|
|
389
|
+
i.map(ir),
|
|
404
390
|
this.options
|
|
405
391
|
);
|
|
406
|
-
} catch (
|
|
407
|
-
l =
|
|
392
|
+
} catch (p) {
|
|
393
|
+
l = p, a = Re([], [], this.options);
|
|
408
394
|
}
|
|
409
|
-
const u = l == null ? o : [...o, l], d = u.length > 0 ? S.Error :
|
|
395
|
+
const u = l == null ? o : [...o, l], d = u.length > 0 ? S.Error : Vt(s);
|
|
410
396
|
this.setSnapshot({
|
|
411
397
|
value: a,
|
|
412
398
|
fetchState: d,
|
|
@@ -416,9 +402,9 @@ class ir extends Pe {
|
|
|
416
402
|
});
|
|
417
403
|
}
|
|
418
404
|
}
|
|
419
|
-
function
|
|
405
|
+
function ft(e) {
|
|
420
406
|
const {
|
|
421
|
-
items:
|
|
407
|
+
items: t,
|
|
422
408
|
splits: r,
|
|
423
409
|
splitIndex: i,
|
|
424
410
|
path: n,
|
|
@@ -428,45 +414,45 @@ function ht(t) {
|
|
|
428
414
|
totalShare: l,
|
|
429
415
|
readabilityThreshold: u,
|
|
430
416
|
issues: d,
|
|
431
|
-
rootLabel:
|
|
432
|
-
} =
|
|
433
|
-
items:
|
|
417
|
+
rootLabel: p
|
|
418
|
+
} = e, b = r[i], w = b != null && n.length > 0 && l < u, g = b == null || w ? [] : or({
|
|
419
|
+
items: t,
|
|
434
420
|
splits: r,
|
|
435
421
|
splitIndex: i,
|
|
436
422
|
path: n,
|
|
437
|
-
criterion:
|
|
423
|
+
criterion: b,
|
|
438
424
|
totalShare: l,
|
|
439
425
|
readabilityThreshold: u,
|
|
440
426
|
issues: d,
|
|
441
|
-
rootLabel:
|
|
442
|
-
}), f = a === 0 ? 0 :
|
|
427
|
+
rootLabel: p
|
|
428
|
+
}), f = a === 0 ? 0 : t.length / a;
|
|
443
429
|
return Object.freeze({
|
|
444
|
-
key:
|
|
430
|
+
key: lr(n),
|
|
445
431
|
path: n,
|
|
446
432
|
criterionKey: (s == null ? void 0 : s.key) ?? null,
|
|
447
433
|
criterionLabel: (s == null ? void 0 : s.label) ?? null,
|
|
448
434
|
categoryKey: (o == null ? void 0 : o.key) ?? null,
|
|
449
|
-
label: (o == null ? void 0 : o.label) ??
|
|
435
|
+
label: (o == null ? void 0 : o.label) ?? p,
|
|
450
436
|
colors: (o == null ? void 0 : o.colors) ?? null,
|
|
451
437
|
colorKey: (o == null ? void 0 : o.colorKey) ?? null,
|
|
452
|
-
count:
|
|
438
|
+
count: t.length,
|
|
453
439
|
share: f,
|
|
454
440
|
totalShare: l,
|
|
455
441
|
depth: n.length - 1,
|
|
456
|
-
items:
|
|
457
|
-
children: Object.freeze(
|
|
442
|
+
items: t,
|
|
443
|
+
children: Object.freeze(g),
|
|
458
444
|
childOrientation: n.length % 2 === 0 ? "horizontal" : "vertical",
|
|
459
|
-
childrenSuppressed:
|
|
445
|
+
childrenSuppressed: w
|
|
460
446
|
});
|
|
461
447
|
}
|
|
462
|
-
function
|
|
463
|
-
const { items:
|
|
448
|
+
function or(e) {
|
|
449
|
+
const { items: t, criterion: r, path: i, issues: n } = e, s = new Map(r.categories.map((l) => [l.key, {
|
|
464
450
|
category: l,
|
|
465
451
|
items: []
|
|
466
452
|
}]));
|
|
467
453
|
let o = !0;
|
|
468
|
-
if (
|
|
469
|
-
const d = r.categories.filter((
|
|
454
|
+
if (t.forEach((l, u) => {
|
|
455
|
+
const d = r.categories.filter((p) => p.predicate(l));
|
|
470
456
|
if (d.length !== 1) {
|
|
471
457
|
o = !1, n.push(Object.freeze({
|
|
472
458
|
kind: d.length === 0 ? "unmatched" : "multiple-matches",
|
|
@@ -475,7 +461,7 @@ function nr(t) {
|
|
|
475
461
|
parentPath: i,
|
|
476
462
|
item: l,
|
|
477
463
|
itemIndex: u,
|
|
478
|
-
matchedCategoryKeys: Object.freeze(d.map(({ key:
|
|
464
|
+
matchedCategoryKeys: Object.freeze(d.map(({ key: p }) => p))
|
|
479
465
|
}));
|
|
480
466
|
return;
|
|
481
467
|
}
|
|
@@ -483,68 +469,68 @@ function nr(t) {
|
|
|
483
469
|
}), !o) return [];
|
|
484
470
|
let a = [...s.values()].filter((l) => l.items.length > 0);
|
|
485
471
|
return r.allowResorting && (a = a.sort((l, u) => u.items.length - l.items.length || l.category.label.localeCompare(u.category.label) || l.category.key.localeCompare(u.category.key))), a.map(({ category: l, items: u }) => {
|
|
486
|
-
const d =
|
|
472
|
+
const d = mt([...i, {
|
|
487
473
|
criterionKey: r.key,
|
|
488
474
|
categoryKey: l.key
|
|
489
|
-
}]),
|
|
490
|
-
return
|
|
491
|
-
...
|
|
475
|
+
}]), p = t.length === 0 ? 0 : u.length / t.length;
|
|
476
|
+
return ft({
|
|
477
|
+
...e,
|
|
492
478
|
items: Object.freeze(u),
|
|
493
|
-
splitIndex:
|
|
479
|
+
splitIndex: e.splitIndex + 1,
|
|
494
480
|
path: d,
|
|
495
481
|
criterion: r,
|
|
496
482
|
category: l,
|
|
497
|
-
parentCount:
|
|
498
|
-
totalShare:
|
|
483
|
+
parentCount: t.length,
|
|
484
|
+
totalShare: e.totalShare * p
|
|
499
485
|
});
|
|
500
486
|
});
|
|
501
487
|
}
|
|
502
|
-
function
|
|
503
|
-
if (!Array.isArray(
|
|
504
|
-
return Object.freeze(
|
|
505
|
-
if (
|
|
488
|
+
function mt(e) {
|
|
489
|
+
if (!Array.isArray(e)) throw new TypeError("Block path must be an array");
|
|
490
|
+
return Object.freeze(e.map((t) => {
|
|
491
|
+
if (t == null || typeof t != "object")
|
|
506
492
|
throw new TypeError("Block path segments must be objects");
|
|
507
|
-
if (typeof
|
|
493
|
+
if (typeof t.criterionKey != "string" || t.criterionKey === "" || typeof t.categoryKey != "string" || t.categoryKey === "")
|
|
508
494
|
throw new TypeError("Block path keys must be non-empty strings");
|
|
509
|
-
return Object.freeze({ ...
|
|
495
|
+
return Object.freeze({ ...t });
|
|
510
496
|
}));
|
|
511
497
|
}
|
|
512
|
-
function
|
|
513
|
-
return
|
|
514
|
-
const n =
|
|
498
|
+
function ar(e, t) {
|
|
499
|
+
return e === t || e != null && t != null && e.length === t.length && e.every((r, i) => {
|
|
500
|
+
const n = t[i];
|
|
515
501
|
return r.criterionKey === (n == null ? void 0 : n.criterionKey) && r.categoryKey === n.categoryKey;
|
|
516
502
|
});
|
|
517
503
|
}
|
|
518
|
-
function
|
|
519
|
-
return
|
|
504
|
+
function lr(e) {
|
|
505
|
+
return e.length === 0 ? "root" : e.map(({ criterionKey: t, categoryKey: r }) => `${encodeURIComponent(t)}=${encodeURIComponent(r)}`).join("/");
|
|
520
506
|
}
|
|
521
|
-
function
|
|
522
|
-
return
|
|
507
|
+
function cr(e) {
|
|
508
|
+
return e != null;
|
|
523
509
|
}
|
|
524
|
-
function
|
|
525
|
-
if (
|
|
526
|
-
throw new TypeError(`${
|
|
510
|
+
function Ge(e, t) {
|
|
511
|
+
if (e == null || typeof e != "object" && typeof e != "function" || typeof Reflect.get(e, "get") != "function" || typeof Reflect.get(e, "getFetchState") != "function" || typeof Reflect.get(e, "getError") != "function" || typeof Reflect.get(e, "subscribe") != "function")
|
|
512
|
+
throw new TypeError(`${t} must be a readable emitter`);
|
|
527
513
|
}
|
|
528
|
-
const
|
|
529
|
-
let
|
|
530
|
-
class
|
|
531
|
-
constructor(
|
|
514
|
+
const Xe = "data-cap-structural-styles";
|
|
515
|
+
let ur = 1;
|
|
516
|
+
class yt {
|
|
517
|
+
constructor(t = `runtime-${ur++}`) {
|
|
532
518
|
c(this, "id");
|
|
533
519
|
c(this, "cssFragments", /* @__PURE__ */ new Map());
|
|
534
|
-
if (typeof
|
|
535
|
-
this.id =
|
|
520
|
+
if (typeof t != "string") throw new TypeError("StyleRegistry id must be a string");
|
|
521
|
+
this.id = t;
|
|
536
522
|
}
|
|
537
|
-
registerCSS(
|
|
538
|
-
if (typeof
|
|
539
|
-
const r =
|
|
523
|
+
registerCSS(t) {
|
|
524
|
+
if (typeof t != "string") throw new TypeError("Component CSS must be a string");
|
|
525
|
+
const r = t.trim();
|
|
540
526
|
return r.length > 0 && this.cssFragments.set(`raw:${r}`, { kind: "raw", css: r }), this;
|
|
541
527
|
}
|
|
542
528
|
/** @internal Collect a host-relative component template without resolving it yet. */
|
|
543
|
-
registerHostCSS(
|
|
544
|
-
if (typeof
|
|
529
|
+
registerHostCSS(t, r) {
|
|
530
|
+
if (typeof t != "string") throw new TypeError("Component CSS must be a string");
|
|
545
531
|
if (typeof r != "string" || r.trim().length === 0)
|
|
546
532
|
throw new TypeError("Component CSS host must be a non-empty selector");
|
|
547
|
-
const i =
|
|
533
|
+
const i = t.trim();
|
|
548
534
|
if (i.length === 0) return this;
|
|
549
535
|
if (!i.includes("&")) return this.registerCSS(i);
|
|
550
536
|
const n = `host:${i}`, s = this.cssFragments.get(n);
|
|
@@ -555,16 +541,16 @@ class mt {
|
|
|
555
541
|
}) : s.kind === "host" && s.hosts.add(r.trim()), this;
|
|
556
542
|
}
|
|
557
543
|
generateCSS() {
|
|
558
|
-
return [...this.cssFragments.values()].map((
|
|
544
|
+
return [...this.cssFragments.values()].map((t) => t.kind === "raw" ? t.css : gt(t.css, [...t.hosts])).join(`
|
|
559
545
|
|
|
560
546
|
`);
|
|
561
547
|
}
|
|
562
|
-
injectAll(
|
|
563
|
-
if ((
|
|
548
|
+
injectAll(t = globalThis.document) {
|
|
549
|
+
if ((t == null ? void 0 : t.head) == null)
|
|
564
550
|
throw new TypeError("StyleRegistry.injectAll requires a document with a head");
|
|
565
|
-
const r = `style[${
|
|
566
|
-
let i =
|
|
567
|
-
i == null && (i =
|
|
551
|
+
const r = `style[${Xe}="${hr(this.id)}"]`;
|
|
552
|
+
let i = t.head.querySelector(r);
|
|
553
|
+
i == null && (i = t.createElement("style"), i.setAttribute(Xe, this.id), t.head.prepend(i));
|
|
568
554
|
const n = this.generateCSS();
|
|
569
555
|
return i.textContent !== n && (i.textContent = n), i;
|
|
570
556
|
}
|
|
@@ -572,66 +558,66 @@ class mt {
|
|
|
572
558
|
this.cssFragments.clear();
|
|
573
559
|
}
|
|
574
560
|
}
|
|
575
|
-
function
|
|
576
|
-
return new
|
|
561
|
+
function dr() {
|
|
562
|
+
return new yt();
|
|
577
563
|
}
|
|
578
|
-
const
|
|
579
|
-
function
|
|
580
|
-
return
|
|
564
|
+
const pr = new yt("");
|
|
565
|
+
function hr(e) {
|
|
566
|
+
return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
581
567
|
}
|
|
582
|
-
function
|
|
568
|
+
function gt(e, t) {
|
|
583
569
|
let r = "", i = 0;
|
|
584
|
-
for (; i <
|
|
585
|
-
const n =
|
|
586
|
-
if (n < 0) return r +
|
|
587
|
-
const s =
|
|
588
|
-
if (s < 0) return r +
|
|
589
|
-
const o =
|
|
590
|
-
r += l.startsWith("@") ? `${o}{${
|
|
570
|
+
for (; i < e.length; ) {
|
|
571
|
+
const n = yr(e, i);
|
|
572
|
+
if (n < 0) return r + e.slice(i);
|
|
573
|
+
const s = gr(e, n);
|
|
574
|
+
if (s < 0) return r + e.slice(i);
|
|
575
|
+
const o = e.slice(i, n), a = e.slice(n + 1, s), l = o.trim();
|
|
576
|
+
r += l.startsWith("@") ? `${o}{${gt(a, t)}}` : `${fr(o, t)}{${a}}`, i = s + 1;
|
|
591
577
|
}
|
|
592
578
|
return r;
|
|
593
579
|
}
|
|
594
|
-
function
|
|
580
|
+
function fr(e, t) {
|
|
595
581
|
var o, a, l;
|
|
596
|
-
if (
|
|
597
|
-
return
|
|
598
|
-
const r = ((o =
|
|
599
|
-
return r + n.flatMap((u) => u.includes("&") ?
|
|
582
|
+
if (t.length === 1 || !e.includes("&"))
|
|
583
|
+
return t.length === 1 ? e.replaceAll("&", t[0]) : e;
|
|
584
|
+
const r = ((o = e.match(/^\s*/)) == null ? void 0 : o[0]) ?? "", i = ((a = e.match(/\s*$/)) == null ? void 0 : a[0]) ?? "", n = mr(e.trim()), s = ((l = r.match(/(?:^|\n)([ \t]*)$/)) == null ? void 0 : l[1]) ?? "";
|
|
585
|
+
return r + n.flatMap((u) => u.includes("&") ? t.map((d) => u.replaceAll("&", d)) : [u]).join(`,
|
|
600
586
|
${s}`) + i;
|
|
601
587
|
}
|
|
602
|
-
function
|
|
603
|
-
const
|
|
588
|
+
function mr(e) {
|
|
589
|
+
const t = [];
|
|
604
590
|
let r = 0, i = 0, n = 0, s = null;
|
|
605
|
-
for (let o = 0; o <
|
|
606
|
-
const a =
|
|
591
|
+
for (let o = 0; o < e.length; o += 1) {
|
|
592
|
+
const a = e[o];
|
|
607
593
|
if (s != null) {
|
|
608
594
|
a === "\\" ? o += 1 : a === s && (s = null);
|
|
609
595
|
continue;
|
|
610
596
|
}
|
|
611
|
-
a === '"' || a === "'" ? s = a : a === "(" ? i += 1 : a === ")" ? i -= 1 : a === "[" ? n += 1 : a === "]" ? n -= 1 : a === "," && i === 0 && n === 0 && (
|
|
597
|
+
a === '"' || a === "'" ? s = a : a === "(" ? i += 1 : a === ")" ? i -= 1 : a === "[" ? n += 1 : a === "]" ? n -= 1 : a === "," && i === 0 && n === 0 && (t.push(e.slice(r, o).trim()), r = o + 1);
|
|
612
598
|
}
|
|
613
|
-
return
|
|
599
|
+
return t.push(e.slice(r).trim()), t.filter(Boolean);
|
|
614
600
|
}
|
|
615
|
-
function
|
|
616
|
-
for (let r =
|
|
617
|
-
const i =
|
|
601
|
+
function yr(e, t) {
|
|
602
|
+
for (let r = t; r < e.length; r += 1) {
|
|
603
|
+
const i = e[r];
|
|
618
604
|
if (i === '"' || i === "'")
|
|
619
|
-
r =
|
|
620
|
-
else if (i === "/" &&
|
|
621
|
-
r =
|
|
605
|
+
r = bt(e, r);
|
|
606
|
+
else if (i === "/" && e[r + 1] === "*")
|
|
607
|
+
r = wt(e, r);
|
|
622
608
|
else if (i === "{")
|
|
623
609
|
return r;
|
|
624
610
|
}
|
|
625
611
|
return -1;
|
|
626
612
|
}
|
|
627
|
-
function
|
|
613
|
+
function gr(e, t) {
|
|
628
614
|
let r = 1;
|
|
629
|
-
for (let i =
|
|
630
|
-
const n =
|
|
615
|
+
for (let i = t + 1; i < e.length; i += 1) {
|
|
616
|
+
const n = e[i];
|
|
631
617
|
if (n === '"' || n === "'")
|
|
632
|
-
i =
|
|
633
|
-
else if (n === "/" &&
|
|
634
|
-
i =
|
|
618
|
+
i = bt(e, i);
|
|
619
|
+
else if (n === "/" && e[i + 1] === "*")
|
|
620
|
+
i = wt(e, i);
|
|
635
621
|
else if (n === "{")
|
|
636
622
|
r += 1;
|
|
637
623
|
else if (n === "}" && --r === 0)
|
|
@@ -639,29 +625,29 @@ function mr(t, e) {
|
|
|
639
625
|
}
|
|
640
626
|
return -1;
|
|
641
627
|
}
|
|
642
|
-
function
|
|
643
|
-
const r = t
|
|
644
|
-
for (let i =
|
|
645
|
-
if (
|
|
646
|
-
else if (
|
|
647
|
-
return
|
|
628
|
+
function bt(e, t) {
|
|
629
|
+
const r = e[t];
|
|
630
|
+
for (let i = t + 1; i < e.length; i += 1)
|
|
631
|
+
if (e[i] === "\\") i += 1;
|
|
632
|
+
else if (e[i] === r) return i;
|
|
633
|
+
return e.length;
|
|
648
634
|
}
|
|
649
|
-
function
|
|
650
|
-
const r =
|
|
651
|
-
return r < 0 ?
|
|
635
|
+
function wt(e, t) {
|
|
636
|
+
const r = e.indexOf("*/", t + 2);
|
|
637
|
+
return r < 0 ? e.length : r + 1;
|
|
652
638
|
}
|
|
653
|
-
const
|
|
654
|
-
class
|
|
655
|
-
constructor(
|
|
639
|
+
const br = /* @__PURE__ */ new WeakSet(), wr = /* @__PURE__ */ new WeakSet();
|
|
640
|
+
class vt {
|
|
641
|
+
constructor(t = []) {
|
|
656
642
|
c(this, "providers", /* @__PURE__ */ new Map());
|
|
657
643
|
c(this, "instances", /* @__PURE__ */ new Map());
|
|
658
644
|
c(this, "creationOrder", []);
|
|
659
645
|
c(this, "resolving", []);
|
|
660
646
|
c(this, "disposed", !1);
|
|
661
|
-
if (!Array.isArray(
|
|
647
|
+
if (!Array.isArray(t))
|
|
662
648
|
throw new TypeError("ServiceScope providers must be an array");
|
|
663
|
-
for (const r of
|
|
664
|
-
if (
|
|
649
|
+
for (const r of t) {
|
|
650
|
+
if (Sr(r), this.providers.has(r.key))
|
|
665
651
|
throw new Error(`Service "${r.key.name}" is registered more than once`);
|
|
666
652
|
this.providers.set(r.key, r);
|
|
667
653
|
}
|
|
@@ -669,22 +655,22 @@ class wt {
|
|
|
669
655
|
get isDisposed() {
|
|
670
656
|
return this.disposed;
|
|
671
657
|
}
|
|
672
|
-
has(
|
|
673
|
-
return this.assertActive(),
|
|
658
|
+
has(t) {
|
|
659
|
+
return this.assertActive(), Ze(t), this.providers.has(t);
|
|
674
660
|
}
|
|
675
|
-
require(
|
|
676
|
-
if (this.assertActive(),
|
|
677
|
-
const r = this.providers.get(
|
|
678
|
-
if (r == null) throw new Error(`Service "${
|
|
679
|
-
const i = this.resolving.indexOf(
|
|
661
|
+
require(t) {
|
|
662
|
+
if (this.assertActive(), Ze(t), this.instances.has(t)) return this.instances.get(t);
|
|
663
|
+
const r = this.providers.get(t);
|
|
664
|
+
if (r == null) throw new Error(`Service "${t.name}" is not registered`);
|
|
665
|
+
const i = this.resolving.indexOf(t);
|
|
680
666
|
if (i >= 0) {
|
|
681
|
-
const n = [...this.resolving.slice(i),
|
|
667
|
+
const n = [...this.resolving.slice(i), t].map((s) => s.name).join(" -> ");
|
|
682
668
|
throw new Error(`Circular service dependency: ${n}`);
|
|
683
669
|
}
|
|
684
|
-
this.resolving.push(
|
|
670
|
+
this.resolving.push(t);
|
|
685
671
|
try {
|
|
686
672
|
const n = r.create(this);
|
|
687
|
-
return this.instances.set(
|
|
673
|
+
return this.instances.set(t, n), this.creationOrder.push(t), n;
|
|
688
674
|
} finally {
|
|
689
675
|
this.resolving.pop();
|
|
690
676
|
}
|
|
@@ -692,46 +678,46 @@ class wt {
|
|
|
692
678
|
dispose() {
|
|
693
679
|
if (this.disposed) return;
|
|
694
680
|
this.disposed = !0;
|
|
695
|
-
const
|
|
681
|
+
const t = [];
|
|
696
682
|
for (const r of [...this.creationOrder].reverse()) {
|
|
697
683
|
const i = this.instances.get(r);
|
|
698
684
|
try {
|
|
699
|
-
const n =
|
|
685
|
+
const n = Er(i);
|
|
700
686
|
n != null && n.call(i);
|
|
701
687
|
} catch (n) {
|
|
702
|
-
|
|
688
|
+
t.push(n);
|
|
703
689
|
}
|
|
704
690
|
}
|
|
705
|
-
if (this.instances.clear(), this.creationOrder.length = 0, this.resolving.length = 0,
|
|
706
|
-
if (
|
|
707
|
-
throw new AggregateError(
|
|
691
|
+
if (this.instances.clear(), this.creationOrder.length = 0, this.resolving.length = 0, t.length === 1) throw t[0];
|
|
692
|
+
if (t.length > 1)
|
|
693
|
+
throw new AggregateError(t, "Several services failed during disposal");
|
|
708
694
|
}
|
|
709
695
|
assertActive() {
|
|
710
696
|
if (this.disposed) throw new Error("ServiceScope has been disposed");
|
|
711
697
|
}
|
|
712
698
|
}
|
|
713
|
-
function
|
|
714
|
-
return new
|
|
699
|
+
function vr(e = []) {
|
|
700
|
+
return new vt(e);
|
|
715
701
|
}
|
|
716
|
-
function
|
|
717
|
-
return
|
|
702
|
+
function kr(e) {
|
|
703
|
+
return e != null && (typeof e == "object" || typeof e == "function") && br.has(e);
|
|
718
704
|
}
|
|
719
|
-
function
|
|
720
|
-
if (!
|
|
705
|
+
function Ze(e) {
|
|
706
|
+
if (!kr(e)) throw new TypeError("Expected a service key created by defineService()");
|
|
721
707
|
}
|
|
722
|
-
function
|
|
723
|
-
if (
|
|
708
|
+
function Sr(e) {
|
|
709
|
+
if (e == null || typeof e != "object" && typeof e != "function" || !wr.has(e))
|
|
724
710
|
throw new TypeError("Expected a service provider created by provideService()");
|
|
725
711
|
}
|
|
726
|
-
function
|
|
727
|
-
if (
|
|
728
|
-
const
|
|
729
|
-
return typeof
|
|
712
|
+
function Er(e) {
|
|
713
|
+
if (e == null || typeof e != "object" && typeof e != "function") return null;
|
|
714
|
+
const t = Reflect.get(e, "dispose");
|
|
715
|
+
return typeof t == "function" ? t : null;
|
|
730
716
|
}
|
|
731
|
-
const
|
|
717
|
+
const he = Object.freeze({
|
|
732
718
|
breadcrumbLabel: "Breadcrumb",
|
|
733
719
|
checkboxOptionLabel: "Option",
|
|
734
|
-
checkboxStateLabel: (
|
|
720
|
+
checkboxStateLabel: (e, t) => `${e}: ${t}`,
|
|
735
721
|
colorOptionGrayLabel: "Gray",
|
|
736
722
|
colorOptionGreenLabel: "Green",
|
|
737
723
|
colorOptionIceBlueLabel: "Ice blue",
|
|
@@ -763,8 +749,8 @@ const pe = Object.freeze({
|
|
|
763
749
|
radioOptionLabel: "Option",
|
|
764
750
|
splitViewSeparatorLabel: "Resize panes",
|
|
765
751
|
tabLineLabel: "Sections",
|
|
766
|
-
tableFilterColumnLabel: (
|
|
767
|
-
tableSortColumnLabel: (
|
|
752
|
+
tableFilterColumnLabel: (e) => `Filter ${e}`,
|
|
753
|
+
tableSortColumnLabel: (e) => `Sort ${e}`,
|
|
768
754
|
themeOptionCapillaryLabel: "Capillary",
|
|
769
755
|
themeOptionMinimalLabel: "Minimal",
|
|
770
756
|
themeOptionShinyLabel: "Shiny",
|
|
@@ -773,49 +759,49 @@ const pe = Object.freeze({
|
|
|
773
759
|
treeViewLoadError: "Unable to load tree items",
|
|
774
760
|
treeViewLoading: "Loading tree items…"
|
|
775
761
|
});
|
|
776
|
-
class
|
|
777
|
-
constructor(
|
|
762
|
+
class kt {
|
|
763
|
+
constructor(t, r) {
|
|
778
764
|
c(this, "locale");
|
|
779
765
|
c(this, "messages");
|
|
780
|
-
this.locale =
|
|
766
|
+
this.locale = t, this.messages = r, Object.freeze(this);
|
|
781
767
|
}
|
|
782
|
-
message(
|
|
783
|
-
return this.messages[
|
|
768
|
+
message(t) {
|
|
769
|
+
return this.messages[t];
|
|
784
770
|
}
|
|
785
771
|
}
|
|
786
|
-
const
|
|
772
|
+
const $r = new kt(
|
|
787
773
|
void 0,
|
|
788
|
-
|
|
774
|
+
he
|
|
789
775
|
);
|
|
790
|
-
function
|
|
791
|
-
if (
|
|
792
|
-
if (typeof
|
|
776
|
+
function xr(e) {
|
|
777
|
+
if (e == null) return $r;
|
|
778
|
+
if (typeof e != "object" || Array.isArray(e))
|
|
793
779
|
throw new TypeError("Capillary UI localization must be an object");
|
|
794
|
-
const
|
|
780
|
+
const t = Cr(e.locale), r = e.messages;
|
|
795
781
|
if (r != null && (typeof r != "object" || Array.isArray(r)))
|
|
796
782
|
throw new TypeError("Capillary UI localization messages must be an object");
|
|
797
|
-
const i = { ...
|
|
783
|
+
const i = { ...he };
|
|
798
784
|
if (r != null)
|
|
799
|
-
for (const n of Object.keys(
|
|
785
|
+
for (const n of Object.keys(he)) {
|
|
800
786
|
const s = r[n];
|
|
801
787
|
if (s === void 0) continue;
|
|
802
|
-
const o =
|
|
788
|
+
const o = he[n];
|
|
803
789
|
if (typeof s != typeof o)
|
|
804
790
|
throw new TypeError(`Capillary UI localization message "${n}" has the wrong type`);
|
|
805
791
|
Object.assign(i, { [n]: s });
|
|
806
792
|
}
|
|
807
|
-
return new
|
|
793
|
+
return new kt(t, Object.freeze(i));
|
|
808
794
|
}
|
|
809
|
-
function
|
|
810
|
-
if (typeof
|
|
795
|
+
function Cr(e) {
|
|
796
|
+
if (typeof e != "string" || e.trim() === "")
|
|
811
797
|
throw new TypeError("Capillary UI localization locale must be a non-empty BCP 47 language tag");
|
|
812
798
|
try {
|
|
813
|
-
return Intl.getCanonicalLocales(
|
|
814
|
-
} catch (
|
|
815
|
-
throw new RangeError(`Invalid Capillary UI localization locale: ${
|
|
799
|
+
return Intl.getCanonicalLocales(e)[0];
|
|
800
|
+
} catch (t) {
|
|
801
|
+
throw new RangeError(`Invalid Capillary UI localization locale: ${e}`, { cause: t });
|
|
816
802
|
}
|
|
817
803
|
}
|
|
818
|
-
const
|
|
804
|
+
const zr = /* @__PURE__ */ new Set([
|
|
819
805
|
"annotation-xml",
|
|
820
806
|
"color-profile",
|
|
821
807
|
"font-face",
|
|
@@ -825,71 +811,71 @@ const xr = /* @__PURE__ */ new Set([
|
|
|
825
811
|
"font-face-name",
|
|
826
812
|
"missing-glyph"
|
|
827
813
|
]);
|
|
828
|
-
class
|
|
829
|
-
constructor(
|
|
814
|
+
class St {
|
|
815
|
+
constructor(t = {}, r = dr()) {
|
|
830
816
|
c(this, "styleRegistry");
|
|
831
817
|
c(this, "services");
|
|
832
818
|
c(this, "router");
|
|
833
819
|
c(this, "localization");
|
|
834
820
|
c(this, "diagnosticScope");
|
|
835
821
|
c(this, "routedRoots", /* @__PURE__ */ new WeakSet());
|
|
836
|
-
if (
|
|
822
|
+
if (t == null || typeof t != "object" || Array.isArray(t))
|
|
837
823
|
throw new TypeError("CapillaryUiRuntime options must be an object");
|
|
838
|
-
if (Object.hasOwn(
|
|
824
|
+
if (Object.hasOwn(t, "elementNames"))
|
|
839
825
|
throw new TypeError("CapillaryUiRuntime no longer supports configurable element names");
|
|
840
|
-
if (this.styleRegistry = r, this.diagnosticScope =
|
|
826
|
+
if (this.styleRegistry = r, this.diagnosticScope = t.diagnosticScope ?? Wt, this.localization = xr(t.localization), this.services = t.services ?? vr(), !(this.services instanceof vt))
|
|
841
827
|
throw new TypeError("Capillary UI services must be a ServiceScope");
|
|
842
|
-
if (this.router =
|
|
828
|
+
if (this.router = t.router ?? null, this.router != null && (typeof this.router != "object" || typeof this.router.openScope != "function" || typeof this.router.completeScope != "function"))
|
|
843
829
|
throw new TypeError("Capillary UI router must be a BrowserRouter");
|
|
844
830
|
}
|
|
845
831
|
/** Resolve a fixed one-hyphen public host name for a built-in component. */
|
|
846
|
-
resolveElementName(
|
|
847
|
-
|
|
848
|
-
const r = `cap-${
|
|
849
|
-
return
|
|
832
|
+
resolveElementName(t) {
|
|
833
|
+
Et(t, "Capillary UI component host name");
|
|
834
|
+
const r = `cap-${t.replaceAll("-", "")}`;
|
|
835
|
+
return Tr(r), r;
|
|
850
836
|
}
|
|
851
|
-
resolveHostSelector(
|
|
852
|
-
if (typeof
|
|
853
|
-
return
|
|
837
|
+
resolveHostSelector(t, r) {
|
|
838
|
+
if (typeof t != "string") throw new TypeError("Host selector must be a string");
|
|
839
|
+
return t.replaceAll("&", this.resolveElementName(r));
|
|
854
840
|
}
|
|
855
|
-
resolveHostCSS(
|
|
856
|
-
if (typeof
|
|
857
|
-
return
|
|
841
|
+
resolveHostCSS(t, r) {
|
|
842
|
+
if (typeof t != "string") throw new TypeError("Host CSS must be a string");
|
|
843
|
+
return t.replaceAll("&", this.resolveElementName(r));
|
|
858
844
|
}
|
|
859
|
-
create(
|
|
860
|
-
const i = m.withScope(this.diagnosticScope, () => new
|
|
845
|
+
create(t, ...r) {
|
|
846
|
+
const i = m.withScope(this.diagnosticScope, () => new t(...r));
|
|
861
847
|
return i._setRuntime(this), i;
|
|
862
848
|
}
|
|
863
|
-
mount(
|
|
864
|
-
|
|
849
|
+
mount(t, r, i = null) {
|
|
850
|
+
t._setRuntime(this);
|
|
865
851
|
let n = null;
|
|
866
|
-
this.router != null && !this.routedRoots.has(
|
|
852
|
+
this.router != null && !this.routedRoots.has(t) && (this.routedRoots.add(t), n = this.router.openScope(this.router.root, t), t.onCleanup(n));
|
|
867
853
|
try {
|
|
868
|
-
|
|
854
|
+
t.mount(r, i), this.router != null && n != null && this.router.completeScope(this.router.root, t);
|
|
869
855
|
} catch (s) {
|
|
870
856
|
throw n == null || n(), s;
|
|
871
857
|
}
|
|
872
|
-
return
|
|
858
|
+
return t;
|
|
873
859
|
}
|
|
874
|
-
registerStyles(
|
|
875
|
-
if (
|
|
860
|
+
registerStyles(t) {
|
|
861
|
+
if (t == null || typeof t.registerStyles != "function")
|
|
876
862
|
throw new TypeError("registerStyles requires a Capillary UI component dependency");
|
|
877
|
-
return
|
|
863
|
+
return t.registerStyles(this), this;
|
|
878
864
|
}
|
|
879
|
-
injectStyles(
|
|
880
|
-
return this.styleRegistry.injectAll(
|
|
865
|
+
injectStyles(t = globalThis.document) {
|
|
866
|
+
return this.styleRegistry.injectAll(t);
|
|
881
867
|
}
|
|
882
868
|
}
|
|
883
|
-
const
|
|
884
|
-
function
|
|
885
|
-
if (typeof
|
|
886
|
-
throw new TypeError(`${
|
|
869
|
+
const Je = new St({}, pr);
|
|
870
|
+
function Et(e, t) {
|
|
871
|
+
if (typeof e != "string" || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(e))
|
|
872
|
+
throw new TypeError(`${t} must be a lowercase kebab-case name`);
|
|
887
873
|
}
|
|
888
|
-
function
|
|
889
|
-
if (
|
|
890
|
-
throw new TypeError(`Capillary UI element name must be a non-reserved name containing a hyphen: ${
|
|
874
|
+
function Tr(e) {
|
|
875
|
+
if (Et(e, "Capillary UI element name"), !e.includes("-") || zr.has(e))
|
|
876
|
+
throw new TypeError(`Capillary UI element name must be a non-reserved name containing a hyphen: ${e}`);
|
|
891
877
|
}
|
|
892
|
-
const
|
|
878
|
+
const re = Symbol.for("@capillaryjs/capillary-ui.Fragment"), Or = /* @__PURE__ */ new WeakSet(), Rr = /* @__PURE__ */ new Set([
|
|
893
879
|
"allowFullScreen",
|
|
894
880
|
"async",
|
|
895
881
|
"autoFocus",
|
|
@@ -913,7 +899,7 @@ const ee = Symbol.for("@capillaryjs/capillary-ui.Fragment"), Tr = /* @__PURE__ *
|
|
|
913
899
|
"required",
|
|
914
900
|
"reversed",
|
|
915
901
|
"selected"
|
|
916
|
-
]),
|
|
902
|
+
]), Ar = /* @__PURE__ */ new Set([
|
|
917
903
|
"checked",
|
|
918
904
|
"defaultChecked",
|
|
919
905
|
"defaultValue",
|
|
@@ -927,13 +913,13 @@ const ee = Symbol.for("@capillaryjs/capillary-ui.Fragment"), Tr = /* @__PURE__ *
|
|
|
927
913
|
"selectedIndex",
|
|
928
914
|
"tabIndex",
|
|
929
915
|
"value"
|
|
930
|
-
]),
|
|
931
|
-
let
|
|
932
|
-
function
|
|
933
|
-
|
|
916
|
+
]), Qe = "data-cap";
|
|
917
|
+
let z = null;
|
|
918
|
+
function $() {
|
|
919
|
+
z && (z.count += 1);
|
|
934
920
|
}
|
|
935
|
-
function
|
|
936
|
-
const i =
|
|
921
|
+
function ye(e, t = null, ...r) {
|
|
922
|
+
const i = t ?? {};
|
|
937
923
|
if (typeof i != "object" || Array.isArray(i))
|
|
938
924
|
throw new TypeError("VNode props must be an object or null");
|
|
939
925
|
const {
|
|
@@ -942,19 +928,19 @@ function me(t, e = null, ...r) {
|
|
|
942
928
|
...o
|
|
943
929
|
} = i;
|
|
944
930
|
return {
|
|
945
|
-
type:
|
|
931
|
+
type: e,
|
|
946
932
|
key: s,
|
|
947
933
|
props: {
|
|
948
934
|
...o,
|
|
949
|
-
children:
|
|
935
|
+
children: $t([n, r])
|
|
950
936
|
}
|
|
951
937
|
};
|
|
952
938
|
}
|
|
953
|
-
function
|
|
954
|
-
return
|
|
939
|
+
function Lr(e, ...t) {
|
|
940
|
+
return e.reduce((r, i, n) => r + i + String(t[n] ?? ""), "");
|
|
955
941
|
}
|
|
956
|
-
const
|
|
957
|
-
constructor(
|
|
942
|
+
const C = class C {
|
|
943
|
+
constructor(t = {}) {
|
|
958
944
|
c(this, "props");
|
|
959
945
|
c(this, "dom", null);
|
|
960
946
|
/** @internal */
|
|
@@ -973,51 +959,51 @@ const x = class x {
|
|
|
973
959
|
c(this, "renderReadSubscriptions", /* @__PURE__ */ new Map());
|
|
974
960
|
c(this, "collectingRenderReads", null);
|
|
975
961
|
/** @internal */
|
|
976
|
-
c(this, "_runtime",
|
|
962
|
+
c(this, "_runtime", Je);
|
|
977
963
|
/** @internal Route lineage inherited by nested routed components. */
|
|
978
964
|
c(this, "_routeContext", null);
|
|
979
965
|
/** JSX component for this instance's runtime-configured custom host. */
|
|
980
966
|
c(this, "Host", ({
|
|
981
|
-
children:
|
|
967
|
+
children: t = [],
|
|
982
968
|
...r
|
|
983
|
-
}) => this.host(r,
|
|
984
|
-
if (
|
|
969
|
+
}) => this.host(r, t));
|
|
970
|
+
if (t == null || typeof t != "object" || Array.isArray(t))
|
|
985
971
|
throw new TypeError(`${this.constructor.name} props must be an object`);
|
|
986
|
-
this.props =
|
|
972
|
+
this.props = t;
|
|
987
973
|
}
|
|
988
|
-
static new(...
|
|
989
|
-
const r = new this(...
|
|
990
|
-
if (!(r instanceof
|
|
974
|
+
static new(...t) {
|
|
975
|
+
const r = new this(...t);
|
|
976
|
+
if (!(r instanceof C))
|
|
991
977
|
throw new TypeError("Component.new() requires a Component constructor");
|
|
992
978
|
return r.mount();
|
|
993
979
|
}
|
|
994
|
-
static registerStyles(
|
|
980
|
+
static registerStyles(t = Je, r = /* @__PURE__ */ new Set()) {
|
|
995
981
|
if (r.has(this)) return;
|
|
996
982
|
r.add(this);
|
|
997
|
-
const i = this.hostName ?? null, n =
|
|
983
|
+
const i = this.hostName ?? null, n = Gr(this);
|
|
998
984
|
for (const s of n)
|
|
999
|
-
Object.hasOwn(s, "css") && s.css && (i == null ?
|
|
985
|
+
Object.hasOwn(s, "css") && s.css && (i == null ? t.styleRegistry.registerCSS(s.css) : t.styleRegistry.registerHostCSS(
|
|
1000
986
|
s.css,
|
|
1001
|
-
|
|
987
|
+
t.resolveElementName(i)
|
|
1002
988
|
));
|
|
1003
989
|
for (const s of n)
|
|
1004
990
|
if (Object.hasOwn(s, "dependencies"))
|
|
1005
991
|
for (const o of s.dependencies ?? [])
|
|
1006
|
-
o.registerStyles(
|
|
992
|
+
o.registerStyles(t, r);
|
|
1007
993
|
}
|
|
1008
994
|
get diagnosticScope() {
|
|
1009
|
-
var
|
|
1010
|
-
return this.constructor.diagnosticScope ?? ((
|
|
995
|
+
var t;
|
|
996
|
+
return this.constructor.diagnosticScope ?? ((t = this._parentComponent) == null ? void 0 : t.diagnosticScope) ?? this._runtime.diagnosticScope;
|
|
1011
997
|
}
|
|
1012
998
|
/** Stable instance label, captured when this component is first observed. */
|
|
1013
999
|
get diagnosticLabel() {
|
|
1014
|
-
const
|
|
1015
|
-
return
|
|
1000
|
+
const t = this.constructor;
|
|
1001
|
+
return t.diagnosticLabel ?? t.hostName ?? t.name;
|
|
1016
1002
|
}
|
|
1017
|
-
[
|
|
1003
|
+
[Yt]() {
|
|
1018
1004
|
return {
|
|
1019
1005
|
kind: "component",
|
|
1020
|
-
label:
|
|
1006
|
+
label: B(this),
|
|
1021
1007
|
scope: this.diagnosticScope,
|
|
1022
1008
|
sources: [...this.watched.keys(), ...this.renderReadSubscriptions.keys()],
|
|
1023
1009
|
targets: [...this._childComponents]
|
|
@@ -1030,7 +1016,7 @@ const x = class x {
|
|
|
1030
1016
|
throw new Error(`${this.constructor.name} must implement render()`);
|
|
1031
1017
|
}
|
|
1032
1018
|
/** Render this component's configured custom host element. */
|
|
1033
|
-
host(
|
|
1019
|
+
host(t = null, ...r) {
|
|
1034
1020
|
const i = this.constructor, n = i.hostName;
|
|
1035
1021
|
if (n == null)
|
|
1036
1022
|
throw new Error(`${this.constructor.name} does not declare a custom host name`);
|
|
@@ -1038,8 +1024,8 @@ const x = class x {
|
|
|
1038
1024
|
class: s,
|
|
1039
1025
|
className: o,
|
|
1040
1026
|
...a
|
|
1041
|
-
} =
|
|
1042
|
-
return
|
|
1027
|
+
} = t ?? {}, l = o ?? s, u = this.props.island === !0 ? Xr(l, "island") : l;
|
|
1028
|
+
return ye(this._runtime.resolveElementName(n), {
|
|
1043
1029
|
...a,
|
|
1044
1030
|
...u == null ? {} : { className: u },
|
|
1045
1031
|
"data-cap-component": n,
|
|
@@ -1047,54 +1033,54 @@ const x = class x {
|
|
|
1047
1033
|
}, ...r);
|
|
1048
1034
|
}
|
|
1049
1035
|
/** @internal Assign an immutable application runtime before initialization or mounting. */
|
|
1050
|
-
_setRuntime(
|
|
1036
|
+
_setRuntime(t) {
|
|
1051
1037
|
var r;
|
|
1052
|
-
if (!(
|
|
1038
|
+
if (!(t instanceof St))
|
|
1053
1039
|
throw new TypeError("Component runtime must be a CapillaryUiRuntime");
|
|
1054
|
-
if (
|
|
1040
|
+
if (t === this._runtime) return this;
|
|
1055
1041
|
if (this.initialized || this.mounted || this._rendered != null)
|
|
1056
1042
|
throw new Error("Cannot change a component runtime after initialization");
|
|
1057
|
-
return this._runtime =
|
|
1043
|
+
return this._runtime = t, this._routeContext == null && (this._routeContext = ((r = t.router) == null ? void 0 : r.root) ?? null), this;
|
|
1058
1044
|
}
|
|
1059
1045
|
/** @internal Assign contextual route lineage before initialization. */
|
|
1060
|
-
_setRouteContext(
|
|
1046
|
+
_setRouteContext(t) {
|
|
1061
1047
|
if (this.initialized || this.mounted || this._rendered != null)
|
|
1062
1048
|
throw new Error("Cannot change a component route context after initialization");
|
|
1063
|
-
return this._routeContext =
|
|
1049
|
+
return this._routeContext = t, this;
|
|
1064
1050
|
}
|
|
1065
1051
|
/** @internal Route lineage inherited by component children. */
|
|
1066
1052
|
_routeContextForChildren() {
|
|
1067
1053
|
return this._routeContext;
|
|
1068
1054
|
}
|
|
1069
1055
|
/** @internal Assign the renderer-owned component ancestry. */
|
|
1070
|
-
_setParentComponent(
|
|
1071
|
-
if (this._parentComponent != null && this._parentComponent !==
|
|
1056
|
+
_setParentComponent(t) {
|
|
1057
|
+
if (this._parentComponent != null && this._parentComponent !== t)
|
|
1072
1058
|
throw new Error("A component instance cannot move between component owners");
|
|
1073
|
-
return this._parentComponent =
|
|
1059
|
+
return this._parentComponent = t, this.validateIslandAncestry(this.props), this;
|
|
1074
1060
|
}
|
|
1075
|
-
mount(
|
|
1061
|
+
mount(t = null, r = null) {
|
|
1076
1062
|
if (this.destroyed) throw new Error("Cannot mount a destroyed component");
|
|
1077
1063
|
this.validateIslandAncestry(this.props);
|
|
1078
1064
|
let i = !1;
|
|
1079
|
-
return this.initialized || (this.validateRequiredServices(), this.initialized = !0, m.withScope(this.diagnosticScope, () => this.initialize())), this.mounted || (this.mounted = !0, this.update(), i = !0),
|
|
1065
|
+
return this.initialized || (this.validateRequiredServices(), this.initialized = !0, m.withScope(this.diagnosticScope, () => this.initialize())), this.mounted || (this.mounted = !0, this.update(), i = !0), t != null && (Yr(t), qe(t, this._rendered, r)), i && this.afterMount(this.dom), this;
|
|
1080
1066
|
}
|
|
1081
|
-
attachTo(
|
|
1082
|
-
return this.mount(
|
|
1067
|
+
attachTo(t) {
|
|
1068
|
+
return this.mount(t), this;
|
|
1083
1069
|
}
|
|
1084
|
-
update(
|
|
1070
|
+
update(t, r = t instanceof Ye ? "dependency" : "explicit") {
|
|
1085
1071
|
if (this.destroyed) return this;
|
|
1086
1072
|
if (!this.mounted) return this.mount();
|
|
1087
1073
|
if (this.updating)
|
|
1088
1074
|
return this.updateRequested = !0, this;
|
|
1089
1075
|
this.updating = !0;
|
|
1090
1076
|
const i = m.event(this, "consumer", {
|
|
1091
|
-
parent:
|
|
1077
|
+
parent: t instanceof Ye ? t : m.currentEvent,
|
|
1092
1078
|
cause: "component render",
|
|
1093
1079
|
outcome: "started",
|
|
1094
1080
|
consumer: { trigger: r }
|
|
1095
|
-
}), n =
|
|
1081
|
+
}), n = z, s = i ? { count: 0 } : null;
|
|
1096
1082
|
let o = 0;
|
|
1097
|
-
|
|
1083
|
+
z = s;
|
|
1098
1084
|
try {
|
|
1099
1085
|
m.withEvent(i, () => {
|
|
1100
1086
|
do {
|
|
@@ -1103,7 +1089,7 @@ const x = class x {
|
|
|
1103
1089
|
this.collectingRenderReads = a;
|
|
1104
1090
|
let l;
|
|
1105
1091
|
try {
|
|
1106
|
-
l = m.withScope(this.diagnosticScope, () =>
|
|
1092
|
+
l = m.withScope(this.diagnosticScope, () => ee(this.render()));
|
|
1107
1093
|
} finally {
|
|
1108
1094
|
this.collectingRenderReads = null;
|
|
1109
1095
|
}
|
|
@@ -1124,25 +1110,25 @@ const x = class x {
|
|
|
1124
1110
|
consumer: { trigger: r, domWrites: s.count, renderPasses: o }
|
|
1125
1111
|
}), a;
|
|
1126
1112
|
} finally {
|
|
1127
|
-
|
|
1113
|
+
z = n, this.updating = !1;
|
|
1128
1114
|
}
|
|
1129
1115
|
return this;
|
|
1130
1116
|
}
|
|
1131
|
-
setProps(
|
|
1117
|
+
setProps(t) {
|
|
1132
1118
|
var r, i;
|
|
1133
|
-
if (
|
|
1119
|
+
if (t == null || typeof t != "object" || Array.isArray(t))
|
|
1134
1120
|
throw new TypeError(`${this.constructor.name} props must be an object`);
|
|
1135
|
-
return this.validateIslandAncestry(
|
|
1121
|
+
return this.validateIslandAncestry(t), this.props = t, this.mounted && this.update(
|
|
1136
1122
|
void 0,
|
|
1137
1123
|
((i = (r = m.currentEvent) == null ? void 0 : r.diagnostic) == null ? void 0 : i.node.kind) === "binding" ? "dependency" : "parent"
|
|
1138
1124
|
), this;
|
|
1139
1125
|
}
|
|
1140
|
-
afterMount(
|
|
1126
|
+
afterMount(t) {
|
|
1141
1127
|
}
|
|
1142
|
-
afterUpdate(
|
|
1128
|
+
afterUpdate(t) {
|
|
1143
1129
|
}
|
|
1144
|
-
watch(...
|
|
1145
|
-
for (const r of
|
|
1130
|
+
watch(...t) {
|
|
1131
|
+
for (const r of t) {
|
|
1146
1132
|
if (r == null || typeof r.subscribe != "function")
|
|
1147
1133
|
throw new TypeError("watch requires emitter-like values");
|
|
1148
1134
|
if (this.watched.has(r)) continue;
|
|
@@ -1155,61 +1141,61 @@ const x = class x {
|
|
|
1155
1141
|
}
|
|
1156
1142
|
return this;
|
|
1157
1143
|
}
|
|
1158
|
-
watchFutureValues(...
|
|
1159
|
-
return this.watch(...
|
|
1144
|
+
watchFutureValues(...t) {
|
|
1145
|
+
return this.watch(...t);
|
|
1160
1146
|
}
|
|
1161
1147
|
/** Read an emitter during render and rerender when that dependency changes. */
|
|
1162
|
-
read(
|
|
1163
|
-
return this.trackRenderRead(
|
|
1148
|
+
read(t) {
|
|
1149
|
+
return this.trackRenderRead(t), t.get();
|
|
1164
1150
|
}
|
|
1165
1151
|
/** Read a Capillary value, fetch state, and error as one tracked render dependency. */
|
|
1166
|
-
snapshot(
|
|
1167
|
-
return this.trackRenderRead(
|
|
1168
|
-
value:
|
|
1169
|
-
fetchState:
|
|
1170
|
-
error:
|
|
1152
|
+
snapshot(t) {
|
|
1153
|
+
return this.trackRenderRead(t), Object.freeze({
|
|
1154
|
+
value: t.get(),
|
|
1155
|
+
fetchState: t.getFetchState(),
|
|
1156
|
+
error: t.getError()
|
|
1171
1157
|
});
|
|
1172
1158
|
}
|
|
1173
|
-
onCleanup(
|
|
1174
|
-
if (typeof
|
|
1159
|
+
onCleanup(t) {
|
|
1160
|
+
if (typeof t != "function") throw new TypeError("cleanup must be a function");
|
|
1175
1161
|
if (this.destroyed)
|
|
1176
|
-
return
|
|
1162
|
+
return t(), () => {
|
|
1177
1163
|
};
|
|
1178
|
-
this.cleanupFunctions.add(
|
|
1164
|
+
this.cleanupFunctions.add(t);
|
|
1179
1165
|
let r = !0;
|
|
1180
1166
|
return () => {
|
|
1181
|
-
r && (r = !1, this.cleanupFunctions.delete(
|
|
1167
|
+
r && (r = !1, this.cleanupFunctions.delete(t), t());
|
|
1182
1168
|
};
|
|
1183
1169
|
}
|
|
1184
1170
|
/** Resolve one explicitly declared application service from this component's runtime. */
|
|
1185
|
-
requireService(
|
|
1171
|
+
requireService(t) {
|
|
1186
1172
|
if (!this.initialized)
|
|
1187
1173
|
throw new Error("Components may resolve services during initialize() or later");
|
|
1188
1174
|
const r = this.constructor;
|
|
1189
|
-
if (!r.requiredServices.includes(
|
|
1175
|
+
if (!r.requiredServices.includes(t))
|
|
1190
1176
|
throw new Error(
|
|
1191
|
-
`${r.name} must declare service "${
|
|
1177
|
+
`${r.name} must declare service "${t.name}" in requiredServices`
|
|
1192
1178
|
);
|
|
1193
|
-
return this._runtime.services.require(
|
|
1179
|
+
return this._runtime.services.require(t);
|
|
1194
1180
|
}
|
|
1195
1181
|
/** Read the immutable Capillary UI localization selected for this component's runtime. */
|
|
1196
1182
|
get localization() {
|
|
1197
1183
|
return this._runtime.localization;
|
|
1198
1184
|
}
|
|
1199
1185
|
/** Resolve one Capillary UI-authored message with the runtime's English fallback. */
|
|
1200
|
-
capillaryUiMessage(
|
|
1201
|
-
return this.localization.message(
|
|
1186
|
+
capillaryUiMessage(t) {
|
|
1187
|
+
return this.localization.message(t);
|
|
1202
1188
|
}
|
|
1203
|
-
listen(
|
|
1204
|
-
if (
|
|
1189
|
+
listen(t, r, i, n) {
|
|
1190
|
+
if (t == null || typeof t.addEventListener != "function")
|
|
1205
1191
|
throw new TypeError("listen target must be an EventTarget");
|
|
1206
1192
|
const s = {};
|
|
1207
1193
|
m.configure(s, {
|
|
1208
1194
|
kind: "interaction",
|
|
1209
|
-
label: `${
|
|
1195
|
+
label: `${B(this)}: ${r}`,
|
|
1210
1196
|
scope: this.diagnosticScope
|
|
1211
1197
|
});
|
|
1212
|
-
const o = (a) =>
|
|
1198
|
+
const o = (a) => be(
|
|
1213
1199
|
s,
|
|
1214
1200
|
this.diagnosticScope,
|
|
1215
1201
|
a,
|
|
@@ -1217,8 +1203,8 @@ const x = class x {
|
|
|
1217
1203
|
r,
|
|
1218
1204
|
() => i(a)
|
|
1219
1205
|
);
|
|
1220
|
-
return
|
|
1221
|
-
|
|
1206
|
+
return t.addEventListener(r, o, n), this.onCleanup(() => {
|
|
1207
|
+
t.removeEventListener(r, o, n), m.dispose(s);
|
|
1222
1208
|
}), this;
|
|
1223
1209
|
}
|
|
1224
1210
|
/**
|
|
@@ -1229,16 +1215,16 @@ const x = class x {
|
|
|
1229
1215
|
* runs through the same traced native-event coalescing as listen(), and
|
|
1230
1216
|
* is removed on destroy if it is still attached.
|
|
1231
1217
|
*/
|
|
1232
|
-
listenWhile(
|
|
1233
|
-
if (
|
|
1218
|
+
listenWhile(t, r, i, n) {
|
|
1219
|
+
if (t == null || typeof t.addEventListener != "function")
|
|
1234
1220
|
throw new TypeError("listen target must be an EventTarget");
|
|
1235
1221
|
const s = {};
|
|
1236
1222
|
m.configure(s, {
|
|
1237
1223
|
kind: "interaction",
|
|
1238
|
-
label: `${
|
|
1224
|
+
label: `${B(this)}: ${r}`,
|
|
1239
1225
|
scope: this.diagnosticScope
|
|
1240
1226
|
});
|
|
1241
|
-
const o = (d) =>
|
|
1227
|
+
const o = (d) => be(
|
|
1242
1228
|
s,
|
|
1243
1229
|
this.diagnosticScope,
|
|
1244
1230
|
d,
|
|
@@ -1248,57 +1234,57 @@ const x = class x {
|
|
|
1248
1234
|
);
|
|
1249
1235
|
let a = !1;
|
|
1250
1236
|
const l = () => {
|
|
1251
|
-
a && (a = !1,
|
|
1237
|
+
a && (a = !1, t.removeEventListener(r, o, n), m.dispose(s));
|
|
1252
1238
|
}, u = this.onCleanup(l);
|
|
1253
|
-
return this.destroyed || (a = !0,
|
|
1239
|
+
return this.destroyed || (a = !0, t.addEventListener(r, o, n)), u;
|
|
1254
1240
|
}
|
|
1255
|
-
registerChild(
|
|
1256
|
-
if (!(
|
|
1241
|
+
registerChild(t) {
|
|
1242
|
+
if (!(t instanceof C))
|
|
1257
1243
|
throw new TypeError("registerChild requires a Component");
|
|
1258
|
-
return this._childComponents.add(
|
|
1244
|
+
return this._childComponents.add(t), m.active && m.inspect(this), t;
|
|
1259
1245
|
}
|
|
1260
1246
|
destroy() {
|
|
1261
1247
|
if (!this.destroyed) {
|
|
1262
1248
|
this.destroyed = !0, this.mounted = !1, m.dispose(this);
|
|
1263
|
-
for (const
|
|
1249
|
+
for (const t of [...this.cleanupFunctions]) t();
|
|
1264
1250
|
this.cleanupFunctions.clear(), this.watched.clear();
|
|
1265
|
-
for (const
|
|
1251
|
+
for (const t of this.renderReadSubscriptions.values()) t();
|
|
1266
1252
|
this.renderReadSubscriptions.clear(), this.collectingRenderReads = null, this._rendered && M(this._rendered, !0), this._rendered = null, this.dom = null, this._childComponents.clear(), this.onDestroy();
|
|
1267
1253
|
}
|
|
1268
1254
|
}
|
|
1269
1255
|
validateRequiredServices() {
|
|
1270
|
-
const
|
|
1271
|
-
for (const r of
|
|
1256
|
+
const t = this.constructor;
|
|
1257
|
+
for (const r of t.requiredServices)
|
|
1272
1258
|
if (!this._runtime.services.has(r))
|
|
1273
|
-
throw new Error(`${
|
|
1259
|
+
throw new Error(`${t.name} requires unregistered service "${r.name}"`);
|
|
1274
1260
|
}
|
|
1275
|
-
validateIslandAncestry(
|
|
1276
|
-
if (!
|
|
1261
|
+
validateIslandAncestry(t) {
|
|
1262
|
+
if (!Le(t)) return;
|
|
1277
1263
|
if (this.hasIslandDescendant())
|
|
1278
1264
|
throw new Error("An island component cannot contain another island");
|
|
1279
1265
|
let r = this._parentComponent;
|
|
1280
1266
|
for (; r != null; ) {
|
|
1281
|
-
if (
|
|
1267
|
+
if (Le(r.props))
|
|
1282
1268
|
throw new Error("An island component cannot be nested inside another island");
|
|
1283
1269
|
r = r._parentComponent;
|
|
1284
1270
|
}
|
|
1285
1271
|
}
|
|
1286
1272
|
hasIslandDescendant() {
|
|
1287
|
-
for (const
|
|
1288
|
-
if (
|
|
1273
|
+
for (const t of this._childComponents)
|
|
1274
|
+
if (Le(t.props) || t.hasIslandDescendant()) return !0;
|
|
1289
1275
|
return !1;
|
|
1290
1276
|
}
|
|
1291
1277
|
onDestroy() {
|
|
1292
1278
|
}
|
|
1293
|
-
trackRenderRead(
|
|
1294
|
-
if (
|
|
1279
|
+
trackRenderRead(t) {
|
|
1280
|
+
if (Dt(t, "Component.read"), this.collectingRenderReads == null)
|
|
1295
1281
|
throw new Error("Component.read() and snapshot() may only be called during render()");
|
|
1296
|
-
this.collectingRenderReads.add(
|
|
1282
|
+
this.collectingRenderReads.add(t);
|
|
1297
1283
|
}
|
|
1298
|
-
reconcileRenderReads(
|
|
1284
|
+
reconcileRenderReads(t) {
|
|
1299
1285
|
for (const [r, i] of this.renderReadSubscriptions)
|
|
1300
|
-
|
|
1301
|
-
for (const r of
|
|
1286
|
+
t.has(r) || (i(), this.renderReadSubscriptions.delete(r));
|
|
1287
|
+
for (const r of t) {
|
|
1302
1288
|
if (this.watched.has(r) || this.renderReadSubscriptions.has(r)) continue;
|
|
1303
1289
|
const i = r.subscribe(({ event: n }) => {
|
|
1304
1290
|
this.mounted && !this.destroyed && this.update(n);
|
|
@@ -1307,8 +1293,8 @@ const x = class x {
|
|
|
1307
1293
|
}
|
|
1308
1294
|
}
|
|
1309
1295
|
};
|
|
1310
|
-
c(
|
|
1311
|
-
c(
|
|
1296
|
+
c(C, "dependencies", []), c(C, "requiredServices", []), /** Component `live()` bindings are opt-in; subclasses declare their allowlist. */
|
|
1297
|
+
c(C, "liveProps", []), c(C, "css", Lr`
|
|
1312
1298
|
.cap-fill-horizontal,
|
|
1313
1299
|
.cap-fill-vertical {
|
|
1314
1300
|
box-sizing: border-box;
|
|
@@ -1455,71 +1441,71 @@ c(x, "liveProps", []), c(x, "css", Ar`
|
|
|
1455
1441
|
label[data-cap] {
|
|
1456
1442
|
user-select: none;
|
|
1457
1443
|
}
|
|
1458
|
-
`), c(
|
|
1459
|
-
c(
|
|
1460
|
-
c(
|
|
1461
|
-
c(
|
|
1462
|
-
let
|
|
1463
|
-
function
|
|
1464
|
-
return Array.isArray(
|
|
1444
|
+
`), c(C, "hostName", null), /** Override for a diagnostic-tool subtree; ordinary components inherit their owner/runtime. */
|
|
1445
|
+
c(C, "diagnosticScope", null), /** Optional stable display name for bundled application components. Built-ins use their host name. */
|
|
1446
|
+
c(C, "diagnosticLabel", null), /** Optional host-level data surface marker for parent composition. */
|
|
1447
|
+
c(C, "dataSurface", null);
|
|
1448
|
+
let O = C;
|
|
1449
|
+
function ee(e) {
|
|
1450
|
+
return Array.isArray(e) ? ye(re, null, e) : e == null || typeof e == "boolean" ? ye(re) : e;
|
|
1465
1451
|
}
|
|
1466
|
-
function
|
|
1467
|
-
const
|
|
1452
|
+
function $t(e) {
|
|
1453
|
+
const t = [], r = (i) => {
|
|
1468
1454
|
if (Array.isArray(i))
|
|
1469
1455
|
for (const n of i) r(n);
|
|
1470
|
-
else i != null && typeof i != "boolean" &&
|
|
1456
|
+
else i != null && typeof i != "boolean" && t.push(i);
|
|
1471
1457
|
};
|
|
1472
|
-
return r(
|
|
1458
|
+
return r(e), t;
|
|
1473
1459
|
}
|
|
1474
|
-
function
|
|
1475
|
-
if (typeof
|
|
1460
|
+
function ie(e, t) {
|
|
1461
|
+
if (typeof e == "string" || typeof e == "number")
|
|
1476
1462
|
return {
|
|
1477
1463
|
kind: "text",
|
|
1478
1464
|
key: null,
|
|
1479
|
-
value:
|
|
1480
|
-
node: document.createTextNode(String(
|
|
1481
|
-
owner:
|
|
1465
|
+
value: e,
|
|
1466
|
+
node: document.createTextNode(String(e)),
|
|
1467
|
+
owner: t
|
|
1482
1468
|
};
|
|
1483
|
-
if (
|
|
1484
|
-
const s = document.createComment("cap-emitter-start"), o = document.createComment("cap-emitter-end"), a =
|
|
1485
|
-
if (Object.is(a,
|
|
1469
|
+
if (Ee(e)) {
|
|
1470
|
+
const s = document.createComment("cap-emitter-start"), o = document.createComment("cap-emitter-end"), a = e.get();
|
|
1471
|
+
if (Object.is(a, e))
|
|
1486
1472
|
throw new TypeError("A Capillary UI emitter child cannot render itself");
|
|
1487
1473
|
const l = document.createDocumentFragment();
|
|
1488
|
-
l.append(s, o),
|
|
1489
|
-
const u =
|
|
1490
|
-
|
|
1474
|
+
l.append(s, o), $(), $();
|
|
1475
|
+
const u = ie(ee(a), t);
|
|
1476
|
+
qe(l, u, o);
|
|
1491
1477
|
const d = {
|
|
1492
1478
|
kind: "emitter",
|
|
1493
1479
|
key: null,
|
|
1494
|
-
source:
|
|
1480
|
+
source: e,
|
|
1495
1481
|
start: s,
|
|
1496
1482
|
end: o,
|
|
1497
1483
|
child: u,
|
|
1498
1484
|
unsubscribe: () => {
|
|
1499
1485
|
},
|
|
1500
|
-
owner:
|
|
1486
|
+
owner: t
|
|
1501
1487
|
};
|
|
1502
|
-
return d.unsubscribe =
|
|
1503
|
-
if (Object.is(
|
|
1488
|
+
return d.unsubscribe = Se(e, d, t, "reactive child", (p) => {
|
|
1489
|
+
if (Object.is(p, e))
|
|
1504
1490
|
throw new TypeError("A Capillary UI emitter child cannot render itself");
|
|
1505
|
-
d.child = Ie(d.child,
|
|
1491
|
+
d.child = Ie(d.child, ee(p), t);
|
|
1506
1492
|
}), d;
|
|
1507
1493
|
}
|
|
1508
|
-
if (
|
|
1509
|
-
return
|
|
1494
|
+
if (e instanceof O)
|
|
1495
|
+
return e._setRuntime(t._runtime), e._setRouteContext(t._routeContextForChildren()), e._setParentComponent(t), e.mount(), t.registerChild(e), {
|
|
1510
1496
|
kind: "component",
|
|
1511
|
-
key:
|
|
1512
|
-
type:
|
|
1513
|
-
instance:
|
|
1497
|
+
key: Lt(e.props),
|
|
1498
|
+
type: e.constructor,
|
|
1499
|
+
instance: e,
|
|
1514
1500
|
prebuilt: !0,
|
|
1515
|
-
props:
|
|
1501
|
+
props: e.props,
|
|
1516
1502
|
liveProps: /* @__PURE__ */ new Map(),
|
|
1517
|
-
owner:
|
|
1503
|
+
owner: t
|
|
1518
1504
|
};
|
|
1519
|
-
if (!
|
|
1520
|
-
throw new TypeError(`Invalid Capillary UI child: ${
|
|
1521
|
-
const { type: r, key: i = null, props: n } =
|
|
1522
|
-
if (r ===
|
|
1505
|
+
if (!A(e))
|
|
1506
|
+
throw new TypeError(`Invalid Capillary UI child: ${nt(e)}`);
|
|
1507
|
+
const { type: r, key: i = null, props: n } = e;
|
|
1508
|
+
if (r === re) {
|
|
1523
1509
|
const s = document.createComment("cap-fragment-start"), o = document.createComment("cap-fragment-end"), a = {
|
|
1524
1510
|
kind: "fragment",
|
|
1525
1511
|
key: i,
|
|
@@ -1527,13 +1513,13 @@ function te(t, e) {
|
|
|
1527
1513
|
start: s,
|
|
1528
1514
|
end: o,
|
|
1529
1515
|
children: [],
|
|
1530
|
-
owner:
|
|
1516
|
+
owner: t
|
|
1531
1517
|
}, l = document.createDocumentFragment();
|
|
1532
|
-
return l.append(s, o),
|
|
1518
|
+
return l.append(s, o), $(), $(), a.children = ge(
|
|
1533
1519
|
l,
|
|
1534
1520
|
[],
|
|
1535
1521
|
n.children,
|
|
1536
|
-
|
|
1522
|
+
t,
|
|
1537
1523
|
o,
|
|
1538
1524
|
s
|
|
1539
1525
|
), a;
|
|
@@ -1550,18 +1536,18 @@ function te(t, e) {
|
|
|
1550
1536
|
nativeBindings: /* @__PURE__ */ new Map(),
|
|
1551
1537
|
ref: null,
|
|
1552
1538
|
children: [],
|
|
1553
|
-
owner:
|
|
1539
|
+
owner: t
|
|
1554
1540
|
};
|
|
1555
|
-
return
|
|
1541
|
+
return Ot(o, n), o.children = ge(s, [], n.children, t), o;
|
|
1556
1542
|
}
|
|
1557
|
-
if (
|
|
1543
|
+
if (Mt(r)) {
|
|
1558
1544
|
const s = n;
|
|
1559
|
-
|
|
1560
|
-
const o =
|
|
1561
|
-
r.diagnosticScope ??
|
|
1545
|
+
zt(r, s);
|
|
1546
|
+
const o = et(s), a = m.withScope(
|
|
1547
|
+
r.diagnosticScope ?? t.diagnosticScope,
|
|
1562
1548
|
() => new r(o)
|
|
1563
1549
|
);
|
|
1564
|
-
a._setRuntime(
|
|
1550
|
+
a._setRuntime(t._runtime), a._setRouteContext(t._routeContextForChildren()), a._setParentComponent(t);
|
|
1565
1551
|
const l = {
|
|
1566
1552
|
kind: "component",
|
|
1567
1553
|
key: i,
|
|
@@ -1570,19 +1556,19 @@ function te(t, e) {
|
|
|
1570
1556
|
prebuilt: !1,
|
|
1571
1557
|
props: o,
|
|
1572
1558
|
liveProps: /* @__PURE__ */ new Map(),
|
|
1573
|
-
owner:
|
|
1559
|
+
owner: t
|
|
1574
1560
|
};
|
|
1575
|
-
return
|
|
1561
|
+
return Ct(l, s), a.mount(), t.registerChild(a), l;
|
|
1576
1562
|
}
|
|
1577
1563
|
if (typeof r == "function") {
|
|
1578
|
-
const s = r, o = n, a =
|
|
1564
|
+
const s = r, o = n, a = et(o), l = s === Reflect.get(t, "Host") ? null : {};
|
|
1579
1565
|
l && m.configure(l, {
|
|
1580
1566
|
kind: "component",
|
|
1581
1567
|
label: String(Reflect.get(s, "diagnosticLabel") ?? s.name ?? "Function component"),
|
|
1582
|
-
scope:
|
|
1583
|
-
sources: [
|
|
1568
|
+
scope: t.diagnosticScope,
|
|
1569
|
+
sources: [t]
|
|
1584
1570
|
});
|
|
1585
|
-
const u = Tt(l, () =>
|
|
1571
|
+
const u = Tt(l, () => ie(ee(s(a)), t)), d = {
|
|
1586
1572
|
kind: "function",
|
|
1587
1573
|
key: i,
|
|
1588
1574
|
type: s,
|
|
@@ -1591,200 +1577,200 @@ function te(t, e) {
|
|
|
1591
1577
|
liveProps: /* @__PURE__ */ new Map(),
|
|
1592
1578
|
child: u,
|
|
1593
1579
|
diagnosticSubject: l,
|
|
1594
|
-
owner:
|
|
1580
|
+
owner: t
|
|
1595
1581
|
};
|
|
1596
|
-
return
|
|
1582
|
+
return Mr(d), d;
|
|
1597
1583
|
}
|
|
1598
|
-
throw new TypeError(`Unsupported vnode type: ${
|
|
1584
|
+
throw new TypeError(`Unsupported vnode type: ${nt(r)}`);
|
|
1599
1585
|
}
|
|
1600
|
-
function Ie(
|
|
1601
|
-
if (
|
|
1602
|
-
if (jt(
|
|
1603
|
-
const i =
|
|
1604
|
-
return s &&
|
|
1586
|
+
function Ie(e, t, r) {
|
|
1587
|
+
if (e == null) return ie(t, r);
|
|
1588
|
+
if (jt(e, t)) return xt(e, t, r);
|
|
1589
|
+
const i = ie(t, r), n = At(e), s = (n == null ? void 0 : n.parentNode) ?? null;
|
|
1590
|
+
return s && qe(s, i, n), M(e, !0), i;
|
|
1605
1591
|
}
|
|
1606
|
-
function
|
|
1607
|
-
return
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1592
|
+
function xt(e, t, r) {
|
|
1593
|
+
return e.kind === "text" ? (typeof t != "string" && typeof t != "number" || Object.is(e.value, t) || (e.value = t, e.node.data = String(t), $()), e) : e.kind === "emitter" ? (!Ee(t) || e.source !== t, e) : e.kind === "component" ? (t instanceof O || A(t) && jr(e, t.props), e) : A(t) ? e.kind === "function" ? (Dr(e, t.props), e) : e.kind === "fragment" ? (e.children = ge(
|
|
1594
|
+
e.start.parentNode,
|
|
1595
|
+
e.children,
|
|
1596
|
+
t.props.children,
|
|
1611
1597
|
r,
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
),
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1598
|
+
e.end,
|
|
1599
|
+
e.start
|
|
1600
|
+
), e) : (Ot(e, t.props), e.children = ge(
|
|
1601
|
+
e.node,
|
|
1602
|
+
e.children,
|
|
1603
|
+
t.props.children,
|
|
1618
1604
|
r
|
|
1619
|
-
),
|
|
1605
|
+
), e) : e;
|
|
1620
1606
|
}
|
|
1621
|
-
function
|
|
1622
|
-
return Object.fromEntries(Object.entries(
|
|
1623
|
-
|
|
1624
|
-
|
|
1607
|
+
function et(e) {
|
|
1608
|
+
return Object.fromEntries(Object.entries(e).map(([t, r]) => [
|
|
1609
|
+
t,
|
|
1610
|
+
U(r) ? r.emitter.get() : r
|
|
1625
1611
|
]));
|
|
1626
1612
|
}
|
|
1627
|
-
function
|
|
1628
|
-
_e(
|
|
1629
|
-
|
|
1630
|
-
}),
|
|
1613
|
+
function Ct(e, t) {
|
|
1614
|
+
_e(e.liveProps, t, e.instance, B(e.instance), (r, i) => {
|
|
1615
|
+
e.props = { ...e.props, [r]: i }, e.instance.setProps(e.props);
|
|
1616
|
+
}), e.props = Be(e.liveProps, t), e.instance.setProps(e.props);
|
|
1631
1617
|
}
|
|
1632
|
-
function
|
|
1633
|
-
|
|
1618
|
+
function jr(e, t) {
|
|
1619
|
+
zt(e.type, t), Ct(e, t);
|
|
1634
1620
|
}
|
|
1635
|
-
function
|
|
1636
|
-
const r = Reflect.get(
|
|
1621
|
+
function zt(e, t) {
|
|
1622
|
+
const r = Reflect.get(e, "liveProps");
|
|
1637
1623
|
if (r == null) return;
|
|
1638
1624
|
if (!Array.isArray(r) || r.some((n) => typeof n != "string"))
|
|
1639
|
-
throw new TypeError(`${
|
|
1625
|
+
throw new TypeError(`${e.name || "Component"}.liveProps must be an array`);
|
|
1640
1626
|
const i = new Set(r);
|
|
1641
|
-
for (const [n, s] of Object.entries(
|
|
1642
|
-
if (
|
|
1627
|
+
for (const [n, s] of Object.entries(t))
|
|
1628
|
+
if (U(s) && !i.has(n))
|
|
1643
1629
|
throw new TypeError(
|
|
1644
|
-
`${
|
|
1630
|
+
`${e.name || "Component"} prop "${n}" does not support live()`
|
|
1645
1631
|
);
|
|
1646
1632
|
}
|
|
1647
|
-
function
|
|
1648
|
-
_e(
|
|
1649
|
-
|
|
1650
|
-
}),
|
|
1651
|
-
}
|
|
1652
|
-
function
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
}),
|
|
1656
|
-
}
|
|
1657
|
-
function
|
|
1658
|
-
Tt(
|
|
1659
|
-
const r =
|
|
1660
|
-
|
|
1661
|
-
},
|
|
1662
|
-
}
|
|
1663
|
-
function Tt(
|
|
1664
|
-
if (!
|
|
1665
|
-
const i = m.event(
|
|
1666
|
-
|
|
1633
|
+
function Mr(e) {
|
|
1634
|
+
_e(e.liveProps, e.sourceProps, e.owner, e.type.diagnosticLabel ?? e.type.name, (t, r) => {
|
|
1635
|
+
e.props = { ...e.props, [t]: r }, De(e, "dependency");
|
|
1636
|
+
}), e.props = Be(e.liveProps, e.sourceProps);
|
|
1637
|
+
}
|
|
1638
|
+
function Dr(e, t) {
|
|
1639
|
+
e.sourceProps = t, _e(e.liveProps, t, e.owner, e.type.diagnosticLabel ?? e.type.name, (r, i) => {
|
|
1640
|
+
e.props = { ...e.props, [r]: i }, De(e, "dependency");
|
|
1641
|
+
}), e.props = Be(e.liveProps, t), De(e);
|
|
1642
|
+
}
|
|
1643
|
+
function De(e, t = "parent") {
|
|
1644
|
+
Tt(e.diagnosticSubject, () => {
|
|
1645
|
+
const r = ee(e.type(e.props));
|
|
1646
|
+
e.child = Ie(e.child, r, e.owner);
|
|
1647
|
+
}, t);
|
|
1648
|
+
}
|
|
1649
|
+
function Tt(e, t, r = "parent") {
|
|
1650
|
+
if (!e) return t();
|
|
1651
|
+
const i = m.event(e, "consumer", { cause: "function component render", outcome: "started", consumer: { trigger: r } }), n = z, s = i ? { count: 0 } : null;
|
|
1652
|
+
z = s;
|
|
1667
1653
|
try {
|
|
1668
|
-
const o = i ? m.withEvent(i,
|
|
1669
|
-
return i && m.event(
|
|
1654
|
+
const o = i ? m.withEvent(i, t) : t();
|
|
1655
|
+
return i && m.event(e, "consumer", { parent: i, cause: "function component rendered", outcome: "succeeded", consumer: { trigger: r, domWrites: s.count, renderPasses: 1 } }), o;
|
|
1670
1656
|
} catch (o) {
|
|
1671
|
-
throw i && m.event(
|
|
1657
|
+
throw i && m.event(e, "consumer", { parent: i, cause: "function component failed", outcome: "failed", error: o, consumer: { trigger: r, domWrites: s.count, renderPasses: 1 } }), o;
|
|
1672
1658
|
} finally {
|
|
1673
|
-
|
|
1659
|
+
z = n;
|
|
1674
1660
|
}
|
|
1675
1661
|
}
|
|
1676
|
-
function _e(
|
|
1677
|
-
for (const [s, o] of
|
|
1678
|
-
const a =
|
|
1679
|
-
|
|
1662
|
+
function _e(e, t, r, i, n) {
|
|
1663
|
+
for (const [s, o] of e) {
|
|
1664
|
+
const a = t[s];
|
|
1665
|
+
U(a) && a.emitter === o.source || (o.unsubscribe(), e.delete(s));
|
|
1680
1666
|
}
|
|
1681
|
-
for (const [s, o] of Object.entries(
|
|
1682
|
-
if (!
|
|
1667
|
+
for (const [s, o] of Object.entries(t)) {
|
|
1668
|
+
if (!U(o) || e.has(s)) continue;
|
|
1683
1669
|
const a = {
|
|
1684
1670
|
source: o.emitter,
|
|
1685
1671
|
value: o.emitter.get(),
|
|
1686
1672
|
unsubscribe: () => {
|
|
1687
1673
|
}
|
|
1688
1674
|
};
|
|
1689
|
-
a.unsubscribe =
|
|
1690
|
-
|
|
1691
|
-
}),
|
|
1675
|
+
a.unsubscribe = Se(o.emitter, a, r, `${i}.${s}`, (l) => {
|
|
1676
|
+
e.get(s) === a && (a.value = l, n(s, l));
|
|
1677
|
+
}), e.set(s, a);
|
|
1692
1678
|
}
|
|
1693
1679
|
}
|
|
1694
|
-
function Be(
|
|
1695
|
-
return Object.fromEntries(Object.entries(
|
|
1680
|
+
function Be(e, t) {
|
|
1681
|
+
return Object.fromEntries(Object.entries(t).map(([r, i]) => {
|
|
1696
1682
|
var n;
|
|
1697
1683
|
return [
|
|
1698
1684
|
r,
|
|
1699
|
-
|
|
1685
|
+
U(i) ? ((n = e.get(r)) == null ? void 0 : n.value) ?? i.emitter.get() : i
|
|
1700
1686
|
];
|
|
1701
1687
|
}));
|
|
1702
1688
|
}
|
|
1703
|
-
function
|
|
1704
|
-
if (
|
|
1705
|
-
const o =
|
|
1706
|
-
for (const
|
|
1707
|
-
|
|
1708
|
-
const u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(),
|
|
1709
|
-
let
|
|
1710
|
-
for (const
|
|
1711
|
-
const f =
|
|
1689
|
+
function ge(e, t, r, i, n = null, s = null) {
|
|
1690
|
+
if (e == null) throw new Error("Cannot patch a detached fragment range");
|
|
1691
|
+
const o = $t(r), a = /* @__PURE__ */ new Map(), l = [];
|
|
1692
|
+
for (const g of t)
|
|
1693
|
+
g.key == null ? l.push(g) : a.has(g.key) || a.set(g.key, g);
|
|
1694
|
+
const u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), p = [];
|
|
1695
|
+
let b = 0;
|
|
1696
|
+
for (const g of o) {
|
|
1697
|
+
const f = Q(g);
|
|
1712
1698
|
if (f != null) {
|
|
1713
1699
|
if (u.has(f)) throw new Error(`Duplicate sibling key: ${String(f)}`);
|
|
1714
1700
|
u.add(f);
|
|
1715
1701
|
}
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1718
|
-
}
|
|
1719
|
-
for (const
|
|
1720
|
-
d.has(
|
|
1721
|
-
let
|
|
1722
|
-
for (const
|
|
1723
|
-
for (const f of P(
|
|
1724
|
-
f ===
|
|
1725
|
-
return
|
|
1726
|
-
}
|
|
1727
|
-
function
|
|
1728
|
-
const r = Object.fromEntries(Object.entries(
|
|
1729
|
-
([s]) => s !== "children" &&
|
|
1730
|
-
)), i =
|
|
1702
|
+
const E = f == null ? l[b++] : a.get(f);
|
|
1703
|
+
E && jt(E, g) ? (d.add(E), p.push(xt(E, g, i))) : p.push(ie(g, i));
|
|
1704
|
+
}
|
|
1705
|
+
for (const g of t)
|
|
1706
|
+
d.has(g) || M(g, !0);
|
|
1707
|
+
let w = s ? s.nextSibling : e.firstChild;
|
|
1708
|
+
for (const g of p)
|
|
1709
|
+
for (const f of P(g))
|
|
1710
|
+
f === w ? w = w.nextSibling : (e.insertBefore(f, w ?? n), $(), w = f.nextSibling);
|
|
1711
|
+
return p;
|
|
1712
|
+
}
|
|
1713
|
+
function Ot(e, t) {
|
|
1714
|
+
const r = Object.fromEntries(Object.entries(t).filter(
|
|
1715
|
+
([s]) => s !== "children" && J(s) !== Qe
|
|
1716
|
+
)), i = e.props, n = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(r)]);
|
|
1731
1717
|
for (const s of ["value", "checked"])
|
|
1732
1718
|
if (Object.hasOwn(r, s) && Object.hasOwn(r, `bind:${s}`))
|
|
1733
1719
|
throw new Error(`${s} and bind:${s} cannot be used together`);
|
|
1734
1720
|
for (const s of n) {
|
|
1735
1721
|
const o = i[s], a = r[s];
|
|
1736
|
-
if (
|
|
1737
|
-
|
|
1722
|
+
if (Ur(s))
|
|
1723
|
+
Nr(e, s, a);
|
|
1738
1724
|
else if (s === "ref")
|
|
1739
|
-
o !== a &&
|
|
1740
|
-
else if (
|
|
1741
|
-
|
|
1742
|
-
else if (
|
|
1743
|
-
|
|
1725
|
+
o !== a && Ir(e, a);
|
|
1726
|
+
else if (Fr(s))
|
|
1727
|
+
Kr(e, s, a);
|
|
1728
|
+
else if (U(a))
|
|
1729
|
+
Pr(e, s, a);
|
|
1744
1730
|
else {
|
|
1745
|
-
const l =
|
|
1746
|
-
l && (l.unsubscribe(),
|
|
1731
|
+
const l = e.liveProps.get(s);
|
|
1732
|
+
l && (l.unsubscribe(), e.liveProps.delete(s));
|
|
1747
1733
|
const u = (l == null ? void 0 : l.value) ?? o;
|
|
1748
|
-
Object.is(u, a) ||
|
|
1734
|
+
Object.is(u, a) || q(e.node, s, u, a);
|
|
1749
1735
|
}
|
|
1750
1736
|
}
|
|
1751
|
-
|
|
1737
|
+
j(e.node, Qe, ""), e.props = { ...r };
|
|
1752
1738
|
}
|
|
1753
|
-
function
|
|
1754
|
-
const i =
|
|
1739
|
+
function Pr(e, t, r) {
|
|
1740
|
+
const i = e.liveProps.get(t);
|
|
1755
1741
|
if ((i == null ? void 0 : i.source) === r.emitter) return;
|
|
1756
1742
|
i == null || i.unsubscribe();
|
|
1757
1743
|
const n = r.emitter.get();
|
|
1758
|
-
|
|
1744
|
+
q(e.node, t, (i == null ? void 0 : i.value) ?? e.props[t], n);
|
|
1759
1745
|
const s = {
|
|
1760
1746
|
source: r.emitter,
|
|
1761
1747
|
value: n,
|
|
1762
1748
|
unsubscribe: () => {
|
|
1763
1749
|
}
|
|
1764
1750
|
};
|
|
1765
|
-
s.unsubscribe =
|
|
1751
|
+
s.unsubscribe = Se(r.emitter, s, e.owner, `${e.type}.${t}`, (o) => {
|
|
1766
1752
|
const a = s.value;
|
|
1767
|
-
s.value = o, Object.is(a, o) ||
|
|
1768
|
-
}),
|
|
1753
|
+
s.value = o, Object.is(a, o) || q(e.node, t, a, o);
|
|
1754
|
+
}), e.liveProps.set(t, s);
|
|
1769
1755
|
}
|
|
1770
|
-
function
|
|
1771
|
-
const i =
|
|
1756
|
+
function Nr(e, t, r) {
|
|
1757
|
+
const i = t.slice(5), n = e.nativeBindings.get(t);
|
|
1772
1758
|
if (r == null) {
|
|
1773
|
-
n && (n.unsubscribe(),
|
|
1759
|
+
n && (n.unsubscribe(), e.node.removeEventListener(n.eventName, n.listener), e.nativeBindings.delete(t), q(e.node, i, n.value, void 0));
|
|
1774
1760
|
return;
|
|
1775
1761
|
}
|
|
1776
|
-
if (
|
|
1777
|
-
n && (n.unsubscribe(),
|
|
1778
|
-
const s =
|
|
1779
|
-
|
|
1762
|
+
if (Hr(r, t), (n == null ? void 0 : n.source) === r) return;
|
|
1763
|
+
n && (n.unsubscribe(), e.node.removeEventListener(n.eventName, n.listener)), Vr(e.node, i);
|
|
1764
|
+
const s = Wr(e.node, i), o = r.get();
|
|
1765
|
+
q(e.node, i, n == null ? void 0 : n.value, o);
|
|
1780
1766
|
const a = (u) => {
|
|
1781
|
-
|
|
1782
|
-
Rt(
|
|
1783
|
-
|
|
1767
|
+
be(
|
|
1768
|
+
Rt(e, s),
|
|
1769
|
+
e.owner.diagnosticScope,
|
|
1784
1770
|
u,
|
|
1785
1771
|
a,
|
|
1786
|
-
`${
|
|
1787
|
-
() => r.set(Reflect.get(
|
|
1772
|
+
`${t} changed`,
|
|
1773
|
+
() => r.set(Reflect.get(e.node, i), `${t} changed`)
|
|
1788
1774
|
);
|
|
1789
1775
|
}, l = {
|
|
1790
1776
|
source: r,
|
|
@@ -1794,490 +1780,578 @@ function Dr(t, e, r) {
|
|
|
1794
1780
|
unsubscribe: () => {
|
|
1795
1781
|
}
|
|
1796
1782
|
};
|
|
1797
|
-
l.unsubscribe =
|
|
1783
|
+
l.unsubscribe = Se(r, l, e.owner, `${e.type}.${t}`, (u) => {
|
|
1798
1784
|
const d = l.value;
|
|
1799
|
-
l.value = u, Object.is(d, u) ||
|
|
1800
|
-
}),
|
|
1785
|
+
l.value = u, Object.is(d, u) || q(e.node, i, d, u);
|
|
1786
|
+
}), e.node.addEventListener(s, a), e.nativeBindings.set(t, l);
|
|
1801
1787
|
}
|
|
1802
|
-
function
|
|
1803
|
-
const i =
|
|
1804
|
-
if (n && s !== r && (
|
|
1805
|
-
throw new TypeError(`${
|
|
1788
|
+
function Kr(e, t, r) {
|
|
1789
|
+
const i = t.slice(2).toLowerCase(), n = e.listeners.get(t), s = n ? rt.get(n) ?? n : null;
|
|
1790
|
+
if (n && s !== r && (e.node.removeEventListener(i, n), e.listeners.delete(t)), r != null && typeof r != "function")
|
|
1791
|
+
throw new TypeError(`${t} must be a function or null`);
|
|
1806
1792
|
if (typeof r == "function" && s !== r) {
|
|
1807
|
-
const o = (a) =>
|
|
1808
|
-
Rt(
|
|
1809
|
-
|
|
1793
|
+
const o = (a) => be(
|
|
1794
|
+
Rt(e, i),
|
|
1795
|
+
e.owner.diagnosticScope,
|
|
1810
1796
|
a,
|
|
1811
1797
|
o,
|
|
1812
1798
|
i,
|
|
1813
|
-
() => r.call(
|
|
1799
|
+
() => r.call(e.node, a)
|
|
1814
1800
|
);
|
|
1815
|
-
|
|
1801
|
+
rt.set(o, r), e.node.addEventListener(i, o), e.listeners.set(t, o);
|
|
1816
1802
|
}
|
|
1817
1803
|
}
|
|
1818
|
-
const
|
|
1819
|
-
function
|
|
1820
|
-
return m.withScope(
|
|
1804
|
+
const tt = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), Ae = /* @__PURE__ */ new WeakMap();
|
|
1805
|
+
function be(e, t, r, i, n, s) {
|
|
1806
|
+
return m.withScope(t, () => {
|
|
1821
1807
|
if (!m.active) return s();
|
|
1822
1808
|
let o = Ae.get(r);
|
|
1823
|
-
return (!o || o.listeners.has(i)) && (o = { event: m.event(
|
|
1809
|
+
return (!o || o.listeners.has(i)) && (o = { event: m.event(e, "interaction", { cause: n, outcome: "started" }), listeners: /* @__PURE__ */ new Set() }, Ae.set(r, o), queueMicrotask(() => Ae.delete(r))), o.listeners.add(i), m.withEvent(o.event, s);
|
|
1824
1810
|
});
|
|
1825
1811
|
}
|
|
1826
|
-
function Rt(
|
|
1812
|
+
function Rt(e, t) {
|
|
1827
1813
|
var n;
|
|
1828
|
-
let r =
|
|
1829
|
-
r || (r = /* @__PURE__ */ new Map(),
|
|
1830
|
-
let i = r.get(
|
|
1814
|
+
let r = tt.get(e);
|
|
1815
|
+
r || (r = /* @__PURE__ */ new Map(), tt.set(e, r));
|
|
1816
|
+
let i = r.get(t);
|
|
1831
1817
|
if (!i) {
|
|
1832
1818
|
i = {};
|
|
1833
|
-
const s =
|
|
1819
|
+
const s = e.node.getAttribute("aria-label") ?? e.node.getAttribute("name") ?? ((n = e.node.textContent) == null ? void 0 : n.trim().slice(0, 80)) ?? "";
|
|
1834
1820
|
m.configure(i, {
|
|
1835
1821
|
kind: "interaction",
|
|
1836
|
-
label: `${
|
|
1837
|
-
scope:
|
|
1838
|
-
}), r.set(
|
|
1822
|
+
label: `${B(e.owner)}: ${e.type} ${s} ${t}`.trim(),
|
|
1823
|
+
scope: e.owner.diagnosticScope
|
|
1824
|
+
}), r.set(t, i);
|
|
1839
1825
|
}
|
|
1840
1826
|
return i;
|
|
1841
1827
|
}
|
|
1842
|
-
function
|
|
1843
|
-
m.configure(
|
|
1828
|
+
function Se(e, t, r, i, n) {
|
|
1829
|
+
m.configure(t, {
|
|
1844
1830
|
kind: "binding",
|
|
1845
|
-
label: `${
|
|
1831
|
+
label: `${B(r)}: ${i}`,
|
|
1846
1832
|
scope: r.diagnosticScope,
|
|
1847
|
-
sources: [
|
|
1833
|
+
sources: [e]
|
|
1848
1834
|
});
|
|
1849
|
-
const s =
|
|
1850
|
-
const l = m.event(
|
|
1835
|
+
const s = e.subscribe(({ value: o, event: a }) => {
|
|
1836
|
+
const l = m.event(t, "consumer", {
|
|
1851
1837
|
parent: a,
|
|
1852
1838
|
cause: "binding update",
|
|
1853
1839
|
value: o,
|
|
1854
1840
|
outcome: "started",
|
|
1855
1841
|
consumer: { trigger: "dependency" }
|
|
1856
|
-
}), u =
|
|
1857
|
-
|
|
1842
|
+
}), u = z, d = l ? { count: 0 } : null;
|
|
1843
|
+
z = d;
|
|
1858
1844
|
try {
|
|
1859
|
-
m.withEvent(l, () => n(o)), l && m.event(
|
|
1845
|
+
m.withEvent(l, () => n(o)), l && m.event(t, "consumer", {
|
|
1860
1846
|
parent: l,
|
|
1861
1847
|
cause: "binding updated",
|
|
1862
1848
|
value: o,
|
|
1863
1849
|
outcome: "succeeded",
|
|
1864
1850
|
consumer: { trigger: "dependency", domWrites: d.count }
|
|
1865
1851
|
});
|
|
1866
|
-
} catch (
|
|
1867
|
-
throw l && m.event(
|
|
1852
|
+
} catch (p) {
|
|
1853
|
+
throw l && m.event(t, "consumer", {
|
|
1868
1854
|
parent: l,
|
|
1869
1855
|
cause: "binding update failed",
|
|
1870
1856
|
outcome: "failed",
|
|
1871
|
-
error:
|
|
1857
|
+
error: p,
|
|
1872
1858
|
consumer: { trigger: "dependency", domWrites: d.count }
|
|
1873
|
-
}),
|
|
1859
|
+
}), p;
|
|
1874
1860
|
} finally {
|
|
1875
|
-
|
|
1861
|
+
z = u;
|
|
1876
1862
|
}
|
|
1877
|
-
}, { emitCurrent: !1, diagnosticTarget:
|
|
1863
|
+
}, { emitCurrent: !1, diagnosticTarget: t });
|
|
1878
1864
|
return () => {
|
|
1879
|
-
s(), m.dispose(
|
|
1865
|
+
s(), m.dispose(t);
|
|
1880
1866
|
};
|
|
1881
1867
|
}
|
|
1882
|
-
function
|
|
1883
|
-
return
|
|
1868
|
+
function B(e) {
|
|
1869
|
+
return e.diagnosticLabel;
|
|
1884
1870
|
}
|
|
1885
|
-
function
|
|
1886
|
-
if (
|
|
1871
|
+
function Ir(e, t) {
|
|
1872
|
+
if (Pe(e.ref, null), t != null && typeof t != "function" && typeof t != "object")
|
|
1887
1873
|
throw new TypeError("ref must be a function, object, or null");
|
|
1888
|
-
|
|
1874
|
+
e.ref = t, Pe(e.ref, e.node);
|
|
1889
1875
|
}
|
|
1890
|
-
function
|
|
1891
|
-
if (
|
|
1892
|
-
|
|
1876
|
+
function q(e, t, r, i) {
|
|
1877
|
+
if (t === "class" || t === "className") {
|
|
1878
|
+
j(e, "class", i);
|
|
1893
1879
|
return;
|
|
1894
1880
|
}
|
|
1895
|
-
if (
|
|
1896
|
-
|
|
1881
|
+
if (t === "for" || t === "htmlFor") {
|
|
1882
|
+
j(e, "for", i);
|
|
1897
1883
|
return;
|
|
1898
1884
|
}
|
|
1899
|
-
if (
|
|
1900
|
-
|
|
1885
|
+
if (t === "dataset") {
|
|
1886
|
+
_r(e, r, i);
|
|
1901
1887
|
return;
|
|
1902
1888
|
}
|
|
1903
|
-
if (
|
|
1904
|
-
|
|
1889
|
+
if (t === "style") {
|
|
1890
|
+
Br(e, r, i);
|
|
1905
1891
|
return;
|
|
1906
1892
|
}
|
|
1907
|
-
if (
|
|
1893
|
+
if (t === "dangerouslySetInnerHTML")
|
|
1908
1894
|
throw new Error("dangerouslySetInnerHTML is not supported");
|
|
1909
|
-
const n =
|
|
1910
|
-
if (
|
|
1895
|
+
const n = qr(t);
|
|
1896
|
+
if (Rr.has(n)) {
|
|
1911
1897
|
const s = !!i;
|
|
1912
|
-
n in
|
|
1898
|
+
n in e && Reflect.get(e, n) !== s && (Reflect.set(e, n, s), $()), j(e, J(t), s);
|
|
1913
1899
|
return;
|
|
1914
1900
|
}
|
|
1915
|
-
if (n === "value" &&
|
|
1916
|
-
|
|
1901
|
+
if (n === "value" && e.localName === "option") {
|
|
1902
|
+
j(e, J(t), i);
|
|
1917
1903
|
return;
|
|
1918
1904
|
}
|
|
1919
|
-
if (
|
|
1905
|
+
if (Ar.has(n) && n in e) {
|
|
1920
1906
|
const s = i ?? (n === "value" ? "" : !1);
|
|
1921
|
-
Object.is(Reflect.get(
|
|
1907
|
+
Object.is(Reflect.get(e, n), s) || (Reflect.set(e, n, s), $()), i == null && j(e, J(t), null);
|
|
1922
1908
|
return;
|
|
1923
1909
|
}
|
|
1924
|
-
|
|
1910
|
+
j(e, J(t), i);
|
|
1925
1911
|
}
|
|
1926
|
-
function
|
|
1927
|
-
const i =
|
|
1912
|
+
function _r(e, t, r) {
|
|
1913
|
+
const i = we(t, "dataset"), n = we(r, "dataset");
|
|
1928
1914
|
for (const s of /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)])) {
|
|
1929
1915
|
const o = n[s];
|
|
1930
|
-
|
|
1916
|
+
e.dataset[s] !== (o == null ? void 0 : String(o)) && (o == null ? delete e.dataset[s] : e.dataset[s] = String(o), $());
|
|
1931
1917
|
}
|
|
1932
1918
|
}
|
|
1933
|
-
function
|
|
1919
|
+
function Br(e, t, r) {
|
|
1934
1920
|
if (typeof r == "string") {
|
|
1935
|
-
|
|
1921
|
+
e.style.cssText !== r && (e.style.cssText = r, $());
|
|
1936
1922
|
return;
|
|
1937
1923
|
}
|
|
1938
|
-
const i = typeof
|
|
1939
|
-
typeof
|
|
1924
|
+
const i = typeof t == "string" ? {} : we(t, "style"), n = we(r, "style");
|
|
1925
|
+
typeof t == "string" && e.style.cssText !== "" && (e.style.cssText = "", $());
|
|
1940
1926
|
for (const s of /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)])) {
|
|
1941
1927
|
const o = n[s];
|
|
1942
1928
|
if (s.startsWith("--")) {
|
|
1943
|
-
if (
|
|
1944
|
-
o == null ?
|
|
1929
|
+
if (e.style.getPropertyValue(s) === (o == null ? "" : String(o))) continue;
|
|
1930
|
+
o == null ? e.style.removeProperty(s) : e.style.setProperty(s, String(o));
|
|
1945
1931
|
} else {
|
|
1946
|
-
if (Reflect.get(
|
|
1947
|
-
Reflect.set(
|
|
1932
|
+
if (Reflect.get(e.style, s) === (o == null ? "" : String(o))) continue;
|
|
1933
|
+
Reflect.set(e.style, s, o == null ? "" : String(o));
|
|
1948
1934
|
}
|
|
1949
|
-
|
|
1935
|
+
$();
|
|
1950
1936
|
}
|
|
1951
1937
|
}
|
|
1952
|
-
function
|
|
1953
|
-
if (
|
|
1954
|
-
if (typeof
|
|
1955
|
-
throw new TypeError(`${
|
|
1956
|
-
return
|
|
1938
|
+
function we(e, t) {
|
|
1939
|
+
if (e == null) return {};
|
|
1940
|
+
if (typeof e != "object" || Array.isArray(e))
|
|
1941
|
+
throw new TypeError(`${t} must be an object or null`);
|
|
1942
|
+
return e;
|
|
1957
1943
|
}
|
|
1958
|
-
function
|
|
1944
|
+
function j(e, t, r) {
|
|
1959
1945
|
const i = r == null || r === !1 ? null : r === !0 ? "" : String(r);
|
|
1960
|
-
|
|
1946
|
+
e.getAttribute(t) !== i && (i === null ? e.removeAttribute(t) : e.setAttribute(t, i), $());
|
|
1961
1947
|
}
|
|
1962
|
-
function
|
|
1963
|
-
return
|
|
1948
|
+
function qr(e) {
|
|
1949
|
+
return e === "readonly" ? "readOnly" : e === "autofocus" ? "autoFocus" : e;
|
|
1964
1950
|
}
|
|
1965
|
-
function
|
|
1966
|
-
return
|
|
1951
|
+
function J(e) {
|
|
1952
|
+
return e === "className" ? "class" : e === "htmlFor" ? "for" : e === "minLength" ? "minlength" : e === "maxLength" ? "maxlength" : e === "autoComplete" ? "autocomplete" : e === "inputMode" ? "inputmode" : /^aria[A-Z]/.test(e) || /^data[A-Z]/.test(e) ? it(e) : e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
1967
1953
|
}
|
|
1968
|
-
function
|
|
1969
|
-
return
|
|
1954
|
+
function it(e) {
|
|
1955
|
+
return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
1970
1956
|
}
|
|
1971
|
-
function
|
|
1972
|
-
|
|
1957
|
+
function Pe(e, t) {
|
|
1958
|
+
e != null && (typeof e == "function" ? e(t) : e.current = t);
|
|
1973
1959
|
}
|
|
1974
|
-
function M(
|
|
1975
|
-
if (
|
|
1976
|
-
if (
|
|
1977
|
-
for (const r of P(
|
|
1960
|
+
function M(e, t) {
|
|
1961
|
+
if (e.kind === "emitter") {
|
|
1962
|
+
if (e.unsubscribe(), M(e.child, !1), t)
|
|
1963
|
+
for (const r of P(e)) ce(r);
|
|
1978
1964
|
return;
|
|
1979
1965
|
}
|
|
1980
|
-
if (
|
|
1981
|
-
for (const r of
|
|
1982
|
-
|
|
1966
|
+
if (e.kind === "component") {
|
|
1967
|
+
for (const r of e.liveProps.values()) r.unsubscribe();
|
|
1968
|
+
e.liveProps.clear(), e.owner._childComponents.delete(e.instance), e.instance.destroy();
|
|
1983
1969
|
return;
|
|
1984
1970
|
}
|
|
1985
|
-
if (
|
|
1986
|
-
for (const r of
|
|
1987
|
-
|
|
1971
|
+
if (e.kind === "function") {
|
|
1972
|
+
for (const r of e.liveProps.values()) r.unsubscribe();
|
|
1973
|
+
e.liveProps.clear(), e.diagnosticSubject && m.dispose(e.diagnosticSubject), M(e.child, t);
|
|
1988
1974
|
return;
|
|
1989
1975
|
}
|
|
1990
|
-
if (
|
|
1991
|
-
|
|
1992
|
-
for (const [r, i] of
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
for (const r of
|
|
1996
|
-
|
|
1997
|
-
for (const r of
|
|
1998
|
-
r.unsubscribe(),
|
|
1999
|
-
|
|
2000
|
-
for (const r of
|
|
2001
|
-
|
|
1976
|
+
if (e.kind === "element") {
|
|
1977
|
+
Pe(e.ref, null);
|
|
1978
|
+
for (const [r, i] of e.listeners)
|
|
1979
|
+
e.node.removeEventListener(r.slice(2).toLowerCase(), i);
|
|
1980
|
+
e.listeners.clear();
|
|
1981
|
+
for (const r of e.liveProps.values()) r.unsubscribe();
|
|
1982
|
+
e.liveProps.clear();
|
|
1983
|
+
for (const r of e.nativeBindings.values())
|
|
1984
|
+
r.unsubscribe(), e.node.removeEventListener(r.eventName, r.listener);
|
|
1985
|
+
e.nativeBindings.clear();
|
|
1986
|
+
for (const r of e.children) M(r, !1);
|
|
1987
|
+
t && ce(e.node);
|
|
2002
1988
|
return;
|
|
2003
1989
|
}
|
|
2004
|
-
if (
|
|
2005
|
-
for (const r of
|
|
2006
|
-
if (
|
|
2007
|
-
for (const r of P(
|
|
1990
|
+
if (e.kind === "fragment") {
|
|
1991
|
+
for (const r of e.children) M(r, !1);
|
|
1992
|
+
if (t)
|
|
1993
|
+
for (const r of P(e)) ce(r);
|
|
2008
1994
|
return;
|
|
2009
1995
|
}
|
|
2010
|
-
|
|
1996
|
+
t && ce(e.node);
|
|
2011
1997
|
}
|
|
2012
|
-
function
|
|
2013
|
-
|
|
1998
|
+
function ce(e) {
|
|
1999
|
+
e.parentNode && (e.remove(), $());
|
|
2014
2000
|
}
|
|
2015
|
-
function
|
|
2016
|
-
if (
|
|
2017
|
-
for (const i of P(
|
|
2018
|
-
i.parentNode ===
|
|
2001
|
+
function qe(e, t, r = null) {
|
|
2002
|
+
if (t != null)
|
|
2003
|
+
for (const i of P(t))
|
|
2004
|
+
i.parentNode === e && i.nextSibling === r || (e.insertBefore(i, r), $());
|
|
2019
2005
|
}
|
|
2020
|
-
function P(
|
|
2021
|
-
if (
|
|
2022
|
-
if (
|
|
2023
|
-
if (
|
|
2024
|
-
if (
|
|
2025
|
-
const
|
|
2026
|
-
let r =
|
|
2027
|
-
for (; r && (
|
|
2006
|
+
function P(e) {
|
|
2007
|
+
if (e == null) return [];
|
|
2008
|
+
if (e.kind === "text" || e.kind === "element") return [e.node];
|
|
2009
|
+
if (e.kind === "component") return P(e.instance._rendered);
|
|
2010
|
+
if (e.kind === "function") return P(e.child);
|
|
2011
|
+
const t = [];
|
|
2012
|
+
let r = e.start;
|
|
2013
|
+
for (; r && (t.push(r), r !== e.end); )
|
|
2028
2014
|
r = r.nextSibling;
|
|
2029
|
-
return
|
|
2015
|
+
return t;
|
|
2030
2016
|
}
|
|
2031
|
-
function At(
|
|
2032
|
-
return P(
|
|
2017
|
+
function At(e) {
|
|
2018
|
+
return P(e)[0] ?? null;
|
|
2033
2019
|
}
|
|
2034
|
-
function
|
|
2035
|
-
return
|
|
2020
|
+
function Q(e) {
|
|
2021
|
+
return e instanceof O ? Lt(e.props) : A(e) ? e.key : null;
|
|
2036
2022
|
}
|
|
2037
|
-
function
|
|
2038
|
-
const
|
|
2039
|
-
return typeof
|
|
2023
|
+
function Lt(e) {
|
|
2024
|
+
const t = e.key;
|
|
2025
|
+
return typeof t == "string" || typeof t == "number" ? t : null;
|
|
2040
2026
|
}
|
|
2041
|
-
function jt(
|
|
2042
|
-
return
|
|
2027
|
+
function jt(e, t) {
|
|
2028
|
+
return e.kind === "text" ? typeof t == "string" || typeof t == "number" : e.kind === "emitter" ? Ee(t) && e.source === t : e.kind === "component" ? t instanceof O ? e.instance === t : A(t) && Mt(t.type) && e.type === t.type && e.key === Q(t) : e.kind === "function" ? A(t) && e.type === t.type && e.key === Q(t) : e.kind === "fragment" ? A(t) && t.type === re && e.key === Q(t) : A(t) && typeof t.type == "string" && e.type === t.type && e.key === Q(t);
|
|
2043
2029
|
}
|
|
2044
|
-
function
|
|
2045
|
-
return
|
|
2030
|
+
function A(e) {
|
|
2031
|
+
return e != null && typeof e == "object" && Object.hasOwn(e, "type");
|
|
2046
2032
|
}
|
|
2047
|
-
function
|
|
2048
|
-
return typeof
|
|
2033
|
+
function Mt(e) {
|
|
2034
|
+
return typeof e == "function" && (e === O || e.prototype instanceof O);
|
|
2049
2035
|
}
|
|
2050
|
-
function
|
|
2051
|
-
return /^on[A-Z]/.test(
|
|
2036
|
+
function Fr(e) {
|
|
2037
|
+
return /^on[A-Z]/.test(e);
|
|
2052
2038
|
}
|
|
2053
|
-
function
|
|
2054
|
-
return
|
|
2039
|
+
function Ur(e) {
|
|
2040
|
+
return e === "bind:value" || e === "bind:checked";
|
|
2055
2041
|
}
|
|
2056
|
-
function
|
|
2057
|
-
return
|
|
2042
|
+
function U(e) {
|
|
2043
|
+
return e != null && typeof e == "object" && Or.has(e);
|
|
2058
2044
|
}
|
|
2059
|
-
function
|
|
2060
|
-
return (typeof
|
|
2045
|
+
function Ee(e) {
|
|
2046
|
+
return (typeof e != "object" || e == null) && typeof e != "function" ? !1 : typeof Reflect.get(e, "get") == "function" && typeof Reflect.get(e, "getFetchState") == "function" && typeof Reflect.get(e, "getError") == "function" && typeof Reflect.get(e, "subscribe") == "function";
|
|
2061
2047
|
}
|
|
2062
|
-
function
|
|
2063
|
-
if (!
|
|
2048
|
+
function Dt(e, t) {
|
|
2049
|
+
if (!Ee(e)) throw new TypeError(`${t} requires a readable emitter`);
|
|
2064
2050
|
}
|
|
2065
|
-
function
|
|
2066
|
-
if (
|
|
2067
|
-
throw new TypeError(`${
|
|
2051
|
+
function Hr(e, t) {
|
|
2052
|
+
if (Dt(e, t), typeof Reflect.get(e, "set") != "function")
|
|
2053
|
+
throw new TypeError(`${t} requires a writable emitter`);
|
|
2068
2054
|
}
|
|
2069
|
-
function
|
|
2070
|
-
const r =
|
|
2071
|
-
if (!(
|
|
2055
|
+
function Vr(e, t) {
|
|
2056
|
+
const r = e.localName;
|
|
2057
|
+
if (!(t === "checked" ? r === "input" : r === "input" || r === "textarea" || r === "select")) throw new TypeError(`bind:${t} is not supported on ${r}`);
|
|
2072
2058
|
}
|
|
2073
|
-
function
|
|
2074
|
-
return
|
|
2059
|
+
function Wr(e, t) {
|
|
2060
|
+
return t === "value" && e.localName !== "select" ? "input" : "change";
|
|
2075
2061
|
}
|
|
2076
|
-
function
|
|
2077
|
-
if (
|
|
2062
|
+
function Yr(e) {
|
|
2063
|
+
if (e == null || typeof e != "object" && typeof e != "function" || typeof Reflect.get(e, "insertBefore") != "function")
|
|
2078
2064
|
throw new TypeError("Component parent must be a DOM ParentNode");
|
|
2079
2065
|
}
|
|
2080
|
-
function
|
|
2066
|
+
function nt(e) {
|
|
2081
2067
|
try {
|
|
2082
|
-
return String(
|
|
2068
|
+
return String(e);
|
|
2083
2069
|
} catch {
|
|
2084
|
-
return Object.prototype.toString.call(
|
|
2070
|
+
return Object.prototype.toString.call(e);
|
|
2085
2071
|
}
|
|
2086
2072
|
}
|
|
2087
|
-
function
|
|
2088
|
-
const
|
|
2089
|
-
let r =
|
|
2090
|
-
for (; r != null && typeof r == "function" && (
|
|
2073
|
+
function Gr(e) {
|
|
2074
|
+
const t = [];
|
|
2075
|
+
let r = e;
|
|
2076
|
+
for (; r != null && typeof r == "function" && (t.unshift(r), r !== O); )
|
|
2091
2077
|
r = Object.getPrototypeOf(r);
|
|
2092
|
-
return
|
|
2078
|
+
return t;
|
|
2093
2079
|
}
|
|
2094
|
-
function
|
|
2095
|
-
return [...new Set(
|
|
2080
|
+
function Xr(...e) {
|
|
2081
|
+
return [...new Set(e.flatMap((t) => typeof t == "string" ? t.split(/\s+/) : []).filter(Boolean))].join(" ");
|
|
2096
2082
|
}
|
|
2097
|
-
function
|
|
2098
|
-
if (
|
|
2099
|
-
const
|
|
2100
|
-
return typeof
|
|
2083
|
+
function Le(e) {
|
|
2084
|
+
if (e.island === !0) return !0;
|
|
2085
|
+
const t = e.className ?? e.class;
|
|
2086
|
+
return typeof t == "string" && t.split(/\s+/).includes("island");
|
|
2101
2087
|
}
|
|
2102
|
-
function
|
|
2103
|
-
const i =
|
|
2104
|
-
return r !== void 0 && (i.key = r),
|
|
2088
|
+
function h(e, t, r) {
|
|
2089
|
+
const i = t == null ? {} : { ...t };
|
|
2090
|
+
return r !== void 0 && (i.key = r), ye(e, i);
|
|
2105
2091
|
}
|
|
2106
|
-
const
|
|
2092
|
+
const y = h, Zr = [
|
|
2107
2093
|
"var(--colored-dark)",
|
|
2108
2094
|
"var(--colored-base)",
|
|
2109
2095
|
"var(--colored-light)"
|
|
2110
2096
|
];
|
|
2111
|
-
class
|
|
2097
|
+
class X extends Ne {
|
|
2098
|
+
constructor() {
|
|
2099
|
+
super(...arguments);
|
|
2100
|
+
c(this, "labelResizeObserver", null);
|
|
2101
|
+
c(this, "measuredLabelOrientations", /* @__PURE__ */ new Map());
|
|
2102
|
+
}
|
|
2112
2103
|
render() {
|
|
2113
|
-
var
|
|
2104
|
+
var f;
|
|
2114
2105
|
const {
|
|
2115
|
-
model:
|
|
2116
|
-
label:
|
|
2117
|
-
description:
|
|
2118
|
-
emptyMessage:
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2106
|
+
model: r,
|
|
2107
|
+
label: i = "Block graph",
|
|
2108
|
+
description: n = "Area is proportional to item count.",
|
|
2109
|
+
emptyMessage: s = "No items are available.",
|
|
2110
|
+
labelOrientation: o = "auto"
|
|
2111
|
+
} = this.props;
|
|
2112
|
+
st(o);
|
|
2113
|
+
const a = this.snapshot(r.layout$), l = a.fetchState === S.Initial || a.fetchState === S.Loading, u = this.read(r.selectedPath$), d = a.value, p = _(d.root, u), b = d.root.children.length === 0 ? [d.root] : d.root.children, w = (f = b[0]) == null ? void 0 : f.key, g = this.Host;
|
|
2114
|
+
return /* @__PURE__ */ y(
|
|
2115
|
+
g,
|
|
2122
2116
|
{
|
|
2123
2117
|
className: (this.props.className ?? this.props.class ?? "") || null,
|
|
2124
|
-
"aria-label":
|
|
2125
|
-
"aria-busy":
|
|
2118
|
+
"aria-label": i,
|
|
2119
|
+
"aria-busy": l ? "true" : null,
|
|
2126
2120
|
children: [
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
2129
|
-
/* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
|
|
2121
|
+
/* @__PURE__ */ y("header", { children: [
|
|
2122
|
+
/* @__PURE__ */ y("cap-summary", { children: [
|
|
2123
|
+
/* @__PURE__ */ h("h2", { children: i }),
|
|
2124
|
+
/* @__PURE__ */ y("p", { children: [
|
|
2125
|
+
n,
|
|
2132
2126
|
" ",
|
|
2133
|
-
|
|
2127
|
+
l ? null : `${d.root.count} items.`
|
|
2134
2128
|
] }),
|
|
2135
|
-
|
|
2136
|
-
/* @__PURE__ */
|
|
2129
|
+
l ? /* @__PURE__ */ h(Ce, { width: 45 }) : /* @__PURE__ */ y("output", { children: [
|
|
2130
|
+
/* @__PURE__ */ h("strong", { children: "Selection:" }),
|
|
2137
2131
|
" ",
|
|
2138
|
-
|
|
2139
|
-
var
|
|
2140
|
-
const
|
|
2141
|
-
return ((
|
|
2132
|
+
p == null ? "None" : p.path.length === 0 ? p.label : p.path.map((E, T) => {
|
|
2133
|
+
var W;
|
|
2134
|
+
const N = p.path.slice(0, T + 1);
|
|
2135
|
+
return ((W = _(d.root, N)) == null ? void 0 : W.label) ?? E.categoryKey;
|
|
2142
2136
|
}).join(" → ")
|
|
2143
2137
|
] })
|
|
2144
2138
|
] }),
|
|
2145
|
-
/* @__PURE__ */
|
|
2146
|
-
|
|
2139
|
+
/* @__PURE__ */ h(
|
|
2140
|
+
fe,
|
|
2147
2141
|
{
|
|
2148
2142
|
label: "Clear selection",
|
|
2149
|
-
disabled:
|
|
2150
|
-
onClick: () =>
|
|
2143
|
+
disabled: l || u == null,
|
|
2144
|
+
onClick: () => r.clear()
|
|
2151
2145
|
}
|
|
2152
2146
|
)
|
|
2153
2147
|
] }),
|
|
2154
|
-
|
|
2155
|
-
/* @__PURE__ */
|
|
2156
|
-
/* @__PURE__ */
|
|
2157
|
-
] }) :
|
|
2148
|
+
a.fetchState === S.Error ? /* @__PURE__ */ h("p", { role: "alert", children: "The block graph could not be calculated." }) : l ? /* @__PURE__ */ y(re, { children: [
|
|
2149
|
+
/* @__PURE__ */ h("p", { role: "status", "aria-live": "polite", children: "Loading block graph…" }),
|
|
2150
|
+
/* @__PURE__ */ h("cap-blockskeleton", { "aria-hidden": "true", children: [0, 1, 2].map((E) => /* @__PURE__ */ h("cap-blockskeletoncolumn", { children: [0, 1].map((T) => /* @__PURE__ */ h(Ce, { width: 100 }, T)) }, E)) })
|
|
2151
|
+
] }) : d.valid ? d.root.count === 0 ? /* @__PURE__ */ h("p", { role: "status", children: s }) : /* @__PURE__ */ h(
|
|
2158
2152
|
"cap-scroller",
|
|
2159
2153
|
{
|
|
2160
2154
|
tabIndex: 0,
|
|
2161
|
-
"aria-label": `Scrollable ${
|
|
2162
|
-
children: /* @__PURE__ */
|
|
2155
|
+
"aria-label": `Scrollable ${i}`,
|
|
2156
|
+
children: /* @__PURE__ */ h(
|
|
2163
2157
|
"cap-blocks",
|
|
2164
2158
|
{
|
|
2165
2159
|
role: "tree",
|
|
2166
|
-
"aria-label":
|
|
2167
|
-
className:
|
|
2168
|
-
onClick: (
|
|
2169
|
-
|
|
2160
|
+
"aria-label": i,
|
|
2161
|
+
className: d.root.childOrientation,
|
|
2162
|
+
onClick: (E) => {
|
|
2163
|
+
E.target === E.currentTarget && r.clear();
|
|
2170
2164
|
},
|
|
2171
|
-
children:
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
(
|
|
2165
|
+
children: b.map((E) => this.renderBlock(
|
|
2166
|
+
E,
|
|
2167
|
+
u,
|
|
2168
|
+
(p == null ? void 0 : p.key) ?? w ?? null
|
|
2175
2169
|
))
|
|
2176
2170
|
}
|
|
2177
2171
|
)
|
|
2178
2172
|
}
|
|
2179
|
-
) : this.renderPartitionError(
|
|
2173
|
+
) : this.renderPartitionError(d.issues)
|
|
2180
2174
|
]
|
|
2181
2175
|
}
|
|
2182
2176
|
);
|
|
2183
2177
|
}
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2178
|
+
afterMount() {
|
|
2179
|
+
this.reconcileLabelOrientation();
|
|
2180
|
+
}
|
|
2181
|
+
afterUpdate() {
|
|
2182
|
+
this.reconcileLabelOrientation();
|
|
2183
|
+
}
|
|
2184
|
+
onDestroy() {
|
|
2185
|
+
var r;
|
|
2186
|
+
(r = this.labelResizeObserver) == null || r.disconnect(), this.labelResizeObserver = null, this.measuredLabelOrientations.clear();
|
|
2187
|
+
}
|
|
2188
|
+
renderBlock(r, i, n) {
|
|
2189
|
+
const s = Jr(r.path, i), o = r.colors, a = ut(o ?? Zr);
|
|
2190
|
+
return /* @__PURE__ */ y(
|
|
2187
2191
|
"article",
|
|
2188
2192
|
{
|
|
2189
2193
|
role: "treeitem",
|
|
2190
2194
|
className: "colored",
|
|
2191
|
-
tabIndex:
|
|
2192
|
-
"aria-level": Math.max(1,
|
|
2193
|
-
"aria-selected":
|
|
2194
|
-
"aria-label": `${
|
|
2195
|
-
"data-block-key":
|
|
2196
|
-
onClick: (
|
|
2197
|
-
|
|
2195
|
+
tabIndex: s || i == null && r.key === n ? 0 : -1,
|
|
2196
|
+
"aria-level": Math.max(1, r.depth + 1),
|
|
2197
|
+
"aria-selected": s ? "true" : "false",
|
|
2198
|
+
"aria-label": `${r.criterionLabel ?? "Items"}: ${r.label}, ${r.count} ${r.count === 1 ? "item" : "items"}`,
|
|
2199
|
+
"data-block-key": r.key,
|
|
2200
|
+
onClick: (l) => {
|
|
2201
|
+
l.target.closest('[role="treeitem"]') === l.currentTarget && this.props.model.select(r.path);
|
|
2198
2202
|
},
|
|
2199
|
-
onKeyDown: (
|
|
2203
|
+
onKeyDown: (l) => this.blockKeyDown(l, r),
|
|
2200
2204
|
style: {
|
|
2201
|
-
flexGrow:
|
|
2202
|
-
...
|
|
2203
|
-
...
|
|
2204
|
-
borderColor:
|
|
2205
|
+
flexGrow: r.count,
|
|
2206
|
+
...a,
|
|
2207
|
+
...o == null ? {} : {
|
|
2208
|
+
borderColor: o[0]
|
|
2205
2209
|
}
|
|
2206
2210
|
},
|
|
2207
2211
|
children: [
|
|
2208
|
-
/* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
":"
|
|
2213
|
-
] }),
|
|
2214
|
-
/* @__PURE__ */ p("strong", { children: e.label })
|
|
2212
|
+
/* @__PURE__ */ h("cap-blocklabel", { children: /* @__PURE__ */ y("cap-blockname", { children: [
|
|
2213
|
+
/* @__PURE__ */ y("small", { children: [
|
|
2214
|
+
r.criterionLabel ?? "Items",
|
|
2215
|
+
":"
|
|
2215
2216
|
] }),
|
|
2216
|
-
/* @__PURE__ */
|
|
2217
|
-
|
|
2218
|
-
|
|
2217
|
+
/* @__PURE__ */ h("strong", { children: r.label }),
|
|
2218
|
+
/* @__PURE__ */ y("data", { value: String(r.count), children: [
|
|
2219
|
+
"(",
|
|
2220
|
+
r.count,
|
|
2221
|
+
")"
|
|
2222
|
+
] })
|
|
2223
|
+
] }) }),
|
|
2224
|
+
r.children.length === 0 ? null : /* @__PURE__ */ h(
|
|
2219
2225
|
"cap-blockgroup",
|
|
2220
2226
|
{
|
|
2221
2227
|
role: "group",
|
|
2222
|
-
className:
|
|
2223
|
-
children:
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2228
|
+
className: r.childOrientation,
|
|
2229
|
+
children: r.children.map((l) => this.renderBlock(
|
|
2230
|
+
l,
|
|
2231
|
+
i,
|
|
2232
|
+
n
|
|
2227
2233
|
))
|
|
2228
2234
|
}
|
|
2229
2235
|
)
|
|
2230
2236
|
]
|
|
2231
2237
|
},
|
|
2232
|
-
|
|
2238
|
+
r.key
|
|
2233
2239
|
);
|
|
2234
2240
|
}
|
|
2235
|
-
renderPartitionError(
|
|
2236
|
-
const
|
|
2237
|
-
return /* @__PURE__ */
|
|
2238
|
-
/* @__PURE__ */
|
|
2239
|
-
/* @__PURE__ */
|
|
2240
|
-
|
|
2241
|
+
renderPartitionError(r) {
|
|
2242
|
+
const i = r[0], n = i == null ? "The selected criteria do not form a complete partition." : i.kind === "unmatched" ? `${i.criterionLabel} has an item with no category.` : `${i.criterionLabel} has an item matching multiple categories.`;
|
|
2243
|
+
return /* @__PURE__ */ y("div", { role: "alert", children: [
|
|
2244
|
+
/* @__PURE__ */ h("strong", { children: "Invalid block partition" }),
|
|
2245
|
+
/* @__PURE__ */ y("p", { children: [
|
|
2246
|
+
n,
|
|
2241
2247
|
" ",
|
|
2242
|
-
|
|
2248
|
+
r.length,
|
|
2243
2249
|
" partition issue",
|
|
2244
|
-
|
|
2250
|
+
r.length === 1 ? "" : "s",
|
|
2245
2251
|
" detected."
|
|
2246
2252
|
] })
|
|
2247
2253
|
] });
|
|
2248
2254
|
}
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2255
|
+
reconcileLabelOrientation() {
|
|
2256
|
+
var s;
|
|
2257
|
+
if ((s = this.labelResizeObserver) == null || s.disconnect(), this.labelResizeObserver = null, !(this.dom instanceof Element)) return;
|
|
2258
|
+
const r = this.props.labelOrientation ?? "auto";
|
|
2259
|
+
st(r);
|
|
2260
|
+
const i = [...this.dom.querySelectorAll('[role="treeitem"]')], n = new Set(i.map((o) => o.dataset.blockKey).filter(
|
|
2261
|
+
(o) => o != null
|
|
2262
|
+
));
|
|
2263
|
+
for (const o of this.measuredLabelOrientations.keys())
|
|
2264
|
+
n.has(o) || this.measuredLabelOrientations.delete(o);
|
|
2265
|
+
if (r !== "auto") {
|
|
2266
|
+
for (const o of i) this.setLabelOrientation(o, r);
|
|
2252
2267
|
return;
|
|
2253
2268
|
}
|
|
2254
|
-
|
|
2255
|
-
|
|
2269
|
+
for (const o of i)
|
|
2270
|
+
this.setLabelOrientation(
|
|
2271
|
+
o,
|
|
2272
|
+
this.measuredLabelOrientations.get(o.dataset.blockKey ?? "") ?? "horizontal"
|
|
2273
|
+
);
|
|
2274
|
+
if (typeof globalThis.ResizeObserver == "function") {
|
|
2275
|
+
this.labelResizeObserver = new ResizeObserver((o) => {
|
|
2276
|
+
for (const a of o) {
|
|
2277
|
+
const l = a.target;
|
|
2278
|
+
if (!(l instanceof HTMLElement)) continue;
|
|
2279
|
+
const u = l.dataset.blockKey;
|
|
2280
|
+
if (u == null) continue;
|
|
2281
|
+
const d = this.resolveAutoLabelOrientation(l, a.contentRect);
|
|
2282
|
+
this.measuredLabelOrientations.set(u, d), this.setLabelOrientation(l, d);
|
|
2283
|
+
}
|
|
2284
|
+
});
|
|
2285
|
+
for (const o of i) this.labelResizeObserver.observe(o);
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
setLabelOrientation(r, i) {
|
|
2289
|
+
var n;
|
|
2290
|
+
(n = r.querySelector("cap-blocklabel")) == null || n.setAttribute("data-label-orientation", i);
|
|
2291
|
+
}
|
|
2292
|
+
resolveAutoLabelOrientation(r, i) {
|
|
2293
|
+
this.setLabelOrientation(r, "horizontal");
|
|
2294
|
+
const n = this.measureHorizontalLabelWidth(r);
|
|
2295
|
+
return n > 0 && i.width >= n ? "horizontal" : i.height > i.width ? "vertical" : "horizontal";
|
|
2296
|
+
}
|
|
2297
|
+
measureHorizontalLabelWidth(r) {
|
|
2298
|
+
var l;
|
|
2299
|
+
const i = r.querySelector("cap-blocklabel"), n = (l = r.ownerDocument) == null ? void 0 : l.body;
|
|
2300
|
+
if (i == null || n == null) return 0;
|
|
2301
|
+
const s = i.cloneNode(!0);
|
|
2302
|
+
s.style.cssText = [
|
|
2303
|
+
"position:fixed",
|
|
2304
|
+
"visibility:hidden",
|
|
2305
|
+
"pointer-events:none",
|
|
2306
|
+
"inset:auto",
|
|
2307
|
+
"display:flex",
|
|
2308
|
+
"width:max-content",
|
|
2309
|
+
"max-width:none",
|
|
2310
|
+
"height:auto",
|
|
2311
|
+
"overflow:visible",
|
|
2312
|
+
"white-space:nowrap",
|
|
2313
|
+
"writing-mode:horizontal-tb",
|
|
2314
|
+
"transform:none"
|
|
2315
|
+
].join(";");
|
|
2316
|
+
for (const u of s.querySelectorAll("cap-blockname, small, strong"))
|
|
2317
|
+
u.style.overflow = "visible", u.style.minWidth = "auto";
|
|
2318
|
+
const o = s.querySelector("cap-blockname");
|
|
2319
|
+
o != null && (o.style.flex = "0 0 auto"), n.append(s);
|
|
2320
|
+
const a = s.getBoundingClientRect().width;
|
|
2321
|
+
return s.remove(), a;
|
|
2322
|
+
}
|
|
2323
|
+
blockKeyDown(r, i) {
|
|
2324
|
+
if (r.key === "Enter" || r.key === " ") {
|
|
2325
|
+
r.preventDefault(), this.props.model.select(i.path, "block selected by keyboard");
|
|
2256
2326
|
return;
|
|
2257
2327
|
}
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
else if (
|
|
2266
|
-
|
|
2328
|
+
if (r.key === "Escape") {
|
|
2329
|
+
r.preventDefault(), this.props.model.clear("block selection cleared by keyboard");
|
|
2330
|
+
return;
|
|
2331
|
+
}
|
|
2332
|
+
const n = this.props.model.layout$.get().root, s = Pt(n.children.length === 0 ? [n] : n.children), o = s.findIndex(({ key: l }) => l === i.key);
|
|
2333
|
+
let a;
|
|
2334
|
+
if (r.key === "ArrowDown") a = s[o + 1];
|
|
2335
|
+
else if (r.key === "ArrowUp") a = s[o - 1];
|
|
2336
|
+
else if (r.key === "Home") a = s[0];
|
|
2337
|
+
else if (r.key === "End") a = s.at(-1);
|
|
2338
|
+
else if (r.key === "ArrowRight") a = i.children[0] ?? s[o + 1];
|
|
2339
|
+
else if (r.key === "ArrowLeft")
|
|
2340
|
+
a = i.path.length <= 1 ? s[o - 1] : _(n, i.path.slice(0, -1)) ?? void 0;
|
|
2267
2341
|
else return;
|
|
2268
|
-
|
|
2342
|
+
a != null && (r.preventDefault(), this.focusBlock(a.key));
|
|
2269
2343
|
}
|
|
2270
|
-
focusBlock(
|
|
2344
|
+
focusBlock(r) {
|
|
2271
2345
|
if (this.dom instanceof Element) {
|
|
2272
|
-
for (const
|
|
2273
|
-
if (
|
|
2274
|
-
|
|
2346
|
+
for (const i of this.dom.querySelectorAll('[role="treeitem"]'))
|
|
2347
|
+
if (i.dataset.blockKey === r) {
|
|
2348
|
+
i.focus();
|
|
2275
2349
|
return;
|
|
2276
2350
|
}
|
|
2277
2351
|
}
|
|
2278
2352
|
}
|
|
2279
2353
|
}
|
|
2280
|
-
c(
|
|
2354
|
+
c(X, "liveProps", []), c(X, "hostName", "block-graph"), c(X, "dataSurface", "data"), c(X, "dependencies", [fe, Ce]), c(X, "css", ne`
|
|
2281
2355
|
& {
|
|
2282
2356
|
display: flex;
|
|
2283
2357
|
min-width: 0;
|
|
@@ -2381,8 +2455,8 @@ c(Y, "liveProps", []), c(Y, "hostName", "block-graph"), c(Y, "dataSurface", "dat
|
|
|
2381
2455
|
& [role="treeitem"] > cap-blocklabel {
|
|
2382
2456
|
position: absolute;
|
|
2383
2457
|
z-index: 1;
|
|
2384
|
-
|
|
2385
|
-
|
|
2458
|
+
top: 0;
|
|
2459
|
+
left: 0;
|
|
2386
2460
|
box-sizing: border-box;
|
|
2387
2461
|
display: flex;
|
|
2388
2462
|
flex-flow: row nowrap;
|
|
@@ -2396,6 +2470,26 @@ c(Y, "liveProps", []), c(Y, "hostName", "block-graph"), c(Y, "dataSurface", "dat
|
|
|
2396
2470
|
cursor: pointer;
|
|
2397
2471
|
}
|
|
2398
2472
|
|
|
2473
|
+
& [role="treeitem"] > cap-blocklabel[data-label-orientation="vertical"] {
|
|
2474
|
+
z-index: 4;
|
|
2475
|
+
top: 0;
|
|
2476
|
+
left: 0;
|
|
2477
|
+
right: auto;
|
|
2478
|
+
bottom: auto;
|
|
2479
|
+
width: 1.6em;
|
|
2480
|
+
height: max-content;
|
|
2481
|
+
writing-mode: vertical-rl;
|
|
2482
|
+
transform: none;
|
|
2483
|
+
justify-content: flex-start;
|
|
2484
|
+
align-items: flex-end;
|
|
2485
|
+
padding: 0.2rem;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
& [role="treeitem"] > cap-blocklabel[data-label-orientation="horizontal"] {
|
|
2489
|
+
writing-mode: horizontal-tb;
|
|
2490
|
+
transform: none;
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2399
2493
|
& [role="treeitem"][aria-selected="true"] {
|
|
2400
2494
|
z-index: 3;
|
|
2401
2495
|
outline: 3px solid var(--viz-selection-color, var(--colored-contrast, Highlight));
|
|
@@ -2429,19 +2523,22 @@ c(Y, "liveProps", []), c(Y, "hostName", "block-graph"), c(Y, "dataSurface", "dat
|
|
|
2429
2523
|
}
|
|
2430
2524
|
|
|
2431
2525
|
& cap-blockname > strong {
|
|
2432
|
-
flex:
|
|
2526
|
+
flex: 0 1 auto;
|
|
2433
2527
|
min-width: 0;
|
|
2434
2528
|
overflow: hidden;
|
|
2435
2529
|
text-overflow: ellipsis;
|
|
2436
2530
|
white-space: nowrap;
|
|
2437
2531
|
}
|
|
2438
2532
|
|
|
2439
|
-
& cap-
|
|
2533
|
+
& cap-blockname > data {
|
|
2440
2534
|
flex: 0 0 auto;
|
|
2441
|
-
align-self: center;
|
|
2442
2535
|
font-weight: 750;
|
|
2443
2536
|
}
|
|
2444
2537
|
|
|
2538
|
+
& [role="treeitem"] > cap-blocklabel[data-label-orientation="vertical"] > cap-blockname {
|
|
2539
|
+
transform: rotate(180deg);
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2445
2542
|
& cap-blockgroup {
|
|
2446
2543
|
position: relative;
|
|
2447
2544
|
z-index: 1;
|
|
@@ -2468,16 +2565,20 @@ c(Y, "liveProps", []), c(Y, "hostName", "block-graph"), c(Y, "dataSurface", "dat
|
|
|
2468
2565
|
}
|
|
2469
2566
|
}
|
|
2470
2567
|
`);
|
|
2471
|
-
function
|
|
2472
|
-
|
|
2568
|
+
function st(e) {
|
|
2569
|
+
if (e !== "auto" && e !== "horizontal" && e !== "vertical")
|
|
2570
|
+
throw new TypeError(`Unknown block label orientation: ${e}`);
|
|
2473
2571
|
}
|
|
2474
|
-
function
|
|
2475
|
-
return e
|
|
2572
|
+
function Pt(e) {
|
|
2573
|
+
return e.flatMap((t) => [t, ...Pt(t.children)]);
|
|
2574
|
+
}
|
|
2575
|
+
function Jr(e, t) {
|
|
2576
|
+
return t != null && e.length === t.length && e.every((r, i) => {
|
|
2476
2577
|
var n, s;
|
|
2477
|
-
return r.criterionKey === ((n =
|
|
2578
|
+
return r.criterionKey === ((n = t[i]) == null ? void 0 : n.criterionKey) && r.categoryKey === ((s = t[i]) == null ? void 0 : s.categoryKey);
|
|
2478
2579
|
});
|
|
2479
2580
|
}
|
|
2480
|
-
class
|
|
2581
|
+
class ve extends Gt {
|
|
2481
2582
|
constructor(r) {
|
|
2482
2583
|
super(r);
|
|
2483
2584
|
c(this, "contentId");
|
|
@@ -2489,10 +2590,10 @@ class we extends Wt {
|
|
|
2489
2590
|
throw new Error(
|
|
2490
2591
|
"CollapsibleOptionGroup trailing header content must use a direct OptionGroupHeaderEnd child"
|
|
2491
2592
|
);
|
|
2492
|
-
const { content: r, regions: i } =
|
|
2593
|
+
const { content: r, regions: i } = Xt(
|
|
2493
2594
|
"CollapsibleOptionGroup",
|
|
2494
2595
|
this.props.children,
|
|
2495
|
-
{ headerEnd:
|
|
2596
|
+
{ headerEnd: Zt }
|
|
2496
2597
|
);
|
|
2497
2598
|
return this.renderOptionGroup(r, i.headerEnd ?? null);
|
|
2498
2599
|
}
|
|
@@ -2508,8 +2609,8 @@ class we extends Wt {
|
|
|
2508
2609
|
busy: u = !1,
|
|
2509
2610
|
error: d = null
|
|
2510
2611
|
} = this.props;
|
|
2511
|
-
return /* @__PURE__ */
|
|
2512
|
-
/* @__PURE__ */
|
|
2612
|
+
return /* @__PURE__ */ y(n, { className: this.props.className ?? this.props.class ?? null, children: [
|
|
2613
|
+
/* @__PURE__ */ y(
|
|
2513
2614
|
"fieldset",
|
|
2514
2615
|
{
|
|
2515
2616
|
id: this.groupId,
|
|
@@ -2520,8 +2621,8 @@ class we extends Wt {
|
|
|
2520
2621
|
"aria-invalid": d == null ? null : "true",
|
|
2521
2622
|
"aria-describedby": d == null ? null : this.errorId,
|
|
2522
2623
|
children: [
|
|
2523
|
-
/* @__PURE__ */
|
|
2524
|
-
/* @__PURE__ */
|
|
2624
|
+
/* @__PURE__ */ y("legend", { children: [
|
|
2625
|
+
/* @__PURE__ */ h(
|
|
2525
2626
|
"button",
|
|
2526
2627
|
{
|
|
2527
2628
|
type: "button",
|
|
@@ -2532,10 +2633,10 @@ class we extends Wt {
|
|
|
2532
2633
|
children: this.collapsed ? "▸" : "▾"
|
|
2533
2634
|
}
|
|
2534
2635
|
),
|
|
2535
|
-
s != null ? /* @__PURE__ */
|
|
2636
|
+
s != null ? /* @__PURE__ */ h("span", { children: s }) : null,
|
|
2536
2637
|
i
|
|
2537
2638
|
] }),
|
|
2538
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ h("div", { id: this.contentId, hidden: this.collapsed, children: r })
|
|
2539
2640
|
]
|
|
2540
2641
|
}
|
|
2541
2642
|
),
|
|
@@ -2543,7 +2644,7 @@ class we extends Wt {
|
|
|
2543
2644
|
] });
|
|
2544
2645
|
}
|
|
2545
2646
|
}
|
|
2546
|
-
c(
|
|
2647
|
+
c(ve, "hostName", "collapsible-option-group"), c(ve, "css", ne`
|
|
2547
2648
|
& > fieldset > legend > button.cap-collapse-toggle {
|
|
2548
2649
|
display: inline-flex;
|
|
2549
2650
|
align-items: center;
|
|
@@ -2578,50 +2679,50 @@ c(we, "hostName", "collapsible-option-group"), c(we, "css", re`
|
|
|
2578
2679
|
display: none;
|
|
2579
2680
|
}
|
|
2580
2681
|
`);
|
|
2581
|
-
const
|
|
2682
|
+
const Qr = [
|
|
2582
2683
|
["☐", "hidden"],
|
|
2583
2684
|
["✓", "visible"]
|
|
2584
2685
|
];
|
|
2585
|
-
class
|
|
2686
|
+
class ue extends Jt {
|
|
2586
2687
|
render() {
|
|
2587
2688
|
const {
|
|
2588
|
-
criteria:
|
|
2689
|
+
criteria: t,
|
|
2589
2690
|
label: r = "Show or hide categories",
|
|
2590
2691
|
description: i = ""
|
|
2591
2692
|
} = this.props, n = this.snapshot(this.props.items$), s = Array.isArray(n.value) ? n.value : [];
|
|
2592
2693
|
return this.renderGroupBox(
|
|
2593
2694
|
r,
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
n.fetchState === S.Error ? /* @__PURE__ */
|
|
2597
|
-
/* @__PURE__ */
|
|
2695
|
+
/* @__PURE__ */ y("cap-categoryhidecontent", { children: [
|
|
2696
|
+
/* @__PURE__ */ h("p", { children: i }),
|
|
2697
|
+
n.fetchState === S.Error ? /* @__PURE__ */ h("p", { role: "alert", children: "Category counts are unavailable." }) : null,
|
|
2698
|
+
/* @__PURE__ */ h("cap-criteriongroups", { children: t.map((o) => {
|
|
2598
2699
|
const a = this.snapshot(o.categories$), l = Array.isArray(a.value) ? a.value : [];
|
|
2599
|
-
return /* @__PURE__ */
|
|
2600
|
-
|
|
2700
|
+
return /* @__PURE__ */ y(
|
|
2701
|
+
ve,
|
|
2601
2702
|
{
|
|
2602
2703
|
label: o.label,
|
|
2603
2704
|
children: [
|
|
2604
|
-
a.fetchState === S.Error ? /* @__PURE__ */
|
|
2705
|
+
a.fetchState === S.Error ? /* @__PURE__ */ y("p", { role: "alert", children: [
|
|
2605
2706
|
o.label,
|
|
2606
2707
|
" categories are unavailable."
|
|
2607
2708
|
] }) : null,
|
|
2608
|
-
a.fetchState !== S.Ready ? /* @__PURE__ */
|
|
2709
|
+
a.fetchState !== S.Ready ? /* @__PURE__ */ y("p", { role: "status", "aria-live": "polite", children: [
|
|
2609
2710
|
"Loading ",
|
|
2610
2711
|
o.label,
|
|
2611
2712
|
"…"
|
|
2612
2713
|
] }) : null,
|
|
2613
|
-
/* @__PURE__ */
|
|
2614
|
-
const d =
|
|
2615
|
-
return /* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ h("cap-categories", { children: l.map((u) => {
|
|
2715
|
+
const d = ei(s, u.predicate);
|
|
2716
|
+
return /* @__PURE__ */ y(
|
|
2616
2717
|
"cap-categoryoption",
|
|
2617
2718
|
{
|
|
2618
|
-
style: { ...
|
|
2719
|
+
style: { ...ut(u.colors) },
|
|
2619
2720
|
children: [
|
|
2620
|
-
/* @__PURE__ */
|
|
2621
|
-
/* @__PURE__ */
|
|
2622
|
-
|
|
2721
|
+
/* @__PURE__ */ h("cap-categoryswatch", { "aria-hidden": "true" }),
|
|
2722
|
+
/* @__PURE__ */ h(
|
|
2723
|
+
me,
|
|
2623
2724
|
{
|
|
2624
|
-
symbols:
|
|
2725
|
+
symbols: Qr,
|
|
2625
2726
|
label: `${u.label} (${d})`,
|
|
2626
2727
|
valueEmitter: o.visibility(u.key)
|
|
2627
2728
|
}
|
|
@@ -2640,7 +2741,7 @@ class ce extends Xt {
|
|
|
2640
2741
|
);
|
|
2641
2742
|
}
|
|
2642
2743
|
}
|
|
2643
|
-
c(
|
|
2744
|
+
c(ue, "liveProps", []), c(ue, "hostName", "category-hide-panel"), c(ue, "dependencies", [me, ve]), c(ue, "css", ne`
|
|
2644
2745
|
& {
|
|
2645
2746
|
flex: 0 0 auto;
|
|
2646
2747
|
min-width: 0;
|
|
@@ -2717,80 +2818,80 @@ c(ce, "liveProps", []), c(ce, "hostName", "category-hide-panel"), c(ce, "depende
|
|
|
2717
2818
|
white-space: nowrap;
|
|
2718
2819
|
}
|
|
2719
2820
|
`);
|
|
2720
|
-
function
|
|
2821
|
+
function ei(e, t) {
|
|
2721
2822
|
let r = 0;
|
|
2722
|
-
for (const i of
|
|
2723
|
-
|
|
2823
|
+
for (const i of e)
|
|
2824
|
+
t(i) && (r += 1);
|
|
2724
2825
|
return r;
|
|
2725
2826
|
}
|
|
2726
|
-
const
|
|
2727
|
-
function
|
|
2728
|
-
const
|
|
2729
|
-
if (
|
|
2730
|
-
const r = Number(
|
|
2827
|
+
const Nt = 864e5, ti = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
2828
|
+
function x(e) {
|
|
2829
|
+
const t = ti.exec(e);
|
|
2830
|
+
if (t == null) throw new TypeError(`Invalid civil date "${e}"; expected YYYY-MM-DD`);
|
|
2831
|
+
const r = Number(t[1]), i = Number(t[2]), n = Number(t[3]), s = Date.UTC(r, i - 1, n), o = new Date(s);
|
|
2731
2832
|
if (o.getUTCFullYear() !== r || o.getUTCMonth() !== i - 1 || o.getUTCDate() !== n)
|
|
2732
|
-
throw new TypeError(`Invalid civil date "${
|
|
2733
|
-
return Math.floor(s /
|
|
2833
|
+
throw new TypeError(`Invalid civil date "${e}"`);
|
|
2834
|
+
return Math.floor(s / Nt);
|
|
2734
2835
|
}
|
|
2735
|
-
function
|
|
2736
|
-
if (!Number.isInteger(
|
|
2737
|
-
return new Date(
|
|
2836
|
+
function H(e) {
|
|
2837
|
+
if (!Number.isInteger(e)) throw new TypeError("Civil day must be an integer");
|
|
2838
|
+
return new Date(e * Nt).toISOString().slice(0, 10);
|
|
2738
2839
|
}
|
|
2739
|
-
function
|
|
2740
|
-
if (!Number.isInteger(
|
|
2741
|
-
return
|
|
2840
|
+
function ri(e, t) {
|
|
2841
|
+
if (!Number.isInteger(t)) throw new TypeError("Civil date offset must be an integer");
|
|
2842
|
+
return H(x(e) + t);
|
|
2742
2843
|
}
|
|
2743
|
-
function
|
|
2744
|
-
if (!(
|
|
2844
|
+
function ii(e = /* @__PURE__ */ new Date()) {
|
|
2845
|
+
if (!(e instanceof Date) || Number.isNaN(e.getTime()))
|
|
2745
2846
|
throw new TypeError("todayCivilDate requires a valid Date");
|
|
2746
|
-
return `${String(
|
|
2747
|
-
|
|
2748
|
-
).padStart(2, "0")}-${String(
|
|
2749
|
-
}
|
|
2750
|
-
function
|
|
2751
|
-
return
|
|
2752
|
-
}
|
|
2753
|
-
function
|
|
2754
|
-
var He, Ve, We
|
|
2755
|
-
|
|
2756
|
-
const r = ot(
|
|
2757
|
-
if (
|
|
2758
|
-
const
|
|
2759
|
-
shape:
|
|
2760
|
-
values:
|
|
2847
|
+
return `${String(e.getUTCFullYear()).padStart(4, "0")}-${String(
|
|
2848
|
+
e.getUTCMonth() + 1
|
|
2849
|
+
).padStart(2, "0")}-${String(e.getUTCDate()).padStart(2, "0")}`;
|
|
2850
|
+
}
|
|
2851
|
+
function ni(e, t) {
|
|
2852
|
+
return x(e) - x(t);
|
|
2853
|
+
}
|
|
2854
|
+
function si(e, t = {}) {
|
|
2855
|
+
var Ue, He, Ve, We;
|
|
2856
|
+
di(e);
|
|
2857
|
+
const r = ot(t.width ?? 960, "Chart width"), i = ot(t.height ?? 420, "Chart height"), n = Math.min(72, r * 0.18), s = 24, o = Math.max(1, r - n - 24), a = Math.max(1, i - s - 58), l = e.flatMap((v) => Object.keys(v.values)), u = t.today ?? ii(), d = ((Ue = t.range) == null ? void 0 : Ue.minX) ?? pi(l) ?? u, p = ((He = t.range) == null ? void 0 : He.maxX) ?? u, b = x(d), w = x(p);
|
|
2858
|
+
if (b > w) throw new RangeError("Line graph minX must not be after maxX");
|
|
2859
|
+
const g = ci(e, b, w), f = t.stacked ?? !1, E = e.map((v) => ({
|
|
2860
|
+
shape: v,
|
|
2861
|
+
values: g.map((Y) => It(v, Y))
|
|
2761
2862
|
}));
|
|
2762
|
-
let
|
|
2763
|
-
const
|
|
2764
|
-
const
|
|
2765
|
-
const
|
|
2766
|
-
return f && (
|
|
2863
|
+
let T = ((Ve = t.range) == null ? void 0 : Ve.minY) ?? 0, N = T;
|
|
2864
|
+
const W = Array.from({ length: g.length }, () => 0), _t = E.map(({ shape: v, values: Y }) => {
|
|
2865
|
+
const G = Y.map((oe, I) => {
|
|
2866
|
+
const ae = f ? W[I] : 0, le = ae + oe;
|
|
2867
|
+
return f && (W[I] = le), T = Math.min(T, ae, le), N = Math.max(N, ae, le), { value: oe, baseValue: ae, displayValue: le };
|
|
2767
2868
|
});
|
|
2768
|
-
return { shape:
|
|
2769
|
-
}),
|
|
2770
|
-
key:
|
|
2771
|
-
label:
|
|
2772
|
-
color:
|
|
2773
|
-
...
|
|
2774
|
-
shape:
|
|
2775
|
-
points: Object.freeze(
|
|
2776
|
-
const
|
|
2869
|
+
return { shape: v, entries: G };
|
|
2870
|
+
}), Bt = Math.max(1, N - T), K = N + Bt * 0.05, $e = ((We = t.range) == null ? void 0 : We.minY) ?? T, xe = Math.max(1, K - $e), Fe = Math.max(1, w - b), qt = _t.map(({ shape: v, entries: Y }) => ({
|
|
2871
|
+
key: v.key,
|
|
2872
|
+
label: v.label,
|
|
2873
|
+
color: v.color,
|
|
2874
|
+
...v.colorKey === void 0 ? {} : { colorKey: v.colorKey },
|
|
2875
|
+
shape: v,
|
|
2876
|
+
points: Object.freeze(Y.map((G, oe) => {
|
|
2877
|
+
const I = g[oe];
|
|
2777
2878
|
return Object.freeze({
|
|
2778
|
-
date:
|
|
2779
|
-
day:
|
|
2780
|
-
...
|
|
2781
|
-
x: n + (
|
|
2782
|
-
y: s + (
|
|
2783
|
-
baseY: s + (
|
|
2879
|
+
date: H(I),
|
|
2880
|
+
day: I,
|
|
2881
|
+
...G,
|
|
2882
|
+
x: n + (I - b) / Fe * o,
|
|
2883
|
+
y: s + (K - G.displayValue) / xe * a,
|
|
2884
|
+
baseY: s + (K - G.baseValue) / xe * a
|
|
2784
2885
|
});
|
|
2785
2886
|
}))
|
|
2786
2887
|
}));
|
|
2787
2888
|
return Object.freeze({
|
|
2788
2889
|
minDate: d,
|
|
2789
|
-
maxDate:
|
|
2790
|
-
minDay:
|
|
2791
|
-
maxDay:
|
|
2792
|
-
minY:
|
|
2793
|
-
maxY:
|
|
2890
|
+
maxDate: p,
|
|
2891
|
+
minDay: b,
|
|
2892
|
+
maxDay: w,
|
|
2893
|
+
minY: $e,
|
|
2894
|
+
maxY: K,
|
|
2794
2895
|
width: r,
|
|
2795
2896
|
height: i,
|
|
2796
2897
|
plotLeft: n,
|
|
@@ -2798,110 +2899,110 @@ function ii(t, e = {}) {
|
|
|
2798
2899
|
plotWidth: o,
|
|
2799
2900
|
plotHeight: a,
|
|
2800
2901
|
stacked: f,
|
|
2801
|
-
series: Object.freeze(
|
|
2802
|
-
dateMarks: Object.freeze(
|
|
2803
|
-
date:
|
|
2804
|
-
day:
|
|
2805
|
-
x: n + (
|
|
2902
|
+
series: Object.freeze(qt),
|
|
2903
|
+
dateMarks: Object.freeze(ui(b, w, t.maxDateMarks ?? 8).map((v) => ({
|
|
2904
|
+
date: H(v),
|
|
2905
|
+
day: v,
|
|
2906
|
+
x: n + (v - b) / Fe * o
|
|
2806
2907
|
}))),
|
|
2807
|
-
valueTicks: Object.freeze(
|
|
2808
|
-
value:
|
|
2809
|
-
y: s + (
|
|
2908
|
+
valueTicks: Object.freeze(li($e, K).map((v) => ({
|
|
2909
|
+
value: v,
|
|
2910
|
+
y: s + (K - v) / xe * a
|
|
2810
2911
|
})))
|
|
2811
2912
|
});
|
|
2812
2913
|
}
|
|
2813
|
-
function
|
|
2814
|
-
return
|
|
2914
|
+
function oi(e, t) {
|
|
2915
|
+
return It(e, x(t));
|
|
2815
2916
|
}
|
|
2816
|
-
function
|
|
2817
|
-
const r =
|
|
2917
|
+
function Kt(e, t) {
|
|
2918
|
+
const r = e[0];
|
|
2818
2919
|
if (r == null) return "";
|
|
2819
|
-
let i = `M ${
|
|
2820
|
-
for (let n = 1; n <
|
|
2821
|
-
const s =
|
|
2822
|
-
if (
|
|
2920
|
+
let i = `M ${k(r.x)} ${k(r.y)}`;
|
|
2921
|
+
for (let n = 1; n < e.length; n += 1) {
|
|
2922
|
+
const s = e[n - 1], o = e[n];
|
|
2923
|
+
if (t) {
|
|
2823
2924
|
const a = (s.x + o.x) / 2;
|
|
2824
|
-
i += ` C ${
|
|
2925
|
+
i += ` C ${k(a)} ${k(s.y)}, ${k(a)} ${k(o.y)}, ${k(o.x)} ${k(o.y)}`;
|
|
2825
2926
|
} else
|
|
2826
|
-
i += ` H ${
|
|
2927
|
+
i += ` H ${k(o.x)} V ${k(o.y)}`;
|
|
2827
2928
|
}
|
|
2828
2929
|
return i;
|
|
2829
2930
|
}
|
|
2830
|
-
function
|
|
2831
|
-
if (
|
|
2832
|
-
const r =
|
|
2931
|
+
function ai(e, t) {
|
|
2932
|
+
if (e.length === 0) return "";
|
|
2933
|
+
const r = Kt(e, t), i = [...e].reverse();
|
|
2833
2934
|
let n = "";
|
|
2834
2935
|
for (let s = 0; s < i.length; s += 1) {
|
|
2835
2936
|
const o = i[s];
|
|
2836
|
-
if (s === 0) n += ` L ${
|
|
2837
|
-
else if (
|
|
2937
|
+
if (s === 0) n += ` L ${k(o.x)} ${k(o.baseY)}`;
|
|
2938
|
+
else if (t) {
|
|
2838
2939
|
const a = i[s - 1], l = (a.x + o.x) / 2;
|
|
2839
|
-
n += ` C ${
|
|
2940
|
+
n += ` C ${k(l)} ${k(a.baseY)}, ${k(l)} ${k(o.baseY)}, ${k(o.x)} ${k(o.baseY)}`;
|
|
2840
2941
|
} else
|
|
2841
|
-
n += ` H ${
|
|
2942
|
+
n += ` H ${k(o.x)} V ${k(o.baseY)}`;
|
|
2842
2943
|
}
|
|
2843
2944
|
return `${r}${n} Z`;
|
|
2844
2945
|
}
|
|
2845
|
-
function
|
|
2846
|
-
if (!Number.isFinite(
|
|
2946
|
+
function li(e, t, r = 6) {
|
|
2947
|
+
if (!Number.isFinite(e) || !Number.isFinite(t) || e > t)
|
|
2847
2948
|
throw new RangeError("Tick range must contain finite ascending values");
|
|
2848
2949
|
if (!Number.isInteger(r) || r < 2) throw new RangeError("Tick target must be at least two");
|
|
2849
|
-
const n = Math.max(1,
|
|
2850
|
-
for (let
|
|
2851
|
-
d.push(Number(
|
|
2852
|
-
return d.length === 0 && d.push(Math.ceil(
|
|
2853
|
-
}
|
|
2854
|
-
function
|
|
2855
|
-
const i = /* @__PURE__ */ new Set([
|
|
2856
|
-
for (const n of
|
|
2950
|
+
const n = Math.max(1, t - e) / (r - 1), s = 10 ** Math.floor(Math.log10(n)), o = n / s, a = o <= 1 ? 1 : o <= 2 ? 2 : o <= 5 ? 5 : 10, l = Math.max(1, a * s), u = Math.ceil(e / l) * l, d = [];
|
|
2951
|
+
for (let p = u; p <= t + l / 1e3; p += l)
|
|
2952
|
+
d.push(Number(p.toFixed(10)));
|
|
2953
|
+
return d.length === 0 && d.push(Math.ceil(e)), d;
|
|
2954
|
+
}
|
|
2955
|
+
function ci(e, t, r) {
|
|
2956
|
+
const i = /* @__PURE__ */ new Set([t, r]);
|
|
2957
|
+
for (const n of e)
|
|
2857
2958
|
for (const s of Object.keys(n.values)) {
|
|
2858
|
-
const o =
|
|
2859
|
-
o >=
|
|
2959
|
+
const o = x(s);
|
|
2960
|
+
o >= t && o <= r && i.add(o);
|
|
2860
2961
|
}
|
|
2861
2962
|
return [...i].sort((n, s) => n - s);
|
|
2862
2963
|
}
|
|
2863
|
-
function
|
|
2864
|
-
const r =
|
|
2964
|
+
function It(e, t) {
|
|
2965
|
+
const r = e.values[H(t)];
|
|
2865
2966
|
if (r !== void 0) return r;
|
|
2866
|
-
if (
|
|
2967
|
+
if (e.carryForward !== !0) return 0;
|
|
2867
2968
|
let i = Number.NEGATIVE_INFINITY, n = 0;
|
|
2868
|
-
for (const [s, o] of Object.entries(
|
|
2869
|
-
const a =
|
|
2870
|
-
a <=
|
|
2969
|
+
for (const [s, o] of Object.entries(e.values)) {
|
|
2970
|
+
const a = x(s);
|
|
2971
|
+
a <= t && a > i && (i = a, n = o);
|
|
2871
2972
|
}
|
|
2872
2973
|
return n;
|
|
2873
2974
|
}
|
|
2874
|
-
function
|
|
2975
|
+
function ui(e, t, r) {
|
|
2875
2976
|
if (!Number.isInteger(r) || r < 2)
|
|
2876
2977
|
throw new RangeError("Maximum date marks must be at least two");
|
|
2877
|
-
const i = Math.max(0,
|
|
2878
|
-
for (let a =
|
|
2879
|
-
return
|
|
2880
|
-
}
|
|
2881
|
-
function
|
|
2882
|
-
if (!Array.isArray(
|
|
2883
|
-
const
|
|
2884
|
-
for (const r of
|
|
2978
|
+
const i = Math.max(0, t - e), n = i <= 62 ? 7 : i <= 730 ? 30 : 365, s = Math.max(n, Math.ceil(Math.max(1, i) / (r - 1))), o = [e];
|
|
2979
|
+
for (let a = e + s; a < t; a += s) o.push(a);
|
|
2980
|
+
return t !== e && o.push(t), o;
|
|
2981
|
+
}
|
|
2982
|
+
function di(e) {
|
|
2983
|
+
if (!Array.isArray(e)) throw new TypeError("History shapes must be an array");
|
|
2984
|
+
const t = /* @__PURE__ */ new Set();
|
|
2985
|
+
for (const r of e) {
|
|
2885
2986
|
if (r == null || typeof r != "object") throw new TypeError("History shape must be an object");
|
|
2886
|
-
if (typeof r.key != "string" || r.key.trim() === "" ||
|
|
2987
|
+
if (typeof r.key != "string" || r.key.trim() === "" || t.has(r.key))
|
|
2887
2988
|
throw new Error("History shape keys must be non-empty and unique");
|
|
2888
|
-
if (
|
|
2989
|
+
if (t.add(r.key), typeof r.label != "string" || r.label.trim() === "")
|
|
2889
2990
|
throw new TypeError("History shape label must be a non-empty string");
|
|
2890
2991
|
if (typeof r.color != "string" || r.color.trim() === "")
|
|
2891
2992
|
throw new TypeError("History shape color must be a non-empty CSS value");
|
|
2892
2993
|
for (const [i, n] of Object.entries(r.values))
|
|
2893
|
-
if (
|
|
2994
|
+
if (x(i), !Number.isFinite(n)) throw new TypeError("History shape values must be finite");
|
|
2894
2995
|
}
|
|
2895
2996
|
}
|
|
2896
|
-
function
|
|
2897
|
-
return
|
|
2997
|
+
function pi(e) {
|
|
2998
|
+
return e.length === 0 ? void 0 : e.reduce((t, r) => x(t) <= x(r) ? t : r);
|
|
2898
2999
|
}
|
|
2899
|
-
function ot(
|
|
2900
|
-
if (!Number.isFinite(
|
|
2901
|
-
return
|
|
3000
|
+
function ot(e, t) {
|
|
3001
|
+
if (!Number.isFinite(e) || e <= 0) throw new RangeError(`${t} must be positive`);
|
|
3002
|
+
return e;
|
|
2902
3003
|
}
|
|
2903
|
-
function
|
|
2904
|
-
return Number(
|
|
3004
|
+
function k(e) {
|
|
3005
|
+
return Number(e.toFixed(3)).toString();
|
|
2905
3006
|
}
|
|
2906
3007
|
class je extends Ne {
|
|
2907
3008
|
constructor(r) {
|
|
@@ -2926,7 +3027,7 @@ class je extends Ne {
|
|
|
2926
3027
|
let u = null;
|
|
2927
3028
|
if (this.currentModel = null, l === S.Ready)
|
|
2928
3029
|
try {
|
|
2929
|
-
this.currentModel =
|
|
3030
|
+
this.currentModel = si(r.value, {
|
|
2930
3031
|
stacked: i.value,
|
|
2931
3032
|
range: s.value,
|
|
2932
3033
|
width: Math.max(480, this.observedWidth),
|
|
@@ -2935,17 +3036,17 @@ class je extends Ne {
|
|
|
2935
3036
|
} catch (f) {
|
|
2936
3037
|
u = f;
|
|
2937
3038
|
}
|
|
2938
|
-
const d = this.currentModel,
|
|
2939
|
-
return /* @__PURE__ */
|
|
2940
|
-
|
|
3039
|
+
const d = this.currentModel, p = d == null ? null : o ?? d.maxDate, b = this.props.formatDate ?? ((f) => f), w = this.props.formatValue ?? ((f) => String(f)), g = this.Host;
|
|
3040
|
+
return /* @__PURE__ */ y(
|
|
3041
|
+
g,
|
|
2941
3042
|
{
|
|
2942
3043
|
className: (this.props.className ?? this.props.class ?? "") || null,
|
|
2943
3044
|
"aria-label": a,
|
|
2944
3045
|
"aria-busy": l !== S.Ready ? "true" : null,
|
|
2945
3046
|
children: [
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
2948
|
-
/* @__PURE__ */
|
|
3047
|
+
/* @__PURE__ */ y("header", { children: [
|
|
3048
|
+
/* @__PURE__ */ h("h2", { children: a }),
|
|
3049
|
+
/* @__PURE__ */ y("p", { children: [
|
|
2949
3050
|
i.value ? "Stacked area" : "Individual line",
|
|
2950
3051
|
" chart;",
|
|
2951
3052
|
" ",
|
|
@@ -2953,7 +3054,7 @@ class je extends Ne {
|
|
|
2953
3054
|
" rendering."
|
|
2954
3055
|
] })
|
|
2955
3056
|
] }),
|
|
2956
|
-
l === S.Error || u != null ? /* @__PURE__ */
|
|
3057
|
+
l === S.Error || u != null ? /* @__PURE__ */ h("p", { role: "alert", children: "The history chart could not be calculated." }) : l !== S.Ready ? /* @__PURE__ */ h("p", { role: "status", "aria-live": "polite", children: "Loading history chart…" }) : r.value.length === 0 ? /* @__PURE__ */ h("p", { role: "status", children: this.props.emptyMessage ?? "No history values are available." }) : /* @__PURE__ */ h(
|
|
2957
3058
|
"cap-chart",
|
|
2958
3059
|
{
|
|
2959
3060
|
tabIndex: 0,
|
|
@@ -2964,18 +3065,18 @@ class je extends Ne {
|
|
|
2964
3065
|
ref: (f) => this.chartHost = f
|
|
2965
3066
|
}
|
|
2966
3067
|
),
|
|
2967
|
-
d == null ||
|
|
2968
|
-
/* @__PURE__ */
|
|
2969
|
-
/* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
3068
|
+
d == null || p == null ? null : /* @__PURE__ */ y("cap-readout", { children: [
|
|
3069
|
+
/* @__PURE__ */ h("p", { "aria-live": "polite", children: /* @__PURE__ */ h("strong", { children: b(p) }) }),
|
|
3070
|
+
/* @__PURE__ */ h("ul", { children: d.series.map(({ shape: f }) => /* @__PURE__ */ y("li", { children: [
|
|
3071
|
+
/* @__PURE__ */ h(
|
|
2971
3072
|
"cap-swatch",
|
|
2972
3073
|
{
|
|
2973
3074
|
style: { "--colored-base": f.color },
|
|
2974
3075
|
"aria-hidden": "true"
|
|
2975
3076
|
}
|
|
2976
3077
|
),
|
|
2977
|
-
/* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
3078
|
+
/* @__PURE__ */ h("span", { children: f.label }),
|
|
3079
|
+
/* @__PURE__ */ h("strong", { children: w(oi(f, p)) })
|
|
2979
3080
|
] }, f.key)) })
|
|
2980
3081
|
] })
|
|
2981
3082
|
]
|
|
@@ -3002,7 +3103,7 @@ class je extends Ne {
|
|
|
3002
3103
|
}), this.resizeObserver.observe(this.chartHost));
|
|
3003
3104
|
}
|
|
3004
3105
|
source(r, i) {
|
|
3005
|
-
if (
|
|
3106
|
+
if (hi(r)) return r;
|
|
3006
3107
|
const n = new D(r, { owner: this, purpose: i });
|
|
3007
3108
|
return this.ownedSources.push(n), n;
|
|
3008
3109
|
}
|
|
@@ -3012,12 +3113,12 @@ class je extends Ne {
|
|
|
3012
3113
|
const s = n.getBoundingClientRect();
|
|
3013
3114
|
if (s.width <= 0) return;
|
|
3014
3115
|
const o = (r.clientX - s.left) / s.width * i.width, a = Math.max(0, Math.min(1, (o - i.plotLeft) / i.plotWidth)), l = Math.round(i.minDay + a * (i.maxDay - i.minDay));
|
|
3015
|
-
this.cursorDate$.set(
|
|
3116
|
+
this.cursorDate$.set(H(l), "line graph pointer moved");
|
|
3016
3117
|
}
|
|
3017
3118
|
cursorKeyDown(r) {
|
|
3018
3119
|
const i = this.currentModel;
|
|
3019
3120
|
if (i == null) return;
|
|
3020
|
-
let n =
|
|
3121
|
+
let n = x(this.cursorDate$.get() ?? i.maxDate);
|
|
3021
3122
|
if (r.key === "ArrowLeft") n -= r.shiftKey ? 7 : 1;
|
|
3022
3123
|
else if (r.key === "ArrowRight") n += r.shiftKey ? 7 : 1;
|
|
3023
3124
|
else if (r.key === "Home") n = i.minDay;
|
|
@@ -3027,35 +3128,35 @@ class je extends Ne {
|
|
|
3027
3128
|
return;
|
|
3028
3129
|
} else return;
|
|
3029
3130
|
r.preventDefault();
|
|
3030
|
-
const s =
|
|
3131
|
+
const s = H(Math.max(i.minDay, Math.min(i.maxDay, n)));
|
|
3031
3132
|
this.cursorDate$.set(s, "line graph cursor moved by keyboard");
|
|
3032
3133
|
}
|
|
3033
3134
|
drawChart() {
|
|
3034
3135
|
const r = this.chartHost, i = this.currentModel;
|
|
3035
3136
|
if (r == null || i == null) return;
|
|
3036
|
-
const n = this.smooth$.get(), s =
|
|
3137
|
+
const n = this.smooth$.get(), s = R("svg");
|
|
3037
3138
|
s.setAttribute("viewBox", `0 0 ${i.width} ${i.height}`), s.setAttribute("role", "img"), s.setAttribute("aria-label", this.props.label ?? "History chart");
|
|
3038
3139
|
for (const a of i.valueTicks) {
|
|
3039
|
-
const l =
|
|
3040
|
-
l.classList.add("gridline"),
|
|
3140
|
+
const l = R("line");
|
|
3141
|
+
l.classList.add("gridline"), Z(l, {
|
|
3041
3142
|
x1: i.plotLeft,
|
|
3042
3143
|
x2: i.plotLeft + i.plotWidth,
|
|
3043
3144
|
y1: a.y,
|
|
3044
3145
|
y2: a.y
|
|
3045
3146
|
}), s.append(l);
|
|
3046
|
-
const u =
|
|
3047
|
-
u.classList.add("axismark"),
|
|
3147
|
+
const u = R("text");
|
|
3148
|
+
u.classList.add("axismark"), Z(u, { x: i.plotLeft - 8, y: a.y + 4, "text-anchor": "end" }), u.textContent = String(a.value), s.append(u);
|
|
3048
3149
|
}
|
|
3049
3150
|
for (const a of i.dateMarks) {
|
|
3050
|
-
const l =
|
|
3051
|
-
l.classList.add("gridline"),
|
|
3151
|
+
const l = R("line");
|
|
3152
|
+
l.classList.add("gridline"), Z(l, {
|
|
3052
3153
|
x1: a.x,
|
|
3053
3154
|
x2: a.x,
|
|
3054
3155
|
y1: i.plotTop,
|
|
3055
3156
|
y2: i.plotTop + i.plotHeight
|
|
3056
3157
|
}), s.append(l);
|
|
3057
|
-
const u =
|
|
3058
|
-
u.classList.add("axismark"),
|
|
3158
|
+
const u = R("text");
|
|
3159
|
+
u.classList.add("axismark"), Z(u, {
|
|
3059
3160
|
x: a.x,
|
|
3060
3161
|
y: i.plotTop + i.plotHeight + 22,
|
|
3061
3162
|
"text-anchor": "middle"
|
|
@@ -3063,16 +3164,16 @@ class je extends Ne {
|
|
|
3063
3164
|
}
|
|
3064
3165
|
for (const a of i.series) {
|
|
3065
3166
|
if (i.stacked) {
|
|
3066
|
-
const u =
|
|
3067
|
-
u.classList.add("seriesarea"), u.setAttribute("fill", a.color), u.setAttribute("d",
|
|
3167
|
+
const u = R("path");
|
|
3168
|
+
u.classList.add("seriesarea"), u.setAttribute("fill", a.color), u.setAttribute("d", ai(a.points, n)), s.append(u);
|
|
3068
3169
|
}
|
|
3069
|
-
const l =
|
|
3070
|
-
l.classList.add("seriesline"), l.setAttribute("stroke", a.color), l.setAttribute("d",
|
|
3170
|
+
const l = R("path");
|
|
3171
|
+
l.classList.add("seriesline"), l.setAttribute("stroke", a.color), l.setAttribute("d", Kt(a.points, n)), s.append(l);
|
|
3071
3172
|
}
|
|
3072
3173
|
const o = this.cursorDate$.get();
|
|
3073
3174
|
if (o != null) {
|
|
3074
|
-
const a =
|
|
3075
|
-
u.classList.add("cursor"),
|
|
3175
|
+
const a = x(o), l = i.plotLeft + (a - i.minDay) / Math.max(1, i.maxDay - i.minDay) * i.plotWidth, u = R("line");
|
|
3176
|
+
u.classList.add("cursor"), Z(u, {
|
|
3076
3177
|
x1: l,
|
|
3077
3178
|
x2: l,
|
|
3078
3179
|
y1: i.plotTop,
|
|
@@ -3082,7 +3183,7 @@ class je extends Ne {
|
|
|
3082
3183
|
r.replaceChildren(s);
|
|
3083
3184
|
}
|
|
3084
3185
|
}
|
|
3085
|
-
c(je, "liveProps", []), c(je, "hostName", "line-graph"), c(je, "css",
|
|
3186
|
+
c(je, "liveProps", []), c(je, "hostName", "line-graph"), c(je, "css", ne`
|
|
3086
3187
|
& {
|
|
3087
3188
|
display: flex;
|
|
3088
3189
|
min-width: 0;
|
|
@@ -3183,19 +3284,19 @@ c(je, "liveProps", []), c(je, "hostName", "line-graph"), c(je, "css", re`
|
|
|
3183
3284
|
}
|
|
3184
3285
|
}
|
|
3185
3286
|
`);
|
|
3186
|
-
function
|
|
3187
|
-
return
|
|
3287
|
+
function hi(e) {
|
|
3288
|
+
return e != null && (typeof e == "object" || typeof e == "function") && typeof Reflect.get(e, "get") == "function" && typeof Reflect.get(e, "subscribe") == "function";
|
|
3188
3289
|
}
|
|
3189
|
-
const
|
|
3190
|
-
function
|
|
3191
|
-
return document.createElementNS(
|
|
3290
|
+
const fi = "http://www.w3.org/2000/svg";
|
|
3291
|
+
function R(e) {
|
|
3292
|
+
return document.createElementNS(fi, e);
|
|
3192
3293
|
}
|
|
3193
|
-
function
|
|
3194
|
-
for (const [r, i] of Object.entries(
|
|
3195
|
-
|
|
3294
|
+
function Z(e, t) {
|
|
3295
|
+
for (const [r, i] of Object.entries(t))
|
|
3296
|
+
e.setAttribute(r, String(i));
|
|
3196
3297
|
}
|
|
3197
|
-
class
|
|
3198
|
-
constructor(
|
|
3298
|
+
class mi {
|
|
3299
|
+
constructor(t, r = {}) {
|
|
3199
3300
|
c(this, "criteria");
|
|
3200
3301
|
c(this, "presets");
|
|
3201
3302
|
c(this, "order$");
|
|
@@ -3207,25 +3308,25 @@ class hi {
|
|
|
3207
3308
|
c(this, "activeSplitsEmitter");
|
|
3208
3309
|
c(this, "activeEmitters", /* @__PURE__ */ new Map());
|
|
3209
3310
|
c(this, "disposed", !1);
|
|
3210
|
-
if (!Array.isArray(
|
|
3311
|
+
if (!Array.isArray(t) || t.some((o) => !(o instanceof V)))
|
|
3211
3312
|
throw new TypeError("Split criteria must contain GroupingCriterion instances");
|
|
3212
3313
|
const i = new Map(
|
|
3213
|
-
|
|
3314
|
+
t.map((o) => [o.key, o])
|
|
3214
3315
|
);
|
|
3215
|
-
if (i.size !==
|
|
3216
|
-
this.criteria = Object.freeze([...
|
|
3316
|
+
if (i.size !== t.length) throw new Error("Split criteria keys must be unique");
|
|
3317
|
+
this.criteria = Object.freeze([...t]), this.byKey = i, this.presets = gi(r.presets ?? [], i);
|
|
3217
3318
|
const n = this.criteria.map(({ key: o }) => o), s = r.active ?? n;
|
|
3218
|
-
|
|
3319
|
+
te(s, i, "Active split keys"), this.state$ = new D(de(n, new Set(s)), {
|
|
3219
3320
|
owner: this,
|
|
3220
3321
|
purpose: "split selection state",
|
|
3221
|
-
equals:
|
|
3222
|
-
}), this.orderEmitter = new
|
|
3322
|
+
equals: bi
|
|
3323
|
+
}), this.orderEmitter = new L(
|
|
3223
3324
|
[this.state$],
|
|
3224
3325
|
([o]) => Object.freeze(
|
|
3225
3326
|
o.order.map((a) => at(i, a))
|
|
3226
3327
|
),
|
|
3227
3328
|
{ owner: this, purpose: "ordered visualization criteria" }
|
|
3228
|
-
), this.order$ = this.orderEmitter, this.activeSplitsEmitter = new
|
|
3329
|
+
), this.order$ = this.orderEmitter, this.activeSplitsEmitter = new L(
|
|
3229
3330
|
[this.state$],
|
|
3230
3331
|
([o]) => Object.freeze(o.order.filter((a) => o.active.has(a)).map((a) => at(i, a))),
|
|
3231
3332
|
{ owner: this, purpose: "active ordered visualization splits" }
|
|
@@ -3234,83 +3335,83 @@ class hi {
|
|
|
3234
3335
|
purpose: "active visualization split preset"
|
|
3235
3336
|
});
|
|
3236
3337
|
}
|
|
3237
|
-
activeState(
|
|
3338
|
+
activeState(t) {
|
|
3238
3339
|
this.assertActive();
|
|
3239
|
-
const r = this.requireKey(
|
|
3340
|
+
const r = this.requireKey(t);
|
|
3240
3341
|
let i = this.activeEmitters.get(r);
|
|
3241
|
-
return i == null && (i = new
|
|
3342
|
+
return i == null && (i = new yi(this, r), this.activeEmitters.set(r, i)), i;
|
|
3242
3343
|
}
|
|
3243
|
-
isActive(
|
|
3244
|
-
return this.state$.get().active.has(this.requireKey(
|
|
3344
|
+
isActive(t) {
|
|
3345
|
+
return this.state$.get().active.has(this.requireKey(t));
|
|
3245
3346
|
}
|
|
3246
|
-
toggle(
|
|
3347
|
+
toggle(t, r) {
|
|
3247
3348
|
this.assertActive();
|
|
3248
|
-
const i = this.requireKey(
|
|
3349
|
+
const i = this.requireKey(t), n = this.state$.get(), s = new Set(n.active);
|
|
3249
3350
|
return s.has(i) ? s.delete(i) : s.add(i), this.activePreset$.set(null, "split selection customized"), this.state$.set(
|
|
3250
|
-
|
|
3351
|
+
de(n.order, s),
|
|
3251
3352
|
r ?? `${i} split toggled`
|
|
3252
3353
|
);
|
|
3253
3354
|
}
|
|
3254
|
-
move(
|
|
3355
|
+
move(t, r, i) {
|
|
3255
3356
|
this.assertActive();
|
|
3256
|
-
const n = this.requireKey(
|
|
3357
|
+
const n = this.requireKey(t);
|
|
3257
3358
|
if (!Number.isInteger(r)) throw new TypeError("Split target index must be an integer");
|
|
3258
3359
|
const s = this.state$.get(), o = s.order.indexOf(n), a = Math.max(0, Math.min(r, s.order.length - 1));
|
|
3259
3360
|
if (o === a) return !1;
|
|
3260
3361
|
const l = [...s.order];
|
|
3261
3362
|
return l.splice(o, 1), l.splice(a, 0, n), this.activePreset$.set(null, "split order customized"), this.state$.set(
|
|
3262
|
-
|
|
3363
|
+
de(l, s.active),
|
|
3263
3364
|
i ?? `${n} split moved`
|
|
3264
3365
|
);
|
|
3265
3366
|
}
|
|
3266
|
-
moveBy(
|
|
3367
|
+
moveBy(t, r, i) {
|
|
3267
3368
|
if (!Number.isInteger(r)) throw new TypeError("Split move offset must be an integer");
|
|
3268
|
-
const n = this.requireKey(
|
|
3369
|
+
const n = this.requireKey(t);
|
|
3269
3370
|
return this.move(
|
|
3270
3371
|
n,
|
|
3271
3372
|
this.state$.get().order.indexOf(n) + r,
|
|
3272
3373
|
i
|
|
3273
3374
|
);
|
|
3274
3375
|
}
|
|
3275
|
-
setSplits(
|
|
3276
|
-
this.assertActive(),
|
|
3277
|
-
const n = new Set(
|
|
3278
|
-
|
|
3279
|
-
const o = [...
|
|
3376
|
+
setSplits(t, r, i) {
|
|
3377
|
+
this.assertActive(), te(t, this.byKey, "Active split keys");
|
|
3378
|
+
const n = new Set(t), s = r ?? this.state$.get().order.filter((a) => !n.has(a));
|
|
3379
|
+
te(s, this.byKey, "Inactive split keys");
|
|
3380
|
+
const o = [...t, ...s];
|
|
3280
3381
|
if (new Set(o).size !== this.criteria.length || o.length !== this.criteria.length)
|
|
3281
3382
|
throw new Error("Active and inactive split keys must cover every criterion exactly once");
|
|
3282
3383
|
return this.activePreset$.set(null, "split selection replaced"), this.state$.set(
|
|
3283
|
-
|
|
3384
|
+
de(o, n),
|
|
3284
3385
|
i ?? "split selection replaced"
|
|
3285
3386
|
);
|
|
3286
3387
|
}
|
|
3287
|
-
applyPreset(
|
|
3388
|
+
applyPreset(t) {
|
|
3288
3389
|
this.assertActive();
|
|
3289
|
-
const r = this.presets.find(({ key: n }) => n ===
|
|
3290
|
-
if (r == null) throw new Error(`Unknown split preset "${
|
|
3390
|
+
const r = this.presets.find(({ key: n }) => n === t);
|
|
3391
|
+
if (r == null) throw new Error(`Unknown split preset "${t}"`);
|
|
3291
3392
|
const i = this.setSplits(r.active, r.inactive, `${r.key} preset applied`);
|
|
3292
3393
|
return this.activePreset$.set(r.key, `${r.key} preset applied`), i;
|
|
3293
3394
|
}
|
|
3294
3395
|
dispose() {
|
|
3295
3396
|
if (!this.disposed) {
|
|
3296
3397
|
this.disposed = !0;
|
|
3297
|
-
for (const
|
|
3398
|
+
for (const t of this.activeEmitters.values()) t.dispose();
|
|
3298
3399
|
this.activeEmitters.clear(), this.activePreset$.dispose(), this.activeSplitsEmitter.dispose(), this.orderEmitter.dispose(), this.state$.dispose();
|
|
3299
3400
|
}
|
|
3300
3401
|
}
|
|
3301
|
-
requireKey(
|
|
3302
|
-
if (typeof
|
|
3303
|
-
throw new Error(`Unknown criterion key "${String(
|
|
3304
|
-
return
|
|
3402
|
+
requireKey(t) {
|
|
3403
|
+
if (typeof t != "string" || !this.byKey.has(t))
|
|
3404
|
+
throw new Error(`Unknown criterion key "${String(t)}"`);
|
|
3405
|
+
return t;
|
|
3305
3406
|
}
|
|
3306
3407
|
assertActive() {
|
|
3307
3408
|
if (this.disposed) throw new Error("Split selection model is disposed");
|
|
3308
3409
|
}
|
|
3309
3410
|
}
|
|
3310
|
-
function
|
|
3311
|
-
return new
|
|
3411
|
+
function Oi(e, t = {}) {
|
|
3412
|
+
return new mi(e, t);
|
|
3312
3413
|
}
|
|
3313
|
-
class
|
|
3414
|
+
class yi extends ct {
|
|
3314
3415
|
constructor(r, i) {
|
|
3315
3416
|
super(r.isActive(i) ? "visible" : "hidden", {
|
|
3316
3417
|
owner: r,
|
|
@@ -3342,45 +3443,45 @@ class fi extends Pe {
|
|
|
3342
3443
|
});
|
|
3343
3444
|
}
|
|
3344
3445
|
}
|
|
3345
|
-
function
|
|
3346
|
-
if (!Array.isArray(
|
|
3446
|
+
function gi(e, t) {
|
|
3447
|
+
if (!Array.isArray(e)) throw new TypeError("Split presets must be an array");
|
|
3347
3448
|
const r = /* @__PURE__ */ new Set();
|
|
3348
|
-
return Object.freeze(
|
|
3449
|
+
return Object.freeze(e.map((i) => {
|
|
3349
3450
|
if (i == null || typeof i != "object" || Array.isArray(i))
|
|
3350
3451
|
throw new TypeError("Split preset must be an object");
|
|
3351
3452
|
if (typeof i.key != "string" || i.key.trim() === "" || r.has(i.key))
|
|
3352
3453
|
throw new Error("Split preset keys must be non-empty and unique");
|
|
3353
3454
|
if (typeof i.label != "string" || i.label.trim() === "")
|
|
3354
3455
|
throw new TypeError("Split preset label must be a non-empty string");
|
|
3355
|
-
r.add(i.key),
|
|
3356
|
-
const n = Object.freeze([...i.active]), s = i.inactive == null ? Object.freeze([...
|
|
3357
|
-
if (
|
|
3456
|
+
r.add(i.key), te(i.active, t, `${i.key} active keys`);
|
|
3457
|
+
const n = Object.freeze([...i.active]), s = i.inactive == null ? Object.freeze([...t.keys()].filter((o) => !n.includes(o))) : Object.freeze([...i.inactive]);
|
|
3458
|
+
if (te(s, t, `${i.key} inactive keys`), (/* @__PURE__ */ new Set([...n, ...s])).size !== t.size || n.length + s.length !== t.size)
|
|
3358
3459
|
throw new Error(`Split preset "${i.key}" must cover every criterion exactly once`);
|
|
3359
3460
|
return Object.freeze({ ...i, active: n, inactive: s });
|
|
3360
3461
|
}));
|
|
3361
3462
|
}
|
|
3362
|
-
function
|
|
3363
|
-
if (!Array.isArray(
|
|
3364
|
-
if (new Set(
|
|
3365
|
-
for (const n of
|
|
3366
|
-
if (!
|
|
3463
|
+
function te(e, t, r) {
|
|
3464
|
+
if (!Array.isArray(e)) throw new TypeError(`${r} must be an array`);
|
|
3465
|
+
if (new Set(e).size !== e.length) throw new Error(`${r} must be unique`);
|
|
3466
|
+
for (const n of e)
|
|
3467
|
+
if (!t.has(n)) throw new Error(`${r} contains unknown criterion "${n}"`);
|
|
3367
3468
|
}
|
|
3368
|
-
function at(
|
|
3369
|
-
const r =
|
|
3370
|
-
if (r == null) throw new Error(`Missing criterion "${
|
|
3469
|
+
function at(e, t) {
|
|
3470
|
+
const r = e.get(t);
|
|
3471
|
+
if (r == null) throw new Error(`Missing criterion "${t}"`);
|
|
3371
3472
|
return r;
|
|
3372
3473
|
}
|
|
3373
|
-
function
|
|
3374
|
-
return Object.freeze({ order: Object.freeze([...
|
|
3474
|
+
function de(e, t) {
|
|
3475
|
+
return Object.freeze({ order: Object.freeze([...e]), active: new Set(t) });
|
|
3375
3476
|
}
|
|
3376
|
-
function
|
|
3377
|
-
return
|
|
3477
|
+
function bi(e, t) {
|
|
3478
|
+
return e.order.length === t.order.length && e.order.every((r, i) => r === t.order[i]) && e.active.size === t.active.size && [...e.active].every((r) => t.active.has(r));
|
|
3378
3479
|
}
|
|
3379
|
-
const
|
|
3480
|
+
const wi = [
|
|
3380
3481
|
["☐", "hidden"],
|
|
3381
3482
|
["✓", "visible"]
|
|
3382
3483
|
];
|
|
3383
|
-
class
|
|
3484
|
+
class pe extends Ne {
|
|
3384
3485
|
constructor() {
|
|
3385
3486
|
super(...arguments);
|
|
3386
3487
|
c(this, "draggingKey", null);
|
|
@@ -3401,9 +3502,9 @@ class de extends Ne {
|
|
|
3401
3502
|
} = this.props, o = this.read(r.order$);
|
|
3402
3503
|
this.read(r.activeSplits$);
|
|
3403
3504
|
const a = this.read(r.activePreset$), l = this.Host;
|
|
3404
|
-
return /* @__PURE__ */
|
|
3405
|
-
r.presets.length === 0 ? null : /* @__PURE__ */
|
|
3406
|
-
|
|
3505
|
+
return /* @__PURE__ */ y(l, { children: [
|
|
3506
|
+
r.presets.length === 0 ? null : /* @__PURE__ */ h(ze, { header: s, children: /* @__PURE__ */ h("cap-presets", { children: r.presets.map((u) => /* @__PURE__ */ h(
|
|
3507
|
+
fe,
|
|
3407
3508
|
{
|
|
3408
3509
|
label: u.label,
|
|
3409
3510
|
pressed: a === u.key,
|
|
@@ -3413,9 +3514,9 @@ class de extends Ne {
|
|
|
3413
3514
|
},
|
|
3414
3515
|
u.key
|
|
3415
3516
|
)) }) }),
|
|
3416
|
-
/* @__PURE__ */
|
|
3417
|
-
/* @__PURE__ */
|
|
3418
|
-
/* @__PURE__ */
|
|
3517
|
+
/* @__PURE__ */ y(ze, { header: i, children: [
|
|
3518
|
+
/* @__PURE__ */ h("p", { children: n }),
|
|
3519
|
+
/* @__PURE__ */ h("ol", { children: o.map((u) => /* @__PURE__ */ y(
|
|
3419
3520
|
"li",
|
|
3420
3521
|
{
|
|
3421
3522
|
className: this.draggingKey === u.key ? "dragging" : void 0,
|
|
@@ -3423,15 +3524,15 @@ class de extends Ne {
|
|
|
3423
3524
|
onPointerDown: (d) => this.startDragging(u.key, d),
|
|
3424
3525
|
onClick: (d) => this.suppressDraggedClick(d),
|
|
3425
3526
|
children: [
|
|
3426
|
-
/* @__PURE__ */
|
|
3427
|
-
|
|
3527
|
+
/* @__PURE__ */ h(
|
|
3528
|
+
me,
|
|
3428
3529
|
{
|
|
3429
|
-
symbols:
|
|
3530
|
+
symbols: wi,
|
|
3430
3531
|
label: u.label,
|
|
3431
3532
|
valueEmitter: r.activeState(u.key)
|
|
3432
3533
|
}
|
|
3433
3534
|
),
|
|
3434
|
-
/* @__PURE__ */
|
|
3535
|
+
/* @__PURE__ */ h(
|
|
3435
3536
|
"cap-draghandle",
|
|
3436
3537
|
{
|
|
3437
3538
|
role: "button",
|
|
@@ -3442,10 +3543,10 @@ class de extends Ne {
|
|
|
3442
3543
|
if (!d.altKey || d.key !== "ArrowUp" && d.key !== "ArrowDown")
|
|
3443
3544
|
return;
|
|
3444
3545
|
d.preventDefault();
|
|
3445
|
-
const
|
|
3446
|
-
if (r.moveBy(u.key,
|
|
3447
|
-
const
|
|
3448
|
-
this.announce(`${u.label} moved to position ${
|
|
3546
|
+
const p = d.key === "ArrowUp" ? -1 : 1;
|
|
3547
|
+
if (r.moveBy(u.key, p, "split reordered by keyboard")) {
|
|
3548
|
+
const b = r.order$.get().findIndex(({ key: w }) => w === u.key) + 1;
|
|
3549
|
+
this.announce(`${u.label} moved to position ${b}`), queueMicrotask(() => this.focusHandle(u.key));
|
|
3449
3550
|
}
|
|
3450
3551
|
}
|
|
3451
3552
|
}
|
|
@@ -3454,7 +3555,7 @@ class de extends Ne {
|
|
|
3454
3555
|
},
|
|
3455
3556
|
u.key
|
|
3456
3557
|
)) }),
|
|
3457
|
-
/* @__PURE__ */
|
|
3558
|
+
/* @__PURE__ */ h("p", { role: "status", "aria-live": "polite", "aria-atomic": "true", children: this.announcement })
|
|
3458
3559
|
] })
|
|
3459
3560
|
] });
|
|
3460
3561
|
}
|
|
@@ -3505,7 +3606,7 @@ class de extends Ne {
|
|
|
3505
3606
|
}
|
|
3506
3607
|
}
|
|
3507
3608
|
}
|
|
3508
|
-
c(
|
|
3609
|
+
c(pe, "liveProps", []), c(pe, "hostName", "split-selection-panel"), c(pe, "dependencies", [fe, me, ze]), c(pe, "css", ne`
|
|
3509
3610
|
& {
|
|
3510
3611
|
display: flex;
|
|
3511
3612
|
flex-flow: column nowrap;
|
|
@@ -3618,32 +3719,32 @@ c(de, "liveProps", []), c(de, "hostName", "split-selection-panel"), c(de, "depen
|
|
|
3618
3719
|
border: 0;
|
|
3619
3720
|
}
|
|
3620
3721
|
`);
|
|
3621
|
-
class
|
|
3622
|
-
constructor(
|
|
3722
|
+
class Ri {
|
|
3723
|
+
constructor(t) {
|
|
3623
3724
|
c(this, "categories");
|
|
3624
3725
|
c(this, "byKey");
|
|
3625
3726
|
c(this, "deltas", /* @__PURE__ */ new Map());
|
|
3626
|
-
if (!Array.isArray(
|
|
3627
|
-
const r =
|
|
3727
|
+
if (!Array.isArray(t)) throw new TypeError("Series categories must be an array");
|
|
3728
|
+
const r = t.map((n) => vi(n)), i = new Map(r.map((n) => [n.key, n]));
|
|
3628
3729
|
if (i.size !== r.length) throw new Error("Series category keys must be unique");
|
|
3629
3730
|
this.categories = Object.freeze(r), this.byKey = i;
|
|
3630
3731
|
}
|
|
3631
|
-
addOne(
|
|
3632
|
-
return this.add(
|
|
3732
|
+
addOne(t, r) {
|
|
3733
|
+
return this.add(t, r, 1);
|
|
3633
3734
|
}
|
|
3634
|
-
removeOne(
|
|
3635
|
-
return this.add(
|
|
3735
|
+
removeOne(t, r) {
|
|
3736
|
+
return this.add(t, r, -1);
|
|
3636
3737
|
}
|
|
3637
|
-
add(
|
|
3638
|
-
if (
|
|
3738
|
+
add(t, r, i) {
|
|
3739
|
+
if (x(t), !Number.isFinite(i)) throw new TypeError("Series delta must be finite");
|
|
3639
3740
|
if (!this.byKey.has(r))
|
|
3640
3741
|
throw new Error(`Unknown series category "${r}"`);
|
|
3641
3742
|
const n = this.deltas.get(r) ?? /* @__PURE__ */ new Map();
|
|
3642
|
-
return n.set(
|
|
3743
|
+
return n.set(t, (n.get(t) ?? 0) + i), this.deltas.set(r, n), this;
|
|
3643
3744
|
}
|
|
3644
3745
|
build() {
|
|
3645
|
-
const
|
|
3646
|
-
return this.categories.map((r) => lt(r, Object.fromEntries(
|
|
3746
|
+
const t = this.allDates();
|
|
3747
|
+
return this.categories.map((r) => lt(r, Object.fromEntries(t.map((i) => {
|
|
3647
3748
|
var n;
|
|
3648
3749
|
return [
|
|
3649
3750
|
i,
|
|
@@ -3652,74 +3753,74 @@ class zi {
|
|
|
3652
3753
|
})), !1)).filter((r) => Object.values(r.values).some((i) => i !== 0));
|
|
3653
3754
|
}
|
|
3654
3755
|
buildCumulative() {
|
|
3655
|
-
const
|
|
3656
|
-
if (
|
|
3657
|
-
const r = [
|
|
3756
|
+
const t = this.allDates();
|
|
3757
|
+
if (t.length === 0) return Object.freeze([]);
|
|
3758
|
+
const r = [ri(t[0], -1), ...t];
|
|
3658
3759
|
return this.categories.map((i) => {
|
|
3659
3760
|
var o;
|
|
3660
3761
|
let n = 0;
|
|
3661
3762
|
const s = { [r[0]]: 0 };
|
|
3662
|
-
for (const a of
|
|
3763
|
+
for (const a of t)
|
|
3663
3764
|
n += ((o = this.deltas.get(i.key)) == null ? void 0 : o.get(a)) ?? 0, s[a] = n;
|
|
3664
3765
|
return lt(i, s, !0);
|
|
3665
3766
|
}).filter((i) => Object.values(i.values).some((n) => n !== 0));
|
|
3666
3767
|
}
|
|
3667
3768
|
allDates() {
|
|
3668
|
-
return [...new Set([...this.deltas.values()].flatMap((
|
|
3769
|
+
return [...new Set([...this.deltas.values()].flatMap((t) => [...t.keys()]))].sort(ni);
|
|
3669
3770
|
}
|
|
3670
3771
|
}
|
|
3671
|
-
function
|
|
3672
|
-
if (
|
|
3772
|
+
function vi(e) {
|
|
3773
|
+
if (e == null || typeof e != "object")
|
|
3673
3774
|
throw new TypeError("Series category must be an object");
|
|
3674
|
-
if (typeof
|
|
3775
|
+
if (typeof e.key != "string" || e.key.trim() === "")
|
|
3675
3776
|
throw new TypeError("Series category key must be a non-empty string");
|
|
3676
|
-
if (typeof
|
|
3777
|
+
if (typeof e.label != "string" || e.label.trim() === "")
|
|
3677
3778
|
throw new TypeError("Series category label must be a non-empty string");
|
|
3678
|
-
const
|
|
3679
|
-
if (typeof
|
|
3779
|
+
const t = "color" in e ? e.color : e.colors[1];
|
|
3780
|
+
if (typeof t != "string" || t.trim() === "")
|
|
3680
3781
|
throw new TypeError("Series category color must be a non-empty CSS value");
|
|
3681
|
-
const r =
|
|
3782
|
+
const r = e.colorKey === void 0 ? { key: e.key, label: e.label, color: t } : { key: e.key, label: e.label, color: t, colorKey: e.colorKey };
|
|
3682
3783
|
return Object.freeze(r);
|
|
3683
3784
|
}
|
|
3684
|
-
function lt(
|
|
3785
|
+
function lt(e, t, r) {
|
|
3685
3786
|
return Object.freeze({
|
|
3686
|
-
...
|
|
3687
|
-
values: Object.freeze(
|
|
3787
|
+
...e,
|
|
3788
|
+
values: Object.freeze(t),
|
|
3688
3789
|
carryForward: r
|
|
3689
3790
|
});
|
|
3690
3791
|
}
|
|
3691
3792
|
export {
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3793
|
+
X as BlockGraph,
|
|
3794
|
+
nr as BlockSelectionModel,
|
|
3795
|
+
ue as CategoryHidePanel,
|
|
3796
|
+
ve as CollapsibleOptionGroup,
|
|
3797
|
+
V as GroupingCriterion,
|
|
3697
3798
|
je as LineGraph,
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3799
|
+
Ri as SeriesBuilder,
|
|
3800
|
+
mi as SplitSelectionModel,
|
|
3801
|
+
pe as SplitSelectionPanel,
|
|
3802
|
+
ri as addCivilDays,
|
|
3803
|
+
ai as areaPath,
|
|
3703
3804
|
Re as buildBlockLayout,
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3805
|
+
li as buildIntegerTicks,
|
|
3806
|
+
si as buildLineChartModel,
|
|
3807
|
+
ut as categoryColorVariables,
|
|
3808
|
+
zi as categoryCounts,
|
|
3809
|
+
x as civilDateToDay,
|
|
3810
|
+
ni as compareCivilDates,
|
|
3811
|
+
Ti as createBlockSelection,
|
|
3812
|
+
Oi as createSplitSelection,
|
|
3813
|
+
ir as criterionSnapshot,
|
|
3814
|
+
H as dayToCivilDate,
|
|
3815
|
+
Qt as deriveCategories,
|
|
3816
|
+
xi as derivedCriterion,
|
|
3817
|
+
Ci as filterByHidden,
|
|
3818
|
+
_ as findBlock,
|
|
3819
|
+
Pt as flattenBlocks,
|
|
3820
|
+
Kt as linePath,
|
|
3821
|
+
er as setsEqual,
|
|
3822
|
+
$i as staticCriterion,
|
|
3823
|
+
ii as todayCivilDate,
|
|
3824
|
+
oi as valueAtDate
|
|
3724
3825
|
};
|
|
3725
3826
|
//# sourceMappingURL=index.js.map
|