@greypan/web-ui 8.0.0 → 9.0.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.
- package/README.CN.md +277 -146
- package/README.md +323 -191
- package/dist/assets/glass.js +1 -1
- package/dist/assets/glass.js.map +1 -1
- package/dist/assets/menu-portal.js +1 -1
- package/dist/assets/menu-portal.js.map +1 -1
- package/dist/assets/selection-control.js +1 -1
- package/dist/assets/selection-control.js.map +1 -1
- package/dist/assets/toast-containers.js +1 -1
- package/dist/assets/toast-containers.js.map +1 -1
- package/dist/components/autocomplete/index.d.ts +3 -2
- package/dist/components/autocomplete/index.js +46 -50
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/autocomplete/style.js +1 -1
- package/dist/components/autocomplete/style.js.map +1 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/avatar/style.js +1 -1
- package/dist/components/avatar/style.js.map +1 -1
- package/dist/components/back-top/style.js +1 -1
- package/dist/components/back-top/style.js.map +1 -1
- package/dist/components/badge/style.js +1 -1
- package/dist/components/badge/style.js.map +1 -1
- package/dist/components/button/index.d.ts +368 -1
- package/dist/components/button/index.js +56 -36
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/style.js +1 -1
- package/dist/components/button/style.js.map +1 -1
- package/dist/components/button-group/index.js +0 -1
- package/dist/components/button-group/index.js.map +1 -1
- package/dist/components/button-group/style.js +1 -1
- package/dist/components/button-group/style.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +3 -0
- package/dist/components/checkbox/index.js +35 -37
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox/style.js +1 -1
- package/dist/components/checkbox/style.js.map +1 -1
- package/dist/components/checkbox-group/index.js +8 -8
- package/dist/components/checkbox-group/style.js +1 -1
- package/dist/components/checkbox-group/style.js.map +1 -1
- package/dist/components/context-menu/index.d.ts +167 -3
- package/dist/components/context-menu/index.js +162 -91
- package/dist/components/context-menu/index.js.map +1 -1
- package/dist/components/context-menu/scrim.js +6 -0
- package/dist/components/context-menu/scrim.js.map +1 -0
- package/dist/components/context-menu/style.js +1 -1
- package/dist/components/context-menu/style.js.map +1 -1
- package/dist/components/dialog/index.d.ts +9 -0
- package/dist/components/dialog/index.js +61 -46
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/style.js +1 -1
- package/dist/components/dialog/style.js.map +1 -1
- package/dist/components/drawer/index.d.ts +45 -0
- package/dist/components/drawer/index.js +116 -52
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/drawer/style.js +1 -1
- package/dist/components/drawer/style.js.map +1 -1
- package/dist/components/dropdown/index.d.ts +12 -0
- package/dist/components/dropdown/index.js +13 -10
- package/dist/components/dropdown/index.js.map +1 -1
- package/dist/components/dropdown-divider/style.js +1 -1
- package/dist/components/dropdown-divider/style.js.map +1 -1
- package/dist/components/dropdown-header/style.js +1 -1
- package/dist/components/dropdown-header/style.js.map +1 -1
- package/dist/components/dropdown-item/style.js +1 -1
- package/dist/components/dropdown-item/style.js.map +1 -1
- package/dist/components/editable-text/index.d.ts +41 -0
- package/dist/components/editable-text/index.js +55 -31
- package/dist/components/editable-text/index.js.map +1 -1
- package/dist/components/empty/index.d.ts +21 -4
- package/dist/components/empty/index.js +37 -32
- package/dist/components/empty/index.js.map +1 -1
- package/dist/components/empty/style.js +1 -1
- package/dist/components/empty/style.js.map +1 -1
- package/dist/components/icon/index.js +7 -7
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/image-preview/index.js +9 -2
- package/dist/components/image-preview/index.js.map +1 -1
- package/dist/components/image-preview/style.js +1 -1
- package/dist/components/image-preview/style.js.map +1 -1
- package/dist/components/index.js +23 -23
- package/dist/components/input/index.d.ts +7 -0
- package/dist/components/input/index.js +34 -29
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/style.js +1 -1
- package/dist/components/input/style.js.map +1 -1
- package/dist/components/input-number/index.d.ts +1 -0
- package/dist/components/input-number/index.js +28 -26
- package/dist/components/input-number/index.js.map +1 -1
- package/dist/components/input-number/style.js +1 -1
- package/dist/components/input-number/style.js.map +1 -1
- package/dist/components/layout/index.d.ts +0 -3
- package/dist/components/layout/index.js +1 -1
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/style.js +1 -1
- package/dist/components/layout/style.js.map +1 -1
- package/dist/components/option/style.js +1 -1
- package/dist/components/option/style.js.map +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/style.js +1 -1
- package/dist/components/popover/style.js.map +1 -1
- package/dist/components/radio/index.d.ts +3 -0
- package/dist/components/radio/index.js +23 -19
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio/style.js +1 -1
- package/dist/components/radio/style.js.map +1 -1
- package/dist/components/radio-group/index.js +8 -8
- package/dist/components/radio-group/style.js +1 -1
- package/dist/components/radio-group/style.js.map +1 -1
- package/dist/components/segmented/index.d.ts +5 -0
- package/dist/components/segmented/index.js +49 -32
- package/dist/components/segmented/index.js.map +1 -1
- package/dist/components/segmented/style.js +1 -1
- package/dist/components/segmented/style.js.map +1 -1
- package/dist/components/segmented-trigger/style.js +1 -1
- package/dist/components/segmented-trigger/style.js.map +1 -1
- package/dist/components/select/index.js +0 -1
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/select/style.js +1 -1
- package/dist/components/select/style.js.map +1 -1
- package/dist/components/slider/index.js +9 -9
- package/dist/components/slider/style.js +1 -1
- package/dist/components/slider/style.js.map +1 -1
- package/dist/components/spinner/style.js +1 -1
- package/dist/components/spinner/style.js.map +1 -1
- package/dist/components/svg-draw-lines/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +1 -0
- package/dist/components/switch/index.js +26 -24
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/style.js +1 -1
- package/dist/components/switch/style.js.map +1 -1
- package/dist/components/textarea/index.d.ts +7 -1
- package/dist/components/textarea/index.js +45 -43
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/style.js +1 -1
- package/dist/components/textarea/style.js.map +1 -1
- package/dist/components/theme/index.d.ts +9 -0
- package/dist/components/theme/index.js +128 -85
- package/dist/components/theme/index.js.map +1 -1
- package/dist/components/theme/style.js +1 -1
- package/dist/components/theme/style.js.map +1 -1
- package/dist/components/toast/style.js +1 -1
- package/dist/components/toast/style.js.map +1 -1
- package/dist/components/toast/toast.js +8 -8
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tooltip/style.js +1 -1
- package/dist/components/tooltip/style.js.map +1 -1
- package/dist/icons/generated/akar-icons-check.d.ts +6 -0
- package/dist/icons/generated/akar-icons-check.js +10 -0
- package/dist/icons/generated/akar-icons-check.js.map +1 -0
- package/dist/icons/generated/akar-icons-circle-check.d.ts +6 -0
- package/dist/icons/generated/akar-icons-circle-check.js +10 -0
- package/dist/icons/generated/akar-icons-circle-check.js.map +1 -0
- package/dist/icons/generated/bi-check-lg.d.ts +6 -0
- package/dist/icons/generated/bi-check-lg.js +10 -0
- package/dist/icons/generated/bi-check-lg.js.map +1 -0
- package/dist/icons/generated/bi-check.d.ts +6 -0
- package/dist/icons/generated/bi-check.js +10 -0
- package/dist/icons/generated/bi-check.js.map +1 -0
- package/dist/icons/generated/fluent-tag-search-24-regular.d.ts +6 -0
- package/dist/icons/generated/fluent-tag-search-24-regular.js +10 -0
- package/dist/icons/generated/fluent-tag-search-24-regular.js.map +1 -0
- package/dist/icons/generated/mdi-tag-search-outline.d.ts +6 -0
- package/dist/icons/generated/mdi-tag-search-outline.js +10 -0
- package/dist/icons/generated/mdi-tag-search-outline.js.map +1 -0
- package/dist/icons/index.d.ts +6 -0
- package/dist/icons/index.js +7 -1
- package/dist/shared/element-height/index.js +47 -0
- package/dist/shared/element-height/index.js.map +1 -0
- package/dist/shared/form-association/field-id.js +9 -0
- package/dist/shared/form-association/field-id.js.map +1 -0
- package/dist/shared/form-association/index.js +9 -1
- package/dist/shared/form-association/index.js.map +1 -1
- package/dist/shared/label-emptiness/index.js +45 -0
- package/dist/shared/label-emptiness/index.js.map +1 -0
- package/dist/shared/menu-portal/menu-portal.js +11 -11
- package/dist/shared/menu-portal/menu-portal.js.map +1 -1
- package/dist/shared/menu-portal/menu-tree.js +2 -2
- package/dist/shared/menu-portal/menu-tree.js.map +1 -1
- package/dist/shared/overlay/anchored-panel.js.map +1 -1
- package/dist/shared/overlay/native-dialog-presence.js +23 -11
- package/dist/shared/overlay/native-dialog-presence.js.map +1 -1
- package/dist/shared/overlay/nested-drawer-layers.js +30 -23
- package/dist/shared/overlay/nested-drawer-layers.js.map +1 -1
- package/dist/shared/scroll-lock/scroll-lock.js +3 -3
- package/dist/shared/scroll-lock/scroll-lock.js.map +1 -1
- package/dist/shared/theme/root-sync.js +24 -18
- package/dist/shared/theme/root-sync.js.map +1 -1
- package/package.json +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","names":[],"sources":["../../../src/components/textarea/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n --wui-textarea-clear-color: var(\n --wui-color-text-tertiary,\n color-mix(in srgb, var(--wui-color-text) 35%, transparent)\n );\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.wui-textarea-inner {\n --wui-glass-corner-radius: var(--wui-radius-menu, 18px);\n position: relative;\n\n display: flex;\n gap: 8px;\n align-items: flex-start;\n\n box-sizing: border-box;\n width: var(--wui-textarea-width, 200px);\n min-width: var(--wui-control-size, 36px);\n min-height: var(--wui-control-size, 36px);\n padding: 7.5px 12px;\n border-radius: var(--wui-radius-menu, 18px);\n}\n\n:host([full]) .wui-textarea-inner {\n width: 100%;\n}\n\n:host([borderless]) .wui-textarea-inner {\n border: none;\n background: transparent;\n backdrop-filter: none;\n box-shadow: none;\n}\n\n/* borderless 必须移除 glass 描边环(.wui-glass::before 底环 + 对角光泽),\n 否则无框后仍残留 1px 描边 */\n:host([borderless]) .wui-textarea-inner::before {\n content: none;\n}\n\ntextarea {\n resize: vertical;\n\n display: block;\n flex: 1;\n\n box-sizing: border-box;\n width: 100%;\n margin: 0;\n padding: 0;\n border: none;\n\n /* 表单控件不继承字体;显式继承以对齐宿主排版,避免 UA 默认字体差异 */\n font: inherit;\n font-size: var(--wui-font-size, 14px);\n line-height: 1.5;\n color: var(--wui-color-text, #1b1b1b);\n\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: var(--wui-color-text-secondary, #6a6a6a);\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n &:read-only {\n cursor: default;\n }\n}\n\n/* Coarse pointers include iOS Safari, where a sub-16px font triggers focus zoom. */\n@media (pointer: coarse) {\n textarea {\n font-size: max(16px, var(--wui-font-size, 14px));\n }\n}\n\n/* Focus ring 独立成 ::after 层:base/focused 都是显式 box-shadow,保证所有变体都能过渡 */\n.wui-textarea-inner::after {\n pointer-events: none;\n content: '';\n\n position: absolute;\n inset: 0;\n\n border-radius: inherit;\n\n box-shadow:\n inset 0 0 0 1px transparent,\n 0 0 0 var(--wui-focus-ring-width, 3px) transparent;\n\n transition: box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([focused]) .wui-textarea-inner::after {\n box-shadow:\n inset 0 0 0 1px var(--wui-color-accent, #08f),\n 0 0 0 var(--wui-focus-ring-width, 3px)
|
|
1
|
+
{"version":3,"file":"style.js","names":[],"sources":["../../../src/components/textarea/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n --wui-textarea-clear-color: var(\n --wui-color-text-tertiary,\n color-mix(in srgb, var(--wui-color-text) 35%, transparent)\n );\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.wui-textarea-inner {\n --wui-glass-corner-radius: var(--wui-radius-menu, 18px);\n position: relative;\n\n display: flex;\n gap: var(--wui-space-2, 8px);\n align-items: flex-start;\n\n box-sizing: border-box;\n width: var(--wui-textarea-width, 200px);\n min-width: var(--wui-control-size, 36px);\n min-height: var(--wui-control-size, 36px);\n padding: 7.5px var(--wui-space-3, 12px);\n border-radius: var(--wui-radius-menu, 18px);\n}\n\n:host([full]) .wui-textarea-inner {\n width: 100%;\n}\n\n:host([borderless]) .wui-textarea-inner {\n border: none;\n background: transparent;\n backdrop-filter: none;\n box-shadow: none;\n}\n\n/* borderless 必须移除 glass 描边环(.wui-glass::before 底环 + 对角光泽),\n 否则无框后仍残留 1px 描边 */\n:host([borderless]) .wui-textarea-inner::before {\n content: none;\n}\n\ntextarea {\n resize: vertical;\n\n display: block;\n flex: 1;\n\n box-sizing: border-box;\n width: 100%;\n margin: 0;\n padding: 0;\n border: none;\n\n /* 表单控件不继承字体;显式继承以对齐宿主排版,避免 UA 默认字体差异 */\n font: inherit;\n font-size: var(--wui-font-size, 14px);\n line-height: var(--wui-line-height-normal, 1.5);\n color: var(--wui-color-text, #1b1b1b);\n\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: var(--wui-color-text-secondary, #6a6a6a);\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n &:read-only {\n cursor: default;\n }\n}\n\n/*\n * autosize 由组件用 JS 独占高度(_autosize 写内联 height),原生 resize 拖拽与它是\n * 两套高度来源:用户拖高后,下一次内容变化又会被 autosize 拉回去,拖拽变成假动作。\n * 所以 autosize 下关掉 resize grip,需要上限高度请用 max-height(CSS 钳制)。\n */\n:host([autosize]) textarea {\n resize: none;\n}\n\n/* Coarse pointers include iOS Safari, where a sub-16px font triggers focus zoom. */\n@media (pointer: coarse) {\n textarea {\n font-size: max(16px, var(--wui-font-size, 14px));\n }\n}\n\n/* Focus ring 独立成 ::after 层:base/focused 都是显式 box-shadow,保证所有变体都能过渡 */\n.wui-textarea-inner::after {\n pointer-events: none;\n content: '';\n\n position: absolute;\n inset: 0;\n\n border-radius: inherit;\n\n box-shadow:\n inset 0 0 0 1px transparent,\n 0 0 0 var(--wui-focus-ring-width, 3px) transparent;\n\n transition: box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([focused]) .wui-textarea-inner::after {\n box-shadow:\n inset 0 0 0 1px var(--wui-color-accent, #08f),\n 0 0 0 var(--wui-focus-ring-width, 3px)\n var(--wui-color-focus-ring, color-mix(in srgb, var(--wui-color-accent, #08f) 40%, transparent));\n}\n\nslot {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text-secondary, #6a6a6a);\n}\n\nslot.empty {\n display: none;\n}\n\n/* 复用 web-ui-button icon ghost:仅覆盖颜色为 faint 并对齐首行,保持弱意图清除图标观感;\n 负 margin-left 抵消容器 flex gap,让清除按钮紧贴文本域内容\n 负 margin-right 抵消 button padding,让清除按钮右侧 spacing 视觉上协调 */\n.wui-textarea-inner web-ui-button[variant='ghost'] {\n --wui-button-color: var(--wui-textarea-clear-color);\n\n /* 与首行文字垂直居中对齐:容器 align-items: flex-start 使按钮贴内容区顶部,\n 首行中心 = padding-top + 行高/2;24px 按钮需相对内容区上移 (行高 − 按钮高度) / 2 */\n margin-top: calc((var(--wui-font-size, 14px) * 1.5 - 24px) / 2);\n margin-right: -4px;\n margin-left: -8px;\n}\n"],"mappings":""}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
export type ThemeAppearance = 'light' | 'dark' | 'system';
|
|
3
|
+
export type ResolvedThemeAppearance = 'light' | 'dark';
|
|
3
4
|
export type ThemeMotion = 'full' | 'reduced' | 'system';
|
|
4
5
|
export declare class WebUiTheme extends LitElement {
|
|
5
6
|
static styles: import('lit').CSSResult;
|
|
@@ -7,6 +8,12 @@ export declare class WebUiTheme extends LitElement {
|
|
|
7
8
|
set appearance(v: string | undefined);
|
|
8
9
|
private _appearance?;
|
|
9
10
|
private _appearanceRequest;
|
|
11
|
+
private _resolvedAppearance;
|
|
12
|
+
get resolvedAppearance(): ResolvedThemeAppearance;
|
|
13
|
+
private _setResolvedAppearance;
|
|
14
|
+
private _syncResolvedAppearance;
|
|
15
|
+
private _syncSystemAppearanceSubscription;
|
|
16
|
+
private _unsubscribeSystemAppearance?;
|
|
10
17
|
get motion(): ThemeMotion;
|
|
11
18
|
set motion(v: string);
|
|
12
19
|
private _motion;
|
|
@@ -16,6 +23,7 @@ export declare class WebUiTheme extends LitElement {
|
|
|
16
23
|
connectedCallback(): void;
|
|
17
24
|
disconnectedCallback(): void;
|
|
18
25
|
protected updated(): void;
|
|
26
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
19
27
|
private _syncRootPageColorSync;
|
|
20
28
|
getOverlayRoot(): HTMLElement | undefined;
|
|
21
29
|
isReducedMotion(): boolean;
|
|
@@ -29,6 +37,7 @@ export declare class WebUiTheme extends LitElement {
|
|
|
29
37
|
private _cleanupThemeTransition;
|
|
30
38
|
private _activeTransition?;
|
|
31
39
|
private _transitionCleanup?;
|
|
40
|
+
private _transitionInputSkipCleanup?;
|
|
32
41
|
render(): import('lit').TemplateResult<1>;
|
|
33
42
|
firstUpdated(): void;
|
|
34
43
|
private _hasAppearance;
|
|
@@ -2,43 +2,60 @@ import e from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate
|
|
|
2
2
|
import { normalizeLiteral as t } from "../../shared/normalize/index.js";
|
|
3
3
|
import { parseDuration as n } from "../../shared/theme/duration.js";
|
|
4
4
|
import { applyOverlayRootStyles as r } from "../../shared/overlay/overlay-root.js";
|
|
5
|
-
import { registerThemeRootSync as i,
|
|
6
|
-
import
|
|
7
|
-
import { LitElement as
|
|
8
|
-
import { customElement as
|
|
5
|
+
import { registerThemeRootSync as i, subscribeThemeSystemAppearanceChange as a, unregisterThemeRootSync as o } from "../../shared/theme/root-sync.js";
|
|
6
|
+
import s from "./style.js";
|
|
7
|
+
import { LitElement as c, html as l, nothing as u, unsafeCSS as d } from "lit";
|
|
8
|
+
import { customElement as f, property as p } from "lit/decorators.js";
|
|
9
9
|
//#region src/components/theme/index.ts
|
|
10
|
-
var
|
|
10
|
+
var m, h = [
|
|
11
11
|
"light",
|
|
12
12
|
"dark",
|
|
13
13
|
"system"
|
|
14
|
-
],
|
|
14
|
+
], g = [
|
|
15
15
|
"full",
|
|
16
16
|
"reduced",
|
|
17
17
|
"system"
|
|
18
|
-
],
|
|
18
|
+
], _ = {
|
|
19
19
|
x: NaN,
|
|
20
20
|
y: NaN
|
|
21
|
-
},
|
|
21
|
+
}, v = 0, y = 0, b = null, x = (e) => {
|
|
22
22
|
let t = e;
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
23
|
+
_.x = t.clientX, _.y = t.clientY;
|
|
24
|
+
}, S = () => {
|
|
25
|
+
_.x = NaN, _.y = NaN;
|
|
26
26
|
};
|
|
27
|
-
function S() {
|
|
28
|
-
v++ > 0 || (window.addEventListener("pointerdown", b, !0), window.addEventListener("keydown", x, !0));
|
|
29
|
-
}
|
|
30
27
|
function C() {
|
|
31
|
-
|
|
28
|
+
y++ > 0 || (window.addEventListener("pointerdown", x, !0), window.addEventListener("keydown", S, !0));
|
|
29
|
+
}
|
|
30
|
+
function w() {
|
|
31
|
+
--y > 0 || (window.removeEventListener("pointerdown", x, !0), window.removeEventListener("keydown", S, !0));
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
var T = ["pointerdown", "wheel"];
|
|
34
|
+
function E(e) {
|
|
35
|
+
let t = !0, n = () => {
|
|
36
|
+
if (t) {
|
|
37
|
+
t = !1;
|
|
38
|
+
for (let e of T) window.removeEventListener(e, r, !0);
|
|
39
|
+
}
|
|
40
|
+
}, r = () => {
|
|
41
|
+
t && (n(), e.skipTransition?.());
|
|
42
|
+
};
|
|
43
|
+
for (let e of T) window.addEventListener(e, r, {
|
|
44
|
+
capture: !0,
|
|
45
|
+
passive: !0
|
|
46
|
+
});
|
|
47
|
+
return n;
|
|
48
|
+
}
|
|
49
|
+
function D(e) {
|
|
50
|
+
if (e === "dark") return "dark";
|
|
51
|
+
if (e !== "system") return "light";
|
|
35
52
|
try {
|
|
36
53
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
37
54
|
} catch {
|
|
38
55
|
return "light";
|
|
39
56
|
}
|
|
40
57
|
}
|
|
41
|
-
function
|
|
58
|
+
function O(e, t) {
|
|
42
59
|
return Number.isFinite(e) && Number.isFinite(t) ? {
|
|
43
60
|
x: e,
|
|
44
61
|
y: t
|
|
@@ -47,49 +64,71 @@ function T(e, t) {
|
|
|
47
64
|
y: (window.innerHeight || 0) / 2
|
|
48
65
|
};
|
|
49
66
|
}
|
|
50
|
-
var
|
|
67
|
+
var k = class extends c {
|
|
51
68
|
static {
|
|
52
|
-
|
|
69
|
+
m = this;
|
|
53
70
|
}
|
|
54
71
|
constructor(...e) {
|
|
55
|
-
super(...e), this._appearanceRequest = 0, this._motion = "system", this._transitionOriginListening = !1, this._transitionRequested = !1, this._warned = !1;
|
|
72
|
+
super(...e), this._appearanceRequest = 0, this._resolvedAppearance = "light", this._motion = "system", this._transitionOriginListening = !1, this._transitionRequested = !1, this._warned = !1;
|
|
56
73
|
}
|
|
57
74
|
static {
|
|
58
|
-
this.styles =
|
|
75
|
+
this.styles = d(s);
|
|
59
76
|
}
|
|
60
77
|
get appearance() {
|
|
61
78
|
return this._appearance;
|
|
62
79
|
}
|
|
63
80
|
set appearance(e) {
|
|
64
|
-
let n = this._appearance, r = e === void 0 ? void 0 : t(e,
|
|
65
|
-
if (r !== void 0 && !this._transitionRequested &&
|
|
81
|
+
let n = this._appearance, r = e === void 0 ? void 0 : t(e, h, "light"), i = D(r), a = ++this._appearanceRequest;
|
|
82
|
+
if (r !== void 0 && !this._transitionRequested && b === null && this._shouldAnimateAppearance(r, i)) {
|
|
66
83
|
this._transitionRequested = !0;
|
|
67
|
-
let e = { requestId:
|
|
68
|
-
|
|
69
|
-
this._cleanupThemeTransition(), this._transitionRequested = !1,
|
|
84
|
+
let e = { requestId: a };
|
|
85
|
+
b = e, this._startThemeTransition(r, i, n, a, e).catch(() => {
|
|
86
|
+
this._cleanupThemeTransition(), this._transitionRequested = !1, b === e && (b = null), this._appearanceRequest === a && (this._appearance = r, this._syncResolvedAppearance(), this.requestUpdate("appearance", n));
|
|
87
|
+
});
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this._appearance = r, this._syncResolvedAppearance(), this.requestUpdate("appearance", n);
|
|
91
|
+
}
|
|
92
|
+
get resolvedAppearance() {
|
|
93
|
+
return this._resolvedAppearance;
|
|
94
|
+
}
|
|
95
|
+
_setResolvedAppearance(e) {
|
|
96
|
+
(this._resolvedAppearance !== e || this.getAttribute("resolved-appearance") !== e) && (this._resolvedAppearance = e, this.setAttribute("resolved-appearance", e));
|
|
97
|
+
}
|
|
98
|
+
_syncResolvedAppearance() {
|
|
99
|
+
this._setResolvedAppearance(D(this._appearance)), this._syncSystemAppearanceSubscription();
|
|
100
|
+
}
|
|
101
|
+
_syncSystemAppearanceSubscription() {
|
|
102
|
+
if (this.isConnected && this._hasAppearance() && this._appearance === "system") {
|
|
103
|
+
if (this._unsubscribeSystemAppearance) return;
|
|
104
|
+
this._unsubscribeSystemAppearance = a(() => {
|
|
105
|
+
this._setResolvedAppearance(D(this._appearance));
|
|
70
106
|
});
|
|
71
107
|
return;
|
|
72
108
|
}
|
|
73
|
-
this.
|
|
109
|
+
this._unsubscribeSystemAppearance?.(), this._unsubscribeSystemAppearance = void 0;
|
|
74
110
|
}
|
|
75
111
|
get motion() {
|
|
76
112
|
return this._motion;
|
|
77
113
|
}
|
|
78
114
|
set motion(e) {
|
|
79
115
|
let n = this._motion;
|
|
80
|
-
this._motion = t(e,
|
|
116
|
+
this._motion = t(e, g, "system"), this.requestUpdate("motion", n);
|
|
81
117
|
}
|
|
82
118
|
connectedCallback() {
|
|
83
|
-
super.connectedCallback(), this._syncTransitionOriginListeners(!0), this._syncRootPageColorSync(), this._warnWhenAppearanceIsMissing();
|
|
119
|
+
super.connectedCallback(), this._syncResolvedAppearance(), this._syncTransitionOriginListeners(!0), this._syncRootPageColorSync(), this._warnWhenAppearanceIsMissing();
|
|
84
120
|
}
|
|
85
121
|
disconnectedCallback() {
|
|
86
|
-
this._syncTransitionOriginListeners(!1),
|
|
122
|
+
this._syncTransitionOriginListeners(!1), this._unsubscribeSystemAppearance?.(), this._unsubscribeSystemAppearance = void 0, o(this), this._activeTransition?.skipTransition?.(), this._cleanupThemeTransition(), super.disconnectedCallback();
|
|
87
123
|
}
|
|
88
124
|
updated() {
|
|
89
125
|
this._warnWhenAppearanceIsMissing(), this._syncRootPageColorSync();
|
|
90
126
|
}
|
|
127
|
+
attributeChangedCallback(e, t, n) {
|
|
128
|
+
super.attributeChangedCallback(e, t, n), e === "resolved-appearance" && this._setResolvedAppearance(D(this._appearance));
|
|
129
|
+
}
|
|
91
130
|
_syncRootPageColorSync() {
|
|
92
|
-
this._hasAppearance() ? i(this) :
|
|
131
|
+
this._hasAppearance() ? i(this) : o(this);
|
|
93
132
|
}
|
|
94
133
|
getOverlayRoot() {
|
|
95
134
|
if (this._hasAppearance()) return this.renderRoot.querySelector("[data-wui-overlay-container]") ?? void 0;
|
|
@@ -106,21 +145,21 @@ var E = class extends s {
|
|
|
106
145
|
_findThemeAncestor() {
|
|
107
146
|
let e = this.parentNode;
|
|
108
147
|
for (; e;) {
|
|
109
|
-
if (e instanceof
|
|
148
|
+
if (e instanceof m && e !== this && e._hasAppearance()) return e;
|
|
110
149
|
e = e instanceof ShadowRoot ? e.host : e.parentElement;
|
|
111
150
|
}
|
|
112
151
|
return null;
|
|
113
152
|
}
|
|
114
153
|
_transitionOrigin() {
|
|
115
|
-
if (Number.isFinite(
|
|
154
|
+
if (Number.isFinite(_.x) && Number.isFinite(_.y)) return _;
|
|
116
155
|
let e = this.getBoundingClientRect();
|
|
117
156
|
return e.width > 0 && e.height > 0 ? {
|
|
118
157
|
x: e.left + e.width / 2,
|
|
119
158
|
y: e.top + e.height / 2
|
|
120
|
-
} :
|
|
159
|
+
} : O(NaN, NaN);
|
|
121
160
|
}
|
|
122
161
|
_syncTransitionOriginListeners(e) {
|
|
123
|
-
e !== this._transitionOriginListening && (this._transitionOriginListening = e, e ?
|
|
162
|
+
e !== this._transitionOriginListening && (this._transitionOriginListening = e, e ? C() : w());
|
|
124
163
|
}
|
|
125
164
|
_transitionMotion() {
|
|
126
165
|
let e = getComputedStyle(this), t = n(e.getPropertyValue("--wui-theme-transition-duration")) ?? 500, r = e.getPropertyValue("--wui-theme-transition-easing").trim() || "ease-in", i = globalThis.CSS?.supports("animation-timing-function", r) ? r : "ease-in";
|
|
@@ -129,75 +168,75 @@ var E = class extends s {
|
|
|
129
168
|
easing: i
|
|
130
169
|
};
|
|
131
170
|
}
|
|
132
|
-
_shouldAnimateAppearance(e) {
|
|
133
|
-
let
|
|
134
|
-
return !
|
|
171
|
+
_shouldAnimateAppearance(e, t) {
|
|
172
|
+
let n = this._appearance;
|
|
173
|
+
return !n || n === e || D(n) === t ? !1 : typeof document.startViewTransition == "function" && Array.isArray(document.adoptedStyleSheets) && !this.isReducedMotion() && this._transitionMotion().duration > 0;
|
|
135
174
|
}
|
|
136
|
-
async _startThemeTransition(e, t, n, r) {
|
|
137
|
-
let
|
|
138
|
-
|
|
175
|
+
async _startThemeTransition(e, t, n, r, i) {
|
|
176
|
+
let a = this._findThemeAncestor() === null, o = a ? void 0 : `wui-theme-transition-${++v}`, s = new CSSStyleSheet();
|
|
177
|
+
o ? s.replaceSync(`
|
|
139
178
|
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
|
|
140
179
|
::view-transition-old(root), ::view-transition-new(root) { mix-blend-mode: normal; }
|
|
141
|
-
::view-transition-image-pair(root), ::view-transition-image-pair(${
|
|
142
|
-
::view-transition-group(${
|
|
143
|
-
::view-transition-old(${
|
|
180
|
+
::view-transition-image-pair(root), ::view-transition-image-pair(${o}) { mix-blend-mode: normal; }
|
|
181
|
+
::view-transition-group(${o}) { animation: none; }
|
|
182
|
+
::view-transition-old(${o}), ::view-transition-new(${o}) {
|
|
144
183
|
animation: none;
|
|
145
184
|
mix-blend-mode: normal;
|
|
146
185
|
}
|
|
147
|
-
::view-transition-old(${
|
|
148
|
-
::view-transition-new(${
|
|
149
|
-
`) :
|
|
186
|
+
::view-transition-old(${o}) { z-index: ${t === "dark" ? 1 : 2}; }
|
|
187
|
+
::view-transition-new(${o}) { z-index: ${t === "dark" ? 2 : 1}; }
|
|
188
|
+
`) : s.replaceSync(`
|
|
150
189
|
::view-transition-old(root), ::view-transition-new(root) {
|
|
151
190
|
animation: none;
|
|
152
191
|
mix-blend-mode: normal;
|
|
153
192
|
}
|
|
154
193
|
::view-transition-image-pair(root) { mix-blend-mode: normal; }
|
|
155
|
-
::view-transition-old(root) { z-index: ${
|
|
156
|
-
::view-transition-new(root) { z-index: ${
|
|
194
|
+
::view-transition-old(root) { z-index: ${t === "dark" ? 1 : 2}; }
|
|
195
|
+
::view-transition-new(root) { z-index: ${t === "dark" ? 2 : 1}; }
|
|
157
196
|
`);
|
|
158
|
-
let
|
|
159
|
-
|
|
160
|
-
let
|
|
197
|
+
let c = this.style.getPropertyValue("display"), l = o ? this.style.getPropertyValue("view-transition-name") : void 0;
|
|
198
|
+
o && (this.style.setProperty("display", "block"), this.style.setProperty("view-transition-name", o));
|
|
199
|
+
let u = () => {
|
|
161
200
|
try {
|
|
162
|
-
document.adoptedStyleSheets = document.adoptedStyleSheets.filter((e) => e !==
|
|
201
|
+
document.adoptedStyleSheets = document.adoptedStyleSheets.filter((e) => e !== s);
|
|
163
202
|
} catch {}
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
this._transitionCleanup =
|
|
167
|
-
let
|
|
168
|
-
this._activeTransition =
|
|
169
|
-
let
|
|
170
|
-
|
|
171
|
-
let { duration:
|
|
172
|
-
if (
|
|
173
|
-
let { x: r, y:
|
|
174
|
-
if (!
|
|
175
|
-
let
|
|
176
|
-
x: r -
|
|
177
|
-
y:
|
|
178
|
-
}, c = Math.ceil(Math.hypot(Math.max(s.x,
|
|
179
|
-
|
|
180
|
-
duration:
|
|
203
|
+
o && (l ? this.style.setProperty("view-transition-name", l) : this.style.removeProperty("view-transition-name"), c ? this.style.setProperty("display", c) : this.style.removeProperty("display"));
|
|
204
|
+
}, d = () => this._appearanceRequest === r ? (this._appearance = e, this._syncResolvedAppearance(), this.requestUpdate("appearance", n), this.updateComplete) : this.updateComplete;
|
|
205
|
+
this._transitionCleanup = u, document.adoptedStyleSheets = [...document.adoptedStyleSheets, s];
|
|
206
|
+
let f = document.startViewTransition(d);
|
|
207
|
+
this._activeTransition = f, this._transitionInputSkipCleanup = E(f);
|
|
208
|
+
let p = [];
|
|
209
|
+
f.ready.then(() => {
|
|
210
|
+
let { duration: e, easing: n } = this._transitionMotion();
|
|
211
|
+
if (e <= 0) return;
|
|
212
|
+
let { x: r, y: i } = this._transitionOrigin(), s = t === "dark" ? "::view-transition-new(root)" : "::view-transition-old(root)";
|
|
213
|
+
if (!a) {
|
|
214
|
+
let a = this.getBoundingClientRect(), s = {
|
|
215
|
+
x: r - a.left,
|
|
216
|
+
y: i - a.top
|
|
217
|
+
}, c = Math.ceil(Math.hypot(Math.max(s.x, a.width - s.x), Math.max(s.y, a.height - s.y))), l = this._transitionKeyframes(s.x, s.y, c, t), u = t === "dark" ? `::view-transition-new(${o})` : `::view-transition-old(${o})`;
|
|
218
|
+
p.push(document.documentElement.animate(l, {
|
|
219
|
+
duration: e,
|
|
181
220
|
easing: n,
|
|
182
221
|
fill: "both",
|
|
183
222
|
pseudoElement: u
|
|
184
223
|
}));
|
|
185
224
|
return;
|
|
186
225
|
}
|
|
187
|
-
let c = Math.ceil(Math.hypot(Math.max(r, window.innerWidth - r), Math.max(
|
|
188
|
-
|
|
189
|
-
duration:
|
|
226
|
+
let c = Math.ceil(Math.hypot(Math.max(r, window.innerWidth - r), Math.max(i, window.innerHeight - i)));
|
|
227
|
+
p.push(document.documentElement.animate(this._transitionKeyframes(r, i, c, t), {
|
|
228
|
+
duration: e,
|
|
190
229
|
easing: n,
|
|
191
230
|
fill: "both",
|
|
192
231
|
pseudoElement: s
|
|
193
232
|
}));
|
|
194
233
|
}).catch(() => void 0);
|
|
195
234
|
try {
|
|
196
|
-
await
|
|
235
|
+
await f.finished;
|
|
197
236
|
} catch {} finally {
|
|
198
|
-
this._activeTransition = void 0, this._transitionCleanup = void 0;
|
|
199
|
-
for (let e of
|
|
200
|
-
|
|
237
|
+
this._transitionInputSkipCleanup?.(), this._transitionInputSkipCleanup = void 0, this._activeTransition = void 0, this._transitionCleanup = void 0;
|
|
238
|
+
for (let e of p) e.cancel();
|
|
239
|
+
u(), this._transitionRequested = !1, b === i && (b = null);
|
|
201
240
|
}
|
|
202
241
|
}
|
|
203
242
|
_transitionKeyframes(e, t, n, r) {
|
|
@@ -205,31 +244,35 @@ var E = class extends s {
|
|
|
205
244
|
return r === "dark" ? [{ clipPath: i }, { clipPath: a }] : [{ clipPath: a }, { clipPath: i }];
|
|
206
245
|
}
|
|
207
246
|
_cleanupThemeTransition(e = !0) {
|
|
208
|
-
this._activeTransition = void 0;
|
|
247
|
+
this._transitionInputSkipCleanup?.(), this._transitionInputSkipCleanup = void 0, this._activeTransition = void 0;
|
|
209
248
|
let t = this._transitionCleanup;
|
|
210
249
|
this._transitionCleanup = void 0, e && t?.();
|
|
211
250
|
}
|
|
212
251
|
render() {
|
|
213
|
-
return
|
|
252
|
+
return l`<slot></slot>${this._hasAppearance() ? l`<div data-wui-overlay-container></div>` : u}`;
|
|
214
253
|
}
|
|
215
254
|
firstUpdated() {
|
|
216
255
|
this.renderRoot instanceof ShadowRoot && r(this.renderRoot);
|
|
217
256
|
}
|
|
218
257
|
_hasAppearance() {
|
|
219
|
-
return this.appearance !== void 0 &&
|
|
258
|
+
return this.appearance !== void 0 && h.includes(this.appearance);
|
|
220
259
|
}
|
|
221
260
|
_warnWhenAppearanceIsMissing() {
|
|
222
261
|
this._hasAppearance() || this._warned;
|
|
223
262
|
}
|
|
224
263
|
};
|
|
225
|
-
e([
|
|
264
|
+
e([p({
|
|
226
265
|
type: String,
|
|
227
266
|
reflect: !0
|
|
228
|
-
})],
|
|
267
|
+
})], k.prototype, "appearance", null), e([p({
|
|
268
|
+
type: String,
|
|
269
|
+
reflect: !0,
|
|
270
|
+
attribute: "resolved-appearance"
|
|
271
|
+
})], k.prototype, "_resolvedAppearance", void 0), e([p({
|
|
229
272
|
type: String,
|
|
230
273
|
reflect: !0
|
|
231
|
-
})],
|
|
274
|
+
})], k.prototype, "motion", null), k = m = e([f("web-ui-theme")], k);
|
|
232
275
|
//#endregion
|
|
233
|
-
export {
|
|
276
|
+
export { k as WebUiTheme };
|
|
234
277
|
|
|
235
278
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/theme/index.ts"],"sourcesContent":["import { html, LitElement, nothing, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { normalizeLiteral } from '@/shared/normalize'\nimport { applyOverlayRootStyles } from '@/shared/overlay/overlay-root'\nimport { parseDuration } from '@/shared/theme/duration'\nimport { registerThemeRootSync, unregisterThemeRootSync } from '@/shared/theme/root-sync'\n\nimport style from './style.css?inline'\n\nexport type ThemeAppearance = 'light' | 'dark' | 'system'\nexport type ThemeMotion = 'full' | 'reduced' | 'system'\n\nconst APPEARANCES = ['light', 'dark', 'system'] as const\nconst MOTIONS = ['full', 'reduced', 'system'] as const\n\ninterface ViewTransitionLike {\n readonly ready: Promise<void>\n readonly finished: Promise<void>\n skipTransition?: () => void\n}\n\n// 根主题没有对应控件;记录最近一次触发主题变更的指针位置,键盘或程序化调用则回退中心。\nconst transitionOrigin = { x: Number.NaN, y: Number.NaN }\nlet transitionSequence = 0\nlet transitionOriginCount = 0\nlet themeTransitionFlightToken: object | null = null\nconst recordTransitionOrigin = (event: Event) => {\n const pointer = event as PointerEvent\n transitionOrigin.x = pointer.clientX\n transitionOrigin.y = pointer.clientY\n}\nconst forgetTransitionOrigin = () => {\n transitionOrigin.x = Number.NaN\n transitionOrigin.y = Number.NaN\n}\n\nfunction addTransitionOriginListeners() {\n if (transitionOriginCount++ > 0) return\n window.addEventListener('pointerdown', recordTransitionOrigin, true)\n window.addEventListener('keydown', forgetTransitionOrigin, true)\n}\n\nfunction removeTransitionOriginListeners() {\n if (--transitionOriginCount > 0) return\n window.removeEventListener('pointerdown', recordTransitionOrigin, true)\n window.removeEventListener('keydown', forgetTransitionOrigin, true)\n}\n\nfunction resolveAppearance(appearance: ThemeAppearance): 'light' | 'dark' {\n if (appearance !== 'system') return appearance\n try {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n } catch {\n return 'light'\n }\n}\n\nfunction transitionPoint(x: number, y: number): { x: number; y: number } {\n if (Number.isFinite(x) && Number.isFinite(y)) return { x, y }\n return {\n x: (window.innerWidth || 0) / 2,\n y: (window.innerHeight || 0) / 2\n }\n}\n\n@customElement('web-ui-theme')\nexport class WebUiTheme extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ type: String, reflect: true })\n get appearance(): ThemeAppearance | undefined {\n return this._appearance\n }\n set appearance(v: string | undefined) {\n const old = this._appearance\n const next = v !== undefined ? (normalizeLiteral(v, APPEARANCES, 'light') as ThemeAppearance) : undefined\n const request = ++this._appearanceRequest\n if (\n next !== undefined &&\n !this._transitionRequested &&\n themeTransitionFlightToken === null &&\n this._shouldAnimateAppearance(next)\n ) {\n // async helper 可能把函数体排到当前栈后;flight gate 必须在当前 setter 栈内生效。\n this._transitionRequested = true\n const flightToken = { requestId: request }\n themeTransitionFlightToken = flightToken\n void this._startThemeTransition(next, old!, request, flightToken).catch(() => {\n this._cleanupThemeTransition()\n this._transitionRequested = false\n if (themeTransitionFlightToken === flightToken) themeTransitionFlightToken = null\n if (this._appearanceRequest === request) {\n this._appearance = next\n this.requestUpdate('appearance', old)\n }\n })\n return\n }\n this._appearance = next\n this.requestUpdate('appearance', old)\n }\n private _appearance?: ThemeAppearance\n private _appearanceRequest = 0\n\n @property({ type: String, reflect: true })\n get motion(): ThemeMotion {\n return this._motion\n }\n set motion(v: string) {\n const old = this._motion\n this._motion = normalizeLiteral(v, MOTIONS, 'system') as ThemeMotion\n this.requestUpdate('motion', old)\n }\n private _motion: ThemeMotion = 'system'\n\n private _transitionOriginListening = false\n private _transitionRequested = false\n\n private _warned = false\n\n override connectedCallback() {\n super.connectedCallback()\n // 揭示开关曾由 transition prop 单独控制;现在统一由 motion 决定,\n // 因此连接期间始终记录圆心来源,真正是否动画仍看 _shouldAnimateAppearance。\n this._syncTransitionOriginListeners(true)\n this._syncRootPageColorSync()\n this._warnWhenAppearanceIsMissing()\n }\n\n override disconnectedCallback() {\n this._syncTransitionOriginListeners(false)\n unregisterThemeRootSync(this)\n this._activeTransition?.skipTransition?.()\n this._cleanupThemeTransition()\n super.disconnectedCallback()\n }\n\n protected override updated() {\n this._warnWhenAppearanceIsMissing()\n this._syncRootPageColorSync()\n }\n\n /*\n * root page 色同步的登记态:只有 active(有 appearance)的主题参与,\n * appearance 被清掉时撤销登记、把同步权顺延给下一个已连接实例。\n * updated() 里重复登记是幂等的,因此这里同时承担「appearance 变化后刷新 root 值」。\n */\n private _syncRootPageColorSync() {\n if (this._hasAppearance()) registerThemeRootSync(this)\n else unregisterThemeRootSync(this)\n }\n\n // 返回该主题拥有的浮层挂载点;未设置 appearance 时不创建。\n getOverlayRoot(): HTMLElement | undefined {\n if (!this._hasAppearance()) return undefined\n return this.renderRoot.querySelector<HTMLElement>('[data-wui-overlay-container]') ?? undefined\n }\n\n // 当前范围是否应减少动效;`system` 跟随用户的系统偏好。\n isReducedMotion(): boolean {\n if (this.motion === 'reduced') return true\n if (this.motion === 'full') return false\n\n try {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches\n } catch {\n return false\n }\n }\n\n private _findThemeAncestor(): WebUiTheme | null {\n let node = this.parentNode\n while (node) {\n if (node instanceof WebUiTheme && node !== this && node._hasAppearance()) return node\n if (node instanceof ShadowRoot) {\n node = node.host\n } else {\n node = node.parentElement\n }\n }\n return null\n }\n\n private _transitionOrigin(): { x: number; y: number } {\n if (Number.isFinite(transitionOrigin.x) && Number.isFinite(transitionOrigin.y)) {\n return transitionOrigin\n }\n\n const box = this.getBoundingClientRect()\n if (box.width > 0 && box.height > 0) {\n return { x: box.left + box.width / 2, y: box.top + box.height / 2 }\n }\n return transitionPoint(Number.NaN, Number.NaN)\n }\n\n private _syncTransitionOriginListeners(listening: boolean) {\n if (listening === this._transitionOriginListening) return\n this._transitionOriginListening = listening\n if (listening) addTransitionOriginListeners()\n else removeTransitionOriginListeners()\n }\n\n private _transitionMotion(): { duration: number; easing: string } {\n const style = getComputedStyle(this)\n const duration = parseDuration(style.getPropertyValue('--wui-theme-transition-duration')) ?? 500\n const easing = style.getPropertyValue('--wui-theme-transition-easing').trim() || 'ease-in'\n const safeEasing = globalThis.CSS?.supports('animation-timing-function', easing) ? easing : 'ease-in'\n return { duration: Math.max(0, duration), easing: safeEasing }\n }\n\n private _shouldAnimateAppearance(next: ThemeAppearance): boolean {\n const previous = this._appearance\n if (!previous || previous === next) return false\n if (resolveAppearance(previous) === resolveAppearance(next)) return false\n return (\n typeof document.startViewTransition === 'function' &&\n Array.isArray(document.adoptedStyleSheets) &&\n !this.isReducedMotion() &&\n this._transitionMotion().duration > 0\n )\n }\n\n // 嵌套主题只做局部揭示;View Transitions 需要 capture box,因此飞行期间临时生成一个 host box。\n private async _startThemeTransition(\n next: ThemeAppearance,\n previous: ThemeAppearance,\n request: number,\n flightToken: object\n ): Promise<void> {\n const root = this._findThemeAncestor() === null\n const transitionName = root ? undefined : `wui-theme-transition-${++transitionSequence}`\n const styleSheet = new CSSStyleSheet()\n if (transitionName) {\n styleSheet.replaceSync(`\n ::view-transition-old(root), ::view-transition-new(root) { animation: none; }\n ::view-transition-old(root), ::view-transition-new(root) { mix-blend-mode: normal; }\n ::view-transition-image-pair(root), ::view-transition-image-pair(${transitionName}) { mix-blend-mode: normal; }\n ::view-transition-group(${transitionName}) { animation: none; }\n ::view-transition-old(${transitionName}), ::view-transition-new(${transitionName}) {\n animation: none;\n mix-blend-mode: normal;\n }\n ::view-transition-old(${transitionName}) { z-index: ${next === 'dark' ? 1 : 2}; }\n ::view-transition-new(${transitionName}) { z-index: ${next === 'dark' ? 2 : 1}; }\n `)\n } else {\n styleSheet.replaceSync(`\n ::view-transition-old(root), ::view-transition-new(root) {\n animation: none;\n mix-blend-mode: normal;\n }\n ::view-transition-image-pair(root) { mix-blend-mode: normal; }\n ::view-transition-old(root) { z-index: ${next === 'dark' ? 1 : 2}; }\n ::view-transition-new(root) { z-index: ${next === 'dark' ? 2 : 1}; }\n `)\n }\n\n const hadDisplay = this.style.getPropertyValue('display')\n const hadTransitionName = transitionName ? this.style.getPropertyValue('view-transition-name') : undefined\n if (transitionName) {\n this.style.setProperty('display', 'block')\n this.style.setProperty('view-transition-name', transitionName)\n }\n\n const restoreCapture = () => {\n try {\n document.adoptedStyleSheets = document.adoptedStyleSheets.filter(sheet => sheet !== styleSheet)\n } catch {\n // 拒绝写入的 setter 也拒绝回收,样式表本就没进去;host 内联态的恢复不能因此中断。\n }\n if (!transitionName) return\n if (hadTransitionName) this.style.setProperty('view-transition-name', hadTransitionName)\n else this.style.removeProperty('view-transition-name')\n if (hadDisplay) this.style.setProperty('display', hadDisplay)\n else this.style.removeProperty('display')\n }\n\n const commit = () => {\n if (this._appearanceRequest !== request) return this.updateComplete\n this._appearance = next\n this.requestUpdate('appearance', previous)\n return this.updateComplete\n }\n // cleanup 必须在 adoptedStyleSheets 写入之前登记:写入同步抛错时 setter 的 .catch 才拿得到它,\n // 否则 host 上的 view-transition-name 会残留,污染之后每一次 view transition(issue #146)。\n this._transitionCleanup = restoreCapture\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, styleSheet]\n const transition = document.startViewTransition(commit) as unknown as ViewTransitionLike\n this._activeTransition = transition\n const animations: Animation[] = []\n\n transition.ready\n .then(() => {\n const { duration, easing } = this._transitionMotion()\n if (duration <= 0) return\n const { x, y } = this._transitionOrigin()\n const target = next === 'dark' ? '::view-transition-new(root)' : '::view-transition-old(root)'\n if (!root) {\n const box = this.getBoundingClientRect()\n const relative = { x: x - box.left, y: y - box.top }\n const radius = Math.ceil(\n Math.hypot(Math.max(relative.x, box.width - relative.x), Math.max(relative.y, box.height - relative.y))\n )\n const frames = this._transitionKeyframes(relative.x, relative.y, radius, next)\n const target =\n next === 'dark' ? `::view-transition-new(${transitionName})` : `::view-transition-old(${transitionName})`\n animations.push(\n document.documentElement.animate(frames, {\n duration,\n easing,\n fill: 'both',\n pseudoElement: target\n } as KeyframeAnimationOptions)\n )\n return\n }\n\n const radius = Math.ceil(Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y)))\n animations.push(\n document.documentElement.animate(this._transitionKeyframes(x, y, radius, next), {\n duration,\n easing,\n fill: 'both',\n pseudoElement: target\n } as KeyframeAnimationOptions)\n )\n })\n .catch(() => undefined)\n\n try {\n await transition.finished\n } catch {\n // API 缺失、capture 冲突或用户 skip 都不是状态错误;appearance 已由 update callback 提交。\n } finally {\n this._activeTransition = undefined\n this._transitionCleanup = undefined\n for (const animation of animations) animation.cancel()\n restoreCapture()\n // disconnected skip 会提前清掉 active;flight token/request 必须无条件释放。\n this._transitionRequested = false\n if (themeTransitionFlightToken === flightToken) themeTransitionFlightToken = null\n }\n }\n\n private _transitionKeyframes(x: number, y: number, radius: number, next: ThemeAppearance): Keyframe[] {\n const from = `circle(0px at ${x}px ${y}px)`\n const to = `circle(${radius}px at ${x}px ${y}px)`\n return next === 'dark' ? [{ clipPath: from }, { clipPath: to }] : [{ clipPath: to }, { clipPath: from }]\n }\n\n private _cleanupThemeTransition(restoreCapture = true) {\n this._activeTransition = undefined\n const cleanup = this._transitionCleanup\n this._transitionCleanup = undefined\n if (restoreCapture) cleanup?.()\n }\n\n private _activeTransition?: ViewTransitionLike\n private _transitionCleanup?: () => void\n\n override render() {\n return html`<slot></slot>${this._hasAppearance() ? html`<div data-wui-overlay-container></div>` : nothing}`\n }\n\n override firstUpdated() {\n if (this.renderRoot instanceof ShadowRoot) {\n applyOverlayRootStyles(this.renderRoot)\n }\n }\n\n private _hasAppearance(): this is this & { appearance: ThemeAppearance } {\n return this.appearance !== undefined && (APPEARANCES as readonly string[]).includes(this.appearance)\n }\n\n private _warnWhenAppearanceIsMissing() {\n if (this._hasAppearance() || this._warned || !import.meta.env.DEV) return\n this._warned = true\n console.warn('[web-ui-theme] appearance is required; this theme scope is inactive until it is set.')\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-theme': WebUiTheme\n }\n}\n"],"mappings":";;;;;;;;;OAaM,IAAc;CAAC;CAAS;CAAQ;AAAQ,GACxC,IAAU;CAAC;CAAQ;CAAW;AAAQ,GAStC,IAAmB;CAAE,GAAG;CAAY,GAAG;AAAW,GACpD,IAAqB,GACrB,IAAwB,GACxB,IAA4C,MAC1C,KAA0B,MAAiB;CAC/C,IAAM,IAAU;CAEhB,AADA,EAAiB,IAAI,EAAQ,SAC7B,EAAiB,IAAI,EAAQ;AAC/B,GACM,UAA+B;CAEnC,AADA,EAAiB,IAAI,KACrB,EAAiB,IAAI;AACvB;AAEA,SAAS,IAA+B;CAClC,MAA0B,MAC9B,OAAO,iBAAiB,eAAe,GAAwB,EAAI,GACnE,OAAO,iBAAiB,WAAW,GAAwB,EAAI;AACjE;AAEA,SAAS,IAAkC;CACrC,EAAE,IAAwB,MAC9B,OAAO,oBAAoB,eAAe,GAAwB,EAAI,GACtE,OAAO,oBAAoB,WAAW,GAAwB,EAAI;AACpE;AAEA,SAAS,EAAkB,GAA+C;CACxE,IAAI,MAAe,UAAU,OAAO;CACpC,IAAI;EACF,OAAO,OAAO,WAAW,8BAA8B,CAAC,CAAC,UAAU,SAAS;CAC9E,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,EAAgB,GAAW,GAAqC;CAEvE,OADI,OAAO,SAAS,CAAC,KAAK,OAAO,SAAS,CAAC,IAAU;EA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AAA,IAAA,GAvC1C,IAAA,IAAA,EAAA,CAAA,EAAc,cAAc,CAAA,GAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/theme/index.ts"],"sourcesContent":["import { html, LitElement, nothing, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { normalizeLiteral } from '@/shared/normalize'\nimport { applyOverlayRootStyles } from '@/shared/overlay/overlay-root'\nimport { parseDuration } from '@/shared/theme/duration'\nimport {\n registerThemeRootSync,\n subscribeThemeSystemAppearanceChange,\n unregisterThemeRootSync\n} from '@/shared/theme/root-sync'\n\nimport style from './style.css?inline'\n\nexport type ThemeAppearance = 'light' | 'dark' | 'system'\nexport type ResolvedThemeAppearance = 'light' | 'dark'\nexport type ThemeMotion = 'full' | 'reduced' | 'system'\n\nconst APPEARANCES = ['light', 'dark', 'system'] as const\nconst MOTIONS = ['full', 'reduced', 'system'] as const\n\ninterface ViewTransitionLike {\n readonly ready: Promise<void>\n readonly finished: Promise<void>\n skipTransition?: () => void\n}\n\n// 主 theme 组件不知道触发它的控件;pointerdown 记录坐标。键盘或程序化调用回退中心。\nconst transitionOrigin = { x: Number.NaN, y: Number.NaN }\nlet transitionSequence = 0\nlet transitionOriginCount = 0\nlet themeTransitionFlightToken: object | null = null\nconst recordTransitionOrigin = (event: Event) => {\n const pointer = event as PointerEvent\n transitionOrigin.x = pointer.clientX\n transitionOrigin.y = pointer.clientY\n}\nconst forgetTransitionOrigin = () => {\n transitionOrigin.x = Number.NaN\n transitionOrigin.y = Number.NaN\n}\n\nfunction addTransitionOriginListeners() {\n if (transitionOriginCount++ > 0) return\n window.addEventListener('pointerdown', recordTransitionOrigin, true)\n window.addEventListener('keydown', forgetTransitionOrigin, true)\n}\n\nfunction removeTransitionOriginListeners() {\n if (--transitionOriginCount > 0) return\n window.removeEventListener('pointerdown', recordTransitionOrigin, true)\n window.removeEventListener('keydown', forgetTransitionOrigin, true)\n}\n\nconst TRANSITION_SKIP_INPUT_EVENTS = ['pointerdown', 'wheel'] as const\n\n/*\n * rendering suppression 期间,规范强制 pointer hit-test 指向 documentElement;\n * 伪元素的 pointer-events 或 host 覆写窗口都无法覆盖这条渲染规则。只有按下或滚轮\n * 才取消揭示,牺牲剩余动画换回交互;移动和抬起不取消,避免切换控件的收尾事件或\n * 过渡期间的普通移动打断动画。触发事件本身仍按规范以 html 为目标,因此这里缩短的\n * 是失效窗口,不是对首个事件的追溯改道。\n */\nfunction addTransitionInputSkipListeners(transition: ViewTransitionLike): () => void {\n let listening = true\n const remove = () => {\n if (!listening) return\n listening = false\n for (const event of TRANSITION_SKIP_INPUT_EVENTS) {\n window.removeEventListener(event, skip, true)\n }\n }\n const skip = () => {\n if (!listening) return\n remove()\n transition.skipTransition?.()\n }\n for (const event of TRANSITION_SKIP_INPUT_EVENTS) {\n window.addEventListener(event, skip, { capture: true, passive: true })\n }\n return remove\n}\n\nfunction resolveAppearance(appearance: ThemeAppearance | undefined): ResolvedThemeAppearance {\n if (appearance === 'dark') return 'dark'\n if (appearance !== 'system') return 'light'\n try {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n } catch {\n return 'light'\n }\n}\n\nfunction transitionPoint(x: number, y: number): { x: number; y: number } {\n if (Number.isFinite(x) && Number.isFinite(y)) return { x, y }\n return {\n x: (window.innerWidth || 0) / 2,\n y: (window.innerHeight || 0) / 2\n }\n}\n\n@customElement('web-ui-theme')\nexport class WebUiTheme extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ type: String, reflect: true })\n get appearance(): ThemeAppearance | undefined {\n return this._appearance\n }\n set appearance(v: string | undefined) {\n const old = this._appearance\n const next = v !== undefined ? (normalizeLiteral(v, APPEARANCES, 'light') as ThemeAppearance) : undefined\n const resolvedNext = resolveAppearance(next)\n const request = ++this._appearanceRequest\n if (\n next !== undefined &&\n !this._transitionRequested &&\n themeTransitionFlightToken === null &&\n this._shouldAnimateAppearance(next, resolvedNext)\n ) {\n // async helper 可能把函数体排到当前栈后;flight gate 必须在当前 setter 栈内生效。\n this._transitionRequested = true\n const flightToken = { requestId: request }\n themeTransitionFlightToken = flightToken\n void this._startThemeTransition(next, resolvedNext, old!, request, flightToken).catch(() => {\n this._cleanupThemeTransition()\n this._transitionRequested = false\n if (themeTransitionFlightToken === flightToken) themeTransitionFlightToken = null\n if (this._appearanceRequest === request) {\n this._appearance = next\n this._syncResolvedAppearance()\n this.requestUpdate('appearance', old)\n }\n })\n return\n }\n this._appearance = next\n this._syncResolvedAppearance()\n this.requestUpdate('appearance', old)\n }\n private _appearance?: ThemeAppearance\n private _appearanceRequest = 0\n\n /*\n * resolved-appearance 是派生输出,不是第二个输入:像 selected-value 一样由组件独占写入,\n * 外部改动在同一 attribute reaction 内恢复,避免消费者把 system 的解析结果当成可设状态。\n */\n @property({ type: String, reflect: true, attribute: 'resolved-appearance' })\n private _resolvedAppearance: ResolvedThemeAppearance = 'light'\n\n get resolvedAppearance(): ResolvedThemeAppearance {\n return this._resolvedAppearance\n }\n\n private _setResolvedAppearance(value: ResolvedThemeAppearance) {\n const old = this._resolvedAppearance\n if (old === value && this.getAttribute('resolved-appearance') === value) return\n this._resolvedAppearance = value\n // 立即写 attribute:View Transition 的 update callback 要在同一次快照里换掉它。\n this.setAttribute('resolved-appearance', value)\n }\n\n private _syncResolvedAppearance() {\n this._setResolvedAppearance(resolveAppearance(this._appearance))\n this._syncSystemAppearanceSubscription()\n }\n\n private _syncSystemAppearanceSubscription() {\n const shouldSubscribe = this.isConnected && this._hasAppearance() && this._appearance === 'system'\n if (shouldSubscribe) {\n if (this._unsubscribeSystemAppearance) return\n this._unsubscribeSystemAppearance = subscribeThemeSystemAppearanceChange(() => {\n this._setResolvedAppearance(resolveAppearance(this._appearance))\n })\n return\n }\n this._unsubscribeSystemAppearance?.()\n this._unsubscribeSystemAppearance = undefined\n }\n private _unsubscribeSystemAppearance?: () => void\n\n @property({ type: String, reflect: true })\n get motion(): ThemeMotion {\n return this._motion\n }\n set motion(v: string) {\n const old = this._motion\n this._motion = normalizeLiteral(v, MOTIONS, 'system') as ThemeMotion\n this.requestUpdate('motion', old)\n }\n private _motion: ThemeMotion = 'system'\n\n private _transitionOriginListening = false\n private _transitionRequested = false\n\n private _warned = false\n\n override connectedCallback() {\n super.connectedCallback()\n this._syncResolvedAppearance()\n // 揭示开关曾由 transition prop 单独控制;现在统一由 motion 决定,\n // 因此连接期间始终记录圆心来源,真正是否动画仍看 _shouldAnimateAppearance。\n this._syncTransitionOriginListeners(true)\n this._syncRootPageColorSync()\n this._warnWhenAppearanceIsMissing()\n }\n\n override disconnectedCallback() {\n this._syncTransitionOriginListeners(false)\n this._unsubscribeSystemAppearance?.()\n this._unsubscribeSystemAppearance = undefined\n unregisterThemeRootSync(this)\n this._activeTransition?.skipTransition?.()\n this._cleanupThemeTransition()\n super.disconnectedCallback()\n }\n\n protected override updated() {\n this._warnWhenAppearanceIsMissing()\n this._syncRootPageColorSync()\n }\n\n override attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {\n super.attributeChangedCallback(name, oldValue, newValue)\n // super 已把外部值写进 backing field,所以这里必须按 appearance 重算,不能与字段比较。\n if (name === 'resolved-appearance') this._setResolvedAppearance(resolveAppearance(this._appearance))\n }\n\n /*\n * root page 色同步的登记态:只有 active(有 appearance)的主题参与,\n * appearance 被清掉时撤销登记、把同步权顺延给下一个已连接实例。\n * updated() 里重复登记是幂等的,因此这里同时承担「appearance 变化后刷新 root 值」。\n */\n private _syncRootPageColorSync() {\n if (this._hasAppearance()) registerThemeRootSync(this)\n else unregisterThemeRootSync(this)\n }\n\n // 返回该主题拥有的浮层挂载点;未设置 appearance 时不创建。\n getOverlayRoot(): HTMLElement | undefined {\n if (!this._hasAppearance()) return undefined\n return this.renderRoot.querySelector<HTMLElement>('[data-wui-overlay-container]') ?? undefined\n }\n\n // 当前范围是否应减少动效;`system` 跟随用户的系统偏好。\n isReducedMotion(): boolean {\n if (this.motion === 'reduced') return true\n if (this.motion === 'full') return false\n\n try {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches\n } catch {\n return false\n }\n }\n\n private _findThemeAncestor(): WebUiTheme | null {\n let node = this.parentNode\n while (node) {\n if (node instanceof WebUiTheme && node !== this && node._hasAppearance()) return node\n if (node instanceof ShadowRoot) {\n node = node.host\n } else {\n node = node.parentElement\n }\n }\n return null\n }\n\n private _transitionOrigin(): { x: number; y: number } {\n if (Number.isFinite(transitionOrigin.x) && Number.isFinite(transitionOrigin.y)) {\n return transitionOrigin\n }\n\n const box = this.getBoundingClientRect()\n if (box.width > 0 && box.height > 0) {\n return { x: box.left + box.width / 2, y: box.top + box.height / 2 }\n }\n return transitionPoint(Number.NaN, Number.NaN)\n }\n\n private _syncTransitionOriginListeners(listening: boolean) {\n if (listening === this._transitionOriginListening) return\n this._transitionOriginListening = listening\n if (listening) addTransitionOriginListeners()\n else removeTransitionOriginListeners()\n }\n\n private _transitionMotion(): { duration: number; easing: string } {\n const style = getComputedStyle(this)\n const duration = parseDuration(style.getPropertyValue('--wui-theme-transition-duration')) ?? 500\n const easing = style.getPropertyValue('--wui-theme-transition-easing').trim() || 'ease-in'\n const safeEasing = globalThis.CSS?.supports('animation-timing-function', easing) ? easing : 'ease-in'\n return { duration: Math.max(0, duration), easing: safeEasing }\n }\n\n private _shouldAnimateAppearance(next: ThemeAppearance, resolvedNext: ResolvedThemeAppearance): boolean {\n const previous = this._appearance\n if (!previous || previous === next) return false\n if (resolveAppearance(previous) === resolvedNext) return false\n return (\n typeof document.startViewTransition === 'function' &&\n Array.isArray(document.adoptedStyleSheets) &&\n !this.isReducedMotion() &&\n this._transitionMotion().duration > 0\n )\n }\n\n // 嵌套主题只做局部揭示;View Transitions 需要 capture box,因此飞行期间临时生成一个 host box。\n private async _startThemeTransition(\n next: ThemeAppearance,\n resolvedNext: ResolvedThemeAppearance,\n previous: ThemeAppearance,\n request: number,\n flightToken: object\n ): Promise<void> {\n const root = this._findThemeAncestor() === null\n const transitionName = root ? undefined : `wui-theme-transition-${++transitionSequence}`\n const styleSheet = new CSSStyleSheet()\n if (transitionName) {\n styleSheet.replaceSync(`\n ::view-transition-old(root), ::view-transition-new(root) { animation: none; }\n ::view-transition-old(root), ::view-transition-new(root) { mix-blend-mode: normal; }\n ::view-transition-image-pair(root), ::view-transition-image-pair(${transitionName}) { mix-blend-mode: normal; }\n ::view-transition-group(${transitionName}) { animation: none; }\n ::view-transition-old(${transitionName}), ::view-transition-new(${transitionName}) {\n animation: none;\n mix-blend-mode: normal;\n }\n ::view-transition-old(${transitionName}) { z-index: ${resolvedNext === 'dark' ? 1 : 2}; }\n ::view-transition-new(${transitionName}) { z-index: ${resolvedNext === 'dark' ? 2 : 1}; }\n `)\n } else {\n styleSheet.replaceSync(`\n ::view-transition-old(root), ::view-transition-new(root) {\n animation: none;\n mix-blend-mode: normal;\n }\n ::view-transition-image-pair(root) { mix-blend-mode: normal; }\n ::view-transition-old(root) { z-index: ${resolvedNext === 'dark' ? 1 : 2}; }\n ::view-transition-new(root) { z-index: ${resolvedNext === 'dark' ? 2 : 1}; }\n `)\n }\n\n const hadDisplay = this.style.getPropertyValue('display')\n const hadTransitionName = transitionName ? this.style.getPropertyValue('view-transition-name') : undefined\n if (transitionName) {\n this.style.setProperty('display', 'block')\n this.style.setProperty('view-transition-name', transitionName)\n }\n\n const restoreCapture = () => {\n try {\n document.adoptedStyleSheets = document.adoptedStyleSheets.filter(sheet => sheet !== styleSheet)\n } catch {\n // 拒绝写入的 setter 也拒绝回收,样式表本就没进去;host 内联态的恢复不能因此中断。\n }\n if (!transitionName) return\n if (hadTransitionName) this.style.setProperty('view-transition-name', hadTransitionName)\n else this.style.removeProperty('view-transition-name')\n if (hadDisplay) this.style.setProperty('display', hadDisplay)\n else this.style.removeProperty('display')\n }\n\n const commit = () => {\n if (this._appearanceRequest !== request) return this.updateComplete\n this._appearance = next\n this._syncResolvedAppearance()\n this.requestUpdate('appearance', previous)\n return this.updateComplete\n }\n // cleanup 必须在 adoptedStyleSheets 写入之前登记:写入同步抛错时 setter 的 .catch 才拿得到它,\n // 否则 host 上的 view-transition-name 会残留,污染之后每一次 view transition(issue #146)。\n this._transitionCleanup = restoreCapture\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, styleSheet]\n const transition = document.startViewTransition(commit) as unknown as ViewTransitionLike\n this._activeTransition = transition\n this._transitionInputSkipCleanup = addTransitionInputSkipListeners(transition)\n const animations: Animation[] = []\n\n transition.ready\n .then(() => {\n const { duration, easing } = this._transitionMotion()\n if (duration <= 0) return\n const { x, y } = this._transitionOrigin()\n const target = resolvedNext === 'dark' ? '::view-transition-new(root)' : '::view-transition-old(root)'\n if (!root) {\n const box = this.getBoundingClientRect()\n const relative = { x: x - box.left, y: y - box.top }\n const radius = Math.ceil(\n Math.hypot(Math.max(relative.x, box.width - relative.x), Math.max(relative.y, box.height - relative.y))\n )\n const frames = this._transitionKeyframes(relative.x, relative.y, radius, resolvedNext)\n const target =\n resolvedNext === 'dark'\n ? `::view-transition-new(${transitionName})`\n : `::view-transition-old(${transitionName})`\n animations.push(\n document.documentElement.animate(frames, {\n duration,\n easing,\n fill: 'both',\n pseudoElement: target\n } as KeyframeAnimationOptions)\n )\n return\n }\n\n const radius = Math.ceil(Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y)))\n animations.push(\n document.documentElement.animate(this._transitionKeyframes(x, y, radius, resolvedNext), {\n duration,\n easing,\n fill: 'both',\n pseudoElement: target\n } as KeyframeAnimationOptions)\n )\n })\n .catch(() => undefined)\n\n try {\n await transition.finished\n } catch {\n // API 缺失、capture 冲突或用户 skip 都不是状态错误;appearance 已由 update callback 提交。\n } finally {\n this._transitionInputSkipCleanup?.()\n this._transitionInputSkipCleanup = undefined\n this._activeTransition = undefined\n this._transitionCleanup = undefined\n for (const animation of animations) animation.cancel()\n restoreCapture()\n // disconnected skip 会提前清掉 active;flight token/request 必须无条件释放。\n this._transitionRequested = false\n if (themeTransitionFlightToken === flightToken) themeTransitionFlightToken = null\n }\n }\n\n private _transitionKeyframes(\n x: number,\n y: number,\n radius: number,\n resolvedNext: ResolvedThemeAppearance\n ): Keyframe[] {\n const from = `circle(0px at ${x}px ${y}px)`\n const to = `circle(${radius}px at ${x}px ${y}px)`\n return resolvedNext === 'dark' ? [{ clipPath: from }, { clipPath: to }] : [{ clipPath: to }, { clipPath: from }]\n }\n\n private _cleanupThemeTransition(restoreCapture = true) {\n this._transitionInputSkipCleanup?.()\n this._transitionInputSkipCleanup = undefined\n this._activeTransition = undefined\n const cleanup = this._transitionCleanup\n this._transitionCleanup = undefined\n if (restoreCapture) cleanup?.()\n }\n\n private _activeTransition?: ViewTransitionLike\n private _transitionCleanup?: () => void\n private _transitionInputSkipCleanup?: () => void\n\n override render() {\n return html`<slot></slot>${this._hasAppearance() ? html`<div data-wui-overlay-container></div>` : nothing}`\n }\n\n override firstUpdated() {\n if (this.renderRoot instanceof ShadowRoot) {\n applyOverlayRootStyles(this.renderRoot)\n }\n }\n\n private _hasAppearance(): this is this & { appearance: ThemeAppearance } {\n return this.appearance !== undefined && (APPEARANCES as readonly string[]).includes(this.appearance)\n }\n\n private _warnWhenAppearanceIsMissing() {\n if (this._hasAppearance() || this._warned || !import.meta.env.DEV) return\n this._warned = true\n console.warn('[web-ui-theme] appearance is required; this theme scope is inactive until it is set.')\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-theme': WebUiTheme\n }\n}\n"],"mappings":";;;;;;;;;OAkBM,IAAc;CAAC;CAAS;CAAQ;AAAQ,GACxC,IAAU;CAAC;CAAQ;CAAW;AAAQ,GAStC,IAAmB;CAAE,GAAG;CAAY,GAAG;AAAW,GACpD,IAAqB,GACrB,IAAwB,GACxB,IAA4C,MAC1C,KAA0B,MAAiB;CAC/C,IAAM,IAAU;CAEhB,AADA,EAAiB,IAAI,EAAQ,SAC7B,EAAiB,IAAI,EAAQ;AAC/B,GACM,UAA+B;CAEnC,AADA,EAAiB,IAAI,KACrB,EAAiB,IA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H;CAEA,wBAAgC,IAAiB,IAAM;EAGrD,AAFA,KAAK,8BAA8B,GACnC,KAAK,8BAA8B,KAAA,GACnC,KAAK,oBAAoB,KAAA;EACzB,IAAM,IAAU,KAAK;EAErB,AADA,KAAK,qBAAqB,KAAA,GACtB,KAAgB,IAAU;CAChC;CAMA,SAAkB;EAChB,OAAO,CAAI,gBAAgB,KAAK,eAAe,IAAI,CAAI,2CAA2C;CACpG;CAEA,eAAwB;EACtB,AAAI,KAAK,sBAAsB,cAC7B,EAAuB,KAAK,UAAU;CAE1C;CAEA,iBAAyE;EACvE,OAAO,KAAK,eAAe,KAAA,KAAc,EAAkC,SAAS,KAAK,UAAU;CACrG;CAEA,+BAAuC;EACjC,KAAK,eAAe,KAAK,KAAK;CAGpC;AACF;AAvXG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,cAAA,IAAA,GA0CxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,WAAW;AAAsB,CAAC,CAAA,GAAA,EAAA,WAAA,uBAAA,KAAA,CAAA,GAkC1E,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,UAAA,IAAA,GAhF1C,IAAA,IAAA,EAAA,CAAA,EAAc,cAAc,CAAA,GAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/components/theme/style.css?inline
|
|
2
|
-
var e = "*,:before,:after{box-sizing:border-box}:host{--wui-font-size:14px;--wui-input-width:200px;--wui-control-size:36px;--wui-overlay-min-width:200px;--wui-selection-control-size:18px;--wui-radio-group-gap:
|
|
2
|
+
var e = "*,:before,:after{box-sizing:border-box}:host{--wui-font-size-caption:12px;--wui-font-size-readout:13px;--wui-font-size:14px;--wui-font-size-title:18px;--wui-font-weight-medium:500;--wui-font-weight-semibold:600;--wui-line-height-tight:1.2;--wui-line-height-snug:1.4;--wui-line-height-normal:1.5;--wui-line-height-relaxed:1.6;--wui-space-1:4px;--wui-space-2:8px;--wui-space-3:12px;--wui-space-4:16px;--wui-space-5:20px;--wui-space-6:24px;--wui-input-width:200px;--wui-control-size:36px;--wui-overlay-min-width:200px;--wui-selection-control-size:18px;--wui-radio-group-gap:var(--wui-space-2);--wui-checkbox-group-gap:var(--wui-space-2);--wui-layer-inline-overlay:1;--wui-layer-header:10;--wui-layer-auxiliary:20;--wui-layer-banner:30;--wui-layer-tabbar:40;--wui-layer-sidebar:50;--wui-layer-menu:100;--wui-layer-menu-nested:110;--wui-layer-toast:200;--wui-layer-loading:300;--wui-duration-press:80ms;--wui-duration-feedback:.1s;--wui-duration-trigger:.16s;--wui-duration-focus:.2s;--wui-duration-float-enter:.24s;--wui-duration-float-exit:.16s;--wui-duration-dialog-enter:.32s;--wui-duration-dialog-exit:.26s;--wui-duration-drawer-enter:.28s;--wui-duration-drawer-exit:.24s;--wui-duration-drawer-nested:.45s;--wui-duration-toast-enter:.28s;--wui-duration-toast-exit:.2s;--wui-duration-collapse-enter:.2s;--wui-duration-collapse-exit:.16s;--wui-duration-layout:.2s;--wui-duration-swipe-settle:.22s;--wui-duration-spin:.6s;--wui-duration-spinner:.8s;--wui-theme-transition-duration:.5s;--wui-theme-transition-easing:ease-in;--wui-ease-enter:cubic-bezier(.23, 1, .32, 1);--wui-ease-dialog:cubic-bezier(.2, 0, 0, 1);--wui-ease-slide:cubic-bezier(.77, 0, .175, 1);--wui-ease-swipe:cubic-bezier(.32, .72, 0, 1);--wui-ease-float:cubic-bezier(.4, .38, .2, 1);--wui-scale-enter:.95;--wui-dialog-scale-enter:1.1;--wui-focus-ring-width:3px;--wui-radius-control:calc(infinity * 1px);--wui-radius-menu:18px;--wui-radius-overlay:28px;display:contents}:host([motion=reduced]){--wui-duration-press:0s;--wui-duration-feedback:0s;--wui-duration-trigger:0s;--wui-duration-focus:0s;--wui-duration-float-enter:0s;--wui-duration-float-exit:0s;--wui-duration-dialog-enter:0s;--wui-duration-dialog-exit:0s;--wui-duration-drawer-enter:0s;--wui-duration-drawer-exit:0s;--wui-duration-drawer-nested:0s;--wui-duration-toast-enter:0s;--wui-duration-toast-exit:0s;--wui-duration-collapse-enter:0s;--wui-duration-collapse-exit:0s;--wui-duration-layout:0s;--wui-duration-swipe-settle:0s;--wui-theme-transition-duration:0s;--wui-duration-spin:1.6s;--wui-duration-spinner:1.6s;--wui-scale-enter:1;--wui-dialog-scale-enter:1}@media (prefers-reduced-motion:reduce){:host([motion=system]){--wui-duration-press:0s;--wui-duration-feedback:0s;--wui-duration-trigger:0s;--wui-duration-focus:0s;--wui-duration-float-enter:0s;--wui-duration-float-exit:0s;--wui-duration-dialog-enter:0s;--wui-duration-dialog-exit:0s;--wui-duration-drawer-enter:0s;--wui-duration-drawer-exit:0s;--wui-duration-drawer-nested:0s;--wui-duration-toast-enter:0s;--wui-duration-toast-exit:0s;--wui-duration-collapse-enter:0s;--wui-duration-collapse-exit:0s;--wui-duration-layout:0s;--wui-duration-swipe-settle:0s;--wui-theme-transition-duration:0s;--wui-duration-spin:1.6s;--wui-duration-spinner:1.6s;--wui-scale-enter:1;--wui-dialog-scale-enter:1}}:host([appearance=light]),:host([appearance=system]){--wui-color-page:#fff;--wui-color-surface:#fff;--wui-color-surface-raised:#f2f2f7;--wui-color-surface-control:#dfdfdf;--wui-color-surface-track:#e5e5ea;--wui-color-surface-menu:#fafafac2;--wui-color-surface-glass:#fafafa57;--wui-color-surface-glass-hover:color-mix(in srgb, var(--wui-color-text) 6%, var(--wui-color-surface-glass));--wui-color-surface-glass-active:color-mix(in srgb, var(--wui-color-text) 15%, var(--wui-color-surface-glass));--wui-color-surface-overlay:#f8f8f8eb;--wui-color-surface-sidebar:#e9e9e9d1;--wui-color-surface-segmented:#e5e5ea;--wui-color-surface-selected:#fff;--wui-color-text:#1b1b1b;--wui-color-text-secondary:#6a6a6a;--wui-color-text-tertiary:color-mix(in srgb, var(--wui-color-text) 35%, transparent);--wui-color-text-disabled:color-mix(in srgb, var(--wui-color-text) 32%, transparent);--wui-color-state-layer-hover:color-mix(in srgb, var(--wui-color-text) 6%, transparent);--wui-color-state-layer-active:color-mix(in srgb, var(--wui-color-text) 15%, transparent);--wui-color-border:#0000001a;--wui-color-glass-highlight:#ffffffe6;--wui-color-glass-ring:#0000000d;--wui-color-glass-ring-sheen:#ffffff80;--wui-color-glass-ring-shade:#00000008;--wui-glass-brightness:1.06;--wui-color-accent:#08f;--wui-color-on-accent:#fff;--wui-color-on-control:#fff;--wui-color-success:#16a34a;--wui-color-warning:#d97706;--wui-color-danger:#dc2626;--wui-color-info:#2563eb;--wui-color-backdrop:#0000001f;--wui-shadow-overlay:2px 16px 40px #0006;--wui-shadow-panel:0 3px 9px #00000045;--wui-shadow-glass:0 0 1px #00000005, 0 0 8px #00000008, 0 2px 16px #00000006, 0 8px 32px #00000004;--wui-color-focus-ring:color-mix(in srgb, var(--wui-color-accent,#08f) 40%, transparent);--lightningcss-light:initial;--lightningcss-dark: ;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}:host([appearance=dark]){--wui-color-page:#242628;--wui-color-surface:#2c2c2e;--wui-color-surface-raised:#2c2c2e;--wui-color-surface-control:#3a3a3c;--wui-color-surface-track:#444446;--wui-color-surface-menu:#313032bd;--wui-color-surface-glass:#2c2c2e6b;--wui-color-surface-glass-hover:color-mix(in srgb, var(--wui-color-text) 6%, var(--wui-color-surface-glass));--wui-color-surface-glass-active:color-mix(in srgb, var(--wui-color-text) 15%, var(--wui-color-surface-glass));--wui-color-surface-overlay:#202222eb;--wui-color-surface-sidebar:#2c2c2ecc;--wui-color-surface-segmented:#3a3a3c;--wui-color-surface-selected:#5c5c5e;--wui-color-text:#e9eaea;--wui-color-text-secondary:#a1a1a6;--wui-color-text-tertiary:color-mix(in srgb, var(--wui-color-text) 42%, transparent);--wui-color-text-disabled:color-mix(in srgb, var(--wui-color-text) 38%, transparent);--wui-color-state-layer-hover:color-mix(in srgb, var(--wui-color-text) 6%, transparent);--wui-color-state-layer-active:color-mix(in srgb, var(--wui-color-text) 15%, transparent);--wui-color-border:#ffffff24;--wui-color-glass-highlight:#ffffff1a;--wui-color-glass-ring:#ffffff0d;--wui-color-glass-ring-sheen:#fff3;--wui-color-glass-ring-shade:#00000080;--wui-glass-brightness:1.02;--wui-color-accent:#0a84ff;--wui-color-on-accent:#fff;--wui-color-on-control:#f2f2f7;--wui-color-success:#30d158;--wui-color-warning:#ff9f0a;--wui-color-danger:#ff453a;--wui-color-info:#64d2ff;--wui-color-backdrop:#0000007a;--wui-shadow-overlay:0 18px 48px #0000007a;--wui-shadow-panel:0 4px 16px #00000052;--wui-shadow-glass:0 8px 24px #00000014;--wui-color-focus-ring:color-mix(in srgb, var(--wui-color-accent,#0a84ff) 62%, transparent);--lightningcss-light: ;--lightningcss-dark:initial;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}@media (prefers-color-scheme:dark){:host([appearance=system]){--wui-color-page:#242628;--wui-color-surface:#2c2c2e;--wui-color-surface-raised:#2c2c2e;--wui-color-surface-control:#3a3a3c;--wui-color-surface-track:#444446;--wui-color-surface-menu:#313032bd;--wui-color-surface-glass:#2c2c2e6b;--wui-color-surface-glass-hover:color-mix(in srgb, var(--wui-color-text) 6%, var(--wui-color-surface-glass));--wui-color-surface-glass-active:color-mix(in srgb, var(--wui-color-text) 15%, var(--wui-color-surface-glass));--wui-color-surface-overlay:#202222eb;--wui-color-surface-sidebar:#2c2c2ecc;--wui-color-surface-segmented:#3a3a3c;--wui-color-surface-selected:#5c5c5e;--wui-color-text:#e9eaea;--wui-color-text-secondary:#a1a1a6;--wui-color-text-tertiary:color-mix(in srgb, var(--wui-color-text) 42%, transparent);--wui-color-text-disabled:color-mix(in srgb, var(--wui-color-text) 38%, transparent);--wui-color-state-layer-hover:color-mix(in srgb, var(--wui-color-text) 6%, transparent);--wui-color-state-layer-active:color-mix(in srgb, var(--wui-color-text) 15%, transparent);--wui-color-border:#ffffff24;--wui-color-glass-highlight:#ffffff1a;--wui-color-glass-ring:#ffffff0d;--wui-color-glass-ring-sheen:#fff3;--wui-color-glass-ring-shade:#00000080;--wui-glass-brightness:1.02;--wui-color-accent:#0a84ff;--wui-color-on-accent:#fff;--wui-color-on-control:#f2f2f7;--wui-color-success:#30d158;--wui-color-warning:#ff9f0a;--wui-color-danger:#ff453a;--wui-color-info:#64d2ff;--wui-color-backdrop:#0000007a;--wui-shadow-overlay:0 18px 48px #0000007a;--wui-shadow-panel:0 4px 16px #00000052;--wui-shadow-glass:0 8px 24px #00000014;--wui-color-focus-ring:color-mix(in srgb, var(--wui-color-accent,#0a84ff) 62%, transparent);--lightningcss-light: ;--lightningcss-dark:initial;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as default };
|
|
5
5
|
|