@capillaryjs/capillary-ui 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/CHANGELOG.md +117 -2
  2. package/README.md +196 -35
  3. package/colors/README.md +53 -3
  4. package/colors/gray/colors.css +4 -2
  5. package/colors/green/colors.css +4 -2
  6. package/colors/iceblue/colors.css +4 -2
  7. package/colors/ocean/colors.css +4 -2
  8. package/colors/orange/colors.css +4 -2
  9. package/colors/purple/colors.css +4 -2
  10. package/colors/red/colors.css +7 -3
  11. package/colors/yellow/colors.css +8 -4
  12. package/dist/Components/app/app.d.ts +3 -3
  13. package/dist/Components/app/app.d.ts.map +1 -1
  14. package/dist/Components/component.d.ts +24 -3
  15. package/dist/Components/component.d.ts.map +1 -1
  16. package/dist/Components/data/descriptionList.d.ts.map +1 -1
  17. package/dist/Components/data/listview/listview.d.ts.map +1 -1
  18. package/dist/Components/data/table/DataTable.d.ts +8 -0
  19. package/dist/Components/data/table/DataTable.d.ts.map +1 -1
  20. package/dist/Components/data/table/FilterPanel.d.ts.map +1 -1
  21. package/dist/Components/data/table/TableHeader.d.ts +2 -0
  22. package/dist/Components/data/table/TableHeader.d.ts.map +1 -1
  23. package/dist/Components/data/table/TableHeaderCell.d.ts +18 -0
  24. package/dist/Components/data/table/TableHeaderCell.d.ts.map +1 -1
  25. package/dist/Components/data/table/tableDataSource.d.ts +6 -0
  26. package/dist/Components/data/table/tableDataSource.d.ts.map +1 -1
  27. package/dist/Components/data/treeview/treeview.d.ts.map +1 -1
  28. package/dist/Components/layout/groupBox.d.ts.map +1 -1
  29. package/dist/Components/layout/header.d.ts.map +1 -1
  30. package/dist/Components/layout/layout.d.ts +2 -2
  31. package/dist/Components/layout/layout.d.ts.map +1 -1
  32. package/dist/Components/layout/layoutTraits.d.ts +6 -0
  33. package/dist/Components/layout/layoutTraits.d.ts.map +1 -1
  34. package/dist/Components/layout/optionGroup.d.ts.map +1 -1
  35. package/dist/Components/layout/optionsBox.d.ts +2 -1
  36. package/dist/Components/layout/optionsBox.d.ts.map +1 -1
  37. package/dist/Components/layout/splitView.d.ts +2 -0
  38. package/dist/Components/layout/splitView.d.ts.map +1 -1
  39. package/dist/Components/lineinputs/CheckableControl.d.ts +2 -2
  40. package/dist/Components/lineinputs/CheckableControl.d.ts.map +1 -1
  41. package/dist/Components/lineinputs/LabeledInputControl.d.ts +2 -2
  42. package/dist/Components/lineinputs/LabeledInputControl.d.ts.map +1 -1
  43. package/dist/Components/lineinputs/LineControl.d.ts +7 -0
  44. package/dist/Components/lineinputs/LineControl.d.ts.map +1 -0
  45. package/dist/Components/lineinputs/SelectControl.d.ts.map +1 -1
  46. package/dist/Components/lineinputs/checkbox/Checkbox.d.ts +9 -3
  47. package/dist/Components/lineinputs/checkbox/Checkbox.d.ts.map +1 -1
  48. package/dist/Components/lineinputs/checkbox/QuadCheckbox.d.ts +1 -0
  49. package/dist/Components/lineinputs/checkbox/QuadCheckbox.d.ts.map +1 -1
  50. package/dist/Components/lineinputs/checkbox/TriCheckbox.d.ts +1 -0
  51. package/dist/Components/lineinputs/checkbox/TriCheckbox.d.ts.map +1 -1
  52. package/dist/Components/lineinputs/datetime/TemporalInput.d.ts.map +1 -1
  53. package/dist/Components/lineinputs/dropdown.d.ts +4 -2
  54. package/dist/Components/lineinputs/dropdown.d.ts.map +1 -1
  55. package/dist/Components/lineinputs/radio.d.ts +9 -4
  56. package/dist/Components/lineinputs/radio.d.ts.map +1 -1
  57. package/dist/Components/lineinputs/requiredPresentation.d.ts +21 -0
  58. package/dist/Components/lineinputs/requiredPresentation.d.ts.map +1 -0
  59. package/dist/Components/lineinputs/textbox.d.ts.map +1 -1
  60. package/dist/Components/lineinputs/toggle.d.ts +4 -2
  61. package/dist/Components/lineinputs/toggle.d.ts.map +1 -1
  62. package/dist/Components/menu/button.d.ts +2 -2
  63. package/dist/Components/menu/button.d.ts.map +1 -1
  64. package/dist/Components/status/progressBar.d.ts +2 -2
  65. package/dist/Components/status/progressBar.d.ts.map +1 -1
  66. package/dist/Components/status/statusPresentation.d.ts.map +1 -1
  67. package/dist/Components/theme/stylesheetPicker.d.ts +2 -1
  68. package/dist/Components/theme/stylesheetPicker.d.ts.map +1 -1
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +2697 -2079
  72. package/dist/index.js.map +1 -1
  73. package/dist/jsx-dev-runtime.js +3 -3
  74. package/dist/jsx-runtime-Ba-uafjl.js +1631 -0
  75. package/dist/jsx-runtime-Ba-uafjl.js.map +1 -0
  76. package/dist/jsx-runtime.js +2 -2
  77. package/dist/localization.d.ts +1 -1
  78. package/dist/localization.d.ts.map +1 -1
  79. package/dist/routing/RouteOutlet.d.ts.map +1 -1
  80. package/dist/runtime.d.ts +4 -0
  81. package/dist/runtime.d.ts.map +1 -1
  82. package/dist/styling/theme.d.ts +1 -1
  83. package/dist/styling/theme.d.ts.map +1 -1
  84. package/docs/application-composition-guide.md +22 -5
  85. package/package.json +3 -3
  86. package/styles/structural.css +704 -158
  87. package/themes/README.md +9 -2
  88. package/themes/base.css +114 -18
  89. package/themes/capillary/theme.css +300 -0
  90. package/themes/shiny/theme.css +33 -15
  91. package/themes/soft/theme.css +37 -0
  92. package/themes/white/theme.css +52 -0
  93. package/dist/jsx-dev-runtime-D3UnwrKT.js +0 -1362
  94. package/dist/jsx-dev-runtime-D3UnwrKT.js.map +0 -1
  95. package/themes/java/theme.css +0 -21
@@ -1,1362 +0,0 @@
1
- var ge = Object.defineProperty;
2
- var we = (e, t, n) => t in e ? ge(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var l = (e, t, n) => we(e, typeof t != "symbol" ? t + "" : t, n);
4
- const D = "data-cap-structural-styles";
5
- let Se = 1;
6
- class J {
7
- constructor(t = `runtime-${Se++}`) {
8
- l(this, "id");
9
- l(this, "cssFragments", /* @__PURE__ */ new Map());
10
- if (typeof t != "string") throw new TypeError("StyleRegistry id must be a string");
11
- this.id = t;
12
- }
13
- registerCSS(t) {
14
- if (typeof t != "string") throw new TypeError("Component CSS must be a string");
15
- const n = t.trim();
16
- return n.length > 0 && this.cssFragments.set(`raw:${n}`, { kind: "raw", css: n }), this;
17
- }
18
- /** @internal Collect a host-relative component template without resolving it yet. */
19
- registerHostCSS(t, n) {
20
- if (typeof t != "string") throw new TypeError("Component CSS must be a string");
21
- if (typeof n != "string" || n.trim().length === 0)
22
- throw new TypeError("Component CSS host must be a non-empty selector");
23
- const r = t.trim();
24
- if (r.length === 0) return this;
25
- if (!r.includes("&")) return this.registerCSS(r);
26
- const i = `host:${r}`, s = this.cssFragments.get(i);
27
- return s == null ? this.cssFragments.set(i, {
28
- kind: "host",
29
- css: r,
30
- hosts: /* @__PURE__ */ new Set([n.trim()])
31
- }) : s.kind === "host" && s.hosts.add(n.trim()), this;
32
- }
33
- generateCSS() {
34
- return [...this.cssFragments.values()].map((t) => t.kind === "raw" ? t.css : Q(t.css, [...t.hosts])).join(`
35
-
36
- `);
37
- }
38
- injectAll(t = globalThis.document) {
39
- if ((t == null ? void 0 : t.head) == null)
40
- throw new TypeError("StyleRegistry.injectAll requires a document with a head");
41
- const n = `style[${D}="${Ce(this.id)}"]`;
42
- let r = t.head.querySelector(n);
43
- r == null && (r = t.createElement("style"), r.setAttribute(D, this.id), t.head.prepend(r));
44
- const i = this.generateCSS();
45
- return r.textContent !== i && (r.textContent = i), r;
46
- }
47
- reset() {
48
- this.cssFragments.clear();
49
- }
50
- }
51
- function ve() {
52
- return new J();
53
- }
54
- const Ee = new J("");
55
- function Ce(e) {
56
- return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
57
- }
58
- function Q(e, t) {
59
- let n = "", r = 0;
60
- for (; r < e.length; ) {
61
- const i = Le(e, r);
62
- if (i < 0) return n + e.slice(r);
63
- const s = Te(e, i);
64
- if (s < 0) return n + e.slice(r);
65
- const o = e.slice(r, i), a = e.slice(i + 1, s), c = o.trim();
66
- n += c.startsWith("@") ? `${o}{${Q(a, t)}}` : `${Re(o, t)}{${a}}`, r = s + 1;
67
- }
68
- return n;
69
- }
70
- function Re(e, t) {
71
- var o, a, c;
72
- if (t.length === 1 || !e.includes("&"))
73
- return t.length === 1 ? e.replaceAll("&", t[0]) : e;
74
- const n = ((o = e.match(/^\s*/)) == null ? void 0 : o[0]) ?? "", r = ((a = e.match(/\s*$/)) == null ? void 0 : a[0]) ?? "", i = Oe(e.trim()), s = ((c = n.match(/(?:^|\n)([ \t]*)$/)) == null ? void 0 : c[1]) ?? "";
75
- return n + i.flatMap((u) => u.includes("&") ? t.map((p) => u.replaceAll("&", p)) : [u]).join(`,
76
- ${s}`) + r;
77
- }
78
- function Oe(e) {
79
- const t = [];
80
- let n = 0, r = 0, i = 0, s = null;
81
- for (let o = 0; o < e.length; o += 1) {
82
- const a = e[o];
83
- if (s != null) {
84
- a === "\\" ? o += 1 : a === s && (s = null);
85
- continue;
86
- }
87
- a === '"' || a === "'" ? s = a : a === "(" ? r += 1 : a === ")" ? r -= 1 : a === "[" ? i += 1 : a === "]" ? i -= 1 : a === "," && r === 0 && i === 0 && (t.push(e.slice(n, o).trim()), n = o + 1);
88
- }
89
- return t.push(e.slice(n).trim()), t.filter(Boolean);
90
- }
91
- function Le(e, t) {
92
- for (let n = t; n < e.length; n += 1) {
93
- const r = e[n];
94
- if (r === '"' || r === "'")
95
- n = X(e, n);
96
- else if (r === "/" && e[n + 1] === "*")
97
- n = ee(e, n);
98
- else if (r === "{")
99
- return n;
100
- }
101
- return -1;
102
- }
103
- function Te(e, t) {
104
- let n = 1;
105
- for (let r = t + 1; r < e.length; r += 1) {
106
- const i = e[r];
107
- if (i === '"' || i === "'")
108
- r = X(e, r);
109
- else if (i === "/" && e[r + 1] === "*")
110
- r = ee(e, r);
111
- else if (i === "{")
112
- n += 1;
113
- else if (i === "}" && --n === 0)
114
- return r;
115
- }
116
- return -1;
117
- }
118
- function X(e, t) {
119
- const n = e[t];
120
- for (let r = t + 1; r < e.length; r += 1)
121
- if (e[r] === "\\") r += 1;
122
- else if (e[r] === n) return r;
123
- return e.length;
124
- }
125
- function ee(e, t) {
126
- const n = e.indexOf("*/", t + 2);
127
- return n < 0 ? e.length : n + 1;
128
- }
129
- const te = /* @__PURE__ */ new WeakSet(), ne = /* @__PURE__ */ new WeakSet();
130
- function st(e) {
131
- if (typeof e != "string" || e.trim() === "")
132
- throw new TypeError("Service name must be a non-empty string");
133
- const t = Object.freeze({ name: e.trim() });
134
- return te.add(t), t;
135
- }
136
- function ot(e, t) {
137
- if (I(e), typeof t != "function")
138
- throw new TypeError(`Service provider "${e.name}" requires a factory function`);
139
- const n = Object.freeze({ key: e, create: t });
140
- return ne.add(n), n;
141
- }
142
- class re {
143
- constructor(t = []) {
144
- l(this, "providers", /* @__PURE__ */ new Map());
145
- l(this, "instances", /* @__PURE__ */ new Map());
146
- l(this, "creationOrder", []);
147
- l(this, "resolving", []);
148
- l(this, "disposed", !1);
149
- if (!Array.isArray(t))
150
- throw new TypeError("ServiceScope providers must be an array");
151
- for (const n of t) {
152
- if (Ae(n), this.providers.has(n.key))
153
- throw new Error(`Service "${n.key.name}" is registered more than once`);
154
- this.providers.set(n.key, n);
155
- }
156
- }
157
- get isDisposed() {
158
- return this.disposed;
159
- }
160
- has(t) {
161
- return this.assertActive(), I(t), this.providers.has(t);
162
- }
163
- require(t) {
164
- if (this.assertActive(), I(t), this.instances.has(t)) return this.instances.get(t);
165
- const n = this.providers.get(t);
166
- if (n == null) throw new Error(`Service "${t.name}" is not registered`);
167
- const r = this.resolving.indexOf(t);
168
- if (r >= 0) {
169
- const i = [...this.resolving.slice(r), t].map((s) => s.name).join(" -> ");
170
- throw new Error(`Circular service dependency: ${i}`);
171
- }
172
- this.resolving.push(t);
173
- try {
174
- const i = n.create(this);
175
- return this.instances.set(t, i), this.creationOrder.push(t), i;
176
- } finally {
177
- this.resolving.pop();
178
- }
179
- }
180
- dispose() {
181
- if (this.disposed) return;
182
- this.disposed = !0;
183
- const t = [];
184
- for (const n of [...this.creationOrder].reverse()) {
185
- const r = this.instances.get(n);
186
- try {
187
- const i = ze(r);
188
- i != null && i.call(r);
189
- } catch (i) {
190
- t.push(i);
191
- }
192
- }
193
- if (this.instances.clear(), this.creationOrder.length = 0, this.resolving.length = 0, t.length === 1) throw t[0];
194
- if (t.length > 1)
195
- throw new AggregateError(t, "Several services failed during disposal");
196
- }
197
- assertActive() {
198
- if (this.disposed) throw new Error("ServiceScope has been disposed");
199
- }
200
- }
201
- function je(e = []) {
202
- return new re(e);
203
- }
204
- function Pe(e) {
205
- return e != null && (typeof e == "object" || typeof e == "function") && te.has(e);
206
- }
207
- function I(e) {
208
- if (!Pe(e)) throw new TypeError("Expected a service key created by defineService()");
209
- }
210
- function Ae(e) {
211
- if (e == null || typeof e != "object" && typeof e != "function" || !ne.has(e))
212
- throw new TypeError("Expected a service provider created by provideService()");
213
- }
214
- function ze(e) {
215
- if (e == null || typeof e != "object" && typeof e != "function") return null;
216
- const t = Reflect.get(e, "dispose");
217
- return typeof t == "function" ? t : null;
218
- }
219
- const T = Object.freeze({
220
- breadcrumbLabel: "Breadcrumb",
221
- checkboxOptionLabel: "Option",
222
- checkboxStateLabel: (e, t) => `${e}: ${t}`,
223
- colorOptionGrayLabel: "Gray",
224
- colorOptionGreenLabel: "Green",
225
- colorOptionIceBlueLabel: "Ice blue",
226
- colorOptionOceanLabel: "Ocean",
227
- colorOptionOrangeLabel: "Orange",
228
- colorOptionPurpleLabel: "Purple",
229
- colorOptionRedLabel: "Red",
230
- colorOptionYellowLabel: "Yellow",
231
- dataTableEmpty: "No rows",
232
- dataTableLoadError: "Unable to load rows",
233
- dataTableLoading: "Loading rows…",
234
- dataTableRetry: "Retry",
235
- dialogCloseLabel: "Close",
236
- dropdownLoadError: "Unable to load options",
237
- dropdownPlaceholder: "Select…",
238
- filterModeDenyLabel: "deny",
239
- filterModeNeutralLabel: "neutral",
240
- filterModePreferLabel: "prefer",
241
- filterModeRequireLabel: "require",
242
- filterPanelEmpty: "No filter options",
243
- filterPanelLabel: "Filter options",
244
- filterPanelLoadError: "Unable to load filter options",
245
- filterPanelLoading: "Loading filter options…",
246
- listViewEmpty: "No items",
247
- listViewLabel: "Items",
248
- listViewLoadError: "Unable to load items",
249
- listViewLoading: "Loading items…",
250
- progressInProgress: "In progress",
251
- radioOptionLabel: "Option",
252
- splitViewSeparatorLabel: "Resize panes",
253
- tabLineLabel: "Sections",
254
- tableFilterColumnLabel: (e) => `Filter ${e}`,
255
- tableSortColumnLabel: (e) => `Sort ${e}`,
256
- themeOptionJavaLabel: "Java",
257
- themeOptionMinimalLabel: "Minimal",
258
- themeOptionShinyLabel: "Shiny",
259
- toolbarLabel: "Actions",
260
- treeViewEmpty: "No tree items",
261
- treeViewLoadError: "Unable to load tree items",
262
- treeViewLoading: "Loading tree items…"
263
- });
264
- class ie {
265
- constructor(t, n) {
266
- l(this, "locale");
267
- l(this, "messages");
268
- this.locale = t, this.messages = n, Object.freeze(this);
269
- }
270
- message(t) {
271
- return this.messages[t];
272
- }
273
- }
274
- const _e = new ie(
275
- void 0,
276
- T
277
- );
278
- function ke(e) {
279
- if (e == null) return _e;
280
- if (typeof e != "object" || Array.isArray(e))
281
- throw new TypeError("Capillary UI localization must be an object");
282
- const t = $e(e.locale), n = e.messages;
283
- if (n != null && (typeof n != "object" || Array.isArray(n)))
284
- throw new TypeError("Capillary UI localization messages must be an object");
285
- const r = { ...T };
286
- if (n != null)
287
- for (const i of Object.keys(T)) {
288
- const s = n[i];
289
- if (s === void 0) continue;
290
- const o = T[i];
291
- if (typeof s != typeof o)
292
- throw new TypeError(`Capillary UI localization message "${i}" has the wrong type`);
293
- Object.assign(r, { [i]: s });
294
- }
295
- return new ie(t, Object.freeze(r));
296
- }
297
- function $e(e) {
298
- if (typeof e != "string" || e.trim() === "")
299
- throw new TypeError("Capillary UI localization locale must be a non-empty BCP 47 language tag");
300
- try {
301
- return Intl.getCanonicalLocales(e)[0];
302
- } catch (t) {
303
- throw new RangeError(`Invalid Capillary UI localization locale: ${e}`, { cause: t });
304
- }
305
- }
306
- const Ne = /* @__PURE__ */ new Set([
307
- "annotation-xml",
308
- "color-profile",
309
- "font-face",
310
- "font-face-src",
311
- "font-face-uri",
312
- "font-face-format",
313
- "font-face-name",
314
- "missing-glyph"
315
- ]);
316
- class M {
317
- constructor(t = {}, n = ve()) {
318
- l(this, "styleRegistry");
319
- l(this, "services");
320
- l(this, "router");
321
- l(this, "localization");
322
- l(this, "routedRoots", /* @__PURE__ */ new WeakSet());
323
- if (t == null || typeof t != "object" || Array.isArray(t))
324
- throw new TypeError("CapillaryUiRuntime options must be an object");
325
- if (Object.hasOwn(t, "elementNames"))
326
- throw new TypeError("CapillaryUiRuntime no longer supports configurable element names");
327
- if (this.styleRegistry = n, this.localization = ke(t.localization), this.services = t.services ?? je(), !(this.services instanceof re))
328
- throw new TypeError("Capillary UI services must be a ServiceScope");
329
- if (this.router = t.router ?? null, this.router != null && (typeof this.router != "object" || typeof this.router.openScope != "function" || typeof this.router.completeScope != "function"))
330
- throw new TypeError("Capillary UI router must be a BrowserRouter");
331
- }
332
- /** Resolve a fixed one-hyphen public host name for a built-in component. */
333
- resolveElementName(t) {
334
- se(t, "Capillary UI component host name");
335
- const n = `cap-${t.replaceAll("-", "")}`;
336
- return Ie(n), n;
337
- }
338
- resolveHostSelector(t, n) {
339
- if (typeof t != "string") throw new TypeError("Host selector must be a string");
340
- return t.replaceAll("&", this.resolveElementName(n));
341
- }
342
- resolveHostCSS(t, n) {
343
- if (typeof t != "string") throw new TypeError("Host CSS must be a string");
344
- return t.replaceAll("&", this.resolveElementName(n));
345
- }
346
- create(t, ...n) {
347
- const r = new t(...n);
348
- return r._setRuntime(this), r;
349
- }
350
- mount(t, n, r = null) {
351
- t._setRuntime(this);
352
- let i = null;
353
- this.router != null && !this.routedRoots.has(t) && (this.routedRoots.add(t), i = this.router.openScope(this.router.root, t), t.onCleanup(i));
354
- try {
355
- t.mount(n, r), this.router != null && i != null && this.router.completeScope(this.router.root, t);
356
- } catch (s) {
357
- throw i == null || i(), s;
358
- }
359
- return t;
360
- }
361
- registerStyles(t) {
362
- if (t == null || typeof t.registerStyles != "function")
363
- throw new TypeError("registerStyles requires a Capillary UI component dependency");
364
- return t.registerStyles(this), this;
365
- }
366
- injectStyles(t = globalThis.document) {
367
- return this.styleRegistry.injectAll(t);
368
- }
369
- }
370
- function at(e = {}) {
371
- return new M(e);
372
- }
373
- const K = new M({}, Ee);
374
- function se(e, t) {
375
- if (typeof e != "string" || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(e))
376
- throw new TypeError(`${t} must be a lowercase kebab-case name`);
377
- }
378
- function Ie(e) {
379
- if (se(e, "Capillary UI element name"), !e.includes("-") || Ne.has(e))
380
- throw new TypeError(`Capillary UI element name must be a non-reserved name containing a hyphen: ${e}`);
381
- }
382
- const P = Symbol.for("@capillaryjs/capillary-ui.Fragment"), oe = /* @__PURE__ */ new WeakSet(), Ue = /* @__PURE__ */ new Set([
383
- "allowFullScreen",
384
- "async",
385
- "autoFocus",
386
- "autoPlay",
387
- "checked",
388
- "controls",
389
- "default",
390
- "defer",
391
- "disabled",
392
- "formNoValidate",
393
- "hidden",
394
- "inert",
395
- "loop",
396
- "multiple",
397
- "muted",
398
- "noModule",
399
- "noValidate",
400
- "open",
401
- "playsInline",
402
- "readOnly",
403
- "required",
404
- "reversed",
405
- "selected"
406
- ]), xe = /* @__PURE__ */ new Set([
407
- "checked",
408
- "defaultChecked",
409
- "defaultValue",
410
- "disabled",
411
- "indeterminate",
412
- "multiple",
413
- "muted",
414
- "readOnly",
415
- "required",
416
- "selected",
417
- "selectedIndex",
418
- "tabIndex",
419
- "value"
420
- ]), W = "data-cap";
421
- function lt(e) {
422
- H(e, "live");
423
- const t = Object.freeze({ emitter: e });
424
- return oe.add(t), t;
425
- }
426
- function A(e, t = null, ...n) {
427
- const r = t ?? {};
428
- if (typeof r != "object" || Array.isArray(r))
429
- throw new TypeError("VNode props must be an object or null");
430
- const {
431
- children: i,
432
- key: s = null,
433
- ...o
434
- } = r;
435
- return {
436
- type: e,
437
- key: s,
438
- props: {
439
- ...o,
440
- children: ae([i, n])
441
- }
442
- };
443
- }
444
- function Me(e, ...t) {
445
- return e.reduce((n, r, i) => n + r + String(t[i] ?? ""), "");
446
- }
447
- const h = class h {
448
- constructor(t = {}) {
449
- l(this, "props");
450
- l(this, "dom", null);
451
- /** @internal */
452
- l(this, "_rendered", null);
453
- /** @internal */
454
- l(this, "_childComponents", /* @__PURE__ */ new Set());
455
- /** @internal Component ancestry used to enforce structural invariants. */
456
- l(this, "_parentComponent", null);
457
- l(this, "initialized", !1);
458
- l(this, "mounted", !1);
459
- l(this, "destroyed", !1);
460
- l(this, "updating", !1);
461
- l(this, "updateRequested", !1);
462
- l(this, "cleanupFunctions", /* @__PURE__ */ new Set());
463
- l(this, "watched", /* @__PURE__ */ new Map());
464
- l(this, "renderReadSubscriptions", /* @__PURE__ */ new Map());
465
- l(this, "collectingRenderReads", null);
466
- /** @internal */
467
- l(this, "_runtime", K);
468
- /** @internal Route lineage inherited by nested routed components. */
469
- l(this, "_routeContext", null);
470
- /** JSX component for this instance's runtime-configured custom host. */
471
- l(this, "Host", ({
472
- children: t = [],
473
- ...n
474
- }) => this.host(n, t));
475
- if (t == null || typeof t != "object" || Array.isArray(t))
476
- throw new TypeError(`${this.constructor.name} props must be an object`);
477
- this.props = t;
478
- }
479
- static new(...t) {
480
- const n = new this(...t);
481
- if (!(n instanceof h))
482
- throw new TypeError("Component.new() requires a Component constructor");
483
- return n.mount();
484
- }
485
- static registerStyles(t = K, n = /* @__PURE__ */ new Set()) {
486
- if (n.has(this)) return;
487
- n.add(this);
488
- const r = this.hostName ?? null, i = nt(this);
489
- for (const s of i)
490
- Object.hasOwn(s, "css") && s.css && (r == null ? t.styleRegistry.registerCSS(s.css) : t.styleRegistry.registerHostCSS(
491
- s.css,
492
- t.resolveElementName(r)
493
- ));
494
- for (const s of i)
495
- if (Object.hasOwn(s, "dependencies"))
496
- for (const o of s.dependencies ?? [])
497
- o.registerStyles(t, n);
498
- }
499
- /** One-time setup hook. Constructors must not subscribe or render. */
500
- initialize() {
501
- }
502
- render() {
503
- throw new Error(`${this.constructor.name} must implement render()`);
504
- }
505
- /** Render this component's configured custom host element. */
506
- host(t = null, ...n) {
507
- const r = this.constructor, i = r.hostName;
508
- if (i == null)
509
- throw new Error(`${this.constructor.name} does not declare a custom host name`);
510
- const {
511
- class: s,
512
- className: o,
513
- ...a
514
- } = t ?? {}, c = o ?? s, u = this.props.island === !0 ? rt(c, "island") : c;
515
- return A(this._runtime.resolveElementName(i), {
516
- ...a,
517
- ...u == null ? {} : { className: u },
518
- "data-cap-component": i,
519
- ...r.dataSurface == null ? {} : { "data-cap-surface": r.dataSurface }
520
- }, ...n);
521
- }
522
- /** @internal Assign an immutable application runtime before initialization or mounting. */
523
- _setRuntime(t) {
524
- var n;
525
- if (!(t instanceof M))
526
- throw new TypeError("Component runtime must be a CapillaryUiRuntime");
527
- if (t === this._runtime) return this;
528
- if (this.initialized || this.mounted || this._rendered != null)
529
- throw new Error("Cannot change a component runtime after initialization");
530
- return this._runtime = t, this._routeContext == null && (this._routeContext = ((n = t.router) == null ? void 0 : n.root) ?? null), this;
531
- }
532
- /** @internal Assign contextual route lineage before initialization. */
533
- _setRouteContext(t) {
534
- if (this.initialized || this.mounted || this._rendered != null)
535
- throw new Error("Cannot change a component route context after initialization");
536
- return this._routeContext = t, this;
537
- }
538
- /** @internal Route lineage inherited by component children. */
539
- _routeContextForChildren() {
540
- return this._routeContext;
541
- }
542
- /** @internal Assign the renderer-owned component ancestry. */
543
- _setParentComponent(t) {
544
- if (this._parentComponent != null && this._parentComponent !== t)
545
- throw new Error("A component instance cannot move between component owners");
546
- return this._parentComponent = t, this.validateIslandAncestry(this.props), this;
547
- }
548
- mount(t = null, n = null) {
549
- if (this.destroyed) throw new Error("Cannot mount a destroyed component");
550
- this.validateIslandAncestry(this.props);
551
- let r = !1;
552
- return this.initialized || (this.validateRequiredServices(), this.initialized = !0, this.initialize()), this.mounted || (this.mounted = !0, this.update(), r = !0), t != null && (tt(t), V(t, this._rendered, n)), r && this.afterMount(this.dom), this;
553
- }
554
- attachTo(t) {
555
- return this.mount(t), this;
556
- }
557
- update(t) {
558
- if (this.destroyed) return this;
559
- if (!this.mounted) return this.mount();
560
- if (this.updating)
561
- return this.updateRequested = !0, this;
562
- this.updating = !0;
563
- try {
564
- do {
565
- this.updateRequested = !1;
566
- const n = /* @__PURE__ */ new Set();
567
- this.collectingRenderReads = n;
568
- let r;
569
- try {
570
- r = R(this.render());
571
- } finally {
572
- this.collectingRenderReads = null;
573
- }
574
- this._rendered = F(this._rendered, r, this), this.dom = pe(this._rendered), this.reconcileRenderReads(n), this.afterUpdate(this.dom);
575
- } while (this.updateRequested && !this.destroyed);
576
- } finally {
577
- this.updating = !1;
578
- }
579
- return this;
580
- }
581
- setProps(t) {
582
- if (t == null || typeof t != "object" || Array.isArray(t))
583
- throw new TypeError(`${this.constructor.name} props must be an object`);
584
- return this.validateIslandAncestry(t), this.props = t, this.mounted && this.update(), this;
585
- }
586
- afterMount(t) {
587
- }
588
- afterUpdate(t) {
589
- }
590
- watch(...t) {
591
- for (const n of t) {
592
- if (n == null || typeof n.subscribe != "function")
593
- throw new TypeError("watch requires emitter-like values");
594
- if (this.watched.has(n)) continue;
595
- const r = n.subscribe(({ event: i }) => {
596
- this.mounted && !this.destroyed && this.update(i);
597
- }, { emitCurrent: !1 });
598
- this.watched.set(n, r), this.onCleanup(() => {
599
- r(), this.watched.delete(n);
600
- });
601
- }
602
- return this;
603
- }
604
- watchFutureValues(...t) {
605
- return this.watch(...t);
606
- }
607
- /** Read an emitter during render and rerender when that dependency changes. */
608
- read(t) {
609
- return this.trackRenderRead(t), t.get();
610
- }
611
- /** Read a Capillary value, fetch state, and error as one tracked render dependency. */
612
- snapshot(t) {
613
- return this.trackRenderRead(t), Object.freeze({
614
- value: t.get(),
615
- fetchState: t.getFetchState(),
616
- error: t.getError()
617
- });
618
- }
619
- onCleanup(t) {
620
- if (typeof t != "function") throw new TypeError("cleanup must be a function");
621
- if (this.destroyed)
622
- return t(), () => {
623
- };
624
- this.cleanupFunctions.add(t);
625
- let n = !0;
626
- return () => {
627
- n && (n = !1, this.cleanupFunctions.delete(t), t());
628
- };
629
- }
630
- /** Resolve one explicitly declared application service from this component's runtime. */
631
- requireService(t) {
632
- if (!this.initialized)
633
- throw new Error("Components may resolve services during initialize() or later");
634
- const n = this.constructor;
635
- if (!n.requiredServices.includes(t))
636
- throw new Error(
637
- `${n.name} must declare service "${t.name}" in requiredServices`
638
- );
639
- return this._runtime.services.require(t);
640
- }
641
- /** Read the immutable Capillary UI localization selected for this component's runtime. */
642
- get localization() {
643
- return this._runtime.localization;
644
- }
645
- /** Resolve one Capillary UI-authored message with the runtime's English fallback. */
646
- capillaryUiMessage(t) {
647
- return this.localization.message(t);
648
- }
649
- listen(t, n, r, i) {
650
- if (t == null || typeof t.addEventListener != "function")
651
- throw new TypeError("listen target must be an EventTarget");
652
- const s = r;
653
- return t.addEventListener(n, s, i), this.onCleanup(() => t.removeEventListener(n, s, i)), this;
654
- }
655
- registerChild(t) {
656
- if (!(t instanceof h))
657
- throw new TypeError("registerChild requires a Component");
658
- return this._childComponents.add(t), t;
659
- }
660
- destroy() {
661
- if (!this.destroyed) {
662
- this.destroyed = !0, this.mounted = !1;
663
- for (const t of [...this.cleanupFunctions]) t();
664
- this.cleanupFunctions.clear(), this.watched.clear();
665
- for (const t of this.renderReadSubscriptions.values()) t();
666
- this.renderReadSubscriptions.clear(), this.collectingRenderReads = null, this._rendered && g(this._rendered, !0), this._rendered = null, this.dom = null, this._childComponents.clear(), this.onDestroy();
667
- }
668
- }
669
- validateRequiredServices() {
670
- const t = this.constructor;
671
- for (const n of t.requiredServices)
672
- if (!this._runtime.services.has(n))
673
- throw new Error(`${t.name} requires unregistered service "${n.name}"`);
674
- }
675
- validateIslandAncestry(t) {
676
- if (!N(t)) return;
677
- if (this.hasIslandDescendant())
678
- throw new Error("An island component cannot contain another island");
679
- let n = this._parentComponent;
680
- for (; n != null; ) {
681
- if (N(n.props))
682
- throw new Error("An island component cannot be nested inside another island");
683
- n = n._parentComponent;
684
- }
685
- }
686
- hasIslandDescendant() {
687
- for (const t of this._childComponents)
688
- if (N(t.props) || t.hasIslandDescendant()) return !0;
689
- return !1;
690
- }
691
- onDestroy() {
692
- }
693
- trackRenderRead(t) {
694
- if (H(t, "Component.read"), this.collectingRenderReads == null)
695
- throw new Error("Component.read() and snapshot() may only be called during render()");
696
- this.collectingRenderReads.add(t);
697
- }
698
- reconcileRenderReads(t) {
699
- for (const [n, r] of this.renderReadSubscriptions)
700
- t.has(n) || (r(), this.renderReadSubscriptions.delete(n));
701
- for (const n of t) {
702
- if (this.watched.has(n) || this.renderReadSubscriptions.has(n)) continue;
703
- const r = n.subscribe(({ event: i }) => {
704
- this.mounted && !this.destroyed && this.update(i);
705
- }, { emitCurrent: !1 });
706
- this.renderReadSubscriptions.set(n, r);
707
- }
708
- }
709
- };
710
- l(h, "dependencies", []), l(h, "requiredServices", []), /** Component `live()` bindings are opt-in; subclasses declare their allowlist. */
711
- l(h, "liveProps", []), l(h, "css", Me`
712
- .cap-fill-horizontal,
713
- .cap-fill-vertical {
714
- box-sizing: border-box;
715
- background: var(--application-background);
716
- color: var(--ui-color);
717
- font-family: var(--font-family);
718
- font-size: var(--font-size);
719
- line-height: var(--line-height);
720
- }
721
-
722
- .cap-fill-horizontal {
723
- width: 100vw;
724
- max-width: 100vw;
725
- min-width: 0;
726
- overflow-x: auto;
727
- }
728
-
729
- .cap-fill-vertical {
730
- height: 100vh;
731
- max-height: 100vh;
732
- min-height: 0;
733
- overflow-y: auto;
734
- }
735
-
736
- .cap-layout-horizontal,
737
- .cap-layout-vertical {
738
- display: flex;
739
- align-items: stretch;
740
- min-inline-size: 0;
741
- min-block-size: 0;
742
- }
743
-
744
- .cap-layout-horizontal {
745
- flex-direction: row;
746
- }
747
-
748
- .cap-layout-vertical {
749
- flex-direction: column;
750
- }
751
-
752
- .cap-size-natural {
753
- flex: 0 0 auto;
754
- }
755
-
756
- .cap-size-flexible {
757
- flex: 1 1 0;
758
- min-inline-size: 0;
759
- min-block-size: 0;
760
- }
761
-
762
- .cap-scroll {
763
- overflow: auto;
764
- min-inline-size: 0;
765
- min-block-size: 0;
766
- }
767
-
768
- .colored {
769
- --colored-base-bg:
770
- linear-gradient(
771
- 15deg,
772
- var(--c1) 0%,
773
- var(--c2) 65%,
774
- var(--c2) 65%,
775
- var(--c3) 100%
776
- );
777
-
778
- background: var(--colored-base-bg);
779
- box-shadow: var(--colored-shadow);
780
- border-radius: var(--ui-border-radius);
781
- }
782
-
783
- .app-footer.island,
784
- .island {
785
- box-sizing: border-box;
786
- min-width: 0;
787
- min-height: 0;
788
- margin: var(--island-margin);
789
- padding: var(--island-padding);
790
- background: var(--island-background);
791
- border: var(--island-border);
792
- border-radius: var(--island-radius);
793
- box-shadow: var(--island-shadow);
794
- }
795
-
796
- .cap-fill-horizontal.island,
797
- .cap-fill-horizontal .island {
798
- max-width: calc(100% - (2 * var(--island-margin)));
799
- overflow-x: auto;
800
- }
801
-
802
- .cap-fill-vertical.island,
803
- .cap-fill-vertical .island {
804
- max-height: calc(100% - (2 * var(--island-margin)));
805
- overflow-y: auto;
806
- }
807
-
808
- label[data-cap] {
809
- user-select: none;
810
- }
811
- `), l(h, "hostName", null), /** Optional host-level data surface marker for parent composition. */
812
- l(h, "dataSurface", null);
813
- let m = h;
814
- function R(e) {
815
- return Array.isArray(e) ? A(P, null, e) : e == null || typeof e == "boolean" ? A(P) : e;
816
- }
817
- function ae(e) {
818
- const t = [], n = (r) => {
819
- if (Array.isArray(r))
820
- for (const i of r) n(i);
821
- else r != null && typeof r != "boolean" && t.push(r);
822
- };
823
- return n(e), t;
824
- }
825
- function O(e, t) {
826
- if (typeof e == "string" || typeof e == "number")
827
- return {
828
- kind: "text",
829
- key: null,
830
- value: e,
831
- node: document.createTextNode(String(e)),
832
- owner: t
833
- };
834
- if (k(e)) {
835
- const s = document.createComment("cap-emitter-start"), o = document.createComment("cap-emitter-end"), a = e.get();
836
- if (Object.is(a, e))
837
- throw new TypeError("A Capillary UI emitter child cannot render itself");
838
- const c = document.createDocumentFragment();
839
- c.append(s, o);
840
- const u = O(R(a), t);
841
- V(c, u, o);
842
- const p = {
843
- kind: "emitter",
844
- key: null,
845
- source: e,
846
- start: s,
847
- end: o,
848
- child: u,
849
- unsubscribe: () => {
850
- },
851
- owner: t
852
- };
853
- return p.unsubscribe = e.subscribe(({ value: b }) => {
854
- if (Object.is(b, e))
855
- throw new TypeError("A Capillary UI emitter child cannot render itself");
856
- p.child = F(p.child, R(b), t);
857
- }, { emitCurrent: !1 }), p;
858
- }
859
- if (e instanceof m)
860
- return e._setRuntime(t._runtime), e._setRouteContext(t._routeContextForChildren()), e._setParentComponent(t), e.mount(), t.registerChild(e), {
861
- kind: "component",
862
- key: de(e.props),
863
- type: e.constructor,
864
- instance: e,
865
- prebuilt: !0,
866
- props: e.props,
867
- liveProps: /* @__PURE__ */ new Map(),
868
- owner: t
869
- };
870
- if (!y(e))
871
- throw new TypeError(`Invalid Capillary UI child: ${G(e)}`);
872
- const { type: n, key: r = null, props: i } = e;
873
- if (n === P) {
874
- const s = document.createComment("cap-fragment-start"), o = document.createComment("cap-fragment-end"), a = {
875
- kind: "fragment",
876
- key: r,
877
- type: n,
878
- start: s,
879
- end: o,
880
- children: [],
881
- owner: t
882
- }, c = document.createDocumentFragment();
883
- return c.append(s, o), a.children = z(
884
- c,
885
- [],
886
- i.children,
887
- t,
888
- o,
889
- s
890
- ), a;
891
- }
892
- if (typeof n == "string") {
893
- const s = document.createElement(n), o = {
894
- kind: "element",
895
- key: r,
896
- type: n,
897
- node: s,
898
- props: {},
899
- listeners: /* @__PURE__ */ new Map(),
900
- liveProps: /* @__PURE__ */ new Map(),
901
- nativeBindings: /* @__PURE__ */ new Map(),
902
- ref: null,
903
- children: [],
904
- owner: t
905
- };
906
- return fe(o, i), o.children = z(s, [], i.children, t), o;
907
- }
908
- if (me(n)) {
909
- const s = i;
910
- ue(n, s);
911
- const o = Y(s), a = new n(o);
912
- a._setRuntime(t._runtime), a._setRouteContext(t._routeContextForChildren()), a._setParentComponent(t);
913
- const c = {
914
- kind: "component",
915
- key: r,
916
- type: n,
917
- instance: a,
918
- prebuilt: !1,
919
- props: o,
920
- liveProps: /* @__PURE__ */ new Map(),
921
- owner: t
922
- };
923
- return ce(c, s), a.mount(), t.registerChild(a), c;
924
- }
925
- if (typeof n == "function") {
926
- const s = n, o = i, a = Y(o), c = R(s(a)), u = {
927
- kind: "function",
928
- key: r,
929
- type: s,
930
- props: a,
931
- sourceProps: o,
932
- liveProps: /* @__PURE__ */ new Map(),
933
- child: O(c, t),
934
- owner: t
935
- };
936
- return qe(u), u;
937
- }
938
- throw new TypeError(`Unsupported vnode type: ${G(n)}`);
939
- }
940
- function F(e, t, n) {
941
- if (e == null) return O(t, n);
942
- if (he(e, t)) return le(e, t, n);
943
- const r = O(t, n), i = pe(e), s = (i == null ? void 0 : i.parentNode) ?? null;
944
- return s && V(s, r, i), g(e, !0), r;
945
- }
946
- function le(e, t, n) {
947
- 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) && Fe(e, t.props), e) : y(t) ? e.kind === "function" ? (Be(e, t.props), e) : e.kind === "fragment" ? (e.children = z(
948
- e.start.parentNode,
949
- e.children,
950
- t.props.children,
951
- n,
952
- e.end,
953
- e.start
954
- ), e) : (fe(e, t.props), e.children = z(
955
- e.node,
956
- e.children,
957
- t.props.children,
958
- n
959
- ), e) : e;
960
- }
961
- function Y(e) {
962
- return Object.fromEntries(Object.entries(e).map(([t, n]) => [
963
- t,
964
- v(n) ? n.emitter.get() : n
965
- ]));
966
- }
967
- function ce(e, t) {
968
- q(e.liveProps, t, (n, r) => {
969
- e.props = { ...e.props, [n]: r }, e.instance.setProps(e.props);
970
- }), e.props = B(e.liveProps, t), e.instance.setProps(e.props);
971
- }
972
- function Fe(e, t) {
973
- ue(e.type, t), ce(e, t);
974
- }
975
- function ue(e, t) {
976
- const n = Reflect.get(e, "liveProps");
977
- if (n == null) return;
978
- if (!Array.isArray(n) || n.some((i) => typeof i != "string"))
979
- throw new TypeError(`${e.name || "Component"}.liveProps must be an array`);
980
- const r = new Set(n);
981
- for (const [i, s] of Object.entries(t))
982
- if (v(s) && !r.has(i))
983
- throw new TypeError(
984
- `${e.name || "Component"} prop "${i}" does not support live()`
985
- );
986
- }
987
- function qe(e) {
988
- q(e.liveProps, e.sourceProps, (t, n) => {
989
- e.props = { ...e.props, [t]: n }, U(e);
990
- }), e.props = B(e.liveProps, e.sourceProps);
991
- }
992
- function Be(e, t) {
993
- e.sourceProps = t, q(e.liveProps, t, (n, r) => {
994
- e.props = { ...e.props, [n]: r }, U(e);
995
- }), e.props = B(e.liveProps, t), U(e);
996
- }
997
- function U(e) {
998
- const t = R(e.type(e.props));
999
- e.child = F(e.child, t, e.owner);
1000
- }
1001
- function q(e, t, n) {
1002
- for (const [r, i] of e) {
1003
- const s = t[r];
1004
- v(s) && s.emitter === i.source || (i.unsubscribe(), e.delete(r));
1005
- }
1006
- for (const [r, i] of Object.entries(t)) {
1007
- if (!v(i) || e.has(r)) continue;
1008
- const s = {
1009
- source: i.emitter,
1010
- value: i.emitter.get(),
1011
- unsubscribe: () => {
1012
- }
1013
- };
1014
- s.unsubscribe = i.emitter.subscribe(({ value: o }) => {
1015
- e.get(r) === s && (s.value = o, n(r, o));
1016
- }, { emitCurrent: !1 }), e.set(r, s);
1017
- }
1018
- }
1019
- function B(e, t) {
1020
- return Object.fromEntries(Object.entries(t).map(([n, r]) => {
1021
- var i;
1022
- return [
1023
- n,
1024
- v(r) ? ((i = e.get(n)) == null ? void 0 : i.value) ?? r.emitter.get() : r
1025
- ];
1026
- }));
1027
- }
1028
- function z(e, t, n, r, i = null, s = null) {
1029
- if (e == null) throw new Error("Cannot patch a detached fragment range");
1030
- const o = ae(n), a = /* @__PURE__ */ new Map(), c = [];
1031
- for (const f of t)
1032
- f.key == null ? c.push(f) : a.has(f.key) || a.set(f.key, f);
1033
- const u = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), b = [];
1034
- let be = 0;
1035
- for (const f of o) {
1036
- const d = C(f);
1037
- if (d != null) {
1038
- if (u.has(d)) throw new Error(`Duplicate sibling key: ${String(d)}`);
1039
- u.add(d);
1040
- }
1041
- const L = d == null ? c[be++] : a.get(d);
1042
- L && he(L, f) ? (p.add(L), b.push(le(L, f, r))) : b.push(O(f, r));
1043
- }
1044
- for (const f of t)
1045
- p.has(f) || g(f, !0);
1046
- let E = s ? s.nextSibling : e.firstChild;
1047
- for (const f of b)
1048
- for (const d of w(f))
1049
- d === E ? E = E.nextSibling : (e.insertBefore(d, E ?? i), E = d.nextSibling);
1050
- return b;
1051
- }
1052
- function fe(e, t) {
1053
- const n = Object.fromEntries(Object.entries(t).filter(
1054
- ([s]) => s !== "children" && j(s) !== W
1055
- )), r = e.props, i = /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(n)]);
1056
- for (const s of ["value", "checked"])
1057
- if (Object.hasOwn(n, s) && Object.hasOwn(n, `bind:${s}`))
1058
- throw new Error(`${s} and bind:${s} cannot be used together`);
1059
- for (const s of i) {
1060
- const o = r[s], a = n[s];
1061
- if (Je(s))
1062
- He(e, s, a);
1063
- else if (s === "ref")
1064
- o !== a && Ke(e, a);
1065
- else if (Ge(s))
1066
- De(e, s, a);
1067
- else if (v(a))
1068
- Ve(e, s, a);
1069
- else {
1070
- const c = e.liveProps.get(s);
1071
- c && (c.unsubscribe(), e.liveProps.delete(s));
1072
- const u = (c == null ? void 0 : c.value) ?? o;
1073
- Object.is(u, a) || S(e.node, s, u, a);
1074
- }
1075
- }
1076
- e.node.setAttribute(W, ""), e.props = { ...n };
1077
- }
1078
- function Ve(e, t, n) {
1079
- const r = e.liveProps.get(t);
1080
- if ((r == null ? void 0 : r.source) === n.emitter) return;
1081
- r == null || r.unsubscribe();
1082
- const i = n.emitter.get();
1083
- S(e.node, t, (r == null ? void 0 : r.value) ?? e.props[t], i);
1084
- const s = {
1085
- source: n.emitter,
1086
- value: i,
1087
- unsubscribe: () => {
1088
- }
1089
- };
1090
- s.unsubscribe = n.emitter.subscribe(({ value: o }) => {
1091
- const a = s.value;
1092
- s.value = o, Object.is(a, o) || S(e.node, t, a, o);
1093
- }, { emitCurrent: !1 }), e.liveProps.set(t, s);
1094
- }
1095
- function He(e, t, n) {
1096
- const r = t.slice(5), i = e.nativeBindings.get(t);
1097
- if (n == null) {
1098
- i && (i.unsubscribe(), e.node.removeEventListener(i.eventName, i.listener), e.nativeBindings.delete(t), S(e.node, r, i.value, void 0));
1099
- return;
1100
- }
1101
- if (Qe(n, t), (i == null ? void 0 : i.source) === n) return;
1102
- i && (i.unsubscribe(), e.node.removeEventListener(i.eventName, i.listener)), Xe(e.node, r);
1103
- const s = et(e.node, r), o = n.get();
1104
- S(e.node, r, i == null ? void 0 : i.value, o);
1105
- const a = () => {
1106
- n.set(Reflect.get(e.node, r), `${t} changed`);
1107
- }, c = {
1108
- source: n,
1109
- value: o,
1110
- eventName: s,
1111
- listener: a,
1112
- unsubscribe: () => {
1113
- }
1114
- };
1115
- c.unsubscribe = n.subscribe(({ value: u }) => {
1116
- const p = c.value;
1117
- c.value = u, Object.is(p, u) || S(e.node, r, p, u);
1118
- }, { emitCurrent: !1 }), e.node.addEventListener(s, a), e.nativeBindings.set(t, c);
1119
- }
1120
- function De(e, t, n) {
1121
- const r = t.slice(2).toLowerCase(), i = e.listeners.get(t);
1122
- if (i && i !== n && (e.node.removeEventListener(r, i), e.listeners.delete(t)), n != null && typeof n != "function")
1123
- throw new TypeError(`${t} must be a function or null`);
1124
- if (typeof n == "function" && i !== n) {
1125
- const s = n;
1126
- e.node.addEventListener(r, s), e.listeners.set(t, s);
1127
- }
1128
- }
1129
- function Ke(e, t) {
1130
- if (x(e.ref, null), t != null && typeof t != "function" && typeof t != "object")
1131
- throw new TypeError("ref must be a function, object, or null");
1132
- e.ref = t, x(e.ref, e.node);
1133
- }
1134
- function S(e, t, n, r) {
1135
- if (t === "class" || t === "className") {
1136
- $(e, "class", r);
1137
- return;
1138
- }
1139
- if (t === "for" || t === "htmlFor") {
1140
- $(e, "for", r);
1141
- return;
1142
- }
1143
- if (t === "dataset") {
1144
- We(e, n, r);
1145
- return;
1146
- }
1147
- if (t === "style") {
1148
- Ye(e, n, r);
1149
- return;
1150
- }
1151
- if (t === "dangerouslySetInnerHTML")
1152
- throw new Error("dangerouslySetInnerHTML is not supported");
1153
- const i = Ze(t);
1154
- if (Ue.has(i)) {
1155
- const s = !!r;
1156
- i in e && Reflect.set(e, i, s), e.toggleAttribute(j(t), s);
1157
- return;
1158
- }
1159
- if (xe.has(i) && i in e) {
1160
- const s = r ?? (i === "value" ? "" : !1);
1161
- Object.is(Reflect.get(e, i), s) || Reflect.set(e, i, s), r == null && e.removeAttribute(j(t));
1162
- return;
1163
- }
1164
- $(e, j(t), r);
1165
- }
1166
- function We(e, t, n) {
1167
- const r = _(t, "dataset"), i = _(n, "dataset");
1168
- for (const s of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])) {
1169
- const o = i[s];
1170
- o == null ? delete e.dataset[s] : e.dataset[s] = String(o);
1171
- }
1172
- }
1173
- function Ye(e, t, n) {
1174
- if (typeof n == "string") {
1175
- e.style.cssText = n;
1176
- return;
1177
- }
1178
- const r = typeof t == "string" ? {} : _(t, "style"), i = _(n, "style");
1179
- typeof t == "string" && (e.style.cssText = "");
1180
- for (const s of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])) {
1181
- const o = i[s];
1182
- s.startsWith("--") ? o == null ? e.style.removeProperty(s) : e.style.setProperty(s, String(o)) : Reflect.set(e.style, s, o == null ? "" : String(o));
1183
- }
1184
- }
1185
- function _(e, t) {
1186
- if (e == null) return {};
1187
- if (typeof e != "object" || Array.isArray(e))
1188
- throw new TypeError(`${t} must be an object or null`);
1189
- return e;
1190
- }
1191
- function $(e, t, n) {
1192
- n == null || n === !1 ? e.removeAttribute(t) : n === !0 ? e.setAttribute(t, "") : e.setAttribute(t, String(n));
1193
- }
1194
- function Ze(e) {
1195
- return e === "readonly" ? "readOnly" : e === "autofocus" ? "autoFocus" : e;
1196
- }
1197
- function j(e) {
1198
- return e === "className" ? "class" : e === "htmlFor" ? "for" : e === "minLength" ? "minlength" : e === "maxLength" ? "maxlength" : e === "autoComplete" ? "autocomplete" : e === "inputMode" ? "inputmode" : /^aria[A-Z]/.test(e) || /^data[A-Z]/.test(e) ? Z(e) : e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
1199
- }
1200
- function Z(e) {
1201
- return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
1202
- }
1203
- function x(e, t) {
1204
- e != null && (typeof e == "function" ? e(t) : e.current = t);
1205
- }
1206
- function g(e, t) {
1207
- if (e.kind === "emitter") {
1208
- if (e.unsubscribe(), g(e.child, !1), t)
1209
- for (const n of w(e)) n.remove();
1210
- return;
1211
- }
1212
- if (e.kind === "component") {
1213
- for (const n of e.liveProps.values()) n.unsubscribe();
1214
- e.liveProps.clear(), e.owner._childComponents.delete(e.instance), e.instance.destroy();
1215
- return;
1216
- }
1217
- if (e.kind === "function") {
1218
- for (const n of e.liveProps.values()) n.unsubscribe();
1219
- e.liveProps.clear(), g(e.child, t);
1220
- return;
1221
- }
1222
- if (e.kind === "element") {
1223
- x(e.ref, null);
1224
- for (const [n, r] of e.listeners)
1225
- e.node.removeEventListener(n.slice(2).toLowerCase(), r);
1226
- e.listeners.clear();
1227
- for (const n of e.liveProps.values()) n.unsubscribe();
1228
- e.liveProps.clear();
1229
- for (const n of e.nativeBindings.values())
1230
- n.unsubscribe(), e.node.removeEventListener(n.eventName, n.listener);
1231
- e.nativeBindings.clear();
1232
- for (const n of e.children) g(n, !1);
1233
- t && e.node.remove();
1234
- return;
1235
- }
1236
- if (e.kind === "fragment") {
1237
- for (const n of e.children) g(n, !1);
1238
- if (t)
1239
- for (const n of w(e)) n.remove();
1240
- return;
1241
- }
1242
- t && e.node.remove();
1243
- }
1244
- function V(e, t, n = null) {
1245
- if (t != null)
1246
- for (const r of w(t)) e.insertBefore(r, n);
1247
- }
1248
- function w(e) {
1249
- if (e == null) return [];
1250
- if (e.kind === "text" || e.kind === "element") return [e.node];
1251
- if (e.kind === "component") return w(e.instance._rendered);
1252
- if (e.kind === "function") return w(e.child);
1253
- const t = [];
1254
- let n = e.start;
1255
- for (; n && (t.push(n), n !== e.end); )
1256
- n = n.nextSibling;
1257
- return t;
1258
- }
1259
- function pe(e) {
1260
- return w(e)[0] ?? null;
1261
- }
1262
- function C(e) {
1263
- return e instanceof m ? de(e.props) : y(e) ? e.key : null;
1264
- }
1265
- function de(e) {
1266
- const t = e.key;
1267
- return typeof t == "string" || typeof t == "number" ? t : null;
1268
- }
1269
- function he(e, t) {
1270
- 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) && me(t.type) && e.type === t.type && e.key === C(t) : e.kind === "function" ? y(t) && e.type === t.type && e.key === C(t) : e.kind === "fragment" ? y(t) && t.type === P && e.key === C(t) : y(t) && typeof t.type == "string" && e.type === t.type && e.key === C(t);
1271
- }
1272
- function y(e) {
1273
- return e != null && typeof e == "object" && Object.hasOwn(e, "type");
1274
- }
1275
- function me(e) {
1276
- return typeof e == "function" && (e === m || e.prototype instanceof m);
1277
- }
1278
- function Ge(e) {
1279
- return /^on[A-Z]/.test(e);
1280
- }
1281
- function Je(e) {
1282
- return e === "bind:value" || e === "bind:checked";
1283
- }
1284
- function v(e) {
1285
- return e != null && typeof e == "object" && oe.has(e);
1286
- }
1287
- function k(e) {
1288
- 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";
1289
- }
1290
- function H(e, t) {
1291
- if (!k(e)) throw new TypeError(`${t} requires a readable emitter`);
1292
- }
1293
- function Qe(e, t) {
1294
- if (H(e, t), typeof Reflect.get(e, "set") != "function")
1295
- throw new TypeError(`${t} requires a writable emitter`);
1296
- }
1297
- function Xe(e, t) {
1298
- const n = e.localName;
1299
- if (!(t === "checked" ? n === "input" : n === "input" || n === "textarea" || n === "select")) throw new TypeError(`bind:${t} is not supported on ${n}`);
1300
- }
1301
- function et(e, t) {
1302
- return t === "value" && e.localName !== "select" ? "input" : "change";
1303
- }
1304
- function tt(e) {
1305
- if (e == null || typeof e != "object" && typeof e != "function" || typeof Reflect.get(e, "insertBefore") != "function")
1306
- throw new TypeError("Component parent must be a DOM ParentNode");
1307
- }
1308
- function G(e) {
1309
- try {
1310
- return String(e);
1311
- } catch {
1312
- return Object.prototype.toString.call(e);
1313
- }
1314
- }
1315
- function nt(e) {
1316
- const t = [];
1317
- let n = e;
1318
- for (; n != null && typeof n == "function" && (t.unshift(n), n !== m); )
1319
- n = Object.getPrototypeOf(n);
1320
- return t;
1321
- }
1322
- function rt(...e) {
1323
- return [...new Set(e.flatMap((t) => typeof t == "string" ? t.split(/\s+/) : []).filter(Boolean))].join(" ");
1324
- }
1325
- function N(e) {
1326
- if (e.island === !0) return !0;
1327
- const t = e.className ?? e.class;
1328
- return typeof t == "string" && t.split(/\s+/).includes("island");
1329
- }
1330
- function ye(e, t, n) {
1331
- const r = t == null ? {} : { ...t };
1332
- return n !== void 0 && (r.key = n), A(e, r);
1333
- }
1334
- const ct = ye, ut = ye;
1335
- function ft(e) {
1336
- if (!(e instanceof m))
1337
- throw new TypeError("createPrebuiltElement requires a Component instance");
1338
- return e;
1339
- }
1340
- export {
1341
- m as C,
1342
- P as F,
1343
- re as S,
1344
- ct as a,
1345
- M as b,
1346
- Me as c,
1347
- J as d,
1348
- at as e,
1349
- je as f,
1350
- ve as g,
1351
- A as h,
1352
- y as i,
1353
- ye as j,
1354
- K as k,
1355
- st as l,
1356
- ut as m,
1357
- lt as n,
1358
- ft as o,
1359
- ot as p,
1360
- Ee as s
1361
- };
1362
- //# sourceMappingURL=jsx-dev-runtime-D3UnwrKT.js.map