@sylwellsoftware/fray 0.6.0 → 0.7.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/README.md +164 -3
- package/dist/Components/component.d.ts.map +1 -1
- package/dist/Components/layout/tabpanel/tab.d.ts +2 -0
- package/dist/Components/layout/tabpanel/tab.d.ts.map +1 -1
- package/dist/Components/layout/tabpanel/tabline.d.ts.map +1 -1
- package/dist/Components/layout/tabpanel/tabpanel.d.ts +9 -1
- package/dist/Components/layout/tabpanel/tabpanel.d.ts.map +1 -1
- package/dist/Components/lineinputs/checkbox/Checkbox.d.ts +0 -1
- package/dist/Components/lineinputs/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/Components/lineinputs/radio.d.ts +51 -0
- package/dist/Components/lineinputs/radio.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2065 -841
- package/dist/index.js.map +1 -1
- package/dist/{jsx-dev-runtime-CqunwZ8j.js → jsx-dev-runtime-Kf1Dhu-y.js} +277 -252
- package/dist/jsx-dev-runtime-Kf1Dhu-y.js.map +1 -0
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/routing/RouteLink.d.ts +17 -0
- package/dist/routing/RouteLink.d.ts.map +1 -0
- package/dist/routing/RouteQuery.d.ts +18 -0
- package/dist/routing/RouteQuery.d.ts.map +1 -0
- package/dist/routing/RouteScope.d.ts +17 -0
- package/dist/routing/RouteScope.d.ts.map +1 -0
- package/dist/routing/RouteValue.d.ts +18 -0
- package/dist/routing/RouteValue.d.ts.map +1 -0
- package/dist/routing/navigationAdapter.d.ts +33 -0
- package/dist/routing/navigationAdapter.d.ts.map +1 -0
- package/dist/routing/route.d.ts +64 -0
- package/dist/routing/route.d.ts.map +1 -0
- package/dist/routing/router.d.ts +109 -0
- package/dist/routing/router.d.ts.map +1 -0
- package/dist/runtime.d.ts +5 -0
- package/dist/runtime.d.ts.map +1 -1
- package/package.json +3 -3
- package/styles/structural.css +166 -34
- package/themes/dark.css +13 -1
- package/themes/java/theme.css +14 -2
- package/themes/light.css +13 -1
- package/themes/minimal/theme.css +14 -2
- package/themes/shiny/theme.css +95 -87
- package/dist/jsx-dev-runtime-CqunwZ8j.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { C as
|
|
5
|
-
import {
|
|
6
|
-
import { Emitter as
|
|
7
|
-
class
|
|
1
|
+
var Rt = Object.defineProperty;
|
|
2
|
+
var Ct = (t, r, e) => r in t ? Rt(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var a = (t, r, e) => Ct(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { C as g, j as h, c as x, h as te, F as Le, a as w, i as de } from "./jsx-dev-runtime-Kf1Dhu-y.js";
|
|
5
|
+
import { b as Ti, S as Ri, d as Ci, e as $i, f as Oi, g as ji, k as Ai, l as Ni, m as qi, n as Di, p as zi, s as Li } from "./jsx-dev-runtime-Kf1Dhu-y.js";
|
|
6
|
+
import { Emitter as S, DerivedEmitter as ge, FetchState as k, QueryArg as Ge, LiveQuery as $t, RestQueryHandler as Ot } from "@sylwellsoftware/glue";
|
|
7
|
+
class ft extends g {
|
|
8
8
|
render() {
|
|
9
9
|
return this.props.children ?? [];
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const y = {
|
|
13
13
|
/** Deny mode: Excludes items that match the filter. */
|
|
14
14
|
Deny: "deny",
|
|
15
15
|
/** Require mode: Includes only items that match the filter. */
|
|
@@ -19,20 +19,20 @@ const b = {
|
|
|
19
19
|
/** Neutral mode: Does not affect the inclusion or exclusion of items. */
|
|
20
20
|
Neutral: "neutral"
|
|
21
21
|
};
|
|
22
|
-
function
|
|
23
|
-
return Object.values(
|
|
22
|
+
function ye(t) {
|
|
23
|
+
return Object.values(y).some((r) => r === t);
|
|
24
24
|
}
|
|
25
|
-
let
|
|
26
|
-
function
|
|
27
|
-
return r != null && String(r).length > 0 ? String(r) : `fray-${t}-${
|
|
25
|
+
let jt = 1;
|
|
26
|
+
function j(t, r) {
|
|
27
|
+
return r != null && String(r).length > 0 ? String(r) : `fray-${t}-${jt++}`;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function K(t, r, e, i) {
|
|
30
30
|
if (r.valueEmitter != null)
|
|
31
|
-
return
|
|
31
|
+
return At(r.valueEmitter, "valueEmitter"), r.valueEmitter;
|
|
32
32
|
const s = r.defaultValue ?? r.value ?? r.initialValue ?? e, n = { owner: t, purpose: i };
|
|
33
|
-
return new
|
|
33
|
+
return new S(s, n);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function At(t, r = "emitter") {
|
|
36
36
|
if (t == null || typeof t != "object" && typeof t != "function" || typeof Reflect.get(t, "get") != "function" || typeof Reflect.get(t, "set") != "function" || typeof Reflect.get(t, "subscribe") != "function")
|
|
37
37
|
throw new TypeError(`${r} must be an emitter`);
|
|
38
38
|
}
|
|
@@ -42,31 +42,31 @@ function R(...t) {
|
|
|
42
42
|
function E(t) {
|
|
43
43
|
return t.className ?? t.class ?? "";
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function C(t, ...r) {
|
|
46
46
|
if (t != null) {
|
|
47
47
|
if (typeof t != "function") throw new TypeError("Control callback must be a function");
|
|
48
48
|
t(...r);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function he(t, r = "options") {
|
|
52
52
|
if (!Array.isArray(t)) throw new TypeError(`${r} must be an array`);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
54
|
+
function Nt(t) {
|
|
55
|
+
return ye(t) ? t : String(t);
|
|
56
56
|
}
|
|
57
|
-
class
|
|
57
|
+
class U extends g {
|
|
58
58
|
constructor(e = {}) {
|
|
59
59
|
var n;
|
|
60
60
|
super(e);
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
a(this, "valueEmitter");
|
|
62
|
+
a(this, "activeTabEmitter");
|
|
63
63
|
const i = e.tabs ?? [];
|
|
64
|
-
|
|
64
|
+
Je(i);
|
|
65
65
|
const s = { ...e };
|
|
66
|
-
s.valueEmitter == null && e.activeTabEmitter != null && (s.valueEmitter = e.activeTabEmitter), s.defaultValue == null && e.initialActiveTabId != null && (s.defaultValue = e.initialActiveTabId), this.valueEmitter =
|
|
66
|
+
s.valueEmitter == null && e.activeTabEmitter != null && (s.valueEmitter = e.activeTabEmitter), s.defaultValue == null && e.initialActiveTabId != null && (s.defaultValue = e.initialActiveTabId), this.valueEmitter = K(
|
|
67
67
|
this,
|
|
68
68
|
s,
|
|
69
|
-
((n = i.find((
|
|
69
|
+
((n = i.find((o) => !o.disabled)) == null ? void 0 : n.id) ?? null,
|
|
70
70
|
"active tab"
|
|
71
71
|
), this.activeTabEmitter = this.valueEmitter;
|
|
72
72
|
}
|
|
@@ -74,30 +74,30 @@ class V extends y {
|
|
|
74
74
|
this.watch(this.valueEmitter);
|
|
75
75
|
}
|
|
76
76
|
selectTab(e, i = null) {
|
|
77
|
-
e == null || e.disabled || (this.valueEmitter.set(e.id, "tab selected"),
|
|
77
|
+
e == null || e.disabled || (this.props.onSelectTab == null ? this.valueEmitter.set(e.id, "tab selected") : this.props.onSelectTab(e, i), C(this.props.onChange, e.id, i));
|
|
78
78
|
}
|
|
79
79
|
render() {
|
|
80
80
|
const { tabs: e = [], label: i = "Sections", baseId: s = "fray-tabs" } = this.props;
|
|
81
|
-
|
|
82
|
-
const n = this.valueEmitter.get(),
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
|
|
81
|
+
Je(e);
|
|
82
|
+
const n = this.valueEmitter.get(), o = this.Host;
|
|
83
|
+
return /* @__PURE__ */ h(
|
|
84
|
+
o,
|
|
85
85
|
{
|
|
86
86
|
role: "tablist",
|
|
87
87
|
className: E(this.props) || null,
|
|
88
88
|
"aria-label": i,
|
|
89
|
-
children: e.map((l, c) => /* @__PURE__ */
|
|
89
|
+
children: e.map((l, c) => /* @__PURE__ */ h(
|
|
90
90
|
"button",
|
|
91
91
|
{
|
|
92
|
-
id:
|
|
92
|
+
id: mt(s, l.id),
|
|
93
93
|
type: "button",
|
|
94
94
|
role: "tab",
|
|
95
95
|
disabled: !!l.disabled,
|
|
96
96
|
"aria-selected": Object.is(n, l.id) ? "true" : "false",
|
|
97
|
-
"aria-controls":
|
|
97
|
+
"aria-controls": bt(s, l.id),
|
|
98
98
|
tabIndex: Object.is(n, l.id) ? 0 : -1,
|
|
99
|
-
onClick: (
|
|
100
|
-
onKeyDown: (
|
|
99
|
+
onClick: (u) => this.selectTab(l, u),
|
|
100
|
+
onKeyDown: (u) => this.handleKeyDown(u, c, e),
|
|
101
101
|
children: l.label ?? String(l.id)
|
|
102
102
|
},
|
|
103
103
|
String(l.id)
|
|
@@ -106,17 +106,17 @@ class V extends y {
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
handleKeyDown(e, i, s) {
|
|
109
|
-
const n = s.map((c,
|
|
109
|
+
const n = s.map((c, u) => ({ tab: c, tabIndex: u })).filter(({ tab: c }) => !c.disabled);
|
|
110
110
|
if (n.length === 0) return;
|
|
111
|
-
const
|
|
111
|
+
const o = Math.max(
|
|
112
112
|
0,
|
|
113
113
|
n.findIndex(({ tabIndex: c }) => c === i)
|
|
114
114
|
);
|
|
115
115
|
let l;
|
|
116
116
|
if (e.key === "ArrowRight" || e.key === "ArrowDown")
|
|
117
|
-
l = n[(
|
|
117
|
+
l = n[(o + 1) % n.length];
|
|
118
118
|
else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
|
|
119
|
-
l = n[(
|
|
119
|
+
l = n[(o - 1 + n.length) % n.length];
|
|
120
120
|
else if (e.key === "Home") l = n[0];
|
|
121
121
|
else if (e.key === "End") l = n.at(-1);
|
|
122
122
|
else return;
|
|
@@ -126,25 +126,25 @@ class V extends y {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
a(U, "hostName", "tab-line"), a(U, "standaloneHostName", "tab-line"), a(U, "baseStyles", [
|
|
130
130
|
['& > button[role="tab"]', ["uiline", "button"]]
|
|
131
|
-
]),
|
|
131
|
+
]), a(U, "css", x`
|
|
132
132
|
& {
|
|
133
133
|
display: flex;
|
|
134
134
|
flex-flow: row wrap;
|
|
135
135
|
padding-top: 3px;
|
|
136
136
|
}
|
|
137
137
|
`);
|
|
138
|
-
function
|
|
139
|
-
return `${t}-tab-${
|
|
138
|
+
function mt(t, r) {
|
|
139
|
+
return `${t}-tab-${gt(r)}`;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
return `${t}-panel-${
|
|
141
|
+
function bt(t, r) {
|
|
142
|
+
return `${t}-panel-${gt(r)}`;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function gt(t) {
|
|
145
145
|
return encodeURIComponent(String(t)).replaceAll("%", "-");
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Je(t) {
|
|
148
148
|
if (!Array.isArray(t)) throw new TypeError("TabLine tabs must be an array");
|
|
149
149
|
const r = /* @__PURE__ */ new Set();
|
|
150
150
|
for (const e of t) {
|
|
@@ -153,60 +153,87 @@ function Te(t) {
|
|
|
153
153
|
r.add(e.id);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
class
|
|
156
|
+
class je extends g {
|
|
157
|
+
constructor() {
|
|
158
|
+
super(...arguments);
|
|
159
|
+
a(this, "closeScope", null);
|
|
160
|
+
}
|
|
161
|
+
initialize() {
|
|
162
|
+
const e = this._runtime.router;
|
|
163
|
+
if (e == null) throw new Error("RouteScope requires a router in FrayRuntime");
|
|
164
|
+
this.closeScope = e.openScope(this.props.context, this);
|
|
165
|
+
}
|
|
166
|
+
render() {
|
|
167
|
+
return te(Le, null, this.props.children ?? []);
|
|
168
|
+
}
|
|
169
|
+
afterMount() {
|
|
170
|
+
var e;
|
|
171
|
+
(e = this._runtime.router) == null || e.completeScope(this.props.context, this);
|
|
172
|
+
}
|
|
173
|
+
_routeContextForChildren() {
|
|
174
|
+
return this.props.context;
|
|
175
|
+
}
|
|
176
|
+
onDestroy() {
|
|
177
|
+
var e;
|
|
178
|
+
(e = this.closeScope) == null || e.call(this), this.closeScope = null;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
class re extends g {
|
|
157
182
|
constructor(e = {}) {
|
|
158
183
|
var n;
|
|
159
184
|
super(e);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
185
|
+
a(this, "valueEmitter");
|
|
186
|
+
a(this, "activeTabEmitter");
|
|
187
|
+
a(this, "baseId");
|
|
188
|
+
a(this, "routeContexts", /* @__PURE__ */ new Map());
|
|
189
|
+
const i = J(e), s = { ...e };
|
|
190
|
+
s.valueEmitter == null && e.activeTabEmitter != null && (s.valueEmitter = e.activeTabEmitter), s.defaultValue == null && e.initialActiveTabId != null && (s.defaultValue = e.initialActiveTabId), this.valueEmitter = K(
|
|
165
191
|
this,
|
|
166
192
|
s,
|
|
167
|
-
((n = i.find((
|
|
193
|
+
((n = i.find((o) => !o.disabled)) == null ? void 0 : n.id) ?? null,
|
|
168
194
|
"active tab"
|
|
169
|
-
), this.activeTabEmitter = this.valueEmitter, this.baseId =
|
|
195
|
+
), this.activeTabEmitter = this.valueEmitter, this.baseId = j("tabs", e.id);
|
|
170
196
|
}
|
|
171
197
|
initialize() {
|
|
172
198
|
var i;
|
|
173
|
-
const e =
|
|
174
|
-
e.some(({ id: s }) => Object.is(s, this.valueEmitter.get())) || this.valueEmitter.set(((i = e.find((s) => !s.disabled)) == null ? void 0 : i.id) ?? null), this.watch(this.valueEmitter);
|
|
199
|
+
const e = J(this.props);
|
|
200
|
+
e.some(({ id: s }) => Object.is(s, this.valueEmitter.get())) || this.valueEmitter.set(((i = e.find((s) => !s.disabled)) == null ? void 0 : i.id) ?? null), this.registerRoutes(e), this.watch(this.valueEmitter);
|
|
175
201
|
}
|
|
176
202
|
setProps(e) {
|
|
177
203
|
var s;
|
|
178
204
|
super.setProps(e);
|
|
179
|
-
const i =
|
|
180
|
-
return i.some(({ id: n }) => Object.is(n, this.valueEmitter.get())) || this.valueEmitter.set(((s = i.find((n) => !n.disabled)) == null ? void 0 : s.id) ?? null), this;
|
|
205
|
+
const i = J(e);
|
|
206
|
+
return i.some(({ id: n }) => Object.is(n, this.valueEmitter.get())) || this.valueEmitter.set(((s = i.find((n) => !n.disabled)) == null ? void 0 : s.id) ?? null), this.registerRoutes(i), this;
|
|
181
207
|
}
|
|
182
208
|
render() {
|
|
183
|
-
const e =
|
|
209
|
+
const e = J(this.props), i = e.find(({ id: n }) => Object.is(n, this.valueEmitter.get())) ?? e.find((n) => !n.disabled) ?? null, s = this.Host;
|
|
184
210
|
return /* @__PURE__ */ w(
|
|
185
211
|
s,
|
|
186
212
|
{
|
|
187
213
|
id: this.baseId,
|
|
188
214
|
className: R("panellike", E(this.props)),
|
|
189
215
|
children: [
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
|
|
216
|
+
/* @__PURE__ */ h(
|
|
217
|
+
U,
|
|
192
218
|
{
|
|
193
|
-
tabs: e.map(({ id: n, label:
|
|
219
|
+
tabs: e.map(({ id: n, label: o, disabled: l }) => ({ id: n, label: o, disabled: l })),
|
|
194
220
|
valueEmitter: this.valueEmitter,
|
|
195
221
|
baseId: this.baseId,
|
|
196
222
|
...this.props.label == null ? {} : { label: this.props.label },
|
|
197
|
-
...this.props.onChange == null ? {} : { onChange: this.props.onChange }
|
|
223
|
+
...this.props.onChange == null ? {} : { onChange: this.props.onChange },
|
|
224
|
+
onSelectTab: (n, o) => this.selectTab(n, o)
|
|
198
225
|
},
|
|
199
226
|
"tab-list"
|
|
200
227
|
),
|
|
201
|
-
i == null ? null : /* @__PURE__ */
|
|
228
|
+
i == null ? null : /* @__PURE__ */ h(
|
|
202
229
|
"div",
|
|
203
230
|
{
|
|
204
|
-
id:
|
|
231
|
+
id: bt(this.baseId, i.id),
|
|
205
232
|
role: "tabpanel",
|
|
206
233
|
"data-part": "content",
|
|
207
|
-
"aria-labelledby":
|
|
234
|
+
"aria-labelledby": mt(this.baseId, i.id),
|
|
208
235
|
tabIndex: 0,
|
|
209
|
-
children: i
|
|
236
|
+
children: this.routedContent(i)
|
|
210
237
|
},
|
|
211
238
|
String(i.id)
|
|
212
239
|
)
|
|
@@ -214,8 +241,41 @@ class _ extends y {
|
|
|
214
241
|
}
|
|
215
242
|
);
|
|
216
243
|
}
|
|
244
|
+
onDestroy() {
|
|
245
|
+
var e;
|
|
246
|
+
(e = this._runtime.router) == null || e.unregisterRoutes(this._routeContext ?? this._runtime.router.root, this), this.routeContexts.clear();
|
|
247
|
+
}
|
|
248
|
+
registerRoutes(e) {
|
|
249
|
+
const i = e.filter((o) => o.route != null), s = this._runtime.router, n = this._routeContext;
|
|
250
|
+
if (s != null && n != null && s.unregisterRoutes(n, this), this.routeContexts.clear(), i.length !== 0) {
|
|
251
|
+
if (s == null || n == null)
|
|
252
|
+
throw new Error("Routed tabs require a router and contextual route scope");
|
|
253
|
+
this.routeContexts = new Map(s.registerSelectionRoutes(
|
|
254
|
+
n,
|
|
255
|
+
this,
|
|
256
|
+
i.map((o) => ({
|
|
257
|
+
route: o.route,
|
|
258
|
+
disabled: o.disabled,
|
|
259
|
+
active: () => Object.is(this.valueEmitter.get(), o.id),
|
|
260
|
+
activate: () => {
|
|
261
|
+
this.valueEmitter.set(o.id, "route tab restored");
|
|
262
|
+
}
|
|
263
|
+
})),
|
|
264
|
+
(o) => this.valueEmitter.subscribe(o, { emitCurrent: !1 })
|
|
265
|
+
));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
selectTab(e, i) {
|
|
269
|
+
var o;
|
|
270
|
+
const s = J(this.props).find(({ id: l }) => Object.is(l, e.id)), n = (s == null ? void 0 : s.route) == null ? null : this.routeContexts.get(s.route);
|
|
271
|
+
n == null ? this.valueEmitter.set(e.id, "tab selected") : (o = this._runtime.router) == null || o.navigate(n);
|
|
272
|
+
}
|
|
273
|
+
routedContent(e) {
|
|
274
|
+
const i = e.route == null ? null : this.routeContexts.get(e.route);
|
|
275
|
+
return i == null ? e.content : /* @__PURE__ */ h(je, { context: i, children: e.content }, i.pathname);
|
|
276
|
+
}
|
|
217
277
|
}
|
|
218
|
-
|
|
278
|
+
a(re, "dependencies", [je, U, ft]), a(re, "hostName", "tab-panel"), a(re, "standaloneHostName", "tab-panel"), a(re, "css", x`
|
|
219
279
|
& {
|
|
220
280
|
display: flex;
|
|
221
281
|
flex-direction: column;
|
|
@@ -231,37 +291,39 @@ o(_, "dependencies", [V, qe]), o(_, "hostName", "tab-panel"), o(_, "standaloneHo
|
|
|
231
291
|
overflow: auto;
|
|
232
292
|
}
|
|
233
293
|
`);
|
|
234
|
-
function
|
|
294
|
+
function J(t) {
|
|
235
295
|
const r = t.tabs ?? [];
|
|
236
296
|
if (!Array.isArray(r)) throw new TypeError("TabPanel tabs must be an array");
|
|
237
|
-
const i = (Array.isArray(t.children) ? t.children : t.children == null ? [] : [t.children]).filter((
|
|
238
|
-
if (!
|
|
239
|
-
const c =
|
|
297
|
+
const i = (Array.isArray(t.children) ? t.children : t.children == null ? [] : [t.children]).filter((o) => de(o) && o.type === ft).map((o, l) => {
|
|
298
|
+
if (!de(o)) throw new TypeError("TabPanel children must be Tab nodes");
|
|
299
|
+
const c = o.props;
|
|
240
300
|
return {
|
|
241
301
|
id: c.id ?? `tab-${l + 1}`,
|
|
242
302
|
label: c.label ?? `Tab ${l + 1}`,
|
|
243
303
|
disabled: !!c.disabled,
|
|
244
|
-
content: c.children ?? []
|
|
304
|
+
content: c.children ?? [],
|
|
305
|
+
...c.route == null ? {} : { route: c.route }
|
|
245
306
|
};
|
|
246
|
-
}), s = r.length > 0 ? r.map((
|
|
247
|
-
...
|
|
248
|
-
label:
|
|
249
|
-
disabled: !!
|
|
250
|
-
content:
|
|
307
|
+
}), s = r.length > 0 ? r.map((o) => ({
|
|
308
|
+
...o,
|
|
309
|
+
label: o.label ?? String(o.id),
|
|
310
|
+
disabled: !!o.disabled,
|
|
311
|
+
content: o.content ?? o.component ?? [],
|
|
312
|
+
...o.route == null ? {} : { route: o.route }
|
|
251
313
|
})) : i, n = /* @__PURE__ */ new Set();
|
|
252
|
-
for (const
|
|
253
|
-
if ((
|
|
254
|
-
if (n.has(
|
|
255
|
-
n.add(
|
|
314
|
+
for (const o of s) {
|
|
315
|
+
if ((o == null ? void 0 : o.id) == null) throw new TypeError("Each tab requires an id");
|
|
316
|
+
if (n.has(o.id)) throw new Error(`Duplicate tab id: ${String(o.id)}`);
|
|
317
|
+
n.add(o.id);
|
|
256
318
|
}
|
|
257
319
|
return s;
|
|
258
320
|
}
|
|
259
|
-
class
|
|
321
|
+
class Ee extends g {
|
|
260
322
|
constructor(e = {}) {
|
|
261
323
|
super(e);
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
this.panelId =
|
|
324
|
+
a(this, "panelId");
|
|
325
|
+
a(this, "headerId");
|
|
326
|
+
this.panelId = j("panel", e.id), this.headerId = `${this.panelId}-title`;
|
|
265
327
|
}
|
|
266
328
|
render() {
|
|
267
329
|
const {
|
|
@@ -269,11 +331,11 @@ class ce extends y {
|
|
|
269
331
|
toolbar: i = null,
|
|
270
332
|
children: s = [],
|
|
271
333
|
orientation: n = "vertical",
|
|
272
|
-
disabled:
|
|
334
|
+
disabled: o = !1
|
|
273
335
|
} = this.props;
|
|
274
336
|
if (!["horizontal", "vertical"].includes(n))
|
|
275
337
|
throw new TypeError("Panel orientation must be horizontal or vertical");
|
|
276
|
-
const l = this.Host, c = e == null ? null : /* @__PURE__ */
|
|
338
|
+
const l = this.Host, c = e == null ? null : /* @__PURE__ */ h("header", { children: typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ h("h2", { id: this.headerId, children: e }) : /* @__PURE__ */ h("div", { id: this.headerId, children: e }) });
|
|
277
339
|
return /* @__PURE__ */ w(
|
|
278
340
|
l,
|
|
279
341
|
{
|
|
@@ -281,19 +343,19 @@ class ce extends y {
|
|
|
281
343
|
role: e == null ? null : "region",
|
|
282
344
|
className: R("panellike", E(this.props)),
|
|
283
345
|
"data-orientation": n,
|
|
284
|
-
"data-disabled":
|
|
285
|
-
"aria-disabled":
|
|
346
|
+
"data-disabled": o ? "" : null,
|
|
347
|
+
"aria-disabled": o ? "true" : null,
|
|
286
348
|
"aria-labelledby": e == null ? null : this.headerId,
|
|
287
349
|
children: [
|
|
288
350
|
c,
|
|
289
351
|
i,
|
|
290
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ h("div", { "data-part": "content", "data-orientation": n, children: s })
|
|
291
353
|
]
|
|
292
354
|
}
|
|
293
355
|
);
|
|
294
356
|
}
|
|
295
357
|
}
|
|
296
|
-
|
|
358
|
+
a(Ee, "hostName", "panel"), a(Ee, "standaloneHostName", "layout-panel"), a(Ee, "css", x`
|
|
297
359
|
& {
|
|
298
360
|
display: flex;
|
|
299
361
|
flex-direction: column;
|
|
@@ -322,12 +384,12 @@ o(ce, "hostName", "panel"), o(ce, "standaloneHostName", "layout-panel"), o(ce, "
|
|
|
322
384
|
flex-direction: column;
|
|
323
385
|
}
|
|
324
386
|
`);
|
|
325
|
-
class
|
|
387
|
+
class qt extends g {
|
|
326
388
|
constructor(e = {}) {
|
|
327
389
|
super(e);
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
this.sidebarId =
|
|
390
|
+
a(this, "sidebarId");
|
|
391
|
+
a(this, "headerId");
|
|
392
|
+
this.sidebarId = j("sidebar", e.id), this.headerId = `${this.sidebarId}-title`;
|
|
331
393
|
}
|
|
332
394
|
render() {
|
|
333
395
|
const {
|
|
@@ -335,7 +397,7 @@ class st extends y {
|
|
|
335
397
|
toolbar: i = null,
|
|
336
398
|
ariaLabel: s,
|
|
337
399
|
children: n = []
|
|
338
|
-
} = this.props,
|
|
400
|
+
} = this.props, o = e == null ? null : /* @__PURE__ */ h("header", { children: typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ h("h2", { id: this.headerId, children: e }) : /* @__PURE__ */ h("div", { id: this.headerId, children: e }) });
|
|
339
401
|
return /* @__PURE__ */ w(
|
|
340
402
|
"aside",
|
|
341
403
|
{
|
|
@@ -345,15 +407,15 @@ class st extends y {
|
|
|
345
407
|
"aria-label": e == null ? s : null,
|
|
346
408
|
"aria-labelledby": e == null ? null : this.headerId,
|
|
347
409
|
children: [
|
|
348
|
-
|
|
349
|
-
i == null ? null : /* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
410
|
+
o,
|
|
411
|
+
i == null ? null : /* @__PURE__ */ h("div", { "data-part": "toolbar", children: i }),
|
|
412
|
+
/* @__PURE__ */ h("div", { "data-part": "content", tabIndex: 0, children: n })
|
|
351
413
|
]
|
|
352
414
|
}
|
|
353
415
|
);
|
|
354
416
|
}
|
|
355
417
|
}
|
|
356
|
-
|
|
418
|
+
a(qt, "css", x`
|
|
357
419
|
aside {
|
|
358
420
|
display: flex;
|
|
359
421
|
flex-direction: column;
|
|
@@ -380,7 +442,7 @@ o(st, "css", S`
|
|
|
380
442
|
overflow-y: auto;
|
|
381
443
|
}
|
|
382
444
|
`);
|
|
383
|
-
class
|
|
445
|
+
class xe extends g {
|
|
384
446
|
render() {
|
|
385
447
|
const {
|
|
386
448
|
primary: r = null,
|
|
@@ -388,7 +450,7 @@ class de extends y {
|
|
|
388
450
|
direction: i = "horizontal",
|
|
389
451
|
primarySize: s,
|
|
390
452
|
primaryLabel: n,
|
|
391
|
-
secondaryLabel:
|
|
453
|
+
secondaryLabel: o
|
|
392
454
|
} = this.props;
|
|
393
455
|
if (i !== "horizontal" && i !== "vertical")
|
|
394
456
|
throw new TypeError("SplitView direction must be horizontal or vertical");
|
|
@@ -402,7 +464,7 @@ class de extends y {
|
|
|
402
464
|
"data-direction": i,
|
|
403
465
|
style: s == null ? void 0 : { "--split-primary-size": s },
|
|
404
466
|
children: [
|
|
405
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ h(
|
|
406
468
|
"div",
|
|
407
469
|
{
|
|
408
470
|
"data-part": "primary",
|
|
@@ -411,12 +473,12 @@ class de extends y {
|
|
|
411
473
|
children: r
|
|
412
474
|
}
|
|
413
475
|
),
|
|
414
|
-
/* @__PURE__ */
|
|
476
|
+
/* @__PURE__ */ h(
|
|
415
477
|
"div",
|
|
416
478
|
{
|
|
417
479
|
"data-part": "secondary",
|
|
418
|
-
role:
|
|
419
|
-
"aria-label":
|
|
480
|
+
role: o == null ? null : "region",
|
|
481
|
+
"aria-label": o,
|
|
420
482
|
children: e ?? this.props.children ?? []
|
|
421
483
|
}
|
|
422
484
|
)
|
|
@@ -425,7 +487,7 @@ class de extends y {
|
|
|
425
487
|
);
|
|
426
488
|
}
|
|
427
489
|
}
|
|
428
|
-
|
|
490
|
+
a(xe, "hostName", "split-view"), a(xe, "standaloneHostName", "split-view"), a(xe, "css", x`
|
|
429
491
|
& {
|
|
430
492
|
display: grid;
|
|
431
493
|
flex: 1 1 auto;
|
|
@@ -460,7 +522,7 @@ o(de, "hostName", "split-view"), o(de, "standaloneHostName", "split-view"), o(de
|
|
|
460
522
|
border-block-end: 1px solid var(--ui-border-color);
|
|
461
523
|
}
|
|
462
524
|
`);
|
|
463
|
-
class
|
|
525
|
+
class yt extends g {
|
|
464
526
|
render() {
|
|
465
527
|
const { term: r, value: e, children: i = [] } = this.props;
|
|
466
528
|
return /* @__PURE__ */ w(
|
|
@@ -469,14 +531,14 @@ class Pe extends y {
|
|
|
469
531
|
className: E(this.props) || void 0,
|
|
470
532
|
"data-fray-component": "description-item",
|
|
471
533
|
children: [
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
/* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ h("dt", { children: r }),
|
|
535
|
+
/* @__PURE__ */ h("dd", { children: e ?? i })
|
|
474
536
|
]
|
|
475
537
|
}
|
|
476
538
|
);
|
|
477
539
|
}
|
|
478
540
|
}
|
|
479
|
-
|
|
541
|
+
a(yt, "css", x`
|
|
480
542
|
div:has(> dt + dd) {
|
|
481
543
|
display: grid;
|
|
482
544
|
grid-template-columns: minmax(7rem, 0.7fr) minmax(0, 1.3fr);
|
|
@@ -497,9 +559,9 @@ o(Pe, "css", S`
|
|
|
497
559
|
}
|
|
498
560
|
}
|
|
499
561
|
`);
|
|
500
|
-
class
|
|
562
|
+
class Ze extends g {
|
|
501
563
|
render() {
|
|
502
|
-
return /* @__PURE__ */
|
|
564
|
+
return /* @__PURE__ */ h(
|
|
503
565
|
"dl",
|
|
504
566
|
{
|
|
505
567
|
className: R("datacomponentlike", E(this.props)),
|
|
@@ -510,21 +572,21 @@ class Re extends y {
|
|
|
510
572
|
);
|
|
511
573
|
}
|
|
512
574
|
}
|
|
513
|
-
|
|
575
|
+
a(Ze, "dependencies", [yt]), a(Ze, "css", x`
|
|
514
576
|
dl:has(> div > dt + dd) {
|
|
515
577
|
display: grid;
|
|
516
578
|
margin: 0;
|
|
517
579
|
}
|
|
518
580
|
`);
|
|
519
|
-
class
|
|
581
|
+
class H extends g {
|
|
520
582
|
render() {
|
|
521
|
-
const r =
|
|
522
|
-
return /* @__PURE__ */
|
|
583
|
+
const r = Dt(this.props.width ?? 65), e = this.Host;
|
|
584
|
+
return /* @__PURE__ */ h(e, { style: { width: `${r}%` }, "aria-hidden": "true" });
|
|
523
585
|
}
|
|
524
586
|
}
|
|
525
|
-
|
|
587
|
+
a(H, "hostName", "placeholder"), a(H, "standaloneHostName", "loading-placeholder"), a(H, "baseStyles", [
|
|
526
588
|
["&::after", ["after", "working"]]
|
|
527
|
-
]),
|
|
589
|
+
]), a(H, "css", x`
|
|
528
590
|
& {
|
|
529
591
|
display: block;
|
|
530
592
|
min-width: 3rem;
|
|
@@ -541,48 +603,48 @@ o(M, "hostName", "placeholder"), o(M, "standaloneHostName", "loading-placeholder
|
|
|
541
603
|
to { background-position: 2rem 0; }
|
|
542
604
|
}
|
|
543
605
|
`);
|
|
544
|
-
function
|
|
606
|
+
function Dt(t) {
|
|
545
607
|
const r = Number(t);
|
|
546
608
|
if (!Number.isFinite(r)) throw new TypeError("Placeholder width must be numeric");
|
|
547
609
|
return Math.min(100, Math.max(10, r));
|
|
548
610
|
}
|
|
549
|
-
function
|
|
550
|
-
|
|
611
|
+
function wt(t, r, e) {
|
|
612
|
+
Ke(e);
|
|
551
613
|
for (const i of e) {
|
|
552
614
|
const s = r[i.key];
|
|
553
615
|
if (s == null) continue;
|
|
554
616
|
const n = i.options.flatMap((c) => {
|
|
555
|
-
const
|
|
556
|
-
return
|
|
617
|
+
const u = s[c.key];
|
|
618
|
+
return u == null || u === y.Neutral ? [] : [{ option: c, mode: u }];
|
|
557
619
|
});
|
|
558
|
-
if (n.some(({ option: c, mode:
|
|
620
|
+
if (n.some(({ option: c, mode: u }) => u === y.Deny && c.matches(t)) || n.filter(({ mode: c }) => c === y.Require).some(({ option: c }) => !c.matches(t)))
|
|
559
621
|
return !1;
|
|
560
|
-
const l = n.filter(({ mode: c }) => c ===
|
|
622
|
+
const l = n.filter(({ mode: c }) => c === y.Prefer);
|
|
561
623
|
if (l.length > 0 && !l.some(({ option: c }) => c.matches(t)))
|
|
562
624
|
return !1;
|
|
563
625
|
}
|
|
564
626
|
return !0;
|
|
565
627
|
}
|
|
566
|
-
function
|
|
628
|
+
function zt(t, r, e) {
|
|
567
629
|
if (!Array.isArray(t)) throw new TypeError("Filtered items must be an array");
|
|
568
|
-
return t.filter((i) =>
|
|
630
|
+
return t.filter((i) => wt(i, r, e));
|
|
569
631
|
}
|
|
570
|
-
function
|
|
571
|
-
return
|
|
632
|
+
function Xr(t, r, e = null) {
|
|
633
|
+
return Ke(r), new ge(
|
|
572
634
|
[t],
|
|
573
|
-
([i]) => (s) =>
|
|
635
|
+
([i]) => (s) => wt(s, i, r),
|
|
574
636
|
{ owner: e, purpose: "filter predicate" }
|
|
575
637
|
);
|
|
576
638
|
}
|
|
577
|
-
function
|
|
578
|
-
return
|
|
639
|
+
function Yr(t, r, e, i = null) {
|
|
640
|
+
return Ke(e), new ge(
|
|
579
641
|
[t, r],
|
|
580
|
-
([s, n]) =>
|
|
642
|
+
([s, n]) => zt(s, n, e),
|
|
581
643
|
{ owner: i, purpose: "filtered items" }
|
|
582
644
|
);
|
|
583
645
|
}
|
|
584
|
-
function
|
|
585
|
-
|
|
646
|
+
function ei(t) {
|
|
647
|
+
Lt(t);
|
|
586
648
|
const r = {};
|
|
587
649
|
for (const e of Object.keys(t).sort()) {
|
|
588
650
|
const i = {}, s = t[e];
|
|
@@ -592,98 +654,98 @@ function ar(t) {
|
|
|
592
654
|
}
|
|
593
655
|
return { version: 1, dimensions: r };
|
|
594
656
|
}
|
|
595
|
-
function
|
|
596
|
-
if (!
|
|
657
|
+
function ti(t) {
|
|
658
|
+
if (!X(t) || t.version !== 1 || !X(t.dimensions))
|
|
597
659
|
throw new TypeError("Filter state must use version 1 with a dimensions object");
|
|
598
660
|
const r = {};
|
|
599
661
|
for (const [e, i] of Object.entries(t.dimensions)) {
|
|
600
|
-
if (
|
|
662
|
+
if (_(e, "Filter dimension"), !X(i))
|
|
601
663
|
throw new TypeError(`Filter dimension ${e} must be an object`);
|
|
602
664
|
const s = {};
|
|
603
|
-
for (const [n,
|
|
604
|
-
if (
|
|
665
|
+
for (const [n, o] of Object.entries(i)) {
|
|
666
|
+
if (_(n, `Filter option in ${e}`), !ye(o))
|
|
605
667
|
throw new TypeError(
|
|
606
|
-
`Unknown filter mode for ${e}.${n}: ${String(
|
|
668
|
+
`Unknown filter mode for ${e}.${n}: ${String(o)}`
|
|
607
669
|
);
|
|
608
|
-
s[n] =
|
|
670
|
+
s[n] = o;
|
|
609
671
|
}
|
|
610
672
|
r[e] = s;
|
|
611
673
|
}
|
|
612
674
|
return r;
|
|
613
675
|
}
|
|
614
|
-
function
|
|
615
|
-
if (!
|
|
676
|
+
function Lt(t) {
|
|
677
|
+
if (!X(t)) throw new TypeError("Filter state must be an object");
|
|
616
678
|
for (const [r, e] of Object.entries(t)) {
|
|
617
|
-
if (
|
|
679
|
+
if (_(r, "Filter dimension"), !X(e))
|
|
618
680
|
throw new TypeError(`Filter dimension ${r} must be an object`);
|
|
619
681
|
for (const [i, s] of Object.entries(e))
|
|
620
|
-
if (
|
|
682
|
+
if (_(i, `Filter option in ${r}`), !ye(s))
|
|
621
683
|
throw new TypeError(
|
|
622
684
|
`Unknown filter mode for ${r}.${i}: ${String(s)}`
|
|
623
685
|
);
|
|
624
686
|
}
|
|
625
687
|
}
|
|
626
|
-
function
|
|
688
|
+
function Ke(t) {
|
|
627
689
|
if (!Array.isArray(t)) throw new TypeError("Filter dimensions must be an array");
|
|
628
690
|
const r = /* @__PURE__ */ new Set();
|
|
629
691
|
for (const e of t) {
|
|
630
|
-
if (
|
|
692
|
+
if (_(e.key, "Filter dimension"), r.has(e.key))
|
|
631
693
|
throw new Error(`Duplicate filter dimension: ${e.key}`);
|
|
632
694
|
if (r.add(e.key), !Array.isArray(e.options))
|
|
633
695
|
throw new TypeError(`Filter dimension ${e.key} options must be an array`);
|
|
634
696
|
const i = /* @__PURE__ */ new Set();
|
|
635
697
|
for (const s of e.options) {
|
|
636
|
-
if (
|
|
698
|
+
if (_(s.key, `Filter option in ${e.key}`), i.has(s.key))
|
|
637
699
|
throw new Error(`Duplicate filter option: ${e.key}.${s.key}`);
|
|
638
700
|
if (i.add(s.key), typeof s.matches != "function")
|
|
639
701
|
throw new TypeError(`Filter matcher ${e.key}.${s.key} must be a function`);
|
|
640
702
|
}
|
|
641
703
|
}
|
|
642
704
|
}
|
|
643
|
-
function
|
|
705
|
+
function _(t, r) {
|
|
644
706
|
if (t.length === 0 || t === "__proto__" || t === "prototype" || t === "constructor")
|
|
645
707
|
throw new TypeError(`${r} key is not safe for persisted state`);
|
|
646
708
|
}
|
|
647
|
-
function
|
|
709
|
+
function X(t) {
|
|
648
710
|
return t != null && typeof t == "object" && !Array.isArray(t);
|
|
649
711
|
}
|
|
650
|
-
class
|
|
712
|
+
class Et {
|
|
651
713
|
constructor({
|
|
652
714
|
getItems: r,
|
|
653
|
-
getKey: e =
|
|
715
|
+
getKey: e = He,
|
|
654
716
|
selectedItemsEmitter: i,
|
|
655
717
|
owner: s = null
|
|
656
718
|
}) {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
719
|
+
a(this, "getItems");
|
|
720
|
+
a(this, "getKey");
|
|
721
|
+
a(this, "selectedItemsEmitter");
|
|
722
|
+
a(this, "selectedItems$");
|
|
723
|
+
a(this, "ownsSelectedItemsEmitter");
|
|
724
|
+
a(this, "rows", []);
|
|
725
|
+
a(this, "rowCleanups", []);
|
|
726
|
+
a(this, "activeIndex", 0);
|
|
727
|
+
a(this, "anchorIndex", null);
|
|
728
|
+
a(this, "dragStartIndex", null);
|
|
729
|
+
a(this, "dragOriginEvent", null);
|
|
730
|
+
a(this, "dragMoved", !1);
|
|
731
|
+
a(this, "dragCleanup", null);
|
|
732
|
+
a(this, "suppressNextClick", !1);
|
|
733
|
+
a(this, "suppressClickTimer", null);
|
|
734
|
+
a(this, "destroyed", !1);
|
|
735
|
+
a(this, "ownedSelectedItemsEmitter");
|
|
674
736
|
if (typeof r != "function")
|
|
675
737
|
throw new TypeError("Selection handler getItems must be a function");
|
|
676
738
|
if (typeof e != "function")
|
|
677
739
|
throw new TypeError("Selection handler getKey must be a function");
|
|
678
|
-
this.getItems = r, this.getKey = e, this.ownedSelectedItemsEmitter = i == null ? new
|
|
740
|
+
this.getItems = r, this.getKey = e, this.ownedSelectedItemsEmitter = i == null ? new S([], { owner: s, purpose: "selected items" }) : null, this.selectedItemsEmitter = i ?? this.ownedSelectedItemsEmitter, this.selectedItems$ = this.selectedItemsEmitter, this.ownsSelectedItemsEmitter = this.ownedSelectedItemsEmitter != null;
|
|
679
741
|
}
|
|
680
742
|
rowsUpdated(r) {
|
|
681
|
-
this.destroyed || (this.releaseRows(), this.rows = Array.from(r ?? []), this.rows.forEach((e, i) => this.wireRow(e, i)), this.activeIndex =
|
|
743
|
+
this.destroyed || (this.releaseRows(), this.rows = Array.from(r ?? []), this.rows.forEach((e, i) => this.wireRow(e, i)), this.activeIndex = Ht(this.activeIndex, this.rows.length), this.reconcileSelectedItems(), this.syncRows());
|
|
682
744
|
}
|
|
683
745
|
wireRow(r, e) {
|
|
684
|
-
const i = (l) => this.handleClick(e, l), s = (l) => this.handleKeyDown(e, l), n = (l) => this.handleMouseDown(e, l, r),
|
|
685
|
-
r.addEventListener("click", i), r.addEventListener("keydown", s), r.addEventListener("mousedown", n), r.addEventListener("mouseenter",
|
|
686
|
-
r.removeEventListener("click", i), r.removeEventListener("keydown", s), r.removeEventListener("mousedown", n), r.removeEventListener("mouseenter",
|
|
746
|
+
const i = (l) => this.handleClick(e, l), s = (l) => this.handleKeyDown(e, l), n = (l) => this.handleMouseDown(e, l, r), o = (l) => this.handleMouseEnter(e, l);
|
|
747
|
+
r.addEventListener("click", i), r.addEventListener("keydown", s), r.addEventListener("mousedown", n), r.addEventListener("mouseenter", o), this.rowCleanups.push(() => {
|
|
748
|
+
r.removeEventListener("click", i), r.removeEventListener("keydown", s), r.removeEventListener("mousedown", n), r.removeEventListener("mouseenter", o);
|
|
687
749
|
});
|
|
688
750
|
}
|
|
689
751
|
handleClick(r, e) {
|
|
@@ -746,8 +808,8 @@ class Ge {
|
|
|
746
808
|
syncRows() {
|
|
747
809
|
const r = new Set(this.getSelectedItems().map((i, s) => this.getKey(i, s))), e = this.getItems();
|
|
748
810
|
this.rows.forEach((i, s) => {
|
|
749
|
-
const n = e[s],
|
|
750
|
-
i.classList.toggle("selected",
|
|
811
|
+
const n = e[s], o = n !== void 0 && r.has(this.getKey(n, s));
|
|
812
|
+
i.classList.toggle("selected", o), i.setAttribute("aria-selected", String(o)), i.tabIndex = s === this.activeIndex ? 0 : -1;
|
|
751
813
|
});
|
|
752
814
|
}
|
|
753
815
|
releaseRows() {
|
|
@@ -766,9 +828,9 @@ class Ge {
|
|
|
766
828
|
this.destroyed || (this.destroyed = !0, this.finishDrag(!1), this.clearClickSuppression(), this.releaseRows(), (r = this.ownedSelectedItemsEmitter) == null || r.dispose());
|
|
767
829
|
}
|
|
768
830
|
}
|
|
769
|
-
class
|
|
831
|
+
class Fe extends Et {
|
|
770
832
|
constructor(e) {
|
|
771
|
-
const i = e.selectedItemEmitter == null ? new
|
|
833
|
+
const i = e.selectedItemEmitter == null ? new S(null, {
|
|
772
834
|
owner: e.owner,
|
|
773
835
|
purpose: "selected item"
|
|
774
836
|
}) : null, s = e.selectedItemEmitter ?? i;
|
|
@@ -776,11 +838,11 @@ class Ee extends Ge {
|
|
|
776
838
|
getItems: e.getItems,
|
|
777
839
|
...e.getKey == null ? {} : { getKey: e.getKey },
|
|
778
840
|
...e.owner === void 0 ? {} : { owner: e.owner },
|
|
779
|
-
selectedItemsEmitter: new
|
|
841
|
+
selectedItemsEmitter: new Ft(s)
|
|
780
842
|
});
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
843
|
+
a(this, "selectedItemEmitter");
|
|
844
|
+
a(this, "selectedItem$");
|
|
845
|
+
a(this, "ownedSelectedItemEmitter");
|
|
784
846
|
this.ownedSelectedItemEmitter = i, this.selectedItemEmitter = s, this.selectedItem$ = s;
|
|
785
847
|
}
|
|
786
848
|
selectIndex(e) {
|
|
@@ -795,17 +857,17 @@ class Ee extends Ge {
|
|
|
795
857
|
super.destroy(), (e = this.ownedSelectedItemEmitter) == null || e.dispose();
|
|
796
858
|
}
|
|
797
859
|
}
|
|
798
|
-
class
|
|
860
|
+
class Kt extends Et {
|
|
799
861
|
selectIndex(r, e) {
|
|
800
862
|
const i = this.getItems(), s = i[r];
|
|
801
863
|
if (s !== void 0) {
|
|
802
864
|
if (e.shiftKey && this.anchorIndex != null) {
|
|
803
|
-
const n = Math.min(this.anchorIndex, r),
|
|
865
|
+
const n = Math.min(this.anchorIndex, r), o = Math.max(this.anchorIndex, r), l = i.slice(n, o + 1), c = ve(e) ? Xe(this.getSelectedItems(), l, this.getKey) : [...l];
|
|
804
866
|
this.setSelectedItems(c, "range selection changed");
|
|
805
867
|
return;
|
|
806
868
|
}
|
|
807
|
-
if (
|
|
808
|
-
const n = this.getSelectedItems(),
|
|
869
|
+
if (ve(e) || "key" in e && e.key === " ") {
|
|
870
|
+
const n = this.getSelectedItems(), o = this.getKey(s, r), c = n.some((u, p) => Object.is(this.getKey(u, p), o)) ? n.filter((u, p) => !Object.is(this.getKey(u, p), o)) : [...n, s];
|
|
809
871
|
this.anchorIndex = r, this.setSelectedItems(c, "multi selection toggled");
|
|
810
872
|
return;
|
|
811
873
|
}
|
|
@@ -819,14 +881,14 @@ class lt extends Ge {
|
|
|
819
881
|
return !0;
|
|
820
882
|
}
|
|
821
883
|
selectDragRange(r, e, i) {
|
|
822
|
-
const s = this.getItems(), n = Math.min(r, e),
|
|
884
|
+
const s = this.getItems(), n = Math.min(r, e), o = Math.max(r, e), l = s.slice(n, o + 1), c = ve(i) ? Xe(this.getSelectedItems(), l, this.getKey) : [...l];
|
|
823
885
|
this.anchorIndex = r, this.setSelectedItems(c, "drag selection changed");
|
|
824
886
|
}
|
|
825
887
|
}
|
|
826
|
-
function
|
|
827
|
-
return t.multiSelect ? new
|
|
888
|
+
function pe(t) {
|
|
889
|
+
return t.multiSelect ? new Kt(t) : new Fe(t);
|
|
828
890
|
}
|
|
829
|
-
class
|
|
891
|
+
class Ft {
|
|
830
892
|
constructor(r) {
|
|
831
893
|
this.source = r;
|
|
832
894
|
}
|
|
@@ -850,7 +912,7 @@ class ct {
|
|
|
850
912
|
}), e);
|
|
851
913
|
}
|
|
852
914
|
}
|
|
853
|
-
function
|
|
915
|
+
function He(t, r) {
|
|
854
916
|
if (t != null && typeof t == "object") {
|
|
855
917
|
const e = Reflect.get(t, "id");
|
|
856
918
|
if (e != null) return e;
|
|
@@ -860,47 +922,47 @@ function Se(t, r) {
|
|
|
860
922
|
`Selection item at index ${r} needs an id or an explicit itemKey/rowKey`
|
|
861
923
|
);
|
|
862
924
|
}
|
|
863
|
-
function
|
|
925
|
+
function ve(t) {
|
|
864
926
|
return !!(t.ctrlKey || t.metaKey);
|
|
865
927
|
}
|
|
866
|
-
function
|
|
928
|
+
function Ht(t, r) {
|
|
867
929
|
return r <= 0 ? 0 : Math.min(Math.max(t, 0), r - 1);
|
|
868
930
|
}
|
|
869
|
-
function
|
|
870
|
-
const i = [...t], s = new Set(t.map((n,
|
|
931
|
+
function Xe(t, r, e) {
|
|
932
|
+
const i = [...t], s = new Set(t.map((n, o) => e(n, o)));
|
|
871
933
|
for (const n of r) {
|
|
872
|
-
const
|
|
873
|
-
s.has(
|
|
934
|
+
const o = e(n, i.length);
|
|
935
|
+
s.has(o) || (s.add(o), i.push(n));
|
|
874
936
|
}
|
|
875
937
|
return i;
|
|
876
938
|
}
|
|
877
|
-
class
|
|
939
|
+
class Z extends g {
|
|
878
940
|
constructor(e = {}) {
|
|
879
941
|
super(e);
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
942
|
+
a(this, "itemsEmitter");
|
|
943
|
+
a(this, "items$");
|
|
944
|
+
a(this, "selectedItemsEmitter");
|
|
945
|
+
a(this, "selectedItems$");
|
|
946
|
+
a(this, "selectedItemEmitter");
|
|
947
|
+
a(this, "selectedItem$");
|
|
948
|
+
a(this, "getItemKey");
|
|
949
|
+
a(this, "selectionHandler");
|
|
950
|
+
a(this, "ownedItemsEmitter");
|
|
951
|
+
Vt(e.items) ? (this.itemsEmitter = e.items, this.ownedItemsEmitter = null) : (this.ownedItemsEmitter = new S(e.items ?? [], {
|
|
890
952
|
owner: this,
|
|
891
953
|
purpose: "list items"
|
|
892
|
-
}), this.itemsEmitter = this.ownedItemsEmitter), this.items$ = this.itemsEmitter, this.getItemKey =
|
|
954
|
+
}), this.itemsEmitter = this.ownedItemsEmitter), this.items$ = this.itemsEmitter, this.getItemKey = Mt(e.itemKey), this.selectionHandler = e.multiSelect === !0 ? pe({
|
|
893
955
|
owner: this,
|
|
894
956
|
multiSelect: !0,
|
|
895
957
|
...e.selectedItemsEmitter == null ? {} : { selectedItemsEmitter: e.selectedItemsEmitter },
|
|
896
958
|
getItems: () => this.itemsEmitter.get(),
|
|
897
959
|
getKey: this.getItemKey
|
|
898
|
-
}) :
|
|
960
|
+
}) : pe({
|
|
899
961
|
owner: this,
|
|
900
962
|
...e.selectedItemEmitter == null ? {} : { selectedItemEmitter: e.selectedItemEmitter },
|
|
901
963
|
getItems: () => this.itemsEmitter.get(),
|
|
902
964
|
getKey: this.getItemKey
|
|
903
|
-
}), this.selectedItemsEmitter = this.selectionHandler.selectedItemsEmitter, this.selectedItems$ = this.selectedItemsEmitter, this.selectedItemEmitter = this.selectionHandler instanceof
|
|
965
|
+
}), this.selectedItemsEmitter = this.selectionHandler.selectedItemsEmitter, this.selectedItems$ = this.selectedItemsEmitter, this.selectedItemEmitter = this.selectionHandler instanceof Fe ? this.selectionHandler.selectedItemEmitter : null, this.selectedItem$ = this.selectedItemEmitter;
|
|
904
966
|
}
|
|
905
967
|
initialize() {
|
|
906
968
|
this.watch(this.itemsEmitter, this.selectedItemsEmitter);
|
|
@@ -908,36 +970,36 @@ class Q extends y {
|
|
|
908
970
|
render() {
|
|
909
971
|
const e = this.itemsEmitter.get();
|
|
910
972
|
if (!Array.isArray(e)) throw new TypeError("ListView items must be an array");
|
|
911
|
-
const i = this.itemsEmitter.getFetchState(), s = this.itemsEmitter.getError(), n = i === k.Initial || i === k.Loading,
|
|
973
|
+
const i = this.itemsEmitter.getFetchState(), s = this.itemsEmitter.getError(), n = i === k.Initial || i === k.Loading, o = new Set(this.selectedItemsEmitter.get().map((c, u) => this.getItemKey(c, u))), l = this.Host;
|
|
912
974
|
return /* @__PURE__ */ w(
|
|
913
975
|
l,
|
|
914
976
|
{
|
|
915
977
|
className: R("datacomponentlike", E(this.props)),
|
|
916
978
|
children: [
|
|
917
|
-
i === k.Error ? /* @__PURE__ */
|
|
979
|
+
i === k.Error ? /* @__PURE__ */ h("p", { role: "alert", children: Qt(s, "Unable to load items") }) : null,
|
|
918
980
|
n && e.length === 0 ? /* @__PURE__ */ w("div", { role: "status", "data-part": "loading", children: [
|
|
919
|
-
/* @__PURE__ */
|
|
920
|
-
Array.from({ length: this.props.placeholderCount ?? 5 }, (c,
|
|
981
|
+
/* @__PURE__ */ h("span", { children: "Loading items…" }),
|
|
982
|
+
Array.from({ length: this.props.placeholderCount ?? 5 }, (c, u) => /* @__PURE__ */ h("div", { "data-part": "placeholder-row", children: /* @__PURE__ */ h(H, { width: 45 + u * 7 }) }, `placeholder-${u}`))
|
|
921
983
|
] }) : null,
|
|
922
|
-
i === k.Ready && e.length === 0 ? /* @__PURE__ */
|
|
923
|
-
e.length > 0 ? /* @__PURE__ */
|
|
984
|
+
i === k.Ready && e.length === 0 ? /* @__PURE__ */ h("p", { role: "status", children: "No items" }) : null,
|
|
985
|
+
e.length > 0 ? /* @__PURE__ */ h(
|
|
924
986
|
"div",
|
|
925
987
|
{
|
|
926
988
|
role: "listbox",
|
|
927
989
|
"aria-label": this.props.label ?? "Items",
|
|
928
990
|
"aria-busy": n ? "true" : null,
|
|
929
991
|
"aria-multiselectable": this.props.multiSelect ? "true" : null,
|
|
930
|
-
children: e.map((c,
|
|
931
|
-
const p = this.getItemKey(c,
|
|
932
|
-
return /* @__PURE__ */
|
|
992
|
+
children: e.map((c, u) => {
|
|
993
|
+
const p = this.getItemKey(c, u), f = o.has(p), m = this.props.renderItem ? this.props.renderItem(c, u) : Pt(c);
|
|
994
|
+
return /* @__PURE__ */ h(
|
|
933
995
|
"div",
|
|
934
996
|
{
|
|
935
997
|
role: "option",
|
|
936
998
|
"data-fray-selectable-row": "",
|
|
937
|
-
"data-index":
|
|
999
|
+
"data-index": u,
|
|
938
1000
|
"aria-selected": String(f),
|
|
939
|
-
tabIndex:
|
|
940
|
-
children:
|
|
1001
|
+
tabIndex: u === 0 ? 0 : -1,
|
|
1002
|
+
children: m
|
|
941
1003
|
},
|
|
942
1004
|
String(p)
|
|
943
1005
|
);
|
|
@@ -970,10 +1032,10 @@ class Q extends y {
|
|
|
970
1032
|
this.selectionHandler.destroy(), (e = this.ownedItemsEmitter) == null || e.dispose();
|
|
971
1033
|
}
|
|
972
1034
|
}
|
|
973
|
-
|
|
1035
|
+
a(Z, "dependencies", [H]), a(Z, "hostName", "list-view"), a(Z, "standaloneHostName", "list-view"), a(Z, "baseStyles", [
|
|
974
1036
|
["&", "inputlike"],
|
|
975
1037
|
['& > [role="listbox"] > [role="option"]', "inputline"]
|
|
976
|
-
]),
|
|
1038
|
+
]), a(Z, "css", x`
|
|
977
1039
|
& {
|
|
978
1040
|
display: flex;
|
|
979
1041
|
flex-direction: column;
|
|
@@ -998,8 +1060,8 @@ o(Q, "dependencies", [M]), o(Q, "hostName", "list-view"), o(Q, "standaloneHostNa
|
|
|
998
1060
|
padding: var(--ui-padding);
|
|
999
1061
|
}
|
|
1000
1062
|
`);
|
|
1001
|
-
function
|
|
1002
|
-
if (t == null) return
|
|
1063
|
+
function Mt(t) {
|
|
1064
|
+
if (t == null) return He;
|
|
1003
1065
|
if (typeof t == "function") return t;
|
|
1004
1066
|
if (typeof t == "string" && t.length > 0)
|
|
1005
1067
|
return (r, e) => {
|
|
@@ -1012,32 +1074,32 @@ function ut(t) {
|
|
|
1012
1074
|
};
|
|
1013
1075
|
throw new TypeError("ListView itemKey must be a function or property name");
|
|
1014
1076
|
}
|
|
1015
|
-
function
|
|
1077
|
+
function Vt(t) {
|
|
1016
1078
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
1017
1079
|
}
|
|
1018
|
-
function
|
|
1080
|
+
function Pt(t) {
|
|
1019
1081
|
if (t != null && (typeof t == "object" || typeof t == "function")) {
|
|
1020
1082
|
const r = Reflect.get(t, "label");
|
|
1021
|
-
if (
|
|
1083
|
+
if (Ut(r)) return r;
|
|
1022
1084
|
}
|
|
1023
1085
|
return String(t);
|
|
1024
1086
|
}
|
|
1025
|
-
function
|
|
1087
|
+
function Ut(t) {
|
|
1026
1088
|
return t == null || typeof t == "string" || typeof t == "number";
|
|
1027
1089
|
}
|
|
1028
|
-
function
|
|
1090
|
+
function Qt(t, r) {
|
|
1029
1091
|
return t instanceof Error ? t.message : t == null ? r : String(t);
|
|
1030
1092
|
}
|
|
1031
|
-
class
|
|
1093
|
+
class q extends g {
|
|
1032
1094
|
constructor(e = {}) {
|
|
1033
1095
|
super(e);
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1096
|
+
a(this, "symbols");
|
|
1097
|
+
a(this, "valueEmitter");
|
|
1098
|
+
a(this, "semanticStateEmitter");
|
|
1037
1099
|
const i = this.constructor;
|
|
1038
|
-
this.symbols = e.symbols ?? i.symbols,
|
|
1100
|
+
this.symbols = e.symbols ?? i.symbols, Bt(this.symbols);
|
|
1039
1101
|
const s = e.initialSemanticState ?? i.defaultSemanticState ?? this.symbols[0][1], n = { ...e };
|
|
1040
|
-
n.defaultValue == null && e.initialSemanticState != null && (n.defaultValue = e.initialSemanticState), this.valueEmitter =
|
|
1102
|
+
n.defaultValue == null && e.initialSemanticState != null && (n.defaultValue = e.initialSemanticState), this.valueEmitter = K(
|
|
1041
1103
|
this,
|
|
1042
1104
|
n,
|
|
1043
1105
|
s,
|
|
@@ -1049,139 +1111,181 @@ class D extends y {
|
|
|
1049
1111
|
}
|
|
1050
1112
|
cycleState(e = 1, i = null) {
|
|
1051
1113
|
if (this.props.disabled) return;
|
|
1052
|
-
const s = this.symbols.findIndex(([, c]) => Object.is(c, this.valueEmitter.get())),
|
|
1053
|
-
this.valueEmitter.set(l, "checkbox state changed"),
|
|
1114
|
+
const s = this.symbols.findIndex(([, c]) => Object.is(c, this.valueEmitter.get())), o = ((s < 0 ? 0 : s) + e + this.symbols.length) % this.symbols.length, l = this.symbols[o][1];
|
|
1115
|
+
this.valueEmitter.set(l, "checkbox state changed"), C(this.props.onChange, l, i);
|
|
1054
1116
|
}
|
|
1055
1117
|
render() {
|
|
1056
1118
|
const {
|
|
1057
1119
|
label: e = this.props.value ?? "Option",
|
|
1058
1120
|
disabled: i = !1,
|
|
1059
|
-
required: s = !1
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
return /* @__PURE__ */ u(
|
|
1064
|
-
g,
|
|
1121
|
+
required: s = !1
|
|
1122
|
+
} = this.props, n = this.valueEmitter.get(), o = this.symbols.findIndex(([, f]) => Object.is(f, n)), [l] = this.symbols[o] ?? ["?", n], c = Nt(n), u = n === y.Prefer || n === y.Require || this.symbols.length === 2 && o === 1, p = this.Host;
|
|
1123
|
+
return /* @__PURE__ */ h(
|
|
1124
|
+
p,
|
|
1065
1125
|
{
|
|
1066
1126
|
className: E(this.props) || null,
|
|
1067
1127
|
"data-disabled": i ? "" : null,
|
|
1068
1128
|
"data-required": s ? "" : null,
|
|
1069
|
-
"data-state":
|
|
1070
|
-
children: /* @__PURE__ */ w(
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
}
|
|
1090
|
-
)
|
|
1129
|
+
"data-state": c,
|
|
1130
|
+
children: /* @__PURE__ */ w("label", { children: [
|
|
1131
|
+
/* @__PURE__ */ h(
|
|
1132
|
+
"input",
|
|
1133
|
+
{
|
|
1134
|
+
type: "checkbox",
|
|
1135
|
+
checked: u,
|
|
1136
|
+
disabled: i,
|
|
1137
|
+
required: s,
|
|
1138
|
+
name: this.props.name,
|
|
1139
|
+
value: this.props.value == null ? void 0 : String(this.props.value),
|
|
1140
|
+
"data-state": c,
|
|
1141
|
+
"aria-label": `${e}: ${c}`,
|
|
1142
|
+
onChange: (f) => this.cycleState(1, f),
|
|
1143
|
+
onKeyDown: (f) => {
|
|
1144
|
+
f.key === "ArrowRight" || f.key === "ArrowDown" ? (f.preventDefault(), this.cycleState(1, f)) : (f.key === "ArrowLeft" || f.key === "ArrowUp") && (f.preventDefault(), this.cycleState(-1, f));
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
),
|
|
1148
|
+
/* @__PURE__ */ h("span", { className: "checkboxshell", "aria-hidden": "true", children: l }),
|
|
1149
|
+
/* @__PURE__ */ h("span", { children: e })
|
|
1150
|
+
] })
|
|
1091
1151
|
}
|
|
1092
1152
|
);
|
|
1093
1153
|
}
|
|
1094
1154
|
}
|
|
1095
|
-
|
|
1096
|
-
["☐",
|
|
1097
|
-
["✓",
|
|
1098
|
-
]),
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1155
|
+
a(q, "symbols", [
|
|
1156
|
+
["☐", y.Neutral],
|
|
1157
|
+
["✓", y.Prefer]
|
|
1158
|
+
]), a(q, "defaultSemanticState", y.Neutral), a(q, "hostName", "check-box"), a(q, "standaloneHostName", "check-box"), a(q, "css", x`
|
|
1159
|
+
& {
|
|
1160
|
+
display: inline-block;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
& > label {
|
|
1103
1164
|
display: inline-flex;
|
|
1104
1165
|
align-items: center;
|
|
1105
1166
|
gap: 0.35em;
|
|
1106
|
-
|
|
1107
|
-
font-family: inherit;
|
|
1167
|
+
cursor: pointer;
|
|
1108
1168
|
}
|
|
1109
1169
|
|
|
1110
|
-
&
|
|
1170
|
+
&[data-disabled] > label {
|
|
1171
|
+
cursor: not-allowed;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
& input[type="checkbox"] {
|
|
1175
|
+
position: absolute;
|
|
1176
|
+
width: 1px;
|
|
1177
|
+
height: 1px;
|
|
1178
|
+
padding: 0;
|
|
1179
|
+
margin: -1px;
|
|
1180
|
+
overflow: hidden;
|
|
1181
|
+
clip: rect(0 0 0 0);
|
|
1182
|
+
white-space: nowrap;
|
|
1183
|
+
border: 0;
|
|
1184
|
+
font: inherit;
|
|
1185
|
+
font-size: var(--ui-font-size, inherit);
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
& input[type="checkbox"] + .checkboxshell {
|
|
1189
|
+
position: relative;
|
|
1111
1190
|
display: inline-grid;
|
|
1112
1191
|
width: 1em;
|
|
1113
1192
|
height: 1em;
|
|
1193
|
+
flex: 0 0 1em;
|
|
1194
|
+
overflow: hidden;
|
|
1195
|
+
box-sizing: border-box;
|
|
1114
1196
|
line-height: 1;
|
|
1115
1197
|
place-items: center;
|
|
1198
|
+
color: var(--input-color, var(--ui-text-color, currentColor));
|
|
1199
|
+
background: var(--checkbox-box-background, var(--ui-input-bg, transparent));
|
|
1200
|
+
border: var(--checkbox-box-border, var(--cbx-o-border, 1px solid currentColor));
|
|
1201
|
+
border-radius: var(--cbx-border-radius, var(--radius-sm, 0.2rem));
|
|
1202
|
+
font-family: inherit;
|
|
1203
|
+
font-size: 1em;
|
|
1204
|
+
user-select: none;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
& input[type="checkbox"]:checked + .checkboxshell {
|
|
1208
|
+
color: var(--checkbox-symbol-color, var(--selection-color, currentColor));
|
|
1209
|
+
background: var(--checkbox-box-background-checked,
|
|
1210
|
+
var(--selection-background, var(--ui-accent-color, Highlight)));
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
& input[type="checkbox"]:focus-visible + .checkboxshell {
|
|
1214
|
+
outline: 2px solid var(--focus-color, var(--ui-accent-color, Highlight));
|
|
1215
|
+
outline-offset: 1px;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
& input[type="checkbox"]:disabled + .checkboxshell {
|
|
1219
|
+
opacity: 0.6;
|
|
1116
1220
|
}
|
|
1117
1221
|
`);
|
|
1118
|
-
function
|
|
1222
|
+
function Bt(t) {
|
|
1119
1223
|
if (!Array.isArray(t) || t.length === 0)
|
|
1120
1224
|
throw new TypeError("Checkbox symbols must be a non-empty tuple array");
|
|
1121
1225
|
for (const r of t)
|
|
1122
1226
|
if (!Array.isArray(r) || r.length < 2)
|
|
1123
1227
|
throw new TypeError("Checkbox symbols must be [symbol, state] tuples");
|
|
1124
1228
|
}
|
|
1125
|
-
class
|
|
1229
|
+
class Q extends g {
|
|
1126
1230
|
constructor(e = {}) {
|
|
1127
1231
|
super(e);
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
this.optionsEmitter =
|
|
1232
|
+
a(this, "optionsEmitter");
|
|
1233
|
+
a(this, "optionStateEmitters", /* @__PURE__ */ new Map());
|
|
1234
|
+
a(this, "staleOptionValues", /* @__PURE__ */ new Set());
|
|
1235
|
+
a(this, "placementTimer", null);
|
|
1236
|
+
this.optionsEmitter = Zt(e.options) ? e.options : null;
|
|
1133
1237
|
}
|
|
1134
1238
|
initialize() {
|
|
1135
1239
|
this.optionsEmitter && this.watch(this.optionsEmitter);
|
|
1136
1240
|
}
|
|
1137
1241
|
render() {
|
|
1138
|
-
var p, f,
|
|
1242
|
+
var p, f, m;
|
|
1139
1243
|
const e = ((p = this.optionsEmitter) == null ? void 0 : p.get()) ?? (Array.isArray(this.props.options) ? this.props.options : []);
|
|
1140
1244
|
if (!Array.isArray(e))
|
|
1141
1245
|
throw new TypeError("FilterPanel options must be an array or emitter of arrays");
|
|
1142
|
-
const i = ((f = this.optionsEmitter) == null ? void 0 : f.getFetchState()) ?? k.Ready, s = (
|
|
1246
|
+
const i = ((f = this.optionsEmitter) == null ? void 0 : f.getFetchState()) ?? k.Ready, s = (m = this.optionsEmitter) == null ? void 0 : m.getError(), n = Ye(this.props.filters), o = this.props.filterModes ?? q.symbols, l = this.props.defaultSemanticState ?? y.Neutral, c = new Set(e.map(Ae));
|
|
1143
1247
|
this.staleOptionValues = new Set(
|
|
1144
|
-
[...this.optionStateEmitters.keys()].filter((
|
|
1248
|
+
[...this.optionStateEmitters.keys()].filter((b) => !c.has(b))
|
|
1145
1249
|
);
|
|
1146
|
-
const
|
|
1147
|
-
return i === k.Error ? /* @__PURE__ */
|
|
1148
|
-
|
|
1250
|
+
const u = this.Host;
|
|
1251
|
+
return i === k.Error ? /* @__PURE__ */ h(
|
|
1252
|
+
u,
|
|
1149
1253
|
{
|
|
1150
1254
|
className: R("panellike", E(this.props)),
|
|
1151
1255
|
role: "alert",
|
|
1152
1256
|
"data-state": "error",
|
|
1153
|
-
children:
|
|
1257
|
+
children: Xt(s, "Unable to load filter options")
|
|
1154
1258
|
}
|
|
1155
|
-
) : (i === k.Initial || i === k.Loading) && e.length === 0 ? /* @__PURE__ */
|
|
1156
|
-
|
|
1259
|
+
) : (i === k.Initial || i === k.Loading) && e.length === 0 ? /* @__PURE__ */ h(
|
|
1260
|
+
u,
|
|
1157
1261
|
{
|
|
1158
1262
|
className: R("panellike", E(this.props)),
|
|
1159
1263
|
role: "status",
|
|
1160
1264
|
"data-state": "loading",
|
|
1161
1265
|
children: "Loading filter options…"
|
|
1162
1266
|
}
|
|
1163
|
-
) : /* @__PURE__ */
|
|
1164
|
-
|
|
1267
|
+
) : /* @__PURE__ */ h(
|
|
1268
|
+
u,
|
|
1165
1269
|
{
|
|
1166
1270
|
className: R("panellike", E(this.props)),
|
|
1167
1271
|
role: "group",
|
|
1168
1272
|
"aria-label": this.props.label ?? "Filter options",
|
|
1169
|
-
children: e.length === 0 ? /* @__PURE__ */
|
|
1170
|
-
const
|
|
1171
|
-
return /* @__PURE__ */
|
|
1172
|
-
|
|
1273
|
+
children: e.length === 0 ? /* @__PURE__ */ h("span", { children: "No filter options" }) : e.map((b) => {
|
|
1274
|
+
const v = Ae(b), I = Wt(b), A = n.get(v) ?? l, N = this.optionEmitter(v, A);
|
|
1275
|
+
return /* @__PURE__ */ h(
|
|
1276
|
+
_t,
|
|
1173
1277
|
{
|
|
1174
|
-
label:
|
|
1175
|
-
valueEmitter:
|
|
1176
|
-
symbols:
|
|
1177
|
-
onChange: (
|
|
1278
|
+
label: I,
|
|
1279
|
+
valueEmitter: N,
|
|
1280
|
+
symbols: o,
|
|
1281
|
+
onChange: (z, L) => {
|
|
1178
1282
|
var T, G;
|
|
1179
|
-
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1283
|
+
L == null || L.stopPropagation();
|
|
1284
|
+
const F = Ye(this.props.filters);
|
|
1285
|
+
z === y.Neutral ? F.delete(v) : F.set(v, z), (G = (T = this.props).onChange) == null || G.call(T, F, L);
|
|
1182
1286
|
}
|
|
1183
1287
|
},
|
|
1184
|
-
|
|
1288
|
+
Gt(v)
|
|
1185
1289
|
);
|
|
1186
1290
|
})
|
|
1187
1291
|
}
|
|
@@ -1204,7 +1308,7 @@ class U extends y {
|
|
|
1204
1308
|
const s = this.optionStateEmitters.get(e);
|
|
1205
1309
|
if (s != null)
|
|
1206
1310
|
return s.get() !== i && s.set(i, "filter option synchronized"), s;
|
|
1207
|
-
const n = new
|
|
1311
|
+
const n = new S(i, { owner: this, purpose: `filter option ${String(e)}` });
|
|
1208
1312
|
return this.optionStateEmitters.set(e, n), n;
|
|
1209
1313
|
}
|
|
1210
1314
|
placeInsideViewport(e) {
|
|
@@ -1213,13 +1317,13 @@ class U extends y {
|
|
|
1213
1317
|
if (i == null || i.innerHeight <= 0) return;
|
|
1214
1318
|
const s = e.parentElement.getBoundingClientRect();
|
|
1215
1319
|
e.style.removeProperty("max-height");
|
|
1216
|
-
const n = e.getBoundingClientRect(),
|
|
1320
|
+
const n = e.getBoundingClientRect(), o = s.top, l = Math.max(0, i.innerHeight - s.bottom), c = n.height > l && o > l;
|
|
1217
1321
|
c ? (e.dataset.placement = "above", e.style.insetBlockStart = `${Math.max(8, s.top - n.height)}px`) : (delete e.dataset.placement, e.style.insetBlockStart = `${s.bottom}px`), e.style.insetInlineEnd = `${Math.max(8, i.innerWidth - s.right)}px`;
|
|
1218
|
-
const
|
|
1219
|
-
e.style.maxHeight = `${Math.max(48,
|
|
1322
|
+
const u = c ? o : l;
|
|
1323
|
+
e.style.maxHeight = `${Math.max(48, u - 8)}px`;
|
|
1220
1324
|
}
|
|
1221
1325
|
}
|
|
1222
|
-
|
|
1326
|
+
a(Q, "dependencies", [q]), a(Q, "hostName", "filter-panel"), a(Q, "standaloneHostName", "filter-panel"), a(Q, "css", x`
|
|
1223
1327
|
& {
|
|
1224
1328
|
position: fixed;
|
|
1225
1329
|
z-index: 1100;
|
|
@@ -1234,14 +1338,14 @@ o(U, "dependencies", [D]), o(U, "hostName", "filter-panel"), o(U, "standaloneHos
|
|
|
1234
1338
|
}
|
|
1235
1339
|
|
|
1236
1340
|
`);
|
|
1237
|
-
const
|
|
1238
|
-
function
|
|
1341
|
+
const _t = q;
|
|
1342
|
+
function Ye(t) {
|
|
1239
1343
|
if (t == null) return /* @__PURE__ */ new Map();
|
|
1240
1344
|
if (t instanceof Map) return new Map(t);
|
|
1241
1345
|
if (Array.isArray(t)) return new Map(t);
|
|
1242
1346
|
throw new TypeError("FilterPanel filters must be a Map or tuple array");
|
|
1243
1347
|
}
|
|
1244
|
-
function
|
|
1348
|
+
function Ae(t) {
|
|
1245
1349
|
if (typeof t == "string" || typeof t == "number") return t;
|
|
1246
1350
|
if (t != null && typeof t == "object") {
|
|
1247
1351
|
const r = Reflect.get(t, "value");
|
|
@@ -1249,30 +1353,30 @@ function be(t) {
|
|
|
1249
1353
|
}
|
|
1250
1354
|
throw new TypeError("Filter options must be strings, numbers, or value/label objects");
|
|
1251
1355
|
}
|
|
1252
|
-
function
|
|
1356
|
+
function Wt(t) {
|
|
1253
1357
|
if (t != null && typeof t == "object") {
|
|
1254
1358
|
const r = Reflect.get(t, "label");
|
|
1255
|
-
if (r != null) return
|
|
1359
|
+
if (r != null) return Jt(r) ? r : String(r);
|
|
1256
1360
|
}
|
|
1257
|
-
return String(
|
|
1361
|
+
return String(Ae(t));
|
|
1258
1362
|
}
|
|
1259
|
-
function
|
|
1363
|
+
function Gt(t) {
|
|
1260
1364
|
return `${typeof t}:${String(t)}`;
|
|
1261
1365
|
}
|
|
1262
|
-
function
|
|
1366
|
+
function Jt(t) {
|
|
1263
1367
|
return typeof t == "string" || typeof t == "number";
|
|
1264
1368
|
}
|
|
1265
|
-
function
|
|
1369
|
+
function Zt(t) {
|
|
1266
1370
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
1267
1371
|
}
|
|
1268
|
-
function
|
|
1372
|
+
function Xt(t, r) {
|
|
1269
1373
|
return t instanceof Error ? t.message : t == null ? r : String(t);
|
|
1270
1374
|
}
|
|
1271
|
-
class
|
|
1375
|
+
class Y extends g {
|
|
1272
1376
|
constructor() {
|
|
1273
1377
|
super(...arguments);
|
|
1274
|
-
|
|
1275
|
-
|
|
1378
|
+
a(this, "filterVisible", !1);
|
|
1379
|
+
a(this, "onGlobalClick", (e) => {
|
|
1276
1380
|
this.filterVisible && this.dom instanceof Node && e.target instanceof Node && !this.dom.contains(e.target) && (this.filterVisible = !1, this.update());
|
|
1277
1381
|
});
|
|
1278
1382
|
}
|
|
@@ -1289,22 +1393,22 @@ class J extends y {
|
|
|
1289
1393
|
e.stopPropagation(), this.filterVisible = !this.filterVisible, this.update();
|
|
1290
1394
|
}
|
|
1291
1395
|
updateFilters(e, i) {
|
|
1292
|
-
var n,
|
|
1396
|
+
var n, o;
|
|
1293
1397
|
const s = { ...this.props.filtersEmitter.get() };
|
|
1294
|
-
e.size === 0 ? delete s[this.props.field] : s[this.props.field] = [...e.entries()], this.props.filtersEmitter.set(s, "table filters changed"), (
|
|
1398
|
+
e.size === 0 ? delete s[this.props.field] : s[this.props.field] = [...e.entries()], this.props.filtersEmitter.set(s, "table filters changed"), (o = (n = this.props).onFilterChange) == null || o.call(n, s, i);
|
|
1295
1399
|
}
|
|
1296
1400
|
render() {
|
|
1297
1401
|
const e = this.props.sortEmitter.get(), i = (e == null ? void 0 : e.field) === this.props.field ? e.direction : null, s = new Map(
|
|
1298
|
-
(this.props.filtersEmitter.get()[this.props.field] ?? []).filter(
|
|
1299
|
-
), n = this.props.label ?? String(this.props.field),
|
|
1402
|
+
(this.props.filtersEmitter.get()[this.props.field] ?? []).filter(Yt)
|
|
1403
|
+
), n = this.props.label ?? String(this.props.field), o = `Filter ${String(n)}`;
|
|
1300
1404
|
let l = null;
|
|
1301
|
-
return this.filterVisible && this.props.filterOptions != null && (l = /* @__PURE__ */
|
|
1302
|
-
|
|
1405
|
+
return this.filterVisible && this.props.filterOptions != null && (l = /* @__PURE__ */ h(
|
|
1406
|
+
Q,
|
|
1303
1407
|
{
|
|
1304
|
-
label:
|
|
1408
|
+
label: o,
|
|
1305
1409
|
options: this.props.filterOptions,
|
|
1306
1410
|
filters: s,
|
|
1307
|
-
onChange: (c,
|
|
1411
|
+
onChange: (c, u) => this.updateFilters(c, u),
|
|
1308
1412
|
...this.props.filterModes == null ? {} : { filterModes: this.props.filterModes },
|
|
1309
1413
|
...this.props.defaultSemanticState == null ? {} : { defaultSemanticState: this.props.defaultSemanticState }
|
|
1310
1414
|
},
|
|
@@ -1328,13 +1432,13 @@ class J extends y {
|
|
|
1328
1432
|
i === "asc" ? " ▲" : i === "desc" ? " ▼" : ""
|
|
1329
1433
|
]
|
|
1330
1434
|
}
|
|
1331
|
-
) : /* @__PURE__ */
|
|
1332
|
-
this.props.filterOptions == null ? null : /* @__PURE__ */
|
|
1435
|
+
) : /* @__PURE__ */ h("span", { children: n }),
|
|
1436
|
+
this.props.filterOptions == null ? null : /* @__PURE__ */ h(
|
|
1333
1437
|
"button",
|
|
1334
1438
|
{
|
|
1335
1439
|
type: "button",
|
|
1336
1440
|
"data-part": "filter-toggle",
|
|
1337
|
-
"aria-label":
|
|
1441
|
+
"aria-label": o,
|
|
1338
1442
|
"aria-expanded": String(this.filterVisible),
|
|
1339
1443
|
onClick: (c) => this.toggleFilterPanel(c),
|
|
1340
1444
|
children: "Filter"
|
|
@@ -1346,11 +1450,11 @@ class J extends y {
|
|
|
1346
1450
|
);
|
|
1347
1451
|
}
|
|
1348
1452
|
}
|
|
1349
|
-
|
|
1453
|
+
a(Y, "dependencies", [Q]), a(Y, "baseStyles", [
|
|
1350
1454
|
["th[aria-sort]", "noselect"],
|
|
1351
1455
|
['th[aria-sort] > [data-part="sort"]', ["uiline", "button"]],
|
|
1352
1456
|
['th[aria-sort] > [data-part="filter-toggle"]', ["uiline", "button"]]
|
|
1353
|
-
]),
|
|
1457
|
+
]), a(Y, "css", x`
|
|
1354
1458
|
th[aria-sort] {
|
|
1355
1459
|
position: relative;
|
|
1356
1460
|
text-align: start;
|
|
@@ -1367,13 +1471,13 @@ o(J, "dependencies", [U]), o(J, "baseStyles", [
|
|
|
1367
1471
|
font-size: 0.75em;
|
|
1368
1472
|
}
|
|
1369
1473
|
`);
|
|
1370
|
-
function
|
|
1474
|
+
function Yt(t) {
|
|
1371
1475
|
return typeof t[0] == "string" || typeof t[0] == "number";
|
|
1372
1476
|
}
|
|
1373
|
-
class
|
|
1477
|
+
class Ne extends g {
|
|
1374
1478
|
render() {
|
|
1375
|
-
return /* @__PURE__ */
|
|
1376
|
-
|
|
1479
|
+
return /* @__PURE__ */ h("thead", { "data-fray-component": "table-header", children: /* @__PURE__ */ h("tr", { children: this.props.columns.map((r) => /* @__PURE__ */ h(
|
|
1480
|
+
Y,
|
|
1377
1481
|
{
|
|
1378
1482
|
field: r.field,
|
|
1379
1483
|
sortEmitter: this.props.sortEmitter,
|
|
@@ -1389,124 +1493,124 @@ class ge extends y {
|
|
|
1389
1493
|
)) }) });
|
|
1390
1494
|
}
|
|
1391
1495
|
}
|
|
1392
|
-
|
|
1393
|
-
const
|
|
1394
|
-
[
|
|
1395
|
-
[
|
|
1396
|
-
[
|
|
1397
|
-
[
|
|
1496
|
+
a(Ne, "dependencies", [Y]);
|
|
1497
|
+
const er = {
|
|
1498
|
+
[y.Neutral]: "☐",
|
|
1499
|
+
[y.Prefer]: "",
|
|
1500
|
+
[y.Require]: "_",
|
|
1501
|
+
[y.Deny]: "!"
|
|
1398
1502
|
};
|
|
1399
|
-
function
|
|
1400
|
-
|
|
1503
|
+
function tr(t, { sort: r = null, filters: e = {} } = {}) {
|
|
1504
|
+
or(t), r != null && (xt(r), t.searchParams.set("sort", `${r.field}:${r.direction}`));
|
|
1401
1505
|
for (const [i, s] of Object.entries(e))
|
|
1402
|
-
for (const [n,
|
|
1403
|
-
if (!
|
|
1404
|
-
throw new TypeError(`Unknown filter mode for ${i}: ${String(
|
|
1506
|
+
for (const [n, o] of s) {
|
|
1507
|
+
if (!ye(o))
|
|
1508
|
+
throw new TypeError(`Unknown filter mode for ${i}: ${String(o)}`);
|
|
1405
1509
|
t.searchParams.append(
|
|
1406
1510
|
"filter",
|
|
1407
|
-
`${i}:${
|
|
1511
|
+
`${i}:${er[o]}:${JSON.stringify(n)}`
|
|
1408
1512
|
);
|
|
1409
1513
|
}
|
|
1410
1514
|
return t;
|
|
1411
1515
|
}
|
|
1412
|
-
function
|
|
1516
|
+
function rr(t, r, e) {
|
|
1413
1517
|
if (!Array.isArray(t)) throw new TypeError("Local table data must be an array");
|
|
1414
|
-
const i = t.filter((n) =>
|
|
1518
|
+
const i = t.filter((n) => ir(n, e));
|
|
1415
1519
|
if (r == null) return i;
|
|
1416
|
-
|
|
1520
|
+
xt(r);
|
|
1417
1521
|
const s = r.direction === "asc" ? 1 : -1;
|
|
1418
|
-
return [...i].sort((n,
|
|
1522
|
+
return [...i].sort((n, o) => nr(qe(n, r.field), qe(o, r.field)) * s);
|
|
1419
1523
|
}
|
|
1420
|
-
function
|
|
1524
|
+
function ir(t, r) {
|
|
1421
1525
|
for (const [e, i] of Object.entries(r)) {
|
|
1422
|
-
const s =
|
|
1423
|
-
if (i.filter(([, c]) => c ===
|
|
1424
|
-
const
|
|
1425
|
-
if (
|
|
1426
|
-
const l = i.filter(([, c]) => c ===
|
|
1526
|
+
const s = qe(t, e);
|
|
1527
|
+
if (i.filter(([, c]) => c === y.Deny).some(([c]) => Object.is(c, s))) return !1;
|
|
1528
|
+
const o = i.filter(([, c]) => c === y.Require);
|
|
1529
|
+
if (o.length > 0 && !o.some(([c]) => Object.is(c, s))) return !1;
|
|
1530
|
+
const l = i.filter(([, c]) => c === y.Prefer);
|
|
1427
1531
|
if (l.length > 0 && !l.some(([c]) => Object.is(c, s))) return !1;
|
|
1428
1532
|
}
|
|
1429
1533
|
return !0;
|
|
1430
1534
|
}
|
|
1431
|
-
function
|
|
1432
|
-
if (t == null || typeof t != "object" || typeof Reflect.get(t, "field") != "string" || !
|
|
1535
|
+
function xt(t) {
|
|
1536
|
+
if (t == null || typeof t != "object" || typeof Reflect.get(t, "field") != "string" || !sr(Reflect.get(t, "direction")))
|
|
1433
1537
|
throw new TypeError("Table sort must contain a field and asc/desc direction");
|
|
1434
1538
|
}
|
|
1435
|
-
function
|
|
1539
|
+
function sr(t) {
|
|
1436
1540
|
return t === "asc" || t === "desc";
|
|
1437
1541
|
}
|
|
1438
|
-
function
|
|
1542
|
+
function nr(t, r) {
|
|
1439
1543
|
return Object.is(t, r) ? 0 : t == null ? -1 : r == null ? 1 : typeof t == "number" && typeof r == "number" ? t - r : String(t).localeCompare(String(r));
|
|
1440
1544
|
}
|
|
1441
|
-
function
|
|
1545
|
+
function qe(t, r) {
|
|
1442
1546
|
if (!(t == null || typeof t != "object" && typeof t != "function"))
|
|
1443
1547
|
return Reflect.get(t, r);
|
|
1444
1548
|
}
|
|
1445
|
-
function
|
|
1549
|
+
function or(t) {
|
|
1446
1550
|
if (t == null || typeof t != "object" && typeof t != "function" || typeof Reflect.get(t, "toString") != "function")
|
|
1447
1551
|
throw new TypeError("Table serializer requires a URL");
|
|
1448
1552
|
const r = Reflect.get(t, "searchParams");
|
|
1449
1553
|
if (r == null || typeof Reflect.get(r, "set") != "function" || typeof Reflect.get(r, "append") != "function")
|
|
1450
1554
|
throw new TypeError("Table serializer requires URL search parameters");
|
|
1451
1555
|
}
|
|
1452
|
-
function
|
|
1453
|
-
const r =
|
|
1556
|
+
function ar(t) {
|
|
1557
|
+
const r = Ve(t), e = vt(t.data) ? null : new S(t.data, {
|
|
1454
1558
|
owner: t.owner,
|
|
1455
1559
|
purpose: "local table data"
|
|
1456
|
-
}), i = e ?? t.data, s = new
|
|
1560
|
+
}), i = e ?? t.data, s = new ge(
|
|
1457
1561
|
[i, r.sortEmitter, r.filtersEmitter],
|
|
1458
|
-
([n,
|
|
1562
|
+
([n, o, l]) => rr(n, o, l),
|
|
1459
1563
|
{ owner: t.owner, purpose: "local table view" }
|
|
1460
1564
|
);
|
|
1461
|
-
return new
|
|
1565
|
+
return new Me(s, r, () => {
|
|
1462
1566
|
s.dispose(), e == null || e.dispose();
|
|
1463
1567
|
});
|
|
1464
1568
|
}
|
|
1465
|
-
function
|
|
1466
|
-
|
|
1467
|
-
const r =
|
|
1468
|
-
return new
|
|
1569
|
+
function ri(t) {
|
|
1570
|
+
ur(t.query);
|
|
1571
|
+
const r = Ve(t);
|
|
1572
|
+
return new Me(t.query, r);
|
|
1469
1573
|
}
|
|
1470
|
-
function
|
|
1574
|
+
function lr(t) {
|
|
1471
1575
|
if (t.handler == null || typeof t.handler.fetch != "function")
|
|
1472
1576
|
throw new TypeError("Table data-source handler must implement fetch");
|
|
1473
|
-
const r =
|
|
1577
|
+
const r = Ve(t), e = new Ge("sort", r.sortEmitter, {
|
|
1474
1578
|
owner: t.owner,
|
|
1475
1579
|
purpose: "table sort argument"
|
|
1476
|
-
}), i = new
|
|
1580
|
+
}), i = new Ge("filters", r.filtersEmitter, {
|
|
1477
1581
|
owner: t.owner,
|
|
1478
1582
|
purpose: "table filters argument"
|
|
1479
|
-
}), s = new
|
|
1583
|
+
}), s = new $t({
|
|
1480
1584
|
handler: t.handler,
|
|
1481
1585
|
args: { sort: e, filters: i },
|
|
1482
1586
|
owner: t.owner,
|
|
1483
1587
|
purpose: "table query",
|
|
1484
1588
|
keepPreviousValue: !0
|
|
1485
1589
|
});
|
|
1486
|
-
return new
|
|
1590
|
+
return new Me(s, r, () => {
|
|
1487
1591
|
s.dispose(), e.dispose(), i.dispose();
|
|
1488
1592
|
});
|
|
1489
1593
|
}
|
|
1490
|
-
function
|
|
1594
|
+
function cr(t) {
|
|
1491
1595
|
if (typeof t.url != "string" || t.url.length === 0)
|
|
1492
1596
|
throw new TypeError("REST table data source requires a URL");
|
|
1493
1597
|
const r = {
|
|
1494
1598
|
url: t.url,
|
|
1495
|
-
serialize: t.serializeQuery ??
|
|
1599
|
+
serialize: t.serializeQuery ?? tr
|
|
1496
1600
|
};
|
|
1497
|
-
return t.baseUrl != null && (r.baseUrl = t.baseUrl), t.fetch != null && (r.fetch = t.fetch),
|
|
1498
|
-
handler: new
|
|
1601
|
+
return t.baseUrl != null && (r.baseUrl = t.baseUrl), t.fetch != null && (r.fetch = t.fetch), lr({
|
|
1602
|
+
handler: new Ot(r),
|
|
1499
1603
|
...t.sortEmitter == null ? {} : { sortEmitter: t.sortEmitter },
|
|
1500
1604
|
...t.filtersEmitter == null ? {} : { filtersEmitter: t.filtersEmitter },
|
|
1501
1605
|
...t.owner === void 0 ? {} : { owner: t.owner }
|
|
1502
1606
|
});
|
|
1503
1607
|
}
|
|
1504
|
-
class
|
|
1608
|
+
class Me {
|
|
1505
1609
|
constructor(r, e, i = null) {
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1610
|
+
a(this, "sortEmitter");
|
|
1611
|
+
a(this, "filtersEmitter");
|
|
1612
|
+
a(this, "retry");
|
|
1613
|
+
a(this, "disposed", !1);
|
|
1510
1614
|
this.query = r, this.state = e, this.disposeQuery = i, this.sortEmitter = e.sortEmitter, this.filtersEmitter = e.filtersEmitter, r.retry != null && (this.retry = (s) => {
|
|
1511
1615
|
var n;
|
|
1512
1616
|
return (n = r.retry) == null ? void 0 : n.call(r, s);
|
|
@@ -1517,11 +1621,11 @@ class Ie {
|
|
|
1517
1621
|
this.disposed || (this.disposed = !0, (r = this.disposeQuery) == null || r.call(this), (e = this.state.ownedSortEmitter) == null || e.dispose(), (i = this.state.ownedFiltersEmitter) == null || i.dispose());
|
|
1518
1622
|
}
|
|
1519
1623
|
}
|
|
1520
|
-
function
|
|
1521
|
-
const r = t.sortEmitter == null ? new
|
|
1624
|
+
function Ve(t) {
|
|
1625
|
+
const r = t.sortEmitter == null ? new S(null, {
|
|
1522
1626
|
owner: t.owner,
|
|
1523
1627
|
purpose: "table sort"
|
|
1524
|
-
}) : null, e = t.filtersEmitter == null ? new
|
|
1628
|
+
}) : null, e = t.filtersEmitter == null ? new S({}, {
|
|
1525
1629
|
owner: t.owner,
|
|
1526
1630
|
purpose: "table filters"
|
|
1527
1631
|
}) : null;
|
|
@@ -1532,31 +1636,31 @@ function ke(t) {
|
|
|
1532
1636
|
ownedFiltersEmitter: e
|
|
1533
1637
|
};
|
|
1534
1638
|
}
|
|
1535
|
-
function
|
|
1639
|
+
function vt(t) {
|
|
1536
1640
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function" && typeof Reflect.get(t, "getFetchState") == "function" && typeof Reflect.get(t, "getError") == "function";
|
|
1537
1641
|
}
|
|
1538
|
-
function
|
|
1539
|
-
if (!
|
|
1642
|
+
function ur(t) {
|
|
1643
|
+
if (!vt(t))
|
|
1540
1644
|
throw new TypeError("Table query must be an emitter");
|
|
1541
1645
|
}
|
|
1542
|
-
class
|
|
1646
|
+
class ie extends g {
|
|
1543
1647
|
constructor(e) {
|
|
1544
1648
|
var i, s;
|
|
1545
1649
|
super(e);
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1650
|
+
a(this, "columns");
|
|
1651
|
+
a(this, "rowKey");
|
|
1652
|
+
a(this, "sortEmitter");
|
|
1653
|
+
a(this, "filtersEmitter");
|
|
1654
|
+
a(this, "selectedItemsEmitter");
|
|
1655
|
+
a(this, "selectedItemEmitter");
|
|
1656
|
+
a(this, "selectionHandler");
|
|
1657
|
+
a(this, "query", null);
|
|
1658
|
+
a(this, "dataSource", null);
|
|
1659
|
+
a(this, "suppliedDataSource");
|
|
1660
|
+
a(this, "ownedSortEmitter");
|
|
1661
|
+
a(this, "ownedFiltersEmitter");
|
|
1662
|
+
a(this, "ownedDataSource", null);
|
|
1663
|
+
hr(e), this.columns = dr(e.columns), this.rowKey = pr(e.rowKey), this.suppliedDataSource = e.dataSource ?? null, this.ownedSortEmitter = this.suppliedDataSource == null ? new S(null, { owner: this, purpose: "table sort" }) : null, this.ownedFiltersEmitter = this.suppliedDataSource == null ? new S({}, { owner: this, purpose: "table filters" }) : null, this.sortEmitter = ((i = this.suppliedDataSource) == null ? void 0 : i.sortEmitter) ?? this.ownedSortEmitter, this.filtersEmitter = ((s = this.suppliedDataSource) == null ? void 0 : s.filtersEmitter) ?? this.ownedFiltersEmitter, this.selectionHandler = e.multiSelect === !0 ? pe({
|
|
1560
1664
|
owner: this,
|
|
1561
1665
|
multiSelect: !0,
|
|
1562
1666
|
...e.selectedItemsEmitter == null ? {} : { selectedItemsEmitter: e.selectedItemsEmitter },
|
|
@@ -1565,7 +1669,7 @@ class X extends y {
|
|
|
1565
1669
|
return ((n = this.query) == null ? void 0 : n.get()) ?? [];
|
|
1566
1670
|
},
|
|
1567
1671
|
getKey: this.rowKey
|
|
1568
|
-
}) :
|
|
1672
|
+
}) : pe({
|
|
1569
1673
|
owner: this,
|
|
1570
1674
|
...e.selectedItemEmitter == null ? {} : { selectedItemEmitter: e.selectedItemEmitter },
|
|
1571
1675
|
getItems: () => {
|
|
@@ -1573,15 +1677,15 @@ class X extends y {
|
|
|
1573
1677
|
return ((n = this.query) == null ? void 0 : n.get()) ?? [];
|
|
1574
1678
|
},
|
|
1575
1679
|
getKey: this.rowKey
|
|
1576
|
-
}), this.selectedItemsEmitter = this.selectionHandler.selectedItemsEmitter, this.selectedItemEmitter = this.selectionHandler instanceof
|
|
1680
|
+
}), this.selectedItemsEmitter = this.selectionHandler.selectedItemsEmitter, this.selectedItemEmitter = this.selectionHandler instanceof Fe ? this.selectionHandler.selectedItemEmitter : null;
|
|
1577
1681
|
}
|
|
1578
1682
|
initialize() {
|
|
1579
|
-
this.suppliedDataSource != null ? this.dataSource = this.suppliedDataSource : this.props.rest != null ? (this.ownedDataSource =
|
|
1683
|
+
this.suppliedDataSource != null ? this.dataSource = this.suppliedDataSource : this.props.rest != null ? (this.ownedDataSource = cr({
|
|
1580
1684
|
...this.props.rest,
|
|
1581
1685
|
sortEmitter: this.sortEmitter,
|
|
1582
1686
|
filtersEmitter: this.filtersEmitter,
|
|
1583
1687
|
owner: this
|
|
1584
|
-
}), this.dataSource = this.ownedDataSource) : (this.ownedDataSource =
|
|
1688
|
+
}), this.dataSource = this.ownedDataSource) : (this.ownedDataSource = ar({
|
|
1585
1689
|
data: this.props.data ?? [],
|
|
1586
1690
|
sortEmitter: this.sortEmitter,
|
|
1587
1691
|
filtersEmitter: this.filtersEmitter,
|
|
@@ -1589,11 +1693,11 @@ class X extends y {
|
|
|
1589
1693
|
}), this.dataSource = this.ownedDataSource), this.query = this.dataSource.query, this.watch(this.query, this.selectedItemsEmitter);
|
|
1590
1694
|
}
|
|
1591
1695
|
render() {
|
|
1592
|
-
var c,
|
|
1696
|
+
var c, u, p, f;
|
|
1593
1697
|
const e = ((c = this.query) == null ? void 0 : c.get()) ?? [];
|
|
1594
1698
|
if (!Array.isArray(e)) throw new TypeError("DataTable query value must be an array");
|
|
1595
|
-
const i = ((
|
|
1596
|
-
this.selectedItemsEmitter.get().map((
|
|
1699
|
+
const i = ((u = this.query) == null ? void 0 : u.getFetchState()) ?? k.Initial, s = (p = this.query) == null ? void 0 : p.getError(), n = i === k.Initial || i === k.Loading, o = new Set(
|
|
1700
|
+
this.selectedItemsEmitter.get().map((m, b) => this.rowKey(m, b))
|
|
1597
1701
|
), l = this.Host;
|
|
1598
1702
|
return /* @__PURE__ */ w(
|
|
1599
1703
|
l,
|
|
@@ -1602,25 +1706,25 @@ class X extends y {
|
|
|
1602
1706
|
"data-loading": n ? "" : null,
|
|
1603
1707
|
"data-error": i === k.Error ? "" : null,
|
|
1604
1708
|
children: [
|
|
1605
|
-
n ? /* @__PURE__ */
|
|
1709
|
+
n ? /* @__PURE__ */ h("p", { role: "status", children: "Loading rows…" }) : null,
|
|
1606
1710
|
i === k.Error ? /* @__PURE__ */ w("div", { role: "alert", children: [
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
typeof ((f = this.dataSource) == null ? void 0 : f.retry) == "function" ? /* @__PURE__ */
|
|
1711
|
+
/* @__PURE__ */ h("span", { children: mr(s, "Unable to load rows") }),
|
|
1712
|
+
typeof ((f = this.dataSource) == null ? void 0 : f.retry) == "function" ? /* @__PURE__ */ h(
|
|
1609
1713
|
"button",
|
|
1610
1714
|
{
|
|
1611
1715
|
type: "button",
|
|
1612
1716
|
onClick: () => {
|
|
1613
|
-
var
|
|
1614
|
-
return (
|
|
1717
|
+
var m, b;
|
|
1718
|
+
return (b = (m = this.dataSource) == null ? void 0 : m.retry) == null ? void 0 : b.call(m, "table retry");
|
|
1615
1719
|
},
|
|
1616
1720
|
children: "Retry"
|
|
1617
1721
|
}
|
|
1618
1722
|
) : null
|
|
1619
1723
|
] }) : null,
|
|
1620
1724
|
/* @__PURE__ */ w("table", { "aria-busy": n ? "true" : null, children: [
|
|
1621
|
-
this.props.caption == null ? null : /* @__PURE__ */
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
|
|
1725
|
+
this.props.caption == null ? null : /* @__PURE__ */ h("caption", { children: this.props.caption }),
|
|
1726
|
+
/* @__PURE__ */ h(
|
|
1727
|
+
Ne,
|
|
1624
1728
|
{
|
|
1625
1729
|
columns: this.columns,
|
|
1626
1730
|
sortEmitter: this.sortEmitter,
|
|
@@ -1631,32 +1735,32 @@ class X extends y {
|
|
|
1631
1735
|
},
|
|
1632
1736
|
"header"
|
|
1633
1737
|
),
|
|
1634
|
-
/* @__PURE__ */
|
|
1738
|
+
/* @__PURE__ */ h("tbody", { children: e.length > 0 ? e.map((m, b) => this.renderRow(m, b, o)) : n ? this.renderPlaceholders() : i === k.Error ? null : /* @__PURE__ */ h("tr", { children: /* @__PURE__ */ h("td", { colSpan: this.columns.length, children: this.props.emptyMessage ?? "No rows" }) }, "empty") })
|
|
1635
1739
|
] })
|
|
1636
1740
|
]
|
|
1637
1741
|
}
|
|
1638
1742
|
);
|
|
1639
1743
|
}
|
|
1640
1744
|
renderRow(e, i, s) {
|
|
1641
|
-
const n = this.rowKey(e, i),
|
|
1642
|
-
return /* @__PURE__ */
|
|
1745
|
+
const n = this.rowKey(e, i), o = s.has(n);
|
|
1746
|
+
return /* @__PURE__ */ h(
|
|
1643
1747
|
"tr",
|
|
1644
1748
|
{
|
|
1645
1749
|
"data-fray-selectable-row": "",
|
|
1646
1750
|
"data-index": i,
|
|
1647
|
-
"aria-selected": String(
|
|
1751
|
+
"aria-selected": String(o),
|
|
1648
1752
|
tabIndex: i === 0 ? 0 : -1,
|
|
1649
|
-
children: this.columns.map((l) => /* @__PURE__ */
|
|
1753
|
+
children: this.columns.map((l) => /* @__PURE__ */ h("td", { children: l.render ? l.render(e, i) : fr(e[l.field]) }, String(l.field)))
|
|
1650
1754
|
},
|
|
1651
1755
|
String(n)
|
|
1652
1756
|
);
|
|
1653
1757
|
}
|
|
1654
1758
|
renderPlaceholders() {
|
|
1655
1759
|
const e = this.props.placeholderCount ?? 5;
|
|
1656
|
-
return Array.from({ length: e }, (i, s) => /* @__PURE__ */
|
|
1657
|
-
|
|
1760
|
+
return Array.from({ length: e }, (i, s) => /* @__PURE__ */ h("tr", { children: this.columns.map((n, o) => /* @__PURE__ */ h("td", { children: /* @__PURE__ */ h(
|
|
1761
|
+
H,
|
|
1658
1762
|
{
|
|
1659
|
-
width: 45 + (s +
|
|
1763
|
+
width: 45 + (s + o) % 6 * 8
|
|
1660
1764
|
}
|
|
1661
1765
|
) }, String(n.field))) }, `placeholder-${s}`));
|
|
1662
1766
|
}
|
|
@@ -1682,7 +1786,7 @@ class X extends y {
|
|
|
1682
1786
|
this.selectionHandler.destroy(), (e = this.ownedDataSource) == null || e.dispose(), (i = this.ownedSortEmitter) == null || i.dispose(), (s = this.ownedFiltersEmitter) == null || s.dispose();
|
|
1683
1787
|
}
|
|
1684
1788
|
}
|
|
1685
|
-
|
|
1789
|
+
a(ie, "dependencies", [H, Ne]), a(ie, "hostName", "data-table"), a(ie, "standaloneHostName", "data-table"), a(ie, "css", x`
|
|
1686
1790
|
& {
|
|
1687
1791
|
overflow: auto;
|
|
1688
1792
|
}
|
|
@@ -1709,7 +1813,7 @@ o(X, "dependencies", [M, ge]), o(X, "hostName", "data-table"), o(X, "standaloneH
|
|
|
1709
1813
|
}
|
|
1710
1814
|
|
|
1711
1815
|
`);
|
|
1712
|
-
function
|
|
1816
|
+
function dr(t) {
|
|
1713
1817
|
if (!Array.isArray(t) || t.length === 0)
|
|
1714
1818
|
throw new TypeError("DataTable columns must be a non-empty array");
|
|
1715
1819
|
const r = /* @__PURE__ */ new Set();
|
|
@@ -1727,8 +1831,8 @@ function At(t) {
|
|
|
1727
1831
|
return e;
|
|
1728
1832
|
});
|
|
1729
1833
|
}
|
|
1730
|
-
function
|
|
1731
|
-
var
|
|
1834
|
+
function hr(t) {
|
|
1835
|
+
var o, l;
|
|
1732
1836
|
const e = [
|
|
1733
1837
|
"mode",
|
|
1734
1838
|
"query",
|
|
@@ -1747,12 +1851,12 @@ function Ft(t) {
|
|
|
1747
1851
|
throw new TypeError("DataTable accepts exactly one of data, dataSource, or rest");
|
|
1748
1852
|
if (s) {
|
|
1749
1853
|
const c = t.dataSource;
|
|
1750
|
-
if (c == null || typeof c != "object" || c.query == null || typeof ((
|
|
1854
|
+
if (c == null || typeof c != "object" || c.query == null || typeof ((o = c.sortEmitter) == null ? void 0 : o.set) != "function" || typeof ((l = c.filtersEmitter) == null ? void 0 : l.set) != "function" || typeof c.dispose != "function")
|
|
1751
1855
|
throw new TypeError("DataTable dataSource must implement the table data-source contract");
|
|
1752
1856
|
}
|
|
1753
1857
|
}
|
|
1754
|
-
function
|
|
1755
|
-
if (t == null) return
|
|
1858
|
+
function pr(t) {
|
|
1859
|
+
if (t == null) return He;
|
|
1756
1860
|
if (typeof t == "function") return t;
|
|
1757
1861
|
if (typeof t == "string" && t.length > 0)
|
|
1758
1862
|
return (r, e) => {
|
|
@@ -1763,18 +1867,18 @@ function Ht(t) {
|
|
|
1763
1867
|
};
|
|
1764
1868
|
throw new TypeError("DataTable rowKey must be a function or property name");
|
|
1765
1869
|
}
|
|
1766
|
-
function
|
|
1870
|
+
function fr(t) {
|
|
1767
1871
|
return t == null || typeof t == "string" || typeof t == "number" ? t : String(t);
|
|
1768
1872
|
}
|
|
1769
|
-
function
|
|
1873
|
+
function mr(t, r) {
|
|
1770
1874
|
return t instanceof Error ? t.message : t == null ? r : String(t);
|
|
1771
1875
|
}
|
|
1772
|
-
class
|
|
1876
|
+
class St extends g {
|
|
1773
1877
|
render() {
|
|
1774
1878
|
return this.props.children ?? [];
|
|
1775
1879
|
}
|
|
1776
1880
|
}
|
|
1777
|
-
function
|
|
1881
|
+
function W(t) {
|
|
1778
1882
|
if (!Array.isArray(t)) throw new TypeError("Tree nodes must be an array");
|
|
1779
1883
|
const r = /* @__PURE__ */ new Set(), e = (i) => {
|
|
1780
1884
|
for (const s of i) {
|
|
@@ -1788,21 +1892,21 @@ function B(t) {
|
|
|
1788
1892
|
};
|
|
1789
1893
|
e(t);
|
|
1790
1894
|
}
|
|
1791
|
-
function
|
|
1792
|
-
return
|
|
1895
|
+
function ii(t, r) {
|
|
1896
|
+
return W(t), Pe(t, r);
|
|
1793
1897
|
}
|
|
1794
|
-
function
|
|
1795
|
-
return new
|
|
1898
|
+
function si(t, r, e = null) {
|
|
1899
|
+
return new ge(
|
|
1796
1900
|
[t, r],
|
|
1797
|
-
([i, s]) => (
|
|
1901
|
+
([i, s]) => (W(i), s == null ? null : Pe(i, s)),
|
|
1798
1902
|
{ owner: e, purpose: "tree node projection" }
|
|
1799
1903
|
);
|
|
1800
1904
|
}
|
|
1801
|
-
function
|
|
1802
|
-
if (
|
|
1905
|
+
function br(t, r, e) {
|
|
1906
|
+
if (W(t), typeof e != "function") throw new TypeError("Tree node update must be a function");
|
|
1803
1907
|
const i = (n) => {
|
|
1804
|
-
for (let
|
|
1805
|
-
const l = n[
|
|
1908
|
+
for (let o = 0; o < n.length; o += 1) {
|
|
1909
|
+
const l = n[o];
|
|
1806
1910
|
if (Object.is(l.id, r)) {
|
|
1807
1911
|
const p = e(l);
|
|
1808
1912
|
if (p == null || typeof p != "object")
|
|
@@ -1811,52 +1915,52 @@ function qt(t, r, e) {
|
|
|
1811
1915
|
throw new Error("Tree node update cannot change the stable id");
|
|
1812
1916
|
if (Object.is(p, l)) return n;
|
|
1813
1917
|
const f = [...n];
|
|
1814
|
-
return f[
|
|
1918
|
+
return f[o] = p, f;
|
|
1815
1919
|
}
|
|
1816
|
-
const c = l.children ?? [],
|
|
1817
|
-
if (!Object.is(
|
|
1920
|
+
const c = l.children ?? [], u = i(c);
|
|
1921
|
+
if (!Object.is(u, c)) {
|
|
1818
1922
|
const p = [...n];
|
|
1819
|
-
return p[
|
|
1923
|
+
return p[o] = { ...l, children: u }, p;
|
|
1820
1924
|
}
|
|
1821
1925
|
}
|
|
1822
1926
|
return n;
|
|
1823
1927
|
}, s = i(t);
|
|
1824
|
-
return Object.is(s, t) ||
|
|
1928
|
+
return Object.is(s, t) || W(s), s;
|
|
1825
1929
|
}
|
|
1826
|
-
function
|
|
1827
|
-
const s = t.get(), n =
|
|
1930
|
+
function ni(t, r, e, i = "tree node updated") {
|
|
1931
|
+
const s = t.get(), n = br(s, r, e);
|
|
1828
1932
|
return Object.is(n, s) ? !1 : t.set(n, i);
|
|
1829
1933
|
}
|
|
1830
|
-
function
|
|
1934
|
+
function Pe(t, r) {
|
|
1831
1935
|
for (const e of t) {
|
|
1832
1936
|
if (Object.is(e.id, r)) return e;
|
|
1833
|
-
const i =
|
|
1937
|
+
const i = Pe(e.children ?? [], r);
|
|
1834
1938
|
if (i != null) return i;
|
|
1835
1939
|
}
|
|
1836
1940
|
return null;
|
|
1837
1941
|
}
|
|
1838
|
-
class
|
|
1942
|
+
class se extends g {
|
|
1839
1943
|
constructor(e) {
|
|
1840
1944
|
super(e);
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
if (
|
|
1945
|
+
a(this, "nodesEmitter");
|
|
1946
|
+
a(this, "selectedKeyEmitter");
|
|
1947
|
+
a(this, "expandedKeysEmitter");
|
|
1948
|
+
a(this, "ownedNodesEmitter");
|
|
1949
|
+
a(this, "ownedSelectedEmitter");
|
|
1950
|
+
a(this, "ownedExpandedEmitter");
|
|
1951
|
+
a(this, "focusedKey", null);
|
|
1952
|
+
a(this, "typeahead", "");
|
|
1953
|
+
a(this, "typeaheadTimer", null);
|
|
1954
|
+
if (Er(e.nodes))
|
|
1851
1955
|
this.nodesEmitter = e.nodes, this.ownedNodesEmitter = null;
|
|
1852
1956
|
else {
|
|
1853
|
-
const i = e.nodes ??
|
|
1854
|
-
this.ownedNodesEmitter = new
|
|
1957
|
+
const i = e.nodes ?? kt(e.children);
|
|
1958
|
+
this.ownedNodesEmitter = new S(i, {
|
|
1855
1959
|
owner: this,
|
|
1856
1960
|
purpose: "tree nodes"
|
|
1857
1961
|
}), this.nodesEmitter = this.ownedNodesEmitter;
|
|
1858
1962
|
}
|
|
1859
|
-
this.ownedSelectedEmitter = e.selectedKeyEmitter == null ? new
|
|
1963
|
+
this.ownedSelectedEmitter = e.selectedKeyEmitter == null ? new S(null, { owner: this, purpose: "selected tree key" }) : null, this.selectedKeyEmitter = e.selectedKeyEmitter ?? this.ownedSelectedEmitter, this.ownedExpandedEmitter = e.expandedKeysEmitter == null ? new S([], { owner: this, purpose: "expanded tree keys" }) : null, this.expandedKeysEmitter = e.expandedKeysEmitter ?? this.ownedExpandedEmitter;
|
|
1860
1964
|
}
|
|
1861
1965
|
initialize() {
|
|
1862
1966
|
this.reconcile(this.nodesEmitter.get()), this.watch(this.nodesEmitter, this.selectedKeyEmitter, this.expandedKeysEmitter), this.onCleanup(this.nodesEmitter.subscribe(({ value: e }) => this.reconcile(e), {
|
|
@@ -1865,46 +1969,46 @@ class Z extends y {
|
|
|
1865
1969
|
}
|
|
1866
1970
|
render() {
|
|
1867
1971
|
const e = this.nodesEmitter.get();
|
|
1868
|
-
|
|
1869
|
-
const i = new Set(this.expandedKeysEmitter.get()), s =
|
|
1870
|
-
this.focusedKey = (
|
|
1972
|
+
W(e);
|
|
1973
|
+
const i = new Set(this.expandedKeysEmitter.get()), s = et(e, i), n = this.selectedKeyEmitter.get(), o = s.find(({ node: c }) => Object.is(c.id, this.focusedKey)) ?? s.find(({ node: c }) => Object.is(c.id, n)) ?? s[0] ?? null;
|
|
1974
|
+
this.focusedKey = (o == null ? void 0 : o.node.id) ?? null;
|
|
1871
1975
|
const l = this.Host;
|
|
1872
|
-
return /* @__PURE__ */
|
|
1873
|
-
var
|
|
1874
|
-
const { node: p, depth: f, position:
|
|
1976
|
+
return /* @__PURE__ */ h(l, { className: R("datacomponentlike", E(this.props)), children: s.length === 0 ? /* @__PURE__ */ h("p", { role: "status", children: "No tree items" }) : /* @__PURE__ */ h("div", { role: "tree", "aria-label": this.props.label, children: s.map((c, u) => {
|
|
1977
|
+
var z, L, F;
|
|
1978
|
+
const { node: p, depth: f, position: m, setSize: b } = c, v = (((z = p.children) == null ? void 0 : z.length) ?? 0) > 0, I = v && i.has(p.id), A = Object.is(p.id, n), N = ((F = (L = this.props).renderItem) == null ? void 0 : F.call(L, p, f)) ?? p.label;
|
|
1875
1979
|
return /* @__PURE__ */ w(
|
|
1876
1980
|
"div",
|
|
1877
1981
|
{
|
|
1878
1982
|
role: "treeitem",
|
|
1879
|
-
"data-index":
|
|
1983
|
+
"data-index": u,
|
|
1880
1984
|
"data-depth": f,
|
|
1881
1985
|
"aria-level": f + 1,
|
|
1882
|
-
"aria-posinset":
|
|
1883
|
-
"aria-setsize":
|
|
1884
|
-
"aria-expanded":
|
|
1885
|
-
"aria-selected": String(
|
|
1886
|
-
tabIndex: Object.is(p.id,
|
|
1986
|
+
"aria-posinset": m,
|
|
1987
|
+
"aria-setsize": b,
|
|
1988
|
+
"aria-expanded": v ? String(I) : null,
|
|
1989
|
+
"aria-selected": String(A),
|
|
1990
|
+
tabIndex: Object.is(p.id, o == null ? void 0 : o.node.id) ? 0 : -1,
|
|
1887
1991
|
style: { "--tree-depth": f },
|
|
1888
1992
|
onClick: (T) => {
|
|
1889
|
-
if (this.focusedKey = p.id,
|
|
1993
|
+
if (this.focusedKey = p.id, xr(T.target) && v) {
|
|
1890
1994
|
this.toggleExpanded(p.id), this.focusRow(p.id);
|
|
1891
1995
|
return;
|
|
1892
1996
|
}
|
|
1893
1997
|
this.selectNode(p, T);
|
|
1894
1998
|
},
|
|
1895
1999
|
onFocus: () => this.focusedKey = p.id,
|
|
1896
|
-
onKeyDown: (T) => this.handleKeyDown(T,
|
|
2000
|
+
onKeyDown: (T) => this.handleKeyDown(T, u, s),
|
|
1897
2001
|
children: [
|
|
1898
|
-
/* @__PURE__ */
|
|
2002
|
+
/* @__PURE__ */ h(
|
|
1899
2003
|
"span",
|
|
1900
2004
|
{
|
|
1901
2005
|
"data-part": "expander",
|
|
1902
|
-
"data-expandable":
|
|
2006
|
+
"data-expandable": v ? "" : null,
|
|
1903
2007
|
"aria-hidden": "true",
|
|
1904
|
-
children:
|
|
2008
|
+
children: v ? I ? "▾" : "▸" : "•"
|
|
1905
2009
|
}
|
|
1906
2010
|
),
|
|
1907
|
-
/* @__PURE__ */
|
|
2011
|
+
/* @__PURE__ */ h("span", { "data-part": "label", children: N })
|
|
1908
2012
|
]
|
|
1909
2013
|
},
|
|
1910
2014
|
p.id
|
|
@@ -1916,14 +2020,14 @@ class Z extends y {
|
|
|
1916
2020
|
this.typeaheadTimer != null && clearTimeout(this.typeaheadTimer), (e = this.ownedNodesEmitter) == null || e.dispose(), (i = this.ownedSelectedEmitter) == null || i.dispose(), (s = this.ownedExpandedEmitter) == null || s.dispose();
|
|
1917
2021
|
}
|
|
1918
2022
|
reconcile(e) {
|
|
1919
|
-
|
|
1920
|
-
const i = new Set(
|
|
2023
|
+
W(e);
|
|
2024
|
+
const i = new Set(gr(e).map(({ node: l }) => l.id)), s = this.selectedKeyEmitter.get();
|
|
1921
2025
|
this.ownedSelectedEmitter != null && s != null && !i.has(s) && this.selectedKeyEmitter.set(null, "selected tree item removed");
|
|
1922
|
-
const n = this.expandedKeysEmitter.get(),
|
|
1923
|
-
this.ownedExpandedEmitter != null && !
|
|
2026
|
+
const n = this.expandedKeysEmitter.get(), o = n.filter((l) => i.has(l));
|
|
2027
|
+
this.ownedExpandedEmitter != null && !wr(n, o) && this.expandedKeysEmitter.set(o, "removed tree expansions reconciled"), this.focusedKey != null && !i.has(this.focusedKey) && (this.focusedKey = null);
|
|
1924
2028
|
}
|
|
1925
2029
|
selectNode(e, i) {
|
|
1926
|
-
this.selectedKeyEmitter.set(e.id, "tree item selected"),
|
|
2030
|
+
this.selectedKeyEmitter.set(e.id, "tree item selected"), C(this.props.onSelect, e, i), this.focusRow(e.id);
|
|
1927
2031
|
}
|
|
1928
2032
|
toggleExpanded(e) {
|
|
1929
2033
|
const i = this.expandedKeysEmitter.get(), s = i.some((n) => Object.is(n, e));
|
|
@@ -1933,18 +2037,18 @@ class Z extends y {
|
|
|
1933
2037
|
);
|
|
1934
2038
|
}
|
|
1935
2039
|
handleKeyDown(e, i, s) {
|
|
1936
|
-
var
|
|
2040
|
+
var o, l, c, u;
|
|
1937
2041
|
const n = s[i];
|
|
1938
2042
|
if (n != null) {
|
|
1939
|
-
if (e.key === "ArrowDown") return this.move(e, (
|
|
2043
|
+
if (e.key === "ArrowDown") return this.move(e, (o = s[i + 1]) == null ? void 0 : o.node.id);
|
|
1940
2044
|
if (e.key === "ArrowUp") return this.move(e, (l = s[i - 1]) == null ? void 0 : l.node.id);
|
|
1941
2045
|
if (e.key === "Home") return this.move(e, (c = s[0]) == null ? void 0 : c.node.id);
|
|
1942
|
-
if (e.key === "End") return this.move(e, (
|
|
2046
|
+
if (e.key === "End") return this.move(e, (u = s.at(-1)) == null ? void 0 : u.node.id);
|
|
1943
2047
|
if (e.key === "ArrowRight") {
|
|
1944
2048
|
e.preventDefault();
|
|
1945
2049
|
const p = n.node.children ?? [];
|
|
1946
2050
|
if (p.length === 0) return;
|
|
1947
|
-
this.expandedKeysEmitter.get().some((
|
|
2051
|
+
this.expandedKeysEmitter.get().some((m) => Object.is(m, n.node.id)) ? this.focusRow(p[0].id) : this.toggleExpanded(n.node.id);
|
|
1948
2052
|
return;
|
|
1949
2053
|
}
|
|
1950
2054
|
if (e.key === "ArrowLeft") {
|
|
@@ -1966,10 +2070,10 @@ class Z extends y {
|
|
|
1966
2070
|
this.focusedKey = e;
|
|
1967
2071
|
const i = this.dom instanceof Element ? [...this.dom.querySelectorAll('[role="treeitem"]')] : [];
|
|
1968
2072
|
for (const n of i) {
|
|
1969
|
-
const
|
|
2073
|
+
const o = Number(n.dataset.index), l = et(
|
|
1970
2074
|
this.nodesEmitter.get(),
|
|
1971
2075
|
new Set(this.expandedKeysEmitter.get())
|
|
1972
|
-
), c = Object.is((s = l[
|
|
2076
|
+
), c = Object.is((s = l[o]) == null ? void 0 : s.node.id, e);
|
|
1973
2077
|
n.tabIndex = c ? 0 : -1, c && n.focus();
|
|
1974
2078
|
}
|
|
1975
2079
|
}
|
|
@@ -1977,11 +2081,11 @@ class Z extends y {
|
|
|
1977
2081
|
e.preventDefault(), this.typeaheadTimer != null && clearTimeout(this.typeaheadTimer), this.typeahead += e.key.toLocaleLowerCase(), this.typeaheadTimer = setTimeout(() => {
|
|
1978
2082
|
this.typeahead = "", this.typeaheadTimer = null;
|
|
1979
2083
|
}, 650);
|
|
1980
|
-
const
|
|
1981
|
-
|
|
2084
|
+
const o = [...i.slice(s + 1), ...i.slice(0, s + 1)].find(({ node: l }) => yr(l).toLocaleLowerCase().startsWith(this.typeahead));
|
|
2085
|
+
o != null && this.focusRow(o.node.id);
|
|
1982
2086
|
}
|
|
1983
2087
|
}
|
|
1984
|
-
|
|
2088
|
+
a(se, "dependencies", [St]), a(se, "hostName", "tree-view"), a(se, "standaloneHostName", "tree-view"), a(se, "css", x`
|
|
1985
2089
|
& {
|
|
1986
2090
|
display: flex;
|
|
1987
2091
|
flex-direction: column;
|
|
@@ -2032,50 +2136,50 @@ o(Z, "dependencies", [Je]), o(Z, "hostName", "tree-view"), o(Z, "standaloneHostN
|
|
|
2032
2136
|
}
|
|
2033
2137
|
}
|
|
2034
2138
|
`);
|
|
2035
|
-
function
|
|
2036
|
-
return (Array.isArray(t) ? t : t == null ? [] : [t]).filter((e) =>
|
|
2037
|
-
if (!
|
|
2139
|
+
function kt(t) {
|
|
2140
|
+
return (Array.isArray(t) ? t : t == null ? [] : [t]).filter((e) => de(e) && e.type === St).map((e) => {
|
|
2141
|
+
if (!de(e)) throw new TypeError("TreeView children must be TreeItem nodes");
|
|
2038
2142
|
const i = e.props;
|
|
2039
2143
|
return {
|
|
2040
2144
|
id: i.id,
|
|
2041
2145
|
label: i.label,
|
|
2042
2146
|
...i.textValue == null ? {} : { textValue: i.textValue },
|
|
2043
2147
|
...i.value === void 0 ? {} : { value: i.value },
|
|
2044
|
-
children:
|
|
2148
|
+
children: kt(i.children)
|
|
2045
2149
|
};
|
|
2046
2150
|
});
|
|
2047
2151
|
}
|
|
2048
|
-
function
|
|
2049
|
-
const e = [], i = (s, n,
|
|
2152
|
+
function et(t, r) {
|
|
2153
|
+
const e = [], i = (s, n, o) => {
|
|
2050
2154
|
s.forEach((l, c) => {
|
|
2051
|
-
var
|
|
2052
|
-
e.push({ node: l, depth: n, parentId:
|
|
2155
|
+
var u;
|
|
2156
|
+
e.push({ node: l, depth: n, parentId: o, position: c + 1, setSize: s.length }), (((u = l.children) == null ? void 0 : u.length) ?? 0) > 0 && r.has(l.id) && i(l.children ?? [], n + 1, l.id);
|
|
2053
2157
|
});
|
|
2054
2158
|
};
|
|
2055
2159
|
return i(t, 0, null), e;
|
|
2056
2160
|
}
|
|
2057
|
-
function
|
|
2058
|
-
const r = /* @__PURE__ */ new Set(), e = [], i = (s, n,
|
|
2161
|
+
function gr(t) {
|
|
2162
|
+
const r = /* @__PURE__ */ new Set(), e = [], i = (s, n, o) => {
|
|
2059
2163
|
s.forEach((l, c) => {
|
|
2060
2164
|
if (r.has(l.id)) throw new Error(`Duplicate tree item id: ${String(l.id)}`);
|
|
2061
|
-
r.add(l.id), e.push({ node: l, depth: n, parentId:
|
|
2165
|
+
r.add(l.id), e.push({ node: l, depth: n, parentId: o, position: c + 1, setSize: s.length }), i(l.children ?? [], n + 1, l.id);
|
|
2062
2166
|
});
|
|
2063
2167
|
};
|
|
2064
2168
|
return i(t, 0, null), e;
|
|
2065
2169
|
}
|
|
2066
|
-
function
|
|
2170
|
+
function yr(t) {
|
|
2067
2171
|
return t.textValue != null ? t.textValue : typeof t.label == "string" || typeof t.label == "number" ? String(t.label) : String(t.id);
|
|
2068
2172
|
}
|
|
2069
|
-
function
|
|
2173
|
+
function wr(t, r) {
|
|
2070
2174
|
return t.length === r.length && t.every((e, i) => Object.is(e, r[i]));
|
|
2071
2175
|
}
|
|
2072
|
-
function
|
|
2176
|
+
function Er(t) {
|
|
2073
2177
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
2074
2178
|
}
|
|
2075
|
-
function
|
|
2179
|
+
function xr(t) {
|
|
2076
2180
|
return t instanceof Element && t.closest('[data-part="expander"]') != null;
|
|
2077
2181
|
}
|
|
2078
|
-
class
|
|
2182
|
+
class fe extends g {
|
|
2079
2183
|
constructor(r = {}) {
|
|
2080
2184
|
if (super(r), r.onClick != null && typeof r.onClick != "function")
|
|
2081
2185
|
throw new TypeError("Button onClick must be a function");
|
|
@@ -2087,55 +2191,55 @@ class ne extends y {
|
|
|
2087
2191
|
type: i = "button",
|
|
2088
2192
|
disabled: s = !1,
|
|
2089
2193
|
pressed: n,
|
|
2090
|
-
busy:
|
|
2194
|
+
busy: o = !1,
|
|
2091
2195
|
busyLabel: l,
|
|
2092
2196
|
id: c,
|
|
2093
|
-
name:
|
|
2197
|
+
name: u,
|
|
2094
2198
|
value: p,
|
|
2095
2199
|
title: f,
|
|
2096
|
-
ariaLabel:
|
|
2097
|
-
onClick:
|
|
2098
|
-
} = this.props,
|
|
2099
|
-
return /* @__PURE__ */
|
|
2200
|
+
ariaLabel: m,
|
|
2201
|
+
onClick: b
|
|
2202
|
+
} = this.props, I = (Array.isArray(r) ? r.length > 0 : r != null && typeof r != "boolean") ? r : e ?? "", A = o ? l ?? I : I, N = s || o;
|
|
2203
|
+
return /* @__PURE__ */ h(
|
|
2100
2204
|
"button",
|
|
2101
2205
|
{
|
|
2102
2206
|
id: c,
|
|
2103
|
-
name:
|
|
2207
|
+
name: u,
|
|
2104
2208
|
value: p == null ? void 0 : String(p),
|
|
2105
2209
|
title: f,
|
|
2106
2210
|
type: i,
|
|
2107
|
-
disabled:
|
|
2211
|
+
disabled: N,
|
|
2108
2212
|
className: E(this.props) || void 0,
|
|
2109
2213
|
"data-fray-component": "button",
|
|
2110
|
-
"aria-label":
|
|
2214
|
+
"aria-label": m,
|
|
2111
2215
|
"aria-pressed": n == null ? null : String(!!n),
|
|
2112
|
-
"aria-busy":
|
|
2113
|
-
onClick: (
|
|
2114
|
-
|
|
2216
|
+
"aria-busy": o ? "true" : null,
|
|
2217
|
+
onClick: (z) => {
|
|
2218
|
+
N || C(b, z);
|
|
2115
2219
|
},
|
|
2116
|
-
children:
|
|
2220
|
+
children: A
|
|
2117
2221
|
}
|
|
2118
2222
|
);
|
|
2119
2223
|
}
|
|
2120
2224
|
}
|
|
2121
|
-
|
|
2225
|
+
a(fe, "baseStyles", [
|
|
2122
2226
|
["button", ["uiline", "button"]]
|
|
2123
|
-
]),
|
|
2227
|
+
]), a(fe, "css", x`
|
|
2124
2228
|
button {
|
|
2125
2229
|
font-family: inherit;
|
|
2126
2230
|
}
|
|
2127
2231
|
`);
|
|
2128
|
-
class
|
|
2232
|
+
class tt extends g {
|
|
2129
2233
|
constructor(e) {
|
|
2130
2234
|
super(e);
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
this.openEmitter =
|
|
2235
|
+
a(this, "openEmitter");
|
|
2236
|
+
a(this, "dialogId");
|
|
2237
|
+
a(this, "titleId");
|
|
2238
|
+
a(this, "descriptionId");
|
|
2239
|
+
a(this, "dialogElement", null);
|
|
2240
|
+
a(this, "restoreFocusTo", null);
|
|
2241
|
+
a(this, "synchronizedOpen", !1);
|
|
2242
|
+
this.openEmitter = K(this, e, !1, "dialog open state"), this.dialogId = j("dialog", e.id), this.titleId = `${this.dialogId}-title`, this.descriptionId = `${this.dialogId}-description`;
|
|
2139
2243
|
}
|
|
2140
2244
|
initialize() {
|
|
2141
2245
|
this.watch(this.openEmitter);
|
|
@@ -2146,7 +2250,7 @@ class Oe extends y {
|
|
|
2146
2250
|
description: i,
|
|
2147
2251
|
actions: s,
|
|
2148
2252
|
closeLabel: n = "Close",
|
|
2149
|
-
showCloseButton:
|
|
2253
|
+
showCloseButton: o = !0,
|
|
2150
2254
|
children: l = []
|
|
2151
2255
|
} = this.props;
|
|
2152
2256
|
return /* @__PURE__ */ w(
|
|
@@ -2160,13 +2264,13 @@ class Oe extends y {
|
|
|
2160
2264
|
"aria-modal": "true",
|
|
2161
2265
|
ref: (c) => this.dialogElement = c,
|
|
2162
2266
|
children: [
|
|
2163
|
-
/* @__PURE__ */
|
|
2164
|
-
i == null ? null : /* @__PURE__ */
|
|
2165
|
-
/* @__PURE__ */
|
|
2166
|
-
s == null && !
|
|
2267
|
+
/* @__PURE__ */ h("header", { children: /* @__PURE__ */ h("h2", { id: this.titleId, children: e }) }),
|
|
2268
|
+
i == null ? null : /* @__PURE__ */ h("p", { id: this.descriptionId, children: i }),
|
|
2269
|
+
/* @__PURE__ */ h("div", { "data-part": "content", children: l }),
|
|
2270
|
+
s == null && !o ? null : /* @__PURE__ */ w("footer", { children: [
|
|
2167
2271
|
s,
|
|
2168
|
-
|
|
2169
|
-
|
|
2272
|
+
o ? /* @__PURE__ */ h(
|
|
2273
|
+
fe,
|
|
2170
2274
|
{
|
|
2171
2275
|
label: n,
|
|
2172
2276
|
onClick: () => this.requestClose()
|
|
@@ -2204,7 +2308,7 @@ class Oe extends y {
|
|
|
2204
2308
|
const i = this.openEmitter.get();
|
|
2205
2309
|
if (i && !this.synchronizedOpen) {
|
|
2206
2310
|
const s = document.activeElement;
|
|
2207
|
-
this.restoreFocusTo = s instanceof HTMLElement ? s : null,
|
|
2311
|
+
this.restoreFocusTo = s instanceof HTMLElement ? s : null, vr(e), this.synchronizedOpen = !0, Sr(e, this.props.initialFocusRef);
|
|
2208
2312
|
return;
|
|
2209
2313
|
}
|
|
2210
2314
|
!i && this.synchronizedOpen && (e.open && typeof e.close == "function" ? e.close() : e.removeAttribute("open"), this.finishClose());
|
|
@@ -2213,10 +2317,10 @@ class Oe extends y {
|
|
|
2213
2317
|
if (!this.synchronizedOpen && this.restoreFocusTo == null) return;
|
|
2214
2318
|
this.synchronizedOpen = !1;
|
|
2215
2319
|
const e = this.restoreFocusTo;
|
|
2216
|
-
this.restoreFocusTo = null, (e == null ? void 0 : e.isConnected) === !0 && e.focus(),
|
|
2320
|
+
this.restoreFocusTo = null, (e == null ? void 0 : e.isConnected) === !0 && e.focus(), C(this.props.onClose);
|
|
2217
2321
|
}
|
|
2218
2322
|
}
|
|
2219
|
-
|
|
2323
|
+
a(tt, "dependencies", [fe]), a(tt, "css", x`
|
|
2220
2324
|
dialog {
|
|
2221
2325
|
width: min(38rem, calc(100vw - 2rem));
|
|
2222
2326
|
max-height: min(42rem, calc(100dvh - 2rem));
|
|
@@ -2251,7 +2355,7 @@ o(Oe, "dependencies", [ne]), o(Oe, "css", S`
|
|
|
2251
2355
|
}
|
|
2252
2356
|
}
|
|
2253
2357
|
`);
|
|
2254
|
-
function
|
|
2358
|
+
function vr(t) {
|
|
2255
2359
|
if (!t.open) {
|
|
2256
2360
|
if (typeof t.showModal == "function") {
|
|
2257
2361
|
t.showModal();
|
|
@@ -2260,52 +2364,52 @@ function Gt(t) {
|
|
|
2260
2364
|
t.setAttribute("open", "");
|
|
2261
2365
|
}
|
|
2262
2366
|
}
|
|
2263
|
-
function
|
|
2367
|
+
function Sr(t, r) {
|
|
2264
2368
|
const i = (r == null || typeof r == "function" ? null : r.current) ?? t.querySelector(
|
|
2265
2369
|
'[autofocus], button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
2266
2370
|
);
|
|
2267
2371
|
i == null || i.focus();
|
|
2268
2372
|
}
|
|
2269
|
-
const
|
|
2373
|
+
const M = class M extends q {
|
|
2270
2374
|
constructor(r = {}) {
|
|
2271
|
-
super({ ...r, symbols:
|
|
2375
|
+
super({ ...r, symbols: M.symbols });
|
|
2272
2376
|
}
|
|
2273
2377
|
};
|
|
2274
|
-
|
|
2275
|
-
["✖",
|
|
2276
|
-
["☐",
|
|
2277
|
-
["✓",
|
|
2278
|
-
["+",
|
|
2279
|
-
]),
|
|
2280
|
-
let
|
|
2281
|
-
const
|
|
2378
|
+
a(M, "hostName", "quad-checkbox"), a(M, "standaloneHostName", "quad-checkbox"), a(M, "symbols", [
|
|
2379
|
+
["✖", y.Deny],
|
|
2380
|
+
["☐", y.Neutral],
|
|
2381
|
+
["✓", y.Prefer],
|
|
2382
|
+
["+", y.Require]
|
|
2383
|
+
]), a(M, "defaultSemanticState", y.Neutral);
|
|
2384
|
+
let rt = M;
|
|
2385
|
+
const V = class V extends q {
|
|
2282
2386
|
constructor(r = {}) {
|
|
2283
|
-
super({ ...r, symbols:
|
|
2387
|
+
super({ ...r, symbols: V.symbols });
|
|
2284
2388
|
}
|
|
2285
2389
|
};
|
|
2286
|
-
|
|
2287
|
-
["✖",
|
|
2288
|
-
["☐",
|
|
2289
|
-
["✓",
|
|
2290
|
-
]),
|
|
2291
|
-
let
|
|
2292
|
-
class
|
|
2390
|
+
a(V, "hostName", "tri-checkbox"), a(V, "standaloneHostName", "tri-checkbox"), a(V, "symbols", [
|
|
2391
|
+
["✖", y.Deny],
|
|
2392
|
+
["☐", y.Neutral],
|
|
2393
|
+
["✓", y.Prefer]
|
|
2394
|
+
]), a(V, "defaultSemanticState", y.Neutral);
|
|
2395
|
+
let it = V;
|
|
2396
|
+
class ne extends g {
|
|
2293
2397
|
constructor(e = {}) {
|
|
2294
2398
|
var n;
|
|
2295
2399
|
super(e);
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
this.inputId =
|
|
2400
|
+
a(this, "inputId");
|
|
2401
|
+
a(this, "errorId");
|
|
2402
|
+
a(this, "optionsEmitter");
|
|
2403
|
+
a(this, "valueEmitter");
|
|
2404
|
+
a(this, "ownsOptionsEmitter");
|
|
2405
|
+
this.inputId = j("dropdown", e.id), this.errorId = `${this.inputId}-error`;
|
|
2302
2406
|
const i = e.options ?? [];
|
|
2303
|
-
|
|
2407
|
+
kr(i) ? (this.optionsEmitter = i, this.ownsOptionsEmitter = !1) : (he(i), this.optionsEmitter = new S(i, {
|
|
2304
2408
|
owner: this,
|
|
2305
2409
|
purpose: "dropdown options"
|
|
2306
2410
|
}), this.ownsOptionsEmitter = !0);
|
|
2307
2411
|
const s = ((n = this.optionsEmitter.get()[0]) == null ? void 0 : n.value) ?? "";
|
|
2308
|
-
this.valueEmitter =
|
|
2412
|
+
this.valueEmitter = K(this, e, s, "dropdown value");
|
|
2309
2413
|
}
|
|
2310
2414
|
initialize() {
|
|
2311
2415
|
this.watch(this.valueEmitter, this.optionsEmitter);
|
|
@@ -2316,22 +2420,22 @@ class ee extends y {
|
|
|
2316
2420
|
name: i,
|
|
2317
2421
|
disabled: s = !1,
|
|
2318
2422
|
required: n = !1,
|
|
2319
|
-
error:
|
|
2423
|
+
error: o = null,
|
|
2320
2424
|
placeholder: l = "Select…",
|
|
2321
2425
|
ariaLabel: c,
|
|
2322
|
-
onChange:
|
|
2426
|
+
onChange: u
|
|
2323
2427
|
} = this.props, p = this.optionsEmitter.get() ?? [];
|
|
2324
|
-
|
|
2325
|
-
const f = this.valueEmitter.get(),
|
|
2428
|
+
he(p);
|
|
2429
|
+
const f = this.valueEmitter.get(), m = this.Host;
|
|
2326
2430
|
return /* @__PURE__ */ w(
|
|
2327
|
-
|
|
2431
|
+
m,
|
|
2328
2432
|
{
|
|
2329
2433
|
className: R("selectshell", E(this.props)),
|
|
2330
2434
|
"data-disabled": s ? "" : null,
|
|
2331
2435
|
"data-required": n ? "" : null,
|
|
2332
|
-
"data-error":
|
|
2436
|
+
"data-error": o == null ? null : "",
|
|
2333
2437
|
children: [
|
|
2334
|
-
e == null ? null : /* @__PURE__ */
|
|
2438
|
+
e == null ? null : /* @__PURE__ */ h("label", { htmlFor: this.inputId, children: e }),
|
|
2335
2439
|
/* @__PURE__ */ w(
|
|
2336
2440
|
"select",
|
|
2337
2441
|
{
|
|
@@ -2341,37 +2445,37 @@ class ee extends y {
|
|
|
2341
2445
|
disabled: s,
|
|
2342
2446
|
required: n,
|
|
2343
2447
|
"aria-label": e == null ? c : null,
|
|
2344
|
-
"aria-invalid":
|
|
2345
|
-
"aria-describedby":
|
|
2346
|
-
onChange: (
|
|
2347
|
-
const
|
|
2348
|
-
this.valueEmitter.set(
|
|
2448
|
+
"aria-invalid": o == null ? null : "true",
|
|
2449
|
+
"aria-describedby": o == null ? null : this.errorId,
|
|
2450
|
+
onChange: (b) => {
|
|
2451
|
+
const v = Ir(b, "dropdown change"), I = p.find(({ value: N }) => String(N) === v), A = (I == null ? void 0 : I.value) ?? v;
|
|
2452
|
+
this.valueEmitter.set(A, "dropdown selection"), C(u, A, b);
|
|
2349
2453
|
},
|
|
2350
2454
|
children: [
|
|
2351
|
-
f == null || f === "" ? /* @__PURE__ */
|
|
2352
|
-
p.map((
|
|
2353
|
-
if (
|
|
2455
|
+
f == null || f === "" ? /* @__PURE__ */ h("option", { value: "", disabled: n, selected: !0, children: l }) : null,
|
|
2456
|
+
p.map((b) => {
|
|
2457
|
+
if (b == null || !Object.hasOwn(b, "value"))
|
|
2354
2458
|
throw new TypeError("Dropdown options require value and label fields");
|
|
2355
|
-
return /* @__PURE__ */
|
|
2459
|
+
return /* @__PURE__ */ h(
|
|
2356
2460
|
"option",
|
|
2357
2461
|
{
|
|
2358
|
-
value: String(
|
|
2359
|
-
disabled: !!
|
|
2360
|
-
selected: Object.is(f,
|
|
2361
|
-
children:
|
|
2462
|
+
value: String(b.value),
|
|
2463
|
+
disabled: !!b.disabled,
|
|
2464
|
+
selected: Object.is(f, b.value),
|
|
2465
|
+
children: b.label ?? String(b.value)
|
|
2362
2466
|
},
|
|
2363
|
-
String(
|
|
2467
|
+
String(b.value)
|
|
2364
2468
|
);
|
|
2365
2469
|
})
|
|
2366
2470
|
]
|
|
2367
2471
|
}
|
|
2368
2472
|
),
|
|
2369
|
-
|
|
2473
|
+
o == null ? null : /* @__PURE__ */ h(
|
|
2370
2474
|
"p",
|
|
2371
2475
|
{
|
|
2372
2476
|
id: this.errorId,
|
|
2373
2477
|
role: "alert",
|
|
2374
|
-
children: String(
|
|
2478
|
+
children: String(o)
|
|
2375
2479
|
}
|
|
2376
2480
|
)
|
|
2377
2481
|
]
|
|
@@ -2379,30 +2483,216 @@ class ee extends y {
|
|
|
2379
2483
|
);
|
|
2380
2484
|
}
|
|
2381
2485
|
}
|
|
2382
|
-
|
|
2486
|
+
a(ne, "hostName", "dropdown"), a(ne, "standaloneHostName", "drop-down"), a(ne, "baseStyles", [
|
|
2383
2487
|
["&", ["labeledinput", "inputline"]],
|
|
2384
2488
|
["& > select", ["input", "inputline"]]
|
|
2385
|
-
]),
|
|
2489
|
+
]), a(ne, "css", x`
|
|
2386
2490
|
& {
|
|
2387
2491
|
position: relative;
|
|
2388
2492
|
}
|
|
2389
2493
|
`);
|
|
2390
|
-
function
|
|
2494
|
+
function kr(t) {
|
|
2391
2495
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
2392
2496
|
}
|
|
2393
|
-
function
|
|
2497
|
+
function Ir(t, r) {
|
|
2394
2498
|
const e = t.currentTarget;
|
|
2395
2499
|
if (e == null || typeof Reflect.get(e, "value") != "string")
|
|
2396
2500
|
throw new TypeError(`${r} requires a value-bearing event target`);
|
|
2397
2501
|
return Reflect.get(e, "value");
|
|
2398
2502
|
}
|
|
2399
|
-
class
|
|
2503
|
+
class ee extends g {
|
|
2504
|
+
constructor(e = {}) {
|
|
2505
|
+
super(e);
|
|
2506
|
+
a(this, "inputId");
|
|
2507
|
+
this.inputId = j("radio", e.id);
|
|
2508
|
+
}
|
|
2509
|
+
render() {
|
|
2510
|
+
const {
|
|
2511
|
+
label: e = this.props.value ?? "Option",
|
|
2512
|
+
checked: i = !1,
|
|
2513
|
+
disabled: s = !1,
|
|
2514
|
+
required: n = !1
|
|
2515
|
+
} = this.props, o = this.Host;
|
|
2516
|
+
return /* @__PURE__ */ h(
|
|
2517
|
+
o,
|
|
2518
|
+
{
|
|
2519
|
+
className: E(this.props) || null,
|
|
2520
|
+
"data-disabled": s ? "" : null,
|
|
2521
|
+
"data-required": n ? "" : null,
|
|
2522
|
+
children: /* @__PURE__ */ w("label", { htmlFor: this.inputId, children: [
|
|
2523
|
+
/* @__PURE__ */ h(
|
|
2524
|
+
"input",
|
|
2525
|
+
{
|
|
2526
|
+
id: this.inputId,
|
|
2527
|
+
type: "radio",
|
|
2528
|
+
name: this.props.name,
|
|
2529
|
+
value: this.props.value == null ? void 0 : String(this.props.value),
|
|
2530
|
+
checked: i,
|
|
2531
|
+
disabled: s,
|
|
2532
|
+
required: n,
|
|
2533
|
+
onChange: (l) => C(
|
|
2534
|
+
this.props.onChange,
|
|
2535
|
+
l.currentTarget.checked,
|
|
2536
|
+
l
|
|
2537
|
+
)
|
|
2538
|
+
}
|
|
2539
|
+
),
|
|
2540
|
+
/* @__PURE__ */ h("span", { className: "radioshell", "aria-hidden": "true" }),
|
|
2541
|
+
/* @__PURE__ */ h("span", { children: e })
|
|
2542
|
+
] })
|
|
2543
|
+
}
|
|
2544
|
+
);
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
a(ee, "hostName", "radio-button"), a(ee, "standaloneHostName", "radio-button"), a(ee, "css", x`
|
|
2548
|
+
& {
|
|
2549
|
+
display: inline-block;
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
& > label {
|
|
2553
|
+
display: inline-flex;
|
|
2554
|
+
align-items: center;
|
|
2555
|
+
gap: 0.35em;
|
|
2556
|
+
cursor: pointer;
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
&[data-disabled] > label {
|
|
2560
|
+
cursor: not-allowed;
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
& input[type="radio"] {
|
|
2564
|
+
position: absolute;
|
|
2565
|
+
width: 1px;
|
|
2566
|
+
height: 1px;
|
|
2567
|
+
padding: 0;
|
|
2568
|
+
margin: -1px;
|
|
2569
|
+
overflow: hidden;
|
|
2570
|
+
clip: rect(0 0 0 0);
|
|
2571
|
+
white-space: nowrap;
|
|
2572
|
+
border: 0;
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
& input[type="radio"] + .radioshell {
|
|
2576
|
+
position: relative;
|
|
2577
|
+
display: inline-grid;
|
|
2578
|
+
width: 1em;
|
|
2579
|
+
height: 1em;
|
|
2580
|
+
flex: 0 0 1em;
|
|
2581
|
+
box-sizing: border-box;
|
|
2582
|
+
border: var(--radio-box-border, var(--input-border, 1px solid currentColor));
|
|
2583
|
+
border-radius: 50%;
|
|
2584
|
+
background: var(--radio-background, var(--ui-input-bg, transparent));
|
|
2585
|
+
place-items: center;
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
& input[type="radio"]:checked + .radioshell {
|
|
2589
|
+
background: var(--radio-background-checked,
|
|
2590
|
+
var(--selection-background, var(--ui-accent-color, Highlight)));
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
& input[type="radio"]:checked + .radioshell::after {
|
|
2594
|
+
width: 0.4em;
|
|
2595
|
+
height: 0.4em;
|
|
2596
|
+
content: "";
|
|
2597
|
+
border-radius: 50%;
|
|
2598
|
+
background: var(--radio-dot-color, var(--selection-color, Canvas));
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
& input[type="radio"]:focus-visible + .radioshell {
|
|
2602
|
+
outline: 2px solid var(--focus-color, var(--ui-accent-color, Highlight));
|
|
2603
|
+
outline-offset: 1px;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
& input[type="radio"]:disabled + .radioshell {
|
|
2607
|
+
opacity: 0.6;
|
|
2608
|
+
}
|
|
2609
|
+
`);
|
|
2610
|
+
class oe extends g {
|
|
2611
|
+
constructor(e = {}) {
|
|
2612
|
+
var n;
|
|
2613
|
+
super(e);
|
|
2614
|
+
a(this, "valueEmitter");
|
|
2615
|
+
a(this, "groupId");
|
|
2616
|
+
a(this, "legendId");
|
|
2617
|
+
const i = e.options ?? [];
|
|
2618
|
+
st(i);
|
|
2619
|
+
const s = ((n = i[0]) == null ? void 0 : n[0]) ?? null;
|
|
2620
|
+
this.valueEmitter = K(this, e, s, "radio group value"), this.groupId = j("radio-group", e.id), this.legendId = `${this.groupId}-label`;
|
|
2621
|
+
}
|
|
2622
|
+
initialize() {
|
|
2623
|
+
this.watch(this.valueEmitter);
|
|
2624
|
+
}
|
|
2625
|
+
selectOption(e, i = null) {
|
|
2626
|
+
this.props.disabled || (this.valueEmitter.set(e, "radio option selected"), C(this.props.onChange, e, i));
|
|
2627
|
+
}
|
|
2628
|
+
render() {
|
|
2629
|
+
const { options: e = [], label: i, disabled: s = !1, required: n = !1 } = this.props;
|
|
2630
|
+
st(e);
|
|
2631
|
+
const o = this.valueEmitter.get(), l = this.Host;
|
|
2632
|
+
return /* @__PURE__ */ h(
|
|
2633
|
+
l,
|
|
2634
|
+
{
|
|
2635
|
+
className: E(this.props) || null,
|
|
2636
|
+
"data-disabled": s ? "" : null,
|
|
2637
|
+
"data-required": n ? "" : null,
|
|
2638
|
+
children: /* @__PURE__ */ w("fieldset", { disabled: s, "aria-required": n ? "true" : null, children: [
|
|
2639
|
+
i == null ? null : /* @__PURE__ */ h("legend", { id: this.legendId, children: i }),
|
|
2640
|
+
/* @__PURE__ */ h(
|
|
2641
|
+
"div",
|
|
2642
|
+
{
|
|
2643
|
+
"data-part": "options",
|
|
2644
|
+
role: "radiogroup",
|
|
2645
|
+
"aria-label": i == null ? this.props.ariaLabel : null,
|
|
2646
|
+
"aria-labelledby": i == null ? null : this.legendId,
|
|
2647
|
+
children: e.map(([c, u], p) => /* @__PURE__ */ h(
|
|
2648
|
+
ee,
|
|
2649
|
+
{
|
|
2650
|
+
id: `${this.groupId}-${p}`,
|
|
2651
|
+
name: this.props.name ?? this.groupId,
|
|
2652
|
+
value: c,
|
|
2653
|
+
label: u,
|
|
2654
|
+
checked: Object.is(o, c),
|
|
2655
|
+
disabled: s,
|
|
2656
|
+
required: n,
|
|
2657
|
+
onChange: (f, m) => {
|
|
2658
|
+
f && this.selectOption(c, m);
|
|
2659
|
+
}
|
|
2660
|
+
},
|
|
2661
|
+
String(c)
|
|
2662
|
+
))
|
|
2663
|
+
}
|
|
2664
|
+
)
|
|
2665
|
+
] })
|
|
2666
|
+
}
|
|
2667
|
+
);
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
a(oe, "dependencies", [ee]), a(oe, "hostName", "radio-group"), a(oe, "standaloneHostName", "radio-group"), a(oe, "css", x`
|
|
2671
|
+
& > fieldset {
|
|
2672
|
+
margin: 0;
|
|
2673
|
+
padding: 0;
|
|
2674
|
+
border: 0;
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
& [data-part="options"] {
|
|
2678
|
+
display: flex;
|
|
2679
|
+
flex-flow: row wrap;
|
|
2680
|
+
gap: var(--space-sm, 0.5rem);
|
|
2681
|
+
}
|
|
2682
|
+
`);
|
|
2683
|
+
function st(t) {
|
|
2684
|
+
he(t, "Radio group options");
|
|
2685
|
+
for (const r of t)
|
|
2686
|
+
if (!Array.isArray(r) || r.length < 2)
|
|
2687
|
+
throw new TypeError("Radio group options must be [value, label] tuples");
|
|
2688
|
+
}
|
|
2689
|
+
class ae extends g {
|
|
2400
2690
|
constructor(e = {}) {
|
|
2401
2691
|
super(e);
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
this.inputId =
|
|
2692
|
+
a(this, "inputId");
|
|
2693
|
+
a(this, "errorId");
|
|
2694
|
+
a(this, "valueEmitter");
|
|
2695
|
+
this.inputId = j("textbox", e.id), this.errorId = `${this.inputId}-error`, this.valueEmitter = K(this, e, "", "textbox value");
|
|
2406
2696
|
}
|
|
2407
2697
|
initialize() {
|
|
2408
2698
|
this.watch(this.valueEmitter);
|
|
@@ -2413,66 +2703,66 @@ class te extends y {
|
|
|
2413
2703
|
placeholder: i,
|
|
2414
2704
|
type: s = "text",
|
|
2415
2705
|
name: n,
|
|
2416
|
-
disabled:
|
|
2706
|
+
disabled: o = !1,
|
|
2417
2707
|
required: l = !1,
|
|
2418
2708
|
readOnly: c = !1,
|
|
2419
|
-
error:
|
|
2709
|
+
error: u = null,
|
|
2420
2710
|
autoComplete: p,
|
|
2421
2711
|
inputMode: f,
|
|
2422
|
-
minLength:
|
|
2423
|
-
maxLength:
|
|
2424
|
-
pattern:
|
|
2425
|
-
ariaLabel:
|
|
2426
|
-
inputRef:
|
|
2427
|
-
onInput:
|
|
2428
|
-
onChange:
|
|
2429
|
-
} = this.props,
|
|
2712
|
+
minLength: m,
|
|
2713
|
+
maxLength: b,
|
|
2714
|
+
pattern: v,
|
|
2715
|
+
ariaLabel: I,
|
|
2716
|
+
inputRef: A,
|
|
2717
|
+
onInput: N,
|
|
2718
|
+
onChange: z
|
|
2719
|
+
} = this.props, L = this.valueEmitter.get() ?? "", F = this.Host;
|
|
2430
2720
|
return /* @__PURE__ */ w(
|
|
2431
|
-
|
|
2721
|
+
F,
|
|
2432
2722
|
{
|
|
2433
2723
|
className: E(this.props) || null,
|
|
2434
|
-
"data-disabled":
|
|
2724
|
+
"data-disabled": o ? "" : null,
|
|
2435
2725
|
"data-required": l ? "" : null,
|
|
2436
|
-
"data-error":
|
|
2726
|
+
"data-error": u == null ? null : "",
|
|
2437
2727
|
children: [
|
|
2438
|
-
e == null ? null : /* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2728
|
+
e == null ? null : /* @__PURE__ */ h("label", { htmlFor: this.inputId, children: e }),
|
|
2729
|
+
/* @__PURE__ */ h(
|
|
2440
2730
|
"input",
|
|
2441
2731
|
{
|
|
2442
2732
|
id: this.inputId,
|
|
2443
2733
|
name: n,
|
|
2444
2734
|
type: s,
|
|
2445
|
-
value:
|
|
2735
|
+
value: L,
|
|
2446
2736
|
placeholder: i,
|
|
2447
|
-
disabled:
|
|
2737
|
+
disabled: o,
|
|
2448
2738
|
required: l,
|
|
2449
2739
|
readOnly: c,
|
|
2450
2740
|
autoComplete: p,
|
|
2451
2741
|
inputMode: f,
|
|
2452
|
-
minLength:
|
|
2453
|
-
maxLength:
|
|
2454
|
-
pattern:
|
|
2455
|
-
ref:
|
|
2456
|
-
"aria-label": e == null ?
|
|
2457
|
-
"aria-invalid":
|
|
2458
|
-
"aria-describedby":
|
|
2742
|
+
minLength: m,
|
|
2743
|
+
maxLength: b,
|
|
2744
|
+
pattern: v,
|
|
2745
|
+
ref: A,
|
|
2746
|
+
"aria-label": e == null ? I : null,
|
|
2747
|
+
"aria-invalid": u == null ? null : "true",
|
|
2748
|
+
"aria-describedby": u == null ? null : this.errorId,
|
|
2459
2749
|
onInput: (T) => {
|
|
2460
|
-
const G =
|
|
2461
|
-
this.valueEmitter.set(G, "textbox input"),
|
|
2750
|
+
const G = nt(T, "textbox input");
|
|
2751
|
+
this.valueEmitter.set(G, "textbox input"), C(N, G, T);
|
|
2462
2752
|
},
|
|
2463
|
-
onChange: (T) =>
|
|
2464
|
-
|
|
2465
|
-
|
|
2753
|
+
onChange: (T) => C(
|
|
2754
|
+
z,
|
|
2755
|
+
nt(T, "textbox change"),
|
|
2466
2756
|
T
|
|
2467
2757
|
)
|
|
2468
2758
|
}
|
|
2469
2759
|
),
|
|
2470
|
-
|
|
2760
|
+
u == null ? null : /* @__PURE__ */ h(
|
|
2471
2761
|
"p",
|
|
2472
2762
|
{
|
|
2473
2763
|
id: this.errorId,
|
|
2474
2764
|
role: "alert",
|
|
2475
|
-
children: String(
|
|
2765
|
+
children: String(u)
|
|
2476
2766
|
}
|
|
2477
2767
|
)
|
|
2478
2768
|
]
|
|
@@ -2480,10 +2770,10 @@ class te extends y {
|
|
|
2480
2770
|
);
|
|
2481
2771
|
}
|
|
2482
2772
|
}
|
|
2483
|
-
|
|
2773
|
+
a(ae, "hostName", "textbox"), a(ae, "standaloneHostName", "text-box"), a(ae, "baseStyles", [
|
|
2484
2774
|
["&", ["labeledinput", "inputline"]],
|
|
2485
2775
|
["& > input", ["input", "inputline"]]
|
|
2486
|
-
]),
|
|
2776
|
+
]), a(ae, "css", x`
|
|
2487
2777
|
& input {
|
|
2488
2778
|
cursor: text;
|
|
2489
2779
|
}
|
|
@@ -2492,34 +2782,34 @@ o(te, "hostName", "textbox"), o(te, "standaloneHostName", "text-box"), o(te, "ba
|
|
|
2492
2782
|
margin: 0;
|
|
2493
2783
|
}
|
|
2494
2784
|
`);
|
|
2495
|
-
function
|
|
2785
|
+
function nt(t, r) {
|
|
2496
2786
|
const e = t.currentTarget;
|
|
2497
2787
|
if (e == null || typeof Reflect.get(e, "value") != "string")
|
|
2498
2788
|
throw new TypeError(`${r} requires a value-bearing event target`);
|
|
2499
2789
|
return Reflect.get(e, "value");
|
|
2500
2790
|
}
|
|
2501
|
-
class
|
|
2791
|
+
class ot extends g {
|
|
2502
2792
|
constructor(e = {}) {
|
|
2503
2793
|
var n;
|
|
2504
2794
|
super(e);
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2795
|
+
a(this, "valueEmitter");
|
|
2796
|
+
a(this, "groupId");
|
|
2797
|
+
a(this, "legendId");
|
|
2508
2798
|
const i = e.options ?? [];
|
|
2509
|
-
|
|
2799
|
+
at(i);
|
|
2510
2800
|
const s = ((n = i[0]) == null ? void 0 : n[0]) ?? null;
|
|
2511
|
-
this.valueEmitter =
|
|
2801
|
+
this.valueEmitter = K(
|
|
2512
2802
|
this,
|
|
2513
2803
|
e,
|
|
2514
2804
|
s ?? null,
|
|
2515
2805
|
"toggle value"
|
|
2516
|
-
), this.groupId =
|
|
2806
|
+
), this.groupId = j("toggle", e.id), this.legendId = `${this.groupId}-label`;
|
|
2517
2807
|
}
|
|
2518
2808
|
initialize() {
|
|
2519
2809
|
this.watch(this.valueEmitter);
|
|
2520
2810
|
}
|
|
2521
2811
|
selectOption(e, i = null) {
|
|
2522
|
-
this.props.disabled || (this.valueEmitter.set(e, "toggle option selected"),
|
|
2812
|
+
this.props.disabled || (this.valueEmitter.set(e, "toggle option selected"), C(this.props.onChange, e, i));
|
|
2523
2813
|
}
|
|
2524
2814
|
render() {
|
|
2525
2815
|
const {
|
|
@@ -2528,10 +2818,10 @@ class Ae extends y {
|
|
|
2528
2818
|
disabled: s = !1,
|
|
2529
2819
|
required: n = !1
|
|
2530
2820
|
} = this.props;
|
|
2531
|
-
|
|
2532
|
-
const
|
|
2821
|
+
at(e);
|
|
2822
|
+
const o = this.valueEmitter.get(), l = Math.max(
|
|
2533
2823
|
0,
|
|
2534
|
-
e.findIndex(([c]) => Object.is(c,
|
|
2824
|
+
e.findIndex(([c]) => Object.is(c, o))
|
|
2535
2825
|
);
|
|
2536
2826
|
return /* @__PURE__ */ w(
|
|
2537
2827
|
"fieldset",
|
|
@@ -2543,26 +2833,26 @@ class Ae extends y {
|
|
|
2543
2833
|
"data-disabled": s ? "" : null,
|
|
2544
2834
|
"aria-required": n ? "true" : null,
|
|
2545
2835
|
children: [
|
|
2546
|
-
i == null ? null : /* @__PURE__ */
|
|
2547
|
-
/* @__PURE__ */
|
|
2836
|
+
i == null ? null : /* @__PURE__ */ h("legend", { id: this.legendId, children: i }),
|
|
2837
|
+
/* @__PURE__ */ h(
|
|
2548
2838
|
"div",
|
|
2549
2839
|
{
|
|
2550
2840
|
"data-part": "options",
|
|
2551
2841
|
role: "radiogroup",
|
|
2552
2842
|
"aria-label": i == null ? this.props.ariaLabel : null,
|
|
2553
2843
|
"aria-labelledby": i == null ? null : this.legendId,
|
|
2554
|
-
children: e.map(([c,
|
|
2844
|
+
children: e.map(([c, u], p) => /* @__PURE__ */ h(
|
|
2555
2845
|
"button",
|
|
2556
2846
|
{
|
|
2557
2847
|
type: "button",
|
|
2558
2848
|
role: "radio",
|
|
2559
2849
|
disabled: s,
|
|
2560
|
-
"aria-checked": Object.is(
|
|
2850
|
+
"aria-checked": Object.is(o, c) ? "true" : "false",
|
|
2561
2851
|
"data-value": String(c),
|
|
2562
2852
|
tabIndex: p === l ? 0 : -1,
|
|
2563
2853
|
onClick: (f) => this.selectOption(c, f),
|
|
2564
2854
|
onKeyDown: (f) => this.handleKeyDown(f, p, e),
|
|
2565
|
-
children:
|
|
2855
|
+
children: u
|
|
2566
2856
|
},
|
|
2567
2857
|
String(c)
|
|
2568
2858
|
))
|
|
@@ -2574,25 +2864,25 @@ class Ae extends y {
|
|
|
2574
2864
|
}
|
|
2575
2865
|
handleKeyDown(e, i, s) {
|
|
2576
2866
|
const { key: n } = e;
|
|
2577
|
-
let
|
|
2578
|
-
if (n === "ArrowRight" || n === "ArrowDown")
|
|
2867
|
+
let o;
|
|
2868
|
+
if (n === "ArrowRight" || n === "ArrowDown") o = (i + 1) % s.length;
|
|
2579
2869
|
else if (n === "ArrowLeft" || n === "ArrowUp")
|
|
2580
|
-
|
|
2581
|
-
else if (n === "Home")
|
|
2582
|
-
else if (n === "End")
|
|
2870
|
+
o = (i - 1 + s.length) % s.length;
|
|
2871
|
+
else if (n === "Home") o = 0;
|
|
2872
|
+
else if (n === "End") o = s.length - 1;
|
|
2583
2873
|
else return;
|
|
2584
2874
|
e.preventDefault();
|
|
2585
|
-
const l = s[
|
|
2875
|
+
const l = s[o];
|
|
2586
2876
|
if (l != null && (this.selectOption(l[0], e), this.dom instanceof Element)) {
|
|
2587
|
-
const c = this.dom.querySelectorAll('[role="radio"]')[
|
|
2877
|
+
const c = this.dom.querySelectorAll('[role="radio"]')[o];
|
|
2588
2878
|
c == null || c.focus();
|
|
2589
2879
|
}
|
|
2590
2880
|
}
|
|
2591
2881
|
}
|
|
2592
|
-
|
|
2882
|
+
a(ot, "baseStyles", [
|
|
2593
2883
|
['fieldset:has(> [data-part="options"]) > [data-part="options"]', ["uiline"]],
|
|
2594
2884
|
['fieldset:has(> [data-part="options"]) [role="radio"]', ["uiline", "button"]]
|
|
2595
|
-
]),
|
|
2885
|
+
]), a(ot, "css", x`
|
|
2596
2886
|
fieldset:has(> [data-part="options"]) {
|
|
2597
2887
|
margin: 0;
|
|
2598
2888
|
padding: 0;
|
|
@@ -2605,13 +2895,13 @@ o(Ae, "baseStyles", [
|
|
|
2605
2895
|
}
|
|
2606
2896
|
|
|
2607
2897
|
`);
|
|
2608
|
-
function
|
|
2609
|
-
|
|
2898
|
+
function at(t) {
|
|
2899
|
+
he(t);
|
|
2610
2900
|
for (const r of t)
|
|
2611
2901
|
if (!Array.isArray(r) || r.length < 2)
|
|
2612
2902
|
throw new TypeError("Toggle options must be [value, label] tuples");
|
|
2613
2903
|
}
|
|
2614
|
-
class
|
|
2904
|
+
class Se extends g {
|
|
2615
2905
|
render() {
|
|
2616
2906
|
const {
|
|
2617
2907
|
children: r = [],
|
|
@@ -2622,7 +2912,7 @@ class he extends y {
|
|
|
2622
2912
|
if (!["horizontal", "vertical"].includes(s))
|
|
2623
2913
|
throw new TypeError("Toolbar orientation must be horizontal or vertical");
|
|
2624
2914
|
const n = this.Host;
|
|
2625
|
-
return /* @__PURE__ */
|
|
2915
|
+
return /* @__PURE__ */ h(
|
|
2626
2916
|
n,
|
|
2627
2917
|
{
|
|
2628
2918
|
id: e,
|
|
@@ -2636,7 +2926,7 @@ class he extends y {
|
|
|
2636
2926
|
);
|
|
2637
2927
|
}
|
|
2638
2928
|
}
|
|
2639
|
-
|
|
2929
|
+
a(Se, "hostName", "toolbar"), a(Se, "standaloneHostName", "tool-bar"), a(Se, "css", x`
|
|
2640
2930
|
& {
|
|
2641
2931
|
display: flex;
|
|
2642
2932
|
flex-wrap: wrap;
|
|
@@ -2650,11 +2940,11 @@ o(he, "hostName", "toolbar"), o(he, "standaloneHostName", "tool-bar"), o(he, "cs
|
|
|
2650
2940
|
align-items: stretch;
|
|
2651
2941
|
}
|
|
2652
2942
|
`);
|
|
2653
|
-
class
|
|
2943
|
+
class ke extends g {
|
|
2654
2944
|
constructor(e) {
|
|
2655
2945
|
super(e);
|
|
2656
|
-
|
|
2657
|
-
if (this.progressId =
|
|
2946
|
+
a(this, "progressId");
|
|
2947
|
+
if (this.progressId = j("progress", e.id), e.valueEmitter != null && !Tr(e.valueEmitter))
|
|
2658
2948
|
throw new TypeError("ProgressBar valueEmitter must be a readable emitter");
|
|
2659
2949
|
}
|
|
2660
2950
|
render() {
|
|
@@ -2664,13 +2954,13 @@ class pe extends y {
|
|
|
2664
2954
|
const i = this.props.valueEmitter == null ? this.props.value ?? null : this.read(this.props.valueEmitter);
|
|
2665
2955
|
if (i != null && (!Number.isFinite(i) || i < 0))
|
|
2666
2956
|
throw new RangeError("ProgressBar value must be null or a non-negative finite number");
|
|
2667
|
-
const s = i == null ? null : Math.min(i, e), n = this.props.valueText ?? (s == null ? "In progress" : `${Math.round(s / e * 100)}%`),
|
|
2668
|
-
return /* @__PURE__ */ w(
|
|
2957
|
+
const s = i == null ? null : Math.min(i, e), n = this.props.valueText ?? (s == null ? "In progress" : `${Math.round(s / e * 100)}%`), o = this.Host;
|
|
2958
|
+
return /* @__PURE__ */ w(o, { className: E(this.props) || null, children: [
|
|
2669
2959
|
/* @__PURE__ */ w("div", { "data-part": "label-line", children: [
|
|
2670
|
-
/* @__PURE__ */
|
|
2671
|
-
/* @__PURE__ */
|
|
2960
|
+
/* @__PURE__ */ h("label", { htmlFor: this.progressId, children: this.props.label }),
|
|
2961
|
+
/* @__PURE__ */ h("output", { children: n })
|
|
2672
2962
|
] }),
|
|
2673
|
-
/* @__PURE__ */
|
|
2963
|
+
/* @__PURE__ */ h(
|
|
2674
2964
|
"progress",
|
|
2675
2965
|
{
|
|
2676
2966
|
id: this.progressId,
|
|
@@ -2683,7 +2973,7 @@ class pe extends y {
|
|
|
2683
2973
|
] });
|
|
2684
2974
|
}
|
|
2685
2975
|
}
|
|
2686
|
-
|
|
2976
|
+
a(ke, "hostName", "progress-bar"), a(ke, "standaloneHostName", "progress-bar"), a(ke, "css", x`
|
|
2687
2977
|
& {
|
|
2688
2978
|
display: grid;
|
|
2689
2979
|
gap: var(--spacing-small, 0.5rem);
|
|
@@ -2706,13 +2996,13 @@ o(pe, "hostName", "progress-bar"), o(pe, "standaloneHostName", "progress-bar"),
|
|
|
2706
2996
|
}
|
|
2707
2997
|
}
|
|
2708
2998
|
`);
|
|
2709
|
-
function
|
|
2999
|
+
function Tr(t) {
|
|
2710
3000
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
2711
3001
|
}
|
|
2712
|
-
const
|
|
2713
|
-
...
|
|
2714
|
-
...
|
|
2715
|
-
...
|
|
3002
|
+
const oi = Object.freeze([
|
|
3003
|
+
...Ie("primary"),
|
|
3004
|
+
...Ie("secondary"),
|
|
3005
|
+
...Ie("neutral"),
|
|
2716
3006
|
d("--palette-primary", "palette", "primary", "color", "Primary anchor color", "--palette-primary-500"),
|
|
2717
3007
|
d("--palette-primary-light", "palette", "primary", "color", "Light primary color", "--palette-primary-200"),
|
|
2718
3008
|
d("--palette-primary-dark", "palette", "primary", "color", "Dark primary color", "--palette-primary-800"),
|
|
@@ -2815,28 +3105,28 @@ const pr = Object.freeze([
|
|
|
2815
3105
|
d("--colored-light", "theme", "colored", "color", "Colored-trait light color", "--palette-primary-light"),
|
|
2816
3106
|
d("--colored-dark", "theme", "colored", "color", "Colored-trait dark color", "--palette-primary-dark"),
|
|
2817
3107
|
d("--colored-contrast", "theme", "colored", "color", "Colored-trait foreground", "--palette-contrast-light")
|
|
2818
|
-
]),
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
]),
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
3108
|
+
]), Rr = Object.freeze([
|
|
3109
|
+
$("shiny", "Shiny", O("themes/shiny/theme.css")),
|
|
3110
|
+
$("java", "Java", O("themes/java/theme.css")),
|
|
3111
|
+
$("minimal", "Minimal", O("themes/minimal/theme.css"))
|
|
3112
|
+
]), Cr = Object.freeze([
|
|
3113
|
+
$("iceblue", "Ice blue", O("colors/iceblue/colors.css")),
|
|
3114
|
+
$("ocean", "Ocean", O("colors/ocean/colors.css")),
|
|
3115
|
+
$("green", "Green", O("colors/green/colors.css")),
|
|
3116
|
+
$("gray", "Gray", O("colors/gray/colors.css")),
|
|
3117
|
+
$("orange", "Orange", O("colors/orange/colors.css")),
|
|
3118
|
+
$("purple", "Purple", O("colors/purple/colors.css")),
|
|
3119
|
+
$("red", "Red", O("colors/red/colors.css")),
|
|
3120
|
+
$("yellow", "Yellow", O("colors/yellow/colors.css"))
|
|
2831
3121
|
]);
|
|
2832
|
-
function
|
|
2833
|
-
if (
|
|
3122
|
+
function $r(t, r, e = globalThis.document) {
|
|
3123
|
+
if (Or(r), (e == null ? void 0 : e.head) == null || e.documentElement == null)
|
|
2834
3124
|
throw new TypeError("replaceFrayStylesheet requires a document with a head and root");
|
|
2835
3125
|
const i = `link[data-fray-stylesheet="${t}"]`;
|
|
2836
3126
|
let s = e.head.querySelector(i);
|
|
2837
3127
|
return s == null && (s = e.createElement("link"), s.rel = "stylesheet", s.dataset.frayStylesheet = t, e.head.append(s)), s.dataset.fraySelection = r.value, s.getAttribute("href") !== r.href && s.setAttribute("href", r.href), t === "theme" ? e.documentElement.dataset.theme = r.value : e.documentElement.dataset.color = r.value, s;
|
|
2838
3128
|
}
|
|
2839
|
-
function
|
|
3129
|
+
function le(t, r) {
|
|
2840
3130
|
const e = t.find((i) => i.value === r);
|
|
2841
3131
|
if (e == null) throw new RangeError(`Unknown Fray stylesheet selection: ${r}`);
|
|
2842
3132
|
return e;
|
|
@@ -2844,7 +3134,7 @@ function re(t, r) {
|
|
|
2844
3134
|
function d(t, r, e, i, s, n) {
|
|
2845
3135
|
return n == null ? Object.freeze({ name: t, layer: r, family: e, value: i, description: s }) : Object.freeze({ name: t, layer: r, family: e, value: i, description: s, fallback: n });
|
|
2846
3136
|
}
|
|
2847
|
-
function
|
|
3137
|
+
function Ie(t) {
|
|
2848
3138
|
return [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950].map((r) => {
|
|
2849
3139
|
var e;
|
|
2850
3140
|
return d(
|
|
@@ -2856,66 +3146,66 @@ function me(t) {
|
|
|
2856
3146
|
);
|
|
2857
3147
|
});
|
|
2858
3148
|
}
|
|
2859
|
-
function
|
|
3149
|
+
function $(t, r, e) {
|
|
2860
3150
|
return Object.freeze({ value: t, label: r, href: e });
|
|
2861
3151
|
}
|
|
2862
|
-
function
|
|
3152
|
+
function O(t) {
|
|
2863
3153
|
const r = import.meta.url.includes("/src/styling/") ? `../../${t}` : `../${t}`;
|
|
2864
3154
|
return new URL(r, import.meta.url).href;
|
|
2865
3155
|
}
|
|
2866
|
-
function
|
|
3156
|
+
function Or(t) {
|
|
2867
3157
|
if (t == null || typeof t != "object")
|
|
2868
3158
|
throw new TypeError("Fray stylesheet selection must be an option");
|
|
2869
3159
|
for (const r of ["value", "label", "href"])
|
|
2870
3160
|
if (typeof Reflect.get(t, r) != "string" || String(Reflect.get(t, r)).length === 0)
|
|
2871
3161
|
throw new TypeError(`Fray stylesheet option ${r} must be a non-empty string`);
|
|
2872
3162
|
}
|
|
2873
|
-
class
|
|
3163
|
+
class me extends g {
|
|
2874
3164
|
constructor(e, i, s) {
|
|
2875
3165
|
var l;
|
|
2876
3166
|
super(e);
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
3167
|
+
a(this, "valueEmitter");
|
|
3168
|
+
a(this, "inputId");
|
|
3169
|
+
a(this, "kind");
|
|
3170
|
+
a(this, "defaults");
|
|
2881
3171
|
const n = e.options ?? s;
|
|
2882
|
-
|
|
2883
|
-
const
|
|
2884
|
-
if (
|
|
2885
|
-
this.kind = i, this.defaults = s, this.inputId =
|
|
3172
|
+
ut(n);
|
|
3173
|
+
const o = (l = n[0]) == null ? void 0 : l.value;
|
|
3174
|
+
if (o == null) throw new TypeError(`${i} picker requires at least one option`);
|
|
3175
|
+
this.kind = i, this.defaults = s, this.inputId = j(`${i}-picker`, e.id), this.valueEmitter = K(this, e, o, `${i} selection`), le(n, this.valueEmitter.get());
|
|
2886
3176
|
}
|
|
2887
3177
|
initialize() {
|
|
2888
3178
|
this.watch(this.valueEmitter);
|
|
2889
3179
|
}
|
|
2890
3180
|
render() {
|
|
2891
|
-
const e = this.options, i =
|
|
3181
|
+
const e = this.options, i = le(e, this.valueEmitter.get()), { label: s, ariaLabel: n, disabled: o = !1, onChange: l } = this.props, c = this.Host;
|
|
2892
3182
|
return /* @__PURE__ */ w(
|
|
2893
3183
|
c,
|
|
2894
3184
|
{
|
|
2895
3185
|
className: R("selectshell", E(this.props)),
|
|
2896
3186
|
"data-kind": this.kind,
|
|
2897
|
-
"data-disabled":
|
|
3187
|
+
"data-disabled": o ? "" : null,
|
|
2898
3188
|
children: [
|
|
2899
|
-
s == null ? null : /* @__PURE__ */
|
|
2900
|
-
/* @__PURE__ */
|
|
3189
|
+
s == null ? null : /* @__PURE__ */ h("label", { htmlFor: this.inputId, children: s }),
|
|
3190
|
+
/* @__PURE__ */ h(
|
|
2901
3191
|
"select",
|
|
2902
3192
|
{
|
|
2903
3193
|
id: this.inputId,
|
|
2904
3194
|
value: i.value,
|
|
2905
|
-
disabled:
|
|
3195
|
+
disabled: o,
|
|
2906
3196
|
"aria-label": s == null ? n : null,
|
|
2907
|
-
onChange: (
|
|
2908
|
-
const p =
|
|
2909
|
-
this.valueEmitter.set(p, `${this.kind} selected`),
|
|
3197
|
+
onChange: (u) => {
|
|
3198
|
+
const p = jr(u), f = le(e, p);
|
|
3199
|
+
this.valueEmitter.set(p, `${this.kind} selected`), C(l, p, f, u);
|
|
2910
3200
|
},
|
|
2911
|
-
children: e.map((
|
|
3201
|
+
children: e.map((u) => /* @__PURE__ */ h(
|
|
2912
3202
|
"option",
|
|
2913
3203
|
{
|
|
2914
|
-
value:
|
|
2915
|
-
selected:
|
|
2916
|
-
children:
|
|
3204
|
+
value: u.value,
|
|
3205
|
+
selected: u.value === i.value,
|
|
3206
|
+
children: u.label
|
|
2917
3207
|
},
|
|
2918
|
-
|
|
3208
|
+
u.value
|
|
2919
3209
|
))
|
|
2920
3210
|
}
|
|
2921
3211
|
)
|
|
@@ -2931,21 +3221,21 @@ class oe extends y {
|
|
|
2931
3221
|
}
|
|
2932
3222
|
get options() {
|
|
2933
3223
|
const e = this.props.options ?? this.defaults;
|
|
2934
|
-
return
|
|
3224
|
+
return ut(e), e;
|
|
2935
3225
|
}
|
|
2936
3226
|
applySelection() {
|
|
2937
3227
|
const e = this.props.targetDocument ?? (typeof document > "u" ? null : document);
|
|
2938
|
-
e != null &&
|
|
3228
|
+
e != null && $r(
|
|
2939
3229
|
this.kind,
|
|
2940
|
-
|
|
3230
|
+
le(this.options, this.valueEmitter.get()),
|
|
2941
3231
|
e
|
|
2942
3232
|
);
|
|
2943
3233
|
}
|
|
2944
3234
|
}
|
|
2945
|
-
|
|
3235
|
+
a(me, "baseStyles", [
|
|
2946
3236
|
["&", ["labeledinput", "inputline"]],
|
|
2947
3237
|
["& > select", ["input", "inputline"]]
|
|
2948
|
-
]),
|
|
3238
|
+
]), a(me, "css", x`
|
|
2949
3239
|
& {
|
|
2950
3240
|
position: relative;
|
|
2951
3241
|
}
|
|
@@ -2954,19 +3244,19 @@ o(oe, "baseStyles", [
|
|
|
2954
3244
|
min-width: 8rem;
|
|
2955
3245
|
}
|
|
2956
3246
|
`);
|
|
2957
|
-
class
|
|
3247
|
+
class lt extends me {
|
|
2958
3248
|
constructor(r = {}) {
|
|
2959
|
-
super(r, "theme",
|
|
3249
|
+
super(r, "theme", Rr);
|
|
2960
3250
|
}
|
|
2961
3251
|
}
|
|
2962
|
-
|
|
2963
|
-
class
|
|
3252
|
+
a(lt, "hostName", "theme-picker"), a(lt, "standaloneHostName", "theme-picker");
|
|
3253
|
+
class ct extends me {
|
|
2964
3254
|
constructor(r = {}) {
|
|
2965
|
-
super(r, "colors",
|
|
3255
|
+
super(r, "colors", Cr);
|
|
2966
3256
|
}
|
|
2967
3257
|
}
|
|
2968
|
-
|
|
2969
|
-
function
|
|
3258
|
+
a(ct, "hostName", "color-picker"), a(ct, "standaloneHostName", "color-picker");
|
|
3259
|
+
function ut(t) {
|
|
2970
3260
|
if (!Array.isArray(t) || t.length === 0)
|
|
2971
3261
|
throw new TypeError("Stylesheet picker options must be a non-empty array");
|
|
2972
3262
|
const r = /* @__PURE__ */ new Set();
|
|
@@ -2981,91 +3271,1025 @@ function ze(t) {
|
|
|
2981
3271
|
r.add(e.value);
|
|
2982
3272
|
}
|
|
2983
3273
|
}
|
|
2984
|
-
function
|
|
3274
|
+
function jr(t) {
|
|
2985
3275
|
const r = t.currentTarget == null ? null : Reflect.get(t.currentTarget, "value");
|
|
2986
3276
|
if (typeof r != "string")
|
|
2987
3277
|
throw new TypeError("Stylesheet picker change requires a select element");
|
|
2988
3278
|
return r;
|
|
2989
3279
|
}
|
|
3280
|
+
class ai {
|
|
3281
|
+
constructor(r = "/") {
|
|
3282
|
+
a(this, "listeners", /* @__PURE__ */ new Set());
|
|
3283
|
+
a(this, "entries");
|
|
3284
|
+
a(this, "index", 0);
|
|
3285
|
+
this.entries = [D(r)];
|
|
3286
|
+
}
|
|
3287
|
+
read() {
|
|
3288
|
+
return this.entries[this.index] ?? "/";
|
|
3289
|
+
}
|
|
3290
|
+
href(r) {
|
|
3291
|
+
return D(r);
|
|
3292
|
+
}
|
|
3293
|
+
push(r) {
|
|
3294
|
+
this.entries = this.entries.slice(0, this.index + 1), this.entries.push(D(r)), this.index += 1;
|
|
3295
|
+
}
|
|
3296
|
+
replace(r) {
|
|
3297
|
+
this.entries[this.index] = D(r);
|
|
3298
|
+
}
|
|
3299
|
+
subscribe(r) {
|
|
3300
|
+
if (typeof r != "function")
|
|
3301
|
+
throw new TypeError("Navigation adapter subscriber must be a function");
|
|
3302
|
+
this.listeners.add(r);
|
|
3303
|
+
let e = !0;
|
|
3304
|
+
return () => {
|
|
3305
|
+
e && (e = !1, this.listeners.delete(r));
|
|
3306
|
+
};
|
|
3307
|
+
}
|
|
3308
|
+
back() {
|
|
3309
|
+
this.index !== 0 && (this.index -= 1, this.notify());
|
|
3310
|
+
}
|
|
3311
|
+
forward() {
|
|
3312
|
+
this.index >= this.entries.length - 1 || (this.index += 1, this.notify());
|
|
3313
|
+
}
|
|
3314
|
+
get length() {
|
|
3315
|
+
return this.entries.length;
|
|
3316
|
+
}
|
|
3317
|
+
notify() {
|
|
3318
|
+
for (const r of [...this.listeners]) r();
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3321
|
+
function li(t = globalThis.window, r = {}) {
|
|
3322
|
+
It(t);
|
|
3323
|
+
const e = Ar(r.basePath ?? "/");
|
|
3324
|
+
return {
|
|
3325
|
+
read() {
|
|
3326
|
+
const i = t.location.pathname, s = i === e.slice(0, -1) ? "/" : i.startsWith(e) ? `/${i.slice(e.length)}` : i;
|
|
3327
|
+
return D(`${s}${t.location.search}`);
|
|
3328
|
+
},
|
|
3329
|
+
href(i) {
|
|
3330
|
+
const s = D(i);
|
|
3331
|
+
return `${e}${s.slice(1)}`;
|
|
3332
|
+
},
|
|
3333
|
+
push(i) {
|
|
3334
|
+
t.history.pushState(null, "", this.href(i));
|
|
3335
|
+
},
|
|
3336
|
+
replace(i) {
|
|
3337
|
+
t.history.replaceState(null, "", this.href(i));
|
|
3338
|
+
},
|
|
3339
|
+
subscribe(i) {
|
|
3340
|
+
return t.addEventListener("popstate", i), () => t.removeEventListener("popstate", i);
|
|
3341
|
+
}
|
|
3342
|
+
};
|
|
3343
|
+
}
|
|
3344
|
+
function ci(t = globalThis.window) {
|
|
3345
|
+
return It(t), {
|
|
3346
|
+
read() {
|
|
3347
|
+
return D(t.location.hash.slice(1) || "/");
|
|
3348
|
+
},
|
|
3349
|
+
href(r) {
|
|
3350
|
+
return `#${D(r)}`;
|
|
3351
|
+
},
|
|
3352
|
+
push(r) {
|
|
3353
|
+
t.history.pushState(null, "", this.href(r));
|
|
3354
|
+
},
|
|
3355
|
+
replace(r) {
|
|
3356
|
+
t.history.replaceState(null, "", this.href(r));
|
|
3357
|
+
},
|
|
3358
|
+
subscribe(r) {
|
|
3359
|
+
let e = this.read();
|
|
3360
|
+
const i = () => {
|
|
3361
|
+
const s = this.read();
|
|
3362
|
+
s !== e && (e = s, r());
|
|
3363
|
+
};
|
|
3364
|
+
return t.addEventListener("popstate", i), t.addEventListener("hashchange", i), () => {
|
|
3365
|
+
t.removeEventListener("popstate", i), t.removeEventListener("hashchange", i);
|
|
3366
|
+
};
|
|
3367
|
+
}
|
|
3368
|
+
};
|
|
3369
|
+
}
|
|
3370
|
+
function D(t) {
|
|
3371
|
+
if (typeof t != "string") throw new TypeError("Route location must be a string");
|
|
3372
|
+
const r = t.indexOf("#"), e = r < 0 ? t : t.slice(0, r), i = e.indexOf("?"), s = i < 0 ? e : e.slice(0, i), n = i < 0 ? "" : e.slice(i);
|
|
3373
|
+
return `${(s.startsWith("/") ? s : `/${s}`).replace(/\/{2,}/g, "/").replace(/\/$/, "") || "/"}${n}`;
|
|
3374
|
+
}
|
|
3375
|
+
function Ar(t) {
|
|
3376
|
+
const r = D(t).split("?")[0] ?? "/";
|
|
3377
|
+
return r === "/" ? "/" : `${r}/`;
|
|
3378
|
+
}
|
|
3379
|
+
function It(t) {
|
|
3380
|
+
if (t == null || typeof t != "object" || !("location" in t) || !("history" in t) || !("addEventListener" in t))
|
|
3381
|
+
throw new TypeError("Browser navigation requires a window-like target");
|
|
3382
|
+
}
|
|
3383
|
+
const Ue = /* @__PURE__ */ new WeakSet(), Qe = /* @__PURE__ */ new WeakSet();
|
|
3384
|
+
class De {
|
|
3385
|
+
constructor(r) {
|
|
3386
|
+
this.target = r, we(r), Object.freeze(this);
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
class Be extends Error {
|
|
3390
|
+
constructor(e = "The requested route is unavailable") {
|
|
3391
|
+
super(e);
|
|
3392
|
+
a(this, "name", "RouteUnavailableError");
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
const ui = Object.freeze({
|
|
3396
|
+
parse: (t) => t,
|
|
3397
|
+
format: (t) => t
|
|
3398
|
+
}), di = Object.freeze({
|
|
3399
|
+
parse(t) {
|
|
3400
|
+
if (t.length !== 1) throw new TypeError("Expected one query value");
|
|
3401
|
+
return t[0] ?? "";
|
|
3402
|
+
},
|
|
3403
|
+
format: (t) => [t]
|
|
3404
|
+
}), hi = Object.freeze({
|
|
3405
|
+
parse(t) {
|
|
3406
|
+
if (t.length !== 1 || t[0] !== "true" && t[0] !== "false")
|
|
3407
|
+
throw new TypeError("Expected one boolean query value");
|
|
3408
|
+
return t[0] === "true";
|
|
3409
|
+
},
|
|
3410
|
+
format: (t) => [String(t)]
|
|
3411
|
+
});
|
|
3412
|
+
function pi(t, r = t) {
|
|
3413
|
+
const e = ze(t, "Route id"), i = zr(r, "Route path"), s = Object.freeze({
|
|
3414
|
+
id: e,
|
|
3415
|
+
kind: "literal",
|
|
3416
|
+
path: i
|
|
3417
|
+
});
|
|
3418
|
+
return Ue.add(s), s;
|
|
3419
|
+
}
|
|
3420
|
+
function fi(t, r, e = t) {
|
|
3421
|
+
const i = ze(t, "Route id"), s = ze(e, "Route parameter name");
|
|
3422
|
+
qr(r);
|
|
3423
|
+
const n = Object.freeze({
|
|
3424
|
+
id: i,
|
|
3425
|
+
kind: "parameter",
|
|
3426
|
+
name: s,
|
|
3427
|
+
codec: r
|
|
3428
|
+
});
|
|
3429
|
+
return Ue.add(n), n;
|
|
3430
|
+
}
|
|
3431
|
+
function mi(t, r) {
|
|
3432
|
+
if (B(t), t.kind !== "parameter")
|
|
3433
|
+
throw new TypeError("routeParameter requires a parameter route");
|
|
3434
|
+
const e = t.codec.format(r);
|
|
3435
|
+
return We(e, t.name), Object.freeze({ route: t, value: r });
|
|
3436
|
+
}
|
|
3437
|
+
function bi(...t) {
|
|
3438
|
+
if (t.length === 0) throw new TypeError("routeTarget requires at least one route");
|
|
3439
|
+
for (const e of t)
|
|
3440
|
+
if (Tt(e))
|
|
3441
|
+
B(e.route);
|
|
3442
|
+
else if (B(e), e.kind !== "literal")
|
|
3443
|
+
throw new TypeError("Parameter routes require routeParameter(route, value)");
|
|
3444
|
+
const r = Object.freeze({ routes: Object.freeze([...t]) });
|
|
3445
|
+
return Qe.add(r), r;
|
|
3446
|
+
}
|
|
3447
|
+
function gi(t, r) {
|
|
3448
|
+
if (we(t), r == null || typeof r != "object" || Array.isArray(r))
|
|
3449
|
+
throw new TypeError("Route target query must be an object");
|
|
3450
|
+
const e = Object.freeze({ routes: t.routes, query: Object.freeze({ ...r }) });
|
|
3451
|
+
return Qe.add(e), e;
|
|
3452
|
+
}
|
|
3453
|
+
function yi(t) {
|
|
3454
|
+
return new De(t);
|
|
3455
|
+
}
|
|
3456
|
+
function _e(t) {
|
|
3457
|
+
return t != null && typeof t == "object" && Ue.has(t);
|
|
3458
|
+
}
|
|
3459
|
+
function B(t) {
|
|
3460
|
+
if (!_e(t))
|
|
3461
|
+
throw new TypeError("Expected a route created by defineRoute() or defineRouteParameter()");
|
|
3462
|
+
}
|
|
3463
|
+
function Nr(t) {
|
|
3464
|
+
return t != null && typeof t == "object" && Qe.has(t);
|
|
3465
|
+
}
|
|
3466
|
+
function we(t) {
|
|
3467
|
+
if (!Nr(t)) throw new TypeError("Expected a target created by routeTarget()");
|
|
3468
|
+
}
|
|
3469
|
+
function qr(t) {
|
|
3470
|
+
if (t == null || typeof t != "object" || typeof t.parse != "function" || typeof t.format != "function")
|
|
3471
|
+
throw new TypeError("Route codec requires parse and format functions");
|
|
3472
|
+
}
|
|
3473
|
+
function Dr(t) {
|
|
3474
|
+
if (t == null || typeof t != "object" || typeof t.parse != "function" || typeof t.format != "function")
|
|
3475
|
+
throw new TypeError("Route query codec requires parse and format functions");
|
|
3476
|
+
}
|
|
3477
|
+
function Te(t) {
|
|
3478
|
+
we(t);
|
|
3479
|
+
const r = t.routes.map((s) => {
|
|
3480
|
+
if (Tt(s)) {
|
|
3481
|
+
const n = s.route.codec.format(s.value);
|
|
3482
|
+
return We(n, s.route.name), encodeURIComponent(n);
|
|
3483
|
+
}
|
|
3484
|
+
return encodeURIComponent(s.path);
|
|
3485
|
+
}), e = new URLSearchParams();
|
|
3486
|
+
for (const [s, n] of Object.entries(t.query ?? {}).sort(([o], [l]) => o.localeCompare(l))) {
|
|
3487
|
+
if (n == null) continue;
|
|
3488
|
+
const o = Array.isArray(n) ? n : [n];
|
|
3489
|
+
for (const l of o) e.append(s, l);
|
|
3490
|
+
}
|
|
3491
|
+
const i = e.toString();
|
|
3492
|
+
return `/${r.join("/")}${i === "" ? "" : `?${i}`}`;
|
|
3493
|
+
}
|
|
3494
|
+
function Tt(t) {
|
|
3495
|
+
return t != null && typeof t == "object" && "route" in t && "value" in t && _e(t.route) && t.route.kind === "parameter";
|
|
3496
|
+
}
|
|
3497
|
+
function ze(t, r) {
|
|
3498
|
+
if (typeof t != "string" || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(t))
|
|
3499
|
+
throw new TypeError(`${r} must be a lowercase kebab-case name`);
|
|
3500
|
+
return t;
|
|
3501
|
+
}
|
|
3502
|
+
function zr(t, r) {
|
|
3503
|
+
if (typeof t != "string" || t === "" || t === "." || t === ".." || t.includes("/") || t.includes("?") || t.includes("#"))
|
|
3504
|
+
throw new TypeError(`${r} must be one non-empty path segment`);
|
|
3505
|
+
try {
|
|
3506
|
+
We(decodeURIComponent(t), r);
|
|
3507
|
+
} catch {
|
|
3508
|
+
throw new TypeError(`${r} must use valid percent encoding`);
|
|
3509
|
+
}
|
|
3510
|
+
return t;
|
|
3511
|
+
}
|
|
3512
|
+
function We(t, r) {
|
|
3513
|
+
if (typeof t != "string" || t === "" || t.includes("/"))
|
|
3514
|
+
throw new TypeError(`${r} codec must format one non-empty path segment`);
|
|
3515
|
+
}
|
|
3516
|
+
const Lr = 16;
|
|
3517
|
+
class Kr {
|
|
3518
|
+
constructor(r) {
|
|
3519
|
+
a(this, "root");
|
|
3520
|
+
a(this, "transition");
|
|
3521
|
+
a(this, "issue");
|
|
3522
|
+
a(this, "transitionEmitter");
|
|
3523
|
+
a(this, "issueEmitter");
|
|
3524
|
+
a(this, "scopes", /* @__PURE__ */ new Map());
|
|
3525
|
+
a(this, "contextCache", /* @__PURE__ */ new Map());
|
|
3526
|
+
a(this, "knownQueryNames", /* @__PURE__ */ new Set());
|
|
3527
|
+
a(this, "registryWaiters", /* @__PURE__ */ new Set());
|
|
3528
|
+
a(this, "adapterUnsubscribe");
|
|
3529
|
+
a(this, "controller", null);
|
|
3530
|
+
a(this, "activeContext");
|
|
3531
|
+
a(this, "requested");
|
|
3532
|
+
a(this, "applying", 0);
|
|
3533
|
+
a(this, "syncQueued", !1);
|
|
3534
|
+
a(this, "disposed", !1);
|
|
3535
|
+
this.adapter = r, _r(r), this.root = Object.freeze({
|
|
3536
|
+
route: null,
|
|
3537
|
+
parent: null,
|
|
3538
|
+
segment: null,
|
|
3539
|
+
value: null,
|
|
3540
|
+
pathname: "/"
|
|
3541
|
+
}), be.set(this.root, this), this.activeContext = this.root, this.requested = Re(r.read());
|
|
3542
|
+
const e = Object.freeze({
|
|
3543
|
+
state: "pending",
|
|
3544
|
+
requestedLocation: this.requested.location,
|
|
3545
|
+
settledLocation: "/"
|
|
3546
|
+
});
|
|
3547
|
+
this.transitionEmitter = new S(e, {
|
|
3548
|
+
owner: this,
|
|
3549
|
+
purpose: "browser route transition"
|
|
3550
|
+
}), this.issueEmitter = new S(null, {
|
|
3551
|
+
owner: this,
|
|
3552
|
+
purpose: "browser route issue"
|
|
3553
|
+
}), this.transition = this.transitionEmitter, this.issue = this.issueEmitter, this.adapterUnsubscribe = r.subscribe(() => {
|
|
3554
|
+
this.startTransition(r.read(), 0, !1);
|
|
3555
|
+
}), this.startTransition(this.requested.location, 0, !1);
|
|
3556
|
+
}
|
|
3557
|
+
openScope(r, e) {
|
|
3558
|
+
this.assertActive(), P(r, this), ce(e);
|
|
3559
|
+
const i = this.scope(r);
|
|
3560
|
+
if (i.owners.has(e)) throw new Error("Route scope owner is already registered");
|
|
3561
|
+
i.owners.set(e, { complete: !1 }), this.wakeRegistry();
|
|
3562
|
+
let s = !0;
|
|
3563
|
+
return () => {
|
|
3564
|
+
s && (s = !1, i.owners.delete(e), this.removeOwnerEntries(i, e), this.removeOwnerQueries(i, e), i.owners.size === 0 && i.entries.size === 0 && i.queries.size === 0 && this.scopes.delete(r), this.wakeRegistry());
|
|
3565
|
+
};
|
|
3566
|
+
}
|
|
3567
|
+
completeScope(r, e) {
|
|
3568
|
+
this.assertActive(), P(r, this);
|
|
3569
|
+
const i = this.scope(r).owners.get(e);
|
|
3570
|
+
if (i == null) throw new Error("Cannot complete an unopened route scope");
|
|
3571
|
+
Fr(this.scope(r)), i.complete = !0, this.wakeRegistry();
|
|
3572
|
+
}
|
|
3573
|
+
registerSelectionRoutes(r, e, i, s) {
|
|
3574
|
+
if (this.assertActive(), P(r, this), ce(e), !Array.isArray(i)) throw new TypeError("Route bindings must be an array");
|
|
3575
|
+
if (typeof s != "function")
|
|
3576
|
+
throw new TypeError("Selection route registration requires a subscriber");
|
|
3577
|
+
const n = this.scope(r), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set();
|
|
3578
|
+
for (const u of i) {
|
|
3579
|
+
if (B(u.route), u.route.kind !== "literal")
|
|
3580
|
+
throw new TypeError("Tab routes must use literal route descriptors");
|
|
3581
|
+
if (l.has(u.route) || n.entries.has(u.route))
|
|
3582
|
+
throw new Error(`Duplicate route in one scope: ${u.route.id}`);
|
|
3583
|
+
l.add(u.route);
|
|
3584
|
+
const p = this.literalContext(r, u.route), f = {
|
|
3585
|
+
owner: e,
|
|
3586
|
+
descriptor: u.route,
|
|
3587
|
+
parent: r,
|
|
3588
|
+
match: (m) => Ce(m) === u.route.path ? { value: null } : null,
|
|
3589
|
+
currentValue: () => u.active() ? null : void 0,
|
|
3590
|
+
activate: async (m, b, v) => {
|
|
3591
|
+
if (u.disabled)
|
|
3592
|
+
throw new Be(
|
|
3593
|
+
`Route "${u.route.id}" is currently disabled`
|
|
3594
|
+
);
|
|
3595
|
+
if (v.aborted) throw v.reason;
|
|
3596
|
+
return await u.activate(v), m;
|
|
3597
|
+
},
|
|
3598
|
+
context: () => p,
|
|
3599
|
+
disposeSubscription: () => {
|
|
3600
|
+
}
|
|
3601
|
+
};
|
|
3602
|
+
n.entries.set(u.route, f), o.set(u.route, p);
|
|
3603
|
+
}
|
|
3604
|
+
const c = s(() => this.scheduleStateSync());
|
|
3605
|
+
for (const u of l) {
|
|
3606
|
+
const p = n.entries.get(u);
|
|
3607
|
+
p != null && (p.disposeSubscription = c);
|
|
3608
|
+
}
|
|
3609
|
+
return this.wakeRegistry(), o;
|
|
3610
|
+
}
|
|
3611
|
+
unregisterRoutes(r, e) {
|
|
3612
|
+
const i = this.scopes.get(r);
|
|
3613
|
+
i != null && (this.removeOwnerEntries(i, e), this.wakeRegistry());
|
|
3614
|
+
}
|
|
3615
|
+
registerValueRoute(r, e, i) {
|
|
3616
|
+
if (this.assertActive(), P(r, this), ce(e), B(i.route), i.route.kind !== "parameter")
|
|
3617
|
+
throw new TypeError("Value routes require a parameter route descriptor");
|
|
3618
|
+
if (pt(i.valueEmitter, "Value route emitter"), i.resolve != null && typeof i.resolve != "function")
|
|
3619
|
+
throw new TypeError("Value route resolver must be a function");
|
|
3620
|
+
const s = this.scope(r);
|
|
3621
|
+
if (s.entries.has(i.route))
|
|
3622
|
+
throw new Error(`Duplicate route in one scope: ${i.route.id}`);
|
|
3623
|
+
const n = (u) => this.parameterContext(r, i.route, u), o = i.valueEmitter.subscribe(() => this.scheduleStateSync(), {
|
|
3624
|
+
emitCurrent: !1
|
|
3625
|
+
}), l = {
|
|
3626
|
+
owner: e,
|
|
3627
|
+
descriptor: i.route,
|
|
3628
|
+
parent: r,
|
|
3629
|
+
match: (u) => {
|
|
3630
|
+
const p = Ce(u), f = i.route.codec.parse(p);
|
|
3631
|
+
if (i.route.codec.format(f) !== p)
|
|
3632
|
+
throw new TypeError(
|
|
3633
|
+
`Route parameter "${i.route.name}" does not round-trip`
|
|
3634
|
+
);
|
|
3635
|
+
return { value: f };
|
|
3636
|
+
},
|
|
3637
|
+
currentValue: () => i.valueEmitter.get(),
|
|
3638
|
+
activate: async (u, p, f) => {
|
|
3639
|
+
const m = u.value, b = i.resolve == null ? m : await i.resolve(m, p, f);
|
|
3640
|
+
if (b instanceof De) return b;
|
|
3641
|
+
if (f.aborted) throw f.reason;
|
|
3642
|
+
return this.withApplication(() => i.valueEmitter.set(
|
|
3643
|
+
b,
|
|
3644
|
+
"route value restored"
|
|
3645
|
+
)), { value: b };
|
|
3646
|
+
},
|
|
3647
|
+
context: (u) => n(u),
|
|
3648
|
+
disposeSubscription: o
|
|
3649
|
+
};
|
|
3650
|
+
s.entries.set(i.route, l), this.wakeRegistry();
|
|
3651
|
+
let c = !0;
|
|
3652
|
+
return {
|
|
3653
|
+
context: Br(i.valueEmitter, n, r),
|
|
3654
|
+
contextFor: n,
|
|
3655
|
+
dispose: () => {
|
|
3656
|
+
if (!c) return;
|
|
3657
|
+
c = !1, s.entries.get(i.route) === l && s.entries.delete(i.route), o(), this.wakeRegistry();
|
|
3658
|
+
}
|
|
3659
|
+
};
|
|
3660
|
+
}
|
|
3661
|
+
registerQuery(r, e, i) {
|
|
3662
|
+
this.assertActive(), P(r, this), ce(e);
|
|
3663
|
+
const s = Qr(i.name);
|
|
3664
|
+
pt(i.valueEmitter, "Route query emitter"), Dr(i.codec);
|
|
3665
|
+
const n = i.equals ?? Object.is;
|
|
3666
|
+
if (typeof n != "function") throw new TypeError("Route query equals must be a function");
|
|
3667
|
+
const o = this.scope(r);
|
|
3668
|
+
if (o.queries.has(s)) throw new Error(`Duplicate route query name: ${s}`);
|
|
3669
|
+
this.knownQueryNames.add(s);
|
|
3670
|
+
const l = i.valueEmitter.subscribe(() => this.scheduleStateSync(), {
|
|
3671
|
+
emitCurrent: !1
|
|
3672
|
+
}), c = {
|
|
3673
|
+
owner: e,
|
|
3674
|
+
context: r,
|
|
3675
|
+
name: s,
|
|
3676
|
+
emitter: i.valueEmitter,
|
|
3677
|
+
codec: i.codec,
|
|
3678
|
+
defaultValue: i.defaultValue,
|
|
3679
|
+
equals: n,
|
|
3680
|
+
disposeSubscription: l
|
|
3681
|
+
};
|
|
3682
|
+
o.queries.set(s, c), this.applyQueryEntry(c, this.requested), this.wakeRegistry();
|
|
3683
|
+
let u = !0;
|
|
3684
|
+
return () => {
|
|
3685
|
+
u && (u = !1, o.queries.get(s) === c && o.queries.delete(s), l(), this.scheduleStateSync());
|
|
3686
|
+
};
|
|
3687
|
+
}
|
|
3688
|
+
navigate(r, e = {}) {
|
|
3689
|
+
this.assertActive();
|
|
3690
|
+
const i = ue(r) ? this.formatContext(r) : Te(Oe(r));
|
|
3691
|
+
return this.issueEmitter.set(null, "explicit route navigation"), (e.history ?? "push") === "replace" ? this.adapter.replace(i) : this.adapter.push(i), this.startTransition(i, 0, !0);
|
|
3692
|
+
}
|
|
3693
|
+
redirect(r) {
|
|
3694
|
+
return this.navigate(r, { history: "replace" });
|
|
3695
|
+
}
|
|
3696
|
+
href(r) {
|
|
3697
|
+
this.assertActive();
|
|
3698
|
+
const e = ue(r) ? this.formatContext(r) : Te(Oe(r));
|
|
3699
|
+
return this.adapter.href(e);
|
|
3700
|
+
}
|
|
3701
|
+
resolve(r, e) {
|
|
3702
|
+
var s;
|
|
3703
|
+
B(r), P(e, this);
|
|
3704
|
+
let i = e;
|
|
3705
|
+
for (; i != null; ) {
|
|
3706
|
+
const n = (s = this.scopes.get(i)) == null ? void 0 : s.entries.get(r);
|
|
3707
|
+
if (n != null) {
|
|
3708
|
+
const o = n.currentValue();
|
|
3709
|
+
if (n.descriptor.kind === "parameter" && o == null)
|
|
3710
|
+
throw new Error(
|
|
3711
|
+
`Dynamic route "${r.id}" requires an explicit parameter value`
|
|
3712
|
+
);
|
|
3713
|
+
return n.context(o);
|
|
3714
|
+
}
|
|
3715
|
+
i = i.parent;
|
|
3716
|
+
}
|
|
3717
|
+
throw new Error(`Route "${r.id}" is not registered in the current route lineage`);
|
|
3718
|
+
}
|
|
3719
|
+
formatActiveLocation() {
|
|
3720
|
+
return this.formatStateLocation();
|
|
3721
|
+
}
|
|
3722
|
+
isActive(r, e = !1) {
|
|
3723
|
+
const i = ue(r) ? r : this.resolveTargetContext(Oe(r));
|
|
3724
|
+
return e ? i === this.activeContext : ht(i, this.activeContext);
|
|
3725
|
+
}
|
|
3726
|
+
dispose() {
|
|
3727
|
+
var r;
|
|
3728
|
+
if (!this.disposed) {
|
|
3729
|
+
this.disposed = !0, (r = this.controller) == null || r.abort(new DOMException("Router disposed", "AbortError")), this.controller = null, this.adapterUnsubscribe();
|
|
3730
|
+
for (const e of this.scopes.values()) {
|
|
3731
|
+
const i = /* @__PURE__ */ new Set();
|
|
3732
|
+
for (const s of e.entries.values()) i.add(s.disposeSubscription);
|
|
3733
|
+
for (const s of e.queries.values()) i.add(s.disposeSubscription);
|
|
3734
|
+
for (const s of i) s();
|
|
3735
|
+
}
|
|
3736
|
+
this.scopes.clear(), this.knownQueryNames.clear(), this.wakeRegistry(), this.transitionEmitter.dispose(), this.issueEmitter.dispose();
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
startTransition(r, e, i) {
|
|
3740
|
+
var n;
|
|
3741
|
+
this.assertActive(), (n = this.controller) == null || n.abort(new DOMException("Navigation superseded", "AbortError"));
|
|
3742
|
+
const s = new AbortController();
|
|
3743
|
+
return this.controller = s, this.requested = Re(r), i && this.issueEmitter.set(null, "route transition started"), this.transitionEmitter.set(Object.freeze({
|
|
3744
|
+
state: "pending",
|
|
3745
|
+
requestedLocation: this.requested.location,
|
|
3746
|
+
settledLocation: this.formatContext(this.activeContext)
|
|
3747
|
+
}), "route transition started"), this.runTransition(this.requested, s, e).catch((o) => {
|
|
3748
|
+
if (!s.signal.aborted) throw o;
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3751
|
+
async runTransition(r, e, i) {
|
|
3752
|
+
const s = e.signal;
|
|
3753
|
+
let n = this.root;
|
|
3754
|
+
const o = /* @__PURE__ */ new Map();
|
|
3755
|
+
for (const c of r.segments) {
|
|
3756
|
+
const u = await this.waitForCompleteScope(n, s);
|
|
3757
|
+
let p;
|
|
3758
|
+
try {
|
|
3759
|
+
p = Hr(u, c);
|
|
3760
|
+
} catch (m) {
|
|
3761
|
+
this.fallback(r, n, null, $e(m));
|
|
3762
|
+
return;
|
|
3763
|
+
}
|
|
3764
|
+
if (p == null) {
|
|
3765
|
+
this.fallback(r, n, null, `Unknown route segment "${Ce(c)}"`);
|
|
3766
|
+
return;
|
|
3767
|
+
}
|
|
3768
|
+
const f = Object.freeze({
|
|
3769
|
+
requestedLocation: r.location,
|
|
3770
|
+
resolvedValues: o
|
|
3771
|
+
});
|
|
3772
|
+
try {
|
|
3773
|
+
const m = await p.entry.activate(p.match, f, s);
|
|
3774
|
+
if (m instanceof De) {
|
|
3775
|
+
if (i >= Lr) {
|
|
3776
|
+
this.fallback(r, n, p.entry.descriptor, "Too many route redirects");
|
|
3777
|
+
return;
|
|
3778
|
+
}
|
|
3779
|
+
const b = Te(m.target);
|
|
3780
|
+
this.adapter.replace(b), await this.startTransition(b, i + 1, !1);
|
|
3781
|
+
return;
|
|
3782
|
+
}
|
|
3783
|
+
p = { entry: p.entry, match: m };
|
|
3784
|
+
} catch (m) {
|
|
3785
|
+
if (s.aborted) return;
|
|
3786
|
+
this.fallback(
|
|
3787
|
+
r,
|
|
3788
|
+
n,
|
|
3789
|
+
p.entry.descriptor,
|
|
3790
|
+
$e(m)
|
|
3791
|
+
);
|
|
3792
|
+
return;
|
|
3793
|
+
}
|
|
3794
|
+
o.set(p.entry.descriptor, p.match.value), n = p.entry.context(p.match.value);
|
|
3795
|
+
}
|
|
3796
|
+
if (s.aborted || (n === this.root && (await this.waitForCompleteScope(this.root, s), n = this.findActiveContext()), s.aborted)) return;
|
|
3797
|
+
this.activeContext = n, this.applyQueriesInLineage(n, r);
|
|
3798
|
+
const l = this.formatContext(n);
|
|
3799
|
+
l !== r.location && this.adapter.replace(l), this.transitionEmitter.set(Object.freeze({
|
|
3800
|
+
state: "idle",
|
|
3801
|
+
requestedLocation: r.location,
|
|
3802
|
+
settledLocation: l
|
|
3803
|
+
}), "route transition settled"), this.scheduleStateSync();
|
|
3804
|
+
}
|
|
3805
|
+
async waitForCompleteScope(r, e) {
|
|
3806
|
+
for (; ; ) {
|
|
3807
|
+
if (e.aborted) throw e.reason;
|
|
3808
|
+
const i = this.scopes.get(r);
|
|
3809
|
+
if (i != null && Mr(i)) return i;
|
|
3810
|
+
await this.waitForRegistryChange(e);
|
|
3811
|
+
}
|
|
3812
|
+
}
|
|
3813
|
+
waitForRegistryChange(r) {
|
|
3814
|
+
return new Promise((e, i) => {
|
|
3815
|
+
const s = () => {
|
|
3816
|
+
r.removeEventListener("abort", n), this.registryWaiters.delete(s), e();
|
|
3817
|
+
}, n = () => {
|
|
3818
|
+
this.registryWaiters.delete(s), i(r.reason);
|
|
3819
|
+
};
|
|
3820
|
+
this.registryWaiters.add(s), r.addEventListener("abort", n, { once: !0 });
|
|
3821
|
+
});
|
|
3822
|
+
}
|
|
3823
|
+
wakeRegistry() {
|
|
3824
|
+
const r = [...this.registryWaiters];
|
|
3825
|
+
this.registryWaiters.clear();
|
|
3826
|
+
for (const e of r) e();
|
|
3827
|
+
}
|
|
3828
|
+
fallback(r, e, i, s) {
|
|
3829
|
+
this.activeContext = e;
|
|
3830
|
+
const n = e === this.root ? this.formatStateLocation() : this.formatContext(e);
|
|
3831
|
+
this.adapter.replace(n), this.issueEmitter.set(Object.freeze({
|
|
3832
|
+
requestedLocation: r.location,
|
|
3833
|
+
failedRouteId: (i == null ? void 0 : i.id) ?? null,
|
|
3834
|
+
reason: s,
|
|
3835
|
+
fallbackLocation: n
|
|
3836
|
+
}), "route fallback selected"), this.transitionEmitter.set(Object.freeze({
|
|
3837
|
+
state: "idle",
|
|
3838
|
+
requestedLocation: r.location,
|
|
3839
|
+
settledLocation: n
|
|
3840
|
+
}), "route transition fell back");
|
|
3841
|
+
}
|
|
3842
|
+
literalContext(r, e) {
|
|
3843
|
+
return this.cachedContext(r, e, e.path, null);
|
|
3844
|
+
}
|
|
3845
|
+
resolveTargetContext(r) {
|
|
3846
|
+
let e = this.root;
|
|
3847
|
+
for (const i of r.routes)
|
|
3848
|
+
"route" in i ? e = this.parameterContext(e, i.route, i.value) : e = this.literalContext(e, i);
|
|
3849
|
+
return e;
|
|
3850
|
+
}
|
|
3851
|
+
parameterContext(r, e, i) {
|
|
3852
|
+
const s = e.codec.format(i);
|
|
3853
|
+
if (typeof s != "string" || s === "" || s.includes("/"))
|
|
3854
|
+
throw new TypeError(`Route parameter "${e.name}" must format one path segment`);
|
|
3855
|
+
return this.cachedContext(r, e, s, i);
|
|
3856
|
+
}
|
|
3857
|
+
cachedContext(r, e, i, s) {
|
|
3858
|
+
const n = Pr(r.pathname, i), o = `${Ur(r)}\0${e.id}\0${i}`, l = this.contextCache.get(o);
|
|
3859
|
+
if (l != null) return l;
|
|
3860
|
+
const c = Object.freeze({ route: e, parent: r, segment: i, value: s, pathname: n });
|
|
3861
|
+
return be.set(c, this), this.contextCache.set(o, c), c;
|
|
3862
|
+
}
|
|
3863
|
+
scope(r) {
|
|
3864
|
+
let e = this.scopes.get(r);
|
|
3865
|
+
return e == null && (e = { owners: /* @__PURE__ */ new Map(), entries: /* @__PURE__ */ new Map(), queries: /* @__PURE__ */ new Map() }, this.scopes.set(r, e)), e;
|
|
3866
|
+
}
|
|
3867
|
+
removeOwnerEntries(r, e) {
|
|
3868
|
+
const i = /* @__PURE__ */ new Set();
|
|
3869
|
+
for (const [s, n] of r.entries)
|
|
3870
|
+
n.owner === e && (i.add(n.disposeSubscription), r.entries.delete(s));
|
|
3871
|
+
for (const s of i) s();
|
|
3872
|
+
}
|
|
3873
|
+
removeOwnerQueries(r, e) {
|
|
3874
|
+
for (const [i, s] of r.queries)
|
|
3875
|
+
s.owner === e && (s.disposeSubscription(), r.queries.delete(i));
|
|
3876
|
+
}
|
|
3877
|
+
scheduleStateSync() {
|
|
3878
|
+
this.applying > 0 || this.disposed || this.syncQueued || (this.syncQueued = !0, queueMicrotask(() => {
|
|
3879
|
+
if (this.syncQueued = !1, this.applying > 0 || this.disposed || this.transitionEmitter.get().state === "pending") return;
|
|
3880
|
+
const r = this.formatStateLocation();
|
|
3881
|
+
r !== this.adapter.read() && this.adapter.replace(r), this.requested = Re(r), this.activeContext = this.findActiveContext(), this.transitionEmitter.set(Object.freeze({
|
|
3882
|
+
...this.transitionEmitter.get(),
|
|
3883
|
+
state: "idle",
|
|
3884
|
+
settledLocation: r
|
|
3885
|
+
}), "route state synchronized");
|
|
3886
|
+
}));
|
|
3887
|
+
}
|
|
3888
|
+
formatStateLocation() {
|
|
3889
|
+
return this.formatContext(this.findActiveContext());
|
|
3890
|
+
}
|
|
3891
|
+
findActiveContext() {
|
|
3892
|
+
let r = this.root;
|
|
3893
|
+
const e = /* @__PURE__ */ new Set();
|
|
3894
|
+
for (; !e.has(r); ) {
|
|
3895
|
+
e.add(r);
|
|
3896
|
+
const i = this.scopes.get(r);
|
|
3897
|
+
if (i == null) break;
|
|
3898
|
+
const s = [...i.entries.values()].filter((c) => c.currentValue() !== void 0 && c.currentValue() !== null), n = [...i.entries.values()].find((c) => c.descriptor.kind === "literal" && c.currentValue() === null), o = s[0] ?? n;
|
|
3899
|
+
if (o == null) break;
|
|
3900
|
+
const l = o.currentValue();
|
|
3901
|
+
r = o.context(l);
|
|
3902
|
+
}
|
|
3903
|
+
return r;
|
|
3904
|
+
}
|
|
3905
|
+
formatContext(r) {
|
|
3906
|
+
const e = new URLSearchParams(this.requested.search);
|
|
3907
|
+
for (const s of this.knownQueryNames) e.delete(s);
|
|
3908
|
+
for (const s of dt(r)) {
|
|
3909
|
+
const n = this.scopes.get(s);
|
|
3910
|
+
if (n != null)
|
|
3911
|
+
for (const o of [...n.queries.values()].sort((l, c) => l.name.localeCompare(c.name))) {
|
|
3912
|
+
if (o.equals(o.emitter.get(), o.defaultValue)) continue;
|
|
3913
|
+
const l = o.codec.format(o.emitter.get());
|
|
3914
|
+
if (!Array.isArray(l))
|
|
3915
|
+
throw new TypeError(`Route query "${o.name}" codec must format an array`);
|
|
3916
|
+
for (const c of l) e.append(o.name, c);
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
e.sort();
|
|
3920
|
+
const i = e.toString();
|
|
3921
|
+
return `${r.pathname}${i === "" ? "" : `?${i}`}`;
|
|
3922
|
+
}
|
|
3923
|
+
applyQueriesInLineage(r, e) {
|
|
3924
|
+
for (const i of dt(r)) {
|
|
3925
|
+
const s = this.scopes.get(i);
|
|
3926
|
+
if (s != null)
|
|
3927
|
+
for (const n of s.queries.values()) this.applyQueryEntry(n, e);
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
applyQueryEntry(r, e) {
|
|
3931
|
+
var s;
|
|
3932
|
+
if (!ht(r.context, this.activeContext) && !Vr(r.context.pathname, e.pathname)) return;
|
|
3933
|
+
const i = e.search.getAll(r.name);
|
|
3934
|
+
try {
|
|
3935
|
+
const n = i.length === 0 ? r.defaultValue : r.codec.parse(i);
|
|
3936
|
+
r.equals(r.emitter.get(), n) || this.withApplication(() => r.emitter.set(n, "route query restored"));
|
|
3937
|
+
} catch (n) {
|
|
3938
|
+
r.equals(r.emitter.get(), r.defaultValue) || this.withApplication(() => r.emitter.set(
|
|
3939
|
+
r.defaultValue,
|
|
3940
|
+
"invalid route query defaulted"
|
|
3941
|
+
));
|
|
3942
|
+
const o = new URLSearchParams(e.search);
|
|
3943
|
+
o.delete(r.name), o.sort();
|
|
3944
|
+
const l = `${e.pathname}${o.size === 0 ? "" : `?${o.toString()}`}`;
|
|
3945
|
+
this.adapter.replace(l), this.issueEmitter.set(Object.freeze({
|
|
3946
|
+
requestedLocation: e.location,
|
|
3947
|
+
failedRouteId: ((s = r.context.route) == null ? void 0 : s.id) ?? null,
|
|
3948
|
+
reason: $e(n),
|
|
3949
|
+
fallbackLocation: l
|
|
3950
|
+
}), "invalid route query");
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
withApplication(r) {
|
|
3954
|
+
this.applying += 1;
|
|
3955
|
+
try {
|
|
3956
|
+
r();
|
|
3957
|
+
} finally {
|
|
3958
|
+
this.applying -= 1;
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
assertActive() {
|
|
3962
|
+
if (this.disposed) throw new Error("BrowserRouter has been disposed");
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
const be = /* @__PURE__ */ new WeakMap();
|
|
3966
|
+
function wi(t) {
|
|
3967
|
+
if (t == null || typeof t != "object" || Array.isArray(t))
|
|
3968
|
+
throw new TypeError("Browser router options must be an object");
|
|
3969
|
+
return new Kr(t.adapter);
|
|
3970
|
+
}
|
|
3971
|
+
function Ei(t, r, e) {
|
|
3972
|
+
if (t == null || typeof t.subscribe != "function")
|
|
3973
|
+
throw new TypeError("waitForRouteValue requires a readable emitter");
|
|
3974
|
+
if (typeof r != "function")
|
|
3975
|
+
throw new TypeError("waitForRouteValue requires an acceptance predicate");
|
|
3976
|
+
return new Promise((i, s) => {
|
|
3977
|
+
let n = !1, o = () => {
|
|
3978
|
+
};
|
|
3979
|
+
const l = (p) => {
|
|
3980
|
+
n || (n = !0, o(), e.removeEventListener("abort", c), p());
|
|
3981
|
+
}, c = () => {
|
|
3982
|
+
l(() => s(e.reason));
|
|
3983
|
+
}, u = (p, f, m) => {
|
|
3984
|
+
f === "error" ? l(() => s(
|
|
3985
|
+
m ?? new Be("Route prerequisite failed")
|
|
3986
|
+
)) : r(p) && l(() => i(p));
|
|
3987
|
+
};
|
|
3988
|
+
if (e.aborted) {
|
|
3989
|
+
c();
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3992
|
+
u(t.get(), t.getFetchState(), t.getError()), !n && (o = t.subscribe(({ value: p, fetchState: f, error: m }) => {
|
|
3993
|
+
u(p, f, m);
|
|
3994
|
+
}, { emitCurrent: !1 }), n ? o() : e.addEventListener("abort", c, { once: !0 }));
|
|
3995
|
+
});
|
|
3996
|
+
}
|
|
3997
|
+
function Re(t) {
|
|
3998
|
+
const r = D(t), e = r.indexOf("?"), i = e < 0 ? r : r.slice(0, e), s = e < 0 ? "" : r.slice(e + 1), n = i.split("/").filter(Boolean);
|
|
3999
|
+
return Object.freeze({
|
|
4000
|
+
location: r,
|
|
4001
|
+
pathname: i,
|
|
4002
|
+
segments: Object.freeze(n),
|
|
4003
|
+
search: new URLSearchParams(s)
|
|
4004
|
+
});
|
|
4005
|
+
}
|
|
4006
|
+
function Fr(t) {
|
|
4007
|
+
const r = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
|
|
4008
|
+
let i = null;
|
|
4009
|
+
for (const s of t.entries.values()) {
|
|
4010
|
+
if (r.has(s.descriptor.id))
|
|
4011
|
+
throw new Error(`Duplicate route id in one scope: ${s.descriptor.id}`);
|
|
4012
|
+
if (r.add(s.descriptor.id), s.descriptor.kind === "literal") {
|
|
4013
|
+
if (e.has(s.descriptor.path))
|
|
4014
|
+
throw new Error(`Duplicate route path in one scope: ${s.descriptor.path}`);
|
|
4015
|
+
e.add(s.descriptor.path);
|
|
4016
|
+
} else {
|
|
4017
|
+
if (i != null)
|
|
4018
|
+
throw new Error(
|
|
4019
|
+
`Ambiguous parameter routes in one scope: ${i.id}, ${s.descriptor.id}`
|
|
4020
|
+
);
|
|
4021
|
+
i = s.descriptor;
|
|
4022
|
+
}
|
|
4023
|
+
}
|
|
4024
|
+
}
|
|
4025
|
+
function Hr(t, r) {
|
|
4026
|
+
const e = [...t.entries.values()].sort((i, s) => i.descriptor.kind === s.descriptor.kind ? 0 : i.descriptor.kind === "literal" ? -1 : 1);
|
|
4027
|
+
for (const i of e) {
|
|
4028
|
+
const s = i.match(r);
|
|
4029
|
+
if (s != null) return { entry: i, match: s };
|
|
4030
|
+
}
|
|
4031
|
+
return null;
|
|
4032
|
+
}
|
|
4033
|
+
function Mr(t) {
|
|
4034
|
+
return t.owners.size > 0 && [...t.owners.values()].every(({ complete: r }) => r);
|
|
4035
|
+
}
|
|
4036
|
+
function dt(t) {
|
|
4037
|
+
const r = [];
|
|
4038
|
+
let e = t;
|
|
4039
|
+
for (; e != null; )
|
|
4040
|
+
r.unshift(e), e = e.parent;
|
|
4041
|
+
return r;
|
|
4042
|
+
}
|
|
4043
|
+
function ht(t, r) {
|
|
4044
|
+
let e = r;
|
|
4045
|
+
for (; e != null; ) {
|
|
4046
|
+
if (e === t) return !0;
|
|
4047
|
+
e = e.parent;
|
|
4048
|
+
}
|
|
4049
|
+
return !1;
|
|
4050
|
+
}
|
|
4051
|
+
function Vr(t, r) {
|
|
4052
|
+
return t === "/" || r === t || r.startsWith(`${t}/`);
|
|
4053
|
+
}
|
|
4054
|
+
function Pr(t, r) {
|
|
4055
|
+
return `${t === "/" ? "" : t}/${encodeURIComponent(r)}`;
|
|
4056
|
+
}
|
|
4057
|
+
function Ur(t) {
|
|
4058
|
+
return t.pathname;
|
|
4059
|
+
}
|
|
4060
|
+
function Ce(t) {
|
|
4061
|
+
try {
|
|
4062
|
+
return decodeURIComponent(t);
|
|
4063
|
+
} catch {
|
|
4064
|
+
throw new Be("Route contains malformed percent encoding");
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
function Qr(t) {
|
|
4068
|
+
if (typeof t != "string" || !/^[A-Za-z][A-Za-z0-9_.-]*$/.test(t))
|
|
4069
|
+
throw new TypeError("Route query name must start with a letter and use URL-safe characters");
|
|
4070
|
+
return t;
|
|
4071
|
+
}
|
|
4072
|
+
function $e(t) {
|
|
4073
|
+
return t instanceof Error && t.message !== "" ? t.message : "The requested route could not be resolved";
|
|
4074
|
+
}
|
|
4075
|
+
function Br(t, r, e) {
|
|
4076
|
+
const i = t.get();
|
|
4077
|
+
return i == null ? e : r(i);
|
|
4078
|
+
}
|
|
4079
|
+
function Oe(t) {
|
|
4080
|
+
return we(t), t;
|
|
4081
|
+
}
|
|
4082
|
+
function ue(t) {
|
|
4083
|
+
return t != null && typeof t == "object" && be.has(t);
|
|
4084
|
+
}
|
|
4085
|
+
function P(t, r) {
|
|
4086
|
+
if (t !== r.root && (!ue(t) || be.get(t) !== r))
|
|
4087
|
+
throw new TypeError("Resolved route does not belong to this router");
|
|
4088
|
+
}
|
|
4089
|
+
function _r(t) {
|
|
4090
|
+
if (t == null || typeof t != "object" || typeof Reflect.get(t, "read") != "function" || typeof Reflect.get(t, "href") != "function" || typeof Reflect.get(t, "push") != "function" || typeof Reflect.get(t, "replace") != "function" || typeof Reflect.get(t, "subscribe") != "function")
|
|
4091
|
+
throw new TypeError("BrowserRouter requires a navigation adapter");
|
|
4092
|
+
}
|
|
4093
|
+
function ce(t) {
|
|
4094
|
+
if (t == null || typeof t != "object" && typeof t != "function")
|
|
4095
|
+
throw new TypeError("Route registration owner must be an object");
|
|
4096
|
+
}
|
|
4097
|
+
function pt(t, r) {
|
|
4098
|
+
if (t == null || typeof t != "object" || typeof Reflect.get(t, "get") != "function" || typeof Reflect.get(t, "set") != "function" || typeof Reflect.get(t, "subscribe") != "function")
|
|
4099
|
+
throw new TypeError(`${r} must be a writable emitter`);
|
|
4100
|
+
}
|
|
4101
|
+
class xi extends g {
|
|
4102
|
+
initialize() {
|
|
4103
|
+
const r = this._runtime.router;
|
|
4104
|
+
if (r == null) throw new Error("RouteLink requires a router in FrayRuntime");
|
|
4105
|
+
this.watch(r.transition);
|
|
4106
|
+
}
|
|
4107
|
+
render() {
|
|
4108
|
+
const r = this._runtime.router;
|
|
4109
|
+
if (r == null) throw new Error("RouteLink requires a router in FrayRuntime");
|
|
4110
|
+
const e = _e(this.props.to) ? r.resolve(this.props.to, this._routeContext ?? r.root) : this.props.to, {
|
|
4111
|
+
to: i,
|
|
4112
|
+
exact: s = !1,
|
|
4113
|
+
children: n = [],
|
|
4114
|
+
onClick: o,
|
|
4115
|
+
...l
|
|
4116
|
+
} = this.props;
|
|
4117
|
+
return te("a", {
|
|
4118
|
+
...l,
|
|
4119
|
+
href: r.href(e),
|
|
4120
|
+
"aria-current": r.isActive(e, s) ? "page" : null,
|
|
4121
|
+
onClick: (c) => {
|
|
4122
|
+
o == null || o(c), Wr(c, l.target, l.download) && (c.preventDefault(), r.navigate(e));
|
|
4123
|
+
}
|
|
4124
|
+
}, n);
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
function Wr(t, r, e) {
|
|
4128
|
+
return !(t.defaultPrevented || t.button !== 0 || t.metaKey || t.ctrlKey || t.shiftKey || t.altKey || e != null && e !== !1 || r != null && r !== "" && r !== "_self");
|
|
4129
|
+
}
|
|
4130
|
+
class vi extends g {
|
|
4131
|
+
constructor() {
|
|
4132
|
+
super(...arguments);
|
|
4133
|
+
a(this, "unregister", null);
|
|
4134
|
+
}
|
|
4135
|
+
initialize() {
|
|
4136
|
+
const e = this._runtime.router;
|
|
4137
|
+
if (e == null || this._routeContext == null)
|
|
4138
|
+
throw new Error("RouteQuery requires a router and contextual route scope");
|
|
4139
|
+
this.unregister = e.registerQuery(this._routeContext, this, {
|
|
4140
|
+
name: this.props.name,
|
|
4141
|
+
valueEmitter: this.props.valueEmitter,
|
|
4142
|
+
codec: this.props.codec,
|
|
4143
|
+
defaultValue: this.props.defaultValue,
|
|
4144
|
+
...this.props.equals == null ? {} : { equals: this.props.equals }
|
|
4145
|
+
});
|
|
4146
|
+
}
|
|
4147
|
+
render() {
|
|
4148
|
+
return te(Le, null, this.props.children ?? []);
|
|
4149
|
+
}
|
|
4150
|
+
onDestroy() {
|
|
4151
|
+
var e;
|
|
4152
|
+
(e = this.unregister) == null || e.call(this), this.unregister = null;
|
|
4153
|
+
}
|
|
4154
|
+
}
|
|
4155
|
+
class Si extends g {
|
|
4156
|
+
constructor() {
|
|
4157
|
+
super(...arguments);
|
|
4158
|
+
a(this, "registration", null);
|
|
4159
|
+
}
|
|
4160
|
+
initialize() {
|
|
4161
|
+
const e = this._runtime.router;
|
|
4162
|
+
if (e == null || this._routeContext == null)
|
|
4163
|
+
throw new Error("RouteValue requires a router and contextual route scope");
|
|
4164
|
+
this.registration = e.registerValueRoute(this._routeContext, this, {
|
|
4165
|
+
route: this.props.route,
|
|
4166
|
+
valueEmitter: this.props.valueEmitter,
|
|
4167
|
+
...this.props.resolve == null ? {} : { resolve: this.props.resolve }
|
|
4168
|
+
}), this.watch(this.props.valueEmitter);
|
|
4169
|
+
}
|
|
4170
|
+
render() {
|
|
4171
|
+
const e = this.props.valueEmitter.get(), i = this.props.children ?? [];
|
|
4172
|
+
return !this.props.scopeChildren || e == null || this.registration == null ? te(Le, null, i) : te(je, {
|
|
4173
|
+
key: this.registration.contextFor(e).pathname,
|
|
4174
|
+
context: this.registration.contextFor(e),
|
|
4175
|
+
children: i
|
|
4176
|
+
});
|
|
4177
|
+
}
|
|
4178
|
+
onDestroy() {
|
|
4179
|
+
var e;
|
|
4180
|
+
(e = this.registration) == null || e.dispose(), this.registration = null;
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
2990
4183
|
export {
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
se as
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
4184
|
+
Et as BaseSelectionHandler,
|
|
4185
|
+
Kr as BrowserRouter,
|
|
4186
|
+
fe as Button,
|
|
4187
|
+
q as Checkbox,
|
|
4188
|
+
ct as ColorPicker,
|
|
4189
|
+
g as Component,
|
|
4190
|
+
ie as DataTable,
|
|
4191
|
+
er as DefaultTableFilterEncoding,
|
|
4192
|
+
yt as DescriptionItem,
|
|
4193
|
+
Ze as DescriptionList,
|
|
4194
|
+
tt as Dialog,
|
|
4195
|
+
ne as Dropdown,
|
|
4196
|
+
y as FilterMode,
|
|
4197
|
+
Q as FilterPanel,
|
|
4198
|
+
Le as Fragment,
|
|
4199
|
+
Ti as FrayRuntime,
|
|
4200
|
+
Z as ListView,
|
|
4201
|
+
ai as MemoryNavigationAdapter,
|
|
4202
|
+
Kt as MultiSelectionHandler,
|
|
4203
|
+
Ee as Panel,
|
|
4204
|
+
H as Placeholder,
|
|
4205
|
+
ke as ProgressBar,
|
|
4206
|
+
rt as QuadCheckbox,
|
|
4207
|
+
ee as RadioButton,
|
|
4208
|
+
oe as RadioGroup,
|
|
4209
|
+
xi as RouteLink,
|
|
4210
|
+
vi as RouteQuery,
|
|
4211
|
+
De as RouteRedirect,
|
|
4212
|
+
je as RouteScope,
|
|
4213
|
+
Be as RouteUnavailableError,
|
|
4214
|
+
Si as RouteValue,
|
|
4215
|
+
Ri as ServiceScope,
|
|
4216
|
+
qt as Sidebar,
|
|
4217
|
+
Fe as SingleSelectionHandler,
|
|
4218
|
+
xe as SplitView,
|
|
4219
|
+
Ci as StyleRegistry,
|
|
4220
|
+
ft as Tab,
|
|
4221
|
+
U as TabLine,
|
|
4222
|
+
re as TabPanel,
|
|
4223
|
+
Ne as TableHeader,
|
|
4224
|
+
Y as TableHeaderCell,
|
|
4225
|
+
ae as Textbox,
|
|
4226
|
+
lt as ThemePicker,
|
|
4227
|
+
ot as Toggle,
|
|
4228
|
+
Se as Toolbar,
|
|
4229
|
+
St as TreeItem,
|
|
4230
|
+
se as TreeView,
|
|
4231
|
+
it as TriCheckbox,
|
|
4232
|
+
rr as applyLocalTableState,
|
|
4233
|
+
qr as assertRouteCodec,
|
|
4234
|
+
B as assertRouteDescriptor,
|
|
4235
|
+
Dr as assertRouteQueryCodec,
|
|
4236
|
+
we as assertRouteTarget,
|
|
4237
|
+
xt as assertSort,
|
|
4238
|
+
W as assertTreeNodes,
|
|
4239
|
+
hi as booleanRouteQueryCodec,
|
|
4240
|
+
wi as createBrowserRouter,
|
|
4241
|
+
$i as createFrayRuntime,
|
|
4242
|
+
lr as createHandlerTableDataSource,
|
|
4243
|
+
ci as createHashNavigation,
|
|
4244
|
+
li as createHistoryNavigation,
|
|
4245
|
+
ar as createLocalTableDataSource,
|
|
4246
|
+
ri as createQueryTableDataSource,
|
|
4247
|
+
cr as createRestTableDataSource,
|
|
4248
|
+
pe as createSelectionHandler,
|
|
4249
|
+
Oi as createServiceScope,
|
|
4250
|
+
ji as createStyleRegistry,
|
|
4251
|
+
x as css,
|
|
4252
|
+
Ai as defaultFrayRuntime,
|
|
4253
|
+
He as defaultItemKey,
|
|
4254
|
+
pi as defineRoute,
|
|
4255
|
+
fi as defineRouteParameter,
|
|
4256
|
+
Ni as defineService,
|
|
4257
|
+
Xr as deriveFilterPredicate,
|
|
4258
|
+
Yr as deriveFilteredItems,
|
|
4259
|
+
si as deriveTreeNode,
|
|
4260
|
+
zt as filterByState,
|
|
4261
|
+
le as findFrayStylesheetOption,
|
|
4262
|
+
ii as findTreeNode,
|
|
4263
|
+
Te as formatRouteTarget,
|
|
4264
|
+
Cr as frayColorOptions,
|
|
4265
|
+
Rr as frayThemeOptions,
|
|
4266
|
+
oi as frayThemeVariableCatalog,
|
|
4267
|
+
te as h,
|
|
4268
|
+
ye as isFilterMode,
|
|
4269
|
+
_e as isRouteDescriptor,
|
|
4270
|
+
Nr as isRouteTarget,
|
|
4271
|
+
h as jsx,
|
|
4272
|
+
qi as jsxDEV,
|
|
3057
4273
|
w as jsxs,
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
4274
|
+
Di as live,
|
|
4275
|
+
wt as matchesFilterState,
|
|
4276
|
+
D as normalizeRouteLocation,
|
|
4277
|
+
ti as parseFilterState,
|
|
4278
|
+
zi as provideService,
|
|
4279
|
+
yi as redirectTo,
|
|
4280
|
+
$r as replaceFrayStylesheet,
|
|
4281
|
+
mi as routeParameter,
|
|
4282
|
+
bi as routeTarget,
|
|
4283
|
+
ei as serializeFilterState,
|
|
4284
|
+
tr as serializeTableQuery,
|
|
4285
|
+
ui as stringRouteCodec,
|
|
4286
|
+
di as stringRouteQueryCodec,
|
|
4287
|
+
Li as styleRegistry,
|
|
4288
|
+
mt as tabButtonId,
|
|
4289
|
+
bt as tabPanelId,
|
|
4290
|
+
br as updateTreeNode,
|
|
4291
|
+
ni as updateWritableTreeNode,
|
|
4292
|
+
Ei as waitForRouteValue,
|
|
4293
|
+
gi as withRouteQuery
|
|
3070
4294
|
};
|
|
3071
4295
|
//# sourceMappingURL=index.js.map
|