@seed-design/stackflow 1.1.0 → 1.1.5
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/hooks/index.cjs +9 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/useActivityZIndexBase.cjs +14 -0
- package/lib/hooks/useActivityZIndexBase.d.ts +18 -0
- package/lib/hooks/useActivityZIndexBase.js +10 -0
- package/lib/index.cjs +2 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/primitive/AppScreen/useAppScreen.cjs +2 -1
- package/lib/primitive/AppScreen/useAppScreen.js +3 -2
- package/package.json +4 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useActivityZIndexBase.ts +26 -0
- package/src/index.ts +2 -0
- package/src/primitive/AppScreen/useAppScreen.tsx +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useActivityZIndexBase } from './useActivityZIndexBase';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useActivityZIndexBase } from './useActivityZIndexBase.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const reactUiCore = require('@stackflow/react-ui-core');
|
|
7
|
+
|
|
8
|
+
const Z_INDEX_SPACING = 5;
|
|
9
|
+
function useActivityZIndexBase(params) {
|
|
10
|
+
const activity = reactUiCore.useNullableActivity();
|
|
11
|
+
return ((activity?.zIndex ?? 0) + (params?.activityOffset ?? 0)) * Z_INDEX_SPACING;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.useActivityZIndexBase = useActivityZIndexBase;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface UseActivityZIndexBaseParams {
|
|
2
|
+
/**
|
|
3
|
+
* Offset from the current activity's position in the stack.
|
|
4
|
+
*
|
|
5
|
+
* - `0` (default): Current activity's z-index base
|
|
6
|
+
* - `1`: Next activity's z-index base (common for overlay components)
|
|
7
|
+
*
|
|
8
|
+
* @default 0
|
|
9
|
+
*/
|
|
10
|
+
activityOffset?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Returns the base z-index which is calculated by multiplying the activity's index by 5.
|
|
14
|
+
* This value is used to give proper z-index values to elements of AppScreen (e.g. app-bar, dim, edge, layer). See the stylesheet of AppScreen for more details.
|
|
15
|
+
* This value can be provided to layerIndex of various overlay components (e.g. AlertDialog, BottomSheet, MenuSheet) to ensure correct stacking order.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useActivityZIndexBase(params?: UseActivityZIndexBaseParams): number;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useNullableActivity } from '@stackflow/react-ui-core';
|
|
3
|
+
|
|
4
|
+
const Z_INDEX_SPACING = 5;
|
|
5
|
+
function useActivityZIndexBase(params) {
|
|
6
|
+
const activity = useNullableActivity();
|
|
7
|
+
return ((activity?.zIndex ?? 0) + (params?.activityOffset ?? 0)) * Z_INDEX_SPACING;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { useActivityZIndexBase };
|
package/lib/index.cjs
CHANGED
|
@@ -7,6 +7,7 @@ const AppBar = require('./components/AppBar/AppBar.cjs');
|
|
|
7
7
|
const AppBar_namespace = require('./components/AppBar/AppBar.namespace.cjs');
|
|
8
8
|
const AppScreen = require('./components/AppScreen/AppScreen.cjs');
|
|
9
9
|
const AppScreen_namespace = require('./components/AppScreen/AppScreen.namespace.cjs');
|
|
10
|
+
const useActivityZIndexBase = require('./hooks/useActivityZIndexBase.cjs');
|
|
10
11
|
const index = require('./primitive/index.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
@@ -26,4 +27,5 @@ exports.AppScreenLayer = AppScreen.AppScreenLayer;
|
|
|
26
27
|
exports.AppScreenPropsProvider = AppScreen.AppScreenPropsProvider;
|
|
27
28
|
exports.AppScreenRoot = AppScreen.AppScreenRoot;
|
|
28
29
|
exports.AppScreen = AppScreen_namespace;
|
|
30
|
+
exports.useActivityZIndexBase = useActivityZIndexBase.useActivityZIndexBase;
|
|
29
31
|
exports.Primitive = index;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -5,5 +5,6 @@ export { AppBar_namespace as AppBar };
|
|
|
5
5
|
export { AppScreenDim, AppScreenEdge, AppScreenLayer, AppScreenPropsProvider, AppScreenRoot } from './components/AppScreen/AppScreen.js';
|
|
6
6
|
import * as AppScreen_namespace from './components/AppScreen/AppScreen.namespace.js';
|
|
7
7
|
export { AppScreen_namespace as AppScreen };
|
|
8
|
+
export { useActivityZIndexBase } from './hooks/useActivityZIndexBase.js';
|
|
8
9
|
import * as index from './primitive/index.js';
|
|
9
10
|
export { index as Primitive };
|
|
@@ -7,12 +7,13 @@ const domUtils = require('@seed-design/dom-utils');
|
|
|
7
7
|
const reactUiCore = require('@stackflow/react-ui-core');
|
|
8
8
|
const React = require('react');
|
|
9
9
|
const useSwipeBack = require('../GlobalInteraction/useSwipeBack.cjs');
|
|
10
|
+
const useActivityZIndexBase = require('../../hooks/useActivityZIndexBase.cjs');
|
|
10
11
|
|
|
11
12
|
function useAppScreen(props) {
|
|
12
13
|
const activity = reactUiCore.useNullableActivity();
|
|
13
14
|
const transitionState = activity?.transitionState ?? "enter-done";
|
|
14
15
|
const { activityProps, layerProps, edgeProps } = useSwipeBack.useSwipeBack(props);
|
|
15
|
-
const zIndexBase =
|
|
16
|
+
const zIndexBase = useActivityZIndexBase.useActivityZIndexBase();
|
|
16
17
|
const zIndexStyle = React.useMemo(
|
|
17
18
|
() => ({
|
|
18
19
|
"--z-index-base": zIndexBase.toString()
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { dataAttr, elementProps } from '@seed-design/dom-utils';
|
|
3
|
-
import { useNullableActivity
|
|
3
|
+
import { useNullableActivity } from '@stackflow/react-ui-core';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { useSwipeBack } from '../GlobalInteraction/useSwipeBack.js';
|
|
6
|
+
import { useActivityZIndexBase } from '../../hooks/useActivityZIndexBase.js';
|
|
6
7
|
|
|
7
8
|
function useAppScreen(props) {
|
|
8
9
|
const activity = useNullableActivity();
|
|
9
10
|
const transitionState = activity?.transitionState ?? "enter-done";
|
|
10
11
|
const { activityProps, layerProps, edgeProps } = useSwipeBack(props);
|
|
11
|
-
const zIndexBase =
|
|
12
|
+
const zIndexBase = useActivityZIndexBase();
|
|
12
13
|
const zIndexStyle = useMemo(
|
|
13
14
|
() => ({
|
|
14
15
|
"--z-index-base": zIndexBase.toString()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/stackflow",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
"clsx": "^2.1.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@seed-design/css": "1.1.
|
|
38
|
+
"@seed-design/css": "1.1.5",
|
|
39
39
|
"@stackflow/core": "^1.2.0",
|
|
40
40
|
"@stackflow/react": "^1.5.1",
|
|
41
41
|
"@stackflow/react-ui-core": "^1.3.2",
|
|
42
42
|
"@types/react": "^19.2.2",
|
|
43
43
|
"@types/react-dom": "^19.2.1",
|
|
44
44
|
"@vitejs/plugin-react": "^5.0.0",
|
|
45
|
-
"globby": "^
|
|
45
|
+
"globby": "^16.0.0",
|
|
46
46
|
"react": "^19.1.0",
|
|
47
47
|
"react-dom": "^19.1.0",
|
|
48
48
|
"vite": "^7.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.5",
|
|
53
53
|
"@stackflow/core": ">=1.1.0",
|
|
54
54
|
"@stackflow/react": ">=1.4.1",
|
|
55
55
|
"@stackflow/react-ui-core": ">=1.3.2",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useActivityZIndexBase } from "./useActivityZIndexBase";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useNullableActivity } from "@stackflow/react-ui-core";
|
|
2
|
+
|
|
3
|
+
interface UseActivityZIndexBaseParams {
|
|
4
|
+
/**
|
|
5
|
+
* Offset from the current activity's position in the stack.
|
|
6
|
+
*
|
|
7
|
+
* - `0` (default): Current activity's z-index base
|
|
8
|
+
* - `1`: Next activity's z-index base (common for overlay components)
|
|
9
|
+
*
|
|
10
|
+
* @default 0
|
|
11
|
+
*/
|
|
12
|
+
activityOffset?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Z_INDEX_SPACING = 5;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns the base z-index which is calculated by multiplying the activity's index by 5.
|
|
19
|
+
* This value is used to give proper z-index values to elements of AppScreen (e.g. app-bar, dim, edge, layer). See the stylesheet of AppScreen for more details.
|
|
20
|
+
* This value can be provided to layerIndex of various overlay components (e.g. AlertDialog, BottomSheet, MenuSheet) to ensure correct stacking order.
|
|
21
|
+
*/
|
|
22
|
+
export function useActivityZIndexBase(params?: UseActivityZIndexBaseParams): number {
|
|
23
|
+
const activity = useNullableActivity();
|
|
24
|
+
|
|
25
|
+
return ((activity?.zIndex ?? 0) + (params?.activityOffset ?? 0)) * Z_INDEX_SPACING;
|
|
26
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { dataAttr, elementProps } from "@seed-design/dom-utils";
|
|
2
|
-
import { useNullableActivity
|
|
2
|
+
import { useNullableActivity } from "@stackflow/react-ui-core";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { type UseSwipeBackProps, useSwipeBack } from "../GlobalInteraction/useSwipeBack";
|
|
5
|
+
import { useActivityZIndexBase } from "../../hooks";
|
|
5
6
|
|
|
6
7
|
export interface UseAppScreenProps extends UseSwipeBackProps {}
|
|
7
8
|
|
|
@@ -14,7 +15,7 @@ export function useAppScreen(props: UseAppScreenProps) {
|
|
|
14
15
|
|
|
15
16
|
const { activityProps, layerProps, edgeProps } = useSwipeBack(props);
|
|
16
17
|
|
|
17
|
-
const zIndexBase =
|
|
18
|
+
const zIndexBase = useActivityZIndexBase();
|
|
18
19
|
const zIndexStyle = useMemo(
|
|
19
20
|
() =>
|
|
20
21
|
({
|