@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,43 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
) });
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_anatomy = require("./anatomy.cjs");
|
|
4
|
+
const require_useAppBar = require("./useAppBar.cjs");
|
|
5
|
+
const require_useAppBarContext = require("./useAppBarContext.cjs");
|
|
6
|
+
let _seed_design_dom_utils = require("@seed-design/dom-utils");
|
|
7
|
+
let _seed_design_react_primitive = require("@seed-design/react-primitive");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let _radix_ui_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
//#region src/primitive/AppBar/AppBar.tsx
|
|
12
|
+
var AppBarRoot = (0, react.forwardRef)((props, ref) => {
|
|
13
|
+
const { ...otherProps } = props;
|
|
14
|
+
const api = require_useAppBar.useAppBar({});
|
|
15
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_useAppBarContext.AppBarProvider, {
|
|
16
|
+
value: api,
|
|
17
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
18
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(api.refs.root, ref),
|
|
19
|
+
...(0, _seed_design_dom_utils.mergeProps)(api.rootProps, otherProps)
|
|
20
|
+
})
|
|
21
|
+
});
|
|
24
22
|
});
|
|
25
23
|
AppBarRoot.displayName = "AppBarRoot";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
var AppBarLeft = (0, react.forwardRef)((props, ref) => {
|
|
25
|
+
const { refs, stateProps } = require_useAppBarContext.useAppBarContext();
|
|
26
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
27
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(refs.left, ref),
|
|
28
|
+
...(0, _seed_design_dom_utils.mergeProps)(stateProps, props)
|
|
29
|
+
});
|
|
29
30
|
});
|
|
30
31
|
AppBarLeft.displayName = "AppBarLeft";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
var AppBarRight = (0, react.forwardRef)((props, ref) => {
|
|
33
|
+
const { refs, stateProps } = require_useAppBarContext.useAppBarContext();
|
|
34
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
35
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(refs.right, ref),
|
|
36
|
+
...(0, _seed_design_dom_utils.mergeProps)(stateProps, props)
|
|
37
|
+
});
|
|
34
38
|
});
|
|
35
39
|
AppBarRight.displayName = "AppBarRight";
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
var AppBarMain = (0, react.forwardRef)((props, ref) => {
|
|
41
|
+
const { stateProps } = require_useAppBarContext.useAppBarContext();
|
|
42
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
43
|
+
ref,
|
|
44
|
+
"data-part": require_anatomy.appBarAnatomy.main,
|
|
45
|
+
...(0, _seed_design_dom_utils.mergeProps)(stateProps, props)
|
|
46
|
+
});
|
|
39
47
|
});
|
|
40
|
-
|
|
48
|
+
//#endregion
|
|
41
49
|
exports.AppBarLeft = AppBarLeft;
|
|
42
50
|
exports.AppBarMain = AppBarMain;
|
|
43
51
|
exports.AppBarRight = AppBarRight;
|
|
@@ -1,37 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { appBarAnatomy } from "./anatomy.js";
|
|
3
|
+
import { useAppBar } from "./useAppBar.js";
|
|
4
|
+
import { AppBarProvider, useAppBarContext } from "./useAppBarContext.js";
|
|
5
|
+
import { mergeProps } from "@seed-design/dom-utils";
|
|
6
|
+
import { Primitive } from "@seed-design/react-primitive";
|
|
7
|
+
import { forwardRef } from "react";
|
|
8
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
//#region src/primitive/AppBar/AppBar.tsx
|
|
11
|
+
var AppBarRoot = forwardRef((props, ref) => {
|
|
12
|
+
const { ...otherProps } = props;
|
|
13
|
+
const api = useAppBar({});
|
|
14
|
+
return /* @__PURE__ */ jsx(AppBarProvider, {
|
|
15
|
+
value: api,
|
|
16
|
+
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
17
|
+
ref: composeRefs(api.refs.root, ref),
|
|
18
|
+
...mergeProps(api.rootProps, otherProps)
|
|
19
|
+
})
|
|
20
|
+
});
|
|
20
21
|
});
|
|
21
22
|
AppBarRoot.displayName = "AppBarRoot";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
var AppBarLeft = forwardRef((props, ref) => {
|
|
24
|
+
const { refs, stateProps } = useAppBarContext();
|
|
25
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
26
|
+
ref: composeRefs(refs.left, ref),
|
|
27
|
+
...mergeProps(stateProps, props)
|
|
28
|
+
});
|
|
25
29
|
});
|
|
26
30
|
AppBarLeft.displayName = "AppBarLeft";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
var AppBarRight = forwardRef((props, ref) => {
|
|
32
|
+
const { refs, stateProps } = useAppBarContext();
|
|
33
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
34
|
+
ref: composeRefs(refs.right, ref),
|
|
35
|
+
...mergeProps(stateProps, props)
|
|
36
|
+
});
|
|
30
37
|
});
|
|
31
38
|
AppBarRight.displayName = "AppBarRight";
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
var AppBarMain = forwardRef((props, ref) => {
|
|
40
|
+
const { stateProps } = useAppBarContext();
|
|
41
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
42
|
+
ref,
|
|
43
|
+
"data-part": appBarAnatomy.main,
|
|
44
|
+
...mergeProps(stateProps, props)
|
|
45
|
+
});
|
|
35
46
|
});
|
|
36
|
-
|
|
47
|
+
//#endregion
|
|
37
48
|
export { AppBarLeft, AppBarMain, AppBarRight, AppBarRoot };
|
|
@@ -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_AppBar = require("./AppBar.cjs");
|
|
3
|
+
//#region src/primitive/AppBar/AppBar.namespace.ts
|
|
4
|
+
var AppBar_namespace_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
5
|
+
Left: () => require_AppBar.AppBarLeft,
|
|
6
|
+
Main: () => require_AppBar.AppBarMain,
|
|
7
|
+
Right: () => require_AppBar.AppBarRight,
|
|
8
|
+
Root: () => require_AppBar.AppBarRoot
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
Object.defineProperty(exports, "AppBar_namespace_exports", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function() {
|
|
14
|
+
return AppBar_namespace_exports;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { AppBarLeft, AppBarMain, AppBarRight, AppBarRoot } from "./AppBar.js";
|
|
3
|
+
//#region src/primitive/AppBar/AppBar.namespace.ts
|
|
4
|
+
var AppBar_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Left: () => AppBarLeft,
|
|
6
|
+
Main: () => AppBarMain,
|
|
7
|
+
Right: () => AppBarRight,
|
|
8
|
+
Root: () => AppBarRoot
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { AppBar_namespace_exports };
|
|
@@ -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,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.AppBarLeft =
|
|
11
|
-
exports.AppBarMain =
|
|
12
|
-
exports.AppBarRight =
|
|
13
|
-
exports.AppBarRoot =
|
|
14
|
-
exports.AppBar = AppBar_namespace;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_AppBar = require("./AppBar.cjs");
|
|
3
|
+
const require_AppBar_namespace = require("./AppBar.namespace.cjs");
|
|
4
|
+
Object.defineProperty(exports, "AppBar", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return require_AppBar_namespace.AppBar_namespace_exports;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
exports.AppBarLeft = require_AppBar.AppBarLeft;
|
|
11
|
+
exports.AppBarMain = require_AppBar.AppBarMain;
|
|
12
|
+
exports.AppBarRight = require_AppBar.AppBarRight;
|
|
13
|
+
exports.AppBarRoot = require_AppBar.AppBarRoot;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
export {
|
|
1
|
+
import { AppBarLeft, AppBarMain, AppBarRight, AppBarRoot } from "./AppBar.js";
|
|
2
|
+
import { AppBar_namespace_exports } from "./AppBar.namespace.js";
|
|
3
|
+
export { AppBar_namespace_exports as AppBar, AppBarLeft, AppBarMain, AppBarRight, AppBarRoot };
|
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const useElementOffset = require('../private/useElementOffset.cjs');
|
|
10
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_useAppScreenContext = require("../AppScreen/useAppScreenContext.cjs");
|
|
4
|
+
const require_anatomy = require("./anatomy.cjs");
|
|
5
|
+
const require_useElementOffset = require("../private/useElementOffset.cjs");
|
|
6
|
+
let _seed_design_dom_utils = require("@seed-design/dom-utils");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
//#region src/primitive/AppBar/useAppBar.tsx
|
|
11
9
|
function useAppBar(_props) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
}),
|
|
35
|
-
[stateProps, centeredTitlePaddingX]
|
|
36
|
-
);
|
|
10
|
+
const { stateProps } = require_useAppScreenContext.useAppScreenContext();
|
|
11
|
+
const [root, rootRef] = (0, react.useState)(null);
|
|
12
|
+
const [left, leftRef] = (0, react.useState)(null);
|
|
13
|
+
const [right, rightRef] = (0, react.useState)(null);
|
|
14
|
+
const leftOffset = require_useElementOffset.useElementOffset(left);
|
|
15
|
+
const rightOffset = require_useElementOffset.useElementOffset(right);
|
|
16
|
+
const centeredTitlePaddingX = root ? `${Math.max(leftOffset?.fromLeft ?? 0, rightOffset?.fromRight ?? 0)}px` : "initial";
|
|
17
|
+
return (0, react.useMemo)(() => ({
|
|
18
|
+
refs: {
|
|
19
|
+
root: rootRef,
|
|
20
|
+
left: leftRef,
|
|
21
|
+
right: rightRef
|
|
22
|
+
},
|
|
23
|
+
stateProps,
|
|
24
|
+
rootProps: (0, _seed_design_dom_utils.elementProps)({
|
|
25
|
+
"data-part": require_anatomy.appBarAnatomy.root,
|
|
26
|
+
...stateProps,
|
|
27
|
+
style: { "--centered-title-padding-x": centeredTitlePaddingX }
|
|
28
|
+
})
|
|
29
|
+
}), [stateProps, centeredTitlePaddingX]);
|
|
37
30
|
}
|
|
38
|
-
|
|
31
|
+
//#endregion
|
|
39
32
|
exports.useAppBar = useAppBar;
|
|
@@ -1,35 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { useAppScreenContext } from "../AppScreen/useAppScreenContext.js";
|
|
3
|
+
import { appBarAnatomy } from "./anatomy.js";
|
|
4
|
+
import { useElementOffset } from "../private/useElementOffset.js";
|
|
5
|
+
import { elementProps } from "@seed-design/dom-utils";
|
|
6
|
+
import { useMemo, useState } from "react";
|
|
7
|
+
//#region src/primitive/AppBar/useAppBar.tsx
|
|
7
8
|
function useAppBar(_props) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
}),
|
|
31
|
-
[stateProps, centeredTitlePaddingX]
|
|
32
|
-
);
|
|
9
|
+
const { stateProps } = useAppScreenContext();
|
|
10
|
+
const [root, rootRef] = useState(null);
|
|
11
|
+
const [left, leftRef] = useState(null);
|
|
12
|
+
const [right, rightRef] = useState(null);
|
|
13
|
+
const leftOffset = useElementOffset(left);
|
|
14
|
+
const rightOffset = useElementOffset(right);
|
|
15
|
+
const centeredTitlePaddingX = root ? `${Math.max(leftOffset?.fromLeft ?? 0, rightOffset?.fromRight ?? 0)}px` : "initial";
|
|
16
|
+
return useMemo(() => ({
|
|
17
|
+
refs: {
|
|
18
|
+
root: rootRef,
|
|
19
|
+
left: leftRef,
|
|
20
|
+
right: rightRef
|
|
21
|
+
},
|
|
22
|
+
stateProps,
|
|
23
|
+
rootProps: elementProps({
|
|
24
|
+
"data-part": appBarAnatomy.root,
|
|
25
|
+
...stateProps,
|
|
26
|
+
style: { "--centered-title-padding-x": centeredTitlePaddingX }
|
|
27
|
+
})
|
|
28
|
+
}), [stateProps, centeredTitlePaddingX]);
|
|
33
29
|
}
|
|
34
|
-
|
|
30
|
+
//#endregion
|
|
35
31
|
export { useAppBar };
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
strict = true
|
|
12
|
-
} = {}) {
|
|
13
|
-
const context = React.useContext(AppBarContext);
|
|
14
|
-
if (!context && strict) {
|
|
15
|
-
throw new Error("useAppBarContext must be used within a AppBar");
|
|
16
|
-
}
|
|
17
|
-
return context;
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
//#region src/primitive/AppBar/useAppBarContext.ts
|
|
5
|
+
var AppBarContext = (0, react.createContext)(null);
|
|
6
|
+
var AppBarProvider = AppBarContext.Provider;
|
|
7
|
+
function useAppBarContext({ strict = true } = {}) {
|
|
8
|
+
const context = (0, react.useContext)(AppBarContext);
|
|
9
|
+
if (!context && strict) throw new Error("useAppBarContext must be used within a AppBar");
|
|
10
|
+
return context;
|
|
18
11
|
}
|
|
19
|
-
|
|
12
|
+
//#endregion
|
|
20
13
|
exports.AppBarProvider = AppBarProvider;
|
|
21
14
|
exports.useAppBarContext = useAppBarContext;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { createContext, useContext } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function useAppBarContext({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!context && strict) {
|
|
11
|
-
throw new Error("useAppBarContext must be used within a AppBar");
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
//#region src/primitive/AppBar/useAppBarContext.ts
|
|
4
|
+
var AppBarContext = createContext(null);
|
|
5
|
+
var AppBarProvider = AppBarContext.Provider;
|
|
6
|
+
function useAppBarContext({ strict = true } = {}) {
|
|
7
|
+
const context = useContext(AppBarContext);
|
|
8
|
+
if (!context && strict) throw new Error("useAppBarContext must be used within a AppBar");
|
|
9
|
+
return context;
|
|
14
10
|
}
|
|
15
|
-
|
|
11
|
+
//#endregion
|
|
16
12
|
export { AppBarProvider, useAppBarContext };
|
|
@@ -1,63 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
) });
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_useAppScreen = require("./useAppScreen.cjs");
|
|
4
|
+
const require_useAppScreenContext = require("./useAppScreenContext.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 _stackflow_react_ui_core = require("@stackflow/react-ui-core");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
//#region src/primitive/AppScreen/AppScreen.tsx
|
|
12
|
+
var AppScreenRoot = (0, react.forwardRef)((props, ref) => {
|
|
13
|
+
const { swipeBackDisplacementRatioThreshold, swipeBackVelocityThreshold, onSwipeBackEnd, onSwipeBackMove, onSwipeBackStart, ...otherProps } = props;
|
|
14
|
+
const innerRef = (0, react.useRef)(null);
|
|
15
|
+
const api = require_useAppScreen.useAppScreen({
|
|
16
|
+
swipeBackDisplacementRatioThreshold,
|
|
17
|
+
swipeBackVelocityThreshold,
|
|
18
|
+
onSwipeBackEnd,
|
|
19
|
+
onSwipeBackMove,
|
|
20
|
+
onSwipeBackStart
|
|
21
|
+
});
|
|
22
|
+
(0, _stackflow_react_ui_core.usePreventTouchDuringTransition)({ ref: innerRef });
|
|
23
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_useAppScreenContext.AppScreenProvider, {
|
|
24
|
+
value: api,
|
|
25
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
26
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(innerRef, ref),
|
|
27
|
+
"data-stackflow-component-name": "AppScreen",
|
|
28
|
+
...(0, _seed_design_dom_utils.mergeProps)(api.activityProps, otherProps)
|
|
29
|
+
})
|
|
30
|
+
});
|
|
43
31
|
});
|
|
44
32
|
AppScreenRoot.displayName = "AppScreenRoot";
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
var AppScreenDim = (0, react.forwardRef)((props, ref) => {
|
|
34
|
+
const { dimProps } = require_useAppScreenContext.useAppScreenContext();
|
|
35
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
36
|
+
ref,
|
|
37
|
+
...(0, _seed_design_dom_utils.mergeProps)(dimProps, props)
|
|
38
|
+
});
|
|
48
39
|
});
|
|
49
40
|
AppScreenDim.displayName = "AppScreenDim";
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
var AppScreenEdge = (0, react.forwardRef)((props, ref) => {
|
|
42
|
+
const { edgeProps } = require_useAppScreenContext.useAppScreenContext();
|
|
43
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
44
|
+
ref,
|
|
45
|
+
...(0, _seed_design_dom_utils.mergeProps)(edgeProps, props)
|
|
46
|
+
});
|
|
53
47
|
});
|
|
54
48
|
AppScreenEdge.displayName = "AppScreenEdge";
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
var AppScreenLayer = (0, react.forwardRef)((props, ref) => {
|
|
50
|
+
const { layerProps } = require_useAppScreenContext.useAppScreenContext();
|
|
51
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_seed_design_react_primitive.Primitive.div, {
|
|
52
|
+
ref,
|
|
53
|
+
...(0, _seed_design_dom_utils.mergeProps)(layerProps, props)
|
|
54
|
+
});
|
|
58
55
|
});
|
|
59
56
|
AppScreenLayer.displayName = "AppScreenLayer";
|
|
60
|
-
|
|
57
|
+
//#endregion
|
|
61
58
|
exports.AppScreenDim = AppScreenDim;
|
|
62
59
|
exports.AppScreenEdge = AppScreenEdge;
|
|
63
60
|
exports.AppScreenLayer = AppScreenLayer;
|