@moneko/react 1.7.8 → 1.8.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/env.d.ts CHANGED
@@ -100,7 +100,7 @@ declare module '@app/info' {
100
100
  export default app;
101
101
  }
102
102
  declare module '@app/routes' {
103
- import type { NonIndexRouteObject } from 'react-router-dom';
103
+ import type { NonIndexRouteObject } from 'react-router/dom';
104
104
  export interface RouteConfig extends Omit<NonIndexRouteObject, 'element' | 'children'> {
105
105
  /** 菜单id */
106
106
  key?: string;
@@ -1,4 +1,4 @@
1
- import type { Path } from 'react-router';
1
+ import type { Path } from 'react-router-dom';
2
2
  declare function parse(reserved?: string | string[]): string[];
3
3
  declare function parseReservedWord(reserved?: string | string[]): string[];
4
4
  export interface IPath extends Partial<Omit<Path, 'search'>> {
@@ -1 +1 @@
1
- export default((e,a)=>{let r,t,n;if("number"==typeof e)return e;if("string"==typeof e){let a=e.split("?");t=a[0],r=new URLSearchParams(a[1])}else t=e.pathname,r=new URLSearchParams(e.search),n=e.hash;let s=new URLSearchParams(location.search);return Array.from(new Set(["menuId","dynamicTitle"].concat(Array.isArray(a)?a:a?[a]:[]))).forEach(e=>{s.has(e)&&!r.has(e)&&r.set(e,s.get(e)??"")}),{pathname:t,search:r.toString(),hash:n}});
1
+ export default((e,a)=>{let r,t,s;if("number"==typeof e)return e;if("string"==typeof e){let a=e.split("?");t=a[0],r=new URLSearchParams(a[1])}else{let a=e.pathname?e.pathname.split("?"):[];t=a[0],r=new URLSearchParams(e.search),a[1]&&new URLSearchParams(a[1]).forEach((e,a)=>{r.has(a)||r.set(a,e)}),s=e.hash}let h=new URLSearchParams(location.search);return Array.from(new Set(["menuId","dynamicTitle"].concat(Array.isArray(a)?a:a?[a]:[]))).forEach(e=>{h.has(e)&&!r.has(e)&&r.set(e,h.get(e)??"")}),{pathname:t,search:r.toString(),hash:s}});
@@ -1,4 +1,4 @@
1
- import { type NavigateOptions, useNavigate as useNavigateReactRouter } from 'react-router';
1
+ import { type NavigateOptions, useNavigate as useNavigateReactRouter } from 'react-router-dom';
2
2
  import parseToByReservedWord, { type To } from './parse-reserved-word.js';
3
3
  interface NavigateFunction {
4
4
  (to: To, options?: NavigateOptions) : void;
@@ -1 +1 @@
1
- import{useNavigate as r}from"react-router";import e from"./parse-reserved-word.js";export default(t=>{let o=r();return(r,a)=>o(e(r,t),a)});
1
+ import{useNavigate as r}from"react-router-dom";import e from"./parse-reserved-word.js";export default(t=>{let o=r();return(r,a)=>o(e(r,t),a)});
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
- import { useLocation } from 'react-router';
2
+ import { useLocation } from 'react-router-dom';
3
3
  declare const useQuery: <T>() => T;
4
4
  export default useQuery;
package/lib/use-query.js CHANGED
@@ -1 +1 @@
1
- import*as r from"react";import{useLocation as e}from"react-router";export default(()=>{let t=e();return r.useMemo(()=>Object.fromEntries(new URLSearchParams(t.search)),[t.search])});
1
+ import*as r from"react";import{useLocation as e}from"react-router-dom";export default(()=>{let t=e();return r.useMemo(()=>Object.fromEntries(new URLSearchParams(t.search)),[t.search])});
package/mdx.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import * as React from 'react';
2
+ type RecordObject = Record<string, any>;
2
3
  export interface MDXComponents {
3
- [k: string]: (props: Record<string, any>) => React.JSX.Element;
4
+ [k: string]: (props: RecordObject) => React.JSX.Element;
4
5
  }
5
6
  export interface MDXProviderProps extends React.Component {
6
7
  children: React.JSX.Element;
7
- components: MDXComponents | ((props: Record<string, any>) => MDXComponents);
8
+ components: MDXComponents | ((props: RecordObject) => MDXComponents);
8
9
  disableParentContext?: boolean;
9
10
  }
10
11
  declare const emptyComponents: Readonly<MDXComponents>;
11
12
  declare const MDXContext: React.Context<Readonly<MDXComponents>>;
12
- export declare function useMDXComponents(components: MDXComponents | ((props: Record<string, any>) => MDXComponents)): MDXComponents;
13
- export declare function MDXProvider(props: MDXProviderProps): React.JSX.Element;
13
+ export declare function useMDXComponents(components: MDXComponents | ((props: RecordObject) => MDXComponents)): MDXComponents;
14
+ export declare function MDXProvider({ components, disableParentContext, children }: MDXProviderProps): React.JSX.Element;
package/mdx.js CHANGED
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import*as t from"react";let n={},o=t.createContext(n);export function useMDXComponents(e){let n=t.useContext(o);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}export function MDXProvider(r){let s=t.useMemo(()=>r.disableParentContext?"function"==typeof r.components?r.components(n):r.components||n:useMDXComponents(r.components),[r.components,r.disableParentContext]);return e(o.Provider,{value:s,children:r.children})}
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,12 +1,15 @@
1
1
  {
2
2
  "name": "@moneko/react",
3
- "version": "1.7.8",
3
+ "version": "1.8.0",
4
4
  "description": "react",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
7
7
  "prebuild": "rm -rf ./lib",
8
8
  "build": "node ./build.mjs",
9
- "prepublishOnly": "npm run build"
9
+ "prepublishOnly": "npm run build",
10
+ "prepare": "husky node_modules/.husky && echo npm run lint:commit > node_modules/.husky/pre-commit",
11
+ "lint:commit": "lint-git mode=commit",
12
+ "lint:ci": "lint-git mode=ci"
10
13
  },
11
14
  "author": "moneko",
12
15
  "type": "module",
@@ -15,21 +18,26 @@
15
18
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
16
19
  "react-refresh": "0.16.0",
17
20
  "react-refresh-typescript": "2.0.10",
18
- "react-router": "6.27.0",
19
- "react-router-dom": "6.27.0",
21
+ "react-router": "6.28.2",
22
+ "react-router-dom": "6.28.2",
20
23
  "shared-store-object": "1.2.1"
21
24
  },
22
25
  "devDependencies": {
23
26
  "@moneko/convert": "1.0.0",
27
+ "@moneko/eslint": "1.0.1",
28
+ "@moneko/stylelint": "1.0.2",
24
29
  "@moneko/transform-imports": "0.6.1",
25
30
  "@moneko/utils": "0.1.22",
26
- "@types/node": "22.10.5",
27
- "@types/react": "19.0.2",
28
- "@types/react-dom": "19.0.2",
29
- "eslint-config-neko": "3.0.3",
31
+ "@types/node": "22.13.9",
32
+ "@types/react": "19.0.10",
33
+ "@types/react-dom": "19.0.4",
34
+ "eslint-plugin-react": "7.37.4",
35
+ "eslint-plugin-react-hooks": "5.2.0",
36
+ "husky": "9.1.7",
37
+ "lint-staged-by-git": "1.1.1",
30
38
  "react": "19.0.0",
31
39
  "react-dom": "19.0.0",
32
- "typescript": "5.7.2"
40
+ "typescript": "5.8.2"
33
41
  },
34
42
  "files": [
35
43
  "lib",
File without changes
File without changes