@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
@@ -1,120 +1,131 @@
1
- /* open-button — authored component styles, ported verbatim from the pre-#1558
2
- * recipe() sheet (the alpha.9 design system). The #1558 migration had
3
- * replaced this with a placeholder shell under the false note that the
4
- * component "carried no authored styles"; it did — this is that sheet. */
5
- :host {
6
- display: inline-block;
7
- }
1
+ /* open-button — the irreducible authored rules (alpha15 S lane).
2
+ *
3
+ * The base treatment (inline flex box, gap, typography, radius, cursor,
4
+ * white-space, the focus ring and the disabled/aria-disabled states) is
5
+ * authored as Tailwind utilities on the control in open-button.tsx: the
6
+ * compiler admits those static tokens and the build's component stylesheet
7
+ * carries the generated rules into this shadow root.
8
+ *
9
+ * What stays here, and why (CUSTOMIZATION.md → "Why the residue is CSS"): every
10
+ * block below HAS a utility spelling — `[:host([size='sm'])_&]:p-1` compiles,
11
+ * measured — and the sheet keeps it because the utility form costs an escaped
12
+ * ancestor selector per utility, per branch, on both rendered controls: ≈6.5×
13
+ * the bytes for the same three size branches, and far less legible.
14
+ * - the host box and the `[hidden]` display rule (a shadow-tree element's
15
+ * `hidden` attribute needs an explicit rule once `display` is set);
16
+ * - the SIZE treatments, selected by the HOST's `size` attribute;
17
+ * - the VARIANT surfaces and their hovers, selected the same way;
18
+ * - the derived two-colour base surface (popover/border mixes and the inset
19
+ * highlight) and the primary hover's brand mix, computed from pairs of role
20
+ * variables — one owned formula instead of a repeated escaped arbitrary
21
+ * value;
22
+ * - `:host(:state(disabled))`, the form-associated custom state.
23
+ * One owner per property: nothing here is also authored as a utility.
24
+ */
25
+ :host {
26
+ display: inline-block;
27
+ }
8
28
 
9
- .btn {
10
- display: inline-flex;
11
- align-items: center;
12
- justify-content: center;
13
- gap: calc(var(--spacing) * 2);
14
- font-family: var(--font-sans);
15
- font-weight: var(--font-weight-extrabold);
16
- text-decoration: none;
17
- cursor: pointer;
18
- border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary));
19
- background: color-mix(in srgb, var(--color-popover) 78%, transparent);
20
- color: var(--color-foreground);
21
- border-radius: var(--radius-md);
22
- box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 12%, transparent);
23
- transition: color var(--ease-out) var(--default-transition-duration), border-color var(--ease-out) var(--default-transition-duration), background var(--ease-out) var(--default-transition-duration), transform var(--ease-out) var(--default-transition-duration), box-shadow var(--ease-out) var(--default-transition-duration);
24
- white-space: nowrap;
25
- letter-spacing: 0;
26
- }
29
+ .btn[hidden] {
30
+ display: none;
31
+ }
27
32
 
28
- .btn[hidden] {
29
- display: none;
30
- }
33
+ /* The base control surface: derived from pairs of role variables. */
34
+ .btn {
35
+ border: calc(var(--spacing) * 0.25) solid
36
+ color-mix(in srgb, var(--color-border) 72%, var(--color-primary));
37
+ background: color-mix(in srgb, var(--color-popover) 78%, transparent);
38
+ color: var(--color-foreground);
39
+ box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 12%, transparent);
40
+ transition:
41
+ color var(--ease-out) var(--default-transition-duration),
42
+ border-color var(--ease-out) var(--default-transition-duration),
43
+ background var(--ease-out) var(--default-transition-duration),
44
+ transform var(--ease-out) var(--default-transition-duration),
45
+ box-shadow var(--ease-out) var(--default-transition-duration);
46
+ letter-spacing: 0;
47
+ }
31
48
 
32
- /* Sizes */
33
- :host([size='sm']) .btn {
34
- padding: calc(var(--spacing) * 1) calc(var(--spacing) * 3);
35
- font-size: var(--text-sm);
36
- min-height: 30px;
37
- }
49
+ /* Sizes (host-attribute scoped). */
50
+ :host([size='sm']) .btn {
51
+ padding: calc(var(--spacing) * 1) calc(var(--spacing) * 3);
52
+ font-size: var(--text-sm);
53
+ min-height: 30px;
54
+ }
38
55
 
39
- :host(:not([size])) .btn,
40
- :host([size='md']) .btn {
41
- padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
42
- font-size: var(--text-base);
43
- min-height: 38px;
44
- }
56
+ :host(:not([size])) .btn,
57
+ :host([size='md']) .btn {
58
+ padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
59
+ font-size: var(--text-base);
60
+ min-height: 38px;
61
+ }
45
62
 
46
- :host([size='lg']) .btn {
47
- padding: calc(var(--spacing) * 3) calc(var(--spacing) * 5);
48
- font-size: var(--text-xl);
49
- min-height: 48px;
50
- }
63
+ :host([size='lg']) .btn {
64
+ padding: calc(var(--spacing) * 3) calc(var(--spacing) * 5);
65
+ font-size: var(--text-xl);
66
+ min-height: 48px;
67
+ }
51
68
 
52
- /* Variants (default is the base .btn treatment) */
53
- :host(:not([variant])) .btn:hover,
54
- :host([variant='default']) .btn:hover {
55
- color: color-mix(in srgb, var(--color-primary) 50%, var(--color-foreground));
56
- border-color: var(--color-violet-400);
57
- background: color-mix(in srgb, color-mix(in srgb, var(--color-primary) 16%, transparent) 52%, var(--color-popover));
58
- }
69
+ /* Variants (host-attribute scoped; default is the base .btn treatment). */
70
+ :host(:not([variant])) .btn:hover,
71
+ :host([variant='default']) .btn:hover {
72
+ color: color-mix(in srgb, var(--color-primary) 50%, var(--color-foreground));
73
+ border-color: var(--color-violet-400);
74
+ background: color-mix(
75
+ in srgb,
76
+ color-mix(in srgb, var(--color-primary) 16%, transparent) 52%,
77
+ var(--color-popover)
78
+ );
79
+ }
59
80
 
60
- /* Flat brand fill, not a light-swept gradient: a violet-400 gradient end
61
- carried white ink at 2.17:1 in light mode (and the dark mirror would
62
- have needed a dark ink on a light tint). --color-primary and its 80%
63
- foreground mix are the two steps that clear AA against
64
- --color-primary-foreground in both themes. */
65
- :host([variant='primary']) .btn {
66
- background: var(--color-primary);
67
- color: var(--color-primary-foreground);
68
- border-color: transparent;
69
- box-shadow: 0 calc(var(--spacing) * 2) calc(var(--spacing) * 5) color-mix(in srgb, var(--color-primary) 22%, transparent);
70
- }
81
+ /* Flat brand fill, not a light-swept gradient: a violet-400 gradient end
82
+ carried white ink at 2.17:1 in light mode (and the dark mirror would
83
+ have needed a dark ink on a light tint). --color-primary and its 80%
84
+ foreground mix are the two steps that clear AA against
85
+ --color-primary-foreground in both themes. */
86
+ :host([variant='primary']) .btn {
87
+ background: var(--color-primary);
88
+ color: var(--color-primary-foreground);
89
+ border-color: transparent;
90
+ box-shadow: 0 calc(var(--spacing) * 2) calc(var(--spacing) * 5)
91
+ color-mix(in srgb, var(--color-primary) 22%, transparent);
92
+ }
71
93
 
72
- :host([variant='primary']) .btn:hover {
73
- background: color-mix(in srgb, var(--color-primary) 80%, var(--color-foreground));
74
- border-color: transparent;
75
- transform: translateY(calc(var(--spacing) * -0.25));
76
- box-shadow: 0 calc(var(--spacing) * 3) calc(var(--spacing) * 6) color-mix(in srgb, var(--color-primary) 28%, transparent);
77
- }
94
+ :host([variant='primary']) .btn:hover {
95
+ background: color-mix(in srgb, var(--color-primary) 80%, var(--color-foreground));
96
+ border-color: transparent;
97
+ transform: translateY(calc(var(--spacing) * -0.25));
98
+ box-shadow: 0 calc(var(--spacing) * 3) calc(var(--spacing) * 6)
99
+ color-mix(in srgb, var(--color-primary) 28%, transparent);
100
+ }
78
101
 
79
- :host([variant='ghost']) .btn {
80
- border-color: transparent;
81
- }
102
+ :host([variant='ghost']) .btn {
103
+ border-color: transparent;
104
+ }
82
105
 
83
- :host([variant='ghost']) .btn:hover {
84
- background: color-mix(in srgb, color-mix(in srgb, var(--color-primary) 16%, transparent) 38%, transparent);
85
- border-color: transparent;
86
- }
106
+ :host([variant='ghost']) .btn:hover {
107
+ background: color-mix(in srgb, color-mix(in srgb, var(--color-primary) 16%, transparent) 38%, transparent);
108
+ border-color: transparent;
109
+ }
87
110
 
88
- :host([variant='accent']) .btn {
89
- background: var(--color-primary);
90
- color: var(--color-primary-foreground);
91
- border-color: transparent;
92
- }
93
- :host([variant='accent']) .btn:hover {
94
- transform: translateY(-1px);
95
- filter: brightness(1.05);
96
- }
97
- :host([variant='accent']) .btn:active {
98
- transform: translateY(0);
99
- box-shadow: var(--shadow-sm);
100
- }
111
+ :host([variant='accent']) .btn {
112
+ background: var(--color-primary);
113
+ color: var(--color-primary-foreground);
114
+ border-color: transparent;
115
+ }
116
+ :host([variant='accent']) .btn:hover {
117
+ transform: translateY(-1px);
118
+ filter: brightness(1.05);
119
+ }
120
+ :host([variant='accent']) .btn:active {
121
+ transform: translateY(0);
122
+ box-shadow: var(--shadow-sm);
123
+ }
101
124
 
102
- /* States */
103
- .btn:disabled,
104
- .btn[aria-disabled='true'] {
105
- opacity: 0.5;
106
- cursor: not-allowed;
107
- pointer-events: none;
108
- }
109
-
110
- .btn:focus-visible {
111
- outline: calc(var(--spacing) * 0.5) solid var(--color-ring);
112
- outline-offset: calc(var(--spacing) * 0.75);
113
- }
114
-
115
- :host(:state(disabled)) .btn {
116
- opacity: 0.5;
117
- cursor: not-allowed;
118
- pointer-events: none;
119
- }
120
-
125
+ /* The form-associated custom state: the host's ElementInternals state, which
126
+ no element-level utility can express. */
127
+ :host(:state(disabled)) .btn {
128
+ opacity: 0.5;
129
+ cursor: not-allowed;
130
+ pointer-events: none;
131
+ }
@@ -1,359 +1,51 @@
1
- import { OpenElement, ReadonlySignal, StyleSheetLike } from "@openelement/element";
2
1
  //#region src/open-button.d.ts
3
- declare const __partProgram: {
4
- version: number;
5
- tag: string;
6
- root: {
7
- id: string;
8
- kind: string;
9
- nodes: string[];
10
- };
11
- template: {
12
- k: string;
13
- id: string;
14
- tag: string;
15
- attrs: string[][];
16
- children: {
17
- k: string;
18
- id: string;
19
- tag: string;
20
- attrs: string[][];
21
- children: {
22
- k: string;
23
- id: string;
24
- tag: string;
25
- attrs: never[];
26
- children: never[];
27
- }[];
28
- }[];
29
- }[];
30
- parts: ({
31
- k: string;
32
- signal: string;
33
- name: string;
34
- path: number[];
35
- index: number;
36
- location: {
37
- id: string;
38
- kind: string;
39
- path: number[];
40
- node: string;
2
+ /**
3
+ * Platform facts for the generated element: shadow root with delegated focus,
4
+ * form association (the class lane's `formAssociated: true`, so `form.elements`
5
+ * membership and the effective-disabled custom state are unchanged), the
6
+ * authored stylesheet, and the six declared property rows — all reflected, the
7
+ * class lane's exact attribute surface.
8
+ */
9
+ export declare const openElement: {
10
+ root: "shadow";
11
+ delegatesFocus: true;
12
+ formAssociated: true;
13
+ styles: string[];
14
+ properties: {
15
+ variant: {
16
+ default: string;
17
+ reflect: true;
41
18
  };
42
- event?: undefined;
43
- handler?: undefined;
44
- action?: undefined;
45
- } | {
46
- k: string;
47
- event: string;
48
- handler: string;
49
- action: {
50
- kind: string;
51
- name: string;
19
+ size: {
20
+ default: string;
21
+ reflect: true;
52
22
  };
53
- path: number[];
54
- index: number;
55
- location: {
56
- id: string;
57
- kind: string;
58
- path: number[];
59
- node: string;
23
+ disabled: {
24
+ default: false;
25
+ reflect: true;
60
26
  };
61
- signal?: undefined;
62
- name?: undefined;
63
- })[];
64
- regions: never[];
65
- dependencies: {
66
- signal: string;
67
- owner: {
68
- kind: string;
69
- index: number;
27
+ href: {
28
+ default: string;
29
+ reflect: true;
70
30
  };
71
- location: string;
72
- }[];
73
- locations: ({
74
- id: string;
75
- kind: string;
76
- tag: string;
77
- path: number[];
78
- part?: undefined;
79
- node?: undefined;
80
- } | {
81
- id: string;
82
- kind: string;
83
- part: number;
84
- node: string;
85
- path: number[];
86
- tag?: undefined;
87
- })[];
88
- metadata: {
89
- tag: string;
90
- className: string;
91
- sourceFile: string;
92
- properties: ({
93
- name: string;
94
- attribute: string;
95
- type: string;
96
- converter: string;
97
- reflect: boolean;
31
+ target: {
98
32
  default: string;
99
- computed?: undefined;
100
- deps?: undefined;
101
- } | {
102
- name: string;
103
- attribute: string;
104
- type: string;
105
- converter: string;
106
- reflect: boolean;
107
- default: boolean;
108
- computed?: undefined;
109
- deps?: undefined;
110
- } | {
111
- name: string;
112
- attribute: null;
113
- type: string;
114
- converter: string;
115
- reflect: boolean;
116
- default: null;
117
- computed: boolean;
118
- deps: string[];
119
- })[];
120
- observedAttributes: string[];
121
- cem: {
122
- tagName: string;
123
- className: string;
124
- declaration: {
125
- name: string;
126
- module: string;
127
- };
128
- attributes: {
129
- name: string;
130
- fieldName: string;
131
- type: string;
132
- reflect: boolean;
133
- }[];
134
- members: ({
135
- name: string;
136
- fieldName: string;
137
- type: string;
138
- attribute: string;
139
- reflect: boolean;
140
- } | {
141
- name: string;
142
- fieldName: string;
143
- type: string;
144
- attribute: null;
145
- reflect: boolean;
146
- })[];
33
+ reflect: true;
147
34
  };
148
- };
149
- };
150
- declare const __compiledProperties: ({
151
- name: string;
152
- attribute: string;
153
- type: string;
154
- converter: string;
155
- reflect: boolean;
156
- default: string;
157
- computed?: undefined;
158
- deps?: undefined;
159
- } | {
160
- name: string;
161
- attribute: string;
162
- type: string;
163
- converter: string;
164
- reflect: boolean;
165
- default: boolean;
166
- computed?: undefined;
167
- deps?: undefined;
168
- } | {
169
- name: string;
170
- attribute: null;
171
- type: string;
172
- converter: string;
173
- reflect: boolean;
174
- default: null;
175
- computed: boolean;
176
- deps: string[];
177
- })[];
178
- declare const __elementMetadata: {
179
- tag: string;
180
- className: string;
181
- sourceFile: string;
182
- properties: ({
183
- name: string;
184
- attribute: string;
185
- type: string;
186
- converter: string;
187
- reflect: boolean;
188
- default: string;
189
- computed?: undefined;
190
- deps?: undefined;
191
- } | {
192
- name: string;
193
- attribute: string;
194
- type: string;
195
- converter: string;
196
- reflect: boolean;
197
- default: boolean;
198
- computed?: undefined;
199
- deps?: undefined;
200
- } | {
201
- name: string;
202
- attribute: null;
203
- type: string;
204
- converter: string;
205
- reflect: boolean;
206
- default: null;
207
- computed: boolean;
208
- deps: string[];
209
- })[];
210
- observedAttributes: string[];
211
- cem: {
212
- tagName: string;
213
- className: string;
214
- declaration: {
215
- name: string;
216
- module: string;
35
+ type: {
36
+ default: string;
37
+ reflect: true;
217
38
  };
218
- attributes: {
219
- name: string;
220
- fieldName: string;
221
- type: string;
222
- reflect: boolean;
223
- }[];
224
- members: ({
225
- name: string;
226
- fieldName: string;
227
- type: string;
228
- attribute: string;
229
- reflect: boolean;
230
- } | {
231
- name: string;
232
- fieldName: string;
233
- type: string;
234
- attribute: null;
235
- reflect: boolean;
236
- })[];
237
- };
238
- };
239
- declare const __observedAttributes: string[];
240
- declare const __compiledProps: {
241
- variant: {
242
- type: StringConstructor;
243
- default: string;
244
- reflect: boolean;
245
- attribute: string;
246
- };
247
- size: {
248
- type: StringConstructor;
249
- default: string;
250
- reflect: boolean;
251
- attribute: string;
252
- };
253
- disabled: {
254
- type: BooleanConstructor;
255
- default: boolean;
256
- reflect: boolean;
257
- attribute: string;
258
- };
259
- href: {
260
- type: StringConstructor;
261
- default: string;
262
- reflect: boolean;
263
- attribute: string;
264
- };
265
- target: {
266
- type: StringConstructor;
267
- default: string;
268
- reflect: boolean;
269
- attribute: string;
270
- };
271
- type: {
272
- type: StringConstructor;
273
- default: string;
274
- reflect: boolean;
275
- attribute: string;
276
- };
277
- linkMode: {
278
- type: ObjectConstructor;
279
- default: undefined;
280
- reflect: boolean;
281
- attribute: boolean;
282
- };
283
- buttonMode: {
284
- type: ObjectConstructor;
285
- default: undefined;
286
- reflect: boolean;
287
- attribute: boolean;
288
- };
289
- linkHref: {
290
- type: ObjectConstructor;
291
- default: undefined;
292
- reflect: boolean;
293
- attribute: boolean;
294
- };
295
- linkTarget: {
296
- type: ObjectConstructor;
297
- default: undefined;
298
- reflect: boolean;
299
- attribute: boolean;
300
- };
301
- linkRel: {
302
- type: ObjectConstructor;
303
- default: undefined;
304
- reflect: boolean;
305
- attribute: boolean;
306
- };
307
- linkAriaDisabled: {
308
- type: ObjectConstructor;
309
- default: undefined;
310
- reflect: boolean;
311
- attribute: boolean;
312
39
  };
313
40
  };
314
- export declare class OpenButton extends OpenElement {
315
- static __partProgram: typeof __partProgram;
316
- static __compiledProperties: typeof __compiledProperties;
317
- static __elementMetadata: typeof __elementMetadata;
318
- static props: typeof __compiledProps;
319
- static observedAttributes: typeof __observedAttributes;
320
- static delegatesFocus: boolean;
321
- static formAssociated: boolean;
322
- static __computedFields: {
323
- linkMode: (__s: {
324
- href: ReadonlySignal<string>;
325
- }) => ReadonlySignal<boolean>;
326
- buttonMode: (__s: {
327
- href: ReadonlySignal<string>;
328
- }) => ReadonlySignal<boolean>;
329
- linkHref: (__s: {
330
- disabled: ReadonlySignal<boolean>;
331
- href: ReadonlySignal<string>;
332
- }) => ReadonlySignal<string | null>;
333
- linkTarget: (__s: {
334
- target: ReadonlySignal<string>;
335
- }) => ReadonlySignal<string | null>;
336
- linkRel: (__s: {
337
- target: ReadonlySignal<string>;
338
- }) => ReadonlySignal<string | null>;
339
- linkAriaDisabled: (__s: {
340
- disabled: ReadonlySignal<boolean>;
341
- }) => ReadonlySignal<string | null>;
342
- };
343
- static styles: StyleSheetLike[];
41
+ /** Button or link control with variant/size surfaces and form participation. */
42
+ declare function OpenButton(props: {
344
43
  variant: string;
345
44
  size: string;
346
45
  disabled: boolean;
347
46
  href: string;
348
47
  target: string;
349
48
  type: string;
350
- onDsdHydrated(): void;
351
- onCsrRendered(): void;
352
- attributeChangedCallback(name: string, old: string | null, val: string | null): void;
353
- private syncInternals;
354
- private handleClick;
355
- private submitForm;
356
- render(): never;
357
- }
49
+ }): any;
358
50
  //#endregion
359
- export { __elementMetadata, __partProgram };
51
+ export { OpenButton as default };