@endfield-ui/react 1.1.0 → 1.2.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/NOTICE.md +4 -3
- package/README.md +24 -2
- package/dist/game/assets/splash_bg.jpg +0 -0
- package/dist/game/assets/splash_bg_portrait.jpg +0 -0
- package/dist/game/assets/splash_deco.svg +4 -0
- package/dist/game/assets/splash_logo.svg +1 -0
- package/dist/game/assets/splash_triangles.svg +4 -0
- package/dist/game/resource-provenance.json +70 -1
- package/dist/game/styles.css +1 -1
- package/dist/game.d.ts +13 -1
- package/dist/game.js +29 -2
- package/dist/index.d.ts +42 -1
- package/dist/index.js +253 -30
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/README.md +1 -0
- package/src/components/alert/Alert.tsx +1 -1
- package/src/components/date-picker/DateField.tsx +0 -2
- package/src/components/dropdown-menu/menu-style.ts +6 -1
- package/src/components/file-upload/FileUpload.tsx +5 -2
- package/src/components/input/control-box.ts +30 -10
- package/src/components/otp-input/OtpInput.tsx +35 -43
- package/src/components/segmented-control/SegmentedControl.tsx +2 -2
- package/src/components/select/Select.tsx +0 -2
- package/src/components/splash-screen/SplashScreen.tsx +340 -0
- package/src/components/splash-screen/index.ts +1 -0
- package/src/components/tag-input/TagInput.tsx +5 -2
- package/src/components/toast/Toast.tsx +4 -3
- package/src/index.ts +1 -0
- package/src/styles/README.md +4 -1
- package/src/styles/theme.css +33 -0
- package/src/styles/utilities.css +8 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useEffect,
|
|
3
3
|
useId,
|
|
4
|
+
useLayoutEffect,
|
|
4
5
|
useMemo,
|
|
5
6
|
useRef,
|
|
6
7
|
useState,
|
|
@@ -203,9 +204,11 @@ export function TagInput({
|
|
|
203
204
|
return () => clearTimeout(timer);
|
|
204
205
|
}, [flash]);
|
|
205
206
|
|
|
206
|
-
//
|
|
207
|
+
// 删掉一个之后焦点落到哪:等这一次渲染落到页面上,旁边那个小块才是"旁边那个",当场交出去。
|
|
208
|
+
// 不用 useEffect:它晚一拍,上一次渲染留下的那一份可能在这次删除之后才补跑——
|
|
209
|
+
// 看到的还是删之前的那一排,焦点留在马上要走的那一块上,随后掉到 body
|
|
207
210
|
const pendingFocus = useRef<number | "input" | null>(null);
|
|
208
|
-
|
|
211
|
+
useLayoutEffect(() => {
|
|
209
212
|
const target = pendingFocus.current;
|
|
210
213
|
if (target === null) return;
|
|
211
214
|
pendingFocus.current = null;
|
|
@@ -178,9 +178,10 @@ function ToastHost({ placement, label, closeLabel, children }: ToastHostProps) {
|
|
|
178
178
|
data-theme="dark"
|
|
179
179
|
className={cn(
|
|
180
180
|
"pointer-events-auto absolute left-1/2 w-max max-w-full",
|
|
181
|
-
//
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
// 暗色页面上黑底和页面只差一档,靠环境阴影分开
|
|
182
|
+
"bg-black/80 shadow-sm text-base leading-[1.4] text-white",
|
|
183
|
+
// 高对比模式下系统把阴影关掉、底色换成页面色,提示就没有边界了:补一圈线
|
|
184
|
+
"forced-colors:border forced-colors:border-[CanvasText]",
|
|
184
185
|
// 三样各走各的:淡入淡出 200ms;进场的位移 300ms;没划够就松手,滑回原位 200ms。
|
|
185
186
|
// 拖动中基元把过渡整个关掉,位置贴着手指
|
|
186
187
|
"transition-[opacity,translate,transform] duration-[var(--duration-fast),var(--duration-base),var(--duration-fast)] ease-[var(--ease-standard),var(--ease-exit),var(--ease-standard)]",
|
package/src/index.ts
CHANGED
|
@@ -63,6 +63,7 @@ export * from "./components/skeleton";
|
|
|
63
63
|
export * from "./components/slider";
|
|
64
64
|
export * from "./components/sparkline";
|
|
65
65
|
export * from "./components/spinner";
|
|
66
|
+
export * from "./components/splash-screen";
|
|
66
67
|
export * from "./components/stat";
|
|
67
68
|
export * from "./components/stepper";
|
|
68
69
|
export * from "./components/steps";
|
package/src/styles/README.md
CHANGED
|
@@ -67,7 +67,10 @@ Game 实机风格的样式不在这个目录里,也不在主样式里:源码
|
|
|
67
67
|
|
|
68
68
|
这些类只画形状。什么东西可以切角、哪里能放斜纹,见 [docs/design/elements](../../../../docs/design/elements/corner-and-wedge.md) 各篇的"什么时候用"。预编译的 `styles.css` 里只有组件自己用到的那几个;不用 Tailwind 的项目用对应的装饰组件。
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
文件末尾还有两个自定义变体:
|
|
71
|
+
|
|
72
|
+
- `choice-diamond:`,在祖先带 `data-choice="diamond"` 时生效,复选与单选靠它整体换成菱形符号。
|
|
73
|
+
- `cq-portrait:`,在最近的尺寸容器(`container-type: size`)高大于宽时生效。开屏页靠它换成竖排——看的是它所在的那一块,不是视口。
|
|
71
74
|
|
|
72
75
|
## 注意
|
|
73
76
|
|
package/src/styles/theme.css
CHANGED
|
@@ -374,6 +374,7 @@
|
|
|
374
374
|
--animate-turn-in: ef-turn-in 300ms ease-out both;
|
|
375
375
|
--animate-fade-in: ef-fade-in 300ms ease-out both;
|
|
376
376
|
--animate-indeterminate: ef-indeterminate 1.2s linear infinite alternate;
|
|
377
|
+
--animate-indeterminate-y: ef-indeterminate-y 1.2s linear infinite alternate;
|
|
377
378
|
--animate-pulse: ef-pulse 2s ease-in-out infinite;
|
|
378
379
|
--animate-bracket-in: ef-bracket-in 200ms ease-out both;
|
|
379
380
|
--animate-shift-in: ef-shift-in 300ms ease-out both;
|
|
@@ -507,6 +508,16 @@
|
|
|
507
508
|
}
|
|
508
509
|
}
|
|
509
510
|
|
|
511
|
+
/* 同上,竖着的轨道:开屏页贴左缘的那根条 */
|
|
512
|
+
@keyframes ef-indeterminate-y {
|
|
513
|
+
from {
|
|
514
|
+
transform: translateY(0);
|
|
515
|
+
}
|
|
516
|
+
to {
|
|
517
|
+
transform: translateY(150%);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
510
521
|
/* 骨架:很轻的明度往返,不是扫光 */
|
|
511
522
|
@keyframes ef-pulse {
|
|
512
523
|
0%,
|
|
@@ -610,6 +621,28 @@
|
|
|
610
621
|
--color-info: var(--ef-info);
|
|
611
622
|
}
|
|
612
623
|
|
|
624
|
+
/* ------------------------------------------------------------------ */
|
|
625
|
+
/* 开屏页的进度 */
|
|
626
|
+
/* ------------------------------------------------------------------ */
|
|
627
|
+
|
|
628
|
+
/*
|
|
629
|
+
* SplashScreen 把进度写成根上的这两个变量,注册成数值之后才能过渡:条长、读数的位置、
|
|
630
|
+
* 底图的模糊都由第一个算,读数的数字是第二个(整数,经计数器显示)。两个一起过渡,
|
|
631
|
+
* 所以这四样天然同拍,半路改值也是从当前的位置折过去。
|
|
632
|
+
* 不认 @property 的浏览器里它们只是普通变量:值照样对,只是不补间、直接到位。
|
|
633
|
+
*/
|
|
634
|
+
@property --ef-splash-progress {
|
|
635
|
+
syntax: "<number>";
|
|
636
|
+
inherits: true;
|
|
637
|
+
initial-value: 0;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
@property --ef-splash-percent {
|
|
641
|
+
syntax: "<integer>";
|
|
642
|
+
inherits: true;
|
|
643
|
+
initial-value: 0;
|
|
644
|
+
}
|
|
645
|
+
|
|
613
646
|
/* ------------------------------------------------------------------ */
|
|
614
647
|
/* 主题切换 */
|
|
615
648
|
/* ------------------------------------------------------------------ */
|
package/src/styles/utilities.css
CHANGED
|
@@ -240,3 +240,11 @@
|
|
|
240
240
|
/* ------------------------------------------------------------------ */
|
|
241
241
|
|
|
242
242
|
@custom-variant choice-diamond (&:where([data-choice="diamond"], [data-choice="diamond"] *));
|
|
243
|
+
|
|
244
|
+
/* ------------------------------------------------------------------ */
|
|
245
|
+
/* 所在的容器是竖着的(高大于宽):开屏页据此换成竖排。 */
|
|
246
|
+
/* 看的是最近的尺寸容器(container-type: size),不是视口—— */
|
|
247
|
+
/* 放进一个框里的开屏页,横竖由那个框说了算 */
|
|
248
|
+
/* ------------------------------------------------------------------ */
|
|
249
|
+
|
|
250
|
+
@custom-variant cq-portrait (@container (orientation: portrait));
|