vanilla-intlayer 9.4.3 → 9.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/esm/client/useLocale.mjs +1 -1
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/types/client/installIntlayer.d.ts +4 -5
- package/dist/types/client/installIntlayer.d.ts.map +1 -1
- package/dist/types/client/useDictionary.d.ts +2 -3
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +1 -2
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useIntlayer.d.ts +1 -2
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts +3 -4
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +7 -8
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/dist/types/client/usePathname.d.ts +2 -3
- package/dist/types/client/usePathname.d.ts.map +1 -1
- package/dist/types/client/useRewriteURL.d.ts +1 -2
- package/dist/types/client/useRewriteURL.d.ts.map +1 -1
- package/dist/types/editor/useEditor.d.ts +1 -2
- package/dist/types/editor/useEditor.d.ts.map +1 -1
- package/dist/types/format/useCompact.d.ts +1 -2
- package/dist/types/format/useCompact.d.ts.map +1 -1
- package/dist/types/format/useCurrency.d.ts +1 -2
- package/dist/types/format/useCurrency.d.ts.map +1 -1
- package/dist/types/format/useDate.d.ts +1 -2
- package/dist/types/format/useDate.d.ts.map +1 -1
- package/dist/types/format/useIntl.d.ts +1 -2
- package/dist/types/format/useIntl.d.ts.map +1 -1
- package/dist/types/format/useList.d.ts +1 -2
- package/dist/types/format/useList.d.ts.map +1 -1
- package/dist/types/format/useNumber.d.ts +1 -2
- package/dist/types/format/useNumber.d.ts.map +1 -1
- package/dist/types/format/usePercentage.d.ts +1 -2
- package/dist/types/format/usePercentage.d.ts.map +1 -1
- package/dist/types/format/useRelativeTime.d.ts +1 -2
- package/dist/types/format/useRelativeTime.d.ts.map +1 -1
- package/dist/types/format/useUnit.d.ts +1 -2
- package/dist/types/format/useUnit.d.ts.map +1 -1
- package/dist/types/getDictionary.d.ts +1 -2
- package/dist/types/getDictionary.d.ts.map +1 -1
- package/dist/types/getIntlayer.d.ts +1 -2
- package/dist/types/getIntlayer.d.ts.map +1 -1
- package/dist/types/html/HTMLRenderer.d.ts +3 -4
- package/dist/types/html/HTMLRenderer.d.ts.map +1 -1
- package/dist/types/html/installIntlayerHTML.d.ts +8 -9
- package/dist/types/html/installIntlayerHTML.d.ts.map +1 -1
- package/dist/types/html/types.d.ts +2 -3
- package/dist/types/html/types.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts +3 -4
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
- package/dist/types/markdown/compiler.d.ts +4 -4
- package/dist/types/markdown/compiler.d.ts.map +1 -1
- package/dist/types/markdown/installIntlayerMarkdown.d.ts +9 -10
- package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -1
- package/dist/types/markdown/runtime.d.ts +3 -3
- package/dist/types/markdown/runtime.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +15 -16
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/renderIntlayerNode.d.ts +2 -3
- package/dist/types/renderIntlayerNode.d.ts.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -69,8 +69,6 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
|
|
|
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
|
|
|
72
|
-
---
|
|
73
|
-
|
|
74
72
|
## 📦 Installation
|
|
75
73
|
|
|
76
74
|
Start your journey with Intlayer today and experience a smoother, more powerful approach to internationalization.
|
|
@@ -4,6 +4,7 @@ const require_client_useLocaleStorage = require('./useLocaleStorage.cjs');
|
|
|
4
4
|
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
5
|
|
|
6
6
|
//#region src/client/useLocale.ts
|
|
7
|
+
const { defaultLocale, locales: availableLocales } = _intlayer_config_built.internationalization ?? {};
|
|
7
8
|
/**
|
|
8
9
|
* Get the current locale state and locale management utilities.
|
|
9
10
|
*
|
|
@@ -33,7 +34,6 @@ let _intlayer_config_built = require("@intlayer/config/built");
|
|
|
33
34
|
*/
|
|
34
35
|
const useLocale = (props = {}) => {
|
|
35
36
|
const client = require_client_installIntlayer.getIntlayerClient();
|
|
36
|
-
const { defaultLocale, locales: availableLocales } = _intlayer_config_built.internationalization ?? {};
|
|
37
37
|
const setLocale = (newLocale) => {
|
|
38
38
|
if (!(availableLocales ?? []).map(String).includes(newLocale)) {
|
|
39
39
|
console.error(`Locale "${newLocale}" is not available.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.cjs","names":["
|
|
1
|
+
{"version":3,"file":"useLocale.cjs","names":["internationalization","getIntlayerClient"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getIntlayerClient } from './installIntlayer';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\nexport type UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: DeclaredLocales) => void;\n};\n\nexport type UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n subscribe: (callback: (locale: LocalesValues) => void) => () => void;\n};\n\nconst { defaultLocale, locales: availableLocales } = internationalization ?? {};\n\n/**\n * Get the current locale state and locale management utilities.\n *\n * Returns a plain object with the current `locale`, `defaultLocale`,\n * `availableLocales`, a `setLocale` function, and a `subscribe` function\n * to react to locale changes.\n *\n * @param props - Optional configuration.\n * @returns Locale state and management utilities.\n *\n * @example\n * ```ts\n * import { installIntlayer, useLocale } from 'vanilla-intlayer';\n *\n * installIntlayer('en');\n *\n * const { locale, availableLocales, setLocale, subscribe } = useLocale();\n *\n * const unsubscribe = subscribe((newLocale) => {\n * console.log('Locale changed to', newLocale);\n * });\n *\n * document.querySelector('#lang-switcher').addEventListener('change', (e) => {\n * setLocale(e.target.value);\n * });\n * ```\n */\nexport const useLocale = (props: UseLocaleProps = {}): UseLocaleResult => {\n const client = getIntlayerClient();\n\n const setLocale = (newLocale: LocalesValues): void => {\n if (!(availableLocales ?? []).map(String).includes(newLocale)) {\n console.error(`Locale \"${newLocale}\" is not available.`);\n return;\n }\n\n client.setLocale(newLocale);\n\n setLocaleInStorage(\n newLocale,\n props.isCookieEnabled ?? client.isCookieEnabled ?? true\n );\n\n props.onLocaleChange?.(newLocale as DeclaredLocales);\n };\n\n return {\n locale: client.locale as DeclaredLocales,\n defaultLocale: defaultLocale as DeclaredLocales,\n availableLocales: (availableLocales ?? []) as DeclaredLocales[],\n setLocale,\n subscribe: (callback) => client.subscribe(callback),\n };\n};\n"],"mappings":";;;;;;AAqBA,MAAM,EAAE,eAAe,SAAS,qBAAqBA,+CAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6B9E,MAAa,aAAa,QAAwB,CAAC,MAAuB;CACxE,MAAM,SAASC,iDAAkB;CAEjC,MAAM,aAAa,cAAmC;EACpD,IAAI,EAAE,oBAAoB,CAAC,EAAC,CAAE,IAAI,MAAM,CAAC,CAAC,SAAS,SAAS,GAAG;GAC7D,QAAQ,MAAM,WAAW,UAAU,oBAAoB;GACvD;EACF;EAEA,OAAO,UAAU,SAAS;EAE1B,mDACE,WACA,MAAM,mBAAmB,OAAO,mBAAmB,IACrD;EAEA,MAAM,iBAAiB,SAA4B;CACrD;CAEA,OAAO;EACL,QAAQ,OAAO;EACA;EACf,kBAAmB,oBAAoB,CAAC;EACxC;EACA,YAAY,aAAa,OAAO,UAAU,QAAQ;CACpD;AACF"}
|
|
@@ -3,6 +3,7 @@ import { setLocaleInStorage } from "./useLocaleStorage.mjs";
|
|
|
3
3
|
import { internationalization } from "@intlayer/config/built";
|
|
4
4
|
|
|
5
5
|
//#region src/client/useLocale.ts
|
|
6
|
+
const { defaultLocale, locales: availableLocales } = internationalization ?? {};
|
|
6
7
|
/**
|
|
7
8
|
* Get the current locale state and locale management utilities.
|
|
8
9
|
*
|
|
@@ -32,7 +33,6 @@ import { internationalization } from "@intlayer/config/built";
|
|
|
32
33
|
*/
|
|
33
34
|
const useLocale = (props = {}) => {
|
|
34
35
|
const client = getIntlayerClient();
|
|
35
|
-
const { defaultLocale, locales: availableLocales } = internationalization ?? {};
|
|
36
36
|
const setLocale = (newLocale) => {
|
|
37
37
|
if (!(availableLocales ?? []).map(String).includes(newLocale)) {
|
|
38
38
|
console.error(`Locale "${newLocale}" is not available.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.mjs","names":[],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getIntlayerClient } from './installIntlayer';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\nexport type UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: DeclaredLocales) => void;\n};\n\nexport type UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n subscribe: (callback: (locale: LocalesValues) => void) => () => void;\n};\n\n/**\n * Get the current locale state and locale management utilities.\n *\n * Returns a plain object with the current `locale`, `defaultLocale`,\n * `availableLocales`, a `setLocale` function, and a `subscribe` function\n * to react to locale changes.\n *\n * @param props - Optional configuration.\n * @returns Locale state and management utilities.\n *\n * @example\n * ```ts\n * import { installIntlayer, useLocale } from 'vanilla-intlayer';\n *\n * installIntlayer('en');\n *\n * const { locale, availableLocales, setLocale, subscribe } = useLocale();\n *\n * const unsubscribe = subscribe((newLocale) => {\n * console.log('Locale changed to', newLocale);\n * });\n *\n * document.querySelector('#lang-switcher').addEventListener('change', (e) => {\n * setLocale(e.target.value);\n * });\n * ```\n */\nexport const useLocale = (props: UseLocaleProps = {}): UseLocaleResult => {\n const client = getIntlayerClient();\n
|
|
1
|
+
{"version":3,"file":"useLocale.mjs","names":[],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getIntlayerClient } from './installIntlayer';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\nexport type UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: DeclaredLocales) => void;\n};\n\nexport type UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n subscribe: (callback: (locale: LocalesValues) => void) => () => void;\n};\n\nconst { defaultLocale, locales: availableLocales } = internationalization ?? {};\n\n/**\n * Get the current locale state and locale management utilities.\n *\n * Returns a plain object with the current `locale`, `defaultLocale`,\n * `availableLocales`, a `setLocale` function, and a `subscribe` function\n * to react to locale changes.\n *\n * @param props - Optional configuration.\n * @returns Locale state and management utilities.\n *\n * @example\n * ```ts\n * import { installIntlayer, useLocale } from 'vanilla-intlayer';\n *\n * installIntlayer('en');\n *\n * const { locale, availableLocales, setLocale, subscribe } = useLocale();\n *\n * const unsubscribe = subscribe((newLocale) => {\n * console.log('Locale changed to', newLocale);\n * });\n *\n * document.querySelector('#lang-switcher').addEventListener('change', (e) => {\n * setLocale(e.target.value);\n * });\n * ```\n */\nexport const useLocale = (props: UseLocaleProps = {}): UseLocaleResult => {\n const client = getIntlayerClient();\n\n const setLocale = (newLocale: LocalesValues): void => {\n if (!(availableLocales ?? []).map(String).includes(newLocale)) {\n console.error(`Locale \"${newLocale}\" is not available.`);\n return;\n }\n\n client.setLocale(newLocale);\n\n setLocaleInStorage(\n newLocale,\n props.isCookieEnabled ?? client.isCookieEnabled ?? true\n );\n\n props.onLocaleChange?.(newLocale as DeclaredLocales);\n };\n\n return {\n locale: client.locale as DeclaredLocales,\n defaultLocale: defaultLocale as DeclaredLocales,\n availableLocales: (availableLocales ?? []) as DeclaredLocales[],\n setLocale,\n subscribe: (callback) => client.subscribe(callback),\n };\n};\n"],"mappings":";;;;;AAqBA,MAAM,EAAE,eAAe,SAAS,qBAAqB,wBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6B9E,MAAa,aAAa,QAAwB,CAAC,MAAuB;CACxE,MAAM,SAAS,kBAAkB;CAEjC,MAAM,aAAa,cAAmC;EACpD,IAAI,EAAE,oBAAoB,CAAC,EAAC,CAAE,IAAI,MAAM,CAAC,CAAC,SAAS,SAAS,GAAG;GAC7D,QAAQ,MAAM,WAAW,UAAU,oBAAoB;GACvD;EACF;EAEA,OAAO,UAAU,SAAS;EAE1B,mBACE,WACA,MAAM,mBAAmB,OAAO,mBAAmB,IACrD;EAEA,MAAM,iBAAiB,SAA4B;CACrD;CAEA,OAAO;EACL,QAAQ,OAAO;EACA;EACf,kBAAmB,oBAAoB,CAAC;EACxC;EACA,YAAY,aAAa,OAAO,UAAU,QAAQ;CACpD;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LocalesValues, ProviderVariant } from "@intlayer/types/module_augmentation";
|
|
2
2
|
//#region src/client/installIntlayer.d.ts
|
|
3
3
|
type LocaleListener = (locale: LocalesValues) => void;
|
|
4
|
-
declare class IntlayerClient {
|
|
4
|
+
export declare class IntlayerClient {
|
|
5
5
|
private _locale;
|
|
6
6
|
private _variant;
|
|
7
7
|
private _listeners;
|
|
@@ -25,11 +25,11 @@ declare class IntlayerClient {
|
|
|
25
25
|
/**
|
|
26
26
|
* Create and return a single IntlayerClient instance.
|
|
27
27
|
*/
|
|
28
|
-
declare const createIntlayerClient: (locale?: LocalesValues, isCookieEnabled?: boolean, variant?: ProviderVariant) => IntlayerClient;
|
|
28
|
+
export declare const createIntlayerClient: (locale?: LocalesValues, isCookieEnabled?: boolean, variant?: ProviderVariant) => IntlayerClient;
|
|
29
29
|
/**
|
|
30
30
|
* Get the current IntlayerClient instance, creating one with defaults if needed.
|
|
31
31
|
*/
|
|
32
|
-
declare const getIntlayerClient: () => IntlayerClient;
|
|
32
|
+
export declare const getIntlayerClient: () => IntlayerClient;
|
|
33
33
|
/**
|
|
34
34
|
* Install Intlayer into your vanilla JS application.
|
|
35
35
|
*
|
|
@@ -66,11 +66,10 @@ declare const getIntlayerClient: () => IntlayerClient;
|
|
|
66
66
|
* installIntlayer('en');
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
|
-
declare const installIntlayer: ({ locale, isCookieEnabled, variant }?: {
|
|
69
|
+
export declare const installIntlayer: ({ locale, isCookieEnabled, variant }?: {
|
|
70
70
|
locale?: LocalesValues;
|
|
71
71
|
isCookieEnabled?: boolean;
|
|
72
72
|
variant?: ProviderVariant;
|
|
73
73
|
}) => IntlayerClient;
|
|
74
74
|
//#endregion
|
|
75
|
-
export { IntlayerClient, createIntlayerClient, getIntlayerClient, installIntlayer };
|
|
76
75
|
//# sourceMappingURL=installIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installIntlayer.d.ts","names":[],"sources":["../../../src/client/installIntlayer.ts"],"mappings":";;KAQK,kBAAkB,QAAQ;
|
|
1
|
+
{"version":3,"file":"installIntlayer.d.ts","names":[],"sources":["../../../src/client/installIntlayer.ts"],"mappings":";;KAQK,kBAAkB,QAAQ;qBAElB;UACH;UACA;UACA;EACR;EAEA,YACE,SAAS,eACT,2BACA,UAAU;MAYR,UAAU;;;;;MAQV,WAAW;EAIf,UAAU,WAAW;EAOrB,WAAW,YAAY;EAKvB,UAAU,UAAU;;;;;EAWpB;;;;;qBAeW,uBAAoB,SACtB,eAAa,2BAAA,UAEZ,oBACT;;;;qBAUU,yBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA2CxB,oBAAe,QAAA,iBAAA;EAK1B,SAAS;EACT;EACA,UAAU;MACH"}
|
|
@@ -2,7 +2,7 @@ import { DeepTransformContent } from "../plugins.js";
|
|
|
2
2
|
import { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
3
3
|
import { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from "@intlayer/types/dictionary";
|
|
4
4
|
//#region src/client/useDictionary.d.ts
|
|
5
|
-
type WithOnChange<T> = T & {
|
|
5
|
+
export type WithOnChange<T> = T & {
|
|
6
6
|
/**
|
|
7
7
|
* Subscribe to locale changes. The callback receives the fresh content
|
|
8
8
|
* whenever the active locale changes. Returns the content object itself
|
|
@@ -28,7 +28,6 @@ type WithOnChange<T> = T & {
|
|
|
28
28
|
* @param localeOrSelector - Optional locale or selector.
|
|
29
29
|
* @returns The current content with an `.onChange()` method.
|
|
30
30
|
*/
|
|
31
|
-
declare const useDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => WithOnChange<DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>>;
|
|
31
|
+
export declare const useDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => WithOnChange<DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>>;
|
|
32
32
|
//#endregion
|
|
33
|
-
export { WithOnChange, useDictionary };
|
|
34
33
|
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/client/useDictionary.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/client/useDictionary.ts"],"mappings":";;;;YAiBY,aAAa,KAAK;;;;;;;;;;;;EAY5B,WAAW,WAAW,0BAA0B,aAAa;;;;;;;;;;;;;;qBAelD,sBACL,UAAU,aAAa,gCACvB,UACF,gBACA,2BAA2B,KAAK,iBAAe,YAEvC,GAAC,mBACM,MAClB,aACD,qBACE,kCAAkC,GAAG,IACrC,sBAAsB"}
|
|
@@ -17,7 +17,6 @@ import { QualifiedDynamicLoaderMap } from "@intlayer/core/dictionaryManipulator"
|
|
|
17
17
|
* @param key - Dictionary key (used for cache namespacing).
|
|
18
18
|
* @param localeOrSelector - Optional locale or selector.
|
|
19
19
|
*/
|
|
20
|
-
declare const useDictionaryDynamic: <const T extends Dictionary, const K extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales>(dictionaryLoaders: StrictModeLocaleMap<() => Promise<T>> | QualifiedDynamicLoaderMap, key: K, localeOrSelector?: A) => WithOnChange<DeepTransformContent<T['content']>>;
|
|
20
|
+
export declare const useDictionaryDynamic: <const T extends Dictionary, const K extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales>(dictionaryLoaders: StrictModeLocaleMap<() => Promise<T>> | QualifiedDynamicLoaderMap, key: K, localeOrSelector?: A) => WithOnChange<DeepTransformContent<T['content']>>;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { useDictionaryDynamic };
|
|
23
22
|
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;;;;;;;;qBA2Ea,6BACL,UAAU,kBACV,UAAU,sBACV,UAAU,gBAAgB,yBAAyB,KAAK,iBAAe,mBAGzE,0BAA0B,QAAQ,MAClC,2BAAyB,KACxB,GAAC,mBACa,MAClB,aAAa,qBAAqB"}
|
|
@@ -29,7 +29,6 @@ import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySe
|
|
|
29
29
|
* const faq2 = useIntlayer('faq', { item: 2 });
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
declare const useIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => WithOnChange<DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>>;
|
|
32
|
+
export declare const useIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => WithOnChange<DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>>;
|
|
33
33
|
//#endregion
|
|
34
|
-
export { useIntlayer };
|
|
35
34
|
//# sourceMappingURL=useIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/client/useIntlayer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/client/useIntlayer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA0Ca,oBACL,UAAU,sBACV,UAAU,gBAAgB,yBAAyB,KAAK,iBAAe,KAExE,GAAC,mBACa,MAClB,aACD,qBAAqB,yBAAyB,GAAG,IAAI,sBAAsB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
2
|
//#region src/client/useLocale.d.ts
|
|
3
|
-
type UseLocaleProps = {
|
|
3
|
+
export type UseLocaleProps = {
|
|
4
4
|
isCookieEnabled?: boolean;
|
|
5
5
|
onLocaleChange?: (locale: DeclaredLocales) => void;
|
|
6
6
|
};
|
|
7
|
-
type UseLocaleResult = {
|
|
7
|
+
export type UseLocaleResult = {
|
|
8
8
|
locale: DeclaredLocales;
|
|
9
9
|
defaultLocale: DeclaredLocales;
|
|
10
10
|
availableLocales: DeclaredLocales[];
|
|
@@ -38,7 +38,6 @@ type UseLocaleResult = {
|
|
|
38
38
|
* });
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
declare const useLocale: (props?: UseLocaleProps) => UseLocaleResult;
|
|
41
|
+
export declare const useLocale: (props?: UseLocaleProps) => UseLocaleResult;
|
|
42
42
|
//#endregion
|
|
43
|
-
export { UseLocaleProps, UseLocaleResult, useLocale };
|
|
44
43
|
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;YAQY;EACV;EACA,kBAAkB,QAAQ;;YAGhB;EACV,QAAQ;EACR,eAAe;EACf,kBAAkB;EAClB,YAAY,QAAQ;EACpB,YAAY,WAAW,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAgCpB,YAAS,QAAW,mBAAsB"}
|
|
@@ -3,30 +3,29 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
|
3
3
|
/**
|
|
4
4
|
* Get the current locale from storage (cookie or localStorage).
|
|
5
5
|
*/
|
|
6
|
-
declare const localeInStorage: import("intlayer").Locale;
|
|
6
|
+
export declare const localeInStorage: import("@intlayer/types").Locale;
|
|
7
7
|
/**
|
|
8
8
|
* @deprecated Use localeInStorage instead.
|
|
9
9
|
*/
|
|
10
|
-
declare const localeCookie: import("intlayer").Locale;
|
|
10
|
+
export declare const localeCookie: import("@intlayer/types").Locale;
|
|
11
11
|
/**
|
|
12
12
|
* Persist the locale to storage (cookie and/or localStorage).
|
|
13
13
|
*/
|
|
14
|
-
declare const setLocaleInStorage: (locale: LocalesValues, isCookieEnabled: boolean) => void;
|
|
14
|
+
export declare const setLocaleInStorage: (locale: LocalesValues, isCookieEnabled: boolean) => void;
|
|
15
15
|
/**
|
|
16
16
|
* @deprecated Use setLocaleInStorage instead.
|
|
17
17
|
*/
|
|
18
|
-
declare const setLocaleCookie: typeof setLocaleInStorage;
|
|
18
|
+
export declare const setLocaleCookie: typeof setLocaleInStorage;
|
|
19
19
|
/**
|
|
20
20
|
* Returns the current locale from storage and a setter.
|
|
21
21
|
*/
|
|
22
|
-
declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
23
|
-
localeStorage: import("intlayer").Locale;
|
|
22
|
+
export declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
23
|
+
localeStorage: import("@intlayer/types").Locale;
|
|
24
24
|
setLocaleStorage: (locale: LocalesValues) => void;
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* @deprecated Use useLocaleStorage instead.
|
|
28
28
|
*/
|
|
29
|
-
declare const useLocaleCookie: typeof useLocaleStorage;
|
|
29
|
+
export declare const useLocaleCookie: typeof useLocaleStorage;
|
|
30
30
|
//#endregion
|
|
31
|
-
export { localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage };
|
|
32
31
|
//# sourceMappingURL=useLocaleStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;qBAWa,2CAAe;;;;qBAKf,wCAAY;;;;qBAKZ,qBAAkB,QACrB,eAAa;;;;qBAWV,wBAAe;;;;qBAKf,mBAAgB;EAOzB,yCAAa;EACb,mBAAgB,QAAA;;;;;qBAOP,wBAAe"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/client/usePathname.d.ts
|
|
2
|
-
type UsePathnameResult = {
|
|
2
|
+
export type UsePathnameResult = {
|
|
3
3
|
/** Current pathname without the locale prefix. */
|
|
4
4
|
pathname: string;
|
|
5
5
|
/**
|
|
@@ -30,7 +30,6 @@ type UsePathnameResult = {
|
|
|
30
30
|
* });
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
declare const usePathname: () => UsePathnameResult;
|
|
33
|
+
export declare const usePathname: () => UsePathnameResult;
|
|
34
34
|
//#endregion
|
|
35
|
-
export { UsePathnameResult, usePathname };
|
|
36
35
|
//# sourceMappingURL=usePathname.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePathname.d.ts","names":[],"sources":["../../../src/client/usePathname.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"usePathname.d.ts","names":[],"sources":["../../../src/client/usePathname.ts"],"mappings":";YAEY;;EAEV;;;;;;;EAOA,YAAY,WAAW;;;;;;;;;;;;;;;;;;;;;;qBAuBZ,mBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRewriteURL.d.ts","names":[],"sources":["../../../src/client/useRewriteURL.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useRewriteURL.d.ts","names":[],"sources":["../../../src/client/useRewriteURL.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;qBA8Ca"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditor.d.ts","names":[],"sources":["../../../src/editor/useEditor.ts"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useEditor.d.ts","names":[],"sources":["../../../src/editor/useEditor.ts"],"mappings":";;;;;;;;;;;;;;;;;;;qBAwBa"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { compact } from "@intlayer/core/formatters";
|
|
2
2
|
//#region src/format/useCompact.d.ts
|
|
3
|
-
declare const useCompact: () => (...args: Parameters<typeof compact>) => string;
|
|
3
|
+
export declare const useCompact: () => (...args: Parameters<typeof compact>) => string;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { useCompact };
|
|
6
5
|
//# sourceMappingURL=useCompact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;qBAGa,sBAAU,MAGJ,kBAAkB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { currency } from "@intlayer/core/formatters";
|
|
2
2
|
//#region src/format/useCurrency.d.ts
|
|
3
|
-
declare const useCurrency: () => (...args: Parameters<typeof currency>) => string;
|
|
3
|
+
export declare const useCurrency: () => (...args: Parameters<typeof currency>) => string;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { useCurrency };
|
|
6
5
|
//# sourceMappingURL=useCurrency.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;qBAGa,uBAAW,MAGL,kBAAkB"}
|
|
@@ -3,7 +3,6 @@ import { date } from "@intlayer/core/formatters";
|
|
|
3
3
|
/**
|
|
4
4
|
* Vanilla JS hook that provides a localized date/time formatter.
|
|
5
5
|
*/
|
|
6
|
-
declare const useDate: () => (...args: Parameters<typeof date>) => string;
|
|
6
|
+
export declare const useDate: () => (...args: Parameters<typeof date>) => string;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { useDate };
|
|
9
8
|
//# sourceMappingURL=useDate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":";;;;;qBAMa,mBAAO,MAGD,kBAAkB"}
|
|
@@ -26,10 +26,9 @@ import { WrappedIntl } from "@intlayer/core/utils";
|
|
|
26
26
|
* });
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
declare const useIntl: (locale?: LocalesValues) => {
|
|
29
|
+
export declare const useIntl: (locale?: LocalesValues) => {
|
|
30
30
|
intl: WrappedIntl;
|
|
31
31
|
subscribe: (callback: (intl: WrappedIntl) => void) => () => void;
|
|
32
32
|
};
|
|
33
33
|
//#endregion
|
|
34
|
-
export { useIntl };
|
|
35
34
|
//# sourceMappingURL=useIntl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../src/format/useIntl.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../src/format/useIntl.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA6Ba,UAAO,SACT;EAET,MAAM;EACN,YAAY,WAAW,MAAM"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { list } from "@intlayer/core/formatters";
|
|
2
2
|
//#region src/format/useList.d.ts
|
|
3
|
-
declare const useList: () => (...args: Parameters<typeof list>) => string;
|
|
3
|
+
export declare const useList: () => (...args: Parameters<typeof list>) => string;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { useList };
|
|
6
5
|
//# sourceMappingURL=useList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;qBAGa,mBAAO,MAGD,kBAAkB"}
|
|
@@ -3,7 +3,6 @@ import { number } from "@intlayer/core/formatters";
|
|
|
3
3
|
/**
|
|
4
4
|
* Vanilla JS hook that provides a localized number formatter.
|
|
5
5
|
*/
|
|
6
|
-
declare const useNumber: () => (...args: Parameters<typeof number>) => string;
|
|
6
|
+
export declare const useNumber: () => (...args: Parameters<typeof number>) => string;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { useNumber };
|
|
9
8
|
//# sourceMappingURL=useNumber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;qBAMa,qBAAS,MAGH,kBAAkB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { percentage } from "@intlayer/core/formatters";
|
|
2
2
|
//#region src/format/usePercentage.d.ts
|
|
3
|
-
declare const usePercentage: () => (...args: Parameters<typeof percentage>) => string;
|
|
3
|
+
export declare const usePercentage: () => (...args: Parameters<typeof percentage>) => string;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { usePercentage };
|
|
6
5
|
//# sourceMappingURL=usePercentage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;qBAGa,yBAAa,MAGP,kBAAkB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { relativeTime } from "@intlayer/core/formatters";
|
|
2
2
|
//#region src/format/useRelativeTime.d.ts
|
|
3
|
-
declare const useRelativeTime: () => (...args: Parameters<typeof relativeTime>) => string;
|
|
3
|
+
export declare const useRelativeTime: () => (...args: Parameters<typeof relativeTime>) => string;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { useRelativeTime };
|
|
6
5
|
//# sourceMappingURL=useRelativeTime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;qBAGa,2BAAe,MAGT,kBAAkB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { units } from "@intlayer/core/formatters";
|
|
2
2
|
//#region src/format/useUnit.d.ts
|
|
3
|
-
declare const useUnit: () => (...args: Parameters<typeof units>) => string;
|
|
3
|
+
export declare const useUnit: () => (...args: Parameters<typeof units>) => string;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { useUnit };
|
|
6
5
|
//# sourceMappingURL=useUnit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;qBAGa,mBAAO,MAGD,kBAAkB"}
|
|
@@ -7,7 +7,6 @@ import { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup, Resol
|
|
|
7
7
|
* content for the given locale or selector (`{ item }`, `{ variant }`,
|
|
8
8
|
* optionally combined with `locale`).
|
|
9
9
|
*/
|
|
10
|
-
declare const getDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>;
|
|
10
|
+
export declare const getDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { getDictionary };
|
|
13
12
|
//# sourceMappingURL=getDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":";;;;;;;;;qBAmBa,sBACL,UAAU,aAAa,gCACvB,UACF,gBACA,2BAA2B,KAAK,iBAAe,YAEvC,GAAC,mBACM,MAClB,qBACD,kCAAkC,GAAG,IACrC,sBAAsB"}
|
|
@@ -6,7 +6,6 @@ import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySe
|
|
|
6
6
|
* locale or selector (`{ item }`, `{ variant }`,
|
|
7
7
|
* optionally combined with `locale`).
|
|
8
8
|
*/
|
|
9
|
-
declare const getIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>;
|
|
9
|
+
export declare const getIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { getIntlayer };
|
|
12
11
|
//# sourceMappingURL=getIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../src/getIntlayer.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../src/getIntlayer.ts"],"mappings":";;;;;;;;qBAgBa,oBACL,UAAU,sBACV,UAAU,gBAAgB,yBAAyB,KAAK,iBAAe,KAExE,GAAC,mBACa,MAClB,qBACD,yBAAyB,GAAG,IAC5B,sBAAsB"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { HTMLComponents } from "./types.js";
|
|
2
2
|
//#region src/html/HTMLRenderer.d.ts
|
|
3
|
-
type RenderHTMLProps = {
|
|
3
|
+
export type RenderHTMLProps = {
|
|
4
4
|
components?: HTMLComponents<'permissive', {}>;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* Renders an HTML string directly, without a global provider.
|
|
8
8
|
* Returns the raw string unchanged.
|
|
9
9
|
*/
|
|
10
|
-
declare const renderHTML: (content: string, _props?: RenderHTMLProps) => string;
|
|
10
|
+
export declare const renderHTML: (content: string, _props?: RenderHTMLProps) => string;
|
|
11
11
|
/**
|
|
12
12
|
* Returns a render function that uses the global provider's configuration
|
|
13
13
|
* (installed via `installIntlayerHTML`), falling back to identity.
|
|
14
14
|
*/
|
|
15
|
-
declare const useHTMLRenderer: ({ components }?: RenderHTMLProps) => ((content: string) => string);
|
|
15
|
+
export declare const useHTMLRenderer: ({ components }?: RenderHTMLProps) => ((content: string) => string);
|
|
16
16
|
//#endregion
|
|
17
|
-
export { RenderHTMLProps, renderHTML, useHTMLRenderer };
|
|
18
17
|
//# sourceMappingURL=HTMLRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTMLRenderer.d.ts","names":[],"sources":["../../../src/html/HTMLRenderer.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"HTMLRenderer.d.ts","names":[],"sources":["../../../src/html/HTMLRenderer.ts"],"mappings":";;YAGY;EACV,aAAa;;;;;;qBAOF,aAAU,iBACN,SACP;;;;;qBAOG,oBAAe,eAEzB,sBAAyB"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { HTMLComponents } from "./types.js";
|
|
2
2
|
//#region src/html/installIntlayerHTML.d.ts
|
|
3
|
-
type RenderHTMLOptions = {
|
|
3
|
+
export type RenderHTMLOptions = {
|
|
4
4
|
components?: HTMLComponents<'permissive', {}>;
|
|
5
5
|
};
|
|
6
|
-
type RenderHTMLFunction = (html: string, overrides?: HTMLComponents<'permissive', {}> | RenderHTMLOptions) => string;
|
|
7
|
-
type IntlayerHTMLProvider = {
|
|
6
|
+
export type RenderHTMLFunction = (html: string, overrides?: HTMLComponents<'permissive', {}> | RenderHTMLOptions) => string;
|
|
7
|
+
export type IntlayerHTMLProvider = {
|
|
8
8
|
renderHTML: RenderHTMLFunction;
|
|
9
9
|
};
|
|
10
|
-
type IntlayerHTMLPluginOptions = {
|
|
10
|
+
export type IntlayerHTMLPluginOptions = {
|
|
11
11
|
components?: HTMLComponents<'permissive', {}>;
|
|
12
12
|
renderHTML?: RenderHTMLFunction;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Create and return a single IntlayerHTMLProvider instance.
|
|
16
16
|
*/
|
|
17
|
-
declare const createIntlayerHTMLClient: (renderHTML: RenderHTMLFunction) => IntlayerHTMLProvider;
|
|
17
|
+
export declare const createIntlayerHTMLClient: (renderHTML: RenderHTMLFunction) => IntlayerHTMLProvider;
|
|
18
18
|
/**
|
|
19
19
|
* Install the Intlayer HTML provider for your vanilla JS application.
|
|
20
20
|
*
|
|
@@ -29,13 +29,13 @@ declare const createIntlayerHTMLClient: (renderHTML: RenderHTMLFunction) => Intl
|
|
|
29
29
|
* });
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
declare const installIntlayerHTML: (pluginOptions?: IntlayerHTMLPluginOptions | RenderHTMLFunction) => IntlayerHTMLProvider;
|
|
32
|
+
export declare const installIntlayerHTML: (pluginOptions?: IntlayerHTMLPluginOptions | RenderHTMLFunction) => IntlayerHTMLProvider;
|
|
33
33
|
/**
|
|
34
34
|
* Access the installed IntlayerHTMLProvider.
|
|
35
35
|
* Returns a fallback renderer that outputs the raw HTML string if no
|
|
36
36
|
* provider has been installed.
|
|
37
37
|
*/
|
|
38
|
-
declare const useHTML: () => IntlayerHTMLProvider;
|
|
38
|
+
export declare const useHTML: () => IntlayerHTMLProvider;
|
|
39
39
|
/**
|
|
40
40
|
* Asynchronously install an HTML renderer whose implementation is loaded
|
|
41
41
|
* via a dynamic `import()`.
|
|
@@ -60,7 +60,6 @@ declare const useHTML: () => IntlayerHTMLProvider;
|
|
|
60
60
|
* });
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
declare const installIntlayerHTMLDynamic: (loader: () => Promise<IntlayerHTMLPluginOptions | RenderHTMLFunction>) => Promise<IntlayerHTMLProvider>;
|
|
63
|
+
export declare const installIntlayerHTMLDynamic: (loader: () => Promise<IntlayerHTMLPluginOptions | RenderHTMLFunction>) => Promise<IntlayerHTMLProvider>;
|
|
64
64
|
//#endregion
|
|
65
|
-
export { IntlayerHTMLPluginOptions, IntlayerHTMLProvider, RenderHTMLFunction, RenderHTMLOptions, createIntlayerHTMLClient, installIntlayerHTML, installIntlayerHTMLDynamic, useHTML };
|
|
66
65
|
//# sourceMappingURL=installIntlayerHTML.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installIntlayerHTML.d.ts","names":[],"sources":["../../../src/html/installIntlayerHTML.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"installIntlayerHTML.d.ts","names":[],"sources":["../../../src/html/installIntlayerHTML.ts"],"mappings":";;YAEY;EACV,aAAa;;YAGH,sBACV,cACA,YAAY,mCAAmC;YAQrC;EACV,YAAY;;YAGF;EACV,aAAa;EACb,aAAa;;;;;qBAMF,2BAAwB,YACvB,uBACX;;;;;;;;;;;;;;;qBAoBU,sBAAmB,gBACd,4BAA4B,uBAC3C;;;;;;qBA2CU,eAAc;;;;;;;;;;;;;;;;;;;;;;;;;qBA6Bd,6BAA0B,cACvB,QAAQ,4BAA4B,wBACjD,QAAQ"}
|
|
@@ -26,14 +26,13 @@ type RestHTMLComponents<T> = { [K in Exclude<keyof HTMLTagsType, keyof T>]?: Van
|
|
|
26
26
|
/**
|
|
27
27
|
* The supported modes for the HTMLComponents type.
|
|
28
28
|
*/
|
|
29
|
-
type HTMLComponentMode = 'permissive' | 'optional' | 'inclusive' | 'strict';
|
|
29
|
+
export type HTMLComponentMode = 'permissive' | 'optional' | 'inclusive' | 'strict';
|
|
30
30
|
/**
|
|
31
31
|
* Component map for HTML rendering in vanilla JS.
|
|
32
32
|
* Each component receives props and children and returns an HTML string.
|
|
33
33
|
*/
|
|
34
|
-
type HTMLComponents<Mode extends HTMLComponentMode = 'optional', T = {}> = Mode extends 'strict' ? DefinedComponents<T, true> : Mode extends 'inclusive' ? DefinedComponents<T, true> & RestHTMLComponents<T> : Mode extends 'permissive' ? DefinedComponents<T, false> & RestHTMLComponents<T> & {
|
|
34
|
+
export type HTMLComponents<Mode extends HTMLComponentMode = 'optional', T = {}> = Mode extends 'strict' ? DefinedComponents<T, true> : Mode extends 'inclusive' ? DefinedComponents<T, true> & RestHTMLComponents<T> : Mode extends 'permissive' ? DefinedComponents<T, false> & RestHTMLComponents<T> & {
|
|
35
35
|
[key: string]: VanillaHTMLComponent;
|
|
36
36
|
} : DefinedComponents<T, false> & RestHTMLComponents<T>;
|
|
37
37
|
//#endregion
|
|
38
|
-
export { HTMLComponentMode, HTMLComponents };
|
|
39
38
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/html/types.ts"],"mappings":";;;;;KAKK,gBAAgB,SAAS,0BAE1B,uBACE;;;;;KAOD,eAAe;EAClB;;;;;KAMG,qBAAqB,WAAW,OAAO,IAAI;;;;KAK3C,kBAAkB,GAAG,8BAA8B,6BAEjD,WAAW,IAAI,qBAAqB,gBAAgB,EAAE,aAGtD,WAAW,KAAK,qBAAqB,gBAAgB,EAAE;;;;KAMzD,mBAAmB,QACrB,KAAK,cAAc,oBAAoB,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/html/types.ts"],"mappings":";;;;;KAKK,gBAAgB,SAAS,0BAE1B,uBACE;;;;;KAOD,eAAe;EAClB;;;;;KAMG,qBAAqB,WAAW,OAAO,IAAI;;;;KAK3C,kBAAkB,GAAG,8BAA8B,6BAEjD,WAAW,IAAI,qBAAqB,gBAAgB,EAAE,aAGtD,WAAW,KAAK,qBAAqB,gBAAgB,EAAE;;;;KAMzD,mBAAmB,QACrB,KAAK,cAAc,oBAAoB,MAAM;;;;YAMpC;;;;;YAUA,eACV,aAAa,gCACb,UACE,wBACA,kBAAkB,WAClB,2BACE,kBAAkB,WAAW,mBAAmB,KAChD,4BACE,kBAAkB,YAChB,mBAAmB;GAChB,cAAc;IAEnB,kBAAkB,YAAY,mBAAmB"}
|
|
@@ -2,7 +2,7 @@ import { HTMLComponents } from "../html/types.js";
|
|
|
2
2
|
import { ParsedMarkdown } from "./compiler.js";
|
|
3
3
|
import { MarkdownProviderOptions } from "./installIntlayerMarkdown.js";
|
|
4
4
|
//#region src/markdown/MarkdownRenderer.d.ts
|
|
5
|
-
type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
5
|
+
export type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
6
6
|
components?: HTMLComponents<'permissive', {}>;
|
|
7
7
|
wrapper?: string;
|
|
8
8
|
};
|
|
@@ -16,12 +16,11 @@ type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
|
16
16
|
* document.querySelector('#content').innerHTML = renderMarkdown('# Hello **World**');
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
declare const renderMarkdown: (content: string | ParsedMarkdown, { forceBlock, forceInline, preserveFrontmatter, tagfilter }?: RenderMarkdownProps) => string;
|
|
19
|
+
export declare const renderMarkdown: (content: string | ParsedMarkdown, { forceBlock, forceInline, preserveFrontmatter, tagfilter }?: RenderMarkdownProps) => string;
|
|
20
20
|
/**
|
|
21
21
|
* Returns a render function that uses the global provider's configuration
|
|
22
22
|
* (installed via `installIntlayerMarkdown`), falling back to `compileMarkdown`.
|
|
23
23
|
*/
|
|
24
|
-
declare const useMarkdownRenderer: (props?: RenderMarkdownProps) => ((content: string | ParsedMarkdown) => string | Promise<string>);
|
|
24
|
+
export declare const useMarkdownRenderer: (props?: RenderMarkdownProps) => ((content: string | ParsedMarkdown) => string | Promise<string>);
|
|
25
25
|
//#endregion
|
|
26
|
-
export { RenderMarkdownProps, renderMarkdown, useMarkdownRenderer };
|
|
27
26
|
//# sourceMappingURL=MarkdownRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRenderer.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRenderer.ts"],"mappings":";;;;YAYY,sBAAsB;EAChC,aAAa;EACb;;;;;;;;;;;;qBAaW,iBAAc,kBACP,kBAAc,YAAA,aAAA,qBAAA,cAM7B;;;;;qBAeQ,sBAAmB,QACvB,0BACJ,kBAAkB,4BAA4B"}
|
|
@@ -4,7 +4,7 @@ import { CompileOptions, ParsedMarkdown } from "@intlayer/core/markdown";
|
|
|
4
4
|
* Options accepted by `compileMarkdown` and `parseMarkdown` to customise
|
|
5
5
|
* rendering behaviour (custom components, sanitizer, slugify, rule hooks, …).
|
|
6
6
|
*/
|
|
7
|
-
type MarkdownCompilerOptions = CompileOptions;
|
|
7
|
+
export type MarkdownCompilerOptions = CompileOptions;
|
|
8
8
|
/**
|
|
9
9
|
* **Step 1 of 2 — parse only.**
|
|
10
10
|
* Converts a raw markdown string into a `ParsedMarkdown` AST without rendering
|
|
@@ -23,7 +23,7 @@ type MarkdownCompilerOptions = CompileOptions;
|
|
|
23
23
|
* document.querySelector('#content').innerHTML = compileMarkdown(ast);
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
declare const parseMarkdown: (markdown?: string, options?: MarkdownCompilerOptions) => ParsedMarkdown;
|
|
26
|
+
export declare const parseMarkdown: (markdown?: string, options?: MarkdownCompilerOptions) => ParsedMarkdown;
|
|
27
27
|
/**
|
|
28
28
|
* **Steps 1 + 2 — parse and render in one shot.**
|
|
29
29
|
* Accepts a raw markdown string or a pre-parsed `ParsedMarkdown` AST and
|
|
@@ -40,7 +40,7 @@ declare const parseMarkdown: (markdown?: string, options?: MarkdownCompilerOptio
|
|
|
40
40
|
* compileMarkdown('# Hello **World**');
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
declare const compileMarkdown: (input?: string | ParsedMarkdown, options?: MarkdownCompilerOptions) => string;
|
|
43
|
+
export declare const compileMarkdown: (input?: string | ParsedMarkdown, options?: MarkdownCompilerOptions) => string;
|
|
44
44
|
//#endregion
|
|
45
|
-
export {
|
|
45
|
+
export type { ParsedMarkdown };
|
|
46
46
|
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.d.ts","names":[],"sources":["../../../src/markdown/compiler.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","names":[],"sources":["../../../src/markdown/compiler.ts"],"mappings":";;;;;;YAqBY,0BAA0B;;;;;;;;;;;;;;;;;;;qBA2BzB,gBAAa,mBACR,UACP,4BACR;;;;;;;;;;;;;;;;;qBAoCU,kBAAe,iBACV,gBAAc,UACrB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLComponents } from "../html/types.js";
|
|
2
2
|
import { ParsedMarkdown } from "./compiler.js";
|
|
3
3
|
//#region src/markdown/installIntlayerMarkdown.d.ts
|
|
4
|
-
type MarkdownProviderOptions = {
|
|
4
|
+
export type MarkdownProviderOptions = {
|
|
5
5
|
/** Forces the compiler to always output content with a block-level wrapper. */
|
|
6
6
|
forceBlock?: boolean;
|
|
7
7
|
/** Forces the compiler to always output content with an inline wrapper. */
|
|
@@ -11,16 +11,16 @@ type MarkdownProviderOptions = {
|
|
|
11
11
|
/** Whether to use the GitHub Tag Filter. */
|
|
12
12
|
tagfilter?: boolean;
|
|
13
13
|
};
|
|
14
|
-
type RenderMarkdownOptions = MarkdownProviderOptions & {
|
|
14
|
+
export type RenderMarkdownOptions = MarkdownProviderOptions & {
|
|
15
15
|
components?: HTMLComponents<'permissive', {}>;
|
|
16
16
|
wrapper?: string;
|
|
17
17
|
};
|
|
18
|
-
type RenderMarkdownFunction = (markdown: string | ParsedMarkdown, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: string) => string | Promise<string>;
|
|
19
|
-
type IntlayerMarkdownProvider = {
|
|
18
|
+
export type RenderMarkdownFunction = (markdown: string | ParsedMarkdown, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: string) => string | Promise<string>;
|
|
19
|
+
export type IntlayerMarkdownProvider = {
|
|
20
20
|
components?: HTMLComponents<'permissive', {}>;
|
|
21
21
|
renderMarkdown: RenderMarkdownFunction;
|
|
22
22
|
};
|
|
23
|
-
type IntlayerMarkdownPluginOptions = MarkdownProviderOptions & {
|
|
23
|
+
export type IntlayerMarkdownPluginOptions = MarkdownProviderOptions & {
|
|
24
24
|
components?: HTMLComponents<'permissive', {}>;
|
|
25
25
|
wrapper?: string;
|
|
26
26
|
renderMarkdown?: RenderMarkdownFunction;
|
|
@@ -28,7 +28,7 @@ type IntlayerMarkdownPluginOptions = MarkdownProviderOptions & {
|
|
|
28
28
|
/**
|
|
29
29
|
* Create and return a single IntlayerMarkdownProvider instance.
|
|
30
30
|
*/
|
|
31
|
-
declare const createIntlayerMarkdownClient: (renderMarkdown: RenderMarkdownFunction, components?: HTMLComponents<'permissive', {}>) => IntlayerMarkdownProvider;
|
|
31
|
+
export declare const createIntlayerMarkdownClient: (renderMarkdown: RenderMarkdownFunction, components?: HTMLComponents<'permissive', {}>) => IntlayerMarkdownProvider;
|
|
32
32
|
/**
|
|
33
33
|
* Install the Intlayer Markdown provider for your vanilla JS application.
|
|
34
34
|
*
|
|
@@ -39,13 +39,13 @@ declare const createIntlayerMarkdownClient: (renderMarkdown: RenderMarkdownFunct
|
|
|
39
39
|
* installIntlayerMarkdown({ forceBlock: true });
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
declare const installIntlayerMarkdown: (pluginOptions?: IntlayerMarkdownPluginOptions | RenderMarkdownFunction) => IntlayerMarkdownProvider;
|
|
42
|
+
export declare const installIntlayerMarkdown: (pluginOptions?: IntlayerMarkdownPluginOptions | RenderMarkdownFunction) => IntlayerMarkdownProvider;
|
|
43
43
|
/**
|
|
44
44
|
* Access the installed IntlayerMarkdownProvider.
|
|
45
45
|
* Returns a fallback renderer that compiles with default options if no
|
|
46
46
|
* provider has been installed.
|
|
47
47
|
*/
|
|
48
|
-
declare const useMarkdown: () => IntlayerMarkdownProvider;
|
|
48
|
+
export declare const useMarkdown: () => IntlayerMarkdownProvider;
|
|
49
49
|
/**
|
|
50
50
|
* Asynchronously install a markdown renderer whose implementation is loaded
|
|
51
51
|
* via a dynamic `import()`.
|
|
@@ -69,7 +69,6 @@ declare const useMarkdown: () => IntlayerMarkdownProvider;
|
|
|
69
69
|
* });
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
|
-
declare const installIntlayerMarkdownDynamic: (loader: () => Promise<IntlayerMarkdownPluginOptions | RenderMarkdownFunction>) => Promise<IntlayerMarkdownProvider>;
|
|
72
|
+
export declare const installIntlayerMarkdownDynamic: (loader: () => Promise<IntlayerMarkdownPluginOptions | RenderMarkdownFunction>) => Promise<IntlayerMarkdownProvider>;
|
|
73
73
|
//#endregion
|
|
74
|
-
export { IntlayerMarkdownPluginOptions, IntlayerMarkdownProvider, MarkdownProviderOptions, RenderMarkdownFunction, RenderMarkdownOptions, createIntlayerMarkdownClient, installIntlayerMarkdown, installIntlayerMarkdownDynamic, useMarkdown };
|
|
75
74
|
//# sourceMappingURL=installIntlayerMarkdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installIntlayerMarkdown.d.ts","names":[],"sources":["../../../src/markdown/installIntlayerMarkdown.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"installIntlayerMarkdown.d.ts","names":[],"sources":["../../../src/markdown/installIntlayerMarkdown.ts"],"mappings":";;;YAOY;;EAEV;;EAEA;;EAEA;;EAEA;;YAGU,wBAAwB;EAClC,aAAa;EACb;;YAGU,0BACV,mBAAmB,gBACnB,UAAU,yBACV,aAAa,kCACb,8BACY;YAOF;EACV,aAAa;EACb,gBAAgB;;YAGN,gCAAgC;EAC1C,aAAa;EACb;EACA,iBAAiB;;;;;qBAMN,+BAA4B,gBACvB,wBAAsB,aACzB,qCACZ;;;;;;;;;;;qBAiBU,0BAAuB,gBAClB,gCAAgC,2BAC/C;;;;;;qBAsDU,mBAAkB;;;;;;;;;;;;;;;;;;;;;;;;qBAgClB,iCAA8B,cAC3B,QAAQ,gCAAgC,4BACrD,QAAQ"}
|
|
@@ -3,13 +3,13 @@ import { MarkdownRuntime } from "@intlayer/core/markdown";
|
|
|
3
3
|
/**
|
|
4
4
|
* Vanilla-specific MarkdownRuntime that produces HTML strings.
|
|
5
5
|
*/
|
|
6
|
-
declare const vanillaRuntime: MarkdownRuntime;
|
|
6
|
+
export declare const vanillaRuntime: MarkdownRuntime;
|
|
7
7
|
/**
|
|
8
8
|
* Creates a vanilla runtime with a custom createElement for advanced use cases.
|
|
9
9
|
*/
|
|
10
|
-
declare const createVanillaRuntime: (options?: {
|
|
10
|
+
export declare const createVanillaRuntime: (options?: {
|
|
11
11
|
onCreateElement?: (type: any, props: Record<string, any> | null, children: any[]) => string;
|
|
12
12
|
}) => MarkdownRuntime;
|
|
13
13
|
//#endregion
|
|
14
|
-
export {
|
|
14
|
+
export { vanillaRuntime as default };
|
|
15
15
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/markdown/runtime.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/markdown/runtime.ts"],"mappings":";;;;;qBA6Ca,gBAAgB;;;;qBA6EhB,uBAAoB;EAE7B,mBACE,WACA,OAAO,4BACP;MAGH"}
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -8,25 +8,25 @@ import { NodeType } from "@intlayer/types/nodeType";
|
|
|
8
8
|
/** ---------------------------------------------
|
|
9
9
|
* INTLAYER NODE PLUGIN
|
|
10
10
|
* --------------------------------------------- */
|
|
11
|
-
type IntlayerNodeCond<T> = T extends number | string ? IntlayerNode<T> : never;
|
|
12
|
-
type IntlayerNode<T, P = {}> = IntlayerNode$1<T> & P;
|
|
13
|
-
declare const intlayerNodePlugins: Plugins;
|
|
11
|
+
export type IntlayerNodeCond<T> = T extends number | string ? IntlayerNode<T> : never;
|
|
12
|
+
export type IntlayerNode<T, P = {}> = IntlayerNode$1<T> & P;
|
|
13
|
+
export declare const intlayerNodePlugins: Plugins;
|
|
14
14
|
/** ---------------------------------------------
|
|
15
15
|
* INSERTION PLUGIN
|
|
16
16
|
* --------------------------------------------- */
|
|
17
|
-
type InsertionCond<T, _S, L extends LocalesValues> = T extends {
|
|
17
|
+
export type InsertionCond<T, _S, L extends LocalesValues> = T extends {
|
|
18
18
|
nodeType: NodeType | string;
|
|
19
19
|
[NodeTypes.INSERTION]: infer I;
|
|
20
20
|
fields: readonly (infer F)[];
|
|
21
21
|
} ? <V extends { [K in Extract<F, string>]: string | number; }>(values: V) => I extends string ? IntlayerNode<string> : DeepTransformContent<I, L> : never;
|
|
22
|
-
declare const insertionPlugin: Plugins;
|
|
23
|
-
type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
|
|
22
|
+
export declare const insertionPlugin: Plugins;
|
|
23
|
+
export type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
|
|
24
24
|
metadata: DeepTransformContent<string>;
|
|
25
25
|
/** Returns the rendered markdown; render with .use(). */
|
|
26
26
|
use: (components?: HTMLComponents<'permissive', {}>) => string;
|
|
27
27
|
}> : never;
|
|
28
|
-
declare const markdownStringPlugin: Plugins;
|
|
29
|
-
type MarkdownCond<T> = T extends {
|
|
28
|
+
export declare const markdownStringPlugin: Plugins;
|
|
29
|
+
export type MarkdownCond<T> = T extends {
|
|
30
30
|
nodeType: NodeType | string;
|
|
31
31
|
[NodeTypes.MARKDOWN]: infer M;
|
|
32
32
|
metadata?: infer U;
|
|
@@ -35,22 +35,22 @@ type MarkdownCond<T> = T extends {
|
|
|
35
35
|
use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<M>;
|
|
36
36
|
metadata: DeepTransformContent<U>;
|
|
37
37
|
} : never;
|
|
38
|
-
declare const markdownPlugin: Plugins;
|
|
38
|
+
export declare const markdownPlugin: Plugins;
|
|
39
39
|
/** ---------------------------------------------
|
|
40
40
|
* HTML PLUGIN
|
|
41
41
|
* --------------------------------------------- */
|
|
42
|
-
type HTMLPluginCond<T> = T extends {
|
|
42
|
+
export type HTMLPluginCond<T> = T extends {
|
|
43
43
|
nodeType: NodeType | string;
|
|
44
44
|
[NodeTypes.HTML]: infer I;
|
|
45
45
|
tags?: infer U;
|
|
46
46
|
} ? {
|
|
47
47
|
use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;
|
|
48
48
|
} : never;
|
|
49
|
-
declare const htmlPlugin: Plugins;
|
|
49
|
+
export declare const htmlPlugin: Plugins;
|
|
50
50
|
/** ---------------------------------------------
|
|
51
51
|
* PLUGINS RESULT
|
|
52
52
|
* --------------------------------------------- */
|
|
53
|
-
interface IInterpreterPluginVanilla<T, S, L extends LocalesValues> {
|
|
53
|
+
export interface IInterpreterPluginVanilla<T, S, L extends LocalesValues> {
|
|
54
54
|
vanillaIntlayerNode: IntlayerNodeCond<T>;
|
|
55
55
|
vanillaInsertion: InsertionCond<T, S, L>;
|
|
56
56
|
vanillaMarkdown: MarkdownCond<T>;
|
|
@@ -63,18 +63,17 @@ interface IInterpreterPluginVanilla<T, S, L extends LocalesValues> {
|
|
|
63
63
|
* Use `getIntlayer` from `vanilla-intlayer` (not from `intlayer`) to get properly typed
|
|
64
64
|
* `IntlayerNode` wrappers with `.value` access on string/number content.
|
|
65
65
|
*/
|
|
66
|
-
type IInterpreterPluginState = Omit<IInterpreterPluginState$1, 'insertion'> & {
|
|
66
|
+
export type IInterpreterPluginState = Omit<IInterpreterPluginState$1, 'insertion'> & {
|
|
67
67
|
vanillaIntlayerNode: true;
|
|
68
68
|
vanillaInsertion: true;
|
|
69
69
|
vanillaMarkdown: true;
|
|
70
70
|
vanillaHtml: true;
|
|
71
71
|
};
|
|
72
|
-
type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContent$1<T, IInterpreterPluginState, L>;
|
|
72
|
+
export type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContent$1<T, IInterpreterPluginState, L>;
|
|
73
73
|
/**
|
|
74
74
|
* Get the plugins array for Vanilla content transformation.
|
|
75
75
|
* This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.
|
|
76
76
|
*/
|
|
77
|
-
declare const getPlugins: (locale?: LocalesValues, fallback?: boolean) => Plugins[];
|
|
77
|
+
export declare const getPlugins: (locale?: LocalesValues, fallback?: boolean) => Plugins[];
|
|
78
78
|
//#endregion
|
|
79
|
-
export { DeepTransformContent, HTMLPluginCond, IInterpreterPluginState, IInterpreterPluginVanilla, InsertionCond, IntlayerNode, IntlayerNodeCond, MarkdownCond, MarkdownStringCond, getPlugins, htmlPlugin, insertionPlugin, intlayerNodePlugins, markdownPlugin, markdownStringPlugin };
|
|
80
79
|
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.ts"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.ts"],"mappings":";;;;;;;;;;YA6CY,iBAAiB,KAAK,4BAC9B,aAAa;YAGL,aAAa,GAAG,UAAU,eAAiB,KAAK;qBAQ/C,qBAAqB;;;;YAmDtB,cAAc,GAAG,IAAI,UAAU,iBAAiB;EAC1D,UAAU;GACT,UAAU,kBAAkB;EAC7B,wBAAwB;KAErB,aAAa,KAAK,QAAQ,iCACzB,QAAQ,MACL,mBAAmB,uBAAuB,qBAAqB,GAAG;qBAG9D,iBAAiB;YA+HlB,mBAAmB,KAAK,mBAChC;EAGI,UAAU;;EAEV,MAAM,aAAa;;qBAKd,sBAAsB;YAuEvB,aAAa,KAAK;EAC5B,UAAU;GACT,UAAU,iBAAiB;EAC5B,iBAAiB;EACjB,aAAa;;EAGT,MAAM,aAAa,6BAA6B,OAAO,aAAa;EACpE,UAAU,qBAAqB;;qBAIxB,gBAAgB;;;;YA2BjB,eAAe,KAAK;EAC9B,UAAU;GACT,UAAU,aAAa;EACxB,aAAa;;EAGT,MAAM,aAAa,6BAA6B,OAAO,aAAa;;qBAI7D,YAAY;;;;iBAqER,0BAA0B,GAAG,GAAG,UAAU;EACzD,qBAAqB,iBAAiB;EACtC,kBAAkB,cAAc,GAAG,GAAG;EACtC,iBAAiB,aAAa;EAC9B,aAAa,eAAe;;;;;;;;;YAUlB,0BAA0B,KACpC;EAGA;EACA;EACA;EACA;;YAGU,qBACV,GACA,UAAU,gBAAgB,mBACxB,uBAAyB,GAAG,yBAAyB;;;;;qBAQ5C,aAAU,SACZ,eAAa,uBAErB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedEditor } from "@intlayer/types/module_augmentation";
|
|
2
2
|
//#region src/renderIntlayerNode.d.ts
|
|
3
|
-
type IntlayerNode<T = string> = ResolvedEditor<T & {
|
|
3
|
+
export type IntlayerNode<T = string> = ResolvedEditor<T & {
|
|
4
4
|
raw: T;
|
|
5
5
|
value: T;
|
|
6
6
|
toString: () => string;
|
|
@@ -15,12 +15,11 @@ type IntlayerNode<T = string> = ResolvedEditor<T & {
|
|
|
15
15
|
toJSON: () => T;
|
|
16
16
|
__update: (next: IntlayerNode<T>) => void;
|
|
17
17
|
}> & T;
|
|
18
|
-
declare const renderIntlayerNode: <T>({ value, children, additionalProps }: {
|
|
18
|
+
export declare const renderIntlayerNode: <T>({ value, children, additionalProps }: {
|
|
19
19
|
value: T;
|
|
20
20
|
children?: any;
|
|
21
21
|
additionalProps?: Record<string, unknown>;
|
|
22
22
|
[key: string]: unknown;
|
|
23
23
|
}) => IntlayerNode<T>;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { IntlayerNode, renderIntlayerNode };
|
|
26
25
|
//# sourceMappingURL=renderIntlayerNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderIntlayerNode.d.ts","names":[],"sources":["../../src/renderIntlayerNode.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"renderIntlayerNode.d.ts","names":[],"sources":["../../src/renderIntlayerNode.ts"],"mappings":";;YAEY,aAAa,cAAc,eACrC;EACE,KAAK;EACL,OAAO;EACP;EACA,eAAe;EACf,cAAc;EACd,WAAW,MAAM,aAAa;;EAG9B,KAAK;EACL,OAAO;EACP;EACA,eAAe;EACf,cAAc;EACd,WAAW,MAAM,aAAa;KAGhC;qBAEW,qBACX,KAAC,OAAA,UAAA;EAMD,OAAO;EACP;EACA,kBAAkB;GACjB;MACC,aAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vanilla-intlayer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Vanilla JS, HTML, and PHP applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -101,24 +101,24 @@
|
|
|
101
101
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@intlayer/api": "9.
|
|
105
|
-
"@intlayer/config": "9.
|
|
106
|
-
"@intlayer/core": "9.
|
|
107
|
-
"@intlayer/editor": "9.
|
|
108
|
-
"@intlayer/types": "9.
|
|
104
|
+
"@intlayer/api": "9.5.1",
|
|
105
|
+
"@intlayer/config": "9.5.1",
|
|
106
|
+
"@intlayer/core": "9.5.1",
|
|
107
|
+
"@intlayer/editor": "9.5.1",
|
|
108
|
+
"@intlayer/types": "9.5.1"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@types/node": "26.
|
|
111
|
+
"@types/node": "26.5.0",
|
|
112
112
|
"@utils/ts-config": "1.0.4",
|
|
113
113
|
"@utils/ts-config-types": "1.0.4",
|
|
114
114
|
"@utils/tsdown-config": "1.0.4",
|
|
115
115
|
"rimraf": "6.1.3",
|
|
116
|
-
"tsdown": "0.
|
|
116
|
+
"tsdown": "0.23.0",
|
|
117
117
|
"typescript": "7.0.2",
|
|
118
|
-
"vitest": "
|
|
118
|
+
"vitest": "5.0.0"
|
|
119
119
|
},
|
|
120
120
|
"peerDependencies": {
|
|
121
|
-
"intlayer": "9.
|
|
121
|
+
"intlayer": "9.5.1"
|
|
122
122
|
},
|
|
123
123
|
"peerDependenciesMeta": {
|
|
124
124
|
"intlayer": {
|