adnbn 0.10.0 → 0.12.0
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 +3 -0
- package/dist/cli/builders/locale/LocaleBuilder.js +2 -11
- package/dist/cli/builders/locale/LocaleBuilder.js.map +1 -1
- package/dist/cli/builders/locale/index.js +1 -1
- package/dist/cli/builders/locale/index.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestBase.js +17 -7
- package/dist/cli/builders/manifest/ManifestBase.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestV2.js +1 -1
- package/dist/cli/builders/manifest/ManifestV3.js +12 -5
- package/dist/cli/builders/manifest/ManifestV3.js.map +1 -1
- package/dist/cli/builders/manifest/utils/data-collection-permissions.d.ts +15 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js +26 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.d.ts +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js +40 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js.map +1 -0
- package/dist/cli/builders/manifest/utils/index.d.ts +4 -0
- package/dist/cli/builders/manifest/utils/index.js +19 -0
- package/dist/cli/builders/manifest/utils/index.js.map +1 -0
- package/dist/cli/builders/manifest/utils/permissions.d.ts +14 -0
- package/dist/cli/builders/manifest/utils/permissions.js +34 -0
- package/dist/cli/builders/manifest/utils/permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.d.ts +2 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js +92 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js.map +1 -0
- package/dist/cli/bundler/index.d.ts +1 -0
- package/dist/cli/bundler/index.js +1 -0
- package/dist/cli/bundler/index.js.map +1 -1
- package/dist/cli/bundler/layers.d.ts +5 -0
- package/dist/cli/bundler/layers.js +12 -0
- package/dist/cli/bundler/layers.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.d.ts +14 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js +524 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.d.ts +2 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js +5 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.d.ts +9 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js +31 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.d.ts +9 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js +43 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js +5 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates/runtime.template.d.ts +2 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.d.ts +7 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.js +30 -0
- package/dist/cli/bundler/plugins/{EntrypointPlugin.d.ts → entrypoint/EntrypointPlugin.d.ts} +7 -2
- package/dist/cli/bundler/plugins/{EntrypointPlugin.js → entrypoint/EntrypointPlugin.js} +46 -26
- package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js +7 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js.map +1 -0
- package/dist/cli/bundler/plugins/{GenerateJsonPlugin.d.ts → generate-json/GenerateJsonPlugin.d.ts} +1 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js +73 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.js +5 -0
- package/dist/cli/bundler/plugins/generate-json/index.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.d.ts +23 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js +88 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.js +7 -0
- package/dist/cli/bundler/plugins/generate-module/index.js.map +1 -0
- package/dist/cli/bundler/plugins/index.d.ts +11 -5
- package/dist/cli/bundler/plugins/index.js +28 -10
- package/dist/cli/bundler/plugins/index.js.map +1 -1
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.d.ts +21 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js +174 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.d.ts +3 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.js +32 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js +5 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/css-loader.template.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/runtime.template.d.ts +7 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.d.ts +18 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.js +174 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.d.ts +10 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js +54 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/manifest/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/manifest/index.js +6 -0
- package/dist/cli/bundler/plugins/manifest/index.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/ReplacePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/replace/index.js +5 -0
- package/dist/cli/bundler/plugins/replace/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.d.ts +19 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js +20 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.js +5 -0
- package/dist/cli/bundler/plugins/resource-access/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/utils.d.ts +8 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js +42 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js.map +1 -0
- package/dist/cli/bundler/plugins/types.d.ts +8 -0
- package/dist/cli/bundler/plugins/types.js +1 -0
- package/dist/cli/bundler/plugins/types.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.d.ts +4 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.js +12 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/index.d.ts +5 -0
- package/dist/cli/bundler/plugins/utils/index.js +14 -0
- package/dist/cli/bundler/plugins/utils/index.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.d.ts +13 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js +17 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.js +11 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.d.ts +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js +18 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js +18 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js +16 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/watch/index.js +5 -0
- package/dist/cli/bundler/plugins/watch/index.js.map +1 -0
- package/dist/cli/bundler/utils/app-filename.d.ts +2 -0
- package/dist/cli/bundler/utils/app-filename.js +19 -0
- package/dist/cli/bundler/utils/app-filename.js.map +1 -0
- package/dist/cli/bundler/utils/assets.d.ts +3 -0
- package/dist/cli/bundler/utils/assets.js +162 -0
- package/dist/cli/bundler/utils/assets.js.map +1 -0
- package/dist/cli/bundler/utils/chunk-filename.d.ts +6 -0
- package/dist/cli/bundler/utils/chunk-filename.js +93 -0
- package/dist/cli/bundler/utils/chunk-filename.js.map +1 -0
- package/dist/cli/bundler/utils/index.d.ts +2 -1
- package/dist/cli/bundler/utils/index.js +2 -1
- package/dist/cli/bundler/utils/index.js.map +1 -1
- package/dist/cli/entrypoint/file/ExpressionFile.d.ts +4 -1
- package/dist/cli/entrypoint/file/ExpressionFile.js +11 -0
- package/dist/cli/entrypoint/file/ExpressionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/OptionFile.d.ts +4 -2
- package/dist/cli/entrypoint/file/OptionFile.js +35 -31
- package/dist/cli/entrypoint/file/OptionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/SourceFile.d.ts +18 -7
- package/dist/cli/entrypoint/file/SourceFile.js +260 -156
- package/dist/cli/entrypoint/file/SourceFile.js.map +1 -1
- package/dist/cli/entrypoint/file/index.d.ts +2 -0
- package/dist/cli/entrypoint/file/index.js +2 -0
- package/dist/cli/entrypoint/file/index.js.map +1 -1
- package/dist/cli/entrypoint/file/injectors/core.js +22 -1
- package/dist/cli/entrypoint/file/injectors/core.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ExportParser.d.ts +14 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js +71 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js.map +1 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.d.ts +2 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js +9 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js +5 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/index.d.ts +1 -0
- package/dist/cli/entrypoint/file/parsers/index.js +2 -0
- package/dist/cli/entrypoint/file/parsers/index.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/types.d.ts +16 -0
- package/dist/cli/entrypoint/file/parsers/types.js +13 -0
- package/dist/cli/entrypoint/file/parsers/types.js.map +1 -1
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.d.ts +1 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +3 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
- package/dist/cli/entrypoint/file/types.d.ts +26 -1
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/ContentFinder.d.ts +1 -1
- package/dist/cli/entrypoint/parser/AbstractParser.d.ts +3 -2
- package/dist/cli/entrypoint/parser/AbstractParser.js +6 -3
- package/dist/cli/entrypoint/parser/AbstractParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/ContentParser.d.ts +7 -3
- package/dist/cli/entrypoint/parser/ContentParser.js +42 -6
- package/dist/cli/entrypoint/parser/ContentParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/RelayParser.d.ts +21 -2
- package/dist/cli/entrypoint/parser/RelayParser.js +5 -1
- package/dist/cli/entrypoint/parser/RelayParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/utils/content/default-render.d.ts +3 -0
- package/dist/cli/entrypoint/parser/utils/content/default-render.js +21 -0
- package/dist/cli/entrypoint/parser/utils/content/default-render.js.map +1 -0
- package/dist/cli/plugins/asset.js +9 -4
- package/dist/cli/plugins/asset.js.map +1 -1
- package/dist/cli/plugins/background/index.js +1 -1
- package/dist/cli/plugins/background/index.js.map +1 -1
- package/dist/cli/plugins/content/Content.d.ts +2 -2
- package/dist/cli/plugins/content/Content.js +3 -2
- package/dist/cli/plugins/content/Content.js.map +1 -1
- package/dist/cli/plugins/content/ContentDriver.d.ts +1 -1
- package/dist/cli/plugins/content/ContentManager.d.ts +8 -5
- package/dist/cli/plugins/content/ContentManager.js +79 -28
- package/dist/cli/plugins/content/ContentManager.js.map +1 -1
- package/dist/cli/plugins/content/ContentName.d.ts +2 -2
- package/dist/cli/plugins/content/ContentName.js +8 -7
- package/dist/cli/plugins/content/ContentName.js.map +1 -1
- package/dist/cli/plugins/content/Relay.d.ts +2 -2
- package/dist/cli/plugins/content/Relay.js +3 -2
- package/dist/cli/plugins/content/Relay.js.map +1 -1
- package/dist/cli/plugins/content/RelayDriver.d.ts +1 -1
- package/dist/cli/plugins/content/RelayDriver.js +1 -1
- package/dist/cli/plugins/content/bundler.d.ts +7 -0
- package/dist/cli/plugins/content/bundler.js +47 -0
- package/dist/cli/plugins/content/bundler.js.map +1 -0
- package/dist/cli/plugins/content/index.js +121 -62
- package/dist/cli/plugins/content/index.js.map +1 -1
- package/dist/cli/plugins/content/relay-module.d.ts +3 -0
- package/dist/cli/plugins/content/relay-module.js +11 -0
- package/dist/cli/plugins/content/relay-module.js.map +1 -0
- package/dist/cli/plugins/content/types.d.ts +2 -2
- package/dist/cli/plugins/content/utils.d.ts +3 -1
- package/dist/cli/plugins/content/utils.js +8 -1
- package/dist/cli/plugins/content/utils.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.d.ts +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js +6 -6
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/icon.d.ts +3 -5
- package/dist/cli/plugins/icon/icon-module.d.ts +2 -0
- package/dist/cli/plugins/icon/icon-module.js +11 -0
- package/dist/cli/plugins/icon/icon-module.js.map +1 -0
- package/dist/cli/plugins/icon/index.js +5 -3
- package/dist/cli/plugins/icon/index.js.map +1 -1
- package/dist/cli/plugins/index.d.ts +1 -1
- package/dist/cli/plugins/index.js +1 -1
- package/dist/cli/plugins/locale/Locale.d.ts +9 -2
- package/dist/cli/plugins/locale/Locale.js +37 -5
- package/dist/cli/plugins/locale/Locale.js.map +1 -1
- package/dist/cli/plugins/locale/declaration/locale.d.ts +1 -1
- package/dist/cli/plugins/locale/index.js +57 -22
- package/dist/cli/plugins/locale/index.js.map +1 -1
- package/dist/cli/plugins/locale/locale-module.d.ts +4 -0
- package/dist/cli/plugins/locale/locale-module.js +16 -0
- package/dist/cli/plugins/locale/locale-module.js.map +1 -0
- package/dist/cli/plugins/offscreen/Offscreen.d.ts +2 -3
- package/dist/cli/plugins/offscreen/Offscreen.js.map +1 -1
- package/dist/cli/plugins/offscreen/index.js +5 -4
- package/dist/cli/plugins/offscreen/index.js.map +1 -1
- package/dist/cli/plugins/offscreen/offscreen-module.d.ts +3 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js +11 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js.map +1 -0
- package/dist/cli/plugins/output/index.d.ts +2 -0
- package/dist/cli/plugins/output/index.js +60 -0
- package/dist/cli/plugins/output/index.js.map +1 -0
- package/dist/cli/plugins/output/runtime.d.ts +26 -0
- package/dist/cli/plugins/output/runtime.js +19 -0
- package/dist/cli/plugins/output/runtime.js.map +1 -0
- package/dist/cli/plugins/page/declaration/PageDeclaration.js +4 -4
- package/dist/cli/plugins/page/declaration/PageDeclaration.js.map +1 -1
- package/dist/cli/plugins/page/declaration/page.d.ts +3 -3
- package/dist/cli/plugins/page/index.js +14 -10
- package/dist/cli/plugins/page/index.js.map +1 -1
- package/dist/cli/plugins/page/page-module.d.ts +2 -0
- package/dist/cli/plugins/page/page-module.js +11 -0
- package/dist/cli/plugins/page/page-module.js.map +1 -0
- package/dist/cli/plugins/popup/Popup.d.ts +1 -1
- package/dist/cli/plugins/popup/Popup.js +2 -2
- package/dist/cli/plugins/popup/Popup.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js +6 -6
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/popup.d.ts +3 -3
- package/dist/cli/plugins/popup/index.js +6 -5
- package/dist/cli/plugins/popup/index.js.map +1 -1
- package/dist/cli/plugins/popup/popup-module.d.ts +3 -0
- package/dist/cli/plugins/popup/popup-module.js +11 -0
- package/dist/cli/plugins/popup/popup-module.js.map +1 -0
- package/dist/cli/plugins/sandbox/Sandbox.d.ts +1 -2
- package/dist/cli/plugins/sandbox/Sandbox.js.map +1 -1
- package/dist/cli/plugins/sandbox/index.js +5 -4
- package/dist/cli/plugins/sandbox/index.js.map +1 -1
- package/dist/cli/plugins/sandbox/sandbox-module.d.ts +3 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js +11 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js.map +1 -0
- package/dist/cli/plugins/sidebar/Sidebar.d.ts +1 -1
- package/dist/cli/plugins/sidebar/Sidebar.js +2 -2
- package/dist/cli/plugins/sidebar/Sidebar.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js +6 -6
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/sidebar.d.ts +3 -3
- package/dist/cli/plugins/sidebar/index.js +6 -5
- package/dist/cli/plugins/sidebar/index.js.map +1 -1
- package/dist/cli/plugins/sidebar/sidebar-module.d.ts +3 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js +11 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js.map +1 -0
- package/dist/cli/plugins/style/index.d.ts +2 -1
- package/dist/cli/plugins/style/index.js +52 -25
- package/dist/cli/plugins/style/index.js.map +1 -1
- package/dist/cli/plugins/style/types.d.ts +5 -0
- package/dist/cli/plugins/style/types.js +1 -0
- package/dist/cli/plugins/style/types.js.map +1 -0
- package/dist/cli/raw.d.ts +4 -0
- package/dist/cli/resolvers/bundler.js +9 -7
- package/dist/cli/resolvers/bundler.js.map +1 -1
- package/dist/cli/resolvers/config.js +2 -1
- package/dist/cli/resolvers/config.js.map +1 -1
- package/dist/cli/virtual/index.d.ts +2 -2
- package/dist/cli/virtual/index.js +11 -8
- package/dist/cli/virtual/virtual.d.ts +14 -11
- package/dist/content/index.d.ts +3 -0
- package/dist/content/index.js +8 -0
- package/dist/content/index.js.map +1 -0
- package/dist/entry/content/adapters/react/Builder.d.ts +5 -6
- package/dist/entry/content/adapters/react/Builder.js +8 -21
- package/dist/entry/content/adapters/react/Builder.js.map +1 -1
- package/dist/entry/content/adapters/react/Node.d.ts +6 -12
- package/dist/entry/content/adapters/react/Node.js +9 -25
- package/dist/entry/content/adapters/react/Node.js.map +1 -1
- package/dist/entry/content/adapters/react/index.d.ts +2 -1
- package/dist/entry/content/adapters/react/index.js +3 -1
- package/dist/entry/content/adapters/react/index.js.map +1 -1
- package/dist/entry/content/adapters/react/resolvers/definition.d.ts +2 -0
- package/dist/entry/content/adapters/react/resolvers/definition.js +12 -0
- package/dist/entry/content/adapters/react/resolvers/definition.js.map +1 -0
- package/dist/entry/content/adapters/react/resolvers/render.d.ts +2 -2
- package/dist/entry/content/adapters/react/resolvers/render.js +4 -6
- package/dist/entry/content/adapters/react/resolvers/render.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.d.ts +5 -5
- package/dist/entry/content/adapters/vanilla/Builder.js +9 -15
- package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Node.d.ts +5 -10
- package/dist/entry/content/adapters/vanilla/Node.js +11 -34
- package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/index.d.ts +2 -1
- package/dist/entry/content/adapters/vanilla/index.js +3 -1
- package/dist/entry/content/adapters/vanilla/index.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/resolvers/definition.d.ts +2 -0
- package/dist/entry/content/adapters/vanilla/resolvers/definition.js +9 -0
- package/dist/entry/content/adapters/vanilla/resolvers/definition.js.map +1 -0
- package/dist/entry/content/adapters/vanilla/resolvers/render.d.ts +3 -0
- package/dist/entry/content/adapters/vanilla/resolvers/render.js +15 -0
- package/dist/entry/content/adapters/vanilla/resolvers/render.js.map +1 -0
- package/dist/entry/content/index.d.ts +5 -1
- package/dist/entry/content/index.js +8 -1
- package/dist/entry/content/index.js.map +1 -1
- package/dist/entry/content/lifecycle/Builder.d.ts +26 -0
- package/dist/entry/content/lifecycle/Builder.js +212 -0
- package/dist/entry/content/lifecycle/Builder.js.map +1 -0
- package/dist/entry/content/lifecycle/IsolationSetup.d.ts +16 -0
- package/dist/entry/content/lifecycle/IsolationSetup.js +37 -0
- package/dist/entry/content/lifecycle/IsolationSetup.js.map +1 -0
- package/dist/entry/content/lifecycle/MountBuilder.d.ts +8 -0
- package/dist/entry/content/lifecycle/MountBuilder.js +57 -0
- package/dist/entry/content/lifecycle/MountBuilder.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/context}/Context.d.ts +5 -2
- package/dist/entry/content/lifecycle/context/Context.js +73 -0
- package/dist/entry/content/lifecycle/context/Context.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/context}/EventEmitter.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/context}/EventEmitter.js +3 -3
- package/dist/entry/content/lifecycle/context/EventEmitter.js.map +1 -0
- package/dist/entry/content/lifecycle/context/ManagedContext.d.ts +5 -0
- package/dist/entry/content/{core → lifecycle/context}/ManagedContext.js +2 -2
- package/dist/entry/content/lifecycle/context/ManagedContext.js.map +1 -0
- package/dist/entry/content/lifecycle/context/index.d.ts +3 -0
- package/dist/entry/content/lifecycle/context/index.js +9 -0
- package/dist/entry/content/lifecycle/context/index.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/markers}/AbstractMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/markers}/AbstractMarker.js +3 -3
- package/dist/entry/content/lifecycle/markers/AbstractMarker.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/markers}/AttributeMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/markers}/AttributeMarker.js +2 -2
- package/dist/entry/content/lifecycle/markers/AttributeMarker.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/markers}/WeakMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/markers}/WeakMarker.js +2 -2
- package/dist/entry/content/lifecycle/markers/WeakMarker.js.map +1 -0
- package/dist/entry/content/lifecycle/markers/index.d.ts +3 -0
- package/dist/entry/content/lifecycle/markers/index.js +9 -0
- package/dist/entry/content/lifecycle/markers/index.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/EventNode.d.ts +5 -2
- package/dist/entry/content/{core → lifecycle/nodes}/EventNode.js +14 -2
- package/dist/entry/content/lifecycle/nodes/EventNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.d.ts +29 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.js +187 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/MarkerNode.d.ts +4 -2
- package/dist/entry/content/{core → lifecycle/nodes}/MarkerNode.js +8 -2
- package/dist/entry/content/lifecycle/nodes/MarkerNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/MountNode.d.ts +4 -2
- package/dist/entry/content/{core → lifecycle/nodes}/MountNode.js +8 -2
- package/dist/entry/content/lifecycle/nodes/MountNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/Node.d.ts +3 -2
- package/dist/entry/content/{core → lifecycle/nodes}/Node.js +5 -2
- package/dist/entry/content/lifecycle/nodes/Node.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.d.ts +19 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.js +75 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.d.ts +21 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.js +121 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/index.d.ts +7 -0
- package/dist/entry/content/lifecycle/nodes/index.js +17 -0
- package/dist/entry/content/lifecycle/nodes/index.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/isolated-styles.d.ts +2 -0
- package/dist/entry/content/lifecycle/nodes/isolated-styles.js +14 -0
- package/dist/entry/content/lifecycle/nodes/isolated-styles.js.map +1 -0
- package/dist/entry/content/resolvers/anchor.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/anchor.js +2 -2
- package/dist/entry/content/resolvers/anchor.js.map +1 -0
- package/dist/entry/content/resolvers/container.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/container.js +2 -2
- package/dist/entry/content/resolvers/container.js.map +1 -0
- package/dist/entry/content/resolvers/definition.d.ts +5 -0
- package/dist/entry/content/resolvers/definition.js +24 -0
- package/dist/entry/content/resolvers/definition.js.map +1 -0
- package/dist/entry/content/{core/resolvers → resolvers}/index.d.ts +1 -1
- package/dist/entry/content/{core/resolvers → resolvers}/index.js +1 -1
- package/dist/entry/content/resolvers/index.js.map +1 -0
- package/dist/entry/content/resolvers/mount.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/mount.js +3 -3
- package/dist/entry/content/resolvers/mount.js.map +1 -0
- package/dist/entry/content/resolvers/target.d.ts +3 -0
- package/dist/entry/content/resolvers/target.js +34 -0
- package/dist/entry/content/resolvers/target.js.map +1 -0
- package/dist/entry/content/resolvers/watch.d.ts +6 -0
- package/dist/entry/content/{core/resolvers → resolvers}/watch.js +15 -11
- package/dist/entry/content/resolvers/watch.js.map +1 -0
- package/dist/entry/relay/Builder.d.ts +8 -8
- package/dist/entry/relay/Builder.js +32 -19
- package/dist/entry/relay/Builder.js.map +1 -1
- package/dist/entry/relay/TransportBuilder.d.ts +3 -2
- package/dist/entry/relay/TransportBuilder.js +3 -3
- package/dist/entry/relay/TransportBuilder.js.map +1 -1
- package/dist/entry/relay/index.d.ts +5 -2
- package/dist/entry/relay/index.js +8 -2
- package/dist/entry/relay/index.js.map +1 -1
- package/dist/entry/relay/resolvers/definition.d.ts +4 -0
- package/dist/entry/relay/resolvers/definition.js +16 -0
- package/dist/entry/relay/resolvers/definition.js.map +1 -0
- package/dist/locale/adapters/react/ReactLocale.d.ts +18 -0
- package/dist/locale/adapters/react/ReactLocale.js +41 -0
- package/dist/locale/adapters/react/ReactLocale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.d.ts +7 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js +30 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-locale.js +17 -0
- package/dist/locale/adapters/react/hooks/use-locale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js +10 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js.map +1 -0
- package/dist/locale/adapters/react/index.d.ts +4 -2
- package/dist/locale/adapters/react/index.js +6 -4
- package/dist/locale/adapters/react/index.js.map +1 -1
- package/dist/locale/adapters/react/types.d.ts +22 -0
- package/dist/locale/adapters/react/types.js +1 -0
- package/dist/locale/adapters/react/types.js.map +1 -0
- package/dist/locale/helpers.d.ts +4 -5
- package/dist/locale/helpers.js +1 -1
- package/dist/locale/helpers.js.map +1 -1
- package/dist/locale/index.d.ts +2 -1
- package/dist/locale/index.js +1 -0
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/providers/AbstractLocale.d.ts +4 -4
- package/dist/locale/providers/AbstractLocale.js +13 -94
- package/dist/locale/providers/AbstractLocale.js.map +1 -1
- package/dist/locale/providers/CustomLocale.d.ts +3 -3
- package/dist/locale/providers/CustomLocale.js +6 -5
- package/dist/locale/providers/CustomLocale.js.map +1 -1
- package/dist/locale/providers/DynamicLocale.d.ts +18 -11
- package/dist/locale/providers/DynamicLocale.js +60 -47
- package/dist/locale/providers/DynamicLocale.js.map +1 -1
- package/dist/locale/providers/NativeLocale.d.ts +4 -7
- package/dist/locale/providers/NativeLocale.js +5 -14
- package/dist/locale/providers/NativeLocale.js.map +1 -1
- package/dist/locale/providers/ObservableLocale.d.ts +35 -0
- package/dist/locale/providers/ObservableLocale.js +179 -0
- package/dist/locale/providers/ObservableLocale.js.map +1 -0
- package/dist/locale/providers/index.d.ts +2 -1
- package/dist/locale/providers/index.js +3 -1
- package/dist/locale/providers/index.js.map +1 -1
- package/dist/locale/storage/LocaleStorage.d.ts +11 -0
- package/dist/locale/storage/LocaleStorage.js +40 -0
- package/dist/locale/storage/LocaleStorage.js.map +1 -0
- package/dist/locale/storage/index.d.ts +1 -0
- package/dist/locale/storage/index.js +5 -0
- package/dist/locale/storage/index.js.map +1 -0
- package/dist/main/content.d.ts +4 -6
- package/dist/main/content.js +3 -16
- package/dist/main/content.js.map +1 -1
- package/dist/main/entrypoint.d.ts +4 -0
- package/dist/main/entrypoint.js +20 -0
- package/dist/main/entrypoint.js.map +1 -0
- package/dist/main/icon.d.ts +2 -3
- package/dist/main/icon.js +2 -1
- package/dist/main/icon.js.map +1 -1
- package/dist/main/index.d.ts +1 -0
- package/dist/main/index.js +1 -0
- package/dist/main/index.js.map +1 -1
- package/dist/main/offscreen.d.ts +2 -5
- package/dist/main/offscreen.js +5 -2
- package/dist/main/offscreen.js.map +1 -1
- package/dist/main/page.d.ts +2 -4
- package/dist/main/page.js +2 -1
- package/dist/main/page.js.map +1 -1
- package/dist/main/popup.d.ts +2 -5
- package/dist/main/popup.js +3 -3
- package/dist/main/popup.js.map +1 -1
- package/dist/main/relay.d.ts +3 -3
- package/dist/main/relay.js +2 -1
- package/dist/main/relay.js.map +1 -1
- package/dist/main/sandbox.d.ts +1 -4
- package/dist/main/sandbox.js +2 -1
- package/dist/main/sandbox.js.map +1 -1
- package/dist/main/service.d.ts +1 -2
- package/dist/main/service.js.map +1 -1
- package/dist/main/sidebar.d.ts +2 -5
- package/dist/main/sidebar.js +3 -3
- package/dist/main/sidebar.js.map +1 -1
- package/dist/message/index.d.ts +2 -4
- package/dist/message/index.js.map +1 -1
- package/dist/offscreen/index.d.ts +2 -6
- package/dist/offscreen/index.js.map +1 -1
- package/dist/relay/RelayPermission.js +1 -1
- package/dist/relay/index.d.ts +2 -5
- package/dist/relay/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +1 -5
- package/dist/sandbox/index.js.map +1 -1
- package/dist/service/index.d.ts +2 -6
- package/dist/service/index.js.map +1 -1
- package/dist/shared/content/index.d.ts +1 -0
- package/dist/shared/content/index.js +6 -0
- package/dist/shared/content/index.js.map +1 -0
- package/dist/shared/content/isolation.d.ts +4 -0
- package/dist/shared/content/isolation.js +63 -0
- package/dist/shared/content/isolation.js.map +1 -0
- package/dist/shared/locale/index.d.ts +5 -0
- package/dist/shared/locale/index.js +21 -0
- package/dist/shared/locale/index.js.map +1 -0
- package/dist/shared/locale/keys.d.ts +5 -0
- package/dist/shared/locale/keys.js +33 -0
- package/dist/shared/locale/keys.js.map +1 -0
- package/dist/shared/locale/language.d.ts +4 -0
- package/dist/shared/locale/language.js +23 -0
- package/dist/shared/locale/language.js.map +1 -0
- package/dist/shared/locale/messages.d.ts +3 -0
- package/dist/shared/locale/messages.js +9 -0
- package/dist/shared/locale/messages.js.map +1 -0
- package/dist/shared/locale/plural.d.ts +2 -0
- package/dist/shared/locale/plural.js +81 -0
- package/dist/shared/locale/plural.js.map +1 -0
- package/dist/shared/locale/substitutions.d.ts +10 -0
- package/dist/shared/locale/substitutions.js +32 -0
- package/dist/shared/locale/substitutions.js.map +1 -0
- package/dist/types/background.d.ts +1 -1
- package/dist/types/background.js.map +1 -1
- package/dist/types/command.d.ts +1 -1
- package/dist/types/command.js.map +1 -1
- package/dist/types/content/adapters/index.d.ts +2 -0
- package/dist/types/content/adapters/index.js +1 -0
- package/dist/types/content/adapters/index.js.map +1 -0
- package/dist/types/content/adapters/react.d.ts +4 -0
- package/dist/types/content/adapters/react.js +1 -0
- package/dist/types/content/adapters/react.js.map +1 -0
- package/dist/types/content/adapters/vanilla.d.ts +1 -0
- package/dist/types/content/adapters/vanilla.js +1 -0
- package/dist/types/content/adapters/vanilla.js.map +1 -0
- package/dist/types/content/boundary.d.ts +17 -0
- package/dist/types/content/boundary.js +1 -0
- package/dist/types/content/boundary.js.map +1 -0
- package/dist/types/{content.d.ts → content/common.d.ts} +119 -59
- package/dist/types/{content.js → content/common.js} +23 -2
- package/dist/types/content/common.js.map +1 -0
- package/dist/types/content/definition.d.ts +61 -0
- package/dist/types/content/definition.js +1 -0
- package/dist/types/content/definition.js.map +1 -0
- package/dist/types/content/index.d.ts +7 -0
- package/dist/types/content/index.js +2 -0
- package/dist/types/content/index.js.map +1 -0
- package/dist/types/content/prepare.d.ts +9 -0
- package/dist/types/content/prepare.js +1 -0
- package/dist/types/content/prepare.js.map +1 -0
- package/dist/types/content/render.d.ts +6 -0
- package/dist/types/content/render.js +1 -0
- package/dist/types/content/render.js.map +1 -0
- package/dist/types/content/target.d.ts +13 -0
- package/dist/types/content/target.js +1 -0
- package/dist/types/content/target.js.map +1 -0
- package/dist/types/entrypoint.d.ts +20 -0
- package/dist/types/entrypoint.js +4 -0
- package/dist/types/entrypoint.js.map +1 -1
- package/dist/types/icon.d.ts +8 -0
- package/dist/types/icon.js.map +1 -1
- package/dist/types/language.d.ts +57 -0
- package/dist/types/language.js +62 -0
- package/dist/types/language.js.map +1 -0
- package/dist/types/locale.d.ts +34 -63
- package/dist/types/locale.js +62 -119
- package/dist/types/locale.js.map +1 -1
- package/dist/types/manifest.d.ts +11 -8
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/message.d.ts +7 -0
- package/dist/types/message.js.map +1 -1
- package/dist/types/offscreen.d.ts +14 -1
- package/dist/types/offscreen.js.map +1 -1
- package/dist/types/page.d.ts +8 -0
- package/dist/types/popup.d.ts +9 -0
- package/dist/types/relay.d.ts +15 -7
- package/dist/types/relay.js.map +1 -1
- package/dist/types/sandbox.d.ts +12 -0
- package/dist/types/sandbox.js.map +1 -1
- package/dist/types/service.d.ts +10 -1
- package/dist/types/service.js.map +1 -1
- package/dist/types/sidebar.d.ts +9 -0
- package/dist/types/sidebar.js.map +1 -1
- package/dist/types/transport.d.ts +4 -0
- package/dist/virtual/icon.d.ts +2 -0
- package/dist/virtual/icon.js +5 -0
- package/dist/virtual/icon.js.map +1 -0
- package/dist/virtual/locale.d.ts +7 -0
- package/dist/virtual/locale.js +13 -0
- package/dist/virtual/locale.js.map +1 -0
- package/dist/virtual/modules.d.ts +41 -0
- package/dist/virtual/offscreen.d.ts +3 -0
- package/dist/virtual/offscreen.js +5 -0
- package/dist/virtual/offscreen.js.map +1 -0
- package/dist/virtual/page.d.ts +2 -0
- package/dist/virtual/page.js +5 -0
- package/dist/virtual/page.js.map +1 -0
- package/dist/virtual/popup.d.ts +3 -0
- package/dist/virtual/popup.js +5 -0
- package/dist/virtual/popup.js.map +1 -0
- package/dist/virtual/relay.d.ts +3 -0
- package/dist/virtual/relay.js +5 -0
- package/dist/virtual/relay.js.map +1 -0
- package/dist/virtual/runtime.d.ts +8 -0
- package/dist/virtual/runtime.js +9 -0
- package/dist/virtual/runtime.js.map +1 -0
- package/dist/virtual/sandbox.d.ts +3 -0
- package/dist/virtual/sandbox.js +5 -0
- package/dist/virtual/sandbox.js.map +1 -0
- package/dist/virtual/sidebar.d.ts +3 -0
- package/dist/virtual/sidebar.js +5 -0
- package/dist/virtual/sidebar.js.map +1 -0
- package/package.json +53 -23
- package/scripts/clean-dist.js +7 -0
- package/scripts/copy-dts.js +11 -1
- package/scripts/merge-coverage.mjs +12 -0
- package/scripts/pre-commit.mjs +22 -0
- package/scripts/test-inventory.mjs +38 -0
- package/scripts/test-run.mjs +25 -0
- package/types/client.d.ts +15 -0
- package/dist/cli/builders/manifest/utils.d.ts +0 -32
- package/dist/cli/builders/manifest/utils.js +0 -209
- package/dist/cli/builders/manifest/utils.js.map +0 -1
- package/dist/cli/bundler/plugins/EntrypointPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js +0 -40
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ManifestPlugin.d.ts +0 -10
- package/dist/cli/bundler/plugins/ManifestPlugin.js +0 -78
- package/dist/cli/bundler/plugins/ManifestPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ReplacePlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/WatchPlugin.js +0 -21
- package/dist/cli/bundler/plugins/WatchPlugin.js.map +0 -1
- package/dist/cli/bundler/utils/output.d.ts +0 -2
- package/dist/cli/bundler/utils/output.js +0 -15
- package/dist/cli/bundler/utils/output.js.map +0 -1
- package/dist/cli/entrypoint/finder/tests/fixtures/options/discovery/account.options.d.ts +0 -1
- package/dist/cli/entrypoint/finder/tests/fixtures/options/discovery/advanced.options/index.d.ts +0 -1
- package/dist/cli/plugins/output.d.ts +0 -2
- package/dist/cli/plugins/output.js +0 -32
- package/dist/cli/plugins/output.js.map +0 -1
- package/dist/entry/content/adapters/react/resolvers/index.d.ts +0 -1
- package/dist/entry/content/adapters/react/resolvers/index.js +0 -2
- package/dist/entry/content/adapters/react/resolvers/index.js.map +0 -1
- package/dist/entry/content/core/AbstractMarker.js.map +0 -1
- package/dist/entry/content/core/AttributeMarker.js.map +0 -1
- package/dist/entry/content/core/Builder.d.ts +0 -27
- package/dist/entry/content/core/Builder.js +0 -124
- package/dist/entry/content/core/Builder.js.map +0 -1
- package/dist/entry/content/core/Context.js +0 -43
- package/dist/entry/content/core/Context.js.map +0 -1
- package/dist/entry/content/core/EventEmitter.js.map +0 -1
- package/dist/entry/content/core/EventNode.js.map +0 -1
- package/dist/entry/content/core/ManagedContext.d.ts +0 -5
- package/dist/entry/content/core/ManagedContext.js.map +0 -1
- package/dist/entry/content/core/MarkerNode.js.map +0 -1
- package/dist/entry/content/core/MountBuilder.d.ts +0 -10
- package/dist/entry/content/core/MountBuilder.js +0 -40
- package/dist/entry/content/core/MountBuilder.js.map +0 -1
- package/dist/entry/content/core/MountNode.js.map +0 -1
- package/dist/entry/content/core/Node.js.map +0 -1
- package/dist/entry/content/core/WeakMarker.js.map +0 -1
- package/dist/entry/content/core/resolvers/anchor.d.ts +0 -2
- package/dist/entry/content/core/resolvers/anchor.js.map +0 -1
- package/dist/entry/content/core/resolvers/container.d.ts +0 -2
- package/dist/entry/content/core/resolvers/container.js.map +0 -1
- package/dist/entry/content/core/resolvers/definition.d.ts +0 -3
- package/dist/entry/content/core/resolvers/definition.js +0 -12
- package/dist/entry/content/core/resolvers/definition.js.map +0 -1
- package/dist/entry/content/core/resolvers/index.js.map +0 -1
- package/dist/entry/content/core/resolvers/mount.d.ts +0 -2
- package/dist/entry/content/core/resolvers/mount.js.map +0 -1
- package/dist/entry/content/core/resolvers/render.d.ts +0 -3
- package/dist/entry/content/core/resolvers/render.js +0 -18
- package/dist/entry/content/core/resolvers/render.js.map +0 -1
- package/dist/entry/content/core/resolvers/watch.d.ts +0 -4
- package/dist/entry/content/core/resolvers/watch.js.map +0 -1
- package/dist/locale/adapters/react/LocaleProvider.d.ts +0 -7
- package/dist/locale/adapters/react/LocaleProvider.js +0 -58
- package/dist/locale/adapters/react/LocaleProvider.js.map +0 -1
- package/dist/locale/adapters/react/context.d.ts +0 -14
- package/dist/locale/adapters/react/context.js +0 -25
- package/dist/locale/adapters/react/context.js.map +0 -1
- package/dist/locale/utils.d.ts +0 -11
- package/dist/locale/utils.js +0 -67
- package/dist/locale/utils.js.map +0 -1
- package/dist/types/content.js.map +0 -1
- /package/dist/cli/bundler/plugins/{ReplacePlugin.d.ts → replace/ReplacePlugin.d.ts} +0 -0
- /package/dist/cli/bundler/plugins/{ReplacePlugin.js → replace/ReplacePlugin.js} +0 -0
- /package/dist/cli/bundler/plugins/{WatchPlugin.d.ts → watch/WatchPlugin.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/entry/relay/TransportBuilder.ts"],"sourcesContent":["import AbstractBuilder from \"@entry/transport/AbstractBuilder\";\n\nimport {RegisterRelay} from \"@relay/providers\";\n\nimport {RelayOptions, RelayUnresolvedDefinition, RelayMethod} from \"@typing/relay\";\nimport {TransportName, TransportType} from \"@typing/transport\";\n\nexport default class
|
|
1
|
+
{"version":3,"sources":["../../../src/entry/relay/TransportBuilder.ts"],"sourcesContent":["import AbstractBuilder from \"@entry/transport/AbstractBuilder\";\n\nimport {RegisterRelay} from \"@relay/providers\";\n\nimport {RelayOptions, RelayUnresolvedDefinition, RelayMethod} from \"@typing/relay\";\nimport {TransportName, TransportType} from \"@typing/transport\";\nimport type {ContentScriptIsolation} from \"@typing/content\";\n\nexport default class TransportBuilder<\n T extends TransportType = TransportType,\n Data = unknown,\n Isolation extends `${ContentScriptIsolation}` = `${ContentScriptIsolation}`,\n> extends AbstractBuilder<RelayOptions, T> {\n protected readonly method: RelayMethod;\n\n constructor(definition: RelayUnresolvedDefinition<T, Data, Isolation>) {\n const {main, method, prepare, boundary, target, ...options} = definition;\n\n super(options);\n\n this.method = method || RelayMethod.Messaging;\n }\n\n protected transport(): RegisterRelay<TransportName, T, [RelayOptions]> {\n const {name, init} = this.definition;\n\n return new RegisterRelay(name, this.method, init);\n }\n}\n"],"mappings":"AAAA,OAAO,qBAAqB;AAE5B,SAAQ,qBAAoB;AAE5B,SAAiD,mBAAkB;AAInE,MAAO,yBAIG,gBAAiC;AAAA,EACpB;AAAA,EAEnB,YAAY,YAA2D;AACnE,UAAM,EAAC,MAAM,QAAQ,SAAS,UAAU,QAAQ,GAAG,QAAO,IAAI;AAE9D,UAAM,OAAO;AAEb,SAAK,SAAS,UAAU,YAAY;AAAA,EACxC;AAAA,EAEU,YAA6D;AACnE,UAAM,EAAC,MAAM,KAAI,IAAI,KAAK;AAE1B,WAAO,IAAI,cAAc,MAAM,KAAK,QAAQ,IAAI;AAAA,EACpD;AACJ;","names":[]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import Builder from "./Builder.js";
|
|
2
|
+
import type { RelayUnresolvedDefinition } from "../../types/relay.js";
|
|
3
|
+
import type { TransportType } from "../../types/transport.js";
|
|
4
|
+
import type { ContentScriptIsolation } from "../../types/content/index.js";
|
|
2
5
|
export { Builder };
|
|
6
|
+
export { resolveDefinition } from "./resolvers/definition.js";
|
|
3
7
|
export type { RelayUnresolvedDefinition } from "../../types/relay.js";
|
|
4
|
-
|
|
5
|
-
export default _default;
|
|
8
|
+
export default function relay<T extends TransportType, Data = unknown, Isolation extends `${ContentScriptIsolation}` = `${ContentScriptIsolation}`>(definition: RelayUnresolvedDefinition<T, Data, Isolation>, contentBuilder: ConstructorParameters<typeof Builder<T, Data, NoInfer<Isolation>>>[1]): void;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import Builder from "./Builder.js";
|
|
2
|
-
|
|
2
|
+
import { resolveDefinition } from "./resolvers/definition.js";
|
|
3
|
+
function relay(definition, contentBuilder) {
|
|
4
|
+
new Builder(definition, contentBuilder).build().catch((error) => {
|
|
5
|
+
console.error("Failed to build relay: ", error);
|
|
6
|
+
});
|
|
7
|
+
}
|
|
3
8
|
export {
|
|
4
9
|
Builder,
|
|
5
|
-
|
|
10
|
+
relay as default,
|
|
11
|
+
resolveDefinition
|
|
6
12
|
};
|
|
7
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/entry/relay/index.ts"],"sourcesContent":["import Builder from \"./Builder\";\n\nexport {Builder};\nexport type {RelayUnresolvedDefinition} from \"@typing/relay\";\n\nexport default Builder.
|
|
1
|
+
{"version":3,"sources":["../../../src/entry/relay/index.ts"],"sourcesContent":["import Builder from \"./Builder\";\n\nimport type {RelayUnresolvedDefinition} from \"@typing/relay\";\nimport type {TransportType} from \"@typing/transport\";\nimport type {ContentScriptIsolation} from \"@typing/content\";\n\nexport {Builder};\nexport {resolveDefinition} from \"./resolvers/definition\";\nexport type {RelayUnresolvedDefinition} from \"@typing/relay\";\n\nexport default function relay<\n T extends TransportType,\n Data = unknown,\n Isolation extends `${ContentScriptIsolation}` = `${ContentScriptIsolation}`,\n>(\n definition: RelayUnresolvedDefinition<T, Data, Isolation>,\n contentBuilder: ConstructorParameters<typeof Builder<T, Data, NoInfer<Isolation>>>[1]\n): void {\n new Builder(definition, contentBuilder).build().catch(error => {\n console.error(\"Failed to build relay: \", error);\n });\n}\n"],"mappings":"AAAA,OAAO,aAAa;AAOpB,SAAQ,yBAAwB;AAGjB,SAAR,MAKH,YACA,gBACI;AACJ,MAAI,QAAQ,YAAY,cAAc,EAAE,MAAM,EAAE,MAAM,WAAS;AAC3D,YAAQ,MAAM,2BAA2B,KAAK;AAAA,EAClD,CAAC;AACL;","names":[]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RelayUnresolvedDefinition } from "../../../types/relay.js";
|
|
2
|
+
import type { TransportType } from "../../../types/transport.js";
|
|
3
|
+
/** Resolve Relay exports without executing init; the build supplies the authoritative name. */
|
|
4
|
+
export declare const resolveDefinition: <T extends TransportType = TransportType>(module: object, name: string) => RelayUnresolvedDefinition<T>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isValidTransportDefinition, isValidTransportInitFunction } from "./../../../entry/transport/resolvers/definition.js";
|
|
2
|
+
const resolveDefinition = (module, name) => {
|
|
3
|
+
const { default: defaultDefinition, ...otherDefinition } = module;
|
|
4
|
+
let definition = otherDefinition;
|
|
5
|
+
if (isValidTransportDefinition(defaultDefinition)) {
|
|
6
|
+
definition = { ...definition, ...defaultDefinition };
|
|
7
|
+
} else if (isValidTransportInitFunction(defaultDefinition)) {
|
|
8
|
+
definition = { ...definition, init: defaultDefinition };
|
|
9
|
+
}
|
|
10
|
+
const { init, main, name: _name, ...options } = definition;
|
|
11
|
+
return { name, init, main, ...options };
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
resolveDefinition
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/entry/relay/resolvers/definition.ts"],"sourcesContent":["import {isValidTransportDefinition, isValidTransportInitFunction} from \"@entry/transport/resolvers/definition\";\n\nimport type {RelayOptions, RelayUnresolvedDefinition} from \"@typing/relay\";\nimport type {TransportType} from \"@typing/transport\";\n\n/** Resolve Relay exports without executing init; the build supplies the authoritative name. */\nexport const resolveDefinition = <T extends TransportType = TransportType>(\n module: object,\n name: string\n): RelayUnresolvedDefinition<T> => {\n const {default: defaultDefinition, ...otherDefinition} = module as Record<string, unknown>;\n\n let definition = otherDefinition as RelayUnresolvedDefinition<T>;\n\n if (isValidTransportDefinition<RelayOptions, T>(defaultDefinition)) {\n definition = {...definition, ...defaultDefinition};\n } else if (isValidTransportInitFunction<RelayOptions, T>(defaultDefinition)) {\n definition = {...definition, init: defaultDefinition};\n }\n\n const {init, main, name: _name, ...options} = definition;\n\n return {name, init, main, ...options};\n};\n"],"mappings":"AAAA,SAAQ,4BAA4B,oCAAmC;AAMhE,MAAM,oBAAoB,CAC7B,QACA,SAC+B;AAC/B,QAAM,EAAC,SAAS,mBAAmB,GAAG,gBAAe,IAAI;AAEzD,MAAI,aAAa;AAEjB,MAAI,2BAA4C,iBAAiB,GAAG;AAChE,iBAAa,EAAC,GAAG,YAAY,GAAG,kBAAiB;AAAA,EACrD,WAAW,6BAA8C,iBAAiB,GAAG;AACzE,iBAAa,EAAC,GAAG,YAAY,MAAM,kBAAiB;AAAA,EACxD;AAEA,QAAM,EAAC,MAAM,MAAM,MAAM,OAAO,GAAG,QAAO,IAAI;AAE9C,SAAO,EAAC,MAAM,MAAM,MAAM,GAAG,QAAO;AACxC;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { Language, LocaleDir, LocaleNonPluralKeys, LocalePluralKeys, LocaleRegistry, LocaleSubstitutionArgs, LocaleSnapshot } from "../../../types/locale.js";
|
|
3
|
+
import type { LocaleReactContract, LocaleReactSubstitutionArgs } from "./types.js";
|
|
4
|
+
/** Adapts an existing message provider to React without owning storage or language changes. */
|
|
5
|
+
export default class ReactLocale<S extends object = LocaleRegistry> implements LocaleReactContract<S> {
|
|
6
|
+
private readonly locale;
|
|
7
|
+
readonly lang: Language;
|
|
8
|
+
readonly langs: ReadonlySet<Language>;
|
|
9
|
+
readonly langNames: ReadonlyMap<Language, string>;
|
|
10
|
+
readonly dir: LocaleDir;
|
|
11
|
+
readonly isRtl: boolean;
|
|
12
|
+
constructor(locale: LocaleSnapshot<S>);
|
|
13
|
+
t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string;
|
|
14
|
+
t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;
|
|
15
|
+
choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string;
|
|
16
|
+
choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;
|
|
17
|
+
private render;
|
|
18
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
import { selectPluralForm, applySubstitutions, getLocaleDir, isLocaleRtl } from "./../../../shared/locale/index.js";
|
|
3
|
+
class ReactLocale {
|
|
4
|
+
constructor(locale) {
|
|
5
|
+
this.locale = locale;
|
|
6
|
+
this.lang = locale.lang();
|
|
7
|
+
this.langs = locale.langs();
|
|
8
|
+
this.langNames = locale.langNames();
|
|
9
|
+
this.dir = getLocaleDir(this.lang);
|
|
10
|
+
this.isRtl = isLocaleRtl(this.lang);
|
|
11
|
+
this.t = this.t.bind(this);
|
|
12
|
+
this.choice = this.choice.bind(this);
|
|
13
|
+
}
|
|
14
|
+
locale;
|
|
15
|
+
lang;
|
|
16
|
+
langs;
|
|
17
|
+
langNames;
|
|
18
|
+
dir;
|
|
19
|
+
isRtl;
|
|
20
|
+
t(key, substitutions) {
|
|
21
|
+
return this.render(key, substitutions);
|
|
22
|
+
}
|
|
23
|
+
choice(key, count, substitutions) {
|
|
24
|
+
return this.render(key, substitutions, count);
|
|
25
|
+
}
|
|
26
|
+
render(key, substitutions, count) {
|
|
27
|
+
const message = this.locale.get(key);
|
|
28
|
+
const template = count === void 0 ? message : selectPluralForm(message, this.lang, count);
|
|
29
|
+
const parts = applySubstitutions(template, substitutions, (name) => {
|
|
30
|
+
console.warn(`Locale substitution "${name}" not found for key "${key}" in "${this.lang}" language.`);
|
|
31
|
+
});
|
|
32
|
+
if (parts.every((part) => typeof part === "string" || typeof part === "number")) {
|
|
33
|
+
return parts.join("");
|
|
34
|
+
}
|
|
35
|
+
return parts.map((part, index) => createElement(Fragment, { key: index }, part));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
ReactLocale as default
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=ReactLocale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/locale/adapters/react/ReactLocale.ts"],"sourcesContent":["import {createElement, Fragment, type ReactNode} from \"react\";\n\nimport {selectPluralForm, applySubstitutions, getLocaleDir, isLocaleRtl} from \"@shared/locale\";\n\nimport type {\n Language,\n LocaleDir,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleRegistry,\n LocaleSubstitutionArgs,\n LocaleSnapshot,\n} from \"@typing/locale\";\n\nimport type {LocaleReactContract, LocaleReactSubstitutionArgs} from \"./types\";\n\n/** Adapts an existing message provider to React without owning storage or language changes. */\nexport default class ReactLocale<S extends object = LocaleRegistry> implements LocaleReactContract<S> {\n public readonly lang: Language;\n public readonly langs: ReadonlySet<Language>;\n public readonly langNames: ReadonlyMap<Language, string>;\n public readonly dir: LocaleDir;\n public readonly isRtl: boolean;\n\n constructor(private readonly locale: LocaleSnapshot<S>) {\n this.lang = locale.lang();\n this.langs = locale.langs();\n this.langNames = locale.langNames();\n this.dir = getLocaleDir(this.lang);\n this.isRtl = isLocaleRtl(this.lang);\n\n this.t = this.t.bind(this);\n this.choice = this.choice.bind(this);\n }\n\n public t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string;\n public t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;\n public t(key: LocaleNonPluralKeys<S>, substitutions?: Record<string, ReactNode>): ReactNode {\n return this.render(key, substitutions);\n }\n\n public choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string;\n public choice<K extends LocalePluralKeys<S>>(\n key: K,\n count: number,\n ...args: LocaleReactSubstitutionArgs<S, K>\n ): ReactNode;\n public choice(key: LocalePluralKeys<S>, count: number, substitutions?: Record<string, ReactNode>): ReactNode {\n return this.render(key, substitutions, count);\n }\n\n private render(key: keyof S & string, substitutions?: Record<string, ReactNode>, count?: number): ReactNode {\n const message = this.locale.get(key);\n\n const template = count === undefined ? message : selectPluralForm(message, this.lang, count);\n\n const parts = applySubstitutions(template, substitutions, name => {\n console.warn(`Locale substitution \"${name}\" not found for key \"${key}\" in \"${this.lang}\" language.`);\n });\n\n if (parts.every(part => typeof part === \"string\" || typeof part === \"number\")) {\n return parts.join(\"\");\n }\n\n return parts.map((part, index) => createElement(Fragment, {key: index}, part));\n }\n}\n"],"mappings":"AAAA,SAAQ,eAAe,gBAA+B;AAEtD,SAAQ,kBAAkB,oBAAoB,cAAc,mBAAkB;AAe9E,MAAO,YAA+F;AAAA,EAOlG,YAA6B,QAA2B;AAA3B;AACzB,SAAK,OAAO,OAAO,KAAK;AACxB,SAAK,QAAQ,OAAO,MAAM;AAC1B,SAAK,YAAY,OAAO,UAAU;AAClC,SAAK,MAAM,aAAa,KAAK,IAAI;AACjC,SAAK,QAAQ,YAAY,KAAK,IAAI;AAElC,SAAK,IAAI,KAAK,EAAE,KAAK,IAAI;AACzB,SAAK,SAAS,KAAK,OAAO,KAAK,IAAI;AAAA,EACvC;AAAA,EAT6B;AAAA,EANb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAeT,EAAE,KAA6B,eAAsD;AACxF,WAAO,KAAK,OAAO,KAAK,aAAa;AAAA,EACzC;AAAA,EAQO,OAAO,KAA0B,OAAe,eAAsD;AACzG,WAAO,KAAK,OAAO,KAAK,eAAe,KAAK;AAAA,EAChD;AAAA,EAEQ,OAAO,KAAuB,eAA2C,OAA2B;AACxG,UAAM,UAAU,KAAK,OAAO,IAAI,GAAG;AAEnC,UAAM,WAAW,UAAU,SAAY,UAAU,iBAAiB,SAAS,KAAK,MAAM,KAAK;AAE3F,UAAM,QAAQ,mBAAmB,UAAU,eAAe,UAAQ;AAC9D,cAAQ,KAAK,wBAAwB,IAAI,wBAAwB,GAAG,SAAS,KAAK,IAAI,aAAa;AAAA,IACvG,CAAC;AAED,QAAI,MAAM,MAAM,UAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,QAAQ,GAAG;AAC3E,aAAO,MAAM,KAAK,EAAE;AAAA,IACxB;AAEA,WAAO,MAAM,IAAI,CAAC,MAAM,UAAU,cAAc,UAAU,EAAC,KAAK,MAAK,GAAG,IAAI,CAAC;AAAA,EACjF;AACJ;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LocaleReactContract } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Applies language attributes from either locale hook to an element after render.
|
|
4
|
+
* An omitted target or undefined selects html; null disables application.
|
|
5
|
+
* Cleanup restores each previous attribute only while its applied value is unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useLocaleAttributes: (locale: Pick<LocaleReactContract, "lang" | "dir">, target?: string | Element | null) => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
const useLocaleAttributes = (locale, target = "html") => {
|
|
3
|
+
const { lang, dir } = locale;
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
6
|
+
if (!element) return;
|
|
7
|
+
const attributes = Object.entries({ lang, dir }).map(([name, value]) => ({
|
|
8
|
+
name,
|
|
9
|
+
value,
|
|
10
|
+
previous: element.getAttribute(name)
|
|
11
|
+
}));
|
|
12
|
+
for (const { name, value } of attributes) {
|
|
13
|
+
element.setAttribute(name, value);
|
|
14
|
+
}
|
|
15
|
+
return () => {
|
|
16
|
+
for (const { name, value, previous } of attributes) {
|
|
17
|
+
if (element.getAttribute(name) !== value) continue;
|
|
18
|
+
if (previous === null) {
|
|
19
|
+
element.removeAttribute(name);
|
|
20
|
+
} else {
|
|
21
|
+
element.setAttribute(name, previous);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}, [target, lang, dir]);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
useLocaleAttributes
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=use-locale-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/locale/adapters/react/hooks/use-locale-attributes.ts"],"sourcesContent":["import {useEffect} from \"react\";\nimport type {LocaleReactContract} from \"../types\";\n\n/**\n * Applies language attributes from either locale hook to an element after render.\n * An omitted target or undefined selects html; null disables application.\n * Cleanup restores each previous attribute only while its applied value is unchanged.\n */\nexport const useLocaleAttributes = (\n locale: Pick<LocaleReactContract, \"lang\" | \"dir\">,\n target: string | Element | null = \"html\"\n): void => {\n const {lang, dir} = locale;\n\n useEffect(() => {\n const element = typeof target === \"string\" ? document.querySelector(target) : target;\n\n if (!element) return;\n\n const attributes = Object.entries({lang, dir}).map(([name, value]) => ({\n name,\n value,\n previous: element.getAttribute(name),\n }));\n\n for (const {name, value} of attributes) {\n element.setAttribute(name, value);\n }\n\n return () => {\n for (const {name, value, previous} of attributes) {\n if (element.getAttribute(name) !== value) continue;\n\n if (previous === null) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, previous);\n }\n }\n };\n }, [target, lang, dir]);\n};\n"],"mappings":"AAAA,SAAQ,iBAAgB;AAQjB,MAAM,sBAAsB,CAC/B,QACA,SAAkC,WAC3B;AACP,QAAM,EAAC,MAAM,IAAG,IAAI;AAEpB,YAAU,MAAM;AACZ,UAAM,UAAU,OAAO,WAAW,WAAW,SAAS,cAAc,MAAM,IAAI;AAE9E,QAAI,CAAC,QAAS;AAEd,UAAM,aAAa,OAAO,QAAQ,EAAC,MAAM,IAAG,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,KAAK,OAAO;AAAA,MACnE;AAAA,MACA;AAAA,MACA,UAAU,QAAQ,aAAa,IAAI;AAAA,IACvC,EAAE;AAEF,eAAW,EAAC,MAAM,MAAK,KAAK,YAAY;AACpC,cAAQ,aAAa,MAAM,KAAK;AAAA,IACpC;AAEA,WAAO,MAAM;AACT,iBAAW,EAAC,MAAM,OAAO,SAAQ,KAAK,YAAY;AAC9C,YAAI,QAAQ,aAAa,IAAI,MAAM,MAAO;AAE1C,YAAI,aAAa,MAAM;AACnB,kBAAQ,gBAAgB,IAAI;AAAA,QAChC,OAAO;AACH,kBAAQ,aAAa,MAAM,QAAQ;AAAA,QACvC;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,GAAG,CAAC,QAAQ,MAAM,GAAG,CAAC;AAC1B;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useMemo, useSyncExternalStore } from "react";
|
|
2
|
+
import ReactLocale from "../ReactLocale.js";
|
|
3
|
+
import { ObservableLocale } from "./../../../../locale/providers/index.js";
|
|
4
|
+
const useLocale = (storage) => {
|
|
5
|
+
const locale = useMemo(() => ObservableLocale.getInstance(storage), [storage]);
|
|
6
|
+
const snapshot = useSyncExternalStore(locale.subscribe, locale.snapshot);
|
|
7
|
+
return useMemo(
|
|
8
|
+
() => Object.assign(new ReactLocale(snapshot), {
|
|
9
|
+
change: locale.change
|
|
10
|
+
}),
|
|
11
|
+
[locale, snapshot]
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
useLocale
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=use-locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/locale/adapters/react/hooks/use-locale.ts"],"sourcesContent":["import {useMemo, useSyncExternalStore} from \"react\";\n\nimport ReactLocale from \"../ReactLocale\";\n\nimport {ObservableLocale} from \"@locale/providers\";\n\nimport type {LocaleReactDynamicContract} from \"../types\";\nimport type {LocaleRegistry, LocaleStorageDriver} from \"@typing/locale\";\n\nexport const useLocale = (storage?: LocaleStorageDriver | false): LocaleReactDynamicContract => {\n const locale = useMemo(() => ObservableLocale.getInstance(storage), [storage]);\n const snapshot = useSyncExternalStore(locale.subscribe, locale.snapshot);\n\n return useMemo(\n () =>\n Object.assign(new ReactLocale<LocaleRegistry>(snapshot), {\n change: locale.change,\n }),\n [locale, snapshot]\n );\n};\n"],"mappings":"AAAA,SAAQ,SAAS,4BAA2B;AAE5C,OAAO,iBAAiB;AAExB,SAAQ,wBAAuB;AAKxB,MAAM,YAAY,CAAC,YAAsE;AAC5F,QAAM,SAAS,QAAQ,MAAM,iBAAiB,YAAY,OAAO,GAAG,CAAC,OAAO,CAAC;AAC7E,QAAM,WAAW,qBAAqB,OAAO,WAAW,OAAO,QAAQ;AAEvE,SAAO;AAAA,IACH,MACI,OAAO,OAAO,IAAI,YAA4B,QAAQ,GAAG;AAAA,MACrD,QAAQ,OAAO;AAAA,IACnB,CAAC;AAAA,IACL,CAAC,QAAQ,QAAQ;AAAA,EACrB;AACJ;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import NativeLocale from "./../../../../locale/providers/NativeLocale.js";
|
|
3
|
+
import ReactLocale from "../ReactLocale.js";
|
|
4
|
+
const useNativeLocale = () => {
|
|
5
|
+
return useMemo(() => new ReactLocale(NativeLocale.getInstance()), []);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
useNativeLocale
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=use-native-locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/locale/adapters/react/hooks/use-native-locale.ts"],"sourcesContent":["import {useMemo} from \"react\";\nimport NativeLocale from \"@locale/providers/NativeLocale\";\nimport ReactLocale from \"../ReactLocale\";\nimport type {LocaleRegistry} from \"@typing/locale\";\nimport type {LocaleReactContract} from \"../types\";\n\n/** Uses browser-selected translations with React substitutions. */\nexport const useNativeLocale = (): LocaleReactContract => {\n return useMemo(() => new ReactLocale<LocaleRegistry>(NativeLocale.getInstance()), []);\n};\n"],"mappings":"AAAA,SAAQ,eAAc;AACtB,OAAO,kBAAkB;AACzB,OAAO,iBAAiB;AAKjB,MAAM,kBAAkB,MAA2B;AACtD,SAAO,QAAQ,MAAM,IAAI,YAA4B,aAAa,YAAY,CAAC,GAAG,CAAC,CAAC;AACxF;","names":[]}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { useLocale
|
|
1
|
+
export { useNativeLocale } from "./hooks/use-native-locale.js";
|
|
2
|
+
export { useLocale } from "./hooks/use-locale.js";
|
|
3
|
+
export { useLocaleAttributes } from "./hooks/use-locale-attributes.js";
|
|
4
|
+
export type { LocaleReactContract, LocaleReactDynamicContract } from "./types.js";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useLocale } from "./
|
|
1
|
+
import { useNativeLocale } from "./hooks/use-native-locale.js";
|
|
2
|
+
import { useLocale } from "./hooks/use-locale.js";
|
|
3
|
+
import { useLocaleAttributes } from "./hooks/use-locale-attributes.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
useLocale,
|
|
6
|
+
useLocaleAttributes,
|
|
7
|
+
useNativeLocale
|
|
6
8
|
};
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/locale/adapters/react/index.ts"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"sources":["../../../../src/locale/adapters/react/index.ts"],"sourcesContent":["export {useNativeLocale} from \"./hooks/use-native-locale\";\nexport {useLocale} from \"./hooks/use-locale\";\nexport {useLocaleAttributes} from \"./hooks/use-locale-attributes\";\nexport type {LocaleReactContract, LocaleReactDynamicContract} from \"./types\";\n"],"mappings":"AAAA,SAAQ,uBAAsB;AAC9B,SAAQ,iBAAgB;AACxB,SAAQ,2BAA0B;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { Language, LocaleDir, LocaleNonPluralKeys, LocalePluralKeys, LocaleRegistry, LocaleSubstitutionArgs, LocaleSubstitutionKeys } from "../../../types/locale.js";
|
|
3
|
+
export type LocaleReactSubstitutionArgs<S, K extends keyof S> = string extends keyof S ? [substitutions?: Record<string, ReactNode>] : [LocaleSubstitutionKeys<S, K>] extends [never] ? [] : [substitutions: Record<LocaleSubstitutionKeys<S, K>, ReactNode>];
|
|
4
|
+
/** Translation capabilities shared by React adapters, without language mutation or storage. */
|
|
5
|
+
export interface LocaleReactContract<S extends object = LocaleRegistry> {
|
|
6
|
+
/** Currently selected language code. */
|
|
7
|
+
readonly lang: Language;
|
|
8
|
+
/** Available language codes. */
|
|
9
|
+
readonly langs: ReadonlySet<Language>;
|
|
10
|
+
/** Native names keyed by the available language codes. */
|
|
11
|
+
readonly langNames: ReadonlyMap<Language, string>;
|
|
12
|
+
readonly dir: LocaleDir;
|
|
13
|
+
readonly isRtl: boolean;
|
|
14
|
+
t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string;
|
|
15
|
+
t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;
|
|
16
|
+
choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string;
|
|
17
|
+
choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/** React translations with an observable language selection. */
|
|
20
|
+
export interface LocaleReactDynamicContract<S extends object = LocaleRegistry> extends LocaleReactContract<S> {
|
|
21
|
+
change(lang: Language): Promise<Language>;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/locale/helpers.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LocaleNonPluralKeys, LocalePluralKeys, LocaleSubstitutionArgs } from "../types/locale.js";
|
|
1
|
+
import type { LocaleNonPluralKeys, LocalePluralKeys, LocaleRegistry, LocaleSubstitutionArgs } from "../types/locale.js";
|
|
3
2
|
/**
|
|
4
3
|
* Translates a non-plural locale key.
|
|
5
4
|
*
|
|
@@ -17,7 +16,7 @@ import { LocaleNonPluralKeys, LocalePluralKeys, LocaleSubstitutionArgs } from ".
|
|
|
17
16
|
* @param args
|
|
18
17
|
* @returns The translated string.
|
|
19
18
|
*/
|
|
20
|
-
export declare const t: <K extends LocaleNonPluralKeys<
|
|
19
|
+
export declare const t: <K extends LocaleNonPluralKeys<LocaleRegistry>>(key: K, ...args: LocaleSubstitutionArgs<LocaleRegistry, K>) => string;
|
|
21
20
|
/**
|
|
22
21
|
* Translates a plural locale key using the provided count.
|
|
23
22
|
*
|
|
@@ -35,7 +34,7 @@ export declare const t: <K extends LocaleNonPluralKeys<LocaleNativeStructure>>(k
|
|
|
35
34
|
* @param args
|
|
36
35
|
* @returns The translated string.
|
|
37
36
|
*/
|
|
38
|
-
export declare const choice: <K extends LocalePluralKeys<
|
|
37
|
+
export declare const choice: <K extends LocalePluralKeys<LocaleRegistry>>(key: K, count: number, ...args: LocaleSubstitutionArgs<LocaleRegistry, K>) => string;
|
|
39
38
|
/**
|
|
40
39
|
* Converts a locale key to a browser message reference.
|
|
41
40
|
*
|
|
@@ -52,7 +51,7 @@ export declare const choice: <K extends LocalePluralKeys<LocaleNativeStructure>>
|
|
|
52
51
|
* @param value - The locale key to convert.
|
|
53
52
|
* @returns The browser message reference.
|
|
54
53
|
*/
|
|
55
|
-
export declare const key: (value: keyof
|
|
54
|
+
export declare const key: (value: keyof LocaleRegistry & string) => string;
|
|
56
55
|
/**
|
|
57
56
|
* Resolves a string that may contain a locale marker.
|
|
58
57
|
*
|
package/dist/locale/helpers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NativeLocale } from "./../locale/providers/index.js";
|
|
2
|
-
import { convertLocaleMessageKey, extractLocaleKey } from "./../locale/
|
|
2
|
+
import { convertLocaleMessageKey, extractLocaleKey } from "./../shared/locale/index.js";
|
|
3
3
|
const t = (key2, ...args) => {
|
|
4
4
|
return NativeLocale.getInstance().trans(key2, ...args);
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/locale/helpers.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/locale/helpers.ts"],"sourcesContent":["import {NativeLocale} from \"@locale/providers\";\nimport {convertLocaleMessageKey, extractLocaleKey} from \"@shared/locale\";\nimport type {LocaleNonPluralKeys, LocalePluralKeys, LocaleRegistry, LocaleSubstitutionArgs} from \"@typing/locale\";\n\n/**\n * Translates a non-plural locale key.\n *\n * Substitutions are type-checked from the generated locale structure:\n * keys without placeholders do not accept substitutions, while keys with\n * placeholders require all declared substitution values.\n *\n * @example\n * ```ts\n * t(\"app.name\");\n * t(\"app.greeting\", {name: \"Alice\"});\n * ```\n *\n * @param key - The locale key to translate.\n * @param args\n * @returns The translated string.\n */\nexport const t = <K extends LocaleNonPluralKeys<LocaleRegistry>>(\n key: K,\n ...args: LocaleSubstitutionArgs<LocaleRegistry, K>\n): string => {\n return NativeLocale.getInstance().trans(key, ...args);\n};\n\n/**\n * Translates a plural locale key using the provided count.\n *\n * Substitutions are type-checked from the generated locale structure:\n * keys without placeholders do not accept substitutions, while keys with\n * placeholders require all declared substitution values.\n *\n * @example\n * ```ts\n * choice(\"cart.items\", count, {count});\n * ```\n *\n * @param key - The locale key to translate.\n * @param count - The count used to select the plural form.\n * @param args\n * @returns The translated string.\n */\nexport const choice = <K extends LocalePluralKeys<LocaleRegistry>>(\n key: K,\n count: number,\n ...args: LocaleSubstitutionArgs<LocaleRegistry, K>\n): string => {\n return NativeLocale.getInstance().choice(key, count, ...args);\n};\n\n/**\n * Converts a locale key to a browser message reference.\n *\n * This is useful for browser-managed extension fields that expect\n * `__MSG_name__` references instead of already translated text.\n *\n * A warning is logged when the key does not exist in the generated locale keys.\n *\n * @example\n * ```ts\n * key(\"app.name\"); // \"__MSG_app_name__\"\n * ```\n *\n * @param value - The locale key to convert.\n * @returns The browser message reference.\n */\nexport const key = (value: keyof LocaleRegistry & string): string => {\n const locale = NativeLocale.getInstance();\n\n if (!locale.keys().has(value)) {\n console.warn(`Locale key \"${value}\" not found in \"${locale.lang()}\" language.`);\n }\n\n return convertLocaleMessageKey(value);\n};\n\n/**\n * Resolves a string that may contain a locale marker.\n *\n * When the input contains a locale marker, the marker is extracted and translated.\n * Plain strings are returned unchanged.\n *\n * @example\n * ```ts\n * resolve(\"@app.name\");\n * resolve(\"Plain title\");\n * ```\n *\n * @param input - A plain string or a marked locale key string.\n * @returns The translated text when a marker is found, otherwise the original input.\n */\nexport const resolve = (input: string): string => {\n const localeKey = extractLocaleKey(input);\n\n if (localeKey) {\n // Markers are runtime strings without substitutions; keep t() strict for typed callers.\n return (t as (key: string) => string)(localeKey);\n }\n\n return input;\n};\n"],"mappings":"AAAA,SAAQ,oBAAmB;AAC3B,SAAQ,yBAAyB,wBAAuB;AAoBjD,MAAM,IAAI,CACbA,SACG,SACM;AACT,SAAO,aAAa,YAAY,EAAE,MAAMA,MAAK,GAAG,IAAI;AACxD;AAmBO,MAAM,SAAS,CAClBA,MACA,UACG,SACM;AACT,SAAO,aAAa,YAAY,EAAE,OAAOA,MAAK,OAAO,GAAG,IAAI;AAChE;AAkBO,MAAM,MAAM,CAAC,UAAiD;AACjE,QAAM,SAAS,aAAa,YAAY;AAExC,MAAI,CAAC,OAAO,KAAK,EAAE,IAAI,KAAK,GAAG;AAC3B,YAAQ,KAAK,eAAe,KAAK,mBAAmB,OAAO,KAAK,CAAC,aAAa;AAAA,EAClF;AAEA,SAAO,wBAAwB,KAAK;AACxC;AAiBO,MAAM,UAAU,CAAC,UAA0B;AAC9C,QAAM,YAAY,iBAAiB,KAAK;AAExC,MAAI,WAAW;AAEX,WAAQ,EAA8B,SAAS;AAAA,EACnD;AAEA,SAAO;AACX;","names":["key"]}
|
package/dist/locale/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * from "./providers/index.js";
|
|
2
2
|
export * from "./helpers.js";
|
|
3
|
-
export
|
|
3
|
+
export * from "./storage/index.js";
|
|
4
|
+
export { Language, LanguageCodes, LocaleDir, type LocaleStructure, type LocaleRegistry, type LocaleProvider, type LocaleDynamicProvider, type LocaleSnapshot, type LocaleStorageDriver, type LocaleKeys, type LocaleSubstitutionArgs, type LocaleSubstitutionKeys, type LocaleSubstitutionValue, type LocaleNonPluralKeys, type LocalePluralKeys, } from "../types/locale.js";
|
package/dist/locale/index.js
CHANGED
package/dist/locale/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/locale/index.ts"],"sourcesContent":["export * from \"./providers\";\nexport * from \"./helpers\";\n\nexport {\n Language,\n LanguageCodes,\n LocaleDir,\n type LocaleStructure,\n type LocaleProvider,\n type LocaleDynamicProvider,\n type LocaleKeys,\n type LocaleSubstitutionArgs,\n type LocaleSubstitutionKeys,\n type LocaleSubstitutionValue,\n type LocaleNonPluralKeys,\n type LocalePluralKeys,\n} from \"@typing/locale\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AAEd;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/locale/index.ts"],"sourcesContent":["export * from \"./providers\";\nexport * from \"./helpers\";\nexport * from \"./storage\";\n\nexport {\n Language,\n LanguageCodes,\n LocaleDir,\n type LocaleStructure,\n type LocaleRegistry,\n type LocaleProvider,\n type LocaleDynamicProvider,\n type LocaleSnapshot,\n type LocaleStorageDriver,\n type LocaleKeys,\n type LocaleSubstitutionArgs,\n type LocaleSubstitutionKeys,\n type LocaleSubstitutionValue,\n type LocaleNonPluralKeys,\n type LocalePluralKeys,\n} from \"@typing/locale\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AAEd;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OAaG;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Language, LocaleNonPluralKeys, LocalePluralKeys, LocaleProvider, LocaleStructure, LocaleSubstitutionArgs, LocaleSubstitutionValue } from "../../types/locale.js";
|
|
2
|
-
export default abstract class<S extends object = LocaleStructure> implements LocaleProvider<S> {
|
|
2
|
+
export default abstract class AbstractLocale<S extends object = LocaleStructure> implements LocaleProvider<S> {
|
|
3
3
|
abstract lang(): Language;
|
|
4
4
|
abstract keys(): Set<keyof S>;
|
|
5
|
-
abstract
|
|
5
|
+
abstract langs(): ReadonlySet<Language>;
|
|
6
6
|
/** Returns native names for this provider's languages, preserving their order. */
|
|
7
|
-
|
|
7
|
+
langNames(): ReadonlyMap<Language, string>;
|
|
8
8
|
protected abstract value(key: keyof S & string): string | undefined;
|
|
9
9
|
trans<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string;
|
|
10
10
|
choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string;
|
|
11
11
|
get<K extends keyof S & string>(key: K, substitutions?: Record<string, LocaleSubstitutionValue>): string;
|
|
12
|
-
private
|
|
12
|
+
private substitute;
|
|
13
13
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import { selectPluralForm, applySubstitutions } from "./../../shared/locale/index.js";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
LanguageNames,
|
|
4
|
-
LocaleValuesSeparator
|
|
3
|
+
LanguageNames
|
|
5
4
|
} from "./../../types/locale.js";
|
|
6
|
-
class
|
|
5
|
+
class AbstractLocale {
|
|
7
6
|
/** Returns native names for this provider's languages, preserving their order. */
|
|
8
|
-
|
|
9
|
-
return new Map([...this.
|
|
7
|
+
langNames() {
|
|
8
|
+
return new Map([...this.langs()].map((language) => [language, LanguageNames[language]]));
|
|
10
9
|
}
|
|
11
10
|
trans(key, ...args) {
|
|
12
11
|
const [substitutions] = args;
|
|
@@ -14,9 +13,8 @@ class AbstractLocale_default {
|
|
|
14
13
|
}
|
|
15
14
|
choice(key, count, ...args) {
|
|
16
15
|
const [substitutions] = args;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
return parts[idx] ?? parts[0] ?? key;
|
|
16
|
+
const message = selectPluralForm(this.get(key), this.lang(), count);
|
|
17
|
+
return this.substitute(message, key, substitutions);
|
|
20
18
|
}
|
|
21
19
|
get(key, substitutions) {
|
|
22
20
|
const template = this.value(key);
|
|
@@ -24,94 +22,15 @@ class AbstractLocale_default {
|
|
|
24
22
|
console.warn(`Locale key "${key}" not found in "${this.lang()}" language.`);
|
|
25
23
|
return key;
|
|
26
24
|
}
|
|
27
|
-
|
|
28
|
-
return template.replace(/{{(.*?)}}/g, (_, placeholder) => {
|
|
29
|
-
const substitution = placeholder.trim();
|
|
30
|
-
if (substitution in substitutions) {
|
|
31
|
-
return substitutions[substitution].toString();
|
|
32
|
-
}
|
|
33
|
-
console.warn(
|
|
34
|
-
`Locale substitution "${substitution}" not found for key "${key}" in "${this.lang()}" language.`
|
|
35
|
-
);
|
|
36
|
-
return substitution;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return template;
|
|
25
|
+
return this.substitute(template, key, substitutions);
|
|
40
26
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
case Language.Kannada:
|
|
46
|
-
case Language.Korean:
|
|
47
|
-
case Language.Malay:
|
|
48
|
-
case Language.Thai:
|
|
49
|
-
case Language.Turkish:
|
|
50
|
-
case Language.Vietnamese:
|
|
51
|
-
return 0;
|
|
52
|
-
case Language.Bengali:
|
|
53
|
-
case Language.Bulgarian:
|
|
54
|
-
case Language.Catalan:
|
|
55
|
-
case Language.Danish:
|
|
56
|
-
case Language.German:
|
|
57
|
-
case Language.Greek:
|
|
58
|
-
case Language.English:
|
|
59
|
-
case Language.EnglishAustralia:
|
|
60
|
-
case Language.EnglishGreatBritain:
|
|
61
|
-
case Language.EnglishUSA:
|
|
62
|
-
case Language.Spanish:
|
|
63
|
-
case Language.SpanishLatinAmericaAndCaribbean:
|
|
64
|
-
case Language.Estonian:
|
|
65
|
-
case Language.Persian:
|
|
66
|
-
case Language.Finnish:
|
|
67
|
-
case Language.Gujarati:
|
|
68
|
-
case Language.Hebrew:
|
|
69
|
-
case Language.Hungarian:
|
|
70
|
-
case Language.Italian:
|
|
71
|
-
case Language.Malayalam:
|
|
72
|
-
case Language.Marathi:
|
|
73
|
-
case Language.Dutch:
|
|
74
|
-
case Language.Norwegian:
|
|
75
|
-
case Language.Swedish:
|
|
76
|
-
case Language.Swahili:
|
|
77
|
-
case Language.Tamil:
|
|
78
|
-
case Language.Telugu:
|
|
79
|
-
case Language.ChineseChina:
|
|
80
|
-
case Language.ChineseTaiwan:
|
|
81
|
-
case Language.PortugueseBrazil:
|
|
82
|
-
case Language.PortuguesePortugal:
|
|
83
|
-
return count == 1 ? 0 : 1;
|
|
84
|
-
case Language.Amharic:
|
|
85
|
-
case Language.Filipino:
|
|
86
|
-
case Language.French:
|
|
87
|
-
case Language.Hindi:
|
|
88
|
-
return count == 0 || count == 1 ? 0 : 1;
|
|
89
|
-
case Language.Croatian:
|
|
90
|
-
case Language.Russian:
|
|
91
|
-
case Language.Serbian:
|
|
92
|
-
case Language.Ukrainian:
|
|
93
|
-
return count % 10 == 1 && count % 100 != 11 ? 0 : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 10 || count % 100 >= 20) ? 1 : 2;
|
|
94
|
-
case Language.Czech:
|
|
95
|
-
case Language.Slovak:
|
|
96
|
-
return count == 1 ? 0 : count >= 2 && count <= 4 ? 1 : 2;
|
|
97
|
-
case Language.Lithuanian:
|
|
98
|
-
return count % 10 == 1 && count % 100 != 11 ? 0 : count % 10 >= 2 && (count % 100 < 10 || count % 100 >= 20) ? 1 : 2;
|
|
99
|
-
case Language.Slovenian:
|
|
100
|
-
return count % 100 == 1 ? 0 : count % 100 == 2 ? 1 : count % 100 == 3 || count % 100 == 4 ? 2 : 3;
|
|
101
|
-
case Language.Latvian:
|
|
102
|
-
return count == 0 ? 0 : count % 10 == 1 && count % 100 != 11 ? 1 : 2;
|
|
103
|
-
case Language.Polish:
|
|
104
|
-
return count == 1 ? 0 : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 12 || count % 100 > 14) ? 1 : 2;
|
|
105
|
-
case Language.Romanian:
|
|
106
|
-
return count == 1 ? 0 : count == 0 || count % 100 > 0 && count % 100 < 20 ? 1 : 2;
|
|
107
|
-
case Language.Arabic:
|
|
108
|
-
return count == 0 ? 0 : count == 1 ? 1 : count == 2 ? 2 : count % 100 >= 3 && count % 100 <= 10 ? 3 : count % 100 >= 11 && count % 100 <= 99 ? 4 : 5;
|
|
109
|
-
default:
|
|
110
|
-
return 0;
|
|
111
|
-
}
|
|
27
|
+
substitute(message, key, substitutions) {
|
|
28
|
+
return applySubstitutions(message, substitutions, (name) => {
|
|
29
|
+
console.warn(`Locale substitution "${name}" not found for key "${key}" in "${this.lang()}" language.`);
|
|
30
|
+
}).join("");
|
|
112
31
|
}
|
|
113
32
|
}
|
|
114
33
|
export {
|
|
115
|
-
|
|
34
|
+
AbstractLocale as default
|
|
116
35
|
};
|
|
117
36
|
//# sourceMappingURL=AbstractLocale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/locale/providers/AbstractLocale.ts"],"sourcesContent":["import {\n Language,\n LanguageNames,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleProvider,\n LocaleStructure,\n LocaleSubstitutionArgs,\n LocaleSubstitutionValue,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/locale/providers/AbstractLocale.ts"],"sourcesContent":["import {selectPluralForm, applySubstitutions} from \"@shared/locale\";\n\nimport {\n Language,\n LanguageNames,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleProvider,\n LocaleStructure,\n LocaleSubstitutionArgs,\n LocaleSubstitutionValue,\n} from \"@typing/locale\";\n\nexport default abstract class AbstractLocale<S extends object = LocaleStructure> implements LocaleProvider<S> {\n public abstract lang(): Language;\n\n public abstract keys(): Set<keyof S>;\n\n public abstract langs(): ReadonlySet<Language>;\n\n /** Returns native names for this provider's languages, preserving their order. */\n public langNames(): ReadonlyMap<Language, string> {\n return new Map([...this.langs()].map(language => [language, LanguageNames[language]]));\n }\n\n protected abstract value(key: keyof S & string): string | undefined;\n\n public trans<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string {\n const [substitutions] = args;\n\n return this.get(key, substitutions);\n }\n\n public choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string {\n const [substitutions] = args;\n const message = selectPluralForm(this.get(key), this.lang(), count);\n\n return this.substitute(message, key, substitutions);\n }\n\n public get<K extends keyof S & string>(key: K, substitutions?: Record<string, LocaleSubstitutionValue>): string {\n const template = this.value(key);\n\n if (template === undefined) {\n console.warn(`Locale key \"${key}\" not found in \"${this.lang()}\" language.`);\n\n return key as string;\n }\n\n return this.substitute(template, key, substitutions);\n }\n\n private substitute(message: string, key: string, substitutions?: Record<string, LocaleSubstitutionValue>): string {\n return applySubstitutions(message, substitutions, name => {\n console.warn(`Locale substitution \"${name}\" not found for key \"${key}\" in \"${this.lang()}\" language.`);\n }).join(\"\");\n }\n}\n"],"mappings":"AAAA,SAAQ,kBAAkB,0BAAyB;AAEnD;AAAA,EAEI;AAAA,OAOG;AAEP,MAAO,eAAuG;AAAA;AAAA,EAQnG,YAA2C;AAC9C,WAAO,IAAI,IAAI,CAAC,GAAG,KAAK,MAAM,CAAC,EAAE,IAAI,cAAY,CAAC,UAAU,cAAc,QAAQ,CAAC,CAAC,CAAC;AAAA,EACzF;AAAA,EAIO,MAAwC,QAAW,MAA4C;AAClG,UAAM,CAAC,aAAa,IAAI;AAExB,WAAO,KAAK,IAAI,KAAK,aAAa;AAAA,EACtC;AAAA,EAEO,OAAsC,KAAQ,UAAkB,MAA4C;AAC/G,UAAM,CAAC,aAAa,IAAI;AACxB,UAAM,UAAU,iBAAiB,KAAK,IAAI,GAAG,GAAG,KAAK,KAAK,GAAG,KAAK;AAElE,WAAO,KAAK,WAAW,SAAS,KAAK,aAAa;AAAA,EACtD;AAAA,EAEO,IAAgC,KAAQ,eAAiE;AAC5G,UAAM,WAAW,KAAK,MAAM,GAAG;AAE/B,QAAI,aAAa,QAAW;AACxB,cAAQ,KAAK,eAAe,GAAG,mBAAmB,KAAK,KAAK,CAAC,aAAa;AAE1E,aAAO;AAAA,IACX;AAEA,WAAO,KAAK,WAAW,UAAU,KAAK,aAAa;AAAA,EACvD;AAAA,EAEQ,WAAW,SAAiB,KAAa,eAAiE;AAC9G,WAAO,mBAAmB,SAAS,eAAe,UAAQ;AACtD,cAAQ,KAAK,wBAAwB,IAAI,wBAAwB,GAAG,SAAS,KAAK,KAAK,CAAC,aAAa;AAAA,IACzG,CAAC,EAAE,KAAK,EAAE;AAAA,EACd;AACJ;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AbstractLocale from "./AbstractLocale.js";
|
|
2
2
|
import { Language, LocaleStructure } from "../../types/locale.js";
|
|
3
|
-
export type CustomLocaleData = Record<string, string
|
|
4
|
-
export default class<T extends object = LocaleStructure> extends AbstractLocale<T> {
|
|
3
|
+
export type CustomLocaleData = Readonly<Record<string, string>>;
|
|
4
|
+
export default class CustomLocale<T extends object = LocaleStructure> extends AbstractLocale<T> {
|
|
5
5
|
protected language: Language;
|
|
6
6
|
protected data: CustomLocaleData;
|
|
7
7
|
constructor(language?: Language, data?: CustomLocaleData);
|
|
@@ -9,6 +9,6 @@ export default class<T extends object = LocaleStructure> extends AbstractLocale<
|
|
|
9
9
|
setData(data: CustomLocaleData): this;
|
|
10
10
|
lang(): Language;
|
|
11
11
|
keys(): Set<keyof T>;
|
|
12
|
-
|
|
12
|
+
langs(): ReadonlySet<Language>;
|
|
13
13
|
protected value(key: string): string | undefined;
|
|
14
14
|
}
|