@sylwellsoftware/fray 0.1.0-alpha.1
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/EXPERIMENTAL.md +75 -0
- package/LICENSE +55 -0
- package/NOTICE +2 -0
- package/README.md +521 -0
- package/dist/Components/Placeholder.d.ts +14 -0
- package/dist/Components/Placeholder.d.ts.map +1 -0
- package/dist/Components/component.d.ts +187 -0
- package/dist/Components/component.d.ts.map +1 -0
- package/dist/Components/controlUtils.d.ts +20 -0
- package/dist/Components/controlUtils.d.ts.map +1 -0
- package/dist/Components/data/descriptionList.d.ts +21 -0
- package/dist/Components/data/descriptionList.d.ts.map +1 -0
- package/dist/Components/data/listview/listview.d.ts +39 -0
- package/dist/Components/data/listview/listview.d.ts.map +1 -0
- package/dist/Components/data/selectionhandler.d.ts +68 -0
- package/dist/Components/data/selectionhandler.d.ts.map +1 -0
- package/dist/Components/data/table/DataTable.d.ts +72 -0
- package/dist/Components/data/table/DataTable.d.ts.map +1 -0
- package/dist/Components/data/table/FilterPanel.d.ts +35 -0
- package/dist/Components/data/table/FilterPanel.d.ts.map +1 -0
- package/dist/Components/data/table/TableHeader.d.ts +21 -0
- package/dist/Components/data/table/TableHeader.d.ts.map +1 -0
- package/dist/Components/data/table/TableHeaderCell.d.ts +39 -0
- package/dist/Components/data/table/TableHeaderCell.d.ts.map +1 -0
- package/dist/Components/data/table/tableQuery.d.ts +25 -0
- package/dist/Components/data/table/tableQuery.d.ts.map +1 -0
- package/dist/Components/data/treeview/treeitem.d.ts +20 -0
- package/dist/Components/data/treeview/treeitem.d.ts.map +1 -0
- package/dist/Components/data/treeview/treeview.d.ts +42 -0
- package/dist/Components/data/treeview/treeview.d.ts.map +1 -0
- package/dist/Components/dialog/dialog.d.ts +37 -0
- package/dist/Components/dialog/dialog.d.ts.map +1 -0
- package/dist/Components/layout/panel.d.ts +20 -0
- package/dist/Components/layout/panel.d.ts.map +1 -0
- package/dist/Components/layout/sidebar.d.ts +18 -0
- package/dist/Components/layout/sidebar.d.ts.map +1 -0
- package/dist/Components/layout/splitView.d.ts +18 -0
- package/dist/Components/layout/splitView.d.ts.map +1 -0
- package/dist/Components/layout/tabpanel/tab.d.ts +12 -0
- package/dist/Components/layout/tabpanel/tab.d.ts.map +1 -0
- package/dist/Components/layout/tabpanel/tabline.d.ts +32 -0
- package/dist/Components/layout/tabpanel/tabline.d.ts.map +1 -0
- package/dist/Components/layout/tabpanel/tabpanel.d.ts +34 -0
- package/dist/Components/layout/tabpanel/tabpanel.d.ts.map +1 -0
- package/dist/Components/lineinputs/checkbox/Checkbox.d.ts +35 -0
- package/dist/Components/lineinputs/checkbox/Checkbox.d.ts.map +1 -0
- package/dist/Components/lineinputs/checkbox/QuadCheckbox.d.ts +12 -0
- package/dist/Components/lineinputs/checkbox/QuadCheckbox.d.ts.map +1 -0
- package/dist/Components/lineinputs/checkbox/TriCheckbox.d.ts +12 -0
- package/dist/Components/lineinputs/checkbox/TriCheckbox.d.ts.map +1 -0
- package/dist/Components/lineinputs/dropdown.d.ts +37 -0
- package/dist/Components/lineinputs/dropdown.d.ts.map +1 -0
- package/dist/Components/lineinputs/textbox.d.ts +36 -0
- package/dist/Components/lineinputs/textbox.d.ts.map +1 -0
- package/dist/Components/lineinputs/toggle.d.ts +30 -0
- package/dist/Components/lineinputs/toggle.d.ts.map +1 -0
- package/dist/Components/menu/button.d.ts +24 -0
- package/dist/Components/menu/button.d.ts.map +1 -0
- package/dist/Components/menu/toolbar.d.ts +15 -0
- package/dist/Components/menu/toolbar.d.ts.map +1 -0
- package/dist/Components/status/progressBar.d.ts +21 -0
- package/dist/Components/status/progressBar.d.ts.map +1 -0
- package/dist/button-BRDkmR1C.js +203 -0
- package/dist/button-BRDkmR1C.js.map +1 -0
- package/dist/experimental.d.ts +16 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +1361 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1014 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime-CarwHDyL.js +1155 -0
- package/dist/jsx-dev-runtime-CarwHDyL.js.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +2 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +6 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.d.ts +26 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +9 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/runtime.d.ts +29 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/styling/baseStyleDefinitions.d.ts +154 -0
- package/dist/styling/baseStyleDefinitions.d.ts.map +1 -0
- package/dist/styling/styleRegistry.d.ts +19 -0
- package/dist/styling/styleRegistry.d.ts.map +1 -0
- package/dist/util/filterMode.d.ts +13 -0
- package/dist/util/filterMode.d.ts.map +1 -0
- package/package.json +83 -0
- package/themes/README.md +30 -0
- package/themes/dark.css +39 -0
- package/themes/light.css +39 -0
|
@@ -0,0 +1,1155 @@
|
|
|
1
|
+
var ue = Object.defineProperty;
|
|
2
|
+
var ce = (e, t, n) => t in e ? ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var u = (e, t, n) => ce(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
const I = {
|
|
5
|
+
after: {
|
|
6
|
+
content: '""',
|
|
7
|
+
display: "block",
|
|
8
|
+
position: "absolute",
|
|
9
|
+
top: "0",
|
|
10
|
+
left: "0",
|
|
11
|
+
width: "100%",
|
|
12
|
+
height: "100%",
|
|
13
|
+
"pointer-events": "none"
|
|
14
|
+
},
|
|
15
|
+
inputline: {
|
|
16
|
+
display: "flex",
|
|
17
|
+
"flex-flow": "row nowrap",
|
|
18
|
+
position: "relative",
|
|
19
|
+
"line-height": "1.25",
|
|
20
|
+
"font-size": "var(--ui-font-size)",
|
|
21
|
+
"min-height": "calc(var(--ui-font-size) + var(--ui-padding) + var(--ui-padding))",
|
|
22
|
+
color: "var(--ui-text-color)",
|
|
23
|
+
"border-radius": "var(--ui-border-radius)",
|
|
24
|
+
"box-sizing": "border-box"
|
|
25
|
+
},
|
|
26
|
+
input: {
|
|
27
|
+
background: "var(--ui-input-bg)",
|
|
28
|
+
padding: "var(--ui-padding-v) var(--ui-padding-h)",
|
|
29
|
+
"pointer-events": "all",
|
|
30
|
+
border: "var(--ui-input-border)",
|
|
31
|
+
width: "var(--input-width)",
|
|
32
|
+
"box-shadow": "var(--input-shadow)",
|
|
33
|
+
"box-sizing": "border-box",
|
|
34
|
+
"white-space": "nowrap",
|
|
35
|
+
variants: {
|
|
36
|
+
":focus-visible": {
|
|
37
|
+
outline: "2px solid transparent",
|
|
38
|
+
"outline-offset": "1px",
|
|
39
|
+
"border-color": "var(--ui-accent-color)",
|
|
40
|
+
"box-shadow": "0 0 0 1px var(--ui-accent-color-highlight)"
|
|
41
|
+
},
|
|
42
|
+
":disabled": {
|
|
43
|
+
background: "var(--ui-input-bg-disabled)",
|
|
44
|
+
"border-color": "var(--ui-input-border-disabled)",
|
|
45
|
+
color: "var(--ui-input-text-color-disabled)",
|
|
46
|
+
cursor: "not-allowed"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
inputlike: {
|
|
51
|
+
background: "var(--ui-input-bg)",
|
|
52
|
+
padding: "var(--ui-padding-v) var(--ui-padding-h)",
|
|
53
|
+
"pointer-events": "all",
|
|
54
|
+
border: "var(--ui-input-border)",
|
|
55
|
+
"box-shadow": "var(--input-shadow)",
|
|
56
|
+
"box-sizing": "border-box",
|
|
57
|
+
"white-space": "nowrap",
|
|
58
|
+
"border-radius": "var(--ui-border-radius)"
|
|
59
|
+
},
|
|
60
|
+
labeledinput: {
|
|
61
|
+
display: "flex",
|
|
62
|
+
"flex-flow": "row nowrap",
|
|
63
|
+
"align-items": "center",
|
|
64
|
+
gap: ".5em"
|
|
65
|
+
},
|
|
66
|
+
label: {
|
|
67
|
+
color: "var(--ui-text-color)",
|
|
68
|
+
"font-size": "var(--ui-font-size)"
|
|
69
|
+
},
|
|
70
|
+
disabled: {
|
|
71
|
+
"border-color": "var(--ui-input-border-disabled)",
|
|
72
|
+
color: "var(--ui-input-text-color-disabled)"
|
|
73
|
+
},
|
|
74
|
+
error: {
|
|
75
|
+
color: "var(--error-color)"
|
|
76
|
+
},
|
|
77
|
+
working: {
|
|
78
|
+
display: "inline",
|
|
79
|
+
position: "absolute",
|
|
80
|
+
"z-index": "1",
|
|
81
|
+
margin: "auto",
|
|
82
|
+
animation: "fray-placeholder-progress 0.8s linear infinite",
|
|
83
|
+
"background-repeat": "repeat",
|
|
84
|
+
"background-size": "2rem 2rem",
|
|
85
|
+
"background-image": "linear-gradient(-45deg, #0001 25%, #fff1 25%, #fff1 50%, #0001 50%, #0001 75%, #fff1 75%, #fff1)",
|
|
86
|
+
border: "0 solid transparent",
|
|
87
|
+
"border-radius": "inherit",
|
|
88
|
+
"box-sizing": "border-box"
|
|
89
|
+
},
|
|
90
|
+
panel: {
|
|
91
|
+
background: "var(--panel-bg)",
|
|
92
|
+
border: "var(--panel-border)",
|
|
93
|
+
"border-radius": "var(--panel-radius)",
|
|
94
|
+
"box-shadow": "var(--panel-shadow)",
|
|
95
|
+
color: "var(--panel-color)"
|
|
96
|
+
},
|
|
97
|
+
sectionheader: {
|
|
98
|
+
"box-shadow": "var(--sectionheader-shadow)",
|
|
99
|
+
background: "var(--sectionheader-bg)",
|
|
100
|
+
color: "var(--sectionheader-color)"
|
|
101
|
+
},
|
|
102
|
+
uiline: {
|
|
103
|
+
"box-sizing": "border-box",
|
|
104
|
+
"line-height": "1.25",
|
|
105
|
+
"font-size": "var(--ui-font-size)",
|
|
106
|
+
"min-height": "calc(var(--ui-font-size) + var(--ui-padding) + var(--ui-padding))",
|
|
107
|
+
color: "var(--ui-text-color)",
|
|
108
|
+
padding: "var(--ui-padding-v) var(--ui-padding-h)",
|
|
109
|
+
"border-radius": "var(--ui-border-radius)",
|
|
110
|
+
cursor: "pointer",
|
|
111
|
+
"user-select": "none"
|
|
112
|
+
},
|
|
113
|
+
noselect: {
|
|
114
|
+
"user-select": "var(--noselect-user-select)",
|
|
115
|
+
cursor: "var(--noselect-cursor)"
|
|
116
|
+
},
|
|
117
|
+
button: {
|
|
118
|
+
"box-sizing": "border-box",
|
|
119
|
+
background: "var(--button-background)",
|
|
120
|
+
border: "var(--button-border)",
|
|
121
|
+
"box-shadow": "var(--button-shadow)",
|
|
122
|
+
color: "var(--button-color)",
|
|
123
|
+
cursor: "default",
|
|
124
|
+
"user-select": "none",
|
|
125
|
+
variants: {
|
|
126
|
+
":hover": {
|
|
127
|
+
background: "var(--button-background-hover)",
|
|
128
|
+
"box-shadow": "var(--button-shadow)"
|
|
129
|
+
},
|
|
130
|
+
":focus-visible": {
|
|
131
|
+
outline: "2px solid transparent",
|
|
132
|
+
"outline-offset": "1px",
|
|
133
|
+
border: "1px solid var(--ui-accent-color)",
|
|
134
|
+
"box-shadow": "0 0 0 1px var(--ui-accent-color-highlight)"
|
|
135
|
+
},
|
|
136
|
+
":disabled": {
|
|
137
|
+
background: "var(--button-background-disabled)",
|
|
138
|
+
border: "var(--button-border-disabled)",
|
|
139
|
+
color: "var(--ui-input-text-color-disabled)",
|
|
140
|
+
cursor: "not-allowed",
|
|
141
|
+
"pointer-events": "none"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
toolbar: {
|
|
146
|
+
background: "var(--toolbar-bg)",
|
|
147
|
+
border: "var(--toolbar-border)",
|
|
148
|
+
"border-radius": "var(--toolbar-radius)",
|
|
149
|
+
"box-shadow": "var(--toolbar-shadow)",
|
|
150
|
+
color: "var(--toolbar-color)"
|
|
151
|
+
}
|
|
152
|
+
}, U = "data-fray-structural-styles";
|
|
153
|
+
let fe = 1;
|
|
154
|
+
class J {
|
|
155
|
+
constructor(t = `runtime-${fe++}`) {
|
|
156
|
+
u(this, "id");
|
|
157
|
+
u(this, "cssFragments", /* @__PURE__ */ new Set());
|
|
158
|
+
u(this, "baseStyleMap", /* @__PURE__ */ new Map());
|
|
159
|
+
if (typeof t != "string") throw new TypeError("StyleRegistry id must be a string");
|
|
160
|
+
this.id = t;
|
|
161
|
+
}
|
|
162
|
+
registerCSS(t) {
|
|
163
|
+
if (typeof t != "string") throw new TypeError("Component CSS must be a string");
|
|
164
|
+
return t.trim().length > 0 && this.cssFragments.add(t.trim()), this;
|
|
165
|
+
}
|
|
166
|
+
registerBaseStyle(t, n) {
|
|
167
|
+
if (typeof t != "string" || t.trim().length === 0)
|
|
168
|
+
throw new TypeError("Base style selector must be a non-empty string");
|
|
169
|
+
const r = typeof n == "string" ? [n] : n;
|
|
170
|
+
if (!Array.isArray(r))
|
|
171
|
+
throw new TypeError("Base style names must be a string or array");
|
|
172
|
+
for (const i of r) {
|
|
173
|
+
if (!Object.hasOwn(I, i))
|
|
174
|
+
throw new Error(`Unknown Fray base style: ${String(i)}`);
|
|
175
|
+
const s = i, o = this.baseStyleMap.get(s) ?? /* @__PURE__ */ new Set();
|
|
176
|
+
o.add(t.trim()), this.baseStyleMap.set(s, o);
|
|
177
|
+
}
|
|
178
|
+
return this;
|
|
179
|
+
}
|
|
180
|
+
generateRootCSS() {
|
|
181
|
+
return `:root {
|
|
182
|
+
--base-font-size: 14px;
|
|
183
|
+
--ui-font-size: var(--base-font-size);
|
|
184
|
+
--ui-padding: 0.375rem;
|
|
185
|
+
--ui-padding-h: 0.375rem;
|
|
186
|
+
--ui-padding-v: 0;
|
|
187
|
+
--ui-border-radius: 0.25rem;
|
|
188
|
+
--input-width: 15rem;
|
|
189
|
+
--spacing-small: 0.5rem;
|
|
190
|
+
--spacing-medium: 1rem;
|
|
191
|
+
--panel-padding: 0.75rem;
|
|
192
|
+
--noselect-user-select: none;
|
|
193
|
+
--noselect-cursor: default;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
*, *::before, *::after {
|
|
197
|
+
box-sizing: border-box;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@media (prefers-reduced-motion: reduce) {
|
|
201
|
+
*, *::before, *::after {
|
|
202
|
+
scroll-behavior: auto !important;
|
|
203
|
+
animation-duration: 0.01ms !important;
|
|
204
|
+
animation-iteration-count: 1 !important;
|
|
205
|
+
transition-duration: 0.01ms !important;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@media (forced-colors: active) {
|
|
210
|
+
:focus-visible {
|
|
211
|
+
outline: 2px solid Highlight !important;
|
|
212
|
+
outline-offset: 2px !important;
|
|
213
|
+
}
|
|
214
|
+
}`;
|
|
215
|
+
}
|
|
216
|
+
generateBaseStyleCSS() {
|
|
217
|
+
let t = "";
|
|
218
|
+
for (const [n, r] of this.baseStyleMap) {
|
|
219
|
+
const { properties: i, variants: s } = he(I[n]), o = [...r];
|
|
220
|
+
t += D(n, o, i);
|
|
221
|
+
for (const [a, l] of Object.entries(s))
|
|
222
|
+
t += D(
|
|
223
|
+
`${n}${a}`,
|
|
224
|
+
o.map((c) => be(c, a)),
|
|
225
|
+
l
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
return t.trim();
|
|
229
|
+
}
|
|
230
|
+
generateCSS() {
|
|
231
|
+
return [
|
|
232
|
+
this.generateRootCSS(),
|
|
233
|
+
this.generateBaseStyleCSS(),
|
|
234
|
+
[...this.cssFragments].join(`
|
|
235
|
+
|
|
236
|
+
`)
|
|
237
|
+
].filter(Boolean).join(`
|
|
238
|
+
|
|
239
|
+
`);
|
|
240
|
+
}
|
|
241
|
+
injectAll(t = globalThis.document) {
|
|
242
|
+
if ((t == null ? void 0 : t.head) == null)
|
|
243
|
+
throw new TypeError("StyleRegistry.injectAll requires a document with a head");
|
|
244
|
+
const n = `style[${U}="${me(this.id)}"]`;
|
|
245
|
+
let r = t.head.querySelector(n);
|
|
246
|
+
r == null && (r = t.createElement("style"), r.setAttribute(U, this.id), t.head.prepend(r));
|
|
247
|
+
const i = this.generateCSS();
|
|
248
|
+
return r.textContent !== i && (r.textContent = i), r;
|
|
249
|
+
}
|
|
250
|
+
reset() {
|
|
251
|
+
this.cssFragments.clear(), this.baseStyleMap.clear();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function de() {
|
|
255
|
+
return new J();
|
|
256
|
+
}
|
|
257
|
+
const pe = new J("");
|
|
258
|
+
function he(e) {
|
|
259
|
+
const t = {};
|
|
260
|
+
let n = {};
|
|
261
|
+
for (const [r, i] of Object.entries(e))
|
|
262
|
+
if (r === "variants") {
|
|
263
|
+
if (typeof i != "object")
|
|
264
|
+
throw new TypeError("Base style variants must be declaration maps");
|
|
265
|
+
n = i;
|
|
266
|
+
} else if (typeof i == "string")
|
|
267
|
+
t[r] = i;
|
|
268
|
+
else
|
|
269
|
+
throw new TypeError(`Base style property ${r} must be a string`);
|
|
270
|
+
return { properties: t, variants: n };
|
|
271
|
+
}
|
|
272
|
+
function D(e, t, n) {
|
|
273
|
+
if (t.length === 0 || Object.keys(n).length === 0) return "";
|
|
274
|
+
const r = Object.entries(n).map(([i, s]) => ` ${i}: ${s};`).join(`
|
|
275
|
+
`);
|
|
276
|
+
return `/* ${e} */
|
|
277
|
+
${t.join(`,
|
|
278
|
+
`)} {
|
|
279
|
+
${r}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
`;
|
|
283
|
+
}
|
|
284
|
+
function be(e, t) {
|
|
285
|
+
const n = e.indexOf("::");
|
|
286
|
+
return n < 0 ? `${e}${t}` : `${e.slice(0, n)}${t}${e.slice(n)}`;
|
|
287
|
+
}
|
|
288
|
+
function me(e) {
|
|
289
|
+
return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
290
|
+
}
|
|
291
|
+
const ye = /* @__PURE__ */ new Set([
|
|
292
|
+
"annotation-xml",
|
|
293
|
+
"color-profile",
|
|
294
|
+
"font-face",
|
|
295
|
+
"font-face-src",
|
|
296
|
+
"font-face-uri",
|
|
297
|
+
"font-face-format",
|
|
298
|
+
"font-face-name",
|
|
299
|
+
"missing-glyph"
|
|
300
|
+
]);
|
|
301
|
+
class L {
|
|
302
|
+
constructor(t = {}, n = de()) {
|
|
303
|
+
u(this, "elementPrefix");
|
|
304
|
+
u(this, "elementNameOverrides");
|
|
305
|
+
u(this, "styleRegistry");
|
|
306
|
+
if (t == null || typeof t != "object" || Array.isArray(t))
|
|
307
|
+
throw new TypeError("FrayRuntime options must be an object");
|
|
308
|
+
const r = t.elementNames ?? {};
|
|
309
|
+
if (r == null || typeof r != "object" || Array.isArray(r))
|
|
310
|
+
throw new TypeError("Fray elementNames must be an object");
|
|
311
|
+
const i = r.prefix === void 0 ? "fray" : r.prefix;
|
|
312
|
+
i !== null && k(i, "Fray element prefix");
|
|
313
|
+
const s = r.overrides ?? {};
|
|
314
|
+
if (s == null || typeof s != "object" || Array.isArray(s))
|
|
315
|
+
throw new TypeError("Fray element-name overrides must be an object");
|
|
316
|
+
for (const [o, a] of Object.entries(s))
|
|
317
|
+
k(o, "Fray component host name"), K(a);
|
|
318
|
+
this.elementPrefix = i, this.elementNameOverrides = Object.freeze({ ...s }), this.styleRegistry = n;
|
|
319
|
+
}
|
|
320
|
+
resolveElementName(t, n = null) {
|
|
321
|
+
k(t, "Fray component host name");
|
|
322
|
+
const i = this.elementNameOverrides[t] ?? (this.elementPrefix == null ? n ?? t : `${this.elementPrefix}-${t}`);
|
|
323
|
+
return K(i), i;
|
|
324
|
+
}
|
|
325
|
+
resolveHostSelector(t, n, r = null) {
|
|
326
|
+
if (typeof t != "string") throw new TypeError("Host selector must be a string");
|
|
327
|
+
return t.replaceAll("&", this.resolveElementName(n, r));
|
|
328
|
+
}
|
|
329
|
+
resolveHostCSS(t, n, r = null) {
|
|
330
|
+
if (typeof t != "string") throw new TypeError("Host CSS must be a string");
|
|
331
|
+
return t.replaceAll("&", this.resolveElementName(n, r));
|
|
332
|
+
}
|
|
333
|
+
create(t, ...n) {
|
|
334
|
+
const r = new t(...n);
|
|
335
|
+
return r._setRuntime(this), r;
|
|
336
|
+
}
|
|
337
|
+
mount(t, n, r = null) {
|
|
338
|
+
return t._setRuntime(this), t.mount(n, r), t;
|
|
339
|
+
}
|
|
340
|
+
registerStyles(t) {
|
|
341
|
+
if (t == null || typeof t.registerStyles != "function")
|
|
342
|
+
throw new TypeError("registerStyles requires a Fray component dependency");
|
|
343
|
+
return t.registerStyles(this), this;
|
|
344
|
+
}
|
|
345
|
+
injectStyles(t = globalThis.document) {
|
|
346
|
+
return this.styleRegistry.injectAll(t);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function _e(e = {}) {
|
|
350
|
+
return new L(e);
|
|
351
|
+
}
|
|
352
|
+
const Z = new L({}, pe);
|
|
353
|
+
function k(e, t) {
|
|
354
|
+
if (typeof e != "string" || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(e))
|
|
355
|
+
throw new TypeError(`${t} must be a lowercase kebab-case name`);
|
|
356
|
+
}
|
|
357
|
+
function K(e) {
|
|
358
|
+
if (k(e, "Fray element name"), !e.includes("-") || ye.has(e))
|
|
359
|
+
throw new TypeError(`Fray element name must be a non-reserved name containing a hyphen: ${e}`);
|
|
360
|
+
}
|
|
361
|
+
const P = Symbol.for("@sylwellsoftware/fray.Fragment"), Q = /* @__PURE__ */ new WeakSet(), ge = /* @__PURE__ */ new Set([
|
|
362
|
+
"allowFullScreen",
|
|
363
|
+
"async",
|
|
364
|
+
"autoFocus",
|
|
365
|
+
"autoPlay",
|
|
366
|
+
"checked",
|
|
367
|
+
"controls",
|
|
368
|
+
"default",
|
|
369
|
+
"defer",
|
|
370
|
+
"disabled",
|
|
371
|
+
"formNoValidate",
|
|
372
|
+
"hidden",
|
|
373
|
+
"inert",
|
|
374
|
+
"loop",
|
|
375
|
+
"multiple",
|
|
376
|
+
"muted",
|
|
377
|
+
"noModule",
|
|
378
|
+
"noValidate",
|
|
379
|
+
"open",
|
|
380
|
+
"playsInline",
|
|
381
|
+
"readOnly",
|
|
382
|
+
"required",
|
|
383
|
+
"reversed",
|
|
384
|
+
"selected"
|
|
385
|
+
]), we = /* @__PURE__ */ new Set([
|
|
386
|
+
"checked",
|
|
387
|
+
"defaultChecked",
|
|
388
|
+
"defaultValue",
|
|
389
|
+
"disabled",
|
|
390
|
+
"indeterminate",
|
|
391
|
+
"multiple",
|
|
392
|
+
"muted",
|
|
393
|
+
"readOnly",
|
|
394
|
+
"required",
|
|
395
|
+
"selected",
|
|
396
|
+
"selectedIndex",
|
|
397
|
+
"tabIndex",
|
|
398
|
+
"value"
|
|
399
|
+
]);
|
|
400
|
+
function Me(e) {
|
|
401
|
+
H(e, "live");
|
|
402
|
+
const t = Object.freeze({ emitter: e });
|
|
403
|
+
return Q.add(t), t;
|
|
404
|
+
}
|
|
405
|
+
function A(e, t = null, ...n) {
|
|
406
|
+
const r = t ?? {};
|
|
407
|
+
if (typeof r != "object" || Array.isArray(r))
|
|
408
|
+
throw new TypeError("VNode props must be an object or null");
|
|
409
|
+
const {
|
|
410
|
+
children: i,
|
|
411
|
+
key: s = null,
|
|
412
|
+
...o
|
|
413
|
+
} = r;
|
|
414
|
+
return {
|
|
415
|
+
type: e,
|
|
416
|
+
key: s,
|
|
417
|
+
props: {
|
|
418
|
+
...o,
|
|
419
|
+
children: X([i, n])
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
function Ve(e, ...t) {
|
|
424
|
+
return e.reduce((n, r, i) => n + r + String(t[i] ?? ""), "");
|
|
425
|
+
}
|
|
426
|
+
const b = class b {
|
|
427
|
+
constructor(t = {}) {
|
|
428
|
+
u(this, "props");
|
|
429
|
+
u(this, "dom", null);
|
|
430
|
+
/** @internal */
|
|
431
|
+
u(this, "_rendered", null);
|
|
432
|
+
/** @internal */
|
|
433
|
+
u(this, "_childComponents", /* @__PURE__ */ new Set());
|
|
434
|
+
u(this, "initialized", !1);
|
|
435
|
+
u(this, "mounted", !1);
|
|
436
|
+
u(this, "destroyed", !1);
|
|
437
|
+
u(this, "updating", !1);
|
|
438
|
+
u(this, "updateRequested", !1);
|
|
439
|
+
u(this, "cleanupFunctions", /* @__PURE__ */ new Set());
|
|
440
|
+
u(this, "watched", /* @__PURE__ */ new Map());
|
|
441
|
+
u(this, "renderReadSubscriptions", /* @__PURE__ */ new Map());
|
|
442
|
+
u(this, "collectingRenderReads", null);
|
|
443
|
+
/** @internal */
|
|
444
|
+
u(this, "_runtime", Z);
|
|
445
|
+
/** JSX component for this instance's runtime-configured custom host. */
|
|
446
|
+
u(this, "Host", ({
|
|
447
|
+
children: t = [],
|
|
448
|
+
...n
|
|
449
|
+
}) => this.host(n, t));
|
|
450
|
+
if (t == null || typeof t != "object" || Array.isArray(t))
|
|
451
|
+
throw new TypeError(`${this.constructor.name} props must be an object`);
|
|
452
|
+
this.props = t;
|
|
453
|
+
}
|
|
454
|
+
static new(...t) {
|
|
455
|
+
const n = new this(...t);
|
|
456
|
+
if (!(n instanceof b))
|
|
457
|
+
throw new TypeError("Component.new() requires a Component constructor");
|
|
458
|
+
return n.mount();
|
|
459
|
+
}
|
|
460
|
+
static get baseStyles() {
|
|
461
|
+
return {};
|
|
462
|
+
}
|
|
463
|
+
static registerStyles(t = Z, n = /* @__PURE__ */ new Set()) {
|
|
464
|
+
if (n.has(this)) return;
|
|
465
|
+
n.add(this);
|
|
466
|
+
const r = this.hostName ?? null, i = this.standaloneHostName ?? null;
|
|
467
|
+
this.css && t.styleRegistry.registerCSS(r == null ? this.css : t.resolveHostCSS(this.css, r, i));
|
|
468
|
+
const s = Be(this.baseStyles);
|
|
469
|
+
for (const [o, a] of s)
|
|
470
|
+
t.styleRegistry.registerBaseStyle(r == null ? o : t.resolveHostSelector(o, r, i), a);
|
|
471
|
+
for (const o of this.dependencies ?? [])
|
|
472
|
+
o.registerStyles(t, n);
|
|
473
|
+
}
|
|
474
|
+
/** One-time setup hook. Constructors must not subscribe or render. */
|
|
475
|
+
initialize() {
|
|
476
|
+
}
|
|
477
|
+
render() {
|
|
478
|
+
throw new Error(`${this.constructor.name} must implement render()`);
|
|
479
|
+
}
|
|
480
|
+
/** Render this component's configured custom host element. */
|
|
481
|
+
host(t = null, ...n) {
|
|
482
|
+
const r = this.constructor, i = r.hostName;
|
|
483
|
+
if (i == null)
|
|
484
|
+
throw new Error(`${this.constructor.name} does not declare a custom host name`);
|
|
485
|
+
return A(this._runtime.resolveElementName(
|
|
486
|
+
i,
|
|
487
|
+
r.standaloneHostName
|
|
488
|
+
), {
|
|
489
|
+
...t,
|
|
490
|
+
"data-fray-component": i
|
|
491
|
+
}, ...n);
|
|
492
|
+
}
|
|
493
|
+
/** @internal Assign an immutable application runtime before initialization or mounting. */
|
|
494
|
+
_setRuntime(t) {
|
|
495
|
+
if (!(t instanceof L))
|
|
496
|
+
throw new TypeError("Component runtime must be a FrayRuntime");
|
|
497
|
+
if (t === this._runtime) return this;
|
|
498
|
+
if (this.initialized || this.mounted || this._rendered != null)
|
|
499
|
+
throw new Error("Cannot change a component runtime after initialization");
|
|
500
|
+
return this._runtime = t, this;
|
|
501
|
+
}
|
|
502
|
+
mount(t = null, n = null) {
|
|
503
|
+
if (this.destroyed) throw new Error("Cannot mount a destroyed component");
|
|
504
|
+
let r = !1;
|
|
505
|
+
return this.initialized || (this.initialized = !0, this.initialize()), this.mounted || (this.mounted = !0, this.update(), r = !0), t != null && (ze(t), q(t, this._rendered, n)), r && this.afterMount(this.dom), this;
|
|
506
|
+
}
|
|
507
|
+
attachTo(t) {
|
|
508
|
+
return this.mount(t), this;
|
|
509
|
+
}
|
|
510
|
+
update(t) {
|
|
511
|
+
if (this.destroyed) return this;
|
|
512
|
+
if (!this.mounted) return this.mount();
|
|
513
|
+
if (this.updating)
|
|
514
|
+
return this.updateRequested = !0, this;
|
|
515
|
+
this.updating = !0;
|
|
516
|
+
try {
|
|
517
|
+
do {
|
|
518
|
+
this.updateRequested = !1;
|
|
519
|
+
const n = /* @__PURE__ */ new Set();
|
|
520
|
+
this.collectingRenderReads = n;
|
|
521
|
+
let r;
|
|
522
|
+
try {
|
|
523
|
+
r = R(this.render());
|
|
524
|
+
} finally {
|
|
525
|
+
this.collectingRenderReads = null;
|
|
526
|
+
}
|
|
527
|
+
this._rendered = _(this._rendered, r, this), this.dom = re(this._rendered), this.reconcileRenderReads(n), this.afterUpdate(this.dom);
|
|
528
|
+
} while (this.updateRequested && !this.destroyed);
|
|
529
|
+
} finally {
|
|
530
|
+
this.updating = !1;
|
|
531
|
+
}
|
|
532
|
+
return this;
|
|
533
|
+
}
|
|
534
|
+
setProps(t) {
|
|
535
|
+
if (t == null || typeof t != "object" || Array.isArray(t))
|
|
536
|
+
throw new TypeError(`${this.constructor.name} props must be an object`);
|
|
537
|
+
return this.props = t, this.mounted && this.update(), this;
|
|
538
|
+
}
|
|
539
|
+
afterMount(t) {
|
|
540
|
+
}
|
|
541
|
+
afterUpdate(t) {
|
|
542
|
+
}
|
|
543
|
+
watch(...t) {
|
|
544
|
+
for (const n of t) {
|
|
545
|
+
if (n == null || typeof n.subscribe != "function")
|
|
546
|
+
throw new TypeError("watch requires emitter-like values");
|
|
547
|
+
if (this.watched.has(n)) continue;
|
|
548
|
+
const r = n.subscribe(({ event: i }) => {
|
|
549
|
+
this.mounted && !this.destroyed && this.update(i);
|
|
550
|
+
}, { emitCurrent: !1 });
|
|
551
|
+
this.watched.set(n, r), this.onCleanup(() => {
|
|
552
|
+
r(), this.watched.delete(n);
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
return this;
|
|
556
|
+
}
|
|
557
|
+
watchFutureValues(...t) {
|
|
558
|
+
return this.watch(...t);
|
|
559
|
+
}
|
|
560
|
+
/** Read an emitter during render and rerender when that dependency changes. */
|
|
561
|
+
read(t) {
|
|
562
|
+
return this.trackRenderRead(t), t.get();
|
|
563
|
+
}
|
|
564
|
+
/** Read a Glue value, fetch state, and error as one tracked render dependency. */
|
|
565
|
+
snapshot(t) {
|
|
566
|
+
return this.trackRenderRead(t), Object.freeze({
|
|
567
|
+
value: t.get(),
|
|
568
|
+
fetchState: t.getFetchState(),
|
|
569
|
+
error: t.getError()
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
onCleanup(t) {
|
|
573
|
+
if (typeof t != "function") throw new TypeError("cleanup must be a function");
|
|
574
|
+
if (this.destroyed)
|
|
575
|
+
return t(), () => {
|
|
576
|
+
};
|
|
577
|
+
this.cleanupFunctions.add(t);
|
|
578
|
+
let n = !0;
|
|
579
|
+
return () => {
|
|
580
|
+
n && (n = !1, this.cleanupFunctions.delete(t), t());
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
listen(t, n, r, i) {
|
|
584
|
+
if (t == null || typeof t.addEventListener != "function")
|
|
585
|
+
throw new TypeError("listen target must be an EventTarget");
|
|
586
|
+
const s = r;
|
|
587
|
+
return t.addEventListener(n, s, i), this.onCleanup(() => t.removeEventListener(n, s, i)), this;
|
|
588
|
+
}
|
|
589
|
+
registerChild(t) {
|
|
590
|
+
if (!(t instanceof b))
|
|
591
|
+
throw new TypeError("registerChild requires a Component");
|
|
592
|
+
return this._childComponents.add(t), t;
|
|
593
|
+
}
|
|
594
|
+
destroy() {
|
|
595
|
+
if (!this.destroyed) {
|
|
596
|
+
this.destroyed = !0, this.mounted = !1;
|
|
597
|
+
for (const t of [...this.cleanupFunctions]) t();
|
|
598
|
+
this.cleanupFunctions.clear(), this.watched.clear();
|
|
599
|
+
for (const t of this.renderReadSubscriptions.values()) t();
|
|
600
|
+
this.renderReadSubscriptions.clear(), this.collectingRenderReads = null, this._rendered && g(this._rendered, !0), this._rendered = null, this.dom = null, this._childComponents.clear(), this.onDestroy();
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
onDestroy() {
|
|
604
|
+
}
|
|
605
|
+
trackRenderRead(t) {
|
|
606
|
+
if (H(t, "Component.read"), this.collectingRenderReads == null)
|
|
607
|
+
throw new Error("Component.read() and snapshot() may only be called during render()");
|
|
608
|
+
this.collectingRenderReads.add(t);
|
|
609
|
+
}
|
|
610
|
+
reconcileRenderReads(t) {
|
|
611
|
+
for (const [n, r] of this.renderReadSubscriptions)
|
|
612
|
+
t.has(n) || (r(), this.renderReadSubscriptions.delete(n));
|
|
613
|
+
for (const n of t) {
|
|
614
|
+
if (this.watched.has(n) || this.renderReadSubscriptions.has(n)) continue;
|
|
615
|
+
const r = n.subscribe(({ event: i }) => {
|
|
616
|
+
this.mounted && !this.destroyed && this.update(i);
|
|
617
|
+
}, { emitCurrent: !1 });
|
|
618
|
+
this.renderReadSubscriptions.set(n, r);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
u(b, "dependencies", []), u(b, "css", ""), u(b, "hostName", null), u(b, "standaloneHostName", null);
|
|
623
|
+
let h = b;
|
|
624
|
+
function R(e) {
|
|
625
|
+
return Array.isArray(e) ? A(P, null, e) : e == null || typeof e == "boolean" ? A(P) : e;
|
|
626
|
+
}
|
|
627
|
+
function X(e) {
|
|
628
|
+
const t = [], n = (r) => {
|
|
629
|
+
if (Array.isArray(r))
|
|
630
|
+
for (const i of r) n(i);
|
|
631
|
+
else r != null && typeof r != "boolean" && t.push(r);
|
|
632
|
+
};
|
|
633
|
+
return n(e), t;
|
|
634
|
+
}
|
|
635
|
+
function j(e, t) {
|
|
636
|
+
if (typeof e == "string" || typeof e == "number")
|
|
637
|
+
return {
|
|
638
|
+
kind: "text",
|
|
639
|
+
key: null,
|
|
640
|
+
value: e,
|
|
641
|
+
node: document.createTextNode(String(e)),
|
|
642
|
+
owner: t
|
|
643
|
+
};
|
|
644
|
+
if (x(e)) {
|
|
645
|
+
const s = document.createComment("fray-emitter-start"), o = document.createComment("fray-emitter-end"), a = e.get();
|
|
646
|
+
if (Object.is(a, e))
|
|
647
|
+
throw new TypeError("A Fray emitter child cannot render itself");
|
|
648
|
+
const l = document.createDocumentFragment();
|
|
649
|
+
l.append(s, o);
|
|
650
|
+
const c = j(R(a), t);
|
|
651
|
+
q(l, c, o);
|
|
652
|
+
const d = {
|
|
653
|
+
kind: "emitter",
|
|
654
|
+
key: null,
|
|
655
|
+
source: e,
|
|
656
|
+
start: s,
|
|
657
|
+
end: o,
|
|
658
|
+
child: c,
|
|
659
|
+
unsubscribe: () => {
|
|
660
|
+
},
|
|
661
|
+
owner: t
|
|
662
|
+
};
|
|
663
|
+
return d.unsubscribe = e.subscribe(({ value: y }) => {
|
|
664
|
+
if (Object.is(y, e))
|
|
665
|
+
throw new TypeError("A Fray emitter child cannot render itself");
|
|
666
|
+
d.child = _(d.child, R(y), t);
|
|
667
|
+
}, { emitCurrent: !1 }), d;
|
|
668
|
+
}
|
|
669
|
+
if (e instanceof h)
|
|
670
|
+
return e._setRuntime(t._runtime), e.mount(), t.registerChild(e), {
|
|
671
|
+
kind: "component",
|
|
672
|
+
key: ie(e.props),
|
|
673
|
+
type: e.constructor,
|
|
674
|
+
instance: e,
|
|
675
|
+
prebuilt: !0,
|
|
676
|
+
props: e.props,
|
|
677
|
+
liveProps: /* @__PURE__ */ new Map(),
|
|
678
|
+
owner: t
|
|
679
|
+
};
|
|
680
|
+
if (!m(e))
|
|
681
|
+
throw new TypeError(`Invalid Fray child: ${G(e)}`);
|
|
682
|
+
const { type: n, key: r = null, props: i } = e;
|
|
683
|
+
if (n === P) {
|
|
684
|
+
const s = document.createComment("fray-fragment-start"), o = document.createComment("fray-fragment-end"), a = {
|
|
685
|
+
kind: "fragment",
|
|
686
|
+
key: r,
|
|
687
|
+
type: n,
|
|
688
|
+
start: s,
|
|
689
|
+
end: o,
|
|
690
|
+
children: [],
|
|
691
|
+
owner: t
|
|
692
|
+
}, l = document.createDocumentFragment();
|
|
693
|
+
return l.append(s, o), a.children = O(
|
|
694
|
+
l,
|
|
695
|
+
[],
|
|
696
|
+
i.children,
|
|
697
|
+
t,
|
|
698
|
+
o,
|
|
699
|
+
s
|
|
700
|
+
), a;
|
|
701
|
+
}
|
|
702
|
+
if (typeof n == "string") {
|
|
703
|
+
const s = document.createElement(n), o = {
|
|
704
|
+
kind: "element",
|
|
705
|
+
key: r,
|
|
706
|
+
type: n,
|
|
707
|
+
node: s,
|
|
708
|
+
props: {},
|
|
709
|
+
listeners: /* @__PURE__ */ new Map(),
|
|
710
|
+
liveProps: /* @__PURE__ */ new Map(),
|
|
711
|
+
nativeBindings: /* @__PURE__ */ new Map(),
|
|
712
|
+
ref: null,
|
|
713
|
+
children: [],
|
|
714
|
+
owner: t
|
|
715
|
+
};
|
|
716
|
+
return ne(o, i), o.children = O(s, [], i.children, t), o;
|
|
717
|
+
}
|
|
718
|
+
if (oe(n)) {
|
|
719
|
+
const s = i, o = W(s), a = new n(o);
|
|
720
|
+
a._setRuntime(t._runtime);
|
|
721
|
+
const l = {
|
|
722
|
+
kind: "component",
|
|
723
|
+
key: r,
|
|
724
|
+
type: n,
|
|
725
|
+
instance: a,
|
|
726
|
+
prebuilt: !1,
|
|
727
|
+
props: o,
|
|
728
|
+
liveProps: /* @__PURE__ */ new Map(),
|
|
729
|
+
owner: t
|
|
730
|
+
};
|
|
731
|
+
return te(l, s), a.mount(), t.registerChild(a), l;
|
|
732
|
+
}
|
|
733
|
+
if (typeof n == "function") {
|
|
734
|
+
const s = n, o = i, a = W(o), l = R(s(a)), c = {
|
|
735
|
+
kind: "function",
|
|
736
|
+
key: r,
|
|
737
|
+
type: s,
|
|
738
|
+
props: a,
|
|
739
|
+
sourceProps: o,
|
|
740
|
+
liveProps: /* @__PURE__ */ new Map(),
|
|
741
|
+
child: j(l, t),
|
|
742
|
+
owner: t
|
|
743
|
+
};
|
|
744
|
+
return Se(c), c;
|
|
745
|
+
}
|
|
746
|
+
throw new TypeError(`Unsupported vnode type: ${G(n)}`);
|
|
747
|
+
}
|
|
748
|
+
function _(e, t, n) {
|
|
749
|
+
if (e == null) return j(t, n);
|
|
750
|
+
if (se(e, t)) return ee(e, t, n);
|
|
751
|
+
const r = j(t, n), i = re(e), s = (i == null ? void 0 : i.parentNode) ?? null;
|
|
752
|
+
return s && q(s, r, i), g(e, !0), r;
|
|
753
|
+
}
|
|
754
|
+
function ee(e, t, n) {
|
|
755
|
+
return e.kind === "text" ? (typeof t != "string" && typeof t != "number" || Object.is(e.value, t) || (e.value = t, e.node.data = String(t)), e) : e.kind === "emitter" ? (!x(t) || e.source !== t, e) : e.kind === "component" ? (t instanceof h || m(t) && ve(e, t.props), e) : m(t) ? e.kind === "function" ? (Ee(e, t.props), e) : e.kind === "fragment" ? (e.children = O(
|
|
756
|
+
e.start.parentNode,
|
|
757
|
+
e.children,
|
|
758
|
+
t.props.children,
|
|
759
|
+
n,
|
|
760
|
+
e.end,
|
|
761
|
+
e.start
|
|
762
|
+
), e) : (ne(e, t.props), e.children = O(
|
|
763
|
+
e.node,
|
|
764
|
+
e.children,
|
|
765
|
+
t.props.children,
|
|
766
|
+
n
|
|
767
|
+
), e) : e;
|
|
768
|
+
}
|
|
769
|
+
function W(e) {
|
|
770
|
+
return Object.fromEntries(Object.entries(e).map(([t, n]) => [
|
|
771
|
+
t,
|
|
772
|
+
C(n) ? n.emitter.get() : n
|
|
773
|
+
]));
|
|
774
|
+
}
|
|
775
|
+
function te(e, t) {
|
|
776
|
+
M(e.liveProps, t, (n, r) => {
|
|
777
|
+
e.props = { ...e.props, [n]: r }, e.instance.setProps(e.props);
|
|
778
|
+
}), e.props = V(e.liveProps, t), e.instance.setProps(e.props);
|
|
779
|
+
}
|
|
780
|
+
function ve(e, t) {
|
|
781
|
+
te(e, t);
|
|
782
|
+
}
|
|
783
|
+
function Se(e) {
|
|
784
|
+
M(e.liveProps, e.sourceProps, (t, n) => {
|
|
785
|
+
e.props = { ...e.props, [t]: n }, z(e);
|
|
786
|
+
}), e.props = V(e.liveProps, e.sourceProps);
|
|
787
|
+
}
|
|
788
|
+
function Ee(e, t) {
|
|
789
|
+
e.sourceProps = t, M(e.liveProps, t, (n, r) => {
|
|
790
|
+
e.props = { ...e.props, [n]: r }, z(e);
|
|
791
|
+
}), e.props = V(e.liveProps, t), z(e);
|
|
792
|
+
}
|
|
793
|
+
function z(e) {
|
|
794
|
+
const t = R(e.type(e.props));
|
|
795
|
+
e.child = _(e.child, t, e.owner);
|
|
796
|
+
}
|
|
797
|
+
function M(e, t, n) {
|
|
798
|
+
for (const [r, i] of e) {
|
|
799
|
+
const s = t[r];
|
|
800
|
+
C(s) && s.emitter === i.source || (i.unsubscribe(), e.delete(r));
|
|
801
|
+
}
|
|
802
|
+
for (const [r, i] of Object.entries(t)) {
|
|
803
|
+
if (!C(i) || e.has(r)) continue;
|
|
804
|
+
const s = {
|
|
805
|
+
source: i.emitter,
|
|
806
|
+
value: i.emitter.get(),
|
|
807
|
+
unsubscribe: () => {
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
s.unsubscribe = i.emitter.subscribe(({ value: o }) => {
|
|
811
|
+
e.get(r) === s && (s.value = o, n(r, o));
|
|
812
|
+
}, { emitCurrent: !1 }), e.set(r, s);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
function V(e, t) {
|
|
816
|
+
return Object.fromEntries(Object.entries(t).map(([n, r]) => {
|
|
817
|
+
var i;
|
|
818
|
+
return [
|
|
819
|
+
n,
|
|
820
|
+
C(r) ? ((i = e.get(n)) == null ? void 0 : i.value) ?? r.emitter.get() : r
|
|
821
|
+
];
|
|
822
|
+
}));
|
|
823
|
+
}
|
|
824
|
+
function O(e, t, n, r, i = null, s = null) {
|
|
825
|
+
if (e == null) throw new Error("Cannot patch a detached fragment range");
|
|
826
|
+
const o = X(n), a = /* @__PURE__ */ new Map(), l = [];
|
|
827
|
+
for (const f of t)
|
|
828
|
+
f.key == null ? l.push(f) : a.has(f.key) || a.set(f.key, f);
|
|
829
|
+
const c = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), y = [];
|
|
830
|
+
let le = 0;
|
|
831
|
+
for (const f of o) {
|
|
832
|
+
const p = E(f);
|
|
833
|
+
if (p != null) {
|
|
834
|
+
if (c.has(p)) throw new Error(`Duplicate sibling key: ${String(p)}`);
|
|
835
|
+
c.add(p);
|
|
836
|
+
}
|
|
837
|
+
const T = p == null ? l[le++] : a.get(p);
|
|
838
|
+
T && se(T, f) ? (d.add(T), y.push(ee(T, f, r))) : y.push(j(f, r));
|
|
839
|
+
}
|
|
840
|
+
for (const f of t)
|
|
841
|
+
d.has(f) || g(f, !0);
|
|
842
|
+
let S = s ? s.nextSibling : e.firstChild;
|
|
843
|
+
for (const f of y)
|
|
844
|
+
for (const p of w(f))
|
|
845
|
+
p === S ? S = S.nextSibling : (e.insertBefore(p, S ?? i), S = p.nextSibling);
|
|
846
|
+
return y;
|
|
847
|
+
}
|
|
848
|
+
function ne(e, t) {
|
|
849
|
+
const { children: n, ...r } = t, i = e.props, s = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(r)]);
|
|
850
|
+
for (const o of ["value", "checked"])
|
|
851
|
+
if (Object.hasOwn(r, o) && Object.hasOwn(r, `bind:${o}`))
|
|
852
|
+
throw new Error(`${o} and bind:${o} cannot be used together`);
|
|
853
|
+
for (const o of s) {
|
|
854
|
+
const a = i[o], l = r[o];
|
|
855
|
+
if (Ne(o))
|
|
856
|
+
je(e, o, l);
|
|
857
|
+
else if (o === "ref")
|
|
858
|
+
a !== l && Te(e, l);
|
|
859
|
+
else if (Oe(o))
|
|
860
|
+
Ce(e, o, l);
|
|
861
|
+
else if (C(l))
|
|
862
|
+
Re(e, o, l);
|
|
863
|
+
else {
|
|
864
|
+
const c = e.liveProps.get(o);
|
|
865
|
+
c && (c.unsubscribe(), e.liveProps.delete(o));
|
|
866
|
+
const d = (c == null ? void 0 : c.value) ?? a;
|
|
867
|
+
Object.is(d, l) || v(e.node, o, d, l);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
e.props = { ...r };
|
|
871
|
+
}
|
|
872
|
+
function Re(e, t, n) {
|
|
873
|
+
const r = e.liveProps.get(t);
|
|
874
|
+
if ((r == null ? void 0 : r.source) === n.emitter) return;
|
|
875
|
+
r == null || r.unsubscribe();
|
|
876
|
+
const i = n.emitter.get();
|
|
877
|
+
v(e.node, t, (r == null ? void 0 : r.value) ?? e.props[t], i);
|
|
878
|
+
const s = {
|
|
879
|
+
source: n.emitter,
|
|
880
|
+
value: i,
|
|
881
|
+
unsubscribe: () => {
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
s.unsubscribe = n.emitter.subscribe(({ value: o }) => {
|
|
885
|
+
const a = s.value;
|
|
886
|
+
s.value = o, Object.is(a, o) || v(e.node, t, a, o);
|
|
887
|
+
}, { emitCurrent: !1 }), e.liveProps.set(t, s);
|
|
888
|
+
}
|
|
889
|
+
function je(e, t, n) {
|
|
890
|
+
const r = t.slice(5), i = e.nativeBindings.get(t);
|
|
891
|
+
if (n == null) {
|
|
892
|
+
i && (i.unsubscribe(), e.node.removeEventListener(i.eventName, i.listener), e.nativeBindings.delete(t), v(e.node, r, i.value, void 0));
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
if (xe(n, t), (i == null ? void 0 : i.source) === n) return;
|
|
896
|
+
i && (i.unsubscribe(), e.node.removeEventListener(i.eventName, i.listener)), Fe(e.node, r);
|
|
897
|
+
const s = $e(e.node, r), o = n.get();
|
|
898
|
+
v(e.node, r, i == null ? void 0 : i.value, o);
|
|
899
|
+
const a = () => {
|
|
900
|
+
n.set(Reflect.get(e.node, r), `${t} changed`);
|
|
901
|
+
}, l = {
|
|
902
|
+
source: n,
|
|
903
|
+
value: o,
|
|
904
|
+
eventName: s,
|
|
905
|
+
listener: a,
|
|
906
|
+
unsubscribe: () => {
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
l.unsubscribe = n.subscribe(({ value: c }) => {
|
|
910
|
+
const d = l.value;
|
|
911
|
+
l.value = c, Object.is(d, c) || v(e.node, r, d, c);
|
|
912
|
+
}, { emitCurrent: !1 }), e.node.addEventListener(s, a), e.nativeBindings.set(t, l);
|
|
913
|
+
}
|
|
914
|
+
function Ce(e, t, n) {
|
|
915
|
+
const r = t.slice(2).toLowerCase(), i = e.listeners.get(t);
|
|
916
|
+
if (i && i !== n && (e.node.removeEventListener(r, i), e.listeners.delete(t)), n != null && typeof n != "function")
|
|
917
|
+
throw new TypeError(`${t} must be a function or null`);
|
|
918
|
+
if (typeof n == "function" && i !== n) {
|
|
919
|
+
const s = n;
|
|
920
|
+
e.node.addEventListener(r, s), e.listeners.set(t, s);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
function Te(e, t) {
|
|
924
|
+
if (B(e.ref, null), t != null && typeof t != "function" && typeof t != "object")
|
|
925
|
+
throw new TypeError("ref must be a function, object, or null");
|
|
926
|
+
e.ref = t, B(e.ref, e.node);
|
|
927
|
+
}
|
|
928
|
+
function v(e, t, n, r) {
|
|
929
|
+
if (t === "class" || t === "className") {
|
|
930
|
+
F(e, "class", r);
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
if (t === "for" || t === "htmlFor") {
|
|
934
|
+
F(e, "for", r);
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
if (t === "dataset") {
|
|
938
|
+
ke(e, n, r);
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
if (t === "style") {
|
|
942
|
+
Pe(e, n, r);
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
if (t === "dangerouslySetInnerHTML")
|
|
946
|
+
throw new Error("dangerouslySetInnerHTML is not supported");
|
|
947
|
+
const i = Ae(t);
|
|
948
|
+
if (ge.has(i)) {
|
|
949
|
+
const s = !!r;
|
|
950
|
+
i in e && Reflect.set(e, i, s), e.toggleAttribute($(t), s);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
if (we.has(i) && i in e) {
|
|
954
|
+
const s = r ?? (i === "value" ? "" : !1);
|
|
955
|
+
Object.is(Reflect.get(e, i), s) || Reflect.set(e, i, s), r == null && e.removeAttribute($(t));
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
F(e, $(t), r);
|
|
959
|
+
}
|
|
960
|
+
function ke(e, t, n) {
|
|
961
|
+
const r = N(t, "dataset"), i = N(n, "dataset");
|
|
962
|
+
for (const s of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])) {
|
|
963
|
+
const o = i[s];
|
|
964
|
+
o == null ? delete e.dataset[s] : e.dataset[s] = String(o);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
function Pe(e, t, n) {
|
|
968
|
+
if (typeof n == "string") {
|
|
969
|
+
e.style.cssText = n;
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
const r = typeof t == "string" ? {} : N(t, "style"), i = N(n, "style");
|
|
973
|
+
typeof t == "string" && (e.style.cssText = "");
|
|
974
|
+
for (const s of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])) {
|
|
975
|
+
const o = i[s];
|
|
976
|
+
s.startsWith("--") ? o == null ? e.style.removeProperty(s) : e.style.setProperty(s, String(o)) : Reflect.set(e.style, s, o == null ? "" : String(o));
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
function N(e, t) {
|
|
980
|
+
if (e == null) return {};
|
|
981
|
+
if (typeof e != "object" || Array.isArray(e))
|
|
982
|
+
throw new TypeError(`${t} must be an object or null`);
|
|
983
|
+
return e;
|
|
984
|
+
}
|
|
985
|
+
function F(e, t, n) {
|
|
986
|
+
n == null || n === !1 ? e.removeAttribute(t) : n === !0 ? e.setAttribute(t, "") : e.setAttribute(t, String(n));
|
|
987
|
+
}
|
|
988
|
+
function Ae(e) {
|
|
989
|
+
return e === "readonly" ? "readOnly" : e === "autofocus" ? "autoFocus" : e;
|
|
990
|
+
}
|
|
991
|
+
function $(e) {
|
|
992
|
+
return e === "className" ? "class" : e === "htmlFor" ? "for" : /^aria[A-Z]/.test(e) || /^data[A-Z]/.test(e) ? Y(e) : e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
993
|
+
}
|
|
994
|
+
function Y(e) {
|
|
995
|
+
return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
996
|
+
}
|
|
997
|
+
function B(e, t) {
|
|
998
|
+
e != null && (typeof e == "function" ? e(t) : e.current = t);
|
|
999
|
+
}
|
|
1000
|
+
function g(e, t) {
|
|
1001
|
+
if (e.kind === "emitter") {
|
|
1002
|
+
if (e.unsubscribe(), g(e.child, !1), t)
|
|
1003
|
+
for (const n of w(e)) n.remove();
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
if (e.kind === "component") {
|
|
1007
|
+
for (const n of e.liveProps.values()) n.unsubscribe();
|
|
1008
|
+
e.liveProps.clear(), e.owner._childComponents.delete(e.instance), e.instance.destroy();
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
if (e.kind === "function") {
|
|
1012
|
+
for (const n of e.liveProps.values()) n.unsubscribe();
|
|
1013
|
+
e.liveProps.clear(), g(e.child, t);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
if (e.kind === "element") {
|
|
1017
|
+
B(e.ref, null);
|
|
1018
|
+
for (const [n, r] of e.listeners)
|
|
1019
|
+
e.node.removeEventListener(n.slice(2).toLowerCase(), r);
|
|
1020
|
+
e.listeners.clear();
|
|
1021
|
+
for (const n of e.liveProps.values()) n.unsubscribe();
|
|
1022
|
+
e.liveProps.clear();
|
|
1023
|
+
for (const n of e.nativeBindings.values())
|
|
1024
|
+
n.unsubscribe(), e.node.removeEventListener(n.eventName, n.listener);
|
|
1025
|
+
e.nativeBindings.clear();
|
|
1026
|
+
for (const n of e.children) g(n, !1);
|
|
1027
|
+
t && e.node.remove();
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
if (e.kind === "fragment") {
|
|
1031
|
+
for (const n of e.children) g(n, !1);
|
|
1032
|
+
if (t)
|
|
1033
|
+
for (const n of w(e)) n.remove();
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
t && e.node.remove();
|
|
1037
|
+
}
|
|
1038
|
+
function q(e, t, n = null) {
|
|
1039
|
+
if (t != null)
|
|
1040
|
+
for (const r of w(t)) e.insertBefore(r, n);
|
|
1041
|
+
}
|
|
1042
|
+
function w(e) {
|
|
1043
|
+
if (e == null) return [];
|
|
1044
|
+
if (e.kind === "text" || e.kind === "element") return [e.node];
|
|
1045
|
+
if (e.kind === "component") return w(e.instance._rendered);
|
|
1046
|
+
if (e.kind === "function") return w(e.child);
|
|
1047
|
+
const t = [];
|
|
1048
|
+
let n = e.start;
|
|
1049
|
+
for (; n && (t.push(n), n !== e.end); )
|
|
1050
|
+
n = n.nextSibling;
|
|
1051
|
+
return t;
|
|
1052
|
+
}
|
|
1053
|
+
function re(e) {
|
|
1054
|
+
return w(e)[0] ?? null;
|
|
1055
|
+
}
|
|
1056
|
+
function E(e) {
|
|
1057
|
+
return e instanceof h ? ie(e.props) : m(e) ? e.key : null;
|
|
1058
|
+
}
|
|
1059
|
+
function ie(e) {
|
|
1060
|
+
const t = e.key;
|
|
1061
|
+
return typeof t == "string" || typeof t == "number" ? t : null;
|
|
1062
|
+
}
|
|
1063
|
+
function se(e, t) {
|
|
1064
|
+
return e.kind === "text" ? typeof t == "string" || typeof t == "number" : e.kind === "emitter" ? x(t) && e.source === t : e.kind === "component" ? t instanceof h ? e.instance === t : m(t) && oe(t.type) && e.type === t.type && e.key === E(t) : e.kind === "function" ? m(t) && e.type === t.type && e.key === E(t) : e.kind === "fragment" ? m(t) && t.type === P && e.key === E(t) : m(t) && typeof t.type == "string" && e.type === t.type && e.key === E(t);
|
|
1065
|
+
}
|
|
1066
|
+
function m(e) {
|
|
1067
|
+
return e != null && typeof e == "object" && Object.hasOwn(e, "type");
|
|
1068
|
+
}
|
|
1069
|
+
function oe(e) {
|
|
1070
|
+
return typeof e == "function" && (e === h || e.prototype instanceof h);
|
|
1071
|
+
}
|
|
1072
|
+
function Oe(e) {
|
|
1073
|
+
return /^on[A-Z]/.test(e);
|
|
1074
|
+
}
|
|
1075
|
+
function Ne(e) {
|
|
1076
|
+
return e === "bind:value" || e === "bind:checked";
|
|
1077
|
+
}
|
|
1078
|
+
function C(e) {
|
|
1079
|
+
return e != null && typeof e == "object" && Q.has(e);
|
|
1080
|
+
}
|
|
1081
|
+
function x(e) {
|
|
1082
|
+
return (typeof e != "object" || e == null) && typeof e != "function" ? !1 : typeof Reflect.get(e, "get") == "function" && typeof Reflect.get(e, "getFetchState") == "function" && typeof Reflect.get(e, "getError") == "function" && typeof Reflect.get(e, "subscribe") == "function";
|
|
1083
|
+
}
|
|
1084
|
+
function H(e, t) {
|
|
1085
|
+
if (!x(e)) throw new TypeError(`${t} requires a readable emitter`);
|
|
1086
|
+
}
|
|
1087
|
+
function xe(e, t) {
|
|
1088
|
+
if (H(e, t), typeof Reflect.get(e, "set") != "function")
|
|
1089
|
+
throw new TypeError(`${t} requires a writable emitter`);
|
|
1090
|
+
}
|
|
1091
|
+
function Fe(e, t) {
|
|
1092
|
+
const n = e.localName;
|
|
1093
|
+
if (!(t === "checked" ? n === "input" : n === "input" || n === "textarea" || n === "select")) throw new TypeError(`bind:${t} is not supported on ${n}`);
|
|
1094
|
+
}
|
|
1095
|
+
function $e(e, t) {
|
|
1096
|
+
return t === "value" && e.localName !== "select" ? "input" : "change";
|
|
1097
|
+
}
|
|
1098
|
+
function ze(e) {
|
|
1099
|
+
if (e == null || typeof e != "object" && typeof e != "function" || typeof Reflect.get(e, "insertBefore") != "function")
|
|
1100
|
+
throw new TypeError("Component parent must be a DOM ParentNode");
|
|
1101
|
+
}
|
|
1102
|
+
function G(e) {
|
|
1103
|
+
try {
|
|
1104
|
+
return String(e);
|
|
1105
|
+
} catch {
|
|
1106
|
+
return Object.prototype.toString.call(e);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
function Be(e) {
|
|
1110
|
+
if (e == null) return [];
|
|
1111
|
+
if (Array.isArray(e))
|
|
1112
|
+
return e.map((t) => {
|
|
1113
|
+
if (!Array.isArray(t) || t.length < 2 || typeof t[0] != "string")
|
|
1114
|
+
throw new TypeError("Component baseStyles entries must be selector/style tuples");
|
|
1115
|
+
const n = t[1];
|
|
1116
|
+
if (typeof n != "string" && (!Array.isArray(n) || n.some((r) => typeof r != "string")))
|
|
1117
|
+
throw new TypeError("Component base style names must be strings");
|
|
1118
|
+
return [t[0], n];
|
|
1119
|
+
});
|
|
1120
|
+
if (typeof e != "object")
|
|
1121
|
+
throw new TypeError("Component baseStyles must be an object or tuple array");
|
|
1122
|
+
return Object.entries(e).map(([t, n]) => [
|
|
1123
|
+
t,
|
|
1124
|
+
n
|
|
1125
|
+
]);
|
|
1126
|
+
}
|
|
1127
|
+
function ae(e, t, n) {
|
|
1128
|
+
const r = t == null ? {} : { ...t };
|
|
1129
|
+
return n !== void 0 && (r.key = n), A(e, r);
|
|
1130
|
+
}
|
|
1131
|
+
const qe = ae, He = ae;
|
|
1132
|
+
function Ie(e) {
|
|
1133
|
+
if (!(e instanceof h))
|
|
1134
|
+
throw new TypeError("createPrebuiltElement requires a Component instance");
|
|
1135
|
+
return e;
|
|
1136
|
+
}
|
|
1137
|
+
export {
|
|
1138
|
+
h as C,
|
|
1139
|
+
P as F,
|
|
1140
|
+
J as S,
|
|
1141
|
+
qe as a,
|
|
1142
|
+
L as b,
|
|
1143
|
+
Ve as c,
|
|
1144
|
+
_e as d,
|
|
1145
|
+
de as e,
|
|
1146
|
+
Z as f,
|
|
1147
|
+
He as g,
|
|
1148
|
+
A as h,
|
|
1149
|
+
m as i,
|
|
1150
|
+
ae as j,
|
|
1151
|
+
Ie as k,
|
|
1152
|
+
Me as l,
|
|
1153
|
+
pe as s
|
|
1154
|
+
};
|
|
1155
|
+
//# sourceMappingURL=jsx-dev-runtime-CarwHDyL.js.map
|