@manohub/ui 1.2.12 → 1.2.13

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.
@@ -54,15 +54,19 @@
54
54
  transition-timing-function: var(--ui-ease-out);
55
55
  transition-behavior: allow-discrete;
56
56
  }
57
- /* 展开态(`[open]` 由原生 `showModal()` 写上) */
57
+ /* 展开态(`[open]` 由原生 `showModal()` 写上)。
58
+ 进场走 **animation**、不用 `@starting-style`:宿主微前端(micro-app)的作用域转换是 **at-rule 白名单**
59
+ (keyframes / media / supports / import / container / layer …),`@starting-style` 不在名单里,会被当成
60
+ 普通选择器加前缀、产出 `micro-app[name=x] @starting-style{…}` 这条非法规则并被浏览器整块丢弃 ——
61
+ 微应用里表现为「进场硬切、退场照播」。`@keyframes` 在白名单内,scoping 后保持合法。
62
+ 退场仍走上面的 transition(收起态本身就是终点,不需要前值)。 */
58
63
  .mh-dialog[open] {
59
64
  opacity: 1;
60
65
  translate: 0 0;
66
+ animation: mh-dialog-in var(--ui-duration-slow) var(--ui-ease-out);
61
67
  }
62
- /* 进场的前值:`display` 从 `none` 变 `flex` 时浏览器没有「改动前的计算值」,只能由这条补 ——
63
- 没有 `@starting-style`,进场同样不会播(退场不需要它,收起态本身就是终点)。 */
64
- @starting-style {
65
- .mh-dialog[open] {
68
+ @keyframes mh-dialog-in {
69
+ from {
66
70
  opacity: 0;
67
71
  translate: 0 8px;
68
72
  }
@@ -96,9 +100,10 @@
96
100
  }
97
101
  .mh-dialog[open]::backdrop {
98
102
  opacity: 1;
103
+ animation: mh-dialog-backdrop-in var(--ui-duration-slow) var(--ui-ease-out);
99
104
  }
100
- @starting-style {
101
- .mh-dialog[open]::backdrop {
105
+ @keyframes mh-dialog-backdrop-in {
106
+ from {
102
107
  opacity: 0;
103
108
  }
104
109
  }
@@ -240,10 +245,14 @@
240
245
  padding-inline: var(--ui-dialog-padding-x);
241
246
  }
242
247
 
243
- /* 减弱动效:整条过渡关掉(含 `display` / `overlay` 的延后)—— 收起回到「立即消失」的既有行为 */
248
+ /* 减弱动效:过渡与进场动画一起关掉(含 `display` / `overlay` 的延后)—— 收起回到「立即消失」的既有行为。
249
+ `[open]` 那两条的 animation 特异性高于基态,必须在这里显式点名压掉。 */
244
250
  @media (prefers-reduced-motion: reduce) {
245
251
  .mh-dialog,
246
- .mh-dialog::backdrop {
252
+ .mh-dialog::backdrop,
253
+ .mh-dialog[open],
254
+ .mh-dialog[open]::backdrop {
247
255
  transition: none;
256
+ animation: none;
248
257
  }
249
258
  }
@@ -57,34 +57,50 @@
57
57
  }
58
58
  .mh-drawer[open]::backdrop {
59
59
  opacity: 1;
60
+ animation: mh-drawer-backdrop-in var(--ui-duration-slow) var(--ui-ease-out);
60
61
  }
61
- @starting-style {
62
- .mh-drawer[open]::backdrop {
62
+ @keyframes mh-drawer-backdrop-in {
63
+ from {
63
64
  opacity: 0;
64
65
  }
65
66
  }
66
67
 
67
- /* 收起态 = 停在所贴那一侧视口外(退场的终点);进场的起点由 `@starting-style` 补
68
- (`display: none → flex` 那一刻没有「改动前的计算值」)。 */
68
+ /* 收起态 = 停在所贴那一侧视口外(退场的终点)。
69
+ 进场起点走 **animation**、不用 `@starting-style`:宿主微前端(micro-app)的作用域转换是 at-rule 白名单
70
+ (不含 `@starting-style`),那条规则会被改写成非法选择器、整块丢弃 ⇒ 微应用里进场硬切、退场照播。
71
+ 位移只碰独立的 `translate`,不碰 `transform`(不覆盖定位)。 */
69
72
  .mh-drawer:not([open]) {
70
73
  translate: 100% 0;
71
74
  }
72
75
  .mh-drawer--left:not([open]) {
73
76
  translate: -100% 0;
74
77
  }
75
- @starting-style {
76
- .mh-drawer[open] {
78
+ .mh-drawer[open] {
79
+ animation: mh-drawer-in var(--ui-duration-slow) var(--ui-ease-out);
80
+ }
81
+ /* 左档必须排在右档之后:两条特异性相同,靠源码顺序取最后一个 animation-name */
82
+ .mh-drawer--left[open] {
83
+ animation-name: mh-drawer-in-left;
84
+ }
85
+ @keyframes mh-drawer-in {
86
+ from {
77
87
  translate: 100% 0;
78
88
  }
79
- .mh-drawer--left[open] {
89
+ }
90
+ @keyframes mh-drawer-in-left {
91
+ from {
80
92
  translate: -100% 0;
81
93
  }
82
94
  }
83
- /* 减弱动效:整条过渡关掉(含 `display` / `overlay` 的延后)—— 收起回到「立即消失」的既有行为 */
95
+ /* 减弱动效:过渡与进场动画一起关掉(含 `display` / `overlay` 的延后)—— 收起回到「立即消失」的既有行为。
96
+ `[open]` 那两条的 animation 特异性高于基态,必须在这里显式点名压掉。 */
84
97
  @media (prefers-reduced-motion: reduce) {
85
98
  .mh-drawer,
86
- .mh-drawer::backdrop {
99
+ .mh-drawer::backdrop,
100
+ .mh-drawer[open],
101
+ .mh-drawer[open]::backdrop {
87
102
  transition: none;
103
+ animation: none;
88
104
  }
89
105
  }
90
106
 
@@ -55,9 +55,13 @@
55
55
  .mh-popup-host:hover .mh-tooltip.mh-popup--hover,
56
56
  .mh-popup-host:focus-within .mh-tooltip.mh-popup--hover {
57
57
  opacity: 1;
58
+ /* 进场走 animation、不用 `@starting-style`:宿主微前端(micro-app)的作用域转换是 at-rule 白名单
59
+ (不含 `@starting-style`),那条规则会被改写成非法选择器、整块丢弃 ⇒ 微应用里只有淡出不淡入。
60
+ 显示由操作层切 `display`,元素从 `none` 变可见时浏览器会自动起播这条动画。 */
61
+ animation: mh-tooltip-in var(--ui-duration-slow) var(--ui-ease-out);
58
62
  }
59
- @starting-style {
60
- .mh-popup-host:hover .mh-tooltip.mh-popup--hover {
63
+ @keyframes mh-tooltip-in {
64
+ from {
61
65
  opacity: 0;
62
66
  }
63
67
  }
@@ -27,8 +27,8 @@
27
27
  * `:is()`(0-3-0)—— 皮肤自带 display 会压过 UA 的收起 `display: none`;③ hover 档两条(同上)。三条
28
28
  * display 规则都只碰 display。
29
29
  * 禁写清单(与折叠同款):底 / 边 / 圆角 / 内距 / 宽高 / 字号 / 阴影 / 遮罩色。
30
- * **动效只许「开合淡入淡出」**(第七节):禁 keyframes、禁位移 / 缩放(会和四向翻面、锚点呼吸位打架),
31
- * 时长与缓动走 theme 的 `--ui-duration-*` / `--ui-ease-*`。
30
+ * **动效只许「开合淡入淡出」,且只在第七节定义一次**(皮肤与消费方不得自写 keyframes,
31
+ * 也禁位移 / 缩放 —— 会和四向翻面、锚点呼吸位打架),时长与缓动走 theme 的 `--ui-duration-*` / `--ui-ease-*`。
32
32
  * 层级:popover 档由 top layer 接管(零 z-index),hover 档不进 top layer 故自带一层 z-index。
33
33
  */
34
34
  /* ===== 一、状态根 ===== */
@@ -164,6 +164,7 @@
164
164
  * 原生收起会立刻把节点摘出 top layer,`display` / `overlay` 的 `allow-discrete` 把「收起」延后到
165
165
  * 过渡结束,才有退场可播;`overlay` 漏了面板会先离开 top layer,淡出跑到页面内容底下(看不见)。
166
166
  * 只碰 `opacity`:位移会与四向翻面、锚点呼吸位打架,各皮肤需要时自己加(本层 0 特异性,永远让位)。
167
+ * 进场走 animation、退场走 transition(原因见展开态那条注释);两者都只碰 `opacity`。
167
168
  * 静态档(不带 `popover` 的摆样)与 hover 档不受影响;时长 / 缓动走 theme 的动效令牌。 */
168
169
  :where(.mh-popup[popover]) {
169
170
  opacity: 0;
@@ -174,16 +175,22 @@
174
175
  }
175
176
  :where(.mh-popup[popover]:popover-open) {
176
177
  opacity: 1;
177
- }
178
- /* 进场前值:`display` 从 `none` 变回来时没有「改动前的计算值」,只能由这条补 */
179
- @starting-style {
180
- :where(.mh-popup[popover]:popover-open) {
178
+ /* 进场走 animation、不用 `@starting-style`:宿主微前端(micro-app)的作用域转换是 at-rule 白名单
179
+ (keyframes / media / supports / import / container / layer …),`@starting-style` 不在名单里,
180
+ 会被当成普通选择器加前缀、产出 `micro-app[name=x] @starting-style{…}` 这条非法规则并被整块丢弃 ——
181
+ 微应用里浮层「进场硬切、退场照播」。`@keyframes` 在白名单内,scoping 后保持合法。 */
182
+ animation: mh-popup-in var(--ui-duration-fast) var(--ui-ease-out);
183
+ }
184
+ @keyframes mh-popup-in {
185
+ from {
181
186
  opacity: 0;
182
187
  }
183
188
  }
184
- /* 减弱动效:整条关掉(含 `display` / `overlay` 的延后)—— 收起回到「立即消失」 */
189
+ /* 减弱动效:过渡与进场动画一起关掉(含 `display` / `overlay` 的延后)—— 收起回到「立即消失」 */
185
190
  @media (prefers-reduced-motion: reduce) {
186
- :where(.mh-popup[popover]) {
191
+ :where(.mh-popup[popover]),
192
+ :where(.mh-popup[popover]:popover-open) {
187
193
  transition: none;
194
+ animation: none;
188
195
  }
189
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manohub/ui",
3
- "version": "1.2.12",
3
+ "version": "1.2.13",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "AIHub 自绘组件层:不依赖 farris 的手写 Vue TSX 组件 + 自带令牌层(Farris 规范视觉 · daisyUI 式语义令牌 · shadcn 式 API 词汇)。",
@@ -35,7 +35,7 @@
35
35
  "vue": "^3.5.0"
36
36
  },
37
37
  "dependencies": {
38
- "@manohub/icon": "^1.2.12"
38
+ "@manohub/icon": "^1.2.13"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^24.0.0",