preact-intlayer 8.4.3 → 8.4.5
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 +222 -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 +212 -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
package/dist/types/plugins.d.ts
CHANGED
|
@@ -1,2 +1,96 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { IntlayerNode } from "./IntlayerNode.js";
|
|
2
|
+
import { HTMLComponents } from "./html/types.js";
|
|
3
|
+
import { DeepTransformContent as DeepTransformContent$1, IInterpreterPluginState as IInterpreterPluginState$1, Plugins } from "@intlayer/core/interpreter";
|
|
4
|
+
import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
5
|
+
import { VNode } from "preact";
|
|
6
|
+
import * as NodeTypes from "@intlayer/types/nodeType";
|
|
7
|
+
import { NodeType } from "@intlayer/types/nodeType";
|
|
8
|
+
|
|
9
|
+
//#region src/plugins.d.ts
|
|
10
|
+
/** ---------------------------------------------
|
|
11
|
+
* INTLAYER NODE PLUGIN
|
|
12
|
+
* --------------------------------------------- */
|
|
13
|
+
type IntlayerNodeCond<T> = T extends number | string ? IntlayerNode<T> : never;
|
|
14
|
+
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
15
|
+
declare const intlayerNodePlugins: Plugins;
|
|
16
|
+
/** ---------------------------------------------
|
|
17
|
+
* PREACT NODE PLUGIN
|
|
18
|
+
* --------------------------------------------- */
|
|
19
|
+
type PreactNodeCond<T> = T extends {
|
|
20
|
+
props: any;
|
|
21
|
+
key: any;
|
|
22
|
+
} ? VNode : never;
|
|
23
|
+
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
24
|
+
declare const preactNodePlugins: Plugins;
|
|
25
|
+
/** ---------------------------------------------
|
|
26
|
+
* INSERTION PLUGIN
|
|
27
|
+
* --------------------------------------------- */
|
|
28
|
+
type InsertionCond<T, _S, L extends LocalesValues> = T extends {
|
|
29
|
+
nodeType: NodeType | string;
|
|
30
|
+
[NodeTypes.INSERTION]: infer I;
|
|
31
|
+
fields: readonly (infer F)[];
|
|
32
|
+
} ? <V extends { [K in Extract<F, string>]: string | number | VNode }>(values: V) => I extends string ? V[keyof V] extends string | number ? IntlayerNode<string> : IntlayerNode<VNode> : DeepTransformContent<I, L> : never;
|
|
33
|
+
/** Insertion plugin for Preact. Handles component/node insertion. */
|
|
34
|
+
declare const insertionPlugin: Plugins;
|
|
35
|
+
/**
|
|
36
|
+
* MARKDOWN PLUGIN
|
|
37
|
+
*/
|
|
38
|
+
type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
|
|
39
|
+
metadata: DeepTransformContent<string>;
|
|
40
|
+
use: (components?: HTMLComponents<'permissive', {}>) => VNode;
|
|
41
|
+
}> : never;
|
|
42
|
+
/** Markdown string plugin. Replaces string node with a component that render the markdown. */
|
|
43
|
+
declare const markdownStringPlugin: Plugins;
|
|
44
|
+
type MarkdownCond<T> = T extends {
|
|
45
|
+
nodeType: NodeType | string;
|
|
46
|
+
[NodeTypes.MARKDOWN]: infer _M;
|
|
47
|
+
metadata?: infer U;
|
|
48
|
+
tags?: infer U;
|
|
49
|
+
} ? {
|
|
50
|
+
use: (components?: HTMLComponents<'permissive', U>) => VNode;
|
|
51
|
+
metadata: DeepTransformContent<U>;
|
|
52
|
+
} : never;
|
|
53
|
+
declare const markdownPlugin: Plugins;
|
|
54
|
+
/** ---------------------------------------------
|
|
55
|
+
* HTML PLUGIN
|
|
56
|
+
* --------------------------------------------- */
|
|
57
|
+
type HTMLPluginCond<T> = T extends {
|
|
58
|
+
nodeType: NodeType | string;
|
|
59
|
+
[NodeTypes.HTML]: infer I;
|
|
60
|
+
tags?: infer U;
|
|
61
|
+
} ? {
|
|
62
|
+
use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;
|
|
63
|
+
} : never;
|
|
64
|
+
/** HTML plugin. Replaces node with a function that takes components => VNode. */
|
|
65
|
+
declare const htmlPlugin: Plugins;
|
|
66
|
+
/** ---------------------------------------------
|
|
67
|
+
* PLUGINS RESULT
|
|
68
|
+
* --------------------------------------------- */
|
|
69
|
+
interface IInterpreterPluginPreact<T, S, L extends LocalesValues> {
|
|
70
|
+
preactNode: PreactNodeCond<T>;
|
|
71
|
+
preactIntlayerNode: IntlayerNodeCond<T>;
|
|
72
|
+
preactInsertion: InsertionCond<T, S, L>;
|
|
73
|
+
preactMarkdown: MarkdownCond<T>;
|
|
74
|
+
preactHtml: HTMLPluginCond<T>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.
|
|
78
|
+
*
|
|
79
|
+
* Otherwise the the `preact-intlayer` plugins will override the types of `intlayer` functions.
|
|
80
|
+
*/
|
|
81
|
+
type IInterpreterPluginState = Omit<IInterpreterPluginState$1, 'insertion'> & {
|
|
82
|
+
preactNode: true;
|
|
83
|
+
preactIntlayerNode: true;
|
|
84
|
+
preactInsertion: true;
|
|
85
|
+
preactMarkdown: true;
|
|
86
|
+
preactHtml: true;
|
|
87
|
+
};
|
|
88
|
+
type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContent$1<T, IInterpreterPluginState, L>;
|
|
89
|
+
/**
|
|
90
|
+
* Get the plugins array for Preact content transformation.
|
|
91
|
+
* This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.
|
|
92
|
+
*/
|
|
93
|
+
declare const getPlugins: (locale?: LocalesValues, fallback?: boolean) => Plugins[];
|
|
94
|
+
//#endregion
|
|
95
|
+
export { DeepTransformContent, HTMLPluginCond, IInterpreterPluginPreact, IInterpreterPluginState, InsertionCond, IntlayerNodeCond, MarkdownCond, MarkdownStringCond, PreactNodeCond, getPlugins, htmlPlugin, insertionPlugin, intlayerNodePlugins, markdownPlugin, markdownStringPlugin, preactNodePlugins };
|
|
96
|
+
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.tsx"],"mappings":";;;;;;;;;;;AAqCA;KAAY,gBAAA,MAAsB,CAAA,2BAC9B,YAAA,CAAa,CAAA;;cAIJ,mBAAA,EAAqB,OAAA;;;;KA8BtB,cAAA,MAAoB,CAAA;EAC9B,KAAA;EACA,GAAA;AAAA,IAEE,KAAA;;cAIS,iBAAA,EAAmB,OAAA;;AAtChC;;KAmEY,aAAA,kBAA+B,aAAA,IAAiB,CAAA;EAC1D,QAAA,EAAU,QAAA;EAAA,CACT,SAAA,CAAU,SAAA;EACX,MAAA;AAAA,uBAEqB,OAAA,CAAQ,CAAA,8BAA+B,KAAA,IACxD,MAAA,EAAQ,CAAA,KACL,CAAA,kBACD,CAAA,OAAQ,CAAA,4BACN,YAAA,WACA,YAAA,CAAa,KAAA,IACf,oBAAA,CAAqB,CAAA,EAAG,CAAA;;cAuEnB,eAAA,EAAiB,OAAA;;;;KA0DlB,kBAAA,MAAwB,CAAA,kBAChC,YAAA;EAGI,QAAA,EAAU,oBAAA;EACV,GAAA,GAAM,UAAA,GAAa,cAAA,uBAAqC,KAAA;AAAA;;cAMnD,oBAAA,EAAsB,OAAA;AAAA,KAuFvB,YAAA,MAAkB,CAAA;EAC5B,QAAA,EAAU,QAAA;EAAA,CACT,SAAA,CAAU,QAAA;EACX,QAAA;EACA,IAAA;AAAA;EAGI,GAAA,GAAM,UAAA,GAAa,cAAA,eAA6B,CAAA,MAAO,KAAA;EACvD,QAAA,EAAU,oBAAA,CAAqB,CAAA;AAAA;AAAA,cAIxB,cAAA,EAAgB,OAAA;;;;KA2BjB,cAAA,MAAoB,CAAA;EAC9B,QAAA,EAAU,QAAA;EAAA,CACT,SAAA,CAAU,IAAA;EACX,IAAA;AAAA;EAGI,GAAA,GAAM,UAAA,GAAa,cAAA,eAA6B,CAAA,MAAO,YAAA,CAAa,CAAA;AAAA;;cAK7D,UAAA,EAAY,OAAA;;;;UAqCR,wBAAA,iBAAyC,aAAA;EACxD,UAAA,EAAY,cAAA,CAAe,CAAA;EAC3B,kBAAA,EAAoB,gBAAA,CAAiB,CAAA;EACrC,eAAA,EAAiB,aAAA,CAAc,CAAA,EAAG,CAAA,EAAG,CAAA;EACrC,cAAA,EAAgB,YAAA,CAAa,CAAA;EAC7B,UAAA,EAAY,cAAA,CAAe,CAAA;AAAA;;;;;;KAQjB,uBAAA,GAA0B,IAAA,CACpC,yBAAA;EAGA,UAAA;EACA,kBAAA;EACA,eAAA;EACA,cAAA;EACA,UAAA;AAAA;AAAA,KAGU,oBAAA,cAEA,aAAA,GAAgB,eAAA,IACxB,sBAAA,CAAyB,CAAA,EAAG,uBAAA,EAAyB,CAAA;;;;;cAM5C,UAAA,GACX,MAAA,GAAS,aAAA,EACT,QAAA,eACC,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "preact-intlayer",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Preact applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
|
-
"@intlayer/api": "8.4.
|
|
96
|
-
"@intlayer/chokidar": "8.4.
|
|
97
|
-
"@intlayer/config": "8.4.
|
|
98
|
-
"@intlayer/core": "8.4.
|
|
99
|
-
"@intlayer/editor": "8.4.
|
|
100
|
-
"@intlayer/types": "8.4.
|
|
95
|
+
"@intlayer/api": "8.4.5",
|
|
96
|
+
"@intlayer/chokidar": "8.4.5",
|
|
97
|
+
"@intlayer/config": "8.4.5",
|
|
98
|
+
"@intlayer/core": "8.4.5",
|
|
99
|
+
"@intlayer/editor": "8.4.5",
|
|
100
|
+
"@intlayer/types": "8.4.5"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@types/node": "25.5.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./client/useLocaleStorage.cjs`);let l=require(`@intlayer/config/built`);l=s(l);let u=require(`preact`),d=require(`@intlayer/editor/isEnabled`),f=require(`preact/hooks`),p=require(`preact/jsx-runtime`),m=require(`@intlayer/core/localization`);const h=()=>{let{locale:e}=(0,f.useContext)(_),t=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!(process.env.INTLAYER_EDITOR_ENABLED===`false`||!d.isEnabled))return import(`@intlayer/editor`).then(({initEditorClient:n})=>{let r=n();t.current=r,e&&r.currentLocale.set(e)}),()=>{t.current=null,import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()})}},[]),(0,f.useEffect)(()=>{!e||!t.current||t.current.currentLocale.set(e)},[e])},g=({children:e})=>(h(),e),_=(0,u.createContext)({locale:c.localeInStorage??l.default?.internationalization?.defaultLocale,setLocale:()=>null}),v=()=>(0,f.useContext)(_),y=({locale:e,defaultLocale:t,children:n,setLocale:r,isCookieEnabled:i})=>{let{internationalization:a}=l.default??{},{defaultLocale:o,locales:s}=a??{},[u,d]=(0,f.useState)(e??c.localeInStorage??t??o);(0,f.useEffect)(()=>{e&&e!==u&&d(e)},[e,u,d]);let h=r??(e=>{if(u.toString()!==e.toString()){if(!s?.map(String).includes(e)){console.error(`Locale ${e} is not available`);return}d(e),c.setLocaleInStorage(e,i??!0)}}),g=(0,m.localeResolver)(e??u);return(0,p.jsx)(_.Provider,{value:{locale:g,setLocale:h,isCookieEnabled:i},children:n})},b=({children:e,...t})=>(0,p.jsxs)(y,{...t,children:[(0,p.jsx)(g,{}),e]});Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
|
|
2
|
-
//# sourceMappingURL=IntlayerProvider-sM1gzsx7.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerProvider-sM1gzsx7.cjs","names":["isEnabled","localeInStorage","configuration"],"sources":["../../src/editor/useEditor.tsx","../../src/editor/EditorProvider.tsx","../../src/client/IntlayerProvider.tsx"],"sourcesContent":["import type { EditorStateManager } from '@intlayer/editor';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { useContext, useEffect, useRef } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * Initialises the Intlayer editor client singleton when the editor is enabled.\n * Syncs the current locale from the Intlayer context into the editor manager so\n * the editor always knows which locale the app is displaying.\n */\nexport const useEditor = () => {\n const { locale } = useContext(IntlayerClientContext);\n const managerRef = useRef<EditorStateManager | null>(null);\n\n useEffect(() => {\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) return;\n\n import('@intlayer/editor').then(({ initEditorClient }) => {\n const manager = initEditorClient();\n managerRef.current = manager;\n\n if (locale) manager.currentLocale.set(locale as Locale);\n });\n\n return () => {\n managerRef.current = null;\n import('@intlayer/editor').then(({ stopEditorClient }) => {\n stopEditorClient();\n });\n };\n }, []);\n\n useEffect(() => {\n if (!locale || !managerRef.current) return;\n\n managerRef.current.currentLocale.set(locale as Locale);\n }, [locale]);\n};\n","import type { ComponentChild, FunctionComponent } from 'preact';\nimport { useEditor } from './useEditor';\n\nexport const EditorProvider: FunctionComponent<{\n children?: ComponentChild;\n}> = ({ children }) => {\n useEditor();\n\n return children;\n};\n","import configuration from '@intlayer/config/built';\nimport { localeResolver } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport {\n type ComponentChild,\n createContext,\n type FunctionComponent,\n} from 'preact';\nimport { useContext, useEffect, useState } from 'preact/hooks';\nimport { EditorProvider } from '../editor/EditorProvider';\nimport { localeInStorage, setLocaleInStorage } from './useLocaleStorage';\n\ntype IntlayerValue = {\n locale: LocalesValues;\n setLocale: (newLocale: LocalesValues) => void;\n isCookieEnabled?: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeInStorage ?? configuration?.internationalization?.defaultLocale,\n setLocale: () => null,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = {\n children?: ComponentChild;\n locale?: LocalesValues;\n defaultLocale?: LocalesValues;\n setLocale?: (locale: LocalesValues) => void;\n isCookieEnabled?: boolean;\n};\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProviderContent: FunctionComponent<\n IntlayerProviderProps\n> = ({\n locale: localeProp,\n defaultLocale: defaultLocaleProp,\n children,\n setLocale: setLocaleProp,\n isCookieEnabled,\n}) => {\n const { internationalization } = configuration ?? {};\n const { defaultLocale: defaultLocaleConfig, locales: availableLocales } =\n internationalization ?? {};\n\n const defaultLocale =\n localeProp ?? localeInStorage ?? defaultLocaleProp ?? defaultLocaleConfig;\n\n const [currentLocale, setCurrentLocale] = useState<LocalesValues>(\n defaultLocale as LocalesValues\n );\n\n useEffect(() => {\n if (localeProp && localeProp !== currentLocale) {\n setCurrentLocale(localeProp);\n }\n }, [localeProp, currentLocale, setCurrentLocale]);\n\n const setLocaleBase = (newLocale: LocalesValues) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleInStorage(newLocale, isCookieEnabled ?? true); // Optionally set cookie for persistence\n };\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const resolvedLocale = localeResolver(localeProp ?? currentLocale);\n\n return (\n <IntlayerClientContext.Provider\n value={{\n locale: resolvedLocale,\n setLocale,\n isCookieEnabled,\n }}\n >\n {children}\n </IntlayerClientContext.Provider>\n );\n};\n\n/**\n * Main provider for Intlayer in Preact applications.\n *\n * It provides the Intlayer context to your application, allowing the use\n * of hooks like `useIntlayer` and `useLocale`.\n *\n * @param props - The provider props.\n * @returns The provider component.\n *\n * @example\n * ```tsx\n * import { IntlayerProvider } from 'preact-intlayer';\n *\n * const App = () => (\n * <IntlayerProvider>\n * <MyComponent />\n * </IntlayerProvider>\n * );\n * ```\n */\nexport const IntlayerProvider: FunctionComponent<IntlayerProviderProps> = ({\n children,\n ...props\n}) => (\n <IntlayerProviderContent {...props}>\n <EditorProvider />\n {children}\n </IntlayerProviderContent>\n);\n"],"mappings":"iuBAWA,MAAa,MAAkB,CAC7B,GAAM,CAAE,WAAA,EAAA,EAAA,YAAsB,EAAsB,CAC9C,GAAA,EAAA,EAAA,QAA+C,KAAK,EAE1D,EAAA,EAAA,eAAgB,CACV,aAAQ,IAAI,0BAA4B,SAAW,CAACA,EAAAA,WASxD,OAPA,OAAO,oBAAoB,MAAM,CAAE,sBAAuB,CACxD,IAAM,EAAU,GAAkB,CAClC,EAAW,QAAU,EAEjB,GAAQ,EAAQ,cAAc,IAAI,EAAiB,EACvD,KAEW,CACX,EAAW,QAAU,KACrB,OAAO,oBAAoB,MAAM,CAAE,sBAAuB,CACxD,GAAkB,EAClB,GAEH,EAAE,CAAC,EAEN,EAAA,EAAA,eAAgB,CACV,CAAC,GAAU,CAAC,EAAW,SAE3B,EAAW,QAAQ,cAAc,IAAI,EAAiB,EACrD,CAAC,EAAO,CAAC,EClCD,GAEP,CAAE,eACN,GAAW,CAEJ,GCaI,GAAA,EAAA,EAAA,eAAqD,CAChE,OAAQC,EAAAA,iBAAmBC,EAAAA,SAAe,sBAAsB,cAChE,cAAiB,KAClB,CAAC,CAKW,OAAA,EAAA,EAAA,YAAsC,EAAsB,CAa5D,GAER,CACH,OAAQ,EACR,cAAe,EACf,WACA,UAAW,EACX,qBACI,CACJ,GAAM,CAAE,wBAAyBA,EAAAA,SAAiB,EAAE,CAC9C,CAAE,cAAe,EAAqB,QAAS,GACnD,GAAwB,EAAE,CAKtB,CAAC,EAAe,IAAA,EAAA,EAAA,UAFpB,GAAcD,EAAAA,iBAAmB,GAAqB,EAIvD,EAED,EAAA,EAAA,eAAgB,CACV,GAAc,IAAe,GAC/B,EAAiB,EAAW,EAE7B,CAAC,EAAY,EAAe,EAAiB,CAAC,CAcjD,IAAM,EAAY,IAZK,GAA6B,CAC9C,KAAc,UAAU,GAAK,EAAU,UAAU,CAErD,IAAI,CAAC,GAAkB,IAAI,OAAO,CAAC,SAAS,EAAU,CAAE,CACtD,QAAQ,MAAM,UAAU,EAAU,mBAAmB,CACrD,OAGF,EAAiB,EAAU,CAC3B,EAAA,mBAAmB,EAAW,GAAmB,GAAK,IAKlD,GAAA,EAAA,EAAA,gBAAgC,GAAc,EAAc,CAElE,OACE,EAAA,EAAA,KAAC,EAAsB,SAAvB,CACE,MAAO,CACL,OAAQ,EACR,YACA,kBACD,CAEA,WAC8B,CAAA,EAwBxB,GAA8D,CACzE,WACA,GAAG,MAEH,EAAA,EAAA,MAAC,EAAD,CAAyB,GAAI,WAA7B,EACE,EAAA,EAAA,KAAC,EAAD,EAAkB,CAAA,CACjB,EACuB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{localeInStorage as e,setLocaleInStorage as t}from"./client/useLocaleStorage.mjs";import n from"@intlayer/config/built";import{createContext as r}from"preact";import{isEnabled as i}from"@intlayer/editor/isEnabled";import{useContext as a,useEffect as o,useRef as s,useState as c}from"preact/hooks";import{jsx as l,jsxs as u}from"preact/jsx-runtime";import{localeResolver as d}from"@intlayer/core/localization";const f=()=>{let{locale:e}=a(m),t=s(null);o(()=>{if(!(process.env.INTLAYER_EDITOR_ENABLED===`false`||!i))return import(`@intlayer/editor`).then(({initEditorClient:n})=>{let r=n();t.current=r,e&&r.currentLocale.set(e)}),()=>{t.current=null,import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()})}},[]),o(()=>{!e||!t.current||t.current.currentLocale.set(e)},[e])},p=({children:e})=>(f(),e),m=r({locale:e??n?.internationalization?.defaultLocale,setLocale:()=>null}),h=()=>a(m),g=({locale:r,defaultLocale:i,children:a,setLocale:s,isCookieEnabled:u})=>{let{internationalization:f}=n??{},{defaultLocale:p,locales:h}=f??{},[g,_]=c(r??e??i??p);o(()=>{r&&r!==g&&_(r)},[r,g,_]);let v=s??(e=>{if(g.toString()!==e.toString()){if(!h?.map(String).includes(e)){console.error(`Locale ${e} is not available`);return}_(e),t(e,u??!0)}}),y=d(r??g);return l(m.Provider,{value:{locale:y,setLocale:v,isCookieEnabled:u},children:a})},_=({children:e,...t})=>u(g,{...t,children:[l(p,{}),e]});export{p as a,h as i,_ as n,f as o,g as r,m as t};
|
|
2
|
-
//# sourceMappingURL=IntlayerProvider-ClOcEK3A.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerProvider-ClOcEK3A.mjs","names":[],"sources":["../../src/editor/useEditor.tsx","../../src/editor/EditorProvider.tsx","../../src/client/IntlayerProvider.tsx"],"sourcesContent":["import type { EditorStateManager } from '@intlayer/editor';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { useContext, useEffect, useRef } from 'preact/hooks';\nimport { IntlayerClientContext } from '../client/IntlayerProvider';\n\n/**\n * Initialises the Intlayer editor client singleton when the editor is enabled.\n * Syncs the current locale from the Intlayer context into the editor manager so\n * the editor always knows which locale the app is displaying.\n */\nexport const useEditor = () => {\n const { locale } = useContext(IntlayerClientContext);\n const managerRef = useRef<EditorStateManager | null>(null);\n\n useEffect(() => {\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) return;\n\n import('@intlayer/editor').then(({ initEditorClient }) => {\n const manager = initEditorClient();\n managerRef.current = manager;\n\n if (locale) manager.currentLocale.set(locale as Locale);\n });\n\n return () => {\n managerRef.current = null;\n import('@intlayer/editor').then(({ stopEditorClient }) => {\n stopEditorClient();\n });\n };\n }, []);\n\n useEffect(() => {\n if (!locale || !managerRef.current) return;\n\n managerRef.current.currentLocale.set(locale as Locale);\n }, [locale]);\n};\n","import type { ComponentChild, FunctionComponent } from 'preact';\nimport { useEditor } from './useEditor';\n\nexport const EditorProvider: FunctionComponent<{\n children?: ComponentChild;\n}> = ({ children }) => {\n useEditor();\n\n return children;\n};\n","import configuration from '@intlayer/config/built';\nimport { localeResolver } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport {\n type ComponentChild,\n createContext,\n type FunctionComponent,\n} from 'preact';\nimport { useContext, useEffect, useState } from 'preact/hooks';\nimport { EditorProvider } from '../editor/EditorProvider';\nimport { localeInStorage, setLocaleInStorage } from './useLocaleStorage';\n\ntype IntlayerValue = {\n locale: LocalesValues;\n setLocale: (newLocale: LocalesValues) => void;\n isCookieEnabled?: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeInStorage ?? configuration?.internationalization?.defaultLocale,\n setLocale: () => null,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = {\n children?: ComponentChild;\n locale?: LocalesValues;\n defaultLocale?: LocalesValues;\n setLocale?: (locale: LocalesValues) => void;\n isCookieEnabled?: boolean;\n};\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProviderContent: FunctionComponent<\n IntlayerProviderProps\n> = ({\n locale: localeProp,\n defaultLocale: defaultLocaleProp,\n children,\n setLocale: setLocaleProp,\n isCookieEnabled,\n}) => {\n const { internationalization } = configuration ?? {};\n const { defaultLocale: defaultLocaleConfig, locales: availableLocales } =\n internationalization ?? {};\n\n const defaultLocale =\n localeProp ?? localeInStorage ?? defaultLocaleProp ?? defaultLocaleConfig;\n\n const [currentLocale, setCurrentLocale] = useState<LocalesValues>(\n defaultLocale as LocalesValues\n );\n\n useEffect(() => {\n if (localeProp && localeProp !== currentLocale) {\n setCurrentLocale(localeProp);\n }\n }, [localeProp, currentLocale, setCurrentLocale]);\n\n const setLocaleBase = (newLocale: LocalesValues) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleInStorage(newLocale, isCookieEnabled ?? true); // Optionally set cookie for persistence\n };\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const resolvedLocale = localeResolver(localeProp ?? currentLocale);\n\n return (\n <IntlayerClientContext.Provider\n value={{\n locale: resolvedLocale,\n setLocale,\n isCookieEnabled,\n }}\n >\n {children}\n </IntlayerClientContext.Provider>\n );\n};\n\n/**\n * Main provider for Intlayer in Preact applications.\n *\n * It provides the Intlayer context to your application, allowing the use\n * of hooks like `useIntlayer` and `useLocale`.\n *\n * @param props - The provider props.\n * @returns The provider component.\n *\n * @example\n * ```tsx\n * import { IntlayerProvider } from 'preact-intlayer';\n *\n * const App = () => (\n * <IntlayerProvider>\n * <MyComponent />\n * </IntlayerProvider>\n * );\n * ```\n */\nexport const IntlayerProvider: FunctionComponent<IntlayerProviderProps> = ({\n children,\n ...props\n}) => (\n <IntlayerProviderContent {...props}>\n <EditorProvider />\n {children}\n </IntlayerProviderContent>\n);\n"],"mappings":"+ZAWA,MAAa,MAAkB,CAC7B,GAAM,CAAE,UAAW,EAAW,EAAsB,CAC9C,EAAa,EAAkC,KAAK,CAE1D,MAAgB,CACV,aAAQ,IAAI,0BAA4B,SAAW,CAAC,GASxD,OAPA,OAAO,oBAAoB,MAAM,CAAE,sBAAuB,CACxD,IAAM,EAAU,GAAkB,CAClC,EAAW,QAAU,EAEjB,GAAQ,EAAQ,cAAc,IAAI,EAAiB,EACvD,KAEW,CACX,EAAW,QAAU,KACrB,OAAO,oBAAoB,MAAM,CAAE,sBAAuB,CACxD,GAAkB,EAClB,GAEH,EAAE,CAAC,CAEN,MAAgB,CACV,CAAC,GAAU,CAAC,EAAW,SAE3B,EAAW,QAAQ,cAAc,IAAI,EAAiB,EACrD,CAAC,EAAO,CAAC,EClCD,GAEP,CAAE,eACN,GAAW,CAEJ,GCaI,EAAwB,EAA6B,CAChE,OAAQ,GAAmB,GAAe,sBAAsB,cAChE,cAAiB,KAClB,CAAC,CAKW,MAA2B,EAAW,EAAsB,CAa5D,GAER,CACH,OAAQ,EACR,cAAe,EACf,WACA,UAAW,EACX,qBACI,CACJ,GAAM,CAAE,wBAAyB,GAAiB,EAAE,CAC9C,CAAE,cAAe,EAAqB,QAAS,GACnD,GAAwB,EAAE,CAKtB,CAAC,EAAe,GAAoB,EAFxC,GAAc,GAAmB,GAAqB,EAIvD,CAED,MAAgB,CACV,GAAc,IAAe,GAC/B,EAAiB,EAAW,EAE7B,CAAC,EAAY,EAAe,EAAiB,CAAC,CAcjD,IAAM,EAAY,IAZK,GAA6B,CAC9C,KAAc,UAAU,GAAK,EAAU,UAAU,CAErD,IAAI,CAAC,GAAkB,IAAI,OAAO,CAAC,SAAS,EAAU,CAAE,CACtD,QAAQ,MAAM,UAAU,EAAU,mBAAmB,CACrD,OAGF,EAAiB,EAAU,CAC3B,EAAmB,EAAW,GAAmB,GAAK,IAKlD,EAAiB,EAAe,GAAc,EAAc,CAElE,OACE,EAAC,EAAsB,SAAvB,CACE,MAAO,CACL,OAAQ,EACR,YACA,kBACD,CAEA,WAC8B,CAAA,EAwBxB,GAA8D,CACzE,WACA,GAAG,KAEH,EAAC,EAAD,CAAyB,GAAI,WAA7B,CACE,EAAC,EAAD,EAAkB,CAAA,CACjB,EACuB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { n as HTMLComponents } from "./types-B3Kzdco6.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 { useHTMLContext as n, HTMLProvider as t };
|
|
18
|
-
//# sourceMappingURL=HTMLProvider-8sO8DU8H.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HTMLProvider-8sO8DU8H.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,61 +0,0 @@
|
|
|
1
|
-
import { n as HTMLComponents } from "./types-B3Kzdco6.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 { renderHTML as a, defaultHTMLComponents as i, HTMLRendererProps as n, useHTMLRenderer as o, RenderHTMLProps as r, HTMLRenderer as t };
|
|
61
|
-
//# sourceMappingURL=HTMLRenderer-NNa_9oMD.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HTMLRenderer-NNa_9oMD.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,23 +0,0 @@
|
|
|
1
|
-
import { NodeProps } from "@intlayer/core/interpreter";
|
|
2
|
-
import { ResolvedEditor } from "@intlayer/types/module_augmentation";
|
|
3
|
-
import { ComponentChildren, VNode } from "preact";
|
|
4
|
-
|
|
5
|
-
//#region src/IntlayerNode.d.ts
|
|
6
|
-
type IntlayerNode<T = NodeProps['children'], AdditionalProps = {}> = ResolvedEditor<T, VNode> & {
|
|
7
|
-
value: T;
|
|
8
|
-
} & AdditionalProps;
|
|
9
|
-
type RenderIntlayerNodeProps<T> = {
|
|
10
|
-
value: T;
|
|
11
|
-
children: ComponentChildren;
|
|
12
|
-
additionalProps?: {
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
declare const renderIntlayerNode: <T extends number | string | boolean | undefined | null>({
|
|
17
|
-
children,
|
|
18
|
-
value,
|
|
19
|
-
additionalProps
|
|
20
|
-
}: RenderIntlayerNodeProps<T>) => IntlayerNode<T>;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { renderIntlayerNode as n, IntlayerNode as t };
|
|
23
|
-
//# sourceMappingURL=IntlayerNode-CIzFHYnC.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerNode-CIzFHYnC.d.ts","names":[],"sources":["../../src/IntlayerNode.tsx"],"mappings":";;;;;KAUY,YAAA,KACN,SAAA,sCAEF,cAAA,CAAe,CAAA,EAAG,KAAA;EACpB,KAAA,EAAO,CAAA;AAAA,IACL,eAAA;AAAA,KAEC,uBAAA;EACH,KAAA,EAAO,CAAA;EACP,QAAA,EAAU,iBAAA;EACV,eAAA;IAAA,CAAqB,GAAA;EAAA;AAAA;AAAA,cAGV,kBAAA;EAEX,QAAA;EAAA,KAAA;EAAA;AAAA,GAIC,uBAAA,CAAwB,CAAA,MAAK,YAAA,CAAa,CAAA"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
-
import * as preact from "preact";
|
|
3
|
-
import { ComponentChild, FunctionComponent } from "preact";
|
|
4
|
-
|
|
5
|
-
//#region src/client/IntlayerProvider.d.ts
|
|
6
|
-
type IntlayerValue = {
|
|
7
|
-
locale: LocalesValues;
|
|
8
|
-
setLocale: (newLocale: LocalesValues) => void;
|
|
9
|
-
isCookieEnabled?: boolean;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Context that store the current locale on the client side
|
|
13
|
-
*/
|
|
14
|
-
declare const IntlayerClientContext: preact.Context<IntlayerValue>;
|
|
15
|
-
/**
|
|
16
|
-
* Hook that provides the current locale
|
|
17
|
-
*/
|
|
18
|
-
declare const useIntlayerContext: () => IntlayerValue;
|
|
19
|
-
type IntlayerProviderProps = {
|
|
20
|
-
children?: ComponentChild;
|
|
21
|
-
locale?: LocalesValues;
|
|
22
|
-
defaultLocale?: LocalesValues;
|
|
23
|
-
setLocale?: (locale: LocalesValues) => void;
|
|
24
|
-
isCookieEnabled?: boolean;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Provider that store the current locale on the client side
|
|
28
|
-
*/
|
|
29
|
-
declare const IntlayerProviderContent: FunctionComponent<IntlayerProviderProps>;
|
|
30
|
-
/**
|
|
31
|
-
* Main provider for Intlayer in Preact applications.
|
|
32
|
-
*
|
|
33
|
-
* It provides the Intlayer context to your application, allowing the use
|
|
34
|
-
* of hooks like `useIntlayer` and `useLocale`.
|
|
35
|
-
*
|
|
36
|
-
* @param props - The provider props.
|
|
37
|
-
* @returns The provider component.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```tsx
|
|
41
|
-
* import { IntlayerProvider } from 'preact-intlayer';
|
|
42
|
-
*
|
|
43
|
-
* const App = () => (
|
|
44
|
-
* <IntlayerProvider>
|
|
45
|
-
* <MyComponent />
|
|
46
|
-
* </IntlayerProvider>
|
|
47
|
-
* );
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
declare const IntlayerProvider: FunctionComponent<IntlayerProviderProps>;
|
|
51
|
-
//#endregion
|
|
52
|
-
export { useIntlayerContext as a, IntlayerProviderProps as i, IntlayerProvider as n, IntlayerProviderContent as r, IntlayerClientContext as t };
|
|
53
|
-
//# sourceMappingURL=IntlayerProvider-aV596OL4.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerProvider-aV596OL4.d.ts","names":[],"sources":["../../src/client/IntlayerProvider.tsx"],"mappings":";;;;;KAYK,aAAA;EACH,MAAA,EAAQ,aAAA;EACR,SAAA,GAAY,SAAA,EAAW,aAAA;EACvB,eAAA;AAAA;;;;cAMW,qBAAA,EAAqB,MAAA,CAAA,OAAA,CAAA,aAAA;;;;cAQrB,kBAAA,QAAkB,aAAA;AAAA,KAEnB,qBAAA;EACV,QAAA,GAAW,cAAA;EACX,MAAA,GAAS,aAAA;EACT,aAAA,GAAgB,aAAA;EAChB,SAAA,IAAa,MAAA,EAAQ,aAAA;EACrB,eAAA;AAAA;AAPF;;;AAAA,cAaa,uBAAA,EAAyB,iBAAA,CACpC,qBAAA;;AAZF;;;;;;;;;;;;;;;;;;;cAsFa,gBAAA,EAAkB,iBAAA,CAAkB,qBAAA"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { n as HTMLComponents } from "./types-B3Kzdco6.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 { MarkdownProviderOptions as n, useMarkdownContext as r, MarkdownProvider as t };
|
|
52
|
-
//# sourceMappingURL=MarkdownProvider-chUIO05u.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownProvider-chUIO05u.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,61 +0,0 @@
|
|
|
1
|
-
import { n as HTMLComponents } from "./types-B3Kzdco6.js";
|
|
2
|
-
import { n as MarkdownProviderOptions } from "./MarkdownProvider-chUIO05u.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 { useMarkdownRenderer as i, RenderMarkdownProps as n, renderMarkdown as r, MarkdownRenderer as t };
|
|
61
|
-
//# sourceMappingURL=MarkdownRenderer-BMhuurZW.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer-BMhuurZW.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,23 +0,0 @@
|
|
|
1
|
-
import { n as HTMLComponents } from "./types-B3Kzdco6.js";
|
|
2
|
-
import { n as MarkdownProviderOptions } from "./MarkdownProvider-chUIO05u.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 { MarkdownRendererPlugin as n, MarkdownMetadataRenderer as t };
|
|
23
|
-
//# sourceMappingURL=MarkdownRendererPlugin-DFRVdHCA.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRendererPlugin-DFRVdHCA.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,14 +0,0 @@
|
|
|
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 { compiler as a, compileMarkdown as i, RuleType as n, defaultSanitizer as o, compile as r, defaultSlugify as s, MarkdownCompilerOptions as t };
|
|
14
|
-
//# sourceMappingURL=compiler-BB0gAVbe.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compiler-BB0gAVbe.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,95 +0,0 @@
|
|
|
1
|
-
import { t as IntlayerNode } from "./IntlayerNode-CIzFHYnC.js";
|
|
2
|
-
import { n as HTMLComponents } from "./types-B3Kzdco6.js";
|
|
3
|
-
import { DeepTransformContent, IInterpreterPluginState, Plugins } from "@intlayer/core/interpreter";
|
|
4
|
-
import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
5
|
-
import { VNode } from "preact";
|
|
6
|
-
import { NodeType } from "@intlayer/types/nodeType";
|
|
7
|
-
|
|
8
|
-
//#region src/plugins.d.ts
|
|
9
|
-
/** ---------------------------------------------
|
|
10
|
-
* INTLAYER NODE PLUGIN
|
|
11
|
-
* --------------------------------------------- */
|
|
12
|
-
type IntlayerNodeCond<T> = T extends number | string ? IntlayerNode<T> : never;
|
|
13
|
-
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
14
|
-
declare const intlayerNodePlugins: Plugins;
|
|
15
|
-
/** ---------------------------------------------
|
|
16
|
-
* PREACT NODE PLUGIN
|
|
17
|
-
* --------------------------------------------- */
|
|
18
|
-
type PreactNodeCond<T> = T extends {
|
|
19
|
-
props: any;
|
|
20
|
-
key: any;
|
|
21
|
-
} ? VNode : never;
|
|
22
|
-
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
23
|
-
declare const preactNodePlugins: Plugins;
|
|
24
|
-
/** ---------------------------------------------
|
|
25
|
-
* INSERTION PLUGIN
|
|
26
|
-
* --------------------------------------------- */
|
|
27
|
-
type InsertionCond<T, _S, L extends LocalesValues> = T extends {
|
|
28
|
-
nodeType: NodeType | string;
|
|
29
|
-
[NodeType.Insertion]: infer I;
|
|
30
|
-
fields: readonly (infer F)[];
|
|
31
|
-
} ? <V extends { [K in Extract<F, string>]: string | number | VNode }>(values: V) => I extends string ? V[keyof V] extends string | number ? IntlayerNode<string> : IntlayerNode<VNode> : DeepTransformContent$1<I, L> : never;
|
|
32
|
-
/** Insertion plugin for Preact. Handles component/node insertion. */
|
|
33
|
-
declare const insertionPlugin: Plugins;
|
|
34
|
-
/**
|
|
35
|
-
* MARKDOWN PLUGIN
|
|
36
|
-
*/
|
|
37
|
-
type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
|
|
38
|
-
metadata: DeepTransformContent$1<string>;
|
|
39
|
-
use: (components?: HTMLComponents<'permissive', {}>) => VNode;
|
|
40
|
-
}> : never;
|
|
41
|
-
/** Markdown string plugin. Replaces string node with a component that render the markdown. */
|
|
42
|
-
declare const markdownStringPlugin: Plugins;
|
|
43
|
-
type MarkdownCond<T> = T extends {
|
|
44
|
-
nodeType: NodeType | string;
|
|
45
|
-
[NodeType.Markdown]: infer _M;
|
|
46
|
-
metadata?: infer U;
|
|
47
|
-
tags?: infer U;
|
|
48
|
-
} ? {
|
|
49
|
-
use: (components?: HTMLComponents<'permissive', U>) => VNode;
|
|
50
|
-
metadata: DeepTransformContent$1<U>;
|
|
51
|
-
} : never;
|
|
52
|
-
declare const markdownPlugin: Plugins;
|
|
53
|
-
/** ---------------------------------------------
|
|
54
|
-
* HTML PLUGIN
|
|
55
|
-
* --------------------------------------------- */
|
|
56
|
-
type HTMLPluginCond<T> = T extends {
|
|
57
|
-
nodeType: NodeType | string;
|
|
58
|
-
[NodeType.HTML]: infer I;
|
|
59
|
-
tags?: infer U;
|
|
60
|
-
} ? {
|
|
61
|
-
use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;
|
|
62
|
-
} : never;
|
|
63
|
-
/** HTML plugin. Replaces node with a function that takes components => VNode. */
|
|
64
|
-
declare const htmlPlugin: Plugins;
|
|
65
|
-
/** ---------------------------------------------
|
|
66
|
-
* PLUGINS RESULT
|
|
67
|
-
* --------------------------------------------- */
|
|
68
|
-
interface IInterpreterPluginPreact<T, S, L extends LocalesValues> {
|
|
69
|
-
preactNode: PreactNodeCond<T>;
|
|
70
|
-
preactIntlayerNode: IntlayerNodeCond<T>;
|
|
71
|
-
preactInsertion: InsertionCond<T, S, L>;
|
|
72
|
-
preactMarkdown: MarkdownCond<T>;
|
|
73
|
-
preactHtml: HTMLPluginCond<T>;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.
|
|
77
|
-
*
|
|
78
|
-
* Otherwise the the `preact-intlayer` plugins will override the types of `intlayer` functions.
|
|
79
|
-
*/
|
|
80
|
-
type IInterpreterPluginState$1 = Omit<IInterpreterPluginState, 'insertion'> & {
|
|
81
|
-
preactNode: true;
|
|
82
|
-
preactIntlayerNode: true;
|
|
83
|
-
preactInsertion: true;
|
|
84
|
-
preactMarkdown: true;
|
|
85
|
-
preactHtml: true;
|
|
86
|
-
};
|
|
87
|
-
type DeepTransformContent$1<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContent<T, IInterpreterPluginState$1, L>;
|
|
88
|
-
/**
|
|
89
|
-
* Get the plugins array for Preact content transformation.
|
|
90
|
-
* This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.
|
|
91
|
-
*/
|
|
92
|
-
declare const getPlugins: (locale?: LocalesValues, fallback?: boolean) => Plugins[];
|
|
93
|
-
//#endregion
|
|
94
|
-
export { InsertionCond as a, MarkdownStringCond as c, htmlPlugin as d, insertionPlugin as f, preactNodePlugins as g, markdownStringPlugin as h, IInterpreterPluginState$1 as i, PreactNodeCond as l, markdownPlugin as m, HTMLPluginCond as n, IntlayerNodeCond as o, intlayerNodePlugins as p, IInterpreterPluginPreact as r, MarkdownCond as s, DeepTransformContent$1 as t, getPlugins as u };
|
|
95
|
-
//# sourceMappingURL=plugins-D6OB94dO.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugins-D6OB94dO.d.ts","names":[],"sources":["../../src/plugins.tsx"],"mappings":";;;;;;;;;;AAoCA;KAAY,gBAAA,MAAsB,CAAA,2BAC9B,YAAA,CAAa,CAAA;;cAIJ,mBAAA,EAAqB,OAAA;;;;KA8BtB,cAAA,MAAoB,CAAA;EAC9B,KAAA;EACA,GAAA;AAAA,IAEE,KAAA;;cAIS,iBAAA,EAAmB,OAAA;;AAtChC;;KAmEY,aAAA,kBAA+B,aAAA,IAAiB,CAAA;EAC1D,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,SAAA;EACV,MAAA;AAAA,uBAEqB,OAAA,CAAQ,CAAA,8BAA+B,KAAA,IACxD,MAAA,EAAQ,CAAA,KACL,CAAA,kBACD,CAAA,OAAQ,CAAA,4BACN,YAAA,WACA,YAAA,CAAa,KAAA,IACf,sBAAA,CAAqB,CAAA,EAAG,CAAA;;cAuEnB,eAAA,EAAiB,OAAA;;;;KA0DlB,kBAAA,MAAwB,CAAA,kBAChC,YAAA;EAGI,QAAA,EAAU,sBAAA;EACV,GAAA,GAAM,UAAA,GAAa,cAAA,uBAAqC,KAAA;AAAA;;cAMnD,oBAAA,EAAsB,OAAA;AAAA,KAuFvB,YAAA,MAAkB,CAAA;EAC5B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,QAAA;EACV,QAAA;EACA,IAAA;AAAA;EAGI,GAAA,GAAM,UAAA,GAAa,cAAA,eAA6B,CAAA,MAAO,KAAA;EACvD,QAAA,EAAU,sBAAA,CAAqB,CAAA;AAAA;AAAA,cAIxB,cAAA,EAAgB,OAAA;;;;KA2BjB,cAAA,MAAoB,CAAA;EAC9B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,IAAA;EACV,IAAA;AAAA;EAGI,GAAA,GAAM,UAAA,GAAa,cAAA,eAA6B,CAAA,MAAO,YAAA,CAAa,CAAA;AAAA;;cAK7D,UAAA,EAAY,OAAA;;;;UAqCR,wBAAA,iBAAyC,aAAA;EACxD,UAAA,EAAY,cAAA,CAAe,CAAA;EAC3B,kBAAA,EAAoB,gBAAA,CAAiB,CAAA;EACrC,eAAA,EAAiB,aAAA,CAAc,CAAA,EAAG,CAAA,EAAG,CAAA;EACrC,cAAA,EAAgB,YAAA,CAAa,CAAA;EAC7B,UAAA,EAAY,cAAA,CAAe,CAAA;AAAA;;;;;;KAQjB,yBAAA,GAA0B,IAAA,CACpC,uBAAA;EAGA,UAAA;EACA,kBAAA;EACA,eAAA;EACA,cAAA;EACA,UAAA;AAAA;AAAA,KAGU,sBAAA,cAEA,aAAA,GAAgB,eAAA,IACxB,oBAAA,CAAyB,CAAA,EAAG,yBAAA,EAAyB,CAAA;;;;;cAM5C,UAAA,GACX,MAAA,GAAS,aAAA,EACT,QAAA,eACC,OAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { MarkdownRuntime } from "@intlayer/core/markdown";
|
|
2
|
-
|
|
3
|
-
//#region src/markdown/runtime.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Preact-specific runtime for the markdown processor.
|
|
6
|
-
*/
|
|
7
|
-
declare const preactRuntime: MarkdownRuntime;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { preactRuntime as t };
|
|
10
|
-
//# sourceMappingURL=runtime-BMHAtT-R.d.ts.map
|