@rynt/sdk 0.9.53
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 +122 -0
- package/REGISTRIES.md +189 -0
- package/env.d.ts +11 -0
- package/host-shims.d.ts +30 -0
- package/package.json +88 -0
- package/src/extension-marketplace/api-types.ts +141 -0
- package/src/extension-marketplace/client.ts +296 -0
- package/src/extension-marketplace/index.ts +22 -0
- package/src/extension-marketplace/schemas.ts +178 -0
- package/src/extensions/ExtensionRoutePage.vue +17 -0
- package/src/extensions/context.ts +37 -0
- package/src/extensions/disabled-folder.ts +21 -0
- package/src/extensions/extension-expose-map.ts +5 -0
- package/src/extensions/extension-expose.ts +48 -0
- package/src/extensions/graph.ts +67 -0
- package/src/extensions/index.ts +251 -0
- package/src/extensions/invite-handler/types.ts +20 -0
- package/src/extensions/launcher-entities/create-launcher-entity.ts +25 -0
- package/src/extensions/launcher-entities/keys.ts +46 -0
- package/src/extensions/launcher-entities/launcher-entity-components.ts +177 -0
- package/src/extensions/launcher-entities/props-map.ts +69 -0
- package/src/extensions/launcher-entities/registry.ts +32 -0
- package/src/extensions/launcher-models/apis/accounts-contracts.ts +102 -0
- package/src/extensions/launcher-models/apis/launcher-model-apis.ts +553 -0
- package/src/extensions/launcher-models/keys.ts +23 -0
- package/src/extensions/launcher-models/public.ts +9 -0
- package/src/extensions/launcher-models/registry-core.ts +34 -0
- package/src/extensions/manifest-types.ts +22 -0
- package/src/extensions/manifest.ts +46 -0
- package/src/extensions/marketplace-open-key.ts +26 -0
- package/src/extensions/plugin-types.ts +44 -0
- package/src/extensions/plugin.ts +62 -0
- package/src/extensions/registries/bootstrap.ts +11 -0
- package/src/extensions/registries/builtins/account-provider.ts +6 -0
- package/src/extensions/registries/builtins/app-topbar-left-widgets.ts +6 -0
- package/src/extensions/registries/builtins/app-topbar-right-widgets.ts +6 -0
- package/src/extensions/registries/builtins/app-topbar-status-widgets.ts +6 -0
- package/src/extensions/registries/builtins/build-card-actions.ts +6 -0
- package/src/extensions/registries/builtins/build-card-after-meta.ts +6 -0
- package/src/extensions/registries/builtins/build-card-before-media.ts +6 -0
- package/src/extensions/registries/builtins/build-card-before-meta.ts +6 -0
- package/src/extensions/registries/builtins/build-card-footer-actions.ts +6 -0
- package/src/extensions/registries/builtins/build-detail-after-content.ts +6 -0
- package/src/extensions/registries/builtins/build-detail-before-content.ts +6 -0
- package/src/extensions/registries/builtins/build-detail-before-hero.ts +6 -0
- package/src/extensions/registries/builtins/build-detail-header-actions.ts +6 -0
- package/src/extensions/registries/builtins/build-detail-mod-row-actions.ts +6 -0
- package/src/extensions/registries/builtins/build-detail-resourcepack-row-actions.ts +6 -0
- package/src/extensions/registries/builtins/build-detail-right-column-bottom.ts +6 -0
- package/src/extensions/registries/builtins/build-detail-right-column-top.ts +6 -0
- package/src/extensions/registries/builtins/dialog-footer-actions.ts +6 -0
- package/src/extensions/registries/builtins/feed-after-content.ts +6 -0
- package/src/extensions/registries/builtins/feed-before-content.ts +6 -0
- package/src/extensions/registries/builtins/file-editor.ts +19 -0
- package/src/extensions/registries/builtins/friends-after-list.ts +6 -0
- package/src/extensions/registries/builtins/friends-before-list.ts +6 -0
- package/src/extensions/registries/builtins/index.ts +141 -0
- package/src/extensions/registries/builtins/invite-handler.ts +7 -0
- package/src/extensions/registries/builtins/library-after-content.ts +6 -0
- package/src/extensions/registries/builtins/library-before-content.ts +6 -0
- package/src/extensions/registries/builtins/loader.ts +8 -0
- package/src/extensions/registries/builtins/map-card-actions.ts +6 -0
- package/src/extensions/registries/builtins/map-card-after-meta.ts +6 -0
- package/src/extensions/registries/builtins/map-card-before-meta.ts +6 -0
- package/src/extensions/registries/builtins/map-card-footer-actions.ts +6 -0
- package/src/extensions/registries/builtins/map-detail-after-content.ts +6 -0
- package/src/extensions/registries/builtins/map-detail-before-content.ts +6 -0
- package/src/extensions/registries/builtins/map-detail-header-actions.ts +6 -0
- package/src/extensions/registries/builtins/markdown-editor-tiptap-extensions.ts +7 -0
- package/src/extensions/registries/builtins/markdown-editor-toolbar-actions.ts +6 -0
- package/src/extensions/registries/builtins/markdown-renderer-after-content.ts +6 -0
- package/src/extensions/registries/builtins/markdown-renderer-before-content.ts +6 -0
- package/src/extensions/registries/builtins/mod-details-footer-actions.ts +6 -0
- package/src/extensions/registries/builtins/mod-manage-actions.ts +6 -0
- package/src/extensions/registries/builtins/mod-provider.ts +5 -0
- package/src/extensions/registries/builtins/nav.ts +7 -0
- package/src/extensions/registries/builtins/page.ts +13 -0
- package/src/extensions/registries/builtins/projects-after-content.ts +6 -0
- package/src/extensions/registries/builtins/projects-before-content.ts +6 -0
- package/src/extensions/registries/builtins/resourcepack-manage-actions.ts +7 -0
- package/src/extensions/registries/builtins/server-card-actions.ts +6 -0
- package/src/extensions/registries/builtins/server-card-after-meta.ts +6 -0
- package/src/extensions/registries/builtins/server-card-before-meta.ts +6 -0
- package/src/extensions/registries/builtins/server-card-footer-actions.ts +6 -0
- package/src/extensions/registries/builtins/server-detail-after-content.ts +6 -0
- package/src/extensions/registries/builtins/server-detail-before-content.ts +6 -0
- package/src/extensions/registries/builtins/server-detail-header-actions.ts +6 -0
- package/src/extensions/registries/builtins/settings-after-sections.ts +6 -0
- package/src/extensions/registries/builtins/settings-before-sections.ts +6 -0
- package/src/extensions/registries/builtins/settings-section-widgets.ts +6 -0
- package/src/extensions/registries/builtins/shaderpack-manage-actions.ts +7 -0
- package/src/extensions/registries/builtins/shell.ts +5 -0
- package/src/extensions/registries/builtins/sidebar-after-content.ts +6 -0
- package/src/extensions/registries/builtins/sidebar-before-content.ts +6 -0
- package/src/extensions/registries/builtins/sidebar-footer-widgets.ts +6 -0
- package/src/extensions/registries/builtins/sidebar-header-widgets.ts +6 -0
- package/src/extensions/registries/builtins/sidebar.ts +11 -0
- package/src/extensions/registries/builtins/theme.ts +5 -0
- package/src/extensions/registries/builtins/user-card-after-meta.ts +6 -0
- package/src/extensions/registries/builtins/user-card-before-meta.ts +6 -0
- package/src/extensions/registries/builtins/user-menu-actions.ts +6 -0
- package/src/extensions/registries/builtins/user-menu-after-actions.ts +6 -0
- package/src/extensions/registries/builtins/user-menu-before-actions.ts +6 -0
- package/src/extensions/registries/builtins/user-strip.ts +5 -0
- package/src/extensions/registries/clear-extension-ui-registries.ts +15 -0
- package/src/extensions/registries/define-extension-registry.ts +58 -0
- package/src/extensions/registries/extension-host-api.ts +41 -0
- package/src/extensions/registries/extension-registry-api.ts +103 -0
- package/src/extensions/registries/extension-registry-payload-map.ts +9 -0
- package/src/extensions/registries/extension-scope.ts +41 -0
- package/src/extensions/registries/get-registry.ts +23 -0
- package/src/extensions/registries/index.ts +58 -0
- package/src/extensions/registries/manifest-rynt.ts +193 -0
- package/src/extensions/registries/registry-slot.ts +40 -0
- package/src/extensions/registries/registry-value-map.ts +89 -0
- package/src/extensions/registries/store.ts +206 -0
- package/src/extensions/resolve-extensions.ts +245 -0
- package/src/extensions/router-bridge.ts +103 -0
- package/src/extensions/session.ts +6 -0
- package/src/extensions/slug.ts +23 -0
- package/src/extensions/version.ts +147 -0
- package/src/host/extensions-composables.ts +33 -0
- package/src/host/extensions-init.ts +194 -0
- package/src/host/index.ts +11 -0
- package/src/host/launcher-models/index.ts +4 -0
- package/src/index.ts +229 -0
- package/src/minecraft-loader/base-loader.ts +102 -0
- package/src/minecraft-loader/index.ts +11 -0
- package/src/minecraft-loader/loader-registry.ts +72 -0
- package/src/shared/api/assets.ts +112 -0
- package/src/shared/api/auth.ts +283 -0
- package/src/shared/api/builds.ts +647 -0
- package/src/shared/api/config.ts +19 -0
- package/src/shared/api/download-stats.ts +103 -0
- package/src/shared/api/downloads.ts +36 -0
- package/src/shared/api/entity-authorship.ts +60 -0
- package/src/shared/api/events.ts +393 -0
- package/src/shared/api/friends.ts +140 -0
- package/src/shared/api/graphql.ts +87 -0
- package/src/shared/api/index.ts +23 -0
- package/src/shared/api/invites.ts +262 -0
- package/src/shared/api/library.ts +44 -0
- package/src/shared/api/maps.ts +385 -0
- package/src/shared/api/notify-websocket.ts +140 -0
- package/src/shared/api/posts.ts +357 -0
- package/src/shared/api/projectServers.ts +379 -0
- package/src/shared/api/serverMembers.ts +173 -0
- package/src/shared/api/users.ts +294 -0
- package/src/shared/composables/buildEditor/useBuildEditor.ts +66 -0
- package/src/shared/composables/buildManifest/buildManifest.ts +447 -0
- package/src/shared/composables/filesEditor/filesEditor.ts +346 -0
- package/src/shared/composables/index.ts +10 -0
- package/src/shared/composables/modsEditor/modsEditor.ts +1678 -0
- package/src/shared/composables/registrySlot/registry-slot-utils.ts +25 -0
- package/src/shared/composables/registrySlot/useRegistrySlotMissing.ts +35 -0
- package/src/shared/composables/resourcePacksEditor/resourcePacksEditor.ts +448 -0
- package/src/shared/composables/shaderPacksEditor/shaderPacksEditor.ts +395 -0
- package/src/shared/composables/useSkinRender.ts +70 -0
- package/src/shared/composables/useZlDeepLink.ts +178 -0
- package/src/shared/definitions/defineGraphCache.ts +216 -0
- package/src/shared/definitions/defineStore.ts +32 -0
- package/src/shared/definitions/index.ts +2 -0
- package/src/shared/minecraft-types/build-manifest.ts +611 -0
- package/src/shared/minecraft-types/index.ts +3 -0
- package/src/shared/minecraft-types/launcher-versions.ts +32 -0
- package/src/shared/minecraft-types/minecraft-launcher-types.ts +276 -0
- package/src/shared/mocks/index.ts +1 -0
- package/src/shared/mocks/navigation.ts +17 -0
- package/src/shared/mods/http.ts +45 -0
- package/src/shared/mods/index.ts +5 -0
- package/src/shared/mods/marketplace-editor-search.ts +266 -0
- package/src/shared/mods/marketplace-search-utils.ts +42 -0
- package/src/shared/mods/mod-marketplace-registry.ts +66 -0
- package/src/shared/mods/mod-marketplace-types.ts +28 -0
- package/src/shared/mods/providers/curseforge.ts +464 -0
- package/src/shared/mods/providers/index.ts +8 -0
- package/src/shared/mods/providers/modrinth.ts +402 -0
- package/src/shared/mods/resolve-mods-provider-loader-ids.ts +77 -0
- package/src/shared/mods/types.ts +76 -0
- package/src/shared/styles/index.css +713 -0
- package/src/shared/themes/index.ts +23 -0
- package/src/shared/themes/theme-tokens-black.json +126 -0
- package/src/shared/themes/theme-tokens-classic.json +126 -0
- package/src/shared/themes/theme-tokens-pink.json +126 -0
- package/src/shared/themes/theme-tokens.json +126 -0
- package/src/shared/themes/types.ts +85 -0
- package/src/shared/types/API_DOCUMENTATION.md +422 -0
- package/src/shared/types/account.ts +40 -0
- package/src/shared/types/build.ts +8 -0
- package/src/shared/types/entities.ts +181 -0
- package/src/shared/types/index.ts +6 -0
- package/src/shared/types/invite-payloads.ts +60 -0
- package/src/shared/types/navigation.ts +16 -0
- package/src/shared/types/running-build.ts +51 -0
- package/src/shared/types/serverMember.ts +17 -0
- package/src/shared/types/user.ts +55 -0
- package/src/shared/ui/base/Avatar.vue +262 -0
- package/src/shared/ui/base/Badge.vue +47 -0
- package/src/shared/ui/base/Button.vue +78 -0
- package/src/shared/ui/base/Divider.vue +42 -0
- package/src/shared/ui/base/Icon.vue +597 -0
- package/src/shared/ui/base/StatusIndicator.vue +44 -0
- package/src/shared/ui/base/index.ts +7 -0
- package/src/shared/ui/cards/InviteCard.vue +47 -0
- package/src/shared/ui/cards/index.ts +2 -0
- package/src/shared/ui/dialog/Dialog.vue +71 -0
- package/src/shared/ui/dialog/DialogContent.vue +31 -0
- package/src/shared/ui/dialog/DialogFooter.vue +14 -0
- package/src/shared/ui/dialog/DialogHeader.vue +41 -0
- package/src/shared/ui/dialog/index.ts +5 -0
- package/src/shared/ui/editors/AttachmentImagesEditor.vue +133 -0
- package/src/shared/ui/editors/ContentAttachmentsDisplay.vue +76 -0
- package/src/shared/ui/editors/MarkdownEditor.vue +956 -0
- package/src/shared/ui/editors/MarkdownRenderer.vue +299 -0
- package/src/shared/ui/editors/RichContentImageViewer.vue +85 -0
- package/src/shared/ui/editors/SocialPostMediaZone.vue +320 -0
- package/src/shared/ui/editors/index.ts +6 -0
- package/src/shared/ui/editors/markdown-editor-gallery.ts +234 -0
- package/src/shared/ui/editors/markdown-editor-image.ts +178 -0
- package/src/shared/ui/form/Checkbox.vue +38 -0
- package/src/shared/ui/form/FormField.vue +30 -0
- package/src/shared/ui/form/FormGrid.vue +38 -0
- package/src/shared/ui/form/ImageEditor.vue +598 -0
- package/src/shared/ui/form/Input.vue +72 -0
- package/src/shared/ui/form/Range.vue +65 -0
- package/src/shared/ui/form/Select.vue +76 -0
- package/src/shared/ui/form/Switch.vue +38 -0
- package/src/shared/ui/form/Textarea.vue +144 -0
- package/src/shared/ui/form/index.ts +9 -0
- package/src/shared/ui/index.ts +9 -0
- package/src/shared/ui/layout/BusyOverlay.vue +31 -0
- package/src/shared/ui/layout/Callout.vue +44 -0
- package/src/shared/ui/layout/Card.vue +38 -0
- package/src/shared/ui/layout/Container.vue +36 -0
- package/src/shared/ui/layout/EmptyState.vue +99 -0
- package/src/shared/ui/layout/EntityMediaRow.vue +54 -0
- package/src/shared/ui/layout/FilterResultsLayout.vue +22 -0
- package/src/shared/ui/layout/FloatingPanel.vue +37 -0
- package/src/shared/ui/layout/FullscreenDimmer.vue +11 -0
- package/src/shared/ui/layout/Grid.vue +40 -0
- package/src/shared/ui/layout/Inline.vue +59 -0
- package/src/shared/ui/layout/LoadingState.vue +39 -0
- package/src/shared/ui/layout/MediaBox.vue +47 -0
- package/src/shared/ui/layout/OverlayPanel.vue +28 -0
- package/src/shared/ui/layout/OverlayWaitPanel.vue +22 -0
- package/src/shared/ui/layout/PageSection.vue +43 -0
- package/src/shared/ui/layout/PageToolbar.vue +29 -0
- package/src/shared/ui/layout/Panel.vue +39 -0
- package/src/shared/ui/layout/ProgressBar.vue +49 -0
- package/src/shared/ui/layout/Section.vue +30 -0
- package/src/shared/ui/layout/SegmentedControl.vue +43 -0
- package/src/shared/ui/layout/SelectableCard.vue +46 -0
- package/src/shared/ui/layout/SelectableRow.vue +41 -0
- package/src/shared/ui/layout/Skeleton.vue +25 -0
- package/src/shared/ui/layout/SkeletonAvatar.vue +30 -0
- package/src/shared/ui/layout/SkeletonEntityCard.vue +20 -0
- package/src/shared/ui/layout/SkeletonFeedPost.vue +22 -0
- package/src/shared/ui/layout/SkeletonGrid.vue +18 -0
- package/src/shared/ui/layout/SkeletonListRow.vue +31 -0
- package/src/shared/ui/layout/SkeletonText.vue +25 -0
- package/src/shared/ui/layout/Stack.vue +42 -0
- package/src/shared/ui/layout/StateBlock.vue +44 -0
- package/src/shared/ui/layout/TwoPaneLayout.vue +35 -0
- package/src/shared/ui/layout/VirtualList.vue +160 -0
- package/src/shared/ui/layout/index.ts +35 -0
- package/src/shared/ui/layout/skeletonSurfaceStyles.ts +24 -0
- package/src/shared/ui/navigation/NavItem.vue +139 -0
- package/src/shared/ui/navigation/Tab.vue +61 -0
- package/src/shared/ui/navigation/Tabs.vue +37 -0
- package/src/shared/ui/navigation/index.ts +4 -0
- package/src/shared/ui/primitives/Action.vue +19 -0
- package/src/shared/ui/primitives/Block.vue +28 -0
- package/src/shared/ui/primitives/CanvasView.vue +19 -0
- package/src/shared/ui/primitives/Control.vue +24 -0
- package/src/shared/ui/primitives/ControlSelect.vue +19 -0
- package/src/shared/ui/primitives/ControlTextarea.vue +17 -0
- package/src/shared/ui/primitives/FieldLabel.vue +19 -0
- package/src/shared/ui/primitives/Form.vue +19 -0
- package/src/shared/ui/primitives/Heading.vue +29 -0
- package/src/shared/ui/primitives/Image.vue +17 -0
- package/src/shared/ui/primitives/LineBreak.vue +3 -0
- package/src/shared/ui/primitives/Link.vue +19 -0
- package/src/shared/ui/primitives/List.vue +28 -0
- package/src/shared/ui/primitives/ListItem.vue +19 -0
- package/src/shared/ui/primitives/OptionItem.vue +19 -0
- package/src/shared/ui/primitives/Text.vue +28 -0
- package/src/shared/ui/primitives/VideoView.vue +19 -0
- package/src/shared/ui/primitives/index.ts +19 -0
- package/src/shared/ui/primitives/resolveElement.ts +25 -0
- package/src/shared/ui/special/AngularAccent.vue +106 -0
- package/src/shared/ui/special/ExtensionRegistrySlotButton.vue +143 -0
- package/src/shared/ui/special/InfoRow.vue +39 -0
- package/src/shared/ui/special/LogViewer.vue +53 -0
- package/src/shared/ui/special/PageHeader.vue +23 -0
- package/src/shared/ui/special/RegistrySlotMissingCallout.vue +48 -0
- package/src/shared/ui/special/WelcomeCard.vue +32 -0
- package/src/shared/ui/special/index.ts +9 -0
- package/src/shared/utils/app-paths.ts +50 -0
- package/src/shared/utils/attachments.ts +16 -0
- package/src/shared/utils/autostart.ts +213 -0
- package/src/shared/utils/build-files.ts +439 -0
- package/src/shared/utils/build-manifest-init.ts +176 -0
- package/src/shared/utils/cloudinary.ts +67 -0
- package/src/shared/utils/cn.ts +7 -0
- package/src/shared/utils/download-stats-week.ts +165 -0
- package/src/shared/utils/entity-api-to-cache.ts +84 -0
- package/src/shared/utils/entity-build-from-api.ts +1 -0
- package/src/shared/utils/entity-display.ts +27 -0
- package/src/shared/utils/entity-map-from-api.ts +1 -0
- package/src/shared/utils/file-hash.ts +65 -0
- package/src/shared/utils/formatSize.ts +5 -0
- package/src/shared/utils/formatTime.ts +157 -0
- package/src/shared/utils/getAccountSkinRender.ts +32 -0
- package/src/shared/utils/index.ts +34 -0
- package/src/shared/utils/local-mods.ts +678 -0
- package/src/shared/utils/local-settings.ts +217 -0
- package/src/shared/utils/member-join-stats.ts +35 -0
- package/src/shared/utils/platform.ts +86 -0
- package/src/shared/utils/play-host-slug.ts +92 -0
- package/src/shared/utils/rich-content.ts +294 -0
- package/src/shared/utils/safeRequest.ts +23 -0
- package/src/shared/utils/semver.ts +81 -0
- package/src/shared/utils/serverPermissions.ts +155 -0
- package/src/shared/utils/skin-render-cache.ts +372 -0
- package/src/shared/utils/stripMarkdown.ts +45 -0
- package/src/shared/utils/transliterate.ts +74 -0
- package/src/shared/utils/updateAccountSkinRender.ts +64 -0
- package/src/shared/utils/updater.ts +218 -0
- package/src/shared/utils/uploadImage.ts +195 -0
- package/src/shared/utils/user-status.ts +9 -0
- package/src/tiptap/index.ts +7 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ExtensionRegistryPayloadMap } from '@rynt/sdk/extension-registry-payload-map';
|
|
2
|
+
import type {
|
|
3
|
+
BuiltinRegistryValueMap,
|
|
4
|
+
KnownBuiltinRegistryId,
|
|
5
|
+
} from './registry-value-map';
|
|
6
|
+
import {
|
|
7
|
+
createExtensionRegistryApi,
|
|
8
|
+
type ExtensionRegistryApi,
|
|
9
|
+
} from './extension-registry-api';
|
|
10
|
+
|
|
11
|
+
/** @deprecated Используйте {@link ExtensionRegistryApi} / {@link getExtensionRegistry}. */
|
|
12
|
+
export type ExtensionRegistryHandle<T> = ExtensionRegistryApi<T>;
|
|
13
|
+
|
|
14
|
+
export function getRegistry<I extends KnownBuiltinRegistryId>(
|
|
15
|
+
registryId: I,
|
|
16
|
+
): ExtensionRegistryApi<BuiltinRegistryValueMap[I]>;
|
|
17
|
+
export function getRegistry<K extends keyof ExtensionRegistryPayloadMap>(
|
|
18
|
+
registryId: K,
|
|
19
|
+
): ExtensionRegistryApi<ExtensionRegistryPayloadMap[K]>;
|
|
20
|
+
export function getRegistry<T>(registryId: string): ExtensionRegistryApi<T>;
|
|
21
|
+
export function getRegistry<T>(registryId: string): ExtensionRegistryApi<T> {
|
|
22
|
+
return createExtensionRegistryApi<T>(registryId);
|
|
23
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export {
|
|
2
|
+
clearRegistryBucket,
|
|
3
|
+
deleteRegistryItem,
|
|
4
|
+
extensionRegistriesRevision,
|
|
5
|
+
getRegistryEntryMeta,
|
|
6
|
+
getRegistryItem,
|
|
7
|
+
hasRegistryItem,
|
|
8
|
+
listRegistryEntries,
|
|
9
|
+
listRegistryKeys,
|
|
10
|
+
listRegistryValuesSorted,
|
|
11
|
+
resetExtensionRegistries,
|
|
12
|
+
setRegistryItem,
|
|
13
|
+
unregisterRegistryEntriesForExtension,
|
|
14
|
+
type RegistryEntry,
|
|
15
|
+
type RegistryEntryMeta,
|
|
16
|
+
} from './store';
|
|
17
|
+
export {
|
|
18
|
+
getCurrentExtensionId,
|
|
19
|
+
HOST_EXTENSION_ID,
|
|
20
|
+
popExtensionScope,
|
|
21
|
+
pushExtensionScope,
|
|
22
|
+
withExtensionScope,
|
|
23
|
+
} from './extension-scope';
|
|
24
|
+
export { ensureCoreExtensionRegistries } from './bootstrap';
|
|
25
|
+
export { getRegistry, type ExtensionRegistryHandle } from './get-registry';
|
|
26
|
+
export {
|
|
27
|
+
defineExtensionRegistry,
|
|
28
|
+
getExtensionRegistry,
|
|
29
|
+
type ExtensionRegistryApi,
|
|
30
|
+
type RegistryRow,
|
|
31
|
+
type UseExtensionRegistry,
|
|
32
|
+
} from './define-extension-registry';
|
|
33
|
+
export type { ExtensionRegistryPayloadMap } from '@rynt/sdk/extension-registry-payload-map';
|
|
34
|
+
export type {
|
|
35
|
+
BuiltinRegistryId,
|
|
36
|
+
BuiltinRegistryValueMap,
|
|
37
|
+
KnownBuiltinRegistryId,
|
|
38
|
+
} from './registry-value-map';
|
|
39
|
+
export {
|
|
40
|
+
applyValidatedRyntContributesToManifest,
|
|
41
|
+
flattenExtendsRegistries,
|
|
42
|
+
getRyntContributesFromManifest,
|
|
43
|
+
KNOWN_CORE_REGISTRY_IDS,
|
|
44
|
+
validateRyntManifestContributes,
|
|
45
|
+
type ParsedRyntManifestContributes,
|
|
46
|
+
type RegistryDeclaration,
|
|
47
|
+
type RegistryExtensionContribution,
|
|
48
|
+
type RegistrySlotRef,
|
|
49
|
+
} from './manifest-rynt';
|
|
50
|
+
export {
|
|
51
|
+
getRegistryEntryRow,
|
|
52
|
+
hasRegistryEntry,
|
|
53
|
+
resolveRegistrySlot,
|
|
54
|
+
type RegistrySlotResolveResult,
|
|
55
|
+
} from './registry-slot';
|
|
56
|
+
export { clearExtensionUiRegistries } from './clear-extension-ui-registries';
|
|
57
|
+
|
|
58
|
+
export * from './builtins';
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const registryDeclSchema = z.object({
|
|
4
|
+
id: z.string().min(1),
|
|
5
|
+
title: z.string().optional(),
|
|
6
|
+
description: z.string().optional(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const registryExtendSchema = z.object({
|
|
10
|
+
registryId: z.string().min(1),
|
|
11
|
+
keys: z.array(z.string().min(1)).min(1),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const ryntContributesSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
declaresRegistries: z.array(registryDeclSchema).optional(),
|
|
17
|
+
extendsRegistries: z.array(registryExtendSchema).optional(),
|
|
18
|
+
})
|
|
19
|
+
.strict();
|
|
20
|
+
|
|
21
|
+
export type RegistryDeclaration = z.infer<typeof registryDeclSchema>;
|
|
22
|
+
export type RegistryExtensionContribution = z.infer<typeof registryExtendSchema>;
|
|
23
|
+
|
|
24
|
+
export type ParsedRyntManifestContributes = z.infer<typeof ryntContributesSchema>;
|
|
25
|
+
|
|
26
|
+
export interface RegistrySlotRef {
|
|
27
|
+
registryId: string;
|
|
28
|
+
key: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Встроенные реестры ядра — implied dependency на владельца не требуется. */
|
|
32
|
+
export const KNOWN_CORE_REGISTRY_IDS = new Set<string>([
|
|
33
|
+
'core.page',
|
|
34
|
+
'core.nav',
|
|
35
|
+
'core.sidebar',
|
|
36
|
+
'core.shell',
|
|
37
|
+
'core.userStrip',
|
|
38
|
+
'core.loader',
|
|
39
|
+
'core.accountProvider',
|
|
40
|
+
'core.inviteHandler',
|
|
41
|
+
'core.modProvider',
|
|
42
|
+
'core.modManageActions',
|
|
43
|
+
'core.resourcepackManageActions',
|
|
44
|
+
'core.shaderpackManageActions',
|
|
45
|
+
'core.fileEditor',
|
|
46
|
+
'core.theme',
|
|
47
|
+
'core.sidebarBeforeContent',
|
|
48
|
+
'core.sidebarAfterContent',
|
|
49
|
+
'core.markdownEditorToolbarActions',
|
|
50
|
+
'core.markdownEditorTiptapExtensions',
|
|
51
|
+
'core.markdownRendererBeforeContent',
|
|
52
|
+
'core.markdownRendererAfterContent',
|
|
53
|
+
'core.buildDetailBeforeContent',
|
|
54
|
+
'core.buildDetailAfterContent',
|
|
55
|
+
'core.buildDetailHeaderActions',
|
|
56
|
+
'core.modDetailsFooterActions',
|
|
57
|
+
'core.mapDetailBeforeContent',
|
|
58
|
+
'core.mapDetailAfterContent',
|
|
59
|
+
'core.mapDetailHeaderActions',
|
|
60
|
+
'core.serverDetailBeforeContent',
|
|
61
|
+
'core.serverDetailAfterContent',
|
|
62
|
+
'core.serverDetailHeaderActions',
|
|
63
|
+
'core.buildCardActions',
|
|
64
|
+
'core.mapCardActions',
|
|
65
|
+
'core.serverCardActions',
|
|
66
|
+
'core.appTopbarLeftWidgets',
|
|
67
|
+
'core.appTopbarRightWidgets',
|
|
68
|
+
'core.appTopbarStatusWidgets',
|
|
69
|
+
'core.sidebarHeaderWidgets',
|
|
70
|
+
'core.sidebarFooterWidgets',
|
|
71
|
+
'core.userMenuActions',
|
|
72
|
+
'core.userMenuBeforeActions',
|
|
73
|
+
'core.userMenuAfterActions',
|
|
74
|
+
'core.feedBeforeContent',
|
|
75
|
+
'core.feedAfterContent',
|
|
76
|
+
'core.libraryBeforeContent',
|
|
77
|
+
'core.libraryAfterContent',
|
|
78
|
+
'core.friendsBeforeList',
|
|
79
|
+
'core.friendsAfterList',
|
|
80
|
+
'core.projectsBeforeContent',
|
|
81
|
+
'core.projectsAfterContent',
|
|
82
|
+
'core.settingsBeforeSections',
|
|
83
|
+
'core.settingsAfterSections',
|
|
84
|
+
'core.settingsSectionWidgets',
|
|
85
|
+
'core.buildCardBeforeMedia',
|
|
86
|
+
'core.buildCardBeforeMeta',
|
|
87
|
+
'core.buildCardAfterMeta',
|
|
88
|
+
'core.buildCardFooterActions',
|
|
89
|
+
'core.mapCardBeforeMeta',
|
|
90
|
+
'core.mapCardAfterMeta',
|
|
91
|
+
'core.mapCardFooterActions',
|
|
92
|
+
'core.serverCardBeforeMeta',
|
|
93
|
+
'core.serverCardAfterMeta',
|
|
94
|
+
'core.serverCardFooterActions',
|
|
95
|
+
'core.userCardBeforeMeta',
|
|
96
|
+
'core.userCardAfterMeta',
|
|
97
|
+
'core.buildDetailBeforeHero',
|
|
98
|
+
'core.buildDetailRightColumnTop',
|
|
99
|
+
'core.buildDetailRightColumnBottom',
|
|
100
|
+
'core.buildDetailModRowActions',
|
|
101
|
+
'core.buildDetailResourcepackRowActions',
|
|
102
|
+
'core.dialogFooterActions',
|
|
103
|
+
]);
|
|
104
|
+
|
|
105
|
+
export function flattenExtendsRegistries(
|
|
106
|
+
contributes: ParsedRyntManifestContributes | undefined,
|
|
107
|
+
): RegistrySlotRef[] {
|
|
108
|
+
if (!contributes?.extendsRegistries?.length) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
const out: RegistrySlotRef[] = [];
|
|
112
|
+
for (const block of contributes.extendsRegistries) {
|
|
113
|
+
for (const key of block.keys) {
|
|
114
|
+
out.push({ registryId: block.registryId, key });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function getRyntContributesFromManifest(manifest: {
|
|
121
|
+
contributes?: Record<string, unknown>;
|
|
122
|
+
}): ParsedRyntManifestContributes | undefined {
|
|
123
|
+
const raw = manifest.contributes?.rynt;
|
|
124
|
+
if (!raw || typeof raw !== 'object') {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
return raw as ParsedRyntManifestContributes;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function validateRyntManifestContributes(
|
|
131
|
+
extensionId: string,
|
|
132
|
+
raw: unknown,
|
|
133
|
+
): { ok: true; data: ParsedRyntManifestContributes } | { ok: false; error: string } {
|
|
134
|
+
if (raw === undefined) {
|
|
135
|
+
return { ok: true, data: {} };
|
|
136
|
+
}
|
|
137
|
+
const parsed = ryntContributesSchema.safeParse(raw);
|
|
138
|
+
if (!parsed.success) {
|
|
139
|
+
const msg = parsed.error.issues
|
|
140
|
+
.map((i) => `${i.path.join('.')}: ${i.message}`)
|
|
141
|
+
.join('; ');
|
|
142
|
+
return { ok: false, error: msg };
|
|
143
|
+
}
|
|
144
|
+
const data = parsed.data;
|
|
145
|
+
|
|
146
|
+
const declared = data.declaresRegistries;
|
|
147
|
+
if (declared?.length) {
|
|
148
|
+
const ids = declared.map((d) => d.id);
|
|
149
|
+
const uniq = new Set(ids);
|
|
150
|
+
if (uniq.size !== ids.length) {
|
|
151
|
+
return { ok: false, error: 'declaresRegistries: дублирующиеся id' };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const extended = data.extendsRegistries;
|
|
156
|
+
if (extended?.length) {
|
|
157
|
+
const registryIds = extended.map((e) => e.registryId);
|
|
158
|
+
const uniqReg = new Set(registryIds);
|
|
159
|
+
if (uniqReg.size !== registryIds.length) {
|
|
160
|
+
return { ok: false, error: 'extendsRegistries: дублирующийся registryId' };
|
|
161
|
+
}
|
|
162
|
+
for (const block of extended) {
|
|
163
|
+
const uniqKeys = new Set(block.keys);
|
|
164
|
+
if (uniqKeys.size !== block.keys.length) {
|
|
165
|
+
return {
|
|
166
|
+
ok: false,
|
|
167
|
+
error: `extendsRegistries[${block.registryId}]: дублирующиеся keys`,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return { ok: true, data };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function applyValidatedRyntContributesToManifest(manifest: {
|
|
177
|
+
id: string;
|
|
178
|
+
contributes?: Record<string, unknown>;
|
|
179
|
+
}): string | null {
|
|
180
|
+
const raw = manifest.contributes?.rynt;
|
|
181
|
+
if (raw === undefined) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
const v = validateRyntManifestContributes(manifest.id, raw);
|
|
185
|
+
if (!v.ok) {
|
|
186
|
+
return v.error;
|
|
187
|
+
}
|
|
188
|
+
manifest.contributes = {
|
|
189
|
+
...(manifest.contributes ?? {}),
|
|
190
|
+
rynt: v.data,
|
|
191
|
+
};
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { RegistryRow } from './extension-registry-api';
|
|
2
|
+
import {
|
|
3
|
+
getRegistryEntryMeta,
|
|
4
|
+
hasRegistryItem,
|
|
5
|
+
} from './store';
|
|
6
|
+
|
|
7
|
+
export type RegistrySlotResolveResult<T = unknown> =
|
|
8
|
+
| { status: 'present'; row: RegistryRow<T> }
|
|
9
|
+
| { status: 'missing' };
|
|
10
|
+
|
|
11
|
+
export function hasRegistryEntry(registryId: string, key: string): boolean {
|
|
12
|
+
return hasRegistryItem(registryId, key);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getRegistryEntryRow<T = unknown>(
|
|
16
|
+
registryId: string,
|
|
17
|
+
key: string,
|
|
18
|
+
): RegistryRow<T> | undefined {
|
|
19
|
+
const meta = getRegistryEntryMeta<T>(registryId, key);
|
|
20
|
+
if (!meta) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
registryKey: key,
|
|
25
|
+
extensionId: meta.extensionId,
|
|
26
|
+
order: meta.order,
|
|
27
|
+
value: meta.value,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function resolveRegistrySlot<T = unknown>(
|
|
32
|
+
registryId: string,
|
|
33
|
+
key: string,
|
|
34
|
+
): RegistrySlotResolveResult<T> {
|
|
35
|
+
const row = getRegistryEntryRow<T>(registryId, key);
|
|
36
|
+
if (!row) {
|
|
37
|
+
return { status: 'missing' };
|
|
38
|
+
}
|
|
39
|
+
return { status: 'present', row };
|
|
40
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
|
|
3
|
+
import type { BaseLoader } from '../../minecraft-loader/base-loader';
|
|
4
|
+
import type { ThemeDefinition } from '../../shared/themes/types';
|
|
5
|
+
import type { NavigationSection } from '../../shared/types/navigation';
|
|
6
|
+
import type { ModMarketplaceProvider } from '../../shared/mods/mod-marketplace-types';
|
|
7
|
+
import type { FileEditorProvider } from './builtins/file-editor';
|
|
8
|
+
import type { IAuthProvider } from '../launcher-models/apis/accounts-contracts';
|
|
9
|
+
import type { InviteHandlerRegistration } from '../invite-handler/types';
|
|
10
|
+
import type { CoreNavItem, CorePageItem, CoreSidebarItem } from './builtins';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Встроенные реестры: ключ = строковый id из `registries/builtins/*`.
|
|
14
|
+
*/
|
|
15
|
+
export interface BuiltinRegistryValueMap {
|
|
16
|
+
'core.page': CorePageItem;
|
|
17
|
+
'core.nav': CoreNavItem;
|
|
18
|
+
'core.sidebar': CoreSidebarItem;
|
|
19
|
+
'core.userStrip': Component;
|
|
20
|
+
'core.shell': Component;
|
|
21
|
+
'core.loader': BaseLoader;
|
|
22
|
+
'core.accountProvider': IAuthProvider;
|
|
23
|
+
'core.inviteHandler': InviteHandlerRegistration;
|
|
24
|
+
'core.modProvider': ModMarketplaceProvider;
|
|
25
|
+
'core.modManageActions': Component;
|
|
26
|
+
'core.resourcepackManageActions': Component;
|
|
27
|
+
'core.shaderpackManageActions': Component;
|
|
28
|
+
'core.fileEditor': FileEditorProvider;
|
|
29
|
+
'core.sidebarBeforeContent': Component;
|
|
30
|
+
'core.sidebarAfterContent': Component;
|
|
31
|
+
'core.markdownEditorToolbarActions': Component;
|
|
32
|
+
'core.markdownEditorTiptapExtensions': import('@tiptap/core').AnyExtension;
|
|
33
|
+
'core.markdownRendererBeforeContent': Component;
|
|
34
|
+
'core.markdownRendererAfterContent': Component;
|
|
35
|
+
'core.buildDetailBeforeContent': Component;
|
|
36
|
+
'core.buildDetailAfterContent': Component;
|
|
37
|
+
'core.buildDetailHeaderActions': Component;
|
|
38
|
+
'core.modDetailsFooterActions': Component;
|
|
39
|
+
'core.mapDetailBeforeContent': Component;
|
|
40
|
+
'core.mapDetailAfterContent': Component;
|
|
41
|
+
'core.mapDetailHeaderActions': Component;
|
|
42
|
+
'core.serverDetailBeforeContent': Component;
|
|
43
|
+
'core.serverDetailAfterContent': Component;
|
|
44
|
+
'core.serverDetailHeaderActions': Component;
|
|
45
|
+
'core.buildCardActions': Component;
|
|
46
|
+
'core.mapCardActions': Component;
|
|
47
|
+
'core.serverCardActions': Component;
|
|
48
|
+
'core.appTopbarLeftWidgets': Component;
|
|
49
|
+
'core.appTopbarRightWidgets': Component;
|
|
50
|
+
'core.appTopbarStatusWidgets': Component;
|
|
51
|
+
'core.sidebarHeaderWidgets': Component;
|
|
52
|
+
'core.sidebarFooterWidgets': Component;
|
|
53
|
+
'core.userMenuActions': Component;
|
|
54
|
+
'core.userMenuBeforeActions': Component;
|
|
55
|
+
'core.userMenuAfterActions': Component;
|
|
56
|
+
'core.feedBeforeContent': Component;
|
|
57
|
+
'core.feedAfterContent': Component;
|
|
58
|
+
'core.libraryBeforeContent': Component;
|
|
59
|
+
'core.libraryAfterContent': Component;
|
|
60
|
+
'core.friendsBeforeList': Component;
|
|
61
|
+
'core.friendsAfterList': Component;
|
|
62
|
+
'core.projectsBeforeContent': Component;
|
|
63
|
+
'core.projectsAfterContent': Component;
|
|
64
|
+
'core.settingsBeforeSections': Component;
|
|
65
|
+
'core.settingsAfterSections': Component;
|
|
66
|
+
'core.settingsSectionWidgets': Component;
|
|
67
|
+
'core.buildCardBeforeMedia': Component;
|
|
68
|
+
'core.buildCardBeforeMeta': Component;
|
|
69
|
+
'core.buildCardAfterMeta': Component;
|
|
70
|
+
'core.buildCardFooterActions': Component;
|
|
71
|
+
'core.mapCardBeforeMeta': Component;
|
|
72
|
+
'core.mapCardAfterMeta': Component;
|
|
73
|
+
'core.mapCardFooterActions': Component;
|
|
74
|
+
'core.serverCardBeforeMeta': Component;
|
|
75
|
+
'core.serverCardAfterMeta': Component;
|
|
76
|
+
'core.serverCardFooterActions': Component;
|
|
77
|
+
'core.userCardBeforeMeta': Component;
|
|
78
|
+
'core.userCardAfterMeta': Component;
|
|
79
|
+
'core.buildDetailBeforeHero': Component;
|
|
80
|
+
'core.buildDetailRightColumnTop': Component;
|
|
81
|
+
'core.buildDetailRightColumnBottom': Component;
|
|
82
|
+
'core.buildDetailModRowActions': Component;
|
|
83
|
+
'core.buildDetailResourcepackRowActions': Component;
|
|
84
|
+
'core.dialogFooterActions': Component;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type KnownBuiltinRegistryId = keyof BuiltinRegistryValueMap;
|
|
88
|
+
|
|
89
|
+
export type BuiltinRegistryId = KnownBuiltinRegistryId;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { reactive, shallowRef } from 'vue';
|
|
2
|
+
|
|
3
|
+
import { HOST_EXTENSION_ID } from './extension-scope';
|
|
4
|
+
import type {
|
|
5
|
+
BuiltinRegistryValueMap,
|
|
6
|
+
KnownBuiltinRegistryId,
|
|
7
|
+
} from './registry-value-map';
|
|
8
|
+
|
|
9
|
+
export interface RegistryEntryMeta {
|
|
10
|
+
/** Источник записи: id расширения или {@link HOST_EXTENSION_ID} для лаунчера. */
|
|
11
|
+
extensionId: string;
|
|
12
|
+
order?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface RegistryEntry<T = unknown> extends RegistryEntryMeta {
|
|
16
|
+
value: T;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Реактивные вложенные `Map`: в `computed`/`watch` достаточно читать через публичные API без `revision`. */
|
|
20
|
+
const buckets = reactive(new Map<string, Map<string, RegistryEntry>>());
|
|
21
|
+
|
|
22
|
+
const declaredRegistryIds = new Set<string>();
|
|
23
|
+
|
|
24
|
+
/** Ревизия любого изменения любого реестра (для Vue). */
|
|
25
|
+
export const extensionRegistriesRevision = shallowRef(0);
|
|
26
|
+
|
|
27
|
+
function bumpRevision(): void {
|
|
28
|
+
extensionRegistriesRevision.value += 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function ensureBucket(registryId: string): Map<string, RegistryEntry> {
|
|
32
|
+
let m = buckets.get(registryId);
|
|
33
|
+
if (!m) {
|
|
34
|
+
m = reactive(new Map<string, RegistryEntry>());
|
|
35
|
+
buckets.set(registryId, m);
|
|
36
|
+
}
|
|
37
|
+
return m;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Идемпотентно помечает реестр как объявленный ядром / автором (`defineExtensionRegistry`)
|
|
42
|
+
* и создаёт bucket. Для динамических id без объявления — {@link touchExtensionRegistryBucket}.
|
|
43
|
+
*/
|
|
44
|
+
export function declareExtensionRegistryId(registryId: string): void {
|
|
45
|
+
if (
|
|
46
|
+
declaredRegistryIds.has(registryId) &&
|
|
47
|
+
process.env.NODE_ENV === 'development'
|
|
48
|
+
) {
|
|
49
|
+
console.warn(
|
|
50
|
+
`[rynt/registries] declareExtensionRegistryId: id «${registryId}» уже объявлен`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
declaredRegistryIds.add(registryId);
|
|
54
|
+
ensureBucket(registryId);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Гарантирует наличие bucket (динамический `registryId`, `getExtensionRegistry`). */
|
|
58
|
+
export function touchExtensionRegistryBucket(registryId: string): void {
|
|
59
|
+
ensureBucket(registryId);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Базовая запись в реестр с явно указанным `extensionId`.
|
|
64
|
+
* Применяется внутри `ExtensionRegistryApi.register(...)` (берёт id из scope), `ctx.registerRegistryEntry`,
|
|
65
|
+
* и обёрток-классов вроде `LoaderRegistry`.
|
|
66
|
+
*/
|
|
67
|
+
export function setRegistryItem<I extends KnownBuiltinRegistryId>(
|
|
68
|
+
registryId: I,
|
|
69
|
+
key: string,
|
|
70
|
+
value: BuiltinRegistryValueMap[I],
|
|
71
|
+
extensionId: string,
|
|
72
|
+
order?: number,
|
|
73
|
+
): void;
|
|
74
|
+
export function setRegistryItem<T>(
|
|
75
|
+
registryId: string,
|
|
76
|
+
key: string,
|
|
77
|
+
value: T,
|
|
78
|
+
extensionId: string,
|
|
79
|
+
order?: number,
|
|
80
|
+
): void;
|
|
81
|
+
export function setRegistryItem<T>(
|
|
82
|
+
registryId: string,
|
|
83
|
+
key: string,
|
|
84
|
+
value: T,
|
|
85
|
+
extensionId: string,
|
|
86
|
+
order?: number,
|
|
87
|
+
): void {
|
|
88
|
+
const map = ensureBucket(registryId);
|
|
89
|
+
map.set(key, { value, extensionId, order });
|
|
90
|
+
bumpRevision();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function getRegistryItem<I extends KnownBuiltinRegistryId>(
|
|
94
|
+
registryId: I,
|
|
95
|
+
key: string,
|
|
96
|
+
): BuiltinRegistryValueMap[I] | undefined;
|
|
97
|
+
export function getRegistryItem<T>(
|
|
98
|
+
registryId: string,
|
|
99
|
+
key: string,
|
|
100
|
+
): T | undefined;
|
|
101
|
+
export function getRegistryItem<T>(
|
|
102
|
+
registryId: string,
|
|
103
|
+
key: string,
|
|
104
|
+
): T | undefined {
|
|
105
|
+
return buckets.get(registryId)?.get(key)?.value as T | undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function hasRegistryItem(registryId: string, key: string): boolean {
|
|
109
|
+
return buckets.get(registryId)?.has(key) ?? false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function listRegistryKeys(registryId: string): string[] {
|
|
113
|
+
return [...(buckets.get(registryId)?.keys() ?? [])];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function listRegistryEntries<I extends KnownBuiltinRegistryId>(
|
|
117
|
+
registryId: I,
|
|
118
|
+
): [string, BuiltinRegistryValueMap[I]][];
|
|
119
|
+
export function listRegistryEntries<T>(registryId: string): [string, T][];
|
|
120
|
+
export function listRegistryEntries<T>(registryId: string): [string, T][] {
|
|
121
|
+
const m = buckets.get(registryId);
|
|
122
|
+
if (!m) return [];
|
|
123
|
+
return [...m.entries()].map(([k, e]) => [k, e.value as T]);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Значения в порядке `order` (по возрастанию), затем по ключу. */
|
|
127
|
+
export function listRegistryValuesSorted<I extends KnownBuiltinRegistryId>(
|
|
128
|
+
registryId: I,
|
|
129
|
+
): BuiltinRegistryValueMap[I][];
|
|
130
|
+
export function listRegistryValuesSorted<T>(registryId: string): T[];
|
|
131
|
+
export function listRegistryValuesSorted<T>(registryId: string): T[] {
|
|
132
|
+
const m = buckets.get(registryId);
|
|
133
|
+
if (!m) return [];
|
|
134
|
+
const rows = [...m.entries()].map(([key, e]) => ({
|
|
135
|
+
key,
|
|
136
|
+
order: e.order ?? 100,
|
|
137
|
+
value: e.value as T,
|
|
138
|
+
}));
|
|
139
|
+
rows.sort((a, b) => a.order - b.order || a.key.localeCompare(b.key));
|
|
140
|
+
return rows.map((r) => r.value);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function deleteRegistryItem(registryId: string, key: string): boolean {
|
|
144
|
+
const m = buckets.get(registryId);
|
|
145
|
+
if (!m?.delete(key)) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
bumpRevision();
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function clearRegistryBucket(registryId: string): void {
|
|
153
|
+
const m = buckets.get(registryId);
|
|
154
|
+
if (!m || m.size === 0) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
m.clear();
|
|
158
|
+
bumpRevision();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function getRegistryEntryMeta<I extends KnownBuiltinRegistryId>(
|
|
162
|
+
registryId: I,
|
|
163
|
+
key: string,
|
|
164
|
+
): RegistryEntry<BuiltinRegistryValueMap[I]> | undefined;
|
|
165
|
+
export function getRegistryEntryMeta<T>(
|
|
166
|
+
registryId: string,
|
|
167
|
+
key: string,
|
|
168
|
+
): RegistryEntry<T> | undefined;
|
|
169
|
+
export function getRegistryEntryMeta(
|
|
170
|
+
registryId: string,
|
|
171
|
+
key: string,
|
|
172
|
+
): RegistryEntry | undefined {
|
|
173
|
+
return buckets.get(registryId)?.get(key);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** Удалить все записи, принадлежащие расширению (хост-записи под {@link HOST_EXTENSION_ID} не трогаются). */
|
|
177
|
+
export function unregisterRegistryEntriesForExtension(
|
|
178
|
+
extensionId: string,
|
|
179
|
+
): void {
|
|
180
|
+
if (extensionId === HOST_EXTENSION_ID) {
|
|
181
|
+
console.warn(
|
|
182
|
+
'[rynt/registries] unregisterRegistryEntriesForExtension: host extensionId is reserved, skipping',
|
|
183
|
+
);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
let changed = false;
|
|
187
|
+
for (const [, map] of buckets.entries()) {
|
|
188
|
+
for (const [k, entry] of [...map.entries()]) {
|
|
189
|
+
if (entry.extensionId === extensionId) {
|
|
190
|
+
map.delete(k);
|
|
191
|
+
changed = true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (changed) {
|
|
196
|
+
bumpRevision();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Полный сброс содержимого всех реестров (перед повторной загрузкой расширений). */
|
|
201
|
+
export function resetExtensionRegistries(): void {
|
|
202
|
+
for (const map of buckets.values()) {
|
|
203
|
+
map.clear();
|
|
204
|
+
}
|
|
205
|
+
bumpRevision();
|
|
206
|
+
}
|