@openelement/ui 1.0.0-alpha.14 → 1.0.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CUSTOMIZATION.md +173 -41
- package/README.md +10 -7
- package/package.json +2 -2
- package/src/generated-manifest.json +46 -10
- package/src/open-button.css +119 -108
- package/src/open-button.d.ts +78 -27
- package/src/open-button.js +157 -232
- package/src/open-code-block.css +24 -44
- package/src/open-code-block.d.ts +3 -1
- package/src/open-code-block.js +28 -3
- package/src/open-dialog.css +114 -127
- package/src/open-dialog.d.ts +3 -1
- package/src/open-dialog.js +43 -8
- package/src/open-dropdown.css +20 -26
- package/src/open-dropdown.d.ts +3 -1
- package/src/open-dropdown.js +14 -4
- package/src/open-input.css +58 -80
- package/src/open-input.d.ts +4 -26
- package/src/open-input.js +86 -140
- package/src/open-theme-toggle.css +37 -47
- package/src/open-theme-toggle.d.ts +3 -1
- package/src/open-theme-toggle.js +27 -5
- package/src/theme.css +26 -8
- package/src/control-recipe.css +0 -21
package/src/open-button.css
CHANGED
|
@@ -1,120 +1,131 @@
|
|
|
1
|
-
/* open-button —
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
29
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
102
|
+
:host([variant='ghost']) .btn {
|
|
103
|
+
border-color: transparent;
|
|
104
|
+
}
|
|
82
105
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
+
}
|
package/src/open-button.d.ts
CHANGED
|
@@ -16,18 +16,31 @@ declare const __partProgram: {
|
|
|
16
16
|
children: {
|
|
17
17
|
k: string;
|
|
18
18
|
id: string;
|
|
19
|
-
|
|
20
|
-
attrs: string[][];
|
|
21
|
-
children: {
|
|
22
|
-
k: string;
|
|
23
|
-
id: string;
|
|
24
|
-
tag: string;
|
|
25
|
-
attrs: never[];
|
|
26
|
-
children: never[];
|
|
27
|
-
}[];
|
|
19
|
+
index: number;
|
|
28
20
|
}[];
|
|
29
21
|
}[];
|
|
30
22
|
parts: ({
|
|
23
|
+
k: string;
|
|
24
|
+
event: string;
|
|
25
|
+
handler: string;
|
|
26
|
+
action: {
|
|
27
|
+
kind: string;
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
path: number[];
|
|
31
|
+
index: number;
|
|
32
|
+
location: {
|
|
33
|
+
id: string;
|
|
34
|
+
kind: string;
|
|
35
|
+
path: number[];
|
|
36
|
+
node: string;
|
|
37
|
+
};
|
|
38
|
+
signal?: undefined;
|
|
39
|
+
name?: undefined;
|
|
40
|
+
test?: undefined;
|
|
41
|
+
on?: undefined;
|
|
42
|
+
off?: undefined;
|
|
43
|
+
} | {
|
|
31
44
|
k: string;
|
|
32
45
|
signal: string;
|
|
33
46
|
name: string;
|
|
@@ -42,26 +55,64 @@ declare const __partProgram: {
|
|
|
42
55
|
event?: undefined;
|
|
43
56
|
handler?: undefined;
|
|
44
57
|
action?: undefined;
|
|
58
|
+
test?: undefined;
|
|
59
|
+
on?: undefined;
|
|
60
|
+
off?: undefined;
|
|
45
61
|
} | {
|
|
46
62
|
k: string;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
signal: string;
|
|
64
|
+
test: {
|
|
65
|
+
signal: string;
|
|
66
|
+
op: string;
|
|
67
|
+
value: boolean;
|
|
52
68
|
};
|
|
53
|
-
|
|
69
|
+
on: {
|
|
70
|
+
k: string;
|
|
71
|
+
id: string;
|
|
72
|
+
tag: string;
|
|
73
|
+
attrs: string[][];
|
|
74
|
+
children: {
|
|
75
|
+
k: string;
|
|
76
|
+
id: string;
|
|
77
|
+
tag: string;
|
|
78
|
+
attrs: never[];
|
|
79
|
+
children: never[];
|
|
80
|
+
}[];
|
|
81
|
+
}[];
|
|
82
|
+
off: {
|
|
83
|
+
k: string;
|
|
84
|
+
id: string;
|
|
85
|
+
tag: string;
|
|
86
|
+
attrs: string[][];
|
|
87
|
+
children: {
|
|
88
|
+
k: string;
|
|
89
|
+
id: string;
|
|
90
|
+
tag: string;
|
|
91
|
+
attrs: never[];
|
|
92
|
+
children: never[];
|
|
93
|
+
}[];
|
|
94
|
+
}[];
|
|
54
95
|
index: number;
|
|
55
96
|
location: {
|
|
56
97
|
id: string;
|
|
57
98
|
kind: string;
|
|
58
99
|
path: number[];
|
|
59
|
-
node
|
|
100
|
+
node?: undefined;
|
|
60
101
|
};
|
|
61
|
-
|
|
102
|
+
event?: undefined;
|
|
103
|
+
handler?: undefined;
|
|
104
|
+
action?: undefined;
|
|
105
|
+
path?: undefined;
|
|
62
106
|
name?: undefined;
|
|
63
107
|
})[];
|
|
64
|
-
|
|
108
|
+
blocks: {
|
|
109
|
+
id: string;
|
|
110
|
+
index: number;
|
|
111
|
+
kind: string;
|
|
112
|
+
anchor: string;
|
|
113
|
+
end: string;
|
|
114
|
+
source: string;
|
|
115
|
+
}[];
|
|
65
116
|
dependencies: {
|
|
66
117
|
signal: string;
|
|
67
118
|
owner: {
|
|
@@ -84,6 +135,13 @@ declare const __partProgram: {
|
|
|
84
135
|
node: string;
|
|
85
136
|
path: number[];
|
|
86
137
|
tag?: undefined;
|
|
138
|
+
} | {
|
|
139
|
+
id: string;
|
|
140
|
+
kind: string;
|
|
141
|
+
part: number;
|
|
142
|
+
path: number[];
|
|
143
|
+
tag?: undefined;
|
|
144
|
+
node?: undefined;
|
|
87
145
|
})[];
|
|
88
146
|
metadata: {
|
|
89
147
|
tag: string;
|
|
@@ -274,12 +332,6 @@ declare const __compiledProps: {
|
|
|
274
332
|
reflect: boolean;
|
|
275
333
|
attribute: string;
|
|
276
334
|
};
|
|
277
|
-
linkMode: {
|
|
278
|
-
type: ObjectConstructor;
|
|
279
|
-
default: undefined;
|
|
280
|
-
reflect: boolean;
|
|
281
|
-
attribute: boolean;
|
|
282
|
-
};
|
|
283
335
|
buttonMode: {
|
|
284
336
|
type: ObjectConstructor;
|
|
285
337
|
default: undefined;
|
|
@@ -319,10 +371,9 @@ export declare class OpenButton extends OpenElement {
|
|
|
319
371
|
static observedAttributes: typeof __observedAttributes;
|
|
320
372
|
static delegatesFocus: boolean;
|
|
321
373
|
static formAssociated: boolean;
|
|
374
|
+
static __oeUtilityClasses: boolean;
|
|
375
|
+
static __oeClassCandidates: readonly string[];
|
|
322
376
|
static __computedFields: {
|
|
323
|
-
linkMode: (__s: {
|
|
324
|
-
href: ReadonlySignal<string>;
|
|
325
|
-
}) => ReadonlySignal<boolean>;
|
|
326
377
|
buttonMode: (__s: {
|
|
327
378
|
href: ReadonlySignal<string>;
|
|
328
379
|
}) => ReadonlySignal<boolean>;
|