preact-intlayer 8.4.4 → 8.4.6
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/dist/cjs/IntlayerNode.cjs +16 -1
- package/dist/cjs/IntlayerNode.cjs.map +1 -1
- package/dist/cjs/UI/ContentSelector.cjs +96 -1
- package/dist/cjs/UI/ContentSelector.cjs.map +1 -1
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/cjs/client/IntlayerProvider.cjs +88 -1
- package/dist/cjs/client/IntlayerProvider.cjs.map +1 -0
- package/dist/cjs/client/format/index.cjs +18 -1
- package/dist/cjs/client/format/useCompact.cjs +27 -1
- package/dist/cjs/client/format/useCompact.cjs.map +1 -1
- package/dist/cjs/client/format/useCurrency.cjs +41 -1
- package/dist/cjs/client/format/useCurrency.cjs.map +1 -1
- package/dist/cjs/client/format/useDate.cjs +43 -1
- package/dist/cjs/client/format/useDate.cjs.map +1 -1
- package/dist/cjs/client/format/useIntl.cjs +33 -1
- package/dist/cjs/client/format/useIntl.cjs.map +1 -1
- package/dist/cjs/client/format/useList.cjs +38 -1
- package/dist/cjs/client/format/useList.cjs.map +1 -1
- package/dist/cjs/client/format/useNumber.cjs +39 -1
- package/dist/cjs/client/format/useNumber.cjs.map +1 -1
- package/dist/cjs/client/format/usePercentage.cjs +35 -1
- package/dist/cjs/client/format/usePercentage.cjs.map +1 -1
- package/dist/cjs/client/format/useRelativeTime.cjs +35 -1
- package/dist/cjs/client/format/useRelativeTime.cjs.map +1 -1
- package/dist/cjs/client/format/useUnit.cjs +34 -1
- package/dist/cjs/client/format/useUnit.cjs.map +1 -1
- package/dist/cjs/client/index.cjs +32 -1
- package/dist/cjs/client/t.cjs +19 -1
- package/dist/cjs/client/t.cjs.map +1 -1
- package/dist/cjs/client/useContent.cjs +19 -1
- package/dist/cjs/client/useContent.cjs.map +1 -1
- package/dist/cjs/client/useDictionary.cjs +25 -1
- package/dist/cjs/client/useDictionary.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +22 -1
- package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +21 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
- package/dist/cjs/client/useIntlayer.cjs +40 -1
- package/dist/cjs/client/useIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useLoadDynamic.cjs +27 -1
- package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
- package/dist/cjs/client/useLocale.cjs +54 -1
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocaleBase.cjs +24 -1
- package/dist/cjs/client/useLocaleBase.cjs.map +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +59 -1
- package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
- package/dist/cjs/client/useTraduction.cjs +35 -1
- package/dist/cjs/client/useTraduction.cjs.map +1 -1
- package/dist/cjs/editor/ContentSelector.cjs +24 -1
- package/dist/cjs/editor/ContentSelector.cjs.map +1 -1
- package/dist/cjs/editor/EditorProvider.cjs +12 -1
- package/dist/cjs/editor/EditorProvider.cjs.map +1 -0
- package/dist/cjs/editor/useEditor.cjs +38 -1
- package/dist/cjs/editor/useEditor.cjs.map +1 -0
- package/dist/cjs/getDictionary.cjs +10 -1
- package/dist/cjs/getDictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayer.cjs +10 -1
- package/dist/cjs/getIntlayer.cjs.map +1 -1
- package/dist/cjs/html/HTMLProvider.cjs +17 -1
- package/dist/cjs/html/HTMLProvider.cjs.map +1 -1
- package/dist/cjs/html/HTMLRenderer.cjs +54 -1
- package/dist/cjs/html/HTMLRenderer.cjs.map +1 -1
- package/dist/cjs/html/index.cjs +10 -1
- package/dist/cjs/index.cjs +57 -1
- package/dist/cjs/markdown/MarkdownProvider.cjs +54 -1
- package/dist/cjs/markdown/MarkdownProvider.cjs.map +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +77 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
- package/dist/cjs/markdown/MarkdownRendererPlugin.cjs +26 -1
- package/dist/cjs/markdown/MarkdownRendererPlugin.cjs.map +1 -1
- package/dist/cjs/markdown/compiler.cjs +24 -1
- package/dist/cjs/markdown/compiler.cjs.map +1 -1
- package/dist/cjs/markdown/index.cjs +23 -1
- package/dist/cjs/markdown/runtime.cjs +18 -1
- package/dist/cjs/markdown/runtime.cjs.map +1 -1
- package/dist/cjs/plugins.cjs +239 -1
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/cjs/preactElement/renderPreactElement.cjs +42 -1
- package/dist/cjs/preactElement/renderPreactElement.cjs.map +1 -1
- package/dist/esm/IntlayerNode.mjs +14 -1
- package/dist/esm/IntlayerNode.mjs.map +1 -1
- package/dist/esm/UI/ContentSelector.mjs +94 -1
- package/dist/esm/UI/ContentSelector.mjs.map +1 -1
- package/dist/esm/client/IntlayerProvider.mjs +82 -1
- package/dist/esm/client/IntlayerProvider.mjs.map +1 -0
- package/dist/esm/client/format/index.mjs +10 -1
- package/dist/esm/client/format/useCompact.mjs +25 -1
- package/dist/esm/client/format/useCompact.mjs.map +1 -1
- package/dist/esm/client/format/useCurrency.mjs +39 -1
- package/dist/esm/client/format/useCurrency.mjs.map +1 -1
- package/dist/esm/client/format/useDate.mjs +41 -1
- package/dist/esm/client/format/useDate.mjs.map +1 -1
- package/dist/esm/client/format/useIntl.mjs +31 -1
- package/dist/esm/client/format/useIntl.mjs.map +1 -1
- package/dist/esm/client/format/useList.mjs +36 -1
- package/dist/esm/client/format/useList.mjs.map +1 -1
- package/dist/esm/client/format/useNumber.mjs +37 -1
- package/dist/esm/client/format/useNumber.mjs.map +1 -1
- package/dist/esm/client/format/usePercentage.mjs +33 -1
- package/dist/esm/client/format/usePercentage.mjs.map +1 -1
- package/dist/esm/client/format/useRelativeTime.mjs +33 -1
- package/dist/esm/client/format/useRelativeTime.mjs.map +1 -1
- package/dist/esm/client/format/useUnit.mjs +32 -1
- package/dist/esm/client/format/useUnit.mjs.map +1 -1
- package/dist/esm/client/index.mjs +13 -1
- package/dist/esm/client/t.mjs +17 -1
- package/dist/esm/client/t.mjs.map +1 -1
- package/dist/esm/client/useContent.mjs +18 -1
- package/dist/esm/client/useContent.mjs.map +1 -1
- package/dist/esm/client/useDictionary.mjs +23 -1
- package/dist/esm/client/useDictionary.mjs.map +1 -1
- package/dist/esm/client/useDictionaryAsync.mjs +19 -1
- package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +19 -1
- package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
- package/dist/esm/client/useIntlayer.mjs +38 -1
- package/dist/esm/client/useIntlayer.mjs.map +1 -1
- package/dist/esm/client/useLoadDynamic.mjs +25 -1
- package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
- package/dist/esm/client/useLocale.mjs +51 -1
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/esm/client/useLocaleBase.mjs +21 -1
- package/dist/esm/client/useLocaleBase.mjs.map +1 -1
- package/dist/esm/client/useLocaleStorage.mjs +52 -1
- package/dist/esm/client/useLocaleStorage.mjs.map +1 -1
- package/dist/esm/client/useTraduction.mjs +33 -1
- package/dist/esm/client/useTraduction.mjs.map +1 -1
- package/dist/esm/editor/ContentSelector.mjs +22 -1
- package/dist/esm/editor/ContentSelector.mjs.map +1 -1
- package/dist/esm/editor/EditorProvider.mjs +11 -1
- package/dist/esm/editor/EditorProvider.mjs.map +1 -0
- package/dist/esm/editor/useEditor.mjs +36 -1
- package/dist/esm/editor/useEditor.mjs.map +1 -0
- package/dist/esm/getDictionary.mjs +8 -1
- package/dist/esm/getDictionary.mjs.map +1 -1
- package/dist/esm/getIntlayer.mjs +8 -1
- package/dist/esm/getIntlayer.mjs.map +1 -1
- package/dist/esm/html/HTMLProvider.mjs +14 -1
- package/dist/esm/html/HTMLProvider.mjs.map +1 -1
- package/dist/esm/html/HTMLRenderer.mjs +49 -1
- package/dist/esm/html/HTMLRenderer.mjs.map +1 -1
- package/dist/esm/html/index.mjs +4 -1
- package/dist/esm/index.mjs +22 -1
- package/dist/esm/markdown/MarkdownProvider.mjs +51 -1
- package/dist/esm/markdown/MarkdownProvider.mjs.map +1 -1
- package/dist/esm/markdown/MarkdownRenderer.mjs +73 -1
- package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -1
- package/dist/esm/markdown/MarkdownRendererPlugin.mjs +23 -1
- package/dist/esm/markdown/MarkdownRendererPlugin.mjs.map +1 -1
- package/dist/esm/markdown/compiler.mjs +17 -1
- package/dist/esm/markdown/compiler.mjs.map +1 -1
- package/dist/esm/markdown/index.mjs +7 -1
- package/dist/esm/markdown/runtime.mjs +15 -1
- package/dist/esm/markdown/runtime.mjs.map +1 -1
- package/dist/esm/plugins.mjs +229 -1
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/esm/preactElement/renderPreactElement.mjs +40 -1
- package/dist/esm/preactElement/renderPreactElement.mjs.map +1 -1
- package/dist/types/IntlayerNode.d.ts +23 -2
- package/dist/types/IntlayerNode.d.ts.map +1 -0
- package/dist/types/client/IntlayerProvider.d.ts +53 -2
- package/dist/types/client/IntlayerProvider.d.ts.map +1 -0
- package/dist/types/client/format/useIntl.d.ts +26 -2
- package/dist/types/client/format/useIntl.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +11 -11
- package/dist/types/client/t.d.ts +13 -2
- package/dist/types/client/t.d.ts.map +1 -0
- package/dist/types/client/useDictionary.d.ts +16 -2
- package/dist/types/client/useDictionary.d.ts.map +1 -0
- package/dist/types/client/useDictionaryAsync.d.ts +13 -2
- package/dist/types/client/useDictionaryAsync.d.ts.map +1 -0
- package/dist/types/client/useDictionaryDynamic.d.ts +16 -2
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -0
- package/dist/types/client/useIntlayer.d.ts +28 -2
- package/dist/types/client/useIntlayer.d.ts.map +1 -0
- package/dist/types/client/useLoadDynamic.d.ts +5 -2
- package/dist/types/client/useLoadDynamic.d.ts.map +1 -0
- package/dist/types/client/useLocale.d.ts +43 -2
- package/dist/types/client/useLocale.d.ts.map +1 -0
- package/dist/types/client/useLocaleBase.d.ts +16 -2
- package/dist/types/client/useLocaleBase.d.ts.map +1 -0
- package/dist/types/client/useLocaleStorage.d.ts +45 -2
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -0
- package/dist/types/getDictionary.d.ts +1 -1
- package/dist/types/getIntlayer.d.ts +1 -1
- package/dist/types/html/HTMLProvider.d.ts +18 -2
- package/dist/types/html/HTMLProvider.d.ts.map +1 -0
- package/dist/types/html/HTMLRenderer.d.ts +61 -2
- package/dist/types/html/HTMLRenderer.d.ts.map +1 -0
- package/dist/types/html/index.d.ts +2 -2
- package/dist/types/html/types.d.ts +38 -2
- package/dist/types/html/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +19 -19
- package/dist/types/markdown/MarkdownProvider.d.ts +52 -2
- package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -0
- package/dist/types/markdown/MarkdownRenderer.d.ts +61 -2
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -0
- package/dist/types/markdown/MarkdownRendererPlugin.d.ts +23 -2
- package/dist/types/markdown/MarkdownRendererPlugin.d.ts.map +1 -0
- package/dist/types/markdown/compiler.d.ts +14 -2
- package/dist/types/markdown/compiler.d.ts.map +1 -0
- package/dist/types/markdown/index.d.ts +5 -5
- package/dist/types/markdown/runtime.d.ts +10 -2
- package/dist/types/markdown/runtime.d.ts.map +1 -0
- package/dist/types/plugins.d.ts +96 -2
- package/dist/types/plugins.d.ts.map +1 -0
- package/package.json +7 -7
- package/dist/cjs/IntlayerProvider-sM1gzsx7.cjs +0 -2
- package/dist/cjs/IntlayerProvider-sM1gzsx7.cjs.map +0 -1
- package/dist/esm/IntlayerProvider-ClOcEK3A.mjs +0 -2
- package/dist/esm/IntlayerProvider-ClOcEK3A.mjs.map +0 -1
- package/dist/types/HTMLProvider-8sO8DU8H.d.ts +0 -18
- package/dist/types/HTMLProvider-8sO8DU8H.d.ts.map +0 -1
- package/dist/types/HTMLRenderer-NNa_9oMD.d.ts +0 -61
- package/dist/types/HTMLRenderer-NNa_9oMD.d.ts.map +0 -1
- package/dist/types/IntlayerNode-CIzFHYnC.d.ts +0 -23
- package/dist/types/IntlayerNode-CIzFHYnC.d.ts.map +0 -1
- package/dist/types/IntlayerProvider-aV596OL4.d.ts +0 -53
- package/dist/types/IntlayerProvider-aV596OL4.d.ts.map +0 -1
- package/dist/types/MarkdownProvider-chUIO05u.d.ts +0 -52
- package/dist/types/MarkdownProvider-chUIO05u.d.ts.map +0 -1
- package/dist/types/MarkdownRenderer-BMhuurZW.d.ts +0 -61
- package/dist/types/MarkdownRenderer-BMhuurZW.d.ts.map +0 -1
- package/dist/types/MarkdownRendererPlugin-DFRVdHCA.d.ts +0 -23
- package/dist/types/MarkdownRendererPlugin-DFRVdHCA.d.ts.map +0 -1
- package/dist/types/compiler-BB0gAVbe.d.ts +0 -14
- package/dist/types/compiler-BB0gAVbe.d.ts.map +0 -1
- package/dist/types/plugins-D6OB94dO.d.ts +0 -95
- package/dist/types/plugins-D6OB94dO.d.ts.map +0 -1
- package/dist/types/runtime-BMHAtT-R.d.ts +0 -10
- package/dist/types/runtime-BMHAtT-R.d.ts.map +0 -1
- package/dist/types/t-CalXqnSB.d.ts +0 -13
- package/dist/types/t-CalXqnSB.d.ts.map +0 -1
- package/dist/types/types-B3Kzdco6.d.ts +0 -38
- package/dist/types/types-B3Kzdco6.d.ts.map +0 -1
- package/dist/types/useDictionary-cjQAc1l1.d.ts +0 -16
- package/dist/types/useDictionary-cjQAc1l1.d.ts.map +0 -1
- package/dist/types/useDictionaryAsync-CDCcBnXn.d.ts +0 -13
- package/dist/types/useDictionaryAsync-CDCcBnXn.d.ts.map +0 -1
- package/dist/types/useDictionaryDynamic-BQgaM0vp.d.ts +0 -16
- package/dist/types/useDictionaryDynamic-BQgaM0vp.d.ts.map +0 -1
- package/dist/types/useIntl-DfzrSGu4.d.ts +0 -26
- package/dist/types/useIntl-DfzrSGu4.d.ts.map +0 -1
- package/dist/types/useIntlayer-BINmW9T1.d.ts +0 -28
- package/dist/types/useIntlayer-BINmW9T1.d.ts.map +0 -1
- package/dist/types/useLoadDynamic-DFXHehpF.d.ts +0 -5
- package/dist/types/useLoadDynamic-DFXHehpF.d.ts.map +0 -1
- package/dist/types/useLocale-BDQ4yLc5.d.ts +0 -43
- package/dist/types/useLocale-BDQ4yLc5.d.ts.map +0 -1
- package/dist/types/useLocaleBase-1L1RLyXD.d.ts +0 -16
- package/dist/types/useLocaleBase-1L1RLyXD.d.ts.map +0 -1
- package/dist/types/useLocaleStorage-BwH9gqN5.d.ts +0 -45
- package/dist/types/useLocaleStorage-BwH9gqN5.d.ts.map +0 -1
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
|
+
|
|
4
|
+
//#region src/client/useDictionaryAsync.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* On the server side, Hook that transform a dictionary and return the content
|
|
7
|
+
*
|
|
8
|
+
* If the locale is not provided, it will use the locale from the client context
|
|
9
|
+
*/
|
|
10
|
+
declare const useDictionaryAsync: <T extends Dictionary>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: LocalesValues) => Promise<T>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { useDictionaryAsync };
|
|
13
|
+
//# sourceMappingURL=useDictionaryAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryAsync.d.ts","names":[],"sources":["../../../src/client/useDictionaryAsync.ts"],"mappings":";;;;;;AAeA;;;cAAa,kBAAA,aAAsC,UAAA,EACjD,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,MAAA,GAAS,aAAA,KACR,OAAA,CAAQ,CAAA"}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
+
import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
|
|
3
|
+
import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
4
|
+
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
5
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
6
|
+
|
|
7
|
+
//#region src/client/useDictionaryDynamic.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* On the server side, Hook that transform a dictionary and return the content
|
|
10
|
+
*
|
|
11
|
+
* If the locale is not provided, it will use the locale from the client context
|
|
12
|
+
*/
|
|
13
|
+
declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1, _intlayer_types_allLocales0.Locale>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { useDictionaryDynamic };
|
|
16
|
+
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;cAgBa,oBAAA,aACD,UAAA,YACA,cAAA,EAEV,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KAAa,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,2BAAA,CAAA,MAAA"}
|
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { DeepTransformContent } from "../plugins.js";
|
|
2
|
+
import { DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
3
|
+
|
|
4
|
+
//#region src/client/useIntlayer.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Preact hook that picks one dictionary by its key and returns its content.
|
|
7
|
+
*
|
|
8
|
+
* If the locale is not provided, it will use the locale from the client context.
|
|
9
|
+
*
|
|
10
|
+
* @param key - The unique key of the dictionary to retrieve.
|
|
11
|
+
* @param locale - Optional locale to override the current context locale.
|
|
12
|
+
* @returns The transformed dictionary content.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { useIntlayer } from 'preact-intlayer';
|
|
17
|
+
*
|
|
18
|
+
* const MyComponent = () => {
|
|
19
|
+
* const content = useIntlayer('my-dictionary-key');
|
|
20
|
+
*
|
|
21
|
+
* return <div>{content.myField.value}</div>;
|
|
22
|
+
* };
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const useIntlayer: <T extends DictionaryKeys, L extends LocalesValues>(key: T, locale?: L) => DeepTransformContent<DictionaryRegistryContent<T>>;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useIntlayer };
|
|
28
|
+
//# sourceMappingURL=useIntlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/client/useIntlayer.ts"],"mappings":";;;;;;AA8BA;;;;;;;;;;;;;;;;;;cAAa,WAAA,aAAyB,cAAA,YAA0B,aAAA,EAC9D,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,KAAC,oBAAA,CAAA,yBAAA,CAAA,CAAA"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/client/useLoadDynamic.d.ts
|
|
2
|
+
declare const useLoadDynamic: <T>(key: string, promise: Promise<T>) => T;
|
|
3
|
+
//#endregion
|
|
4
|
+
export { useLoadDynamic };
|
|
5
|
+
//# sourceMappingURL=useLoadDynamic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLoadDynamic.d.ts","names":[],"sources":["../../../src/client/useLoadDynamic.ts"],"mappings":";cA2Ba,cAAA,MAAqB,GAAA,UAAa,OAAA,EAAS,OAAA,CAAQ,CAAA,MAAK,CAAA"}
|
|
@@ -1,2 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
3
|
+
|
|
4
|
+
//#region src/client/useLocale.d.ts
|
|
5
|
+
type useLocaleProps = {
|
|
6
|
+
isCookieEnabled?: boolean;
|
|
7
|
+
onLocaleChange?: (locale: LocalesValues) => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Preact hook to get the current locale and related locale management functions.
|
|
11
|
+
*
|
|
12
|
+
* @param props - Optional properties for the hook.
|
|
13
|
+
* @returns An object containing the current locale, default locale, available locales, and a function to update the locale.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { useLocale } from 'preact-intlayer';
|
|
18
|
+
*
|
|
19
|
+
* const LocaleSwitcher = () => {
|
|
20
|
+
* const { locale, setLocale, availableLocales } = useLocale();
|
|
21
|
+
*
|
|
22
|
+
* return (
|
|
23
|
+
* <select value={locale} onChange={(e) => setLocale(e.target.value)}>
|
|
24
|
+
* {availableLocales.map((loc) => (
|
|
25
|
+
* <option key={loc} value={loc}>{loc}</option>
|
|
26
|
+
* ))}
|
|
27
|
+
* </select>
|
|
28
|
+
* );
|
|
29
|
+
* };
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare const useLocale: ({
|
|
33
|
+
isCookieEnabled,
|
|
34
|
+
onLocaleChange
|
|
35
|
+
}?: useLocaleProps) => {
|
|
36
|
+
locale: LocalesValues;
|
|
37
|
+
defaultLocale: _intlayer_types_allLocales0.Locale;
|
|
38
|
+
availableLocales: _intlayer_types_allLocales0.Locale[];
|
|
39
|
+
setLocale: (locale: LocalesValues) => void;
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { useLocale };
|
|
43
|
+
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;;;KAMK,cAAA;EACH,eAAA;EACA,cAAA,IAAkB,MAAA,EAAQ,aAAA;AAAA;;;;;;;;;;AA0B5B;;;;;;;;;;;;;;cAAa,SAAA;EAAa,eAAA;EAAA;AAAA,IAGvB,cAAA;;;;sBAU0B,aAAA;AAAA"}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_augmentation";
|
|
2
|
+
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
3
|
+
|
|
4
|
+
//#region src/client/useLocaleBase.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* On the client side, hook to get the current locale and all related fields
|
|
7
|
+
*/
|
|
8
|
+
declare const useLocaleBase: () => {
|
|
9
|
+
locale: _intlayer_types_module_augmentation0.LocalesValues;
|
|
10
|
+
defaultLocale: _intlayer_types_allLocales0.Locale;
|
|
11
|
+
availableLocales: _intlayer_types_allLocales0.Locale[];
|
|
12
|
+
setLocale: (newLocale: _intlayer_types_module_augmentation0.LocalesValues) => void;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { useLocaleBase };
|
|
16
|
+
//# sourceMappingURL=useLocaleBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":";;;;;;;cAUa,aAAA;UASZ,oCAAA,CAAA,aAAA"}
|
|
@@ -1,2 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
3
|
+
|
|
4
|
+
//#region src/client/useLocaleStorage.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get the locale cookie
|
|
7
|
+
*/
|
|
8
|
+
declare const localeInStorage: _intlayer_types_allLocales0.Locale;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use localeInStorage instead
|
|
11
|
+
*
|
|
12
|
+
* Get the locale cookie
|
|
13
|
+
*/
|
|
14
|
+
declare const localeCookie: _intlayer_types_allLocales0.Locale;
|
|
15
|
+
/**
|
|
16
|
+
* Set the locale cookie
|
|
17
|
+
*/
|
|
18
|
+
declare const setLocaleInStorage: (locale: LocalesValues, isCookieEnabled: boolean) => void;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use setLocaleInStorage instead
|
|
21
|
+
*
|
|
22
|
+
* Set the locale cookie
|
|
23
|
+
*/
|
|
24
|
+
declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Hook that provides the locale storage and a function to set it
|
|
27
|
+
*/
|
|
28
|
+
declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
29
|
+
getLocale: () => _intlayer_types_allLocales0.Locale;
|
|
30
|
+
setLocale: (locale: LocalesValues) => void;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use useLocaleStorage instead
|
|
34
|
+
*
|
|
35
|
+
* For GDPR compliance, use useLocaleStorage instead
|
|
36
|
+
*
|
|
37
|
+
* Hook that provides the locale cookie and a function to set it
|
|
38
|
+
*/
|
|
39
|
+
declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
40
|
+
localeCookie: _intlayer_types_allLocales0.Locale;
|
|
41
|
+
setLocaleCookie: (locale: LocalesValues) => void;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage };
|
|
45
|
+
//# sourceMappingURL=useLocaleStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;cAYa,eAAA,EAA4D,2BAAA,CAA7C,MAAA;;;;;AAM5B;cAAa,YAAA,EAA8B,2BAAA,CAAlB,MAAA;;;;cAKZ,kBAAA,GACX,MAAA,EAAQ,aAAA,EACR,eAAA;;;;;;cAYW,eAAA,GAAe,MAAA,EAblB,aAAA,EAAa,eAAA;;;AAavB;cAKa,gBAAA,GAAoB,eAAA;mBAQ9B,2BAAA,CAAA,MAAA;sBAAA,aAAA;AAAA;;;;;AARH;;;cAiBa,eAAA,GAAmB,eAAA;gBAM/B,2BAAA,CAAA,MAAA;4BAAA,aAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeepTransformContent } from "./plugins.js";
|
|
2
2
|
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
3
3
|
|
|
4
4
|
//#region src/getIntlayer.d.ts
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { HTMLComponents } from "./types.js";
|
|
2
|
+
import { FunctionalComponent, RenderableProps } from "preact";
|
|
3
|
+
|
|
4
|
+
//#region src/html/HTMLProvider.d.ts
|
|
5
|
+
type HTMLContextValue = {
|
|
6
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
7
|
+
};
|
|
8
|
+
type HTMLProviderProps = RenderableProps<{
|
|
9
|
+
/**
|
|
10
|
+
* Component overrides for HTML tags.
|
|
11
|
+
*/
|
|
12
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
13
|
+
}>;
|
|
14
|
+
declare const useHTMLContext: () => HTMLContextValue;
|
|
15
|
+
declare const HTMLProvider: FunctionalComponent<HTMLProviderProps>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { HTMLProvider, useHTMLContext };
|
|
18
|
+
//# sourceMappingURL=HTMLProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HTMLProvider.d.ts","names":[],"sources":["../../../src/html/HTMLProvider.tsx"],"mappings":";;;;KAQK,gBAAA;EACH,UAAA,GAAa,cAAA;AAAA;AAAA,KAGV,iBAAA,GAAoB,eAAA;;;;EAIvB,UAAA,GAAa,cAAA;AAAA;AAAA,cAKF,cAAA,QAAc,gBAAA;AAAA,cAEd,YAAA,EAAc,mBAAA,CAAoB,iBAAA"}
|
|
@@ -1,2 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { HTMLComponents } from "./types.js";
|
|
2
|
+
import { FunctionComponent, JSX, h } from "preact";
|
|
3
|
+
import { KeyPath } from "@intlayer/types/keyPath";
|
|
4
|
+
|
|
5
|
+
//#region src/html/HTMLRenderer.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Type for Preact HTML tag components.
|
|
8
|
+
*/
|
|
9
|
+
type HTMLTagComponent = (props: {
|
|
10
|
+
children?: any;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}) => JSX.Element;
|
|
13
|
+
declare const defaultHTMLComponents: Record<string, HTMLTagComponent>;
|
|
14
|
+
type RenderHTMLProps = {
|
|
15
|
+
/**
|
|
16
|
+
* Component overrides for HTML tags.
|
|
17
|
+
* Allows you to customize how specific HTML elements are rendered.
|
|
18
|
+
*/
|
|
19
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Renders HTML-like content to JSX with the provided components.
|
|
23
|
+
*
|
|
24
|
+
* This function does not use context from HTMLProvider. Use `useHTMLRenderer`
|
|
25
|
+
* hook if you want to leverage provider context.
|
|
26
|
+
*/
|
|
27
|
+
declare const renderHTML: (content: string, {
|
|
28
|
+
components
|
|
29
|
+
}?: RenderHTMLProps) => JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* Hook that returns a function to render HTML content.
|
|
32
|
+
*
|
|
33
|
+
* This hook considers the configuration from the `HTMLProvider` context if available,
|
|
34
|
+
* falling back to the provided components.
|
|
35
|
+
*/
|
|
36
|
+
declare const useHTMLRenderer: ({
|
|
37
|
+
components
|
|
38
|
+
}?: RenderHTMLProps) => (content: string) => h.JSX.Element;
|
|
39
|
+
type HTMLRendererProps = RenderHTMLProps & {
|
|
40
|
+
/**
|
|
41
|
+
* The HTML content to render as a string.
|
|
42
|
+
*/
|
|
43
|
+
children?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Alias for children, used by the plugin.
|
|
46
|
+
*/
|
|
47
|
+
html?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Alias for components, used by the plugin.
|
|
50
|
+
*/
|
|
51
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
52
|
+
dictionaryKey?: string;
|
|
53
|
+
keyPath?: KeyPath[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Preact component that renders HTML-like content to JSX.
|
|
57
|
+
*/
|
|
58
|
+
declare const HTMLRenderer: FunctionComponent<HTMLRendererProps>;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { HTMLRenderer, HTMLRendererProps, RenderHTMLProps, defaultHTMLComponents, renderHTML, useHTMLRenderer };
|
|
61
|
+
//# sourceMappingURL=HTMLRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HTMLRenderer.d.ts","names":[],"sources":["../../../src/html/HTMLRenderer.tsx"],"mappings":";;;;;;;AAK8C;KAKzC,gBAAA,IAAoB,KAAA;EACvB,QAAA;EAAA,CACC,GAAA;AAAA,MACG,GAAA,CAAI,OAAA;AAAA,cAaG,qBAAA,EAAqB,MAAA,SAAA,gBAAA;AAAA,KAEtB,eAAA;EAfN;;;;EAoBJ,UAAA,GAAa,cAAA;AAAA;;;;AALf;;;cAca,UAAA,GACX,OAAA;EACA;AAAA,IAAgB,eAAA,KACf,GAAA,CAAI,OAAA;;AAHP;;;;;cA4Ba,eAAA;EAAmB;AAAA,IAAgB,eAAA,MAGtC,OAAA,aAAe,CAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAUb,iBAAA,GAAoB,eAAA;EArB/B;;;EAyBC,QAAA;EA3CgB;;;EA+ChB,IAAA;EA7BD;AAQD;;EAyBE,UAAA,GAAa,cAAA;EACb,aAAA;EACA,OAAA,GAAU,OAAA;AAAA;;;;cAMC,YAAA,EAAc,iBAAA,CAAkB,iBAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { HTMLProvider, useHTMLContext } from "./HTMLProvider.js";
|
|
2
|
+
import { HTMLRenderer, HTMLRendererProps, RenderHTMLProps, defaultHTMLComponents, renderHTML, useHTMLRenderer } from "./HTMLRenderer.js";
|
|
3
3
|
export { HTMLProvider, HTMLRenderer, HTMLRendererProps, RenderHTMLProps, defaultHTMLComponents, renderHTML, useHTMLContext, useHTMLRenderer };
|
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { FunctionalComponent, JSX } from "preact";
|
|
2
|
+
import { HTMLTagsType } from "@intlayer/core/transpiler";
|
|
3
|
+
|
|
4
|
+
//#region src/html/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Helper to extract specific props from the configuration value.
|
|
7
|
+
*/
|
|
8
|
+
type PropsFromConfig<Value> = Value extends true ? {} : Value extends object ? Value : {};
|
|
9
|
+
/**
|
|
10
|
+
* Smart Type to resolve props based on the key K.
|
|
11
|
+
*/
|
|
12
|
+
type ElementProps<K> = K extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[K] : JSX.HTMLAttributes<HTMLElement>;
|
|
13
|
+
/**
|
|
14
|
+
* Helper: Defines the mapping for the explicitly listed keys in T.
|
|
15
|
+
* Handles whether they are Required or Optional.
|
|
16
|
+
*/
|
|
17
|
+
type DefinedComponents<T, IsRequired extends boolean> = IsRequired extends true ? { [K in keyof T]: FunctionalComponent<ElementProps<K> & PropsFromConfig<T[K]>> } : { [K in keyof T]?: FunctionalComponent<ElementProps<K> & PropsFromConfig<T[K]>> };
|
|
18
|
+
/**
|
|
19
|
+
* Helper: Defines the standard HTML tags NOT listed in T.
|
|
20
|
+
* These are always optional when included.
|
|
21
|
+
*/
|
|
22
|
+
type RestHTMLComponents<T> = { [K in Exclude<keyof HTMLTagsType, keyof T>]?: FunctionalComponent<K extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[K] : JSX.HTMLAttributes<HTMLElement>> };
|
|
23
|
+
/**
|
|
24
|
+
* The supported modes for the HTMLComponents type.
|
|
25
|
+
*/
|
|
26
|
+
type HTMLComponentMode = 'permissive' | 'optional' | 'inclusive' | 'strict';
|
|
27
|
+
/**
|
|
28
|
+
* The main component definition with Mode support.
|
|
29
|
+
*/
|
|
30
|
+
type HTMLComponents<Mode extends HTMLComponentMode = 'optional', T = {}> = Mode extends 'strict' ? DefinedComponents<T, true> : Mode extends 'inclusive' ? // Inclusive: Keys in T are required. Rest of HTML is optional.
|
|
31
|
+
DefinedComponents<T, true> & RestHTMLComponents<T> : Mode extends 'permissive' ? // Permissive: Keys in T optional. Rest of HTML optional. Any other string allowed.
|
|
32
|
+
DefinedComponents<T, false> & RestHTMLComponents<T> & {
|
|
33
|
+
[key: string]: FunctionalComponent<JSX.HTMLAttributes<HTMLElement>>;
|
|
34
|
+
} : // Optional (Default): Keys in T optional. Rest of HTML optional.
|
|
35
|
+
DefinedComponents<T, false> & RestHTMLComponents<T>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { HTMLComponentMode, HTMLComponents };
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/html/types.ts"],"mappings":";;;;;;AACuD;KAKlD,eAAA,UAAyB,KAAA,qBAE1B,KAAA,kBACE,KAAA;;;;KAMD,YAAA,MAAkB,CAAA,eAAgB,GAAA,CAAI,iBAAA,GACvC,GAAA,CAAI,iBAAA,CAAkB,CAAA,IACtB,GAAA,CAAI,cAAA,CAAe,WAAA;;;;;KAMlB,iBAAA,kCAAmD,UAAA,8BAGtC,CAAA,GAAI,mBAAA,CACd,YAAA,CAAa,CAAA,IAAK,eAAA,CAAgB,CAAA,CAAE,CAAA,sBAK1B,CAAA,IAAK,mBAAA,CACf,YAAA,CAAa,CAAA,IAAK,eAAA,CAAgB,CAAA,CAAE,CAAA;;;;;KAQvC,kBAAA,cACG,OAAA,OAAc,YAAA,QAAoB,CAAA,KAAM,mBAAA,CAC5C,CAAA,eAAgB,GAAA,CAAI,iBAAA,GAChB,GAAA,CAAI,iBAAA,CAAkB,CAAA,IACtB,GAAA,CAAI,cAAA,CAAe,WAAA;;;;KAOf,iBAAA;;;;KASA,cAAA,cACG,iBAAA,yBAEX,IAAA,oBAEA,iBAAA,CAAkB,CAAA,UAClB,IAAA;AAEE,iBAAA,CAAkB,CAAA,UAAW,kBAAA,CAAmB,CAAA,IAChD,IAAA;AAEE,iBAAA,CAAkB,CAAA,WAChB,kBAAA,CAAmB,CAAA;EAAA,CAChB,GAAA,WAAc,mBAAA,CAAoB,GAAA,CAAI,cAAA,CAAe,WAAA;AAAA;AAG1D,iBAAA,CAAkB,CAAA,WAAY,kBAAA,CAAmB,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t } from "./t
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { IntlayerNode } from "./IntlayerNode.js";
|
|
2
|
+
import { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, IntlayerProviderProps, useIntlayerContext } from "./client/IntlayerProvider.js";
|
|
3
|
+
import { useIntl } from "./client/format/useIntl.js";
|
|
4
|
+
import { t } from "./client/t.js";
|
|
5
|
+
import { IInterpreterPluginPreact, htmlPlugin, intlayerNodePlugins, markdownPlugin, markdownStringPlugin, preactNodePlugins } from "./plugins.js";
|
|
6
|
+
import { useDictionary } from "./client/useDictionary.js";
|
|
7
|
+
import { useDictionaryAsync } from "./client/useDictionaryAsync.js";
|
|
8
|
+
import { useDictionaryDynamic } from "./client/useDictionaryDynamic.js";
|
|
9
|
+
import { useIntlayer } from "./client/useIntlayer.js";
|
|
10
|
+
import { useLoadDynamic } from "./client/useLoadDynamic.js";
|
|
11
|
+
import { useLocale } from "./client/useLocale.js";
|
|
12
|
+
import { useLocaleBase } from "./client/useLocaleBase.js";
|
|
13
|
+
import { localeCookie, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage } from "./client/useLocaleStorage.js";
|
|
14
14
|
import { getDictionary } from "./getDictionary.js";
|
|
15
15
|
import { getIntlayer } from "./getIntlayer.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
16
|
+
import { HTMLProvider } from "./html/HTMLProvider.js";
|
|
17
|
+
import { HTMLRenderer, HTMLRendererProps, RenderHTMLProps, renderHTML, useHTMLRenderer } from "./html/HTMLRenderer.js";
|
|
18
|
+
import { compileMarkdown } from "./markdown/compiler.js";
|
|
19
|
+
import { MarkdownProvider } from "./markdown/MarkdownProvider.js";
|
|
20
|
+
import { MarkdownRenderer, renderMarkdown, useMarkdownRenderer } from "./markdown/MarkdownRenderer.js";
|
|
21
|
+
import preactRuntime from "./markdown/runtime.js";
|
|
22
22
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
23
23
|
|
|
24
24
|
//#region src/index.d.ts
|
|
@@ -1,2 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { HTMLComponents } from "../html/types.js";
|
|
2
|
+
import { ComponentChildren, FunctionComponent } from "preact";
|
|
3
|
+
|
|
4
|
+
//#region src/markdown/MarkdownProvider.d.ts
|
|
5
|
+
type PropsWithChildren<P = {}> = P & {
|
|
6
|
+
children?: ComponentChildren;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Refined options for the MarkdownProvider.
|
|
10
|
+
*/
|
|
11
|
+
type MarkdownProviderOptions = {
|
|
12
|
+
/**
|
|
13
|
+
* Forces the compiler to always output content with a block-level wrapper.
|
|
14
|
+
*/
|
|
15
|
+
forceBlock?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Forces the compiler to always output content with an inline wrapper.
|
|
18
|
+
*/
|
|
19
|
+
forceInline?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to preserve frontmatter in the markdown content.
|
|
22
|
+
*/
|
|
23
|
+
preserveFrontmatter?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether to use the GitHub Tag Filter.
|
|
26
|
+
*/
|
|
27
|
+
tagfilter?: boolean;
|
|
28
|
+
};
|
|
29
|
+
type MarkdownContextValue = {
|
|
30
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
31
|
+
renderMarkdown: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: any) => ComponentChildren;
|
|
32
|
+
};
|
|
33
|
+
type MarkdownProviderProps = PropsWithChildren<MarkdownProviderOptions & {
|
|
34
|
+
/**
|
|
35
|
+
* Component overrides for HTML tags.
|
|
36
|
+
*/
|
|
37
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
38
|
+
/**
|
|
39
|
+
* Wrapper element or component to be used when there are multiple children.
|
|
40
|
+
*/
|
|
41
|
+
wrapper?: any;
|
|
42
|
+
/**
|
|
43
|
+
* Custom render function for markdown.
|
|
44
|
+
* If provided, it will overwrite all rules and default rendering.
|
|
45
|
+
*/
|
|
46
|
+
renderMarkdown?: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: any) => ComponentChildren;
|
|
47
|
+
}>;
|
|
48
|
+
declare const useMarkdownContext: () => MarkdownContextValue;
|
|
49
|
+
declare const MarkdownProvider: FunctionComponent<MarkdownProviderProps>;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { MarkdownProvider, MarkdownProviderOptions, useMarkdownContext };
|
|
52
|
+
//# sourceMappingURL=MarkdownProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownProvider.d.ts","names":[],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"mappings":";;;;KASK,iBAAA,WAA4B,CAAA;EAAM,QAAA,GAAW,iBAAA;AAAA;;;;KAKtC,uBAAA;EALqB;;;EAS/B,UAAA;EATiE;AAKnE;;EAQE,WAAA;EARiC;;;EAYjC,mBAAA;EAIA;;;EAAA,SAAA;AAAA;AAAA,KAQG,oBAAA;EACH,UAAA,GAAa,cAAA;EACb,cAAA,GACE,QAAA,UACA,OAAA,GAAU,uBAAA,EACV,UAAA,GAAa,cAAA,oBACb,OAAA,WACG,iBAAA;AAAA;AAAA,KAGF,qBAAA,GAAwB,iBAAA,CAC3B,uBAAA;EAJsB;;;EAQpB,UAAA,GAAa,cAAA;EAbf;;;EAiBE,OAAA;EAda;;;;EAmBb,cAAA,IACE,QAAA,UACA,OAAA,GAAU,uBAAA,EACV,UAAA,GAAa,cAAA,oBACb,OAAA,WACG,iBAAA;AAAA;AAAA,cAQI,kBAAA,QAAkB,oBAAA;AAAA,cAuBlB,gBAAA,EAAkB,iBAAA,CAAkB,qBAAA"}
|
|
@@ -1,2 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { HTMLComponents } from "../html/types.js";
|
|
2
|
+
import { MarkdownProviderOptions } from "./MarkdownProvider.js";
|
|
3
|
+
import { ComponentChildren, FunctionComponent, JSX } from "preact";
|
|
4
|
+
|
|
5
|
+
//#region src/markdown/MarkdownRenderer.d.ts
|
|
6
|
+
type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
7
|
+
/**
|
|
8
|
+
* Component overrides for HTML tags.
|
|
9
|
+
* Only used if not wrapped in a MarkdownProvider.
|
|
10
|
+
*/
|
|
11
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
12
|
+
/**
|
|
13
|
+
* Wrapper element or component to be used when there are multiple children.
|
|
14
|
+
* Only used if not wrapped in a MarkdownProvider.
|
|
15
|
+
*/
|
|
16
|
+
wrapper?: FunctionComponent<any>;
|
|
17
|
+
};
|
|
18
|
+
declare const renderMarkdown: (content: string, {
|
|
19
|
+
components,
|
|
20
|
+
wrapper,
|
|
21
|
+
forceBlock,
|
|
22
|
+
forceInline,
|
|
23
|
+
preserveFrontmatter,
|
|
24
|
+
tagfilter
|
|
25
|
+
}?: RenderMarkdownProps) => JSX.Element;
|
|
26
|
+
declare const useMarkdownRenderer: ({
|
|
27
|
+
components,
|
|
28
|
+
wrapper,
|
|
29
|
+
forceBlock,
|
|
30
|
+
forceInline,
|
|
31
|
+
preserveFrontmatter,
|
|
32
|
+
tagfilter
|
|
33
|
+
}?: RenderMarkdownProps) => (content: string) => ComponentChildren;
|
|
34
|
+
type MarkdownRendererProps = RenderMarkdownProps & {
|
|
35
|
+
/**
|
|
36
|
+
* The markdown content to render.
|
|
37
|
+
*/
|
|
38
|
+
children: string;
|
|
39
|
+
/**
|
|
40
|
+
* Custom render function for markdown.
|
|
41
|
+
* If provided, it will overwrite context and default rendering.
|
|
42
|
+
*/
|
|
43
|
+
renderMarkdown?: (markdown: string, options?: {
|
|
44
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
45
|
+
wrapper?: FunctionComponent<any>;
|
|
46
|
+
forceBlock?: boolean;
|
|
47
|
+
forceInline?: boolean;
|
|
48
|
+
preserveFrontmatter?: boolean;
|
|
49
|
+
tagfilter?: boolean;
|
|
50
|
+
}) => ComponentChildren;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Preact component that renders markdown to JSX.
|
|
54
|
+
*
|
|
55
|
+
* It uses the renderMarkdown function from the MarkdownProvider context if available.
|
|
56
|
+
* Otherwise, it falls back to the default compiler with provided components and options.
|
|
57
|
+
*/
|
|
58
|
+
declare const MarkdownRenderer: FunctionComponent<MarkdownRendererProps>;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { MarkdownRenderer, RenderMarkdownProps, renderMarkdown, useMarkdownRenderer };
|
|
61
|
+
//# sourceMappingURL=MarkdownRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"mappings":";;;;;KAQY,mBAAA,GAAsB,uBAAA;;AAAlC;;;EAKE,UAAA,GAAa,cAAA;EAAA;;;;EAKb,OAAA,GAAU,iBAAA;AAAA;AAAA,cAGC,cAAA,GACX,OAAA;EACA,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAOG,mBAAA,KACF,GAAA,CAAI,OAAA;AAAA,cAeM,mBAAA;EAAuB,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAOjC,mBAAA,MAGO,OAAA,aAAe,iBAAA;AAAA,KAuBpB,qBAAA,GAAwB,mBAAA;EA7DA;;AAG7B;EA8DE,QAAA;;;;;EAKA,cAAA,IACE,QAAA,UACA,OAAA;IACE,UAAA,GAAa,cAAA;IACb,OAAA,GAAU,iBAAA;IACV,UAAA;IACA,WAAA;IACA,mBAAA;IACA,SAAA;EAAA,MAEC,iBAAA;AAAA;;;;;;;cASM,gBAAA,EAAkB,iBAAA,CAAkB,qBAAA"}
|
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { HTMLComponents } from "../html/types.js";
|
|
2
|
+
import { MarkdownProviderOptions } from "./MarkdownProvider.js";
|
|
3
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
4
|
+
import { FunctionComponent } from "preact";
|
|
5
|
+
import { KeyPath } from "@intlayer/types/keyPath";
|
|
6
|
+
|
|
7
|
+
//#region src/markdown/MarkdownRendererPlugin.d.ts
|
|
8
|
+
type MarkdownRendererPluginProps = {
|
|
9
|
+
dictionaryKey: string;
|
|
10
|
+
keyPath: KeyPath[];
|
|
11
|
+
locale?: LocalesValues;
|
|
12
|
+
children: string;
|
|
13
|
+
options?: MarkdownProviderOptions;
|
|
14
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
15
|
+
};
|
|
16
|
+
declare const MarkdownRendererPlugin: FunctionComponent<MarkdownRendererPluginProps>;
|
|
17
|
+
type MarkdownMetadataRendererProps = MarkdownRendererPluginProps & {
|
|
18
|
+
metadataKeyPath: KeyPath[];
|
|
19
|
+
};
|
|
20
|
+
declare const MarkdownMetadataRenderer: FunctionComponent<MarkdownMetadataRendererProps>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { MarkdownMetadataRenderer, MarkdownRendererPlugin };
|
|
23
|
+
//# sourceMappingURL=MarkdownRendererPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRendererPlugin.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRendererPlugin.tsx"],"mappings":";;;;;;;KAeK,2BAAA;EACH,aAAA;EACA,OAAA,EAAS,OAAA;EACT,MAAA,GAAS,aAAA;EACT,QAAA;EACA,OAAA,GAAU,uBAAA;EACV,UAAA,GAAa,cAAA;AAAA;AAAA,cAGF,sBAAA,EAAwB,iBAAA,CACnC,2BAAA;AAAA,KAYG,6BAAA,GAAgC,2BAAA;EACnC,eAAA,EAAiB,OAAA;AAAA;AAAA,cAGN,wBAAA,EAA0B,iBAAA,CACrC,6BAAA"}
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { CompileOptions, RuleType, sanitizer as defaultSanitizer, slugify as defaultSlugify } from "@intlayer/core/markdown";
|
|
2
|
+
|
|
3
|
+
//#region src/markdown/compiler.d.ts
|
|
4
|
+
type MarkdownCompilerOptions = CompileOptions;
|
|
5
|
+
/**
|
|
6
|
+
* Compile markdown to Preact VNodes.
|
|
7
|
+
* This is the primary export - use this for new code.
|
|
8
|
+
*/
|
|
9
|
+
declare const compileMarkdown: (markdown?: string, options?: MarkdownCompilerOptions) => unknown;
|
|
10
|
+
declare const compiler: (markdown?: string, options?: MarkdownCompilerOptions) => unknown;
|
|
11
|
+
declare const compile: (markdown?: string, options?: MarkdownCompilerOptions) => unknown;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { MarkdownCompilerOptions, RuleType, compile, compileMarkdown, compiler, defaultSanitizer as sanitizer, defaultSlugify as slugify };
|
|
14
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","names":[],"sources":["../../../src/markdown/compiler.ts"],"mappings":";;;KAiBY,uBAAA,GAA0B,cAAA;;AAMtC;;;cAAa,eAAA,GACX,QAAA,WACA,OAAA,GAAS,uBAAA;AAAA,cAIE,QAAA,GAAQ,QAAA,WALH,OAAA,GACP,uBAAA;AAAA,cAKE,OAAA,GAAO,QAAA,WANF,OAAA,GACP,uBAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { MarkdownCompilerOptions, RuleType, compile, compileMarkdown, compiler, sanitizer as defaultSanitizer, slugify as defaultSlugify } from "./compiler.js";
|
|
2
|
+
import { MarkdownProvider, MarkdownProviderOptions, useMarkdownContext } from "./MarkdownProvider.js";
|
|
3
|
+
import { MarkdownRenderer, RenderMarkdownProps, renderMarkdown, useMarkdownRenderer } from "./MarkdownRenderer.js";
|
|
4
|
+
import { MarkdownMetadataRenderer, MarkdownRendererPlugin } from "./MarkdownRendererPlugin.js";
|
|
5
|
+
import preactRuntime from "./runtime.js";
|
|
6
6
|
export { MarkdownCompilerOptions, MarkdownMetadataRenderer, MarkdownProvider, MarkdownProviderOptions, MarkdownRenderer, MarkdownRendererPlugin, RenderMarkdownProps, RuleType, compile, compileMarkdown, compiler, preactRuntime, renderMarkdown, defaultSanitizer as sanitizer, defaultSlugify as slugify, useMarkdownContext, useMarkdownRenderer };
|