solid-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/analytics/useAnalytics.cjs +1 -1
- package/dist/cjs/client/IntlayerProvider.cjs +1 -1
- package/dist/cjs/client/t.cjs +1 -1
- 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/client/useTraduction.cjs +1 -1
- package/dist/cjs/format/index.cjs +1 -1
- package/dist/cjs/html/HTMLProvider.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/markdown/MarkdownProvider.cjs +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/analytics/useAnalytics.mjs +9 -9
- package/dist/esm/client/IntlayerProvider.mjs +22 -22
- package/dist/esm/client/t.mjs +4 -4
- package/dist/esm/client/useDictionary.mjs +6 -6
- package/dist/esm/client/useDictionaryDynamic.mjs +9 -9
- package/dist/esm/client/useIntlayer.mjs +6 -6
- package/dist/esm/client/useTraduction.mjs +4 -4
- package/dist/esm/format/index.mjs +9 -9
- package/dist/esm/html/HTMLProvider.mjs +5 -5
- package/dist/esm/index.mjs +11 -11
- package/dist/esm/markdown/MarkdownProvider.mjs +16 -16
- package/dist/esm/markdown/MarkdownRenderer.mjs +11 -11
- package/dist/esm/plugins.mjs +86 -86
- package/dist/types/client/useContent.d.ts +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +4 -4
- package/package.json +10 -9
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("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../isEnabled-CuTKz0YA.js"),t=require("../client/IntlayerProvider.cjs"),n=require("./exposureSink.cjs");let r=require("solid-js");var i=()=>{if(process.env.INTLAYER_ANALYTICS_ENABLED===`false`||!e.t)return;let{locale:i}=t.useIntlayerContext(),[a,o]=(0,r.createSignal)(null),s=!1,c=!1;(0,r.onMount)(()=>{Promise.resolve().then(()=>require("../../esm-DXg1m_y3.js")).then(({initAnalyticsClient:e,buildContentExposure:t})=>{if(s)return;let r=e();c=!0;let a=i?.();a&&r.setLocale(a),r.trackPageView({reason:`initial`}),n.setExposureSink(e=>r.trackContentExposure(t(e))),o(r)}).catch(()=>{})});let l;(0,r.createEffect)(()=>{let e=a(),t=i?.();if(e&&t){if(l===void 0){l=t;return}l!==t&&(l=t,e.setLocale(t),e.trackPageView({reason:`locale_change`}))}}),(0,r.onCleanup)(()=>{s=!0,n.setExposureSink(null),Promise.resolve().then(()=>require("../../esm-DXg1m_y3.js")).then(({stopAnalyticsClient:e})=>{c&&e()}).catch(()=>{})})};exports.useAnalytics=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useLocaleStorage.cjs");let t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useLocaleStorage.cjs");let t=require("@intlayer/config/built"),n=require("solid-js"),r=require("@intlayer/core/localization"),i=require("solid-js/web"),a=require("@intlayer/config/client");var o=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,n.lazy)(()=>Promise.resolve().then(()=>require("../editor/EditorProvider.cjs")).then(e=>({default:e.EditorProvider}))),s=process.env.INTLAYER_ANALYTICS_ENABLED===`false`?null:(0,n.lazy)(()=>Promise.resolve().then(()=>require("../analytics/AnalyticsProvider.cjs")).then(e=>({default:e.AnalyticsProvider}))),c=(0,n.createContext)({locale:()=>e.localeInStorage??t.internationalization?.defaultLocale,setLocale:()=>null}),l=()=>(0,n.useContext)(c)??{},u=o=>{let{defaultLocale:s,locales:l}=t.internationalization??{},u=o.locale??e.localeInStorage??o.defaultLocale??s,[d,f]=(0,n.createSignal)(u),p=o.setLocale??(t=>{if(d().toString()!==t.toString()){if(!l?.map(String).includes(t)){console.error(`Locale ${t} is not available`);return}f(t),e.setLocaleInStorage(t,o.isCookieEnabled)}}),m=(0,n.createMemo)(()=>(0,r.localeResolver)(d()));return(0,n.createEffect)((0,n.on)(()=>o.locale,e=>{e&&e!==(0,n.untrack)(d)&&f(e)},{defer:!0})),(0,n.onMount)(()=>{(0,a.setIntlayerIdentifier)()}),(0,i.createComponent)(c.Provider,{value:{locale:m,setLocale:p,variant:()=>o.variant},get children(){return o.children}})},d=e=>(0,i.createComponent)(u,(0,i.mergeProps)(e,{get children(){return[(0,i.memo)(()=>(0,i.memo)(()=>!!(process.env.INTLAYER_EDITOR_ENABLED!==`false`&&o))()&&(0,i.createComponent)(n.Suspense,{get children(){return(0,i.createComponent)(o,{})}})),(0,i.memo)(()=>(0,i.memo)(()=>!!(process.env.INTLAYER_ANALYTICS_ENABLED!==`false`&&s))()&&(0,i.createComponent)(n.Suspense,{get children(){return(0,i.createComponent)(s,{})}})),(0,i.memo)(()=>e.children)]}}));exports.IntlayerClientContext=c,exports.IntlayerProvider=d,exports.IntlayerProviderContent=u,exports.useIntlayerContext=l;
|
package/dist/cjs/client/t.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./IntlayerProvider.cjs");let t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./IntlayerProvider.cjs");let t=require("solid-js"),n=require("@intlayer/core/interpreter");var r=(r,i)=>{let{locale:a}=(0,t.useContext)(e.IntlayerClientContext)??{},o=i??(typeof a==`function`?a():a);return(0,n.getTranslation)(r,o)};exports.t=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./IntlayerProvider.cjs"),t=require("../getDictionary.cjs"),n=require("./useLoadDynamic.cjs");let r=require("solid-js"),i=require("@intlayer/core/dictionaryManipulator");var a=(a,o)=>{let s=(0,r.useContext)(e.IntlayerClientContext)??{},c=(0,r.createMemo)(()=>{let e=s?.locale?.(),r=n.unwrapLoadable(a)??a;return process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?t.getDictionary(r,o??e):t.getDictionary(r,(0,i.resolveDictionaryArgument)({localeOrSelector:o,contextLocale:e,contextVariant:s?.variant?.(),dictionaryKey:a.key}))});return new Proxy(c,{get(e,t){return e()?.[t]},apply(e,t,n){return Reflect.apply(e,t,n)}})};exports.useDictionary=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("./IntlayerProvider.cjs"),t=require("../getDictionary.cjs"),n=require("./useLoadDynamic.cjs"),r=require("./useDictionary.cjs");let i=require("@intlayer/config/built"),a=require("solid-js"),o=require("@intlayer/core/dictionaryManipulator");var s=(s,c,l)=>{let u=(0,a.useContext)(e.IntlayerClientContext)??{},{locale:d}=u,f=i.internationalization.defaultLocale,p=String(c);if(process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&(0,o.isQualifiedDynamicLoaderMap)(s)){let{locale:e,selector:i}=(0,o.parseDictionarySelector)(l),c=()=>(0,o.parseDictionarySelector)((0,o.resolveDictionaryArgument)({localeOrSelector:l,contextLocale:d?.(),contextVariant:u.variant?.(),dictionaryKey:p})).selector,m=s[o.QUALIFIER_DYNAMIC_TYPES_KEY].includes(`item`)&&i?.item===void 0,h=()=>e??d?.()??f;if(!m){let t=n.useLoadDynamic(()=>{let e=h();return{cacheKey:`${p}.${e}.${(0,o.getDictionarySelectorCacheKey)(c())}`,locale:e}},({locale:e})=>(0,o.resolveQualifiedDynamicContentAsync)({loaderMap:s,key:p,locale:e,selector:c(),transform:e=>e}).then(e=>Array.isArray(e)?e[0]:e));return r.useDictionary(t,e)}let[g]=(0,a.createResource)(()=>({locale:h(),selector:c()}),({locale:e,selector:t})=>(0,o.resolveQualifiedDynamicContentAsync)({loaderMap:s,key:p,locale:e,selector:t,transform:e=>e})),_=(0,a.createMemo)(()=>{let e=g(),n=h();return Array.isArray(e)?e.map(e=>t.getDictionary(e,n)):[]});return(0,a.createRenderEffect)(()=>{g()}),new Proxy(_,{get(e,t){return e()?.[t]},apply(e){return e()}})}let m=s,h=l,g=()=>h??d?.()??f,_=()=>{let e=g();return{cacheKey:`${p}.${e}`,locale:e}},v=({locale:e})=>{let t=m[e];return t?t():Promise.reject(Error(`No dynamic dictionary loader found for key "${p}" and locale "${e}".`))},y=(0,o.getPreloadedDictionary)(m,g());y&&n.seedDynamicValue(_(),y);let b=n.useLoadDynamic(_,v);return r.useDictionary(b,h)};exports.useDictionaryDynamic=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./IntlayerProvider.cjs"),t=require("../getIntlayer.cjs");let n=require("solid-js"),r=require("@intlayer/core/dictionaryManipulator");var i=(i,a)=>{let o=(0,n.useContext)(e.IntlayerClientContext)??{},s=(0,n.createMemo)(()=>{let e=o?.locale?.();return process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?t.getIntlayer(i,a??e):t.getIntlayer(i,(0,r.resolveDictionaryArgument)({localeOrSelector:a,contextLocale:e,contextVariant:o?.variant?.(),dictionaryKey:i}))});return new Proxy(s,{get(e,t){return e()?.[t]},apply(e,t,n){return Reflect.apply(e,t,n)}})};exports.useIntlayer=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./IntlayerProvider.cjs");let t=require("@intlayer/config/built"),n=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./IntlayerProvider.cjs");let t=require("@intlayer/config/built"),n=require("solid-js"),r=require("@intlayer/core/interpreter");var i=i=>{let{locale:a}=(0,n.useContext)(e.IntlayerClientContext)??{};return(0,r.getTranslation)(i,a?.()??t.internationalization.defaultLocale)};exports.useTranslation=i;
|
|
@@ -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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("solid-js
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("solid-js"),t=require("solid-js/web");var n=(0,e.createContext)(),r=()=>(0,e.useContext)(n),i=e=>(0,t.createComponent)(n.Provider,{get value(){return{components:e.components}},get children(){return e.children}});exports.HTMLProvider=i,exports.useHTMLContext=r;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./client/getBrowserLocale.cjs"),t=require("./client/useLocaleStorage.cjs"),n=require("./client/IntlayerProvider.cjs"),r=require("./client/t.cjs"),i=require("./getDictionary.cjs"),a=require("./client/useLoadDynamic.cjs"),o=require("./client/useDictionary.cjs"),s=require("./client/useDictionaryAsync.cjs"),c=require("./client/useDictionaryDynamic.cjs"),l=require("./getIntlayer.cjs"),u=require("./client/useIntlayer.cjs"),d=require("./client/useLocale.cjs"),f=require("./client/useLocaleBase.cjs"),p=require("./client/useRewriteURL.cjs"),m=require("./analytics/useAnalytics.cjs"),h=require("./analytics/AnalyticsProvider.cjs"),g=require("./analytics/useConversion.cjs"),_=require("./analytics/useExperiment.cjs");require("./analytics/index.cjs"),exports.AnalyticsProvider=h.AnalyticsProvider,exports.IntlayerClientContext=n.IntlayerClientContext,exports.IntlayerProvider=n.IntlayerProvider,exports.IntlayerProviderContent=n.IntlayerProviderContent,exports.getBrowserLocale=e.getBrowserLocale,exports.getDictionary=i.getDictionary,exports.getIntlayer=l.getIntlayer,exports.localeCookie=t.localeCookie,exports.localeInStorage=t.localeInStorage,exports.setLocaleCookie=t.setLocaleCookie,exports.setLocaleInStorage=t.setLocaleInStorage,exports.t=r.t,exports.useAnalytics=m.useAnalytics,exports.useConversion=g.useConversion,exports.useDictionary=o.useDictionary,exports.useDictionaryAsync=s.useDictionaryAsync,exports.useDictionaryDynamic=c.useDictionaryDynamic,exports.useExperiment=_.useExperiment,exports.useIntlayer=u.useIntlayer,exports.useIntlayerContext=n.useIntlayerContext,exports.useLoadDynamic=a.useLoadDynamic,exports.useLocale=d.useLocale,exports.useLocaleBase=f.useLocaleBase,exports.useLocaleCookie=t.useLocaleCookie,exports.useLocaleStorage=t.useLocaleStorage,exports.useRewriteURL=p.useRewriteURL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./compiler.cjs");let t=require("solid-js
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./compiler.cjs");let t=require("solid-js"),n=require("solid-js/web");var r=(0,t.createContext)(),i=t=>{let i=(n,r,i,a)=>{if(t.renderMarkdown)return t.renderMarkdown(n,r,i,a);let o={forceBlock:r?.forceBlock??t.forceBlock,preserveFrontmatter:r?.preserveFrontmatter??t.preserveFrontmatter,tagfilter:r?.tagfilter??t.tagfilter,wrapper:a||t.wrapper,components:{...t.components,...i??{}}};return e.compileMarkdown(n,o)};return(0,n.createComponent)(r.Provider,{get value(){return{components:t.components,renderMarkdown:i}},get children(){return t.children}})},a=()=>{let e=(0,t.useContext)(r);if(!e)throw Error(`useMarkdown must be used within a MarkdownProvider. To fix this error, wrap your component with <MarkdownProvider>.`);return e};exports.MarkdownContext=r,exports.MarkdownProvider=i,exports.useMarkdown=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./compiler.cjs"),t=require("./MarkdownProvider.cjs");let n=require("solid-js
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./compiler.cjs"),t=require("./MarkdownProvider.cjs");let n=require("solid-js"),r=require("solid-js/web"),i=require("@intlayer/core/dictionaryManipulator"),a=require("@intlayer/core/markdown");var o=(t,n={})=>e.compileMarkdown(t,n),s=(e={})=>{let r=(0,n.useContext)(t.MarkdownContext);return t=>r?r.renderMarkdown(t,{forceBlock:e.forceBlock,preserveFrontmatter:e.preserveFrontmatter,tagfilter:e.tagfilter},e.components,e.wrapper):o(t,e)},c=e=>{let i=(0,n.useContext)(t.MarkdownContext),{renderMarkdown:a}=t.useMarkdown(),[o]=(0,n.createResource)(()=>[e.children,e.forceBlock,e.preserveFrontmatter,e.tagfilter,e.components,e.wrapper],([e,t,n,r,o,s])=>a(e,{forceBlock:t,preserveFrontmatter:n,tagfilter:r},{...i?.components??{},...o??{}},s));return(0,r.createComponent)(n.Suspense,{get children(){return o()}})},l=e=>{let t=(0,n.createMemo)(()=>(0,a.getMarkdownMetadata)(e.children));return(0,n.createMemo)(()=>(0,i.getContentNodeByKeyPath)(t(),e.metadataKeyPath))()};exports.MarkdownMetadataRenderer=l,exports.MarkdownRenderer=c,exports.renderMarkdown=o,exports.useMarkdownRenderer=s;
|
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("./analytics/exposureSink.cjs"),l=require("./IntlayerNode.cjs"),u=require("./solidElement/renderSolidElement.cjs");let d=require("solid-js
|
|
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("./analytics/exposureSink.cjs"),l=require("./IntlayerNode.cjs"),u=require("./solidElement/renderSolidElement.cjs");let d=require("@intlayer/config/built"),f=require("solid-js"),p=require("solid-js/web"),m=require("@intlayer/core/interpreter"),h=require("@intlayer/core/markdown"),g=require("@intlayer/types/nodeType");g=s(g);var _=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,f.lazy)(()=>Promise.resolve().then(()=>require("./editor/ContentSelector.cjs")).then(e=>({default:e.ContentSelector}))),v=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?null:Promise.resolve().then(()=>require("./markdown/MarkdownRenderer.cjs")).then(e=>({MarkdownRenderer:e.MarkdownRenderer,MarkdownMetadataRenderer:e.MarkdownMetadataRenderer})),y=process.env.INTLAYER_NODE_TYPE_HTML===`false`?null:Promise.resolve().then(()=>require("./html/HTMLRenderer.cjs")).then(e=>e.HTMLRenderer);v?.catch(()=>{}),y?.catch(()=>{});var b={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{plugins:t,...n})=>(process.env.INTLAYER_ANALYTICS_ENABLED!==`false`&&c.reportExposure({dictionaryKey:n.dictionaryKey,keyPath:n.keyPath,locale:n.locale,nodeType:`text`}),l.renderIntlayerNode({...n,value:n.children,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,p.createComponent)(f.Suspense,{get fallback(){return n.children},get children(){return(0,p.createComponent)(_,(0,p.mergeProps)(n,{get children(){return n.children}}))}}):n.children}))},x=process.env.INTLAYER_NODE_TYPE_SOLID_NODE===`false`?m.fallbackPlugin:{id:`solid-node-plugin`,canHandle:e=>typeof e==`object`&&e?.props!==void 0||typeof Node<`u`&&e instanceof Node,transform:(e,{plugins:t,...n})=>(process.env.INTLAYER_ANALYTICS_ENABLED!==`false`&&c.reportExposure({dictionaryKey:n.dictionaryKey,keyPath:n.keyPath,locale:n.locale,nodeType:`solid-node`}),l.renderIntlayerNode({...n,value:`[[solid-element]]`,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,p.createComponent)(f.Suspense,{get fallback(){return typeof Node<`u`&&e instanceof Node?e:u.renderSolidElement(e)},get children(){return(0,p.createComponent)(_,(0,p.mergeProps)(n,{get children(){return typeof Node<`u`&&e instanceof Node?e:u.renderSolidElement(e)}}))}}):typeof Node<`u`&&e instanceof Node?e:u.renderSolidElement(e)}))},S=(e,t)=>{let n=(0,m.splitInsertionTemplate)(e,t);return n.isSimple,n.parts},C=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?m.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===g.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:g.INSERTION}],i=e[g.INSERTION];return e=>{let a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,m.isInterpolableWrapperNode)(e),transform:(n,r,i)=>{if((0,m.isInterpolableWrapperNode)(n))return(0,m.transformInterpolableNode)(n,e,r,t.plugins,i);let a=S(i(n,{...r,children:n,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]}),e);return i(a,{...r,plugins:t.plugins,children:a})}};return n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]})}}},w=(0,f.lazy)(()=>v.then(e=>({default:e.MarkdownRenderer}))),T=(0,f.lazy)(()=>v.then(e=>({default:e.MarkdownMetadataRenderer}))),E=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?m.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,a=n((0,h.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>l.renderIntlayerNode({...n,value:t,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,p.createComponent)(f.Suspense,{get children(){return(0,p.createComponent)(_,(0,p.mergeProps)(i,{get children(){return(0,p.createComponent)(T,(0,p.mergeProps)(i,{get metadataKeyPath(){return n.keyPath},children:e}))}}))}}):(0,p.createComponent)(T,(0,p.mergeProps)(i,{get metadataKeyPath(){return n.keyPath},children:e}))})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),o=n=>l.renderIntlayerNode({...t,value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,p.createComponent)(f.Suspense,{get children(){return(0,p.createComponent)(_,(0,p.mergeProps)(i,{get children(){return(0,p.createComponent)(w,(0,p.mergeProps)(i,{components:n,children:e}))}}))}}):(0,p.createComponent)(w,(0,p.mergeProps)(i,{components:n,children:e})),additionalProps:{metadata:a}}),s=o();return new Proxy(s,{get(t,n,r){if(n===`value`)return e;if(n===Symbol.toPrimitive||n===`toString`||n===`valueOf`)return()=>e;if(typeof n==`string`&&n!==`constructor`){let t=String.prototype[n];if(typeof t==`function`)return t.bind(e)}return n===`metadata`?a:n===`use`?e=>o(e):Reflect.get(t,n,r)}})}},D=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?m.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===g.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:g.MARKDOWN}],i=e[g.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[E,...t.plugins??[]]})}},O=(0,f.lazy)(()=>y.then(e=>({default:e}))),k=process.env.INTLAYER_NODE_TYPE_HTML===`false`?m.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===g.HTML,transform:(e,t)=>{let n=e[g.HTML],{plugins:r,children:i,...a}=t,o=e=>l.renderIntlayerNode({...a,value:n,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,p.createComponent)(f.Suspense,{get children(){return(0,p.createComponent)(_,(0,p.mergeProps)(a,{get children(){return(0,p.createComponent)(O,(0,p.mergeProps)(a,{html:n,components:e}))}}))}}):(0,p.createComponent)(O,(0,p.mergeProps)(a,{html:n,components:e}))}),s=[o()];return new Proxy(s,{get(e,t,r){if(t===`value`)return n;if(t===Symbol.toPrimitive||t===`toString`||t===`valueOf`)return()=>n;if(typeof t==`string`&&t!==`constructor`){let e=String.prototype[t];if(typeof e==`function`)return e.bind(n)}return t===`use`?e=>o(e):Reflect.get(e,t,r)}})}},A=new Map,j=(e,t=!0)=>{let n=`${e??d.internationalization.defaultLocale}_${t}`;if(A.has(n))return A.get(n);let r=[(0,m.translationPlugin)(e??d.internationalization.defaultLocale,t?d.internationalization.defaultLocale:void 0),m.enumerationPlugin,(0,m.pluralPlugin)(e??d.internationalization.defaultLocale),m.conditionPlugin,(0,m.nestedPlugin)(e??d.internationalization.defaultLocale),m.filePlugin,m.genderPlugin,m.selectPlugin,b,x,C,D,k];return A.set(n,r),r};exports.getPlugins=j,exports.htmlPlugin=k,exports.insertionPlugin=C,exports.intlayerNodePlugins=b,exports.markdownPlugin=D,exports.markdownStringPlugin=E,exports.solidNodePlugins=x;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "
|
|
3
|
-
import {
|
|
1
|
+
import { t as e } from "../../isEnabled-BbWU6Ox5.mjs";
|
|
2
|
+
import { useIntlayerContext as t } from "../client/IntlayerProvider.mjs";
|
|
3
|
+
import { setExposureSink as n } from "./exposureSink.mjs";
|
|
4
4
|
import { createEffect as r, createSignal as i, onCleanup as a, onMount as o } from "solid-js";
|
|
5
5
|
//#region src/analytics/useAnalytics.tsx
|
|
6
6
|
var s = () => {
|
|
7
|
-
if (process.env.INTLAYER_ANALYTICS_ENABLED === "false" || !
|
|
8
|
-
let { locale: s } =
|
|
7
|
+
if (process.env.INTLAYER_ANALYTICS_ENABLED === "false" || !e) return;
|
|
8
|
+
let { locale: s } = t(), [c, l] = i(null), u = !1, d = !1;
|
|
9
9
|
o(() => {
|
|
10
|
-
import("../../esm-DZ1bEPA6.mjs").then(({ initAnalyticsClient:
|
|
10
|
+
import("../../esm-DZ1bEPA6.mjs").then(({ initAnalyticsClient: e, buildContentExposure: t }) => {
|
|
11
11
|
if (u) return;
|
|
12
|
-
let r =
|
|
12
|
+
let r = e();
|
|
13
13
|
d = !0;
|
|
14
14
|
let i = s?.();
|
|
15
|
-
i && r.setLocale(i), r.trackPageView({ reason: "initial" }),
|
|
15
|
+
i && r.setLocale(i), r.trackPageView({ reason: "initial" }), n((e) => r.trackContentExposure(t(e))), l(r);
|
|
16
16
|
}).catch(() => {});
|
|
17
17
|
});
|
|
18
18
|
let f;
|
|
@@ -26,7 +26,7 @@ var s = () => {
|
|
|
26
26
|
f !== t && (f = t, e.setLocale(t), e.trackPageView({ reason: "locale_change" }));
|
|
27
27
|
}
|
|
28
28
|
}), a(() => {
|
|
29
|
-
u = !0,
|
|
29
|
+
u = !0, n(null), import("../../esm-DZ1bEPA6.mjs").then(({ stopAnalyticsClient: e }) => {
|
|
30
30
|
d && e();
|
|
31
31
|
}).catch(() => {});
|
|
32
32
|
});
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { localeInStorage as e, setLocaleInStorage as t } from "./useLocaleStorage.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { internationalization as n } from "@intlayer/config/built";
|
|
3
|
+
import { Suspense as r, createContext as i, createEffect as a, createMemo as o, createSignal as s, lazy as c, on as l, onMount as u, untrack as d, useContext as f } from "solid-js";
|
|
4
|
+
import { localeResolver as p } from "@intlayer/core/localization";
|
|
5
|
+
import { createComponent as m, memo as h, mergeProps as g } from "solid-js/web";
|
|
6
6
|
import { setIntlayerIdentifier as _ } from "@intlayer/config/client";
|
|
7
7
|
//#region src/client/IntlayerProvider.tsx
|
|
8
|
-
var v = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null :
|
|
9
|
-
locale: () => e ??
|
|
8
|
+
var v = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : c(() => import("../editor/EditorProvider.mjs").then((e) => ({ default: e.EditorProvider }))), y = process.env.INTLAYER_ANALYTICS_ENABLED === "false" ? null : c(() => import("../analytics/AnalyticsProvider.mjs").then((e) => ({ default: e.AnalyticsProvider }))), b = i({
|
|
9
|
+
locale: () => e ?? n?.defaultLocale,
|
|
10
10
|
setLocale: () => null
|
|
11
|
-
}), x = () =>
|
|
12
|
-
let { defaultLocale: i, locales:
|
|
13
|
-
if (
|
|
14
|
-
if (!
|
|
11
|
+
}), x = () => f(b) ?? {}, S = (r) => {
|
|
12
|
+
let { defaultLocale: i, locales: c } = n ?? {}, f = r.locale ?? e ?? r.defaultLocale ?? i, [h, g] = s(f), v = r.setLocale ?? ((e) => {
|
|
13
|
+
if (h().toString() !== e.toString()) {
|
|
14
|
+
if (!c?.map(String).includes(e)) {
|
|
15
15
|
console.error(`Locale ${e} is not available`);
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
g(e), t(e, r.isCookieEnabled);
|
|
19
19
|
}
|
|
20
|
-
}), y =
|
|
21
|
-
return
|
|
22
|
-
e && e !==
|
|
23
|
-
}, { defer: !0 })),
|
|
20
|
+
}), y = o(() => p(h()));
|
|
21
|
+
return a(l(() => r.locale, (e) => {
|
|
22
|
+
e && e !== d(h) && g(e);
|
|
23
|
+
}, { defer: !0 })), u(() => {
|
|
24
24
|
_();
|
|
25
|
-
}),
|
|
25
|
+
}), m(b.Provider, {
|
|
26
26
|
value: {
|
|
27
27
|
locale: y,
|
|
28
28
|
setLocale: v,
|
|
@@ -32,15 +32,15 @@ var v = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : d(() => import(
|
|
|
32
32
|
return r.children;
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
}, C = (e) =>
|
|
35
|
+
}, C = (e) => m(S, g(e, { get children() {
|
|
36
36
|
return [
|
|
37
|
-
|
|
38
|
-
return
|
|
37
|
+
h(() => h(() => !!(process.env.INTLAYER_EDITOR_ENABLED !== "false" && v))() && m(r, { get children() {
|
|
38
|
+
return m(v, {});
|
|
39
39
|
} })),
|
|
40
|
-
|
|
41
|
-
return
|
|
40
|
+
h(() => h(() => !!(process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && y))() && m(r, { get children() {
|
|
41
|
+
return m(y, {});
|
|
42
42
|
} })),
|
|
43
|
-
|
|
43
|
+
h(() => e.children)
|
|
44
44
|
];
|
|
45
45
|
} }));
|
|
46
46
|
//#endregion
|
package/dist/esm/client/t.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useContext as t } from "solid-js";
|
|
3
|
+
import { getTranslation as n } from "@intlayer/core/interpreter";
|
|
4
4
|
//#region src/client/t.ts
|
|
5
5
|
var r = (r, i) => {
|
|
6
|
-
let { locale: a } =
|
|
7
|
-
return
|
|
6
|
+
let { locale: a } = t(e) ?? {}, o = i ?? (typeof a == "function" ? a() : a);
|
|
7
|
+
return n(r, o);
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
10
10
|
export { r as t };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
|
+
import { getDictionary as t } from "../getDictionary.mjs";
|
|
3
3
|
import { unwrapLoadable as n } from "./useLoadDynamic.mjs";
|
|
4
4
|
import { createMemo as r, useContext as i } from "solid-js";
|
|
5
5
|
import { resolveDictionaryArgument as a } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
//#region src/client/useDictionary.ts
|
|
7
7
|
var o = (o, s) => {
|
|
8
|
-
let c = i(
|
|
9
|
-
let
|
|
10
|
-
return process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ?
|
|
8
|
+
let c = i(e) ?? {}, l = r(() => {
|
|
9
|
+
let e = c?.locale?.(), r = n(o) ?? o;
|
|
10
|
+
return process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? t(r, s ?? e) : t(r, a({
|
|
11
11
|
localeOrSelector: s,
|
|
12
|
-
contextLocale:
|
|
12
|
+
contextLocale: e,
|
|
13
13
|
contextVariant: c?.variant?.(),
|
|
14
14
|
dictionaryKey: o.key
|
|
15
15
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
|
+
import { getDictionary as t } from "../getDictionary.mjs";
|
|
3
3
|
import { seedDynamicValue as n, useLoadDynamic as r } from "./useLoadDynamic.mjs";
|
|
4
4
|
import { useDictionary as i } from "./useDictionary.mjs";
|
|
5
5
|
import { internationalization as a } from "@intlayer/config/built";
|
|
@@ -7,16 +7,16 @@ import { createMemo as o, createRenderEffect as s, createResource as c, useConte
|
|
|
7
7
|
import { QUALIFIER_DYNAMIC_TYPES_KEY as u, getDictionarySelectorCacheKey as d, getPreloadedDictionary as f, isQualifiedDynamicLoaderMap as p, parseDictionarySelector as m, resolveDictionaryArgument as h, resolveQualifiedDynamicContentAsync as g } from "@intlayer/core/dictionaryManipulator";
|
|
8
8
|
//#region src/client/useDictionaryDynamic.ts
|
|
9
9
|
var _ = (_, v, y) => {
|
|
10
|
-
let b = l(
|
|
10
|
+
let b = l(e) ?? {}, { locale: x } = b, S = a.defaultLocale, C = String(v);
|
|
11
11
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && p(_)) {
|
|
12
|
-
let { locale:
|
|
12
|
+
let { locale: e, selector: n } = m(y), a = () => m(h({
|
|
13
13
|
localeOrSelector: y,
|
|
14
14
|
contextLocale: x?.(),
|
|
15
15
|
contextVariant: b.variant?.(),
|
|
16
16
|
dictionaryKey: C
|
|
17
|
-
})).selector, l = _[u].includes("item") && n?.item === void 0, f = () =>
|
|
17
|
+
})).selector, l = _[u].includes("item") && n?.item === void 0, f = () => e ?? x?.() ?? S;
|
|
18
18
|
if (!l) {
|
|
19
|
-
let
|
|
19
|
+
let t = r(() => {
|
|
20
20
|
let e = f();
|
|
21
21
|
return {
|
|
22
22
|
cacheKey: `${C}.${e}.${d(a())}`,
|
|
@@ -29,7 +29,7 @@ var _ = (_, v, y) => {
|
|
|
29
29
|
selector: a(),
|
|
30
30
|
transform: (e) => e
|
|
31
31
|
}).then((e) => Array.isArray(e) ? e[0] : e));
|
|
32
|
-
return i(
|
|
32
|
+
return i(t, e);
|
|
33
33
|
}
|
|
34
34
|
let [p] = c(() => ({
|
|
35
35
|
locale: f(),
|
|
@@ -41,8 +41,8 @@ var _ = (_, v, y) => {
|
|
|
41
41
|
selector: t,
|
|
42
42
|
transform: (e) => e
|
|
43
43
|
})), v = o(() => {
|
|
44
|
-
let
|
|
45
|
-
return Array.isArray(
|
|
44
|
+
let e = p(), n = f();
|
|
45
|
+
return Array.isArray(e) ? e.map((e) => t(e, n)) : [];
|
|
46
46
|
});
|
|
47
47
|
return s(() => {
|
|
48
48
|
p();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
|
+
import { getIntlayer as t } from "../getIntlayer.mjs";
|
|
3
3
|
import { createMemo as n, useContext as r } from "solid-js";
|
|
4
4
|
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
5
5
|
//#region src/client/useIntlayer.ts
|
|
6
6
|
var a = (a, o) => {
|
|
7
|
-
let s = r(
|
|
8
|
-
let
|
|
9
|
-
return process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ?
|
|
7
|
+
let s = r(e) ?? {}, c = n(() => {
|
|
8
|
+
let e = s?.locale?.();
|
|
9
|
+
return process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? t(a, o ?? e) : t(a, i({
|
|
10
10
|
localeOrSelector: o,
|
|
11
|
-
contextLocale:
|
|
11
|
+
contextLocale: e,
|
|
12
12
|
contextVariant: s?.variant?.(),
|
|
13
13
|
dictionaryKey: a
|
|
14
14
|
}));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
2
|
import { internationalization as t } from "@intlayer/config/built";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useContext as n } from "solid-js";
|
|
4
|
+
import { getTranslation as r } from "@intlayer/core/interpreter";
|
|
5
5
|
//#region src/client/useTraduction.ts
|
|
6
6
|
var i = (i) => {
|
|
7
|
-
let { locale: a } =
|
|
8
|
-
return
|
|
7
|
+
let { locale: a } = n(e) ?? {};
|
|
8
|
+
return r(i, a?.() ?? t.defaultLocale);
|
|
9
9
|
};
|
|
10
10
|
//#endregion
|
|
11
11
|
export { i as useTranslation };
|
|
@@ -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 };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createContext as e, useContext as t } from "solid-js";
|
|
2
|
+
import { createComponent as n } from "solid-js/web";
|
|
3
3
|
//#region src/html/HTMLProvider.tsx
|
|
4
|
-
var r =
|
|
4
|
+
var r = e(), i = () => t(r), a = (e) => n(r.Provider, {
|
|
5
5
|
get value() {
|
|
6
|
-
return { components:
|
|
6
|
+
return { components: e.components };
|
|
7
7
|
},
|
|
8
8
|
get children() {
|
|
9
|
-
return
|
|
9
|
+
return e.children;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
//#endregion
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { getBrowserLocale as e } from "./client/getBrowserLocale.mjs";
|
|
2
|
+
import { localeCookie as t, localeInStorage as n, setLocaleCookie as r, setLocaleInStorage as i, useLocaleCookie as a, useLocaleStorage as o } from "./client/useLocaleStorage.mjs";
|
|
3
|
+
import { IntlayerClientContext as s, IntlayerProvider as c, IntlayerProviderContent as l, useIntlayerContext as u } from "./client/IntlayerProvider.mjs";
|
|
4
|
+
import { t as d } from "./client/t.mjs";
|
|
5
|
+
import { getDictionary as f } from "./getDictionary.mjs";
|
|
6
|
+
import { useLoadDynamic as p } from "./client/useLoadDynamic.mjs";
|
|
7
|
+
import { useDictionary as m } from "./client/useDictionary.mjs";
|
|
8
|
+
import { useDictionaryAsync as h } from "./client/useDictionaryAsync.mjs";
|
|
9
|
+
import { useDictionaryDynamic as g } from "./client/useDictionaryDynamic.mjs";
|
|
10
|
+
import { getIntlayer as _ } from "./getIntlayer.mjs";
|
|
11
11
|
import { useIntlayer as v } from "./client/useIntlayer.mjs";
|
|
12
12
|
import { useLocale as y } from "./client/useLocale.mjs";
|
|
13
13
|
import { useLocaleBase as b } from "./client/useLocaleBase.mjs";
|
|
@@ -17,4 +17,4 @@ import { AnalyticsProvider as C } from "./analytics/AnalyticsProvider.mjs";
|
|
|
17
17
|
import { useConversion as w } from "./analytics/useConversion.mjs";
|
|
18
18
|
import { useExperiment as T } from "./analytics/useExperiment.mjs";
|
|
19
19
|
import "./analytics/index.mjs";
|
|
20
|
-
export { C as AnalyticsProvider,
|
|
20
|
+
export { C as AnalyticsProvider, s as IntlayerClientContext, c as IntlayerProvider, l as IntlayerProviderContent, e as getBrowserLocale, f as getDictionary, _ as getIntlayer, t as localeCookie, n as localeInStorage, r as setLocaleCookie, i as setLocaleInStorage, d as t, S as useAnalytics, w as useConversion, m as useDictionary, h as useDictionaryAsync, g as useDictionaryDynamic, T as useExperiment, v as useIntlayer, u as useIntlayerContext, p as useLoadDynamic, y as useLocale, b as useLocaleBase, a as useLocaleCookie, o as useLocaleStorage, x as useRewriteURL };
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { compileMarkdown as e } from "./compiler.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { createContext as t, useContext as n } from "solid-js";
|
|
3
|
+
import { createComponent as r } from "solid-js/web";
|
|
4
4
|
//#region src/markdown/MarkdownProvider.tsx
|
|
5
|
-
var i =
|
|
6
|
-
let
|
|
7
|
-
if (
|
|
5
|
+
var i = t(), a = (t) => {
|
|
6
|
+
let n = (n, r, i, a) => {
|
|
7
|
+
if (t.renderMarkdown) return t.renderMarkdown(n, r, i, a);
|
|
8
8
|
let o = {
|
|
9
|
-
forceBlock: r?.forceBlock ??
|
|
10
|
-
preserveFrontmatter: r?.preserveFrontmatter ??
|
|
11
|
-
tagfilter: r?.tagfilter ??
|
|
12
|
-
wrapper: a ||
|
|
9
|
+
forceBlock: r?.forceBlock ?? t.forceBlock,
|
|
10
|
+
preserveFrontmatter: r?.preserveFrontmatter ?? t.preserveFrontmatter,
|
|
11
|
+
tagfilter: r?.tagfilter ?? t.tagfilter,
|
|
12
|
+
wrapper: a || t.wrapper,
|
|
13
13
|
components: {
|
|
14
|
-
...
|
|
14
|
+
...t.components,
|
|
15
15
|
...i ?? {}
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
return e(
|
|
18
|
+
return e(n, o);
|
|
19
19
|
};
|
|
20
|
-
return
|
|
20
|
+
return r(i.Provider, {
|
|
21
21
|
get value() {
|
|
22
22
|
return {
|
|
23
|
-
components:
|
|
24
|
-
renderMarkdown:
|
|
23
|
+
components: t.components,
|
|
24
|
+
renderMarkdown: n
|
|
25
25
|
};
|
|
26
26
|
},
|
|
27
27
|
get children() {
|
|
28
|
-
return
|
|
28
|
+
return t.children;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}, o = () => {
|
|
32
|
-
let e =
|
|
32
|
+
let e = n(i);
|
|
33
33
|
if (!e) throw Error("useMarkdown must be used within a MarkdownProvider. To fix this error, wrap your component with <MarkdownProvider>.");
|
|
34
34
|
return e;
|
|
35
35
|
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { compileMarkdown as e } from "./compiler.mjs";
|
|
2
2
|
import { MarkdownContext as t, useMarkdown as n } from "./MarkdownProvider.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { Suspense as r, createMemo as i, createResource as a, useContext as o } from "solid-js";
|
|
4
|
+
import { createComponent as s } from "solid-js/web";
|
|
5
|
+
import { getContentNodeByKeyPath as c } from "@intlayer/core/dictionaryManipulator";
|
|
6
|
+
import { getMarkdownMetadata as l } from "@intlayer/core/markdown";
|
|
7
7
|
//#region src/markdown/MarkdownRenderer.tsx
|
|
8
8
|
var u = (t, n = {}) => e(t, n), d = (e = {}) => {
|
|
9
|
-
let n =
|
|
9
|
+
let n = o(t);
|
|
10
10
|
return (t) => n ? n.renderMarkdown(t, {
|
|
11
11
|
forceBlock: e.forceBlock,
|
|
12
12
|
preserveFrontmatter: e.preserveFrontmatter,
|
|
13
13
|
tagfilter: e.tagfilter
|
|
14
14
|
}, e.components, e.wrapper) : u(t, e);
|
|
15
15
|
}, f = (e) => {
|
|
16
|
-
let i =
|
|
16
|
+
let i = o(t), { renderMarkdown: c } = n(), [l] = a(() => [
|
|
17
17
|
e.children,
|
|
18
18
|
e.forceBlock,
|
|
19
19
|
e.preserveFrontmatter,
|
|
20
20
|
e.tagfilter,
|
|
21
21
|
e.components,
|
|
22
22
|
e.wrapper
|
|
23
|
-
], ([e, t, n, r, a,
|
|
23
|
+
], ([e, t, n, r, a, o]) => c(e, {
|
|
24
24
|
forceBlock: t,
|
|
25
25
|
preserveFrontmatter: n,
|
|
26
26
|
tagfilter: r
|
|
27
27
|
}, {
|
|
28
28
|
...i?.components ?? {},
|
|
29
29
|
...a ?? {}
|
|
30
|
-
},
|
|
31
|
-
return r
|
|
30
|
+
}, o));
|
|
31
|
+
return s(r, { get children() {
|
|
32
32
|
return l();
|
|
33
33
|
} });
|
|
34
34
|
}, p = (e) => {
|
|
35
|
-
let t =
|
|
36
|
-
return
|
|
35
|
+
let t = i(() => l(e.children));
|
|
36
|
+
return i(() => c(t(), e.metadataKeyPath))();
|
|
37
37
|
};
|
|
38
38
|
//#endregion
|
|
39
39
|
export { p as MarkdownMetadataRenderer, f as MarkdownRenderer, u as renderMarkdown, d as useMarkdownRenderer };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { reportExposure as e } from "./analytics/exposureSink.mjs";
|
|
2
2
|
import { renderIntlayerNode as t } from "./IntlayerNode.mjs";
|
|
3
3
|
import { renderSolidElement as n } from "./solidElement/renderSolidElement.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
4
|
+
import { editor as r, internationalization as i } from "@intlayer/config/built";
|
|
5
|
+
import { Suspense as a, lazy as o } from "solid-js";
|
|
6
|
+
import { createComponent as s, mergeProps as c } from "solid-js/web";
|
|
7
|
+
import { conditionPlugin as l, enumerationPlugin as u, fallbackPlugin as d, filePlugin as f, genderPlugin as p, isInterpolableWrapperNode as m, nestedPlugin as h, pluralPlugin as g, selectPlugin as _, splitInsertionTemplate as v, transformInterpolableNode as y, translationPlugin as b } from "@intlayer/core/interpreter";
|
|
8
|
+
import { getMarkdownMetadata as x } from "@intlayer/core/markdown";
|
|
9
|
+
import * as S from "@intlayer/types/nodeType";
|
|
10
10
|
//#region src/plugins.tsx
|
|
11
|
-
var C = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null :
|
|
11
|
+
var C = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : o(() => import("./editor/ContentSelector.mjs").then((e) => ({ default: e.ContentSelector }))), w = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? null : import("./markdown/MarkdownRenderer.mjs").then((e) => ({
|
|
12
12
|
MarkdownRenderer: e.MarkdownRenderer,
|
|
13
13
|
MarkdownMetadataRenderer: e.MarkdownMetadataRenderer
|
|
14
14
|
})), T = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? null : import("./html/HTMLRenderer.mjs").then((e) => e.HTMLRenderer);
|
|
@@ -16,61 +16,61 @@ w?.catch(() => {}), T?.catch(() => {});
|
|
|
16
16
|
var E = {
|
|
17
17
|
id: "intlayer-node-plugin",
|
|
18
18
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
19
|
-
transform: (n, { plugins:
|
|
20
|
-
dictionaryKey:
|
|
21
|
-
keyPath:
|
|
22
|
-
locale:
|
|
19
|
+
transform: (n, { plugins: i, ...o }) => (process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
|
|
20
|
+
dictionaryKey: o.dictionaryKey,
|
|
21
|
+
keyPath: o.keyPath,
|
|
22
|
+
locale: o.locale,
|
|
23
23
|
nodeType: "text"
|
|
24
24
|
}), t({
|
|
25
|
-
...
|
|
26
|
-
value:
|
|
27
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
25
|
+
...o,
|
|
26
|
+
value: o.children,
|
|
27
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, {
|
|
28
28
|
get fallback() {
|
|
29
|
-
return
|
|
29
|
+
return o.children;
|
|
30
30
|
},
|
|
31
31
|
get children() {
|
|
32
|
-
return
|
|
33
|
-
return
|
|
32
|
+
return s(C, c(o, { get children() {
|
|
33
|
+
return o.children;
|
|
34
34
|
} }));
|
|
35
35
|
}
|
|
36
|
-
}) :
|
|
36
|
+
}) : o.children
|
|
37
37
|
}))
|
|
38
|
-
}, D = process.env.INTLAYER_NODE_TYPE_SOLID_NODE === "false" ?
|
|
38
|
+
}, D = process.env.INTLAYER_NODE_TYPE_SOLID_NODE === "false" ? d : {
|
|
39
39
|
id: "solid-node-plugin",
|
|
40
40
|
canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
|
|
41
|
-
transform: (
|
|
42
|
-
dictionaryKey:
|
|
43
|
-
keyPath:
|
|
44
|
-
locale:
|
|
41
|
+
transform: (i, { plugins: o, ...l }) => (process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
|
|
42
|
+
dictionaryKey: l.dictionaryKey,
|
|
43
|
+
keyPath: l.keyPath,
|
|
44
|
+
locale: l.locale,
|
|
45
45
|
nodeType: "solid-node"
|
|
46
46
|
}), t({
|
|
47
|
-
...
|
|
47
|
+
...l,
|
|
48
48
|
value: "[[solid-element]]",
|
|
49
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
49
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, {
|
|
50
50
|
get fallback() {
|
|
51
|
-
return typeof Node < "u" &&
|
|
51
|
+
return typeof Node < "u" && i instanceof Node ? i : n(i);
|
|
52
52
|
},
|
|
53
53
|
get children() {
|
|
54
|
-
return
|
|
55
|
-
return typeof Node < "u" &&
|
|
54
|
+
return s(C, c(l, { get children() {
|
|
55
|
+
return typeof Node < "u" && i instanceof Node ? i : n(i);
|
|
56
56
|
} }));
|
|
57
57
|
}
|
|
58
|
-
}) : typeof Node < "u" &&
|
|
58
|
+
}) : typeof Node < "u" && i instanceof Node ? i : n(i)
|
|
59
59
|
}))
|
|
60
60
|
}, O = (e, t) => {
|
|
61
|
-
let n =
|
|
61
|
+
let n = v(e, t);
|
|
62
62
|
return n.isSimple, n.parts;
|
|
63
|
-
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ?
|
|
63
|
+
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? d : {
|
|
64
64
|
id: "insertion-plugin",
|
|
65
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
65
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === S.INSERTION,
|
|
66
66
|
transform: (e, t, n) => {
|
|
67
|
-
let r = [...t.keyPath, { type:
|
|
67
|
+
let r = [...t.keyPath, { type: S.INSERTION }], i = e[S.INSERTION];
|
|
68
68
|
return (e) => {
|
|
69
69
|
let a = {
|
|
70
70
|
id: "insertion-string-plugin",
|
|
71
|
-
canHandle: (e) => typeof e == "string" ||
|
|
71
|
+
canHandle: (e) => typeof e == "string" || m(e),
|
|
72
72
|
transform: (n, r, i) => {
|
|
73
|
-
if (
|
|
73
|
+
if (m(n)) return y(n, e, r, t.plugins, i);
|
|
74
74
|
let a = O(i(n, {
|
|
75
75
|
...r,
|
|
76
76
|
children: n,
|
|
@@ -91,67 +91,67 @@ var E = {
|
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
}, A =
|
|
94
|
+
}, A = o(() => w.then((e) => ({ default: e.MarkdownRenderer }))), j = o(() => w.then((e) => ({ default: e.MarkdownMetadataRenderer }))), M = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? d : {
|
|
95
95
|
id: "markdown-string-plugin",
|
|
96
96
|
canHandle: (e) => typeof e == "string",
|
|
97
|
-
transform: (e, n,
|
|
98
|
-
let { plugins:
|
|
97
|
+
transform: (e, n, i) => {
|
|
98
|
+
let { plugins: o, ...l } = n, u = i(x(e) ?? {}, {
|
|
99
99
|
plugins: [{
|
|
100
100
|
id: "markdown-metadata-plugin",
|
|
101
101
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
102
|
-
transform: (n,
|
|
103
|
-
...
|
|
102
|
+
transform: (n, i) => t({
|
|
103
|
+
...i,
|
|
104
104
|
value: n,
|
|
105
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
106
|
-
return
|
|
107
|
-
return
|
|
105
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, { get children() {
|
|
106
|
+
return s(C, c(l, { get children() {
|
|
107
|
+
return s(j, c(l, {
|
|
108
108
|
get metadataKeyPath() {
|
|
109
|
-
return
|
|
109
|
+
return i.keyPath;
|
|
110
110
|
},
|
|
111
111
|
children: e
|
|
112
112
|
}));
|
|
113
113
|
} }));
|
|
114
|
-
} }) :
|
|
114
|
+
} }) : s(j, c(l, {
|
|
115
115
|
get metadataKeyPath() {
|
|
116
|
-
return
|
|
116
|
+
return i.keyPath;
|
|
117
117
|
},
|
|
118
118
|
children: e
|
|
119
119
|
}))
|
|
120
120
|
})
|
|
121
121
|
}],
|
|
122
|
-
dictionaryKey:
|
|
122
|
+
dictionaryKey: l.dictionaryKey,
|
|
123
123
|
keyPath: []
|
|
124
|
-
}),
|
|
124
|
+
}), d = (i) => t({
|
|
125
125
|
...n,
|
|
126
126
|
value: e,
|
|
127
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
128
|
-
return
|
|
129
|
-
return
|
|
130
|
-
components:
|
|
127
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, { get children() {
|
|
128
|
+
return s(C, c(l, { get children() {
|
|
129
|
+
return s(A, c(l, {
|
|
130
|
+
components: i,
|
|
131
131
|
children: e
|
|
132
132
|
}));
|
|
133
133
|
} }));
|
|
134
|
-
} }) :
|
|
135
|
-
components:
|
|
134
|
+
} }) : s(A, c(l, {
|
|
135
|
+
components: i,
|
|
136
136
|
children: e
|
|
137
137
|
})),
|
|
138
|
-
additionalProps: { metadata:
|
|
139
|
-
}),
|
|
140
|
-
return new Proxy(
|
|
138
|
+
additionalProps: { metadata: u }
|
|
139
|
+
}), f = d();
|
|
140
|
+
return new Proxy(f, { get(t, n, r) {
|
|
141
141
|
if (n === "value") return e;
|
|
142
142
|
if (n === Symbol.toPrimitive || n === "toString" || n === "valueOf") return () => e;
|
|
143
143
|
if (typeof n == "string" && n !== "constructor") {
|
|
144
144
|
let t = String.prototype[n];
|
|
145
145
|
if (typeof t == "function") return t.bind(e);
|
|
146
146
|
}
|
|
147
|
-
return n === "metadata" ?
|
|
147
|
+
return n === "metadata" ? u : n === "use" ? (e) => d(e) : Reflect.get(t, n, r);
|
|
148
148
|
} });
|
|
149
149
|
}
|
|
150
|
-
}, N = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
150
|
+
}, N = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? d : {
|
|
151
151
|
id: "markdown-plugin",
|
|
152
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
152
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === S.MARKDOWN,
|
|
153
153
|
transform: (e, t, n) => {
|
|
154
|
-
let r = [...t.keyPath, { type:
|
|
154
|
+
let r = [...t.keyPath, { type: S.MARKDOWN }], i = e[S.MARKDOWN];
|
|
155
155
|
return n(i, {
|
|
156
156
|
...t,
|
|
157
157
|
children: i,
|
|
@@ -159,47 +159,47 @@ var E = {
|
|
|
159
159
|
plugins: [M, ...t.plugins ?? []]
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
}, P =
|
|
162
|
+
}, P = o(() => T.then((e) => ({ default: e }))), F = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? d : {
|
|
163
163
|
id: "html-plugin",
|
|
164
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
164
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === S.HTML,
|
|
165
165
|
transform: (e, n) => {
|
|
166
|
-
let
|
|
167
|
-
...
|
|
168
|
-
value:
|
|
169
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
170
|
-
return
|
|
171
|
-
return
|
|
172
|
-
html:
|
|
166
|
+
let i = e[S.HTML], { plugins: o, children: l, ...u } = n, d = (e) => t({
|
|
167
|
+
...u,
|
|
168
|
+
value: i,
|
|
169
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && r.enabled ? s(a, { get children() {
|
|
170
|
+
return s(C, c(u, { get children() {
|
|
171
|
+
return s(P, c(u, {
|
|
172
|
+
html: i,
|
|
173
173
|
components: e
|
|
174
174
|
}));
|
|
175
175
|
} }));
|
|
176
|
-
} }) :
|
|
177
|
-
html:
|
|
176
|
+
} }) : s(P, c(u, {
|
|
177
|
+
html: i,
|
|
178
178
|
components: e
|
|
179
179
|
}))
|
|
180
|
-
}),
|
|
181
|
-
return new Proxy(
|
|
182
|
-
if (t === "value") return
|
|
183
|
-
if (t === Symbol.toPrimitive || t === "toString" || t === "valueOf") return () =>
|
|
180
|
+
}), f = [d()];
|
|
181
|
+
return new Proxy(f, { get(e, t, n) {
|
|
182
|
+
if (t === "value") return i;
|
|
183
|
+
if (t === Symbol.toPrimitive || t === "toString" || t === "valueOf") return () => i;
|
|
184
184
|
if (typeof t == "string" && t !== "constructor") {
|
|
185
185
|
let e = String.prototype[t];
|
|
186
|
-
if (typeof e == "function") return e.bind(
|
|
186
|
+
if (typeof e == "function") return e.bind(i);
|
|
187
187
|
}
|
|
188
|
-
return t === "use" ? (e) =>
|
|
188
|
+
return t === "use" ? (e) => d(e) : Reflect.get(e, t, n);
|
|
189
189
|
} });
|
|
190
190
|
}
|
|
191
191
|
}, I = /* @__PURE__ */ new Map(), L = (e, t = !0) => {
|
|
192
|
-
let n = `${e ??
|
|
192
|
+
let n = `${e ?? i.defaultLocale}_${t}`;
|
|
193
193
|
if (I.has(n)) return I.get(n);
|
|
194
194
|
let r = [
|
|
195
|
-
|
|
196
|
-
c,
|
|
197
|
-
m(e ?? o.defaultLocale),
|
|
198
|
-
s,
|
|
199
|
-
p(e ?? o.defaultLocale),
|
|
195
|
+
b(e ?? i.defaultLocale, t ? i.defaultLocale : void 0),
|
|
200
196
|
u,
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
g(e ?? i.defaultLocale),
|
|
198
|
+
l,
|
|
199
|
+
h(e ?? i.defaultLocale),
|
|
200
|
+
f,
|
|
201
|
+
p,
|
|
202
|
+
_,
|
|
203
203
|
E,
|
|
204
204
|
D,
|
|
205
205
|
k,
|
|
@@ -3,7 +3,7 @@ import { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
|
|
|
3
3
|
* On the client side, hook to get the translation content based on the locale
|
|
4
4
|
*/
|
|
5
5
|
export declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
|
|
6
|
-
locale: import('
|
|
6
|
+
locale: import('intlayer').Locale;
|
|
7
7
|
content: Content;
|
|
8
8
|
t: <Content_1 = string>(languageContent: StrictModeLocaleMap<Content_1>) => Content_1;
|
|
9
9
|
};
|
|
@@ -2,13 +2,13 @@ import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
|
2
2
|
/**
|
|
3
3
|
* Get the locale cookie
|
|
4
4
|
*/
|
|
5
|
-
export declare const localeInStorage: import('
|
|
5
|
+
export declare const localeInStorage: import('intlayer').Locale | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use localeInStorage instead
|
|
8
8
|
*
|
|
9
9
|
* Get the locale cookie
|
|
10
10
|
*/
|
|
11
|
-
export declare const localeCookie: import('
|
|
11
|
+
export declare const localeCookie: import('intlayer').Locale | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* Set the locale cookie
|
|
14
14
|
*/
|
|
@@ -23,7 +23,7 @@ export declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled?:
|
|
|
23
23
|
* Hook that provides the locale storage and a function to set it
|
|
24
24
|
*/
|
|
25
25
|
export declare const useLocaleStorage: (isCookieEnabled?: boolean) => import('solid-js').Accessor<{
|
|
26
|
-
getLocale: () => import('
|
|
26
|
+
getLocale: () => import('intlayer').Locale;
|
|
27
27
|
setLocale: (locale: LocalesValues) => void;
|
|
28
28
|
}>;
|
|
29
29
|
/**
|
|
@@ -34,6 +34,6 @@ export declare const useLocaleStorage: (isCookieEnabled?: boolean) => import('so
|
|
|
34
34
|
* Hook that provides the locale cookie and a function to set it
|
|
35
35
|
*/
|
|
36
36
|
export declare const useLocaleCookie: (isCookieEnabled?: boolean) => import('solid-js').Accessor<{
|
|
37
|
-
getLocale: () => import('
|
|
37
|
+
getLocale: () => import('intlayer').Locale;
|
|
38
38
|
setLocale: (locale: LocalesValues) => void;
|
|
39
39
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-intlayer",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -107,17 +107,18 @@
|
|
|
107
107
|
"prepublish": "cp -f ../../README.md ./README.md",
|
|
108
108
|
"publish": "bun publish || true",
|
|
109
109
|
"publish:canary": "bun publish --access public --tag canary || true",
|
|
110
|
+
"publish:ci": "bun ../../scripts/publish-package.mjs",
|
|
110
111
|
"publish:latest": "bun publish --access public --tag latest || true",
|
|
111
112
|
"test": "bun --bun vitest run",
|
|
112
113
|
"test:watch": "bun --bun vitest",
|
|
113
114
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
114
115
|
},
|
|
115
116
|
"dependencies": {
|
|
116
|
-
"@intlayer/api": "9.5.
|
|
117
|
-
"@intlayer/config": "9.5.
|
|
118
|
-
"@intlayer/core": "9.5.
|
|
119
|
-
"@intlayer/editor": "9.5.
|
|
120
|
-
"@intlayer/types": "9.5.
|
|
117
|
+
"@intlayer/api": "9.5.4",
|
|
118
|
+
"@intlayer/config": "9.5.4",
|
|
119
|
+
"@intlayer/core": "9.5.4",
|
|
120
|
+
"@intlayer/editor": "9.5.4",
|
|
121
|
+
"@intlayer/types": "9.5.4"
|
|
121
122
|
},
|
|
122
123
|
"devDependencies": {
|
|
123
124
|
"@solidjs/testing-library": "0.8.10",
|
|
@@ -128,20 +129,20 @@
|
|
|
128
129
|
"@utils/ts-config": "1.0.4",
|
|
129
130
|
"@utils/ts-config-types": "1.0.4",
|
|
130
131
|
"@utils/tsdown-config": "1.0.4",
|
|
131
|
-
"jsdom": "30.0
|
|
132
|
+
"jsdom": "30.1.0",
|
|
132
133
|
"rimraf": "6.1.3",
|
|
133
134
|
"tsdown": "0.23.0",
|
|
134
135
|
"typescript": "7.0.2",
|
|
135
136
|
"vite": "8.3.0",
|
|
136
137
|
"vite-plugin-dts": "5.1.0",
|
|
137
138
|
"vite-plugin-solid": "2.11.14",
|
|
138
|
-
"vitest": "5.0.
|
|
139
|
+
"vitest": "5.0.1"
|
|
139
140
|
},
|
|
140
141
|
"peerDependencies": {
|
|
141
142
|
"solid-js": ">=1.0.0"
|
|
142
143
|
},
|
|
143
144
|
"optionalDependencies": {
|
|
144
|
-
"@intlayer/analytics": "9.5.
|
|
145
|
+
"@intlayer/analytics": "9.5.4"
|
|
145
146
|
},
|
|
146
147
|
"engines": {
|
|
147
148
|
"node": ">=14.18"
|