@lanaqi/rsr 0.0.2 → 0.0.3

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.
@@ -1,14 +1,9 @@
1
- import { type ComponentType, type PropsWithChildren } from 'react';
2
- import { type SecurityBundler } from './provider';
3
1
  /**
4
- * 安全阻断器组件
5
- * @param children 子组件
6
- * @constructor
2
+ * 安全阻断器组件属性
7
3
  */
8
- export declare function SecurityBlocker({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
4
+ export interface SecurityBlockerProps extends React.PropsWithChildren {
5
+ }
9
6
  /**
10
- * 安全阻断器包装
11
- * @param Component 组件
12
- * @param bundler 打包器
7
+ * 安全阻断器组件
13
8
  */
14
- export declare const withSecurityBlocker: (Component: ComponentType, bundler: SecurityBundler) => () => import("react/jsx-runtime").JSX.Element;
9
+ export declare function SecurityBlocker({ children }: SecurityBlockerProps): import("react").ReactNode;
@@ -0,0 +1,9 @@
1
+ import type { AccessProvider } from '../access';
2
+ /**
3
+ * 安全上下文
4
+ */
5
+ export declare const SecurityContext: import("react").Context<AccessProvider | null>;
6
+ /**
7
+ * 安全上下文钩子
8
+ */
9
+ export declare const useSecurityContext: () => AccessProvider;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * 上下文
3
+ */
4
+ export * from './context';
1
5
  /**
2
6
  * 提供者
3
7
  */
@@ -1,4 +1,3 @@
1
- import { type PropsWithChildren } from 'react';
2
1
  import type { AccessProvider } from '../access';
3
2
  import { AccessGuarderBuilder } from '../builder';
4
3
  /**
@@ -6,26 +5,21 @@ import { AccessGuarderBuilder } from '../builder';
6
5
  */
7
6
  export type SecurityBundler = (builder: AccessGuarderBuilder) => AccessProvider;
8
7
  /**
9
- * 安全安装器
8
+ * 安全提供者组件属性
10
9
  */
11
- export type SecurityInstaller = PropsWithChildren<{
10
+ export interface SecurityProviderProps extends React.PropsWithChildren {
12
11
  /**
13
12
  * 打包器
14
13
  */
15
14
  readonly bundler: SecurityBundler;
16
- }>;
15
+ }
17
16
  /**
18
- * 安全上下文
19
- */
20
- export declare const SecurityContext: import("react").Context<AccessProvider | null>;
21
- /**
22
- * 安全上下文钩子
17
+ * 安全提供者组件
23
18
  */
24
- export declare const useSecurityContext: () => AccessProvider;
19
+ export declare function SecurityProvider({ children, bundler }: SecurityProviderProps): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
25
20
  /**
26
- * 安全提供者组件
27
- * @param children 子组件
21
+ * 安全阻断器包装
22
+ * @param Component 组件
28
23
  * @param bundler 打包器
29
- * @constructor
30
24
  */
31
- export declare function SecurityProvider({ children, bundler }: SecurityInstaller): import("react/jsx-runtime").JSX.Element;
25
+ export declare const withSecurityBlocker: (Component: React.ComponentType, bundler: SecurityBundler) => () => import("react/jsx-runtime").JSX.Element;
@@ -1,24 +1,20 @@
1
- import type { ComponentType, PropsWithChildren } from 'react';
2
1
  import type { AccessPermission, AccessPermissions } from '../access';
3
2
  /**
4
- * 权限条件
3
+ * 拥有权限组件属性
5
4
  */
6
- export type PermissionTerm = PropsWithChildren<{
5
+ export interface HavePermissionProps extends React.PropsWithChildren {
7
6
  /**
8
7
  * 条件
9
8
  */
10
9
  readonly term: AccessPermission | AccessPermissions;
11
- }>;
10
+ }
12
11
  /**
13
12
  * 拥有权限组件
14
- * @param children 子组件
15
- * @param term 条件
16
- * @constructor
17
13
  */
18
- export declare function HavePermission({ children, term }: PermissionTerm): import("react/jsx-runtime").JSX.Element;
14
+ export declare function HavePermission({ children, term }: HavePermissionProps): import("react").ReactNode;
19
15
  /**
20
16
  * 拥有权限包装
21
17
  * @param Component 组件
22
18
  * @param term 条件
23
19
  */
24
- export declare const withHavePermission: (Component: ComponentType, term: AccessPermission | AccessPermissions) => () => import("react/jsx-runtime").JSX.Element;
20
+ export declare const withHavePermission: (Component: React.ComponentType, term: AccessPermission | AccessPermissions) => () => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanaqi/rsr",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -10,7 +10,9 @@
10
10
  },
11
11
  "module": "./dist/index.js",
12
12
  "types": "./dist/index.d.ts",
13
- "files": ["dist"],
13
+ "files": [
14
+ "dist"
15
+ ],
14
16
  "keywords": [
15
17
  "react",
16
18
  "router",
@@ -24,7 +26,7 @@
24
26
  "router-guard",
25
27
  "react-router-guard",
26
28
  "react-router",
27
- "react-router-dom",
29
+ "react-router",
28
30
  "modern-js",
29
31
  "modernjs",
30
32
  "auth",
@@ -53,20 +55,22 @@
53
55
  "release": "npm run build && npm publish"
54
56
  },
55
57
  "devDependencies": {
56
- "@biomejs/biome": "^1.9.4",
57
- "@rsbuild/plugin-react": "^1.4.1",
58
- "@rslib/core": "0.15.0",
59
- "@types/react": "^19.2.2",
60
- "@types/react-dom": "^19.2.1",
61
- "react": "^19.2.0",
62
- "react-dom": "^19.2.0",
63
- "react-router-dom": "^7.9.4",
64
- "typescript": "^5.9.3"
58
+ "@biomejs/biome": "2.4.15",
59
+ "@rsbuild/plugin-babel": "^1.1.2",
60
+ "@rsbuild/plugin-react": "^2.0.0",
61
+ "@rslib/core": "0.21.5",
62
+ "@types/react": "^19.2.14",
63
+ "@types/react-dom": "^19.2.3",
64
+ "babel-plugin-react-compiler": "^1.0.0",
65
+ "react": "^19.2.6",
66
+ "react-dom": "^19.2.6",
67
+ "react-router": "^7.15.1",
68
+ "typescript": "^6.0.3"
65
69
  },
66
70
  "peerDependencies": {
67
- "react": ">=17.0.0",
68
- "react-dom": ">=17.0.0",
69
- "react-router-dom": "^6.0.0 || ^7.0.0"
71
+ "react": ">=19.0.0",
72
+ "react-dom": ">=19.0.0",
73
+ "react-router": "^7.0.0"
70
74
  },
71
75
  "private": false,
72
76
  "publishConfig": {