@seed-design/stackflow 1.1.20 → 1.1.22
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 +5 -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/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,77 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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 };
|
package/lib/utils/styled.cjs
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
10
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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;
|
package/lib/utils/styled.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import { vars } from
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { vars } from "@seed-design/css/vars";
|
|
3
|
+
//#region src/utils/styled.ts
|
|
4
4
|
function handleColor(color) {
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"clsx": "^2.1.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@seed-design/css": "1.2.
|
|
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": "^
|
|
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": "^
|
|
48
|
+
"vite": "^8.0.0",
|
|
49
49
|
"vite-plugin-dts": "^4.5.3"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@seed-design/css": ">=1.1.
|
|
52
|
+
"@seed-design/css": ">=1.1.25 <1.2.0 || >=1.2.11",
|
|
53
53
|
"@stackflow/core": ">=1.1.0",
|
|
54
54
|
"@stackflow/react": ">=1.4.1",
|
|
55
55
|
"react": ">=18.0.0",
|
|
@@ -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 },
|
|
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>
|
|
@@ -136,6 +141,7 @@ export const AppBarSlot = forwardRef<HTMLElement, AppBarSlotProps>(
|
|
|
136
141
|
<Slot
|
|
137
142
|
ref={ref}
|
|
138
143
|
className={clsx(classNames.custom, className)}
|
|
144
|
+
data-part={appBarAnatomy.custom}
|
|
139
145
|
{...mergeProps(stateProps, otherProps)}
|
|
140
146
|
>
|
|
141
147
|
{children}
|
|
@@ -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
|
|
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":
|
|
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":
|
|
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":
|
|
52
|
+
"data-part": appScreenAnatomy.dim,
|
|
52
53
|
...stateProps,
|
|
53
54
|
}),
|
|
54
55
|
layerProps: elementProps({
|
|
55
|
-
"data-part":
|
|
56
|
+
"data-part": appScreenAnatomy.layer,
|
|
56
57
|
...stateProps,
|
|
57
58
|
...layerProps,
|
|
58
59
|
}),
|
|
59
60
|
edgeProps: elementProps({
|
|
60
|
-
"data-part":
|
|
61
|
+
"data-part": appScreenAnatomy.edge,
|
|
61
62
|
"aria-hidden": true,
|
|
62
63
|
tabIndex: -1,
|
|
63
64
|
...edgeProps,
|