@seed-design/stackflow 0.0.0-alpha-20260414104312

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.
Files changed (127) hide show
  1. package/lib/components/AppBar/AppBar.cjs +115 -0
  2. package/lib/components/AppBar/AppBar.d.ts +34 -0
  3. package/lib/components/AppBar/AppBar.js +103 -0
  4. package/lib/components/AppBar/AppBar.namespace.cjs +16 -0
  5. package/lib/components/AppBar/AppBar.namespace.d.ts +2 -0
  6. package/lib/components/AppBar/AppBar.namespace.js +1 -0
  7. package/lib/components/AppBar/index.cjs +18 -0
  8. package/lib/components/AppBar/index.d.ts +3 -0
  9. package/lib/components/AppBar/index.js +3 -0
  10. package/lib/components/AppScreen/AppScreen.cjs +68 -0
  11. package/lib/components/AppScreen/AppScreen.d.ts +23 -0
  12. package/lib/components/AppScreen/AppScreen.js +60 -0
  13. package/lib/components/AppScreen/AppScreen.namespace.cjs +13 -0
  14. package/lib/components/AppScreen/AppScreen.namespace.d.ts +2 -0
  15. package/lib/components/AppScreen/AppScreen.namespace.js +1 -0
  16. package/lib/components/AppScreen/index.cjs +15 -0
  17. package/lib/components/AppScreen/index.d.ts +3 -0
  18. package/lib/components/AppScreen/index.js +3 -0
  19. package/lib/components/index.cjs +26 -0
  20. package/lib/components/index.d.ts +2 -0
  21. package/lib/components/index.js +6 -0
  22. package/lib/hooks/index.cjs +9 -0
  23. package/lib/hooks/index.d.ts +1 -0
  24. package/lib/hooks/index.js +1 -0
  25. package/lib/hooks/useActivityZIndexBase.cjs +14 -0
  26. package/lib/hooks/useActivityZIndexBase.d.ts +18 -0
  27. package/lib/hooks/useActivityZIndexBase.js +10 -0
  28. package/lib/index.cjs +32 -0
  29. package/lib/index.d.ts +4 -0
  30. package/lib/index.js +10 -0
  31. package/lib/plugin.cjs +18 -0
  32. package/lib/plugin.d.ts +7 -0
  33. package/lib/plugin.js +14 -0
  34. package/lib/primitive/AppBar/AppBar.cjs +44 -0
  35. package/lib/primitive/AppBar/AppBar.d.ts +15 -0
  36. package/lib/primitive/AppBar/AppBar.js +37 -0
  37. package/lib/primitive/AppBar/AppBar.namespace.cjs +12 -0
  38. package/lib/primitive/AppBar/AppBar.namespace.d.ts +1 -0
  39. package/lib/primitive/AppBar/AppBar.namespace.js +1 -0
  40. package/lib/primitive/AppBar/index.cjs +14 -0
  41. package/lib/primitive/AppBar/index.d.ts +2 -0
  42. package/lib/primitive/AppBar/index.js +3 -0
  43. package/lib/primitive/AppBar/useAppBar.cjs +39 -0
  44. package/lib/primitive/AppBar/useAppBar.d.ts +294 -0
  45. package/lib/primitive/AppBar/useAppBar.js +35 -0
  46. package/lib/primitive/AppBar/useAppBarContext.cjs +21 -0
  47. package/lib/primitive/AppBar/useAppBarContext.d.ts +8 -0
  48. package/lib/primitive/AppBar/useAppBarContext.js +16 -0
  49. package/lib/primitive/AppScreen/AppScreen.cjs +64 -0
  50. package/lib/primitive/AppScreen/AppScreen.d.ts +15 -0
  51. package/lib/primitive/AppScreen/AppScreen.js +57 -0
  52. package/lib/primitive/AppScreen/AppScreen.namespace.cjs +12 -0
  53. package/lib/primitive/AppScreen/AppScreen.namespace.d.ts +1 -0
  54. package/lib/primitive/AppScreen/AppScreen.namespace.js +1 -0
  55. package/lib/primitive/AppScreen/index.cjs +16 -0
  56. package/lib/primitive/AppScreen/index.d.ts +3 -0
  57. package/lib/primitive/AppScreen/index.js +4 -0
  58. package/lib/primitive/AppScreen/useAppScreen.cjs +66 -0
  59. package/lib/primitive/AppScreen/useAppScreen.d.ts +1138 -0
  60. package/lib/primitive/AppScreen/useAppScreen.js +62 -0
  61. package/lib/primitive/AppScreen/useAppScreenContext.cjs +21 -0
  62. package/lib/primitive/AppScreen/useAppScreenContext.d.ts +8 -0
  63. package/lib/primitive/AppScreen/useAppScreenContext.js +16 -0
  64. package/lib/primitive/GlobalInteraction/GlobalInteraction.cjs +28 -0
  65. package/lib/primitive/GlobalInteraction/GlobalInteraction.d.ts +5 -0
  66. package/lib/primitive/GlobalInteraction/GlobalInteraction.js +24 -0
  67. package/lib/primitive/GlobalInteraction/index.cjs +11 -0
  68. package/lib/primitive/GlobalInteraction/index.d.ts +2 -0
  69. package/lib/primitive/GlobalInteraction/index.js +2 -0
  70. package/lib/primitive/GlobalInteraction/useGlobalInteraction.cjs +136 -0
  71. package/lib/primitive/GlobalInteraction/useGlobalInteraction.d.ts +54 -0
  72. package/lib/primitive/GlobalInteraction/useGlobalInteraction.js +132 -0
  73. package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.cjs +21 -0
  74. package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.d.ts +8 -0
  75. package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.js +16 -0
  76. package/lib/primitive/GlobalInteraction/useSwipeBack.cjs +58 -0
  77. package/lib/primitive/GlobalInteraction/useSwipeBack.d.ts +8 -0
  78. package/lib/primitive/GlobalInteraction/useSwipeBack.js +54 -0
  79. package/lib/primitive/index.cjs +27 -0
  80. package/lib/primitive/index.d.ts +3 -0
  81. package/lib/primitive/index.js +9 -0
  82. package/lib/primitive/private/useElementOffset.cjs +54 -0
  83. package/lib/primitive/private/useElementOffset.d.ts +4 -0
  84. package/lib/primitive/private/useElementOffset.js +31 -0
  85. package/lib/primitive/private/useTopActivity.cjs +34 -0
  86. package/lib/primitive/private/useTopActivity.d.ts +5 -0
  87. package/lib/primitive/private/useTopActivity.js +30 -0
  88. package/lib/utils/createStyleContext.cjs +77 -0
  89. package/lib/utils/createStyleContext.d.ts +23 -0
  90. package/lib/utils/createStyleContext.js +73 -0
  91. package/lib/utils/createWithStateProps.d.ts +10 -0
  92. package/lib/utils/styled.cjs +25 -0
  93. package/lib/utils/styled.d.ts +16 -0
  94. package/lib/utils/styled.js +21 -0
  95. package/package.json +61 -0
  96. package/src/components/AppBar/AppBar.namespace.ts +21 -0
  97. package/src/components/AppBar/AppBar.tsx +146 -0
  98. package/src/components/AppBar/index.ts +23 -0
  99. package/src/components/AppScreen/AppScreen.namespace.ts +14 -0
  100. package/src/components/AppScreen/AppScreen.tsx +83 -0
  101. package/src/components/AppScreen/index.ts +16 -0
  102. package/src/components/index.ts +2 -0
  103. package/src/hooks/index.ts +1 -0
  104. package/src/hooks/useActivityZIndexBase.ts +26 -0
  105. package/src/index.ts +6 -0
  106. package/src/plugin.tsx +27 -0
  107. package/src/primitive/AppBar/AppBar.namespace.ts +10 -0
  108. package/src/primitive/AppBar/AppBar.tsx +52 -0
  109. package/src/primitive/AppBar/index.ts +12 -0
  110. package/src/primitive/AppBar/useAppBar.tsx +42 -0
  111. package/src/primitive/AppBar/useAppBarContext.ts +21 -0
  112. package/src/primitive/AppScreen/AppScreen.namespace.ts +10 -0
  113. package/src/primitive/AppScreen/AppScreen.tsx +72 -0
  114. package/src/primitive/AppScreen/index.ts +13 -0
  115. package/src/primitive/AppScreen/useAppScreen.tsx +69 -0
  116. package/src/primitive/AppScreen/useAppScreenContext.ts +21 -0
  117. package/src/primitive/GlobalInteraction/GlobalInteraction.tsx +25 -0
  118. package/src/primitive/GlobalInteraction/index.ts +6 -0
  119. package/src/primitive/GlobalInteraction/useGlobalInteraction.ts +188 -0
  120. package/src/primitive/GlobalInteraction/useGlobalInteractionContext.tsx +21 -0
  121. package/src/primitive/GlobalInteraction/useSwipeBack.ts +56 -0
  122. package/src/primitive/index.ts +3 -0
  123. package/src/primitive/private/useElementOffset.ts +37 -0
  124. package/src/primitive/private/useTopActivity.ts +33 -0
  125. package/src/utils/createStyleContext.tsx +128 -0
  126. package/src/utils/createWithStateProps.tsx +28 -0
  127. package/src/utils/styled.ts +41 -0
@@ -0,0 +1,64 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
+
6
+ const jsxRuntime = require('react/jsx-runtime');
7
+ const reactComposeRefs = require('@radix-ui/react-compose-refs');
8
+ const domUtils = require('@seed-design/dom-utils');
9
+ const reactPrimitive = require('@seed-design/react-primitive');
10
+ const reactUiCore = require('@stackflow/react-ui-core');
11
+ const React = require('react');
12
+ const useAppScreen = require('./useAppScreen.cjs');
13
+ const useAppScreenContext = require('./useAppScreenContext.cjs');
14
+
15
+ const AppScreenRoot = React.forwardRef((props, ref) => {
16
+ const {
17
+ swipeBackDisplacementRatioThreshold,
18
+ swipeBackVelocityThreshold,
19
+ onSwipeBackEnd,
20
+ onSwipeBackMove,
21
+ onSwipeBackStart,
22
+ ...otherProps
23
+ } = props;
24
+ const innerRef = React.useRef(null);
25
+ const api = useAppScreen.useAppScreen({
26
+ swipeBackDisplacementRatioThreshold,
27
+ swipeBackVelocityThreshold,
28
+ onSwipeBackEnd,
29
+ onSwipeBackMove,
30
+ onSwipeBackStart
31
+ });
32
+ reactUiCore.usePreventTouchDuringTransition({
33
+ ref: innerRef
34
+ });
35
+ return /* @__PURE__ */ jsxRuntime.jsx(useAppScreenContext.AppScreenProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(
36
+ reactPrimitive.Primitive.div,
37
+ {
38
+ ref: reactComposeRefs.composeRefs(innerRef, ref),
39
+ "data-stackflow-component-name": "AppScreen",
40
+ ...domUtils.mergeProps(api.activityProps, otherProps)
41
+ }
42
+ ) });
43
+ });
44
+ AppScreenRoot.displayName = "AppScreenRoot";
45
+ const AppScreenDim = React.forwardRef((props, ref) => {
46
+ const { dimProps } = useAppScreenContext.useAppScreenContext();
47
+ return /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref, ...domUtils.mergeProps(dimProps, props) });
48
+ });
49
+ AppScreenDim.displayName = "AppScreenDim";
50
+ const AppScreenEdge = React.forwardRef((props, ref) => {
51
+ const { edgeProps } = useAppScreenContext.useAppScreenContext();
52
+ return /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref, ...domUtils.mergeProps(edgeProps, props) });
53
+ });
54
+ AppScreenEdge.displayName = "AppScreenEdge";
55
+ const AppScreenLayer = React.forwardRef((props, ref) => {
56
+ const { layerProps } = useAppScreenContext.useAppScreenContext();
57
+ return /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref, ...domUtils.mergeProps(layerProps, props) });
58
+ });
59
+ AppScreenLayer.displayName = "AppScreenLayer";
60
+
61
+ exports.AppScreenDim = AppScreenDim;
62
+ exports.AppScreenEdge = AppScreenEdge;
63
+ exports.AppScreenLayer = AppScreenLayer;
64
+ exports.AppScreenRoot = AppScreenRoot;
@@ -0,0 +1,15 @@
1
+ import { PrimitiveProps } from '@seed-design/react-primitive';
2
+ import { UseAppScreenProps } from './useAppScreen';
3
+ import { ForwardRefExoticComponent, RefAttributes } from 'react';
4
+ export interface AppScreenRootProps extends PrimitiveProps, UseAppScreenProps, React.HTMLAttributes<HTMLDivElement> {
5
+ }
6
+ export declare const AppScreenRoot: ForwardRefExoticComponent<AppScreenRootProps & RefAttributes<HTMLDivElement>>;
7
+ export interface AppScreenDimProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
8
+ }
9
+ export declare const AppScreenDim: ForwardRefExoticComponent<AppScreenDimProps & RefAttributes<HTMLDivElement>>;
10
+ export interface AppScreenEdgeProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
11
+ }
12
+ export declare const AppScreenEdge: ForwardRefExoticComponent<AppScreenEdgeProps & RefAttributes<HTMLDivElement>>;
13
+ export interface AppScreenLayerProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
14
+ }
15
+ export declare const AppScreenLayer: ForwardRefExoticComponent<AppScreenLayerProps & RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,57 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { composeRefs } from '@radix-ui/react-compose-refs';
4
+ import { mergeProps } from '@seed-design/dom-utils';
5
+ import { Primitive } from '@seed-design/react-primitive';
6
+ import { usePreventTouchDuringTransition } from '@stackflow/react-ui-core';
7
+ import { forwardRef, useRef } from 'react';
8
+ import { useAppScreen } from './useAppScreen.js';
9
+ import { useAppScreenContext, AppScreenProvider } from './useAppScreenContext.js';
10
+
11
+ const AppScreenRoot = forwardRef((props, ref) => {
12
+ const {
13
+ swipeBackDisplacementRatioThreshold,
14
+ swipeBackVelocityThreshold,
15
+ onSwipeBackEnd,
16
+ onSwipeBackMove,
17
+ onSwipeBackStart,
18
+ ...otherProps
19
+ } = props;
20
+ const innerRef = useRef(null);
21
+ const api = useAppScreen({
22
+ swipeBackDisplacementRatioThreshold,
23
+ swipeBackVelocityThreshold,
24
+ onSwipeBackEnd,
25
+ onSwipeBackMove,
26
+ onSwipeBackStart
27
+ });
28
+ usePreventTouchDuringTransition({
29
+ ref: innerRef
30
+ });
31
+ return /* @__PURE__ */ jsx(AppScreenProvider, { value: api, children: /* @__PURE__ */ jsx(
32
+ Primitive.div,
33
+ {
34
+ ref: composeRefs(innerRef, ref),
35
+ "data-stackflow-component-name": "AppScreen",
36
+ ...mergeProps(api.activityProps, otherProps)
37
+ }
38
+ ) });
39
+ });
40
+ AppScreenRoot.displayName = "AppScreenRoot";
41
+ const AppScreenDim = forwardRef((props, ref) => {
42
+ const { dimProps } = useAppScreenContext();
43
+ return /* @__PURE__ */ jsx(Primitive.div, { ref, ...mergeProps(dimProps, props) });
44
+ });
45
+ AppScreenDim.displayName = "AppScreenDim";
46
+ const AppScreenEdge = forwardRef((props, ref) => {
47
+ const { edgeProps } = useAppScreenContext();
48
+ return /* @__PURE__ */ jsx(Primitive.div, { ref, ...mergeProps(edgeProps, props) });
49
+ });
50
+ AppScreenEdge.displayName = "AppScreenEdge";
51
+ const AppScreenLayer = forwardRef((props, ref) => {
52
+ const { layerProps } = useAppScreenContext();
53
+ return /* @__PURE__ */ jsx(Primitive.div, { ref, ...mergeProps(layerProps, props) });
54
+ });
55
+ AppScreenLayer.displayName = "AppScreenLayer";
56
+
57
+ export { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenRoot };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const AppScreen = require('./AppScreen.cjs');
6
+
7
+
8
+
9
+ exports.Dim = AppScreen.AppScreenDim;
10
+ exports.Edge = AppScreen.AppScreenEdge;
11
+ exports.Layer = AppScreen.AppScreenLayer;
12
+ exports.Root = AppScreen.AppScreenRoot;
@@ -0,0 +1 @@
1
+ export { AppScreenDim as Dim, AppScreenEdge as Edge, AppScreenLayer as Layer, AppScreenRoot as Root, type AppScreenDimProps as DimProps, type AppScreenEdgeProps as EdgeProps, type AppScreenLayerProps as LayerProps, type AppScreenRootProps as RootProps, } from './AppScreen';
@@ -0,0 +1 @@
1
+ export { AppScreenDim as Dim, AppScreenEdge as Edge, AppScreenLayer as Layer, AppScreenRoot as Root } from './AppScreen.js';
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const AppScreen = require('./AppScreen.cjs');
6
+ const AppScreen_namespace = require('./AppScreen.namespace.cjs');
7
+ const useAppScreenContext = require('./useAppScreenContext.cjs');
8
+
9
+
10
+
11
+ exports.AppScreenDim = AppScreen.AppScreenDim;
12
+ exports.AppScreenEdge = AppScreen.AppScreenEdge;
13
+ exports.AppScreenLayer = AppScreen.AppScreenLayer;
14
+ exports.AppScreenRoot = AppScreen.AppScreenRoot;
15
+ exports.AppScreen = AppScreen_namespace;
16
+ exports.useAppScreenContext = useAppScreenContext.useAppScreenContext;
@@ -0,0 +1,3 @@
1
+ export { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenRoot, type AppScreenDimProps, type AppScreenEdgeProps, type AppScreenLayerProps, type AppScreenRootProps, } from './AppScreen';
2
+ export * as AppScreen from './AppScreen.namespace';
3
+ export { useAppScreenContext, type UseAppScreenContext } from './useAppScreenContext';
@@ -0,0 +1,4 @@
1
+ export { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenRoot } from './AppScreen.js';
2
+ import * as AppScreen_namespace from './AppScreen.namespace.js';
3
+ export { AppScreen_namespace as AppScreen };
4
+ export { useAppScreenContext } from './useAppScreenContext.js';
@@ -0,0 +1,66 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
+
6
+ const domUtils = require('@seed-design/dom-utils');
7
+ const reactUiCore = require('@stackflow/react-ui-core');
8
+ const React = require('react');
9
+ const useSwipeBack = require('../GlobalInteraction/useSwipeBack.cjs');
10
+ const useActivityZIndexBase = require('../../hooks/useActivityZIndexBase.cjs');
11
+
12
+ function useAppScreen(props) {
13
+ const activity = reactUiCore.useNullableActivity();
14
+ const transitionState = activity?.transitionState ?? "enter-done";
15
+ const { activityProps, layerProps, edgeProps } = useSwipeBack.useSwipeBack(props);
16
+ const zIndexBase = useActivityZIndexBase.useActivityZIndexBase();
17
+ const zIndexStyle = React.useMemo(
18
+ () => ({
19
+ "--z-index-base": zIndexBase.toString()
20
+ }),
21
+ [zIndexBase]
22
+ );
23
+ const stateProps = React.useMemo(
24
+ () => ({
25
+ "data-activity-is-top": domUtils.dataAttr(activity?.isTop),
26
+ "data-activity-is-active": domUtils.dataAttr(activity?.isActive),
27
+ "data-transition-state": transitionState
28
+ }),
29
+ [transitionState, activity?.isActive, activity?.isTop]
30
+ );
31
+ return React.useMemo(
32
+ () => ({
33
+ activity,
34
+ stateProps,
35
+ activityProps: domUtils.elementProps({
36
+ "data-part": "activity",
37
+ "data-activity-type": "full-screen",
38
+ ...activityProps,
39
+ ...stateProps,
40
+ "data-activity-id": activity?.id,
41
+ style: zIndexStyle,
42
+ // FIXME: @stackflow/react should prevent activity.id hydration mismatch; this is temporal fix.
43
+ suppressHydrationWarning: true
44
+ }),
45
+ dimProps: domUtils.elementProps({
46
+ "data-part": "dim",
47
+ ...stateProps
48
+ }),
49
+ layerProps: domUtils.elementProps({
50
+ "data-part": "layer",
51
+ ...stateProps,
52
+ ...layerProps
53
+ }),
54
+ edgeProps: domUtils.elementProps({
55
+ "data-part": "edge",
56
+ "aria-hidden": true,
57
+ tabIndex: -1,
58
+ ...edgeProps,
59
+ ...stateProps
60
+ })
61
+ }),
62
+ [activity, zIndexStyle, stateProps, activityProps, edgeProps, layerProps]
63
+ );
64
+ }
65
+
66
+ exports.useAppScreen = useAppScreen;