preact-intlayer 9.7.0 → 9.7.2
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 +1 -2
- package/dist/cjs/UI/ContentSelector.cjs +1 -2
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/cjs/analytics/AnalyticsProvider.cjs +2 -3
- package/dist/cjs/analytics/exposureSink.cjs +1 -2
- package/dist/cjs/analytics/index.cjs +4 -4
- package/dist/cjs/analytics/useAnalytics.cjs +4 -5
- package/dist/cjs/analytics/useConversion.cjs +2 -3
- package/dist/cjs/analytics/useExperiment.cjs +2 -3
- package/dist/cjs/client/IntlayerProvider.cjs +7 -8
- package/dist/cjs/client/index.cjs +11 -11
- package/dist/cjs/client/t.cjs +3 -4
- package/dist/cjs/client/useContent.cjs +3 -4
- package/dist/cjs/client/useDictionary.cjs +3 -4
- package/dist/cjs/client/useDictionary.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +4 -5
- package/dist/cjs/client/useDictionaryDynamic.cjs +5 -6
- package/dist/cjs/client/useIntlayer.cjs +3 -4
- package/dist/cjs/client/useLoadDynamic.cjs +1 -2
- package/dist/cjs/client/useLocale.cjs +4 -5
- package/dist/cjs/client/useLocaleBase.cjs +3 -4
- package/dist/cjs/client/useLocaleStorage.cjs +1 -2
- package/dist/cjs/client/usePathname.cjs +1 -2
- package/dist/cjs/client/useTraduction.cjs +3 -4
- package/dist/cjs/editor/ContentSelector.cjs +2 -3
- package/dist/cjs/editor/EditorProvider.cjs +2 -3
- package/dist/cjs/editor/useEditor.cjs +3 -4
- package/dist/cjs/format/index.cjs +9 -9
- package/dist/cjs/format/useCompact.cjs +2 -3
- package/dist/cjs/format/useCurrency.cjs +2 -3
- package/dist/cjs/format/useDate.cjs +2 -3
- package/dist/cjs/format/useIntl.cjs +2 -3
- package/dist/cjs/format/useList.cjs +2 -3
- package/dist/cjs/format/useNumber.cjs +2 -3
- package/dist/cjs/format/usePercentage.cjs +2 -3
- package/dist/cjs/format/useRelativeTime.cjs +2 -3
- package/dist/cjs/format/useUnit.cjs +2 -3
- package/dist/cjs/getDictionary.cjs +2 -3
- package/dist/cjs/getDictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayer.cjs +2 -3
- package/dist/cjs/html/HTMLProvider.cjs +2 -3
- package/dist/cjs/html/HTMLRenderer.cjs +3 -4
- package/dist/cjs/html/index.cjs +2 -2
- package/dist/cjs/index.cjs +17 -17
- package/dist/cjs/markdown/MarkdownProvider.cjs +3 -4
- package/dist/cjs/markdown/MarkdownRenderer.cjs +3 -4
- package/dist/cjs/markdown/MarkdownRendererPlugin.cjs +4 -5
- package/dist/cjs/markdown/compiler.cjs +2 -3
- package/dist/cjs/markdown/index.cjs +3 -3
- package/dist/cjs/markdown/runtime.cjs +1 -2
- package/dist/cjs/plugins.cjs +10 -11
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/cjs/preactElement/renderPreactElement.cjs +1 -2
- package/dist/esm/IntlayerNode.mjs +1 -2
- package/dist/esm/UI/ContentSelector.mjs +1 -2
- package/dist/esm/analytics/AnalyticsProvider.mjs +1 -2
- package/dist/esm/analytics/exposureSink.mjs +1 -2
- package/dist/esm/analytics/index.mjs +1 -1
- package/dist/esm/analytics/useAnalytics.mjs +3 -4
- package/dist/esm/analytics/useConversion.mjs +2 -3
- package/dist/esm/analytics/useExperiment.mjs +2 -3
- package/dist/esm/client/IntlayerProvider.mjs +5 -6
- package/dist/esm/client/index.mjs +2 -2
- package/dist/esm/client/t.mjs +2 -3
- package/dist/esm/client/useContent.mjs +1 -2
- package/dist/esm/client/useDictionary.mjs +1 -2
- package/dist/esm/client/useDictionary.mjs.map +1 -1
- package/dist/esm/client/useDictionaryAsync.mjs +2 -3
- package/dist/esm/client/useDictionaryDynamic.mjs +2 -3
- package/dist/esm/client/useIntlayer.mjs +1 -2
- package/dist/esm/client/useLoadDynamic.mjs +1 -2
- package/dist/esm/client/useLocale.mjs +3 -4
- package/dist/esm/client/useLocaleBase.mjs +2 -3
- package/dist/esm/client/useLocaleStorage.mjs +1 -2
- package/dist/esm/client/usePathname.mjs +1 -2
- package/dist/esm/client/useTraduction.mjs +2 -3
- package/dist/esm/editor/ContentSelector.mjs +2 -3
- package/dist/esm/editor/EditorProvider.mjs +1 -2
- package/dist/esm/editor/useEditor.mjs +2 -3
- package/dist/esm/format/index.mjs +5 -5
- package/dist/esm/format/useCompact.mjs +1 -2
- package/dist/esm/format/useCurrency.mjs +1 -2
- package/dist/esm/format/useDate.mjs +1 -2
- package/dist/esm/format/useIntl.mjs +1 -2
- package/dist/esm/format/useList.mjs +1 -2
- package/dist/esm/format/useNumber.mjs +1 -2
- package/dist/esm/format/usePercentage.mjs +1 -2
- package/dist/esm/format/useRelativeTime.mjs +1 -2
- package/dist/esm/format/useUnit.mjs +1 -2
- package/dist/esm/getDictionary.mjs +1 -2
- package/dist/esm/getDictionary.mjs.map +1 -1
- package/dist/esm/getIntlayer.mjs +1 -2
- package/dist/esm/html/HTMLProvider.mjs +2 -3
- package/dist/esm/html/HTMLRenderer.mjs +2 -3
- package/dist/esm/index.mjs +6 -6
- package/dist/esm/markdown/MarkdownProvider.mjs +2 -3
- package/dist/esm/markdown/MarkdownRenderer.mjs +1 -2
- package/dist/esm/markdown/MarkdownRendererPlugin.mjs +2 -3
- package/dist/esm/markdown/compiler.mjs +1 -2
- package/dist/esm/markdown/runtime.mjs +1 -2
- package/dist/esm/plugins.mjs +5 -6
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/esm/preactElement/renderPreactElement.mjs +1 -2
- package/dist/types/IntlayerNode.d.ts +2 -3
- package/dist/types/IntlayerNode.d.ts.map +1 -1
- package/dist/types/UI/ContentSelector.d.ts +1 -2
- package/dist/types/UI/ContentSelector.d.ts.map +1 -1
- package/dist/types/analytics/AnalyticsProvider.d.ts +0 -2
- package/dist/types/analytics/AnalyticsProvider.d.ts.map +1 -1
- package/dist/types/analytics/exposureSink.d.ts +0 -2
- package/dist/types/analytics/exposureSink.d.ts.map +1 -1
- package/dist/types/analytics/useAnalytics.d.ts +0 -2
- package/dist/types/analytics/useAnalytics.d.ts.map +1 -1
- package/dist/types/analytics/useConversion.d.ts +0 -2
- package/dist/types/analytics/useConversion.d.ts.map +1 -1
- package/dist/types/analytics/useExperiment.d.ts +0 -2
- package/dist/types/analytics/useExperiment.d.ts.map +1 -1
- package/dist/types/client/IntlayerProvider.d.ts +1 -2
- package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
- package/dist/types/client/t.d.ts +0 -2
- package/dist/types/client/t.d.ts.map +1 -1
- package/dist/types/client/useContent.d.ts +0 -2
- package/dist/types/client/useContent.d.ts.map +1 -1
- package/dist/types/client/useDictionary.d.ts +0 -2
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useDictionaryAsync.d.ts +0 -2
- package/dist/types/client/useDictionaryAsync.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +0 -2
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useIntlayer.d.ts +0 -2
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- package/dist/types/client/useLoadDynamic.d.ts +0 -2
- package/dist/types/client/useLoadDynamic.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts +1 -2
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocaleBase.d.ts +0 -2
- package/dist/types/client/useLocaleBase.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +0 -2
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/dist/types/client/usePathname.d.ts +0 -2
- package/dist/types/client/usePathname.d.ts.map +1 -1
- package/dist/types/client/useTraduction.d.ts +0 -2
- package/dist/types/client/useTraduction.d.ts.map +1 -1
- package/dist/types/editor/ContentSelector.d.ts +0 -2
- package/dist/types/editor/ContentSelector.d.ts.map +1 -1
- package/dist/types/editor/EditorProvider.d.ts +0 -2
- package/dist/types/editor/EditorProvider.d.ts.map +1 -1
- package/dist/types/editor/useEditor.d.ts +0 -2
- package/dist/types/editor/useEditor.d.ts.map +1 -1
- package/dist/types/format/useCompact.d.ts +0 -2
- package/dist/types/format/useCompact.d.ts.map +1 -1
- package/dist/types/format/useCurrency.d.ts +0 -2
- package/dist/types/format/useCurrency.d.ts.map +1 -1
- package/dist/types/format/useDate.d.ts +0 -2
- package/dist/types/format/useDate.d.ts.map +1 -1
- package/dist/types/format/useIntl.d.ts +0 -2
- package/dist/types/format/useIntl.d.ts.map +1 -1
- package/dist/types/format/useList.d.ts +0 -2
- package/dist/types/format/useList.d.ts.map +1 -1
- package/dist/types/format/useNumber.d.ts +0 -2
- package/dist/types/format/useNumber.d.ts.map +1 -1
- package/dist/types/format/usePercentage.d.ts +0 -2
- package/dist/types/format/usePercentage.d.ts.map +1 -1
- package/dist/types/format/useRelativeTime.d.ts +0 -2
- package/dist/types/format/useRelativeTime.d.ts.map +1 -1
- package/dist/types/format/useUnit.d.ts +0 -2
- package/dist/types/format/useUnit.d.ts.map +1 -1
- package/dist/types/getDictionary.d.ts +0 -2
- package/dist/types/getDictionary.d.ts.map +1 -1
- package/dist/types/getIntlayer.d.ts +0 -2
- package/dist/types/getIntlayer.d.ts.map +1 -1
- package/dist/types/html/HTMLProvider.d.ts +1 -2
- package/dist/types/html/HTMLProvider.d.ts.map +1 -1
- package/dist/types/html/HTMLRenderer.d.ts +0 -2
- package/dist/types/html/HTMLRenderer.d.ts.map +1 -1
- package/dist/types/html/index.d.ts +1 -1
- package/dist/types/html/types.d.ts +1 -2
- package/dist/types/html/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownProvider.d.ts +1 -2
- package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts +0 -2
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownRendererPlugin.d.ts +1 -2
- package/dist/types/markdown/MarkdownRendererPlugin.d.ts.map +1 -1
- package/dist/types/markdown/compiler.d.ts +3 -2
- package/dist/types/markdown/compiler.d.ts.map +1 -1
- package/dist/types/markdown/runtime.d.ts +3 -2
- package/dist/types/markdown/runtime.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +3 -5
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/preactElement/renderPreactElement.d.ts +0 -2
- package/dist/types/preactElement/renderPreactElement.d.ts.map +1 -1
- package/package.json +50 -50
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_client_IntlayerProvider = require(
|
|
2
|
+
const require_client_IntlayerProvider = require("../client/IntlayerProvider.cjs");
|
|
3
3
|
let preact_hooks = require("preact/hooks");
|
|
4
4
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/format/useIntl.ts
|
|
7
7
|
/**
|
|
8
8
|
* Preact client hook that provides a locale-bound `Intl` object.
|
|
9
9
|
*
|
|
@@ -28,6 +28,5 @@ const useIntl = (locale) => {
|
|
|
28
28
|
return (0, preact_hooks.useMemo)(() => (0, _intlayer_core_formatters.bindIntl)(currentLocale), [currentLocale]);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
//#endregion
|
|
32
31
|
exports.useIntl = useIntl;
|
|
33
32
|
//# sourceMappingURL=useIntl.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_client_IntlayerProvider = require(
|
|
2
|
+
const require_client_IntlayerProvider = require("../client/IntlayerProvider.cjs");
|
|
3
3
|
let preact_hooks = require("preact/hooks");
|
|
4
4
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/format/useList.ts
|
|
7
7
|
/**
|
|
8
8
|
* React client hook that provides a list formatter
|
|
9
9
|
* bound to the current application locale.
|
|
@@ -33,6 +33,5 @@ const useList = () => {
|
|
|
33
33
|
}), [locale]);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
//#endregion
|
|
37
36
|
exports.useList = useList;
|
|
38
37
|
//# sourceMappingURL=useList.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_client_IntlayerProvider = require(
|
|
2
|
+
const require_client_IntlayerProvider = require("../client/IntlayerProvider.cjs");
|
|
3
3
|
let preact_hooks = require("preact/hooks");
|
|
4
4
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/format/useNumber.ts
|
|
7
7
|
/**
|
|
8
8
|
* React client hook that provides a localized number formatter.
|
|
9
9
|
*
|
|
@@ -34,6 +34,5 @@ const useNumber = () => {
|
|
|
34
34
|
}), [locale]);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
//#endregion
|
|
38
37
|
exports.useNumber = useNumber;
|
|
39
38
|
//# sourceMappingURL=useNumber.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_client_IntlayerProvider = require(
|
|
2
|
+
const require_client_IntlayerProvider = require("../client/IntlayerProvider.cjs");
|
|
3
3
|
let preact_hooks = require("preact/hooks");
|
|
4
4
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/format/usePercentage.ts
|
|
7
7
|
/**
|
|
8
8
|
* React hook to provide a percentage formatter function
|
|
9
9
|
* based on the current application locale.
|
|
@@ -30,6 +30,5 @@ const usePercentage = () => {
|
|
|
30
30
|
}), [locale]);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
//#endregion
|
|
34
33
|
exports.usePercentage = usePercentage;
|
|
35
34
|
//# sourceMappingURL=usePercentage.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_client_IntlayerProvider = require(
|
|
2
|
+
const require_client_IntlayerProvider = require("../client/IntlayerProvider.cjs");
|
|
3
3
|
let preact_hooks = require("preact/hooks");
|
|
4
4
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/format/useRelativeTime.ts
|
|
7
7
|
/**
|
|
8
8
|
* Client-side React hook for accessing a localized relative time formatter.
|
|
9
9
|
*
|
|
@@ -30,6 +30,5 @@ const useRelativeTime = () => {
|
|
|
30
30
|
}), [locale]);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
//#endregion
|
|
34
33
|
exports.useRelativeTime = useRelativeTime;
|
|
35
34
|
//# sourceMappingURL=useRelativeTime.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_client_IntlayerProvider = require(
|
|
2
|
+
const require_client_IntlayerProvider = require("../client/IntlayerProvider.cjs");
|
|
3
3
|
let preact_hooks = require("preact/hooks");
|
|
4
4
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/format/useUnit.ts
|
|
7
7
|
/**
|
|
8
8
|
* React hook that provides a unit formatting function
|
|
9
9
|
* based on the current locale from {@link useLocaleBase}.
|
|
@@ -29,6 +29,5 @@ const useUnit = () => {
|
|
|
29
29
|
}), [locale]);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
exports.useUnit = useUnit;
|
|
34
33
|
//# sourceMappingURL=useUnit.cjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_plugins = require(
|
|
2
|
+
const require_plugins = require("./plugins.cjs");
|
|
3
3
|
let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/getDictionary.ts
|
|
6
6
|
/**
|
|
7
7
|
* Transforms a dictionary (or qualified dictionary group) and returns its
|
|
8
8
|
* content for the given locale or selector (`{ item }`, `{ variant }`,
|
|
@@ -13,6 +13,5 @@ const getDictionary = (dictionary, localeOrSelector) => {
|
|
|
13
13
|
return (0, _intlayer_core_interpreter.getDictionary)(dictionary, localeOrSelector, require_plugins.getPlugins(locale));
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
//#endregion
|
|
17
16
|
exports.getDictionary = getDictionary;
|
|
18
17
|
//# sourceMappingURL=getDictionary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionary.cjs","names":["getDictionaryCore","getPlugins"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Transforms a dictionary (or qualified dictionary group) and returns its\n * content for the given locale or selector (`{ item }`, `{ variant }`,\n * optionally combined with `locale`).\n */\nexport const getDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends
|
|
1
|
+
{"version":3,"file":"getDictionary.cjs","names":["getDictionaryCore","getPlugins"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\n/**\n * Transforms a dictionary (or qualified dictionary group) and returns its\n * content for the given locale or selector (`{ item }`, `{ variant }`,\n * optionally combined with `locale`).\n */\nexport const getDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends LocalesValues | DictionarySelectorForGroup<T> =\n DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n> => {\n const locale = (\n typeof localeOrSelector === 'object' && localeOrSelector !== null\n ? localeOrSelector.locale\n : localeOrSelector\n ) as LocalesValues | undefined;\n\n return getDictionaryCore(\n dictionary,\n localeOrSelector,\n getPlugins(locale)\n ) as any;\n};\n"],"mappings":";;;;;;;;;;AAmBA,MAAa,iBAKX,YACA,qBAIG;CACH,MAAM,SACJ,OAAO,qBAAqB,YAAY,qBAAqB,OACzD,iBAAiB,SACjB;CAGN,WAAOA,0CACL,YACA,kBACAC,2BAAW,MAAM,CACnB;AACF"}
|
package/dist/cjs/getIntlayer.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_plugins = require(
|
|
2
|
+
const require_plugins = require("./plugins.cjs");
|
|
3
3
|
let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/getIntlayer.ts
|
|
6
6
|
/**
|
|
7
7
|
* Picks one dictionary by its key and returns its content for the given
|
|
8
8
|
* locale or selector (`{ item }`, `{ variant }`,
|
|
@@ -13,6 +13,5 @@ const getIntlayer = (key, localeOrSelector) => {
|
|
|
13
13
|
return (0, _intlayer_core_interpreter.getIntlayer)(key, localeOrSelector, require_plugins.getPlugins(locale));
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
//#endregion
|
|
17
16
|
exports.getIntlayer = getIntlayer;
|
|
18
17
|
//# sourceMappingURL=getIntlayer.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
let preact = require("preact");
|
|
3
2
|
let preact_hooks = require("preact/hooks");
|
|
3
|
+
let preact = require("preact");
|
|
4
4
|
let preact_jsx_runtime = require("preact/jsx-runtime");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/html/HTMLProvider.tsx
|
|
7
7
|
const HTMLContext = (0, preact.createContext)(void 0);
|
|
8
8
|
const useHTMLContext = () => (0, preact_hooks.useContext)(HTMLContext);
|
|
9
9
|
const HTMLProvider = ({ children, components }) => /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(HTMLContext.Provider, {
|
|
@@ -11,7 +11,6 @@ const HTMLProvider = ({ children, components }) => /* @__PURE__ */ (0, preact_js
|
|
|
11
11
|
children
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
//#endregion
|
|
15
14
|
exports.HTMLProvider = HTMLProvider;
|
|
16
15
|
exports.useHTMLContext = useHTMLContext;
|
|
17
16
|
//# sourceMappingURL=HTMLProvider.cjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_html_HTMLProvider = require(
|
|
3
|
-
let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
|
|
2
|
+
const require_html_HTMLProvider = require("./HTMLProvider.cjs");
|
|
4
3
|
let preact = require("preact");
|
|
4
|
+
let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
|
|
5
5
|
let _intlayer_core_transpiler = require("@intlayer/core/transpiler");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/html/HTMLRenderer.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Renders HTML-like content to JSX with the provided components.
|
|
10
10
|
*
|
|
@@ -44,7 +44,6 @@ const HTMLRenderer = ({ children = "", html, components }) => {
|
|
|
44
44
|
return useHTMLRenderer({ components })(children || html || "");
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
//#endregion
|
|
48
47
|
exports.HTMLRenderer = HTMLRenderer;
|
|
49
48
|
exports.renderHTML = renderHTML;
|
|
50
49
|
exports.useHTMLRenderer = useHTMLRenderer;
|
package/dist/cjs/html/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_html_HTMLProvider = require(
|
|
3
|
-
const require_html_HTMLRenderer = require(
|
|
2
|
+
const require_html_HTMLProvider = require("./HTMLProvider.cjs");
|
|
3
|
+
const require_html_HTMLRenderer = require("./HTMLRenderer.cjs");
|
|
4
4
|
|
|
5
5
|
exports.HTMLProvider = require_html_HTMLProvider.HTMLProvider;
|
|
6
6
|
exports.HTMLRenderer = require_html_HTMLRenderer.HTMLRenderer;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const require_client_useLoadDynamic = require(
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
2
|
+
const require_analytics_AnalyticsProvider = require("./analytics/AnalyticsProvider.cjs");
|
|
3
|
+
const require_analytics_useAnalytics = require("./analytics/useAnalytics.cjs");
|
|
4
|
+
const require_analytics_useConversion = require("./analytics/useConversion.cjs");
|
|
5
|
+
const require_analytics_useExperiment = require("./analytics/useExperiment.cjs");
|
|
6
|
+
const require_client_IntlayerProvider = require("./client/IntlayerProvider.cjs");
|
|
7
|
+
const require_client_useLocaleStorage = require("./client/useLocaleStorage.cjs");
|
|
8
|
+
const require_client_t = require("./client/t.cjs");
|
|
9
|
+
const require_client_useDictionary = require("./client/useDictionary.cjs");
|
|
10
|
+
const require_client_useDictionaryAsync = require("./client/useDictionaryAsync.cjs");
|
|
11
|
+
const require_client_useDictionaryDynamic = require("./client/useDictionaryDynamic.cjs");
|
|
12
|
+
const require_client_useIntlayer = require("./client/useIntlayer.cjs");
|
|
13
|
+
const require_client_useLoadDynamic = require("./client/useLoadDynamic.cjs");
|
|
14
|
+
const require_client_useLocale = require("./client/useLocale.cjs");
|
|
15
|
+
const require_client_useLocaleBase = require("./client/useLocaleBase.cjs");
|
|
16
|
+
const require_client_usePathname = require("./client/usePathname.cjs");
|
|
17
|
+
const require_getDictionary = require("./getDictionary.cjs");
|
|
18
|
+
const require_getIntlayer = require("./getIntlayer.cjs");
|
|
19
19
|
|
|
20
20
|
exports.AnalyticsProvider = require_analytics_AnalyticsProvider.AnalyticsProvider;
|
|
21
21
|
exports.IntlayerClientContext = require_client_IntlayerProvider.IntlayerClientContext;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_markdown_compiler = require(
|
|
3
|
-
let preact = require("preact");
|
|
2
|
+
const require_markdown_compiler = require("./compiler.cjs");
|
|
4
3
|
let preact_hooks = require("preact/hooks");
|
|
4
|
+
let preact = require("preact");
|
|
5
5
|
let preact_jsx_runtime = require("preact/jsx-runtime");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/markdown/MarkdownProvider.tsx
|
|
8
8
|
const MarkdownContext = (0, preact.createContext)(void 0);
|
|
9
9
|
const useMarkdownContext = () => (0, preact_hooks.useContext)(MarkdownContext);
|
|
10
10
|
const mergeOptions = (baseComponents, baseOptions, options = {}, components = {}, wrapper) => {
|
|
@@ -49,7 +49,6 @@ const MarkdownProvider = ({ children, components, wrapper, forceBlock, forceInli
|
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
//#endregion
|
|
53
52
|
exports.MarkdownProvider = MarkdownProvider;
|
|
54
53
|
exports.useMarkdownContext = useMarkdownContext;
|
|
55
54
|
//# sourceMappingURL=MarkdownProvider.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_markdown_compiler = require(
|
|
3
|
-
const require_markdown_MarkdownProvider = require(
|
|
2
|
+
const require_markdown_compiler = require("./compiler.cjs");
|
|
3
|
+
const require_markdown_MarkdownProvider = require("./MarkdownProvider.cjs");
|
|
4
4
|
let preact_jsx_runtime = require("preact/jsx-runtime");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/markdown/MarkdownRenderer.tsx
|
|
7
7
|
const renderMarkdown = (content, { components, wrapper, forceBlock, forceInline, preserveFrontmatter, tagfilter } = {}) => {
|
|
8
8
|
return require_markdown_compiler.compileMarkdown(content, {
|
|
9
9
|
components,
|
|
@@ -66,7 +66,6 @@ const MarkdownRenderer = ({ children = "", components, wrapper, forceBlock, forc
|
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
//#endregion
|
|
70
69
|
exports.MarkdownRenderer = MarkdownRenderer;
|
|
71
70
|
exports.renderMarkdown = renderMarkdown;
|
|
72
71
|
exports.useMarkdownRenderer = useMarkdownRenderer;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_client_useLocale = require(
|
|
5
|
-
const require_markdown_MarkdownProvider = require(
|
|
6
|
-
let _intlayer_core_markdown = require("@intlayer/core/markdown");
|
|
4
|
+
const require_client_useLocale = require("../client/useLocale.cjs");
|
|
5
|
+
const require_markdown_MarkdownProvider = require("./MarkdownProvider.cjs");
|
|
7
6
|
let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryManipulator");
|
|
7
|
+
let _intlayer_core_markdown = require("@intlayer/core/markdown");
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/markdown/MarkdownRendererPlugin.tsx
|
|
10
10
|
const MarkdownRendererPlugin = (props) => {
|
|
11
11
|
const { children, options, components } = props;
|
|
12
12
|
const context = require_markdown_MarkdownProvider.useMarkdownContext();
|
|
@@ -21,7 +21,6 @@ const MarkdownMetadataRenderer = ({ children, metadataKeyPath }) => {
|
|
|
21
21
|
return (0, _intlayer_core_dictionaryManipulator.getContentNodeByKeyPath)(metadata, metadataKeyPath, currentLocale);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
//#endregion
|
|
25
24
|
exports.MarkdownMetadataRenderer = MarkdownMetadataRenderer;
|
|
26
25
|
exports.MarkdownRendererPlugin = MarkdownRendererPlugin;
|
|
27
26
|
//# sourceMappingURL=MarkdownRendererPlugin.cjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_markdown_runtime = require(
|
|
2
|
+
const require_markdown_runtime = require("./runtime.cjs");
|
|
3
3
|
let _intlayer_core_markdown = require("@intlayer/core/markdown");
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/markdown/compiler.ts
|
|
6
6
|
/**
|
|
7
7
|
* Preact adapter for the framework-agnostic markdown processor.
|
|
8
8
|
*/
|
|
@@ -61,7 +61,6 @@ const compileMarkdown = (input = "", options = {}) => {
|
|
|
61
61
|
}, compilerOptions);
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
//#endregion
|
|
65
64
|
exports.compileMarkdown = compileMarkdown;
|
|
66
65
|
exports.parseMarkdown = parseMarkdown;
|
|
67
66
|
//# sourceMappingURL=compiler.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_markdown_compiler = require(
|
|
3
|
-
const require_markdown_MarkdownProvider = require(
|
|
4
|
-
const require_markdown_MarkdownRenderer = require(
|
|
2
|
+
const require_markdown_compiler = require("./compiler.cjs");
|
|
3
|
+
const require_markdown_MarkdownProvider = require("./MarkdownProvider.cjs");
|
|
4
|
+
const require_markdown_MarkdownRenderer = require("./MarkdownRenderer.cjs");
|
|
5
5
|
|
|
6
6
|
exports.MarkdownProvider = require_markdown_MarkdownProvider.MarkdownProvider;
|
|
7
7
|
exports.MarkdownRenderer = require_markdown_MarkdownRenderer.MarkdownRenderer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
2
|
let preact = require("preact");
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/markdown/runtime.ts
|
|
5
5
|
/**
|
|
6
6
|
* Preact-specific runtime for the markdown processor.
|
|
7
7
|
*/
|
|
@@ -12,7 +12,6 @@ const preactRuntime = {
|
|
|
12
12
|
normalizeProps: (_tag, props) => props
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
//#endregion
|
|
16
15
|
exports.default = preactRuntime;
|
|
17
16
|
exports.preactRuntime = preactRuntime;
|
|
18
17
|
//# sourceMappingURL=runtime.cjs.map
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require(
|
|
3
|
-
const require_analytics_exposureSink = require(
|
|
4
|
-
const require_editor_ContentSelector = require(
|
|
5
|
-
const require_IntlayerNode = require(
|
|
6
|
-
const require_preactElement_renderPreactElement = require(
|
|
7
|
-
let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
|
|
2
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_analytics_exposureSink = require("./analytics/exposureSink.cjs");
|
|
4
|
+
const require_editor_ContentSelector = require("./editor/ContentSelector.cjs");
|
|
5
|
+
const require_IntlayerNode = require("./IntlayerNode.cjs");
|
|
6
|
+
const require_preactElement_renderPreactElement = require("./preactElement/renderPreactElement.cjs");
|
|
8
7
|
let _intlayer_config_built = require("@intlayer/config/built");
|
|
8
|
+
let preact = require("preact");
|
|
9
|
+
let preact_jsx_runtime = require("preact/jsx-runtime");
|
|
10
|
+
let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
|
|
9
11
|
let _intlayer_core_markdown = require("@intlayer/core/markdown");
|
|
10
12
|
let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
|
|
11
13
|
_intlayer_types_nodeType = require_runtime.__toESM(_intlayer_types_nodeType);
|
|
12
|
-
let preact = require("preact");
|
|
13
14
|
let preact_compat = require("preact/compat");
|
|
14
|
-
let preact_jsx_runtime = require("preact/jsx-runtime");
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
// src/plugins.tsx
|
|
17
17
|
const markdownRendererModulePromise = process.env.INTLAYER_NODE_TYPE_MARKDOWN !== "false" ? Promise.resolve().then(() => require("./markdown/MarkdownRendererPlugin.cjs")).then((m) => ({
|
|
18
18
|
MarkdownRendererPlugin: m.MarkdownRendererPlugin,
|
|
19
19
|
MarkdownMetadataRenderer: m.MarkdownMetadataRenderer
|
|
@@ -113,7 +113,7 @@ const insertionPlugin = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? _
|
|
|
113
113
|
const transformedResult = deepTransformNode(node, {
|
|
114
114
|
...subProps,
|
|
115
115
|
children: node,
|
|
116
|
-
plugins:
|
|
116
|
+
plugins: (props.plugins ?? []).filter((plugin) => plugin.id !== "intlayer-node-plugin")
|
|
117
117
|
});
|
|
118
118
|
return (values) => {
|
|
119
119
|
const result = splitAndJoinInsertion(transformedResult, values);
|
|
@@ -263,7 +263,6 @@ const getPlugins = (locale, fallback = true) => {
|
|
|
263
263
|
return enabledPlugins;
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
-
//#endregion
|
|
267
266
|
exports.getPlugins = getPlugins;
|
|
268
267
|
exports.htmlPlugin = htmlPlugin;
|
|
269
268
|
exports.insertionPlugin = insertionPlugin;
|
package/dist/cjs/plugins.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.cjs","names":["editor","renderIntlayerNode","ContentSelector","fallbackPlugin","renderPreactElement","h","Fragment","NodeTypes","isInterpolableWrapperNode","transformInterpolableNode","resolveInsertedSelector","lazy","getMarkdownMetadata","resolveInterpreterLocale","translationPlugin","internationalization","enumerationPlugin","pluralPlugin","conditionPlugin","nestedPlugin","filePlugin","genderPlugin","selectPlugin"],"sources":["../../src/plugins.tsx"],"sourcesContent":["import { editor, internationalization } from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n fallbackPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n isInterpolableWrapperNode,\n nestedPlugin,\n type Plugins,\n pluralPlugin,\n resolveInsertedSelector,\n resolveInterpreterLocale,\n selectPlugin,\n transformInterpolableNode,\n translationPlugin,\n} from '@intlayer/core/interpreter';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type {\n HTMLContent,\n InsertionContent,\n MarkdownContent,\n} from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type { NodeType } from '@intlayer/types/nodeType';\nimport * as NodeTypes from '@intlayer/types/nodeType';\nimport { Fragment, type FunctionComponent, h, type VNode } from 'preact';\nimport { lazy } from 'preact/compat';\nimport { reportExposure } from './analytics/exposureSink';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/types';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderPreactElement } from './preactElement/renderPreactElement';\n\nconst markdownRendererModulePromise =\n process.env.INTLAYER_NODE_TYPE_MARKDOWN !== 'false'\n ? import('./markdown/MarkdownRendererPlugin').then((m) => ({\n MarkdownRendererPlugin: m.MarkdownRendererPlugin,\n MarkdownMetadataRenderer: m.MarkdownMetadataRenderer,\n }))\n : null;\n\nconst htmlRendererModulePromise =\n process.env.INTLAYER_NODE_TYPE_HTML !== 'false'\n ? import('./html/HTMLRenderer').then((m) => m.HTMLRenderer)\n : null;\n\n// These preloads are read later by `useLoadDynamic`, so the rejection must stay\n// on the promise: a `.catch()` chained into it would resolve with `undefined`\n// and be mistaken for a loaded module. Handle it on the side instead, so an\n// aborted chunk load never escapes as an unhandled rejection.\nmarkdownRendererModulePromise?.catch(() => {});\nhtmlRendererModulePromise?.catch(() => {});\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (_node, props) => {\n // Node-level analytics: record which content is resolved for display.\n // No-op (and dead-code-eliminated) when analytics is disabled.\n if (process.env.INTLAYER_ANALYTICS_ENABLED !== 'false') {\n reportExposure({\n dictionaryKey: props.dictionaryKey,\n keyPath: props.keyPath,\n locale: props.locale,\n nodeType: 'text',\n });\n }\n\n // Props are only forwarded to the editor selector: copying them for every\n // leaf would cost an allocation per rendered string\n if (process.env.INTLAYER_EDITOR_ENABLED !== 'false' && editor.enabled) {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n return renderIntlayerNode({\n value: rest.children,\n children: (\n <ContentSelector {...rest} key={rest.children}>\n {rest.children}\n </ContentSelector>\n ),\n });\n }\n\n return renderIntlayerNode({\n value: props.children,\n children: props.children,\n });\n },\n};\n\n/** ---------------------------------------------\n * PREACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type PreactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? VNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const preactNodePlugins: Plugins =\n process.env.INTLAYER_NODE_TYPE_PREACT_NODE === 'false'\n ? fallbackPlugin\n : {\n id: 'preact-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: (\n node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => {\n if (process.env.INTLAYER_ANALYTICS_ENABLED !== 'false') {\n reportExposure({\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n locale: rest.locale,\n nodeType: 'preact-node',\n });\n }\n\n return renderIntlayerNode({\n ...rest,\n value: '[[preact-element]]',\n children:\n process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n editor.enabled ? (\n <ContentSelector {...rest}>\n {renderPreactElement(node)}\n </ContentSelector>\n ) : (\n renderPreactElement(node)\n ),\n });\n },\n };\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T, _S, L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.INSERTION]: infer I; // Accept strings OR nested nodes like enumerations\n fields: readonly (infer F)[]; // Infer the exact string literals in the array\n}\n ? <V extends { [K in Extract<F, string>]: string | number | VNode }>(\n values: V\n ) => I extends string\n ? V[keyof V] extends string | number\n ? IntlayerNode<string>\n : IntlayerNode<VNode>\n : DeepTransformContent<I, L> // Delegate nested nodes (like enumerations) back to the core\n : never;\n\n/**\n * Check if a value is a Preact VNode\n */\nconst isVNode = (value: any): value is VNode => {\n return (\n value !== null &&\n value !== undefined &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n );\n};\n\n/**\n * Split insertion string and join with Preact VNodes\n */\nconst splitAndJoinInsertion = (\n template: string,\n values: Record<string, string | number | VNode>\n): VNode => {\n // Check if any value is a VNode\n const hasVNode = Object.values(values).some(isVNode);\n\n if (!hasVNode) {\n // Simple string replacement\n return template.replace(/\\{\\{\\s*(.*?)\\s*\\}\\}/g, (_, key) => {\n const trimmedKey = key.trim();\n return (values[trimmedKey] ?? '').toString();\n }) as any;\n }\n\n // Split the template by placeholders while keeping the structure\n const parts: (string | VNode)[] = [];\n let lastIndex = 0;\n const regex = /\\{\\{\\s*(.*?)\\s*\\}\\}/g;\n let match: RegExpExecArray | null = regex.exec(template);\n\n while (match !== null) {\n // Add text before the placeholder\n if (match.index > lastIndex) {\n parts.push(template.substring(lastIndex, match.index));\n }\n\n // Add the replaced value\n const key = match[1]?.trim();\n const value = key && values[key];\n if (value !== undefined && value !== null) {\n parts.push(typeof value === 'number' ? String(value) : value);\n }\n\n lastIndex = match.index + match[0].length;\n match = regex.exec(template);\n }\n\n // Add remaining text\n if (lastIndex < template.length) {\n parts.push(template.substring(lastIndex));\n }\n\n // Return as Fragment\n return h(\n Fragment,\n null,\n ...parts.map((part, index) => h(Fragment, { key: index }, part))\n );\n};\n\n/** Insertion plugin for Preact. Handles component/node insertion. */\nexport const insertionPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_INSERTION === 'false'\n ? fallbackPlugin\n : {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.INSERTION,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeTypes.INSERTION,\n },\n ];\n\n const children = node[NodeTypes.INSERTION];\n\n /** Insertion string plugin. Replaces string node with a component that render the insertion. */\n const insertionStringPlugin: Plugins = {\n id: 'insertion-string-plugin',\n canHandle: (node) =>\n typeof node === 'string' || isInterpolableWrapperNode(node),\n transform: (node, subProps, deepTransformNode) => {\n // `html()`/`markdown()` nodes carry their `{{ … }}` placeholders\n // inside a raw string. Interpolate into that string, then re-run\n // the transform so the html/markdown renderer applies afterwards.\n // VNodes cannot be injected into a raw markup string, so string\n // interpolation (not `splitAndJoinInsertion`) is used here.\n if (isInterpolableWrapperNode(node)) {\n return (\n values: {\n [K in InsertionContent['fields'][number]]: string | number;\n }\n ) =>\n transformInterpolableNode(\n node,\n values,\n subProps,\n props.plugins,\n deepTransformNode\n );\n }\n\n const transformedResult = deepTransformNode(node, {\n ...subProps,\n children: node,\n plugins: [\n ...(props.plugins ?? ([] as Plugins[])).filter(\n (plugin) => plugin.id !== 'intlayer-node-plugin'\n ),\n ],\n });\n\n return (\n values: {\n [K in InsertionContent['fields'][number]]:\n | string\n | number\n | VNode;\n }\n ) => {\n const result = splitAndJoinInsertion(transformedResult, values);\n\n return deepTransformNode(result, {\n ...subProps,\n plugins: props.plugins,\n children: result as any,\n });\n };\n },\n };\n\n const result = deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\n\n return resolveInsertedSelector(children, result);\n },\n };\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<\n string,\n {\n metadata: DeepTransformContent<string>;\n use: (components?: HTMLComponents<'permissive', {}>) => VNode;\n }\n >\n : never;\n\n/**\n * Code-split renderers are loaded with `lazy` rather than a hand-rolled\n * suspender. A node that suspended on the hand-rolled one never recovered once\n * the chunk landed, so every markdown node present on the first paint stayed\n * blank forever; `lazy` implements the suspend/retry handshake correctly.\n */\nconst MarkdownSuspenseRenderer = lazy(() =>\n markdownRendererModulePromise!.then((modules) => ({\n default: modules.MarkdownRendererPlugin as FunctionComponent<\n Record<string, any>\n >,\n }))\n);\n\nconst MarkdownMetadataSuspenseRenderer = lazy(() =>\n markdownRendererModulePromise!.then((modules) => ({\n default: modules.MarkdownMetadataRenderer as FunctionComponent<\n Record<string, any>\n >,\n }))\n);\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_MARKDOWN === 'false'\n ? fallbackPlugin\n : {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node) ?? {};\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children:\n process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n editor.enabled ? (\n <ContentSelector {...rest}>\n <MarkdownMetadataSuspenseRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataSuspenseRenderer>\n </ContentSelector>\n ) : (\n <MarkdownMetadataSuspenseRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataSuspenseRenderer>\n ),\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n const render = (components?: any) =>\n renderIntlayerNode({\n ...props,\n value: node,\n children:\n process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n editor.enabled ? (\n <ContentSelector {...rest}>\n <MarkdownSuspenseRenderer {...rest} components={components}>\n {node}\n </MarkdownSuspenseRenderer>\n </ContentSelector>\n ) : (\n <MarkdownSuspenseRenderer {...rest} components={components}>\n {node}\n </MarkdownSuspenseRenderer>\n ),\n additionalProps: {\n metadata: metadataNodes,\n use: render,\n },\n });\n\n return render() as any;\n },\n };\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.MARKDOWN]: infer _M;\n metadata?: infer U;\n tags?: infer U;\n}\n ? {\n use: (components?: HTMLComponents<'permissive', U>) => VNode;\n metadata: DeepTransformContent<U>;\n }\n : never;\n\nexport const markdownPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_MARKDOWN === 'false'\n ? fallbackPlugin\n : {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.MARKDOWN,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeTypes.MARKDOWN,\n },\n ];\n\n const children = node[NodeTypes.MARKDOWN];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n };\n\n/** ---------------------------------------------\n * HTML PLUGIN\n * --------------------------------------------- */\n\nexport type HTMLPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.HTML]: infer I;\n tags?: infer U;\n}\n ? {\n use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;\n }\n : never;\n\nconst HTMLSuspenseRenderer = lazy(() =>\n htmlRendererModulePromise!.then((HTMLRenderer) => ({\n default: HTMLRenderer as FunctionComponent<Record<string, any>>,\n }))\n);\n\n/** HTML plugin. Replaces node with a function that takes components => VNode. */\nexport const htmlPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_HTML === 'false'\n ? fallbackPlugin\n : {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.HTML,\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeTypes.HTML];\n const _tags = node.tags ?? [];\n // `children` is dropped deliberately: `HTMLRenderer` resolves its\n // content as `children || html`, so forwarding the raw node here would\n // shadow the HTML string and render nothing.\n const { plugins, children: _nodeChildren, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): VNode =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children:\n process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n editor.enabled\n ? h(\n ContentSelector,\n { ...rest },\n h(HTMLSuspenseRenderer, {\n ...rest,\n html,\n components: userComponents,\n })\n )\n : h(HTMLSuspenseRenderer, {\n ...rest,\n html,\n components: userComponents,\n }),\n additionalProps: { use: render },\n }) as any;\n\n return render();\n },\n };\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginPreact<T, S, L extends LocalesValues> {\n preactNode: PreactNodeCond<T>;\n preactIntlayerNode: IntlayerNodeCond<T>;\n preactInsertion: InsertionCond<T, S, L>;\n preactMarkdown: MarkdownCond<T>;\n preactHtml: HTMLPluginCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `preact-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n preactNode: true;\n preactIntlayerNode: true;\n preactInsertion: true;\n preactMarkdown: true;\n preactHtml: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n\nconst pluginsCache = new Map<string, Plugins[]>();\n\n/**\n * Get the plugins array for Preact content transformation.\n * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.\n */\nexport const getPlugins = (\n locale?: LocalesValues,\n fallback: boolean = true\n): Plugins[] => {\n const currentLocale = resolveInterpreterLocale(locale);\n const cacheKey = `${currentLocale}_${fallback}`;\n\n if (pluginsCache.has(cacheKey)) {\n return pluginsCache.get(cacheKey)!;\n }\n\n const plugins = [\n // First: most nodes are plain strings, which every other plugin rejects\n intlayerNodePlugins,\n translationPlugin(\n currentLocale,\n fallback ? internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n pluralPlugin(currentLocale),\n conditionPlugin,\n nestedPlugin(currentLocale),\n filePlugin,\n genderPlugin,\n selectPlugin,\n // Always include: handle plain strings/numbers and React elements\n preactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n ] as Plugins[];\n\n // Plugins disabled at build time never match: skip them on every node\n const enabledPlugins = plugins.filter((plugin) => plugin !== fallbackPlugin);\n\n pluginsCache.set(cacheKey, enabledPlugins);\n\n return enabledPlugins;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA,MAAM,gCACJ,QAAQ,IAAI,gCAAgC,+CACxC,0CAA4C,MAAM,OAAO;CACvD,wBAAwB,EAAE;CAC1B,0BAA0B,EAAE;AAC9B,EAAE,IACF;AAEN,MAAM,4BACJ,QAAQ,IAAI,4BAA4B,+CACpC,4BAA8B,MAAM,MAAM,EAAE,YAAY,IACxD;AAMN,+BAA+B,YAAY,CAAC,CAAC;AAC7C,2BAA2B,YAAY,CAAC,CAAC;;AAWzC,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YAAY,OAAO,UAAU;EAG3B,IAAI,QAAQ,IAAI,+BAA+B,SAC7C,8CAAe;GACb,eAAe,MAAM;GACrB,SAAS,MAAM;GACf,QAAQ,MAAM;GACd,UAAU;EACZ,CAAC;EAKH,IAAI,QAAQ,IAAI,4BAA4B,WAAWA,8BAAO,SAAS;GACrE,MAAM,EACJ,SACA,GAAG,SACD;GAEJ,OAAOC,wCAAmB;IACxB,OAAO,KAAK;IACZ,UACE,0CAACC,gDAAD;KAAiB,GAAI;KAAM,KAAK,KAAK;IAEpB,GADd,KAAK,QACS;GAErB,CAAC;EACH;EAEA,OAAOD,wCAAmB;GACxB,OAAO,MAAM;GACb,UAAU,MAAM;EAClB,CAAC;CACH;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AC,8CACE,eACA,WAAWC,4CAAqB,gBAAgB,MAClD;EACAC;MACAC,yCAAa,aAAa;EAC1BC;MACAC,yCAAa,aAAa;EAC1BC;EACAC;EACAC;EAEA;EACA;EACA;EACA;CAI2B,CAAC,CAAC,QAAQ,WAAW,WAAWnB,yCAAc;CAE3E,aAAa,IAAI,UAAU,cAAc;CAEzC,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"plugins.cjs","names":["editor","renderIntlayerNode","ContentSelector","fallbackPlugin","renderPreactElement","h","Fragment","NodeTypes","isInterpolableWrapperNode","transformInterpolableNode","resolveInsertedSelector","lazy","getMarkdownMetadata","resolveInterpreterLocale","translationPlugin","internationalization","enumerationPlugin","pluralPlugin","conditionPlugin","nestedPlugin","filePlugin","genderPlugin","selectPlugin"],"sources":["../../src/plugins.tsx"],"sourcesContent":["import { editor, internationalization } from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n fallbackPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n isInterpolableWrapperNode,\n nestedPlugin,\n type Plugins,\n pluralPlugin,\n resolveInsertedSelector,\n resolveInterpreterLocale,\n selectPlugin,\n transformInterpolableNode,\n translationPlugin,\n} from '@intlayer/core/interpreter';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type {\n HTMLContent,\n InsertionContent,\n MarkdownContent,\n} from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type { NodeType } from '@intlayer/types/nodeType';\nimport * as NodeTypes from '@intlayer/types/nodeType';\nimport { Fragment, type FunctionComponent, h, type VNode } from 'preact';\nimport { lazy } from 'preact/compat';\nimport { reportExposure } from './analytics/exposureSink';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/types';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderPreactElement } from './preactElement/renderPreactElement';\n\nconst markdownRendererModulePromise =\n process.env.INTLAYER_NODE_TYPE_MARKDOWN !== 'false'\n ? import('./markdown/MarkdownRendererPlugin').then((m) => ({\n MarkdownRendererPlugin: m.MarkdownRendererPlugin,\n MarkdownMetadataRenderer: m.MarkdownMetadataRenderer,\n }))\n : null;\n\nconst htmlRendererModulePromise =\n process.env.INTLAYER_NODE_TYPE_HTML !== 'false'\n ? import('./html/HTMLRenderer').then((m) => m.HTMLRenderer)\n : null;\n\n// These preloads are read later by `useLoadDynamic`, so the rejection must stay\n// on the promise: a `.catch()` chained into it would resolve with `undefined`\n// and be mistaken for a loaded module. Handle it on the side instead, so an\n// aborted chunk load never escapes as an unhandled rejection.\nmarkdownRendererModulePromise?.catch(() => {});\nhtmlRendererModulePromise?.catch(() => {});\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (_node, props) => {\n // Node-level analytics: record which content is resolved for display.\n // No-op (and dead-code-eliminated) when analytics is disabled.\n if (process.env.INTLAYER_ANALYTICS_ENABLED !== 'false') {\n reportExposure({\n dictionaryKey: props.dictionaryKey,\n keyPath: props.keyPath,\n locale: props.locale,\n nodeType: 'text',\n });\n }\n\n // Props are only forwarded to the editor selector: copying them for every\n // leaf would cost an allocation per rendered string\n if (process.env.INTLAYER_EDITOR_ENABLED !== 'false' && editor.enabled) {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n return renderIntlayerNode({\n value: rest.children,\n children: (\n <ContentSelector {...rest} key={rest.children}>\n {rest.children}\n </ContentSelector>\n ),\n });\n }\n\n return renderIntlayerNode({\n value: props.children,\n children: props.children,\n });\n },\n};\n\n/** ---------------------------------------------\n * PREACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type PreactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? VNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const preactNodePlugins: Plugins =\n process.env.INTLAYER_NODE_TYPE_PREACT_NODE === 'false'\n ? fallbackPlugin\n : {\n id: 'preact-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: (\n node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => {\n if (process.env.INTLAYER_ANALYTICS_ENABLED !== 'false') {\n reportExposure({\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n locale: rest.locale,\n nodeType: 'preact-node',\n });\n }\n\n return renderIntlayerNode({\n ...rest,\n value: '[[preact-element]]',\n children:\n process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n editor.enabled ? (\n <ContentSelector {...rest}>\n {renderPreactElement(node)}\n </ContentSelector>\n ) : (\n renderPreactElement(node)\n ),\n });\n },\n };\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T, _S, L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.INSERTION]: infer I; // Accept strings OR nested nodes like enumerations\n fields: readonly (infer F)[]; // Infer the exact string literals in the array\n}\n ? <V extends { [K in Extract<F, string>]: string | number | VNode }>(\n values: V\n ) => I extends string\n ? V[keyof V] extends string | number\n ? IntlayerNode<string>\n : IntlayerNode<VNode>\n : DeepTransformContent<I, L> // Delegate nested nodes (like enumerations) back to the core\n : never;\n\n/**\n * Check if a value is a Preact VNode\n */\nconst isVNode = (value: any): value is VNode => {\n return (\n value !== null &&\n value !== undefined &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n );\n};\n\n/**\n * Split insertion string and join with Preact VNodes\n */\nconst splitAndJoinInsertion = (\n template: string,\n values: Record<string, string | number | VNode>\n): VNode => {\n // Check if any value is a VNode\n const hasVNode = Object.values(values).some(isVNode);\n\n if (!hasVNode) {\n // Simple string replacement\n return template.replace(/\\{\\{\\s*(.*?)\\s*\\}\\}/g, (_, key) => {\n const trimmedKey = key.trim();\n return (values[trimmedKey] ?? '').toString();\n }) as any;\n }\n\n // Split the template by placeholders while keeping the structure\n const parts: (string | VNode)[] = [];\n let lastIndex = 0;\n const regex = /\\{\\{\\s*(.*?)\\s*\\}\\}/g;\n let match: RegExpExecArray | null = regex.exec(template);\n\n while (match !== null) {\n // Add text before the placeholder\n if (match.index > lastIndex) {\n parts.push(template.substring(lastIndex, match.index));\n }\n\n // Add the replaced value\n const key = match[1]?.trim();\n const value = key && values[key];\n if (value !== undefined && value !== null) {\n parts.push(typeof value === 'number' ? String(value) : value);\n }\n\n lastIndex = match.index + match[0].length;\n match = regex.exec(template);\n }\n\n // Add remaining text\n if (lastIndex < template.length) {\n parts.push(template.substring(lastIndex));\n }\n\n // Return as Fragment\n return h(\n Fragment,\n null,\n ...parts.map((part, index) => h(Fragment, { key: index }, part))\n );\n};\n\n/** Insertion plugin for Preact. Handles component/node insertion. */\nexport const insertionPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_INSERTION === 'false'\n ? fallbackPlugin\n : {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.INSERTION,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeTypes.INSERTION,\n },\n ];\n\n const children = node[NodeTypes.INSERTION];\n\n /** Insertion string plugin. Replaces string node with a component that render the insertion. */\n const insertionStringPlugin: Plugins = {\n id: 'insertion-string-plugin',\n canHandle: (node) =>\n typeof node === 'string' || isInterpolableWrapperNode(node),\n transform: (node, subProps, deepTransformNode) => {\n // `html()`/`markdown()` nodes carry their `{{ … }}` placeholders\n // inside a raw string. Interpolate into that string, then re-run\n // the transform so the html/markdown renderer applies afterwards.\n // VNodes cannot be injected into a raw markup string, so string\n // interpolation (not `splitAndJoinInsertion`) is used here.\n if (isInterpolableWrapperNode(node)) {\n return (values: {\n [K in InsertionContent['fields'][number]]: string | number;\n }) =>\n transformInterpolableNode(\n node,\n values,\n subProps,\n props.plugins,\n deepTransformNode\n );\n }\n\n const transformedResult = deepTransformNode(node, {\n ...subProps,\n children: node,\n plugins: (props.plugins ?? ([] as Plugins[])).filter(\n (plugin) => plugin.id !== 'intlayer-node-plugin'\n ),\n });\n\n return (values: {\n [K in InsertionContent['fields'][number]]:\n | string\n | number\n | VNode;\n }) => {\n const result = splitAndJoinInsertion(transformedResult, values);\n\n return deepTransformNode(result, {\n ...subProps,\n plugins: props.plugins,\n children: result as any,\n });\n };\n },\n };\n\n const result = deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\n\n return resolveInsertedSelector(children, result);\n },\n };\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<\n string,\n {\n metadata: DeepTransformContent<string>;\n use: (components?: HTMLComponents<'permissive', {}>) => VNode;\n }\n >\n : never;\n\n/**\n * Code-split renderers are loaded with `lazy` rather than a hand-rolled\n * suspender. A node that suspended on the hand-rolled one never recovered once\n * the chunk landed, so every markdown node present on the first paint stayed\n * blank forever; `lazy` implements the suspend/retry handshake correctly.\n */\nconst MarkdownSuspenseRenderer = lazy(() =>\n markdownRendererModulePromise!.then((modules) => ({\n default: modules.MarkdownRendererPlugin as FunctionComponent<\n Record<string, any>\n >,\n }))\n);\n\nconst MarkdownMetadataSuspenseRenderer = lazy(() =>\n markdownRendererModulePromise!.then((modules) => ({\n default: modules.MarkdownMetadataRenderer as FunctionComponent<\n Record<string, any>\n >,\n }))\n);\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_MARKDOWN === 'false'\n ? fallbackPlugin\n : {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node) ?? {};\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children:\n process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n editor.enabled ? (\n <ContentSelector {...rest}>\n <MarkdownMetadataSuspenseRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataSuspenseRenderer>\n </ContentSelector>\n ) : (\n <MarkdownMetadataSuspenseRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataSuspenseRenderer>\n ),\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n const render = (components?: any) =>\n renderIntlayerNode({\n ...props,\n value: node,\n children:\n process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n editor.enabled ? (\n <ContentSelector {...rest}>\n <MarkdownSuspenseRenderer {...rest} components={components}>\n {node}\n </MarkdownSuspenseRenderer>\n </ContentSelector>\n ) : (\n <MarkdownSuspenseRenderer {...rest} components={components}>\n {node}\n </MarkdownSuspenseRenderer>\n ),\n additionalProps: {\n metadata: metadataNodes,\n use: render,\n },\n });\n\n return render() as any;\n },\n };\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.MARKDOWN]: infer _M;\n metadata?: infer U;\n tags?: infer U;\n}\n ? {\n use: (components?: HTMLComponents<'permissive', U>) => VNode;\n metadata: DeepTransformContent<U>;\n }\n : never;\n\nexport const markdownPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_MARKDOWN === 'false'\n ? fallbackPlugin\n : {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.MARKDOWN,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeTypes.MARKDOWN,\n },\n ];\n\n const children = node[NodeTypes.MARKDOWN];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n };\n\n/** ---------------------------------------------\n * HTML PLUGIN\n * --------------------------------------------- */\n\nexport type HTMLPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.HTML]: infer I;\n tags?: infer U;\n}\n ? {\n use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;\n }\n : never;\n\nconst HTMLSuspenseRenderer = lazy(() =>\n htmlRendererModulePromise!.then((HTMLRenderer) => ({\n default: HTMLRenderer as FunctionComponent<Record<string, any>>,\n }))\n);\n\n/** HTML plugin. Replaces node with a function that takes components => VNode. */\nexport const htmlPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_HTML === 'false'\n ? fallbackPlugin\n : {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.HTML,\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeTypes.HTML];\n const _tags = node.tags ?? [];\n // `children` is dropped deliberately: `HTMLRenderer` resolves its\n // content as `children || html`, so forwarding the raw node here would\n // shadow the HTML string and render nothing.\n const { plugins, children: _nodeChildren, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): VNode =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children:\n process.env.INTLAYER_EDITOR_ENABLED !== 'false' &&\n editor.enabled\n ? h(\n ContentSelector,\n { ...rest },\n h(HTMLSuspenseRenderer, {\n ...rest,\n html,\n components: userComponents,\n })\n )\n : h(HTMLSuspenseRenderer, {\n ...rest,\n html,\n components: userComponents,\n }),\n additionalProps: { use: render },\n }) as any;\n\n return render();\n },\n };\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginPreact<T, S, L extends LocalesValues> {\n preactNode: PreactNodeCond<T>;\n preactIntlayerNode: IntlayerNodeCond<T>;\n preactInsertion: InsertionCond<T, S, L>;\n preactMarkdown: MarkdownCond<T>;\n preactHtml: HTMLPluginCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `preact-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n preactNode: true;\n preactIntlayerNode: true;\n preactInsertion: true;\n preactMarkdown: true;\n preactHtml: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n\nconst pluginsCache = new Map<string, Plugins[]>();\n\n/**\n * Get the plugins array for Preact content transformation.\n * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.\n */\nexport const getPlugins = (\n locale?: LocalesValues,\n fallback: boolean = true\n): Plugins[] => {\n const currentLocale = resolveInterpreterLocale(locale);\n const cacheKey = `${currentLocale}_${fallback}`;\n\n if (pluginsCache.has(cacheKey)) {\n return pluginsCache.get(cacheKey)!;\n }\n\n const plugins = [\n // First: most nodes are plain strings, which every other plugin rejects\n intlayerNodePlugins,\n translationPlugin(\n currentLocale,\n fallback ? internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n pluralPlugin(currentLocale),\n conditionPlugin,\n nestedPlugin(currentLocale),\n filePlugin,\n genderPlugin,\n selectPlugin,\n // Always include: handle plain strings/numbers and React elements\n preactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n ] as Plugins[];\n\n // Plugins disabled at build time never match: skip them on every node\n const enabledPlugins = plugins.filter((plugin) => plugin !== fallbackPlugin);\n\n pluginsCache.set(cacheKey, enabledPlugins);\n\n return enabledPlugins;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA,MAAM,gCACJ,QAAQ,IAAI,gCAAgC,+CACxC,0CAA4C,MAAM,OAAO;CACvD,wBAAwB,EAAE;CAC1B,0BAA0B,EAAE;AAC9B,EAAE,IACF;AAEN,MAAM,4BACJ,QAAQ,IAAI,4BAA4B,+CACpC,4BAA8B,MAAM,MAAM,EAAE,YAAY,IACxD;AAMN,+BAA+B,YAAY,CAAC,CAAC;AAC7C,2BAA2B,YAAY,CAAC,CAAC;;AAWzC,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YAAY,OAAO,UAAU;EAG3B,IAAI,QAAQ,IAAI,+BAA+B,SAC7C,8CAAe;GACb,eAAe,MAAM;GACrB,SAAS,MAAM;GACf,QAAQ,MAAM;GACd,UAAU;EACZ,CAAC;EAKH,IAAI,QAAQ,IAAI,4BAA4B,WAAWA,8BAAO,SAAS;GACrE,MAAM,EACJ,SACA,GAAG,SACD;GAEJ,OAAOC,wCAAmB;IACxB,OAAO,KAAK;IACZ,UACE,0CAACC,gDAAD;KAAiB,GAAI;KAAM,KAAK,KAAK;IAEpB,GADd,KAAK,QACS;GAErB,CAAC;EACH;EAEA,OAAOD,wCAAmB;GACxB,OAAO,MAAM;GACb,UAAU,MAAM;EAClB,CAAC;CACH;AACF;;AAcA,MAAa,oBACX,QAAQ,IAAI,mCAAmC,UAC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CAAa,aAAa;EAC1BC;MACAC,yCAAa,aAAa;EAC1BC;EACAC;EACAC;EAEA;EACA;EACA;EACA;CAI2B,CAAC,CAAC,QAAQ,WAAW,WAAWnB,yCAAc;CAE3E,aAAa,IAAI,UAAU,cAAc;CAEzC,OAAO;AACT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
let preact = require("preact");
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/preactElement/renderPreactElement.ts
|
|
5
5
|
const renderPreactElement = (element) => {
|
|
6
6
|
if (element === null || typeof element !== "object") return element;
|
|
7
7
|
const convertChildrenAsArray = (element) => {
|
|
@@ -37,6 +37,5 @@ const renderPreactElement = (element) => {
|
|
|
37
37
|
return (0, preact.createElement)(type ?? "span", props, ...props.children);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
40
|
exports.renderPreactElement = renderPreactElement;
|
|
42
41
|
//# sourceMappingURL=renderPreactElement.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, h, isValidElement } from "preact";
|
|
2
2
|
import { getIntlayerNodePrototype } from "@intlayer/core/utils";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/IntlayerNode.tsx
|
|
5
5
|
/**
|
|
6
6
|
* Renders content as a Preact vnode that also behaves like its value
|
|
7
7
|
* (`node.value`, `${node}`, `node.toUpperCase()`).
|
|
@@ -18,6 +18,5 @@ const renderIntlayerNode = ({ children, value, additionalProps }) => Object.setP
|
|
|
18
18
|
...additionalProps
|
|
19
19
|
}, getIntlayerNodePrototype(value));
|
|
20
20
|
|
|
21
|
-
//#endregion
|
|
22
21
|
export { renderIntlayerNode };
|
|
23
22
|
//# sourceMappingURL=IntlayerNode.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "preact/hooks";
|
|
2
2
|
import { jsx } from "preact/jsx-runtime";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/UI/ContentSelector.tsx
|
|
5
5
|
const DEFAULT_PRESS_DETECT_DURATION = 250;
|
|
6
6
|
const ContentSelector = ({ children, onPress: onSelect, onHover, onUnhover, onClickOutside: onUnselect, pressDuration = DEFAULT_PRESS_DETECT_DURATION, isSelecting: isSelectingProp, ...props }) => {
|
|
7
7
|
const divRef = useRef(null);
|
|
@@ -90,6 +90,5 @@ const ContentSelector = ({ children, onPress: onSelect, onHover, onUnhover, onCl
|
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
//#endregion
|
|
94
93
|
export { ContentSelector };
|
|
95
94
|
//# sourceMappingURL=ContentSelector.mjs.map
|