@_tc/template-core 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1108 -0
- package/cjs/_virtual/_rolldown/runtime.js +1 -0
- package/cjs/app/controller/base.js +1 -0
- package/cjs/app/controller/project.js +1 -0
- package/cjs/app/controller/view.js +1 -0
- package/cjs/app/data/signKey.js +1 -0
- package/cjs/app/extend/$fetch.js +1 -0
- package/cjs/app/extend/db.js +1 -0
- package/cjs/app/extend/generateErrorMessage.js +1 -0
- package/cjs/app/extend/logger.js +1 -0
- package/cjs/app/extend/parsingParamsOnUrl.js +1 -0
- package/cjs/app/extend/render-view.js +1 -0
- package/cjs/app/middleware/api-params-verify.js +1 -0
- package/cjs/app/middleware/api-sign-verify.js +1 -0
- package/cjs/app/middleware/error-handle.js +1 -0
- package/cjs/app/middleware/project-handler.js +1 -0
- package/cjs/app/middleware.js +1 -0
- package/cjs/app/router/project.js +1 -0
- package/cjs/app/router/view.js +1 -0
- package/cjs/app/router-schema/project.js +1 -0
- package/cjs/app/service/base.js +1 -0
- package/cjs/app/service/project.js +1 -0
- package/cjs/app/type.js +1 -0
- package/cjs/app/typings.js +1 -0
- package/cjs/app/view/entry.tpl +30 -0
- package/cjs/bundler/defaultAlias.js +1 -0
- package/cjs/bundler/dev.js +1 -0
- package/cjs/bundler/index.js +1 -0
- package/cjs/bundler/prod.js +1 -0
- package/cjs/bundler/state.js +1 -0
- package/cjs/bundler/utils.js +1 -0
- package/cjs/index.js +1 -0
- package/cjs/packages/common/LRUCache.js +1 -0
- package/cjs/packages/common/array/index.js +1 -0
- package/cjs/packages/common/cache/LRUCache.js +1 -0
- package/cjs/packages/common/cache/index.js +1 -0
- package/cjs/packages/common/guards/index.js +1 -0
- package/cjs/packages/common/http/index.js +1 -0
- package/cjs/packages/common/i18n/default.js +1 -0
- package/cjs/packages/common/i18n/en-US.js +1 -0
- package/cjs/packages/common/i18n/index.js +1 -0
- package/cjs/packages/common/i18n/locales.js +1 -0
- package/cjs/packages/common/i18n/types.js +1 -0
- package/cjs/packages/common/index.js +1 -0
- package/cjs/packages/common/log/index.js +2 -0
- package/cjs/packages/common/number/index.js +1 -0
- package/cjs/packages/common/object/filterEmpty.js +1 -0
- package/cjs/packages/common/object/filtereEmpty.js +1 -0
- package/cjs/packages/common/object/index.js +1 -0
- package/cjs/packages/common/string/index.js +1 -0
- package/cjs/packages/common/types/index.js +1 -0
- package/cjs/packages/core/env.js +1 -0
- package/cjs/packages/core/index.js +1 -0
- package/cjs/packages/core/loader/config.js +1 -0
- package/cjs/packages/core/loader/controller.js +1 -0
- package/cjs/packages/core/loader/extend.js +1 -0
- package/cjs/packages/core/loader/middleware.js +1 -0
- package/cjs/packages/core/loader/model.js +1 -0
- package/cjs/packages/core/loader/router-schema.js +1 -0
- package/cjs/packages/core/loader/router.js +1 -0
- package/cjs/packages/core/loader/service.js +1 -0
- package/cjs/packages/core/paths.js +1 -0
- package/cjs/packages/core/types.js +1 -0
- package/cjs/packages/utils/getAllFilesInFolder.js +1 -0
- package/cjs/packages/utils/getAllFnReturnValue.js +1 -0
- package/cjs/packages/utils/index.js +1 -0
- package/cjs/packages/utils/loadFile.js +1 -0
- package/cjs/packages/utils/path.js +1 -0
- package/cjs/packages/utils/runFileFn.js +1 -0
- package/esm/_virtual/_rolldown/runtime.js +20 -0
- package/esm/app/controller/base.js +26 -0
- package/esm/app/controller/project.js +52 -0
- package/esm/app/controller/view.js +23 -0
- package/esm/app/data/signKey.js +8 -0
- package/esm/app/extend/$fetch.js +15 -0
- package/esm/app/extend/db.js +6 -0
- package/esm/app/extend/generateErrorMessage.js +7 -0
- package/esm/app/extend/logger.js +26 -0
- package/esm/app/extend/parsingParamsOnUrl.js +14 -0
- package/esm/app/extend/render-view.js +19 -0
- package/esm/app/middleware/api-params-verify.js +56 -0
- package/esm/app/middleware/api-sign-verify.js +18 -0
- package/esm/app/middleware/error-handle.js +24 -0
- package/esm/app/middleware/project-handler.js +15 -0
- package/esm/app/middleware.js +18 -0
- package/esm/app/router/project.js +7 -0
- package/esm/app/router/view.js +7 -0
- package/esm/app/router-schema/project.js +15 -0
- package/esm/app/service/base.js +14 -0
- package/esm/app/service/project.js +23 -0
- package/esm/app/type.js +0 -0
- package/esm/app/typings.js +0 -0
- package/esm/app/view/entry.tpl +30 -0
- package/esm/bundler/defaultAlias.js +4 -0
- package/esm/bundler/dev.js +12 -0
- package/esm/bundler/index.js +18 -0
- package/esm/bundler/prod.js +14 -0
- package/esm/bundler/state.js +10 -0
- package/esm/bundler/utils.js +194 -0
- package/esm/index.js +16 -0
- package/esm/packages/common/LRUCache.js +2 -0
- package/esm/packages/common/array/index.js +27 -0
- package/esm/packages/common/cache/LRUCache.js +39 -0
- package/esm/packages/common/cache/index.js +2 -0
- package/esm/packages/common/guards/index.js +8 -0
- package/esm/packages/common/http/index.js +256 -0
- package/esm/packages/common/i18n/default.js +88 -0
- package/esm/packages/common/i18n/en-US.js +88 -0
- package/esm/packages/common/i18n/index.js +91 -0
- package/esm/packages/common/i18n/locales.js +9 -0
- package/esm/packages/common/i18n/types.js +0 -0
- package/esm/packages/common/index.js +14 -0
- package/esm/packages/common/log/index.js +93 -0
- package/esm/packages/common/number/index.js +10 -0
- package/esm/packages/common/object/filterEmpty.js +23 -0
- package/esm/packages/common/object/filtereEmpty.js +2 -0
- package/esm/packages/common/object/index.js +17 -0
- package/esm/packages/common/string/index.js +4 -0
- package/esm/packages/common/types/index.js +0 -0
- package/esm/packages/core/env.js +24 -0
- package/esm/packages/core/index.js +52 -0
- package/esm/packages/core/loader/config.js +27 -0
- package/esm/packages/core/loader/controller.js +13 -0
- package/esm/packages/core/loader/extend.js +23 -0
- package/esm/packages/core/loader/middleware.js +16 -0
- package/esm/packages/core/loader/model.js +68 -0
- package/esm/packages/core/loader/router-schema.js +19 -0
- package/esm/packages/core/loader/router.js +36 -0
- package/esm/packages/core/loader/service.js +13 -0
- package/esm/packages/core/paths.js +9 -0
- package/esm/packages/core/types.js +0 -0
- package/esm/packages/utils/getAllFilesInFolder.js +9 -0
- package/esm/packages/utils/getAllFnReturnValue.js +0 -0
- package/esm/packages/utils/index.js +5 -0
- package/esm/packages/utils/loadFile.js +34 -0
- package/esm/packages/utils/path.js +16 -0
- package/esm/packages/utils/runFileFn.js +45 -0
- package/fe/frontend/apps/dash/Dashboard.d.ts +6 -0
- package/fe/frontend/apps/dash/Dashboard.js +75 -0
- package/fe/frontend/apps/dash/dash.entry.d.ts +2 -0
- package/fe/frontend/apps/dash/dash.entry.js +80 -0
- package/fe/frontend/apps/dash/types.d.ts +17 -0
- package/fe/frontend/apps/dash/types.js +1 -0
- package/fe/frontend/apps/testPage/index.d.ts +3 -0
- package/fe/frontend/apps/testPage/index.js +6 -0
- package/fe/frontend/apps/testPage/testPage.entry.d.ts +2 -0
- package/fe/frontend/apps/testPage/testPage.entry.js +6 -0
- package/fe/frontend/extended/SchemaForm/data.d.ts +13 -0
- package/fe/frontend/extended/SchemaForm/data.js +8 -0
- package/fe/frontend/src/api/baseInfo.d.ts +31 -0
- package/fe/frontend/src/api/baseInfo.js +15 -0
- package/fe/frontend/src/common/CRUD/CRUD.d.ts +3 -0
- package/fe/frontend/src/common/CRUD/CRUD.js +2 -0
- package/fe/frontend/src/common/CRUD/index.d.ts +2 -0
- package/fe/frontend/src/common/CRUD/index.js +1 -0
- package/fe/frontend/src/common/auth/index.d.ts +7 -0
- package/fe/frontend/src/common/auth/index.js +20 -0
- package/fe/frontend/src/common/fetchErrorShow.d.ts +3 -0
- package/fe/frontend/src/common/fetchErrorShow.js +8 -0
- package/fe/frontend/src/common/generateMenuData.d.ts +4 -0
- package/fe/frontend/src/common/generateMenuData.js +12 -0
- package/fe/frontend/src/common/importComponent.d.ts +5 -0
- package/fe/frontend/src/common/importComponent.js +8 -0
- package/fe/frontend/src/common/language.d.ts +2 -0
- package/fe/frontend/src/common/language.js +9 -0
- package/fe/frontend/src/common/logFn/index.d.ts +5 -0
- package/fe/frontend/src/common/logFn/index.js +9 -0
- package/fe/frontend/src/common/menu.d.ts +34 -0
- package/fe/frontend/src/common/menu.js +101 -0
- package/fe/frontend/src/common/request.d.ts +37 -0
- package/fe/frontend/src/common/request.js +217 -0
- package/fe/frontend/src/components/AsyncSelect/AsyncSelect.d.ts +8 -0
- package/fe/frontend/src/components/AsyncSelect/AsyncSelect.js +32 -0
- package/fe/frontend/src/components/AsyncSelect/index.d.ts +4 -0
- package/fe/frontend/src/components/AsyncSelect/index.js +3 -0
- package/fe/frontend/src/components/BasePage/HeaderView.d.ts +9 -0
- package/fe/frontend/src/components/BasePage/HeaderView.js +14 -0
- package/fe/frontend/src/components/Router/index.d.ts +9 -0
- package/fe/frontend/src/components/Router/index.js +11 -0
- package/fe/frontend/src/components/Router/type.d.ts +2 -0
- package/fe/frontend/src/components/Router/type.js +1 -0
- package/fe/frontend/src/defaultPages/Iframe/index.d.ts +3 -0
- package/fe/frontend/src/defaultPages/Iframe/index.js +14 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.d.ts +7 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.js +94 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.d.ts +13 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.js +124 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.d.ts +44 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.js +7 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.d.ts +4 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.js +6 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.js +63 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.d.ts +11 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.js +188 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/eventInfo.d.ts +8 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/eventInfo.js +6 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/index.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/index.js +1 -0
- package/fe/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.d.ts +10 -0
- package/fe/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.js +14 -0
- package/fe/frontend/src/defaultPages/SchemaPage/index.css +167 -0
- package/fe/frontend/src/defaultPages/SchemaPage/index.d.ts +4 -0
- package/fe/frontend/src/defaultPages/SchemaPage/index.js +75 -0
- package/fe/frontend/src/defaultPages/SchemaPage/schemaType.d.ts +51 -0
- package/fe/frontend/src/defaultPages/SchemaPage/schemaType.js +4 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/permissions.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/permissions.js +3 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.js +115 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.d.ts +7 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.js +36 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +10 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +38 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPage/index.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPage/index.js +16 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.js +17 -0
- package/fe/frontend/src/defaultPages/SlotPage/index.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SlotPage/index.js +26 -0
- package/fe/frontend/src/exportStore.d.ts +17 -0
- package/fe/frontend/src/exportStore.js +16 -0
- package/fe/frontend/src/hooks/useCurrentMenuData.d.ts +19 -0
- package/fe/frontend/src/hooks/useCurrentMenuData.js +28 -0
- package/fe/frontend/src/hooks/useRouterParams.d.ts +5 -0
- package/fe/frontend/src/hooks/useRouterParams.js +11 -0
- package/fe/frontend/src/index.d.ts +16 -0
- package/fe/frontend/src/index.js +13 -0
- package/fe/frontend/src/main.css +96 -0
- package/fe/frontend/src/main.d.ts +27 -0
- package/fe/frontend/src/main.js +72 -0
- package/fe/frontend/src/stores/apiFreezer.d.ts +93 -0
- package/fe/frontend/src/stores/apiFreezer.js +49 -0
- package/fe/frontend/src/stores/mode.d.ts +19 -0
- package/fe/frontend/src/stores/mode.js +37 -0
- package/fe/frontend/src/stores/schemaEventBus.d.ts +42 -0
- package/fe/frontend/src/stores/schemaEventBus.js +70 -0
- package/fe/frontend/src/stores/schemaStore.d.ts +47 -0
- package/fe/frontend/src/stores/schemaStore.js +26 -0
- package/fe/frontend/src/typing/scalability.d.ts +47 -0
- package/fe/frontend/src/typing/scalability.js +1 -0
- package/fe/frontend/src/typing/window.d.ts +7 -0
- package/fe/frontend/src/typing/window.js +1 -0
- package/fe/model/types/data/button.d.ts +32 -0
- package/fe/model/types/data/button.js +16 -0
- package/fe/model/types/data/component.d.ts +40 -0
- package/fe/model/types/data/component.js +11 -0
- package/fe/model/types/data/fetchInfo.d.ts +20 -0
- package/fe/model/types/data/fetchInfo.js +1 -0
- package/fe/model/types/data/schema.d.ts +98 -0
- package/fe/model/types/data/schema.js +1 -0
- package/fe/model/types/data/search.d.ts +7 -0
- package/fe/model/types/data/search.js +1 -0
- package/fe/model/types/menuType.d.ts +73 -0
- package/fe/model/types/menuType.js +1 -0
- package/fe/model/types/model.d.ts +33 -0
- package/fe/model/types/model.js +1 -0
- package/fe/packages/common/array/index.d.ts +7 -0
- package/fe/packages/common/array/index.js +40 -0
- package/fe/packages/common/cache/LRUCache.d.ts +13 -0
- package/fe/packages/common/cache/LRUCache.js +47 -0
- package/fe/packages/common/cache/index.d.ts +2 -0
- package/fe/packages/common/cache/index.js +1 -0
- package/fe/packages/common/guards/index.d.ts +9 -0
- package/fe/packages/common/guards/index.js +24 -0
- package/fe/packages/common/http/index.d.ts +90 -0
- package/fe/packages/common/http/index.js +310 -0
- package/fe/packages/common/i18n/default.d.ts +92 -0
- package/fe/packages/common/i18n/default.js +90 -0
- package/fe/packages/common/i18n/en-US.d.ts +92 -0
- package/fe/packages/common/i18n/en-US.js +90 -0
- package/fe/packages/common/i18n/index.d.ts +43 -0
- package/fe/packages/common/i18n/index.js +173 -0
- package/fe/packages/common/i18n/locales.d.ts +8 -0
- package/fe/packages/common/i18n/locales.js +10 -0
- package/fe/packages/common/i18n/types.d.ts +71 -0
- package/fe/packages/common/i18n/types.js +1 -0
- package/fe/packages/common/index.d.ts +11 -0
- package/fe/packages/common/index.js +10 -0
- package/fe/packages/common/log/index.d.ts +33 -0
- package/fe/packages/common/log/index.js +176 -0
- package/fe/packages/common/number/index.d.ts +3 -0
- package/fe/packages/common/number/index.js +10 -0
- package/fe/packages/common/object/filterEmpty.d.ts +3 -0
- package/fe/packages/common/object/filterEmpty.js +33 -0
- package/fe/packages/common/object/index.d.ts +5 -0
- package/fe/packages/common/object/index.js +25 -0
- package/fe/packages/common/string/index.d.ts +4 -0
- package/fe/packages/common/string/index.js +17 -0
- package/fe/packages/common/types/index.d.ts +4 -0
- package/fe/packages/common/types/index.js +1 -0
- package/fe/packages/ui/react/assets/table/no-result.svg +5 -0
- package/fe/packages/ui/react/components/Button/Button.d.ts +58 -0
- package/fe/packages/ui/react/components/Button/Button.js +72 -0
- package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +13 -0
- package/fe/packages/ui/react/components/Button/SumbitButton.js +25 -0
- package/fe/packages/ui/react/components/Button/index.d.ts +4 -0
- package/fe/packages/ui/react/components/Button/index.js +2 -0
- package/fe/packages/ui/react/components/Checkbox/Checkbox.d.ts +17 -0
- package/fe/packages/ui/react/components/Checkbox/Checkbox.js +39 -0
- package/fe/packages/ui/react/components/Checkbox/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Checkbox/index.js +1 -0
- package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.d.ts +20 -0
- package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.js +11 -0
- package/fe/packages/ui/react/components/ConfirmDialog/index.d.ts +2 -0
- package/fe/packages/ui/react/components/ConfirmDialog/index.js +1 -0
- package/fe/packages/ui/react/components/DataTable/ActionBtn.d.ts +8 -0
- package/fe/packages/ui/react/components/DataTable/ActionBtn.js +96 -0
- package/fe/packages/ui/react/components/DataTable/index.d.ts +52 -0
- package/fe/packages/ui/react/components/DataTable/index.js +187 -0
- package/fe/packages/ui/react/components/Date/Calendar.d.ts +35 -0
- package/fe/packages/ui/react/components/Date/Calendar.js +216 -0
- package/fe/packages/ui/react/components/Date/Date.d.ts +38 -0
- package/fe/packages/ui/react/components/Date/Date.js +201 -0
- package/fe/packages/ui/react/components/Date/DateTestPage.d.ts +2 -0
- package/fe/packages/ui/react/components/Date/DateTestPage.js +29 -0
- package/fe/packages/ui/react/components/Date/LocaleContext.d.ts +6 -0
- package/fe/packages/ui/react/components/Date/LocaleContext.js +8 -0
- package/fe/packages/ui/react/components/Date/LocaleProvider.d.ts +19 -0
- package/fe/packages/ui/react/components/Date/LocaleProvider.js +24 -0
- package/fe/packages/ui/react/components/Date/TimePicker.d.ts +7 -0
- package/fe/packages/ui/react/components/Date/TimePicker.js +78 -0
- package/fe/packages/ui/react/components/Date/data.d.ts +6 -0
- package/fe/packages/ui/react/components/Date/data.js +4 -0
- package/fe/packages/ui/react/components/Date/dateLocaleStore.d.ts +16 -0
- package/fe/packages/ui/react/components/Date/dateLocaleStore.js +14 -0
- package/fe/packages/ui/react/components/Date/dropdownPositioning.d.ts +3 -0
- package/fe/packages/ui/react/components/Date/dropdownPositioning.js +12 -0
- package/fe/packages/ui/react/components/Date/index.d.ts +6 -0
- package/fe/packages/ui/react/components/Date/index.js +5 -0
- package/fe/packages/ui/react/components/Date/locales.d.ts +43 -0
- package/fe/packages/ui/react/components/Date/locales.js +21 -0
- package/fe/packages/ui/react/components/Drawer/Drawer.d.ts +29 -0
- package/fe/packages/ui/react/components/Drawer/Drawer.js +100 -0
- package/fe/packages/ui/react/components/Drawer/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Drawer/index.js +1 -0
- package/fe/packages/ui/react/components/Dropdown/Dropdown.d.ts +26 -0
- package/fe/packages/ui/react/components/Dropdown/Dropdown.js +49 -0
- package/fe/packages/ui/react/components/Dropdown/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Dropdown/index.js +1 -0
- package/fe/packages/ui/react/components/Form/Form.d.ts +18 -0
- package/fe/packages/ui/react/components/Form/Form.js +8 -0
- package/fe/packages/ui/react/components/Form/FormItem.d.ts +41 -0
- package/fe/packages/ui/react/components/Form/FormItem.js +43 -0
- package/fe/packages/ui/react/components/Form/SchemaForm/data.d.ts +40 -0
- package/fe/packages/ui/react/components/Form/SchemaForm/data.js +18 -0
- package/fe/packages/ui/react/components/Form/SchemaForm/index.d.ts +153 -0
- package/fe/packages/ui/react/components/Form/SchemaForm/index.js +79 -0
- package/fe/packages/ui/react/components/Form/index.d.ts +5 -0
- package/fe/packages/ui/react/components/Form/index.js +4 -0
- package/fe/packages/ui/react/components/Form/useForm.d.ts +3 -0
- package/fe/packages/ui/react/components/Form/useForm.js +1 -0
- package/fe/packages/ui/react/components/ImagePreview/ImagePreview.d.ts +8 -0
- package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +169 -0
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.d.ts +11 -0
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +28 -0
- package/fe/packages/ui/react/components/ImagePreview/index.d.ts +3 -0
- package/fe/packages/ui/react/components/ImagePreview/index.js +2 -0
- package/fe/packages/ui/react/components/Input/Input.d.ts +45 -0
- package/fe/packages/ui/react/components/Input/Input.js +61 -0
- package/fe/packages/ui/react/components/Input/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Input/index.js +1 -0
- package/fe/packages/ui/react/components/InputNumber/InputNumber.d.ts +28 -0
- package/fe/packages/ui/react/components/InputNumber/InputNumber.js +144 -0
- package/fe/packages/ui/react/components/InputNumber/index.d.ts +2 -0
- package/fe/packages/ui/react/components/InputNumber/index.js +1 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.d.ts +30 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.js +63 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.d.ts +2 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.js +27 -0
- package/fe/packages/ui/react/components/Label/Label.d.ts +51 -0
- package/fe/packages/ui/react/components/Label/Label.js +35 -0
- package/fe/packages/ui/react/components/Label/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Label/index.js +2 -0
- package/fe/packages/ui/react/components/Menu/Menu.d.ts +18 -0
- package/fe/packages/ui/react/components/Menu/Menu.js +102 -0
- package/fe/packages/ui/react/components/Menu/MenuContext.d.ts +39 -0
- package/fe/packages/ui/react/components/Menu/MenuContext.js +97 -0
- package/fe/packages/ui/react/components/Menu/MenuItem.d.ts +3 -0
- package/fe/packages/ui/react/components/Menu/MenuItem.js +33 -0
- package/fe/packages/ui/react/components/Menu/SubMenu.d.ts +10 -0
- package/fe/packages/ui/react/components/Menu/SubMenu.js +169 -0
- package/fe/packages/ui/react/components/Menu/index.d.ts +9 -0
- package/fe/packages/ui/react/components/Menu/index.js +5 -0
- package/fe/packages/ui/react/components/Menu/menuTypes.d.ts +59 -0
- package/fe/packages/ui/react/components/Menu/menuTypes.js +1 -0
- package/fe/packages/ui/react/components/Menu/utils.d.ts +2 -0
- package/fe/packages/ui/react/components/Menu/utils.js +7 -0
- package/fe/packages/ui/react/components/Message/Message.d.ts +20 -0
- package/fe/packages/ui/react/components/Message/Message.js +58 -0
- package/fe/packages/ui/react/components/Message/MessageManager.d.ts +37 -0
- package/fe/packages/ui/react/components/Message/MessageManager.js +90 -0
- package/fe/packages/ui/react/components/Message/data.d.ts +2 -0
- package/fe/packages/ui/react/components/Message/data.js +1 -0
- package/fe/packages/ui/react/components/Message/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Message/index.js +1 -0
- package/fe/packages/ui/react/components/Modal/Modal.d.ts +27 -0
- package/fe/packages/ui/react/components/Modal/Modal.js +14 -0
- package/fe/packages/ui/react/components/Modal/ModalManager.d.ts +59 -0
- package/fe/packages/ui/react/components/Modal/ModalManager.js +90 -0
- package/fe/packages/ui/react/components/Modal/index.d.ts +4 -0
- package/fe/packages/ui/react/components/Modal/index.js +2 -0
- package/fe/packages/ui/react/components/Overlay/Overlay.d.ts +23 -0
- package/fe/packages/ui/react/components/Overlay/Overlay.js +53 -0
- package/fe/packages/ui/react/components/Overlay/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Overlay/index.js +1 -0
- package/fe/packages/ui/react/components/Pagination/Pagination.d.ts +18 -0
- package/fe/packages/ui/react/components/Pagination/Pagination.js +88 -0
- package/fe/packages/ui/react/components/Pagination/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Pagination/index.js +1 -0
- package/fe/packages/ui/react/components/Popup/Popup.d.ts +26 -0
- package/fe/packages/ui/react/components/Popup/Popup.js +81 -0
- package/fe/packages/ui/react/components/Popup/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Popup/index.js +1 -0
- package/fe/packages/ui/react/components/Search/Search.d.ts +17 -0
- package/fe/packages/ui/react/components/Search/Search.js +12 -0
- package/fe/packages/ui/react/components/Search/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Search/index.js +1 -0
- package/fe/packages/ui/react/components/Select/Select.d.ts +26 -0
- package/fe/packages/ui/react/components/Select/Select.js +123 -0
- package/fe/packages/ui/react/components/Select/dropdownPositioning.d.ts +3 -0
- package/fe/packages/ui/react/components/Select/dropdownPositioning.js +13 -0
- package/fe/packages/ui/react/components/Select/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Select/index.js +1 -0
- package/fe/packages/ui/react/components/Skeleton/Skeleton.d.ts +28 -0
- package/fe/packages/ui/react/components/Skeleton/Skeleton.js +31 -0
- package/fe/packages/ui/react/components/Skeleton/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Skeleton/index.js +1 -0
- package/fe/packages/ui/react/components/Switch/Switch.d.ts +11 -0
- package/fe/packages/ui/react/components/Switch/Switch.js +22 -0
- package/fe/packages/ui/react/components/Switch/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Switch/index.js +1 -0
- package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +68 -0
- package/fe/packages/ui/react/components/TableSearch/TableSearch.js +121 -0
- package/fe/packages/ui/react/components/TableSearch/index.d.ts +2 -0
- package/fe/packages/ui/react/components/TableSearch/index.js +1 -0
- package/fe/packages/ui/react/components/TableSearch/lang.d.ts +15 -0
- package/fe/packages/ui/react/components/TableSearch/lang.js +14 -0
- package/fe/packages/ui/react/components/TableSearch/tableSearchLocaleStore.d.ts +9 -0
- package/fe/packages/ui/react/components/TableSearch/tableSearchLocaleStore.js +11 -0
- package/fe/packages/ui/react/components/Textarea/Textarea.d.ts +67 -0
- package/fe/packages/ui/react/components/Textarea/Textarea.js +37 -0
- package/fe/packages/ui/react/components/Textarea/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Textarea/index.js +1 -0
- package/fe/packages/ui/react/components/Tooltip/Tooltip.d.ts +25 -0
- package/fe/packages/ui/react/components/Tooltip/Tooltip.js +79 -0
- package/fe/packages/ui/react/components/Tooltip/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Tooltip/index.js +1 -0
- package/fe/packages/ui/react/components/TreeSelect/TreeSelect.d.ts +25 -0
- package/fe/packages/ui/react/components/TreeSelect/TreeSelect.js +160 -0
- package/fe/packages/ui/react/components/TreeSelect/index.d.ts +2 -0
- package/fe/packages/ui/react/components/TreeSelect/index.js +1 -0
- package/fe/packages/ui/react/components/Upload/ImageUpload.d.ts +9 -0
- package/fe/packages/ui/react/components/Upload/ImageUpload.js +75 -0
- package/fe/packages/ui/react/components/Upload/Upload.d.ts +41 -0
- package/fe/packages/ui/react/components/Upload/Upload.js +6 -0
- package/fe/packages/ui/react/components/Upload/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Upload/index.js +2 -0
- package/fe/packages/ui/react/components/breadcrumb/breadcrumb.d.ts +35 -0
- package/fe/packages/ui/react/components/breadcrumb/breadcrumb.js +81 -0
- package/fe/packages/ui/react/components/breadcrumb/index.d.ts +2 -0
- package/fe/packages/ui/react/components/breadcrumb/index.js +1 -0
- package/fe/packages/ui/react/components/hooks/useDropdownPositioning.d.ts +49 -0
- package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +137 -0
- package/fe/packages/ui/react/components/hooks/useInputController.d.ts +24 -0
- package/fe/packages/ui/react/components/hooks/useInputController.js +45 -0
- package/fe/packages/ui/react/components/index.d.ts +30 -0
- package/fe/packages/ui/react/components/index.js +29 -0
- package/fe/packages/ui/react/components/table/index.d.ts +2 -0
- package/fe/packages/ui/react/components/table/index.js +1 -0
- package/fe/packages/ui/react/components/table/table.d.ts +27 -0
- package/fe/packages/ui/react/components/table/table.js +116 -0
- package/fe/packages/ui/react/components/testPage/MenuTestPage.d.ts +2 -0
- package/fe/packages/ui/react/components/testPage/MenuTestPage.js +104 -0
- package/fe/packages/ui/react/components/testPage/index.d.ts +3 -0
- package/fe/packages/ui/react/components/testPage/index.js +337 -0
- package/fe/packages/ui/react/hooks/useBreadcrumb.d.ts +10 -0
- package/fe/packages/ui/react/hooks/useBreadcrumb.js +2 -0
- package/fe/packages/ui/react/hooks/useExecuteOnce.d.ts +30 -0
- package/fe/packages/ui/react/hooks/useExecuteOnce.js +57 -0
- package/fe/packages/ui/react/hooks/useInit.d.ts +3 -0
- package/fe/packages/ui/react/hooks/useInit.js +9 -0
- package/fe/packages/ui/react/hooks/useLanguage.d.ts +2 -0
- package/fe/packages/ui/react/hooks/useLanguage.js +4 -0
- package/fe/packages/ui/react/hooks/usePagination.d.ts +16 -0
- package/fe/packages/ui/react/hooks/usePagination.js +27 -0
- package/fe/packages/ui/react/hooks/useRefState.d.ts +30 -0
- package/fe/packages/ui/react/hooks/useRefState.js +29 -0
- package/fe/packages/ui/react/hooks/useWatch.d.ts +23 -0
- package/fe/packages/ui/react/hooks/useWatch.js +87 -0
- package/fe/packages/ui/react/hooks/useWatch.test.d.ts +2 -0
- package/fe/packages/ui/react/hooks/useWatch.test.js +22 -0
- package/fe/packages/ui/react/i18n/I18nProvider.d.ts +31 -0
- package/fe/packages/ui/react/i18n/I18nProvider.js +25 -0
- package/fe/packages/ui/react/i18n/index.d.ts +4 -0
- package/fe/packages/ui/react/i18n/index.js +3 -0
- package/fe/packages/ui/react/i18n/useI18n.d.ts +13 -0
- package/fe/packages/ui/react/i18n/useI18n.js +18 -0
- package/fe/packages/ui/react/index.css +238 -0
- package/fe/packages/ui/react/index.d.ts +5 -0
- package/fe/packages/ui/react/index.js +6 -0
- package/fe/packages/ui/react/lib/createStoreHook.d.ts +9 -0
- package/fe/packages/ui/react/lib/createStoreHook.js +6 -0
- package/fe/packages/ui/react/lib/export.d.ts +66 -0
- package/fe/packages/ui/react/lib/export.js +138 -0
- package/fe/packages/ui/react/lib/utils.d.ts +34 -0
- package/fe/packages/ui/react/lib/utils.js +70 -0
- package/fe/packages/ui/react/stores/breadcrumb.d.ts +15 -0
- package/fe/packages/ui/react/stores/breadcrumb.js +66 -0
- package/fe/packages/ui/react/stores/language.d.ts +4 -0
- package/fe/packages/ui/react/stores/language.js +2 -0
- package/{typings/type.d.ts → fe/packages/ui/react/types/index.d.ts} +1 -1
- package/fe/packages/ui/react/types/index.js +1 -0
- package/fe/typings/type.d.ts +5 -0
- package/fe/typings/type.js +1 -0
- package/model/index.d.ts +1 -1
- package/model/test.d.ts +1 -5
- package/model/types/data/button.d.ts +32 -0
- package/model/types/data/component.d.ts +40 -0
- package/model/types/data/fetchInfo.d.ts +20 -0
- package/model/types/data/schema.d.ts +98 -0
- package/model/types/data/search.d.ts +7 -0
- package/model/types/index.d.ts +3 -0
- package/model/types/menuType.d.ts +73 -0
- package/model/types/model.d.ts +33 -0
- package/package.json +61 -8
- package/{app → types/app}/controller/base.d.ts +4 -6
- package/types/app/controller/project.d.ts +22 -0
- package/{app → types/app}/controller/view.d.ts +1 -3
- package/{app → types/app}/data/signKey.d.ts +0 -1
- package/types/app/extend/$fetch.d.ts +8 -0
- package/types/app/extend/db.d.ts +2 -0
- package/{app → types/app}/extend/generateErrorMessage.d.ts +0 -1
- package/{app → types/app}/extend/logger.d.ts +1 -2
- package/{app → types/app}/extend/parsingParamsOnUrl.d.ts +0 -1
- package/{app → types/app}/extend/render-view.d.ts +1 -3
- package/{app → types/app}/middleware/api-params-verify.d.ts +1 -3
- package/{app → types/app}/middleware/api-sign-verify.d.ts +1 -3
- package/types/app/middleware/error-handle.d.ts +4 -0
- package/types/app/middleware/project-handler.d.ts +4 -0
- package/{app → types/app}/middleware.d.ts +0 -3
- package/{app/router/view.d.ts → types/app/router/project.d.ts} +1 -2
- package/types/app/router/view.d.ts +3 -0
- package/types/app/router-schema/project.d.ts +3 -0
- package/types/app/service/base.d.ts +9 -0
- package/types/app/service/project.d.ts +57 -0
- package/types/app/type.d.ts +5 -0
- package/types/app/typings.d.ts +43 -0
- package/types/bundler/defaultAlias.d.ts +3 -0
- package/types/bundler/dev.d.ts +1 -0
- package/types/bundler/index.d.ts +2 -0
- package/types/bundler/prod.d.ts +1 -0
- package/types/bundler/state.d.ts +18 -0
- package/types/bundler/utils.d.ts +9 -0
- package/types/config/config.default.d.ts +14 -0
- package/types/index.d.ts +28 -0
- package/types/packages/common/LRUCache.d.ts +1 -0
- package/types/packages/common/array/index.d.ts +6 -0
- package/types/packages/common/cache/LRUCache.d.ts +12 -0
- package/types/packages/common/cache/index.d.ts +1 -0
- package/types/packages/common/guards/index.d.ts +8 -0
- package/types/packages/common/http/index.d.ts +89 -0
- package/types/packages/common/i18n/default.d.ts +91 -0
- package/types/packages/common/i18n/en-US.d.ts +91 -0
- package/types/packages/common/i18n/index.d.ts +42 -0
- package/types/packages/common/i18n/locales.d.ts +7 -0
- package/types/packages/common/i18n/types.d.ts +70 -0
- package/types/packages/common/index.d.ts +10 -0
- package/types/packages/common/log/index.d.ts +32 -0
- package/types/packages/common/number/index.d.ts +2 -0
- package/types/packages/common/object/filterEmpty.d.ts +2 -0
- package/types/packages/common/object/filtereEmpty.d.ts +1 -0
- package/types/packages/common/object/index.d.ts +4 -0
- package/types/packages/common/string/index.d.ts +3 -0
- package/types/packages/common/types/index.d.ts +3 -0
- package/{packages → types/packages}/core/env.d.ts +0 -1
- package/{packages → types/packages}/core/index.d.ts +1 -2
- package/types/packages/core/loader/config.d.ts +9 -0
- package/types/packages/core/loader/controller.d.ts +17 -0
- package/types/packages/core/loader/extend.d.ts +8 -0
- package/types/packages/core/loader/middleware.d.ts +11 -0
- package/types/packages/core/loader/model.d.ts +36 -0
- package/types/packages/core/loader/router-schema.d.ts +18 -0
- package/{packages/core/loader/extend.d.ts → types/packages/core/loader/router.d.ts} +5 -1
- package/types/packages/core/loader/service.d.ts +17 -0
- package/{packages → types/packages}/core/paths.d.ts +0 -1
- package/{packages → types/packages}/core/types.d.ts +60 -9
- package/{packages → types/packages}/utils/getAllFilesInFolder.d.ts +5 -1
- package/types/packages/utils/getAllFnReturnValue.d.ts +0 -0
- package/{packages → types/packages}/utils/index.d.ts +0 -1
- package/{packages → types/packages}/utils/loadFile.d.ts +6 -1
- package/types/packages/utils/path.d.ts +24 -0
- package/types/packages/utils/runFileFn.d.ts +7 -0
- package/types/typings/type.d.ts +4 -0
- package/app/controller/base.d.ts.map +0 -1
- package/app/controller/base.js +0 -24
- package/app/controller/base.js.map +0 -1
- package/app/controller/project.d.ts +0 -12
- package/app/controller/project.d.ts.map +0 -1
- package/app/controller/project.js +0 -48
- package/app/controller/project.js.map +0 -1
- package/app/controller/view.d.ts.map +0 -1
- package/app/controller/view.js +0 -15
- package/app/controller/view.js.map +0 -1
- package/app/data/signKey.d.ts.map +0 -1
- package/app/data/signKey.js +0 -5
- package/app/data/signKey.js.map +0 -1
- package/app/extend/db.d.ts +0 -3
- package/app/extend/db.d.ts.map +0 -1
- package/app/extend/db.js +0 -8
- package/app/extend/db.js.map +0 -1
- package/app/extend/generateErrorMessage.d.ts.map +0 -1
- package/app/extend/generateErrorMessage.js +0 -12
- package/app/extend/generateErrorMessage.js.map +0 -1
- package/app/extend/logger.d.ts.map +0 -1
- package/app/extend/logger.js +0 -73
- package/app/extend/logger.js.map +0 -1
- package/app/extend/parsingParamsOnUrl.d.ts.map +0 -1
- package/app/extend/parsingParamsOnUrl.js +0 -23
- package/app/extend/parsingParamsOnUrl.js.map +0 -1
- package/app/extend/render-view.d.ts.map +0 -1
- package/app/extend/render-view.js +0 -22
- package/app/extend/render-view.js.map +0 -1
- package/app/middleware/api-params-verify.d.ts.map +0 -1
- package/app/middleware/api-params-verify.js +0 -64
- package/app/middleware/api-params-verify.js.map +0 -1
- package/app/middleware/api-sign-verify.d.ts.map +0 -1
- package/app/middleware/api-sign-verify.js +0 -29
- package/app/middleware/api-sign-verify.js.map +0 -1
- package/app/middleware/error-handle.d.ts +0 -6
- package/app/middleware/error-handle.d.ts.map +0 -1
- package/app/middleware/error-handle.js +0 -34
- package/app/middleware/error-handle.js.map +0 -1
- package/app/middleware/project-handler.d.ts +0 -5
- package/app/middleware/project-handler.d.ts.map +0 -1
- package/app/middleware/project-handler.js +0 -22
- package/app/middleware/project-handler.js.map +0 -1
- package/app/middleware.d.ts.map +0 -1
- package/app/middleware.js +0 -39
- package/app/middleware.js.map +0 -1
- package/app/router/project.d.ts +0 -5
- package/app/router/project.d.ts.map +0 -1
- package/app/router/project.js +0 -9
- package/app/router/project.js.map +0 -1
- package/app/router/view.d.ts.map +0 -1
- package/app/router/view.js +0 -6
- package/app/router/view.js.map +0 -1
- package/app/router-schema/project.d.ts +0 -4
- package/app/router-schema/project.d.ts.map +0 -1
- package/app/router-schema/project.js +0 -34
- package/app/router-schema/project.js.map +0 -1
- package/app/service/bese.d.ts +0 -11
- package/app/service/bese.d.ts.map +0 -1
- package/app/service/bese.js +0 -18
- package/app/service/bese.js.map +0 -1
- package/app/service/project.d.ts +0 -28
- package/app/service/project.d.ts.map +0 -1
- package/app/service/project.js +0 -39
- package/app/service/project.js.map +0 -1
- package/app/type.d.ts +0 -3
- package/app/type.d.ts.map +0 -1
- package/app/type.js +0 -3
- package/app/type.js.map +0 -1
- package/app/typings.d.ts +0 -52
- package/app/typings.d.ts.map +0 -1
- package/app/typings.js +0 -3
- package/app/typings.js.map +0 -1
- package/index.d.ts +0 -29
- package/index.d.ts.map +0 -1
- package/index.js +0 -22
- package/index.js.map +0 -1
- package/model/index.d.ts.map +0 -1
- package/model/index.js +0 -7
- package/model/index.js.map +0 -1
- package/model/test.d.ts.map +0 -1
- package/model/test.js +0 -6
- package/model/test.js.map +0 -1
- package/model/test2.d.ts +0 -6
- package/model/test2.d.ts.map +0 -1
- package/model/test2.js +0 -6
- package/model/test2.js.map +0 -1
- package/packages/core/env.d.ts.map +0 -1
- package/packages/core/env.js +0 -26
- package/packages/core/env.js.map +0 -1
- package/packages/core/index.d.ts.map +0 -1
- package/packages/core/index.js +0 -93
- package/packages/core/index.js.map +0 -1
- package/packages/core/loader/config.d.ts +0 -4
- package/packages/core/loader/config.d.ts.map +0 -1
- package/packages/core/loader/config.js +0 -32
- package/packages/core/loader/config.js.map +0 -1
- package/packages/core/loader/controller.d.ts +0 -4
- package/packages/core/loader/controller.d.ts.map +0 -1
- package/packages/core/loader/controller.js +0 -18
- package/packages/core/loader/controller.js.map +0 -1
- package/packages/core/loader/extend.d.ts.map +0 -1
- package/packages/core/loader/extend.js +0 -34
- package/packages/core/loader/extend.js.map +0 -1
- package/packages/core/loader/middleware.d.ts +0 -4
- package/packages/core/loader/middleware.d.ts.map +0 -1
- package/packages/core/loader/middleware.js +0 -16
- package/packages/core/loader/middleware.js.map +0 -1
- package/packages/core/loader/model.d.ts +0 -15
- package/packages/core/loader/model.d.ts.map +0 -1
- package/packages/core/loader/model.js +0 -90
- package/packages/core/loader/model.js.map +0 -1
- package/packages/core/loader/router-schema.d.ts +0 -4
- package/packages/core/loader/router-schema.d.ts.map +0 -1
- package/packages/core/loader/router-schema.js +0 -20
- package/packages/core/loader/router-schema.js.map +0 -1
- package/packages/core/loader/router.d.ts +0 -4
- package/packages/core/loader/router.d.ts.map +0 -1
- package/packages/core/loader/router.js +0 -46
- package/packages/core/loader/router.js.map +0 -1
- package/packages/core/loader/service.d.ts +0 -4
- package/packages/core/loader/service.d.ts.map +0 -1
- package/packages/core/loader/service.js +0 -17
- package/packages/core/loader/service.js.map +0 -1
- package/packages/core/paths.d.ts.map +0 -1
- package/packages/core/paths.js +0 -11
- package/packages/core/paths.js.map +0 -1
- package/packages/core/types.d.ts.map +0 -1
- package/packages/core/types.js +0 -3
- package/packages/core/types.js.map +0 -1
- package/packages/utils/getAllFilesInFolder.d.ts.map +0 -1
- package/packages/utils/getAllFilesInFolder.js +0 -46
- package/packages/utils/getAllFilesInFolder.js.map +0 -1
- package/packages/utils/getAllFnReturnValue.d.ts +0 -1
- package/packages/utils/getAllFnReturnValue.d.ts.map +0 -1
- package/packages/utils/getAllFnReturnValue.js +0 -2
- package/packages/utils/getAllFnReturnValue.js.map +0 -1
- package/packages/utils/index.d.ts.map +0 -1
- package/packages/utils/index.js +0 -21
- package/packages/utils/index.js.map +0 -1
- package/packages/utils/loadFile.d.ts.map +0 -1
- package/packages/utils/loadFile.js +0 -57
- package/packages/utils/loadFile.js.map +0 -1
- package/packages/utils/path.d.ts +0 -7
- package/packages/utils/path.d.ts.map +0 -1
- package/packages/utils/path.js +0 -51
- package/packages/utils/path.js.map +0 -1
- package/packages/utils/runFileFn.d.ts +0 -6
- package/packages/utils/runFileFn.d.ts.map +0 -1
- package/packages/utils/runFileFn.js +0 -6
- package/packages/utils/runFileFn.js.map +0 -1
- package/typings/type.d.ts.map +0 -1
- package/typings/type.js +0 -3
- package/typings/type.js.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI component library default English language resources.
|
|
3
|
+
*
|
|
4
|
+
* Only built-in component copy belongs here. Applications can override or extend it with I18nProvider.resources.
|
|
5
|
+
*/
|
|
6
|
+
export const defaultEnglishResources = {
|
|
7
|
+
common: {
|
|
8
|
+
tip: 'Prompt',
|
|
9
|
+
confirm: 'Confirm',
|
|
10
|
+
cancel: 'Cancel',
|
|
11
|
+
close: 'Close',
|
|
12
|
+
submit: 'Submit',
|
|
13
|
+
reset: 'Reset',
|
|
14
|
+
},
|
|
15
|
+
components: {
|
|
16
|
+
breadcrumb: {
|
|
17
|
+
close: 'Close',
|
|
18
|
+
},
|
|
19
|
+
confirmDialog: {
|
|
20
|
+
title: 'Prompt',
|
|
21
|
+
okText: 'Confirm',
|
|
22
|
+
cancelText: 'Cancel',
|
|
23
|
+
},
|
|
24
|
+
dataTable: {
|
|
25
|
+
noData: 'No Data',
|
|
26
|
+
},
|
|
27
|
+
date: {
|
|
28
|
+
placeholder: 'Select date',
|
|
29
|
+
placeholderDateTime: 'Select date and time',
|
|
30
|
+
placeholderRange: 'Select date range',
|
|
31
|
+
placeholderDateTimeRange: 'Select date and time range',
|
|
32
|
+
weekDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
33
|
+
selectTime: 'Select time',
|
|
34
|
+
startTime: 'Start time',
|
|
35
|
+
endTime: 'End time',
|
|
36
|
+
confirm: 'Confirm',
|
|
37
|
+
monthFormat: 'MMM yyyy',
|
|
38
|
+
quickRanges: 'Quick ranges',
|
|
39
|
+
quickRangeToday: 'Today',
|
|
40
|
+
quickRangeYesterday: 'Yesterday',
|
|
41
|
+
quickRangeLast7Days: 'Last 7 days',
|
|
42
|
+
quickRangeLast30Days: 'Last 30 days',
|
|
43
|
+
quickRangeThisMonth: 'This month',
|
|
44
|
+
quickRangeLastYear: 'Last year',
|
|
45
|
+
clear: 'Clear',
|
|
46
|
+
},
|
|
47
|
+
form: {
|
|
48
|
+
submit: 'Submit',
|
|
49
|
+
cancel: 'Cancel',
|
|
50
|
+
},
|
|
51
|
+
imagePreview: {
|
|
52
|
+
closePreview: 'Close preview',
|
|
53
|
+
previousImage: 'Previous image',
|
|
54
|
+
nextImage: 'Next image',
|
|
55
|
+
zoomOut: 'Zoom out',
|
|
56
|
+
zoomIn: 'Zoom in',
|
|
57
|
+
reset: 'Reset',
|
|
58
|
+
rotateLeft: 'Rotate left',
|
|
59
|
+
rotateRight: 'Rotate right',
|
|
60
|
+
flipHorizontal: 'Flip horizontal',
|
|
61
|
+
flipVertical: 'Flip vertical',
|
|
62
|
+
previewImage: 'Preview image {index}',
|
|
63
|
+
},
|
|
64
|
+
modal: {
|
|
65
|
+
close: 'Close',
|
|
66
|
+
confirmTitle: 'Prompt',
|
|
67
|
+
okText: 'Confirm',
|
|
68
|
+
cancelText: 'Cancel',
|
|
69
|
+
},
|
|
70
|
+
message: {
|
|
71
|
+
close: 'Close',
|
|
72
|
+
},
|
|
73
|
+
select: {
|
|
74
|
+
empty: 'No options',
|
|
75
|
+
},
|
|
76
|
+
tableSearch: {
|
|
77
|
+
reset: 'Reset',
|
|
78
|
+
search: 'Search',
|
|
79
|
+
export: 'Export Excel',
|
|
80
|
+
expand: 'Expand',
|
|
81
|
+
collapse: 'Collapse',
|
|
82
|
+
exportCurrentPage: 'Current Page',
|
|
83
|
+
exportCurrentQuery: 'Current Filters',
|
|
84
|
+
},
|
|
85
|
+
upload: {
|
|
86
|
+
deleteImage: 'Delete image',
|
|
87
|
+
upload: 'Upload',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { I18nDictionary, I18nInterpolationValues, I18nMessage, I18nResources, I18nStore, I18nStoreListener, I18nTranslateOptions, I18nTranslateState } from './types';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './locales';
|
|
4
|
+
export declare const isPlainI18nDictionary: (value: I18nMessage) => value is I18nDictionary;
|
|
5
|
+
/**
|
|
6
|
+
* 深合并单个语言包。
|
|
7
|
+
* 嵌套对象递归合并,字符串、数组、数字等叶子节点直接以 patch 覆盖 base。
|
|
8
|
+
*/
|
|
9
|
+
export declare const mergeI18nDictionary: (base?: I18nDictionary, patch?: I18nDictionary) => I18nDictionary;
|
|
10
|
+
/**
|
|
11
|
+
* 合并多语言资源。
|
|
12
|
+
* 结构示例:{ 'zh-CN': { common: { ok: '确定' } }, 'en-US': { common: { ok: 'OK' } } }
|
|
13
|
+
*/
|
|
14
|
+
export declare const mergeI18nResources: (base?: I18nResources, patch?: I18nResources) => I18nResources;
|
|
15
|
+
/**
|
|
16
|
+
* 根据点分 key 从语言包中取值。
|
|
17
|
+
* 例如 common.submit 会读取 resources[language].common.submit。
|
|
18
|
+
*/
|
|
19
|
+
export declare const getI18nPathValue: (dictionary: I18nDictionary | undefined, key: string) => I18nMessage | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* 替换文案中的插值占位符。
|
|
22
|
+
* 例如 "Hello, {name}" + { name: "Tom" } => "Hello, Tom"。
|
|
23
|
+
*/
|
|
24
|
+
export declare const interpolateI18nMessage: (value: string, data?: I18nInterpolationValues) => string;
|
|
25
|
+
/**
|
|
26
|
+
* 纯翻译函数:只依赖传入的 state。
|
|
27
|
+
* 优先级:指定语言 -> 兜底语言 -> options.fallback -> 原 key。
|
|
28
|
+
*/
|
|
29
|
+
export declare const translate: <T = string>(state: I18nTranslateState, key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => T | string;
|
|
30
|
+
export declare const i18nStore: {
|
|
31
|
+
getState: () => I18nStore;
|
|
32
|
+
getInitialState: () => I18nStore;
|
|
33
|
+
setState: (partial: Partial<I18nStore> | ((state: I18nStore) => Partial<I18nStore>)) => void;
|
|
34
|
+
subscribe: (listener: I18nStoreListener) => () => void;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 对外使用的 i18n 函数。
|
|
38
|
+
* 每次调用都会读取最新 state,适合在非 React 代码中直接使用。
|
|
39
|
+
*/
|
|
40
|
+
export declare const i18n: <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string | T;
|
|
41
|
+
export declare const t: <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string | T;
|
|
42
|
+
export declare const getLanguage: <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string | T;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { defaultLanguage, languageLocalKey, translations } from './locales';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './locales';
|
|
4
|
+
export const isPlainI18nDictionary = (value) => {
|
|
5
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 深合并单个语言包。
|
|
9
|
+
* 嵌套对象递归合并,字符串、数组、数字等叶子节点直接以 patch 覆盖 base。
|
|
10
|
+
*/
|
|
11
|
+
export const mergeI18nDictionary = (base = {}, patch = {}) => {
|
|
12
|
+
const next = { ...base };
|
|
13
|
+
Object.entries(patch).forEach(([key, value]) => {
|
|
14
|
+
const current = next[key];
|
|
15
|
+
if (isPlainI18nDictionary(current) && isPlainI18nDictionary(value)) {
|
|
16
|
+
next[key] = mergeI18nDictionary(current, value);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
next[key] = value;
|
|
20
|
+
});
|
|
21
|
+
return next;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 合并多语言资源。
|
|
25
|
+
* 结构示例:{ 'zh-CN': { common: { ok: '确定' } }, 'en-US': { common: { ok: 'OK' } } }
|
|
26
|
+
*/
|
|
27
|
+
export const mergeI18nResources = (base = {}, patch = {}) => {
|
|
28
|
+
const next = { ...base };
|
|
29
|
+
Object.entries(patch).forEach(([language, messages]) => {
|
|
30
|
+
if (!messages)
|
|
31
|
+
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
|
+
export const getI18nPathValue = (dictionary, key) => {
|
|
41
|
+
if (!dictionary)
|
|
42
|
+
return undefined;
|
|
43
|
+
return key.split('.').reduce((value, currentKey) => {
|
|
44
|
+
if (!isPlainI18nDictionary(value))
|
|
45
|
+
return undefined;
|
|
46
|
+
return value[currentKey];
|
|
47
|
+
}, dictionary);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* 替换文案中的插值占位符。
|
|
51
|
+
* 例如 "Hello, {name}" + { name: "Tom" } => "Hello, Tom"。
|
|
52
|
+
*/
|
|
53
|
+
export const interpolateI18nMessage = (value, data) => {
|
|
54
|
+
if (!data)
|
|
55
|
+
return value;
|
|
56
|
+
return value.replace(/\{([A-Za-z0-9_]+)\}/g, (match, key) => {
|
|
57
|
+
const nextValue = data[key];
|
|
58
|
+
return typeof nextValue === 'undefined' || nextValue === null ? match : String(nextValue);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* 纯翻译函数:只依赖传入的 state。
|
|
63
|
+
* 优先级:指定语言 -> 兜底语言 -> options.fallback -> 原 key。
|
|
64
|
+
*/
|
|
65
|
+
export const translate = (state, key, fillingData, options) => {
|
|
66
|
+
const language = options?.language || state.language;
|
|
67
|
+
const fallbackLanguage = options?.fallbackLanguage || state.fallbackLanguage;
|
|
68
|
+
const value = getI18nPathValue(state.resources[language], key) ??
|
|
69
|
+
getI18nPathValue(state.resources[fallbackLanguage], key) ??
|
|
70
|
+
options?.fallback ??
|
|
71
|
+
key;
|
|
72
|
+
return (typeof value === 'string' ? interpolateI18nMessage(value, fillingData) : value);
|
|
73
|
+
};
|
|
74
|
+
const getBrowserWindow = () => {
|
|
75
|
+
return globalThis.window;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* 初始化时优先读取本地缓存语言。
|
|
79
|
+
* SSR 环境没有 window,直接回退到默认语言。
|
|
80
|
+
*/
|
|
81
|
+
const getStoredLanguage = (storageKey) => {
|
|
82
|
+
const windowRef = getBrowserWindow();
|
|
83
|
+
if (!windowRef) {
|
|
84
|
+
return defaultLanguage;
|
|
85
|
+
}
|
|
86
|
+
return windowRef.localStorage.getItem(storageKey) || defaultLanguage;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* 持久化当前语言,用于刷新页面后保持用户选择。
|
|
90
|
+
*/
|
|
91
|
+
const persistLanguage = (storageKey, language) => {
|
|
92
|
+
const windowRef = getBrowserWindow();
|
|
93
|
+
if (!windowRef)
|
|
94
|
+
return;
|
|
95
|
+
windowRef.localStorage.setItem(storageKey, language);
|
|
96
|
+
};
|
|
97
|
+
const createInitialState = () => ({
|
|
98
|
+
language: getStoredLanguage(languageLocalKey),
|
|
99
|
+
fallbackLanguage: defaultLanguage,
|
|
100
|
+
resources: translations,
|
|
101
|
+
storageKey: languageLocalKey,
|
|
102
|
+
persist: true,
|
|
103
|
+
});
|
|
104
|
+
const createI18nStore = () => {
|
|
105
|
+
let state;
|
|
106
|
+
const listeners = new Set();
|
|
107
|
+
const setState = (partial) => {
|
|
108
|
+
const previousState = state;
|
|
109
|
+
const nextPartial = typeof partial === 'function' ? partial(state) : partial;
|
|
110
|
+
state = { ...state, ...nextPartial };
|
|
111
|
+
listeners.forEach((listener) => listener(state, previousState));
|
|
112
|
+
};
|
|
113
|
+
const initialState = createInitialState();
|
|
114
|
+
state = {
|
|
115
|
+
...initialState,
|
|
116
|
+
t: (key, fillingData, options) => i18n(key, fillingData, options),
|
|
117
|
+
setLanguage: (language) => {
|
|
118
|
+
setState({ language });
|
|
119
|
+
const { persist, storageKey } = state;
|
|
120
|
+
if (persist) {
|
|
121
|
+
persistLanguage(storageKey, language);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
setFallbackLanguage: (fallbackLanguage) => {
|
|
125
|
+
setState({ fallbackLanguage });
|
|
126
|
+
},
|
|
127
|
+
setResources: (resources, options) => {
|
|
128
|
+
setState((currentState) => ({
|
|
129
|
+
resources: options?.merge ? mergeI18nResources(currentState.resources, resources) : resources,
|
|
130
|
+
}));
|
|
131
|
+
},
|
|
132
|
+
addResources: (language, messages, options) => {
|
|
133
|
+
setState((currentState) => {
|
|
134
|
+
const shouldMerge = options?.merge ?? true;
|
|
135
|
+
const currentMessages = currentState.resources[language];
|
|
136
|
+
return {
|
|
137
|
+
resources: {
|
|
138
|
+
...currentState.resources,
|
|
139
|
+
[language]: shouldMerge ? mergeI18nDictionary(currentMessages, messages) : messages,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
configureI18n: (config) => {
|
|
145
|
+
setState(config);
|
|
146
|
+
},
|
|
147
|
+
resetI18n: () => {
|
|
148
|
+
setState(createInitialState());
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
const initialStoreState = state;
|
|
152
|
+
return {
|
|
153
|
+
getState: () => state,
|
|
154
|
+
getInitialState: () => initialStoreState,
|
|
155
|
+
setState,
|
|
156
|
+
subscribe: (listener) => {
|
|
157
|
+
listeners.add(listener);
|
|
158
|
+
return () => {
|
|
159
|
+
listeners.delete(listener);
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
export const i18nStore = createI18nStore();
|
|
165
|
+
/**
|
|
166
|
+
* 对外使用的 i18n 函数。
|
|
167
|
+
* 每次调用都会读取最新 state,适合在非 React 代码中直接使用。
|
|
168
|
+
*/
|
|
169
|
+
export const i18n = (key, fillingData, options) => {
|
|
170
|
+
return translate(i18nStore.getState(), key, fillingData, options);
|
|
171
|
+
};
|
|
172
|
+
export const t = i18n;
|
|
173
|
+
export const getLanguage = i18n;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { I18nResources } from './types';
|
|
2
|
+
export declare const defaultLanguage: "zh-CN";
|
|
3
|
+
export declare const languageLocalKey = "tc_language";
|
|
4
|
+
export declare const translations: I18nResources;
|
|
5
|
+
export type Language = keyof typeof translations | (string & {});
|
|
6
|
+
export * from './default';
|
|
7
|
+
export * from './en-US';
|
|
8
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defaultLanguageResources } from './default';
|
|
2
|
+
import { defaultEnglishResources } from './en-US';
|
|
3
|
+
export const defaultLanguage = 'zh-CN';
|
|
4
|
+
export const languageLocalKey = 'tc_language';
|
|
5
|
+
export const translations = {
|
|
6
|
+
'zh-CN': defaultLanguageResources,
|
|
7
|
+
'en-US': defaultEnglishResources,
|
|
8
|
+
};
|
|
9
|
+
export * from './default';
|
|
10
|
+
export * from './en-US';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type I18nLanguage = string;
|
|
2
|
+
export type I18nPrimitive = string | number | boolean | null | undefined;
|
|
3
|
+
export type I18nMessage = I18nPrimitive | I18nMessage[] | readonly I18nMessage[] | I18nDictionary;
|
|
4
|
+
export interface I18nDictionary {
|
|
5
|
+
[key: string]: I18nMessage;
|
|
6
|
+
}
|
|
7
|
+
export type I18nResources<Language extends I18nLanguage = I18nLanguage> = Partial<Record<Language, I18nDictionary>>;
|
|
8
|
+
export type I18nInterpolationValues = Record<string, I18nPrimitive>;
|
|
9
|
+
export interface I18nTranslateState {
|
|
10
|
+
language: I18nLanguage;
|
|
11
|
+
fallbackLanguage: I18nLanguage;
|
|
12
|
+
resources: I18nResources;
|
|
13
|
+
}
|
|
14
|
+
export interface I18nState extends I18nTranslateState {
|
|
15
|
+
/** 持久化语言时使用的 localStorage key。 */
|
|
16
|
+
storageKey: string;
|
|
17
|
+
/** 是否把 setLanguage 的结果写入 localStorage。 */
|
|
18
|
+
persist: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface I18nTranslateOptions {
|
|
21
|
+
/**
|
|
22
|
+
* 指定本次翻译使用的语言,不传则使用全局 language。
|
|
23
|
+
*/
|
|
24
|
+
language?: I18nLanguage;
|
|
25
|
+
/**
|
|
26
|
+
* 当前语言未命中时使用的兜底语言,不传则使用全局 fallbackLanguage。
|
|
27
|
+
*/
|
|
28
|
+
fallbackLanguage?: I18nLanguage;
|
|
29
|
+
/**
|
|
30
|
+
* 当前语言和兜底语言都未命中时返回的兜底值。
|
|
31
|
+
*/
|
|
32
|
+
fallback?: I18nMessage;
|
|
33
|
+
}
|
|
34
|
+
export interface I18nSetResourcesOptions {
|
|
35
|
+
/**
|
|
36
|
+
* 是否和现有资源深合并。默认 false,直接替换 resources。
|
|
37
|
+
*/
|
|
38
|
+
merge?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface I18nAddResourcesOptions {
|
|
41
|
+
/**
|
|
42
|
+
* 是否和当前语言资源深合并。默认 true。
|
|
43
|
+
*/
|
|
44
|
+
merge?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export type I18nTranslator = <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => T | string;
|
|
47
|
+
export interface I18nActions {
|
|
48
|
+
/** 设置当前展示语言。 */
|
|
49
|
+
setLanguage: (language: I18nLanguage) => void;
|
|
50
|
+
/** 设置兜底语言。 */
|
|
51
|
+
setFallbackLanguage: (language: I18nLanguage) => void;
|
|
52
|
+
/** 批量设置多语言资源,可选择替换或合并。 */
|
|
53
|
+
setResources: (resources: I18nResources, options?: I18nSetResourcesOptions) => void;
|
|
54
|
+
/** 为指定语言追加资源,默认和已有资源深合并。 */
|
|
55
|
+
addResources: (language: I18nLanguage, messages: I18nDictionary, options?: I18nAddResourcesOptions) => void;
|
|
56
|
+
/** 配置存储行为,主要由 I18nProvider 同步外部 props 使用。 */
|
|
57
|
+
configureI18n: (config: Partial<Pick<I18nState, 'storageKey' | 'persist'>>) => void;
|
|
58
|
+
/** 重置为默认语言、默认资源和默认存储配置。 */
|
|
59
|
+
resetI18n: () => void;
|
|
60
|
+
/** 挂在 store 上的翻译函数,方便直接读取。 */
|
|
61
|
+
t: I18nTranslator;
|
|
62
|
+
}
|
|
63
|
+
export type I18nStore = I18nState & I18nActions;
|
|
64
|
+
export type I18nStoreListener = (state: I18nStore, previousState: I18nStore) => void;
|
|
65
|
+
export interface I18nStoreApi {
|
|
66
|
+
getState: () => I18nStore;
|
|
67
|
+
getInitialState: () => I18nStore;
|
|
68
|
+
setState: (partial: Partial<I18nStore> | ((state: I18nStore) => Partial<I18nStore>)) => void;
|
|
69
|
+
subscribe: (listener: I18nStoreListener) => () => void;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./array";
|
|
2
|
+
export * from "./cache";
|
|
3
|
+
export * from "./guards";
|
|
4
|
+
export * from "./http";
|
|
5
|
+
export * from "./i18n";
|
|
6
|
+
export * from "./log";
|
|
7
|
+
export * from "./number";
|
|
8
|
+
export * from "./object";
|
|
9
|
+
export * from "./string";
|
|
10
|
+
export * from "./types";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./array";
|
|
2
|
+
export * from "./cache";
|
|
3
|
+
export * from "./guards";
|
|
4
|
+
export * from "./http";
|
|
5
|
+
export * from "./i18n";
|
|
6
|
+
export * from "./log";
|
|
7
|
+
export * from "./number";
|
|
8
|
+
export * from "./object";
|
|
9
|
+
export * from "./string";
|
|
10
|
+
export * from "./types";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const ANSI_RESET = "\u001B[0m";
|
|
2
|
+
export declare const ansiColors: {
|
|
3
|
+
readonly black: "\u001B[30m";
|
|
4
|
+
readonly red: "\u001B[31m";
|
|
5
|
+
readonly green: "\u001B[32m";
|
|
6
|
+
readonly yellow: "\u001B[33m";
|
|
7
|
+
readonly blue: "\u001B[34m";
|
|
8
|
+
readonly magenta: "\u001B[35m";
|
|
9
|
+
readonly pink: "\u001B[95m";
|
|
10
|
+
readonly cyan: "\u001B[36m";
|
|
11
|
+
readonly white: "\u001B[37m";
|
|
12
|
+
readonly gray: "\u001B[90m";
|
|
13
|
+
};
|
|
14
|
+
export type LogColor = keyof typeof ansiColors;
|
|
15
|
+
export type ColorLogOptions = {
|
|
16
|
+
color?: LogColor;
|
|
17
|
+
prefix?: string;
|
|
18
|
+
suffix?: string;
|
|
19
|
+
};
|
|
20
|
+
export type ColorLogAffixes = Omit<ColorLogOptions, 'color'>;
|
|
21
|
+
export declare const colorize: (message: unknown, color?: LogColor) => string;
|
|
22
|
+
export declare const joinColorized: (...messages: readonly unknown[]) => string;
|
|
23
|
+
export declare const logJoinColorized: (...messages: readonly unknown[]) => void;
|
|
24
|
+
export declare function colorLog(color: LogColor, ...data: unknown[]): void;
|
|
25
|
+
export declare function colorLog(...data: unknown[]): void;
|
|
26
|
+
export declare const logColor: (color: LogColor, ...data: unknown[]) => void;
|
|
27
|
+
export declare const logColorized: (...messages: readonly unknown[]) => void;
|
|
28
|
+
export declare const logGreen: (...data: unknown[]) => void;
|
|
29
|
+
export declare const logYellow: (...data: unknown[]) => void;
|
|
30
|
+
export declare const logPink: (...data: unknown[]) => void;
|
|
31
|
+
export declare const logWhite: (...data: unknown[]) => void;
|
|
32
|
+
export declare const logRed: (...data: unknown[]) => void;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
export const ANSI_RESET = '\x1b[0m';
|
|
2
|
+
export const ansiColors = {
|
|
3
|
+
black: '\x1b[30m',
|
|
4
|
+
red: '\x1b[31m',
|
|
5
|
+
green: '\x1b[32m',
|
|
6
|
+
yellow: '\x1b[33m',
|
|
7
|
+
blue: '\x1b[34m',
|
|
8
|
+
magenta: '\x1b[35m',
|
|
9
|
+
pink: '\x1b[95m',
|
|
10
|
+
cyan: '\x1b[36m',
|
|
11
|
+
white: '\x1b[37m',
|
|
12
|
+
gray: '\x1b[90m',
|
|
13
|
+
};
|
|
14
|
+
const getConsole = () => {
|
|
15
|
+
const globalValue = globalThis;
|
|
16
|
+
return globalValue.console;
|
|
17
|
+
};
|
|
18
|
+
export const colorize = (message, color = 'green') => {
|
|
19
|
+
return `${ansiColors[color]}${String(message)}${ANSI_RESET}`;
|
|
20
|
+
};
|
|
21
|
+
export const joinColorized = (...messages) => {
|
|
22
|
+
return messages.map(String).join('');
|
|
23
|
+
};
|
|
24
|
+
export const logJoinColorized = (...messages) => {
|
|
25
|
+
getConsole()?.log(messages.map(String).join(''));
|
|
26
|
+
};
|
|
27
|
+
const inspectPrimitive = (value) => {
|
|
28
|
+
if (typeof value === 'string')
|
|
29
|
+
return `'${value}'`;
|
|
30
|
+
if (typeof value === 'bigint')
|
|
31
|
+
return `${value}n`;
|
|
32
|
+
if (typeof value === 'symbol')
|
|
33
|
+
return String(value);
|
|
34
|
+
if (typeof value === 'function')
|
|
35
|
+
return `[Function${value.name ? `: ${value.name}` : ''}]`;
|
|
36
|
+
if (value === undefined)
|
|
37
|
+
return 'undefined';
|
|
38
|
+
if (value === null)
|
|
39
|
+
return 'null';
|
|
40
|
+
return String(value);
|
|
41
|
+
};
|
|
42
|
+
const inspectValue = (value, context, depth = 0) => {
|
|
43
|
+
if (value === null || typeof value !== 'object')
|
|
44
|
+
return inspectPrimitive(value);
|
|
45
|
+
if (context.seen.has(value))
|
|
46
|
+
return '[Circular]';
|
|
47
|
+
if (value instanceof Date)
|
|
48
|
+
return value.toISOString();
|
|
49
|
+
if (value instanceof Error)
|
|
50
|
+
return value.stack ?? `${value.name}: ${value.message}`;
|
|
51
|
+
context.seen.add(value);
|
|
52
|
+
if (Array.isArray(value)) {
|
|
53
|
+
const items = value.map((item) => inspectValue(item, context, depth + 1));
|
|
54
|
+
context.seen.delete(value);
|
|
55
|
+
return `[${items.join(', ')}]`;
|
|
56
|
+
}
|
|
57
|
+
const entries = Object.entries(value);
|
|
58
|
+
if (entries.length === 0) {
|
|
59
|
+
context.seen.delete(value);
|
|
60
|
+
return '{}';
|
|
61
|
+
}
|
|
62
|
+
const indent = ' '.repeat(depth);
|
|
63
|
+
const nextIndent = ' '.repeat(depth + 1);
|
|
64
|
+
const body = entries
|
|
65
|
+
.map(([key, item]) => `${nextIndent}${key}: ${inspectValue(item, context, depth + 1)}`)
|
|
66
|
+
.join(',\n');
|
|
67
|
+
context.seen.delete(value);
|
|
68
|
+
return `{\n${body}\n${indent}}`;
|
|
69
|
+
};
|
|
70
|
+
const stringifyLogValue = (value) => {
|
|
71
|
+
return typeof value === 'string' ? value : inspectValue(value, { seen: new WeakSet() });
|
|
72
|
+
};
|
|
73
|
+
const formatSpecifier = (specifier, value) => {
|
|
74
|
+
if (specifier === '%%')
|
|
75
|
+
return '%';
|
|
76
|
+
if (specifier === '%s')
|
|
77
|
+
return String(value);
|
|
78
|
+
if (specifier === '%d' || specifier === '%i')
|
|
79
|
+
return Number.parseInt(String(value), 10).toString();
|
|
80
|
+
if (specifier === '%f')
|
|
81
|
+
return Number.parseFloat(String(value)).toString();
|
|
82
|
+
if (specifier === '%j') {
|
|
83
|
+
try {
|
|
84
|
+
return JSON.stringify(value);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return '[Circular]';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (specifier === '%o' || specifier === '%O')
|
|
91
|
+
return stringifyLogValue(value);
|
|
92
|
+
if (specifier === '%c')
|
|
93
|
+
return '';
|
|
94
|
+
return specifier;
|
|
95
|
+
};
|
|
96
|
+
const formatLogData = (data) => {
|
|
97
|
+
if (data.length === 0)
|
|
98
|
+
return '';
|
|
99
|
+
const [first, ...rest] = data;
|
|
100
|
+
if (typeof first !== 'string') {
|
|
101
|
+
return data.map(stringifyLogValue).join(' ');
|
|
102
|
+
}
|
|
103
|
+
let index = 0;
|
|
104
|
+
const formatted = first.replace(/%[sdifjoOc%]/g, (specifier) => {
|
|
105
|
+
if (specifier === '%%')
|
|
106
|
+
return '%';
|
|
107
|
+
if (index >= rest.length)
|
|
108
|
+
return specifier;
|
|
109
|
+
const value = rest[index];
|
|
110
|
+
index += 1;
|
|
111
|
+
return formatSpecifier(specifier, value);
|
|
112
|
+
});
|
|
113
|
+
const remaining = rest.slice(index).map(stringifyLogValue);
|
|
114
|
+
return [formatted, ...remaining].join(' ');
|
|
115
|
+
};
|
|
116
|
+
const isLogColor = (value) => {
|
|
117
|
+
return typeof value === 'string' && value in ansiColors;
|
|
118
|
+
};
|
|
119
|
+
const isColorLogOptions = (value) => {
|
|
120
|
+
if (value === null || typeof value !== 'object')
|
|
121
|
+
return false;
|
|
122
|
+
const keys = Object.keys(value);
|
|
123
|
+
if (!keys.some((key) => key === 'color' || key === 'prefix' || key === 'suffix')) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
const options = value;
|
|
127
|
+
return options.color === undefined || isLogColor(options.color);
|
|
128
|
+
};
|
|
129
|
+
const withColor = (color, data, options = {}) => {
|
|
130
|
+
const prefix = options.prefix ?? '';
|
|
131
|
+
const suffix = options.suffix ?? '';
|
|
132
|
+
const message = formatLogData(data);
|
|
133
|
+
return [`${ansiColors[color]}${prefix}${message}${suffix}${ANSI_RESET}`];
|
|
134
|
+
};
|
|
135
|
+
const printColorMessage = (data, config) => {
|
|
136
|
+
const color = config.color ?? 'green';
|
|
137
|
+
getConsole()?.log(...withColor(color, data, config));
|
|
138
|
+
};
|
|
139
|
+
export function colorLog(...data) {
|
|
140
|
+
const [first, ...rest] = data;
|
|
141
|
+
const last = data.at(-1);
|
|
142
|
+
if (isLogColor(first) && data.length >= 2) {
|
|
143
|
+
printColorMessage(rest, { color: first });
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (isLogColor(last) && data.length === 2) {
|
|
147
|
+
printColorMessage([first], { color: last });
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (isColorLogOptions(last) && data.length >= 2) {
|
|
151
|
+
printColorMessage(data.slice(0, -1), last);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
printColorMessage(data, { color: 'green' });
|
|
155
|
+
}
|
|
156
|
+
export const logColor = (color, ...data) => {
|
|
157
|
+
printColorMessage(data, { color });
|
|
158
|
+
};
|
|
159
|
+
export const logColorized = (...messages) => {
|
|
160
|
+
getConsole()?.log(...messages);
|
|
161
|
+
};
|
|
162
|
+
export const logGreen = (...data) => {
|
|
163
|
+
logColor('green', ...data);
|
|
164
|
+
};
|
|
165
|
+
export const logYellow = (...data) => {
|
|
166
|
+
logColor('yellow', ...data);
|
|
167
|
+
};
|
|
168
|
+
export const logPink = (...data) => {
|
|
169
|
+
logColor('pink', ...data);
|
|
170
|
+
};
|
|
171
|
+
export const logWhite = (...data) => {
|
|
172
|
+
logColor('white', ...data);
|
|
173
|
+
};
|
|
174
|
+
export const logRed = (...data) => {
|
|
175
|
+
logColor('red', ...data);
|
|
176
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const clamp = (value, min, max) => {
|
|
2
|
+
if (min > max) {
|
|
3
|
+
throw new RangeError("min must be less than or equal to max");
|
|
4
|
+
}
|
|
5
|
+
return Math.min(Math.max(value, min), max);
|
|
6
|
+
};
|
|
7
|
+
export const toFiniteNumber = (value, fallback = 0) => {
|
|
8
|
+
const numberValue = typeof value === "number" ? value : Number(value);
|
|
9
|
+
return Number.isFinite(numberValue) ? numberValue : fallback;
|
|
10
|
+
};
|