preact-intlayer 8.4.5 → 8.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_client_useLocaleStorage = require('./useLocaleStorage.cjs');
3
3
  const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
4
- const require_client_useLocale = require('./useLocale.cjs');
5
4
  const require_client_format_useIntl = require('./format/useIntl.cjs');
6
5
  const require_client_t = require('./t.cjs');
7
6
  const require_client_useDictionary = require('./useDictionary.cjs');
@@ -9,6 +8,7 @@ const require_client_useDictionaryAsync = require('./useDictionaryAsync.cjs');
9
8
  const require_client_useLoadDynamic = require('./useLoadDynamic.cjs');
10
9
  const require_client_useDictionaryDynamic = require('./useDictionaryDynamic.cjs');
11
10
  const require_client_useIntlayer = require('./useIntlayer.cjs');
11
+ const require_client_useLocale = require('./useLocale.cjs');
12
12
  const require_client_useLocaleBase = require('./useLocaleBase.cjs');
13
13
 
14
14
  exports.IntlayerClientContext = require_client_IntlayerProvider.IntlayerClientContext;
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
4
3
  const require_getDictionary = require('../getDictionary.cjs');
4
+ const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
5
  let preact_hooks = require("preact/hooks");
6
6
 
7
7
  //#region src/client/useDictionary.ts
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
4
3
  const require_getIntlayer = require('../getIntlayer.cjs');
4
+ const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
5
5
  let preact_hooks = require("preact/hooks");
6
6
 
7
7
  //#region src/client/useIntlayer.ts
@@ -1,16 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_html_HTMLProvider = require('./html/HTMLProvider.cjs');
3
- const require_html_HTMLRenderer = require('./html/HTMLRenderer.cjs');
4
- const require_markdown_runtime = require('./markdown/runtime.cjs');
5
- const require_markdown_compiler = require('./markdown/compiler.cjs');
6
- const require_markdown_MarkdownProvider = require('./markdown/MarkdownProvider.cjs');
7
- const require_markdown_MarkdownRenderer = require('./markdown/MarkdownRenderer.cjs');
8
- const require_client_useLocaleStorage = require('./client/useLocaleStorage.cjs');
9
- const require_client_IntlayerProvider = require('./client/IntlayerProvider.cjs');
10
- const require_client_useLocale = require('./client/useLocale.cjs');
11
2
  const require_plugins = require('./plugins.cjs');
12
3
  const require_getIntlayer = require('./getIntlayer.cjs');
13
4
  const require_getDictionary = require('./getDictionary.cjs');
5
+ const require_client_useLocaleStorage = require('./client/useLocaleStorage.cjs');
6
+ const require_client_IntlayerProvider = require('./client/IntlayerProvider.cjs');
14
7
  const require_client_format_useIntl = require('./client/format/useIntl.cjs');
15
8
  const require_client_t = require('./client/t.cjs');
16
9
  const require_client_useDictionary = require('./client/useDictionary.cjs');
@@ -18,7 +11,14 @@ const require_client_useDictionaryAsync = require('./client/useDictionaryAsync.c
18
11
  const require_client_useLoadDynamic = require('./client/useLoadDynamic.cjs');
19
12
  const require_client_useDictionaryDynamic = require('./client/useDictionaryDynamic.cjs');
20
13
  const require_client_useIntlayer = require('./client/useIntlayer.cjs');
14
+ const require_client_useLocale = require('./client/useLocale.cjs');
21
15
  const require_client_useLocaleBase = require('./client/useLocaleBase.cjs');
16
+ const require_html_HTMLProvider = require('./html/HTMLProvider.cjs');
17
+ const require_html_HTMLRenderer = require('./html/HTMLRenderer.cjs');
18
+ const require_markdown_runtime = require('./markdown/runtime.cjs');
19
+ const require_markdown_compiler = require('./markdown/compiler.cjs');
20
+ const require_markdown_MarkdownProvider = require('./markdown/MarkdownProvider.cjs');
21
+ const require_markdown_MarkdownRenderer = require('./markdown/MarkdownRenderer.cjs');
22
22
 
23
23
  exports.HTMLProvider = require_html_HTMLProvider.HTMLProvider;
24
24
  exports.HTMLRenderer = require_html_HTMLRenderer.HTMLRenderer;
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
5
- const require_markdown_MarkdownProvider = require('./MarkdownProvider.cjs');
6
5
  const require_client_useLocale = require('../client/useLocale.cjs');
6
+ const require_markdown_MarkdownProvider = require('./MarkdownProvider.cjs');
7
7
  let _intlayer_core_markdown = require("@intlayer/core/markdown");
8
8
  let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryManipulator");
9
9
 
@@ -1,20 +1,25 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_editor_ContentSelector = require('./editor/ContentSelector.cjs');
4
- const require_html_HTMLRenderer = require('./html/HTMLRenderer.cjs');
5
4
  const require_IntlayerNode = require('./IntlayerNode.cjs');
6
- const require_markdown_MarkdownRendererPlugin = require('./markdown/MarkdownRendererPlugin.cjs');
7
5
  const require_preactElement_renderPreactElement = require('./preactElement/renderPreactElement.cjs');
8
6
  let _intlayer_config_built = require("@intlayer/config/built");
9
7
  _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
10
8
  let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
11
- let _intlayer_core_markdown = require("@intlayer/core/markdown");
12
9
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
13
10
  _intlayer_types_nodeType = require_runtime.__toESM(_intlayer_types_nodeType);
14
11
  let preact = require("preact");
12
+ let preact_compat = require("preact/compat");
15
13
  let preact_jsx_runtime = require("preact/jsx-runtime");
16
14
 
17
15
  //#region src/plugins.tsx
16
+ let _getMarkdownMetadata = null;
17
+ import("@intlayer/core/markdown").then((m) => {
18
+ _getMarkdownMetadata = m.getMarkdownMetadata;
19
+ });
20
+ const LazyMarkdownMetadataRenderer = (0, preact_compat.lazy)(() => Promise.resolve().then(() => require("./markdown/index.cjs")).then((m) => ({ default: m.MarkdownMetadataRenderer })));
21
+ const LazyMarkdownRendererPlugin = (0, preact_compat.lazy)(() => Promise.resolve().then(() => require("./markdown/index.cjs")).then((m) => ({ default: m.MarkdownRendererPlugin })));
22
+ const LazyHTMLRenderer = (0, preact_compat.lazy)(() => Promise.resolve().then(() => require("./html/HTMLRenderer.cjs")).then((m) => ({ default: m.HTMLRenderer })));
18
23
  /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
19
24
  const intlayerNodePlugins = {
20
25
  id: "intlayer-node-plugin",
@@ -109,7 +114,7 @@ const markdownStringPlugin = {
109
114
  canHandle: (node) => typeof node === "string",
110
115
  transform: (node, props, deepTransformNode) => {
111
116
  const { plugins, ...rest } = props;
112
- const metadataNodes = deepTransformNode((0, _intlayer_core_markdown.getMarkdownMetadata)(node), {
117
+ const metadataNodes = deepTransformNode(_getMarkdownMetadata?.(node) ?? {}, {
113
118
  plugins: [{
114
119
  id: "markdown-metadata-plugin",
115
120
  canHandle: (metadataNode) => typeof metadataNode === "string" || typeof metadataNode === "number" || typeof metadataNode === "boolean" || !metadataNode,
@@ -118,15 +123,21 @@ const markdownStringPlugin = {
118
123
  value: metadataNode,
119
124
  children: _intlayer_config_built.default?.editor.enabled ? /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(require_editor_ContentSelector.ContentSelector, {
120
125
  ...rest,
121
- children: /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(require_markdown_MarkdownRendererPlugin.MarkdownMetadataRenderer, {
126
+ children: /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(preact_compat.Suspense, {
127
+ fallback: node,
128
+ children: /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(LazyMarkdownMetadataRenderer, {
129
+ ...rest,
130
+ metadataKeyPath: props.keyPath,
131
+ children: node
132
+ })
133
+ })
134
+ }) : /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(preact_compat.Suspense, {
135
+ fallback: node,
136
+ children: /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(LazyMarkdownMetadataRenderer, {
122
137
  ...rest,
123
138
  metadataKeyPath: props.keyPath,
124
139
  children: node
125
140
  })
126
- }) : /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(require_markdown_MarkdownRendererPlugin.MarkdownMetadataRenderer, {
127
- ...rest,
128
- metadataKeyPath: props.keyPath,
129
- children: node
130
141
  })
131
142
  })
132
143
  }],
@@ -138,15 +149,21 @@ const markdownStringPlugin = {
138
149
  value: node,
139
150
  children: _intlayer_config_built.default?.editor.enabled ? /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(require_editor_ContentSelector.ContentSelector, {
140
151
  ...rest,
141
- children: /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(require_markdown_MarkdownRendererPlugin.MarkdownRendererPlugin, {
152
+ children: /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(preact_compat.Suspense, {
153
+ fallback: node,
154
+ children: /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(LazyMarkdownRendererPlugin, {
155
+ ...rest,
156
+ components,
157
+ children: node
158
+ })
159
+ })
160
+ }) : /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(preact_compat.Suspense, {
161
+ fallback: node,
162
+ children: /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(LazyMarkdownRendererPlugin, {
142
163
  ...rest,
143
164
  components,
144
165
  children: node
145
166
  })
146
- }) : /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(require_markdown_MarkdownRendererPlugin.MarkdownRendererPlugin, {
147
- ...rest,
148
- components,
149
- children: node
150
167
  }),
151
168
  additionalProps: { metadata: metadataNodes }
152
169
  });
@@ -181,11 +198,11 @@ const htmlPlugin = {
181
198
  const html = node[_intlayer_types_nodeType.HTML];
182
199
  node.tags;
183
200
  const { plugins, ...rest } = props;
184
- const render = (userComponents) => (0, preact.h)(require_html_HTMLRenderer.HTMLRenderer, {
201
+ const render = (userComponents) => (0, preact.h)(preact_compat.Suspense, { fallback: html }, (0, preact.h)(LazyHTMLRenderer, {
185
202
  ...rest,
186
203
  html,
187
204
  userComponents
188
- });
205
+ }));
189
206
  const element = render();
190
207
  return new Proxy(element, { get(target, prop) {
191
208
  if (prop === "value") return html;
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.cjs","names":["renderIntlayerNode","configuration","ContentSelector","renderPreactElement","Fragment","NodeTypes","MarkdownMetadataRenderer","MarkdownRendererPlugin","HTMLRenderer","enumerationPlugin","conditionPlugin","filePlugin","genderPlugin"],"sources":["../../src/plugins.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\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, h, type VNode } from 'preact';\nimport { ContentSelector } from './editor/ContentSelector';\nimport { HTMLRenderer } from './html/HTMLRenderer';\nimport type { HTMLComponents } from './html/types';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { MarkdownMetadataRenderer, MarkdownRendererPlugin } from './markdown';\nimport { renderPreactElement } from './preactElement/renderPreactElement';\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: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: rest.children,\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest} key={rest.children}>\n {rest.children}\n </ContentSelector>\n ) : (\n rest.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 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 renderIntlayerNode({\n ...rest,\n value: '[[preact-element]]',\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>{renderPreactElement(node)}</ContentSelector>\n ) : (\n renderPreactElement(node)\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 = 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 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) => typeof node === 'string',\n transform: (node: string, subProps, deepTransformNode) => {\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]]: string | number | 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 return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\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/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <MarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataRenderer>\n </ContentSelector>\n ) : (\n <MarkdownMetadataRenderer {...rest} metadataKeyPath={props.keyPath}>\n {node}\n </MarkdownMetadataRenderer>\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <MarkdownRendererPlugin {...rest} components={components}>\n {node}\n </MarkdownRendererPlugin>\n </ContentSelector>\n ) : (\n <MarkdownRendererPlugin {...rest} components={components}>\n {node}\n </MarkdownRendererPlugin>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const element = render() as any;\n\n return new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'use') {\n return (components?: any) => render(components);\n }\n\n return Reflect.get(target, prop);\n },\n }) 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 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\n/** HTML plugin. Replaces node with a function that takes components => VNode. */\nexport const htmlPlugin: Plugins = {\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 const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): VNode =>\n h(HTMLRenderer as any, { ...rest, html, userComponents } as any);\n\n const element = render() as any;\n\n const proxy = new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'use') {\n return (userComponents?: HTMLComponents) => render(userComponents);\n }\n\n return Reflect.get(target, prop);\n },\n });\n\n return proxy;\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\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 translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodePlugins,\n preactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,EACE,SACA,GAAG,WAGLA,wCAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UAAUC,gCAAe,OAAO,UAC9B,0CAACC,gDAAD;GAAiB,GAAI;GAAM,KAAK,KAAK;GAEnB,EADf,KAAK,SACU,GAElB,KAAK;EAER,CAAC;CACL;;AAcD,MAAa,oBAA6B;CACxC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,KAAK,UAAU,eACtB,OAAO,KAAK,QAAQ;CAEtB,YACE,MACA,EACE,SACA,GAAG,WAGLF,wCAAmB;EACjB,GAAG;EACH,OAAO;EACP,UAAUC,gCAAe,OAAO,UAC9B,4CAACC,gDAAD;GAAiB,GAAI;aAAOC,8DAAoB,KAAK;GAAmB,IAExEA,8DAAoB,KAAK;EAE5B,CAAC;CACL;;;;AAuBD,MAAM,WAAW,UAA+B;AAC9C,QACE,UAAU,QACV,UAAU,UACV,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU;;;;;AAOrB,MAAM,yBACJ,UACA,WACU;AAIV,KAAI,CAFa,OAAO,OAAO,OAAO,CAAC,KAAK,QAAQ,CAIlD,QAAO,SAAS,QAAQ,yBAAyB,GAAG,QAAQ;AAE1D,UAAQ,OADW,IAAI,MAAM,KACC,IAAI,UAAU;GAC5C;CAIJ,MAAM,QAA4B,EAAE;CACpC,IAAI,YAAY;CAChB,MAAM,QAAQ;CACd,IAAI,QAAgC,MAAM,KAAK,SAAS;AAExD,QAAO,UAAU,M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Y,MAAuB,OAAO,sBAAsB;EAC9D,MAAM,aAAwB,CAC5B,GAAG,MAAM,SACT,EACE,MAAMA,yBAAU,UACjB,CACF;EAED,MAAM,WAAW,KAAKA,yBAAU;AAEhC,SAAO,kBAAkB,UAAU;GACjC,GAAG;GACH;GACA,SAAS;GACT,SAAS,CAAC,sBAAsB,GAAI,MAAM,WAAW,EAAE,CAAE;GAC1D,CAAC;;CAEL;;AAiBD,MAAa,aAAsB;CACjC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAaA,yBAAU;CAC3D,YAAY,MAA2B,UAAU;EAC/C,MAAM,OAAO,KAAKA,yBAAU;AACd,OAAK;EACnB,MAAM,EAAE,SAAS,GAAG,SAAS;EAG7B,MAAM,UAAU,iCACZG,wCAAqB;GAAE,GAAG;GAAM;GAAM;GAAgB,CAAQ;EAElE,MAAM,UAAU,QAAQ;AAgBxB,SAdc,IAAI,MAAM,SAAS,EAC/B,IAAI,QAAQ,MAAM;AAChB,OAAI,SAAS,QACX,QAAO;AAGT,OAAI,SAAS,MACX,SAAQ,mBAAoC,OAAO,eAAe;AAGpE,UAAO,QAAQ,IAAI,QAAQ,KAAK;KAEnC,CAAC;;CAIL;;;;;AAuCD,MAAa,cACX,QACA,WAAoB,SACN;mDAEZ,UAAUP,+BAAc,qBAAqB,eAC7C,WAAWA,+BAAc,qBAAqB,gBAAgB,OAC/D;CACDQ;CACAC;8CACa,UAAUT,+BAAc,qBAAqB,cAAc;CACxEU;CACAC;CACA;CACA;CACA;CACA;CACA;CACD"}
1
+ {"version":3,"file":"plugins.cjs","names":["renderIntlayerNode","configuration","ContentSelector","renderPreactElement","Fragment","NodeTypes","Suspense","enumerationPlugin","conditionPlugin","filePlugin","genderPlugin"],"sources":["../../src/plugins.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from '@intlayer/core/interpreter';\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, h, type VNode } from 'preact';\nimport { lazy, Suspense } from 'preact/compat';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/types';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderPreactElement } from './preactElement/renderPreactElement';\n\n// Lazy pre-load @intlayer/core/markdown — creates a separate code-split chunk\nlet _getMarkdownMetadata: ((s: string) => any) | null = null;\nvoid import('@intlayer/core/markdown').then((m) => {\n _getMarkdownMetadata = m.getMarkdownMetadata;\n});\n\n// preact lazy for heavy renderer components — creates separate code-split chunks\nconst LazyMarkdownMetadataRenderer = lazy(() =>\n import('./markdown').then((m) => ({ default: m.MarkdownMetadataRenderer }))\n);\n\nconst LazyMarkdownRendererPlugin = lazy(() =>\n import('./markdown').then((m) => ({ default: m.MarkdownRendererPlugin }))\n);\n\nconst LazyHTMLRenderer = lazy(() =>\n import('./html/HTMLRenderer').then((m) => ({ default: m.HTMLRenderer }))\n);\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: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: rest.children,\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest} key={rest.children}>\n {rest.children}\n </ContentSelector>\n ) : (\n rest.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 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 renderIntlayerNode({\n ...rest,\n value: '[[preact-element]]',\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>{renderPreactElement(node)}</ContentSelector>\n ) : (\n renderPreactElement(node)\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 = 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 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) => typeof node === 'string',\n transform: (node: string, subProps, deepTransformNode) => {\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]]: string | number | 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 return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\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/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </LazyMarkdownMetadataRenderer>\n </Suspense>\n </ContentSelector>\n ) : (\n <Suspense fallback={node}>\n <LazyMarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </LazyMarkdownMetadataRenderer>\n </Suspense>\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin {...rest} components={components}>\n {node}\n </LazyMarkdownRendererPlugin>\n </Suspense>\n </ContentSelector>\n ) : (\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin {...rest} components={components}>\n {node}\n </LazyMarkdownRendererPlugin>\n </Suspense>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const element = render() as any;\n\n return new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'use') {\n return (components?: any) => render(components);\n }\n\n return Reflect.get(target, prop);\n },\n }) 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 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\n/** HTML plugin. Replaces node with a function that takes components => VNode. */\nexport const htmlPlugin: Plugins = {\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 const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): VNode =>\n h(\n Suspense as any,\n { fallback: html },\n h(LazyHTMLRenderer as any, { ...rest, html, userComponents } as any)\n );\n\n const element = render() as any;\n\n const proxy = new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'use') {\n return (userComponents?: HTMLComponents) => render(userComponents);\n }\n\n return Reflect.get(target, prop);\n },\n });\n\n return proxy;\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\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 translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodeP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L,+BAAc,qBAAqB,eAC7C,WAAWA,+BAAc,qBAAqB,gBAAgB,OAC/D;CACDM;CACAC;8CACa,UAAUP,+BAAc,qBAAqB,cAAc;CACxEQ;CACAC;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -1,6 +1,5 @@
1
1
  import { localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage } from "./useLocaleStorage.mjs";
2
2
  import { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, useIntlayerContext } from "./IntlayerProvider.mjs";
3
- import { useLocale } from "./useLocale.mjs";
4
3
  import { useIntl } from "./format/useIntl.mjs";
5
4
  import { t } from "./t.mjs";
6
5
  import { useDictionary } from "./useDictionary.mjs";
@@ -8,6 +7,7 @@ import { useDictionaryAsync } from "./useDictionaryAsync.mjs";
8
7
  import { useLoadDynamic } from "./useLoadDynamic.mjs";
9
8
  import { useDictionaryDynamic } from "./useDictionaryDynamic.mjs";
10
9
  import { useIntlayer } from "./useIntlayer.mjs";
10
+ import { useLocale } from "./useLocale.mjs";
11
11
  import { useLocaleBase } from "./useLocaleBase.mjs";
12
12
 
13
13
  export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntl, useIntlayer, useIntlayerContext, useLoadDynamic, useLocale, useLocaleBase, useLocaleCookie, useLocaleStorage };
@@ -1,5 +1,5 @@
1
- import { IntlayerClientContext } from "./IntlayerProvider.mjs";
2
1
  import { getDictionary } from "../getDictionary.mjs";
2
+ import { IntlayerClientContext } from "./IntlayerProvider.mjs";
3
3
  import { useContext, useMemo } from "preact/hooks";
4
4
 
5
5
  //#region src/client/useDictionary.ts
@@ -1,5 +1,5 @@
1
- import { IntlayerClientContext } from "./IntlayerProvider.mjs";
2
1
  import { getIntlayer } from "../getIntlayer.mjs";
2
+ import { IntlayerClientContext } from "./IntlayerProvider.mjs";
3
3
  import { useContext, useMemo } from "preact/hooks";
4
4
 
5
5
  //#region src/client/useIntlayer.ts
@@ -1,15 +1,8 @@
1
- import { HTMLProvider } from "./html/HTMLProvider.mjs";
2
- import { HTMLRenderer, renderHTML, useHTMLRenderer } from "./html/HTMLRenderer.mjs";
3
- import preactRuntime from "./markdown/runtime.mjs";
4
- import { compileMarkdown } from "./markdown/compiler.mjs";
5
- import { MarkdownProvider } from "./markdown/MarkdownProvider.mjs";
6
- import { MarkdownRenderer, renderMarkdown, useMarkdownRenderer } from "./markdown/MarkdownRenderer.mjs";
7
- import { localeCookie, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage } from "./client/useLocaleStorage.mjs";
8
- import { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, useIntlayerContext } from "./client/IntlayerProvider.mjs";
9
- import { useLocale } from "./client/useLocale.mjs";
10
1
  import { htmlPlugin, intlayerNodePlugins, markdownPlugin, markdownStringPlugin, preactNodePlugins } from "./plugins.mjs";
11
2
  import { getIntlayer } from "./getIntlayer.mjs";
12
3
  import { getDictionary } from "./getDictionary.mjs";
4
+ import { localeCookie, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage } from "./client/useLocaleStorage.mjs";
5
+ import { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, useIntlayerContext } from "./client/IntlayerProvider.mjs";
13
6
  import { useIntl } from "./client/format/useIntl.mjs";
14
7
  import { t } from "./client/t.mjs";
15
8
  import { useDictionary } from "./client/useDictionary.mjs";
@@ -17,6 +10,13 @@ import { useDictionaryAsync } from "./client/useDictionaryAsync.mjs";
17
10
  import { useLoadDynamic } from "./client/useLoadDynamic.mjs";
18
11
  import { useDictionaryDynamic } from "./client/useDictionaryDynamic.mjs";
19
12
  import { useIntlayer } from "./client/useIntlayer.mjs";
13
+ import { useLocale } from "./client/useLocale.mjs";
20
14
  import { useLocaleBase } from "./client/useLocaleBase.mjs";
15
+ import { HTMLProvider } from "./html/HTMLProvider.mjs";
16
+ import { HTMLRenderer, renderHTML, useHTMLRenderer } from "./html/HTMLRenderer.mjs";
17
+ import preactRuntime from "./markdown/runtime.mjs";
18
+ import { compileMarkdown } from "./markdown/compiler.mjs";
19
+ import { MarkdownProvider } from "./markdown/MarkdownProvider.mjs";
20
+ import { MarkdownRenderer, renderMarkdown, useMarkdownRenderer } from "./markdown/MarkdownRenderer.mjs";
21
21
 
22
22
  export { HTMLProvider, HTMLRenderer, IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, MarkdownProvider, MarkdownRenderer, compileMarkdown, getDictionary, getIntlayer, htmlPlugin, intlayerNodePlugins, localeCookie, markdownPlugin, markdownStringPlugin, preactNodePlugins, preactRuntime, renderHTML, renderMarkdown, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic, useHTMLRenderer, useIntl, useIntlayer, useIntlayerContext, useLoadDynamic, useLocale, useLocaleBase, useLocaleCookie, useLocaleStorage, useMarkdownRenderer };
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import { useMarkdownContext } from "./MarkdownProvider.mjs";
4
3
  import { useLocale } from "../client/useLocale.mjs";
4
+ import { useMarkdownContext } from "./MarkdownProvider.mjs";
5
5
  import { getMarkdownMetadata } from "@intlayer/core/markdown";
6
6
  import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
7
7
 
@@ -1,16 +1,21 @@
1
1
  import { ContentSelector } from "./editor/ContentSelector.mjs";
2
- import { HTMLRenderer } from "./html/HTMLRenderer.mjs";
3
2
  import { renderIntlayerNode } from "./IntlayerNode.mjs";
4
- import { MarkdownMetadataRenderer, MarkdownRendererPlugin } from "./markdown/MarkdownRendererPlugin.mjs";
5
3
  import { renderPreactElement } from "./preactElement/renderPreactElement.mjs";
6
4
  import configuration from "@intlayer/config/built";
7
5
  import { conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, nestedPlugin, translationPlugin } from "@intlayer/core/interpreter";
8
- import { getMarkdownMetadata } from "@intlayer/core/markdown";
9
6
  import * as NodeTypes from "@intlayer/types/nodeType";
10
7
  import { Fragment, createElement, h } from "preact";
8
+ import { Suspense, lazy } from "preact/compat";
11
9
  import { jsx } from "preact/jsx-runtime";
12
10
 
13
11
  //#region src/plugins.tsx
12
+ let _getMarkdownMetadata = null;
13
+ import("@intlayer/core/markdown").then((m) => {
14
+ _getMarkdownMetadata = m.getMarkdownMetadata;
15
+ });
16
+ const LazyMarkdownMetadataRenderer = lazy(() => import("./markdown/index.mjs").then((m) => ({ default: m.MarkdownMetadataRenderer })));
17
+ const LazyMarkdownRendererPlugin = lazy(() => import("./markdown/index.mjs").then((m) => ({ default: m.MarkdownRendererPlugin })));
18
+ const LazyHTMLRenderer = lazy(() => import("./html/HTMLRenderer.mjs").then((m) => ({ default: m.HTMLRenderer })));
14
19
  /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
15
20
  const intlayerNodePlugins = {
16
21
  id: "intlayer-node-plugin",
@@ -105,7 +110,7 @@ const markdownStringPlugin = {
105
110
  canHandle: (node) => typeof node === "string",
106
111
  transform: (node, props, deepTransformNode) => {
107
112
  const { plugins, ...rest } = props;
108
- const metadataNodes = deepTransformNode(getMarkdownMetadata(node), {
113
+ const metadataNodes = deepTransformNode(_getMarkdownMetadata?.(node) ?? {}, {
109
114
  plugins: [{
110
115
  id: "markdown-metadata-plugin",
111
116
  canHandle: (metadataNode) => typeof metadataNode === "string" || typeof metadataNode === "number" || typeof metadataNode === "boolean" || !metadataNode,
@@ -114,15 +119,21 @@ const markdownStringPlugin = {
114
119
  value: metadataNode,
115
120
  children: configuration?.editor.enabled ? /* @__PURE__ */ jsx(ContentSelector, {
116
121
  ...rest,
117
- children: /* @__PURE__ */ jsx(MarkdownMetadataRenderer, {
122
+ children: /* @__PURE__ */ jsx(Suspense, {
123
+ fallback: node,
124
+ children: /* @__PURE__ */ jsx(LazyMarkdownMetadataRenderer, {
125
+ ...rest,
126
+ metadataKeyPath: props.keyPath,
127
+ children: node
128
+ })
129
+ })
130
+ }) : /* @__PURE__ */ jsx(Suspense, {
131
+ fallback: node,
132
+ children: /* @__PURE__ */ jsx(LazyMarkdownMetadataRenderer, {
118
133
  ...rest,
119
134
  metadataKeyPath: props.keyPath,
120
135
  children: node
121
136
  })
122
- }) : /* @__PURE__ */ jsx(MarkdownMetadataRenderer, {
123
- ...rest,
124
- metadataKeyPath: props.keyPath,
125
- children: node
126
137
  })
127
138
  })
128
139
  }],
@@ -134,15 +145,21 @@ const markdownStringPlugin = {
134
145
  value: node,
135
146
  children: configuration?.editor.enabled ? /* @__PURE__ */ jsx(ContentSelector, {
136
147
  ...rest,
137
- children: /* @__PURE__ */ jsx(MarkdownRendererPlugin, {
148
+ children: /* @__PURE__ */ jsx(Suspense, {
149
+ fallback: node,
150
+ children: /* @__PURE__ */ jsx(LazyMarkdownRendererPlugin, {
151
+ ...rest,
152
+ components,
153
+ children: node
154
+ })
155
+ })
156
+ }) : /* @__PURE__ */ jsx(Suspense, {
157
+ fallback: node,
158
+ children: /* @__PURE__ */ jsx(LazyMarkdownRendererPlugin, {
138
159
  ...rest,
139
160
  components,
140
161
  children: node
141
162
  })
142
- }) : /* @__PURE__ */ jsx(MarkdownRendererPlugin, {
143
- ...rest,
144
- components,
145
- children: node
146
163
  }),
147
164
  additionalProps: { metadata: metadataNodes }
148
165
  });
@@ -177,11 +194,11 @@ const htmlPlugin = {
177
194
  const html = node[NodeTypes.HTML];
178
195
  node.tags;
179
196
  const { plugins, ...rest } = props;
180
- const render = (userComponents) => h(HTMLRenderer, {
197
+ const render = (userComponents) => h(Suspense, { fallback: html }, h(LazyHTMLRenderer, {
181
198
  ...rest,
182
199
  html,
183
200
  userComponents
184
- });
201
+ }));
185
202
  const element = render();
186
203
  return new Proxy(element, { get(target, prop) {
187
204
  if (prop === "value") return html;
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\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, h, type VNode } from 'preact';\nimport { ContentSelector } from './editor/ContentSelector';\nimport { HTMLRenderer } from './html/HTMLRenderer';\nimport type { HTMLComponents } from './html/types';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { MarkdownMetadataRenderer, MarkdownRendererPlugin } from './markdown';\nimport { renderPreactElement } from './preactElement/renderPreactElement';\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: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: rest.children,\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest} key={rest.children}>\n {rest.children}\n </ContentSelector>\n ) : (\n rest.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 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 renderIntlayerNode({\n ...rest,\n value: '[[preact-element]]',\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>{renderPreactElement(node)}</ContentSelector>\n ) : (\n renderPreactElement(node)\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 = 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 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) => typeof node === 'string',\n transform: (node: string, subProps, deepTransformNode) => {\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]]: string | number | 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 return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\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/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <MarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataRenderer>\n </ContentSelector>\n ) : (\n <MarkdownMetadataRenderer {...rest} metadataKeyPath={props.keyPath}>\n {node}\n </MarkdownMetadataRenderer>\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <MarkdownRendererPlugin {...rest} components={components}>\n {node}\n </MarkdownRendererPlugin>\n </ContentSelector>\n ) : (\n <MarkdownRendererPlugin {...rest} components={components}>\n {node}\n </MarkdownRendererPlugin>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const element = render() as any;\n\n return new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'use') {\n return (components?: any) => render(components);\n }\n\n return Reflect.get(target, prop);\n },\n }) 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 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\n/** HTML plugin. Replaces node with a function that takes components => VNode. */\nexport const htmlPlugin: Plugins = {\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 const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): VNode =>\n h(HTMLRenderer as any, { ...rest, html, userComponents } as any);\n\n const element = render() as any;\n\n const proxy = new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'use') {\n return (userComponents?: HTMLComponents) => render(userComponents);\n }\n\n return Reflect.get(target, prop);\n },\n });\n\n return proxy;\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\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 translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodePlugins,\n preactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n];\n"],"mappings":";;;;;;;;;;;;;;AA0CA,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,EACE,SACA,GAAG,WAGL,mBAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UAAU,eAAe,OAAO,UAC9B,8BAAC,iBAAD;GAAiB,GAAI;GAAM,KAAK,KAAK;GAEnB,EADf,KAAK,SACU,GAElB,KAAK;EAER,CAAC;CACL;;AAcD,MAAa,oBAA6B;CACxC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS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AI,MAAM,SAAS,EAC/B,IAAI,QAAQ,MAAM;AAChB,OAAI,SAAS,QACX,QAAO;AAGT,OAAI,SAAS,MACX,SAAQ,mBAAoC,OAAO,eAAe;AAGpE,UAAO,QAAQ,IAAI,QAAQ,KAAK;KAEnC,CAAC;;CAIL;;;;;AAuCD,MAAa,cACX,QACA,WAAoB,SACN;CACd,kBACE,UAAU,cAAc,qBAAqB,eAC7C,WAAW,cAAc,qBAAqB,gBAAgB,OAC/D;CACD;CACA;CACA,aAAa,UAAU,cAAc,qBAAqB,cAAc;CACxE;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
1
+ {"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from '@intlayer/core/interpreter';\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, h, type VNode } from 'preact';\nimport { lazy, Suspense } from 'preact/compat';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/types';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderPreactElement } from './preactElement/renderPreactElement';\n\n// Lazy pre-load @intlayer/core/markdown — creates a separate code-split chunk\nlet _getMarkdownMetadata: ((s: string) => any) | null = null;\nvoid import('@intlayer/core/markdown').then((m) => {\n _getMarkdownMetadata = m.getMarkdownMetadata;\n});\n\n// preact lazy for heavy renderer components — creates separate code-split chunks\nconst LazyMarkdownMetadataRenderer = lazy(() =>\n import('./markdown').then((m) => ({ default: m.MarkdownMetadataRenderer }))\n);\n\nconst LazyMarkdownRendererPlugin = lazy(() =>\n import('./markdown').then((m) => ({ default: m.MarkdownRendererPlugin }))\n);\n\nconst LazyHTMLRenderer = lazy(() =>\n import('./html/HTMLRenderer').then((m) => ({ default: m.HTMLRenderer }))\n);\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: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: rest.children,\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest} key={rest.children}>\n {rest.children}\n </ContentSelector>\n ) : (\n rest.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 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 renderIntlayerNode({\n ...rest,\n value: '[[preact-element]]',\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>{renderPreactElement(node)}</ContentSelector>\n ) : (\n renderPreactElement(node)\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 = 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 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) => typeof node === 'string',\n transform: (node: string, subProps, deepTransformNode) => {\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]]: string | number | 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 return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\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/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </LazyMarkdownMetadataRenderer>\n </Suspense>\n </ContentSelector>\n ) : (\n <Suspense fallback={node}>\n <LazyMarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </LazyMarkdownMetadataRenderer>\n </Suspense>\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin {...rest} components={components}>\n {node}\n </LazyMarkdownRendererPlugin>\n </Suspense>\n </ContentSelector>\n ) : (\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin {...rest} components={components}>\n {node}\n </LazyMarkdownRendererPlugin>\n </Suspense>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const element = render() as any;\n\n return new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'use') {\n return (components?: any) => render(components);\n }\n\n return Reflect.get(target, prop);\n },\n }) 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 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\n/** HTML plugin. Replaces node with a function that takes components => VNode. */\nexport const htmlPlugin: Plugins = {\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 const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): VNode =>\n h(\n Suspense as any,\n { fallback: html },\n h(LazyHTMLRenderer as any, { ...rest, html, userComponents } as any)\n );\n\n const element = render() as any;\n\n const proxy = new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'use') {\n return (userComponents?: HTMLComponents) => render(userComponents);\n }\n\n return Reflect.get(target, prop);\n },\n });\n\n return proxy;\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\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 translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodePlugins,\n preactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n];\n"],"mappings":";;;;;;;;;;;AAgCA,IAAI,uBAAoD;AACnD,OAAO,2BAA2B,MAAM,MAAM;AACjD,wBAAuB,EAAE;EACzB;AAGF,MAAM,+BAA+B,WACnC,OAAO,wBAAc,MAAM,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAC5E;AAED,MAAM,6BAA6B,WACjC,OAAO,wBAAc,MAAM,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAC1E;AAED,MAAM,mBAAmB,WACvB,OAAO,2BAAuB,MAAM,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CACzE;;AAWD,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,EACE,SACA,GAAG,WAGL,mBAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UAAU,eAAe,OAAO,UAC9B,8BAAC,iBAAD;GAAiB,GAAI;GAAM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A;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.5",
3
+ "version": "8.4.6",
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.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"
95
+ "@intlayer/api": "8.4.6",
96
+ "@intlayer/chokidar": "8.4.6",
97
+ "@intlayer/config": "8.4.6",
98
+ "@intlayer/core": "8.4.6",
99
+ "@intlayer/editor": "8.4.6",
100
+ "@intlayer/types": "8.4.6"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@types/node": "25.5.0",