inl-ui 0.1.60 → 0.1.62

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 (286) hide show
  1. package/.babelrc +3 -0
  2. package/.gitignore +17 -0
  3. package/README.md +49 -49
  4. package/conf/build.ts +69 -0
  5. package/conf/buildDocs.ts +27 -0
  6. package/conf/buildtp.ts +54 -0
  7. package/conf/cp1.js +85 -0
  8. package/conf/modules.ts +44 -0
  9. package/conf/rollup.config.ts +131 -0
  10. package/conf/utils.ts +19 -0
  11. package/dist/components/index.cjs +63 -23
  12. package/dist/components/index.js +63 -23
  13. package/dist/hooks/index.cjs +50 -2
  14. package/dist/hooks/index.js +50 -2
  15. package/dist/iconfont.js +1 -1
  16. package/dist/index.cjs +64 -24
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +64 -24
  19. package/dist/style.css +1 -1
  20. package/dist/theme/index.js +70 -70
  21. package/dist/theme/scripts/dark-vars.js +21 -21
  22. package/dist/theme/scripts/default-vars.js +25 -25
  23. package/dist/theme/scripts/light-vars.js +22 -22
  24. package/dist/theme/style/color/bezierEasing.less +110 -110
  25. package/dist/theme/style/color/colorPalette.less +81 -81
  26. package/dist/theme/style/color/colors.less +162 -162
  27. package/dist/theme/style/color/tinyColor.less +1184 -1184
  28. package/dist/theme/style/compact.less +4 -4
  29. package/dist/theme/style/dark.less +4 -4
  30. package/dist/theme/style/default.less +4 -4
  31. package/dist/theme/style/index.less +2 -2
  32. package/dist/theme/style/index.tsx +2 -2
  33. package/dist/theme/style/themes/compact.less +295 -295
  34. package/dist/theme/style/themes/dark.less +790 -790
  35. package/dist/theme/style/themes/default.less +1067 -1067
  36. package/dist/theme/style/themes/index.less +7 -7
  37. package/dist/theme/style/themes/var-dark.less +343 -343
  38. package/dist/theme/style/themes/var-default.less +184 -184
  39. package/dist/theme/style/themes/variable.less +1122 -1122
  40. package/dist/theme/style/variable.less +4 -4
  41. package/dist/tplib/index.cjs +50 -2
  42. package/dist/tplib/index.js +50 -2
  43. package/dist/video/index.cjs +56 -2
  44. package/dist/video/index.js +56 -2
  45. package/dist/videoMobile/index.cjs +50 -2
  46. package/dist/videoMobile/index.js +50 -2
  47. package/global.d.ts +2 -0
  48. package/package.json +87 -87
  49. package/rollup.config.js +2 -0
  50. package/siteTp/index.html +13 -0
  51. package/siteTp/lay.tsx +53 -0
  52. package/siteTp/main.ts +11 -0
  53. package/siteTp/tsconfig.json +19 -0
  54. package/siteTp/vite.config.ts +36 -0
  55. package/src/assets/iconfont/index.js +1 -0
  56. package/src/assets/style/common/const.less +48 -0
  57. package/src/assets/style/common/font.less +72 -0
  58. package/src/assets/style/components/changeThemeSelect.less +25 -0
  59. package/src/assets/style/components/childLayout.less +92 -0
  60. package/src/assets/style/components/cloudVideo.less +9 -0
  61. package/src/assets/style/components/collapseTitle.less +24 -0
  62. package/src/assets/style/components/demo.less +5 -0
  63. package/src/assets/style/components/detailContainer.less +7 -0
  64. package/src/assets/style/components/headerMenu.less +123 -0
  65. package/src/assets/style/components/iconfonts.less +56 -0
  66. package/src/assets/style/components/index.less +18 -0
  67. package/src/assets/style/components/layout.less +429 -0
  68. package/src/assets/style/components/layoutSider.less +68 -0
  69. package/src/assets/style/components/llmChatBox.less +309 -0
  70. package/src/assets/style/components/login.less +430 -0
  71. package/src/assets/style/components/param-manager.less +56 -0
  72. package/src/assets/style/components/paramManagerV2.less +58 -0
  73. package/src/assets/style/components/peopleSelectCpn.less +78 -0
  74. package/src/assets/style/components/sszComment.less +18 -0
  75. package/src/assets/style/components/table.less +10 -0
  76. package/src/assets/style/components/video.less +304 -0
  77. package/src/assets/style/components/videoAlarm.less +278 -0
  78. package/src/assets/style/index.less +14 -0
  79. package/src/assets/style/reset.less +38 -0
  80. package/src/components/README.md +251 -0
  81. package/src/components/changeThemeSelect/README.md +5 -0
  82. package/src/components/changeThemeSelect/index.tsx +71 -0
  83. package/src/components/collapseTitle/README.md +12 -0
  84. package/src/components/collapseTitle/index.tsx +71 -0
  85. package/src/components/demo/README.md +3 -0
  86. package/src/components/demo/index.tsx +17 -0
  87. package/src/components/detailContainer/README.md +36 -0
  88. package/src/components/detailContainer/index.tsx +212 -0
  89. package/src/components/fontSelect/README.md +33 -0
  90. package/src/components/fontSelect/fonts.ts +22 -0
  91. package/src/components/fontSelect/index.tsx +41 -0
  92. package/src/components/gridForm/README.md +34 -0
  93. package/src/components/gridForm/helper.ts +45 -0
  94. package/src/components/gridForm/index.tsx +98 -0
  95. package/src/components/headerMenu/headerMenuItem.tsx +50 -0
  96. package/src/components/headerMenu/headerMenuTitle.tsx +32 -0
  97. package/src/components/headerMenu/index.tsx +142 -0
  98. package/src/components/iconFont/README.md +17 -0
  99. package/src/components/iconFont/icons.tsx +110 -0
  100. package/src/components/iconFont/index.tsx +6 -0
  101. package/src/components/importModal/README.md +15 -0
  102. package/src/components/importModal/index.tsx +141 -0
  103. package/src/components/index.ts +64 -0
  104. package/src/components/largeLanguageModel/answerStyle.ts +36 -0
  105. package/src/components/largeLanguageModel/chatBox.tsx +54 -0
  106. package/src/components/largeLanguageModel/components/answerBubble.tsx +213 -0
  107. package/src/components/largeLanguageModel/components/avatar.tsx +32 -0
  108. package/src/components/largeLanguageModel/components/input.tsx +95 -0
  109. package/src/components/largeLanguageModel/components/questionBubble.tsx +30 -0
  110. package/src/components/largeLanguageModel/components/speechRecognition.tsx +127 -0
  111. package/src/components/largeLanguageModel/device.ts +21 -0
  112. package/src/components/largeLanguageModel/index.ts +10 -0
  113. package/src/components/largeLanguageModel/layouts/bottom.tsx +36 -0
  114. package/src/components/largeLanguageModel/layouts/qaContext.tsx +82 -0
  115. package/src/components/largeLanguageModel/request.ts +29 -0
  116. package/src/components/largeLanguageModel/useQA.ts +146 -0
  117. package/src/components/layout/childLayout.tsx +302 -0
  118. package/src/components/layout/components/childHeader.tsx +84 -0
  119. package/src/components/layout/components/childHeaderDev.tsx +143 -0
  120. package/src/components/layout/components/childSideMenu.tsx +119 -0
  121. package/src/components/layout/components/header.tsx +199 -0
  122. package/src/components/layout/components/pageContent.tsx +448 -0
  123. package/src/components/layout/components/sideMenu.tsx +101 -0
  124. package/src/components/layout/components/tabList.tsx +445 -0
  125. package/src/components/layout/hooks/onAddExtraTabs.ts +31 -0
  126. package/src/components/layout/hooks/useActiveApp.ts +14 -0
  127. package/src/components/layout/hooks/useActiveMenu.ts +86 -0
  128. package/src/components/layout/hooks/useMicroApp.ts +67 -0
  129. package/src/components/layout/index.tsx +277 -0
  130. package/src/components/layout/table.tsx +33 -0
  131. package/src/components/layout/utils/menu.ts +126 -0
  132. package/src/components/login/README.md +19 -0
  133. package/src/components/login/box.tsx +295 -0
  134. package/src/components/login/index.tsx +117 -0
  135. package/src/components/login/leftImg.tsx +23 -0
  136. package/src/components/login/top-title.tsx +17 -0
  137. package/src/components/menuDetail/index.tsx +116 -0
  138. package/src/components/paramManager/README.md +3 -0
  139. package/src/components/paramManager/collapseContainer.tsx +54 -0
  140. package/src/components/paramManager/dynamicForm.tsx +134 -0
  141. package/src/components/paramManager/index.tsx +141 -0
  142. package/src/components/paramManager/proFormItem.tsx +197 -0
  143. package/src/components/paramManager/request.ts +42 -0
  144. package/src/components/paramManager/tabItem.tsx +194 -0
  145. package/src/components/paramManagerV2/README.md +23 -0
  146. package/src/components/paramManagerV2/fetch.ts +42 -0
  147. package/src/components/paramManagerV2/index.tsx +124 -0
  148. package/src/components/paramManagerV2/paramItem.tsx +203 -0
  149. package/src/components/paramManagerV2/tabLevel.tsx +238 -0
  150. package/src/components/peopleSelect/depBreadcrumb.tsx +50 -0
  151. package/src/components/peopleSelect/index.tsx +300 -0
  152. package/src/components/peopleSelect/searchPeopleInput.tsx +69 -0
  153. package/src/components/peopleSelect/utils.ts +156 -0
  154. package/src/components/queryFormContainer/README.md +3 -0
  155. package/src/components/queryFormContainer/index.tsx +59 -0
  156. package/src/components/sszComment/http.ts +32 -0
  157. package/src/components/sszComment/index.tsx +147 -0
  158. package/src/components/undeveloped/index.tsx +17 -0
  159. package/src/components/video/README.md +53 -0
  160. package/src/components/video/alarmVideo.tsx +385 -0
  161. package/src/components/video/cloudVideo.tsx +98 -0
  162. package/src/components/video/index.ts +16 -0
  163. package/src/components/video/indexMobile.ts +2 -0
  164. package/src/components/video/pollingPlay.tsx +218 -0
  165. package/src/components/video/tree.tsx +342 -0
  166. package/src/components/video/videoBox.tsx +410 -0
  167. package/src/components/video/videoBoxV2.tsx +686 -0
  168. package/src/components/video/videoPlayerV1.tsx +133 -0
  169. package/src/components/video/videoPlayerV2.tsx +194 -0
  170. package/src/config/index.ts +7 -0
  171. package/src/directives/autoScroll.ts +87 -0
  172. package/src/directives/focus.ts +14 -0
  173. package/src/directives/index.ts +7 -0
  174. package/src/hooks/README.md +107 -0
  175. package/src/hooks/index.ts +18 -0
  176. package/src/hooks/useCacheExclude.ts +71 -0
  177. package/src/hooks/useEvent.ts +25 -0
  178. package/src/hooks/useModalVisible.ts +34 -0
  179. package/src/hooks/useNow.ts +25 -0
  180. package/src/hooks/usePoolingReq.ts +34 -0
  181. package/src/hooks/useQiankunState.ts +36 -0
  182. package/src/hooks/useQiankunStateValue.ts +29 -0
  183. package/src/hooks/useRouteActive.ts +12 -0
  184. package/src/hooks/useTableList.ts +87 -0
  185. package/src/hooks/useTableSelec.ts +65 -0
  186. package/src/hooks/useZoomAdaptation.ts +25 -0
  187. package/src/hooks/videoV1.ts +241 -0
  188. package/src/hooks/videoV2.ts +307 -0
  189. package/src/index.ts +27 -0
  190. package/src/priviteUtils/className.ts +16 -0
  191. package/src/priviteUtils/getIconFonts.ts +16 -0
  192. package/src/priviteUtils/installComponent.ts +24 -0
  193. package/src/priviteUtils/route.ts +49 -0
  194. package/src/tp-lib/README.md +240 -0
  195. package/src/tp-lib/TP3D.md +144 -0
  196. package/src/tp-lib/findAlarmDeviceById.ts +35 -0
  197. package/src/tp-lib/getAlarmingCamera.ts +132 -0
  198. package/src/tp-lib/getDeviceDetail.ts +467 -0
  199. package/src/tp-lib/index.ts +4 -0
  200. package/src/tp-lib/package.json +13 -0
  201. package/src/tpInit/index.ts +130 -0
  202. package/src/tpInit/utils.ts +1 -0
  203. package/src/types/gl.d.ts +24 -0
  204. package/src/types/global.d.ts +41 -0
  205. package/src/types/ht/ht-widget.d.ts +11327 -0
  206. package/src/types/ht/ht.d.ts +11410 -0
  207. package/src/types/ht/index.d.ts +4 -0
  208. package/src/types/shims-vue.d.ts +1 -0
  209. package/src/utils/README.md +175 -0
  210. package/src/utils/ZLMRTCClient.js +9075 -0
  211. package/src/utils/apiInstance.ts +128 -0
  212. package/src/utils/base64.ts +22 -0
  213. package/src/utils/changeTheme.ts +37 -0
  214. package/src/utils/file.ts +35 -0
  215. package/src/utils/format.ts +268 -0
  216. package/src/utils/index.ts +38 -0
  217. package/src/utils/login.ts +105 -0
  218. package/src/utils/microApp.ts +120 -0
  219. package/src/utils/ramdom.ts +43 -0
  220. package/src/utils/setRem.ts +16 -0
  221. package/src/utils/upload.ts +26 -0
  222. package/theme/index.html +14 -0
  223. package/theme/src/Layouts/index.tsx +14 -0
  224. package/theme/src/assets/iconfont/iconfont.css +771 -0
  225. package/theme/src/assets/iconfont/iconfont.js +1 -0
  226. package/theme/src/assets/iconfont/iconfont.json +1332 -0
  227. package/theme/src/assets/iconfont/iconfont.ttf +0 -0
  228. package/theme/src/assets/iconfont/iconfont.woff +0 -0
  229. package/theme/src/assets/iconfont/iconfont.woff2 +0 -0
  230. package/theme/src/assets/img/1.png +0 -0
  231. package/theme/src/assets/img/loginBackground.png +0 -0
  232. package/theme/src/assets/img/loginPicBig.png +0 -0
  233. package/theme/src/assets/img/logo.png +0 -0
  234. package/theme/src/assets/img/logoBig.png +0 -0
  235. package/theme/src/assets/img/ms.png +0 -0
  236. package/theme/src/assets/img/platformLogo.png +0 -0
  237. package/theme/src/assets/img/selected-menu.svg +18 -0
  238. package/theme/src/assets/logo.png +0 -0
  239. package/theme/src/assets/styles/const.less +1 -0
  240. package/theme/src/assets/styles/constant/antd.less +1 -0
  241. package/theme/src/assets/styles/index.less +22 -0
  242. package/theme/src/assets/styles/layout.less +99 -0
  243. package/theme/src/assets/styles/login.less +111 -0
  244. package/theme/src/assets/styles/loginBox.less +181 -0
  245. package/theme/src/assets/styles/pages/modelManager/index.less +3 -0
  246. package/theme/src/assets/styles/reset.less +36 -0
  247. package/theme/src/assets/test.less +4 -0
  248. package/theme/src/assets/zh-cn.js +134 -0
  249. package/theme/src/main.ts +14 -0
  250. package/theme/src/router/index.ts +15 -0
  251. package/theme/src/views/index.tsx +98 -0
  252. package/theme/src/views/login.tsx +25 -0
  253. package/theme/theme/index.js +70 -0
  254. package/theme/theme/scripts/dark-vars.js +21 -0
  255. package/theme/theme/scripts/default-vars.js +25 -0
  256. package/theme/theme/scripts/light-vars.js +22 -0
  257. package/theme/theme/style/color/bezierEasing.less +110 -0
  258. package/theme/theme/style/color/colorPalette.less +81 -0
  259. package/theme/theme/style/color/colors.less +162 -0
  260. package/theme/theme/style/color/tinyColor.less +1184 -0
  261. package/theme/theme/style/compact.less +4 -0
  262. package/theme/theme/style/dark.less +4 -0
  263. package/theme/theme/style/default.less +4 -0
  264. package/theme/theme/style/index.less +2 -0
  265. package/theme/theme/style/index.tsx +2 -0
  266. package/theme/theme/style/themes/compact.less +295 -0
  267. package/theme/theme/style/themes/dark.less +790 -0
  268. package/theme/theme/style/themes/default.less +1067 -0
  269. package/theme/theme/style/themes/index.less +7 -0
  270. package/theme/theme/style/themes/var-dark.less +343 -0
  271. package/theme/theme/style/themes/var-default.less +184 -0
  272. package/theme/theme/style/themes/variable.less +1122 -0
  273. package/theme/theme/style/variable.less +4 -0
  274. package/theme/tsconfig.json +27 -0
  275. package/theme/vite.config.ts +32 -0
  276. package/tp-bundle/README.md +240 -0
  277. package/tp-bundle/TP3D.md +144 -0
  278. package/tp-bundle/index.c.js +73 -0
  279. package/tp-bundle/index.d.ts +272 -0
  280. package/tp-bundle/index.es.js +73 -0
  281. package/tp-bundle/index.iife.js +73 -0
  282. package/tp-bundle/package.json +13 -0
  283. package/tp-bundle.rar +0 -0
  284. package/tsconfig.json +27 -0
  285. package/yarn-error.log +4499 -0
  286. package/yarn.lock +4073 -0
package/.babelrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "plugins": ["@vue/babel-plugin-jsx"]
3
+ }
package/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ node_modules
2
+ .DS_Store
3
+ dist
4
+ tp-bundle
5
+ versions
6
+ dist-ssr
7
+ test-*
8
+ *.local
9
+ *.log
10
+ lib
11
+ mtip-factory
12
+ mtip-*
13
+ tpf
14
+ tpf-*
15
+ test-theme
16
+ quick-start-cra
17
+ transparent-management
package/README.md CHANGED
@@ -1,49 +1,49 @@
1
- # 工业PC ui库
2
-
3
- 前端通用库,包括组件、hooks、utils等。
4
-
5
- ### 运行
6
-
7
- + 开发模式 yarn dev
8
- + 生产打包 yarn build
9
- + 生成文档 yarn build:docs
10
- + 打包图扑工具 yarn buildtp
11
-
12
- ### 使用方法
13
-
14
- ```javascript
15
- import inl from 'inl-ui';
16
- import 'inl-ui/dist/style.css';
17
-
18
- vue.use(inl)
19
- ```
20
-
21
-
22
-
23
- ### 激活主题
24
-
25
- **vite.config.ts**
26
-
27
- ```javascript
28
- const additionalData = require("inl-ui/dist/theme").default;
29
-
30
- ...
31
-
32
- css: {
33
- preprocessorOptions: {
34
- less: {
35
- javascriptEnabled: true,
36
- additionalData,
37
- },
38
- },
39
- },
40
- ```
41
-
42
- ### 文档链接
43
-
44
- ##### [组件文档](./src/components/README.md)
45
-
46
- ##### [hooks文档](./src/hooks/README.md)
47
-
48
- ##### [Utils文档](./src/utils/README.md)
49
-
1
+ # 工业PC ui库
2
+
3
+ 前端通用库,包括组件、hooks、utils等。
4
+
5
+ ### 运行
6
+
7
+ + 开发模式 yarn dev
8
+ + 生产打包 yarn build
9
+ + 生成文档 yarn build:docs
10
+ + 打包图扑工具 yarn buildtp
11
+
12
+ ### 使用方法
13
+
14
+ ```javascript
15
+ import inl from 'inl-ui';
16
+ import 'inl-ui/dist/style.css';
17
+
18
+ vue.use(inl)
19
+ ```
20
+
21
+
22
+
23
+ ### 激活主题
24
+
25
+ **vite.config.ts**
26
+
27
+ ```javascript
28
+ const additionalData = require("inl-ui/dist/theme").default;
29
+
30
+ ...
31
+
32
+ css: {
33
+ preprocessorOptions: {
34
+ less: {
35
+ javascriptEnabled: true,
36
+ additionalData,
37
+ },
38
+ },
39
+ },
40
+ ```
41
+
42
+ ### 文档链接
43
+
44
+ ##### [组件文档](./src/components/README.md)
45
+
46
+ ##### [hooks文档](./src/hooks/README.md)
47
+
48
+ ##### [Utils文档](./src/utils/README.md)
49
+
package/conf/build.ts ADDED
@@ -0,0 +1,69 @@
1
+ import { execSync, exec } from "child_process";
2
+ import { writeFileSync } from "fs";
3
+ import inquirer from "inquirer";
4
+ import pkg from "../package.json";
5
+ import { getDefaultNextVersion, resolvePath } from "./utils";
6
+
7
+ const args = process.argv.slice(2);
8
+
9
+ export async function build() {
10
+ console.log(">>>>>>> 📦打包开始");
11
+
12
+ // 删除dist
13
+ execSync("npm run clean", { stdio: "inherit" });
14
+
15
+ // 开始打包
16
+ execSync(`yarn build:rollup ${args.join(" ")}`, { stdio: "inherit" });
17
+
18
+ // 复制主题
19
+ execSync("npm run cp:theme", { stdio: "inherit" });
20
+ console.log(">>>>>>> 📦打包成功");
21
+
22
+ // 发版逻辑
23
+ runPublish();
24
+ }
25
+
26
+ // 发版流程
27
+ async function runPublish() {
28
+ const { response } = await inquirer.prompt({
29
+ name: "response",
30
+ message: "是否发版",
31
+ type: "confirm",
32
+ });
33
+ if (!response) return;
34
+ // 获取输入的版本
35
+ const defalutNextVersion = getDefaultNextVersion();
36
+ const { version: versionInput } = await inquirer.prompt({
37
+ name: "version",
38
+ message: "请输入版本号",
39
+ type: "input",
40
+ default: defalutNextVersion,
41
+ });
42
+ // 修改package.json
43
+ const newPkg = { ...pkg, version: versionInput };
44
+ writeFileSync(
45
+ resolvePath("../package.json"),
46
+ JSON.stringify(newPkg, null, 2),
47
+ {
48
+ encoding: "utf-8",
49
+ }
50
+ );
51
+ console.log(">>>>>>> 版本号修改成功");
52
+ // 发版
53
+ try {
54
+ // 指定仓库 防止使用yarn执行会发布到yarn源
55
+ execSync("npm publish --registry https://registry.npmjs.org/", {
56
+ cwd: resolvePath(".."),
57
+ stdio: "inherit",
58
+ });
59
+ // 打开浏览器同步cnpm
60
+ const isWindows = process.platform === "win32";
61
+ exec(
62
+ `${isWindows ? "start" : "open"} https://npmmirror.com/sync/${pkg.name}`
63
+ );
64
+ } catch (e) {
65
+ process.exit(0);
66
+ }
67
+ }
68
+
69
+ build();
@@ -0,0 +1,27 @@
1
+ import path from "path";
2
+ import fg from "fast-glob";
3
+ import fs from "fs";
4
+
5
+ const docModules = ["components"];
6
+
7
+ /**
8
+ * 创建文档
9
+ * 把每个模块的单个文档集中到一个文档中
10
+ */
11
+ export default async function buildDocs() {
12
+ for (const module of docModules) {
13
+ const moduleRoot = path.resolve(__dirname, `../src/${module}`);
14
+ const docFiles = await fg("*/README.md", { cwd: moduleRoot });
15
+
16
+ let outputDoc = ``;
17
+ for (const mdPath of docFiles) {
18
+ const mdContent = fs.readFileSync(path.join(moduleRoot, mdPath), "utf-8");
19
+ outputDoc += `${mdContent} \n\n---\n\n`;
20
+ }
21
+ fs.writeFileSync(path.join(moduleRoot, "README.md"), outputDoc, {
22
+ encoding: "utf-8",
23
+ });
24
+ }
25
+ }
26
+
27
+ buildDocs();
@@ -0,0 +1,54 @@
1
+ import { rollup } from "rollup";
2
+ import esbuild from "rollup-plugin-esbuild";
3
+ import copy from "rollup-plugin-copy";
4
+ import dts from "rollup-plugin-dts";
5
+
6
+ const input = "src/tp-lib/index.ts";
7
+
8
+ // 打包图扑工具
9
+ export async function buildtp() {
10
+ const res = await rollup({
11
+ input,
12
+ plugins: [
13
+ esbuild({
14
+ drop: ["console", "debugger"],
15
+ minify: true,
16
+ treeShaking: true,
17
+ }),
18
+ copy({
19
+ targets: [
20
+ { src: "src/tp-lib/**/*.md", dest: "tp-bundle" },
21
+ { src: "src/tp-lib/**/*.json", dest: "tp-bundle" },
22
+ ],
23
+ }),
24
+ ],
25
+ });
26
+ res.write({
27
+ name: "tp-lib",
28
+ file: "tp-bundle/index.c.js",
29
+ format: "cjs",
30
+ });
31
+ res.write({
32
+ name: "tp-lib",
33
+ file: "tp-bundle/index.es.js",
34
+ format: "es",
35
+ });
36
+
37
+ res.write({
38
+ name: "tp-lib",
39
+ file: "tp-bundle/index.iife.js",
40
+ format: "iife",
41
+ extend: true,
42
+ });
43
+ const dtsCfg = await rollup({
44
+ input,
45
+ plugins: [dts()],
46
+ });
47
+ dtsCfg.write({
48
+ name: "tp-lib",
49
+ file: "tp-bundle/index.d.ts",
50
+ format: "cjs",
51
+ });
52
+ }
53
+
54
+ buildtp();
package/conf/cp1.js ADDED
@@ -0,0 +1,85 @@
1
+ var fs = require("fs");
2
+ var path = require("path");
3
+
4
+ const getPath = (p = "./") => {
5
+ return path.resolve(__dirname, p);
6
+ };
7
+ var copyFile = function (srcPath, tarPath, cb) {
8
+ var rs = fs.createReadStream(srcPath);
9
+ rs.on("error", function (err) {
10
+ if (err) {
11
+ console.log("read error", srcPath);
12
+ }
13
+ cb && cb(err);
14
+ });
15
+
16
+ var ws = fs.createWriteStream(tarPath);
17
+ ws.on("error", function (err) {
18
+ if (err) {
19
+ console.log("write error", tarPath);
20
+ }
21
+ cb && cb(err);
22
+ });
23
+ ws.on("close", function (ex) {
24
+ cb && cb(ex);
25
+ });
26
+
27
+ rs.pipe(ws);
28
+ };
29
+ var copyFolder = function (srcDir, tarDir, cb) {
30
+ fs.readdir(srcDir, function (err, files) {
31
+ var count = 0;
32
+ var checkEnd = function () {
33
+ ++count == files.length && cb && cb();
34
+ };
35
+
36
+ if (err) {
37
+ checkEnd();
38
+ return;
39
+ }
40
+
41
+ files.forEach(function (file) {
42
+ var srcPath = path.join(srcDir, file);
43
+ var tarPath = path.join(tarDir, file);
44
+
45
+ fs.stat(srcPath, function (err, stats) {
46
+ if (stats.isDirectory()) {
47
+ console.log("mkdir", tarPath);
48
+ fs.mkdir(tarPath, function (err) {
49
+ if (err) {
50
+ console.log(err);
51
+ return;
52
+ }
53
+
54
+ copyFolder(srcPath, tarPath, checkEnd);
55
+ });
56
+ } else {
57
+ copyFile(srcPath, tarPath, checkEnd);
58
+ }
59
+ });
60
+ });
61
+
62
+ //为空时直接回调
63
+ files.length === 0 && cb && cb();
64
+ });
65
+ };
66
+ const createDir = () => {
67
+ const path = getPath("../dist/theme");
68
+ fs.stat(path, async (err, res) => {
69
+ if (err) {
70
+ await fs.mkdirSync(path);
71
+ }
72
+ copyFolder(
73
+ getPath("../theme/theme"),
74
+ getPath("../dist/theme"),
75
+ function (err) {
76
+ if (err) {
77
+ return;
78
+ }
79
+
80
+ //continue
81
+ }
82
+ );
83
+ });
84
+ };
85
+ createDir();
@@ -0,0 +1,44 @@
1
+ const modules = [
2
+ {
3
+ name: "root",
4
+ entry: "src/index.ts",
5
+ description: "主包",
6
+ },
7
+ {
8
+ name: "utils",
9
+ entry: "src/utils/index.ts",
10
+ description: "工具集合",
11
+ },
12
+ {
13
+ name: "hooks",
14
+ entry: "src/hooks/index.ts",
15
+ description: "hooks",
16
+ },
17
+ {
18
+ name: "components",
19
+ entry: "src/components/index.ts",
20
+ description: "组件",
21
+ },
22
+ {
23
+ name: "directives",
24
+ entry: "src/directives/index.ts",
25
+ description: "自定义指令",
26
+ },
27
+ {
28
+ name: "tplib",
29
+ entry: "src/tp-lib/index.ts",
30
+ description: "图扑工具库",
31
+ },
32
+ {
33
+ name: "video",
34
+ entry: "src/components/video/index.ts",
35
+ description: "视频",
36
+ },
37
+ {
38
+ name: "videoMobile",
39
+ entry: "src/components/video/indexMobile.ts",
40
+ description: "视频移动端",
41
+ },
42
+ ];
43
+
44
+ export default modules;
@@ -0,0 +1,131 @@
1
+ import { defineConfig, RollupOptions } from "rollup";
2
+ import pkg from "../package.json";
3
+ import modules from "./modules";
4
+ import esbuild from "rollup-plugin-esbuild";
5
+ import dts from "rollup-plugin-dts";
6
+ import babel from "@rollup/plugin-babel";
7
+ import postcss from "rollup-plugin-postcss";
8
+ import cssnano from "cssnano";
9
+ import json from "@rollup/plugin-json";
10
+ import jsx from "acorn-jsx";
11
+ import copy from "rollup-plugin-copy";
12
+
13
+ const extensions = [".ts", ".js", ".tsx", ".json", ".ttf", ".woff", ".woff2"];
14
+ const externals = [
15
+ ...Object.keys(pkg.dependencies),
16
+ ...Object.keys(pkg.devDependencies),
17
+ ...Object.keys(pkg.peerDependencies),
18
+ /ant-design-vue\/*/,
19
+ /vite-plugin-qiankun\/*/,
20
+ "dayjs",
21
+ "@ant-design/icons-vue",
22
+ ];
23
+
24
+ const onwarn = (warning, rollupWarn) => {
25
+ if (warning.code !== "UNUSED_EXTERNAL_IMPORT") {
26
+ rollupWarn(warning);
27
+ }
28
+ };
29
+
30
+ const isProduction = process.env.BUILD === "production";
31
+
32
+ const configList: RollupOptions[] = [];
33
+
34
+ for (const module of modules) {
35
+ const isMainBundle = module.name === "root";
36
+
37
+ const babelPlugin = babel({ babelHelpers: "bundled", extensions });
38
+ const copyPlugin =
39
+ isMainBundle &&
40
+ copy({
41
+ targets: [
42
+ {
43
+ src: "src/assets/iconfont/index.js",
44
+ dest: "dist",
45
+ rename: "iconfont.js",
46
+ },
47
+ ],
48
+ verbose: true,
49
+ });
50
+ const esbuildPlugin = esbuild({
51
+ drop: isProduction ? ["console", "debugger"] : undefined,
52
+ });
53
+
54
+ // esm
55
+ configList.push({
56
+ input: module.entry,
57
+ output: {
58
+ file: `dist/${isMainBundle ? "index.js" : `${module.name}/index.js`}`,
59
+ format: "es",
60
+ name: module.name,
61
+ exports: "named",
62
+ },
63
+ plugins: [
64
+ json(),
65
+ esbuildPlugin,
66
+ babelPlugin,
67
+ postcss({ to: "dist/style.css", inject: false }),
68
+ copyPlugin,
69
+ ],
70
+ acornInjectPlugins: [jsx() as any],
71
+ external: externals,
72
+ onwarn,
73
+ });
74
+
75
+ // cjs
76
+ configList.push({
77
+ input: module.entry,
78
+ output: {
79
+ file: `dist/${isMainBundle ? "index.cjs" : `${module.name}/index.cjs`}`,
80
+ format: "cjs",
81
+ name: module.name,
82
+ exports: "named",
83
+ },
84
+ plugins: [
85
+ json(),
86
+ esbuildPlugin,
87
+ babelPlugin,
88
+ postcss({ plugins: [cssnano], extract: "style.css" }),
89
+ copyPlugin,
90
+ ],
91
+ acornInjectPlugins: [jsx() as any],
92
+ external: externals,
93
+ onwarn,
94
+ });
95
+
96
+ // // iife
97
+ // if (isMainBundle) {
98
+ // configList.push({
99
+ // input: module.entry,
100
+ // output: {
101
+ // file: `dist/${
102
+ // isMainBundle ? "index.min.js" : `${module.name}/index.min.js`
103
+ // }`,
104
+ // format: "iife",
105
+ // name: module.name,
106
+ // },
107
+ // plugins: [
108
+ // json(),
109
+ // esbuild({ minify: true, globalName: "inlUI" }),
110
+ // babelPlugin,
111
+ // postcss({ plugins: [cssnano], extract: "style.css" }),
112
+ // ],
113
+ // acornInjectPlugins: [jsx() as any],
114
+ // });
115
+ // }
116
+
117
+ // dts
118
+ configList.push({
119
+ input: module.entry,
120
+ output: {
121
+ file: `dist/${isMainBundle ? "index.d.ts" : `${module.name}/index.d.ts`}`,
122
+ format: "es",
123
+ name: module.name,
124
+ },
125
+ external: [/\.css$/, /\.less$/],
126
+ plugins: [json(), dts()],
127
+ acornInjectPlugins: [jsx() as any],
128
+ });
129
+ }
130
+
131
+ export default defineConfig(configList);
package/conf/utils.ts ADDED
@@ -0,0 +1,19 @@
1
+ import pkg from "../package.json";
2
+ import { resolve } from "path";
3
+
4
+ /**
5
+ * 获取当前版本的下一个版本
6
+ * @returns 新版本
7
+ */
8
+ export function getDefaultNextVersion() {
9
+ const version = pkg.version;
10
+ const versionList = version.split(".");
11
+ let lastV = Number(versionList[versionList.length - 1]);
12
+ lastV += 1;
13
+ versionList.splice(versionList.length - 1, 1, lastV + "");
14
+ return versionList.join(".");
15
+ }
16
+
17
+ export function resolvePath(p: string) {
18
+ return resolve(__dirname, p);
19
+ }