@openelement/ui 1.0.0-alpha.14 → 1.0.0-alpha.16

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 (43) hide show
  1. package/CUSTOMIZATION.md +106 -112
  2. package/README.md +19 -39
  3. package/custom-elements.json +369 -0
  4. package/package.json +3 -2
  5. package/src/button-machine.js +54 -0
  6. package/src/component-config.js +7 -0
  7. package/src/component-recipes.js +2 -24
  8. package/src/copy-feedback.js +32 -0
  9. package/src/dialog-machine.js +104 -0
  10. package/src/dropdown-machine.js +253 -0
  11. package/src/generated-manifest.json +135 -87
  12. package/src/index.d.ts +7 -8
  13. package/src/index.js +7 -8
  14. package/src/input-machine.js +33 -0
  15. package/src/open-button.css +119 -108
  16. package/src/open-button.d.ts +34 -342
  17. package/src/open-button.generated.js +592 -0
  18. package/src/open-button.js +115 -1140
  19. package/src/open-code-block.css +24 -44
  20. package/src/open-code-block.d.ts +15 -175
  21. package/src/open-code-block.generated.js +293 -0
  22. package/src/open-code-block.js +112 -224
  23. package/src/open-dialog.css +114 -127
  24. package/src/open-dialog.d.ts +22 -261
  25. package/src/open-dialog.generated.js +501 -0
  26. package/src/open-dialog.js +137 -632
  27. package/src/open-dropdown.css +26 -26
  28. package/src/open-dropdown.d.ts +15 -218
  29. package/src/open-dropdown.generated.js +211 -0
  30. package/src/open-dropdown.js +74 -355
  31. package/src/open-input.css +69 -74
  32. package/src/open-input.d.ts +34 -461
  33. package/src/open-input.generated.js +685 -0
  34. package/src/open-input.js +161 -1802
  35. package/src/open-theme-toggle.css +37 -47
  36. package/src/open-theme-toggle.d.ts +19 -190
  37. package/src/open-theme-toggle.generated.js +564 -0
  38. package/src/open-theme-toggle.js +209 -509
  39. package/src/theme-contract.js +40 -0
  40. package/src/theme.css +26 -8
  41. package/src/control-recipe.css +0 -21
  42. package/src/register.d.ts +0 -4
  43. package/src/register.js +0 -22
@@ -0,0 +1,501 @@
1
+ import { assertElementInHtmlNamespace, assertSafeUrlAttribute, assertStaticAttributeSeed, assertTextSlotMarker, attributeValueOf, bindSignalWrites, createRecipe, displayValue, emitComment, escapeAttrValue, escapeText, leafClaimMismatch, leafRuntimeError, markerText, textSlotMarker } from "@openelement/element/internal/compiled/leaf-runtime";
2
+ import { handleDialogCancel } from "./dialog-machine.js";
3
+ import { handleDialogNativeClose } from "./dialog-machine.js";
4
+ import { syncOpenDialog } from "./dialog-machine.js";
5
+ function __oe_rootInstance(__oe_owner, __oe_host) {
6
+ const hostOf = ((event) => ((event.currentTarget).getRootNode()).host);
7
+ const __oe_connectEnv = [];
8
+ __oe_connectEnv.push(((env) => {
9
+ const host = env.host;
10
+ globalThis.requestAnimationFrame(() => syncOpenDialog(host, env.states));
11
+ }));
12
+ if (__oe_host.__oe_onPropertyChange !== undefined)
13
+ __oe_host.__oe_onPropertyChange(((event) => {
14
+ if (event.name !== 'open')
15
+ return;
16
+ syncOpenDialog(event.host, event.states);
17
+ }));
18
+ return { hostOf, __oe_connectEnv };
19
+ }
20
+ function OpenDialog__mount(__oe_scope, __oe_props, __oe_host) {
21
+ const props = __oe_props;
22
+ const __oe_lifecycleEnvHooks = __oe_host.bindings.__oe_connectEnv;
23
+ if (__oe_lifecycleEnvHooks !== undefined) {
24
+ for (const __oe_lifecycleEnvHook of __oe_lifecycleEnvHooks) {
25
+ const __oe_lifecycleEnvCleanup = __oe_lifecycleEnvHook({ host: __oe_host.__oe_hostElement, signal: __oe_scope.signal, states: __oe_host.__oe_states });
26
+ if (typeof __oe_lifecycleEnvCleanup === "function")
27
+ __oe_scope.add(__oe_lifecycleEnvCleanup);
28
+ }
29
+ }
30
+ const __oe_nodes = [];
31
+ const __oe_setup = __oe_host.bindings ?? {};
32
+ const __oe_requireRootSetup = (name) => { if (!Object.hasOwn(__oe_setup, name))
33
+ throw new Error("OEIR_LEAF_MISSING_VALUE: " + name); return __oe_setup[name]; };
34
+ const hostOf = __oe_requireRootSetup("hostOf");
35
+ const __oe_el0 = document.createElement("div");
36
+ __oe_el0.setAttribute("style", "display:contents");
37
+ const __oe_el1 = document.createElement("slot");
38
+ __oe_el1.setAttribute("name", "trigger");
39
+ const __oe_eventHandler2 = ((event) => {
40
+ const host = hostOf(event);
41
+ host.open = !host.open;
42
+ });
43
+ if (typeof __oe_eventHandler2 !== "function")
44
+ throw leafRuntimeError("OEIR_LEAF_EVENT_HANDLER_INVALID", "onClick handler is not callable", { file: "src/open-dialog.tsx", line: 99, column: 9 });
45
+ const __oe_eventListener3 = (event) => __oe_eventHandler2(event);
46
+ __oe_el1.addEventListener("click", __oe_eventListener3);
47
+ __oe_scope.add(() => __oe_el1.removeEventListener("click", __oe_eventListener3));
48
+ __oe_el0.appendChild(__oe_el1);
49
+ const __oe_el4 = document.createElement("dialog");
50
+ __oe_el4.setAttribute("class", "p-6 rounded-xl max-w-[min(90vw,480px)] font-sans");
51
+ function __oe_refresh5() {
52
+ __oe_el4.toggleAttribute("open", Boolean((props.open)));
53
+ }
54
+ __oe_refresh5();
55
+ for (const __oe_propDep of __oe_host.propDeps)
56
+ bindSignalWrites(__oe_scope, __oe_propDep, "props", __oe_refresh5);
57
+ function __oe_refresh6() {
58
+ const __oe_value7 = attributeValueOf((props.label));
59
+ if (__oe_value7 === null)
60
+ __oe_el4.removeAttribute("aria-label");
61
+ else {
62
+ assertSafeUrlAttribute("aria-label", __oe_value7);
63
+ __oe_el4.setAttribute("aria-label", __oe_value7);
64
+ }
65
+ }
66
+ __oe_refresh6();
67
+ for (const __oe_propDep of __oe_host.propDeps)
68
+ bindSignalWrites(__oe_scope, __oe_propDep, "props", __oe_refresh6);
69
+ __oe_el4.setAttribute("part", "overlay");
70
+ const __oe_eventHandler8 = ((event) => handleDialogCancel(hostOf(event), event));
71
+ if (typeof __oe_eventHandler8 !== "function")
72
+ throw leafRuntimeError("OEIR_LEAF_EVENT_HANDLER_INVALID", "onCancel handler is not callable", { file: "src/open-dialog.tsx", line: 109, column: 9 });
73
+ const __oe_eventListener9 = (event) => __oe_eventHandler8(event);
74
+ __oe_el4.addEventListener("cancel", __oe_eventListener9);
75
+ __oe_scope.add(() => __oe_el4.removeEventListener("cancel", __oe_eventListener9));
76
+ const __oe_eventHandler10 = ((event) => handleDialogNativeClose(hostOf(event)));
77
+ if (typeof __oe_eventHandler10 !== "function")
78
+ throw leafRuntimeError("OEIR_LEAF_EVENT_HANDLER_INVALID", "onClose handler is not callable", { file: "src/open-dialog.tsx", line: 110, column: 9 });
79
+ const __oe_eventListener11 = (event) => __oe_eventHandler10(event);
80
+ __oe_el4.addEventListener("close", __oe_eventListener11);
81
+ __oe_scope.add(() => __oe_el4.removeEventListener("close", __oe_eventListener11));
82
+ const __oe_el12 = document.createElement("div");
83
+ __oe_el12.setAttribute("class", "dialog-header mb-4 flex items-center justify-between");
84
+ __oe_el12.setAttribute("part", "header");
85
+ const __oe_el13 = document.createElement("h2");
86
+ __oe_el13.setAttribute("class", "dialog-title m-0 text-xl font-semibold text-foreground");
87
+ const __oe_textStart14 = emitComment(textSlotMarker(0));
88
+ const __oe_text16 = document.createTextNode("");
89
+ const __oe_textEnd15 = emitComment(textSlotMarker(0, true));
90
+ function __oe_refresh17() {
91
+ __oe_text16.nodeValue = displayValue((props.label));
92
+ }
93
+ __oe_refresh17();
94
+ for (const __oe_propDep of __oe_host.propDeps)
95
+ bindSignalWrites(__oe_scope, __oe_propDep, "props", __oe_refresh17);
96
+ __oe_el13.appendChild(__oe_textStart14);
97
+ __oe_el13.appendChild(__oe_text16);
98
+ __oe_el13.appendChild(__oe_textEnd15);
99
+ __oe_el12.appendChild(__oe_el13);
100
+ const __oe_el18 = document.createElement("button");
101
+ __oe_el18.setAttribute("type", "button");
102
+ __oe_el18.setAttribute("class", "dialog-close cursor-pointer rounded-md border-0 bg-transparent p-1 text-xl leading-tight text-muted-foreground transition-colors duration-150 ease-out");
103
+ __oe_el18.setAttribute("part", "close");
104
+ function __oe_refresh19() {
105
+ const __oe_value20 = attributeValueOf((props.closeLabel.trim() || 'Close'));
106
+ if (__oe_value20 === null)
107
+ __oe_el18.removeAttribute("aria-label");
108
+ else {
109
+ assertSafeUrlAttribute("aria-label", __oe_value20);
110
+ __oe_el18.setAttribute("aria-label", __oe_value20);
111
+ }
112
+ }
113
+ __oe_refresh19();
114
+ for (const __oe_propDep of __oe_host.propDeps)
115
+ bindSignalWrites(__oe_scope, __oe_propDep, "props", __oe_refresh19);
116
+ const __oe_eventHandler21 = ((event) => {
117
+ const host = hostOf(event);
118
+ host.open = false;
119
+ host.dispatchEvent(new globalThis.CustomEvent('open-dialog-close', { bubbles: true, composed: true }));
120
+ });
121
+ if (typeof __oe_eventHandler21 !== "function")
122
+ throw leafRuntimeError("OEIR_LEAF_EVENT_HANDLER_INVALID", "onClick handler is not callable", { file: "src/open-dialog.tsx", line: 119, column: 13 });
123
+ const __oe_eventListener22 = (event) => __oe_eventHandler21(event);
124
+ __oe_el18.addEventListener("click", __oe_eventListener22);
125
+ __oe_scope.add(() => __oe_el18.removeEventListener("click", __oe_eventListener22));
126
+ const __oe_text23 = document.createTextNode(" × ");
127
+ __oe_el18.appendChild(__oe_text23);
128
+ __oe_el12.appendChild(__oe_el18);
129
+ __oe_el4.appendChild(__oe_el12);
130
+ const __oe_el24 = document.createElement("div");
131
+ __oe_el24.setAttribute("class", "dialog-body text-base leading-normal text-muted-foreground");
132
+ __oe_el24.setAttribute("part", "body");
133
+ const __oe_el25 = document.createElement("slot");
134
+ __oe_el24.appendChild(__oe_el25);
135
+ __oe_el4.appendChild(__oe_el24);
136
+ const __oe_el26 = document.createElement("div");
137
+ __oe_el26.setAttribute("class", "dialog-footer mt-5 flex justify-end gap-2");
138
+ __oe_el26.setAttribute("part", "footer");
139
+ const __oe_el27 = document.createElement("slot");
140
+ __oe_el27.setAttribute("name", "footer");
141
+ __oe_el26.appendChild(__oe_el27);
142
+ __oe_el4.appendChild(__oe_el26);
143
+ __oe_el0.appendChild(__oe_el4);
144
+ __oe_nodes.push(__oe_el0);
145
+ return __oe_nodes;
146
+ }
147
+ export function createOpenDialogRecipe(__oe_owner, __oe_host) {
148
+ const __oe_propsChanged = __oe_host.propsChanged;
149
+ if (__oe_propsChanged === undefined)
150
+ throw new Error("OEIR_LEAF_MISSING_VALUE: propsChanged");
151
+ const __oe_mountHost = { bindings: __oe_host.bindings, propDeps: [__oe_propsChanged], __oe_hostElement: __oe_host.__oe_hostElement, __oe_states: __oe_host.__oe_states, __oe_onPropertyChange: __oe_host.__oe_onPropertyChange };
152
+ return createRecipe({
153
+ definitionOwner: __oe_owner,
154
+ source: "src/open-dialog.tsx#OpenDialog",
155
+ mount(__oe_scope) {
156
+ return OpenDialog__mount(__oe_scope, __oe_host.props, __oe_mountHost);
157
+ },
158
+ claim(__oe_scope, __oe_props, __oe_parent) {
159
+ return OpenDialog__claim(__oe_scope, __oe_host.props, __oe_mountHost, __oe_parent);
160
+ },
161
+ });
162
+ }
163
+ function OpenDialog__claim(__oe_scope, __oe_props, __oe_host, __oe_parent) {
164
+ const props = __oe_props;
165
+ const __oe_lifecycleEnvHooks = __oe_host.bindings.__oe_connectEnv;
166
+ if (__oe_lifecycleEnvHooks !== undefined) {
167
+ for (const __oe_lifecycleEnvHook of __oe_lifecycleEnvHooks) {
168
+ const __oe_lifecycleEnvCleanup = __oe_lifecycleEnvHook({ host: __oe_host.__oe_hostElement, signal: __oe_scope.signal, states: __oe_host.__oe_states });
169
+ if (typeof __oe_lifecycleEnvCleanup === "function")
170
+ __oe_scope.add(__oe_lifecycleEnvCleanup);
171
+ }
172
+ }
173
+ const __oe_setup = __oe_host.bindings ?? {};
174
+ const __oe_requireRootSetup = (name) => { if (!Object.hasOwn(__oe_setup, name))
175
+ throw new Error("OEIR_LEAF_MISSING_VALUE: " + name); return __oe_setup[name]; };
176
+ const hostOf = __oe_requireRootSetup("hostOf");
177
+ const __oe_adopted0 = [];
178
+ assertElementInHtmlNamespace(__oe_parent, "/", { file: "src/open-dialog.tsx", line: 73, column: 1 });
179
+ let __oe_claimStart2 = __oe_parent.firstChild;
180
+ while (__oe_claimStart2 !== null && __oe_claimStart2.nodeType === 1 && __oe_claimStart2.nodeName === "LINK" && __oe_claimStart2.hasAttribute("data-oe-static-styles"))
181
+ __oe_claimStart2 = __oe_claimStart2.nextSibling;
182
+ const __oe_cursor1 = { node: __oe_claimStart2 };
183
+ const __oe_el3 = __oe_cursor1.node;
184
+ if (__oe_el3 == null)
185
+ throw leafClaimMismatch("missing node at /0", { file: "src/open-dialog.tsx", line: 96, column: 5 });
186
+ __oe_cursor1.node = __oe_el3.nextSibling;
187
+ if (__oe_el3.nodeType !== 1 || String(__oe_el3.localName || __oe_el3.tagName || "").toLowerCase() !== "div")
188
+ throw leafClaimMismatch("expected element 'div' at /0", { file: "src/open-dialog.tsx", line: 96, column: 5 });
189
+ assertElementInHtmlNamespace(__oe_el3, "/0", { file: "src/open-dialog.tsx", line: 96, column: 5 });
190
+ assertStaticAttributeSeed(__oe_el3, [{ name: "style", value: "display:contents" }], "/0", [], { file: "src/open-dialog.tsx", line: 96, column: 5 });
191
+ const __oe_cursor4 = { node: __oe_el3.firstChild };
192
+ const __oe_el5 = __oe_cursor4.node;
193
+ if (__oe_el5 == null)
194
+ throw leafClaimMismatch("missing node at /0/0", { file: "src/open-dialog.tsx", line: 97, column: 7 });
195
+ __oe_cursor4.node = __oe_el5.nextSibling;
196
+ if (__oe_el5.nodeType !== 1 || String(__oe_el5.localName || __oe_el5.tagName || "").toLowerCase() !== "slot")
197
+ throw leafClaimMismatch("expected element 'slot' at /0/0", { file: "src/open-dialog.tsx", line: 97, column: 7 });
198
+ assertElementInHtmlNamespace(__oe_el5, "/0/0", { file: "src/open-dialog.tsx", line: 97, column: 7 });
199
+ assertStaticAttributeSeed(__oe_el5, [{ name: "name", value: "trigger" }], "/0/0", [], { file: "src/open-dialog.tsx", line: 97, column: 7 });
200
+ const __oe_cursor6 = { node: __oe_el5.firstChild };
201
+ if (__oe_cursor6.node !== null)
202
+ throw leafClaimMismatch("extra node at /0/0", { file: "src/open-dialog.tsx", line: 97, column: 7 });
203
+ const __oe_el7 = __oe_cursor4.node;
204
+ if (__oe_el7 == null)
205
+ throw leafClaimMismatch("missing node at /0/1", { file: "src/open-dialog.tsx", line: 104, column: 7 });
206
+ __oe_cursor4.node = __oe_el7.nextSibling;
207
+ if (__oe_el7.nodeType !== 1 || String(__oe_el7.localName || __oe_el7.tagName || "").toLowerCase() !== "dialog")
208
+ throw leafClaimMismatch("expected element 'dialog' at /0/1", { file: "src/open-dialog.tsx", line: 104, column: 7 });
209
+ assertElementInHtmlNamespace(__oe_el7, "/0/1", { file: "src/open-dialog.tsx", line: 104, column: 7 });
210
+ assertStaticAttributeSeed(__oe_el7, [{ name: "class", value: "p-6 rounded-xl max-w-[min(90vw,480px)] font-sans" }, { name: "part", value: "overlay" }], "/0/1", ["open", "aria-label"], { file: "src/open-dialog.tsx", line: 104, column: 7 });
211
+ const __oe_cursor8 = { node: __oe_el7.firstChild };
212
+ const __oe_el9 = __oe_cursor8.node;
213
+ if (__oe_el9 == null)
214
+ throw leafClaimMismatch("missing node at /0/1/0", { file: "src/open-dialog.tsx", line: 112, column: 9 });
215
+ __oe_cursor8.node = __oe_el9.nextSibling;
216
+ if (__oe_el9.nodeType !== 1 || String(__oe_el9.localName || __oe_el9.tagName || "").toLowerCase() !== "div")
217
+ throw leafClaimMismatch("expected element 'div' at /0/1/0", { file: "src/open-dialog.tsx", line: 112, column: 9 });
218
+ assertElementInHtmlNamespace(__oe_el9, "/0/1/0", { file: "src/open-dialog.tsx", line: 112, column: 9 });
219
+ assertStaticAttributeSeed(__oe_el9, [{ name: "class", value: "dialog-header mb-4 flex items-center justify-between" }, { name: "part", value: "header" }], "/0/1/0", [], { file: "src/open-dialog.tsx", line: 112, column: 9 });
220
+ const __oe_cursor10 = { node: __oe_el9.firstChild };
221
+ const __oe_el11 = __oe_cursor10.node;
222
+ if (__oe_el11 == null)
223
+ throw leafClaimMismatch("missing node at /0/1/0/0", { file: "src/open-dialog.tsx", line: 113, column: 11 });
224
+ __oe_cursor10.node = __oe_el11.nextSibling;
225
+ if (__oe_el11.nodeType !== 1 || String(__oe_el11.localName || __oe_el11.tagName || "").toLowerCase() !== "h2")
226
+ throw leafClaimMismatch("expected element 'h2' at /0/1/0/0", { file: "src/open-dialog.tsx", line: 113, column: 11 });
227
+ assertElementInHtmlNamespace(__oe_el11, "/0/1/0/0", { file: "src/open-dialog.tsx", line: 113, column: 11 });
228
+ assertStaticAttributeSeed(__oe_el11, [{ name: "class", value: "dialog-title m-0 text-xl font-semibold text-foreground" }], "/0/1/0/0", [], { file: "src/open-dialog.tsx", line: 113, column: 11 });
229
+ const __oe_cursor12 = { node: __oe_el11.firstChild };
230
+ const __oe_textStart13 = __oe_cursor12.node;
231
+ if (__oe_textStart13 == null)
232
+ throw leafClaimMismatch("missing node at /0/1/0/0/0/text-start", { file: "src/open-dialog.tsx", line: 113, column: 79 });
233
+ __oe_cursor12.node = __oe_textStart13.nextSibling;
234
+ assertTextSlotMarker(__oe_textStart13, 0, false, "/0/1/0/0/0/text-start", { file: "src/open-dialog.tsx", line: 113, column: 79 });
235
+ let __oe_slotText14 = null;
236
+ const __oe_maybeText15 = __oe_cursor12.node;
237
+ if (__oe_maybeText15 !== null && __oe_maybeText15.nodeType === 3) {
238
+ __oe_slotText14 = __oe_maybeText15;
239
+ __oe_cursor12.node = __oe_maybeText15.nextSibling;
240
+ }
241
+ const __oe_textEnd16 = __oe_cursor12.node;
242
+ if (__oe_textEnd16 == null)
243
+ throw leafClaimMismatch("missing node at /0/1/0/0/0/text-end", { file: "src/open-dialog.tsx", line: 113, column: 79 });
244
+ __oe_cursor12.node = __oe_textEnd16.nextSibling;
245
+ assertTextSlotMarker(__oe_textEnd16, 0, true, "/0/1/0/0/0/text-end", { file: "src/open-dialog.tsx", line: 113, column: 79 });
246
+ if (__oe_cursor12.node !== null)
247
+ throw leafClaimMismatch("extra node at /0/1/0/0", { file: "src/open-dialog.tsx", line: 113, column: 11 });
248
+ const __oe_el17 = __oe_cursor10.node;
249
+ if (__oe_el17 == null)
250
+ throw leafClaimMismatch("missing node at /0/1/0/1", { file: "src/open-dialog.tsx", line: 114, column: 11 });
251
+ __oe_cursor10.node = __oe_el17.nextSibling;
252
+ if (__oe_el17.nodeType !== 1 || String(__oe_el17.localName || __oe_el17.tagName || "").toLowerCase() !== "button")
253
+ throw leafClaimMismatch("expected element 'button' at /0/1/0/1", { file: "src/open-dialog.tsx", line: 114, column: 11 });
254
+ assertElementInHtmlNamespace(__oe_el17, "/0/1/0/1", { file: "src/open-dialog.tsx", line: 114, column: 11 });
255
+ assertStaticAttributeSeed(__oe_el17, [{ name: "type", value: "button" }, { name: "class", value: "dialog-close cursor-pointer rounded-md border-0 bg-transparent p-1 text-xl leading-tight text-muted-foreground transition-colors duration-150 ease-out" }, { name: "part", value: "close" }], "/0/1/0/1", ["aria-label"], { file: "src/open-dialog.tsx", line: 114, column: 11 });
256
+ const __oe_cursor18 = { node: __oe_el17.firstChild };
257
+ const __oe_text19 = __oe_cursor18.node;
258
+ if (__oe_text19 == null)
259
+ throw leafClaimMismatch("missing node at /0/1/0/1/0", { file: "src/open-dialog.tsx", line: 132, column: 13 });
260
+ __oe_cursor18.node = __oe_text19.nextSibling;
261
+ if (__oe_text19.nodeType !== 3 || __oe_text19.nodeValue !== " × ")
262
+ throw leafClaimMismatch("static text at /0/1/0/1/0", { file: "src/open-dialog.tsx", line: 132, column: 13 });
263
+ if (__oe_cursor18.node !== null)
264
+ throw leafClaimMismatch("extra node at /0/1/0/1", { file: "src/open-dialog.tsx", line: 114, column: 11 });
265
+ if (__oe_cursor10.node !== null)
266
+ throw leafClaimMismatch("extra node at /0/1/0", { file: "src/open-dialog.tsx", line: 112, column: 9 });
267
+ const __oe_el20 = __oe_cursor8.node;
268
+ if (__oe_el20 == null)
269
+ throw leafClaimMismatch("missing node at /0/1/1", { file: "src/open-dialog.tsx", line: 135, column: 9 });
270
+ __oe_cursor8.node = __oe_el20.nextSibling;
271
+ if (__oe_el20.nodeType !== 1 || String(__oe_el20.localName || __oe_el20.tagName || "").toLowerCase() !== "div")
272
+ throw leafClaimMismatch("expected element 'div' at /0/1/1", { file: "src/open-dialog.tsx", line: 135, column: 9 });
273
+ assertElementInHtmlNamespace(__oe_el20, "/0/1/1", { file: "src/open-dialog.tsx", line: 135, column: 9 });
274
+ assertStaticAttributeSeed(__oe_el20, [{ name: "class", value: "dialog-body text-base leading-normal text-muted-foreground" }, { name: "part", value: "body" }], "/0/1/1", [], { file: "src/open-dialog.tsx", line: 135, column: 9 });
275
+ const __oe_cursor21 = { node: __oe_el20.firstChild };
276
+ const __oe_el22 = __oe_cursor21.node;
277
+ if (__oe_el22 == null)
278
+ throw leafClaimMismatch("missing node at /0/1/1/0", { file: "src/open-dialog.tsx", line: 136, column: 11 });
279
+ __oe_cursor21.node = __oe_el22.nextSibling;
280
+ if (__oe_el22.nodeType !== 1 || String(__oe_el22.localName || __oe_el22.tagName || "").toLowerCase() !== "slot")
281
+ throw leafClaimMismatch("expected element 'slot' at /0/1/1/0", { file: "src/open-dialog.tsx", line: 136, column: 11 });
282
+ assertElementInHtmlNamespace(__oe_el22, "/0/1/1/0", { file: "src/open-dialog.tsx", line: 136, column: 11 });
283
+ assertStaticAttributeSeed(__oe_el22, [], "/0/1/1/0", [], { file: "src/open-dialog.tsx", line: 136, column: 11 });
284
+ const __oe_cursor23 = { node: __oe_el22.firstChild };
285
+ if (__oe_cursor23.node !== null)
286
+ throw leafClaimMismatch("extra node at /0/1/1/0", { file: "src/open-dialog.tsx", line: 136, column: 11 });
287
+ if (__oe_cursor21.node !== null)
288
+ throw leafClaimMismatch("extra node at /0/1/1", { file: "src/open-dialog.tsx", line: 135, column: 9 });
289
+ const __oe_el24 = __oe_cursor8.node;
290
+ if (__oe_el24 == null)
291
+ throw leafClaimMismatch("missing node at /0/1/2", { file: "src/open-dialog.tsx", line: 138, column: 9 });
292
+ __oe_cursor8.node = __oe_el24.nextSibling;
293
+ if (__oe_el24.nodeType !== 1 || String(__oe_el24.localName || __oe_el24.tagName || "").toLowerCase() !== "div")
294
+ throw leafClaimMismatch("expected element 'div' at /0/1/2", { file: "src/open-dialog.tsx", line: 138, column: 9 });
295
+ assertElementInHtmlNamespace(__oe_el24, "/0/1/2", { file: "src/open-dialog.tsx", line: 138, column: 9 });
296
+ assertStaticAttributeSeed(__oe_el24, [{ name: "class", value: "dialog-footer mt-5 flex justify-end gap-2" }, { name: "part", value: "footer" }], "/0/1/2", [], { file: "src/open-dialog.tsx", line: 138, column: 9 });
297
+ const __oe_cursor25 = { node: __oe_el24.firstChild };
298
+ const __oe_el26 = __oe_cursor25.node;
299
+ if (__oe_el26 == null)
300
+ throw leafClaimMismatch("missing node at /0/1/2/0", { file: "src/open-dialog.tsx", line: 139, column: 11 });
301
+ __oe_cursor25.node = __oe_el26.nextSibling;
302
+ if (__oe_el26.nodeType !== 1 || String(__oe_el26.localName || __oe_el26.tagName || "").toLowerCase() !== "slot")
303
+ throw leafClaimMismatch("expected element 'slot' at /0/1/2/0", { file: "src/open-dialog.tsx", line: 139, column: 11 });
304
+ assertElementInHtmlNamespace(__oe_el26, "/0/1/2/0", { file: "src/open-dialog.tsx", line: 139, column: 11 });
305
+ assertStaticAttributeSeed(__oe_el26, [{ name: "name", value: "footer" }], "/0/1/2/0", [], { file: "src/open-dialog.tsx", line: 139, column: 11 });
306
+ const __oe_cursor27 = { node: __oe_el26.firstChild };
307
+ if (__oe_cursor27.node !== null)
308
+ throw leafClaimMismatch("extra node at /0/1/2/0", { file: "src/open-dialog.tsx", line: 139, column: 11 });
309
+ if (__oe_cursor25.node !== null)
310
+ throw leafClaimMismatch("extra node at /0/1/2", { file: "src/open-dialog.tsx", line: 138, column: 9 });
311
+ if (__oe_cursor8.node !== null)
312
+ throw leafClaimMismatch("extra node at /0/1", { file: "src/open-dialog.tsx", line: 104, column: 7 });
313
+ if (__oe_cursor4.node !== null)
314
+ throw leafClaimMismatch("extra node at /0", { file: "src/open-dialog.tsx", line: 96, column: 5 });
315
+ __oe_adopted0.push(__oe_el3);
316
+ if (__oe_cursor1.node !== null)
317
+ throw leafClaimMismatch("extra node at /", { file: "src/open-dialog.tsx", line: 73, column: 1 });
318
+ const __oe_eventHandler28 = ((event) => {
319
+ const host = hostOf(event);
320
+ host.open = !host.open;
321
+ });
322
+ if (typeof __oe_eventHandler28 !== "function")
323
+ throw leafRuntimeError("OEIR_LEAF_EVENT_HANDLER_INVALID", "onClick handler is not callable", { file: "src/open-dialog.tsx", line: 99, column: 9 });
324
+ const __oe_eventListener29 = (event) => __oe_eventHandler28(event);
325
+ __oe_el5.addEventListener("click", __oe_eventListener29);
326
+ __oe_scope.add(() => __oe_el5.removeEventListener("click", __oe_eventListener29));
327
+ function __oe_refresh30() {
328
+ const __oe_value31 = Boolean((props.open));
329
+ if (__oe_el7.hasAttribute("open") !== __oe_value31)
330
+ __oe_el7.toggleAttribute("open", __oe_value31);
331
+ }
332
+ __oe_refresh30();
333
+ for (const __oe_propDep of __oe_host.propDeps)
334
+ bindSignalWrites(__oe_scope, __oe_propDep, "props", __oe_refresh30);
335
+ function __oe_refresh32() {
336
+ const __oe_value33 = attributeValueOf((props.label));
337
+ if (__oe_value33 === null) {
338
+ if (__oe_el7.hasAttribute("aria-label"))
339
+ __oe_el7.removeAttribute("aria-label");
340
+ }
341
+ else if (__oe_el7.getAttribute("aria-label") !== __oe_value33) {
342
+ assertSafeUrlAttribute("aria-label", __oe_value33);
343
+ __oe_el7.setAttribute("aria-label", __oe_value33);
344
+ }
345
+ }
346
+ __oe_refresh32();
347
+ for (const __oe_propDep of __oe_host.propDeps)
348
+ bindSignalWrites(__oe_scope, __oe_propDep, "props", __oe_refresh32);
349
+ const __oe_eventHandler34 = ((event) => handleDialogCancel(hostOf(event), event));
350
+ if (typeof __oe_eventHandler34 !== "function")
351
+ throw leafRuntimeError("OEIR_LEAF_EVENT_HANDLER_INVALID", "onCancel handler is not callable", { file: "src/open-dialog.tsx", line: 109, column: 9 });
352
+ const __oe_eventListener35 = (event) => __oe_eventHandler34(event);
353
+ __oe_el7.addEventListener("cancel", __oe_eventListener35);
354
+ __oe_scope.add(() => __oe_el7.removeEventListener("cancel", __oe_eventListener35));
355
+ const __oe_eventHandler36 = ((event) => handleDialogNativeClose(hostOf(event)));
356
+ if (typeof __oe_eventHandler36 !== "function")
357
+ throw leafRuntimeError("OEIR_LEAF_EVENT_HANDLER_INVALID", "onClose handler is not callable", { file: "src/open-dialog.tsx", line: 110, column: 9 });
358
+ const __oe_eventListener37 = (event) => __oe_eventHandler36(event);
359
+ __oe_el7.addEventListener("close", __oe_eventListener37);
360
+ __oe_scope.add(() => __oe_el7.removeEventListener("close", __oe_eventListener37));
361
+ function __oe_refresh38() {
362
+ const __oe_value39 = displayValue((props.label));
363
+ if (__oe_slotText14 === null) {
364
+ if (__oe_value39 !== "") {
365
+ const __oe_text40 = document.createTextNode(__oe_value39);
366
+ __oe_textEnd16.parentNode.insertBefore(__oe_text40, __oe_textEnd16);
367
+ __oe_scope.addRangeCleanup(() => __oe_text40.remove());
368
+ __oe_slotText14 = __oe_text40;
369
+ }
370
+ }
371
+ else if (__oe_slotText14.nodeValue !== __oe_value39) {
372
+ __oe_slotText14.nodeValue = __oe_value39;
373
+ }
374
+ }
375
+ __oe_refresh38();
376
+ for (const __oe_propDep of __oe_host.propDeps)
377
+ bindSignalWrites(__oe_scope, __oe_propDep, "props", __oe_refresh38);
378
+ function __oe_refresh41() {
379
+ const __oe_value42 = attributeValueOf((props.closeLabel.trim() || 'Close'));
380
+ if (__oe_value42 === null) {
381
+ if (__oe_el17.hasAttribute("aria-label"))
382
+ __oe_el17.removeAttribute("aria-label");
383
+ }
384
+ else if (__oe_el17.getAttribute("aria-label") !== __oe_value42) {
385
+ assertSafeUrlAttribute("aria-label", __oe_value42);
386
+ __oe_el17.setAttribute("aria-label", __oe_value42);
387
+ }
388
+ }
389
+ __oe_refresh41();
390
+ for (const __oe_propDep of __oe_host.propDeps)
391
+ bindSignalWrites(__oe_scope, __oe_propDep, "props", __oe_refresh41);
392
+ const __oe_eventHandler43 = ((event) => {
393
+ const host = hostOf(event);
394
+ host.open = false;
395
+ host.dispatchEvent(new globalThis.CustomEvent('open-dialog-close', { bubbles: true, composed: true }));
396
+ });
397
+ if (typeof __oe_eventHandler43 !== "function")
398
+ throw leafRuntimeError("OEIR_LEAF_EVENT_HANDLER_INVALID", "onClick handler is not callable", { file: "src/open-dialog.tsx", line: 119, column: 13 });
399
+ const __oe_eventListener44 = (event) => __oe_eventHandler43(event);
400
+ __oe_el17.addEventListener("click", __oe_eventListener44);
401
+ __oe_scope.add(() => __oe_el17.removeEventListener("click", __oe_eventListener44));
402
+ return __oe_adopted0;
403
+ }
404
+ export function OpenDialog__ssr(__oe_props, __oe_host) {
405
+ const props = __oe_props;
406
+ const __oe_out0 = [];
407
+ __oe_out0.push("<div");
408
+ __oe_out0.push(" style=\"", escapeAttrValue("display:contents"), "\"");
409
+ __oe_out0.push(">");
410
+ __oe_out0.push("<slot");
411
+ __oe_out0.push(" name=\"", escapeAttrValue("trigger"), "\"");
412
+ __oe_out0.push(">");
413
+ __oe_out0.push("</slot>");
414
+ __oe_out0.push("<dialog");
415
+ __oe_out0.push(" class=\"", escapeAttrValue("p-6 rounded-xl max-w-[min(90vw,480px)] font-sans"), "\"");
416
+ if (Boolean((props.open)))
417
+ __oe_out0.push(" open=\"\"");
418
+ const __oe_value1 = attributeValueOf((props.label));
419
+ if (__oe_value1 !== null) {
420
+ assertSafeUrlAttribute("aria-label", __oe_value1);
421
+ __oe_out0.push(" aria-label=\"", escapeAttrValue(__oe_value1), "\"");
422
+ }
423
+ __oe_out0.push(" part=\"", escapeAttrValue("overlay"), "\"");
424
+ __oe_out0.push(">");
425
+ __oe_out0.push("<div");
426
+ __oe_out0.push(" class=\"", escapeAttrValue("dialog-header mb-4 flex items-center justify-between"), "\"");
427
+ __oe_out0.push(" part=\"", escapeAttrValue("header"), "\"");
428
+ __oe_out0.push(">");
429
+ __oe_out0.push("<h2");
430
+ __oe_out0.push(" class=\"", escapeAttrValue("dialog-title m-0 text-xl font-semibold text-foreground"), "\"");
431
+ __oe_out0.push(">");
432
+ __oe_out0.push("<!--", markerText(textSlotMarker(0)), "-->");
433
+ __oe_out0.push(escapeText(displayValue((props.label))));
434
+ __oe_out0.push("<!--", markerText(textSlotMarker(0, true)), "-->");
435
+ __oe_out0.push("</h2>");
436
+ __oe_out0.push("<button");
437
+ __oe_out0.push(" type=\"", escapeAttrValue("button"), "\"");
438
+ __oe_out0.push(" class=\"", escapeAttrValue("dialog-close cursor-pointer rounded-md border-0 bg-transparent p-1 text-xl leading-tight text-muted-foreground transition-colors duration-150 ease-out"), "\"");
439
+ __oe_out0.push(" part=\"", escapeAttrValue("close"), "\"");
440
+ const __oe_value2 = attributeValueOf((props.closeLabel.trim() || 'Close'));
441
+ if (__oe_value2 !== null) {
442
+ assertSafeUrlAttribute("aria-label", __oe_value2);
443
+ __oe_out0.push(" aria-label=\"", escapeAttrValue(__oe_value2), "\"");
444
+ }
445
+ __oe_out0.push(">");
446
+ __oe_out0.push(escapeText(" × "));
447
+ __oe_out0.push("</button>");
448
+ __oe_out0.push("</div>");
449
+ __oe_out0.push("<div");
450
+ __oe_out0.push(" class=\"", escapeAttrValue("dialog-body text-base leading-normal text-muted-foreground"), "\"");
451
+ __oe_out0.push(" part=\"", escapeAttrValue("body"), "\"");
452
+ __oe_out0.push(">");
453
+ __oe_out0.push("<slot");
454
+ __oe_out0.push(">");
455
+ __oe_out0.push("</slot>");
456
+ __oe_out0.push("</div>");
457
+ __oe_out0.push("<div");
458
+ __oe_out0.push(" class=\"", escapeAttrValue("dialog-footer mt-5 flex justify-end gap-2"), "\"");
459
+ __oe_out0.push(" part=\"", escapeAttrValue("footer"), "\"");
460
+ __oe_out0.push(">");
461
+ __oe_out0.push("<slot");
462
+ __oe_out0.push(" name=\"", escapeAttrValue("footer"), "\"");
463
+ __oe_out0.push(">");
464
+ __oe_out0.push("</slot>");
465
+ __oe_out0.push("</div>");
466
+ __oe_out0.push("</dialog>");
467
+ __oe_out0.push("</div>");
468
+ return __oe_out0.join("");
469
+ }
470
+ import { createGeneratedElementClassWithFeatures as __oe_createElementClass, generatedElementProperties as __oe_propertiesFeature, serializeGeneratedElementHtml, seedGeneratedElementHostProperties } from "@openelement/element/internal/compiled/generated-element/shell";
471
+ const __oeElementDescriptor = {
472
+ tag: "open-dialog",
473
+ root: "shadow-open",
474
+ delegatesFocus: true,
475
+ properties: [
476
+ { name: "open", attribute: "open", type: "boolean", reflect: true, default: false },
477
+ { name: "label", attribute: "label", type: "string", reflect: false, default: "" },
478
+ { name: "closeLabel", attribute: "close-label", type: "string", reflect: false, default: "Close" },
479
+ ],
480
+ createRecipe: createOpenDialogRecipe,
481
+ createInstance: __oe_rootInstance,
482
+ };
483
+ const __oeOpenDialogElement = __oe_createElementClass(__oeElementDescriptor, { properties: __oe_propertiesFeature });
484
+ export default __oeOpenDialogElement;
485
+ export { __oeOpenDialogElement as OpenDialogElement };
486
+ export const __oeElementTag = "open-dialog";
487
+ export function OpenDialog__ssrHost(props, lightChildren, attributes, styleLinks, nestedHost) {
488
+ if (!Array.isArray(styleLinks) || styleLinks.length === 0)
489
+ throw new Error("OEIR_LEAF_MISSING_VALUE: styleLinks (the styled generated element received no declared stylesheet URLs; mixed generated-element/entry artifacts or a missing style-link carrier)");
490
+ const __oeHostProps = seedGeneratedElementHostProperties(__oeElementDescriptor.properties, props, attributes);
491
+ const __oeHostAttrs = __oeHostProps.__oeHostAttributes;
492
+ return serializeGeneratedElementHtml({
493
+ tag: "open-dialog",
494
+ root: "open",
495
+ dsd: { delegatesFocus: true },
496
+ content: OpenDialog__ssr(__oeHostProps, nestedHost === undefined ? undefined : { "__oe_nestedHost": nestedHost }),
497
+ ...(lightChildren === undefined ? {} : { lightChildren }),
498
+ ...(attributes === undefined && __oeHostAttrs === undefined ? {} : { attributes: __oeHostAttrs === undefined ? attributes : __oeHostAttrs }),
499
+ ...(styleLinks === undefined ? {} : { styleLinks }),
500
+ });
501
+ }