@env-hopper/frontend-core 2.0.1-alpha
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/LICENSE +21 -0
- package/dist/apple-touch-180x180.png +0 -0
- package/dist/disable.well-known/appspecific/com.chrome.devtools.json +6 -0
- package/dist/env-hopper-16x16.png +0 -0
- package/dist/env-hopper-192x192.png +0 -0
- package/dist/env-hopper-32x32.png +0 -0
- package/dist/env-hopper-48x48.png +0 -0
- package/dist/env-hopper-512x512.png +0 -0
- package/dist/env-hopper-square.svg +114 -0
- package/dist/esm/App.d.ts +12 -0
- package/dist/esm/App.js +12 -0
- package/dist/esm/App.js.map +1 -0
- package/dist/esm/__tests__/modules/fuzzyMatchLogic/autoCompleteFilter.test.d.ts +1 -0
- package/dist/esm/__tests__/modules/fuzzyMatchLogic/features/prefixFracTokenMiddles.test.d.ts +1 -0
- package/dist/esm/__tests__/modules/fuzzyMatchLogic/fixLayout.test.d.ts +1 -0
- package/dist/esm/__tests__/modules/fuzzyMatchLogic/postFiltration.test.d.ts +1 -0
- package/dist/esm/__tests__/modules/fuzzyMatchLogic/testUtils.d.ts +2 -0
- package/dist/esm/__tests__/modules/fuzzyMatchLogic/tokenize.test.d.ts +1 -0
- package/dist/esm/__tests__/modules/resouceJump/findBestMatchByUrl.test.d.ts +1 -0
- package/dist/esm/__tests__/setupTests.d.ts +0 -0
- package/dist/esm/__tests__/util/availabilityMatrixUtils.test.d.ts +1 -0
- package/dist/esm/api/ApiQueryMagazine.d.ts +12 -0
- package/dist/esm/api/ApiQueryMagazine.js +16 -0
- package/dist/esm/api/ApiQueryMagazine.js.map +1 -0
- package/dist/esm/api/data/useQueryBootstrapConfig.d.ts +3 -0
- package/dist/esm/api/data/useQueryBootstrapConfig.js +14 -0
- package/dist/esm/api/data/useQueryBootstrapConfig.js.map +1 -0
- package/dist/esm/api/infra/createQueryClient.d.ts +7 -0
- package/dist/esm/api/infra/createQueryClient.js +23 -0
- package/dist/esm/api/infra/createQueryClient.js.map +1 -0
- package/dist/esm/api/infra/trpc.d.ts +93 -0
- package/dist/esm/api/infra/trpc.js +8 -0
- package/dist/esm/api/infra/trpc.js.map +1 -0
- package/dist/esm/api/unsorted/indexDataFetcher.d.ts +11 -0
- package/dist/esm/api/unsorted/indexDataFetcher.js +35 -0
- package/dist/esm/api/unsorted/indexDataFetcher.js.map +1 -0
- package/dist/esm/appPropsFactory.d.ts +2 -0
- package/dist/esm/appPropsFactory.js +32 -0
- package/dist/esm/appPropsFactory.js.map +1 -0
- package/dist/esm/assets/env-hopper-logo.svg.js +16 -0
- package/dist/esm/assets/env-hopper-logo.svg.js.map +1 -0
- package/dist/esm/components/ThemeSwitcher.d.ts +1 -0
- package/dist/esm/components/ThemeSwitcher.js +25 -0
- package/dist/esm/components/ThemeSwitcher.js.map +1 -0
- package/dist/esm/components/theme-provider.d.ts +2 -0
- package/dist/esm/components/theme-provider.js +10 -0
- package/dist/esm/components/theme-provider.js.map +1 -0
- package/dist/esm/components/ui/badge.d.ts +9 -0
- package/dist/esm/components/ui/breadcrumb.d.ts +46 -0
- package/dist/esm/components/ui/button.d.ts +16 -0
- package/dist/esm/components/ui/button.js +52 -0
- package/dist/esm/components/ui/button.js.map +1 -0
- package/dist/esm/components/ui/card.d.ts +38 -0
- package/dist/esm/components/ui/collapsible.d.ts +5 -0
- package/dist/esm/components/ui/dialog.d.ts +21 -0
- package/dist/esm/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/esm/components/ui/input.d.ts +10 -0
- package/dist/esm/components/ui/popover.d.ts +7 -0
- package/dist/esm/components/ui/popover.js +14 -0
- package/dist/esm/components/ui/popover.js.map +1 -0
- package/dist/esm/components/ui/scroll-area.d.ts +5 -0
- package/dist/esm/components/ui/separator.d.ts +4 -0
- package/dist/esm/components/ui/separator.js +27 -0
- package/dist/esm/components/ui/separator.js.map +1 -0
- package/dist/esm/components/ui/tabs.d.ts +7 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/utils.d.ts +2 -0
- package/dist/esm/lib/utils.js +9 -0
- package/dist/esm/lib/utils.js.map +1 -0
- package/dist/esm/main.d.ts +0 -0
- package/dist/esm/modules/config/BootstrapConfigContext.d.ts +9 -0
- package/dist/esm/modules/config/BootstrapConfigContext.js +25 -0
- package/dist/esm/modules/config/BootstrapConfigContext.js.map +1 -0
- package/dist/esm/modules/config/GlobalConfigContext.d.ts +14 -0
- package/dist/esm/modules/config/GlobalConfigContext.js +21 -0
- package/dist/esm/modules/config/GlobalConfigContext.js.map +1 -0
- package/dist/esm/modules/environment/ApiQueryMagazineEnvironment.d.ts +12 -0
- package/dist/esm/modules/environment/ApiQueryMagazineEnvironment.js +13 -0
- package/dist/esm/modules/environment/ApiQueryMagazineEnvironment.js.map +1 -0
- package/dist/esm/modules/environment/EnvironmentContext.d.ts +15 -0
- package/dist/esm/modules/environment/EnvironmentContext.js +67 -0
- package/dist/esm/modules/environment/EnvironmentContext.js.map +1 -0
- package/dist/esm/modules/environment/types.d.ts +4 -0
- package/dist/esm/modules/environment/ui/EhEnvSelector.d.ts +9 -0
- package/dist/esm/modules/environment/ui/EhEnvSelector.js +167 -0
- package/dist/esm/modules/environment/ui/EhEnvSelector.js.map +1 -0
- package/dist/esm/modules/fuzzyMatchLogic/autoCompleteFilter.d.ts +3 -0
- package/dist/esm/modules/fuzzyMatchLogic/autoCompleteFilter.js +43 -0
- package/dist/esm/modules/fuzzyMatchLogic/autoCompleteFilter.js.map +1 -0
- package/dist/esm/modules/fuzzyMatchLogic/features/prefixFrac.d.ts +1 -0
- package/dist/esm/modules/fuzzyMatchLogic/features/prefixFrac.js +12 -0
- package/dist/esm/modules/fuzzyMatchLogic/features/prefixFrac.js.map +1 -0
- package/dist/esm/modules/fuzzyMatchLogic/features/prefixFracTokenMiddles.d.ts +2 -0
- package/dist/esm/modules/fuzzyMatchLogic/fixLayout.d.ts +2 -0
- package/dist/esm/modules/fuzzyMatchLogic/postFiltration.d.ts +2 -0
- package/dist/esm/modules/fuzzyMatchLogic/scoring.d.ts +2 -0
- package/dist/esm/modules/fuzzyMatchLogic/scoring.js +23 -0
- package/dist/esm/modules/fuzzyMatchLogic/scoring.js.map +1 -0
- package/dist/esm/modules/fuzzyMatchLogic/tokenize.d.ts +3 -0
- package/dist/esm/modules/fuzzyMatchLogic/types.d.ts +25 -0
- package/dist/esm/modules/fuzzyMatchLogic/utils.d.ts +2 -0
- package/dist/esm/modules/fuzzyMatchLogic/utils.js +12 -0
- package/dist/esm/modules/fuzzyMatchLogic/utils.js.map +1 -0
- package/dist/esm/modules/pluginCore/PluginManagerContext.d.ts +24 -0
- package/dist/esm/modules/pluginCore/PluginManagerContext.js +62 -0
- package/dist/esm/modules/pluginCore/PluginManagerContext.js.map +1 -0
- package/dist/esm/modules/pluginCore/makePluginManagerContext.d.ts +7 -0
- package/dist/esm/modules/pluginCore/makePluginManagerContext.js +27 -0
- package/dist/esm/modules/pluginCore/makePluginManagerContext.js.map +1 -0
- package/dist/esm/modules/pluginCore/types.d.ts +36 -0
- package/dist/esm/modules/pluginCore/types.js +7 -0
- package/dist/esm/modules/pluginCore/types.js.map +1 -0
- package/dist/esm/modules/resourceJump/ApiQueryMagazineResourceJump.d.ts +27 -0
- package/dist/esm/modules/resourceJump/ApiQueryMagazineResourceJump.js +26 -0
- package/dist/esm/modules/resourceJump/ApiQueryMagazineResourceJump.js.map +1 -0
- package/dist/esm/modules/resourceJump/ResourceJumpContext.d.ts +17 -0
- package/dist/esm/modules/resourceJump/ResourceJumpContext.js +88 -0
- package/dist/esm/modules/resourceJump/ResourceJumpContext.js.map +1 -0
- package/dist/esm/modules/resourceJump/buildJumpUrl.d.ts +2 -0
- package/dist/esm/modules/resourceJump/buildJumpUrl.js +32 -0
- package/dist/esm/modules/resourceJump/buildJumpUrl.js.map +1 -0
- package/dist/esm/modules/resourceJump/findBestMatchByUrl.d.ts +17 -0
- package/dist/esm/modules/resourceJump/findBestMatchByUrl.js +85 -0
- package/dist/esm/modules/resourceJump/findBestMatchByUrl.js.map +1 -0
- package/dist/esm/modules/resourceJump/helpers.d.ts +28 -0
- package/dist/esm/modules/resourceJump/helpers.js +19 -0
- package/dist/esm/modules/resourceJump/helpers.js.map +1 -0
- package/dist/esm/modules/resourceJump/routeLoader.d.ts +11 -0
- package/dist/esm/modules/resourceJump/routeLoader.js +43 -0
- package/dist/esm/modules/resourceJump/routeLoader.js.map +1 -0
- package/dist/esm/modules/resourceJump/types.d.ts +18 -0
- package/dist/esm/modules/resourceJump/ui/EhJumpResourceSelector.d.ts +20 -0
- package/dist/esm/modules/resourceJump/ui/EhJumpResourceSelector.js +209 -0
- package/dist/esm/modules/resourceJump/ui/EhJumpResourceSelector.js.map +1 -0
- package/dist/esm/modules/resourceJump/ui/JumpALink.d.ts +14 -0
- package/dist/esm/modules/resourceJump/ui/JumpALink.js +38 -0
- package/dist/esm/modules/resourceJump/ui/JumpALink.js.map +1 -0
- package/dist/esm/modules/resourceJump/ui/JumpMainButton.d.ts +5 -0
- package/dist/esm/modules/resourceJump/ui/JumpMainButton.js +66 -0
- package/dist/esm/modules/resourceJump/ui/JumpMainButton.js.map +1 -0
- package/dist/esm/modules/resourceJump/ui/ResouceJumpLayout.d.ts +5 -0
- package/dist/esm/modules/resourceJump/ui/ResouceJumpLayout.js +42 -0
- package/dist/esm/modules/resourceJump/ui/ResouceJumpLayout.js.map +1 -0
- package/dist/esm/plugins/builtin/pageUrl/PageUrlPluginContext.d.ts +9 -0
- package/dist/esm/plugins/builtin/pageUrl/PageUrlPluginContext.js +36 -0
- package/dist/esm/plugins/builtin/pageUrl/PageUrlPluginContext.js.map +1 -0
- package/dist/esm/plugins/builtin/pageUrl/pageUrlAutoCompletePlugin.d.ts +11 -0
- package/dist/esm/plugins/builtin/pageUrl/pageUrlAutoCompletePlugin.js +44 -0
- package/dist/esm/plugins/builtin/pageUrl/pageUrlAutoCompletePlugin.js.map +1 -0
- package/dist/esm/plugins/builtin/pageUrl/pageUrlJumpPlugin.d.ts +7 -0
- package/dist/esm/plugins/builtin/pageUrl/pageUrlJumpPlugin.js +29 -0
- package/dist/esm/plugins/builtin/pageUrl/pageUrlJumpPlugin.js.map +1 -0
- package/dist/esm/plugins/builtin/pageUrl/pageUrlTypes.d.ts +11 -0
- package/dist/esm/routeTree.gen.d.ts +142 -0
- package/dist/esm/routeTree.gen.js +77 -0
- package/dist/esm/routeTree.gen.js.map +1 -0
- package/dist/esm/routes/__root.d.ts +2 -0
- package/dist/esm/routes/__root.js +22 -0
- package/dist/esm/routes/__root.js.map +1 -0
- package/dist/esm/routes/_layout/app/$appSlug/sub/$subValue.d.ts +1 -0
- package/dist/esm/routes/_layout/app/$appSlug.d.ts +1 -0
- package/dist/esm/routes/_layout/app/_appSlug/sub/_subValue.js +18 -0
- package/dist/esm/routes/_layout/app/_appSlug/sub/_subValue.js.map +1 -0
- package/dist/esm/routes/_layout/app/_appSlug.js +18 -0
- package/dist/esm/routes/_layout/app/_appSlug.js.map +1 -0
- package/dist/esm/routes/_layout/env/$envSlug/app/$appSlug/sub/$subValue.d.ts +1 -0
- package/dist/esm/routes/_layout/env/$envSlug/app/$appSlug.d.ts +1 -0
- package/dist/esm/routes/_layout/env/$envSlug/sub/$subValue.d.ts +1 -0
- package/dist/esm/routes/_layout/env/$envSlug.d.ts +1 -0
- package/dist/esm/routes/_layout/env/_envSlug/app/_appSlug/sub/_subValue.js +20 -0
- package/dist/esm/routes/_layout/env/_envSlug/app/_appSlug/sub/_subValue.js.map +1 -0
- package/dist/esm/routes/_layout/env/_envSlug/app/_appSlug.js +18 -0
- package/dist/esm/routes/_layout/env/_envSlug/app/_appSlug.js.map +1 -0
- package/dist/esm/routes/_layout/env/_envSlug/sub/_subValue.js +18 -0
- package/dist/esm/routes/_layout/env/_envSlug/sub/_subValue.js.map +1 -0
- package/dist/esm/routes/_layout/env/_envSlug.js +18 -0
- package/dist/esm/routes/_layout/env/_envSlug.js.map +1 -0
- package/dist/esm/routes/_layout/index.d.ts +1 -0
- package/dist/esm/routes/_layout/index.js +18 -0
- package/dist/esm/routes/_layout/index.js.map +1 -0
- package/dist/esm/routes/_layout.d.ts +1 -0
- package/dist/esm/routes/_layout.js +12 -0
- package/dist/esm/routes/_layout.js.map +1 -0
- package/dist/esm/types/ehTypes.d.ts +31 -0
- package/dist/esm/types/slateTypes.d.ts +28 -0
- package/dist/esm/types/tanstackQuery.d.ts +11 -0
- package/dist/esm/types/types.d.ts +16 -0
- package/dist/esm/types/userBehaviourTypes.d.ts +76 -0
- package/dist/esm/types/utilityTypes.d.ts +1 -0
- package/dist/esm/ui/components/ActionCard.d.ts +9 -0
- package/dist/esm/ui/components/AppIcon.d.ts +7 -0
- package/dist/esm/ui/components/commandInput/EhBaseSelector.d.ts +6 -0
- package/dist/esm/ui/components/commandInput/EhBaseSelector.js +22 -0
- package/dist/esm/ui/components/commandInput/EhBaseSelector.js.map +1 -0
- package/dist/esm/ui/components/commandInput/types.d.ts +13 -0
- package/dist/esm/ui/components/contextDebug.d.ts +2 -0
- package/dist/esm/ui/components/contextDebug.js +12 -0
- package/dist/esm/ui/components/contextDebug.js.map +1 -0
- package/dist/esm/ui/components/controlPanel/BaseDropdownSelector.d.ts +11 -0
- package/dist/esm/ui/components/controlPanel/env/EnvDropdownContent.d.ts +5 -0
- package/dist/esm/ui/components/controlPanel/env/EnvDropdownSelector.d.ts +1 -0
- package/dist/esm/ui/components/error/DefaultErrorComponent.d.ts +2 -0
- package/dist/esm/ui/components/error/DefaultErrorComponent.js +13 -0
- package/dist/esm/ui/components/error/DefaultErrorComponent.js.map +1 -0
- package/dist/esm/ui/components/error/RooutErrorPage.d.ts +2 -0
- package/dist/esm/ui/components/error/RooutErrorPage.js +12 -0
- package/dist/esm/ui/components/error/RooutErrorPage.js.map +1 -0
- package/dist/esm/ui/components/footer/Footer.d.ts +1 -0
- package/dist/esm/ui/components/footer/Footer.js +38 -0
- package/dist/esm/ui/components/footer/Footer.js.map +1 -0
- package/dist/esm/ui/components/header/PlaygroundHeader.d.ts +1 -0
- package/dist/esm/ui/components/header/PlaygroundHeader.js +23 -0
- package/dist/esm/ui/components/header/PlaygroundHeader.js.map +1 -0
- package/dist/esm/ui/components/leftPanel/LeftPanel.d.ts +5 -0
- package/dist/esm/ui/components/quickBar/EnvQuickJumpBar.d.ts +5 -0
- package/dist/esm/ui/components/quickBar/EnvQuickJumpBar.js +52 -0
- package/dist/esm/ui/components/quickBar/EnvQuickJumpBar.js.map +1 -0
- package/dist/esm/ui/components/quickBar/QuickJumpBar.d.ts +5 -0
- package/dist/esm/ui/components/widgetPanel/AddWidgetCard.d.ts +5 -0
- package/dist/esm/ui/components/widgetPanel/WidgetGrid.d.ts +6 -0
- package/dist/esm/ui/components/widgets/CredentialsWidget.d.ts +11 -0
- package/dist/esm/ui/components/widgets/VersionWidget.d.ts +7 -0
- package/dist/esm/ui/error/NotFoundError.d.ts +1 -0
- package/dist/esm/ui/error/NotFoundError.js +16 -0
- package/dist/esm/ui/error/NotFoundError.js.map +1 -0
- package/dist/esm/ui/layout/Footer.d.ts +1 -0
- package/dist/esm/ui/layout/Header.d.ts +1 -0
- package/dist/esm/ui/layout/LoadingScreen.d.ts +4 -0
- package/dist/esm/ui/layout/LoadingScreen.js +14 -0
- package/dist/esm/ui/layout/LoadingScreen.js.map +1 -0
- package/dist/esm/ui/layout/MainLayout.d.ts +5 -0
- package/dist/esm/ui/layout/MainLayout.js +18 -0
- package/dist/esm/ui/layout/MainLayout.js.map +1 -0
- package/dist/esm/ui/layout/SideColumn.d.ts +1 -0
- package/dist/esm/ui/layout/TopLevelProviders.d.ts +5 -0
- package/dist/esm/ui/layout/TopLevelProviders.js +42 -0
- package/dist/esm/ui/layout/TopLevelProviders.js.map +1 -0
- package/dist/esm/ui/main/JumpTabContent.d.ts +1 -0
- package/dist/esm/ui/main/Tabs.d.ts +4 -0
- package/dist/esm/userDb/DbContext.d.ts +9 -0
- package/dist/esm/userDb/DbContext.js +18 -0
- package/dist/esm/userDb/DbContext.js.map +1 -0
- package/dist/esm/userDb/EhDb.d.ts +12 -0
- package/dist/esm/userDb/EhDb.js +20 -0
- package/dist/esm/userDb/EhDb.js.map +1 -0
- package/dist/esm/util/availabilityMatrixUtils.d.ts +12 -0
- package/dist/esm/util/availabilityMatrixUtils.js +57 -0
- package/dist/esm/util/availabilityMatrixUtils.js.map +1 -0
- package/dist/esm/util/createEhRouter.d.ts +7 -0
- package/dist/esm/util/createEhRouter.js +16 -0
- package/dist/esm/util/createEhRouter.js.map +1 -0
- package/dist/esm/util/highlightMatches.d.ts +2 -0
- package/dist/esm/util/highlightMatches.js +19 -0
- package/dist/esm/util/highlightMatches.js.map +1 -0
- package/dist/esm/util/reactQueryUtils.d.ts +6 -0
- package/dist/esm/util/reactQueryUtils.js +10 -0
- package/dist/esm/util/reactQueryUtils.js.map +1 -0
- package/dist/esm/util/route-utils.d.ts +6 -0
- package/dist/esm/util/route-utils.js +72 -0
- package/dist/esm/util/route-utils.js.map +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/robots.txt +2 -0
- package/package.json +110 -0
- package/src/App.tsx +28 -0
- package/src/__tests__/modules/fuzzyMatchLogic/autoCompleteFilter.test.ts +185 -0
- package/src/__tests__/modules/fuzzyMatchLogic/features/prefixFracTokenMiddles.test.ts +23 -0
- package/src/__tests__/modules/fuzzyMatchLogic/fixLayout.test.ts +11 -0
- package/src/__tests__/modules/fuzzyMatchLogic/postFiltration.test.ts +15 -0
- package/src/__tests__/modules/fuzzyMatchLogic/testUtils.ts +8 -0
- package/src/__tests__/modules/fuzzyMatchLogic/tokenize.test.ts +65 -0
- package/src/__tests__/modules/resouceJump/findBestMatchByUrl.test.ts +234 -0
- package/src/__tests__/setupTests.tsx +0 -0
- package/src/__tests__/util/availabilityMatrixUtils.test.ts +61 -0
- package/src/api/ApiQueryMagazine.ts +15 -0
- package/src/api/data/useQueryBootstrapConfig.ts +17 -0
- package/src/api/infra/createQueryClient.ts +25 -0
- package/src/api/infra/trpc.ts +6 -0
- package/src/api/unsorted/indexDataFetcher.ts +46 -0
- package/src/appPropsFactory.ts +35 -0
- package/src/assets/env-hopper-logo.svg +114 -0
- package/src/components/ThemeSwitcher.tsx +22 -0
- package/src/components/theme-provider.tsx +8 -0
- package/src/components/ui/badge.tsx +37 -0
- package/src/components/ui/breadcrumb.tsx +128 -0
- package/src/components/ui/button.tsx +60 -0
- package/src/components/ui/card.tsx +95 -0
- package/src/components/ui/collapsible.tsx +31 -0
- package/src/components/ui/dialog.tsx +182 -0
- package/src/components/ui/dropdown-menu.tsx +257 -0
- package/src/components/ui/input.tsx +28 -0
- package/src/components/ui/popover.tsx +48 -0
- package/src/components/ui/scroll-area.tsx +58 -0
- package/src/components/ui/separator.tsx +26 -0
- package/src/components/ui/tabs.tsx +65 -0
- package/src/index.css +211 -0
- package/src/index.tsx +3 -0
- package/src/lib/utils.ts +7 -0
- package/src/main.tsx +53 -0
- package/src/modules/config/BootstrapConfigContext.tsx +33 -0
- package/src/modules/config/GlobalConfigContext.tsx +42 -0
- package/src/modules/environment/ApiQueryMagazineEnvironment.ts +12 -0
- package/src/modules/environment/EnvironmentContext.tsx +115 -0
- package/src/modules/environment/types.ts +4 -0
- package/src/modules/environment/ui/EhEnvSelector.tsx +191 -0
- package/src/modules/fuzzyMatchLogic/autoCompleteFilter.ts +186 -0
- package/src/modules/fuzzyMatchLogic/features/prefixFrac.ts +13 -0
- package/src/modules/fuzzyMatchLogic/features/prefixFracTokenMiddles.ts +29 -0
- package/src/modules/fuzzyMatchLogic/fixLayout.ts +24 -0
- package/src/modules/fuzzyMatchLogic/postFiltration.ts +35 -0
- package/src/modules/fuzzyMatchLogic/scoring.ts +42 -0
- package/src/modules/fuzzyMatchLogic/tokenize.ts +32 -0
- package/src/modules/fuzzyMatchLogic/types.ts +33 -0
- package/src/modules/fuzzyMatchLogic/utils.ts +18 -0
- package/src/modules/pluginCore/PluginManagerContext.tsx +107 -0
- package/src/modules/pluginCore/makePluginManagerContext.ts +35 -0
- package/src/modules/pluginCore/types.ts +54 -0
- package/src/modules/resourceJump/ApiQueryMagazineResourceJump.ts +31 -0
- package/src/modules/resourceJump/ResourceJumpContext.tsx +142 -0
- package/src/modules/resourceJump/buildJumpUrl.ts +40 -0
- package/src/modules/resourceJump/findBestMatchByUrl.ts +121 -0
- package/src/modules/resourceJump/helpers.ts +117 -0
- package/src/modules/resourceJump/routeLoader.ts +58 -0
- package/src/modules/resourceJump/types.ts +21 -0
- package/src/modules/resourceJump/ui/EhJumpResourceSelector.tsx +259 -0
- package/src/modules/resourceJump/ui/JumpALink.tsx +54 -0
- package/src/modules/resourceJump/ui/JumpMainButton.tsx +97 -0
- package/src/modules/resourceJump/ui/ResouceJumpLayout.tsx +73 -0
- package/src/plugins/builtin/pageUrl/PageUrlPluginContext.tsx +55 -0
- package/src/plugins/builtin/pageUrl/pageUrlAutoCompletePlugin.ts +66 -0
- package/src/plugins/builtin/pageUrl/pageUrlJumpPlugin.ts +36 -0
- package/src/plugins/builtin/pageUrl/pageUrlTypes.ts +17 -0
- package/src/routeTree.gen.ts +249 -0
- package/src/routes/__root.tsx +23 -0
- package/src/routes/_layout/app/$appSlug/sub/$subValue.tsx +15 -0
- package/src/routes/_layout/app/$appSlug.tsx +15 -0
- package/src/routes/_layout/env/$envSlug/app/$appSlug/sub/$subValue.tsx +17 -0
- package/src/routes/_layout/env/$envSlug/app/$appSlug.tsx +15 -0
- package/src/routes/_layout/env/$envSlug/sub/$subValue.tsx +15 -0
- package/src/routes/_layout/env/$envSlug.tsx +15 -0
- package/src/routes/_layout/index.tsx +16 -0
- package/src/routes/_layout.tsx +9 -0
- package/src/types/ehTypes.ts +40 -0
- package/src/types/slateTypes.ts +22 -0
- package/src/types/tanstackQuery.ts +14 -0
- package/src/types/types.ts +20 -0
- package/src/types/userBehaviourTypes.ts +100 -0
- package/src/types/utilityTypes.ts +1 -0
- package/src/types/vite-env.d.ts +1 -0
- package/src/ui/components/ActionCard.tsx +30 -0
- package/src/ui/components/AppIcon.tsx +48 -0
- package/src/ui/components/commandInput/EhBaseSelector.tsx +51 -0
- package/src/ui/components/commandInput/types.ts +22 -0
- package/src/ui/components/contextDebug.tsx +13 -0
- package/src/ui/components/controlPanel/BaseDropdownSelector.tsx +163 -0
- package/src/ui/components/controlPanel/env/EnvDropdownContent.tsx +114 -0
- package/src/ui/components/controlPanel/env/EnvDropdownSelector.tsx +21 -0
- package/src/ui/components/error/DefaultErrorComponent.tsx +38 -0
- package/src/ui/components/error/RooutErrorPage.tsx +10 -0
- package/src/ui/components/footer/Footer.tsx +32 -0
- package/src/ui/components/header/PlaygroundHeader.tsx +26 -0
- package/src/ui/components/leftPanel/LeftPanel.tsx +194 -0
- package/src/ui/components/quickBar/EnvQuickJumpBar.tsx +65 -0
- package/src/ui/components/quickBar/QuickJumpBar.tsx +101 -0
- package/src/ui/components/widgetPanel/AddWidgetCard.tsx +17 -0
- package/src/ui/components/widgetPanel/WidgetGrid.tsx +18 -0
- package/src/ui/components/widgets/CredentialsWidget.tsx +55 -0
- package/src/ui/components/widgets/VersionWidget.tsx +29 -0
- package/src/ui/error/NotFoundError.tsx +13 -0
- package/src/ui/layout/Footer.tsx +16 -0
- package/src/ui/layout/Header.tsx +14 -0
- package/src/ui/layout/LoadingScreen.tsx +17 -0
- package/src/ui/layout/MainLayout.tsx +27 -0
- package/src/ui/layout/SideColumn.tsx +3 -0
- package/src/ui/layout/TopLevelProviders.tsx +52 -0
- package/src/ui/main/JumpTabContent.tsx +12 -0
- package/src/ui/main/Tabs.tsx +29 -0
- package/src/userDb/DbContext.tsx +22 -0
- package/src/userDb/EhDb.ts +22 -0
- package/src/util/availabilityMatrixUtils.ts +80 -0
- package/src/util/createEhRouter.ts +20 -0
- package/src/util/highlightMatches.tsx +29 -0
- package/src/util/reactQueryUtils.ts +12 -0
- package/src/util/route-utils.ts +71 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Encoder, Index } from 'flexsearch'
|
|
2
|
+
import { score } from './scoring'
|
|
3
|
+
import type {
|
|
4
|
+
FuzzySearchContext,
|
|
5
|
+
FuzzySearchIndex,
|
|
6
|
+
FuzzySearchPrepareIndexParams,
|
|
7
|
+
FuzzySearchReturnItem,
|
|
8
|
+
} from './types'
|
|
9
|
+
|
|
10
|
+
export function makeFuzzySearchIndex(
|
|
11
|
+
params: FuzzySearchPrepareIndexParams,
|
|
12
|
+
): FuzzySearchIndex {
|
|
13
|
+
const encoder = new Encoder({
|
|
14
|
+
// prepare
|
|
15
|
+
// normalize: true,
|
|
16
|
+
// dedupe: true,
|
|
17
|
+
// include: {
|
|
18
|
+
// letter: true,
|
|
19
|
+
// number: true,
|
|
20
|
+
// symbol: true,
|
|
21
|
+
// punctuation: true,
|
|
22
|
+
// control: false,
|
|
23
|
+
// },
|
|
24
|
+
// finalize: (terms) => {
|
|
25
|
+
// return terms
|
|
26
|
+
// },
|
|
27
|
+
})
|
|
28
|
+
const index = new Index({
|
|
29
|
+
tokenize: 'forward',
|
|
30
|
+
encoder: encoder,
|
|
31
|
+
})
|
|
32
|
+
params.entries.forEach((entry, idx) => {
|
|
33
|
+
index.add(idx, entry.displayName || entry.slug)
|
|
34
|
+
// index.add(idx, enrichTokensForIndex(tokenize(entry.displayName || entry.slug)).join(' '))
|
|
35
|
+
})
|
|
36
|
+
return {
|
|
37
|
+
flexIndex: index,
|
|
38
|
+
entries: params.entries,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function fuzzySearch(
|
|
43
|
+
needle: string,
|
|
44
|
+
context: FuzzySearchContext,
|
|
45
|
+
): Array<FuzzySearchReturnItem> {
|
|
46
|
+
const postFiltrationResults = context.index.flexIndex
|
|
47
|
+
.searchCache(needle)
|
|
48
|
+
.map((id) => {
|
|
49
|
+
return {
|
|
50
|
+
entry: context.index.entries[id as number]!,
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
// const tokenizedNeedle = tokenize(needle)
|
|
55
|
+
|
|
56
|
+
// const foundTokensByRows = new Map<number, FuzzySearchPreliminaryResult>()
|
|
57
|
+
|
|
58
|
+
// tokenizedNeedle.forEach((token) => {
|
|
59
|
+
// const found = context.index.flexIndex.search(token)
|
|
60
|
+
// ;(found as number[]).forEach((id) => {
|
|
61
|
+
// let row = foundTokensByRows.get(id)
|
|
62
|
+
// if (!row) {
|
|
63
|
+
// row = {
|
|
64
|
+
// entry: context.index.entries[id as number]!,
|
|
65
|
+
// foundTokens: [token],
|
|
66
|
+
// }
|
|
67
|
+
// foundTokensByRows.set(id, row)
|
|
68
|
+
// } else {
|
|
69
|
+
// row.foundTokens.push(token)
|
|
70
|
+
// }
|
|
71
|
+
// })
|
|
72
|
+
// })
|
|
73
|
+
|
|
74
|
+
// const rawResults = [...foundTokensByRows.values()]
|
|
75
|
+
// const postFiltrationResults = postFiltration(rawResults)
|
|
76
|
+
return score(postFiltrationResults, needle)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// type IndexType = {
|
|
80
|
+
// title: string;
|
|
81
|
+
// titleOrig: string;
|
|
82
|
+
// tokens: string[];
|
|
83
|
+
// notFavorite: boolean;
|
|
84
|
+
// notRecent: boolean;
|
|
85
|
+
// item: SourceItem;
|
|
86
|
+
// };
|
|
87
|
+
|
|
88
|
+
// export function makeAutoCompleteFilter(
|
|
89
|
+
// items: SourceItem[],
|
|
90
|
+
// ): EhAutoCompleteFilter {
|
|
91
|
+
// const itemsIndex: IndexType[] = items.map((item) => {
|
|
92
|
+
// const lower = item.title.toLowerCase();
|
|
93
|
+
// return {
|
|
94
|
+
// title: lower,
|
|
95
|
+
// titleOrig: item.title,
|
|
96
|
+
// tokens: tokenize(item.title),
|
|
97
|
+
// notFavorite: !item.favorite,
|
|
98
|
+
// notRecent: !item.recent,
|
|
99
|
+
// item,
|
|
100
|
+
// };
|
|
101
|
+
// });
|
|
102
|
+
// const recentFavWinSort = ['notFavorite', 'notRecent'];
|
|
103
|
+
// const shortestWinSort = (x: IndexType) => x.title.length;
|
|
104
|
+
// const sorts: Many<ListIteratee<IndexType>> = [
|
|
105
|
+
// ...recentFavWinSort,
|
|
106
|
+
// shortestWinSort,
|
|
107
|
+
// ];
|
|
108
|
+
|
|
109
|
+
// function doSearch(searchPatternOrig: string) {
|
|
110
|
+
// const searchPattern = searchPatternOrig.toLowerCase();
|
|
111
|
+
// const results = new Set<SourceItem>();
|
|
112
|
+
|
|
113
|
+
// // prefix match exact case sensitive
|
|
114
|
+
// const exactPrefix = sortBy(
|
|
115
|
+
// itemsIndex.filter((item) => item.titleOrig.startsWith(searchPatternOrig)),
|
|
116
|
+
// sorts,
|
|
117
|
+
// );
|
|
118
|
+
// exactPrefix.forEach((x) => results.add(x.item));
|
|
119
|
+
|
|
120
|
+
// // prefix case insensitive
|
|
121
|
+
// const caseRelaxedPrefix = sortBy(
|
|
122
|
+
// itemsIndex.filter((item) => item.title.startsWith(searchPattern)),
|
|
123
|
+
// sorts,
|
|
124
|
+
// );
|
|
125
|
+
// caseRelaxedPrefix.forEach((x) => results.add(x.item));
|
|
126
|
+
|
|
127
|
+
// // token prefix
|
|
128
|
+
// const searchTokens = tokenize(searchPattern);
|
|
129
|
+
|
|
130
|
+
// if (searchTokens.length > 0) {
|
|
131
|
+
// const prefixedInTokens = itemsIndex.filter((item) => {
|
|
132
|
+
// const isFound = searchTokens.reduce<string[] | false>(
|
|
133
|
+
// (itemTokens, searchToken) => {
|
|
134
|
+
// if (itemTokens !== false) {
|
|
135
|
+
// for (let i = 0; i < itemTokens.length; i++) {
|
|
136
|
+
// if (itemTokens[i].startsWith(searchToken)) {
|
|
137
|
+
// return itemTokens.slice(i + 1);
|
|
138
|
+
// }
|
|
139
|
+
// }
|
|
140
|
+
// }
|
|
141
|
+
// return false;
|
|
142
|
+
// },
|
|
143
|
+
// item.tokens,
|
|
144
|
+
// );
|
|
145
|
+
// return isFound !== false;
|
|
146
|
+
// });
|
|
147
|
+
|
|
148
|
+
// sortBy(prefixedInTokens, sorts).forEach((x) => results.add(x.item));
|
|
149
|
+
// }
|
|
150
|
+
|
|
151
|
+
// // substring match (case sensitive)
|
|
152
|
+
// const exactSubstring = sortBy(
|
|
153
|
+
// itemsIndex.filter((item) => item.titleOrig.includes(searchPatternOrig)),
|
|
154
|
+
// sorts,
|
|
155
|
+
// (x) => x.titleOrig.indexOf(searchPatternOrig),
|
|
156
|
+
// );
|
|
157
|
+
// exactSubstring.forEach((x) => results.add(x.item));
|
|
158
|
+
|
|
159
|
+
// // substring match (case insensitive)
|
|
160
|
+
// const relaxSubstring = sortBy(
|
|
161
|
+
// itemsIndex.filter((item) => item.title.includes(searchPattern)),
|
|
162
|
+
// sorts,
|
|
163
|
+
// (x) => x.title.indexOf(searchPattern),
|
|
164
|
+
// );
|
|
165
|
+
// relaxSubstring.forEach((x) => results.add(x.item));
|
|
166
|
+
|
|
167
|
+
// itemsIndex
|
|
168
|
+
// .filter((item) => item.tokens.join('').includes(searchPattern))
|
|
169
|
+
// .forEach((x) => results.add(x.item));
|
|
170
|
+
|
|
171
|
+
// const searchString = searchTokens.join('');
|
|
172
|
+
// itemsIndex
|
|
173
|
+
// .filter((item) => item.tokens.join('').includes(searchString))
|
|
174
|
+
// .forEach((x) => results.add(x.item));
|
|
175
|
+
|
|
176
|
+
// return [...results];
|
|
177
|
+
// }
|
|
178
|
+
|
|
179
|
+
// return (searchPatternOrig: string) => {
|
|
180
|
+
// let results = doSearch(searchPatternOrig);
|
|
181
|
+
// if (results.length === 0 && isRuLayout(searchPatternOrig)) {
|
|
182
|
+
// results = doSearch(fixRuLayout(searchPatternOrig));
|
|
183
|
+
// }
|
|
184
|
+
// return results;
|
|
185
|
+
// };
|
|
186
|
+
// }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { longestCommonPrefix } from '../utils'
|
|
2
|
+
|
|
3
|
+
export function prefixFrac(
|
|
4
|
+
needle: string,
|
|
5
|
+
candidate: string,
|
|
6
|
+
qLen: number,
|
|
7
|
+
): number {
|
|
8
|
+
if (qLen === 0) {
|
|
9
|
+
return 0
|
|
10
|
+
}
|
|
11
|
+
const lcp = longestCommonPrefix(needle, candidate)
|
|
12
|
+
return lcp / qLen
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { sum } from 'radashi'
|
|
2
|
+
import { tokenize } from '../tokenize'
|
|
3
|
+
import { longestCommonPrefix } from '../utils'
|
|
4
|
+
import type { FuzzySearchInputEntry } from '../types'
|
|
5
|
+
|
|
6
|
+
export function prefixFracAcrossTokens(
|
|
7
|
+
entry: FuzzySearchInputEntry,
|
|
8
|
+
needleTokens: Array<string>,
|
|
9
|
+
): number {
|
|
10
|
+
const entryTokens = tokenize(entry.displayName)
|
|
11
|
+
|
|
12
|
+
const scores = []
|
|
13
|
+
|
|
14
|
+
for (let i = 0, j = 0; i < needleTokens.length && j < entryTokens.length; ) {
|
|
15
|
+
const needleToken = needleTokens[i]!
|
|
16
|
+
const entryToken = entryTokens[j]!
|
|
17
|
+
|
|
18
|
+
if (entryToken.includes(needleToken)) {
|
|
19
|
+
const lcp = longestCommonPrefix(entryToken, needleToken)
|
|
20
|
+
scores.push((1.0 * lcp) / entryToken.length)
|
|
21
|
+
i++
|
|
22
|
+
j++
|
|
23
|
+
} else {
|
|
24
|
+
j++
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return needleTokens.length > 0 ? sum(scores) / needleTokens.length : 0
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const En = "qwertyuiop[]asdfghjkl;'zxcvbnm,.",
|
|
2
|
+
Ru = 'йцукенгшщзхъфывапролджэячсмитьбю'
|
|
3
|
+
|
|
4
|
+
const ruEnMap: Record<string, string> = [...Ru].reduce<Record<string, string>>(
|
|
5
|
+
(acc, ruChar, index) => {
|
|
6
|
+
const enChar = En[index]
|
|
7
|
+
|
|
8
|
+
if (enChar) {
|
|
9
|
+
acc[ruChar] = enChar
|
|
10
|
+
acc[ruChar.toUpperCase()] = enChar.toUpperCase()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return acc
|
|
14
|
+
},
|
|
15
|
+
{},
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
export function isRuLayout(text: string) {
|
|
19
|
+
return [...text].some((c) => Ru.includes(c))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function fixRuLayout(text: string) {
|
|
23
|
+
return [...text].map((c) => ruEnMap[c] || c).join('')
|
|
24
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { normalize } from './utils'
|
|
2
|
+
import type { FuzzySearchInputEntry } from './types'
|
|
3
|
+
|
|
4
|
+
export function isTokensConsequent(
|
|
5
|
+
foundTokens: Array<string>,
|
|
6
|
+
entry: FuzzySearchInputEntry,
|
|
7
|
+
): boolean {
|
|
8
|
+
const entryNormalized = normalize(entry.displayName)
|
|
9
|
+
|
|
10
|
+
for (let index = 0; index < entryNormalized.length; index++) {
|
|
11
|
+
const nextToken = foundTokens.shift()
|
|
12
|
+
if (nextToken === undefined) {
|
|
13
|
+
break
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const nextIndex = entryNormalized.indexOf(nextToken, index)
|
|
17
|
+
if (nextIndex === -1) {
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
index = nextIndex + nextToken.length - 1
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return foundTokens.length === 0
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// export function postFiltration(
|
|
27
|
+
// raw: Array<FuzzySearchPreliminaryResult>,
|
|
28
|
+
// ): Array<FuzzySearchPreliminaryResult> {
|
|
29
|
+
// return raw.filter(({ entry, foundTokens }) => {
|
|
30
|
+
// if (foundTokens.length > 1 && !isTokensConsequent(foundTokens, entry)) {
|
|
31
|
+
// return false
|
|
32
|
+
// }
|
|
33
|
+
// return true
|
|
34
|
+
// })
|
|
35
|
+
// }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { prefixFrac } from './features/prefixFrac'
|
|
2
|
+
import type {
|
|
3
|
+
FuzzySearchPreliminaryResult,
|
|
4
|
+
FuzzySearchReturnItem,
|
|
5
|
+
} from './types'
|
|
6
|
+
|
|
7
|
+
const W = {
|
|
8
|
+
prefixFrac: 1.3,
|
|
9
|
+
prefixFracTokenMiddles: 0.1,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function score(
|
|
13
|
+
raw: Array<FuzzySearchPreliminaryResult>,
|
|
14
|
+
needle: string,
|
|
15
|
+
): Array<FuzzySearchReturnItem> {
|
|
16
|
+
const qLen = needle.length
|
|
17
|
+
|
|
18
|
+
const scored = raw.map(({ entry }) => {
|
|
19
|
+
const label = entry.displayName
|
|
20
|
+
const norm = label
|
|
21
|
+
|
|
22
|
+
const pf = prefixFrac(needle, norm, qLen)
|
|
23
|
+
// const pfTokens = prefixFracTokenMiddles(entry, foundTokens)
|
|
24
|
+
|
|
25
|
+
// const tc = tokenCoverage(qTokens, norm);
|
|
26
|
+
// const pb = positionBonus(q, norm, W.positionDecayAlpha);
|
|
27
|
+
|
|
28
|
+
let scoreValue = 0
|
|
29
|
+
scoreValue += W.prefixFrac * pf
|
|
30
|
+
|
|
31
|
+
return { entry, score: scoreValue }
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
// stable sort by score desc, then by displayName
|
|
35
|
+
scored.sort(
|
|
36
|
+
(a, b) =>
|
|
37
|
+
b.score - a.score ||
|
|
38
|
+
a.entry.displayName.localeCompare(b.entry.displayName),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return scored
|
|
42
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function normalize(str: string): string {
|
|
2
|
+
const text = str.normalize('NFKD').replace(/[\u0300-\u036f]/g, '')
|
|
3
|
+
return text
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const TOKEN_SPLIT = new RegExp(
|
|
7
|
+
[
|
|
8
|
+
String.raw`[\p{Z}\p{P}\p{S}]+`,
|
|
9
|
+
String.raw`(?<=\p{Nd})(?=\p{L})`,
|
|
10
|
+
String.raw`(?<=\p{L})(?=\p{Nd})`,
|
|
11
|
+
String.raw`(?<=[\p{Ll}\p{Nd}])(?=\p{Lu})`,
|
|
12
|
+
String.raw`(?<=\p{Lu})(?=\p{Lu}\p{Ll})`,
|
|
13
|
+
].join('|'),
|
|
14
|
+
'u',
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
export function tokenize(str: string): Array<string> {
|
|
18
|
+
return str
|
|
19
|
+
.split(TOKEN_SPLIT)
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.map((s) => s.toLowerCase())
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function enrichTokensForIndex(tokens: Array<string>): Array<string> {
|
|
25
|
+
const newTokens = tokens.flatMap((token) => {
|
|
26
|
+
if (token.startsWith('0')) {
|
|
27
|
+
return [token.replace(/^0+(?=[1-9])/, ''), token]
|
|
28
|
+
}
|
|
29
|
+
return [token]
|
|
30
|
+
})
|
|
31
|
+
return newTokens
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Index } from 'flexsearch'
|
|
2
|
+
|
|
3
|
+
export interface FuzzySearchInputEntry {
|
|
4
|
+
slug: string
|
|
5
|
+
displayName: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface FuzzySearchContext {
|
|
9
|
+
index: FuzzySearchIndex
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface FuzzySearchIndex {
|
|
13
|
+
flexIndex: Index
|
|
14
|
+
entries: Array<FuzzySearchInputEntry>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface FuzzySearchIndexEntry {
|
|
18
|
+
inputEntry: FuzzySearchInputEntry
|
|
19
|
+
tokens: Array<string>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface FuzzySearchPrepareIndexParams {
|
|
23
|
+
entries: Array<FuzzySearchInputEntry>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface FuzzySearchPreliminaryResult {
|
|
27
|
+
entry: FuzzySearchInputEntry
|
|
28
|
+
// foundTokens: string[]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface FuzzySearchReturnItem {
|
|
32
|
+
entry: FuzzySearchInputEntry
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function normalize(x: string): string {
|
|
2
|
+
// lower, NFKD, strip combining marks (accents), collapse spaces
|
|
3
|
+
return x
|
|
4
|
+
.toLowerCase()
|
|
5
|
+
.normalize('NFKD')
|
|
6
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
7
|
+
.replace(/\s+/g, ' ')
|
|
8
|
+
.trim()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function longestCommonPrefix(a: string, b: string): number {
|
|
12
|
+
const n = Math.min(a.length, b.length)
|
|
13
|
+
let i = 0
|
|
14
|
+
while (i < n && a.charCodeAt(i) === b.charCodeAt(i)) {
|
|
15
|
+
i++
|
|
16
|
+
}
|
|
17
|
+
return i
|
|
18
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { objectify } from 'radashi'
|
|
2
|
+
import { createContext, use, useCallback, useMemo, useState } from 'react'
|
|
3
|
+
import { isEhPluginResourceJumpable } from './types'
|
|
4
|
+
import type { ReactNode } from 'react'
|
|
5
|
+
import type { PluginPageUrlAutocompleteItem } from '~/plugins/builtin/pageUrl/pageUrlTypes'
|
|
6
|
+
import type { PartialRecord } from '~/types/utilityTypes'
|
|
7
|
+
import type { ResourceJumpItem } from '../resourceJump/types'
|
|
8
|
+
import type { PluginInterfaceForCore } from './makePluginManagerContext'
|
|
9
|
+
import type {
|
|
10
|
+
EhPlugin,
|
|
11
|
+
EhPluginResouceJumpFactoryCtx,
|
|
12
|
+
PluginName,
|
|
13
|
+
} from './types'
|
|
14
|
+
|
|
15
|
+
export interface PluginManagerContextIface {
|
|
16
|
+
plugins: Array<EhPlugin>
|
|
17
|
+
interfaceForPlugins: PartialRecord<
|
|
18
|
+
PluginName,
|
|
19
|
+
PluginManagerInterfaceForPlugins
|
|
20
|
+
>
|
|
21
|
+
resouceJumpItems: PartialRecord<PluginName, Array<ResourceJumpItem>>
|
|
22
|
+
autocompleteFactoryItems: (
|
|
23
|
+
ctx: EhPluginResouceJumpFactoryCtx,
|
|
24
|
+
) => Array<PluginPageUrlAutocompleteItem>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface PluginManagerInterfaceForPlugins {
|
|
28
|
+
setResouceJumps: (items: Array<ResourceJumpItem>) => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const PluginManagerContext = createContext<
|
|
32
|
+
PluginManagerContextIface | undefined
|
|
33
|
+
>(undefined)
|
|
34
|
+
|
|
35
|
+
interface PluginManagerProviderProps {
|
|
36
|
+
children: ReactNode
|
|
37
|
+
plugins: Array<EhPlugin>
|
|
38
|
+
pluginInterfaceForCore: PluginInterfaceForCore
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function PluginManagerContextProvider({
|
|
42
|
+
children,
|
|
43
|
+
plugins,
|
|
44
|
+
}: PluginManagerProviderProps) {
|
|
45
|
+
const [resouceJumpItems, setResouceJumpsItems] = useState<
|
|
46
|
+
PartialRecord<PluginName, Array<ResourceJumpItem>>
|
|
47
|
+
>({})
|
|
48
|
+
|
|
49
|
+
const autocompleteFactoryItems = useCallback(
|
|
50
|
+
(
|
|
51
|
+
ctx: EhPluginResouceJumpFactoryCtx,
|
|
52
|
+
): Array<PluginPageUrlAutocompleteItem> => {
|
|
53
|
+
return plugins
|
|
54
|
+
.filter((p) => isEhPluginResourceJumpable(p))
|
|
55
|
+
.flatMap((plugin) => plugin.factoryPageJumpAutocompleteItems(ctx))
|
|
56
|
+
},
|
|
57
|
+
[plugins],
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
const value: PluginManagerContextIface = useMemo(() => {
|
|
61
|
+
return {
|
|
62
|
+
plugins,
|
|
63
|
+
interfaceForPlugins: objectify(
|
|
64
|
+
plugins.map((p) => p.name),
|
|
65
|
+
(pluginName) => pluginName,
|
|
66
|
+
(pluginName) => ({
|
|
67
|
+
setResouceJumps: (items: Array<ResourceJumpItem>) => {
|
|
68
|
+
setResouceJumpsItems((old) => ({
|
|
69
|
+
...old,
|
|
70
|
+
...{ [pluginName]: items },
|
|
71
|
+
}))
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
),
|
|
75
|
+
autocompleteFactoryItems,
|
|
76
|
+
resouceJumpItems,
|
|
77
|
+
}
|
|
78
|
+
}, [autocompleteFactoryItems, plugins, resouceJumpItems])
|
|
79
|
+
|
|
80
|
+
return <PluginManagerContext value={value}>{children}</PluginManagerContext>
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function usePluginManager(): PluginManagerContextIface {
|
|
84
|
+
const context = use(PluginManagerContext)
|
|
85
|
+
if (context === undefined) {
|
|
86
|
+
throw new Error(
|
|
87
|
+
'usePluginManager must be used within an PluginManagerContextProvider',
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
return context
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function usePluginManagerForPlugin(
|
|
94
|
+
pluginName: PluginName,
|
|
95
|
+
): PluginManagerInterfaceForPlugins {
|
|
96
|
+
const context = usePluginManager()
|
|
97
|
+
|
|
98
|
+
const interfaceForPlugins = context.interfaceForPlugins[pluginName]
|
|
99
|
+
|
|
100
|
+
if (interfaceForPlugins === undefined) {
|
|
101
|
+
throw new Error(
|
|
102
|
+
`usePluginManagerForPlugin("${pluginName}") is not initialized.`,
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return interfaceForPlugins
|
|
107
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { objectify } from 'radashi'
|
|
2
|
+
import { isEhPluginResourceJumpable } from './types'
|
|
3
|
+
import type { EhPlugin } from './types'
|
|
4
|
+
import type { BootstrapConfigData } from '@env-hopper/backend-core'
|
|
5
|
+
import type { ResourceJumpItem } from '../resourceJump/types'
|
|
6
|
+
|
|
7
|
+
export interface PluginInterfaceForCore {
|
|
8
|
+
getResourceJumpsItems: (
|
|
9
|
+
config: BootstrapConfigData,
|
|
10
|
+
) => Promise<Record<string, ResourceJumpItem>>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function makePluginInterfaceForCore(
|
|
14
|
+
plugins: Array<EhPlugin>,
|
|
15
|
+
): PluginInterfaceForCore {
|
|
16
|
+
return {
|
|
17
|
+
getResourceJumpsItems: async (bootstrapConfig: BootstrapConfigData) => {
|
|
18
|
+
const items = await Promise.all(
|
|
19
|
+
plugins.map((plugin) => {
|
|
20
|
+
if (isEhPluginResourceJumpable(plugin)) {
|
|
21
|
+
return plugin.factoryPageJumpAutocompleteItems({
|
|
22
|
+
bootstrapConfig,
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
return []
|
|
26
|
+
}),
|
|
27
|
+
)
|
|
28
|
+
return objectify(
|
|
29
|
+
items.flat(),
|
|
30
|
+
(item) => item.slug,
|
|
31
|
+
(item) => item,
|
|
32
|
+
)
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BootstrapConfigData,
|
|
3
|
+
EhEnvIndexed,
|
|
4
|
+
} from '@env-hopper/backend-core'
|
|
5
|
+
import type { PluginPageUrlAutocompleteItem } from '~/plugins/builtin/pageUrl/pageUrlTypes'
|
|
6
|
+
|
|
7
|
+
export interface PluginAsyncData<T> {
|
|
8
|
+
pluginName: string
|
|
9
|
+
data: T
|
|
10
|
+
isLoaded: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface EhPluginResourceJumpable extends EhPlugin {
|
|
14
|
+
factoryPageJumpAutocompleteItems: (
|
|
15
|
+
ctx: EhPluginResouceJumpFactoryCtx,
|
|
16
|
+
) => Array<PluginPageUrlAutocompleteItem>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface EhPlugin {
|
|
20
|
+
name: PluginName
|
|
21
|
+
// populatePageJumpItems(): Promise<ResouceJumpItem[]>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function isEhPluginResourceJumpable(
|
|
25
|
+
plugin: EhPlugin,
|
|
26
|
+
): plugin is EhPluginResourceJumpable {
|
|
27
|
+
return 'factoryPageJumpAutocompleteItems' in plugin
|
|
28
|
+
}
|
|
29
|
+
export interface BaseAppAutoCompletableParent {
|
|
30
|
+
type: string
|
|
31
|
+
displayName: string
|
|
32
|
+
hasSingleChild: boolean
|
|
33
|
+
}
|
|
34
|
+
export interface BaseAutoCompletableItem {
|
|
35
|
+
type: string
|
|
36
|
+
slug: string
|
|
37
|
+
parent?: BaseAppAutoCompletableParent
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface BaseAutoCompleteItemRender {
|
|
41
|
+
displayName: string
|
|
42
|
+
parentDisplayName?: string
|
|
43
|
+
isDefaultGroupItem?: boolean
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface EhPluginResouceJumpFactoryCtx {
|
|
47
|
+
bootstrapConfig: BootstrapConfigData
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface EhPluginResouceJumpCtx {
|
|
51
|
+
env: EhEnvIndexed | undefined
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type PluginName = string
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { queryOptions } from '@tanstack/react-query'
|
|
2
|
+
import type {
|
|
3
|
+
AvailiabilityMatrixData,
|
|
4
|
+
RenameRule,
|
|
5
|
+
RenameRuleParams,
|
|
6
|
+
ResourceJumpsData,
|
|
7
|
+
} from '@env-hopper/backend-core'
|
|
8
|
+
import { getTrpcFromMeta } from '~/util/reactQueryUtils'
|
|
9
|
+
|
|
10
|
+
export class ApiQueryMagazineResouceJump {
|
|
11
|
+
static getNameMigration(params: RenameRuleParams) {
|
|
12
|
+
return queryOptions<RenameRule | false, Error>({
|
|
13
|
+
queryKey: ['nameMigrations'],
|
|
14
|
+
queryFn: (ctx) => getTrpcFromMeta(ctx).tryFindRenameRule.query(params),
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static getAvailabilityMatrix() {
|
|
19
|
+
return queryOptions<AvailiabilityMatrixData, Error>({
|
|
20
|
+
queryKey: ['availabilityMatrix'],
|
|
21
|
+
queryFn: (ctx) => getTrpcFromMeta(ctx).availabilityMatrix.query(),
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static getResourceJumps() {
|
|
26
|
+
return queryOptions<ResourceJumpsData, Error>({
|
|
27
|
+
queryKey: ['resourceJumps'],
|
|
28
|
+
queryFn: (ctx) => getTrpcFromMeta(ctx).resourceJumps.query(),
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
}
|