@stackflow/plugin-basic-ui 0.21.3-alpha.0 → 0.21.4-alpha.4
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/dist/components/AppBar.d.ts +2 -1
- package/dist/hooks/useStyleEffect.d.ts +3 -3
- package/dist/index.css +49 -42
- package/dist/index.css.map +3 -3
- package/dist/index.js +35 -30
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +35 -30
- package/dist/index.mjs.map +3 -3
- package/dist/theme.css.d.ts +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/isBrowser.d.ts +5 -0
- package/dist/utils/isServer.d.ts +5 -0
- package/package.json +3 -3
- package/src/basicUIPlugin.tsx +2 -2
- package/src/components/AppBar.css.ts +9 -6
- package/src/components/AppBar.tsx +6 -0
- package/src/hooks/useStyleEffect.ts +8 -7
- package/src/hooks/useStyleEffectHide.ts +2 -1
- package/src/hooks/useStyleEffectOffset.ts +4 -4
- package/src/hooks/useStyleEffectSwipeBack.ts +3 -3
- package/src/theme.css.ts +2 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/isBrowser.ts +9 -0
- package/src/utils/isServer.ts +7 -0
|
@@ -2,6 +2,7 @@ import type { ActivityTransitionState } from "@stackflow/core";
|
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
4
|
|
|
5
|
+
import { noop } from "../utils";
|
|
5
6
|
import { useNullableActivity } from "./useNullableActivity";
|
|
6
7
|
|
|
7
8
|
const connections: {
|
|
@@ -14,17 +15,17 @@ const connections: {
|
|
|
14
15
|
>;
|
|
15
16
|
} = {};
|
|
16
17
|
|
|
17
|
-
export function useStyleEffect({
|
|
18
|
+
export function useStyleEffect<T extends HTMLElement>({
|
|
18
19
|
styleName,
|
|
19
20
|
refs,
|
|
20
21
|
effect,
|
|
21
22
|
effectDeps,
|
|
22
23
|
}: {
|
|
23
24
|
styleName: string;
|
|
24
|
-
refs: Array<React.RefObject<
|
|
25
|
+
refs: Array<React.RefObject<T>>;
|
|
25
26
|
effect?: (params: {
|
|
26
27
|
activityTransitionState: ActivityTransitionState;
|
|
27
|
-
refs: Array<React.RefObject<
|
|
28
|
+
refs: Array<React.RefObject<T>>;
|
|
28
29
|
}) => (() => void) | void;
|
|
29
30
|
effectDeps?: any[];
|
|
30
31
|
}) {
|
|
@@ -32,7 +33,7 @@ export function useStyleEffect({
|
|
|
32
33
|
|
|
33
34
|
useEffect(() => {
|
|
34
35
|
if (!activity) {
|
|
35
|
-
return
|
|
36
|
+
return noop;
|
|
36
37
|
}
|
|
37
38
|
if (!connections[styleName]) {
|
|
38
39
|
connections[styleName] = new Map();
|
|
@@ -50,14 +51,14 @@ export function useStyleEffect({
|
|
|
50
51
|
|
|
51
52
|
useEffect(() => {
|
|
52
53
|
if (!activity) {
|
|
53
|
-
return
|
|
54
|
+
return noop;
|
|
54
55
|
}
|
|
55
56
|
if (!effect) {
|
|
56
|
-
return
|
|
57
|
+
return noop;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
const refs = (() => {
|
|
60
|
-
let arr: Array<React.RefObject<
|
|
61
|
+
let arr: Array<React.RefObject<T>> = [];
|
|
61
62
|
|
|
62
63
|
for (let i = 1; i <= activity.zIndex; i += 1) {
|
|
63
64
|
const connection = connections[styleName].get(activity.zIndex - i);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type React from "react";
|
|
4
4
|
|
|
5
|
+
import { noop } from "../utils";
|
|
5
6
|
import { useStyleEffect } from "./useStyleEffect";
|
|
6
7
|
|
|
7
8
|
export function useStyleEffectHide({
|
|
@@ -45,7 +46,7 @@ export function useStyleEffectHide({
|
|
|
45
46
|
default: {
|
|
46
47
|
cleanup();
|
|
47
48
|
|
|
48
|
-
return
|
|
49
|
+
return noop;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
|
|
3
|
-
import { listenOnce, requestNextFrame } from "../utils";
|
|
3
|
+
import { listenOnce, noop, requestNextFrame } from "../utils";
|
|
4
4
|
import { useStyleEffect } from "./useStyleEffect";
|
|
5
5
|
|
|
6
6
|
export const OFFSET_PX_ANDROID = 32;
|
|
@@ -62,7 +62,7 @@ export function useStyleEffectOffset({
|
|
|
62
62
|
};
|
|
63
63
|
case "enter-active":
|
|
64
64
|
default:
|
|
65
|
-
return
|
|
65
|
+
return noop;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
case "exit-active":
|
|
@@ -71,10 +71,10 @@ export function useStyleEffectOffset({
|
|
|
71
71
|
cleanup();
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
return
|
|
74
|
+
return noop;
|
|
75
75
|
}
|
|
76
76
|
default: {
|
|
77
|
-
return
|
|
77
|
+
return noop;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
|
|
3
|
-
import { listenOnce } from "../utils";
|
|
3
|
+
import { listenOnce, noop } from "../utils";
|
|
4
4
|
import { useStyleEffect } from "./useStyleEffect";
|
|
5
5
|
import { OFFSET_PX_CUPERTINO } from "./useStyleEffectOffset";
|
|
6
6
|
|
|
@@ -27,11 +27,11 @@ export function useStyleEffectSwipeBack({
|
|
|
27
27
|
effect: hasEffect
|
|
28
28
|
? ({ refs }) => {
|
|
29
29
|
if (theme !== "cupertino") {
|
|
30
|
-
return
|
|
30
|
+
return noop;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if (!dimRef.current || !edgeRef.current || !paperRef.current) {
|
|
34
|
-
return
|
|
34
|
+
return noop;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const $dim = dimRef.current;
|
package/src/theme.css.ts
CHANGED
|
@@ -18,6 +18,7 @@ export const globalVars = createGlobalThemeContract(
|
|
|
18
18
|
iconColor: "app-bar-icon-color",
|
|
19
19
|
textColor: "app-bar-text-color",
|
|
20
20
|
backgroundColor: "app-bar-background-color",
|
|
21
|
+
overflow: "app-bar-overflow",
|
|
21
22
|
},
|
|
22
23
|
bottomSheet: {
|
|
23
24
|
borderRadius: "bottom-sheet-border-radius",
|
|
@@ -44,6 +45,7 @@ const defaultVars = {
|
|
|
44
45
|
iconColor: "#212124",
|
|
45
46
|
textColor: "#212124",
|
|
46
47
|
backgroundColor: "#fff",
|
|
48
|
+
overflow: "hidden",
|
|
47
49
|
},
|
|
48
50
|
bottomSheet: {
|
|
49
51
|
borderRadius: "1rem",
|
package/src/utils/index.ts
CHANGED