idea-react 1.0.0-rc.30 → 2.0.0-rc.1
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/ReadMe.md +27 -4
- package/dist/index.d.ts +10 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +51 -50
- package/source/CodeBlock.tsx +4 -2
- package/source/Dialog.tsx +4 -5
- package/source/Editor.tsx +3 -8
- package/source/MonthCalendar.tsx +11 -16
- package/source/PageNav.tsx +6 -11
- package/source/TypeEcho.tsx +8 -5
- package/tsconfig.json +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "idea-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"author": "shiy2008@gmail.com",
|
|
6
6
|
"description": "A React advanced components library based on TypeScript & Bootstrap, built by idea2app remote developers team.",
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"types": "dist/index.d.ts",
|
|
23
23
|
"main": "dist/index.js",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@editorjs/editorjs": "^2.
|
|
26
|
-
"@editorjs/paragraph": "^2.
|
|
25
|
+
"@editorjs/editorjs": "^2.29.0",
|
|
26
|
+
"@editorjs/paragraph": "^2.11.3",
|
|
27
27
|
"@react-editor-js/core": "^2.1.0",
|
|
28
|
-
"@swc/helpers": "^0.5.
|
|
29
|
-
"classnames": "^2.
|
|
28
|
+
"@swc/helpers": "^0.5.3",
|
|
29
|
+
"classnames": "^2.5.1",
|
|
30
30
|
"editorjs-html": "^3.4.3",
|
|
31
|
-
"iterable-observer": "^1.0.
|
|
31
|
+
"iterable-observer": "^1.0.1",
|
|
32
32
|
"lodash": "^4.17.21",
|
|
33
|
-
"mobx": ">=
|
|
34
|
-
"mobx-react": ">=
|
|
35
|
-
"mobx-react-helper": "^0.
|
|
33
|
+
"mobx": ">=6.12.0",
|
|
34
|
+
"mobx-react": ">=9.1.0",
|
|
35
|
+
"mobx-react-helper": "^0.3.1",
|
|
36
36
|
"prismjs": "^1.29.0",
|
|
37
|
-
"react-bootstrap": "^2.
|
|
37
|
+
"react-bootstrap": "^2.10.0",
|
|
38
38
|
"react-editor-js": "^2.1.0",
|
|
39
39
|
"react-element-to-jsx-string": "^15.0.0",
|
|
40
40
|
"web-utility": "^4.1.3"
|
|
@@ -44,50 +44,51 @@
|
|
|
44
44
|
"react-dom": ">=16"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/plugin-proposal-
|
|
48
|
-
"@babel/
|
|
49
|
-
"@microsoft/api-extractor": "^7.
|
|
50
|
-
"@parcel/
|
|
51
|
-
"@parcel/
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@storybook/addon-
|
|
55
|
-
"@storybook/addon-
|
|
56
|
-
"@storybook/addon-
|
|
57
|
-
"@storybook/
|
|
58
|
-
"@storybook/
|
|
59
|
-
"@storybook/
|
|
60
|
-
"@storybook/
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@types/
|
|
64
|
-
"@types/
|
|
65
|
-
"@types/
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"eslint": "^
|
|
70
|
-
"
|
|
71
|
-
"eslint
|
|
47
|
+
"@babel/plugin-proposal-decorators": "^7.23.9",
|
|
48
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
49
|
+
"@microsoft/api-extractor": "^7.39.4",
|
|
50
|
+
"@parcel/config-default": "~2.11.0",
|
|
51
|
+
"@parcel/packager-ts": "~2.11.0",
|
|
52
|
+
"@parcel/transformer-typescript-tsc": "~2.11.0",
|
|
53
|
+
"@parcel/transformer-typescript-types": "~2.11.0",
|
|
54
|
+
"@storybook/addon-console": "^3.0.0",
|
|
55
|
+
"@storybook/addon-essentials": "^7.6.10",
|
|
56
|
+
"@storybook/addon-interactions": "^7.6.10",
|
|
57
|
+
"@storybook/addon-links": "^7.6.10",
|
|
58
|
+
"@storybook/addon-storysource": "^7.6.10",
|
|
59
|
+
"@storybook/blocks": "^7.6.10",
|
|
60
|
+
"@storybook/react": "^7.6.10",
|
|
61
|
+
"@storybook/react-vite": "^7.6.10",
|
|
62
|
+
"@storybook/testing-library": "^0.2.2",
|
|
63
|
+
"@types/lodash": "^4.14.202",
|
|
64
|
+
"@types/node": "^18.19.10",
|
|
65
|
+
"@types/prismjs": "^1.26.3",
|
|
66
|
+
"@types/react": "^18.2.48",
|
|
67
|
+
"@types/react-dom": "^18.2.18",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
69
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
70
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
71
|
+
"eslint": "^8.56.0",
|
|
72
|
+
"eslint-config-prettier": "^9.1.0",
|
|
73
|
+
"eslint-plugin-import": "^2.29.1",
|
|
72
74
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
73
|
-
"husky": "^
|
|
75
|
+
"husky": "^9.0.7",
|
|
74
76
|
"koapache": "^2.2.2",
|
|
75
77
|
"less": "^4.2.0",
|
|
76
|
-
"lint-staged": "^
|
|
77
|
-
"parcel": "~2.
|
|
78
|
-
"postcss-preset-env": "^9.
|
|
79
|
-
"prettier": "^3.
|
|
78
|
+
"lint-staged": "^15.2.0",
|
|
79
|
+
"parcel": "~2.11.0",
|
|
80
|
+
"postcss-preset-env": "^9.3.0",
|
|
81
|
+
"prettier": "^3.2.4",
|
|
80
82
|
"process": "^0.11.10",
|
|
81
83
|
"prop-types": "15.8.1",
|
|
82
84
|
"react": "^18.2.0",
|
|
83
85
|
"react-dom": "^18.2.0",
|
|
84
|
-
"rimraf": "^5.0.
|
|
85
|
-
"storybook": "^7.
|
|
86
|
-
"
|
|
87
|
-
"typedoc": "^
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"vite": "^4.4.9"
|
|
86
|
+
"rimraf": "^5.0.5",
|
|
87
|
+
"storybook": "^7.6.10",
|
|
88
|
+
"typedoc": "^0.25.7",
|
|
89
|
+
"typedoc-plugin-mdn-links": "^3.1.14",
|
|
90
|
+
"typescript": "~5.3.3",
|
|
91
|
+
"vite": "^5.0.12"
|
|
91
92
|
},
|
|
92
93
|
"prettier": {
|
|
93
94
|
"singleQuote": true,
|
|
@@ -106,7 +107,7 @@
|
|
|
106
107
|
}
|
|
107
108
|
},
|
|
108
109
|
"scripts": {
|
|
109
|
-
"prepare": "husky
|
|
110
|
+
"prepare": "husky",
|
|
110
111
|
"test": "lint-staged",
|
|
111
112
|
"api-extractor": "tsc --project tsconfig.build.json --outDir dist/dts && api-extractor run && rimraf dist/dts",
|
|
112
113
|
"pack-preview": "cd preview/ && rimraf ../.parcel-cache dist/ && parcel build --public-url=. --dist-dir=../docs/preview/",
|
|
@@ -116,8 +117,8 @@
|
|
|
116
117
|
"build": "npm run pack-docs && npm run pack-preview && npm run pack-dist && npm run api-extractor",
|
|
117
118
|
"prepublishOnly": "npm test && npm run build",
|
|
118
119
|
"dev:storybook": "storybook dev -p 6006",
|
|
119
|
-
"build:storybook": "
|
|
120
|
-
"preview:storybook": "vite preview --outDir storybook-static",
|
|
120
|
+
"build:storybook": "storybook build -c .storybook",
|
|
121
|
+
"preview:storybook": "npm run build:storybook && vite preview --outDir storybook-static",
|
|
121
122
|
"preview": "cd preview/ && rimraf ../.parcel-cache dist/ && parcel --open"
|
|
122
123
|
}
|
|
123
124
|
}
|
package/source/CodeBlock.tsx
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { highlight, languages } from 'prismjs';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { isValidElement, PropsWithChildren } from 'react';
|
|
3
3
|
import reactElementToJSXString from 'react-element-to-jsx-string';
|
|
4
4
|
|
|
5
5
|
export type CodeBlockProps = PropsWithChildren<{ language: string }>;
|
|
6
6
|
|
|
7
7
|
export function CodeBlock({ language, children }: CodeBlockProps) {
|
|
8
8
|
const __html = highlight(
|
|
9
|
-
reactElementToJSXString(
|
|
9
|
+
reactElementToJSXString(
|
|
10
|
+
isValidElement(children) ? children : <>{children}</>
|
|
11
|
+
),
|
|
10
12
|
languages[language],
|
|
11
13
|
language
|
|
12
14
|
);
|
package/source/Dialog.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Defer } from 'iterable-observer';
|
|
2
|
-
import
|
|
2
|
+
import { observable } from 'mobx';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { FC } from 'react';
|
|
5
5
|
|
|
@@ -14,15 +14,14 @@ export interface DialogProps<T = any> {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export class Dialog<T = any> {
|
|
17
|
-
@
|
|
18
|
-
defer
|
|
17
|
+
@observable
|
|
18
|
+
accessor defer: Defer<T> | undefined;
|
|
19
19
|
|
|
20
20
|
Component: FC;
|
|
21
21
|
|
|
22
22
|
constructor(Factory: FC<DialogProps<T>>) {
|
|
23
|
-
MobX.makeObservable?.(this);
|
|
24
|
-
|
|
25
23
|
this.Component = observer(() => <Factory defer={this.defer} />);
|
|
24
|
+
this.Component.displayName = 'DialogComponent';
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
open() {
|
package/source/Editor.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorCore, WrapperProps } from '@react-editor-js/core';
|
|
2
|
-
import
|
|
2
|
+
import { observable } from 'mobx';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { InputHTMLAttributes, PropsWithoutRef, PureComponent } from 'react';
|
|
5
5
|
import { createReactEditorJS } from 'react-editor-js';
|
|
@@ -15,15 +15,10 @@ export type EditorProps = PropsWithoutRef<
|
|
|
15
15
|
export class Editor extends PureComponent<EditorProps> {
|
|
16
16
|
static displayName = 'Editor';
|
|
17
17
|
|
|
18
|
-
constructor(props: EditorProps) {
|
|
19
|
-
super(props);
|
|
20
|
-
MobX.makeObservable?.(this);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
18
|
private core?: EditorCore;
|
|
24
19
|
|
|
25
|
-
@
|
|
26
|
-
innerValue = this.props.defaultValue;
|
|
20
|
+
@observable
|
|
21
|
+
accessor innerValue = this.props.defaultValue;
|
|
27
22
|
|
|
28
23
|
save = async () => this.core && (this.innerValue = await this.core.save());
|
|
29
24
|
|
package/source/MonthCalendar.tsx
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import
|
|
2
|
+
import { computed, observable } from 'mobx';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { observePropsState } from 'mobx-react-helper';
|
|
5
|
-
import {
|
|
5
|
+
import { Component, ReactNode } from 'react';
|
|
6
6
|
import { Badge, Button, ButtonProps, Table, TableProps } from 'react-bootstrap';
|
|
7
7
|
import {
|
|
8
|
-
Day,
|
|
9
|
-
TimeData,
|
|
10
8
|
changeMonth,
|
|
9
|
+
Day,
|
|
11
10
|
formatDate,
|
|
12
|
-
splitArray
|
|
11
|
+
splitArray,
|
|
12
|
+
TimeData
|
|
13
13
|
} from 'web-utility';
|
|
14
14
|
|
|
15
|
-
import { OverlayBox } from './OverlayBox';
|
|
16
15
|
import { text2color } from './color';
|
|
16
|
+
import { OverlayBox } from './OverlayBox';
|
|
17
17
|
|
|
18
18
|
export interface DateData {
|
|
19
19
|
date: TimeData;
|
|
@@ -35,27 +35,22 @@ export interface MonthCalendarProps
|
|
|
35
35
|
*/
|
|
36
36
|
@observer
|
|
37
37
|
@observePropsState
|
|
38
|
-
export class MonthCalendar extends
|
|
38
|
+
export class MonthCalendar extends Component<MonthCalendarProps> {
|
|
39
39
|
static displayName = 'MonthCalendar';
|
|
40
40
|
|
|
41
|
-
constructor(props: MonthCalendarProps) {
|
|
42
|
-
super(props);
|
|
43
|
-
MobX.makeObservable?.(this);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
41
|
declare observedProps: MonthCalendarProps;
|
|
47
42
|
|
|
48
|
-
@
|
|
43
|
+
@computed
|
|
49
44
|
get weekFormatter() {
|
|
50
45
|
const { locale = globalThis.navigator?.language } = this.observedProps;
|
|
51
46
|
|
|
52
47
|
return new Intl.DateTimeFormat(locale, { weekday: 'long' });
|
|
53
48
|
}
|
|
54
49
|
|
|
55
|
-
@
|
|
56
|
-
currentDate = new Date();
|
|
50
|
+
@observable
|
|
51
|
+
accessor currentDate = new Date();
|
|
57
52
|
|
|
58
|
-
@
|
|
53
|
+
@computed
|
|
59
54
|
get dateGrid() {
|
|
60
55
|
let startDate = new Date(this.currentDate);
|
|
61
56
|
startDate.setDate(1);
|
package/source/PageNav.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { computed, observable } from 'mobx';
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
import { PureComponent } from 'react';
|
|
4
4
|
import { Nav, NavProps } from 'react-bootstrap';
|
|
@@ -19,18 +19,13 @@ export interface PageNavProps extends NavProps {
|
|
|
19
19
|
export class PageNav extends PureComponent<PageNavProps> {
|
|
20
20
|
static displayName = 'PageNav';
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
MobX.makeObservable?.(this);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@MobX.observable
|
|
28
|
-
list: HeadingMeta[] = [];
|
|
22
|
+
@observable
|
|
23
|
+
accessor list: HeadingMeta[] = [];
|
|
29
24
|
|
|
30
|
-
@
|
|
31
|
-
scrollY = 0;
|
|
25
|
+
@observable
|
|
26
|
+
accessor scrollY = 0;
|
|
32
27
|
|
|
33
|
-
@
|
|
28
|
+
@computed
|
|
34
29
|
get currentActiveId() {
|
|
35
30
|
const { list, scrollY } = this;
|
|
36
31
|
const index = list.findIndex(({ top }) => top > scrollY);
|
package/source/TypeEcho.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
+
import { observable } from 'mobx';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
2
4
|
import { PropsWithoutRef, PureComponent, RefCallback } from 'react';
|
|
3
5
|
import { sleep } from 'web-utility';
|
|
4
6
|
|
|
@@ -7,12 +9,13 @@ export type TypeEchoProps = PropsWithoutRef<{
|
|
|
7
9
|
text: string;
|
|
8
10
|
intervals?: number;
|
|
9
11
|
}>;
|
|
10
|
-
type State = { echoed: string };
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
@observer
|
|
14
|
+
export class TypeEcho extends PureComponent<TypeEchoProps> {
|
|
13
15
|
static displayName = 'TypeEcho';
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
@observable
|
|
18
|
+
accessor echoed = '';
|
|
16
19
|
|
|
17
20
|
init: RefCallback<HTMLPreElement> = node =>
|
|
18
21
|
node &&
|
|
@@ -26,13 +29,13 @@ export class TypeEcho extends PureComponent<TypeEchoProps, State> {
|
|
|
26
29
|
for (const char of text) {
|
|
27
30
|
await sleep(intervals / 1000);
|
|
28
31
|
|
|
29
|
-
this.
|
|
32
|
+
this.echoed += char;
|
|
30
33
|
}
|
|
31
34
|
}).observe(node);
|
|
32
35
|
|
|
33
36
|
render() {
|
|
34
37
|
const { className, text } = this.props,
|
|
35
|
-
{ echoed } = this
|
|
38
|
+
{ echoed } = this;
|
|
36
39
|
|
|
37
40
|
return (
|
|
38
41
|
<pre className={classNames('text-wrap', className)} ref={this.init}>
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
3
|
+
"target": "ES6",
|
|
4
|
+
"moduleResolution": "Node",
|
|
4
5
|
"esModuleInterop": true,
|
|
5
6
|
"downlevelIteration": true,
|
|
6
|
-
"
|
|
7
|
+
"useDefineForClassFields": true,
|
|
7
8
|
"jsx": "react-jsx",
|
|
8
9
|
"skipLibCheck": true,
|
|
9
|
-
"lib": ["
|
|
10
|
+
"lib": ["ES2023", "DOM"]
|
|
10
11
|
},
|
|
11
12
|
"include": ["source/**/*", "stories/**/*"],
|
|
12
13
|
"typedocOptions": {
|