@seed-design/stackflow 1.1.20 → 1.1.21
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/_virtual/_rolldown/runtime.cjs +34 -0
- package/lib/_virtual/_rolldown/runtime.js +14 -0
- package/lib/components/AppBar/AppBar.cjs +86 -102
- package/lib/components/AppBar/AppBar.js +84 -98
- package/lib/components/AppBar/AppBar.namespace.cjs +20 -16
- package/lib/components/AppBar/AppBar.namespace.js +15 -1
- package/lib/components/AppBar/index.cjs +17 -18
- package/lib/components/AppBar/index.js +3 -3
- package/lib/components/AppScreen/AppScreen.cjs +46 -61
- package/lib/components/AppScreen/AppScreen.js +45 -57
- package/lib/components/AppScreen/AppScreen.namespace.cjs +17 -13
- package/lib/components/AppScreen/AppScreen.namespace.js +12 -1
- package/lib/components/AppScreen/index.cjs +14 -15
- package/lib/components/AppScreen/index.js +3 -3
- package/lib/components/index.cjs +30 -26
- package/lib/components/index.js +5 -6
- package/lib/hooks/index.cjs +3 -9
- package/lib/hooks/index.js +2 -1
- package/lib/hooks/useActivityZIndexBase.cjs +12 -11
- package/lib/hooks/useActivityZIndexBase.js +11 -7
- package/lib/index.cjs +41 -32
- package/lib/index.js +8 -10
- package/lib/plugin.cjs +16 -16
- package/lib/plugin.js +14 -12
- package/lib/primitive/AppBar/AppBar.cjs +41 -33
- package/lib/primitive/AppBar/AppBar.js +40 -29
- package/lib/primitive/AppBar/AppBar.namespace.cjs +16 -12
- package/lib/primitive/AppBar/AppBar.namespace.js +11 -1
- package/lib/primitive/AppBar/anatomy.cjs +18 -0
- package/lib/primitive/AppBar/anatomy.d.ts +15 -0
- package/lib/primitive/AppBar/anatomy.js +18 -0
- package/lib/primitive/AppBar/index.cjs +13 -14
- package/lib/primitive/AppBar/index.js +3 -3
- package/lib/primitive/AppBar/useAppBar.cjs +29 -36
- package/lib/primitive/AppBar/useAppBar.js +28 -32
- package/lib/primitive/AppBar/useAppBarContext.cjs +11 -18
- package/lib/primitive/AppBar/useAppBarContext.js +10 -14
- package/lib/primitive/AppScreen/AppScreen.cjs +49 -52
- package/lib/primitive/AppScreen/AppScreen.js +48 -48
- package/lib/primitive/AppScreen/AppScreen.namespace.cjs +16 -12
- package/lib/primitive/AppScreen/AppScreen.namespace.js +11 -1
- package/lib/primitive/AppScreen/anatomy.cjs +17 -0
- package/lib/primitive/AppScreen/anatomy.d.ts +14 -0
- package/lib/primitive/AppScreen/anatomy.js +17 -0
- package/lib/primitive/AppScreen/index.cjs +15 -16
- package/lib/primitive/AppScreen/index.js +4 -4
- package/lib/primitive/AppScreen/useAppScreen.cjs +60 -63
- package/lib/primitive/AppScreen/useAppScreen.js +59 -59
- package/lib/primitive/AppScreen/useAppScreenContext.cjs +11 -18
- package/lib/primitive/AppScreen/useAppScreenContext.js +10 -14
- package/lib/primitive/GlobalInteraction/GlobalInteraction.cjs +21 -26
- package/lib/primitive/GlobalInteraction/GlobalInteraction.js +20 -22
- package/lib/primitive/GlobalInteraction/animation.cjs +303 -0
- package/lib/primitive/GlobalInteraction/animation.d.ts +16 -0
- package/lib/primitive/GlobalInteraction/animation.js +299 -0
- package/lib/primitive/GlobalInteraction/constants.cjs +9 -0
- package/lib/primitive/GlobalInteraction/constants.d.ts +19 -0
- package/lib/primitive/GlobalInteraction/constants.js +8 -0
- package/lib/primitive/GlobalInteraction/dom.cjs +147 -0
- package/lib/primitive/GlobalInteraction/dom.d.ts +44 -0
- package/lib/primitive/GlobalInteraction/dom.js +140 -0
- package/lib/primitive/GlobalInteraction/index.cjs +5 -11
- package/lib/primitive/GlobalInteraction/index.js +3 -2
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.cjs +220 -133
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.d.ts +10 -26
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.js +219 -129
- package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.cjs +11 -18
- package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.js +10 -14
- package/lib/primitive/GlobalInteraction/useSwipeBack.cjs +71 -55
- package/lib/primitive/GlobalInteraction/useSwipeBack.d.ts +19 -2
- package/lib/primitive/GlobalInteraction/useSwipeBack.js +70 -51
- package/lib/primitive/index.cjs +55 -27
- package/lib/primitive/index.js +26 -9
- package/lib/primitive/private/useElementOffset.cjs +29 -51
- package/lib/primitive/private/useElementOffset.js +27 -28
- package/lib/primitive/private/useTopActivity.cjs +22 -31
- package/lib/primitive/private/useTopActivity.js +21 -27
- package/lib/utils/createStyleContext.cjs +91 -74
- package/lib/utils/createStyleContext.js +89 -70
- package/lib/utils/styled.cjs +13 -20
- package/lib/utils/styled.js +12 -16
- package/package.json +4 -4
- package/src/components/AppBar/AppBar.tsx +9 -3
- package/src/primitive/AppBar/AppBar.tsx +4 -1
- package/src/primitive/AppBar/anatomy.ts +16 -0
- package/src/primitive/AppBar/useAppBar.tsx +2 -1
- package/src/primitive/AppScreen/anatomy.ts +15 -0
- package/src/primitive/AppScreen/useAppScreen.tsx +5 -4
- package/src/primitive/GlobalInteraction/animation.ts +447 -0
- package/src/primitive/GlobalInteraction/constants.ts +24 -0
- package/src/primitive/GlobalInteraction/dom.ts +211 -0
- package/src/primitive/GlobalInteraction/useGlobalInteraction.ts +302 -129
- package/src/primitive/GlobalInteraction/useSwipeBack.ts +64 -26
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { mergeProps } from
|
|
5
|
-
import { Primitive } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
) });
|
|
1
|
+
"use client";
|
|
2
|
+
import { useAppScreen } from "./useAppScreen.js";
|
|
3
|
+
import { AppScreenProvider, useAppScreenContext } from "./useAppScreenContext.js";
|
|
4
|
+
import { mergeProps } from "@seed-design/dom-utils";
|
|
5
|
+
import { Primitive } from "@seed-design/react-primitive";
|
|
6
|
+
import { forwardRef, useRef } from "react";
|
|
7
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
8
|
+
import { usePreventTouchDuringTransition } from "@stackflow/react-ui-core";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
//#region src/primitive/AppScreen/AppScreen.tsx
|
|
11
|
+
var AppScreenRoot = forwardRef((props, ref) => {
|
|
12
|
+
const { swipeBackDisplacementRatioThreshold, swipeBackVelocityThreshold, onSwipeBackEnd, onSwipeBackMove, onSwipeBackStart, ...otherProps } = props;
|
|
13
|
+
const innerRef = useRef(null);
|
|
14
|
+
const api = useAppScreen({
|
|
15
|
+
swipeBackDisplacementRatioThreshold,
|
|
16
|
+
swipeBackVelocityThreshold,
|
|
17
|
+
onSwipeBackEnd,
|
|
18
|
+
onSwipeBackMove,
|
|
19
|
+
onSwipeBackStart
|
|
20
|
+
});
|
|
21
|
+
usePreventTouchDuringTransition({ ref: innerRef });
|
|
22
|
+
return /* @__PURE__ */ jsx(AppScreenProvider, {
|
|
23
|
+
value: api,
|
|
24
|
+
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
25
|
+
ref: composeRefs(innerRef, ref),
|
|
26
|
+
"data-stackflow-component-name": "AppScreen",
|
|
27
|
+
...mergeProps(api.activityProps, otherProps)
|
|
28
|
+
})
|
|
29
|
+
});
|
|
39
30
|
});
|
|
40
31
|
AppScreenRoot.displayName = "AppScreenRoot";
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
var AppScreenDim = forwardRef((props, ref) => {
|
|
33
|
+
const { dimProps } = useAppScreenContext();
|
|
34
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
35
|
+
ref,
|
|
36
|
+
...mergeProps(dimProps, props)
|
|
37
|
+
});
|
|
44
38
|
});
|
|
45
39
|
AppScreenDim.displayName = "AppScreenDim";
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
var AppScreenEdge = forwardRef((props, ref) => {
|
|
41
|
+
const { edgeProps } = useAppScreenContext();
|
|
42
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
43
|
+
ref,
|
|
44
|
+
...mergeProps(edgeProps, props)
|
|
45
|
+
});
|
|
49
46
|
});
|
|
50
47
|
AppScreenEdge.displayName = "AppScreenEdge";
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
var AppScreenLayer = forwardRef((props, ref) => {
|
|
49
|
+
const { layerProps } = useAppScreenContext();
|
|
50
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
51
|
+
ref,
|
|
52
|
+
...mergeProps(layerProps, props)
|
|
53
|
+
});
|
|
54
54
|
});
|
|
55
55
|
AppScreenLayer.displayName = "AppScreenLayer";
|
|
56
|
-
|
|
56
|
+
//#endregion
|
|
57
57
|
export { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenRoot };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports
|
|
12
|
-
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_AppScreen = require("./AppScreen.cjs");
|
|
3
|
+
//#region src/primitive/AppScreen/AppScreen.namespace.ts
|
|
4
|
+
var AppScreen_namespace_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
5
|
+
Dim: () => require_AppScreen.AppScreenDim,
|
|
6
|
+
Edge: () => require_AppScreen.AppScreenEdge,
|
|
7
|
+
Layer: () => require_AppScreen.AppScreenLayer,
|
|
8
|
+
Root: () => require_AppScreen.AppScreenRoot
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
Object.defineProperty(exports, "AppScreen_namespace_exports", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function() {
|
|
14
|
+
return AppScreen_namespace_exports;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenRoot } from "./AppScreen.js";
|
|
3
|
+
//#region src/primitive/AppScreen/AppScreen.namespace.ts
|
|
4
|
+
var AppScreen_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Dim: () => AppScreenDim,
|
|
6
|
+
Edge: () => AppScreenEdge,
|
|
7
|
+
Layer: () => AppScreenLayer,
|
|
8
|
+
Root: () => AppScreenRoot
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { AppScreen_namespace_exports };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/primitive/AppScreen/anatomy.ts
|
|
3
|
+
/**
|
|
4
|
+
* Parts of the AppScreen anatomy.
|
|
5
|
+
*
|
|
6
|
+
* Each value is the literal `data-part` attribute placed on the rendered DOM.
|
|
7
|
+
* Consumers in GlobalInteraction/dom.ts import from here to keep markup and
|
|
8
|
+
* DOM queries in sync.
|
|
9
|
+
*/
|
|
10
|
+
var appScreenAnatomy = {
|
|
11
|
+
activity: "activity",
|
|
12
|
+
dim: "dim",
|
|
13
|
+
layer: "layer",
|
|
14
|
+
edge: "edge"
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.appScreenAnatomy = appScreenAnatomy;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parts of the AppScreen anatomy.
|
|
3
|
+
*
|
|
4
|
+
* Each value is the literal `data-part` attribute placed on the rendered DOM.
|
|
5
|
+
* Consumers in GlobalInteraction/dom.ts import from here to keep markup and
|
|
6
|
+
* DOM queries in sync.
|
|
7
|
+
*/
|
|
8
|
+
export declare const appScreenAnatomy: {
|
|
9
|
+
readonly activity: "activity";
|
|
10
|
+
readonly dim: "dim";
|
|
11
|
+
readonly layer: "layer";
|
|
12
|
+
readonly edge: "edge";
|
|
13
|
+
};
|
|
14
|
+
export type AppScreenPart = (typeof appScreenAnatomy)[keyof typeof appScreenAnatomy];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/primitive/AppScreen/anatomy.ts
|
|
3
|
+
/**
|
|
4
|
+
* Parts of the AppScreen anatomy.
|
|
5
|
+
*
|
|
6
|
+
* Each value is the literal `data-part` attribute placed on the rendered DOM.
|
|
7
|
+
* Consumers in GlobalInteraction/dom.ts import from here to keep markup and
|
|
8
|
+
* DOM queries in sync.
|
|
9
|
+
*/
|
|
10
|
+
var appScreenAnatomy = {
|
|
11
|
+
activity: "activity",
|
|
12
|
+
dim: "dim",
|
|
13
|
+
layer: "layer",
|
|
14
|
+
edge: "edge"
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { appScreenAnatomy };
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.AppScreenDim =
|
|
12
|
-
exports.AppScreenEdge =
|
|
13
|
-
exports.AppScreenLayer =
|
|
14
|
-
exports.AppScreenRoot =
|
|
15
|
-
exports.
|
|
16
|
-
exports.useAppScreenContext = useAppScreenContext.useAppScreenContext;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_useAppScreenContext = require("./useAppScreenContext.cjs");
|
|
3
|
+
const require_AppScreen = require("./AppScreen.cjs");
|
|
4
|
+
const require_AppScreen_namespace = require("./AppScreen.namespace.cjs");
|
|
5
|
+
Object.defineProperty(exports, "AppScreen", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return require_AppScreen_namespace.AppScreen_namespace_exports;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
exports.AppScreenDim = require_AppScreen.AppScreenDim;
|
|
12
|
+
exports.AppScreenEdge = require_AppScreen.AppScreenEdge;
|
|
13
|
+
exports.AppScreenLayer = require_AppScreen.AppScreenLayer;
|
|
14
|
+
exports.AppScreenRoot = require_AppScreen.AppScreenRoot;
|
|
15
|
+
exports.useAppScreenContext = require_useAppScreenContext.useAppScreenContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export {
|
|
1
|
+
import { useAppScreenContext } from "./useAppScreenContext.js";
|
|
2
|
+
import { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenRoot } from "./AppScreen.js";
|
|
3
|
+
import { AppScreen_namespace_exports } from "./AppScreen.namespace.js";
|
|
4
|
+
export { AppScreen_namespace_exports as AppScreen, AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenRoot, useAppScreenContext };
|
|
@@ -1,66 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const useActivityZIndexBase = require('../../hooks/useActivityZIndexBase.cjs');
|
|
11
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_useSwipeBack = require("../GlobalInteraction/useSwipeBack.cjs");
|
|
4
|
+
const require_useActivityZIndexBase = require("../../hooks/useActivityZIndexBase.cjs");
|
|
5
|
+
const require_anatomy = require("./anatomy.cjs");
|
|
6
|
+
let _seed_design_dom_utils = require("@seed-design/dom-utils");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let _stackflow_react_ui_core = require("@stackflow/react-ui-core");
|
|
9
|
+
//#region src/primitive/AppScreen/useAppScreen.tsx
|
|
12
10
|
function useAppScreen(props) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
11
|
+
const activity = (0, _stackflow_react_ui_core.useNullableActivity)();
|
|
12
|
+
const transitionState = activity?.transitionState ?? "enter-done";
|
|
13
|
+
const { activityProps, layerProps, edgeProps } = require_useSwipeBack.useSwipeBack(props);
|
|
14
|
+
const zIndexBase = require_useActivityZIndexBase.useActivityZIndexBase();
|
|
15
|
+
const zIndexStyle = (0, react.useMemo)(() => ({ "--z-index-base": zIndexBase.toString() }), [zIndexBase]);
|
|
16
|
+
const stateProps = (0, react.useMemo)(() => ({
|
|
17
|
+
"data-activity-is-top": (0, _seed_design_dom_utils.dataAttr)(activity?.isTop),
|
|
18
|
+
"data-activity-is-active": (0, _seed_design_dom_utils.dataAttr)(activity?.isActive),
|
|
19
|
+
"data-transition-state": transitionState
|
|
20
|
+
}), [
|
|
21
|
+
transitionState,
|
|
22
|
+
activity?.isActive,
|
|
23
|
+
activity?.isTop
|
|
24
|
+
]);
|
|
25
|
+
return (0, react.useMemo)(() => ({
|
|
26
|
+
activity,
|
|
27
|
+
stateProps,
|
|
28
|
+
activityProps: (0, _seed_design_dom_utils.elementProps)({
|
|
29
|
+
"data-part": require_anatomy.appScreenAnatomy.activity,
|
|
30
|
+
"data-activity-type": "full-screen",
|
|
31
|
+
...activityProps,
|
|
32
|
+
...stateProps,
|
|
33
|
+
"data-activity-id": activity?.id,
|
|
34
|
+
style: zIndexStyle,
|
|
35
|
+
suppressHydrationWarning: true
|
|
36
|
+
}),
|
|
37
|
+
dimProps: (0, _seed_design_dom_utils.elementProps)({
|
|
38
|
+
"data-part": require_anatomy.appScreenAnatomy.dim,
|
|
39
|
+
...stateProps
|
|
40
|
+
}),
|
|
41
|
+
layerProps: (0, _seed_design_dom_utils.elementProps)({
|
|
42
|
+
"data-part": require_anatomy.appScreenAnatomy.layer,
|
|
43
|
+
...stateProps,
|
|
44
|
+
...layerProps
|
|
45
|
+
}),
|
|
46
|
+
edgeProps: (0, _seed_design_dom_utils.elementProps)({
|
|
47
|
+
"data-part": require_anatomy.appScreenAnatomy.edge,
|
|
48
|
+
"aria-hidden": true,
|
|
49
|
+
tabIndex: -1,
|
|
50
|
+
...edgeProps,
|
|
51
|
+
...stateProps
|
|
52
|
+
})
|
|
53
|
+
}), [
|
|
54
|
+
activity,
|
|
55
|
+
zIndexStyle,
|
|
56
|
+
stateProps,
|
|
57
|
+
activityProps,
|
|
58
|
+
edgeProps,
|
|
59
|
+
layerProps
|
|
60
|
+
]);
|
|
64
61
|
}
|
|
65
|
-
|
|
62
|
+
//#endregion
|
|
66
63
|
exports.useAppScreen = useAppScreen;
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSwipeBack } from "../GlobalInteraction/useSwipeBack.js";
|
|
3
|
+
import { useActivityZIndexBase } from "../../hooks/useActivityZIndexBase.js";
|
|
4
|
+
import { appScreenAnatomy } from "./anatomy.js";
|
|
5
|
+
import { dataAttr, elementProps } from "@seed-design/dom-utils";
|
|
6
|
+
import { useMemo } from "react";
|
|
7
|
+
import { useNullableActivity } from "@stackflow/react-ui-core";
|
|
8
|
+
//#region src/primitive/AppScreen/useAppScreen.tsx
|
|
8
9
|
function useAppScreen(props) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
);
|
|
10
|
+
const activity = useNullableActivity();
|
|
11
|
+
const transitionState = activity?.transitionState ?? "enter-done";
|
|
12
|
+
const { activityProps, layerProps, edgeProps } = useSwipeBack(props);
|
|
13
|
+
const zIndexBase = useActivityZIndexBase();
|
|
14
|
+
const zIndexStyle = useMemo(() => ({ "--z-index-base": zIndexBase.toString() }), [zIndexBase]);
|
|
15
|
+
const stateProps = useMemo(() => ({
|
|
16
|
+
"data-activity-is-top": dataAttr(activity?.isTop),
|
|
17
|
+
"data-activity-is-active": dataAttr(activity?.isActive),
|
|
18
|
+
"data-transition-state": transitionState
|
|
19
|
+
}), [
|
|
20
|
+
transitionState,
|
|
21
|
+
activity?.isActive,
|
|
22
|
+
activity?.isTop
|
|
23
|
+
]);
|
|
24
|
+
return useMemo(() => ({
|
|
25
|
+
activity,
|
|
26
|
+
stateProps,
|
|
27
|
+
activityProps: elementProps({
|
|
28
|
+
"data-part": appScreenAnatomy.activity,
|
|
29
|
+
"data-activity-type": "full-screen",
|
|
30
|
+
...activityProps,
|
|
31
|
+
...stateProps,
|
|
32
|
+
"data-activity-id": activity?.id,
|
|
33
|
+
style: zIndexStyle,
|
|
34
|
+
suppressHydrationWarning: true
|
|
35
|
+
}),
|
|
36
|
+
dimProps: elementProps({
|
|
37
|
+
"data-part": appScreenAnatomy.dim,
|
|
38
|
+
...stateProps
|
|
39
|
+
}),
|
|
40
|
+
layerProps: elementProps({
|
|
41
|
+
"data-part": appScreenAnatomy.layer,
|
|
42
|
+
...stateProps,
|
|
43
|
+
...layerProps
|
|
44
|
+
}),
|
|
45
|
+
edgeProps: elementProps({
|
|
46
|
+
"data-part": appScreenAnatomy.edge,
|
|
47
|
+
"aria-hidden": true,
|
|
48
|
+
tabIndex: -1,
|
|
49
|
+
...edgeProps,
|
|
50
|
+
...stateProps
|
|
51
|
+
})
|
|
52
|
+
}), [
|
|
53
|
+
activity,
|
|
54
|
+
zIndexStyle,
|
|
55
|
+
stateProps,
|
|
56
|
+
activityProps,
|
|
57
|
+
edgeProps,
|
|
58
|
+
layerProps
|
|
59
|
+
]);
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
//#endregion
|
|
62
62
|
export { useAppScreen };
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
strict = true
|
|
12
|
-
} = {}) {
|
|
13
|
-
const context = React.useContext(AppScreenContext);
|
|
14
|
-
if (!context && strict) {
|
|
15
|
-
throw new Error("useAppScreenContext must be used within a AppScreen");
|
|
16
|
-
}
|
|
17
|
-
return context;
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
//#region src/primitive/AppScreen/useAppScreenContext.ts
|
|
5
|
+
var AppScreenContext = (0, react.createContext)(null);
|
|
6
|
+
var AppScreenProvider = AppScreenContext.Provider;
|
|
7
|
+
function useAppScreenContext({ strict = true } = {}) {
|
|
8
|
+
const context = (0, react.useContext)(AppScreenContext);
|
|
9
|
+
if (!context && strict) throw new Error("useAppScreenContext must be used within a AppScreen");
|
|
10
|
+
return context;
|
|
18
11
|
}
|
|
19
|
-
|
|
12
|
+
//#endregion
|
|
20
13
|
exports.AppScreenProvider = AppScreenProvider;
|
|
21
14
|
exports.useAppScreenContext = useAppScreenContext;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { createContext, useContext } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function useAppScreenContext({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!context && strict) {
|
|
11
|
-
throw new Error("useAppScreenContext must be used within a AppScreen");
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
//#region src/primitive/AppScreen/useAppScreenContext.ts
|
|
4
|
+
var AppScreenContext = createContext(null);
|
|
5
|
+
var AppScreenProvider = AppScreenContext.Provider;
|
|
6
|
+
function useAppScreenContext({ strict = true } = {}) {
|
|
7
|
+
const context = useContext(AppScreenContext);
|
|
8
|
+
if (!context && strict) throw new Error("useAppScreenContext must be used within a AppScreen");
|
|
9
|
+
return context;
|
|
14
10
|
}
|
|
15
|
-
|
|
11
|
+
//#endregion
|
|
16
12
|
export { AppScreenProvider, useAppScreenContext };
|
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
...domUtils.mergeProps(api.stackProps, props)
|
|
22
|
-
}
|
|
23
|
-
) });
|
|
24
|
-
}
|
|
25
|
-
);
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_useGlobalInteractionContext = require("./useGlobalInteractionContext.cjs");
|
|
4
|
+
const require_useGlobalInteraction = require("./useGlobalInteraction.cjs");
|
|
5
|
+
let _seed_design_dom_utils = require("@seed-design/dom-utils");
|
|
6
|
+
let _seed_design_react_primitive = require("@seed-design/react-primitive");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let _radix_ui_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/primitive/GlobalInteraction/GlobalInteraction.tsx
|
|
11
|
+
var GlobalInteraction = (0, react.forwardRef)((props, ref) => {
|
|
12
|
+
const api = require_useGlobalInteraction.useGlobalInteraction();
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_useGlobalInteractionContext.GlobalInteractionProvider, {
|
|
14
|
+
value: api,
|
|
15
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
16
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(api.stackRef, ref),
|
|
17
|
+
...(0, _seed_design_dom_utils.mergeProps)(api.stackProps, props)
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
});
|
|
26
21
|
GlobalInteraction.displayName = "GlobalInteraction";
|
|
27
|
-
|
|
22
|
+
//#endregion
|
|
28
23
|
exports.GlobalInteraction = GlobalInteraction;
|