@_tc/template-core 0.0.1-bate.36 → 0.0.1-bate.38

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 (419) hide show
  1. package/cjs/app/controller/base.js +3 -3
  2. package/cjs/app/controller/project.js +1 -1
  3. package/cjs/app/controller/view.js +16 -7
  4. package/cjs/app/middleware/api-params-verify.js +10 -1
  5. package/cjs/app/middleware/error-handle.js +9 -3
  6. package/cjs/app/middleware/project-handler.js +1 -1
  7. package/cjs/app/router/view.js +3 -1
  8. package/cjs/app/router-schema/project.js +1 -1
  9. package/cjs/app/service/project.js +5 -0
  10. package/cjs/bundler/defaultAlias.js +5 -0
  11. package/cjs/bundler/dev.js +4 -3
  12. package/cjs/bundler/index.js +2 -1
  13. package/cjs/bundler/prod.js +4 -3
  14. package/cjs/bundler/utils.js +52 -23
  15. package/cjs/packages/common/LRUCache.js +4 -0
  16. package/cjs/packages/common/array/index.js +43 -0
  17. package/cjs/packages/common/cache/LRUCache.js +45 -0
  18. package/cjs/packages/common/cache/index.js +4 -0
  19. package/cjs/packages/common/guards/index.js +34 -0
  20. package/cjs/packages/common/i18n/default.js +95 -0
  21. package/cjs/packages/common/i18n/en-US.js +95 -0
  22. package/cjs/packages/common/i18n/index.js +178 -0
  23. package/cjs/packages/common/i18n/locales.js +17 -0
  24. package/cjs/packages/common/i18n/types.js +1 -0
  25. package/cjs/packages/common/index.js +65 -0
  26. package/cjs/packages/common/log/index.js +160 -0
  27. package/cjs/packages/common/number/index.js +14 -0
  28. package/cjs/packages/common/object/filterEmpty.js +32 -0
  29. package/cjs/packages/common/object/filtereEmpty.js +5 -0
  30. package/cjs/packages/common/object/index.js +26 -0
  31. package/cjs/packages/common/string/index.js +17 -0
  32. package/cjs/packages/common/types/index.js +1 -0
  33. package/cjs/packages/core/index.js +18 -13
  34. package/cjs/packages/core/loader/config.js +4 -2
  35. package/cjs/packages/core/loader/controller.js +2 -3
  36. package/cjs/packages/core/loader/extend.js +1 -2
  37. package/cjs/packages/core/loader/middleware.js +2 -3
  38. package/cjs/packages/core/loader/model.js +10 -6
  39. package/cjs/packages/core/loader/router-schema.js +4 -2
  40. package/cjs/packages/core/loader/router.js +24 -11
  41. package/cjs/packages/core/loader/service.js +2 -2
  42. package/cjs/packages/utils/runFileFn.js +46 -1
  43. package/esm/app/controller/base.js +3 -3
  44. package/esm/app/controller/project.js +3 -3
  45. package/esm/app/controller/view.js +16 -7
  46. package/esm/app/middleware/api-params-verify.js +10 -1
  47. package/esm/app/middleware/error-handle.js +9 -3
  48. package/esm/app/middleware/project-handler.js +1 -1
  49. package/esm/app/router/view.js +3 -1
  50. package/esm/app/router-schema/project.js +1 -1
  51. package/esm/app/service/project.js +5 -0
  52. package/esm/bundler/defaultAlias.js +4 -0
  53. package/esm/bundler/dev.js +4 -3
  54. package/esm/bundler/index.js +2 -1
  55. package/esm/bundler/prod.js +4 -3
  56. package/esm/bundler/utils.js +52 -23
  57. package/esm/index.js +2 -2
  58. package/esm/packages/common/LRUCache.js +2 -0
  59. package/esm/packages/common/array/index.js +37 -0
  60. package/esm/packages/common/cache/LRUCache.js +43 -0
  61. package/esm/packages/common/cache/index.js +2 -0
  62. package/esm/packages/common/guards/index.js +26 -0
  63. package/esm/packages/common/i18n/default.js +93 -0
  64. package/esm/packages/common/i18n/en-US.js +93 -0
  65. package/esm/packages/common/i18n/index.js +162 -0
  66. package/esm/packages/common/i18n/locales.js +11 -0
  67. package/esm/packages/common/i18n/types.js +0 -0
  68. package/esm/packages/common/index.js +13 -0
  69. package/esm/packages/common/log/index.js +146 -0
  70. package/esm/packages/common/number/index.js +11 -0
  71. package/esm/packages/common/object/filterEmpty.js +29 -0
  72. package/esm/packages/common/object/filtereEmpty.js +2 -0
  73. package/esm/packages/common/object/index.js +20 -0
  74. package/esm/packages/common/string/index.js +13 -0
  75. package/esm/packages/common/types/index.js +0 -0
  76. package/esm/packages/core/index.js +18 -14
  77. package/esm/packages/core/loader/config.js +4 -3
  78. package/esm/packages/core/loader/controller.js +2 -4
  79. package/esm/packages/core/loader/extend.js +1 -3
  80. package/esm/packages/core/loader/middleware.js +2 -4
  81. package/esm/packages/core/loader/model.js +10 -7
  82. package/esm/packages/core/loader/router-schema.js +4 -3
  83. package/esm/packages/core/loader/router.js +24 -12
  84. package/esm/packages/core/loader/service.js +2 -3
  85. package/esm/packages/utils/runFileFn.js +47 -1
  86. package/fe/frontend/dash/Dashboard.d.ts +7 -0
  87. package/fe/frontend/dash/Dashboard.js +73 -0
  88. package/fe/frontend/dash/dash.entry.d.ts +2 -0
  89. package/fe/frontend/dash/dash.entry.js +80 -0
  90. package/fe/frontend/index.d.ts +3 -0
  91. package/fe/frontend/index.js +1 -0
  92. package/fe/frontend/main.css +2 -184
  93. package/fe/frontend/main.d.ts +10 -3
  94. package/fe/frontend/main.js +15 -4
  95. package/fe/frontend/testPage/testPage.entry.js +1 -2
  96. package/fe/frontend/typing/window.d.ts +7 -0
  97. package/fe/frontend/typing/window.js +1 -0
  98. package/fe/frontend/widgets/api/baseInfo.d.ts +31 -0
  99. package/fe/frontend/widgets/api/baseInfo.js +15 -0
  100. package/fe/frontend/widgets/common/CRUD/CRUD.d.ts +70 -0
  101. package/fe/frontend/widgets/common/CRUD/CRUD.js +208 -0
  102. package/fe/frontend/widgets/common/CRUD/index.d.ts +2 -0
  103. package/fe/frontend/widgets/common/CRUD/index.js +1 -0
  104. package/fe/frontend/widgets/common/auth/index.d.ts +7 -0
  105. package/fe/frontend/widgets/common/auth/index.js +20 -0
  106. package/fe/frontend/widgets/common/generateMenuData.d.ts +4 -0
  107. package/fe/frontend/widgets/common/generateMenuData.js +14 -0
  108. package/fe/frontend/widgets/common/importComponent.d.ts +5 -0
  109. package/fe/frontend/widgets/common/importComponent.js +8 -0
  110. package/fe/frontend/widgets/common/language.d.ts +2 -0
  111. package/fe/frontend/widgets/common/language.js +9 -0
  112. package/fe/frontend/widgets/common/logFn/index.d.ts +4 -0
  113. package/fe/frontend/widgets/common/logFn/index.js +8 -0
  114. package/fe/frontend/widgets/common/menu.d.ts +34 -0
  115. package/fe/frontend/widgets/common/menu.js +101 -0
  116. package/fe/frontend/widgets/common/request.d.ts +36 -0
  117. package/fe/frontend/widgets/common/request.js +133 -0
  118. package/fe/frontend/widgets/components/BasePage/HeaderView.d.ts +9 -0
  119. package/fe/frontend/widgets/components/BasePage/HeaderView.js +16 -0
  120. package/fe/frontend/widgets/components/Router/index.d.ts +9 -0
  121. package/fe/frontend/widgets/components/Router/index.js +11 -0
  122. package/fe/frontend/widgets/components/Router/type.d.ts +2 -0
  123. package/fe/frontend/widgets/components/Router/type.js +1 -0
  124. package/fe/frontend/widgets/defaultPages/Iframe/index.d.ts +3 -0
  125. package/fe/frontend/widgets/defaultPages/Iframe/index.js +14 -0
  126. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.d.ts +7 -0
  127. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.js +94 -0
  128. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.d.ts +13 -0
  129. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.js +124 -0
  130. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.d.ts +3 -0
  131. package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.js +6 -0
  132. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.d.ts +3 -0
  133. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.js +63 -0
  134. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.d.ts +11 -0
  135. package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.js +188 -0
  136. package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.d.ts +8 -0
  137. package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.js +6 -0
  138. package/fe/frontend/widgets/defaultPages/Schema/data/index.d.ts +3 -0
  139. package/fe/frontend/widgets/defaultPages/Schema/data/index.js +1 -0
  140. package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.d.ts +10 -0
  141. package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.js +14 -0
  142. package/fe/frontend/widgets/defaultPages/Schema/index.d.ts +3 -0
  143. package/fe/frontend/widgets/defaultPages/Schema/index.js +74 -0
  144. package/fe/frontend/widgets/defaultPages/Schema/schemaType.d.ts +50 -0
  145. package/fe/frontend/widgets/defaultPages/Schema/schemaType.js +4 -0
  146. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.d.ts +42 -0
  147. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.js +70 -0
  148. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.d.ts +47 -0
  149. package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.js +26 -0
  150. package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.d.ts +3 -0
  151. package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.js +8 -0
  152. package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.d.ts +3 -0
  153. package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.js +3 -0
  154. package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.d.ts +3 -0
  155. package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.js +115 -0
  156. package/fe/frontend/widgets/defaultPages/Schema/utils/validator.d.ts +7 -0
  157. package/fe/frontend/widgets/defaultPages/Schema/utils/validator.js +36 -0
  158. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +10 -0
  159. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +38 -0
  160. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.d.ts +3 -0
  161. package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.js +16 -0
  162. package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.d.ts +3 -0
  163. package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.js +17 -0
  164. package/fe/frontend/widgets/defaultPages/SlotPage/index.d.ts +3 -0
  165. package/fe/frontend/widgets/defaultPages/SlotPage/index.js +26 -0
  166. package/fe/frontend/widgets/defaultPages/Todo.d.ts +3 -0
  167. package/fe/frontend/widgets/defaultPages/Todo.js +5 -0
  168. package/fe/frontend/widgets/hooks/useCurrentMenuData.d.ts +19 -0
  169. package/fe/frontend/widgets/hooks/useCurrentMenuData.js +28 -0
  170. package/fe/frontend/widgets/hooks/useRouterParams.d.ts +5 -0
  171. package/fe/frontend/widgets/hooks/useRouterParams.js +11 -0
  172. package/fe/frontend/widgets/store/mode.d.ts +19 -0
  173. package/fe/frontend/widgets/store/mode.js +37 -0
  174. package/fe/model/types/data/button.d.ts +32 -0
  175. package/fe/model/types/data/button.js +16 -0
  176. package/fe/model/types/data/component.d.ts +61 -0
  177. package/fe/model/types/data/component.js +11 -0
  178. package/fe/model/types/data/fetchInfo.d.ts +20 -0
  179. package/fe/model/types/data/fetchInfo.js +1 -0
  180. package/fe/model/types/data/schema.d.ts +98 -0
  181. package/fe/model/types/data/schema.js +1 -0
  182. package/fe/model/types/data/search.d.ts +7 -0
  183. package/fe/model/types/data/search.js +1 -0
  184. package/fe/model/types/menuType.d.ts +73 -0
  185. package/fe/model/types/menuType.js +1 -0
  186. package/fe/model/types/model.d.ts +33 -0
  187. package/fe/model/types/model.js +1 -0
  188. package/fe/packages/common/array/index.d.ts +7 -0
  189. package/fe/packages/common/array/index.js +40 -0
  190. package/fe/packages/common/cache/LRUCache.d.ts +13 -0
  191. package/fe/packages/common/cache/LRUCache.js +47 -0
  192. package/fe/packages/common/cache/index.d.ts +2 -0
  193. package/fe/packages/common/cache/index.js +1 -0
  194. package/fe/packages/common/guards/index.d.ts +9 -0
  195. package/fe/packages/common/guards/index.js +24 -0
  196. package/fe/packages/common/i18n/default.d.ts +92 -0
  197. package/fe/packages/common/i18n/default.js +90 -0
  198. package/fe/packages/common/i18n/en-US.d.ts +92 -0
  199. package/fe/packages/common/i18n/en-US.js +90 -0
  200. package/fe/packages/common/i18n/index.d.ts +43 -0
  201. package/fe/packages/common/i18n/index.js +173 -0
  202. package/fe/packages/common/i18n/locales.d.ts +8 -0
  203. package/fe/packages/common/i18n/locales.js +10 -0
  204. package/fe/packages/common/i18n/types.d.ts +71 -0
  205. package/fe/packages/common/i18n/types.js +1 -0
  206. package/fe/packages/common/index.d.ts +10 -0
  207. package/fe/packages/common/index.js +9 -0
  208. package/fe/packages/common/log/index.d.ts +33 -0
  209. package/fe/packages/common/log/index.js +176 -0
  210. package/fe/packages/common/number/index.d.ts +3 -0
  211. package/fe/packages/common/number/index.js +10 -0
  212. package/fe/packages/common/object/filterEmpty.d.ts +3 -0
  213. package/fe/packages/common/object/filterEmpty.js +33 -0
  214. package/fe/packages/common/object/index.d.ts +5 -0
  215. package/fe/packages/common/object/index.js +25 -0
  216. package/fe/packages/common/string/index.d.ts +4 -0
  217. package/fe/packages/common/string/index.js +17 -0
  218. package/fe/packages/common/types/index.d.ts +4 -0
  219. package/fe/packages/common/types/index.js +1 -0
  220. package/fe/packages/ui/react/components/Button/Button.d.ts +29 -10
  221. package/fe/packages/ui/react/components/Button/Button.js +53 -23
  222. package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +2 -2
  223. package/fe/packages/ui/react/components/Button/SumbitButton.js +3 -10
  224. package/fe/packages/ui/react/components/Button/index.d.ts +1 -1
  225. package/fe/packages/ui/react/components/Checkbox/Checkbox.d.ts +1 -1
  226. package/fe/packages/ui/react/components/Checkbox/Checkbox.js +5 -3
  227. package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.js +11 -0
  228. package/fe/packages/ui/react/components/ConfirmDialog/index.d.ts +2 -0
  229. package/fe/packages/ui/react/components/ConfirmDialog/index.js +1 -0
  230. package/fe/packages/ui/react/components/DataTable/ActionBtn.d.ts +3 -1
  231. package/fe/packages/ui/react/components/DataTable/ActionBtn.js +85 -4
  232. package/fe/packages/ui/react/components/DataTable/{data-table.d.ts → index.d.ts} +10 -4
  233. package/fe/packages/ui/react/components/DataTable/{data-table.js → index.js} +58 -44
  234. package/fe/packages/ui/react/components/Date/Calendar.js +4 -3
  235. package/fe/packages/ui/react/components/Date/Date.d.ts +5 -3
  236. package/fe/packages/ui/react/components/Date/Date.js +71 -48
  237. package/fe/packages/ui/react/components/Date/TimePicker.js +3 -1
  238. package/fe/packages/ui/react/components/Date/dropdownPositioning.d.ts +3 -0
  239. package/fe/packages/ui/react/components/Date/dropdownPositioning.js +12 -0
  240. package/fe/packages/ui/react/components/Date/locales.d.ts +1 -0
  241. package/fe/packages/ui/react/components/Date/locales.js +7 -38
  242. package/fe/packages/ui/react/components/Drawer/Drawer.d.ts +29 -0
  243. package/fe/packages/ui/react/components/Drawer/Drawer.js +100 -0
  244. package/fe/packages/ui/react/components/Drawer/index.d.ts +3 -0
  245. package/fe/packages/ui/react/components/Drawer/index.js +1 -0
  246. package/fe/packages/ui/react/components/Dropdown/Dropdown.d.ts +25 -0
  247. package/fe/packages/ui/react/components/Dropdown/Dropdown.js +28 -0
  248. package/fe/packages/ui/react/components/Dropdown/index.d.ts +2 -0
  249. package/fe/packages/ui/react/components/Dropdown/index.js +1 -0
  250. package/fe/packages/ui/react/components/Form/Form.js +1 -1
  251. package/fe/packages/ui/react/components/Form/FormItem.js +1 -1
  252. package/fe/packages/ui/react/components/Form/SchemaForm/data.d.ts +45 -0
  253. package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/data.js +9 -1
  254. package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/index.d.ts +15 -14
  255. package/fe/packages/ui/react/components/Form/SchemaForm/index.js +79 -0
  256. package/fe/packages/ui/react/components/Form/index.d.ts +1 -1
  257. package/fe/packages/ui/react/components/Form/index.js +1 -1
  258. package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +15 -12
  259. package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +5 -2
  260. package/fe/packages/ui/react/components/Input/Input.d.ts +5 -1
  261. package/fe/packages/ui/react/components/Input/Input.js +5 -4
  262. package/fe/packages/ui/react/components/InputNumber/InputNumber.d.ts +28 -0
  263. package/fe/packages/ui/react/components/InputNumber/InputNumber.js +144 -0
  264. package/fe/packages/ui/react/components/InputNumber/index.d.ts +2 -0
  265. package/fe/packages/ui/react/components/InputNumber/index.js +1 -0
  266. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.d.ts +30 -0
  267. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.js +63 -0
  268. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.d.ts +2 -0
  269. package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.js +27 -0
  270. package/fe/packages/ui/react/components/Label/Label.js +2 -2
  271. package/fe/packages/ui/react/components/Menu/Menu.d.ts +18 -0
  272. package/fe/packages/ui/react/components/Menu/Menu.js +102 -0
  273. package/fe/packages/ui/react/components/Menu/MenuContext.d.ts +39 -0
  274. package/fe/packages/ui/react/components/Menu/MenuContext.js +97 -0
  275. package/fe/packages/ui/react/components/Menu/MenuItem.d.ts +3 -0
  276. package/fe/packages/ui/react/components/Menu/MenuItem.js +33 -0
  277. package/fe/packages/ui/react/components/Menu/SubMenu.d.ts +10 -0
  278. package/fe/packages/ui/react/components/Menu/SubMenu.js +169 -0
  279. package/fe/packages/ui/react/components/Menu/index.d.ts +9 -0
  280. package/fe/packages/ui/react/components/Menu/index.js +5 -0
  281. package/fe/packages/ui/react/components/Menu/menuTypes.d.ts +59 -0
  282. package/fe/packages/ui/react/components/Menu/menuTypes.js +1 -0
  283. package/fe/packages/ui/react/components/Menu/utils.d.ts +2 -0
  284. package/fe/packages/ui/react/components/Menu/utils.js +7 -0
  285. package/fe/packages/ui/react/components/Message/Message.js +4 -1
  286. package/fe/packages/ui/react/components/Modal/Modal.d.ts +3 -1
  287. package/fe/packages/ui/react/components/Modal/Modal.js +6 -43
  288. package/fe/packages/ui/react/components/Modal/ModalManager.js +4 -3
  289. package/fe/packages/ui/react/components/Overlay/Overlay.d.ts +23 -0
  290. package/fe/packages/ui/react/components/Overlay/Overlay.js +53 -0
  291. package/fe/packages/ui/react/components/Overlay/index.d.ts +3 -0
  292. package/fe/packages/ui/react/components/Overlay/index.js +1 -0
  293. package/fe/packages/ui/react/components/{Pagination.js → Pagination/Pagination.js} +4 -4
  294. package/fe/packages/ui/react/components/Pagination/index.d.ts +2 -0
  295. package/fe/packages/ui/react/components/Pagination/index.js +1 -0
  296. package/fe/packages/ui/react/components/Popup/Popup.d.ts +26 -0
  297. package/fe/packages/ui/react/components/Popup/Popup.js +81 -0
  298. package/fe/packages/ui/react/components/Popup/index.d.ts +2 -0
  299. package/fe/packages/ui/react/components/Popup/index.js +1 -0
  300. package/fe/packages/ui/react/components/Search/Search.d.ts +2 -2
  301. package/fe/packages/ui/react/components/Search/Search.js +3 -3
  302. package/fe/packages/ui/react/components/Select/Select.d.ts +5 -0
  303. package/fe/packages/ui/react/components/Select/Select.js +52 -109
  304. package/fe/packages/ui/react/components/Select/dropdownPositioning.d.ts +3 -0
  305. package/fe/packages/ui/react/components/Select/dropdownPositioning.js +13 -0
  306. package/fe/packages/ui/react/components/Skeleton/Skeleton.js +2 -2
  307. package/fe/packages/ui/react/components/Switch/Switch.js +3 -1
  308. package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +5 -4
  309. package/fe/packages/ui/react/components/TableSearch/TableSearch.js +23 -21
  310. package/fe/packages/ui/react/components/TableSearch/lang.js +5 -14
  311. package/fe/packages/ui/react/components/{Textarea.d.ts → Textarea/Textarea.d.ts} +11 -3
  312. package/fe/packages/ui/react/components/Textarea/Textarea.js +37 -0
  313. package/fe/packages/ui/react/components/Textarea/index.d.ts +2 -0
  314. package/fe/packages/ui/react/components/Textarea/index.js +1 -0
  315. package/fe/packages/ui/react/components/{Tooltip.d.ts → Tooltip/Tooltip.d.ts} +2 -2
  316. package/fe/packages/ui/react/components/Tooltip/Tooltip.js +79 -0
  317. package/fe/packages/ui/react/components/Tooltip/index.d.ts +2 -0
  318. package/fe/packages/ui/react/components/Tooltip/index.js +1 -0
  319. package/fe/packages/ui/react/components/{TreeSelect.js → TreeSelect/TreeSelect.js} +9 -11
  320. package/fe/packages/ui/react/components/TreeSelect/index.d.ts +2 -0
  321. package/fe/packages/ui/react/components/TreeSelect/index.js +1 -0
  322. package/fe/packages/ui/react/components/Upload/ImageUpload.js +18 -6
  323. package/fe/packages/ui/react/components/Upload/Upload.js +2 -1
  324. package/fe/packages/ui/react/components/{breadcrumb.js → breadcrumb/breadcrumb.js} +15 -12
  325. package/fe/packages/ui/react/components/breadcrumb/index.d.ts +2 -0
  326. package/fe/packages/ui/react/components/breadcrumb/index.js +1 -0
  327. package/fe/packages/ui/react/components/hooks/useDropdownPositioning.d.ts +49 -0
  328. package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +137 -0
  329. package/fe/packages/ui/react/components/index.d.ts +7 -1
  330. package/fe/packages/ui/react/components/index.js +7 -1
  331. package/fe/packages/ui/react/components/table/index.d.ts +2 -0
  332. package/fe/packages/ui/react/components/table/index.js +1 -0
  333. package/fe/packages/ui/react/components/table/table.js +20 -0
  334. package/fe/packages/ui/react/components/testPage/MenuTestPage.d.ts +2 -0
  335. package/fe/packages/ui/react/components/testPage/MenuTestPage.js +104 -0
  336. package/fe/packages/ui/react/components/testPage/index.js +277 -81
  337. package/fe/packages/ui/react/hooks/useExecuteOnce.d.ts +30 -0
  338. package/fe/packages/ui/react/hooks/useExecuteOnce.js +57 -0
  339. package/fe/packages/ui/react/hooks/useInit.d.ts +1 -1
  340. package/fe/packages/ui/react/hooks/useInit.js +1 -1
  341. package/fe/packages/ui/react/hooks/useLanguage.d.ts +1 -6
  342. package/fe/packages/ui/react/hooks/useRefState.d.ts +30 -0
  343. package/fe/packages/ui/react/hooks/useRefState.js +29 -0
  344. package/fe/packages/ui/react/hooks/useWatch.d.ts +23 -0
  345. package/fe/packages/ui/react/hooks/useWatch.js +87 -0
  346. package/fe/packages/ui/react/hooks/useWatch.test.d.ts +2 -0
  347. package/fe/packages/ui/react/hooks/useWatch.test.js +22 -0
  348. package/fe/packages/ui/react/i18n/I18nProvider.d.ts +31 -0
  349. package/fe/packages/ui/react/i18n/I18nProvider.js +25 -0
  350. package/fe/packages/ui/react/i18n/index.d.ts +4 -0
  351. package/fe/packages/ui/react/i18n/index.js +3 -0
  352. package/fe/packages/ui/react/i18n/useI18n.d.ts +13 -0
  353. package/fe/packages/ui/react/i18n/useI18n.js +18 -0
  354. package/fe/packages/ui/react/index.css +238 -0
  355. package/fe/packages/ui/react/index.d.ts +2 -0
  356. package/fe/packages/ui/react/index.js +2 -0
  357. package/fe/packages/ui/react/lib/createStoreHook.d.ts +9 -0
  358. package/fe/packages/ui/react/lib/createStoreHook.js +6 -0
  359. package/fe/packages/ui/react/lib/export.d.ts +2 -2
  360. package/fe/packages/ui/react/stores/language.d.ts +3 -12
  361. package/fe/packages/ui/react/stores/language.js +2 -51
  362. package/fe/typings/type.d.ts +5 -0
  363. package/fe/typings/type.js +1 -0
  364. package/model/index.d.ts +2 -0
  365. package/model/types/data/button.d.ts +32 -0
  366. package/model/types/data/component.d.ts +61 -0
  367. package/model/types/data/fetchInfo.d.ts +20 -0
  368. package/model/types/data/schema.d.ts +98 -0
  369. package/model/types/data/search.d.ts +7 -0
  370. package/model/types/index.d.ts +2 -0
  371. package/model/types/menuType.d.ts +73 -0
  372. package/model/types/model.d.ts +33 -0
  373. package/model/types/test.d.ts +2 -0
  374. package/package.json +20 -6
  375. package/types/app/controller/base.d.ts +3 -3
  376. package/types/app/router/view.d.ts +2 -3
  377. package/types/app/service/project.d.ts +29 -4
  378. package/types/app/type.d.ts +1 -0
  379. package/types/app/typings.d.ts +12 -21
  380. package/types/bundler/defaultAlias.d.ts +3 -0
  381. package/types/bundler/utils.d.ts +1 -1
  382. package/types/config/config.default.d.ts +14 -0
  383. package/types/packages/common/LRUCache.d.ts +1 -0
  384. package/types/packages/common/array/index.d.ts +6 -0
  385. package/types/packages/common/cache/LRUCache.d.ts +12 -0
  386. package/types/packages/common/cache/index.d.ts +1 -0
  387. package/types/packages/common/guards/index.d.ts +8 -0
  388. package/types/packages/common/i18n/default.d.ts +86 -0
  389. package/types/packages/common/i18n/en-US.d.ts +86 -0
  390. package/types/packages/common/i18n/index.d.ts +18 -0
  391. package/types/packages/common/i18n/locales.d.ts +7 -0
  392. package/types/packages/common/i18n/types.d.ts +46 -0
  393. package/types/packages/common/index.d.ts +9 -0
  394. package/types/packages/common/log/index.d.ts +32 -0
  395. package/types/packages/common/number/index.d.ts +2 -0
  396. package/types/packages/common/object/filterEmpty.d.ts +2 -0
  397. package/types/packages/common/object/filtereEmpty.d.ts +1 -0
  398. package/types/packages/common/object/index.d.ts +4 -0
  399. package/types/packages/common/string/index.d.ts +3 -0
  400. package/types/packages/common/types/index.d.ts +3 -0
  401. package/types/packages/core/index.d.ts +1 -1
  402. package/types/packages/core/loader/router.d.ts +1 -1
  403. package/types/packages/core/types.d.ts +12 -3
  404. package/types/packages/utils/runFileFn.d.ts +5 -3
  405. package/fe/packages/ui/react/components/ConfirmDialog.js +0 -9
  406. package/fe/packages/ui/react/components/Dropdown.d.ts +0 -16
  407. package/fe/packages/ui/react/components/Dropdown.js +0 -54
  408. package/fe/packages/ui/react/components/Form/SchemeForm/data.d.ts +0 -51
  409. package/fe/packages/ui/react/components/Form/SchemeForm/index.js +0 -69
  410. package/fe/packages/ui/react/components/Textarea.js +0 -35
  411. package/fe/packages/ui/react/components/Tooltip.js +0 -118
  412. package/fe/packages/ui/react/components/table.js +0 -20
  413. package/fe/packages/ui/react/locales/index.d.ts +0 -8
  414. package/fe/packages/ui/react/locales/index.js +0 -6
  415. /package/fe/packages/ui/react/components/{ConfirmDialog.d.ts → ConfirmDialog/ConfirmDialog.d.ts} +0 -0
  416. /package/fe/packages/ui/react/components/{Pagination.d.ts → Pagination/Pagination.d.ts} +0 -0
  417. /package/fe/packages/ui/react/components/{TreeSelect.d.ts → TreeSelect/TreeSelect.d.ts} +0 -0
  418. /package/fe/packages/ui/react/components/{breadcrumb.d.ts → breadcrumb/breadcrumb.d.ts} +0 -0
  419. /package/fe/packages/ui/react/components/{table.d.ts → table/table.d.ts} +0 -0
@@ -0,0 +1,43 @@
1
+ //#region packages/common/cache/LRUCache.ts
2
+ var LRUCache = class {
3
+ limit;
4
+ data;
5
+ constructor(limit) {
6
+ if (!Number.isInteger(limit) || limit <= 0) throw new Error("LRUCache limit must be a positive integer");
7
+ this.limit = limit;
8
+ this.data = /* @__PURE__ */ new Map();
9
+ }
10
+ get size() {
11
+ return this.data.size;
12
+ }
13
+ has(k) {
14
+ return this.data.has(k);
15
+ }
16
+ get(k) {
17
+ if (!this.data.has(k)) return void 0;
18
+ const value = this.data.get(k);
19
+ this.updateSorting(k, value);
20
+ return value;
21
+ }
22
+ set(k, v) {
23
+ if (this.data.has(k)) {
24
+ this.updateSorting(k, v);
25
+ return;
26
+ }
27
+ if (this.data.size >= this.limit) this.deleteFirstKey();
28
+ this.data.set(k, v);
29
+ }
30
+ push(k, v) {
31
+ this.set(k, v);
32
+ }
33
+ deleteFirstKey() {
34
+ const firstKey = this.data.keys().next().value;
35
+ if (firstKey !== void 0) this.data.delete(firstKey);
36
+ }
37
+ updateSorting(k, v) {
38
+ this.data.delete(k);
39
+ this.data.set(k, v);
40
+ }
41
+ };
42
+ //#endregion
43
+ export { LRUCache };
@@ -0,0 +1,2 @@
1
+ import { LRUCache } from "./LRUCache.js";
2
+ export { LRUCache };
@@ -0,0 +1,26 @@
1
+ //#region packages/common/guards/index.ts
2
+ var isNil = (value) => {
3
+ return value === null || value === void 0;
4
+ };
5
+ var isNonNullable = (value) => {
6
+ return value !== null && value !== void 0;
7
+ };
8
+ var isString = (value) => {
9
+ return typeof value === "string";
10
+ };
11
+ var isNumber = (value) => {
12
+ return typeof value === "number" && Number.isFinite(value);
13
+ };
14
+ var isBoolean = (value) => {
15
+ return typeof value === "boolean";
16
+ };
17
+ var isFunction = (value) => {
18
+ return typeof value === "function";
19
+ };
20
+ var isPlainObject = (value) => {
21
+ if (value === null || typeof value !== "object") return false;
22
+ const prototype = Object.getPrototypeOf(value);
23
+ return prototype === Object.prototype || prototype === null;
24
+ };
25
+ //#endregion
26
+ export { isBoolean, isFunction, isNil, isNonNullable, isNumber, isPlainObject, isString };
@@ -0,0 +1,93 @@
1
+ //#region packages/common/i18n/default.ts
2
+ /**
3
+ * UI 组件库默认中文语言资源。
4
+ *
5
+ * 这里只放组件内置文案,业务项目可以通过 I18nProvider.resources 覆盖或追加。
6
+ */
7
+ var defaultLanguageResources = {
8
+ common: {
9
+ tip: "提示",
10
+ confirm: "确认",
11
+ cancel: "取消",
12
+ close: "关闭",
13
+ submit: "提交",
14
+ reset: "重置"
15
+ },
16
+ components: {
17
+ breadcrumb: { close: "关闭" },
18
+ confirmDialog: {
19
+ title: "提示",
20
+ okText: "确认",
21
+ cancelText: "取消"
22
+ },
23
+ dataTable: { noData: "暂无数据" },
24
+ date: {
25
+ placeholder: "请选择日期",
26
+ placeholderDateTime: "请选择日期时间",
27
+ placeholderRange: "选择日期范围",
28
+ placeholderDateTimeRange: "选择日期时间范围",
29
+ weekDays: [
30
+ "日",
31
+ "一",
32
+ "二",
33
+ "三",
34
+ "四",
35
+ "五",
36
+ "六"
37
+ ],
38
+ selectTime: "选择时间",
39
+ startTime: "开始时间",
40
+ endTime: "结束时间",
41
+ confirm: "确认",
42
+ monthFormat: "yyyy年 M月",
43
+ quickRanges: "快速选择",
44
+ quickRangeToday: "今天",
45
+ quickRangeYesterday: "昨天",
46
+ quickRangeLast7Days: "近7天",
47
+ quickRangeLast30Days: "近30天",
48
+ quickRangeThisMonth: "本月",
49
+ quickRangeLastYear: "最近一年",
50
+ clear: "清除"
51
+ },
52
+ form: {
53
+ submit: "提交",
54
+ cancel: "取消"
55
+ },
56
+ imagePreview: {
57
+ closePreview: "关闭预览",
58
+ previousImage: "上一张",
59
+ nextImage: "下一张",
60
+ zoomOut: "缩小",
61
+ zoomIn: "放大",
62
+ reset: "重置",
63
+ rotateLeft: "左旋转",
64
+ rotateRight: "右旋转",
65
+ flipHorizontal: "左右镜像",
66
+ flipVertical: "上下镜像",
67
+ previewImage: "预览第{index}张"
68
+ },
69
+ modal: {
70
+ close: "关闭",
71
+ confirmTitle: "提示",
72
+ okText: "确认",
73
+ cancelText: "取消"
74
+ },
75
+ message: { close: "关闭" },
76
+ select: { empty: "暂无选项" },
77
+ tableSearch: {
78
+ reset: "重置",
79
+ search: "查询",
80
+ export: "导出Excel",
81
+ expand: "展开",
82
+ collapse: "收起",
83
+ exportCurrentPage: "当前页",
84
+ exportCurrentQuery: "当前查询条件"
85
+ },
86
+ upload: {
87
+ deleteImage: "删除图片",
88
+ upload: "上传"
89
+ }
90
+ }
91
+ };
92
+ //#endregion
93
+ export { defaultLanguageResources };
@@ -0,0 +1,93 @@
1
+ //#region packages/common/i18n/en-US.ts
2
+ /**
3
+ * UI component library default English language resources.
4
+ *
5
+ * Only built-in component copy belongs here. Applications can override or extend it with I18nProvider.resources.
6
+ */
7
+ var defaultEnglishResources = {
8
+ common: {
9
+ tip: "Prompt",
10
+ confirm: "Confirm",
11
+ cancel: "Cancel",
12
+ close: "Close",
13
+ submit: "Submit",
14
+ reset: "Reset"
15
+ },
16
+ components: {
17
+ breadcrumb: { close: "Close" },
18
+ confirmDialog: {
19
+ title: "Prompt",
20
+ okText: "Confirm",
21
+ cancelText: "Cancel"
22
+ },
23
+ dataTable: { noData: "No Data" },
24
+ date: {
25
+ placeholder: "Select date",
26
+ placeholderDateTime: "Select date and time",
27
+ placeholderRange: "Select date range",
28
+ placeholderDateTimeRange: "Select date and time range",
29
+ weekDays: [
30
+ "Sun",
31
+ "Mon",
32
+ "Tue",
33
+ "Wed",
34
+ "Thu",
35
+ "Fri",
36
+ "Sat"
37
+ ],
38
+ selectTime: "Select time",
39
+ startTime: "Start time",
40
+ endTime: "End time",
41
+ confirm: "Confirm",
42
+ monthFormat: "MMM yyyy",
43
+ quickRanges: "Quick ranges",
44
+ quickRangeToday: "Today",
45
+ quickRangeYesterday: "Yesterday",
46
+ quickRangeLast7Days: "Last 7 days",
47
+ quickRangeLast30Days: "Last 30 days",
48
+ quickRangeThisMonth: "This month",
49
+ quickRangeLastYear: "Last year",
50
+ clear: "Clear"
51
+ },
52
+ form: {
53
+ submit: "Submit",
54
+ cancel: "Cancel"
55
+ },
56
+ imagePreview: {
57
+ closePreview: "Close preview",
58
+ previousImage: "Previous image",
59
+ nextImage: "Next image",
60
+ zoomOut: "Zoom out",
61
+ zoomIn: "Zoom in",
62
+ reset: "Reset",
63
+ rotateLeft: "Rotate left",
64
+ rotateRight: "Rotate right",
65
+ flipHorizontal: "Flip horizontal",
66
+ flipVertical: "Flip vertical",
67
+ previewImage: "Preview image {index}"
68
+ },
69
+ modal: {
70
+ close: "Close",
71
+ confirmTitle: "Prompt",
72
+ okText: "Confirm",
73
+ cancelText: "Cancel"
74
+ },
75
+ message: { close: "Close" },
76
+ select: { empty: "No options" },
77
+ tableSearch: {
78
+ reset: "Reset",
79
+ search: "Search",
80
+ export: "Export Excel",
81
+ expand: "Expand",
82
+ collapse: "Collapse",
83
+ exportCurrentPage: "Current Page",
84
+ exportCurrentQuery: "Current Filters"
85
+ },
86
+ upload: {
87
+ deleteImage: "Delete image",
88
+ upload: "Upload"
89
+ }
90
+ }
91
+ };
92
+ //#endregion
93
+ export { defaultEnglishResources };
@@ -0,0 +1,162 @@
1
+ import { defaultLanguageResources } from "./default.js";
2
+ import { defaultEnglishResources } from "./en-US.js";
3
+ import { defaultLanguage, languageLocalKey, translations } from "./locales.js";
4
+ //#region packages/common/i18n/index.ts
5
+ var isPlainI18nDictionary = (value) => {
6
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
7
+ };
8
+ /**
9
+ * 深合并单个语言包。
10
+ * 嵌套对象递归合并,字符串、数组、数字等叶子节点直接以 patch 覆盖 base。
11
+ */
12
+ var mergeI18nDictionary = (base = {}, patch = {}) => {
13
+ const next = { ...base };
14
+ Object.entries(patch).forEach(([key, value]) => {
15
+ const current = next[key];
16
+ if (isPlainI18nDictionary(current) && isPlainI18nDictionary(value)) {
17
+ next[key] = mergeI18nDictionary(current, value);
18
+ return;
19
+ }
20
+ next[key] = value;
21
+ });
22
+ return next;
23
+ };
24
+ /**
25
+ * 合并多语言资源。
26
+ * 结构示例:{ 'zh-CN': { common: { ok: '确定' } }, 'en-US': { common: { ok: 'OK' } } }
27
+ */
28
+ var mergeI18nResources = (base = {}, patch = {}) => {
29
+ const next = { ...base };
30
+ Object.entries(patch).forEach(([language, messages]) => {
31
+ if (!messages) return;
32
+ next[language] = mergeI18nDictionary(next[language], messages);
33
+ });
34
+ return next;
35
+ };
36
+ /**
37
+ * 根据点分 key 从语言包中取值。
38
+ * 例如 common.submit 会读取 resources[language].common.submit。
39
+ */
40
+ var getI18nPathValue = (dictionary, key) => {
41
+ if (!dictionary) return void 0;
42
+ return key.split(".").reduce((value, currentKey) => {
43
+ if (!isPlainI18nDictionary(value)) return void 0;
44
+ return value[currentKey];
45
+ }, dictionary);
46
+ };
47
+ /**
48
+ * 替换文案中的插值占位符。
49
+ * 例如 "Hello, {name}" + { name: "Tom" } => "Hello, Tom"。
50
+ */
51
+ var interpolateI18nMessage = (value, data) => {
52
+ if (!data) return value;
53
+ return value.replace(/\{([A-Za-z0-9_]+)\}/g, (match, key) => {
54
+ const nextValue = data[key];
55
+ return typeof nextValue === "undefined" || nextValue === null ? match : String(nextValue);
56
+ });
57
+ };
58
+ /**
59
+ * 纯翻译函数:只依赖传入的 state。
60
+ * 优先级:指定语言 -> 兜底语言 -> options.fallback -> 原 key。
61
+ */
62
+ var translate = (state, key, fillingData, options) => {
63
+ const language = options?.language || state.language;
64
+ const fallbackLanguage = options?.fallbackLanguage || state.fallbackLanguage;
65
+ const value = getI18nPathValue(state.resources[language], key) ?? getI18nPathValue(state.resources[fallbackLanguage], key) ?? options?.fallback ?? key;
66
+ return typeof value === "string" ? interpolateI18nMessage(value, fillingData) : value;
67
+ };
68
+ var getBrowserWindow = () => {
69
+ return globalThis.window;
70
+ };
71
+ /**
72
+ * 初始化时优先读取本地缓存语言。
73
+ * SSR 环境没有 window,直接回退到默认语言。
74
+ */
75
+ var getStoredLanguage = (storageKey) => {
76
+ const windowRef = getBrowserWindow();
77
+ if (!windowRef) return defaultLanguage;
78
+ return windowRef.localStorage.getItem(storageKey) || "zh-CN";
79
+ };
80
+ /**
81
+ * 持久化当前语言,用于刷新页面后保持用户选择。
82
+ */
83
+ var persistLanguage = (storageKey, language) => {
84
+ const windowRef = getBrowserWindow();
85
+ if (!windowRef) return;
86
+ windowRef.localStorage.setItem(storageKey, language);
87
+ };
88
+ var createInitialState = () => ({
89
+ language: getStoredLanguage(languageLocalKey),
90
+ fallbackLanguage: defaultLanguage,
91
+ resources: translations,
92
+ storageKey: languageLocalKey,
93
+ persist: true
94
+ });
95
+ var createI18nStore = () => {
96
+ let state;
97
+ const listeners = /* @__PURE__ */ new Set();
98
+ const setState = (partial) => {
99
+ const previousState = state;
100
+ const nextPartial = typeof partial === "function" ? partial(state) : partial;
101
+ state = {
102
+ ...state,
103
+ ...nextPartial
104
+ };
105
+ listeners.forEach((listener) => listener(state, previousState));
106
+ };
107
+ state = {
108
+ ...createInitialState(),
109
+ t: (key, fillingData, options) => i18n(key, fillingData, options),
110
+ setLanguage: (language) => {
111
+ setState({ language });
112
+ const { persist, storageKey } = state;
113
+ if (persist) persistLanguage(storageKey, language);
114
+ },
115
+ setFallbackLanguage: (fallbackLanguage) => {
116
+ setState({ fallbackLanguage });
117
+ },
118
+ setResources: (resources, options) => {
119
+ setState((currentState) => ({ resources: options?.merge ? mergeI18nResources(currentState.resources, resources) : resources }));
120
+ },
121
+ addResources: (language, messages, options) => {
122
+ setState((currentState) => {
123
+ const shouldMerge = options?.merge ?? true;
124
+ const currentMessages = currentState.resources[language];
125
+ return { resources: {
126
+ ...currentState.resources,
127
+ [language]: shouldMerge ? mergeI18nDictionary(currentMessages, messages) : messages
128
+ } };
129
+ });
130
+ },
131
+ configureI18n: (config) => {
132
+ setState(config);
133
+ },
134
+ resetI18n: () => {
135
+ setState(createInitialState());
136
+ }
137
+ };
138
+ const initialStoreState = state;
139
+ return {
140
+ getState: () => state,
141
+ getInitialState: () => initialStoreState,
142
+ setState,
143
+ subscribe: (listener) => {
144
+ listeners.add(listener);
145
+ return () => {
146
+ listeners.delete(listener);
147
+ };
148
+ }
149
+ };
150
+ };
151
+ var i18nStore = createI18nStore();
152
+ /**
153
+ * 对外使用的 i18n 函数。
154
+ * 每次调用都会读取最新 state,适合在非 React 代码中直接使用。
155
+ */
156
+ var i18n = (key, fillingData, options) => {
157
+ return translate(i18nStore.getState(), key, fillingData, options);
158
+ };
159
+ var t = i18n;
160
+ var getLanguage = i18n;
161
+ //#endregion
162
+ export { defaultEnglishResources, defaultLanguage, defaultLanguageResources, getI18nPathValue, getLanguage, i18n, i18nStore, interpolateI18nMessage, isPlainI18nDictionary, languageLocalKey, mergeI18nDictionary, mergeI18nResources, t, translate, translations };
@@ -0,0 +1,11 @@
1
+ import { defaultLanguageResources } from "./default.js";
2
+ import { defaultEnglishResources } from "./en-US.js";
3
+ //#region packages/common/i18n/locales.ts
4
+ var defaultLanguage = "zh-CN";
5
+ var languageLocalKey = "tc_language";
6
+ var translations = {
7
+ "zh-CN": defaultLanguageResources,
8
+ "en-US": defaultEnglishResources
9
+ };
10
+ //#endregion
11
+ export { defaultEnglishResources, defaultLanguage, defaultLanguageResources, languageLocalKey, translations };
File without changes
@@ -0,0 +1,13 @@
1
+ import { isBoolean, isFunction, isNil, isNonNullable, isNumber, isPlainObject, isString } from "./guards/index.js";
2
+ import { chunk, compact, groupBy, toArray, uniqueBy } from "./array/index.js";
3
+ import { LRUCache } from "./cache/LRUCache.js";
4
+ import { defaultLanguageResources } from "./i18n/default.js";
5
+ import { defaultEnglishResources } from "./i18n/en-US.js";
6
+ import { defaultLanguage, languageLocalKey, translations } from "./i18n/locales.js";
7
+ import { getI18nPathValue, getLanguage, i18n, i18nStore, interpolateI18nMessage, isPlainI18nDictionary, mergeI18nDictionary, mergeI18nResources, t, translate } from "./i18n/index.js";
8
+ import { ANSI_RESET, ansiColors, colorLog, colorize, joinColorized, logColor, logColorized, logGreen, logJoinColorized, logPink, logRed, logWhite, logYellow } from "./log/index.js";
9
+ import { clamp, toFiniteNumber } from "./number/index.js";
10
+ import { filterEmpty, filtereEmpty } from "./object/filterEmpty.js";
11
+ import { mapValues, omit, pick } from "./object/index.js";
12
+ import { capitalize, isBlank, kebabCase } from "./string/index.js";
13
+ export { ANSI_RESET, LRUCache, ansiColors, capitalize, chunk, clamp, colorLog, colorize, compact, defaultEnglishResources, defaultLanguage, defaultLanguageResources, filterEmpty, filtereEmpty, getI18nPathValue, getLanguage, groupBy, i18n, i18nStore, interpolateI18nMessage, isBlank, isBoolean, isFunction, isNil, isNonNullable, isNumber, isPlainI18nDictionary, isPlainObject, isString, joinColorized, kebabCase, languageLocalKey, logColor, logColorized, logGreen, logJoinColorized, logPink, logRed, logWhite, logYellow, mapValues, mergeI18nDictionary, mergeI18nResources, omit, pick, t, toArray, toFiniteNumber, translate, translations, uniqueBy };
@@ -0,0 +1,146 @@
1
+ //#region packages/common/log/index.ts
2
+ var ANSI_RESET = "\x1B[0m";
3
+ var ansiColors = {
4
+ black: "\x1B[30m",
5
+ red: "\x1B[31m",
6
+ green: "\x1B[32m",
7
+ yellow: "\x1B[33m",
8
+ blue: "\x1B[34m",
9
+ magenta: "\x1B[35m",
10
+ pink: "\x1B[95m",
11
+ cyan: "\x1B[36m",
12
+ white: "\x1B[37m",
13
+ gray: "\x1B[90m"
14
+ };
15
+ var getConsole = () => {
16
+ return globalThis.console;
17
+ };
18
+ var colorize = (message, color = "green") => {
19
+ return `${ansiColors[color]}${String(message)}${ANSI_RESET}`;
20
+ };
21
+ var joinColorized = (...messages) => {
22
+ return messages.map(String).join("");
23
+ };
24
+ var logJoinColorized = (...messages) => {
25
+ getConsole()?.log(messages.map(String).join(""));
26
+ };
27
+ var inspectPrimitive = (value) => {
28
+ if (typeof value === "string") return `'${value}'`;
29
+ if (typeof value === "bigint") return `${value}n`;
30
+ if (typeof value === "symbol") return String(value);
31
+ if (typeof value === "function") return `[Function${value.name ? `: ${value.name}` : ""}]`;
32
+ if (value === void 0) return "undefined";
33
+ if (value === null) return "null";
34
+ return String(value);
35
+ };
36
+ var inspectValue = (value, context, depth = 0) => {
37
+ if (value === null || typeof value !== "object") return inspectPrimitive(value);
38
+ if (context.seen.has(value)) return "[Circular]";
39
+ if (value instanceof Date) return value.toISOString();
40
+ if (value instanceof Error) return value.stack ?? `${value.name}: ${value.message}`;
41
+ context.seen.add(value);
42
+ if (Array.isArray(value)) {
43
+ const items = value.map((item) => inspectValue(item, context, depth + 1));
44
+ context.seen.delete(value);
45
+ return `[${items.join(", ")}]`;
46
+ }
47
+ const entries = Object.entries(value);
48
+ if (entries.length === 0) {
49
+ context.seen.delete(value);
50
+ return "{}";
51
+ }
52
+ const indent = " ".repeat(depth);
53
+ const nextIndent = " ".repeat(depth + 1);
54
+ const body = entries.map(([key, item]) => `${nextIndent}${key}: ${inspectValue(item, context, depth + 1)}`).join(",\n");
55
+ context.seen.delete(value);
56
+ return `{\n${body}\n${indent}}`;
57
+ };
58
+ var stringifyLogValue = (value) => {
59
+ return typeof value === "string" ? value : inspectValue(value, { seen: /* @__PURE__ */ new WeakSet() });
60
+ };
61
+ var formatSpecifier = (specifier, value) => {
62
+ if (specifier === "%%") return "%";
63
+ if (specifier === "%s") return String(value);
64
+ if (specifier === "%d" || specifier === "%i") return Number.parseInt(String(value), 10).toString();
65
+ if (specifier === "%f") return Number.parseFloat(String(value)).toString();
66
+ if (specifier === "%j") try {
67
+ return JSON.stringify(value);
68
+ } catch {
69
+ return "[Circular]";
70
+ }
71
+ if (specifier === "%o" || specifier === "%O") return stringifyLogValue(value);
72
+ if (specifier === "%c") return "";
73
+ return specifier;
74
+ };
75
+ var formatLogData = (data) => {
76
+ if (data.length === 0) return "";
77
+ const [first, ...rest] = data;
78
+ if (typeof first !== "string") return data.map(stringifyLogValue).join(" ");
79
+ let index = 0;
80
+ return [first.replace(/%[sdifjoOc%]/g, (specifier) => {
81
+ if (specifier === "%%") return "%";
82
+ if (index >= rest.length) return specifier;
83
+ const value = rest[index];
84
+ index += 1;
85
+ return formatSpecifier(specifier, value);
86
+ }), ...rest.slice(index).map(stringifyLogValue)].join(" ");
87
+ };
88
+ var isLogColor = (value) => {
89
+ return typeof value === "string" && value in ansiColors;
90
+ };
91
+ var isColorLogOptions = (value) => {
92
+ if (value === null || typeof value !== "object") return false;
93
+ if (!Object.keys(value).some((key) => key === "color" || key === "prefix" || key === "suffix")) return false;
94
+ const options = value;
95
+ return options.color === void 0 || isLogColor(options.color);
96
+ };
97
+ var withColor = (color, data, options = {}) => {
98
+ const prefix = options.prefix ?? "";
99
+ const suffix = options.suffix ?? "";
100
+ const message = formatLogData(data);
101
+ return [`${ansiColors[color]}${prefix}${message}${suffix}${ANSI_RESET}`];
102
+ };
103
+ var printColorMessage = (data, config) => {
104
+ const color = config.color ?? "green";
105
+ getConsole()?.log(...withColor(color, data, config));
106
+ };
107
+ function colorLog(...data) {
108
+ const [first, ...rest] = data;
109
+ const last = data.at(-1);
110
+ if (isLogColor(first) && data.length >= 2) {
111
+ printColorMessage(rest, { color: first });
112
+ return;
113
+ }
114
+ if (isLogColor(last) && data.length === 2) {
115
+ printColorMessage([first], { color: last });
116
+ return;
117
+ }
118
+ if (isColorLogOptions(last) && data.length >= 2) {
119
+ printColorMessage(data.slice(0, -1), last);
120
+ return;
121
+ }
122
+ printColorMessage(data, { color: "green" });
123
+ }
124
+ var logColor = (color, ...data) => {
125
+ printColorMessage(data, { color });
126
+ };
127
+ var logColorized = (...messages) => {
128
+ getConsole()?.log(...messages);
129
+ };
130
+ var logGreen = (...data) => {
131
+ logColor("green", ...data);
132
+ };
133
+ var logYellow = (...data) => {
134
+ logColor("yellow", ...data);
135
+ };
136
+ var logPink = (...data) => {
137
+ logColor("pink", ...data);
138
+ };
139
+ var logWhite = (...data) => {
140
+ logColor("white", ...data);
141
+ };
142
+ var logRed = (...data) => {
143
+ logColor("red", ...data);
144
+ };
145
+ //#endregion
146
+ export { ANSI_RESET, ansiColors, colorLog, colorize, joinColorized, logColor, logColorized, logGreen, logJoinColorized, logPink, logRed, logWhite, logYellow };
@@ -0,0 +1,11 @@
1
+ //#region packages/common/number/index.ts
2
+ var clamp = (value, min, max) => {
3
+ if (min > max) throw new RangeError("min must be less than or equal to max");
4
+ return Math.min(Math.max(value, min), max);
5
+ };
6
+ var toFiniteNumber = (value, fallback = 0) => {
7
+ const numberValue = typeof value === "number" ? value : Number(value);
8
+ return Number.isFinite(numberValue) ? numberValue : fallback;
9
+ };
10
+ //#endregion
11
+ export { clamp, toFiniteNumber };
@@ -0,0 +1,29 @@
1
+ import { isPlainObject } from "../guards/index.js";
2
+ //#region packages/common/object/filterEmpty.ts
3
+ var isEmptyValue = (value) => {
4
+ if (value === void 0) return true;
5
+ if (Array.isArray(value)) return value.length === 0;
6
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
7
+ return false;
8
+ };
9
+ var filterEmptyValue = (value) => {
10
+ if (Array.isArray(value)) {
11
+ const result = value.map((item) => filterEmptyValue(item)).filter((item) => !isEmptyValue(item));
12
+ return result.length > 0 ? result : void 0;
13
+ }
14
+ if (isPlainObject(value)) {
15
+ const result = {};
16
+ for (const [key, item] of Object.entries(value)) {
17
+ const nextValue = filterEmptyValue(item);
18
+ if (!isEmptyValue(nextValue)) result[key] = nextValue;
19
+ }
20
+ return Object.keys(result).length > 0 ? result : void 0;
21
+ }
22
+ return value;
23
+ };
24
+ function filterEmpty(data) {
25
+ return filterEmptyValue(data);
26
+ }
27
+ var filtereEmpty = filterEmpty;
28
+ //#endregion
29
+ export { filterEmpty, filtereEmpty };
@@ -0,0 +1,2 @@
1
+ import { filterEmpty, filtereEmpty } from "./filterEmpty.js";
2
+ export { filterEmpty, filtereEmpty };
@@ -0,0 +1,20 @@
1
+ import { filterEmpty, filtereEmpty } from "./filterEmpty.js";
2
+ //#region packages/common/object/index.ts
3
+ var pick = (target, keys) => {
4
+ const result = {};
5
+ for (const key of keys) if (key in target) result[key] = target[key];
6
+ return result;
7
+ };
8
+ var omit = (target, keys) => {
9
+ const result = { ...target };
10
+ for (const key of keys) delete result[key];
11
+ return result;
12
+ };
13
+ var mapValues = (target, mapper) => {
14
+ const result = {};
15
+ const keys = Object.keys(target);
16
+ for (const key of keys) result[key] = mapper(target[key], key);
17
+ return result;
18
+ };
19
+ //#endregion
20
+ export { filterEmpty, filtereEmpty, mapValues, omit, pick };
@@ -0,0 +1,13 @@
1
+ //#region packages/common/string/index.ts
2
+ var isBlank = (value) => {
3
+ return value === null || value === void 0 || value.trim().length === 0;
4
+ };
5
+ var capitalize = (value) => {
6
+ if (value.length === 0) return value;
7
+ return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
8
+ };
9
+ var kebabCase = (value) => {
10
+ return value.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").replace(/-+/g, "-").toLowerCase();
11
+ };
12
+ //#endregion
13
+ export { capitalize, isBlank, kebabCase };
File without changes