angular-intlayer 9.3.0 → 9.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +24 -24
  2. package/dist/cjs/UI/IntlayerNode.component.cjs +2 -2
  3. package/dist/cjs/UI/IntlayerNode.component.cjs.map +1 -1
  4. package/dist/cjs/_virtual/{_@oxc-project_runtime@0.140.0 → _@oxc-project_runtime@0.143.0}/helpers/esm/decorate.cjs +1 -2
  5. package/dist/cjs/_virtual/{_@oxc-project_runtime@0.140.0 → _@oxc-project_runtime@0.143.0}/helpers/esm/decorateMetadata.cjs +1 -2
  6. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
  7. package/dist/cjs/analytics/exposureSink.cjs +0 -1
  8. package/dist/cjs/analytics/exposureSink.cjs.map +1 -1
  9. package/dist/cjs/analytics/useAnalytics.cjs.map +1 -1
  10. package/dist/cjs/analytics/useExperiment.cjs.map +1 -1
  11. package/dist/cjs/client/intlayerToken.cjs.map +1 -1
  12. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  13. package/dist/cjs/client/useDictionaryAsync.cjs +2 -1
  14. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  15. package/dist/cjs/client/useDictionaryDynamic.cjs +2 -1
  16. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  17. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  18. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  19. package/dist/cjs/client/useLocale.cjs.map +1 -1
  20. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
  21. package/dist/cjs/client/usePathname.cjs.map +1 -1
  22. package/dist/cjs/editor/ContentSelector.component.cjs +2 -2
  23. package/dist/cjs/editor/ContentSelector.component.cjs.map +1 -1
  24. package/dist/cjs/editor/EditorProvider.component.cjs +2 -2
  25. package/dist/cjs/editor/EditorProvider.component.cjs.map +1 -1
  26. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  27. package/dist/cjs/esbuild/plugin.cjs +3 -3
  28. package/dist/cjs/esbuild/plugin.cjs.map +1 -1
  29. package/dist/cjs/format/useCompact.cjs.map +1 -1
  30. package/dist/cjs/format/useCurrency.cjs.map +1 -1
  31. package/dist/cjs/format/useDate.cjs.map +1 -1
  32. package/dist/cjs/format/useIntl.cjs +2 -1
  33. package/dist/cjs/format/useIntl.cjs.map +1 -1
  34. package/dist/cjs/format/useList.cjs.map +1 -1
  35. package/dist/cjs/format/useNumber.cjs.map +1 -1
  36. package/dist/cjs/format/usePercentage.cjs.map +1 -1
  37. package/dist/cjs/format/useRelativeTime.cjs.map +1 -1
  38. package/dist/cjs/format/useUnit.cjs.map +1 -1
  39. package/dist/cjs/getDictionary.cjs +2 -1
  40. package/dist/cjs/getDictionary.cjs.map +1 -1
  41. package/dist/cjs/getIntlayer.cjs +2 -1
  42. package/dist/cjs/getIntlayer.cjs.map +1 -1
  43. package/dist/cjs/html/installIntlayerHTML.cjs +1 -1
  44. package/dist/cjs/html/installIntlayerHTML.cjs.map +1 -1
  45. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +1 -1
  46. package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
  47. package/dist/cjs/plugins.cjs +4 -2
  48. package/dist/cjs/plugins.cjs.map +1 -1
  49. package/dist/cjs/renderIntlayerNode.cjs +0 -1
  50. package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
  51. package/dist/cjs/webpack/mergeConfig.cjs +4 -3
  52. package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
  53. package/dist/esm/UI/IntlayerNode.component.mjs +2 -2
  54. package/dist/esm/_virtual/{_@oxc-project_runtime@0.140.0 → _@oxc-project_runtime@0.143.0}/helpers/esm/decorate.mjs +1 -1
  55. package/dist/esm/_virtual/{_@oxc-project_runtime@0.140.0 → _@oxc-project_runtime@0.143.0}/helpers/esm/decorateMetadata.mjs +1 -1
  56. package/dist/esm/client/useDictionaryAsync.mjs +2 -1
  57. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  58. package/dist/esm/client/useDictionaryDynamic.mjs +2 -1
  59. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  60. package/dist/esm/editor/ContentSelector.component.mjs +2 -2
  61. package/dist/esm/editor/EditorProvider.component.mjs +2 -2
  62. package/dist/esm/esbuild/plugin.mjs +3 -3
  63. package/dist/esm/esbuild/plugin.mjs.map +1 -1
  64. package/dist/esm/format/useIntl.mjs +2 -1
  65. package/dist/esm/format/useIntl.mjs.map +1 -1
  66. package/dist/esm/getDictionary.mjs +2 -1
  67. package/dist/esm/getDictionary.mjs.map +1 -1
  68. package/dist/esm/getIntlayer.mjs +2 -1
  69. package/dist/esm/getIntlayer.mjs.map +1 -1
  70. package/dist/esm/html/installIntlayerHTML.mjs +1 -1
  71. package/dist/esm/markdown/installIntlayerMarkdown.mjs +1 -1
  72. package/dist/esm/plugins.mjs +4 -2
  73. package/dist/esm/plugins.mjs.map +1 -1
  74. package/dist/esm/webpack/mergeConfig.mjs +4 -3
  75. package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
  76. package/package.json +9 -9
package/README.md CHANGED
@@ -47,27 +47,27 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
47
47
 
48
48
  ## Keys benefits of Intlayer:
49
49
 
50
- | Feature | Description |
51
- | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
53
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
54
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
55
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.jpg?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler) |
56
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
57
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
58
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app) |
59
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code) |
60
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer) |
61
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
62
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file) |
63
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
64
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
65
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
66
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill) |
67
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md) |
68
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
69
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) |
70
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/benchmark.png?raw=true" alt="Feature" width="700"> | **Performances & Benchmark**<br><br>Uses advanced tree-shaking and dynamic loading to boost performances and keep the solution as light as possible. <br><br> - [Performances & Benchmark](https://intlayer.org/doc/benchmark) |
50
+ | Feature | Description |
51
+ | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
53
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
54
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
55
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.jpg?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler) |
56
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
57
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
58
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app) |
59
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code) |
60
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer) |
61
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
62
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file) |
63
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
64
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
65
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
66
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill) |
67
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md) |
68
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
69
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) <br> - [Intlayer compat adapters](https://intlayer.org/doc/compatibility) |
70
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/benchmark.png?raw=true" alt="Feature" width="700"> | **Performances & Benchmark**<br><br>Uses advanced tree-shaking and dynamic loading to boost performances and keep the solution as light as possible. <br><br> - [Performances & Benchmark](https://intlayer.org/doc/benchmark) |
71
71
 
72
72
  ---
73
73
 
@@ -162,7 +162,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
162
162
  <li><a href="https://intlayer.org/doc/concept/cms" rel=''>Intlayer CMS</a></li>
163
163
  <li><a href="https://intlayer.org/doc/concept/content" rel=''>Dictionary</a>
164
164
  <ul>
165
- <li><a href="https://intlayer.org/doc/concept/content/per-locale-file" rel=''>Per-Locale Content Declaration File</a></li>
165
+ <li><a href="https://intlayer.org/doc/concept/per-locale-file" rel=''>Per-Locale Content Declaration File</a></li>
166
166
  <li><a href="https://intlayer.org/doc/concept/content/translation" rel=''>Translation</a></li>
167
167
  <li><a href="https://intlayer.org/doc/concept/content/enumeration" rel=''>Enumeration</a></li>
168
168
  <li><a href="https://intlayer.org/doc/concept/content/condition" rel=''>Condition</a></li>
@@ -183,7 +183,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
183
183
  <ul>
184
184
  <li><a href="https://intlayer.org/doc/environment/nextjs/15" rel=''>Next.js 15</a></li>
185
185
  <li><a href="https://intlayer.org/doc/environment/nextjs/14" rel=''>Next.js 14 (App Router)</a></li>
186
- <li><a href="https://intlayer.org/doc/environment/nextjs/next-with-Page-Router" rel=''>Next.js Page Router</a></li>
186
+ <li><a href="https://intlayer.org/doc/environment/nextjs/next-with-page-router" rel=''>Next.js Page Router</a></li>
187
187
  <li><a href="https://intlayer.org/doc/environment/nextjs/compiler" rel=''>Next.js using Compiler</a></li>
188
188
  </ul>
189
189
  </li>
@@ -212,7 +212,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
212
212
  <li><a href="https://intlayer.org/doc/environment/sveltekit" rel=''>SvelteKit</a></li>
213
213
  <li><a href="https://intlayer.org/doc/environment/vite-and-preact" rel=''>Vite + Preact</a></li>
214
214
  <li><a href="https://intlayer.org/doc/environment/vite-and-vue" rel=''>Vite + Vue</a></li>
215
- <li><a href="https://intlayer.org/doc/environment/vite-and-nuxt" rel=''>Vite + Nuxt</a></li>
215
+ <li><a href="https://intlayer.org/doc/environment/nuxt-and-vue" rel=''>Vite + Nuxt</a></li>
216
216
  <li><a href="https://intlayer.org/doc/environment/vite-and-solid" rel=''>Vite + Solid</a></li>
217
217
  <li><a href="https://intlayer.org/doc/environment/angular" rel=''>Angular</a></li>
218
218
  <li>
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_decorateMetadata = require('../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorateMetadata.cjs');
3
- const require_decorate = require('../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.cjs');
2
+ const require_decorateMetadata = require('../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorateMetadata.cjs');
3
+ const require_decorate = require('../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.cjs');
4
4
  let _angular_core = require("@angular/core");
5
5
 
6
6
  //#region src/UI/IntlayerNode.component.ts
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerNode.component.cjs","names":["ViewContainerRef","ElementRef","ChangeDetectorRef"],"sources":["../../../src/UI/IntlayerNode.component.ts"],"sourcesContent":["import {\n ChangeDetectorRef,\n Component,\n ElementRef,\n Input,\n inject,\n type OnChanges,\n type SimpleChanges,\n type Type,\n ViewContainerRef,\n} from '@angular/core';\n\n/**\n * A transparent host element that renders Intlayer content nodes.\n *\n * `display: contents` makes the `<intlayer-node>` element invisible in the\n * layout — its children appear as if they were direct children of the parent,\n * so placing this component inside `<h1>`, `<p>`, etc. does not break the\n * document structure.\n *\n * ### Usage\n * ```html\n * <h1><intlayer-node [node]=\"content().title\"></intlayer-node></h1>\n * ```\n */\n@Component({\n selector: 'intlayer-node',\n standalone: true,\n // The ng-content slot is the anchor point for ViewContainerRef.\n // Wrapping text renders directly inside this host thanks to display:contents.\n template: `<ng-container #anchor></ng-container>`,\n // display:contents collapses the host box so it is layout-transparent.\n styles: [`:host { display: contents; }`],\n})\nexport class IntlayerNodeComponent implements OnChanges {\n @Input() node: any;\n\n private vcr = inject(ViewContainerRef);\n private elRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private cdr = inject(ChangeDetectorRef);\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['node']) {\n this.render();\n }\n }\n\n private render() {\n // Clear previously created views / text nodes\n this.vcr.clear();\n const host = this.elRef.nativeElement;\n // Remove any raw text nodes we injected directly on previous renders\n host.childNodes.forEach((n) => {\n if (n.nodeType === Node.TEXT_NODE) n.parentNode?.removeChild(n);\n });\n\n if (!this.node) return;\n\n // The node returned by the Angular plugin is a Proxy whose `.children`\n // property is a function returning component info (editor on) or the raw\n // value (editor off).\n const nodeInfo =\n typeof this.node?.children === 'function'\n ? this.node.children()\n : this.node;\n\n if (nodeInfo?.component && typeof nodeInfo.component !== 'string') {\n // ── Editor enabled path: create the ContentSelectorWrapper component ──\n const componentRef = this.vcr.createComponent(\n nodeInfo.component as Type<any>\n );\n\n if (nodeInfo.props) {\n for (const [key, value] of Object.entries(nodeInfo.props)) {\n (componentRef.instance as any)[key] = value;\n }\n }\n\n if (nodeInfo.children) {\n const content = nodeInfo.children;\n if (typeof content === 'string' || typeof content === 'number') {\n componentRef.location.nativeElement.appendChild(\n document.createTextNode(String(content))\n );\n }\n }\n\n this.cdr.markForCheck();\n } else {\n // ── Editor disabled path: render plain text inside the host ──────────\n const text =\n this.node?.value ?? this.node?.toString?.() ?? String(this.node);\n // Append a text node directly inside the host element.\n // Because the host has `display: contents`, this text is layout-wise a\n // direct child of the surrounding element (e.g. <h1>).\n host.appendChild(document.createTextNode(text));\n }\n }\n}\n"],"mappings":";;;;;;AAkCO,IAAM,wBAAN,MAAM,sBAA2C;CACtD,AAAS;CAET,AAAQ,gCAAaA,8BAAgB;CACrC,AAAQ,kCAAwCC,wBAAU;CAC1D,AAAQ,gCAAaC,+BAAiB;CAEtC,YAAY,SAA8B;EACxC,IAAI,QAAQ,SACV,KAAK,OAAO;CAEhB;CAEA,AAAQ,SAAS;EAEf,KAAK,IAAI,MAAM;EACf,MAAM,OAAO,KAAK,MAAM;EAExB,KAAK,WAAW,SAAS,MAAM;GAC7B,IAAI,EAAE,aAAa,KAAK,WAAW,EAAE,YAAY,YAAY,CAAC;EAChE,CAAC;EAED,IAAI,CAAC,KAAK,MAAM;EAKhB,MAAM,WACJ,OAAO,KAAK,MAAM,aAAa,aAC3B,KAAK,KAAK,SAAS,IACnB,KAAK;EAEX,IAAI,UAAU,aAAa,OAAO,SAAS,cAAc,UAAU;GAEjE,MAAM,eAAe,KAAK,IAAI,gBAC5B,SAAS,SACX;GAEA,IAAI,SAAS,OACX,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,KAAK,GACtD,AAAC,aAAa,SAAiB,OAAO;GAI1C,IAAI,SAAS,UAAU;IACrB,MAAM,UAAU,SAAS;IACzB,IAAI,OAAO,YAAY,YAAY,OAAO,YAAY,UACpD,aAAa,SAAS,cAAc,YAClC,SAAS,eAAe,OAAO,OAAO,CAAC,CACzC;GAEJ;GAEA,KAAK,IAAI,aAAa;EACxB,OAAO;GAEL,MAAM,OACJ,KAAK,MAAM,SAAS,KAAK,MAAM,WAAW,KAAK,OAAO,KAAK,IAAI;GAIjE,KAAK,YAAY,SAAS,eAAe,IAAI,CAAC;EAChD;CACF;AACF;mDA/DS;+EAVE;CACT,UAAU;CACV,YAAY;CAGZ,UAAU;CAEV,QAAQ,CAAC,8BAA8B;AACzC,CAAC"}
1
+ {"version":3,"file":"IntlayerNode.component.cjs","names":["inject","ViewContainerRef","ElementRef","ChangeDetectorRef","Input","Component"],"sources":["../../../src/UI/IntlayerNode.component.ts"],"sourcesContent":["import {\n ChangeDetectorRef,\n Component,\n ElementRef,\n Input,\n inject,\n type OnChanges,\n type SimpleChanges,\n type Type,\n ViewContainerRef,\n} from '@angular/core';\n\n/**\n * A transparent host element that renders Intlayer content nodes.\n *\n * `display: contents` makes the `<intlayer-node>` element invisible in the\n * layout — its children appear as if they were direct children of the parent,\n * so placing this component inside `<h1>`, `<p>`, etc. does not break the\n * document structure.\n *\n * ### Usage\n * ```html\n * <h1><intlayer-node [node]=\"content().title\"></intlayer-node></h1>\n * ```\n */\n@Component({\n selector: 'intlayer-node',\n standalone: true,\n // The ng-content slot is the anchor point for ViewContainerRef.\n // Wrapping text renders directly inside this host thanks to display:contents.\n template: `<ng-container #anchor></ng-container>`,\n // display:contents collapses the host box so it is layout-transparent.\n styles: [`:host { display: contents; }`],\n})\nexport class IntlayerNodeComponent implements OnChanges {\n @Input() node: any;\n\n private vcr = inject(ViewContainerRef);\n private elRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private cdr = inject(ChangeDetectorRef);\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['node']) {\n this.render();\n }\n }\n\n private render() {\n // Clear previously created views / text nodes\n this.vcr.clear();\n const host = this.elRef.nativeElement;\n // Remove any raw text nodes we injected directly on previous renders\n host.childNodes.forEach((n) => {\n if (n.nodeType === Node.TEXT_NODE) n.parentNode?.removeChild(n);\n });\n\n if (!this.node) return;\n\n // The node returned by the Angular plugin is a Proxy whose `.children`\n // property is a function returning component info (editor on) or the raw\n // value (editor off).\n const nodeInfo =\n typeof this.node?.children === 'function'\n ? this.node.children()\n : this.node;\n\n if (nodeInfo?.component && typeof nodeInfo.component !== 'string') {\n // ── Editor enabled path: create the ContentSelectorWrapper component ──\n const componentRef = this.vcr.createComponent(\n nodeInfo.component as Type<any>\n );\n\n if (nodeInfo.props) {\n for (const [key, value] of Object.entries(nodeInfo.props)) {\n (componentRef.instance as any)[key] = value;\n }\n }\n\n if (nodeInfo.children) {\n const content = nodeInfo.children;\n if (typeof content === 'string' || typeof content === 'number') {\n componentRef.location.nativeElement.appendChild(\n document.createTextNode(String(content))\n );\n }\n }\n\n this.cdr.markForCheck();\n } else {\n // ── Editor disabled path: render plain text inside the host ──────────\n const text =\n this.node?.value ?? this.node?.toString?.() ?? String(this.node);\n // Append a text node directly inside the host element.\n // Because the host has `display: contents`, this text is layout-wise a\n // direct child of the surrounding element (e.g. <h1>).\n host.appendChild(document.createTextNode(text));\n }\n }\n}\n"],"mappings":";;;;;;AAkCO,IAAM,wBAAN,MAAM,sBAA2C;CACtD,AAAS;CAET,AAAQ,UAAMA,sBAAOC,8BAAgB;CACrC,AAAQ,YAAQD,sBAAgCE,wBAAU;CAC1D,AAAQ,UAAMF,sBAAOG,+BAAiB;CAEtC,YAAY,SAA8B;EACxC,IAAI,QAAQ,SACV,KAAK,OAAO;CAEhB;CAEA,AAAQ,SAAS;EAEf,KAAK,IAAI,MAAM;EACf,MAAM,OAAO,KAAK,MAAM;EAExB,KAAK,WAAW,SAAS,MAAM;GAC7B,IAAI,EAAE,aAAa,KAAK,WAAW,EAAE,YAAY,YAAY,CAAC;EAChE,CAAC;EAED,IAAI,CAAC,KAAK,MAAM;EAKhB,MAAM,WACJ,OAAO,KAAK,MAAM,aAAa,aAC3B,KAAK,KAAK,SAAS,IACnB,KAAK;EAEX,IAAI,UAAU,aAAa,OAAO,SAAS,cAAc,UAAU;GAEjE,MAAM,eAAe,KAAK,IAAI,gBAC5B,SAAS,SACX;GAEA,IAAI,SAAS,OACX,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,KAAK,GACtD,AAAC,aAAa,SAAiB,OAAO;GAI1C,IAAI,SAAS,UAAU;IACrB,MAAM,UAAU,SAAS;IACzB,IAAI,OAAO,YAAY,YAAY,OAAO,YAAY,UACpD,aAAa,SAAS,cAAc,YAClC,SAAS,eAAe,OAAO,OAAO,CAAC,CACzC;GAEJ;GAEA,KAAK,IAAI,aAAa;EACxB,OAAO;GAEL,MAAM,OACJ,KAAK,MAAM,SAAS,KAAK,MAAM,WAAW,KAAK,OAAO,KAAK,IAAI;GAIjE,KAAK,YAAY,SAAS,eAAe,IAAI,CAAC;EAChD;CACF;AACF;8BA/DGC,qBAAM;sDAVRC,yBAAU;CACT,UAAU;CACV,YAAY;CAGZ,UAAU;CAEV,QAAQ,CAAC,8BAA8B;AACzC,CAAC"}
@@ -1,5 +1,4 @@
1
-
2
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
1
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/decorate.js
3
2
  function __decorate(decorators, target, key, desc) {
4
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1,5 +1,4 @@
1
-
2
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateMetadata.js
1
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/decorateMetadata.js
3
2
  function __decorateMetadata(k, v) {
4
3
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5
4
  }
@@ -19,11 +19,10 @@ var __copyProps = (to, from, except, desc) => {
19
19
  }
20
20
  return to;
21
21
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
23
  value: mod,
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
-
29
28
  exports.__toESM = __toESM;
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
2
  //#region src/analytics/exposureSink.ts
4
3
  let sink = null;
5
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"exposureSink.cjs","names":[],"sources":["../../../src/analytics/exposureSink.ts"],"sourcesContent":["import type { KeyPath } from '@intlayer/types/keyPath';\n\n/**\n * Node metadata reported for a content exposure. Kept dependency-free (types\n * only) so the interpreter hot path in `plugins.ts` never statically imports\n * `@intlayer/analytics` — the package stays optional and tree-shakeable.\n */\nexport type ExposureInput = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: string;\n nodeType?: string;\n};\n\n/** Consumer of exposure reports, installed by `useAnalytics` after init. */\nexport type ExposureSink = (input: ExposureInput) => void;\n\nlet sink: ExposureSink | null = null;\n\n/**\n * Installs (or clears) the exposure sink. `useAnalytics` sets this once the\n * analytics client has loaded, and clears it on unmount.\n *\n * @param next - The sink to install, or `null` to clear.\n */\nexport const setExposureSink = (next: ExposureSink | null): void => {\n sink = next;\n};\n\n/**\n * Forwards a content exposure to the installed sink. A cheap null-check when\n * analytics is not running, so it is safe to call from every node resolution.\n *\n * @param input - The node metadata to report.\n */\nexport const reportExposure = (input: ExposureInput): void => {\n sink?.(input);\n};\n"],"mappings":";;;AAiBA,IAAI,OAA4B;;;;;;;AAQhC,MAAa,mBAAmB,SAAoC;CAClE,OAAO;AACT;;;;;;;AAQA,MAAa,kBAAkB,UAA+B;CAC5D,OAAO,KAAK;AACd"}
1
+ {"version":3,"file":"exposureSink.cjs","names":[],"sources":["../../../src/analytics/exposureSink.ts"],"sourcesContent":["import type { KeyPath } from '@intlayer/types/keyPath';\n\n/**\n * Node metadata reported for a content exposure. Kept dependency-free (types\n * only) so the interpreter hot path in `plugins.ts` never statically imports\n * `@intlayer/analytics` — the package stays optional and tree-shakeable.\n */\nexport type ExposureInput = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: string;\n nodeType?: string;\n};\n\n/** Consumer of exposure reports, installed by `useAnalytics` after init. */\nexport type ExposureSink = (input: ExposureInput) => void;\n\nlet sink: ExposureSink | null = null;\n\n/**\n * Installs (or clears) the exposure sink. `useAnalytics` sets this once the\n * analytics client has loaded, and clears it on unmount.\n *\n * @param next - The sink to install, or `null` to clear.\n */\nexport const setExposureSink = (next: ExposureSink | null): void => {\n sink = next;\n};\n\n/**\n * Forwards a content exposure to the installed sink. A cheap null-check when\n * analytics is not running, so it is safe to call from every node resolution.\n *\n * @param input - The node metadata to report.\n */\nexport const reportExposure = (input: ExposureInput): void => {\n sink?.(input);\n};\n"],"mappings":";;AAiBA,IAAI,OAA4B;;;;;;;AAQhC,MAAa,mBAAmB,SAAoC;CAClE,OAAO;AACT;;;;;;;AAQA,MAAa,kBAAkB,UAA+B;CAC5D,OAAO,KAAK;AACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAnalytics.cjs","names":["isEnabled","DestroyRef","Injector","INTLAYER_TOKEN"],"sources":["../../../src/analytics/useAnalytics.ts"],"sourcesContent":["import {\n DestroyRef,\n effect,\n Injector,\n inject,\n provideAppInitializer,\n runInInjectionContext,\n signal,\n} from '@angular/core';\nimport type { AnalyticsClient } from '@intlayer/analytics';\nimport { isEnabled } from '@intlayer/analytics/isEnabled';\n// Import from the standalone token file to avoid a circular dependency:\n// installIntlayer.ts → useAnalytics.ts → ../client → installIntlayer.ts\nimport { INTLAYER_TOKEN, type IntlayerProvider } from '../client/intlayerToken';\nimport { setExposureSink } from './exposureSink';\n\n/**\n * Initializes the Intlayer analytics client singleton when analytics is\n * enabled (mirrors {@link useEditor}). Records an initial page view, keeps the\n * client aware of the current locale, and wires node-level content exposures.\n *\n * Must be called inside an Angular injection context (e.g. a component\n * constructor, `provideAppInitializer`, or `runInInjectionContext`).\n *\n * @param client - The IntlayerProvider instance to sync locale from.\n * When omitted the function injects `INTLAYER_TOKEN` from the DI tree,\n * so it still works when called directly from a component.\n */\nexport const useAnalytics = (client?: IntlayerProvider | null): void => {\n if (process.env.INTLAYER_ANALYTICS_ENABLED === 'false' || !isEnabled) return;\n\n const destroyRef = inject(DestroyRef, { optional: true });\n const injector = inject(Injector);\n\n // Resolve the client: use the passed-in reference or fall back to injection.\n const resolvedClient =\n client ??\n inject<IntlayerProvider>(INTLAYER_TOKEN, { optional: true } as any);\n\n // `analyticsClient` signal is set once the async import resolves.\n // Using a signal lets an `effect()` react to it becoming available.\n const analyticsClient = signal<AnalyticsClient | null>(null);\n\n // Guard: prevents the async callback from acting after the view is destroyed.\n let stopped = false;\n // Tracks whether initAnalyticsClient actually ran, so teardown never calls\n // stopAnalyticsClient for an init that was cancelled — that would decrement\n // the shared reference count once too many.\n let initialized = false;\n\n import('@intlayer/analytics')\n .then(({ initAnalyticsClient, buildContentExposure }) => {\n if (stopped) return;\n\n const clientInstance = initAnalyticsClient();\n initialized = true;\n\n const currentLocale = resolvedClient?.locale();\n if (currentLocale) clientInstance.setLocale(currentLocale);\n clientInstance.trackPageView({ reason: 'initial' });\n\n // Route node-level exposures (from the interpreter plugins) into the\n // client. Serialization happens here, off the hot render path.\n setExposureSink((input) =>\n clientInstance.trackContentExposure(buildContentExposure(input))\n );\n\n analyticsClient.set(clientInstance);\n })\n .catch(() => {\n /* chunk failed to load — analytics stays a no-op */\n });\n\n // Locale switches are a real signal — record them as page views.\n let previousLocale: string | undefined;\n const effectRef = runInInjectionContext(injector, () =>\n effect(() => {\n const clientInstance = analyticsClient();\n const locale = resolvedClient?.locale();\n\n if (!clientInstance || !locale) return;\n\n if (previousLocale === undefined) {\n // First run after init — the initial page view already covered it.\n previousLocale = locale;\n return;\n }\n if (previousLocale === locale) return;\n\n previousLocale = locale;\n clientInstance.setLocale(locale);\n clientInstance.trackPageView({ reason: 'locale_change' });\n })\n );\n\n // Tear down on destroy\n destroyRef?.onDestroy(() => {\n stopped = true;\n effectRef.destroy();\n analyticsClient.set(null);\n setExposureSink(null);\n import('@intlayer/analytics')\n .then(({ stopAnalyticsClient }) => {\n if (initialized) stopAnalyticsClient();\n })\n .catch(() => {});\n });\n};\n\n/**\n * Angular provider that wires `useAnalytics` into the application\n * initialisation phase via `provideAppInitializer`.\n *\n * `provideIntlayer()` already calls this internally, so you only need this\n * function when you want to manage providers individually.\n *\n * @example\n * ```ts\n * // app.config.ts\n * import { provideIntlayer, provideIntlayerAnalytics } from 'angular-intlayer';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [provideIntlayer(), provideIntlayerAnalytics()],\n * };\n * ```\n */\nexport const provideIntlayerAnalytics = (client?: IntlayerProvider | null) =>\n provideAppInitializer(() => useAnalytics(client));\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,MAAa,gBAAgB,WAA2C;CACtE,IAAI,QAAQ,IAAI,+BAA+B,WAAW,CAACA,yCAAW;CAEtE,MAAM,uCAAoBC,0BAAY,EAAE,UAAU,KAAK,CAAC;CACxD,MAAM,qCAAkBC,sBAAQ;CAGhC,MAAM,iBACJ,oCACyBC,6CAAgB,EAAE,UAAU,KAAK,CAAQ;CAIpE,MAAM,4CAAiD,IAAI;CAG3D,IAAI,UAAU;CAId,IAAI,cAAc;CAElB,OAAO,sBAAsB,CAC1B,MAAM,EAAE,qBAAqB,2BAA2B;EACvD,IAAI,SAAS;EAEb,MAAM,iBAAiB,oBAAoB;EAC3C,cAAc;EAEd,MAAM,gBAAgB,gBAAgB,OAAO;EAC7C,IAAI,eAAe,eAAe,UAAU,aAAa;EACzD,eAAe,cAAc,EAAE,QAAQ,UAAU,CAAC;EAIlD,gDAAiB,UACf,eAAe,qBAAqB,qBAAqB,KAAK,CAAC,CACjE;EAEA,gBAAgB,IAAI,cAAc;CACpC,CAAC,CAAC,CACD,YAAY,CAEb,CAAC;CAGH,IAAI;CACJ,MAAM,qDAAkC,gDACzB;EACX,MAAM,iBAAiB,gBAAgB;EACvC,MAAM,SAAS,gBAAgB,OAAO;EAEtC,IAAI,CAAC,kBAAkB,CAAC,QAAQ;EAEhC,IAAI,mBAAmB,QAAW;GAEhC,iBAAiB;GACjB;EACF;EACA,IAAI,mBAAmB,QAAQ;EAE/B,iBAAiB;EACjB,eAAe,UAAU,MAAM;EAC/B,eAAe,cAAc,EAAE,QAAQ,gBAAgB,CAAC;CAC1D,CAAC,CACH;CAGA,YAAY,gBAAgB;EAC1B,UAAU;EACV,UAAU,QAAQ;EAClB,gBAAgB,IAAI,IAAI;EACxB,+CAAgB,IAAI;EACpB,OAAO,sBAAsB,CAC1B,MAAM,EAAE,0BAA0B;GACjC,IAAI,aAAa,oBAAoB;EACvC,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;CACnB,CAAC;AACH;;;;;;;;;;;;;;;;;;AAmBA,MAAa,4BAA4B,0DACX,aAAa,MAAM,CAAC"}
1
+ {"version":3,"file":"useAnalytics.cjs","names":["isEnabled","inject","DestroyRef","Injector","INTLAYER_TOKEN","signal","runInInjectionContext","effect","provideAppInitializer"],"sources":["../../../src/analytics/useAnalytics.ts"],"sourcesContent":["import {\n DestroyRef,\n effect,\n Injector,\n inject,\n provideAppInitializer,\n runInInjectionContext,\n signal,\n} from '@angular/core';\nimport type { AnalyticsClient } from '@intlayer/analytics';\nimport { isEnabled } from '@intlayer/analytics/isEnabled';\n// Import from the standalone token file to avoid a circular dependency:\n// installIntlayer.ts → useAnalytics.ts → ../client → installIntlayer.ts\nimport { INTLAYER_TOKEN, type IntlayerProvider } from '../client/intlayerToken';\nimport { setExposureSink } from './exposureSink';\n\n/**\n * Initializes the Intlayer analytics client singleton when analytics is\n * enabled (mirrors {@link useEditor}). Records an initial page view, keeps the\n * client aware of the current locale, and wires node-level content exposures.\n *\n * Must be called inside an Angular injection context (e.g. a component\n * constructor, `provideAppInitializer`, or `runInInjectionContext`).\n *\n * @param client - The IntlayerProvider instance to sync locale from.\n * When omitted the function injects `INTLAYER_TOKEN` from the DI tree,\n * so it still works when called directly from a component.\n */\nexport const useAnalytics = (client?: IntlayerProvider | null): void => {\n if (process.env.INTLAYER_ANALYTICS_ENABLED === 'false' || !isEnabled) return;\n\n const destroyRef = inject(DestroyRef, { optional: true });\n const injector = inject(Injector);\n\n // Resolve the client: use the passed-in reference or fall back to injection.\n const resolvedClient =\n client ??\n inject<IntlayerProvider>(INTLAYER_TOKEN, { optional: true } as any);\n\n // `analyticsClient` signal is set once the async import resolves.\n // Using a signal lets an `effect()` react to it becoming available.\n const analyticsClient = signal<AnalyticsClient | null>(null);\n\n // Guard: prevents the async callback from acting after the view is destroyed.\n let stopped = false;\n // Tracks whether initAnalyticsClient actually ran, so teardown never calls\n // stopAnalyticsClient for an init that was cancelled — that would decrement\n // the shared reference count once too many.\n let initialized = false;\n\n import('@intlayer/analytics')\n .then(({ initAnalyticsClient, buildContentExposure }) => {\n if (stopped) return;\n\n const clientInstance = initAnalyticsClient();\n initialized = true;\n\n const currentLocale = resolvedClient?.locale();\n if (currentLocale) clientInstance.setLocale(currentLocale);\n clientInstance.trackPageView({ reason: 'initial' });\n\n // Route node-level exposures (from the interpreter plugins) into the\n // client. Serialization happens here, off the hot render path.\n setExposureSink((input) =>\n clientInstance.trackContentExposure(buildContentExposure(input))\n );\n\n analyticsClient.set(clientInstance);\n })\n .catch(() => {\n /* chunk failed to load — analytics stays a no-op */\n });\n\n // Locale switches are a real signal — record them as page views.\n let previousLocale: string | undefined;\n const effectRef = runInInjectionContext(injector, () =>\n effect(() => {\n const clientInstance = analyticsClient();\n const locale = resolvedClient?.locale();\n\n if (!clientInstance || !locale) return;\n\n if (previousLocale === undefined) {\n // First run after init — the initial page view already covered it.\n previousLocale = locale;\n return;\n }\n if (previousLocale === locale) return;\n\n previousLocale = locale;\n clientInstance.setLocale(locale);\n clientInstance.trackPageView({ reason: 'locale_change' });\n })\n );\n\n // Tear down on destroy\n destroyRef?.onDestroy(() => {\n stopped = true;\n effectRef.destroy();\n analyticsClient.set(null);\n setExposureSink(null);\n import('@intlayer/analytics')\n .then(({ stopAnalyticsClient }) => {\n if (initialized) stopAnalyticsClient();\n })\n .catch(() => {});\n });\n};\n\n/**\n * Angular provider that wires `useAnalytics` into the application\n * initialisation phase via `provideAppInitializer`.\n *\n * `provideIntlayer()` already calls this internally, so you only need this\n * function when you want to manage providers individually.\n *\n * @example\n * ```ts\n * // app.config.ts\n * import { provideIntlayer, provideIntlayerAnalytics } from 'angular-intlayer';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [provideIntlayer(), provideIntlayerAnalytics()],\n * };\n * ```\n */\nexport const provideIntlayerAnalytics = (client?: IntlayerProvider | null) =>\n provideAppInitializer(() => useAnalytics(client));\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,MAAa,gBAAgB,WAA2C;CACtE,IAAI,QAAQ,IAAI,+BAA+B,WAAW,CAACA,yCAAW;CAEtE,MAAM,iBAAaC,sBAAOC,0BAAY,EAAE,UAAU,KAAK,CAAC;CACxD,MAAM,eAAWD,sBAAOE,sBAAQ;CAGhC,MAAM,iBACJ,cACAF,sBAAyBG,6CAAgB,EAAE,UAAU,KAAK,CAAQ;CAIpE,MAAM,sBAAkBC,sBAA+B,IAAI;CAG3D,IAAI,UAAU;CAId,IAAI,cAAc;CAElB,OAAO,sBAAsB,CAC1B,MAAM,EAAE,qBAAqB,2BAA2B;EACvD,IAAI,SAAS;EAEb,MAAM,iBAAiB,oBAAoB;EAC3C,cAAc;EAEd,MAAM,gBAAgB,gBAAgB,OAAO;EAC7C,IAAI,eAAe,eAAe,UAAU,aAAa;EACzD,eAAe,cAAc,EAAE,QAAQ,UAAU,CAAC;EAIlD,gDAAiB,UACf,eAAe,qBAAqB,qBAAqB,KAAK,CAAC,CACjE;EAEA,gBAAgB,IAAI,cAAc;CACpC,CAAC,CAAC,CACD,YAAY,CAEb,CAAC;CAGH,IAAI;CACJ,MAAM,gBAAYC,qCAAsB,oBACtCC,4BAAa;EACX,MAAM,iBAAiB,gBAAgB;EACvC,MAAM,SAAS,gBAAgB,OAAO;EAEtC,IAAI,CAAC,kBAAkB,CAAC,QAAQ;EAEhC,IAAI,mBAAmB,QAAW;GAEhC,iBAAiB;GACjB;EACF;EACA,IAAI,mBAAmB,QAAQ;EAE/B,iBAAiB;EACjB,eAAe,UAAU,MAAM;EAC/B,eAAe,cAAc,EAAE,QAAQ,gBAAgB,CAAC;CAC1D,CAAC,CACH;CAGA,YAAY,gBAAgB;EAC1B,UAAU;EACV,UAAU,QAAQ;EAClB,gBAAgB,IAAI,IAAI;EACxB,+CAAgB,IAAI;EACpB,OAAO,sBAAsB,CAC1B,MAAM,EAAE,0BAA0B;GACjC,IAAI,aAAa,oBAAoB;EACvC,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;CACnB,CAAC;AACH;;;;;;;;;;;;;;;;;;AAmBA,MAAa,4BAA4B,eACvCC,2CAA4B,aAAa,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useExperiment.cjs","names":["isEnabled","DestroyRef"],"sources":["../../../src/analytics/useExperiment.ts"],"sourcesContent":["import { DestroyRef, inject, type Signal, signal } from '@angular/core';\nimport { isEnabled } from '@intlayer/analytics/isEnabled';\n\n/**\n * The state of an A/B experiment for the current session.\n */\nexport type ExperimentState = {\n /**\n * The variant assigned to this session. Until assignment resolves (and on\n * the server, or when analytics is disabled), this is the first variant —\n * treat the first variant as the control.\n */\n variant: Signal<string>;\n /**\n * `true` once the variant has been deterministically assigned and its\n * exposure recorded. Useful to defer rendering when a flash of the control\n * variant is not acceptable.\n */\n isAssigned: Signal<boolean>;\n};\n\n/**\n * Assigns this session to a variant of an A/B experiment and records the\n * exposure, scoped to `experimentKey`, so the backend can compute per-variant\n * conversion rates against `useConversion` events.\n *\n * Assignment is deterministic per session (no server round-trip, stable across\n * re-mounts). The exposure is recorded once per call.\n *\n * Must be called inside an Angular injection context (e.g. a component\n * constructor or field initializer).\n *\n * @param experimentKey - Unique key identifying the experiment.\n * @param variants - The candidate variant names; the first one is the control.\n * @param weights - Optional relative weights, one per variant (e.g. `[9, 1]`).\n * @returns The {@link ExperimentState} for this session.\n *\n * @example\n * ```ts\n * export class HeroComponent {\n * experiment = useExperiment('homepage-hero', ['a', 'b']);\n * content = useIntlayer('hero');\n * }\n * ```\n */\nexport const useExperiment = (\n experimentKey: string,\n variants: string[],\n weights?: number[]\n): ExperimentState => {\n const variant = signal(variants[0] ?? '');\n const isAssigned = signal(false);\n\n if (process.env.INTLAYER_ANALYTICS_ENABLED === 'false' || !isEnabled) {\n return {\n variant: variant.asReadonly(),\n isAssigned: isAssigned.asReadonly(),\n };\n }\n\n const destroyRef = inject(DestroyRef, { optional: true });\n\n let cancelled = false;\n let initialized = false;\n\n import('@intlayer/analytics')\n .then(({ initAnalyticsClient }) => {\n if (cancelled) return;\n\n // Ref-counted: guarantees a live client even when this call's import\n // resolves before the provider's. Balanced by stop on destroy.\n const client = initAnalyticsClient();\n initialized = true;\n\n const assigned = client.getVariant(experimentKey, variants, weights);\n variant.set(assigned);\n isAssigned.set(true);\n\n // Experiment-level exposure — the denominator of the conversion rate.\n client.trackContentExposure({\n dictionaryKey: experimentKey,\n keyPath: '',\n nodeType: 'experiment',\n experimentKey,\n variant: assigned,\n });\n })\n .catch(() => {\n /* chunk failed to load — control variant stays in place */\n });\n\n destroyRef?.onDestroy(() => {\n cancelled = true;\n import('@intlayer/analytics')\n .then(({ stopAnalyticsClient }) => {\n if (initialized) stopAnalyticsClient();\n })\n .catch(() => {});\n });\n\n return { variant: variant.asReadonly(), isAssigned: isAssigned.asReadonly() };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,iBACX,eACA,UACA,YACoB;CACpB,MAAM,oCAAiB,SAAS,MAAM,EAAE;CACxC,MAAM,uCAAoB,KAAK;CAE/B,IAAI,QAAQ,IAAI,+BAA+B,WAAW,CAACA,yCACzD,OAAO;EACL,SAAS,QAAQ,WAAW;EAC5B,YAAY,WAAW,WAAW;CACpC;CAGF,MAAM,uCAAoBC,0BAAY,EAAE,UAAU,KAAK,CAAC;CAExD,IAAI,YAAY;CAChB,IAAI,cAAc;CAElB,OAAO,sBAAsB,CAC1B,MAAM,EAAE,0BAA0B;EACjC,IAAI,WAAW;EAIf,MAAM,SAAS,oBAAoB;EACnC,cAAc;EAEd,MAAM,WAAW,OAAO,WAAW,eAAe,UAAU,OAAO;EACnE,QAAQ,IAAI,QAAQ;EACpB,WAAW,IAAI,IAAI;EAGnB,OAAO,qBAAqB;GAC1B,eAAe;GACf,SAAS;GACT,UAAU;GACV;GACA,SAAS;EACX,CAAC;CACH,CAAC,CAAC,CACD,YAAY,CAEb,CAAC;CAEH,YAAY,gBAAgB;EAC1B,YAAY;EACZ,OAAO,sBAAsB,CAC1B,MAAM,EAAE,0BAA0B;GACjC,IAAI,aAAa,oBAAoB;EACvC,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;CACnB,CAAC;CAED,OAAO;EAAE,SAAS,QAAQ,WAAW;EAAG,YAAY,WAAW,WAAW;CAAE;AAC9E"}
1
+ {"version":3,"file":"useExperiment.cjs","names":["signal","isEnabled","inject","DestroyRef"],"sources":["../../../src/analytics/useExperiment.ts"],"sourcesContent":["import { DestroyRef, inject, type Signal, signal } from '@angular/core';\nimport { isEnabled } from '@intlayer/analytics/isEnabled';\n\n/**\n * The state of an A/B experiment for the current session.\n */\nexport type ExperimentState = {\n /**\n * The variant assigned to this session. Until assignment resolves (and on\n * the server, or when analytics is disabled), this is the first variant —\n * treat the first variant as the control.\n */\n variant: Signal<string>;\n /**\n * `true` once the variant has been deterministically assigned and its\n * exposure recorded. Useful to defer rendering when a flash of the control\n * variant is not acceptable.\n */\n isAssigned: Signal<boolean>;\n};\n\n/**\n * Assigns this session to a variant of an A/B experiment and records the\n * exposure, scoped to `experimentKey`, so the backend can compute per-variant\n * conversion rates against `useConversion` events.\n *\n * Assignment is deterministic per session (no server round-trip, stable across\n * re-mounts). The exposure is recorded once per call.\n *\n * Must be called inside an Angular injection context (e.g. a component\n * constructor or field initializer).\n *\n * @param experimentKey - Unique key identifying the experiment.\n * @param variants - The candidate variant names; the first one is the control.\n * @param weights - Optional relative weights, one per variant (e.g. `[9, 1]`).\n * @returns The {@link ExperimentState} for this session.\n *\n * @example\n * ```ts\n * export class HeroComponent {\n * experiment = useExperiment('homepage-hero', ['a', 'b']);\n * content = useIntlayer('hero');\n * }\n * ```\n */\nexport const useExperiment = (\n experimentKey: string,\n variants: string[],\n weights?: number[]\n): ExperimentState => {\n const variant = signal(variants[0] ?? '');\n const isAssigned = signal(false);\n\n if (process.env.INTLAYER_ANALYTICS_ENABLED === 'false' || !isEnabled) {\n return {\n variant: variant.asReadonly(),\n isAssigned: isAssigned.asReadonly(),\n };\n }\n\n const destroyRef = inject(DestroyRef, { optional: true });\n\n let cancelled = false;\n let initialized = false;\n\n import('@intlayer/analytics')\n .then(({ initAnalyticsClient }) => {\n if (cancelled) return;\n\n // Ref-counted: guarantees a live client even when this call's import\n // resolves before the provider's. Balanced by stop on destroy.\n const client = initAnalyticsClient();\n initialized = true;\n\n const assigned = client.getVariant(experimentKey, variants, weights);\n variant.set(assigned);\n isAssigned.set(true);\n\n // Experiment-level exposure — the denominator of the conversion rate.\n client.trackContentExposure({\n dictionaryKey: experimentKey,\n keyPath: '',\n nodeType: 'experiment',\n experimentKey,\n variant: assigned,\n });\n })\n .catch(() => {\n /* chunk failed to load — control variant stays in place */\n });\n\n destroyRef?.onDestroy(() => {\n cancelled = true;\n import('@intlayer/analytics')\n .then(({ stopAnalyticsClient }) => {\n if (initialized) stopAnalyticsClient();\n })\n .catch(() => {});\n });\n\n return { variant: variant.asReadonly(), isAssigned: isAssigned.asReadonly() };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,iBACX,eACA,UACA,YACoB;CACpB,MAAM,cAAUA,sBAAO,SAAS,MAAM,EAAE;CACxC,MAAM,iBAAaA,sBAAO,KAAK;CAE/B,IAAI,QAAQ,IAAI,+BAA+B,WAAW,CAACC,yCACzD,OAAO;EACL,SAAS,QAAQ,WAAW;EAC5B,YAAY,WAAW,WAAW;CACpC;CAGF,MAAM,iBAAaC,sBAAOC,0BAAY,EAAE,UAAU,KAAK,CAAC;CAExD,IAAI,YAAY;CAChB,IAAI,cAAc;CAElB,OAAO,sBAAsB,CAC1B,MAAM,EAAE,0BAA0B;EACjC,IAAI,WAAW;EAIf,MAAM,SAAS,oBAAoB;EACnC,cAAc;EAEd,MAAM,WAAW,OAAO,WAAW,eAAe,UAAU,OAAO;EACnE,QAAQ,IAAI,QAAQ;EACpB,WAAW,IAAI,IAAI;EAGnB,OAAO,qBAAqB;GAC1B,eAAe;GACf,SAAS;GACT,UAAU;GACV;GACA,SAAS;EACX,CAAC;CACH,CAAC,CAAC,CACD,YAAY,CAEb,CAAC;CAEH,YAAY,gBAAgB;EAC1B,YAAY;EACZ,OAAO,sBAAsB,CAC1B,MAAM,EAAE,0BAA0B;GACjC,IAAI,aAAa,oBAAoB;EACvC,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;CACnB,CAAC;CAED,OAAO;EAAE,SAAS,QAAQ,WAAW;EAAG,YAAY,WAAW,WAAW;CAAE;AAC9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerToken.cjs","names":["internationalization","InjectionToken"],"sources":["../../../src/client/intlayerToken.ts"],"sourcesContent":["import { InjectionToken, type Signal, signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport { setIntlayerIdentifier } from '@intlayer/config/client';\nimport type {\n LocalesValues,\n ProviderVariant,\n} from '@intlayer/types/module_augmentation';\n\nexport class IntlayerProvider {\n isCookieEnabled = signal(true);\n private _locale = signal<LocalesValues>(\n internationalization.defaultLocale as LocalesValues\n );\n\n private _variant = signal<ProviderVariant | undefined>(undefined);\n\n readonly locale: Signal<LocalesValues> = this._locale.asReadonly();\n\n /**\n * Ambient variant applied to every dictionary read in the app, the same way\n * `locale` is. Overridden per call by an explicit selector.\n */\n readonly variant: Signal<ProviderVariant | undefined> =\n this._variant.asReadonly();\n\n constructor() {\n setIntlayerIdentifier();\n }\n\n setLocale = (locale: LocalesValues) => {\n this._locale.set(locale);\n };\n\n setVariant = (variant: ProviderVariant | undefined) => {\n this._variant.set(variant);\n };\n}\n\nexport const INTLAYER_TOKEN = new InjectionToken<IntlayerProvider>('intlayer');\n\n/**\n * Singleton instance\n */\nlet instance: IntlayerProvider | null = null;\n\n/**\n * Create and return a single IntlayerProvider instance\n */\nexport const createIntlayerClient = (\n locale?: LocalesValues,\n isCookieEnabled = true,\n variant?: ProviderVariant\n): IntlayerProvider => {\n if (instance) return instance;\n\n instance = new IntlayerProvider();\n\n if (locale) {\n instance.setLocale(locale);\n }\n if (variant !== undefined) {\n instance.setVariant(variant);\n }\n instance.isCookieEnabled.set(isCookieEnabled);\n\n return instance;\n};\n"],"mappings":";;;;;;AAQA,IAAa,mBAAb,MAA8B;CAC5B,4CAAyB,IAAI;CAC7B,AAAQ,oCACNA,4CAAqB,aACvB;CAEA,AAAQ,qCAA+C,MAAS;CAEhE,AAAS,SAAgC,KAAK,QAAQ,WAAW;;;;;CAMjE,AAAS,UACP,KAAK,SAAS,WAAW;CAE3B,cAAc;EACZ,mDAAsB;CACxB;CAEA,aAAa,WAA0B;EACrC,KAAK,QAAQ,IAAI,MAAM;CACzB;CAEA,cAAc,YAAyC;EACrD,KAAK,SAAS,IAAI,OAAO;CAC3B;AACF;AAEA,MAAa,iBAAiB,IAAIC,6BAAiC,UAAU;;;;AAK7E,IAAI,WAAoC;;;;AAKxC,MAAa,wBACX,QACA,kBAAkB,MAClB,YACqB;CACrB,IAAI,UAAU,OAAO;CAErB,WAAW,IAAI,iBAAiB;CAEhC,IAAI,QACF,SAAS,UAAU,MAAM;CAE3B,IAAI,YAAY,QACd,SAAS,WAAW,OAAO;CAE7B,SAAS,gBAAgB,IAAI,eAAe;CAE5C,OAAO;AACT"}
1
+ {"version":3,"file":"intlayerToken.cjs","names":["signal","internationalization","InjectionToken"],"sources":["../../../src/client/intlayerToken.ts"],"sourcesContent":["import { InjectionToken, type Signal, signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport { setIntlayerIdentifier } from '@intlayer/config/client';\nimport type {\n LocalesValues,\n ProviderVariant,\n} from '@intlayer/types/module_augmentation';\n\nexport class IntlayerProvider {\n isCookieEnabled = signal(true);\n private _locale = signal<LocalesValues>(\n internationalization.defaultLocale as LocalesValues\n );\n\n private _variant = signal<ProviderVariant | undefined>(undefined);\n\n readonly locale: Signal<LocalesValues> = this._locale.asReadonly();\n\n /**\n * Ambient variant applied to every dictionary read in the app, the same way\n * `locale` is. Overridden per call by an explicit selector.\n */\n readonly variant: Signal<ProviderVariant | undefined> =\n this._variant.asReadonly();\n\n constructor() {\n setIntlayerIdentifier();\n }\n\n setLocale = (locale: LocalesValues) => {\n this._locale.set(locale);\n };\n\n setVariant = (variant: ProviderVariant | undefined) => {\n this._variant.set(variant);\n };\n}\n\nexport const INTLAYER_TOKEN = new InjectionToken<IntlayerProvider>('intlayer');\n\n/**\n * Singleton instance\n */\nlet instance: IntlayerProvider | null = null;\n\n/**\n * Create and return a single IntlayerProvider instance\n */\nexport const createIntlayerClient = (\n locale?: LocalesValues,\n isCookieEnabled = true,\n variant?: ProviderVariant\n): IntlayerProvider => {\n if (instance) return instance;\n\n instance = new IntlayerProvider();\n\n if (locale) {\n instance.setLocale(locale);\n }\n if (variant !== undefined) {\n instance.setVariant(variant);\n }\n instance.isCookieEnabled.set(isCookieEnabled);\n\n return instance;\n};\n"],"mappings":";;;;;;AAQA,IAAa,mBAAb,MAA8B;CAC5B,sBAAkBA,sBAAO,IAAI;CAC7B,AAAQ,cAAUA,sBAChBC,4CAAqB,aACvB;CAEA,AAAQ,eAAWD,sBAAoC,MAAS;CAEhE,AAAS,SAAgC,KAAK,QAAQ,WAAW;;;;;CAMjE,AAAS,UACP,KAAK,SAAS,WAAW;CAE3B,cAAc;EACZ,mDAAsB;CACxB;CAEA,aAAa,WAA0B;EACrC,KAAK,QAAQ,IAAI,MAAM;CACzB;CAEA,cAAc,YAAyC;EACrD,KAAK,SAAS,IAAI,OAAO;CAC3B;AACF;AAEA,MAAa,iBAAiB,IAAIE,6BAAiC,UAAU;;;;AAK7E,IAAI,WAAoC;;;;AAKxC,MAAa,wBACX,QACA,kBAAkB,MAClB,YACqB;CACrB,IAAI,UAAU,OAAO;CAErB,WAAW,IAAI,iBAAiB;CAEhC,IAAI,QACF,SAAS,UAAU,MAAM;CAE3B,IAAI,YAAY,QACd,SAAS,WAAW,OAAO;CAE7B,SAAS,gBAAgB,IAAI,eAAe;CAE5C,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionary.cjs","names":["INTLAYER_TOKEN","getDictionary"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\nimport { resolveDictionaryArgument } from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getDictionary } from '../getDictionary';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/**\n * Angular hook that transforms a dictionary (or qualified dictionary group)\n * and returns its reactive content for the given locale or selector.\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends\n | LocalesValues\n | DictionarySelectorForGroup<T> = DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): Signal<\n DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n >\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n /** a *stable* reactive dictionary object */\n const content = computed(() => {\n const currentLocale = intlayer?.locale();\n\n if (process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false') {\n // Layers the provider's locale and variant under the call-site argument.\n // This is also the seam the build-time optimize transform lands on, which\n // rewrites `useIntlayer('key', selector)` into `useDictionary(dict, …)`.\n return getDictionary(\n dictionary,\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: currentLocale,\n contextVariant: intlayer?.variant?.(),\n dictionaryKey: dictionary.key,\n }) as A\n ) as any;\n }\n\n return getDictionary(\n dictionary,\n (localeOrSelector ?? currentLocale) as A\n ) as any;\n });\n\n return content; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;;;;;AAqBA,MAAa,iBAMX,YACA,qBAMG;CACH,MAAM,qCAAoCA,2CAAc;CA2BxD,yCAxB+B;EAC7B,MAAM,gBAAgB,UAAU,OAAO;EAEvC,IAAI,QAAQ,IAAI,iCAAiC,SAI/C,OAAOC,oCACL,gFAC0B;GACxB;GACA,eAAe;GACf,gBAAgB,UAAU,UAAU;GACpC,eAAe,WAAW;EAC5B,CAAC,CACH;EAGF,OAAOA,oCACL,YACC,oBAAoB,aACvB;CACF,CAEa;AACf"}
1
+ {"version":3,"file":"useDictionary.cjs","names":["inject","INTLAYER_TOKEN","computed","getDictionary","resolveDictionaryArgument"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\nimport { resolveDictionaryArgument } from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getDictionary } from '../getDictionary';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/**\n * Angular hook that transforms a dictionary (or qualified dictionary group)\n * and returns its reactive content for the given locale or selector.\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends\n | LocalesValues\n | DictionarySelectorForGroup<T> = DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): Signal<\n DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n >\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n /** a *stable* reactive dictionary object */\n const content = computed(() => {\n const currentLocale = intlayer?.locale();\n\n if (process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false') {\n // Layers the provider's locale and variant under the call-site argument.\n // This is also the seam the build-time optimize transform lands on, which\n // rewrites `useIntlayer('key', selector)` into `useDictionary(dict, …)`.\n return getDictionary(\n dictionary,\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: currentLocale,\n contextVariant: intlayer?.variant?.(),\n dictionaryKey: dictionary.key,\n }) as A\n ) as any;\n }\n\n return getDictionary(\n dictionary,\n (localeOrSelector ?? currentLocale) as A\n ) as any;\n });\n\n return content; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;;;;;AAqBA,MAAa,iBAMX,YACA,qBAMG;CACH,MAAM,eAAWA,sBAAyBC,2CAAc;CA2BxD,WAxBgBC,8BAAe;EAC7B,MAAM,gBAAgB,UAAU,OAAO;EAEvC,IAAI,QAAQ,IAAI,iCAAiC,SAI/C,OAAOC,oCACL,gBACAC,gEAA0B;GACxB;GACA,eAAe;GACf,gBAAgB,UAAU,UAAU;GACpC,eAAe,WAAW;EAC5B,CAAC,CACH;EAGF,OAAOD,oCACL,YACC,oBAAoB,aACvB;CACF,CAEa;AACf"}
@@ -15,7 +15,8 @@ let _angular_core = require("@angular/core");
15
15
  const useDictionaryAsync = async (dictionaryPromise, locale) => {
16
16
  const intlayer = (0, _angular_core.inject)(require_client_intlayerToken.INTLAYER_TOKEN);
17
17
  const localeTarget = (0, _angular_core.computed)(() => locale ?? intlayer?.locale() ?? _intlayer_config_built.internationalization.defaultLocale);
18
- return require_client_useDictionary.useDictionary(await dictionaryPromise[localeTarget()]?.(), localeTarget());
18
+ const dictionary = await dictionaryPromise[localeTarget()]?.();
19
+ return require_client_useDictionary.useDictionary(dictionary, localeTarget());
19
20
  };
20
21
 
21
22
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryAsync.cjs","names":["INTLAYER_TOKEN","internationalization","useDictionary"],"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <const T extends Dictionary>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () => locale ?? intlayer?.locale() ?? internationalization.defaultLocale\n );\n\n const dictionary = await (dictionaryPromise as any)[localeTarget()]?.();\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAa,qBAAqB,OAChC,mBACA,WACG;CACH,MAAM,qCAAoCA,2CAAc;CAExD,MAAM,iDACE,UAAU,UAAU,OAAO,KAAKC,4CAAqB,aAC7D;CAIA,OAAOC,2CAAc,MAFK,kBAA0B,aAAa,EAAE,GAAG,GAErC,aAAa,CAAQ;AACxD"}
1
+ {"version":3,"file":"useDictionaryAsync.cjs","names":["inject","INTLAYER_TOKEN","computed","internationalization","useDictionary"],"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <const T extends Dictionary>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () => locale ?? intlayer?.locale() ?? internationalization.defaultLocale\n );\n\n const dictionary = await (dictionaryPromise as any)[localeTarget()]?.();\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAa,qBAAqB,OAChC,mBACA,WACG;CACH,MAAM,eAAWA,sBAAyBC,2CAAc;CAExD,MAAM,mBAAeC,8BACb,UAAU,UAAU,OAAO,KAAKC,4CAAqB,aAC7D;CAEA,MAAM,aAAa,MAAO,kBAA0B,aAAa,EAAE,GAAG;CAEtE,OAAOC,2CAAc,YAAY,aAAa,CAAQ;AACxD"}
@@ -43,7 +43,8 @@ const useDictionaryDynamic = (dictionaryPromise, key, localeOrSelector) => {
43
43
  }
44
44
  const locale = typeof localeOrSelector === "string" ? localeOrSelector : void 0;
45
45
  const localeTarget = (0, _angular_core.computed)(() => locale ?? intlayer?.locale() ?? _intlayer_config_built.internationalization.defaultLocale);
46
- return require_client_useDictionary.useDictionary(require_client_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget()}`, dictionaryPromise[localeTarget()]?.()), localeTarget());
46
+ const dictionary = require_client_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget()}`, dictionaryPromise[localeTarget()]?.());
47
+ return require_client_useDictionary.useDictionary(dictionary, localeTarget());
47
48
  };
48
49
 
49
50
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.cjs","names":["INTLAYER_TOKEN","internationalization","getDictionary","useDictionary","useLoadDynamic"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject, signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport {\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveDictionaryArgument,\n resolveQualifiedDynamicContentAsync,\n} from '@intlayer/core/dictionaryManipulator';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionarySelectorForKey,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { getDictionary } from '../getDictionary';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * Lazily loads a dictionary (plain or qualified) and returns its reactive\n * content.\n *\n * For a qualified loader map (collection / variant, possibly\n * combined), only the chunk(s) the selector targets are loaded. For a plain\n * loader map, the locale chunk is loaded.\n *\n * If the locale is not provided (directly or through the selector), it will use\n * the locale from the client context.\n */\nexport const useDictionaryDynamic = <\n const T extends Dictionary,\n const K extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales,\n>(\n dictionaryPromise:\n | StrictModeLocaleMap<() => Promise<T>>\n | QualifiedDynamicLoaderMap,\n key: K,\n localeOrSelector?: A\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n if (\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false' &&\n isQualifiedDynamicLoaderMap(dictionaryPromise)\n ) {\n // Layers the provider's ambient variant under the call-site argument\n // before the chunk walk, so only the targeted chunk is loaded.\n const { locale: selectorLocale, selector } =\n parseDictionarySelector<LocalesValues>(\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: intlayer?.locale(),\n contextVariant: intlayer?.variant?.(),\n dictionaryKey: String(key),\n })\n );\n\n const localeTarget = selectorLocale ?? internationalization.defaultLocale;\n\n const container = signal<unknown>(undefined);\n\n resolveQualifiedDynamicContentAsync({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n }).then((resolved) => container.set(resolved));\n\n return computed(() => container() as any);\n }\n\n const locale =\n typeof localeOrSelector === 'string'\n ? (localeOrSelector as LocalesValues)\n : undefined;\n\n const localeTarget = computed(\n () => locale ?? intlayer?.locale() ?? internationalization.defaultLocale\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget()}`,\n (dictionaryPromise as any)[localeTarget()]?.()\n ) as T;\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,qCAAoCA,2CAAc;CAExD,IACE,QAAQ,IAAI,iCAAiC,iFACjB,iBAAiB,GAC7C;EAGA,MAAM,EAAE,QAAQ,gBAAgB,mJAEF;GACxB;GACA,eAAe,UAAU,OAAO;GAChC,gBAAgB,UAAU,UAAU;GACpC,eAAe,OAAO,GAAG;EAC3B,CAAC,CACH;EAEF,MAAM,eAAe,kBAAkBC,4CAAqB;EAE5D,MAAM,sCAA4B,MAAS;EAE3C,8EAAoC;GAClC,WAAW;GACX,KAAK,OAAO,GAAG;GACf,QAAQ;GACR;GACA,YAAY,eAAeC,oCAAc,YAAY,YAAY;EACnE,CAAC,CAAC,CAAC,MAAM,aAAa,UAAU,IAAI,QAAQ,CAAC;EAE7C,yCAAsB,UAAU,CAAQ;CAC1C;CAEA,MAAM,SACJ,OAAO,qBAAqB,WACvB,mBACD;CAEN,MAAM,iDACE,UAAU,UAAU,OAAO,KAAKD,4CAAqB,aAC7D;CAOA,OAAOE,2CALYC,6CACjB,GAAG,OAAO,GAAG,EAAE,GAAG,aAAa,KAC9B,kBAA0B,aAAa,EAAE,GAAG,CAGjB,GAAG,aAAa,CAAQ;AACxD"}
1
+ {"version":3,"file":"useDictionaryDynamic.cjs","names":["inject","INTLAYER_TOKEN","isQualifiedDynamicLoaderMap","parseDictionarySelector","resolveDictionaryArgument","internationalization","signal","getDictionary","computed","useLoadDynamic","useDictionary"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject, signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport {\n isQualifiedDynamicLoaderMap,\n parseDictionarySelector,\n type QualifiedDynamicLoaderMap,\n resolveDictionaryArgument,\n resolveQualifiedDynamicContentAsync,\n} from '@intlayer/core/dictionaryManipulator';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionarySelectorForKey,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { getDictionary } from '../getDictionary';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * Lazily loads a dictionary (plain or qualified) and returns its reactive\n * content.\n *\n * For a qualified loader map (collection / variant, possibly\n * combined), only the chunk(s) the selector targets are loaded. For a plain\n * loader map, the locale chunk is loaded.\n *\n * If the locale is not provided (directly or through the selector), it will use\n * the locale from the client context.\n */\nexport const useDictionaryDynamic = <\n const T extends Dictionary,\n const K extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales,\n>(\n dictionaryPromise:\n | StrictModeLocaleMap<() => Promise<T>>\n | QualifiedDynamicLoaderMap,\n key: K,\n localeOrSelector?: A\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n if (\n process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false' &&\n isQualifiedDynamicLoaderMap(dictionaryPromise)\n ) {\n // Layers the provider's ambient variant under the call-site argument\n // before the chunk walk, so only the targeted chunk is loaded.\n const { locale: selectorLocale, selector } =\n parseDictionarySelector<LocalesValues>(\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: intlayer?.locale(),\n contextVariant: intlayer?.variant?.(),\n dictionaryKey: String(key),\n })\n );\n\n const localeTarget = selectorLocale ?? internationalization.defaultLocale;\n\n const container = signal<unknown>(undefined);\n\n resolveQualifiedDynamicContentAsync({\n loaderMap: dictionaryPromise,\n key: String(key),\n locale: localeTarget,\n selector,\n transform: (dictionary) => getDictionary(dictionary, localeTarget),\n }).then((resolved) => container.set(resolved));\n\n return computed(() => container() as any);\n }\n\n const locale =\n typeof localeOrSelector === 'string'\n ? (localeOrSelector as LocalesValues)\n : undefined;\n\n const localeTarget = computed(\n () => locale ?? intlayer?.locale() ?? internationalization.defaultLocale\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget()}`,\n (dictionaryPromise as any)[localeTarget()]?.()\n ) as T;\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,wBAKX,mBAGA,KACA,qBACG;CACH,MAAM,eAAWA,sBAAyBC,2CAAc;CAExD,IACE,QAAQ,IAAI,iCAAiC,eAC7CC,kEAA4B,iBAAiB,GAC7C;EAGA,MAAM,EAAE,QAAQ,gBAAgB,iBAC9BC,kEACEC,gEAA0B;GACxB;GACA,eAAe,UAAU,OAAO;GAChC,gBAAgB,UAAU,UAAU;GACpC,eAAe,OAAO,GAAG;EAC3B,CAAC,CACH;EAEF,MAAM,eAAe,kBAAkBC,4CAAqB;EAE5D,MAAM,gBAAYC,sBAAgB,MAAS;EAE3C,8EAAoC;GAClC,WAAW;GACX,KAAK,OAAO,GAAG;GACf,QAAQ;GACR;GACA,YAAY,eAAeC,oCAAc,YAAY,YAAY;EACnE,CAAC,CAAC,CAAC,MAAM,aAAa,UAAU,IAAI,QAAQ,CAAC;EAE7C,WAAOC,8BAAe,UAAU,CAAQ;CAC1C;CAEA,MAAM,SACJ,OAAO,qBAAqB,WACvB,mBACD;CAEN,MAAM,mBAAeA,8BACb,UAAU,UAAU,OAAO,KAAKH,4CAAqB,aAC7D;CAEA,MAAM,aAAaI,6CACjB,GAAG,OAAO,GAAG,EAAE,GAAG,aAAa,KAC9B,kBAA0B,aAAa,EAAE,GAAG,CAC/C;CAEA,OAAOC,2CAAc,YAAY,aAAa,CAAQ;AACxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayer.cjs","names":["INTLAYER_TOKEN","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\nimport { resolveDictionaryArgument } from '@intlayer/core/dictionaryManipulator';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryResult,\n DictionarySelectorForKey,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/** guard utility - true only for objects generated by `renderIntlayerNode()` */\nexport const isUpdatableNode = (\n val: unknown\n): val is { __update: (n: unknown) => void } =>\n !!val &&\n typeof val === 'object' &&\n typeof (val as any).__update === 'function';\n\n/**\n * Angular hook that picks one dictionary by its key and returns its reactive content.\n *\n * It utilizes Angular signals to provide deep reactivity, ensuring your components\n * update automatically when the locale changes.\n *\n * @param key - The unique key of the dictionary to retrieve.\n * @param locale - Optional locale to override the current context locale.\n * @returns The transformed dictionary content.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { useIntlayer } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-my-component',\n * template: `<div>{{ content().myField.value }}</div>`,\n * })\n * export class MyComponent {\n * content = useIntlayer('my-dictionary-key');\n * }\n * ```\n */\nexport const useIntlayer = <\n const T extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales,\n>(\n key: T,\n localeOrSelector?: A\n): Signal<\n DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN)!;\n\n /** a *stable* reactive dictionary object */\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const content = computed(() => {\n const currentLocale = intlayer.locale();\n\n if (process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false') {\n // Layers the provider's locale and variant under the call-site argument.\n return getIntlayer(\n key,\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: currentLocale,\n contextVariant: intlayer.variant?.(),\n dictionaryKey: key as string,\n }) as A\n ) as any;\n }\n\n return getIntlayer(key, (localeOrSelector ?? currentLocale) as A) as any;\n });\n\n return content; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;;AAeA,MAAa,mBACX,QAEA,CAAC,CAAC,OACF,OAAO,QAAQ,YACf,OAAQ,IAAY,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BnC,MAAa,eAIX,KACA,qBAGG;CACH,MAAM,qCAAoCA,2CAAc;CAuBxD,yCAnB+B;EAC7B,MAAM,gBAAgB,SAAS,OAAO;EAEtC,IAAI,QAAQ,IAAI,iCAAiC,SAE/C,OAAOC,gCACL,yEAC0B;GACxB;GACA,eAAe;GACf,gBAAgB,SAAS,UAAU;GACnC,eAAe;EACjB,CAAC,CACH;EAGF,OAAOA,gCAAY,KAAM,oBAAoB,aAAmB;CAClE,CAEa;AACf"}
1
+ {"version":3,"file":"useIntlayer.cjs","names":["inject","INTLAYER_TOKEN","computed","getIntlayer","resolveDictionaryArgument"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\nimport { resolveDictionaryArgument } from '@intlayer/core/dictionaryManipulator';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryResult,\n DictionarySelectorForKey,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/** guard utility - true only for objects generated by `renderIntlayerNode()` */\nexport const isUpdatableNode = (\n val: unknown\n): val is { __update: (n: unknown) => void } =>\n !!val &&\n typeof val === 'object' &&\n typeof (val as any).__update === 'function';\n\n/**\n * Angular hook that picks one dictionary by its key and returns its reactive content.\n *\n * It utilizes Angular signals to provide deep reactivity, ensuring your components\n * update automatically when the locale changes.\n *\n * @param key - The unique key of the dictionary to retrieve.\n * @param locale - Optional locale to override the current context locale.\n * @returns The transformed dictionary content.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { useIntlayer } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-my-component',\n * template: `<div>{{ content().myField.value }}</div>`,\n * })\n * export class MyComponent {\n * content = useIntlayer('my-dictionary-key');\n * }\n * ```\n */\nexport const useIntlayer = <\n const T extends DictionaryKeys,\n const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales,\n>(\n key: T,\n localeOrSelector?: A\n): Signal<\n DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>\n> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN)!;\n\n /** a *stable* reactive dictionary object */\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const content = computed(() => {\n const currentLocale = intlayer.locale();\n\n if (process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false') {\n // Layers the provider's locale and variant under the call-site argument.\n return getIntlayer(\n key,\n resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: currentLocale,\n contextVariant: intlayer.variant?.(),\n dictionaryKey: key as string,\n }) as A\n ) as any;\n }\n\n return getIntlayer(key, (localeOrSelector ?? currentLocale) as A) as any;\n });\n\n return content; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;;AAeA,MAAa,mBACX,QAEA,CAAC,CAAC,OACF,OAAO,QAAQ,YACf,OAAQ,IAAY,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BnC,MAAa,eAIX,KACA,qBAGG;CACH,MAAM,eAAWA,sBAAyBC,2CAAc;CAuBxD,WAnBgBC,8BAAe;EAC7B,MAAM,gBAAgB,SAAS,OAAO;EAEtC,IAAI,QAAQ,IAAI,iCAAiC,SAE/C,OAAOC,gCACL,SACAC,gEAA0B;GACxB;GACA,eAAe;GACf,gBAAgB,SAAS,UAAU;GACnC,eAAe;EACjB,CAAC,CACH;EAGF,OAAOD,gCAAY,KAAM,oBAAoB,aAAmB;CAClE,CAEa;AACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"useLoadDynamic.cjs","names":[],"sources":["../../../src/client/useLoadDynamic.ts"],"sourcesContent":["import { signal } from '@angular/core';\n\n/**\n * A \"synchronous\" loader for a dynamically‐imported JSON (or anything).\n *\n * - Immediately returns a reactive signal so that Angular can properly track changes.\n * - When the Promise resolves, it replaces the signal's value with the real data.\n */\nexport const useLoadDynamic = <T extends Record<string, any>>(\n key: string,\n promise: Promise<T>\n): T => {\n // A module‐level cache of Promises, so we only import once per key.\n const cache: Map<string, Promise<T>> = (useLoadDynamic as any)._cache ||\n ((useLoadDynamic as any)._cache = new Map());\n\n // Hold the \"current\" value as a reactive signal\n // This starts as an empty object but Angular can track changes to it\n const container = signal({} as T);\n\n if (!cache.has(key)) {\n // Kick off the dynamic import & cache it\n const p = promise.then((real) => {\n // As soon as the import resolves, update the signal with the real data\n container.set(real);\n return real;\n });\n cache.set(key, p);\n } else {\n // If it's already in flight (or done), hook into it so that the container still updates\n cache.get(key)?.then((real) => {\n container.set(real);\n });\n }\n\n // Return the current signal value directly - Angular can track all changes to it\n return container();\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,kBACX,KACA,YACM;CAEN,MAAM,QAAkC,eAAuB,WAC9D,AAAC,eAAuB,yBAAS,IAAI,IAAI;CAI1C,MAAM,sCAAmB,CAAC,CAAM;CAEhC,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG;EAEnB,MAAM,IAAI,QAAQ,MAAM,SAAS;GAE/B,UAAU,IAAI,IAAI;GAClB,OAAO;EACT,CAAC;EACD,MAAM,IAAI,KAAK,CAAC;CAClB,OAEE,MAAM,IAAI,GAAG,CAAC,EAAE,MAAM,SAAS;EAC7B,UAAU,IAAI,IAAI;CACpB,CAAC;CAIH,OAAO,UAAU;AACnB"}
1
+ {"version":3,"file":"useLoadDynamic.cjs","names":["signal"],"sources":["../../../src/client/useLoadDynamic.ts"],"sourcesContent":["import { signal } from '@angular/core';\n\n/**\n * A \"synchronous\" loader for a dynamically‐imported JSON (or anything).\n *\n * - Immediately returns a reactive signal so that Angular can properly track changes.\n * - When the Promise resolves, it replaces the signal's value with the real data.\n */\nexport const useLoadDynamic = <T extends Record<string, any>>(\n key: string,\n promise: Promise<T>\n): T => {\n // A module‐level cache of Promises, so we only import once per key.\n const cache: Map<string, Promise<T>> = (useLoadDynamic as any)._cache ||\n ((useLoadDynamic as any)._cache = new Map());\n\n // Hold the \"current\" value as a reactive signal\n // This starts as an empty object but Angular can track changes to it\n const container = signal({} as T);\n\n if (!cache.has(key)) {\n // Kick off the dynamic import & cache it\n const p = promise.then((real) => {\n // As soon as the import resolves, update the signal with the real data\n container.set(real);\n return real;\n });\n cache.set(key, p);\n } else {\n // If it's already in flight (or done), hook into it so that the container still updates\n cache.get(key)?.then((real) => {\n container.set(real);\n });\n }\n\n // Return the current signal value directly - Angular can track all changes to it\n return container();\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,kBACX,KACA,YACM;CAEN,MAAM,QAAkC,eAAuB,WAC9D,AAAC,eAAuB,yBAAS,IAAI,IAAI;CAI1C,MAAM,gBAAYA,sBAAO,CAAC,CAAM;CAEhC,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG;EAEnB,MAAM,IAAI,QAAQ,MAAM,SAAS;GAE/B,UAAU,IAAI,IAAI;GAClB,OAAO;EACT,CAAC;EACD,MAAM,IAAI,KAAK,CAAC;CAClB,OAEE,MAAM,IAAI,GAAG,CAAC,EAAE,MAAM,SAAS;EAC7B,UAAU,IAAI,IAAI;CACpB,CAAC;CAIH,OAAO,UAAU;AACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useLocale.cjs","names":["internationalization","INTLAYER_TOKEN"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\nexport type UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: DeclaredLocales) => void;\n};\n\nexport type UseLocaleResult = {\n locale: Signal<DeclaredLocales>;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n};\n\n/**\n * Angular hook to manage the current locale and related functions.\n *\n * @param props - Optional configuration for locale management.\n * @returns An object containing the current locale (signal), default locale, available locales, and a function to update the locale.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { useLocale } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-locale-switcher',\n * template: `\n * <select [value]=\"locale()\" (change)=\"setLocale($any($event.target).value)\">\n * @for (loc of availableLocales; track loc) {\n * <option [value]=\"loc\">{{ loc }}</option>\n * }\n * </select>\n * `,\n * })\n * export class LocaleSwitcher {\n * const { locale, setLocale, availableLocales } = useLocale();\n * }\n * ```\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: UseLocaleProps = {}): UseLocaleResult => {\n const { defaultLocale, locales: availableLocales } =\n internationalization ?? {};\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n // Create a reactive reference for the locale\n const locale = computed(\n () => (intlayer?.locale() ?? defaultLocale) as DeclaredLocales\n );\n const isCookieEnabledContext = computed(\n () => intlayer?.isCookieEnabled() ?? true\n );\n\n const setLocale = (newLocale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n if (intlayer) {\n intlayer.setLocale(newLocale);\n }\n setLocaleInStorage(\n newLocale,\n isCookieEnabled ?? isCookieEnabledContext() ?? true\n );\n onLocaleChange?.(newLocale as DeclaredLocales);\n };\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n } as UseLocaleResult;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAa,aAAa,EACxB,iBACA,mBACkB,CAAC,MAAuB;CAC1C,MAAM,EAAE,eAAe,SAAS,qBAC9BA,+CAAwB,CAAC;CAC3B,MAAM,qCAAoCC,2CAAc;CAGxD,MAAM,2CACG,UAAU,OAAO,KAAK,aAC/B;CACA,MAAM,2DACE,UAAU,gBAAgB,KAAK,IACvC;CAEA,MAAM,aAAa,cAA6B;EAC9C,IAAI,CAAC,kBAAkB,IAAI,MAAM,CAAC,CAAC,SAAS,SAAS,GAAG;GACtD,QAAQ,MAAM,UAAU,UAAU,kBAAkB;GACpD;EACF;EAEA,IAAI,UACF,SAAS,UAAU,SAAS;EAE9B,mDACE,WACA,mBAAmB,uBAAuB,KAAK,IACjD;EACA,iBAAiB,SAA4B;CAC/C;CAEA,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"useLocale.cjs","names":["internationalization","inject","INTLAYER_TOKEN","computed"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { computed, inject, type Signal } from '@angular/core';\nimport { internationalization } from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\nexport type UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: DeclaredLocales) => void;\n};\n\nexport type UseLocaleResult = {\n locale: Signal<DeclaredLocales>;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n};\n\n/**\n * Angular hook to manage the current locale and related functions.\n *\n * @param props - Optional configuration for locale management.\n * @returns An object containing the current locale (signal), default locale, available locales, and a function to update the locale.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { useLocale } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-locale-switcher',\n * template: `\n * <select [value]=\"locale()\" (change)=\"setLocale($any($event.target).value)\">\n * @for (loc of availableLocales; track loc) {\n * <option [value]=\"loc\">{{ loc }}</option>\n * }\n * </select>\n * `,\n * })\n * export class LocaleSwitcher {\n * const { locale, setLocale, availableLocales } = useLocale();\n * }\n * ```\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: UseLocaleProps = {}): UseLocaleResult => {\n const { defaultLocale, locales: availableLocales } =\n internationalization ?? {};\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n // Create a reactive reference for the locale\n const locale = computed(\n () => (intlayer?.locale() ?? defaultLocale) as DeclaredLocales\n );\n const isCookieEnabledContext = computed(\n () => intlayer?.isCookieEnabled() ?? true\n );\n\n const setLocale = (newLocale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n if (intlayer) {\n intlayer.setLocale(newLocale);\n }\n setLocaleInStorage(\n newLocale,\n isCookieEnabled ?? isCookieEnabledContext() ?? true\n );\n onLocaleChange?.(newLocale as DeclaredLocales);\n };\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n } as UseLocaleResult;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAa,aAAa,EACxB,iBACA,mBACkB,CAAC,MAAuB;CAC1C,MAAM,EAAE,eAAe,SAAS,qBAC9BA,+CAAwB,CAAC;CAC3B,MAAM,eAAWC,sBAAyBC,2CAAc;CAGxD,MAAM,aAASC,8BACN,UAAU,OAAO,KAAK,aAC/B;CACA,MAAM,6BAAyBA,8BACvB,UAAU,gBAAgB,KAAK,IACvC;CAEA,MAAM,aAAa,cAA6B;EAC9C,IAAI,CAAC,kBAAkB,IAAI,MAAM,CAAC,CAAC,SAAS,SAAS,GAAG;GACtD,QAAQ,MAAM,UAAU,UAAU,kBAAkB;GACpD;EACF;EAEA,IAAI,UACF,SAAS,UAAU,SAAS;EAE9B,mDACE,WACA,mBAAmB,uBAAuB,KAAK,IACjD;EACA,iBAAiB,SAA4B;CAC/C;CAEA,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleStorage.cjs","names":["localeStorageOptions"],"sources":["../../../src/client/useLocaleStorage.ts"],"sourcesContent":["import {\n getLocaleFromStorageClient,\n LocaleStorageClient,\n localeStorageOptions,\n setLocaleInStorageClient as setLocaleInStorageCore,\n} from '@intlayer/core/utils';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\n/**\n * Get the locale cookie\n */\n/**\n * Get the locale cookie\n */\nexport const localeInStorage = getLocaleFromStorageClient(localeStorageOptions);\n/**\n * @deprecated Use localeInStorage instead\n *\n * Get the locale cookie\n */\nexport const localeCookie = localeInStorage;\n\n/**\n * Set the locale cookie\n */\nexport const setLocaleInStorage = (\n locale: LocalesValues,\n isCookieEnabled: boolean\n) =>\n setLocaleInStorageCore(locale, {\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use setLocaleInStorage instead\n *\n * Set the locale cookie\n */\nexport const setLocaleCookie = setLocaleInStorage;\n\n/**\n * Hook that provides the locale storage and a function to set it\n */\nexport const useLocaleStorage = (isCookieEnabled?: boolean) =>\n LocaleStorageClient({\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use useLocaleStorage instead\n *\n * For GDPR compliance, use useLocaleStorage instead\n *\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleCookie = (isCookieEnabled?: boolean) => {\n const storage = useLocaleStorage(isCookieEnabled);\n\n return {\n localeCookie: storage.getLocale(),\n setLocaleCookie: storage.setLocale,\n };\n};\n"],"mappings":";;;;;;;;;;AAcA,MAAa,uEAA6CA,yCAAoB;;;;;;AAM9E,MAAa,eAAe;;;;AAK5B,MAAa,sBACX,QACA,uEAEuB,QAAQ;CAC7B,GAAGA;CACH;AACF,CAAC;;;;;;AAOH,MAAa,kBAAkB;;;;AAK/B,MAAa,oBAAoB,kEACX;CAClB,GAAGA;CACH;AACF,CAAC;;;;;;;;AASH,MAAa,mBAAmB,oBAA8B;CAC5D,MAAM,UAAU,iBAAiB,eAAe;CAEhD,OAAO;EACL,cAAc,QAAQ,UAAU;EAChC,iBAAiB,QAAQ;CAC3B;AACF"}
1
+ {"version":3,"file":"useLocaleStorage.cjs","names":["getLocaleFromStorageClient","localeStorageOptions","setLocaleInStorageCore","LocaleStorageClient"],"sources":["../../../src/client/useLocaleStorage.ts"],"sourcesContent":["import {\n getLocaleFromStorageClient,\n LocaleStorageClient,\n localeStorageOptions,\n setLocaleInStorageClient as setLocaleInStorageCore,\n} from '@intlayer/core/utils';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\n/**\n * Get the locale cookie\n */\n/**\n * Get the locale cookie\n */\nexport const localeInStorage = getLocaleFromStorageClient(localeStorageOptions);\n/**\n * @deprecated Use localeInStorage instead\n *\n * Get the locale cookie\n */\nexport const localeCookie = localeInStorage;\n\n/**\n * Set the locale cookie\n */\nexport const setLocaleInStorage = (\n locale: LocalesValues,\n isCookieEnabled: boolean\n) =>\n setLocaleInStorageCore(locale, {\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use setLocaleInStorage instead\n *\n * Set the locale cookie\n */\nexport const setLocaleCookie = setLocaleInStorage;\n\n/**\n * Hook that provides the locale storage and a function to set it\n */\nexport const useLocaleStorage = (isCookieEnabled?: boolean) =>\n LocaleStorageClient({\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use useLocaleStorage instead\n *\n * For GDPR compliance, use useLocaleStorage instead\n *\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleCookie = (isCookieEnabled?: boolean) => {\n const storage = useLocaleStorage(isCookieEnabled);\n\n return {\n localeCookie: storage.getLocale(),\n setLocaleCookie: storage.setLocale,\n };\n};\n"],"mappings":";;;;;;;;;;AAcA,MAAa,sBAAkBA,iDAA2BC,yCAAoB;;;;;;AAM9E,MAAa,eAAe;;;;AAK5B,MAAa,sBACX,QACA,wBAEAC,+CAAuB,QAAQ;CAC7B,GAAGD;CACH;AACF,CAAC;;;;;;AAOH,MAAa,kBAAkB;;;;AAK/B,MAAa,oBAAoB,wBAC/BE,0CAAoB;CAClB,GAAGF;CACH;AACF,CAAC;;;;;;;;AASH,MAAa,mBAAmB,oBAA8B;CAC5D,MAAM,UAAU,iBAAiB,eAAe;CAEhD,OAAO;EACL,cAAc,QAAQ,UAAU;EAChC,iBAAiB,QAAQ;CAC3B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"usePathname.cjs","names":["DestroyRef"],"sources":["../../../src/client/usePathname.ts"],"sourcesContent":["import {\n computed,\n DestroyRef,\n inject,\n type Signal,\n signal,\n} from '@angular/core';\nimport { getPathWithoutLocale } from '@intlayer/core/localization';\n\n/**\n * Angular hook that returns a signal containing the current pathname with\n * the locale segment removed.\n *\n * Reacts to browser back/forward navigation via the `popstate` event.\n * Uses `DestroyRef` to clean up the event listener when the component is destroyed.\n * Falls back to an empty string during server-side rendering.\n *\n * @returns A signal containing the current pathname without the locale prefix.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { usePathname } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-nav-item',\n * template: `\n * <a [class.active]=\"pathname() === '/dashboard'\" href=\"/dashboard\">\n * Dashboard\n * </a>\n * `,\n * })\n * export class NavItem {\n * readonly pathname = usePathname();\n * }\n * ```\n */\nexport const usePathname = (): Signal<string> => {\n const destroyRef = inject(DestroyRef);\n\n const rawPathname = signal<string>(\n typeof window !== 'undefined' ? window.location.pathname : ''\n );\n\n if (typeof window !== 'undefined') {\n const handleLocationChange = (): void => {\n rawPathname.set(window.location.pathname);\n };\n\n window.addEventListener('popstate', handleLocationChange);\n\n destroyRef.onDestroy(() => {\n window.removeEventListener('popstate', handleLocationChange);\n });\n }\n\n return computed(() => getPathWithoutLocale(rawPathname()));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,oBAAoC;CAC/C,MAAM,uCAAoBA,wBAAU;CAEpC,MAAM,wCACJ,OAAO,WAAW,cAAc,OAAO,SAAS,WAAW,EAC7D;CAEA,IAAI,OAAO,WAAW,aAAa;EACjC,MAAM,6BAAmC;GACvC,YAAY,IAAI,OAAO,SAAS,QAAQ;EAC1C;EAEA,OAAO,iBAAiB,YAAY,oBAAoB;EAExD,WAAW,gBAAgB;GACzB,OAAO,oBAAoB,YAAY,oBAAoB;EAC7D,CAAC;CACH;CAEA,+FAA2C,YAAY,CAAC,CAAC;AAC3D"}
1
+ {"version":3,"file":"usePathname.cjs","names":["inject","DestroyRef","signal","computed","getPathWithoutLocale"],"sources":["../../../src/client/usePathname.ts"],"sourcesContent":["import {\n computed,\n DestroyRef,\n inject,\n type Signal,\n signal,\n} from '@angular/core';\nimport { getPathWithoutLocale } from '@intlayer/core/localization';\n\n/**\n * Angular hook that returns a signal containing the current pathname with\n * the locale segment removed.\n *\n * Reacts to browser back/forward navigation via the `popstate` event.\n * Uses `DestroyRef` to clean up the event listener when the component is destroyed.\n * Falls back to an empty string during server-side rendering.\n *\n * @returns A signal containing the current pathname without the locale prefix.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { usePathname } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-nav-item',\n * template: `\n * <a [class.active]=\"pathname() === '/dashboard'\" href=\"/dashboard\">\n * Dashboard\n * </a>\n * `,\n * })\n * export class NavItem {\n * readonly pathname = usePathname();\n * }\n * ```\n */\nexport const usePathname = (): Signal<string> => {\n const destroyRef = inject(DestroyRef);\n\n const rawPathname = signal<string>(\n typeof window !== 'undefined' ? window.location.pathname : ''\n );\n\n if (typeof window !== 'undefined') {\n const handleLocationChange = (): void => {\n rawPathname.set(window.location.pathname);\n };\n\n window.addEventListener('popstate', handleLocationChange);\n\n destroyRef.onDestroy(() => {\n window.removeEventListener('popstate', handleLocationChange);\n });\n }\n\n return computed(() => getPathWithoutLocale(rawPathname()));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,oBAAoC;CAC/C,MAAM,iBAAaA,sBAAOC,wBAAU;CAEpC,MAAM,kBAAcC,sBAClB,OAAO,WAAW,cAAc,OAAO,SAAS,WAAW,EAC7D;CAEA,IAAI,OAAO,WAAW,aAAa;EACjC,MAAM,6BAAmC;GACvC,YAAY,IAAI,OAAO,SAAS,QAAQ;EAC1C;EAEA,OAAO,iBAAiB,YAAY,oBAAoB;EAExD,WAAW,gBAAgB;GACzB,OAAO,oBAAoB,YAAY,oBAAoB;EAC7D,CAAC;CACH;CAEA,WAAOC,kCAAeC,kDAAqB,YAAY,CAAC,CAAC;AAC3D"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_decorateMetadata = require('../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorateMetadata.cjs');
3
- const require_decorate = require('../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.cjs');
2
+ const require_decorateMetadata = require('../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorateMetadata.cjs');
3
+ const require_decorate = require('../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.cjs');
4
4
  let _angular_core = require("@angular/core");
5
5
 
6
6
  //#region src/editor/ContentSelector.component.ts
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelector.component.cjs","names":["CUSTOM_ELEMENTS_SCHEMA"],"sources":["../../../src/editor/ContentSelector.component.ts"],"sourcesContent":["import { Component, CUSTOM_ELEMENTS_SCHEMA, Input } from '@angular/core';\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <intlayer-content-selector-wrapper\n [attr.key-path]=\"keyPathJson\"\n [attr.dictionary-key]=\"dictionaryKey\"\n >\n <ng-content></ng-content>\n </intlayer-content-selector-wrapper>\n `,\n})\nexport class ContentSelectorWrapperComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n get keyPathJson() {\n return JSON.stringify(this.keyPath);\n }\n}\n"],"mappings":";;;;;;AAeO,IAAM,kCAAN,MAAM,gCAAgC;CAC3C,AAAS;CACT,AAAS;CAET,IAAI,cAAc;EAChB,OAAO,KAAK,UAAU,KAAK,OAAO;CACpC;AACF;mDANS;mDACA;yFAfE;CACT,UAAU;CACV,YAAY;CACZ,SAAS,CAACA,oCAAsB;CAChC,UAAU;;;;;;;;AAQZ,CAAC"}
1
+ {"version":3,"file":"ContentSelector.component.cjs","names":["Input","Component","CUSTOM_ELEMENTS_SCHEMA"],"sources":["../../../src/editor/ContentSelector.component.ts"],"sourcesContent":["import { Component, CUSTOM_ELEMENTS_SCHEMA, Input } from '@angular/core';\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <intlayer-content-selector-wrapper\n [attr.key-path]=\"keyPathJson\"\n [attr.dictionary-key]=\"dictionaryKey\"\n >\n <ng-content></ng-content>\n </intlayer-content-selector-wrapper>\n `,\n})\nexport class ContentSelectorWrapperComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n get keyPathJson() {\n return JSON.stringify(this.keyPath);\n }\n}\n"],"mappings":";;;;;;AAeO,IAAM,kCAAN,MAAM,gCAAgC;CAC3C,AAAS;CACT,AAAS;CAET,IAAI,cAAc;EAChB,OAAO,KAAK,UAAU,KAAK,OAAO;CACpC;AACF;8BANGA,qBAAM;8BACNA,qBAAM;gEAfRC,yBAAU;CACT,UAAU;CACV,YAAY;CACZ,SAAS,CAACC,oCAAsB;CAChC,UAAU;;;;;;;;AAQZ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_decorateMetadata = require('../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorateMetadata.cjs');
3
- const require_decorate = require('../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.cjs');
2
+ const require_decorateMetadata = require('../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorateMetadata.cjs');
3
+ const require_decorate = require('../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.cjs');
4
4
  const require_editor_useEditor = require('./useEditor.cjs');
5
5
  let _angular_core = require("@angular/core");
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"EditorProvider.component.cjs","names":[],"sources":["../../../src/editor/EditorProvider.component.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { useEditor } from './useEditor';\n\n/**\n * Drop-in Angular equivalent of React's `EditorProvider`.\n *\n * Wrap your root component (or any subtree) with this component to automatically\n * start the Intlayer editor client. The editor will be started on mount and\n * stopped when this component is destroyed.\n *\n * @example\n * ```html\n * <!-- app.component.html -->\n * <intlayer-editor-provider>\n * <router-outlet />\n * </intlayer-editor-provider>\n * ```\n *\n * ```ts\n * // app.component.ts\n * import { EditorProviderComponent } from 'angular-intlayer';\n *\n * @Component({\n * imports: [EditorProviderComponent],\n * …\n * })\n * export class AppComponent {}\n * ```\n */\n@Component({\n selector: 'intlayer-editor-provider',\n standalone: true,\n template: `<ng-content />`,\n})\nexport class EditorProviderComponent {\n constructor() {\n useEditor();\n }\n}\n"],"mappings":";;;;;;;AAkCO,IAAM,0BAAN,MAAM,wBAAwB;CACnC,cAAc;EACZ,mCAAU;CACZ;AACF;iFATW;CACT,UAAU;CACV,YAAY;CACZ,UAAU;AACZ,CAAC"}
1
+ {"version":3,"file":"EditorProvider.component.cjs","names":["Component"],"sources":["../../../src/editor/EditorProvider.component.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { useEditor } from './useEditor';\n\n/**\n * Drop-in Angular equivalent of React's `EditorProvider`.\n *\n * Wrap your root component (or any subtree) with this component to automatically\n * start the Intlayer editor client. The editor will be started on mount and\n * stopped when this component is destroyed.\n *\n * @example\n * ```html\n * <!-- app.component.html -->\n * <intlayer-editor-provider>\n * <router-outlet />\n * </intlayer-editor-provider>\n * ```\n *\n * ```ts\n * // app.component.ts\n * import { EditorProviderComponent } from 'angular-intlayer';\n *\n * @Component({\n * imports: [EditorProviderComponent],\n * …\n * })\n * export class AppComponent {}\n * ```\n */\n@Component({\n selector: 'intlayer-editor-provider',\n standalone: true,\n template: `<ng-content />`,\n})\nexport class EditorProviderComponent {\n constructor() {\n useEditor();\n }\n}\n"],"mappings":";;;;;;;AAkCO,IAAM,0BAAN,MAAM,wBAAwB;CACnC,cAAc;EACZ,mCAAU;CACZ;AACF;wDATCA,yBAAU;CACT,UAAU;CACV,YAAY;CACZ,UAAU;AACZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEditor.cjs","names":["isEnabled","DestroyRef","Injector","INTLAYER_TOKEN"],"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import {\n DestroyRef,\n effect,\n Injector,\n inject,\n provideAppInitializer,\n runInInjectionContext,\n signal,\n} from '@angular/core';\nimport type { EditorStateManager } from '@intlayer/editor';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { Locale } from '@intlayer/types/allLocales';\n// Import from the standalone token file to avoid a circular dependency:\n// installIntlayer.ts → useEditor.ts → ../client → installIntlayer.ts\nimport { INTLAYER_TOKEN, type IntlayerProvider } from '../client/intlayerToken';\n\n/**\n * Initialises the Intlayer editor client singleton when the editor is enabled.\n * Syncs the current locale from the provided Intlayer client into the editor\n * manager so the editor always knows which locale the app is displaying.\n *\n * Must be called inside an Angular injection context (e.g. a component\n * constructor, `provideAppInitializer`, or `runInInjectionContext`).\n *\n * @param client - The IntlayerProvider instance to sync locale from.\n * When omitted the function injects `INTLAYER_TOKEN` from the DI tree,\n * so it still works when called directly from a component.\n */\nexport const useEditor = (client?: IntlayerProvider | null): void => {\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) return;\n\n const destroyRef = inject(DestroyRef, { optional: true });\n const injector = inject(Injector);\n\n // Resolve the client: use the passed-in reference or fall back to injection.\n const resolvedClient =\n client ??\n inject<IntlayerProvider>(INTLAYER_TOKEN, { optional: true } as any);\n\n // `manager` signal is set once the async import resolves.\n // Using a signal lets an `effect()` react to it becoming available.\n const manager = signal<EditorStateManager | null>(null);\n\n // Guard: prevents the async callback from acting after the view is destroyed.\n let stopped = false;\n\n // Initialise the editor client\n import('@intlayer/editor').then(({ initEditorClient }) => {\n if (stopped) return;\n manager.set(initEditorClient());\n });\n\n // Keep the editor locale in sync with the Angular locale signal\n const effectRef = runInInjectionContext(injector, () =>\n effect(() => {\n const m = manager();\n const locale = resolvedClient?.locale();\n if (m && locale) m.currentLocale.set(locale as Locale);\n })\n );\n\n // Tear down on destroy\n destroyRef?.onDestroy(() => {\n stopped = true;\n effectRef.destroy();\n manager.set(null);\n import('@intlayer/editor').then(({ stopEditorClient }) => {\n stopEditorClient();\n });\n });\n};\n\n/**\n * Angular provider that wires `useEditor` into the application initialisation\n * phase via `provideAppInitializer`.\n *\n * `provideIntlayer()` already calls this internally, so you only need this\n * function when you want to manage providers individually.\n *\n * @example\n * ```ts\n * // app.config.ts\n * import { provideIntlayer, provideIntlayerEditor } from 'angular-intlayer';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [provideIntlayer(), provideIntlayerEditor()],\n * };\n * ```\n */\nexport const provideIntlayerEditor = (client?: IntlayerProvider | null) =>\n provideAppInitializer(() => useEditor(client));\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,MAAa,aAAa,WAA2C;CACnE,IAAI,QAAQ,IAAI,4BAA4B,WAAW,CAACA,sCAAW;CAEnE,MAAM,uCAAoBC,0BAAY,EAAE,UAAU,KAAK,CAAC;CACxD,MAAM,qCAAkBC,sBAAQ;CAGhC,MAAM,iBACJ,oCACyBC,6CAAgB,EAAE,UAAU,KAAK,CAAQ;CAIpE,MAAM,oCAA4C,IAAI;CAGtD,IAAI,UAAU;CAGd,OAAO,mBAAmB,CAAC,MAAM,EAAE,uBAAuB;EACxD,IAAI,SAAS;EACb,QAAQ,IAAI,iBAAiB,CAAC;CAChC,CAAC;CAGD,MAAM,qDAAkC,gDACzB;EACX,MAAM,IAAI,QAAQ;EAClB,MAAM,SAAS,gBAAgB,OAAO;EACtC,IAAI,KAAK,QAAQ,EAAE,cAAc,IAAI,MAAgB;CACvD,CAAC,CACH;CAGA,YAAY,gBAAgB;EAC1B,UAAU;EACV,UAAU,QAAQ;EAClB,QAAQ,IAAI,IAAI;EAChB,OAAO,mBAAmB,CAAC,MAAM,EAAE,uBAAuB;GACxD,iBAAiB;EACnB,CAAC;CACH,CAAC;AACH;;;;;;;;;;;;;;;;;;AAmBA,MAAa,yBAAyB,0DACR,UAAU,MAAM,CAAC"}
1
+ {"version":3,"file":"useEditor.cjs","names":["isEnabled","inject","DestroyRef","Injector","INTLAYER_TOKEN","signal","runInInjectionContext","effect","provideAppInitializer"],"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import {\n DestroyRef,\n effect,\n Injector,\n inject,\n provideAppInitializer,\n runInInjectionContext,\n signal,\n} from '@angular/core';\nimport type { EditorStateManager } from '@intlayer/editor';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { Locale } from '@intlayer/types/allLocales';\n// Import from the standalone token file to avoid a circular dependency:\n// installIntlayer.ts → useEditor.ts → ../client → installIntlayer.ts\nimport { INTLAYER_TOKEN, type IntlayerProvider } from '../client/intlayerToken';\n\n/**\n * Initialises the Intlayer editor client singleton when the editor is enabled.\n * Syncs the current locale from the provided Intlayer client into the editor\n * manager so the editor always knows which locale the app is displaying.\n *\n * Must be called inside an Angular injection context (e.g. a component\n * constructor, `provideAppInitializer`, or `runInInjectionContext`).\n *\n * @param client - The IntlayerProvider instance to sync locale from.\n * When omitted the function injects `INTLAYER_TOKEN` from the DI tree,\n * so it still works when called directly from a component.\n */\nexport const useEditor = (client?: IntlayerProvider | null): void => {\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) return;\n\n const destroyRef = inject(DestroyRef, { optional: true });\n const injector = inject(Injector);\n\n // Resolve the client: use the passed-in reference or fall back to injection.\n const resolvedClient =\n client ??\n inject<IntlayerProvider>(INTLAYER_TOKEN, { optional: true } as any);\n\n // `manager` signal is set once the async import resolves.\n // Using a signal lets an `effect()` react to it becoming available.\n const manager = signal<EditorStateManager | null>(null);\n\n // Guard: prevents the async callback from acting after the view is destroyed.\n let stopped = false;\n\n // Initialise the editor client\n import('@intlayer/editor').then(({ initEditorClient }) => {\n if (stopped) return;\n manager.set(initEditorClient());\n });\n\n // Keep the editor locale in sync with the Angular locale signal\n const effectRef = runInInjectionContext(injector, () =>\n effect(() => {\n const m = manager();\n const locale = resolvedClient?.locale();\n if (m && locale) m.currentLocale.set(locale as Locale);\n })\n );\n\n // Tear down on destroy\n destroyRef?.onDestroy(() => {\n stopped = true;\n effectRef.destroy();\n manager.set(null);\n import('@intlayer/editor').then(({ stopEditorClient }) => {\n stopEditorClient();\n });\n });\n};\n\n/**\n * Angular provider that wires `useEditor` into the application initialisation\n * phase via `provideAppInitializer`.\n *\n * `provideIntlayer()` already calls this internally, so you only need this\n * function when you want to manage providers individually.\n *\n * @example\n * ```ts\n * // app.config.ts\n * import { provideIntlayer, provideIntlayerEditor } from 'angular-intlayer';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [provideIntlayer(), provideIntlayerEditor()],\n * };\n * ```\n */\nexport const provideIntlayerEditor = (client?: IntlayerProvider | null) =>\n provideAppInitializer(() => useEditor(client));\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,MAAa,aAAa,WAA2C;CACnE,IAAI,QAAQ,IAAI,4BAA4B,WAAW,CAACA,sCAAW;CAEnE,MAAM,iBAAaC,sBAAOC,0BAAY,EAAE,UAAU,KAAK,CAAC;CACxD,MAAM,eAAWD,sBAAOE,sBAAQ;CAGhC,MAAM,iBACJ,cACAF,sBAAyBG,6CAAgB,EAAE,UAAU,KAAK,CAAQ;CAIpE,MAAM,cAAUC,sBAAkC,IAAI;CAGtD,IAAI,UAAU;CAGd,OAAO,mBAAmB,CAAC,MAAM,EAAE,uBAAuB;EACxD,IAAI,SAAS;EACb,QAAQ,IAAI,iBAAiB,CAAC;CAChC,CAAC;CAGD,MAAM,gBAAYC,qCAAsB,oBACtCC,4BAAa;EACX,MAAM,IAAI,QAAQ;EAClB,MAAM,SAAS,gBAAgB,OAAO;EACtC,IAAI,KAAK,QAAQ,EAAE,cAAc,IAAI,MAAgB;CACvD,CAAC,CACH;CAGA,YAAY,gBAAgB;EAC1B,UAAU;EACV,UAAU,QAAQ;EAClB,QAAQ,IAAI,IAAI;EAChB,OAAO,mBAAmB,CAAC,MAAM,EAAE,uBAAuB;GACxD,iBAAiB;EACnB,CAAC;CACH,CAAC;AACH;;;;;;;;;;;;;;;;;;AAmBA,MAAa,yBAAyB,eACpCC,2CAA4B,UAAU,MAAM,CAAC"}
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  let node_path = require("node:path");
3
- let _intlayer_config_node = require("@intlayer/config/node");
4
- let _intlayer_config_utils = require("@intlayer/config/utils");
5
3
  let _intlayer_config_envVars = require("@intlayer/config/envVars");
6
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
5
+ let _intlayer_config_node = require("@intlayer/config/node");
6
+ let _intlayer_config_utils = require("@intlayer/config/utils");
7
7
  let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
8
8
  let _intlayer_engine_build = require("@intlayer/engine/build");
9
9
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
@@ -88,7 +88,7 @@ const intlayerEsbuildPlugin = (options) => {
88
88
  }
89
89
  if (!preparePromise) preparePromise = (0, _intlayer_engine_build.prepareIntlayer)(config, {
90
90
  clean: isProduction,
91
- cacheTimeoutMs: isProduction ? 1e3 * 30 : 1e3 * 60 * 60,
91
+ cacheTimeoutMs: isProduction ? 3e4 : 36e5,
92
92
  env: isProduction ? "prod" : "dev"
93
93
  });
94
94
  await preparePromise;