idea-react 1.0.0-rc.31 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-react",
3
- "version": "1.0.0-rc.31",
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.28.2",
25
+ "@editorjs/editorjs": "^2.29.0",
26
26
  "@editorjs/paragraph": "^2.11.3",
27
27
  "@react-editor-js/core": "^2.1.0",
28
28
  "@swc/helpers": "^0.5.3",
29
- "classnames": "^2.3.3",
29
+ "classnames": "^2.5.1",
30
30
  "editorjs-html": "^3.4.3",
31
31
  "iterable-observer": "^1.0.1",
32
32
  "lodash": "^4.17.21",
33
- "mobx": ">=4 <6.11",
34
- "mobx-react": ">=6 <9.1",
35
- "mobx-react-helper": "^0.2.7",
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.9.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,54 +44,51 @@
44
44
  "react-dom": ">=16"
45
45
  },
46
46
  "devDependencies": {
47
- "@babel/plugin-proposal-class-properties": "^7.18.6",
48
- "@babel/plugin-proposal-decorators": "^7.23.6",
49
- "@microsoft/api-extractor": "^7.39.0",
50
- "@parcel/packager-ts": "~2.10.3",
51
- "@parcel/transformer-typescript-types": "~2.10.3",
52
- "@storybook/addon-console": "^2.0.0",
53
- "@storybook/addon-essentials": "^7.6.6",
54
- "@storybook/addon-interactions": "^7.6.6",
55
- "@storybook/addon-links": "^7.6.6",
56
- "@storybook/addon-storysource": "^7.6.6",
57
- "@storybook/blocks": "^7.6.6",
58
- "@storybook/react": "^7.6.6",
59
- "@storybook/react-vite": "^7.6.6",
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",
60
62
  "@storybook/testing-library": "^0.2.2",
61
63
  "@types/lodash": "^4.14.202",
62
- "@types/node": "^18.19.3",
64
+ "@types/node": "^18.19.10",
63
65
  "@types/prismjs": "^1.26.3",
64
- "@types/react": "^18.2.45",
66
+ "@types/react": "^18.2.48",
65
67
  "@types/react-dom": "^18.2.18",
66
- "@typescript-eslint/eslint-plugin": "^6.16.0",
67
- "@typescript-eslint/parser": "^6.16.0",
68
+ "@typescript-eslint/eslint-plugin": "^6.20.0",
69
+ "@typescript-eslint/parser": "^6.20.0",
68
70
  "@vitejs/plugin-react": "^4.2.1",
69
71
  "eslint": "^8.56.0",
70
72
  "eslint-config-prettier": "^9.1.0",
71
73
  "eslint-plugin-import": "^2.29.1",
72
74
  "eslint-plugin-simple-import-sort": "^10.0.0",
73
- "husky": "^8.0.3",
75
+ "husky": "^9.0.7",
74
76
  "koapache": "^2.2.2",
75
77
  "less": "^4.2.0",
76
78
  "lint-staged": "^15.2.0",
77
- "parcel": "~2.10.3",
79
+ "parcel": "~2.11.0",
78
80
  "postcss-preset-env": "^9.3.0",
79
- "prettier": "^3.1.1",
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
86
  "rimraf": "^5.0.5",
85
- "storybook": "^7.6.6",
86
- "typedoc": "^0.25.4",
87
- "typedoc-plugin-mdn-links": "^3.1.9",
87
+ "storybook": "^7.6.10",
88
+ "typedoc": "^0.25.7",
89
+ "typedoc-plugin-mdn-links": "^3.1.14",
88
90
  "typescript": "~5.3.3",
89
- "vite": "^5.0.10"
90
- },
91
- "pnpm": {
92
- "overrides": {
93
- "@storybook/addon-actions": "~7.5"
94
- }
91
+ "vite": "^5.0.12"
95
92
  },
96
93
  "prettier": {
97
94
  "singleQuote": true,
@@ -110,7 +107,7 @@
110
107
  }
111
108
  },
112
109
  "scripts": {
113
- "prepare": "husky install",
110
+ "prepare": "husky",
114
111
  "test": "lint-staged",
115
112
  "api-extractor": "tsc --project tsconfig.build.json --outDir dist/dts && api-extractor run && rimraf dist/dts",
116
113
  "pack-preview": "cd preview/ && rimraf ../.parcel-cache dist/ && parcel build --public-url=. --dist-dir=../docs/preview/",
package/source/Dialog.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Defer } from 'iterable-observer';
2
- import * as MobX from 'mobx';
2
+ import { observable } from 'mobx';
3
3
  import { observer } from 'mobx-react';
4
4
  import { FC } from 'react';
5
5
 
@@ -14,14 +14,12 @@ export interface DialogProps<T = any> {
14
14
  }
15
15
 
16
16
  export class Dialog<T = any> {
17
- @MobX.observable
18
- defer?: Defer<T> = undefined;
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} />);
26
24
  this.Component.displayName = 'DialogComponent';
27
25
  }
package/source/Editor.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { EditorCore, WrapperProps } from '@react-editor-js/core';
2
- import * as MobX from 'mobx';
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
- @MobX.observable
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
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import * as MobX from 'mobx';
2
+ import { computed, observable } from 'mobx';
3
3
  import { observer } from 'mobx-react';
4
4
  import { observePropsState } from 'mobx-react-helper';
5
5
  import { Component, ReactNode } from 'react';
@@ -38,24 +38,19 @@ export interface MonthCalendarProps
38
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
- @MobX.computed
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
- @MobX.observable
56
- currentDate = new Date();
50
+ @observable
51
+ accessor currentDate = new Date();
57
52
 
58
- @MobX.computed
53
+ @computed
59
54
  get dateGrid() {
60
55
  let startDate = new Date(this.currentDate);
61
56
  startDate.setDate(1);
@@ -1,4 +1,4 @@
1
- import * as MobX from 'mobx';
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
- constructor(props: PageNavProps) {
23
- super(props);
24
- MobX.makeObservable?.(this);
25
- }
26
-
27
- @MobX.observable
28
- list: HeadingMeta[] = [];
22
+ @observable
23
+ accessor list: HeadingMeta[] = [];
29
24
 
30
- @MobX.observable
31
- scrollY = 0;
25
+ @observable
26
+ accessor scrollY = 0;
32
27
 
33
- @MobX.computed
28
+ @computed
34
29
  get currentActiveId() {
35
30
  const { list, scrollY } = this;
36
31
  const index = list.findIndex(({ top }) => top > scrollY);
@@ -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
- export class TypeEcho extends PureComponent<TypeEchoProps, State> {
13
+ @observer
14
+ export class TypeEcho extends PureComponent<TypeEchoProps> {
13
15
  static displayName = 'TypeEcho';
14
16
 
15
- state: Readonly<State> = { echoed: '' };
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.setState({ echoed: this.state.echoed + char });
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.state;
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": "ES5",
3
+ "target": "ES6",
4
+ "moduleResolution": "Node",
4
5
  "esModuleInterop": true,
5
6
  "downlevelIteration": true,
6
- "experimentalDecorators": true,
7
+ "useDefineForClassFields": true,
7
8
  "jsx": "react-jsx",
8
9
  "skipLibCheck": true,
9
- "lib": ["ES2021", "DOM"]
10
+ "lib": ["ES2023", "DOM"]
10
11
  },
11
12
  "include": ["source/**/*", "stories/**/*"],
12
13
  "typedocOptions": {
@@ -1,17 +0,0 @@
1
- {
2
- "recommendations": [
3
- "yzhang.markdown-all-in-one",
4
- "jock.svg",
5
- "redhat.vscode-yaml",
6
- "clinyong.vscode-css-modules",
7
- "akamud.vscode-caniuse",
8
- "visualstudioexptteam.intellicode-api-usage-examples",
9
- "pflannery.vscode-versionlens",
10
- "christian-kohler.npm-intellisense",
11
- "esbenp.prettier-vscode",
12
- "rangav.vscode-thunder-client",
13
- "eamodio.gitlens",
14
- "github.vscode-pull-request-github",
15
- "github.vscode-github-actions"
16
- ]
17
- }