@seed-design/stackflow 1.1.17 → 1.1.19

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.
@@ -12,6 +12,7 @@ const createStyleContext = require('../../utils/createStyleContext.cjs');
12
12
  const AppBar = require('../AppBar/AppBar.cjs');
13
13
  const useTopActivity = require('../../primitive/private/useTopActivity.cjs');
14
14
  const react = require('@stackflow/react');
15
+ const appBar = require('@seed-design/css/recipes/app-bar');
15
16
 
16
17
  const { ClassNamesProvider, PropsProvider, withContext, useProps } = createStyleContext.createStyleContext(appScreen.appScreen);
17
18
  const AppScreenPropsProvider = PropsProvider;
@@ -24,12 +25,16 @@ const AppScreenRoot = React.forwardRef((props, ref) => {
24
25
  ...variantProps,
25
26
  transitionStyle: react.useActivity().isTop ? transitionStyle : topActivityTransitionStyle
26
27
  });
28
+ const [appBarVariantProps] = React.useMemo(
29
+ () => appBar.appBar.splitVariantProps(variantProps),
30
+ [variantProps]
31
+ );
27
32
  return /* @__PURE__ */ jsxRuntime.jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsxRuntime.jsx(
28
33
  AppBar.AppBarPropsProvider,
29
34
  {
30
35
  value: React.useMemo(
31
- () => ({ ...variantProps, transitionStyle }),
32
- [variantProps, transitionStyle]
36
+ () => ({ ...appBarVariantProps, transitionStyle }),
37
+ [appBarVariantProps, transitionStyle]
33
38
  ),
34
39
  children: /* @__PURE__ */ jsxRuntime.jsx(
35
40
  AppScreen.AppScreenRoot,
@@ -8,6 +8,7 @@ import { createStyleContext } from '../../utils/createStyleContext.js';
8
8
  import { AppBarPropsProvider } from '../AppBar/AppBar.js';
9
9
  import { useTopActivity } from '../../primitive/private/useTopActivity.js';
10
10
  import { useActivity } from '@stackflow/react';
11
+ import { appBar } from '@seed-design/css/recipes/app-bar';
11
12
 
12
13
  const { ClassNamesProvider, PropsProvider, withContext, useProps } = createStyleContext(appScreen);
13
14
  const AppScreenPropsProvider = PropsProvider;
@@ -20,12 +21,16 @@ const AppScreenRoot = forwardRef((props, ref) => {
20
21
  ...variantProps,
21
22
  transitionStyle: useActivity().isTop ? transitionStyle : topActivityTransitionStyle
22
23
  });
24
+ const [appBarVariantProps] = useMemo(
25
+ () => appBar.splitVariantProps(variantProps),
26
+ [variantProps]
27
+ );
23
28
  return /* @__PURE__ */ jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsx(
24
29
  AppBarPropsProvider,
25
30
  {
26
31
  value: useMemo(
27
- () => ({ ...variantProps, transitionStyle }),
28
- [variantProps, transitionStyle]
32
+ () => ({ ...appBarVariantProps, transitionStyle }),
33
+ [appBarVariantProps, transitionStyle]
29
34
  ),
30
35
  children: /* @__PURE__ */ jsx(
31
36
  AppScreenRoot$1,
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
- return /* @__PURE__ */ jsxRuntime.jsx(AppScreen.AppScreenPropsProvider, { value: options, children: /* @__PURE__ */ jsxRuntime.jsx(GlobalInteraction.GlobalInteraction, { children: stack.render() }) });
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) => StackflowReactPlugin;
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
- return /* @__PURE__ */ jsx(AppScreenPropsProvider, { value: options, children: /* @__PURE__ */ jsx(GlobalInteraction, { children: stack.render() }) });
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.17",
3
+ "version": "1.1.19",
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.3",
39
+ "@seed-design/css": "1.2.6",
40
40
  "@stackflow/core": "^1.2.0",
41
41
  "@stackflow/react": "^1.5.1",
42
42
  "@types/react": "^19.2.2",
@@ -6,6 +6,7 @@ import { createStyleContext } from "../../utils/createStyleContext";
6
6
  import { AppBarPropsProvider } from "../AppBar/AppBar";
7
7
  import { useTopActivity } from "../../primitive/private/useTopActivity";
8
8
  import { useActivity } from "@stackflow/react";
9
+ import { appBar } from "@seed-design/css/recipes/app-bar";
9
10
 
10
11
  const { ClassNamesProvider, PropsProvider, withContext, useProps } = createStyleContext(appScreen);
11
12
 
@@ -36,12 +37,17 @@ export const AppScreenRoot = forwardRef<HTMLDivElement, AppScreenRootProps>((pro
36
37
  : (topActivityTransitionStyle as NonNullable<AppScreenVariantProps["transitionStyle"]>),
37
38
  });
38
39
 
40
+ const [appBarVariantProps] = useMemo(
41
+ () => appBar.splitVariantProps(variantProps),
42
+ [variantProps],
43
+ );
44
+
39
45
  return (
40
46
  <ClassNamesProvider value={classNames}>
41
47
  <AppBarPropsProvider
42
48
  value={useMemo(
43
- () => ({ ...variantProps, transitionStyle }),
44
- [variantProps, transitionStyle],
49
+ () => ({ ...appBarVariantProps, transitionStyle }),
50
+ [appBarVariantProps, transitionStyle],
45
51
  )}
46
52
  >
47
53
  <AppScreenPrimitive.Root
package/src/plugin.tsx CHANGED
@@ -7,12 +7,19 @@ export interface SeedPluginOptions {
7
7
  }
8
8
 
9
9
  export const seedPlugin =
10
- (options: SeedPluginOptions): StackflowReactPlugin =>
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={options}>
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({