@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.
Files changed (93) hide show
  1. package/lib/_virtual/_rolldown/runtime.cjs +34 -0
  2. package/lib/_virtual/_rolldown/runtime.js +14 -0
  3. package/lib/components/AppBar/AppBar.cjs +86 -102
  4. package/lib/components/AppBar/AppBar.js +84 -98
  5. package/lib/components/AppBar/AppBar.namespace.cjs +20 -16
  6. package/lib/components/AppBar/AppBar.namespace.js +15 -1
  7. package/lib/components/AppBar/index.cjs +17 -18
  8. package/lib/components/AppBar/index.js +3 -3
  9. package/lib/components/AppScreen/AppScreen.cjs +46 -61
  10. package/lib/components/AppScreen/AppScreen.js +45 -57
  11. package/lib/components/AppScreen/AppScreen.namespace.cjs +17 -13
  12. package/lib/components/AppScreen/AppScreen.namespace.js +12 -1
  13. package/lib/components/AppScreen/index.cjs +14 -15
  14. package/lib/components/AppScreen/index.js +3 -3
  15. package/lib/components/index.cjs +30 -26
  16. package/lib/components/index.js +5 -6
  17. package/lib/hooks/index.cjs +3 -9
  18. package/lib/hooks/index.js +2 -1
  19. package/lib/hooks/useActivityZIndexBase.cjs +12 -11
  20. package/lib/hooks/useActivityZIndexBase.js +11 -7
  21. package/lib/index.cjs +41 -32
  22. package/lib/index.js +8 -10
  23. package/lib/plugin.cjs +16 -16
  24. package/lib/plugin.js +14 -12
  25. package/lib/primitive/AppBar/AppBar.cjs +41 -33
  26. package/lib/primitive/AppBar/AppBar.js +40 -29
  27. package/lib/primitive/AppBar/AppBar.namespace.cjs +16 -12
  28. package/lib/primitive/AppBar/AppBar.namespace.js +11 -1
  29. package/lib/primitive/AppBar/anatomy.cjs +18 -0
  30. package/lib/primitive/AppBar/anatomy.d.ts +15 -0
  31. package/lib/primitive/AppBar/anatomy.js +18 -0
  32. package/lib/primitive/AppBar/index.cjs +13 -14
  33. package/lib/primitive/AppBar/index.js +3 -3
  34. package/lib/primitive/AppBar/useAppBar.cjs +29 -36
  35. package/lib/primitive/AppBar/useAppBar.js +28 -32
  36. package/lib/primitive/AppBar/useAppBarContext.cjs +11 -18
  37. package/lib/primitive/AppBar/useAppBarContext.js +10 -14
  38. package/lib/primitive/AppScreen/AppScreen.cjs +49 -52
  39. package/lib/primitive/AppScreen/AppScreen.js +48 -48
  40. package/lib/primitive/AppScreen/AppScreen.namespace.cjs +16 -12
  41. package/lib/primitive/AppScreen/AppScreen.namespace.js +11 -1
  42. package/lib/primitive/AppScreen/anatomy.cjs +17 -0
  43. package/lib/primitive/AppScreen/anatomy.d.ts +14 -0
  44. package/lib/primitive/AppScreen/anatomy.js +17 -0
  45. package/lib/primitive/AppScreen/index.cjs +15 -16
  46. package/lib/primitive/AppScreen/index.js +4 -4
  47. package/lib/primitive/AppScreen/useAppScreen.cjs +60 -63
  48. package/lib/primitive/AppScreen/useAppScreen.js +59 -59
  49. package/lib/primitive/AppScreen/useAppScreenContext.cjs +11 -18
  50. package/lib/primitive/AppScreen/useAppScreenContext.js +10 -14
  51. package/lib/primitive/GlobalInteraction/GlobalInteraction.cjs +21 -26
  52. package/lib/primitive/GlobalInteraction/GlobalInteraction.js +20 -22
  53. package/lib/primitive/GlobalInteraction/animation.cjs +303 -0
  54. package/lib/primitive/GlobalInteraction/animation.d.ts +16 -0
  55. package/lib/primitive/GlobalInteraction/animation.js +299 -0
  56. package/lib/primitive/GlobalInteraction/constants.cjs +9 -0
  57. package/lib/primitive/GlobalInteraction/constants.d.ts +19 -0
  58. package/lib/primitive/GlobalInteraction/constants.js +8 -0
  59. package/lib/primitive/GlobalInteraction/dom.cjs +147 -0
  60. package/lib/primitive/GlobalInteraction/dom.d.ts +44 -0
  61. package/lib/primitive/GlobalInteraction/dom.js +140 -0
  62. package/lib/primitive/GlobalInteraction/index.cjs +5 -11
  63. package/lib/primitive/GlobalInteraction/index.js +3 -2
  64. package/lib/primitive/GlobalInteraction/useGlobalInteraction.cjs +220 -133
  65. package/lib/primitive/GlobalInteraction/useGlobalInteraction.d.ts +10 -26
  66. package/lib/primitive/GlobalInteraction/useGlobalInteraction.js +219 -129
  67. package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.cjs +11 -18
  68. package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.js +10 -14
  69. package/lib/primitive/GlobalInteraction/useSwipeBack.cjs +71 -55
  70. package/lib/primitive/GlobalInteraction/useSwipeBack.d.ts +19 -2
  71. package/lib/primitive/GlobalInteraction/useSwipeBack.js +70 -51
  72. package/lib/primitive/index.cjs +55 -27
  73. package/lib/primitive/index.js +26 -9
  74. package/lib/primitive/private/useElementOffset.cjs +29 -51
  75. package/lib/primitive/private/useElementOffset.js +27 -28
  76. package/lib/primitive/private/useTopActivity.cjs +22 -31
  77. package/lib/primitive/private/useTopActivity.js +21 -27
  78. package/lib/utils/createStyleContext.cjs +91 -74
  79. package/lib/utils/createStyleContext.js +89 -70
  80. package/lib/utils/styled.cjs +13 -20
  81. package/lib/utils/styled.js +12 -16
  82. package/package.json +4 -4
  83. package/src/components/AppBar/AppBar.tsx +9 -3
  84. package/src/primitive/AppBar/AppBar.tsx +4 -1
  85. package/src/primitive/AppBar/anatomy.ts +16 -0
  86. package/src/primitive/AppBar/useAppBar.tsx +2 -1
  87. package/src/primitive/AppScreen/anatomy.ts +15 -0
  88. package/src/primitive/AppScreen/useAppScreen.tsx +5 -4
  89. package/src/primitive/GlobalInteraction/animation.ts +447 -0
  90. package/src/primitive/GlobalInteraction/constants.ts +24 -0
  91. package/src/primitive/GlobalInteraction/dom.ts +211 -0
  92. package/src/primitive/GlobalInteraction/useGlobalInteraction.ts +302 -129
  93. package/src/primitive/GlobalInteraction/useSwipeBack.ts +64 -26
@@ -1,43 +1,51 @@
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 React = require('react');
11
- const useAppBar = require('./useAppBar.cjs');
12
- const useAppBarContext = require('./useAppBarContext.cjs');
13
-
14
- const AppBarRoot = React.forwardRef((props, ref) => {
15
- const { ...otherProps } = props;
16
- const api = useAppBar.useAppBar();
17
- return /* @__PURE__ */ jsxRuntime.jsx(useAppBarContext.AppBarProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(
18
- reactPrimitive.Primitive.div,
19
- {
20
- ref: reactComposeRefs.composeRefs(api.refs.root, ref),
21
- ...domUtils.mergeProps(api.rootProps, otherProps)
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
- const AppBarLeft = React.forwardRef((props, ref) => {
27
- const { refs, stateProps } = useAppBarContext.useAppBarContext();
28
- return /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref: reactComposeRefs.composeRefs(refs.left, ref), ...domUtils.mergeProps(stateProps, props) });
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
- const AppBarRight = React.forwardRef((props, ref) => {
32
- const { refs, stateProps } = useAppBarContext.useAppBarContext();
33
- return /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref: reactComposeRefs.composeRefs(refs.right, ref), ...domUtils.mergeProps(stateProps, props) });
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
- const AppBarMain = React.forwardRef((props, ref) => {
37
- const { stateProps } = useAppBarContext.useAppBarContext();
38
- return /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref, ...domUtils.mergeProps(stateProps, props) });
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
- '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 { forwardRef } from 'react';
7
- import { useAppBar } from './useAppBar.js';
8
- import { useAppBarContext, AppBarProvider } from './useAppBarContext.js';
9
-
10
- const AppBarRoot = forwardRef((props, ref) => {
11
- const { ...otherProps } = props;
12
- const api = useAppBar();
13
- return /* @__PURE__ */ jsx(AppBarProvider, { value: api, children: /* @__PURE__ */ jsx(
14
- Primitive.div,
15
- {
16
- ref: composeRefs(api.refs.root, ref),
17
- ...mergeProps(api.rootProps, otherProps)
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
- const AppBarLeft = forwardRef((props, ref) => {
23
- const { refs, stateProps } = useAppBarContext();
24
- return /* @__PURE__ */ jsx(Primitive.div, { ref: composeRefs(refs.left, ref), ...mergeProps(stateProps, props) });
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
- const AppBarRight = forwardRef((props, ref) => {
28
- const { refs, stateProps } = useAppBarContext();
29
- return /* @__PURE__ */ jsx(Primitive.div, { ref: composeRefs(refs.right, ref), ...mergeProps(stateProps, props) });
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
- const AppBarMain = forwardRef((props, ref) => {
33
- const { stateProps } = useAppBarContext();
34
- return /* @__PURE__ */ jsx(Primitive.div, { ref, ...mergeProps(stateProps, props) });
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
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const AppBar = require('./AppBar.cjs');
6
-
7
-
8
-
9
- exports.Left = AppBar.AppBarLeft;
10
- exports.Main = AppBar.AppBarMain;
11
- exports.Right = AppBar.AppBarRight;
12
- exports.Root = AppBar.AppBarRoot;
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
- export { AppBarLeft as Left, AppBarMain as Main, AppBarRight as Right, AppBarRoot as Root } from './AppBar.js';
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
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const AppBar = require('./AppBar.cjs');
6
- const AppBar_namespace = require('./AppBar.namespace.cjs');
7
-
8
-
9
-
10
- exports.AppBarLeft = AppBar.AppBarLeft;
11
- exports.AppBarMain = AppBar.AppBarMain;
12
- exports.AppBarRight = AppBar.AppBarRight;
13
- exports.AppBarRoot = AppBar.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
- export { AppBarLeft, AppBarMain, AppBarRight, AppBarRoot } from './AppBar.js';
2
- import * as AppBar_namespace from './AppBar.namespace.js';
3
- export { AppBar_namespace as AppBar };
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
- '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 React = require('react');
8
- const useAppScreenContext = require('../AppScreen/useAppScreenContext.cjs');
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
- const { stateProps } = useAppScreenContext.useAppScreenContext();
13
- const [root, rootRef] = React.useState(null);
14
- const [left, leftRef] = React.useState(null);
15
- const [right, rightRef] = React.useState(null);
16
- const leftOffset = useElementOffset.useElementOffset(left);
17
- const rightOffset = useElementOffset.useElementOffset(right);
18
- const centeredTitlePaddingX = root ? `${Math.max(leftOffset?.fromLeft ?? 0, rightOffset?.fromRight ?? 0)}px` : "initial";
19
- return React.useMemo(
20
- () => ({
21
- refs: {
22
- root: rootRef,
23
- left: leftRef,
24
- right: rightRef
25
- },
26
- stateProps,
27
- rootProps: domUtils.elementProps({
28
- "data-part": "appBar",
29
- ...stateProps,
30
- style: {
31
- "--centered-title-padding-x": centeredTitlePaddingX
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
- 'use client';
2
- import { elementProps } from '@seed-design/dom-utils';
3
- import { useState, useMemo } from 'react';
4
- import { useAppScreenContext } from '../AppScreen/useAppScreenContext.js';
5
- import { useElementOffset } from '../private/useElementOffset.js';
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
- const { stateProps } = useAppScreenContext();
9
- const [root, rootRef] = useState(null);
10
- const [left, leftRef] = useState(null);
11
- const [right, rightRef] = useState(null);
12
- const leftOffset = useElementOffset(left);
13
- const rightOffset = useElementOffset(right);
14
- const centeredTitlePaddingX = root ? `${Math.max(leftOffset?.fromLeft ?? 0, rightOffset?.fromRight ?? 0)}px` : "initial";
15
- return useMemo(
16
- () => ({
17
- refs: {
18
- root: rootRef,
19
- left: leftRef,
20
- right: rightRef
21
- },
22
- stateProps,
23
- rootProps: elementProps({
24
- "data-part": "appBar",
25
- ...stateProps,
26
- style: {
27
- "--centered-title-padding-x": centeredTitlePaddingX
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
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const React = require('react');
7
-
8
- const AppBarContext = React.createContext(null);
9
- const AppBarProvider = AppBarContext.Provider;
10
- function useAppBarContext({
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
- 'use client';
2
- import { createContext, useContext } from 'react';
3
-
4
- const AppBarContext = createContext(null);
5
- const AppBarProvider = AppBarContext.Provider;
6
- function useAppBarContext({
7
- strict = true
8
- } = {}) {
9
- const context = useContext(AppBarContext);
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
- '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
- ) });
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
- const AppScreenDim = React.forwardRef((props, ref) => {
46
- const { dimProps } = useAppScreenContext.useAppScreenContext();
47
- return /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref, ...domUtils.mergeProps(dimProps, props) });
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
- const AppScreenEdge = React.forwardRef((props, ref) => {
51
- const { edgeProps } = useAppScreenContext.useAppScreenContext();
52
- return /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref, ...domUtils.mergeProps(edgeProps, props) });
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
- const AppScreenLayer = React.forwardRef((props, ref) => {
56
- const { layerProps } = useAppScreenContext.useAppScreenContext();
57
- return /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref, ...domUtils.mergeProps(layerProps, props) });
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;