@seed-design/stackflow 1.1.19 → 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 (98) 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 +88 -87
  4. package/lib/components/AppBar/AppBar.d.ts +3 -0
  5. package/lib/components/AppBar/AppBar.js +86 -84
  6. package/lib/components/AppBar/AppBar.namespace.cjs +20 -15
  7. package/lib/components/AppBar/AppBar.namespace.d.ts +2 -2
  8. package/lib/components/AppBar/AppBar.namespace.js +15 -1
  9. package/lib/components/AppBar/index.cjs +17 -17
  10. package/lib/components/AppBar/index.d.ts +2 -2
  11. package/lib/components/AppBar/index.js +3 -3
  12. package/lib/components/AppScreen/AppScreen.cjs +46 -61
  13. package/lib/components/AppScreen/AppScreen.js +45 -57
  14. package/lib/components/AppScreen/AppScreen.namespace.cjs +17 -13
  15. package/lib/components/AppScreen/AppScreen.namespace.js +12 -1
  16. package/lib/components/AppScreen/index.cjs +14 -15
  17. package/lib/components/AppScreen/index.js +3 -3
  18. package/lib/components/index.cjs +30 -25
  19. package/lib/components/index.js +5 -6
  20. package/lib/hooks/index.cjs +3 -9
  21. package/lib/hooks/index.js +2 -1
  22. package/lib/hooks/useActivityZIndexBase.cjs +12 -11
  23. package/lib/hooks/useActivityZIndexBase.js +11 -7
  24. package/lib/index.cjs +41 -31
  25. package/lib/index.js +8 -10
  26. package/lib/plugin.cjs +16 -16
  27. package/lib/plugin.js +14 -12
  28. package/lib/primitive/AppBar/AppBar.cjs +41 -33
  29. package/lib/primitive/AppBar/AppBar.js +40 -29
  30. package/lib/primitive/AppBar/AppBar.namespace.cjs +16 -12
  31. package/lib/primitive/AppBar/AppBar.namespace.js +11 -1
  32. package/lib/primitive/AppBar/anatomy.cjs +18 -0
  33. package/lib/primitive/AppBar/anatomy.d.ts +15 -0
  34. package/lib/primitive/AppBar/anatomy.js +18 -0
  35. package/lib/primitive/AppBar/index.cjs +13 -14
  36. package/lib/primitive/AppBar/index.js +3 -3
  37. package/lib/primitive/AppBar/useAppBar.cjs +29 -36
  38. package/lib/primitive/AppBar/useAppBar.js +28 -32
  39. package/lib/primitive/AppBar/useAppBarContext.cjs +11 -18
  40. package/lib/primitive/AppBar/useAppBarContext.js +10 -14
  41. package/lib/primitive/AppScreen/AppScreen.cjs +49 -52
  42. package/lib/primitive/AppScreen/AppScreen.js +48 -48
  43. package/lib/primitive/AppScreen/AppScreen.namespace.cjs +16 -12
  44. package/lib/primitive/AppScreen/AppScreen.namespace.js +11 -1
  45. package/lib/primitive/AppScreen/anatomy.cjs +17 -0
  46. package/lib/primitive/AppScreen/anatomy.d.ts +14 -0
  47. package/lib/primitive/AppScreen/anatomy.js +17 -0
  48. package/lib/primitive/AppScreen/index.cjs +15 -16
  49. package/lib/primitive/AppScreen/index.js +4 -4
  50. package/lib/primitive/AppScreen/useAppScreen.cjs +60 -63
  51. package/lib/primitive/AppScreen/useAppScreen.js +59 -59
  52. package/lib/primitive/AppScreen/useAppScreenContext.cjs +11 -18
  53. package/lib/primitive/AppScreen/useAppScreenContext.js +10 -14
  54. package/lib/primitive/GlobalInteraction/GlobalInteraction.cjs +21 -26
  55. package/lib/primitive/GlobalInteraction/GlobalInteraction.js +20 -22
  56. package/lib/primitive/GlobalInteraction/animation.cjs +303 -0
  57. package/lib/primitive/GlobalInteraction/animation.d.ts +16 -0
  58. package/lib/primitive/GlobalInteraction/animation.js +299 -0
  59. package/lib/primitive/GlobalInteraction/constants.cjs +9 -0
  60. package/lib/primitive/GlobalInteraction/constants.d.ts +19 -0
  61. package/lib/primitive/GlobalInteraction/constants.js +8 -0
  62. package/lib/primitive/GlobalInteraction/dom.cjs +147 -0
  63. package/lib/primitive/GlobalInteraction/dom.d.ts +44 -0
  64. package/lib/primitive/GlobalInteraction/dom.js +140 -0
  65. package/lib/primitive/GlobalInteraction/index.cjs +5 -11
  66. package/lib/primitive/GlobalInteraction/index.js +3 -2
  67. package/lib/primitive/GlobalInteraction/useGlobalInteraction.cjs +220 -133
  68. package/lib/primitive/GlobalInteraction/useGlobalInteraction.d.ts +10 -26
  69. package/lib/primitive/GlobalInteraction/useGlobalInteraction.js +219 -129
  70. package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.cjs +11 -18
  71. package/lib/primitive/GlobalInteraction/useGlobalInteractionContext.js +10 -14
  72. package/lib/primitive/GlobalInteraction/useSwipeBack.cjs +71 -55
  73. package/lib/primitive/GlobalInteraction/useSwipeBack.d.ts +19 -2
  74. package/lib/primitive/GlobalInteraction/useSwipeBack.js +70 -51
  75. package/lib/primitive/index.cjs +55 -27
  76. package/lib/primitive/index.js +26 -9
  77. package/lib/primitive/private/useElementOffset.cjs +29 -51
  78. package/lib/primitive/private/useElementOffset.js +27 -28
  79. package/lib/primitive/private/useTopActivity.cjs +22 -31
  80. package/lib/primitive/private/useTopActivity.js +21 -27
  81. package/lib/utils/createStyleContext.cjs +91 -74
  82. package/lib/utils/createStyleContext.js +89 -70
  83. package/lib/utils/styled.cjs +13 -20
  84. package/lib/utils/styled.js +12 -16
  85. package/package.json +4 -4
  86. package/src/components/AppBar/AppBar.namespace.ts +2 -0
  87. package/src/components/AppBar/AppBar.tsx +29 -3
  88. package/src/components/AppBar/index.ts +2 -0
  89. package/src/primitive/AppBar/AppBar.tsx +4 -1
  90. package/src/primitive/AppBar/anatomy.ts +16 -0
  91. package/src/primitive/AppBar/useAppBar.tsx +2 -1
  92. package/src/primitive/AppScreen/anatomy.ts +15 -0
  93. package/src/primitive/AppScreen/useAppScreen.tsx +5 -4
  94. package/src/primitive/GlobalInteraction/animation.ts +447 -0
  95. package/src/primitive/GlobalInteraction/constants.ts +24 -0
  96. package/src/primitive/GlobalInteraction/dom.ts +211 -0
  97. package/src/primitive/GlobalInteraction/useGlobalInteraction.ts +302 -129
  98. package/src/primitive/GlobalInteraction/useSwipeBack.ts +64 -26
@@ -1,77 +1,94 @@
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 clsx = require('clsx');
8
- const React = require('react');
9
-
1
+ "use client";
2
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
3
+ let clsx = require("clsx");
4
+ clsx = require_runtime.__toESM(clsx);
5
+ let react = require("react");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ //#region src/utils/createStyleContext.tsx
10
8
  function createStyleContext(recipe) {
11
- const ClassNamesContext = React.createContext(null);
12
- const PropsContext = React.createContext(null);
13
- const ClassNamesProvider = ({
14
- children,
15
- value
16
- }) => {
17
- return /* @__PURE__ */ jsxRuntime.jsx(ClassNamesContext.Provider, { value, children });
18
- };
19
- const PropsProvider = ({ children, value }) => {
20
- return /* @__PURE__ */ jsxRuntime.jsx(PropsContext.Provider, { value, children });
21
- };
22
- function useClassNames() {
23
- const context = React.useContext(ClassNamesContext);
24
- if (context === null) {
25
- throw new Error(
26
- "useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?"
27
- );
28
- }
29
- return context;
30
- }
31
- function useProps() {
32
- return React.useContext(PropsContext);
33
- }
34
- const withRootProvider = (Component, options) => {
35
- const { defaultProps } = options ?? {};
36
- const StyledComponent = (innerProps) => {
37
- const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
38
- const [variantProps, otherProps] = recipe.splitVariantProps(props);
39
- const classNames = recipe(variantProps);
40
- return /* @__PURE__ */ jsxRuntime.jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsxRuntime.jsx(Component, { ...otherProps }) });
41
- };
42
- StyledComponent.displayName = Component.displayName || Component.name;
43
- return StyledComponent;
44
- };
45
- const withProvider = (Component, slot, options) => {
46
- const { defaultProps } = options ?? {};
47
- const StyledComponent = React.forwardRef((innerProps, ref) => {
48
- const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
49
- const [variantProps, otherProps] = recipe.splitVariantProps(props);
50
- const classNames = recipe(variantProps);
51
- const className = classNames[slot];
52
- return /* @__PURE__ */ jsxRuntime.jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, ...otherProps, className: clsx(className, props.className) }) });
53
- });
54
- StyledComponent.displayName = Component.displayName || Component.name;
55
- return StyledComponent;
56
- };
57
- const withContext = (Component, slot) => {
58
- const StyledComponent = React.forwardRef((props, ref) => {
59
- const classNames = useClassNames();
60
- const className = classNames?.[slot];
61
- return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, ...props, className: clsx(className, props.className) });
62
- });
63
- StyledComponent.displayName = Component.displayName || Component.name;
64
- return StyledComponent;
65
- };
66
- return {
67
- ClassNamesProvider,
68
- PropsProvider,
69
- useClassNames,
70
- useProps,
71
- withRootProvider,
72
- withProvider,
73
- withContext
74
- };
9
+ const ClassNamesContext = (0, react.createContext)(null);
10
+ const PropsContext = (0, react.createContext)(null);
11
+ const ClassNamesProvider = ({ children, value }) => {
12
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClassNamesContext.Provider, {
13
+ value,
14
+ children
15
+ });
16
+ };
17
+ const PropsProvider = ({ children, value }) => {
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PropsContext.Provider, {
19
+ value,
20
+ children
21
+ });
22
+ };
23
+ function useClassNames() {
24
+ const context = (0, react.useContext)(ClassNamesContext);
25
+ if (context === null) throw new Error("useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?");
26
+ return context;
27
+ }
28
+ function useProps() {
29
+ return (0, react.useContext)(PropsContext);
30
+ }
31
+ const withRootProvider = (Component, options) => {
32
+ const { defaultProps } = options ?? {};
33
+ const StyledComponent = (innerProps) => {
34
+ const props = {
35
+ ...defaultProps ?? {},
36
+ ...useProps(),
37
+ ...innerProps
38
+ };
39
+ const [variantProps, otherProps] = recipe.splitVariantProps(props);
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClassNamesProvider, {
41
+ value: recipe(variantProps),
42
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { ...otherProps })
43
+ });
44
+ };
45
+ StyledComponent.displayName = Component.displayName || Component.name;
46
+ return StyledComponent;
47
+ };
48
+ const withProvider = (Component, slot, options) => {
49
+ const { defaultProps } = options ?? {};
50
+ const StyledComponent = (0, react.forwardRef)((innerProps, ref) => {
51
+ const props = {
52
+ ...defaultProps ?? {},
53
+ ...useProps(),
54
+ ...innerProps
55
+ };
56
+ const [variantProps, otherProps] = recipe.splitVariantProps(props);
57
+ const classNames = recipe(variantProps);
58
+ const className = classNames[slot];
59
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClassNamesProvider, {
60
+ value: classNames,
61
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
62
+ ref,
63
+ ...otherProps,
64
+ className: (0, clsx.default)(className, props.className)
65
+ })
66
+ });
67
+ });
68
+ StyledComponent.displayName = Component.displayName || Component.name;
69
+ return StyledComponent;
70
+ };
71
+ const withContext = (Component, slot) => {
72
+ const StyledComponent = (0, react.forwardRef)((props, ref) => {
73
+ const className = useClassNames()?.[slot];
74
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
75
+ ref,
76
+ ...props,
77
+ className: (0, clsx.default)(className, props.className)
78
+ });
79
+ });
80
+ StyledComponent.displayName = Component.displayName || Component.name;
81
+ return StyledComponent;
82
+ };
83
+ return {
84
+ ClassNamesProvider,
85
+ PropsProvider,
86
+ useClassNames,
87
+ useProps,
88
+ withRootProvider,
89
+ withProvider,
90
+ withContext
91
+ };
75
92
  }
76
-
93
+ //#endregion
77
94
  exports.createStyleContext = createStyleContext;
@@ -1,73 +1,92 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import clsx from 'clsx';
4
- import { createContext, forwardRef, useContext } from 'react';
5
-
1
+ "use client";
2
+ import clsx from "clsx";
3
+ import { createContext, forwardRef, useContext } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/utils/createStyleContext.tsx
6
6
  function createStyleContext(recipe) {
7
- const ClassNamesContext = createContext(null);
8
- const PropsContext = createContext(null);
9
- const ClassNamesProvider = ({
10
- children,
11
- value
12
- }) => {
13
- return /* @__PURE__ */ jsx(ClassNamesContext.Provider, { value, children });
14
- };
15
- const PropsProvider = ({ children, value }) => {
16
- return /* @__PURE__ */ jsx(PropsContext.Provider, { value, children });
17
- };
18
- function useClassNames() {
19
- const context = useContext(ClassNamesContext);
20
- if (context === null) {
21
- throw new Error(
22
- "useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?"
23
- );
24
- }
25
- return context;
26
- }
27
- function useProps() {
28
- return useContext(PropsContext);
29
- }
30
- const withRootProvider = (Component, options) => {
31
- const { defaultProps } = options ?? {};
32
- const StyledComponent = (innerProps) => {
33
- const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
34
- const [variantProps, otherProps] = recipe.splitVariantProps(props);
35
- const classNames = recipe(variantProps);
36
- return /* @__PURE__ */ jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsx(Component, { ...otherProps }) });
37
- };
38
- StyledComponent.displayName = Component.displayName || Component.name;
39
- return StyledComponent;
40
- };
41
- const withProvider = (Component, slot, options) => {
42
- const { defaultProps } = options ?? {};
43
- const StyledComponent = forwardRef((innerProps, ref) => {
44
- const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
45
- const [variantProps, otherProps] = recipe.splitVariantProps(props);
46
- const classNames = recipe(variantProps);
47
- const className = classNames[slot];
48
- return /* @__PURE__ */ jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsx(Component, { ref, ...otherProps, className: clsx(className, props.className) }) });
49
- });
50
- StyledComponent.displayName = Component.displayName || Component.name;
51
- return StyledComponent;
52
- };
53
- const withContext = (Component, slot) => {
54
- const StyledComponent = forwardRef((props, ref) => {
55
- const classNames = useClassNames();
56
- const className = classNames?.[slot];
57
- return /* @__PURE__ */ jsx(Component, { ref, ...props, className: clsx(className, props.className) });
58
- });
59
- StyledComponent.displayName = Component.displayName || Component.name;
60
- return StyledComponent;
61
- };
62
- return {
63
- ClassNamesProvider,
64
- PropsProvider,
65
- useClassNames,
66
- useProps,
67
- withRootProvider,
68
- withProvider,
69
- withContext
70
- };
7
+ const ClassNamesContext = createContext(null);
8
+ const PropsContext = createContext(null);
9
+ const ClassNamesProvider = ({ children, value }) => {
10
+ return /* @__PURE__ */ jsx(ClassNamesContext.Provider, {
11
+ value,
12
+ children
13
+ });
14
+ };
15
+ const PropsProvider = ({ children, value }) => {
16
+ return /* @__PURE__ */ jsx(PropsContext.Provider, {
17
+ value,
18
+ children
19
+ });
20
+ };
21
+ function useClassNames() {
22
+ const context = useContext(ClassNamesContext);
23
+ if (context === null) throw new Error("useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?");
24
+ return context;
25
+ }
26
+ function useProps() {
27
+ return useContext(PropsContext);
28
+ }
29
+ const withRootProvider = (Component, options) => {
30
+ const { defaultProps } = options ?? {};
31
+ const StyledComponent = (innerProps) => {
32
+ const props = {
33
+ ...defaultProps ?? {},
34
+ ...useProps(),
35
+ ...innerProps
36
+ };
37
+ const [variantProps, otherProps] = recipe.splitVariantProps(props);
38
+ return /* @__PURE__ */ jsx(ClassNamesProvider, {
39
+ value: recipe(variantProps),
40
+ children: /* @__PURE__ */ jsx(Component, { ...otherProps })
41
+ });
42
+ };
43
+ StyledComponent.displayName = Component.displayName || Component.name;
44
+ return StyledComponent;
45
+ };
46
+ const withProvider = (Component, slot, options) => {
47
+ const { defaultProps } = options ?? {};
48
+ const StyledComponent = forwardRef((innerProps, ref) => {
49
+ const props = {
50
+ ...defaultProps ?? {},
51
+ ...useProps(),
52
+ ...innerProps
53
+ };
54
+ const [variantProps, otherProps] = recipe.splitVariantProps(props);
55
+ const classNames = recipe(variantProps);
56
+ const className = classNames[slot];
57
+ return /* @__PURE__ */ jsx(ClassNamesProvider, {
58
+ value: classNames,
59
+ children: /* @__PURE__ */ jsx(Component, {
60
+ ref,
61
+ ...otherProps,
62
+ className: clsx(className, props.className)
63
+ })
64
+ });
65
+ });
66
+ StyledComponent.displayName = Component.displayName || Component.name;
67
+ return StyledComponent;
68
+ };
69
+ const withContext = (Component, slot) => {
70
+ const StyledComponent = forwardRef((props, ref) => {
71
+ const className = useClassNames()?.[slot];
72
+ return /* @__PURE__ */ jsx(Component, {
73
+ ref,
74
+ ...props,
75
+ className: clsx(className, props.className)
76
+ });
77
+ });
78
+ StyledComponent.displayName = Component.displayName || Component.name;
79
+ return StyledComponent;
80
+ };
81
+ return {
82
+ ClassNamesProvider,
83
+ PropsProvider,
84
+ useClassNames,
85
+ useProps,
86
+ withRootProvider,
87
+ withProvider,
88
+ withContext
89
+ };
71
90
  }
72
-
91
+ //#endregion
73
92
  export { createStyleContext };
@@ -1,25 +1,18 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const vars = require('@seed-design/css/vars');
7
-
1
+ "use client";
2
+ require("../_virtual/_rolldown/runtime.cjs");
3
+ let _seed_design_css_vars = require("@seed-design/css/vars");
4
+ //#region src/utils/styled.ts
8
5
  function handleColor(color) {
9
- if (!color) {
10
- return void 0;
11
- }
12
- const [type, value] = color.split(".");
13
- return vars.vars.$color[type]?.[value] ?? color;
6
+ if (!color) return;
7
+ const [type, value] = color.split(".");
8
+ return _seed_design_css_vars.vars.$color[type]?.[value] ?? color;
14
9
  }
15
10
  function useBoxBackgroundProps(props) {
16
- const { bg, background, ...restProps } = props;
17
- return {
18
- style: {
19
- "--seed-box-background": handleColor(background ?? bg)
20
- },
21
- restProps
22
- };
11
+ const { bg, background, ...restProps } = props;
12
+ return {
13
+ style: { "--seed-box-background": handleColor(background ?? bg) },
14
+ restProps
15
+ };
23
16
  }
24
-
17
+ //#endregion
25
18
  exports.useBoxBackgroundProps = useBoxBackgroundProps;
@@ -1,21 +1,17 @@
1
- 'use client';
2
- import { vars } from '@seed-design/css/vars';
3
-
1
+ "use client";
2
+ import { vars } from "@seed-design/css/vars";
3
+ //#region src/utils/styled.ts
4
4
  function handleColor(color) {
5
- if (!color) {
6
- return void 0;
7
- }
8
- const [type, value] = color.split(".");
9
- return vars.$color[type]?.[value] ?? color;
5
+ if (!color) return;
6
+ const [type, value] = color.split(".");
7
+ return vars.$color[type]?.[value] ?? color;
10
8
  }
11
9
  function useBoxBackgroundProps(props) {
12
- const { bg, background, ...restProps } = props;
13
- return {
14
- style: {
15
- "--seed-box-background": handleColor(background ?? bg)
16
- },
17
- restProps
18
- };
10
+ const { bg, background, ...restProps } = props;
11
+ return {
12
+ style: { "--seed-box-background": handleColor(background ?? bg) },
13
+ restProps
14
+ };
19
15
  }
20
-
16
+ //#endregion
21
17
  export { useBoxBackgroundProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-design/stackflow",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/daangn/seed-design.git",
@@ -36,16 +36,16 @@
36
36
  "clsx": "^2.1.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@seed-design/css": "1.2.6",
39
+ "@seed-design/css": "1.2.11",
40
40
  "@stackflow/core": "^1.2.0",
41
41
  "@stackflow/react": "^1.5.1",
42
42
  "@types/react": "^19.2.2",
43
43
  "@types/react-dom": "^19.2.1",
44
- "@vitejs/plugin-react": "^5.0.0",
44
+ "@vitejs/plugin-react": "^6.0.0",
45
45
  "globby": "^16.0.0",
46
46
  "react": "^19.1.0",
47
47
  "react-dom": "^19.1.0",
48
- "vite": "^7.0.0",
48
+ "vite": "^8.0.0",
49
49
  "vite-plugin-dts": "^4.5.3"
50
50
  },
51
51
  "peerDependencies": {
@@ -4,6 +4,7 @@ export {
4
4
  AppBarMain as Main,
5
5
  AppBarRight as Right,
6
6
  AppBarRoot as Root,
7
+ AppBarSlot as Slot,
7
8
  AppBarSubtitle as Subtitle,
8
9
  AppBarTitle as Title,
9
10
  } from "./AppBar";
@@ -14,6 +15,7 @@ export type {
14
15
  AppBarMainProps as MainProps,
15
16
  AppBarRightProps as RightProps,
16
17
  AppBarProps as RootProps,
18
+ AppBarSlotProps as SlotProps,
17
19
  AppBarSubtitleProps as SubtitleProps,
18
20
  AppBarTitleProps as TitleProps,
19
21
  } from "./AppBar";
@@ -6,6 +6,7 @@ import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
6
6
  import clsx from "clsx";
7
7
  import { forwardRef } from "react";
8
8
  import { AppBar as AppBarPrimitive } from "../../primitive";
9
+ import { appBarAnatomy } from "../../primitive/AppBar/anatomy";
9
10
  import { useAppBarContext } from "../../primitive/AppBar/useAppBarContext";
10
11
  import { createStyleContext } from "../../utils/createStyleContext";
11
12
  import { useTopActivity } from "../../primitive/private/useTopActivity";
@@ -49,14 +50,18 @@ export const AppBarRoot = forwardRef<HTMLDivElement, AppBarProps>((props, ref) =
49
50
  };
50
51
 
51
52
  const classNames = appBar(resolvedVariantProps);
53
+ const { children, ...restProps } = otherProps;
52
54
 
53
55
  return (
54
56
  <ClassNamesProvider value={classNames}>
55
57
  <MainPropsProvider value={resolvedVariantProps}>
56
58
  <AppBarPrimitive.Root
57
59
  ref={ref}
58
- {...mergeProps({ className: classNames.root, style: boxStyle }, otherProps)}
59
- />
60
+ {...mergeProps({ className: classNames.root, style: boxStyle }, restProps)}
61
+ >
62
+ <div aria-hidden data-part={appBarAnatomy.background} className={classNames.background} />
63
+ {children}
64
+ </AppBarPrimitive.Root>
60
65
  </MainPropsProvider>
61
66
  </ClassNamesProvider>
62
67
  );
@@ -116,7 +121,7 @@ export const AppBarIconButton = forwardRef<HTMLButtonElement, AppBarIconButtonPr
116
121
  className={clsx(classNames.iconButton, className)}
117
122
  {...mergeProps(stateProps, otherProps)}
118
123
  >
119
- <Slot className={classNames.icon} {...stateProps}>
124
+ <Slot className={classNames.icon} data-part={appBarAnatomy.icon} {...stateProps}>
120
125
  {children}
121
126
  </Slot>
122
127
  </Primitive.button>
@@ -124,3 +129,24 @@ export const AppBarIconButton = forwardRef<HTMLButtonElement, AppBarIconButtonPr
124
129
  },
125
130
  );
126
131
  AppBarIconButton.displayName = "IconButton";
132
+
133
+ export interface AppBarSlotProps extends PrimitiveProps, React.HTMLAttributes<HTMLElement> {}
134
+
135
+ export const AppBarSlot = forwardRef<HTMLElement, AppBarSlotProps>(
136
+ ({ children, className, ...otherProps }, ref) => {
137
+ const { stateProps } = useAppBarContext();
138
+ const classNames = useClassNames();
139
+
140
+ return (
141
+ <Slot
142
+ ref={ref}
143
+ className={clsx(classNames.custom, className)}
144
+ data-part={appBarAnatomy.custom}
145
+ {...mergeProps(stateProps, otherProps)}
146
+ >
147
+ {children}
148
+ </Slot>
149
+ );
150
+ },
151
+ );
152
+ AppBarSlot.displayName = "AppBarSlot";
@@ -4,6 +4,7 @@ export {
4
4
  AppBarMain,
5
5
  AppBarRight,
6
6
  AppBarRoot,
7
+ AppBarSlot,
7
8
  AppBarSubtitle,
8
9
  AppBarTitle,
9
10
  } from "./AppBar";
@@ -14,6 +15,7 @@ export type {
14
15
  AppBarMainProps,
15
16
  AppBarProps,
16
17
  AppBarRightProps,
18
+ AppBarSlotProps,
17
19
  AppBarSubtitleProps,
18
20
  AppBarTitleProps,
19
21
  } from "./AppBar";
@@ -2,6 +2,7 @@ import { composeRefs } from "@radix-ui/react-compose-refs";
2
2
  import { mergeProps } from "@seed-design/dom-utils";
3
3
  import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
4
4
  import { forwardRef } from "react";
5
+ import { appBarAnatomy } from "./anatomy";
5
6
  import { useAppBar, type UseAppBarProps } from "./useAppBar";
6
7
  import { AppBarProvider, useAppBarContext } from "./useAppBarContext";
7
8
 
@@ -48,5 +49,7 @@ export interface AppBarMainProps extends PrimitiveProps, React.HTMLAttributes<HT
48
49
  export const AppBarMain = forwardRef<HTMLDivElement, AppBarMainProps>((props, ref) => {
49
50
  const { stateProps } = useAppBarContext();
50
51
 
51
- return <Primitive.div ref={ref} {...mergeProps(stateProps, props)} />;
52
+ return (
53
+ <Primitive.div ref={ref} data-part={appBarAnatomy.main} {...mergeProps(stateProps, props)} />
54
+ );
52
55
  });
@@ -0,0 +1,16 @@
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 const appBarAnatomy = {
9
+ root: "appBar",
10
+ background: "appBarBackground",
11
+ main: "appBarMain",
12
+ icon: "appBarIcon",
13
+ custom: "appBarCustom",
14
+ } as const;
15
+
16
+ export type AppBarPart = (typeof appBarAnatomy)[keyof typeof appBarAnatomy];
@@ -2,6 +2,7 @@ import { elementProps } from "@seed-design/dom-utils";
2
2
  import { useMemo, useState } from "react";
3
3
  import { useAppScreenContext } from "../AppScreen";
4
4
  import { useElementOffset } from "../private/useElementOffset";
5
+ import { appBarAnatomy } from "./anatomy";
5
6
 
6
7
  // biome-ignore lint/suspicious/noEmptyInterface: intentionally empty for future extension
7
8
  export interface UseAppBarProps {}
@@ -30,7 +31,7 @@ export function useAppBar(_props: UseAppBarProps) {
30
31
  },
31
32
  stateProps,
32
33
  rootProps: elementProps({
33
- "data-part": "appBar",
34
+ "data-part": appBarAnatomy.root,
34
35
  ...stateProps,
35
36
  style: {
36
37
  "--centered-title-padding-x": centeredTitlePaddingX,
@@ -0,0 +1,15 @@
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 const appScreenAnatomy = {
9
+ activity: "activity",
10
+ dim: "dim",
11
+ layer: "layer",
12
+ edge: "edge",
13
+ } as const;
14
+
15
+ export type AppScreenPart = (typeof appScreenAnatomy)[keyof typeof appScreenAnatomy];
@@ -3,6 +3,7 @@ import { useNullableActivity } from "@stackflow/react-ui-core";
3
3
  import { useMemo } from "react";
4
4
  import { type UseSwipeBackProps, useSwipeBack } from "../GlobalInteraction/useSwipeBack";
5
5
  import { useActivityZIndexBase } from "../../hooks";
6
+ import { appScreenAnatomy } from "./anatomy";
6
7
 
7
8
  export interface UseAppScreenProps extends UseSwipeBackProps {}
8
9
 
@@ -38,7 +39,7 @@ export function useAppScreen(props: UseAppScreenProps) {
38
39
  activity,
39
40
  stateProps,
40
41
  activityProps: elementProps({
41
- "data-part": "activity",
42
+ "data-part": appScreenAnatomy.activity,
42
43
  "data-activity-type": "full-screen",
43
44
  ...activityProps,
44
45
  ...stateProps,
@@ -48,16 +49,16 @@ export function useAppScreen(props: UseAppScreenProps) {
48
49
  suppressHydrationWarning: true,
49
50
  }),
50
51
  dimProps: elementProps({
51
- "data-part": "dim",
52
+ "data-part": appScreenAnatomy.dim,
52
53
  ...stateProps,
53
54
  }),
54
55
  layerProps: elementProps({
55
- "data-part": "layer",
56
+ "data-part": appScreenAnatomy.layer,
56
57
  ...stateProps,
57
58
  ...layerProps,
58
59
  }),
59
60
  edgeProps: elementProps({
60
- "data-part": "edge",
61
+ "data-part": appScreenAnatomy.edge,
61
62
  "aria-hidden": true,
62
63
  tabIndex: -1,
63
64
  ...edgeProps,