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