@seed-design/stackflow 1.1.18 → 1.1.20
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/lib/components/AppBar/AppBar.cjs +17 -0
- package/lib/components/AppBar/AppBar.d.ts +3 -0
- package/lib/components/AppBar/AppBar.js +17 -1
- package/lib/components/AppBar/AppBar.namespace.cjs +1 -0
- package/lib/components/AppBar/AppBar.namespace.d.ts +2 -2
- package/lib/components/AppBar/AppBar.namespace.js +1 -1
- package/lib/components/AppBar/index.cjs +1 -0
- package/lib/components/AppBar/index.d.ts +2 -2
- package/lib/components/AppBar/index.js +1 -1
- package/lib/components/index.cjs +1 -0
- package/lib/components/index.js +1 -1
- package/lib/index.cjs +1 -0
- package/lib/index.js +1 -1
- package/lib/plugin.cjs +3 -2
- package/lib/plugin.d.ts +3 -1
- package/lib/plugin.js +3 -2
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.cjs +1 -1
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.js +1 -1
- package/package.json +2 -2
- package/src/components/AppBar/AppBar.namespace.ts +2 -0
- package/src/components/AppBar/AppBar.tsx +20 -0
- package/src/components/AppBar/index.ts +2 -0
- package/src/plugin.tsx +10 -3
- package/src/primitive/GlobalInteraction/useGlobalInteraction.ts +1 -1
|
@@ -87,6 +87,22 @@ const AppBarIconButton = React.forwardRef(
|
|
|
87
87
|
}
|
|
88
88
|
);
|
|
89
89
|
AppBarIconButton.displayName = "IconButton";
|
|
90
|
+
const AppBarSlot = React.forwardRef(
|
|
91
|
+
({ children, className, ...otherProps }, ref) => {
|
|
92
|
+
const { stateProps } = useAppBarContext.useAppBarContext();
|
|
93
|
+
const classNames = useClassNames();
|
|
94
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
95
|
+
reactSlot.Slot,
|
|
96
|
+
{
|
|
97
|
+
ref,
|
|
98
|
+
className: clsx(classNames.custom, className),
|
|
99
|
+
...domUtils.mergeProps(stateProps, otherProps),
|
|
100
|
+
children
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
AppBarSlot.displayName = "AppBarSlot";
|
|
90
106
|
|
|
91
107
|
exports.AppBarIconButton = AppBarIconButton;
|
|
92
108
|
exports.AppBarLeft = AppBarLeft;
|
|
@@ -94,5 +110,6 @@ exports.AppBarMain = AppBarMain;
|
|
|
94
110
|
exports.AppBarPropsProvider = AppBarPropsProvider;
|
|
95
111
|
exports.AppBarRight = AppBarRight;
|
|
96
112
|
exports.AppBarRoot = AppBarRoot;
|
|
113
|
+
exports.AppBarSlot = AppBarSlot;
|
|
97
114
|
exports.AppBarSubtitle = AppBarSubtitle;
|
|
98
115
|
exports.AppBarTitle = AppBarTitle;
|
|
@@ -29,3 +29,6 @@ export declare const AppBarSubtitle: ForwardRefExoticComponent<AppBarSubtitlePro
|
|
|
29
29
|
export interface AppBarIconButtonProps extends PrimitiveProps, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
30
30
|
}
|
|
31
31
|
export declare const AppBarIconButton: ForwardRefExoticComponent<AppBarIconButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
32
|
+
export interface AppBarSlotProps extends PrimitiveProps, React.HTMLAttributes<HTMLElement> {
|
|
33
|
+
}
|
|
34
|
+
export declare const AppBarSlot: ForwardRefExoticComponent<AppBarSlotProps & RefAttributes<HTMLElement>>;
|
|
@@ -83,5 +83,21 @@ const AppBarIconButton = forwardRef(
|
|
|
83
83
|
}
|
|
84
84
|
);
|
|
85
85
|
AppBarIconButton.displayName = "IconButton";
|
|
86
|
+
const AppBarSlot = forwardRef(
|
|
87
|
+
({ children, className, ...otherProps }, ref) => {
|
|
88
|
+
const { stateProps } = useAppBarContext();
|
|
89
|
+
const classNames = useClassNames();
|
|
90
|
+
return /* @__PURE__ */ jsx(
|
|
91
|
+
Slot,
|
|
92
|
+
{
|
|
93
|
+
ref,
|
|
94
|
+
className: clsx(classNames.custom, className),
|
|
95
|
+
...mergeProps(stateProps, otherProps),
|
|
96
|
+
children
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
AppBarSlot.displayName = "AppBarSlot";
|
|
86
102
|
|
|
87
|
-
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarPropsProvider, AppBarRight, AppBarRoot, AppBarSubtitle, AppBarTitle };
|
|
103
|
+
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarPropsProvider, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle };
|
|
@@ -11,5 +11,6 @@ exports.Left = AppBar.AppBarLeft;
|
|
|
11
11
|
exports.Main = AppBar.AppBarMain;
|
|
12
12
|
exports.Right = AppBar.AppBarRight;
|
|
13
13
|
exports.Root = AppBar.AppBarRoot;
|
|
14
|
+
exports.Slot = AppBar.AppBarSlot;
|
|
14
15
|
exports.Subtitle = AppBar.AppBarSubtitle;
|
|
15
16
|
exports.Title = AppBar.AppBarTitle;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AppBarIconButton as IconButton, AppBarLeft as Left, AppBarMain as Main, AppBarRight as Right, AppBarRoot as Root, AppBarSubtitle as Subtitle, AppBarTitle as Title, } from './AppBar';
|
|
2
|
-
export type { AppBarIconButtonProps as IconButtonProps, AppBarLeftProps as LeftProps, AppBarMainProps as MainProps, AppBarRightProps as RightProps, AppBarProps as RootProps, AppBarSubtitleProps as SubtitleProps, AppBarTitleProps as TitleProps, } from './AppBar';
|
|
1
|
+
export { AppBarIconButton as IconButton, AppBarLeft as Left, AppBarMain as Main, AppBarRight as Right, AppBarRoot as Root, AppBarSlot as Slot, AppBarSubtitle as Subtitle, AppBarTitle as Title, } from './AppBar';
|
|
2
|
+
export type { AppBarIconButtonProps as IconButtonProps, AppBarLeftProps as LeftProps, AppBarMainProps as MainProps, AppBarRightProps as RightProps, AppBarProps as RootProps, AppBarSlotProps as SlotProps, AppBarSubtitleProps as SubtitleProps, AppBarTitleProps as TitleProps, } from './AppBar';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AppBarIconButton as IconButton, AppBarLeft as Left, AppBarMain as Main, AppBarRight as Right, AppBarRoot as Root, AppBarSubtitle as Subtitle, AppBarTitle as Title } from './AppBar.js';
|
|
1
|
+
export { AppBarIconButton as IconButton, AppBarLeft as Left, AppBarMain as Main, AppBarRight as Right, AppBarRoot as Root, AppBarSlot as Slot, AppBarSubtitle as Subtitle, AppBarTitle as Title } from './AppBar.js';
|
|
@@ -12,6 +12,7 @@ exports.AppBarLeft = AppBar.AppBarLeft;
|
|
|
12
12
|
exports.AppBarMain = AppBar.AppBarMain;
|
|
13
13
|
exports.AppBarRight = AppBar.AppBarRight;
|
|
14
14
|
exports.AppBarRoot = AppBar.AppBarRoot;
|
|
15
|
+
exports.AppBarSlot = AppBar.AppBarSlot;
|
|
15
16
|
exports.AppBarSubtitle = AppBar.AppBarSubtitle;
|
|
16
17
|
exports.AppBarTitle = AppBar.AppBarTitle;
|
|
17
18
|
exports.AppBar = AppBar_namespace;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSubtitle, AppBarTitle, } from './AppBar';
|
|
2
|
-
export type { AppBarIconButtonProps, AppBarLeftProps, AppBarMainProps, AppBarProps, AppBarRightProps, AppBarSubtitleProps, AppBarTitleProps, } from './AppBar';
|
|
1
|
+
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle, } from './AppBar';
|
|
2
|
+
export type { AppBarIconButtonProps, AppBarLeftProps, AppBarMainProps, AppBarProps, AppBarRightProps, AppBarSlotProps, AppBarSubtitleProps, AppBarTitleProps, } from './AppBar';
|
|
3
3
|
export * as AppBar from './AppBar.namespace';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSubtitle, AppBarTitle } from './AppBar.js';
|
|
1
|
+
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle } from './AppBar.js';
|
|
2
2
|
import * as AppBar_namespace from './AppBar.namespace.js';
|
|
3
3
|
export { AppBar_namespace as AppBar };
|
package/lib/components/index.cjs
CHANGED
|
@@ -14,6 +14,7 @@ exports.AppBarLeft = AppBar.AppBarLeft;
|
|
|
14
14
|
exports.AppBarMain = AppBar.AppBarMain;
|
|
15
15
|
exports.AppBarRight = AppBar.AppBarRight;
|
|
16
16
|
exports.AppBarRoot = AppBar.AppBarRoot;
|
|
17
|
+
exports.AppBarSlot = AppBar.AppBarSlot;
|
|
17
18
|
exports.AppBarSubtitle = AppBar.AppBarSubtitle;
|
|
18
19
|
exports.AppBarTitle = AppBar.AppBarTitle;
|
|
19
20
|
exports.AppBar = AppBar_namespace;
|
package/lib/components/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSubtitle, AppBarTitle } from './AppBar/AppBar.js';
|
|
1
|
+
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle } from './AppBar/AppBar.js';
|
|
2
2
|
import * as AppBar_namespace from './AppBar/AppBar.namespace.js';
|
|
3
3
|
export { AppBar_namespace as AppBar };
|
|
4
4
|
export { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenPropsProvider, AppScreenRoot } from './AppScreen/AppScreen.js';
|
package/lib/index.cjs
CHANGED
|
@@ -18,6 +18,7 @@ exports.AppBarLeft = AppBar.AppBarLeft;
|
|
|
18
18
|
exports.AppBarMain = AppBar.AppBarMain;
|
|
19
19
|
exports.AppBarRight = AppBar.AppBarRight;
|
|
20
20
|
exports.AppBarRoot = AppBar.AppBarRoot;
|
|
21
|
+
exports.AppBarSlot = AppBar.AppBarSlot;
|
|
21
22
|
exports.AppBarSubtitle = AppBar.AppBarSubtitle;
|
|
22
23
|
exports.AppBarTitle = AppBar.AppBarTitle;
|
|
23
24
|
exports.AppBar = AppBar_namespace;
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { seedPlugin } from './plugin.js';
|
|
2
|
-
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSubtitle, AppBarTitle } from './components/AppBar/AppBar.js';
|
|
2
|
+
export { AppBarIconButton, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot, AppBarSlot, AppBarSubtitle, AppBarTitle } from './components/AppBar/AppBar.js';
|
|
3
3
|
import * as AppBar_namespace from './components/AppBar/AppBar.namespace.js';
|
|
4
4
|
export { AppBar_namespace as AppBar };
|
|
5
5
|
export { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenPropsProvider, AppScreenRoot } from './components/AppScreen/AppScreen.js';
|
package/lib/plugin.cjs
CHANGED
|
@@ -9,8 +9,9 @@ const GlobalInteraction = require('./primitive/GlobalInteraction/GlobalInteracti
|
|
|
9
9
|
|
|
10
10
|
const seedPlugin = (options) => () => ({
|
|
11
11
|
key: "seed-design",
|
|
12
|
-
wrapStack({ stack }) {
|
|
13
|
-
|
|
12
|
+
wrapStack({ stack, initialContext }) {
|
|
13
|
+
const resolved = typeof options === "function" ? options({ initialContext }) : options;
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AppScreen.AppScreenPropsProvider, { value: resolved, children: /* @__PURE__ */ jsxRuntime.jsx(GlobalInteraction.GlobalInteraction, { children: stack.render() }) });
|
|
14
15
|
}
|
|
15
16
|
});
|
|
16
17
|
|
package/lib/plugin.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ import { StackflowReactPlugin } from '@stackflow/react';
|
|
|
2
2
|
export interface SeedPluginOptions {
|
|
3
3
|
theme: "android" | "cupertino";
|
|
4
4
|
}
|
|
5
|
-
export declare const seedPlugin: (options: SeedPluginOptions
|
|
5
|
+
export declare const seedPlugin: (options: SeedPluginOptions | ((args: {
|
|
6
|
+
initialContext?: any;
|
|
7
|
+
}) => SeedPluginOptions)) => StackflowReactPlugin;
|
package/lib/plugin.js
CHANGED
|
@@ -5,8 +5,9 @@ import { GlobalInteraction } from './primitive/GlobalInteraction/GlobalInteracti
|
|
|
5
5
|
|
|
6
6
|
const seedPlugin = (options) => () => ({
|
|
7
7
|
key: "seed-design",
|
|
8
|
-
wrapStack({ stack }) {
|
|
9
|
-
|
|
8
|
+
wrapStack({ stack, initialContext }) {
|
|
9
|
+
const resolved = typeof options === "function" ? options({ initialContext }) : options;
|
|
10
|
+
return /* @__PURE__ */ jsx(AppScreenPropsProvider, { value: resolved, children: /* @__PURE__ */ jsx(GlobalInteraction, { children: stack.render() }) });
|
|
10
11
|
}
|
|
11
12
|
});
|
|
12
13
|
|
|
@@ -53,7 +53,7 @@ function useGlobalInteraction() {
|
|
|
53
53
|
);
|
|
54
54
|
const moveSwipeBack = React.useCallback(
|
|
55
55
|
({ x, t }) => {
|
|
56
|
-
const displacement = x - swipeBackContextRef.current.x0;
|
|
56
|
+
const displacement = Math.max(0, x - swipeBackContextRef.current.x0);
|
|
57
57
|
const displacementRatio = displacement / window.innerWidth;
|
|
58
58
|
const velocity = displacement / (t - swipeBackContextRef.current.t0);
|
|
59
59
|
setSwipeBackContext({
|
|
@@ -49,7 +49,7 @@ function useGlobalInteraction() {
|
|
|
49
49
|
);
|
|
50
50
|
const moveSwipeBack = useCallback(
|
|
51
51
|
({ x, t }) => {
|
|
52
|
-
const displacement = x - swipeBackContextRef.current.x0;
|
|
52
|
+
const displacement = Math.max(0, x - swipeBackContextRef.current.x0);
|
|
53
53
|
const displacementRatio = displacement / window.innerWidth;
|
|
54
54
|
const velocity = displacement / (t - swipeBackContextRef.current.t0);
|
|
55
55
|
setSwipeBackContext({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/stackflow",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"clsx": "^2.1.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@seed-design/css": "1.2.
|
|
39
|
+
"@seed-design/css": "1.2.7",
|
|
40
40
|
"@stackflow/core": "^1.2.0",
|
|
41
41
|
"@stackflow/react": "^1.5.1",
|
|
42
42
|
"@types/react": "^19.2.2",
|
|
@@ -4,6 +4,7 @@ export {
|
|
|
4
4
|
AppBarMain as Main,
|
|
5
5
|
AppBarRight as Right,
|
|
6
6
|
AppBarRoot as Root,
|
|
7
|
+
AppBarSlot as Slot,
|
|
7
8
|
AppBarSubtitle as Subtitle,
|
|
8
9
|
AppBarTitle as Title,
|
|
9
10
|
} from "./AppBar";
|
|
@@ -14,6 +15,7 @@ export type {
|
|
|
14
15
|
AppBarMainProps as MainProps,
|
|
15
16
|
AppBarRightProps as RightProps,
|
|
16
17
|
AppBarProps as RootProps,
|
|
18
|
+
AppBarSlotProps as SlotProps,
|
|
17
19
|
AppBarSubtitleProps as SubtitleProps,
|
|
18
20
|
AppBarTitleProps as TitleProps,
|
|
19
21
|
} from "./AppBar";
|
|
@@ -124,3 +124,23 @@ export const AppBarIconButton = forwardRef<HTMLButtonElement, AppBarIconButtonPr
|
|
|
124
124
|
},
|
|
125
125
|
);
|
|
126
126
|
AppBarIconButton.displayName = "IconButton";
|
|
127
|
+
|
|
128
|
+
export interface AppBarSlotProps extends PrimitiveProps, React.HTMLAttributes<HTMLElement> {}
|
|
129
|
+
|
|
130
|
+
export const AppBarSlot = forwardRef<HTMLElement, AppBarSlotProps>(
|
|
131
|
+
({ children, className, ...otherProps }, ref) => {
|
|
132
|
+
const { stateProps } = useAppBarContext();
|
|
133
|
+
const classNames = useClassNames();
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<Slot
|
|
137
|
+
ref={ref}
|
|
138
|
+
className={clsx(classNames.custom, className)}
|
|
139
|
+
{...mergeProps(stateProps, otherProps)}
|
|
140
|
+
>
|
|
141
|
+
{children}
|
|
142
|
+
</Slot>
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
AppBarSlot.displayName = "AppBarSlot";
|
|
@@ -4,6 +4,7 @@ export {
|
|
|
4
4
|
AppBarMain,
|
|
5
5
|
AppBarRight,
|
|
6
6
|
AppBarRoot,
|
|
7
|
+
AppBarSlot,
|
|
7
8
|
AppBarSubtitle,
|
|
8
9
|
AppBarTitle,
|
|
9
10
|
} from "./AppBar";
|
|
@@ -14,6 +15,7 @@ export type {
|
|
|
14
15
|
AppBarMainProps,
|
|
15
16
|
AppBarProps,
|
|
16
17
|
AppBarRightProps,
|
|
18
|
+
AppBarSlotProps,
|
|
17
19
|
AppBarSubtitleProps,
|
|
18
20
|
AppBarTitleProps,
|
|
19
21
|
} from "./AppBar";
|
package/src/plugin.tsx
CHANGED
|
@@ -7,12 +7,19 @@ export interface SeedPluginOptions {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export const seedPlugin =
|
|
10
|
-
(
|
|
10
|
+
(
|
|
11
|
+
options:
|
|
12
|
+
| SeedPluginOptions
|
|
13
|
+
// biome-ignore lint/suspicious/noExplicitAny: matches upstream @stackflow/react's `initialContext: any`
|
|
14
|
+
| ((args: { initialContext?: any }) => SeedPluginOptions),
|
|
15
|
+
): StackflowReactPlugin =>
|
|
11
16
|
() => ({
|
|
12
17
|
key: "seed-design",
|
|
13
|
-
wrapStack({ stack }) {
|
|
18
|
+
wrapStack({ stack, initialContext }) {
|
|
19
|
+
const resolved = typeof options === "function" ? options({ initialContext }) : options;
|
|
20
|
+
|
|
14
21
|
return (
|
|
15
|
-
<AppScreenPropsProvider value={
|
|
22
|
+
<AppScreenPropsProvider value={resolved}>
|
|
16
23
|
<GlobalInteraction>{stack.render()}</GlobalInteraction>
|
|
17
24
|
</AppScreenPropsProvider>
|
|
18
25
|
);
|
|
@@ -96,7 +96,7 @@ export function useGlobalInteraction() {
|
|
|
96
96
|
|
|
97
97
|
const moveSwipeBack = useCallback(
|
|
98
98
|
({ x, t }: MoveSwipeBackProps) => {
|
|
99
|
-
const displacement = x - swipeBackContextRef.current.x0;
|
|
99
|
+
const displacement = Math.max(0, x - swipeBackContextRef.current.x0);
|
|
100
100
|
const displacementRatio = displacement / window.innerWidth;
|
|
101
101
|
const velocity = displacement / (t - swipeBackContextRef.current.t0);
|
|
102
102
|
setSwipeBackContext({
|