@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.
- package/CUSTOMIZATION.md +106 -112
- package/README.md +19 -39
- package/custom-elements.json +369 -0
- package/package.json +3 -2
- package/src/button-machine.js +54 -0
- package/src/component-config.js +7 -0
- package/src/component-recipes.js +2 -24
- package/src/copy-feedback.js +32 -0
- package/src/dialog-machine.js +104 -0
- package/src/dropdown-machine.js +253 -0
- package/src/generated-manifest.json +135 -87
- package/src/index.d.ts +7 -8
- package/src/index.js +7 -8
- package/src/input-machine.js +33 -0
- package/src/open-button.css +119 -108
- package/src/open-button.d.ts +34 -342
- package/src/open-button.generated.js +592 -0
- package/src/open-button.js +115 -1140
- package/src/open-code-block.css +24 -44
- package/src/open-code-block.d.ts +15 -175
- package/src/open-code-block.generated.js +293 -0
- package/src/open-code-block.js +112 -224
- package/src/open-dialog.css +114 -127
- package/src/open-dialog.d.ts +22 -261
- package/src/open-dialog.generated.js +501 -0
- package/src/open-dialog.js +137 -632
- package/src/open-dropdown.css +26 -26
- package/src/open-dropdown.d.ts +15 -218
- package/src/open-dropdown.generated.js +211 -0
- package/src/open-dropdown.js +74 -355
- package/src/open-input.css +69 -74
- package/src/open-input.d.ts +34 -461
- package/src/open-input.generated.js +685 -0
- package/src/open-input.js +161 -1802
- package/src/open-theme-toggle.css +37 -47
- package/src/open-theme-toggle.d.ts +19 -190
- package/src/open-theme-toggle.generated.js +564 -0
- package/src/open-theme-toggle.js +209 -509
- package/src/theme-contract.js +40 -0
- package/src/theme.css +26 -8
- package/src/control-recipe.css +0 -21
- package/src/register.d.ts +0 -4
- package/src/register.js +0 -22
package/src/open-code-block.js
CHANGED
|
@@ -1,230 +1,118 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { defineComponentConfig } from "./component-config.js";
|
|
2
|
+
import { log } from "./component-recipes.js";
|
|
3
|
+
import { cancelCopyReset, scheduleCopyReset } from "./copy-feedback.js";
|
|
4
|
+
import { jsx, jsxs } from "@openelement/element/jsx-runtime";
|
|
5
|
+
import { onConnect, onDispose, onPropertyChange } from "@openelement/element/lifecycle";
|
|
6
|
+
import { computed, signal } from "@openelement/element";
|
|
4
7
|
//#region src/open-code-block.tsx
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @openelement/ui - open-code-block
|
|
10
|
+
*
|
|
11
|
+
* Code block with a copy button.
|
|
12
|
+
*
|
|
13
|
+
* Contract (shrunk in #1552): the component owns the copy interaction only —
|
|
14
|
+
* it does NOT bundle, load, or invoke a tokenizer. Syntax highlighting is the
|
|
15
|
+
* host page's build-time concern: fences are compiled to token-span HTML by
|
|
16
|
+
* the site's markdown pipeline (e.g., Shiki) and project through the slot
|
|
17
|
+
* untouched. The projected content stays light DOM, so the host's stylesheet
|
|
18
|
+
* owns the code surface and token inks; this component only paints its chip.
|
|
19
|
+
*
|
|
20
|
+
* Generated authoring: the shell (slot + copy button) is the compiled
|
|
21
|
+
* template; the copy label is a compiled text sink driven by the `copyLabel`
|
|
22
|
+
* property, and the copy feedback's custom state (`:state(copied)` /
|
|
23
|
+
* `:state(failed)`) is driven from the property-change channel.
|
|
24
|
+
*
|
|
25
|
+
* @csspart copy - The copy button
|
|
26
|
+
*
|
|
27
|
+
* Usage:
|
|
28
|
+
* ```html
|
|
29
|
+
* <open-code-block>
|
|
30
|
+
* <pre><code>const x = 1;</code></pre>
|
|
31
|
+
* </open-code-block>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Platform facts for the generated element: shadow root, the authored
|
|
36
|
+
* component stylesheet, and the `copyLabel` property (property-only, no
|
|
37
|
+
* attribute form).
|
|
38
|
+
*/
|
|
39
|
+
const openElement = /* @__PURE__ */ defineComponentConfig({
|
|
40
|
+
root: "shadow",
|
|
41
|
+
styles: ["./open-code-block.css"],
|
|
42
|
+
properties: { copyLabel: {
|
|
43
|
+
default: "Copy",
|
|
44
|
+
attribute: false
|
|
45
|
+
} }
|
|
46
|
+
});
|
|
47
|
+
/** Code block with a copy button. */
|
|
48
|
+
function OpenCodeBlock(props) {
|
|
49
|
+
const chinese = signal(false);
|
|
50
|
+
const translatedLabel = computed(() => !chinese.value ? props.copyLabel : props.copyLabel === "Copy" ? "复制" : props.copyLabel === "Copied!" ? "已复制" : props.copyLabel === "Failed" ? "复制失败" : props.copyLabel);
|
|
51
|
+
onConnect((env) => {
|
|
52
|
+
globalThis.queueMicrotask(() => {
|
|
53
|
+
if (env.signal.aborted) return;
|
|
54
|
+
const language = env.host.closest("[lang]")?.getAttribute("lang") ?? env.host.ownerDocument.documentElement.lang;
|
|
55
|
+
chinese.value = /^zh(?:-|$)/i.test(language);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Copy the slotted light DOM: token spans (if the host highlighted at build
|
|
60
|
+
* time) concatenate to the exact source text. The clipboard promise chain
|
|
61
|
+
* writes the declared `copyLabel`; the change channel below owns state and
|
|
62
|
+
* timer bookkeeping, so the click path never touches internals.
|
|
63
|
+
*/
|
|
64
|
+
const copy = (host) => {
|
|
65
|
+
const text = host.textContent || "";
|
|
66
|
+
try {
|
|
67
|
+
globalThis.navigator.clipboard.writeText(text).then(() => {
|
|
68
|
+
host.copyLabel = "Copied!";
|
|
69
|
+
}, (error) => {
|
|
70
|
+
log.warn("Clipboard write failed:", error);
|
|
71
|
+
host.copyLabel = "Failed";
|
|
72
|
+
});
|
|
73
|
+
} catch (error) {
|
|
74
|
+
log.warn("Clipboard write failed:", error);
|
|
75
|
+
host.copyLabel = "Failed";
|
|
55
76
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
0,
|
|
65
|
-
1,
|
|
66
|
-
0
|
|
67
|
-
]
|
|
77
|
+
};
|
|
78
|
+
onPropertyChange((env) => {
|
|
79
|
+
if (env.name !== "copyLabel") return;
|
|
80
|
+
if (env.value === "Copied!") {
|
|
81
|
+
env.states.add("copied");
|
|
82
|
+
env.states.delete("failed");
|
|
83
|
+
scheduleCopyReset(env.host);
|
|
84
|
+
return;
|
|
68
85
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"kind": "part",
|
|
75
|
-
"index": 1
|
|
76
|
-
},
|
|
77
|
-
"location": "p1"
|
|
78
|
-
}],
|
|
79
|
-
"locations": [
|
|
80
|
-
{
|
|
81
|
-
"id": "e0",
|
|
82
|
-
"kind": "element",
|
|
83
|
-
"tag": "div",
|
|
84
|
-
"path": [0]
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"id": "e1",
|
|
88
|
-
"kind": "element",
|
|
89
|
-
"tag": "slot",
|
|
90
|
-
"path": [0, 0]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"id": "e2",
|
|
94
|
-
"kind": "element",
|
|
95
|
-
"tag": "button",
|
|
96
|
-
"path": [0, 1]
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"id": "p0",
|
|
100
|
-
"kind": "sink",
|
|
101
|
-
"part": 0,
|
|
102
|
-
"node": "e2",
|
|
103
|
-
"path": [0, 1]
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"id": "p1",
|
|
107
|
-
"kind": "anchor",
|
|
108
|
-
"part": 1,
|
|
109
|
-
"path": [
|
|
110
|
-
0,
|
|
111
|
-
1,
|
|
112
|
-
0
|
|
113
|
-
]
|
|
86
|
+
if (env.value === "Failed") {
|
|
87
|
+
env.states.add("failed");
|
|
88
|
+
env.states.delete("copied");
|
|
89
|
+
scheduleCopyReset(env.host);
|
|
90
|
+
return;
|
|
114
91
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"className": "OpenCodeBlock",
|
|
132
|
-
"declaration": {
|
|
133
|
-
"name": "OpenCodeBlock",
|
|
134
|
-
"module": "open-code-block.tsx"
|
|
92
|
+
env.states.delete("copied");
|
|
93
|
+
env.states.delete("failed");
|
|
94
|
+
cancelCopyReset(env.host);
|
|
95
|
+
});
|
|
96
|
+
onDispose((env) => {
|
|
97
|
+
cancelCopyReset(env.host);
|
|
98
|
+
});
|
|
99
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
100
|
+
style: "display:contents",
|
|
101
|
+
children: [/* @__PURE__ */ jsx("slot", {}), /* @__PURE__ */ jsx("button", {
|
|
102
|
+
type: "button",
|
|
103
|
+
class: "copy-btn absolute top-2 right-2 z-10 cursor-pointer rounded-md border-[0.5px] border-transparent bg-primary/14 px-3 py-1 font-sans text-xs font-semibold tracking-wider text-foreground transition-all duration-150 ease-in-out hover:border-primary hover:bg-primary/23",
|
|
104
|
+
part: "copy",
|
|
105
|
+
onClick: (event) => {
|
|
106
|
+
const target = event.currentTarget;
|
|
107
|
+
copy(target.getRootNode().host);
|
|
135
108
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
"type": "string",
|
|
141
|
-
"attribute": null,
|
|
142
|
-
"reflect": false
|
|
143
|
-
}]
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const __compiledProperties = [{
|
|
148
|
-
"name": "copyLabel",
|
|
149
|
-
"attribute": null,
|
|
150
|
-
"type": "string",
|
|
151
|
-
"converter": "string",
|
|
152
|
-
"reflect": false,
|
|
153
|
-
"default": "Copy"
|
|
154
|
-
}];
|
|
155
|
-
const __elementMetadata = {
|
|
156
|
-
"tag": "open-code-block",
|
|
157
|
-
"className": "OpenCodeBlock",
|
|
158
|
-
"sourceFile": "open-code-block.tsx",
|
|
159
|
-
"properties": [{
|
|
160
|
-
"name": "copyLabel",
|
|
161
|
-
"attribute": null,
|
|
162
|
-
"type": "string",
|
|
163
|
-
"converter": "string",
|
|
164
|
-
"reflect": false,
|
|
165
|
-
"default": "Copy"
|
|
166
|
-
}],
|
|
167
|
-
"observedAttributes": [],
|
|
168
|
-
"cem": {
|
|
169
|
-
"tagName": "open-code-block",
|
|
170
|
-
"className": "OpenCodeBlock",
|
|
171
|
-
"declaration": {
|
|
172
|
-
"name": "OpenCodeBlock",
|
|
173
|
-
"module": "open-code-block.tsx"
|
|
174
|
-
},
|
|
175
|
-
"attributes": [],
|
|
176
|
-
"members": [{
|
|
177
|
-
"name": "copyLabel",
|
|
178
|
-
"fieldName": "copyLabel",
|
|
179
|
-
"type": "string",
|
|
180
|
-
"attribute": null,
|
|
181
|
-
"reflect": false
|
|
182
|
-
}]
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
const __observedAttributes = [];
|
|
186
|
-
const __compiledProps = { copyLabel: {
|
|
187
|
-
type: String,
|
|
188
|
-
default: "Copy",
|
|
189
|
-
reflect: false,
|
|
190
|
-
attribute: false
|
|
191
|
-
} };
|
|
192
|
-
var OpenCodeBlock = class extends OpenElement {
|
|
193
|
-
static __partProgram = __partProgram;
|
|
194
|
-
static __compiledProperties = __compiledProperties;
|
|
195
|
-
static __elementMetadata = __elementMetadata;
|
|
196
|
-
static props = __compiledProps;
|
|
197
|
-
static observedAttributes = __observedAttributes;
|
|
198
|
-
static styles = [openCodeBlockStyles];
|
|
199
|
-
copyLabel = "Copy";
|
|
200
|
-
getCodeText() {
|
|
201
|
-
return this.textContent || "";
|
|
202
|
-
}
|
|
203
|
-
async copy() {
|
|
204
|
-
try {
|
|
205
|
-
const text = this.getCodeText();
|
|
206
|
-
await navigator.clipboard.writeText(text);
|
|
207
|
-
this.copyLabel = "Copied!";
|
|
208
|
-
this._internals?.states.add("copied");
|
|
209
|
-
this._internals?.states.delete("failed");
|
|
210
|
-
this._setTimeout(() => {
|
|
211
|
-
this.copyLabel = "Copy";
|
|
212
|
-
this._internals?.states.delete("copied");
|
|
213
|
-
}, CODE_BLOCK_CONSTANTS.copyFeedbackMs);
|
|
214
|
-
} catch (e) {
|
|
215
|
-
log.warn("Clipboard write failed:", e);
|
|
216
|
-
this.copyLabel = "Failed";
|
|
217
|
-
this._internals?.states.add("failed");
|
|
218
|
-
this._internals?.states.delete("copied");
|
|
219
|
-
this._setTimeout(() => {
|
|
220
|
-
this.copyLabel = "Copy";
|
|
221
|
-
this._internals?.states.delete("failed");
|
|
222
|
-
}, CODE_BLOCK_CONSTANTS.copyFeedbackMs);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
render() {
|
|
226
|
-
throw new Error("[open:compiled-element] open-code-block is compiled to a Part Program; the runtime JSX render path is not available.");
|
|
227
|
-
}
|
|
228
|
-
};
|
|
109
|
+
children: translatedLabel.value
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
229
113
|
//#endregion
|
|
230
|
-
export { OpenCodeBlock
|
|
114
|
+
export { OpenCodeBlock as default, openElement };
|
|
115
|
+
|
|
116
|
+
export { OpenCodeBlockElement, OpenCodeBlock__ssrHost } from './open-code-block.generated.js';
|
|
117
|
+
|
|
118
|
+
// openElement:class-candidates ["absolute","bg-primary/14","border-[0.5px]","border-transparent","copy-btn","cursor-pointer","duration-150","ease-in-out","font-sans","font-semibold","hover:bg-primary/23","hover:border-primary","px-3","py-1","right-2","rounded-md","text-foreground","text-xs","top-2","tracking-wider","transition-all","z-10"]
|
package/src/open-dialog.css
CHANGED
|
@@ -1,137 +1,124 @@
|
|
|
1
|
-
/* open-dialog —
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/* open-dialog — the irreducible authored rules (alpha15 S lane).
|
|
2
|
+
*
|
|
3
|
+
* The dialog box (padding, radius, width bound, font) and the header / title /
|
|
4
|
+
* close / body / footer presentation are authored as Tailwind utilities in
|
|
5
|
+
* open-dialog.tsx: the compiler admits those static tokens and the build's
|
|
6
|
+
* component stylesheet carries the generated rules into this shadow root.
|
|
7
|
+
*
|
|
8
|
+
* What stays here, and why (CUSTOMIZATION.md → "Why the residue is CSS"): the
|
|
9
|
+
* residue is either a structural limit of the platform or one owned rule that
|
|
10
|
+
* reads better than its utility spelling.
|
|
11
|
+
* - the host box;
|
|
12
|
+
* - the trigger slot's cursor (`::slotted`);
|
|
13
|
+
* - the dialog's DERIVED surface: the foreground/border/primary triple mix of
|
|
14
|
+
* its frame, the popover mix of its background, the inset highlight plus
|
|
15
|
+
* the `--shadow-2xl` scale value, and the close button's primary-mixed hover
|
|
16
|
+
* background — each one formula over role pairs rather than a repeated
|
|
17
|
+
* escaped arbitrary value;
|
|
18
|
+
* - the NATIVE top-layer presentation: `::backdrop` and its scrim, and the
|
|
19
|
+
* entry/exit transitions. The transition configuration IS expressible
|
|
20
|
+
* (`starting:opacity-0` compiles into `@starting-style`,
|
|
21
|
+
* `transition-discrete` into `transition-behavior: allow-discrete`); the
|
|
22
|
+
* sheet keeps it because the whole top-layer choreography — backdrop,
|
|
23
|
+
* scrim, starting style, discrete behavior and its forced-colors /
|
|
24
|
+
* reduced-motion degradations — reads as one owned block;
|
|
25
|
+
* - the forced-colors and reduced-motion degradations of those transitions;
|
|
26
|
+
* - `:host(:state(open))`, the host's attached state.
|
|
27
|
+
* One owner per property: nothing here is also authored as a utility.
|
|
28
|
+
*/
|
|
29
|
+
:host {
|
|
30
|
+
display: inline-block;
|
|
31
|
+
}
|
|
8
32
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
33
|
+
::slotted([slot='trigger']) {
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
12
36
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
color
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
dialog {
|
|
38
|
+
border: calc(var(--spacing) * 0.25) solid
|
|
39
|
+
color-mix(
|
|
40
|
+
in srgb,
|
|
41
|
+
color-mix(in srgb, var(--color-foreground) 25%, var(--color-border)) 62%,
|
|
42
|
+
var(--color-primary)
|
|
43
|
+
);
|
|
44
|
+
background: color-mix(in srgb, var(--color-popover) 92%, transparent);
|
|
45
|
+
color: var(--color-foreground);
|
|
46
|
+
box-shadow:
|
|
47
|
+
inset 0 1px 0 color-mix(in srgb, var(--color-white) 8%, transparent),
|
|
48
|
+
var(--shadow-2xl);
|
|
49
|
+
}
|
|
23
50
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
dialog::backdrop {
|
|
52
|
+
/* Closed base: transparent. The [open] rule carries the zinc-950 scrim
|
|
53
|
+
and starts from transparent, so the scrim fades in on entry and back
|
|
54
|
+
out on exit instead of snapping. */
|
|
55
|
+
background: transparent;
|
|
56
|
+
backdrop-filter: blur(8px);
|
|
57
|
+
/* Exit visibility: with allow-discrete the top-layer membership and the
|
|
58
|
+
display flip wait for the transition, so the scrim fades out instead
|
|
59
|
+
of snapping (the allow-discrete recipe, cf. upstream #591 — open
|
|
60
|
+
upstream, does not gate this landing). */
|
|
61
|
+
transition:
|
|
62
|
+
background-color 0.2s ease-out,
|
|
63
|
+
overlay 0.2s ease-out allow-discrete,
|
|
64
|
+
display 0.2s ease-out allow-discrete;
|
|
65
|
+
}
|
|
39
66
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
67
|
+
dialog[open]::backdrop {
|
|
68
|
+
background: color-mix(in srgb, var(--color-zinc-950) 68%, transparent);
|
|
69
|
+
@starting-style {
|
|
70
|
+
background: transparent;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
46
73
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
74
|
+
/* Entry AND exit: the closed state is the base rule (opacity 0, lifted);
|
|
75
|
+
opening transitions to the [open] values from the @starting-style
|
|
76
|
+
starting point, closing transitions back to the base — the display and
|
|
77
|
+
overlay legs carry allow-discrete so the dialog stays rendered and in
|
|
78
|
+
the top layer until the exit transition finishes. */
|
|
79
|
+
dialog {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
transform: translateY(-8px);
|
|
82
|
+
transition:
|
|
83
|
+
opacity 0.2s ease-out,
|
|
84
|
+
transform 0.2s ease-out,
|
|
85
|
+
overlay 0.2s ease-out allow-discrete,
|
|
86
|
+
display 0.2s ease-out allow-discrete;
|
|
87
|
+
}
|
|
61
88
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
89
|
+
dialog[open] {
|
|
90
|
+
opacity: 1;
|
|
91
|
+
transform: translateY(0);
|
|
92
|
+
@starting-style {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
transform: translateY(-8px);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
70
97
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
98
|
+
/* Forced colors: the system owns the palette, so half-opacity frames and
|
|
99
|
+
moving text would fight the forced rendering — the dialog appears and
|
|
100
|
+
dismisses immediately instead (the display leg loses its deferral with
|
|
101
|
+
the transition, which is the graceful degradation). Reduced motion
|
|
102
|
+
collapses the same way. */
|
|
103
|
+
@media (forced-colors: active) {
|
|
104
|
+
dialog,
|
|
105
|
+
dialog::backdrop {
|
|
106
|
+
transition: none;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
82
109
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
110
|
+
@media (prefers-reduced-motion: reduce) {
|
|
111
|
+
dialog,
|
|
112
|
+
dialog::backdrop {
|
|
113
|
+
transition-duration: 0s;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
89
116
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
margin-bottom: calc(var(--spacing) * 4);
|
|
95
|
-
}
|
|
117
|
+
.dialog-close:hover {
|
|
118
|
+
color: var(--color-foreground);
|
|
119
|
+
background: color-mix(in srgb, var(--color-primary) 14%, transparent);
|
|
120
|
+
}
|
|
96
121
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
color: var(--color-foreground);
|
|
101
|
-
margin: 0;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.dialog-close {
|
|
105
|
-
background: none;
|
|
106
|
-
border: none;
|
|
107
|
-
cursor: pointer;
|
|
108
|
-
color: var(--color-muted-foreground);
|
|
109
|
-
font-size: var(--text-xl);
|
|
110
|
-
line-height: var(--leading-tight);
|
|
111
|
-
padding: calc(var(--spacing) * 1);
|
|
112
|
-
border-radius: var(--radius-md);
|
|
113
|
-
transition: color 0.15s ease;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.dialog-close:hover {
|
|
117
|
-
color: var(--color-foreground);
|
|
118
|
-
background: color-mix(in srgb, var(--color-primary) 14%, transparent);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.dialog-body {
|
|
122
|
-
font-size: var(--text-base);
|
|
123
|
-
color: var(--color-muted-foreground);
|
|
124
|
-
line-height: var(--leading-normal);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.dialog-footer {
|
|
128
|
-
margin-top: calc(var(--spacing) * 5);
|
|
129
|
-
display: flex;
|
|
130
|
-
justify-content: flex-end;
|
|
131
|
-
gap: calc(var(--spacing) * 2);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
:host(:state(open)) dialog {
|
|
135
|
-
display: block;
|
|
136
|
-
}
|
|
137
|
-
|
|
122
|
+
:host(:state(open)) dialog {
|
|
123
|
+
display: block;
|
|
124
|
+
}
|