@moneko/react 1.5.6 → 1.6.0

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/entry.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ type RenderAppProps = {
3
+ container?: HTMLElement;
4
+ basename?: string;
5
+ fallback?: React.ReactElement;
6
+ language?: string;
7
+ };
8
+ export declare function App(props: RenderAppProps): React.JSX.Element;
9
+ declare function renderApp(props?: RenderAppProps): () => void;
10
+ export default renderApp;
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+ export declare const a: any;
3
+ export interface ErrorBoundaryProps {
4
+ children: React.ReactNode;
5
+ /**
6
+ * 自定义错误降级组件
7
+ */
8
+ fallback?: React.ComponentType<ErrorBoundaryState>;
9
+ }
10
+ /** 错误边界状态 */
11
+ export interface ErrorBoundaryState {
12
+ /** 捕获的错误 */
13
+ error?: Error;
14
+ /** 错误信息 */
15
+ errorInfo: {
16
+ /** 组件堆栈 */
17
+ componentStack?: string;
18
+ };
19
+ }
20
+ /** 错误边界 */
21
+ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, Partial<ErrorBoundaryState>> {
22
+ constructor(props: ErrorBoundaryProps);
23
+ componentDidCatch(error: ErrorBoundaryState['error'], errorInfo: ErrorBoundaryState['errorInfo']): void;
24
+ render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
25
+ }
26
+ export default ErrorBoundary;
@@ -0,0 +1 @@
1
+ import{jsx as r,jsxs as t}from"react/jsx-runtime";import*as e from"react";import o from"lodash/isEqual";export const a=o;class s extends e.Component{constructor(r){super(r),this.state={}}componentDidCatch(r,t){this.setState({error:r,errorInfo:t})}render(){if(this.state.errorInfo){let e=this.props.fallback;return e?r(e,{error:this.state.error,errorInfo:this.state.errorInfo}):t("div",{children:[r("h2",{children:"Something went wrong."}),t("details",{style:{whiteSpace:"pre-wrap",color:"var(--error-color, red)"},children:[this.state.error&&this.state.error.toString(),r("br",{}),this.state.errorInfo.componentStack]})]})}return this.props.children}}export default s;
package/lib/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ export * from 'react-router-dom';
3
+ export { default as LinkWithMenuId } from './link.js';
4
+ export { default as useNavigateWithMenuId } from './use-navgate.js';
5
+ export { default as renderApp, App } from './entry.js';
6
+ export { default as ErrorBoundary, type ErrorBoundaryProps, type ErrorBoundaryState, } from './error-boundary.js';
7
+ export type RenderAppProps = {
8
+ container?: HTMLElement;
9
+ basename?: string;
10
+ fallback?: JSX.Element;
11
+ language?: string;
12
+ };
13
+ export default React;
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import*as e from"react";export*from"react-router-dom";export{default as LinkWithMenuId}from"./link.js";export{default as useNavigateWithMenuId}from"./use-navgate.js";export{default as renderApp,App}from"./entry.js";export default e;
1
+ import*as r from"react";export*from"react-router-dom";export{default as LinkWithMenuId}from"./link.js";export{default as useNavigateWithMenuId}from"./use-navgate.js";export{default as renderApp,App}from"./entry.js";export{default as ErrorBoundary}from"./error-boundary.js";export default r;
@@ -0,0 +1 @@
1
+ export declare const injectReactRefresh: () => void;
package/lib/link.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { type FC } from 'react';
2
+ import { type LinkProps as ReactRouterLinkProps, type To } from 'react-router-dom';
3
+ export interface LinkProps extends Omit<ReactRouterLinkProps, 'to'> {
4
+ /** 保留字 */
5
+ reserved?: string | string[];
6
+ to: To | -1;
7
+ }
8
+ /** 跳转时继承部分query参数
9
+ * @default {string[]} ['menuId', 'dynamicTitle']
10
+ */
11
+ declare const Link: FC<LinkProps>;
12
+ export default Link;
@@ -0,0 +1,6 @@
1
+ import { type NavigateOptions, type To } from 'react-router-dom';
2
+ /** 跳转时继承部分query参数
3
+ * @default {string[]} ['menuId', 'dynamicTitle']
4
+ */
5
+ declare const useNavigate: (reserved?: string | string[]) => (to: To | -1, options?: NavigateOptions) => void;
6
+ export default useNavigate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/react",
3
- "version": "1.5.6",
3
+ "version": "1.6.0",
4
4
  "description": "react",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -15,21 +15,21 @@
15
15
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
16
16
  "react-refresh": "0.14.2",
17
17
  "react-refresh-typescript": "2.0.9",
18
- "react-router": "6.24.1",
19
- "react-router-dom": "6.24.1",
18
+ "react-router": "6.25.1",
19
+ "react-router-dom": "6.25.1",
20
20
  "shared-store-object": "1.1.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@moneko/transform-imports": "0.6.0",
24
24
  "@swc/cli": "0.4.0",
25
- "@swc/core": "1.6.13",
26
- "@types/node": "20.14.10",
25
+ "@swc/core": "1.7.3",
26
+ "@types/node": "20.14.12",
27
27
  "@types/react": "18.3.3",
28
28
  "@types/react-dom": "18.3.0",
29
29
  "eslint-config-neko": "2.8.4",
30
30
  "react": "18.3.1",
31
31
  "react-dom": "18.3.1",
32
- "typescript": "5.5.3"
32
+ "typescript": "5.5.4"
33
33
  },
34
34
  "files": [
35
35
  "lib",