lit-intlayer 9.5.3 → 9.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/format/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/client/useDictionary.mjs +4 -4
- package/dist/esm/client/useDictionaryDynamic.mjs +10 -10
- package/dist/esm/client/useIntlayer.mjs +8 -8
- package/dist/esm/format/index.mjs +9 -9
- package/dist/esm/index.mjs +6 -6
- package/dist/esm/plugins.mjs +53 -53
- package/dist/types/client/useLocaleStorage.d.ts +4 -4
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://intlayer.org" rel="">
|
|
3
|
-
<img src="https://raw.githubusercontent.com/aymericzip/intlayer/main/docs/assets/cover.
|
|
3
|
+
<img src="https://raw.githubusercontent.com/aymericzip/intlayer/main/docs/assets/cover.webp" width="60%" alt="Intlayer Logo" />
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -49,10 +49,10 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
|
|
|
49
49
|
|
|
50
50
|
| Feature | Description |
|
|
51
51
|
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
52
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.
|
|
52
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.webp?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
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
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.
|
|
55
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.webp?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
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
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
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) |
|
|
@@ -60,12 +60,12 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
|
|
|
60
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
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
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.
|
|
64
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.
|
|
65
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.
|
|
63
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.webp?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.webp?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.webp?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
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
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.
|
|
68
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.webp?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
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
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
|
|
|
@@ -262,7 +262,7 @@ Intlayer connects **developers**, **copywriters**, and **AI agents** in one work
|
|
|
262
262
|
- Feature flags
|
|
263
263
|
- Headless CMSs (e.g. Contentful, Strapi, Sanity)
|
|
264
264
|
|
|
265
|
-

|
|
266
266
|
|
|
267
267
|
## 🌐 Readme in other languages
|
|
268
268
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("./IntlayerBinding.cjs"),n=require("../getDictionary.cjs");let r=require("@intlayer/config/built"),i=require("@intlayer/core/dictionaryManipulator");var a=(a,o)=>{let s=e.r(),c=process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&typeof o==`object`&&o?o.locale:o,l=e=>process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?n.getDictionary(a,e):n.getDictionary(a,(0,i.resolveDictionaryArgument)({localeOrSelector:o,contextLocale:e,contextVariant:s.variant,dictionaryKey:a.key})),u=l(c??s.locale??r.internationalization.defaultLocale);s.subscribe(e=>{u=l(c??e)});let d,f=new Proxy({},{get(e,t){if(t===`observe`)return d;if(t===Symbol.toPrimitive)return()=>u?.[Symbol.toPrimitive]?.()??``;if(t===`toString`)return()=>String(u?.toString?.()??``);if(t!==`then`&&u!=null)return u[t]}});return d=e=>(new t.IntlayerBinding(e),f),f};exports.useDictionary=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("./IntlayerBinding.cjs"),n=require("../getDictionary.cjs");let r=require("@intlayer/config/built"),i=require("@intlayer/core/dictionaryManipulator");var a=new Map,o=async(e,t)=>{if(!t)return;if(a.has(e))return a.get(e);let n=await t();return a.set(e,n),n},s=new Proxy(()=>{},{get:(e,t)=>{if(t===Symbol.toPrimitive||t===`toString`)return()=>``;if(t!==`then`&&!(typeof t==`string`&&t.startsWith(`_$`))&&t!==`nodeType`&&t!==Symbol.iterator)return s},apply:()=>s,construct:()=>({})}),c=(c,l,u)=>{let d=e.r(),f=process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&(0,i.isQualifiedDynamicLoaderMap)(c),{locale:p,selector:m}=process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?{locale:u,selector:void 0}:(0,i.parseDictionarySelector)((0,i.resolveDictionaryArgument)({localeOrSelector:u,contextLocale:d.locale,contextVariant:d.variant,dictionaryKey:String(l)})),h=()=>p??d.locale??r.internationalization.defaultLocale,g,_=new Set,v=()=>{for(let e of _)e()},y=e=>{if(f){(0,i.resolveQualifiedDynamicContentAsync)({loaderMap:c,key:String(l),locale:e,selector:m,transform:t=>n.getDictionary(t,e)}).then(e=>{g=e,v()});return}let t=`${String(l)}.${e}`,r=(0,i.getPreloadedDictionary)(c,e);if(r){a.set(t,r),g=n.getDictionary(r,e),v();return}let s=c[e];o(t,s).then(t=>{t&&(g=n.getDictionary(t,e),v())})};y(h()),d.subscribe(e=>{y(p??e)});let b,x=new Proxy({},{get(e,t){if(t===`observe`)return b;if(t===Symbol.toPrimitive)return()=>void 0;if(t===`toString`)return()=>``;if(t!==`then`)return g==null?s:g[t]}});return b=e=>{let n=()=>e.requestUpdate();return _.add(n),new t.IntlayerBinding(e,()=>{g!=null&&e.requestUpdate()},()=>{_.delete(n)}),x},x};exports.useDictionaryDynamic=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("./IntlayerBinding.cjs"),n=require("../getIntlayer.cjs");let r=require("@intlayer/config/built"),i=require("@intlayer/core/dictionaryManipulator");var a=(a,o)=>{let s=e.r(),c=process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&typeof o==`object`&&o?o.locale:o,l=e=>process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?n.getIntlayer(a,e):n.getIntlayer(a,(0,i.resolveDictionaryArgument)({localeOrSelector:o,contextLocale:e,contextVariant:s.variant,dictionaryKey:a})),u,d,f=!1,p=new Proxy({},{get(e,n){if(n===`observe`)return e=>(new t.IntlayerBinding(e),p);if(n===Symbol.toPrimitive||n===`toString`)return()=>``;if(n===`then`||typeof n==`symbol`||typeof n==`string`&&n.startsWith(`_$`))return;let i=c??s.locale??r.internationalization.defaultLocale;if((!f||u!==i)&&(d=l(i),u=i,f=!0),d!=null)return d[n]}});return p};exports.useIntlayer=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useCurrency.cjs"),t=require("./useUnit.cjs"),n=require("./useDate.cjs"),r=require("./useCompact.cjs"),i=require("./useIntl.cjs"),a=require("./useList.cjs"),o=require("./useNumber.cjs"),s=require("./usePercentage.cjs"),c=require("./useRelativeTime.cjs");exports.useCompact=r.useCompact,exports.useCurrency=e.useCurrency,exports.useDate=n.useDate,exports.useIntl=i.useIntl,exports.useList=a.useList,exports.useNumber=o.useNumber,exports.usePercentage=s.usePercentage,exports.useRelativeTime=c.useRelativeTime,exports.useUnit=t.useUnit;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../installIntlayer-DOvWQYtw.js"),t=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../installIntlayer-DOvWQYtw.js"),t=require("./client/IntlayerBinding.cjs"),n=require("./plugins.cjs"),r=require("./getDictionary.cjs"),i=require("./client/useDictionary.cjs"),a=require("./client/useDictionaryDynamic.cjs"),o=require("./getIntlayer.cjs"),s=require("./client/useIntlayer.cjs"),c=require("./client/useLocaleStorage.cjs"),l=require("./client/useLocale.cjs"),u=require("./client/useRewriteURL.cjs");require("./client/index.cjs"),exports.IntlayerBinding=t.IntlayerBinding,exports.IntlayerClient=e.t,exports.LocaleController=l.LocaleController,exports.createIntlayerClient=e.n,exports.getDictionary=r.getDictionary,exports.getIntlayer=o.getIntlayer,exports.getIntlayerClient=e.r,exports.getPlugins=n.getPlugins,exports.htmlPlugin=n.htmlPlugin,exports.insertionPlugin=n.insertionPlugin,exports.installIntlayer=e.i,exports.intlayerNodePlugins=n.intlayerNodePlugins,exports.localeCookie=c.localeCookie,exports.localeInStorage=c.localeInStorage,exports.markdownPlugin=n.markdownPlugin,exports.markdownStringPlugin=n.markdownStringPlugin,exports.setLocaleCookie=c.setLocaleCookie,exports.setLocaleInStorage=c.setLocaleInStorage,exports.useDictionary=i.useDictionary,exports.useDictionaryDynamic=a.useDictionaryDynamic,exports.useEditor=e.a,exports.useIntlayer=s.useIntlayer,exports.useLocale=l.useLocale,exports.useLocaleCookie=c.useLocaleCookie,exports.useLocaleStorage=c.useLocaleStorage,exports.useRewriteURL=u.useRewriteURL;
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("../installIntlayer-DOvWQYtw.js"),l=require("./markdown/runtime.cjs"),u=require("./renderIntlayerNode.cjs");let d=require("@intlayer/config/built"),f=require("@intlayer/core/interpreter"),p=require("@intlayer/core/markdown"),m=require("@intlayer/types/nodeType");m=s(m);let h=require("lit/directives/unsafe-html.js"),g=require("lit/static-html.js");var _=(e=``,t={})=>(0,p.compileWithOptions)(e,l.default,t),v=(e,t,n={})=>{let r=typeof e==`string`?(0,h.unsafeHTML)(e):e;return new Proxy(r,{get(e,r,i){if(r===`value`||r===`raw`)return t;if(r===`toString`||r===Symbol.toPrimitive)return()=>t;if(r!==Symbol.iterator)return r===`__update`?()=>{}:r===`isJSX`?!0:r in n?n[r]:Reflect.get(e,r,i)}})},y=e=>e.replace(/&/g,`&`).replace(/"/g,`"`),b=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),x={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:t,keyPath:n,dictionaryKey:r,...i})=>{if(process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled){let e=String(t??``);return v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(n??[]))}" dictionary-key="${y(String(r??``))}">${b(e)}</intlayer-content-selector-wrapper>`,e)}return u.renderIntlayerNode({...i,value:t,children:t})}},S=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?f.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.INSERTION}],i=e[m.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,f.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,f.isInterpolableWrapperNode)(e))return i=>(0,f.transformInterpolableNode)(e,i,n,t.plugins,r);let i=r(e,{...n,children:e,plugins:(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)});return e=>{let a=(0,f.splitInsertionTemplate)(i,e),o=a.isSimple?a.parts:a.parts.join(``);return r(o,{...n,plugins:t.plugins,children:o})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return typeof i==`object`&&i&&`nodeType`in i&&[m.ENUMERATION,m.CONDITION].includes(i.nodeType)?e=>t=>{let n=o(t);return typeof n==`function`?n(e):n}:o}},C=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,{keyPath:a,dictionaryKey:o}=i,s=n((0,p.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>u.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),c=_(e),l=t=>{let n=_(e,{components:t});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(a??[]))}" dictionary-key="${y(String(o??``))}">${n}</intlayer-content-selector-wrapper>`,e):v(n,e)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(a??[]))}" dictionary-key="${y(String(o??``))}">${c}</intlayer-content-selector-wrapper>`,e,{metadata:s,use:l}):v(c,e,{metadata:s,use:l})}},w=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.MARKDOWN}],i=e[m.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[C,...t.plugins??[]]})}},T=process.env.INTLAYER_NODE_TYPE_HTML===`false`?f.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.HTML,transform:(e,t)=>{let n=e[m.HTML],{keyPath:r,dictionaryKey:i}=t,a=(e={})=>{let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e).map(([e,t])=>[e,e=>t(e)])),a=new Proxy(t,{get(e,t){if(typeof t==`string`&&t in e)return e[t];if(typeof t==`string`&&/^[a-z][a-z0-9]*$/.test(t))return e=>g.html`<${(0,g.unsafeStatic)(t)} ...${e}>${e.children}</${(0,g.unsafeStatic)(t)}>`}}),o=(0,f.getHTML)(n,a);return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(r??[]))}" dictionary-key="${y(String(i??``))}">${o}</intlayer-content-selector-wrapper>`,n):v(o,n)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(r??[]))}" dictionary-key="${y(String(i??``))}">${n}</intlayer-content-selector-wrapper>`,n,{use:a}):v(n,n,{use:a})}},E=new Map,D=(e,t=!0)=>{let n=e??(typeof window<`u`&&c.r()?.locale)??d.internationalization.defaultLocale,r=`${n}_${t}`;if(E.has(r))return E.get(r);let i=[(0,f.translationPlugin)(e??d.internationalization.defaultLocale,t?d.internationalization.defaultLocale:void 0),f.enumerationPlugin,(0,f.pluralPlugin)(n),f.conditionPlugin,(0,f.nestedPlugin)(n),f.filePlugin,f.genderPlugin,f.selectPlugin,x,S,w,T];return E.set(r,i),i};exports.getPlugins=D,exports.htmlPlugin=T,exports.insertionPlugin=S,exports.intlayerNodePlugins=x,exports.markdownPlugin=w,exports.markdownStringPlugin=C;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as e } from "../../installIntlayer-DT6bzUDN.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { IntlayerBinding as t } from "./IntlayerBinding.mjs";
|
|
3
|
+
import { getDictionary as n } from "../getDictionary.mjs";
|
|
4
4
|
import { internationalization as r } from "@intlayer/config/built";
|
|
5
5
|
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
//#region src/client/useDictionary.ts
|
|
7
7
|
var a = (a, o) => {
|
|
8
|
-
let s = e(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (e) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ?
|
|
8
|
+
let s = e(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (e) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? n(a, e) : n(a, i({
|
|
9
9
|
localeOrSelector: o,
|
|
10
10
|
contextLocale: e,
|
|
11
11
|
contextVariant: s.variant,
|
|
@@ -20,7 +20,7 @@ var a = (a, o) => {
|
|
|
20
20
|
if (t === "toString") return () => String(u?.toString?.() ?? "");
|
|
21
21
|
if (t !== "then" && u != null) return u[t];
|
|
22
22
|
} });
|
|
23
|
-
return d = (e) => (new
|
|
23
|
+
return d = (e) => (new t(e), f), f;
|
|
24
24
|
};
|
|
25
25
|
//#endregion
|
|
26
26
|
export { a as useDictionary };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as e } from "../../installIntlayer-DT6bzUDN.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { IntlayerBinding as t } from "./IntlayerBinding.mjs";
|
|
3
|
+
import { getDictionary as n } from "../getDictionary.mjs";
|
|
4
4
|
import { internationalization as r } from "@intlayer/config/built";
|
|
5
5
|
import { getPreloadedDictionary as i, isQualifiedDynamicLoaderMap as a, parseDictionarySelector as o, resolveDictionaryArgument as s, resolveQualifiedDynamicContentAsync as c } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
//#region src/client/useDictionaryDynamic.ts
|
|
@@ -34,20 +34,20 @@ var l = /* @__PURE__ */ new Map(), u = async (e, t) => {
|
|
|
34
34
|
key: String(p),
|
|
35
35
|
locale: e,
|
|
36
36
|
selector: v,
|
|
37
|
-
transform: (
|
|
37
|
+
transform: (t) => n(t, e)
|
|
38
38
|
}).then((e) => {
|
|
39
39
|
b = e, S();
|
|
40
40
|
});
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
let
|
|
43
|
+
let t = `${String(p)}.${e}`, r = i(f, e);
|
|
44
44
|
if (r) {
|
|
45
|
-
l.set(
|
|
45
|
+
l.set(t, r), b = n(r, e), S();
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
let a = f[e];
|
|
49
|
-
u(
|
|
50
|
-
|
|
49
|
+
u(t, a).then((t) => {
|
|
50
|
+
t && (b = n(t, e), S());
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
C(y()), h.subscribe((e) => {
|
|
@@ -60,11 +60,11 @@ var l = /* @__PURE__ */ new Map(), u = async (e, t) => {
|
|
|
60
60
|
if (t !== "then") return b == null ? d : b[t];
|
|
61
61
|
} });
|
|
62
62
|
return w = (e) => {
|
|
63
|
-
let
|
|
64
|
-
return x.add(
|
|
63
|
+
let n = () => e.requestUpdate();
|
|
64
|
+
return x.add(n), new t(e, () => {
|
|
65
65
|
b != null && e.requestUpdate();
|
|
66
66
|
}, () => {
|
|
67
|
-
x.delete(
|
|
67
|
+
x.delete(n);
|
|
68
68
|
}), T;
|
|
69
69
|
}, T;
|
|
70
70
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { r as e } from "../../installIntlayer-DT6bzUDN.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { IntlayerBinding as t } from "./IntlayerBinding.mjs";
|
|
3
|
+
import { getIntlayer as n } from "../getIntlayer.mjs";
|
|
4
4
|
import { internationalization as r } from "@intlayer/config/built";
|
|
5
5
|
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
//#region src/client/useIntlayer.ts
|
|
7
7
|
var a = (a, o) => {
|
|
8
|
-
let s = e(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (e) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ?
|
|
8
|
+
let s = e(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (e) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? n(a, e) : n(a, i({
|
|
9
9
|
localeOrSelector: o,
|
|
10
10
|
contextLocale: e,
|
|
11
11
|
contextVariant: s.variant,
|
|
12
12
|
dictionaryKey: a
|
|
13
|
-
})), u, d, f = !1, p = new Proxy({}, { get(e,
|
|
14
|
-
if (
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
13
|
+
})), u, d, f = !1, p = new Proxy({}, { get(e, n) {
|
|
14
|
+
if (n === "observe") return (e) => (new t(e), p);
|
|
15
|
+
if (n === Symbol.toPrimitive || n === "toString") return () => "";
|
|
16
|
+
if (n === "then" || typeof n == "symbol" || typeof n == "string" && n.startsWith("_$")) return;
|
|
17
17
|
let i = c ?? s.locale ?? r.defaultLocale;
|
|
18
|
-
if ((!f || u !== i) && (d = l(i), u = i, f = !0), d != null) return d[
|
|
18
|
+
if ((!f || u !== i) && (d = l(i), u = i, f = !0), d != null) return d[n];
|
|
19
19
|
} });
|
|
20
20
|
return p;
|
|
21
21
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { useCurrency as e } from "./useCurrency.mjs";
|
|
2
|
+
import { useUnit as t } from "./useUnit.mjs";
|
|
3
|
+
import { useDate as n } from "./useDate.mjs";
|
|
4
|
+
import { useCompact as r } from "./useCompact.mjs";
|
|
5
|
+
import { useIntl as i } from "./useIntl.mjs";
|
|
6
|
+
import { useList as a } from "./useList.mjs";
|
|
7
|
+
import { useNumber as o } from "./useNumber.mjs";
|
|
8
8
|
import { usePercentage as s } from "./usePercentage.mjs";
|
|
9
|
-
import {
|
|
10
|
-
export {
|
|
9
|
+
import { useRelativeTime as c } from "./useRelativeTime.mjs";
|
|
10
|
+
export { r as useCompact, e as useCurrency, n as useDate, i as useIntl, a as useList, o as useNumber, s as usePercentage, c as useRelativeTime, t as useUnit };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { a as e, i as t, n, r, t as i } from "../installIntlayer-DT6bzUDN.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { IntlayerBinding as a } from "./client/IntlayerBinding.mjs";
|
|
3
|
+
import { getPlugins as o, htmlPlugin as s, insertionPlugin as c, intlayerNodePlugins as l, markdownPlugin as u, markdownStringPlugin as d } from "./plugins.mjs";
|
|
4
4
|
import { getDictionary as f } from "./getDictionary.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useDictionary as p } from "./client/useDictionary.mjs";
|
|
6
|
+
import { useDictionaryDynamic as m } from "./client/useDictionaryDynamic.mjs";
|
|
7
|
+
import { getIntlayer as h } from "./getIntlayer.mjs";
|
|
8
8
|
import { useIntlayer as g } from "./client/useIntlayer.mjs";
|
|
9
9
|
import { localeCookie as _, localeInStorage as v, setLocaleCookie as y, setLocaleInStorage as b, useLocaleCookie as x, useLocaleStorage as S } from "./client/useLocaleStorage.mjs";
|
|
10
10
|
import { LocaleController as C, useLocale as w } from "./client/useLocale.mjs";
|
|
11
11
|
import { useRewriteURL as T } from "./client/useRewriteURL.mjs";
|
|
12
12
|
import "./client/index.mjs";
|
|
13
|
-
export {
|
|
13
|
+
export { a as IntlayerBinding, i as IntlayerClient, C as LocaleController, n as createIntlayerClient, f as getDictionary, h as getIntlayer, r as getIntlayerClient, o as getPlugins, s as htmlPlugin, c as insertionPlugin, t as installIntlayer, l as intlayerNodePlugins, _ as localeCookie, v as localeInStorage, u as markdownPlugin, d as markdownStringPlugin, y as setLocaleCookie, b as setLocaleInStorage, p as useDictionary, m as useDictionaryDynamic, e as useEditor, g as useIntlayer, w as useLocale, x as useLocaleCookie, S as useLocaleStorage, T as useRewriteURL };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import n from "./
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { r as e } from "../installIntlayer-DT6bzUDN.mjs";
|
|
2
|
+
import t from "./markdown/runtime.mjs";
|
|
3
|
+
import { renderIntlayerNode as n } from "./renderIntlayerNode.mjs";
|
|
4
|
+
import { editor as r, internationalization as i } from "@intlayer/config/built";
|
|
5
|
+
import { conditionPlugin as a, enumerationPlugin as o, fallbackPlugin as s, filePlugin as c, genderPlugin as l, getHTML as u, isInterpolableWrapperNode as d, nestedPlugin as f, pluralPlugin as p, selectPlugin as m, splitInsertionTemplate as h, transformInterpolableNode as g, translationPlugin as _ } from "@intlayer/core/interpreter";
|
|
6
6
|
import { compileWithOptions as v, getMarkdownMetadata as y } from "@intlayer/core/markdown";
|
|
7
7
|
import * as b from "@intlayer/types/nodeType";
|
|
8
8
|
import { unsafeHTML as x } from "lit/directives/unsafe-html.js";
|
|
9
9
|
import { html as S, unsafeStatic as C } from "lit/static-html.js";
|
|
10
10
|
//#region src/plugins.ts
|
|
11
|
-
var w = (e = "",
|
|
11
|
+
var w = (e = "", n = {}) => v(e, t, n), T = (e, t, n = {}) => {
|
|
12
12
|
let r = typeof e == "string" ? x(e) : e;
|
|
13
13
|
return new Proxy(r, { get(e, r, i) {
|
|
14
14
|
if (r === "value" || r === "raw") return t;
|
|
@@ -18,33 +18,33 @@ var w = (e = "", t = {}) => v(e, n, t), T = (e, t, n = {}) => {
|
|
|
18
18
|
}, E = (e) => e.replace(/&/g, "&").replace(/"/g, """), D = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), O = {
|
|
19
19
|
id: "intlayer-node-plugin",
|
|
20
20
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
21
|
-
transform: (
|
|
22
|
-
if (process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
23
|
-
let e = String(
|
|
24
|
-
return T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(
|
|
21
|
+
transform: (e, { children: t, keyPath: i, dictionaryKey: a, ...o }) => {
|
|
22
|
+
if (process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled) {
|
|
23
|
+
let e = String(t ?? "");
|
|
24
|
+
return T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(i ?? []))}" dictionary-key="${E(String(a ?? ""))}">${D(e)}</intlayer-content-selector-wrapper>`, e);
|
|
25
25
|
}
|
|
26
|
-
return
|
|
27
|
-
...
|
|
28
|
-
value:
|
|
29
|
-
children:
|
|
26
|
+
return n({
|
|
27
|
+
...o,
|
|
28
|
+
value: t,
|
|
29
|
+
children: t
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ?
|
|
32
|
+
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? s : {
|
|
33
33
|
id: "insertion-plugin",
|
|
34
34
|
canHandle: (e) => typeof e == "object" && e?.nodeType === b.INSERTION,
|
|
35
35
|
transform: (e, t, n) => {
|
|
36
36
|
let r = [...t.keyPath, { type: b.INSERTION }], i = e[b.INSERTION], a = {
|
|
37
37
|
id: "insertion-string-plugin",
|
|
38
|
-
canHandle: (e) => typeof e == "string" ||
|
|
38
|
+
canHandle: (e) => typeof e == "string" || d(e),
|
|
39
39
|
transform: (e, n, r) => {
|
|
40
|
-
if (
|
|
40
|
+
if (d(e)) return (i) => g(e, i, n, t.plugins, r);
|
|
41
41
|
let i = r(e, {
|
|
42
42
|
...n,
|
|
43
43
|
children: e,
|
|
44
44
|
plugins: (t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")
|
|
45
45
|
});
|
|
46
46
|
return (e) => {
|
|
47
|
-
let a =
|
|
47
|
+
let a = h(i, e), o = a.isSimple ? a.parts : a.parts.join("");
|
|
48
48
|
return r(o, {
|
|
49
49
|
...n,
|
|
50
50
|
plugins: t.plugins,
|
|
@@ -63,35 +63,35 @@ var w = (e = "", t = {}) => v(e, n, t), T = (e, t, n = {}) => {
|
|
|
63
63
|
return typeof n == "function" ? n(e) : n;
|
|
64
64
|
} : o;
|
|
65
65
|
}
|
|
66
|
-
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
66
|
+
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? s : {
|
|
67
67
|
id: "markdown-string-plugin",
|
|
68
68
|
canHandle: (e) => typeof e == "string",
|
|
69
|
-
transform: (
|
|
70
|
-
let { plugins:
|
|
69
|
+
transform: (e, t, i) => {
|
|
70
|
+
let { plugins: a, ...o } = t, { keyPath: s, dictionaryKey: c } = o, l = i(y(e) ?? {}, {
|
|
71
71
|
plugins: [{
|
|
72
72
|
id: "markdown-metadata-plugin",
|
|
73
73
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
74
|
-
transform: (
|
|
74
|
+
transform: (t, r) => n({
|
|
75
75
|
...r,
|
|
76
|
-
value:
|
|
77
|
-
children:
|
|
76
|
+
value: t,
|
|
77
|
+
children: e
|
|
78
78
|
})
|
|
79
79
|
}],
|
|
80
|
-
dictionaryKey:
|
|
80
|
+
dictionaryKey: o.dictionaryKey,
|
|
81
81
|
keyPath: []
|
|
82
|
-
}),
|
|
83
|
-
let n = w(
|
|
84
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
82
|
+
}), u = w(e), d = (t) => {
|
|
83
|
+
let n = w(e, { components: t });
|
|
84
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(s ?? []))}" dictionary-key="${E(String(c ?? ""))}">${n}</intlayer-content-selector-wrapper>`, e) : T(n, e);
|
|
85
85
|
};
|
|
86
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
87
|
-
metadata:
|
|
88
|
-
use:
|
|
89
|
-
}) : T(
|
|
90
|
-
metadata:
|
|
91
|
-
use:
|
|
86
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(s ?? []))}" dictionary-key="${E(String(c ?? ""))}">${u}</intlayer-content-selector-wrapper>`, e, {
|
|
87
|
+
metadata: l,
|
|
88
|
+
use: d
|
|
89
|
+
}) : T(u, e, {
|
|
90
|
+
metadata: l,
|
|
91
|
+
use: d
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
94
|
+
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? s : {
|
|
95
95
|
id: "markdown-plugin",
|
|
96
96
|
canHandle: (e) => typeof e == "object" && e?.nodeType === b.MARKDOWN,
|
|
97
97
|
transform: (e, t, n) => {
|
|
@@ -103,37 +103,37 @@ var w = (e = "", t = {}) => v(e, n, t), T = (e, t, n = {}) => {
|
|
|
103
103
|
plugins: [A, ...t.plugins ?? []]
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
}, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ?
|
|
106
|
+
}, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? s : {
|
|
107
107
|
id: "html-plugin",
|
|
108
108
|
canHandle: (e) => typeof e == "object" && e?.nodeType === b.HTML,
|
|
109
109
|
transform: (e, t) => {
|
|
110
|
-
let n = e[b.HTML], { keyPath:
|
|
111
|
-
let t = Object.fromEntries(Object.entries(e).filter(([, e]) => e).map(([e, t]) => [e, (e) => t(e)])),
|
|
110
|
+
let n = e[b.HTML], { keyPath: i, dictionaryKey: a } = t, o = (e = {}) => {
|
|
111
|
+
let t = Object.fromEntries(Object.entries(e).filter(([, e]) => e).map(([e, t]) => [e, (e) => t(e)])), o = new Proxy(t, { get(e, t) {
|
|
112
112
|
if (typeof t == "string" && t in e) return e[t];
|
|
113
113
|
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return (e) => S`<${C(t)} ...${e}>${e.children}</${C(t)}>`;
|
|
114
|
-
} }),
|
|
115
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
114
|
+
} }), s = u(n, o);
|
|
115
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(i ?? []))}" dictionary-key="${E(String(a ?? ""))}">${s}</intlayer-content-selector-wrapper>`, n) : T(s, n);
|
|
116
116
|
};
|
|
117
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
117
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(i ?? []))}" dictionary-key="${E(String(a ?? ""))}">${n}</intlayer-content-selector-wrapper>`, n, { use: o }) : T(n, n, { use: o });
|
|
118
118
|
}
|
|
119
|
-
}, N = /* @__PURE__ */ new Map(), P = (
|
|
120
|
-
let
|
|
121
|
-
if (N.has(
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
i,
|
|
125
|
-
d(a),
|
|
126
|
-
r,
|
|
127
|
-
u(a),
|
|
119
|
+
}, N = /* @__PURE__ */ new Map(), P = (t, n = !0) => {
|
|
120
|
+
let r = t ?? (typeof window < "u" && e()?.locale) ?? i.defaultLocale, s = `${r}_${n}`;
|
|
121
|
+
if (N.has(s)) return N.get(s);
|
|
122
|
+
let u = [
|
|
123
|
+
_(t ?? i.defaultLocale, n ? i.defaultLocale : void 0),
|
|
128
124
|
o,
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
p(r),
|
|
126
|
+
a,
|
|
127
|
+
f(r),
|
|
128
|
+
c,
|
|
129
|
+
l,
|
|
130
|
+
m,
|
|
131
131
|
O,
|
|
132
132
|
k,
|
|
133
133
|
j,
|
|
134
134
|
M
|
|
135
135
|
];
|
|
136
|
-
return N.set(
|
|
136
|
+
return N.set(s, u), u;
|
|
137
137
|
};
|
|
138
138
|
//#endregion
|
|
139
139
|
export { P as getPlugins, M as htmlPlugin, k as insertionPlugin, O as intlayerNodePlugins, j as markdownPlugin, A as markdownStringPlugin };
|
|
@@ -2,11 +2,11 @@ import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
|
2
2
|
/**
|
|
3
3
|
* Get the current locale from storage (cookie or localStorage).
|
|
4
4
|
*/
|
|
5
|
-
export declare const localeInStorage: import('
|
|
5
|
+
export declare const localeInStorage: import('intlayer').Locale;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use localeInStorage instead.
|
|
8
8
|
*/
|
|
9
|
-
export declare const localeCookie: import('
|
|
9
|
+
export declare const localeCookie: import('intlayer').Locale;
|
|
10
10
|
/**
|
|
11
11
|
* Persist the locale to storage (cookie and/or localStorage).
|
|
12
12
|
*/
|
|
@@ -19,14 +19,14 @@ export declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: b
|
|
|
19
19
|
* Returns the current locale from storage and a setter.
|
|
20
20
|
*/
|
|
21
21
|
export declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
22
|
-
localeStorage: import('
|
|
22
|
+
localeStorage: import('intlayer').Locale;
|
|
23
23
|
setLocaleStorage: (locale: LocalesValues) => void;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* @deprecated Use useLocaleStorage instead.
|
|
27
27
|
*/
|
|
28
28
|
export declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
29
|
-
localeStorage: import('
|
|
29
|
+
localeStorage: import('intlayer').Locale;
|
|
30
30
|
setLocaleStorage: (locale: LocalesValues) => void;
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=useLocaleStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.d.ts","sourceRoot":"","sources":["../../../src/client/useLocaleStorage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","sourceRoot":"","sources":["../../../src/client/useLocaleStorage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,eAAe,2BAAmD,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,YAAY,2BAAkB,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,aAAa,EACrB,iBAAiB,OAAO,SAKtB,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,eAAe,WAXlB,aAAa,mBACJ,OAAO,SAUuB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,kBAAkB,OAAO;;;CAUzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,qBAfuB,OAAO;;;CAeX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-intlayer",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Lit applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -97,17 +97,18 @@
|
|
|
97
97
|
"prepublish": "cp -f ../../README.md ./README.md",
|
|
98
98
|
"publish": "bun publish || true",
|
|
99
99
|
"publish:canary": "bun publish --access public --tag canary || true",
|
|
100
|
+
"publish:ci": "bun ../../scripts/publish-package.mjs",
|
|
100
101
|
"publish:latest": "bun publish --access public --tag latest || true",
|
|
101
102
|
"test": "bun --bun vitest run",
|
|
102
103
|
"test:watch": "bun --bun vitest",
|
|
103
104
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
104
105
|
},
|
|
105
106
|
"dependencies": {
|
|
106
|
-
"@intlayer/api": "9.5.
|
|
107
|
-
"@intlayer/config": "9.5.
|
|
108
|
-
"@intlayer/core": "9.5.
|
|
109
|
-
"@intlayer/editor": "9.5.
|
|
110
|
-
"@intlayer/types": "9.5.
|
|
107
|
+
"@intlayer/api": "9.5.4",
|
|
108
|
+
"@intlayer/config": "9.5.4",
|
|
109
|
+
"@intlayer/core": "9.5.4",
|
|
110
|
+
"@intlayer/editor": "9.5.4",
|
|
111
|
+
"@intlayer/types": "9.5.4"
|
|
111
112
|
},
|
|
112
113
|
"devDependencies": {
|
|
113
114
|
"@types/node": "^22",
|
|
@@ -121,10 +122,10 @@
|
|
|
121
122
|
"typescript": "7.0.2",
|
|
122
123
|
"vite": "8.3.0",
|
|
123
124
|
"vite-plugin-dts": "5.1.0",
|
|
124
|
-
"vitest": "5.0.
|
|
125
|
+
"vitest": "5.0.1"
|
|
125
126
|
},
|
|
126
127
|
"peerDependencies": {
|
|
127
|
-
"intlayer": "9.5.
|
|
128
|
+
"intlayer": "9.5.4",
|
|
128
129
|
"lit": ">=3.0.0"
|
|
129
130
|
},
|
|
130
131
|
"peerDependenciesMeta": {
|