@stackflow/plugin-basic-ui 0.21.4-alpha.4 → 1.0.1
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.md +1 -1
- package/dist/assets/IconBack.d.ts +1 -1
- package/dist/assets/IconClose.d.ts +1 -1
- package/dist/{theme.css.d.ts → basicUIPlugin.css.d.ts} +12 -0
- package/dist/basicUIPlugin.d.ts +4 -4
- package/dist/components/AppBar.d.ts +3 -3
- package/dist/components/AppScreen.d.ts +3 -3
- package/dist/components/BottomSheet.d.ts +2 -2
- package/dist/components/Modal.d.ts +2 -2
- package/dist/hooks/useMaxWidth.d.ts +1 -1
- package/dist/hooks/useStyleEffect.d.ts +1 -1
- package/dist/hooks/useStyleEffectHide.d.ts +1 -1
- package/dist/index.css +150 -143
- package/dist/index.css.map +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +348 -295
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +327 -272
- package/dist/index.mjs.map +4 -4
- package/package.json +8 -8
- package/src/assets/IconBack.tsx +0 -2
- package/src/assets/IconClose.tsx +0 -2
- package/src/{theme.css.ts → basicUIPlugin.css.ts} +27 -9
- package/src/basicUIPlugin.tsx +23 -19
- package/src/components/AppBar.css.ts +2 -2
- package/src/components/AppBar.tsx +4 -4
- package/src/components/AppScreen.css.ts +2 -2
- package/src/components/AppScreen.tsx +8 -5
- package/src/components/BottomSheet.css.ts +1 -1
- package/src/components/BottomSheet.tsx +4 -4
- package/src/components/Modal.css.ts +1 -1
- package/src/components/Modal.tsx +4 -4
- package/src/hooks/useMaxWidth.ts +0 -1
- package/src/hooks/useStyleEffect.ts +0 -1
- package/src/hooks/useStyleEffectHide.ts +0 -2
- package/src/hooks/useStyleEffectOffset.ts +2 -1
- package/src/hooks/useStyleEffectSwipeBack.ts +4 -4
- package/src/index.ts +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { style } from "@vanilla-extract/css";
|
|
2
2
|
import { recipe } from "@vanilla-extract/recipes";
|
|
3
3
|
|
|
4
|
-
import { f } from "../styles";
|
|
5
4
|
import {
|
|
6
5
|
android,
|
|
7
6
|
cupertino,
|
|
8
7
|
globalVars,
|
|
9
8
|
rootAndroid,
|
|
10
9
|
rootCupertino,
|
|
11
|
-
} from "../
|
|
10
|
+
} from "../basicUIPlugin.css";
|
|
11
|
+
import { f } from "../styles";
|
|
12
12
|
import {
|
|
13
13
|
background,
|
|
14
14
|
enterActive,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useActions } from "@stackflow/react";
|
|
2
2
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
3
|
-
import
|
|
3
|
+
import { forwardRef, useRef } from "react";
|
|
4
4
|
|
|
5
5
|
import { IconBack, IconClose } from "../assets";
|
|
6
6
|
import { useGlobalOptions } from "../basicUIPlugin";
|
|
7
|
+
import type { GlobalVars } from "../basicUIPlugin.css";
|
|
8
|
+
import { globalVars } from "../basicUIPlugin.css";
|
|
7
9
|
import { useMaxWidth, useNullableActivity } from "../hooks";
|
|
8
|
-
import type { GlobalVars } from "../theme.css";
|
|
9
|
-
import { globalVars } from "../theme.css";
|
|
10
10
|
import { compactMap } from "../utils";
|
|
11
11
|
import * as css from "./AppBar.css";
|
|
12
12
|
import * as appScreenCss from "./AppScreen.css";
|
|
@@ -50,7 +50,7 @@ type AppBarProps = Partial<
|
|
|
50
50
|
modalPresentationStyle?: "fullScreen";
|
|
51
51
|
onTopClick?: (e: React.MouseEvent) => void;
|
|
52
52
|
};
|
|
53
|
-
const AppBar =
|
|
53
|
+
const AppBar = forwardRef<HTMLDivElement, AppBarProps>(
|
|
54
54
|
(
|
|
55
55
|
{
|
|
56
56
|
title,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createThemeContract, style } from "@vanilla-extract/css";
|
|
2
2
|
import { recipe } from "@vanilla-extract/recipes";
|
|
3
3
|
|
|
4
|
-
import { f } from "../styles";
|
|
5
4
|
import {
|
|
6
5
|
android,
|
|
7
6
|
cupertino,
|
|
8
7
|
globalVars,
|
|
9
8
|
rootAndroid,
|
|
10
9
|
rootCupertino,
|
|
11
|
-
} from "../
|
|
10
|
+
} from "../basicUIPlugin.css";
|
|
11
|
+
import { f } from "../styles";
|
|
12
12
|
|
|
13
13
|
export const vars = createThemeContract({
|
|
14
14
|
transitionDuration: null,
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { useActions } from "@stackflow/react";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
|
-
import
|
|
5
|
+
import { createContext, useContext, useMemo, useRef } from "react";
|
|
6
6
|
|
|
7
7
|
import { useGlobalOptions } from "../basicUIPlugin";
|
|
8
|
+
import type { GlobalVars } from "../basicUIPlugin.css";
|
|
9
|
+
import { globalVars } from "../basicUIPlugin.css";
|
|
8
10
|
import {
|
|
9
11
|
useLazy,
|
|
10
12
|
useNullableActivity,
|
|
@@ -12,8 +14,6 @@ import {
|
|
|
12
14
|
useStyleEffectOffset,
|
|
13
15
|
useStyleEffectSwipeBack,
|
|
14
16
|
} from "../hooks";
|
|
15
|
-
import type { GlobalVars } from "../theme.css";
|
|
16
|
-
import { globalVars } from "../theme.css";
|
|
17
17
|
import type { PropOf } from "../utils";
|
|
18
18
|
import { compactMap } from "../utils";
|
|
19
19
|
import AppBar from "./AppBar";
|
|
@@ -31,7 +31,10 @@ export function useAppScreen() {
|
|
|
31
31
|
export type AppScreenProps = Partial<
|
|
32
32
|
Pick<GlobalVars, "backgroundColor" | "dimBackgroundColor">
|
|
33
33
|
> & {
|
|
34
|
-
appBar?: Omit<
|
|
34
|
+
appBar?: Omit<
|
|
35
|
+
PropOf<typeof AppBar>,
|
|
36
|
+
"theme" | "modalPresentationStyle" | "ref" | "key"
|
|
37
|
+
>;
|
|
35
38
|
preventSwipeBack?: boolean;
|
|
36
39
|
modalPresentationStyle?: "fullScreen";
|
|
37
40
|
children: React.ReactNode;
|
|
@@ -140,7 +143,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
|
|
|
140
143
|
[css.vars.transitionDuration]:
|
|
141
144
|
transitionState === "enter-active" ||
|
|
142
145
|
transitionState === "exit-active"
|
|
143
|
-
?
|
|
146
|
+
? globalVars.transitionDuration
|
|
144
147
|
: "0ms",
|
|
145
148
|
}),
|
|
146
149
|
)}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createThemeContract, style } from "@vanilla-extract/css";
|
|
2
2
|
import { recipe } from "@vanilla-extract/recipes";
|
|
3
3
|
|
|
4
|
+
import { globalVars } from "../basicUIPlugin.css";
|
|
4
5
|
import { f } from "../styles";
|
|
5
|
-
import { globalVars } from "../theme.css";
|
|
6
6
|
|
|
7
7
|
export const vars = createThemeContract({
|
|
8
8
|
transitionDuration: null,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { useActions } from "@stackflow/react";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
|
-
import
|
|
5
|
+
import { useRef } from "react";
|
|
6
6
|
|
|
7
|
+
import type { GlobalVars } from "../basicUIPlugin.css";
|
|
8
|
+
import { globalVars } from "../basicUIPlugin.css";
|
|
7
9
|
import { useLazy, useNullableActivity, useStyleEffect } from "../hooks";
|
|
8
|
-
import type { GlobalVars } from "../theme.css";
|
|
9
|
-
import { globalVars } from "../theme.css";
|
|
10
10
|
import { compactMap } from "../utils";
|
|
11
11
|
import * as css from "./BottomSheet.css";
|
|
12
12
|
|
|
@@ -83,7 +83,7 @@ const BottomSheet: React.FC<BottomSheetProps> = ({
|
|
|
83
83
|
[css.vars.transitionDuration]:
|
|
84
84
|
transitionState === "enter-active" ||
|
|
85
85
|
transitionState === "exit-active"
|
|
86
|
-
?
|
|
86
|
+
? globalVars.transitionDuration
|
|
87
87
|
: "0ms",
|
|
88
88
|
}),
|
|
89
89
|
)}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createThemeContract, style } from "@vanilla-extract/css";
|
|
2
2
|
import { recipe } from "@vanilla-extract/recipes";
|
|
3
3
|
|
|
4
|
+
import { globalVars } from "../basicUIPlugin.css";
|
|
4
5
|
import { f } from "../styles";
|
|
5
|
-
import { globalVars } from "../theme.css";
|
|
6
6
|
|
|
7
7
|
export const vars = createThemeContract({
|
|
8
8
|
transitionDuration: null,
|
package/src/components/Modal.tsx
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { useActions } from "@stackflow/react";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
|
-
import
|
|
5
|
+
import { useRef } from "react";
|
|
6
6
|
|
|
7
|
+
import type { GlobalVars } from "../basicUIPlugin.css";
|
|
8
|
+
import { globalVars } from "../basicUIPlugin.css";
|
|
7
9
|
import { useLazy, useNullableActivity, useStyleEffect } from "../hooks";
|
|
8
|
-
import type { GlobalVars } from "../theme.css";
|
|
9
|
-
import { globalVars } from "../theme.css";
|
|
10
10
|
import { compactMap } from "../utils";
|
|
11
11
|
import * as css from "./Modal.css";
|
|
12
12
|
|
|
@@ -83,7 +83,7 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
83
83
|
[css.vars.transitionDuration]:
|
|
84
84
|
transitionState === "enter-active" ||
|
|
85
85
|
transitionState === "exit-active"
|
|
86
|
-
?
|
|
86
|
+
? globalVars.transitionDuration
|
|
87
87
|
: "0ms",
|
|
88
88
|
}),
|
|
89
89
|
)}
|
package/src/hooks/useMaxWidth.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
|
|
3
|
+
import { globalVars } from "../basicUIPlugin.css";
|
|
3
4
|
import { listenOnce, noop, requestNextFrame } from "../utils";
|
|
4
5
|
import { useStyleEffect } from "./useStyleEffect";
|
|
5
6
|
|
|
@@ -51,7 +52,7 @@ export function useStyleEffectOffset({
|
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
ref.current.style.transition =
|
|
55
|
+
ref.current.style.transition = globalVars.transitionDuration;
|
|
55
56
|
ref.current.style.transform = transform;
|
|
56
57
|
});
|
|
57
58
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
|
|
3
|
+
import { globalVars } from "../basicUIPlugin.css";
|
|
3
4
|
import { listenOnce, noop } from "../utils";
|
|
4
5
|
import { useStyleEffect } from "./useStyleEffect";
|
|
5
6
|
import { OFFSET_PX_CUPERTINO } from "./useStyleEffectOffset";
|
|
@@ -101,19 +102,18 @@ export function useStyleEffectSwipeBack({
|
|
|
101
102
|
return new Promise((resolve) => {
|
|
102
103
|
requestAnimationFrame(() => {
|
|
103
104
|
$dim.style.opacity = `${swiped ? 0 : 1}`;
|
|
104
|
-
$dim.style.transition =
|
|
105
|
+
$dim.style.transition = globalVars.transitionDuration;
|
|
105
106
|
|
|
106
107
|
$paper.style.overflowY = "hidden";
|
|
107
108
|
$paper.style.transform = `translateX(${swiped ? "100%" : "0"})`;
|
|
108
|
-
$paper.style.transition =
|
|
109
|
-
"var(--stackflow-transition-duration)";
|
|
109
|
+
$paper.style.transition = globalVars.transitionDuration;
|
|
110
110
|
|
|
111
111
|
refs.forEach((ref) => {
|
|
112
112
|
if (!ref.current) {
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
ref.current.style.transition =
|
|
116
|
+
ref.current.style.transition = globalVars.transitionDuration;
|
|
117
117
|
ref.current.style.transform = `translate3d(${
|
|
118
118
|
swiped ? "0" : `-${OFFSET_PX_CUPERTINO / 16}rem`
|
|
119
119
|
}, 0, 0)`;
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { basicUIPlugin } from "./basicUIPlugin";
|
|
2
|
+
export { globalVars as cssVars } from "./basicUIPlugin.css";
|
|
2
3
|
export {
|
|
3
4
|
default as AppScreen,
|
|
4
5
|
AppScreenContext,
|
|
@@ -10,4 +11,3 @@ export {
|
|
|
10
11
|
BottomSheetProps,
|
|
11
12
|
} from "./components/BottomSheet";
|
|
12
13
|
export { default as Modal, ModalProps } from "./components/Modal";
|
|
13
|
-
export { globalVars as cssVars } from "./theme.css";
|