neko-ui 2.6.7 → 2.7.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.
Files changed (139) hide show
  1. package/CHANGELOG.md +24 -6
  2. package/es/@moneko/routes/index.d.ts +1 -1
  3. package/es/back-top/style.js +1 -3
  4. package/es/back-top/style.js.map +1 -1
  5. package/es/button/style.js.map +1 -1
  6. package/es/capture-screen/index.js +1 -1
  7. package/es/capture-screen/index.js.map +1 -1
  8. package/es/cron/begin-interval.d.ts +1 -0
  9. package/es/cron/index.js +1 -1
  10. package/es/cron/index.js.map +1 -1
  11. package/es/cron/item.d.ts +1 -0
  12. package/es/cron/period.d.ts +1 -0
  13. package/es/cron/some.d.ts +1 -0
  14. package/es/date-picker/index.js +1 -1
  15. package/es/date-picker/index.js.map +1 -1
  16. package/es/img/style.js +0 -2
  17. package/es/img/style.js.map +1 -1
  18. package/es/index.d.ts +1 -0
  19. package/es/index.js +1 -1
  20. package/es/index.js.map +1 -1
  21. package/es/md-style/index.js +6 -8
  22. package/es/md-style/index.js.map +1 -1
  23. package/es/modal/hooks.d.ts +5 -0
  24. package/es/modal/hooks.js +2 -0
  25. package/es/modal/hooks.js.map +1 -0
  26. package/es/modal/style.js +3 -4
  27. package/es/modal/style.js.map +1 -1
  28. package/es/notification/index.d.ts +59 -0
  29. package/es/notification/index.js +2 -0
  30. package/es/notification/index.js.map +1 -0
  31. package/es/notification/notification.d.ts +3 -0
  32. package/es/notification/notification.js +2 -0
  33. package/es/notification/notification.js.map +1 -0
  34. package/es/notification/queque.d.ts +46 -0
  35. package/es/notification/queque.js +2 -0
  36. package/es/notification/queque.js.map +1 -0
  37. package/es/notification/styles.d.ts +1 -0
  38. package/es/notification/styles.js +97 -0
  39. package/es/notification/styles.js.map +1 -0
  40. package/es/popover/index.js +1 -1
  41. package/es/popover/index.js.map +1 -1
  42. package/es/popover/style.js +1 -3
  43. package/es/popover/style.js.map +1 -1
  44. package/es/prism/css.js +1 -3
  45. package/es/prism/css.js.map +1 -1
  46. package/es/select/index.js +1 -1
  47. package/es/select/index.js.map +1 -1
  48. package/es/theme/index.js +10 -8
  49. package/es/theme/index.js.map +1 -1
  50. package/es/tree/index.d.ts +3 -99
  51. package/es/tree/index.js +1 -1
  52. package/es/tree/index.js.map +1 -1
  53. package/es/tree/register.d.ts +1 -0
  54. package/es/tree/register.js +2 -0
  55. package/es/tree/register.js.map +1 -0
  56. package/es/tree/type.d.ts +104 -0
  57. package/es/tree/type.js +2 -0
  58. package/es/tree/type.js.map +1 -0
  59. package/lib/@moneko/routes/index.d.ts +1 -1
  60. package/lib/back-top/style.js +1 -3
  61. package/lib/back-top/style.js.map +1 -1
  62. package/lib/button/style.js.map +1 -1
  63. package/lib/capture-screen/index.js +1 -1
  64. package/lib/capture-screen/index.js.map +1 -1
  65. package/lib/cron/begin-interval.d.ts +1 -0
  66. package/lib/cron/index.js +1 -1
  67. package/lib/cron/index.js.map +1 -1
  68. package/lib/cron/item.d.ts +1 -0
  69. package/lib/cron/period.d.ts +1 -0
  70. package/lib/cron/some.d.ts +1 -0
  71. package/lib/img/style.js +0 -2
  72. package/lib/img/style.js.map +1 -1
  73. package/lib/index.d.ts +1 -0
  74. package/lib/index.js +1 -1
  75. package/lib/index.js.map +1 -1
  76. package/lib/md-style/index.js +6 -8
  77. package/lib/md-style/index.js.map +1 -1
  78. package/lib/modal/hooks.d.ts +5 -0
  79. package/lib/modal/hooks.js +2 -0
  80. package/lib/modal/hooks.js.map +1 -0
  81. package/lib/modal/style.js +3 -4
  82. package/lib/modal/style.js.map +1 -1
  83. package/lib/notification/index.d.ts +59 -0
  84. package/lib/notification/index.js +2 -0
  85. package/lib/notification/index.js.map +1 -0
  86. package/lib/notification/notification.d.ts +3 -0
  87. package/lib/notification/notification.js +2 -0
  88. package/lib/notification/notification.js.map +1 -0
  89. package/lib/notification/queque.d.ts +46 -0
  90. package/lib/notification/queque.js +2 -0
  91. package/lib/notification/queque.js.map +1 -0
  92. package/lib/notification/styles.d.ts +1 -0
  93. package/lib/notification/styles.js +97 -0
  94. package/lib/notification/styles.js.map +1 -0
  95. package/lib/popover/index.js +1 -1
  96. package/lib/popover/index.js.map +1 -1
  97. package/lib/popover/style.js +1 -3
  98. package/lib/popover/style.js.map +1 -1
  99. package/lib/prism/css.js +1 -3
  100. package/lib/prism/css.js.map +1 -1
  101. package/lib/theme/index.js +8 -6
  102. package/lib/theme/index.js.map +1 -1
  103. package/lib/tree/index.d.ts +3 -99
  104. package/lib/tree/index.js +1 -1
  105. package/lib/tree/index.js.map +1 -1
  106. package/lib/tree/register.d.ts +1 -0
  107. package/lib/tree/register.js +2 -0
  108. package/lib/tree/register.js.map +1 -0
  109. package/lib/tree/type.d.ts +104 -0
  110. package/lib/tree/type.js +2 -0
  111. package/lib/tree/type.js.map +1 -0
  112. package/package.json +23 -21
  113. package/umd/index.js +1 -1
  114. package/es/@introduce/api.md +0 -158
  115. package/es/@introduce/getting-started/api.md +0 -34
  116. package/es/@introduce/html/doc.md +0 -45
  117. package/es/@introduce/react/doc.md +0 -49
  118. package/es/@introduce/solid/doc.md +0 -39
  119. package/es/@introduce/vue/doc.md +0 -54
  120. package/es/@moneko/cli/doc.md +0 -211
  121. package/es/@moneko/config/api.md +0 -213
  122. package/es/@moneko/locales/doc.md +0 -130
  123. package/es/@moneko/mock/api.md +0 -177
  124. package/es/@moneko/request/api.md +0 -31
  125. package/es/@moneko/routes/doc.md +0 -81
  126. package/es/@moneko/sso/api.md +0 -158
  127. package/lib/@introduce/api.md +0 -158
  128. package/lib/@introduce/getting-started/api.md +0 -34
  129. package/lib/@introduce/html/doc.md +0 -45
  130. package/lib/@introduce/react/doc.md +0 -49
  131. package/lib/@introduce/solid/doc.md +0 -39
  132. package/lib/@introduce/vue/doc.md +0 -54
  133. package/lib/@moneko/cli/doc.md +0 -211
  134. package/lib/@moneko/config/api.md +0 -213
  135. package/lib/@moneko/locales/doc.md +0 -130
  136. package/lib/@moneko/mock/api.md +0 -177
  137. package/lib/@moneko/request/api.md +0 -31
  138. package/lib/@moneko/routes/doc.md +0 -81
  139. package/lib/@moneko/sso/api.md +0 -158
@@ -1,177 +0,0 @@
1
- [TOC]
2
-
3
- # @moneko/mock
4
-
5
- !> 在项目启动目录 mock 文件夹下创建 mock 脚本,达到模拟响应数据的效果
6
-
7
- ## 函数方式
8
-
9
- !> (req: RequestFormData, res: Response) => void
10
-
11
- ```typescript
12
- import type { MockConfiguration } from '@moneko/mock';
13
-
14
- const conf: MockConfiguration = {
15
- 'GET /api/account': (req, res) => {
16
- const resp = {
17
- success: true,
18
- message: '请求成功',
19
- result: {
20
- inme: '人大',
21
- effte: '2022/7/1',
22
- },
23
- };
24
-
25
- res.status(200).send(resp);
26
- },
27
- };
28
-
29
- export default conf;
30
- ```
31
-
32
- ### 获取 Restful Api 参数
33
-
34
- ```typescript
35
- import type { MockConfiguration } from '@moneko/mock';
36
-
37
- const conf: MockConfiguration = {
38
- 'GET /api/account/:id': (req, res) => {
39
- const resp = {
40
- success: true,
41
- message: '请求成功',
42
- result: {
43
- id: req.params.id,
44
- csaa: '人额',
45
- currency: req.params.id,
46
- effee: '2022/7/1',
47
- },
48
- };
49
-
50
- res.status(200).send(resp);
51
- },
52
- };
53
-
54
- export default conf;
55
- ```
56
-
57
- ### 获取 POST 请求体数据
58
-
59
- ```typescript
60
- import type { MockConfiguration } from '@moneko/mock';
61
-
62
- const conf: MockConfiguration = {
63
- 'POST /api/login_by_username': (req, res) => {
64
- const resp = {
65
- status: 200,
66
- message: '请求成功',
67
- result: {
68
- password: req.body.password,
69
- username: req.body.username,
70
- },
71
- };
72
-
73
- res.status(resp.status).send(resp);
74
- },
75
- };
76
-
77
- export default conf;
78
- ```
79
-
80
- ### 模拟上传文件,返回文件 base64
81
-
82
- ```typescript
83
- import type { MockConfiguration } from '@moneko/core';
84
-
85
- const conf: MockConfiguration = {
86
- 'POST /api/upload_file': (req, res) => {
87
- const { files } = req;
88
-
89
- const strBase64 = Buffer.from(files[0].buffer).toString('base64');
90
-
91
- const resp = {
92
- status: 200,
93
- message: '上传成功',
94
- result: 'data:image/jpeg;base64,' + strBase64,
95
- };
96
-
97
- res.status(resp.status).send(resp);
98
- },
99
- };
100
-
101
- export default conf;
102
- ```
103
-
104
- ### 使用 YApi JSON Schema 生成数据
105
-
106
- ```typescript
107
- import { yApiSchemaMock } from '@moneko/mock';
108
- import type { MockConfiguration } from '@moneko/mock';
109
-
110
- const getYApiOption = (id: string) => {
111
- return {
112
- // yapi host
113
- host: 'http://yapihost',
114
- // yapi open api token
115
- token: 'yapi open api token',
116
- // yapi 接口id
117
- id,
118
- };
119
- };
120
-
121
- const conf: MockConfiguration = {
122
- 'POST /getids/list': async (req, res) => {
123
- const mockData = await yApiSchemaMock(getYApiOption('7610'), {
124
- result: {
125
- page: req.body.pageNum,
126
- itemsPerPage: req.body.pageSize,
127
- keyword: req.body.keyword,
128
- },
129
- });
130
-
131
- res.status(200).send(mockData);
132
- },
133
- };
134
-
135
- export default conf;
136
- ```
137
-
138
- ### 使用 YApi 高级 Mock
139
-
140
- ```typescript
141
- import { yApiMock } from '@moneko/mock';
142
- import type { MockConfiguration, YApiOption } from '@moneko/mock';
143
-
144
- const yApi: YApiOption = {
145
- // yapi host
146
- host: 'http://yapihost:8080',
147
- projectId: 143,
148
- pathRewrite: '^/api/',
149
- };
150
-
151
- const conf: MockConfiguration = {
152
- 'POST /api/getids/list': async (req, res) => {
153
- // 此时 mockData 将是来自 POST http://yapihost:8080/mock/143/getids/list 响应的数据
154
- const resp = await yApiMock(req, yApi);
155
-
156
- res.status(200).send(resp);
157
- },
158
- };
159
-
160
- export default conf;
161
- ```
162
-
163
- ## KV 方式
164
-
165
- ```typescript
166
- import type { MockConfiguration } from '@moneko/mock';
167
-
168
- const conf: MockConfiguration = {
169
- 'POST /api/use/fun': {
170
- status: 200,
171
- message: '上传成功',
172
- effectiveDate: '2022/7/1',
173
- },
174
- };
175
-
176
- export default conf;
177
- ```
@@ -1,31 +0,0 @@
1
- [TOC]
2
-
3
- # @moneko/request
4
-
5
- > 数据请求
6
-
7
- ## 设置响应拦截器、请求前缀
8
-
9
- ```typescript
10
- // @/services/index.ts
11
- import { extend } from '@moneko/request';
12
- export { request } from '@moneko/request';
13
-
14
- extend({
15
- interceptor: {
16
- response: (resp) => resp,
17
- },
18
- prefixUrl: '/api',
19
- });
20
- ```
21
-
22
- ## 调用 request 案例
23
-
24
- ```typescript
25
- import { request } from '@/services';
26
-
27
- // 实际访问 /api/list
28
- export const getApi = () => request('/list');
29
- // 实际访问 /api/list
30
- export const postApi = (params = {}) => request('/list', { data: params, method: 'POST' });
31
- ```
@@ -1,81 +0,0 @@
1
- [TOC]
2
-
3
- # 约定式路由
4
-
5
- > 通过内置的虚拟模块 @app/routes 获取约定式路由, 在编译期间动态生成,均采用懒加载;
6
-
7
- 1. 路由根据 `src/pages` 文件夹内的 `index.ts` 和 `index.tsx` 路径信息自动生成
8
- 2. 比如 `src/pages/user/index.tsx` 会生成一个 path 为 `/user/:id` 的路由
9
- 3. 文件夹名称以 `$` 开头将创建为动态路由
10
- 4. 比如 `src/pages/user/$id/index.tsx` 会生成一个 path 为 `/user/:id` 的动态路由
11
-
12
- <div style="display:flex;gap: 16px;align-items:center;">
13
-
14
- <div>
15
-
16
- ```treeview
17
- 项目根目录
18
- `-- src
19
- `-- pages
20
- |-- user
21
- | |-- $id
22
- | | `-- index.tsx
23
- | `-- index.tsx
24
- `-- index.tsx
25
- ```
26
-
27
- </div>
28
-
29
- 将创建出以下路由
30
-
31
- 1. `/`
32
- 2. `/user`
33
- 3. `/user/:id`
34
-
35
- </div>
36
-
37
- ## 使用
38
-
39
- > 或参考 [demo](https://github.com/monako97/demo-micro-app-solid)
40
-
41
- ## 读取路由数据
42
-
43
- ```ts
44
- import routes from '@app/routes';
45
-
46
- console.log(routes);
47
- ```
48
-
49
- ## 自定义路由
50
-
51
- !> 当创建的约定式路由不足以满足您的需求时, 您可以通过创建 `src/router/index.ts` 来对其进行补充, 最终通过 `@app/routes` 获取的数据将是合并后的路由数据
52
-
53
- ```js
54
- // src/router/index.ts
55
- import { lazy } from 'solid-js';
56
- import type { RouteConfig } from '@app/routes';
57
-
58
- const router: RouteConfig[] = [
59
- {
60
- path: '/',
61
- // 补充路由
62
- component: lazy(() => import('@/layout')),
63
- children: [
64
- // 自定义路由
65
- {
66
- path: 'about',
67
- children: [
68
- {
69
- path: '/',
70
- component: lazy(() => import('@/pages/home')),
71
- },
72
- ],
73
- },
74
- ],
75
- },
76
- ];
77
-
78
- export default router;
79
- ```
80
-
81
- > React 应用与 Solid应用稍有差别, 具体可参考 [React demo](https://github.com/monako97/demo-micro-app-react) 和 [Solid demo](https://github.com/monako97/demo-micro-app-solid)
@@ -1,158 +0,0 @@
1
- [TOC]
2
-
3
- # SSO React 共享状态对象
4
-
5
- > Shared Store Object `共享状态对象`
6
- > 通过 useSyncExternalStore 衔接的外部状态管理
7
-
8
- ## 安装依赖
9
-
10
- ```shell
11
- npm install shared-store-object -S
12
- # or
13
- yarn add shared-store-object -S
14
- ```
15
-
16
- ## 使用方式
17
-
18
- > 页面 render 后在任意位置使用, 可通过简单的方式进行创建、修改、回收(回收的对象将无法继续使用)
19
-
20
- ```jsx
21
- // 引入 或 import { sso } from '@moneko/react';
22
- import sso from 'shared-store-object';
23
-
24
- // 创建公共状态
25
- const like = sso({
26
- count: 0,
27
- inc() {
28
- store.count++;
29
- },
30
- });
31
-
32
- // 使用
33
- const App = () => {
34
- const { count, inc } = like;
35
-
36
- return (
37
- <div>
38
- <p>{count}</p>
39
- <button onClick={inc}>inc</button>
40
- {/* 直接修改 */}
41
- <button onClick={() => like.count++}>add</button>
42
- {/* 函数函数修改 */}
43
- <button onClick={() => like('count', (prev) => prev + 1)}>func</button>
44
- </div>
45
- );
46
- };
47
-
48
- // 也可以直接在 react 函数外操作
49
- like.count++;
50
- ```
51
-
52
- ## 计算属性
53
-
54
- > 在第二个入参中配置计算属性
55
-
56
- ```jsx
57
- // 使用
58
- const store = sso(
59
- {
60
- count: 0,
61
- inc() {
62
- store.count++;
63
- },
64
- },
65
- // 在这里配置计算属性
66
- {
67
- age() {
68
- return store.count * 2 + 1;
69
- },
70
- },
71
- );
72
-
73
- const App = () => {
74
- const { count, age } = store;
75
-
76
- return (
77
- <div>
78
- <p>count: {count}</p>
79
- <p>age: {age}</p>
80
- <button onClick={() => store.inc()}>add</button>
81
- </div>
82
- );
83
- };
84
- ```
85
-
86
- ## 回收
87
-
88
- > 当作 react 的 useState 来使用,并在组件卸载时手动回收
89
-
90
- ```jsx
91
- // 使用
92
- const App = () => {
93
- const store = useRef(sso({ count: 0 }));
94
- // 结构出 deps 对象
95
- const { count } = store.current;
96
-
97
- useEffect(() => {
98
- return () => {
99
- // 回收之后将无法继续使用store
100
- store.current();
101
- };
102
- }, []);
103
- return (
104
- <div>
105
- <p>{count}</p>
106
- <button onClick={() => store.count++}>add</button>
107
- </div>
108
- );
109
- };
110
- ```
111
-
112
- ## 配置项
113
-
114
- > 通过 `next` 参数传递的 `iteration` 函数决定是否需要进行迭代
115
-
116
- ### 全局
117
-
118
- > 所有的 sso 都将使用这个配置
119
-
120
- ```javascript
121
- sso.config({
122
- next(iteration, key, data) {
123
- console.log('global', key, data);
124
- // 不执行 iteration 函数数据将不会改变
125
- iteration();
126
- },
127
- });
128
- ```
129
-
130
- ### 私有
131
-
132
- > 为单独的对象设置私有的配置, 权限高于全局配置
133
-
134
- ```typescript
135
- const app = sso({
136
- count: 0,
137
- });
138
-
139
- app((): Partial<SSOConfig> => {
140
- return {
141
- next(iteration, key, data) {
142
- console.log('app', key, data);
143
- // 不执行 iteration 函数数据将不会改变
144
- iteration();
145
- },
146
- };
147
- });
148
- ```
149
-
150
- ## 批量更新
151
-
152
- > 当使用 React < 18 时使用批量更新。
153
-
154
- ```javascript
155
- sso.config({
156
- next: ReactDOM.unstable_batchedUpdates,
157
- });
158
- ```