@seed-design/stackflow 0.0.0-alpha-20260504105015 → 0.0.0-alpha-20260622094810
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 +11 -2
- package/lib/components/AppBar/AppBar.js +12 -3
- package/lib/primitive/AppBar/AppBar.cjs +2 -0
- package/lib/primitive/AppBar/AppBar.js +2 -0
- 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/useAppBar.cjs +2 -1
- package/lib/primitive/AppBar/useAppBar.js +2 -1
- package/lib/primitive/AppScreen/AppScreen.cjs +17 -6
- package/lib/primitive/AppScreen/AppScreen.js +18 -7
- 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/useAppScreen.cjs +7 -4
- package/lib/primitive/AppScreen/useAppScreen.d.ts +2 -1
- package/lib/primitive/AppScreen/useAppScreen.js +8 -5
- 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 +176 -0
- package/lib/primitive/GlobalInteraction/dom.d.ts +61 -0
- package/lib/primitive/GlobalInteraction/dom.js +168 -0
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.cjs +201 -91
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.d.ts +10 -26
- package/lib/primitive/GlobalInteraction/useGlobalInteraction.js +202 -92
- package/lib/primitive/GlobalInteraction/useSwipeBack.cjs +43 -20
- package/lib/primitive/GlobalInteraction/useSwipeBack.d.ts +19 -2
- package/lib/primitive/GlobalInteraction/useSwipeBack.js +44 -21
- package/package.json +6 -5
- 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/AppScreen.tsx +31 -8
- package/src/primitive/AppScreen/anatomy.ts +15 -0
- package/src/primitive/AppScreen/useAppScreen.tsx +8 -5
- package/src/primitive/GlobalInteraction/animation.ts +450 -0
- package/src/primitive/GlobalInteraction/constants.ts +24 -0
- package/src/primitive/GlobalInteraction/dom.ts +240 -0
- package/src/primitive/GlobalInteraction/useGlobalInteraction.ts +325 -129
- package/src/primitive/GlobalInteraction/useSwipeBack.ts +64 -26
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_anatomy = require("../../primitive/AppBar/anatomy.cjs");
|
|
3
4
|
const require_useAppBarContext = require("../../primitive/AppBar/useAppBarContext.cjs");
|
|
4
5
|
const require_AppBar = require("../../primitive/AppBar/AppBar.cjs");
|
|
5
6
|
const require_useTopActivity = require("../../primitive/private/useTopActivity.cjs");
|
|
@@ -32,16 +33,22 @@ var AppBarRoot = (0, react.forwardRef)((props, ref) => {
|
|
|
32
33
|
...(0, _stackflow_react.useActivity)().isTop === false && { transitionStyle: topActivityTransitionStyle }
|
|
33
34
|
};
|
|
34
35
|
const classNames = (0, _seed_design_css_recipes_app_bar.appBar)(resolvedVariantProps);
|
|
36
|
+
const { children, ...restProps } = otherProps;
|
|
35
37
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClassNamesProvider, {
|
|
36
38
|
value: classNames,
|
|
37
39
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MainPropsProvider, {
|
|
38
40
|
value: resolvedVariantProps,
|
|
39
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.
|
|
41
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AppBar.AppBarRoot, {
|
|
40
42
|
ref,
|
|
41
43
|
...(0, _seed_design_dom_utils.mergeProps)({
|
|
42
44
|
className: classNames.root,
|
|
43
45
|
style: boxStyle
|
|
44
|
-
},
|
|
46
|
+
}, restProps),
|
|
47
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
48
|
+
"aria-hidden": true,
|
|
49
|
+
"data-part": require_anatomy.appBarAnatomy.background,
|
|
50
|
+
className: classNames.background
|
|
51
|
+
}), children]
|
|
45
52
|
})
|
|
46
53
|
})
|
|
47
54
|
});
|
|
@@ -62,6 +69,7 @@ var AppBarIconButton = (0, react.forwardRef)(({ children, className, ...otherPro
|
|
|
62
69
|
...(0, _seed_design_dom_utils.mergeProps)(stateProps, otherProps),
|
|
63
70
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_slot.Slot, {
|
|
64
71
|
className: classNames.icon,
|
|
72
|
+
"data-part": require_anatomy.appBarAnatomy.icon,
|
|
65
73
|
...stateProps,
|
|
66
74
|
children
|
|
67
75
|
})
|
|
@@ -73,6 +81,7 @@ var AppBarSlot = (0, react.forwardRef)(({ children, className, ...otherProps },
|
|
|
73
81
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_slot.Slot, {
|
|
74
82
|
ref,
|
|
75
83
|
className: (0, clsx.default)(useClassNames().custom, className),
|
|
84
|
+
"data-part": require_anatomy.appBarAnatomy.custom,
|
|
76
85
|
...(0, _seed_design_dom_utils.mergeProps)(stateProps, otherProps),
|
|
77
86
|
children
|
|
78
87
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { appBarAnatomy } from "../../primitive/AppBar/anatomy.js";
|
|
2
3
|
import { useAppBarContext } from "../../primitive/AppBar/useAppBarContext.js";
|
|
3
4
|
import { AppBarLeft as AppBarLeft$1, AppBarMain as AppBarMain$1, AppBarRight as AppBarRight$1, AppBarRoot as AppBarRoot$1 } from "../../primitive/AppBar/AppBar.js";
|
|
4
5
|
import { useTopActivity } from "../../primitive/private/useTopActivity.js";
|
|
@@ -11,7 +12,7 @@ import { mergeProps } from "@seed-design/dom-utils";
|
|
|
11
12
|
import { Primitive } from "@seed-design/react-primitive";
|
|
12
13
|
import clsx from "clsx";
|
|
13
14
|
import { forwardRef } from "react";
|
|
14
|
-
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
16
|
import { useActivity } from "@stackflow/react";
|
|
16
17
|
//#region src/components/AppBar/AppBar.tsx
|
|
17
18
|
var { PropsProvider, ClassNamesProvider, useProps, withContext, useClassNames } = createStyleContext(appBar);
|
|
@@ -30,16 +31,22 @@ var AppBarRoot = forwardRef((props, ref) => {
|
|
|
30
31
|
...useActivity().isTop === false && { transitionStyle: topActivityTransitionStyle }
|
|
31
32
|
};
|
|
32
33
|
const classNames = appBar(resolvedVariantProps);
|
|
34
|
+
const { children, ...restProps } = otherProps;
|
|
33
35
|
return /* @__PURE__ */ jsx(ClassNamesProvider, {
|
|
34
36
|
value: classNames,
|
|
35
37
|
children: /* @__PURE__ */ jsx(MainPropsProvider, {
|
|
36
38
|
value: resolvedVariantProps,
|
|
37
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ jsxs(AppBarRoot$1, {
|
|
38
40
|
ref,
|
|
39
41
|
...mergeProps({
|
|
40
42
|
className: classNames.root,
|
|
41
43
|
style: boxStyle
|
|
42
|
-
},
|
|
44
|
+
}, restProps),
|
|
45
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
46
|
+
"aria-hidden": true,
|
|
47
|
+
"data-part": appBarAnatomy.background,
|
|
48
|
+
className: classNames.background
|
|
49
|
+
}), children]
|
|
43
50
|
})
|
|
44
51
|
})
|
|
45
52
|
});
|
|
@@ -60,6 +67,7 @@ var AppBarIconButton = forwardRef(({ children, className, ...otherProps }, ref)
|
|
|
60
67
|
...mergeProps(stateProps, otherProps),
|
|
61
68
|
children: /* @__PURE__ */ jsx(Slot, {
|
|
62
69
|
className: classNames.icon,
|
|
70
|
+
"data-part": appBarAnatomy.icon,
|
|
63
71
|
...stateProps,
|
|
64
72
|
children
|
|
65
73
|
})
|
|
@@ -71,6 +79,7 @@ var AppBarSlot = forwardRef(({ children, className, ...otherProps }, ref) => {
|
|
|
71
79
|
return /* @__PURE__ */ jsx(Slot, {
|
|
72
80
|
ref,
|
|
73
81
|
className: clsx(useClassNames().custom, className),
|
|
82
|
+
"data-part": appBarAnatomy.custom,
|
|
74
83
|
...mergeProps(stateProps, otherProps),
|
|
75
84
|
children
|
|
76
85
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_anatomy = require("./anatomy.cjs");
|
|
3
4
|
const require_useAppBar = require("./useAppBar.cjs");
|
|
4
5
|
const require_useAppBarContext = require("./useAppBarContext.cjs");
|
|
5
6
|
let _seed_design_dom_utils = require("@seed-design/dom-utils");
|
|
@@ -40,6 +41,7 @@ var AppBarMain = (0, react.forwardRef)((props, ref) => {
|
|
|
40
41
|
const { stateProps } = require_useAppBarContext.useAppBarContext();
|
|
41
42
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
42
43
|
ref,
|
|
44
|
+
"data-part": require_anatomy.appBarAnatomy.main,
|
|
43
45
|
...(0, _seed_design_dom_utils.mergeProps)(stateProps, props)
|
|
44
46
|
});
|
|
45
47
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { appBarAnatomy } from "./anatomy.js";
|
|
2
3
|
import { useAppBar } from "./useAppBar.js";
|
|
3
4
|
import { AppBarProvider, useAppBarContext } from "./useAppBarContext.js";
|
|
4
5
|
import { mergeProps } from "@seed-design/dom-utils";
|
|
@@ -39,6 +40,7 @@ var AppBarMain = forwardRef((props, ref) => {
|
|
|
39
40
|
const { stateProps } = useAppBarContext();
|
|
40
41
|
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
41
42
|
ref,
|
|
43
|
+
"data-part": appBarAnatomy.main,
|
|
42
44
|
...mergeProps(stateProps, props)
|
|
43
45
|
});
|
|
44
46
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/primitive/AppBar/anatomy.ts
|
|
3
|
+
/**
|
|
4
|
+
* Parts of the AppBar anatomy.
|
|
5
|
+
*
|
|
6
|
+
* Each value is the literal `data-part` attribute placed on the rendered DOM.
|
|
7
|
+
* Consumers in the styled layer and in GlobalInteraction/dom.ts import from
|
|
8
|
+
* here to keep markup and DOM queries in sync.
|
|
9
|
+
*/
|
|
10
|
+
var appBarAnatomy = {
|
|
11
|
+
root: "appBar",
|
|
12
|
+
background: "appBarBackground",
|
|
13
|
+
main: "appBarMain",
|
|
14
|
+
icon: "appBarIcon",
|
|
15
|
+
custom: "appBarCustom"
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.appBarAnatomy = appBarAnatomy;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parts of the AppBar anatomy.
|
|
3
|
+
*
|
|
4
|
+
* Each value is the literal `data-part` attribute placed on the rendered DOM.
|
|
5
|
+
* Consumers in the styled layer and in GlobalInteraction/dom.ts import from
|
|
6
|
+
* here to keep markup and DOM queries in sync.
|
|
7
|
+
*/
|
|
8
|
+
export declare const appBarAnatomy: {
|
|
9
|
+
readonly root: "appBar";
|
|
10
|
+
readonly background: "appBarBackground";
|
|
11
|
+
readonly main: "appBarMain";
|
|
12
|
+
readonly icon: "appBarIcon";
|
|
13
|
+
readonly custom: "appBarCustom";
|
|
14
|
+
};
|
|
15
|
+
export type AppBarPart = (typeof appBarAnatomy)[keyof typeof appBarAnatomy];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/primitive/AppBar/anatomy.ts
|
|
3
|
+
/**
|
|
4
|
+
* Parts of the AppBar anatomy.
|
|
5
|
+
*
|
|
6
|
+
* Each value is the literal `data-part` attribute placed on the rendered DOM.
|
|
7
|
+
* Consumers in the styled layer and in GlobalInteraction/dom.ts import from
|
|
8
|
+
* here to keep markup and DOM queries in sync.
|
|
9
|
+
*/
|
|
10
|
+
var appBarAnatomy = {
|
|
11
|
+
root: "appBar",
|
|
12
|
+
background: "appBarBackground",
|
|
13
|
+
main: "appBarMain",
|
|
14
|
+
icon: "appBarIcon",
|
|
15
|
+
custom: "appBarCustom"
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { appBarAnatomy };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_useAppScreenContext = require("../AppScreen/useAppScreenContext.cjs");
|
|
4
|
+
const require_anatomy = require("./anatomy.cjs");
|
|
4
5
|
const require_useElementOffset = require("../private/useElementOffset.cjs");
|
|
5
6
|
let _seed_design_dom_utils = require("@seed-design/dom-utils");
|
|
6
7
|
let react = require("react");
|
|
@@ -21,7 +22,7 @@ function useAppBar(_props) {
|
|
|
21
22
|
},
|
|
22
23
|
stateProps,
|
|
23
24
|
rootProps: (0, _seed_design_dom_utils.elementProps)({
|
|
24
|
-
"data-part":
|
|
25
|
+
"data-part": require_anatomy.appBarAnatomy.root,
|
|
25
26
|
...stateProps,
|
|
26
27
|
style: { "--centered-title-padding-x": centeredTitlePaddingX }
|
|
27
28
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAppScreenContext } from "../AppScreen/useAppScreenContext.js";
|
|
3
|
+
import { appBarAnatomy } from "./anatomy.js";
|
|
3
4
|
import { useElementOffset } from "../private/useElementOffset.js";
|
|
4
5
|
import { elementProps } from "@seed-design/dom-utils";
|
|
5
6
|
import { useMemo, useState } from "react";
|
|
@@ -20,7 +21,7 @@ function useAppBar(_props) {
|
|
|
20
21
|
},
|
|
21
22
|
stateProps,
|
|
22
23
|
rootProps: elementProps({
|
|
23
|
-
"data-part":
|
|
24
|
+
"data-part": appBarAnatomy.root,
|
|
24
25
|
...stateProps,
|
|
25
26
|
style: { "--centered-title-padding-x": centeredTitlePaddingX }
|
|
26
27
|
})
|
|
@@ -6,6 +6,7 @@ let _seed_design_dom_utils = require("@seed-design/dom-utils");
|
|
|
6
6
|
let _seed_design_react_primitive = require("@seed-design/react-primitive");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let _radix_ui_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
9
|
+
let _radix_ui_react_focus_scope = require("@radix-ui/react-focus-scope");
|
|
9
10
|
let _stackflow_react_ui_core = require("@stackflow/react-ui-core");
|
|
10
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
12
|
//#region src/primitive/AppScreen/AppScreen.tsx
|
|
@@ -20,12 +21,21 @@ var AppScreenRoot = (0, react.forwardRef)((props, ref) => {
|
|
|
20
21
|
onSwipeBackStart
|
|
21
22
|
});
|
|
22
23
|
(0, _stackflow_react_ui_core.usePreventTouchDuringTransition)({ ref: innerRef });
|
|
24
|
+
(0, react.useEffect)(() => {
|
|
25
|
+
if (api.activity?.transitionState === "enter-done") api.layerRef.current?.focus();
|
|
26
|
+
}, [api.activity?.transitionState, api.layerRef]);
|
|
23
27
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_useAppScreenContext.AppScreenProvider, {
|
|
24
28
|
value: api,
|
|
25
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_focus_scope.FocusScope, {
|
|
30
|
+
asChild: true,
|
|
31
|
+
trapped: true,
|
|
32
|
+
loop: true,
|
|
33
|
+
onMountAutoFocus: (e) => e.preventDefault(),
|
|
34
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
35
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(innerRef, ref),
|
|
36
|
+
"data-stackflow-component-name": "AppScreen",
|
|
37
|
+
...(0, _seed_design_dom_utils.mergeProps)(api.activityProps, otherProps)
|
|
38
|
+
})
|
|
29
39
|
})
|
|
30
40
|
});
|
|
31
41
|
});
|
|
@@ -47,9 +57,10 @@ var AppScreenEdge = (0, react.forwardRef)((props, ref) => {
|
|
|
47
57
|
});
|
|
48
58
|
AppScreenEdge.displayName = "AppScreenEdge";
|
|
49
59
|
var AppScreenLayer = (0, react.forwardRef)((props, ref) => {
|
|
50
|
-
const { layerProps } = require_useAppScreenContext.useAppScreenContext();
|
|
60
|
+
const { layerProps, layerRef } = require_useAppScreenContext.useAppScreenContext();
|
|
51
61
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
52
|
-
ref,
|
|
62
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(ref, layerRef),
|
|
63
|
+
tabIndex: -1,
|
|
53
64
|
...(0, _seed_design_dom_utils.mergeProps)(layerProps, props)
|
|
54
65
|
});
|
|
55
66
|
});
|
|
@@ -3,8 +3,9 @@ import { useAppScreen } from "./useAppScreen.js";
|
|
|
3
3
|
import { AppScreenProvider, useAppScreenContext } from "./useAppScreenContext.js";
|
|
4
4
|
import { mergeProps } from "@seed-design/dom-utils";
|
|
5
5
|
import { Primitive } from "@seed-design/react-primitive";
|
|
6
|
-
import { forwardRef, useRef } from "react";
|
|
6
|
+
import { forwardRef, useEffect, useRef } from "react";
|
|
7
7
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
8
|
+
import { FocusScope } from "@radix-ui/react-focus-scope";
|
|
8
9
|
import { usePreventTouchDuringTransition } from "@stackflow/react-ui-core";
|
|
9
10
|
import { jsx } from "react/jsx-runtime";
|
|
10
11
|
//#region src/primitive/AppScreen/AppScreen.tsx
|
|
@@ -19,12 +20,21 @@ var AppScreenRoot = forwardRef((props, ref) => {
|
|
|
19
20
|
onSwipeBackStart
|
|
20
21
|
});
|
|
21
22
|
usePreventTouchDuringTransition({ ref: innerRef });
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (api.activity?.transitionState === "enter-done") api.layerRef.current?.focus();
|
|
25
|
+
}, [api.activity?.transitionState, api.layerRef]);
|
|
22
26
|
return /* @__PURE__ */ jsx(AppScreenProvider, {
|
|
23
27
|
value: api,
|
|
24
|
-
children: /* @__PURE__ */ jsx(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
29
|
+
asChild: true,
|
|
30
|
+
trapped: true,
|
|
31
|
+
loop: true,
|
|
32
|
+
onMountAutoFocus: (e) => e.preventDefault(),
|
|
33
|
+
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
34
|
+
ref: composeRefs(innerRef, ref),
|
|
35
|
+
"data-stackflow-component-name": "AppScreen",
|
|
36
|
+
...mergeProps(api.activityProps, otherProps)
|
|
37
|
+
})
|
|
28
38
|
})
|
|
29
39
|
});
|
|
30
40
|
});
|
|
@@ -46,9 +56,10 @@ var AppScreenEdge = forwardRef((props, ref) => {
|
|
|
46
56
|
});
|
|
47
57
|
AppScreenEdge.displayName = "AppScreenEdge";
|
|
48
58
|
var AppScreenLayer = forwardRef((props, ref) => {
|
|
49
|
-
const { layerProps } = useAppScreenContext();
|
|
59
|
+
const { layerProps, layerRef } = useAppScreenContext();
|
|
50
60
|
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
51
|
-
ref,
|
|
61
|
+
ref: composeRefs(ref, layerRef),
|
|
62
|
+
tabIndex: -1,
|
|
52
63
|
...mergeProps(layerProps, props)
|
|
53
64
|
});
|
|
54
65
|
});
|
|
@@ -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 };
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_useSwipeBack = require("../GlobalInteraction/useSwipeBack.cjs");
|
|
4
4
|
const require_useActivityZIndexBase = require("../../hooks/useActivityZIndexBase.cjs");
|
|
5
|
+
const require_anatomy = require("./anatomy.cjs");
|
|
5
6
|
let _seed_design_dom_utils = require("@seed-design/dom-utils");
|
|
6
7
|
let react = require("react");
|
|
7
8
|
let _stackflow_react_ui_core = require("@stackflow/react-ui-core");
|
|
8
9
|
//#region src/primitive/AppScreen/useAppScreen.tsx
|
|
9
10
|
function useAppScreen(props) {
|
|
10
11
|
const activity = (0, _stackflow_react_ui_core.useNullableActivity)();
|
|
12
|
+
const layerRef = (0, react.useRef)(null);
|
|
11
13
|
const transitionState = activity?.transitionState ?? "enter-done";
|
|
12
14
|
const { activityProps, layerProps, edgeProps } = require_useSwipeBack.useSwipeBack(props);
|
|
13
15
|
const zIndexBase = require_useActivityZIndexBase.useActivityZIndexBase();
|
|
@@ -23,9 +25,10 @@ function useAppScreen(props) {
|
|
|
23
25
|
]);
|
|
24
26
|
return (0, react.useMemo)(() => ({
|
|
25
27
|
activity,
|
|
28
|
+
layerRef,
|
|
26
29
|
stateProps,
|
|
27
30
|
activityProps: (0, _seed_design_dom_utils.elementProps)({
|
|
28
|
-
"data-part":
|
|
31
|
+
"data-part": require_anatomy.appScreenAnatomy.activity,
|
|
29
32
|
"data-activity-type": "full-screen",
|
|
30
33
|
...activityProps,
|
|
31
34
|
...stateProps,
|
|
@@ -34,16 +37,16 @@ function useAppScreen(props) {
|
|
|
34
37
|
suppressHydrationWarning: true
|
|
35
38
|
}),
|
|
36
39
|
dimProps: (0, _seed_design_dom_utils.elementProps)({
|
|
37
|
-
"data-part":
|
|
40
|
+
"data-part": require_anatomy.appScreenAnatomy.dim,
|
|
38
41
|
...stateProps
|
|
39
42
|
}),
|
|
40
43
|
layerProps: (0, _seed_design_dom_utils.elementProps)({
|
|
41
|
-
"data-part":
|
|
44
|
+
"data-part": require_anatomy.appScreenAnatomy.layer,
|
|
42
45
|
...stateProps,
|
|
43
46
|
...layerProps
|
|
44
47
|
}),
|
|
45
48
|
edgeProps: (0, _seed_design_dom_utils.elementProps)({
|
|
46
|
-
"data-part":
|
|
49
|
+
"data-part": require_anatomy.appScreenAnatomy.edge,
|
|
47
50
|
"aria-hidden": true,
|
|
48
51
|
tabIndex: -1,
|
|
49
52
|
...edgeProps,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { UseSwipeBackProps } from '../GlobalInteraction/useSwipeBack';
|
|
2
2
|
import { Activity } from '@stackflow/core';
|
|
3
|
-
import { HTMLAttributes, CSSProperties, AriaRole, ReactNode, ClipboardEventHandler, CompositionEventHandler, FocusEventHandler, FormEventHandler, InputEventHandler, ReactEventHandler, KeyboardEventHandler, MouseEventHandler, DragEventHandler, TouchEventHandler, PointerEventHandler, UIEventHandler, WheelEventHandler, AnimationEventHandler, ToggleEventHandler, TransitionEventHandler } from 'react';
|
|
3
|
+
import { RefObject, HTMLAttributes, CSSProperties, AriaRole, ReactNode, ClipboardEventHandler, CompositionEventHandler, FocusEventHandler, FormEventHandler, InputEventHandler, ReactEventHandler, KeyboardEventHandler, MouseEventHandler, DragEventHandler, TouchEventHandler, PointerEventHandler, UIEventHandler, WheelEventHandler, AnimationEventHandler, ToggleEventHandler, TransitionEventHandler } from 'react';
|
|
4
4
|
export interface UseAppScreenProps extends UseSwipeBackProps {
|
|
5
5
|
}
|
|
6
6
|
export type UseAppScreenReturn = ReturnType<typeof useAppScreen>;
|
|
7
7
|
export declare function useAppScreen(props: UseAppScreenProps): {
|
|
8
8
|
activity: Activity | null;
|
|
9
|
+
layerRef: RefObject<HTMLDivElement | null>;
|
|
9
10
|
stateProps: HTMLAttributes<HTMLElement>;
|
|
10
11
|
activityProps: {
|
|
11
12
|
slot?: string | undefined | undefined;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useSwipeBack } from "../GlobalInteraction/useSwipeBack.js";
|
|
3
3
|
import { useActivityZIndexBase } from "../../hooks/useActivityZIndexBase.js";
|
|
4
|
+
import { appScreenAnatomy } from "./anatomy.js";
|
|
4
5
|
import { dataAttr, elementProps } from "@seed-design/dom-utils";
|
|
5
|
-
import { useMemo } from "react";
|
|
6
|
+
import { useMemo, useRef } from "react";
|
|
6
7
|
import { useNullableActivity } from "@stackflow/react-ui-core";
|
|
7
8
|
//#region src/primitive/AppScreen/useAppScreen.tsx
|
|
8
9
|
function useAppScreen(props) {
|
|
9
10
|
const activity = useNullableActivity();
|
|
11
|
+
const layerRef = useRef(null);
|
|
10
12
|
const transitionState = activity?.transitionState ?? "enter-done";
|
|
11
13
|
const { activityProps, layerProps, edgeProps } = useSwipeBack(props);
|
|
12
14
|
const zIndexBase = useActivityZIndexBase();
|
|
@@ -22,9 +24,10 @@ function useAppScreen(props) {
|
|
|
22
24
|
]);
|
|
23
25
|
return useMemo(() => ({
|
|
24
26
|
activity,
|
|
27
|
+
layerRef,
|
|
25
28
|
stateProps,
|
|
26
29
|
activityProps: elementProps({
|
|
27
|
-
"data-part":
|
|
30
|
+
"data-part": appScreenAnatomy.activity,
|
|
28
31
|
"data-activity-type": "full-screen",
|
|
29
32
|
...activityProps,
|
|
30
33
|
...stateProps,
|
|
@@ -33,16 +36,16 @@ function useAppScreen(props) {
|
|
|
33
36
|
suppressHydrationWarning: true
|
|
34
37
|
}),
|
|
35
38
|
dimProps: elementProps({
|
|
36
|
-
"data-part":
|
|
39
|
+
"data-part": appScreenAnatomy.dim,
|
|
37
40
|
...stateProps
|
|
38
41
|
}),
|
|
39
42
|
layerProps: elementProps({
|
|
40
|
-
"data-part":
|
|
43
|
+
"data-part": appScreenAnatomy.layer,
|
|
41
44
|
...stateProps,
|
|
42
45
|
...layerProps
|
|
43
46
|
}),
|
|
44
47
|
edgeProps: elementProps({
|
|
45
|
-
"data-part":
|
|
48
|
+
"data-part": appScreenAnatomy.edge,
|
|
46
49
|
"aria-hidden": true,
|
|
47
50
|
tabIndex: -1,
|
|
48
51
|
...edgeProps,
|