Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit 2bfa439

Browse files
author
crossjs
committed
isolated framework
1 parent 048f801 commit 2bfa439

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+367
-277
lines changed

packages/boilerplate-grommet/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"license": "MIT",
1919
"dependencies": {
2020
"@wugui/core": "*",
21-
"@wugui/framework-simple": "*",
21+
"@wugui/framework": "*",
22+
"@wugui/framework-hook": "*",
2223
"@wugui/hooks": "*",
2324
"@wugui/plugin-router": "*",
2425
"@wugui/utils": "*",
@@ -33,9 +34,9 @@
3334
"@craco/craco": "^5.2.4",
3435
"@types/classnames": "^2.2.9",
3536
"@types/jest": "^24.0.17",
36-
"@types/node": "^12.6.9",
37+
"@types/node": "^12.7.1",
3738
"@types/react-dom": "^16.8.5",
38-
"@types/react": "^16.8.24",
39+
"@types/react": "^16.8.25",
3940
"@types/styled-components": "^4.1.18",
4041
"react-scripts": "^3.0.1",
4142
"source-map-loader": "^0.2.4",
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
import { TPluginFunction } from "@wugui/core";
2-
import SimpleFramework from "@wugui/framework-simple";
1+
import { TCP } from "@wugui/core";
2+
import { IFO } from "@wugui/framework";
3+
import FrameworkHook from "@wugui/framework-hook";
34
import StorePlugin from "./plugins/store";
45
import ThemePlugin from "./plugins/theme";
56

67
const options = process.env.NODE_ENV === "production"
78
? require("./config/config.prod")
89
: require("./config/config.dev");
910

10-
export default class Framework extends SimpleFramework {
11-
public static plugins: TPluginFunction[] = [
11+
export default class Framework extends FrameworkHook {
12+
public static plugins: TCP[] = [
1213
StorePlugin,
1314
ThemePlugin,
1415
];
1516

16-
public static options: any = options.default;
17+
public static options: IFO = options.default;
1718
}

packages/boilerplate-grommet/src/framework/plugins/store/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

2-
import { ICoreHooks, IPluginOption } from "@wugui/core";
2+
import { ICH, IPO } from "@wugui/core";
33
import { initGlobalState } from "@wugui/hooks";
44
import { debug } from "@wugui/utils";
55

6-
export default ({ init }: ICoreHooks) => {
7-
init.tap("Store", ({ initialStates = [] }: IPluginOption) => {
6+
export default ({ init }: ICH) => {
7+
init.tap("Store", ({ initialStates = [] }: IPO) => {
88
if (process.env.NODE_ENV !== "production")
99
debug("Initialize global states: %O", initialStates);
1010

packages/boilerplate-grommet/src/framework/plugins/theme/Menu.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IModule, useParsed } from "@wugui/core";
1+
import { IModuleDescription, useParsed } from "@wugui/core";
22
import { useGlobalState } from "@wugui/hooks";
33
import { Link, useMatched } from "@wugui/plugin-router";
44
import { debug } from "@wugui/utils";
@@ -95,7 +95,7 @@ function createMenuItems(menu: any[], paths: string[]): ReactNode[] {
9595
/**
9696
* 获取需要显示的菜单树结构
9797
*/
98-
function getMenu(auth: string, modules: IModule[]): IMenu[] {
98+
function getMenu(auth: string, modules: IModuleDescription[]): IMenu[] {
9999
if (!cacheMap.has(auth)) {
100100
const menuData = getMenuData(auth, modules);
101101

@@ -107,7 +107,7 @@ function getMenu(auth: string, modules: IModule[]): IMenu[] {
107107
return cacheMap.get(auth);
108108
}
109109

110-
function getMenuData(auth: string, modules: IModule[]): IMenu[] {
110+
function getMenuData(auth: string, modules: IModuleDescription[]): IMenu[] {
111111
return modules
112112
// 过滤掉 路径带变量 的模块
113113
// 过滤掉无 标题 的模块

packages/boilerplate-grommet/src/framework/plugins/theme/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { ICoreHooks, IPluginOption } from "@wugui/core";
1+
import { ICH, IPO } from "@wugui/core";
22
import React, { ReactElement } from "react";
33
import Theme from "./Theme";
44

5-
export default ({ render }: ICoreHooks) => {
5+
export default ({ render }: ICH) => {
66
render.tap(
77
"Theme",
8-
(modules: ReactElement, option: IPluginOption): ReactElement => {
8+
(modules: ReactElement, option: IPO): ReactElement => {
99
return (
1010
<Theme
1111
option={option}

packages/boilerplate-grommet/yarn.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -1334,10 +1334,10 @@
13341334
dependencies:
13351335
"@types/jest-diff" "*"
13361336

1337-
"@types/node@^12.6.9":
1338-
version "12.6.9"
1339-
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-12.6.9.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-12.6.9.tgz#ffeee23afdc19ab16e979338e7b536fdebbbaeaf"
1340-
integrity sha1-/+7iOv3BmrFul5M457U2/eu7rq8=
1337+
"@types/node@^12.7.1":
1338+
version "12.7.1"
1339+
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-12.7.1.tgz?cache=0&sync_timestamp=1565213600002&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-12.7.1.tgz#3b5c3a26393c19b400844ac422bd0f631a94d69d"
1340+
integrity sha1-O1w6Jjk8GbQAhErEIr0PYxqU1p0=
13411341

13421342
"@types/prop-types@*":
13431343
version "15.7.1"
@@ -1372,10 +1372,10 @@
13721372
"@types/prop-types" "*"
13731373
csstype "^2.2.0"
13741374

1375-
"@types/react@^16.8.24":
1376-
version "16.8.24"
1377-
resolved "https://registry.npm.taobao.org/@types/react/download/@types/react-16.8.24.tgz#8d1ea1fcbfa214220da3d3c04e506f1077b0deac"
1378-
integrity sha1-jR6h/L+iFCINo9PATlBvEHew3qw=
1375+
"@types/react@^16.8.25":
1376+
version "16.8.25"
1377+
resolved "https://registry.npm.taobao.org/@types/react/download/@types/react-16.8.25.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Freact%2Fdownload%2F%40types%2Freact-16.8.25.tgz#0247613ab58b1b11ba10fed662e1947c5f2bb89c"
1378+
integrity sha1-AkdhOrWLGxG6EP7WYuGUfF8ruJw=
13791379
dependencies:
13801380
"@types/prop-types" "*"
13811381
csstype "^2.2.0"

packages/boilerplate-mui/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@
1313
<Router>
1414
<Theme layout>
1515
<Switch modules> -> <Matched> - 匹配到的模块
16-
<Auth modules> ->
1716
```

packages/boilerplate-mui/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
"dependencies": {
2020
"@material-ui/core": "^4.3.1",
2121
"@material-ui/icons": "^4.2.1",
22-
"@mdi/svg": "^3.8.95",
22+
"@mdi/svg": "^3.9.97",
2323
"@wugui/core": "*",
24-
"@wugui/framework-simple": "*",
24+
"@wugui/framework": "*",
25+
"@wugui/framework-hook": "*",
2526
"@wugui/hooks": "*",
2627
"@wugui/plugin-router": "*",
2728
"@wugui/utils": "*",
@@ -34,9 +35,9 @@
3435
"devDependencies": {
3536
"@craco/craco": "^5.2.4",
3637
"@types/jest": "^24.0.17",
37-
"@types/node": "^12.6.9",
38+
"@types/node": "^12.7.1",
3839
"@types/react-dom": "^16.8.5",
39-
"@types/react": "^16.8.24",
40+
"@types/react": "^16.8.25",
4041
"@types/styled-components": "^4.1.18",
4142
"react-scripts": "^3.0.1",
4243
"source-map-loader": "^0.2.4",
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
import { TPluginFunction } from "@wugui/core";
2-
import SimpleFramework from "@wugui/framework-simple";
1+
import { TCP } from "@wugui/core";
2+
import { IFO } from "@wugui/framework";
3+
import FrameworkHook from "@wugui/framework-hook";
34
import StorePlugin from "./plugins/store";
45
import ThemePlugin from "./plugins/theme";
56

67
const options = process.env.NODE_ENV === "production"
78
? require("./config/config.prod")
89
: require("./config/config.dev");
910

10-
export default class Framework extends SimpleFramework {
11-
public static plugins: TPluginFunction[] = [
11+
export default class Framework extends FrameworkHook {
12+
public static plugins: TCP[] = [
1213
StorePlugin,
1314
ThemePlugin,
1415
];
1516

16-
public static options: any = options.default;
17+
public static options: IFO = options.default;
1718
}

packages/boilerplate-mui/src/framework/plugins/store/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

2-
import { ICoreHooks, IPluginOption } from "@wugui/core";
2+
import { ICH, IPO } from "@wugui/core";
33
import { initGlobalState } from "@wugui/hooks";
44
import { debug } from "@wugui/utils";
55

6-
export default ({ init }: ICoreHooks) => {
7-
init.tap("Store", ({ initialStates = [] }: IPluginOption) => {
6+
export default ({ init }: ICH) => {
7+
init.tap("Store", ({ initialStates = [] }: IPO) => {
88
if (process.env.NODE_ENV !== "production")
99
debug("Initialize global states: %O", initialStates);
1010

packages/boilerplate-mui/src/framework/plugins/theme/Menu.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Collapse, List, ListItem, ListItemIcon, ListItemText, Theme } from "@material-ui/core";
22
import { ExpandLess, ExpandMore, Remove } from "@material-ui/icons";
33
import { createStyles, makeStyles } from "@material-ui/styles";
4-
import { IModule, useParsed } from "@wugui/core";
4+
import { IModuleDescription, useParsed } from "@wugui/core";
55
import { useGlobalState } from "@wugui/hooks";
66
import { Link, useMatched } from "@wugui/plugin-router";
77
import { debug } from "@wugui/utils";
@@ -117,7 +117,7 @@ function MenuList(props: any): ReactElement {
117117
/**
118118
* 获取需要显示的菜单树结构
119119
*/
120-
function getMenu(auth: string, modules: IModule[]): IMenu[] {
120+
function getMenu(auth: string, modules: IModuleDescription[]): IMenu[] {
121121
if (!cacheMap.has(auth)) {
122122
const menuData = getMenuData(auth, modules);
123123

@@ -129,7 +129,7 @@ function getMenu(auth: string, modules: IModule[]): IMenu[] {
129129
return cacheMap.get(auth);
130130
}
131131

132-
function getMenuData(auth: string, modules: IModule[]): IMenu[] {
132+
function getMenuData(auth: string, modules: IModuleDescription[]): IMenu[] {
133133
return modules
134134
// 过滤掉 路径带变量 的模块
135135
// 过滤掉无 标题 的模块

packages/boilerplate-mui/src/framework/plugins/theme/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { ICoreHooks, IPluginOption } from "@wugui/core";
1+
import { ICH, IPO } from "@wugui/core";
22
import React, { ReactElement } from "react";
33
import Root from "./Root";
44

5-
export default ({ render }: ICoreHooks) => {
5+
export default ({ render }: ICH) => {
66
render.tap(
77
"Theme",
8-
(modules: ReactElement, option: IPluginOption): ReactElement => {
8+
(modules: ReactElement, option: IPO): ReactElement => {
99
return (
1010
<Root
1111
option={option}

packages/boilerplate-mui/yarn.lock

+13-34
Original file line numberDiff line numberDiff line change
@@ -1182,17 +1182,6 @@
11821182
dependencies:
11831183
"@babel/runtime" "^7.2.0"
11841184

1185-
"@material-ui/lab@^4.0.0-alpha.22":
1186-
version "4.0.0-alpha.22"
1187-
resolved "https://registry.npm.taobao.org/@material-ui/lab/download/@material-ui/lab-4.0.0-alpha.22.tgz#918f76e41a9aa9a427e5987ea9cc089f49fcd951"
1188-
integrity sha1-kY925BqaqaQn5Zh+qcwIn0n82VE=
1189-
dependencies:
1190-
"@babel/runtime" "^7.4.4"
1191-
"@material-ui/utils" "^4.1.0"
1192-
clsx "^1.0.4"
1193-
prop-types "^15.7.2"
1194-
warning "^4.0.3"
1195-
11961185
"@material-ui/styles@^4.3.0":
11971186
version "4.3.0"
11981187
resolved "https://registry.npm.taobao.org/@material-ui/styles/download/@material-ui/styles-4.3.0.tgz#27f11fbf061d8a20ad5703acb0dbb0e69cc00345"
@@ -1243,10 +1232,10 @@
12431232
prop-types "^15.7.2"
12441233
react-is "^16.8.6"
12451234

1246-
"@mdi/svg@^3.8.95":
1247-
version "3.8.95"
1248-
resolved "https://registry.npm.taobao.org/@mdi/svg/download/@mdi/svg-3.8.95.tgz#174a0de996e057d6ca1f1d956cff4d1b96df4e10"
1249-
integrity sha1-F0oN6ZbgV9bKHx2VbP9NG5bfThA=
1235+
"@mdi/svg@^3.9.97":
1236+
version "3.9.97"
1237+
resolved "https://registry.npm.taobao.org/@mdi/svg/download/@mdi/svg-3.9.97.tgz#653fb2249e47c62bd89664ab1479eb5e16a3051c"
1238+
integrity sha1-ZT+yJJ5HxivYlmSrFHnrXhajBRw=
12501239

12511240
"@mrmlnc/readdir-enhanced@^2.2.1":
12521241
version "2.2.1"
@@ -1397,11 +1386,6 @@
13971386
dependencies:
13981387
"@babel/types" "^7.3.0"
13991388

1400-
"@types/classnames@^2.2.9":
1401-
version "2.2.9"
1402-
resolved "https://registry.npm.taobao.org/@types/classnames/download/@types/classnames-2.2.9.tgz?cache=0&sync_timestamp=1562086035227&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fclassnames%2Fdownload%2F%40types%2Fclassnames-2.2.9.tgz#d868b6febb02666330410fe7f58f3c4b8258be7b"
1403-
integrity sha1-2Gi2/rsCZmMwQQ/n9Y88S4JYvns=
1404-
14051389
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
14061390
version "2.0.1"
14071391
resolved "https://registry.npm.taobao.org/@types/istanbul-lib-coverage/download/@types/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
@@ -1434,10 +1418,10 @@
14341418
dependencies:
14351419
"@types/jest-diff" "*"
14361420

1437-
"@types/node@^12.6.9":
1438-
version "12.6.9"
1439-
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-12.6.9.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-12.6.9.tgz#ffeee23afdc19ab16e979338e7b536fdebbbaeaf"
1440-
integrity sha1-/+7iOv3BmrFul5M457U2/eu7rq8=
1421+
"@types/node@^12.7.1":
1422+
version "12.7.1"
1423+
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-12.7.1.tgz?cache=0&sync_timestamp=1565213600002&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-12.7.1.tgz#3b5c3a26393c19b400844ac422bd0f631a94d69d"
1424+
integrity sha1-O1w6Jjk8GbQAhErEIr0PYxqU1p0=
14411425

14421426
"@types/prop-types@*":
14431427
version "15.7.1"
@@ -1479,10 +1463,10 @@
14791463
"@types/prop-types" "*"
14801464
csstype "^2.2.0"
14811465

1482-
"@types/react@^16.8.24":
1483-
version "16.8.24"
1484-
resolved "https://registry.npm.taobao.org/@types/react/download/@types/react-16.8.24.tgz#8d1ea1fcbfa214220da3d3c04e506f1077b0deac"
1485-
integrity sha1-jR6h/L+iFCINo9PATlBvEHew3qw=
1466+
"@types/react@^16.8.25":
1467+
version "16.8.25"
1468+
resolved "https://registry.npm.taobao.org/@types/react/download/@types/react-16.8.25.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Freact%2Fdownload%2F%40types%2Freact-16.8.25.tgz#0247613ab58b1b11ba10fed662e1947c5f2bb89c"
1469+
integrity sha1-AkdhOrWLGxG6EP7WYuGUfF8ruJw=
14861470
dependencies:
14871471
"@types/prop-types" "*"
14881472
csstype "^2.2.0"
@@ -2678,11 +2662,6 @@ class-utils@^0.3.5:
26782662
isobject "^3.0.0"
26792663
static-extend "^0.1.1"
26802664

2681-
classnames@^2.2.6:
2682-
version "2.2.6"
2683-
resolved "https://registry.npm.taobao.org/classnames/download/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce"
2684-
integrity sha1-Q5Nb/90pHzJtrQogUwmzjQD2UM4=
2685-
26862665
26872666
version "4.2.1"
26882667
resolved "https://registry.npm.taobao.org/clean-css/download/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17"
@@ -9986,7 +9965,7 @@ walker@^1.0.7, walker@~1.0.5:
99869965
dependencies:
99879966
makeerror "1.0.x"
99889967

9989-
warning@^4.0.1, warning@^4.0.3:
9968+
warning@^4.0.1:
99909969
version "4.0.3"
99919970
resolved "https://registry.npm.taobao.org/warning/download/warning-4.0.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwarning%2Fdownload%2Fwarning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
99929971
integrity sha1-Fungd+uKhtavfWSqHgX9hbRnjKM=

packages/core/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 🐢 Core

packages/core/package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
},
1111
"license": "MIT",
1212
"dependencies": {
13-
"@wugui/utils": "*",
14-
"lodash": "^4.17.15"
13+
"@wugui/utils": "*"
1514
},
1615
"devDependencies": {
17-
"@types/lodash": "^4.14.136",
18-
"@types/node": "^12.6.9",
19-
"@types/react": "^16.8.24",
16+
"@types/node": "^12.7.1",
17+
"@types/react": "^16.8.25",
2018
"@types/react-dom": "^16.8.5"
2119
},
2220
"peerDependencies": {

0 commit comments

Comments
 (0)