solid-intlayer 8.3.1 → 8.3.3

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.
Files changed (107) hide show
  1. package/dist/chunk-C91j1N6u.js +1 -0
  2. package/dist/cjs/IntlayerNode.cjs +1 -1
  3. package/dist/cjs/UI/ContentSelector.cjs +1 -1
  4. package/dist/cjs/client/IntlayerProvider.cjs +1 -1
  5. package/dist/cjs/client/format/useIntl.cjs +1 -1
  6. package/dist/cjs/client/getBrowserLocale.cjs +1 -1
  7. package/dist/cjs/client/index.cjs +1 -1
  8. package/dist/cjs/client/t.cjs +1 -1
  9. package/dist/cjs/client/useContent.cjs +1 -1
  10. package/dist/cjs/client/useDictionary.cjs +1 -1
  11. package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
  12. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
  13. package/dist/cjs/client/useIntlayer.cjs +1 -1
  14. package/dist/cjs/client/useLoadDynamic.cjs +1 -1
  15. package/dist/cjs/client/useLocale.cjs +1 -1
  16. package/dist/cjs/client/useLocaleBase.cjs +1 -1
  17. package/dist/cjs/client/useLocaleStorage.cjs +1 -1
  18. package/dist/cjs/client/useRewriteURL.cjs +1 -1
  19. package/dist/cjs/client/useTraduction.cjs +1 -1
  20. package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
  21. package/dist/cjs/editor/IntlayerEditorProvider.cjs +1 -1
  22. package/dist/cjs/editor/contexts/CommunicatorContext.cjs +1 -1
  23. package/dist/cjs/editor/contexts/ConfigurationContext.cjs +1 -1
  24. package/dist/cjs/editor/contexts/DictionariesRecordContext.cjs +1 -1
  25. package/dist/cjs/editor/contexts/EditedContentContext.cjs +1 -1
  26. package/dist/cjs/editor/contexts/EditorEnabledContext.cjs +1 -1
  27. package/dist/cjs/editor/contexts/EditorProvider.cjs +1 -1
  28. package/dist/cjs/editor/contexts/FocusDictionaryContext.cjs +1 -1
  29. package/dist/cjs/editor/contexts/index.cjs +1 -1
  30. package/dist/cjs/editor/contexts/useCrossFrameMessageListener.cjs +1 -1
  31. package/dist/cjs/editor/contexts/useCrossFrameState.cjs +1 -1
  32. package/dist/cjs/editor/contexts/useCrossURLPathState.cjs +1 -1
  33. package/dist/cjs/editor/contexts/useIframeClickInterceptor.cjs +1 -1
  34. package/dist/cjs/editor/index.cjs +1 -1
  35. package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -1
  36. package/dist/cjs/getDictionary.cjs +1 -1
  37. package/dist/cjs/getIntlayer.cjs +1 -1
  38. package/dist/cjs/html/HTMLProvider.cjs +1 -1
  39. package/dist/cjs/html/HTMLRenderer.cjs +1 -1
  40. package/dist/cjs/html/index.cjs +1 -1
  41. package/dist/cjs/html/types.cjs +1 -1
  42. package/dist/cjs/index.cjs +1 -1
  43. package/dist/cjs/markdown/MarkdownProvider.cjs +1 -1
  44. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
  45. package/dist/cjs/markdown/compiler.cjs +1 -1
  46. package/dist/cjs/markdown/index.cjs +1 -1
  47. package/dist/cjs/markdown/runtime.cjs +1 -1
  48. package/dist/cjs/plugins.cjs +1 -1
  49. package/dist/cjs/solidElement/renderSolidElement.cjs +1 -1
  50. package/dist/esm/IntlayerNode.mjs +9 -17
  51. package/dist/esm/UI/ContentSelector.mjs +57 -56
  52. package/dist/esm/client/IntlayerProvider.mjs +56 -66
  53. package/dist/esm/client/format/useIntl.mjs +8 -11
  54. package/dist/esm/client/getBrowserLocale.mjs +79 -95
  55. package/dist/esm/client/index.mjs +11 -36
  56. package/dist/esm/client/t.mjs +9 -9
  57. package/dist/esm/client/useContent.mjs +12 -12
  58. package/dist/esm/client/useDictionary.mjs +2 -13
  59. package/dist/esm/client/useDictionaryAsync.mjs +2 -11
  60. package/dist/esm/client/useDictionaryDynamic.mjs +2 -15
  61. package/dist/esm/client/useIntlayer.mjs +2 -13
  62. package/dist/esm/client/useLoadDynamic.mjs +15 -21
  63. package/dist/esm/client/useLocale.mjs +23 -36
  64. package/dist/esm/client/useLocaleBase.mjs +14 -18
  65. package/dist/esm/client/useLocaleStorage.mjs +18 -25
  66. package/dist/esm/client/useRewriteURL.mjs +14 -18
  67. package/dist/esm/client/useTraduction.mjs +9 -12
  68. package/dist/esm/editor/ContentSelectorWrapper.mjs +2 -24
  69. package/dist/esm/editor/IntlayerEditorProvider.mjs +36 -58
  70. package/dist/esm/editor/contexts/CommunicatorContext.mjs +29 -28
  71. package/dist/esm/editor/contexts/ConfigurationContext.mjs +18 -20
  72. package/dist/esm/editor/contexts/DictionariesRecordContext.mjs +39 -44
  73. package/dist/esm/editor/contexts/EditedContentContext.mjs +135 -154
  74. package/dist/esm/editor/contexts/EditorEnabledContext.mjs +19 -27
  75. package/dist/esm/editor/contexts/EditorProvider.mjs +68 -80
  76. package/dist/esm/editor/contexts/FocusDictionaryContext.mjs +41 -47
  77. package/dist/esm/editor/contexts/index.mjs +11 -38
  78. package/dist/esm/editor/contexts/useCrossFrameMessageListener.mjs +30 -34
  79. package/dist/esm/editor/contexts/useCrossFrameState.mjs +44 -56
  80. package/dist/esm/editor/contexts/useCrossURLPathState.mjs +23 -24
  81. package/dist/esm/editor/contexts/useIframeClickInterceptor.mjs +17 -18
  82. package/dist/esm/editor/index.mjs +2 -4
  83. package/dist/esm/editor/useEditedContentRenderer.mjs +15 -28
  84. package/dist/esm/getDictionary.mjs +2 -16
  85. package/dist/esm/getIntlayer.mjs +2 -16
  86. package/dist/esm/html/HTMLProvider.mjs +12 -15
  87. package/dist/esm/html/HTMLRenderer.mjs +28 -51
  88. package/dist/esm/html/index.mjs +3 -10
  89. package/dist/esm/html/types.mjs +0 -1
  90. package/dist/esm/index.mjs +17 -54
  91. package/dist/esm/markdown/MarkdownProvider.mjs +33 -41
  92. package/dist/esm/markdown/MarkdownRenderer.mjs +36 -41
  93. package/dist/esm/markdown/compiler.mjs +6 -8
  94. package/dist/esm/markdown/index.mjs +5 -17
  95. package/dist/esm/markdown/runtime.mjs +21 -40
  96. package/dist/esm/plugins.mjs +2 -20
  97. package/dist/esm/solidElement/renderSolidElement.mjs +32 -29
  98. package/dist/getDictionary-DKdSGWHu.mjs +188 -0
  99. package/dist/getDictionary-DxYuk0_0.js +1 -0
  100. package/dist/types/IntlayerNode.d.ts +1 -2
  101. package/dist/types/client/useDictionary.d.ts +1 -1
  102. package/dist/types/getDictionary.d.ts +1 -2
  103. package/dist/types/getIntlayer.d.ts +1 -2
  104. package/dist/types/plugins.d.ts +15 -10
  105. package/package.json +11 -11
  106. package/dist/plugins-FXnYVZH5.mjs +0 -229
  107. package/dist/plugins-lDhO98Wy.js +0 -1
@@ -1,43 +1,38 @@
1
- import { getContentNodeByKeyPath as m } from "@intlayer/core/dictionaryManipulator";
1
+ import { useEditedContentRenderer as e } from "../editor/useEditedContentRenderer.mjs";
2
+ import { compileMarkdown as t } from "./compiler.mjs";
3
+ import { MarkdownContext as n, useMarkdown as r } from "./MarkdownProvider.mjs";
2
4
  import { getMarkdownMetadata as i } from "@intlayer/core/markdown";
3
- import { useContext as a, createMemo as n } from "solid-js";
4
- import { useEditedContentRenderer as d } from "../editor/useEditedContentRenderer.mjs";
5
- import { compileMarkdown as k } from "./compiler.mjs";
6
- import { MarkdownContext as c, useMarkdown as f } from "./MarkdownProvider.mjs";
7
- const l = (e, t = {}) => k(e, t), g = (e = {}) => {
8
- const t = a(c);
9
- return (r) => t ? t.renderMarkdown(r, {
10
- forceBlock: e.forceBlock,
11
- preserveFrontmatter: e.preserveFrontmatter,
12
- tagfilter: e.tagfilter
13
- }, e.components, e.wrapper) : l(r, e);
14
- }, x = (e) => {
15
- const t = a(c), {
16
- renderMarkdown: r
17
- } = f(), o = n(() => d({
18
- dictionaryKey: e.dictionaryKey,
19
- keyPath: e.keyPath,
20
- children: e.children
21
- }));
22
- return r(typeof o() == "string" ? o() : e.children, {
23
- forceBlock: e.forceBlock,
24
- preserveFrontmatter: e.preserveFrontmatter,
25
- tagfilter: e.tagfilter
26
- }, {
27
- ...t?.components ?? {},
28
- ...e.components ?? {}
29
- }, e.wrapper);
30
- }, K = (e) => {
31
- const t = n(() => d({
32
- dictionaryKey: e.dictionaryKey,
33
- keyPath: e.keyPath,
34
- children: e.children
35
- })), r = n(() => i(t()));
36
- return n(() => m(r(), e.metadataKeyPath))();
37
- };
38
- export {
39
- K as MarkdownMetadataRenderer,
40
- x as MarkdownRenderer,
41
- l as renderMarkdown,
42
- g as useMarkdownRenderer
5
+ import { createMemo as a, useContext as o } from "solid-js";
6
+ import { getContentNodeByKeyPath as s } from "@intlayer/core/dictionaryManipulator";
7
+ //#region src/markdown/MarkdownRenderer.tsx
8
+ var c = (e, n = {}) => t(e, n), l = (e = {}) => {
9
+ let t = o(n);
10
+ return (n) => t ? t.renderMarkdown(n, {
11
+ forceBlock: e.forceBlock,
12
+ preserveFrontmatter: e.preserveFrontmatter,
13
+ tagfilter: e.tagfilter
14
+ }, e.components, e.wrapper) : c(n, e);
15
+ }, u = (t) => {
16
+ let i = o(n), { renderMarkdown: s } = r(), c = a(() => e({
17
+ dictionaryKey: t.dictionaryKey,
18
+ keyPath: t.keyPath,
19
+ children: t.children
20
+ }));
21
+ return s(typeof c() == "string" ? c() : t.children, {
22
+ forceBlock: t.forceBlock,
23
+ preserveFrontmatter: t.preserveFrontmatter,
24
+ tagfilter: t.tagfilter
25
+ }, {
26
+ ...i?.components ?? {},
27
+ ...t.components ?? {}
28
+ }, t.wrapper);
29
+ }, d = (t) => {
30
+ let n = a(() => e({
31
+ dictionaryKey: t.dictionaryKey,
32
+ keyPath: t.keyPath,
33
+ children: t.children
34
+ })), r = a(() => i(n()));
35
+ return a(() => s(r(), t.metadataKeyPath))();
43
36
  };
37
+ //#endregion
38
+ export { d as MarkdownMetadataRenderer, u as MarkdownRenderer, c as renderMarkdown, l as useMarkdownRenderer };
@@ -1,8 +1,6 @@
1
- import { compileWithOptions as m } from "@intlayer/core/markdown";
2
- import r from "./runtime.mjs";
3
- const o = (i = "", t = {}) => m(i, r, t), e = o, n = o;
4
- export {
5
- n as compile,
6
- o as compileMarkdown,
7
- e as compiler
8
- };
1
+ import e from "./runtime.mjs";
2
+ import { compileWithOptions as t } from "@intlayer/core/markdown";
3
+ //#region src/markdown/compiler.tsx
4
+ var n = (n = "", r = {}) => t(n, e, r), r = n, i = n;
5
+ //#endregion
6
+ export { i as compile, n as compileMarkdown, r as compiler };
@@ -1,17 +1,5 @@
1
- import { compile as o, compileMarkdown as d, compiler as n } from "./compiler.mjs";
2
- import { MarkdownContext as t, MarkdownProvider as M, useMarkdown as k } from "./MarkdownProvider.mjs";
3
- import { MarkdownMetadataRenderer as w, MarkdownRenderer as p, renderMarkdown as i, useMarkdownRenderer as f } from "./MarkdownRenderer.mjs";
4
- import { default as x } from "./runtime.mjs";
5
- export {
6
- t as MarkdownContext,
7
- w as MarkdownMetadataRenderer,
8
- M as MarkdownProvider,
9
- p as MarkdownRenderer,
10
- o as compile,
11
- d as compileMarkdown,
12
- n as compiler,
13
- i as renderMarkdown,
14
- x as solidRuntime,
15
- k as useMarkdown,
16
- f as useMarkdownRenderer
17
- };
1
+ import e from "./runtime.mjs";
2
+ import { compile as t, compileMarkdown as n, compiler as r } from "./compiler.mjs";
3
+ import { MarkdownContext as i, MarkdownProvider as a, useMarkdown as o } from "./MarkdownProvider.mjs";
4
+ import { MarkdownMetadataRenderer as s, MarkdownRenderer as c, renderMarkdown as l, useMarkdownRenderer as u } from "./MarkdownRenderer.mjs";
5
+ export { i as MarkdownContext, s as MarkdownMetadataRenderer, a as MarkdownProvider, c as MarkdownRenderer, t as compile, n as compileMarkdown, r as compiler, l as renderMarkdown, e as solidRuntime, o as useMarkdown, u as useMarkdownRenderer };
@@ -1,41 +1,22 @@
1
- import { createComponent as a, Dynamic as c } from "solid-js/web";
2
- const i = {
3
- /**
4
- * Creates a Solid JSX Element.
5
- * Uses Solid's Dynamic component for element creation.
6
- */
7
- createElement: (e, n, ...t) => a(c, {
8
- get component() {
9
- return e;
10
- },
11
- ...n,
12
- get children() {
13
- return t.length === 1 ? t[0] : t;
14
- }
15
- }),
16
- /**
17
- * Solid doesn't have a built-in cloneElement like React.
18
- * In the context of markdown rendering, we usually don't need to deep-clone
19
- * but rather merge props if we're wrapping a result.
20
- */
21
- cloneElement: (e, n) => typeof e == "function" ? a(e, n) : e,
22
- /**
23
- * Solid Fragment equivalent.
24
- * In Solid, a fragment is just an array or a function returning children.
25
- */
26
- Fragment: (e) => e.children,
27
- /**
28
- * Solid-specific prop normalization.
29
- * Solid uses 'class' instead of 'className'.
30
- */
31
- normalizeProps: (e, n) => {
32
- const t = {};
33
- for (const [r, o] of Object.entries(n))
34
- r === "className" ? t.class = o : t[r] = o;
35
- return t;
36
- }
37
- };
38
- export {
39
- i as default,
40
- i as solidRuntime
1
+ import { Dynamic as e, createComponent as t } from "solid-js/web";
2
+ //#region src/markdown/runtime.tsx
3
+ var n = {
4
+ createElement: (n, r, ...i) => t(e, {
5
+ get component() {
6
+ return n;
7
+ },
8
+ ...r,
9
+ get children() {
10
+ return i.length === 1 ? i[0] : i;
11
+ }
12
+ }),
13
+ cloneElement: (e, n) => typeof e == "function" ? t(e, n) : e,
14
+ Fragment: (e) => e.children,
15
+ normalizeProps: (e, t) => {
16
+ let n = {};
17
+ for (let [e, r] of Object.entries(t)) e === "className" ? n.class = r : n[e] = r;
18
+ return n;
19
+ }
41
20
  };
21
+ //#endregion
22
+ export { n as default, n as solidRuntime };
@@ -1,20 +1,2 @@
1
- import "solid-js/web";
2
- import "@intlayer/config/built";
3
- import "@intlayer/core/interpreter";
4
- import "@intlayer/core/markdown";
5
- import "@intlayer/core/transpiler";
6
- import "@intlayer/types/nodeType";
7
- import { h as d, a as e, i as h, m as k, b as w, s as N } from "../plugins-FXnYVZH5.mjs";
8
- import "./editor/useEditedContentRenderer.mjs";
9
- import "./IntlayerNode.mjs";
10
- import "./markdown/MarkdownProvider.mjs";
11
- import "./markdown/MarkdownRenderer.mjs";
12
- import "./solidElement/renderSolidElement.mjs";
13
- export {
14
- d as htmlPlugin,
15
- e as insertionPlugin,
16
- h as intlayerNodePlugins,
17
- k as markdownPlugin,
18
- w as markdownStringPlugin,
19
- N as solidNodePlugins
20
- };
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o } from "../getDictionary-DKdSGWHu.mjs";
2
+ export { r as getPlugins, a as htmlPlugin, n as insertionPlugin, e as intlayerNodePlugins, i as markdownPlugin, o as markdownStringPlugin, t as solidNodePlugins };
@@ -1,30 +1,33 @@
1
- import { Dynamic as d } from "solid-js/web";
2
- const h = (o) => {
3
- if (typeof o == "string")
4
- return o;
5
- const n = ((r) => {
6
- if (r?.props && typeof r.props.children == "object") {
7
- const s = [], { children: c } = r.props;
8
- return Object.keys(c ?? {}).forEach((t) => {
9
- s.push(
10
- h(c?.[t])
11
- );
12
- }), {
13
- ...r,
14
- props: { ...r.props, children: s }
15
- };
16
- }
17
- return {
18
- ...r,
19
- props: { ...r.props, children: r.props?.children ?? [] }
20
- };
21
- })(o), { type: i, props: p } = n;
22
- return d({
23
- component: i ?? "span",
24
- ...p,
25
- children: p.children
26
- });
27
- };
28
- export {
29
- h as renderSolidElement
1
+ import { Dynamic as e } from "solid-js/web";
2
+ //#region src/solidElement/renderSolidElement.ts
3
+ var t = (n) => {
4
+ if (typeof n == "string") return n;
5
+ let { type: r, props: i } = ((e) => {
6
+ if (e?.props && typeof e.props.children == "object") {
7
+ let n = [], { children: r } = e.props;
8
+ return Object.keys(r ?? {}).forEach((e) => {
9
+ n.push(t(r?.[e]));
10
+ }), {
11
+ ...e,
12
+ props: {
13
+ ...e.props,
14
+ children: n
15
+ }
16
+ };
17
+ }
18
+ return {
19
+ ...e,
20
+ props: {
21
+ ...e.props,
22
+ children: e.props?.children ?? []
23
+ }
24
+ };
25
+ })(n);
26
+ return e({
27
+ component: r ?? "span",
28
+ ...i,
29
+ children: i.children
30
+ });
30
31
  };
32
+ //#endregion
33
+ export { t as renderSolidElement };
@@ -0,0 +1,188 @@
1
+ import { renderIntlayerNode as e } from "./esm/IntlayerNode.mjs";
2
+ import { useEditorEnabled as t } from "./esm/editor/contexts/EditorEnabledContext.mjs";
3
+ import { useFocusDictionary as n } from "./esm/editor/contexts/FocusDictionaryContext.mjs";
4
+ import { IntlayerClientContext as r, useIntlayerContext as i } from "./esm/client/IntlayerProvider.mjs";
5
+ import { useLoadDynamic as a } from "./esm/client/useLoadDynamic.mjs";
6
+ import { ContentSelector as o } from "./esm/UI/ContentSelector.mjs";
7
+ import { EditedContentRenderer as s } from "./esm/editor/useEditedContentRenderer.mjs";
8
+ import { MarkdownMetadataRenderer as c, MarkdownRenderer as l } from "./esm/markdown/MarkdownRenderer.mjs";
9
+ import { renderSolidElement as u } from "./esm/solidElement/renderSolidElement.mjs";
10
+ import { conditionPlugin as d, enumerationPlugin as f, filePlugin as p, genderPlugin as m, getDictionary as h, getHTML as g, getIntlayer as _, nestedPlugin as v, splitInsertionTemplate as y, translationPlugin as b } from "@intlayer/core/interpreter";
11
+ import { Dynamic as x, createComponent as S, mergeProps as C } from "solid-js/web";
12
+ import w from "@intlayer/config/built";
13
+ import { getMarkdownMetadata as T } from "@intlayer/core/markdown";
14
+ import { HTML_TAGS as E } from "@intlayer/core/transpiler";
15
+ import { NodeType as D } from "@intlayer/types/nodeType";
16
+ import { isSameKeyPath as O } from "@intlayer/core/utils";
17
+ import { createMemo as k, useContext as A } from "solid-js";
18
+ //#region src/client/useDictionary.ts
19
+ var j = (e, t) => {
20
+ let n = A(r);
21
+ return k(() => q(e, t ?? n?.locale?.()));
22
+ }, M = async (e, t) => {
23
+ let { locale: n } = A(r), i = w?.internationalization.defaultLocale, a = t ?? n() ?? i;
24
+ return j(await e[a]?.(), a);
25
+ }, N = (e, t, n) => {
26
+ let { locale: i } = A(r) ?? {}, o = w?.internationalization.defaultLocale, s = n ?? i?.() ?? o;
27
+ return j(a(`${String(t)}.${s}`, e[s]?.()), s);
28
+ }, P = (e, t) => _(e, t, K(t)), F = (e, t) => {
29
+ let n = A(r);
30
+ return k(() => {
31
+ let r = n?.locale();
32
+ return P(e, t ?? r);
33
+ });
34
+ }, I = (e) => {
35
+ let { focusedContent: t, setFocusedContent: r } = n(), i = k(() => e.keyPath.filter((e) => e.type !== D.Translation)), a = () => r({
36
+ dictionaryKey: e.dictionaryKey,
37
+ keyPath: i()
38
+ }), s = k(() => (t?.dictionaryKey === e.dictionaryKey && (t?.keyPath?.length ?? 0) > 0 && O(t?.keyPath ?? [], i())) ?? !1);
39
+ return S(o, {
40
+ onPress: a,
41
+ get isSelecting() {
42
+ return s();
43
+ },
44
+ get children() {
45
+ return e.children;
46
+ }
47
+ });
48
+ }, L = (e) => {
49
+ let { enabled: n } = t(), { disableEditor: r } = i();
50
+ return n() && !r ? S(I, C(e, { get children() {
51
+ return e.children;
52
+ } })) : e.children;
53
+ }, R = {
54
+ id: "intlayer-node-plugin",
55
+ canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
56
+ transform: (t, { plugins: n, ...r }) => e({
57
+ ...r,
58
+ value: r.children,
59
+ children: w?.editor.enabled ? S(L, C(r, { get children() {
60
+ return S(s, C(r, { get children() {
61
+ return r.children;
62
+ } }));
63
+ } })) : r.children
64
+ })
65
+ }, z = {
66
+ id: "solid-node-plugin",
67
+ canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
68
+ transform: (t, { plugins: n, ...r }) => e({
69
+ ...r,
70
+ value: "[[solid-element]]",
71
+ children: w?.editor.enabled ? S(L, C(r, { get children() {
72
+ return typeof Node < "u" && t instanceof Node ? t : u(t);
73
+ } })) : typeof Node < "u" && t instanceof Node ? t : u(t)
74
+ })
75
+ }, B = (e, t) => {
76
+ let n = y(e, t);
77
+ return n.isSimple, n.parts;
78
+ }, V = {
79
+ id: "insertion-plugin",
80
+ canHandle: (e) => typeof e == "object" && e?.nodeType === D.Insertion,
81
+ transform: (e, t, n) => {
82
+ let r = [...t.keyPath, { type: D.Insertion }], i = e[D.Insertion];
83
+ return (e) => {
84
+ let a = {
85
+ id: "insertion-string-plugin",
86
+ canHandle: (e) => typeof e == "string",
87
+ transform: (n, r, i) => {
88
+ let a = B(i(n, {
89
+ ...r,
90
+ children: n,
91
+ plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
92
+ }), e);
93
+ return i(a, {
94
+ ...r,
95
+ plugins: t.plugins,
96
+ children: a
97
+ });
98
+ }
99
+ };
100
+ return n(i, {
101
+ ...t,
102
+ children: i,
103
+ keyPath: r,
104
+ plugins: [a, ...t.plugins ?? []]
105
+ });
106
+ };
107
+ }
108
+ }, H = {
109
+ id: "markdown-string-plugin",
110
+ canHandle: (e) => typeof e == "string",
111
+ transform: (t, n, r) => {
112
+ let { plugins: i, ...a } = n, o = r(T(t), {
113
+ plugins: [{
114
+ id: "markdown-metadata-plugin",
115
+ canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
116
+ transform: (n, r) => e({
117
+ ...r,
118
+ value: n,
119
+ children: S(L, C(a, { get children() {
120
+ return S(c, C(a, {
121
+ get metadataKeyPath() {
122
+ return r.keyPath;
123
+ },
124
+ children: t
125
+ }));
126
+ } }))
127
+ })
128
+ }],
129
+ dictionaryKey: a.dictionaryKey,
130
+ keyPath: []
131
+ }), s = (r) => e({
132
+ ...n,
133
+ value: t,
134
+ children: S(L, C(a, { get children() {
135
+ return S(l, C(a, {
136
+ components: r,
137
+ children: t
138
+ }));
139
+ } })),
140
+ additionalProps: { metadata: o }
141
+ }), u = s();
142
+ return new Proxy(u, { get(e, n, r) {
143
+ return n === "value" ? t : n === "metadata" ? o : n === "use" ? (e) => s(e) : Reflect.get(e, n, r);
144
+ } });
145
+ }
146
+ }, U = {
147
+ id: "markdown-plugin",
148
+ canHandle: (e) => typeof e == "object" && e?.nodeType === D.Markdown,
149
+ transform: (e, t, n) => {
150
+ let r = [...t.keyPath, { type: D.Markdown }], i = e[D.Markdown];
151
+ return n(i, {
152
+ ...t,
153
+ children: i,
154
+ keyPath: r,
155
+ plugins: [H, ...t.plugins ?? []]
156
+ });
157
+ }
158
+ }, W = (() => {
159
+ let e = {};
160
+ for (let t of E) e[t] = ({ children: e, ...n }) => S(x, C({ component: t }, n, { children: e }));
161
+ return e;
162
+ })(), G = {
163
+ id: "html-plugin",
164
+ canHandle: (e) => typeof e == "object" && e?.nodeType === D.HTML,
165
+ transform: (e) => {
166
+ let t = e[D.HTML], n = (e) => g(t, {
167
+ ...W,
168
+ ...e
169
+ }), r = [n()];
170
+ return new Proxy(r, { get(e, r, i) {
171
+ return r === "value" ? t : r === "use" ? (e) => n(e) : Reflect.get(e, r, i);
172
+ } });
173
+ }
174
+ }, K = (e, t = !0) => [
175
+ b(e ?? w.internationalization.defaultLocale, t ? w.internationalization.defaultLocale : void 0),
176
+ f,
177
+ d,
178
+ v(e ?? w.internationalization.defaultLocale),
179
+ p,
180
+ m,
181
+ R,
182
+ z,
183
+ V,
184
+ U,
185
+ G
186
+ ], q = (e, t) => h(e, t, K(t));
187
+ //#endregion
188
+ export { R as a, z as c, P as d, N as f, V as i, L as l, j as m, K as n, U as o, M as p, G as r, H as s, q as t, F as u };
@@ -0,0 +1 @@
1
+ const e=require(`./chunk-C91j1N6u.js`),t=require(`./cjs/IntlayerNode.cjs`),n=require(`./cjs/editor/contexts/EditorEnabledContext.cjs`),r=require(`./cjs/editor/contexts/FocusDictionaryContext.cjs`),i=require(`./cjs/client/IntlayerProvider.cjs`),a=require(`./cjs/client/useLoadDynamic.cjs`),o=require(`./cjs/UI/ContentSelector.cjs`),s=require(`./cjs/editor/useEditedContentRenderer.cjs`),c=require(`./cjs/markdown/MarkdownRenderer.cjs`),l=require(`./cjs/solidElement/renderSolidElement.cjs`);let u=require(`@intlayer/core/interpreter`),d=require(`solid-js/web`),f=require(`@intlayer/config/built`);f=e.t(f);let p=require(`@intlayer/core/markdown`),m=require(`@intlayer/core/transpiler`),h=require(`@intlayer/types/nodeType`),g=require(`@intlayer/core/utils`),_=require(`solid-js`);var v=(e,t)=>{let n=(0,_.useContext)(i.IntlayerClientContext);return(0,_.createMemo)(()=>P(e,t??n?.locale?.()))},y=async(e,t)=>{let{locale:n}=(0,_.useContext)(i.IntlayerClientContext),r=f.default?.internationalization.defaultLocale,a=t??n()??r;return v(await e[a]?.(),a)},b=(e,t,n)=>{let{locale:r}=(0,_.useContext)(i.IntlayerClientContext)??{},o=f.default?.internationalization.defaultLocale,s=n??r?.()??o;return v(a.useLoadDynamic(`${String(t)}.${s}`,e[s]?.()),s)},x=(e,t)=>(0,u.getIntlayer)(e,t,N(t)),S=(e,t)=>{let n=(0,_.useContext)(i.IntlayerClientContext);return(0,_.createMemo)(()=>{let r=n?.locale();return x(e,t??r)})},C=e=>{let{focusedContent:t,setFocusedContent:n}=r.useFocusDictionary(),i=(0,_.createMemo)(()=>e.keyPath.filter(e=>e.type!==h.NodeType.Translation)),a=()=>n({dictionaryKey:e.dictionaryKey,keyPath:i()}),s=(0,_.createMemo)(()=>(t?.dictionaryKey===e.dictionaryKey&&(t?.keyPath?.length??0)>0&&(0,g.isSameKeyPath)(t?.keyPath??[],i()))??!1);return(0,d.createComponent)(o.ContentSelector,{onPress:a,get isSelecting(){return s()},get children(){return e.children}})},w=e=>{let{enabled:t}=n.useEditorEnabled(),{disableEditor:r}=i.useIntlayerContext();return t()&&!r?(0,d.createComponent)(C,(0,d.mergeProps)(e,{get children(){return e.children}})):e.children},T={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{plugins:n,...r})=>t.renderIntlayerNode({...r,value:r.children,children:f.default?.editor.enabled?(0,d.createComponent)(w,(0,d.mergeProps)(r,{get children(){return(0,d.createComponent)(s.EditedContentRenderer,(0,d.mergeProps)(r,{get children(){return r.children}}))}})):r.children})},E={id:`solid-node-plugin`,canHandle:e=>typeof e==`object`&&e?.props!==void 0||typeof Node<`u`&&e instanceof Node,transform:(e,{plugins:n,...r})=>t.renderIntlayerNode({...r,value:`[[solid-element]]`,children:f.default?.editor.enabled?(0,d.createComponent)(w,(0,d.mergeProps)(r,{get children(){return typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)}})):typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)})},D=(e,t)=>{let n=(0,u.splitInsertionTemplate)(e,t);return n.isSimple,n.parts},O={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.NodeType.Insertion,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.NodeType.Insertion}],i=e[h.NodeType.Insertion];return e=>{let a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(n,r,i)=>{let a=D(i(n,{...r,children:n,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]}),e);return i(a,{...r,plugins:t.plugins,children:a})}};return n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]})}}},k={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,r)=>{let{plugins:i,...a}=n,o=r((0,p.getMarkdownMetadata)(e),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(n,r)=>t.renderIntlayerNode({...r,value:n,children:(0,d.createComponent)(w,(0,d.mergeProps)(a,{get children(){return(0,d.createComponent)(c.MarkdownMetadataRenderer,(0,d.mergeProps)(a,{get metadataKeyPath(){return r.keyPath},children:e}))}}))})}],dictionaryKey:a.dictionaryKey,keyPath:[]}),s=r=>t.renderIntlayerNode({...n,value:e,children:(0,d.createComponent)(w,(0,d.mergeProps)(a,{get children(){return(0,d.createComponent)(c.MarkdownRenderer,(0,d.mergeProps)(a,{components:r,children:e}))}})),additionalProps:{metadata:o}}),l=s();return new Proxy(l,{get(t,n,r){return n===`value`?e:n===`metadata`?o:n===`use`?e=>s(e):Reflect.get(t,n,r)}})}},A={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.NodeType.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.NodeType.Markdown}],i=e[h.NodeType.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[k,...t.plugins??[]]})}},j=(()=>{let e={};for(let t of m.HTML_TAGS)e[t]=({children:e,...n})=>(0,d.createComponent)(d.Dynamic,(0,d.mergeProps)({component:t},n,{children:e}));return e})(),M={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.NodeType.HTML,transform:e=>{let t=e[h.NodeType.HTML],n=e=>(0,u.getHTML)(t,{...j,...e}),r=[n()];return new Proxy(r,{get(e,r,i){return r===`value`?t:r===`use`?e=>n(e):Reflect.get(e,r,i)}})}},N=(e,t=!0)=>[(0,u.translationPlugin)(e??f.default.internationalization.defaultLocale,t?f.default.internationalization.defaultLocale:void 0),u.enumerationPlugin,u.conditionPlugin,(0,u.nestedPlugin)(e??f.default.internationalization.defaultLocale),u.filePlugin,u.genderPlugin,T,E,O,A,M],P=(e,t)=>(0,u.getDictionary)(e,t,N(t));Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return S}});
@@ -1,7 +1,6 @@
1
1
  import { NodeProps } from '@intlayer/core/interpreter';
2
- import { ResolvedEditor } from '@intlayer/types/module_augmentation';
3
2
  import { JSX, ParentProps } from 'solid-js';
4
- export type IntlayerNode<T = NodeProps['children'], AdditionalProps = {}> = ResolvedEditor<T, JSX.Element> & {
3
+ export type IntlayerNode<T = NodeProps['children'], AdditionalProps = {}> = T & {
5
4
  value: T;
6
5
  } & AdditionalProps;
7
6
  type RenderIntlayerNodeProps<T> = ParentProps<{
@@ -1,5 +1,5 @@
1
- import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
2
1
  import { Dictionary } from '@intlayer/types/dictionary';
2
+ import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
3
3
  import { Accessor } from 'solid-js';
4
4
  import { DeepTransformContent } from '../plugins';
5
5
  /**
@@ -1,5 +1,4 @@
1
- import { Plugins } from '@intlayer/core/interpreter';
2
1
  import { Dictionary } from '@intlayer/types/dictionary';
3
2
  import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
4
3
  import { DeepTransformContent } from './plugins';
5
- export declare const getDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L, additionalPlugins?: Plugins[]) => DeepTransformContent<T["content"], L>;
4
+ export declare const getDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => DeepTransformContent<T["content"], L>;
@@ -1,4 +1,3 @@
1
- import { Plugins } from '@intlayer/core/interpreter';
2
1
  import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from '@intlayer/types/module_augmentation';
3
2
  import { DeepTransformContent } from './plugins';
4
- export declare const getIntlayer: <T extends DictionaryKeys, L extends LocalesValues = DeclaredLocales>(key: T, locale?: L, additionalPlugins?: Plugins[]) => DeepTransformContent<DictionaryRegistryContent<T>, L>;
3
+ export declare const getIntlayer: <T extends DictionaryKeys, L extends LocalesValues = DeclaredLocales>(key: T, locale?: L) => DeepTransformContent<DictionaryRegistryContent<T>, L>;
@@ -22,13 +22,13 @@ export declare const solidNodePlugins: Plugins;
22
22
  /** ---------------------------------------------
23
23
  * INSERTION PLUGIN
24
24
  * --------------------------------------------- */
25
- export type InsertionCond<T, _S, _L> = T extends {
25
+ export type InsertionCond<T, _S, L extends LocalesValues> = T extends {
26
26
  nodeType: NodeType | string;
27
- [NodeType.Insertion]: string;
28
- fields: readonly string[];
27
+ [NodeType.Insertion]: infer I;
28
+ fields: readonly (infer F)[];
29
29
  } ? <V extends {
30
- [K in T['fields'][number]]: JSX.Element;
31
- }>(values: V) => V[keyof V] extends string | number ? IntlayerNode<string> : IntlayerNode<JSX.Element> : never;
30
+ [K in Extract<F, string>]: string | number | JSX.Element;
31
+ }>(values: V) => I extends string ? V[keyof V] extends string | number ? IntlayerNode<string> : IntlayerNode<JSX.Element> : DeepTransformContent<I, L> : never;
32
32
  /** Insertion plugin for Solid. Handles component/element insertion. */
33
33
  export declare const insertionPlugin: Plugins;
34
34
  /**
@@ -42,21 +42,21 @@ export type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
42
42
  export declare const markdownStringPlugin: Plugins;
43
43
  export type MarkdownCond<T> = T extends {
44
44
  nodeType: NodeType | string;
45
- [NodeType.Markdown]: infer _M;
45
+ [NodeType.Markdown]: infer M;
46
46
  metadata?: infer U;
47
47
  tags?: infer U;
48
- } ? {
48
+ } ? IntlayerNode<M, {
49
49
  use: (components?: HTMLComponents<'permissive', U>) => JSX.Element;
50
50
  metadata: DeepTransformContent<U>;
51
- } : never;
51
+ }> : never;
52
52
  export declare const markdownPlugin: Plugins;
53
53
  export type HTMLPluginCond<T> = T extends {
54
54
  nodeType: NodeType | string;
55
55
  [NodeType.HTML]: infer I;
56
56
  tags?: infer U;
57
- } ? {
57
+ } ? IntlayerNode<I, {
58
58
  use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;
59
- } : never;
59
+ }> : never;
60
60
  /** HTML plugin. Replaces node with a function that takes components => JSX.Element. */
61
61
  export declare const htmlPlugin: Plugins;
62
62
  /** ---------------------------------------------
@@ -82,3 +82,8 @@ export type IInterpreterPluginState = Omit<IInterpreterPluginStateCore, 'inserti
82
82
  solidHtml: true;
83
83
  };
84
84
  export type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContentCore<T, IInterpreterPluginState, L>;
85
+ /**
86
+ * Get the plugins array for Solid content transformation.
87
+ * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.
88
+ */
89
+ export declare const getPlugins: (locale?: LocalesValues, fallback?: boolean) => Plugins[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-intlayer",
3
- "version": "8.3.1",
3
+ "version": "8.3.3",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -73,18 +73,18 @@
73
73
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
74
74
  },
75
75
  "dependencies": {
76
- "@intlayer/api": "8.3.1",
77
- "@intlayer/config": "8.3.1",
78
- "@intlayer/core": "8.3.1",
79
- "@intlayer/editor": "8.3.1",
80
- "@intlayer/types": "8.3.1"
76
+ "@intlayer/api": "8.3.3",
77
+ "@intlayer/config": "8.3.3",
78
+ "@intlayer/core": "8.3.3",
79
+ "@intlayer/editor": "8.3.3",
80
+ "@intlayer/types": "8.3.3"
81
81
  },
82
82
  "devDependencies": {
83
- "@intlayer/unmerged-dictionaries-entry": "8.3.1",
83
+ "@intlayer/unmerged-dictionaries-entry": "8.3.3",
84
84
  "@solidjs/testing-library": "0.8.10",
85
85
  "@testing-library/jest-dom": "6.9.1",
86
86
  "@testing-library/user-event": "14.6.1",
87
- "@types/node": "25.4.0",
87
+ "@types/node": "25.5.0",
88
88
  "@utils/ts-config": "1.0.4",
89
89
  "@utils/ts-config-types": "1.0.4",
90
90
  "@utils/tsdown-config": "1.0.4",
@@ -92,10 +92,10 @@
92
92
  "rimraf": "6.1.3",
93
93
  "tsdown": "0.21.2",
94
94
  "typescript": "5.9.3",
95
- "vite": "7.3.1",
95
+ "vite": "8.0.0",
96
96
  "vite-plugin-dts": "4.5.4",
97
- "vite-plugin-solid": "2.11.10",
98
- "vitest": "4.0.18"
97
+ "vite-plugin-solid": "2.11.11",
98
+ "vitest": "4.1.0"
99
99
  },
100
100
  "peerDependencies": {
101
101
  "solid-js": ">=1.0.0"