@moneko/react 2.2.1 → 3.0.0-beta.2
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/env.d.ts +7 -19
- package/index.js +7 -0
- package/lib/activity.d.ts +4 -4
- package/lib/error-boundary.d.ts +9 -19
- package/lib/index.d.ts +2 -1
- package/lib/link.d.ts +6 -4
- package/lib/parse-reserved-word.d.ts +0 -2
- package/lib/use-navgate.d.ts +5 -3
- package/lib/use-query.d.ts +0 -2
- package/mdx.d.ts +2 -2
- package/mdx.dev.js +1 -0
- package/mdx.js +7 -1
- package/mdx.prod.js +1 -0
- package/package.json +19 -15
package/env.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare module '*?url' {
|
|
|
19
19
|
export default string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
declare module '
|
|
22
|
+
declare module 'scope:components' {
|
|
23
23
|
import { MDXComponents } from '@moneko/react/mdx';
|
|
24
24
|
|
|
25
25
|
const scope: MDXComponents;
|
|
@@ -41,7 +41,7 @@ declare module '*.mdx' {
|
|
|
41
41
|
export default MDXProvider;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
declare module '
|
|
44
|
+
declare module 'docs:docs' {
|
|
45
45
|
import { JSX } from 'react';
|
|
46
46
|
|
|
47
47
|
interface ApiEntry {
|
|
@@ -52,7 +52,7 @@ declare module '@app/docs' {
|
|
|
52
52
|
export default entry;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
declare module '
|
|
55
|
+
declare module 'app:routes' {
|
|
56
56
|
import type { RouteObject } from 'react-router-dom';
|
|
57
57
|
export interface RouteConfig extends Omit<RouteObject, 'element' | 'children'> {
|
|
58
58
|
/** 菜单id */
|
|
@@ -101,7 +101,7 @@ interface ExampleModuleBase {
|
|
|
101
101
|
[key: string]: unknown;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
declare module '
|
|
104
|
+
declare module 'docs:example' {
|
|
105
105
|
export interface ExampleModule extends ExampleModuleBase {
|
|
106
106
|
[key: string]: unknown;
|
|
107
107
|
}
|
|
@@ -109,7 +109,7 @@ declare module '@app/example' {
|
|
|
109
109
|
|
|
110
110
|
export default examples;
|
|
111
111
|
}
|
|
112
|
-
declare module '
|
|
112
|
+
declare module 'example:*' {
|
|
113
113
|
export interface ExampleModule extends ExampleModuleBase {
|
|
114
114
|
[key: string]: unknown;
|
|
115
115
|
}
|
|
@@ -117,7 +117,7 @@ declare module '@app/example/*' {
|
|
|
117
117
|
|
|
118
118
|
export default example;
|
|
119
119
|
}
|
|
120
|
-
declare module '
|
|
120
|
+
declare module 'docs:coverage' {
|
|
121
121
|
export type CoverageType = {
|
|
122
122
|
/** 语句(statement coverage) */
|
|
123
123
|
statements: string;
|
|
@@ -151,7 +151,7 @@ declare module '@app/coverage' {
|
|
|
151
151
|
|
|
152
152
|
export default coverage;
|
|
153
153
|
}
|
|
154
|
-
declare module '
|
|
154
|
+
declare module 'app:locales' {
|
|
155
155
|
import type { SSO } from 'shared-store-object';
|
|
156
156
|
export type LocaleConfig = {
|
|
157
157
|
/** 语言名称 (未设置时使用文件名)*/
|
|
@@ -201,18 +201,6 @@ declare module '@app/locales' {
|
|
|
201
201
|
|
|
202
202
|
export default localizable;
|
|
203
203
|
}
|
|
204
|
-
declare module '@app/fallback' {
|
|
205
|
-
const Fallback: null | (() => ReactElement);
|
|
206
|
-
|
|
207
|
-
export default Fallback;
|
|
208
|
-
}
|
|
209
|
-
declare module '@app/suspense' {
|
|
210
|
-
export default function SuspenseComp(props: {
|
|
211
|
-
comp: () => Promise<{
|
|
212
|
-
default: ComponentType;
|
|
213
|
-
}>;
|
|
214
|
-
}): React.JSX.Element;
|
|
215
|
-
}
|
|
216
204
|
|
|
217
205
|
declare let __webpack_public_path__: string | undefined;
|
|
218
206
|
|
package/index.js
ADDED
package/lib/activity.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export interface ActivityProps {
|
|
|
4
4
|
mode: ActivityMode;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
declare const Activity: React.FC<ActivityProps>;
|
|
7
|
+
/**
|
|
8
|
+
* @param {ActivityProps} props
|
|
9
|
+
* @description 状态保持组件
|
|
10
|
+
*/ declare const Activity: React.FC<ActivityProps>;
|
|
11
11
|
export default Activity;
|
package/lib/error-boundary.d.ts
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export interface ErrorBoundaryProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 自定义错误降级组件
|
|
6
|
+
*/ fallback?: React.ComponentType<ErrorBoundaryState>;
|
|
5
7
|
}
|
|
6
|
-
export interface ErrorBoundaryState {
|
|
7
|
-
error?: Error;
|
|
8
|
-
errorInfo: {
|
|
9
|
-
componentStack?: string;
|
|
10
|
-
digest?: string;
|
|
8
|
+
/** 错误边界状态 */ export interface ErrorBoundaryState {
|
|
9
|
+
/** 捕获的错误 */ error?: Error;
|
|
10
|
+
/** 错误信息 */ errorInfo: {
|
|
11
|
+
/** 组件堆栈 */ componentStack?: string;
|
|
12
|
+
/** 错误摘要 */ digest?: string;
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
|
-
declare
|
|
14
|
-
declare const __webpack_require__: {
|
|
15
|
-
m: Record<string, string>;
|
|
16
|
-
};
|
|
17
|
-
declare function extractSourceMapURL(str: string);
|
|
18
|
-
declare function parseJson<T>(str: string): T | null;
|
|
19
|
-
declare function getSourceCode(moduleId: string);
|
|
20
|
-
declare function getSourceFromWebpack(file: string): string | null;
|
|
21
|
-
declare const ErrorStack: ({ stack, heading }: {
|
|
22
|
-
stack?: string;
|
|
23
|
-
heading?: React.ReactNode;
|
|
24
|
-
}) => any;
|
|
25
|
-
declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, Partial<ErrorBoundaryState>> {
|
|
15
|
+
/** 错误边界 */ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, Partial<ErrorBoundaryState>> {
|
|
26
16
|
componentNameRegex: RegExp;
|
|
27
17
|
constructor(props: ErrorBoundaryProps);
|
|
28
18
|
componentDidCatch(error: ErrorBoundaryState['error'], errorInfo: ErrorBoundaryState['errorInfo']): void;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export * from 'react-router-dom';
|
|
3
|
+
// 导入并覆盖 useNavigate,使用自定义版本
|
|
3
4
|
export { default as ErrorBoundary, type ErrorBoundaryProps, type ErrorBoundaryState } from './error-boundary.js';
|
|
4
5
|
export { default as Link } from './link.js';
|
|
5
6
|
export { default as parseToByReservedWord, type To } from './parse-reserved-word.js';
|
|
6
7
|
export { default as useNavigate } from './use-navgate.js';
|
|
7
8
|
export { default as useQuery } from './use-query.js';
|
|
8
|
-
export { Link as LinkReactRouter, useNavigate as useNavigateReactRouter } from 'react-router-dom';
|
|
9
|
+
export { /** 原版 Link */ Link as LinkReactRouter, /** 原版 useNavigate */ useNavigate as useNavigateReactRouter } from 'react-router-dom';
|
|
9
10
|
export type RenderAppProps = {
|
|
10
11
|
container?: HTMLElement;
|
|
11
12
|
basename?: string;
|
package/lib/link.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { type LinkProps as ReactRouterLinkProps } from 'react-router-dom';
|
|
3
|
+
import { type To } from './parse-reserved-word.js';
|
|
4
4
|
export interface LinkProps extends Omit<ReactRouterLinkProps, 'to'> {
|
|
5
|
-
reserved?: string | string[];
|
|
5
|
+
/** 保留字 */ reserved?: string | string[];
|
|
6
6
|
to: To;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
/** 跳转时继承部分query参数
|
|
9
|
+
* @default {string[]} ['menuId', 'dynamicTitle']
|
|
10
|
+
*/ declare const Link: React.FC<LinkProps>;
|
|
9
11
|
export default Link;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { Path } from 'react-router-dom';
|
|
2
|
-
declare function parse(reserved?: string | string[]): string[];
|
|
3
|
-
declare function parseReservedWord(reserved?: string | string[]): string[];
|
|
4
2
|
type SearchParams = ConstructorParameters<typeof URLSearchParams>[0];
|
|
5
3
|
type NormalRecord = Record<string, string | number | boolean | undefined | null>;
|
|
6
4
|
export interface IPath extends Partial<Omit<Path, 'search'>> {
|
package/lib/use-navgate.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type NavigateOptions
|
|
2
|
-
import
|
|
1
|
+
import { type NavigateOptions } from 'react-router-dom';
|
|
2
|
+
import { type To } from './parse-reserved-word.js';
|
|
3
3
|
interface NavigateFunction {
|
|
4
4
|
(to: To, options?: NavigateOptions) : void;
|
|
5
5
|
(delta: number) : void;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
/** 跳转时继承部分query参数
|
|
8
|
+
* @default {string[]} ['menuId', 'dynamicTitle']
|
|
9
|
+
*/ declare const useNavigate: (/** search保留字 */ reserved?: string | string[]) => NavigateFunction;
|
|
8
10
|
export default useNavigate;
|
package/lib/use-query.d.ts
CHANGED
package/mdx.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
3
|
type RecordObject = Record<string, any>;
|
|
3
4
|
export interface MDXComponents {
|
|
4
5
|
[k: string]: (props: RecordObject) => React.JSX.Element;
|
|
@@ -8,7 +9,6 @@ export interface MDXProviderProps extends React.Component {
|
|
|
8
9
|
components: MDXComponents | ((props: RecordObject) => MDXComponents);
|
|
9
10
|
disableParentContext?: boolean;
|
|
10
11
|
}
|
|
11
|
-
declare const emptyComponents: Readonly<MDXComponents>;
|
|
12
|
-
declare const MDXContext: React.Context<Readonly<MDXComponents>>;
|
|
13
12
|
export declare function useMDXComponents(components: MDXComponents | ((props: RecordObject) => MDXComponents)): MDXComponents;
|
|
14
13
|
export declare function MDXProvider({ components, disableParentContext, children }: MDXProviderProps): React.JSX.Element;
|
|
14
|
+
export { };
|
package/mdx.dev.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxDEV as e}from"react/jsx-dev-runtime";var r=$RefreshSig$(),o=$RefreshSig$();import*as t from"react";let n={},s=t.createContext(n);export function useMDXComponents(e){r();let o=t.useContext(s);return t.useMemo(function(){return"function"==typeof e?e(o):{...o,...e}},[o,e])}r(useMDXComponents,"FcZoNO24HXzM5P6P848XEnnFz2s=");export function MDXProvider({components:r,disableParentContext:u,children:i}){o();let m=useMDXComponents(r),f=t.useMemo(()=>u?"function"==typeof r?r(n):r||n:m,[m,r,u]);return e(s.Provider,{value:f,children:i},void 0,!1,{fileName:"src/mdx.tsx",lineNumber:49,columnNumber:10},this)}o(MDXProvider,"Aro+Q0yrxuf2vRoKYCi6Hks00dI=",!1,function(){return[useMDXComponents]}),$RefreshReg$(MDXProvider,"MDXProvider");
|
package/mdx.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
if (process.env.NODE_ENV === 'production') {
|
|
4
|
+
module.exports = require('./mdx.prod.js');
|
|
5
|
+
} else {
|
|
6
|
+
module.exports = require('./mdx.dev.js');
|
|
7
|
+
}
|
package/mdx.prod.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import*as t from"react";let o={},n=t.createContext(o);export function useMDXComponents(e){let o=t.useContext(n);return t.useMemo(function(){return"function"==typeof e?e(o):{...o,...e}},[o,e])}export function MDXProvider({components:r,disableParentContext:u,children:i}){let s=useMDXComponents(r),c=t.useMemo(()=>u?"function"==typeof r?r(o):r||o:s,[s,r,u]);return e(n.Provider,{value:c,children:i})}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"description": "react",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prebuild": "rm -rf ./lib",
|
|
8
8
|
"build": "node ./build.mjs",
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
"shared-store-object": "1.4.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@moneko/convert": "1.
|
|
28
|
-
"@moneko/eslint": "1.
|
|
29
|
-
"@moneko/stylelint": "1.
|
|
30
|
-
"@moneko/transform-imports": "
|
|
31
|
-
"@moneko/utils": "0.
|
|
32
|
-
"@
|
|
33
|
-
"@types/
|
|
34
|
-
"@types/react
|
|
35
|
-
"@types/react-
|
|
27
|
+
"@moneko/convert": "1.1.4",
|
|
28
|
+
"@moneko/eslint": "1.10.0",
|
|
29
|
+
"@moneko/stylelint": "1.7.0",
|
|
30
|
+
"@moneko/transform-imports": "1.3.0",
|
|
31
|
+
"@moneko/utils": "0.3.3",
|
|
32
|
+
"@swc/core": "^1.15.1",
|
|
33
|
+
"@types/node": "24.10.0",
|
|
34
|
+
"@types/react": "19.2.2",
|
|
35
|
+
"@types/react-dom": "19.2.2",
|
|
36
36
|
"husky": "9.1.7",
|
|
37
37
|
"lint-staged-by-git": "1.3.0",
|
|
38
|
-
"react": "19.
|
|
39
|
-
"react-dom": "19.
|
|
40
|
-
"typescript": "5.
|
|
38
|
+
"react": "19.2.0",
|
|
39
|
+
"react-dom": "19.2.0",
|
|
40
|
+
"typescript": "5.9.3"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"lib",
|
|
@@ -46,7 +46,11 @@
|
|
|
46
46
|
"lib.json",
|
|
47
47
|
"env.d.ts",
|
|
48
48
|
"mdx.js",
|
|
49
|
+
"mdx.dev.js",
|
|
50
|
+
"mdx.prod.js",
|
|
49
51
|
"mdx.js.map",
|
|
50
|
-
"mdx.d.ts"
|
|
52
|
+
"mdx.d.ts",
|
|
53
|
+
"index.js",
|
|
54
|
+
"index.d.ts"
|
|
51
55
|
]
|
|
52
56
|
}
|