solid-intlayer 8.7.11 → 8.7.12

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 (68) hide show
  1. package/dist/cjs/client/IntlayerProvider.cjs +1 -1
  2. package/dist/cjs/client/getBrowserLocale.cjs +1 -1
  3. package/dist/cjs/client/index.cjs +1 -1
  4. package/dist/cjs/client/t.cjs +1 -1
  5. package/dist/cjs/client/useContent.cjs +1 -1
  6. package/dist/cjs/client/useDictionary.cjs +1 -1
  7. package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
  8. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
  9. package/dist/cjs/client/useIntlayer.cjs +1 -1
  10. package/dist/cjs/client/useLocale.cjs +1 -1
  11. package/dist/cjs/client/useLocaleBase.cjs +1 -1
  12. package/dist/cjs/client/useLocaleStorage.cjs +1 -1
  13. package/dist/cjs/client/useRewriteURL.cjs +1 -1
  14. package/dist/cjs/client/useTraduction.cjs +1 -1
  15. package/dist/cjs/editor/ContentSelector.cjs +1 -1
  16. package/dist/cjs/editor/EditorProvider.cjs +1 -1
  17. package/dist/cjs/editor/useEditor.cjs +1 -1
  18. package/dist/cjs/format/useCompact.cjs +1 -1
  19. package/dist/cjs/format/useCurrency.cjs +1 -1
  20. package/dist/cjs/format/useDate.cjs +1 -1
  21. package/dist/cjs/format/useIntl.cjs +1 -1
  22. package/dist/cjs/format/useList.cjs +1 -1
  23. package/dist/cjs/format/useNumber.cjs +1 -1
  24. package/dist/cjs/format/usePercentage.cjs +1 -1
  25. package/dist/cjs/format/useRelativeTime.cjs +1 -1
  26. package/dist/cjs/format/useUnit.cjs +1 -1
  27. package/dist/cjs/getDictionary.cjs +1 -1
  28. package/dist/cjs/getIntlayer.cjs +1 -1
  29. package/dist/cjs/html/HTMLProvider.cjs +1 -1
  30. package/dist/cjs/html/HTMLRenderer.cjs +1 -1
  31. package/dist/cjs/index.cjs +1 -1
  32. package/dist/cjs/markdown/MarkdownProvider.cjs +1 -1
  33. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
  34. package/dist/cjs/markdown/runtime.cjs +1 -1
  35. package/dist/cjs/plugins.cjs +1 -1
  36. package/dist/cjs/solidElement/renderSolidElement.cjs +1 -1
  37. package/dist/esm/client/IntlayerProvider.mjs +40 -2
  38. package/dist/esm/client/index.mjs +12 -4
  39. package/dist/esm/client/t.mjs +10 -2
  40. package/dist/esm/client/useContent.mjs +1 -1
  41. package/dist/esm/client/useDictionary.mjs +10 -2
  42. package/dist/esm/client/useDictionaryAsync.mjs +11 -2
  43. package/dist/esm/client/useDictionaryDynamic.mjs +12 -2
  44. package/dist/esm/client/useIntlayer.mjs +13 -2
  45. package/dist/esm/client/useLocale.mjs +24 -2
  46. package/dist/esm/client/useLocaleBase.mjs +15 -2
  47. package/dist/esm/client/useRewriteURL.mjs +15 -2
  48. package/dist/esm/client/useTraduction.mjs +1 -1
  49. package/dist/esm/editor/ContentSelector.mjs +5 -5
  50. package/dist/esm/editor/EditorProvider.mjs +5 -2
  51. package/dist/esm/editor/useEditor.mjs +22 -2
  52. package/dist/esm/format/useCompact.mjs +1 -1
  53. package/dist/esm/format/useCurrency.mjs +1 -1
  54. package/dist/esm/format/useDate.mjs +1 -1
  55. package/dist/esm/format/useIntl.mjs +1 -1
  56. package/dist/esm/format/useList.mjs +1 -1
  57. package/dist/esm/format/useNumber.mjs +1 -1
  58. package/dist/esm/format/usePercentage.mjs +1 -1
  59. package/dist/esm/format/useRelativeTime.mjs +1 -1
  60. package/dist/esm/format/useUnit.mjs +1 -1
  61. package/dist/esm/index.mjs +12 -4
  62. package/dist/esm/plugins.mjs +121 -108
  63. package/dist/plugins-D8_XlNwB.js +1 -0
  64. package/dist/types/client/useDictionaryDynamic.d.ts +1 -1
  65. package/package.json +6 -6
  66. package/dist/client-D9wP8Q_u.mjs +0 -107
  67. package/dist/client-DrZ62_Q2.js +0 -1
  68. package/dist/plugins-JJ37BmVk.js +0 -1
@@ -1,7 +1,15 @@
1
1
  import { getIntlayer as e } from "./getIntlayer.mjs";
2
2
  import { getDictionary as t } from "./getDictionary.mjs";
3
3
  import { getBrowserLocale as n } from "./client/getBrowserLocale.mjs";
4
- import { a as r, c as i, d as a, f as o, i as s, l as c, n as l, o as u, r as d, s as f, t as p, u as m } from "../client-D9wP8Q_u.mjs";
5
- import { localeCookie as h, localeInStorage as g, setLocaleCookie as _, setLocaleInStorage as v, useLocaleCookie as y, useLocaleStorage as b } from "./client/useLocaleStorage.mjs";
6
- import { useLoadDynamic as x } from "./client/useLoadDynamic.mjs";
7
- export { c as IntlayerClientContext, m as IntlayerProvider, a as IntlayerProviderContent, n as getBrowserLocale, t as getDictionary, e as getIntlayer, h as localeCookie, g as localeInStorage, _ as setLocaleCookie, v as setLocaleInStorage, i as t, f as useDictionary, u as useDictionaryAsync, r as useDictionaryDynamic, s as useIntlayer, o as useIntlayerContext, x as useLoadDynamic, d as useLocale, l as useLocaleBase, y as useLocaleCookie, b as useLocaleStorage, p as useRewriteURL };
4
+ import { localeCookie as r, localeInStorage as i, setLocaleCookie as a, setLocaleInStorage as o, useLocaleCookie as s, useLocaleStorage as c } from "./client/useLocaleStorage.mjs";
5
+ import { IntlayerClientContext as l, IntlayerProvider as u, IntlayerProviderContent as d, useIntlayerContext as f } from "./client/IntlayerProvider.mjs";
6
+ import { t as p } from "./client/t.mjs";
7
+ import { useDictionary as m } from "./client/useDictionary.mjs";
8
+ import { useDictionaryAsync as h } from "./client/useDictionaryAsync.mjs";
9
+ import { useLoadDynamic as g } from "./client/useLoadDynamic.mjs";
10
+ import { useDictionaryDynamic as _ } from "./client/useDictionaryDynamic.mjs";
11
+ import { useIntlayer as v } from "./client/useIntlayer.mjs";
12
+ import { useLocale as y } from "./client/useLocale.mjs";
13
+ import { useLocaleBase as b } from "./client/useLocaleBase.mjs";
14
+ import { useRewriteURL as x } from "./client/useRewriteURL.mjs";
15
+ export { l as IntlayerClientContext, u as IntlayerProvider, d as IntlayerProviderContent, n as getBrowserLocale, t as getDictionary, e as getIntlayer, r as localeCookie, i as localeInStorage, a as setLocaleCookie, o as setLocaleInStorage, p as t, m as useDictionary, h as useDictionaryAsync, _ as useDictionaryDynamic, v as useIntlayer, f as useIntlayerContext, g as useLoadDynamic, y as useLocale, b as useLocaleBase, s as useLocaleCookie, c as useLocaleStorage, x as useRewriteURL };
@@ -1,47 +1,60 @@
1
- import { ContentSelector as e } from "./editor/ContentSelector.mjs";
2
- import { renderIntlayerNode as t } from "./IntlayerNode.mjs";
3
- import { renderSolidElement as n } from "./solidElement/renderSolidElement.mjs";
4
- import { createComponent as r, mergeProps as i } from "solid-js/web";
5
- import { editor as a, internationalization as o } from "@intlayer/config/built";
6
- import { conditionPlugin as s, enumerationPlugin as c, fallbackPlugin as l, filePlugin as u, genderPlugin as d, nestedPlugin as f, splitInsertionTemplate as p, translationPlugin as m } from "@intlayer/core/interpreter";
7
- import { getMarkdownMetadata as h } from "@intlayer/core/markdown";
8
- import * as g from "@intlayer/types/nodeType";
9
- import { Suspense as _, lazy as v } from "solid-js";
1
+ import { renderIntlayerNode as e } from "./IntlayerNode.mjs";
2
+ import { renderSolidElement as t } from "./solidElement/renderSolidElement.mjs";
3
+ import { createComponent as n, mergeProps as r } from "solid-js/web";
4
+ import { editor as i, internationalization as a } from "@intlayer/config/built";
5
+ import { conditionPlugin as o, enumerationPlugin as s, fallbackPlugin as c, filePlugin as l, genderPlugin as u, nestedPlugin as d, splitInsertionTemplate as f, translationPlugin as p } from "@intlayer/core/interpreter";
6
+ import { getMarkdownMetadata as m } from "@intlayer/core/markdown";
7
+ import * as h from "@intlayer/types/nodeType";
8
+ import { Suspense as g, lazy as _ } from "solid-js";
10
9
  //#region src/plugins.tsx
11
- var y = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false", b = process.env.INTLAYER_NODE_TYPE_SOLID_NODE === "false", x = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false", S = process.env.INTLAYER_NODE_TYPE_HTML === "false", C = process.env.INTLAYER_NODE_TYPE_INSERTION === "false", w = process.env.INTLAYER_EDITOR_ENABLED === "false", T = x ? null : v(() => import("./markdown/MarkdownRenderer.mjs").then((e) => ({ default: e.MarkdownMetadataRenderer }))), E = x ? null : v(() => import("./markdown/MarkdownRenderer.mjs").then((e) => ({ default: e.MarkdownRenderer }))), D = S ? null : v(() => import("./html/HTMLRenderer.mjs").then((e) => ({ default: e.HTMLRenderer }))), O = y ? l : {
10
+ var v = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : _(() => import("./editor/ContentSelector.mjs").then((e) => ({ default: e.ContentSelector }))), y = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? null : _(() => import("./markdown/MarkdownRenderer.mjs").then((e) => ({ default: e.MarkdownMetadataRenderer }))), b = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? null : _(() => import("./markdown/MarkdownRenderer.mjs").then((e) => ({ default: e.MarkdownRenderer }))), x = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? null : _(() => import("./html/HTMLRenderer.mjs").then((e) => ({ default: e.HTMLRenderer }))), S = {
12
11
  id: "intlayer-node-plugin",
13
12
  canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
14
- transform: (n, { plugins: o, ...s }) => t({
15
- ...s,
16
- value: s.children,
17
- children: !w && a.enabled ? r(e, i(s, { get children() {
18
- return s.children;
19
- } })) : s.children
13
+ transform: (t, { plugins: a, ...o }) => e({
14
+ ...o,
15
+ value: o.children,
16
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(g, {
17
+ get fallback() {
18
+ return o.children;
19
+ },
20
+ get children() {
21
+ return n(v, r(o, { get children() {
22
+ return o.children;
23
+ } }));
24
+ }
25
+ }) : o.children
20
26
  })
21
- }, k = b ? l : {
27
+ }, C = process.env.INTLAYER_NODE_TYPE_SOLID_NODE === "false" ? c : {
22
28
  id: "solid-node-plugin",
23
29
  canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
24
- transform: (o, { plugins: s, ...c }) => t({
25
- ...c,
30
+ transform: (a, { plugins: o, ...s }) => e({
31
+ ...s,
26
32
  value: "[[solid-element]]",
27
- children: !w && a.enabled ? r(e, i(c, { get children() {
28
- return typeof Node < "u" && o instanceof Node ? o : n(o);
29
- } })) : typeof Node < "u" && o instanceof Node ? o : n(o)
33
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(g, {
34
+ get fallback() {
35
+ return typeof Node < "u" && a instanceof Node ? a : t(a);
36
+ },
37
+ get children() {
38
+ return n(v, r(s, { get children() {
39
+ return typeof Node < "u" && a instanceof Node ? a : t(a);
40
+ } }));
41
+ }
42
+ }) : typeof Node < "u" && a instanceof Node ? a : t(a)
30
43
  })
31
- }, A = (e, t) => {
32
- let n = p(e, t);
44
+ }, w = (e, t) => {
45
+ let n = f(e, t);
33
46
  return n.isSimple, n.parts;
34
- }, j = C ? l : {
47
+ }, T = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? c : {
35
48
  id: "insertion-plugin",
36
- canHandle: (e) => typeof e == "object" && e?.nodeType === g.INSERTION,
49
+ canHandle: (e) => typeof e == "object" && e?.nodeType === h.INSERTION,
37
50
  transform: (e, t, n) => {
38
- let r = [...t.keyPath, { type: g.INSERTION }], i = e[g.INSERTION];
51
+ let r = [...t.keyPath, { type: h.INSERTION }], i = e[h.INSERTION];
39
52
  return (e) => {
40
53
  let a = {
41
54
  id: "insertion-string-plugin",
42
55
  canHandle: (e) => typeof e == "string",
43
56
  transform: (n, r, i) => {
44
- let a = A(i(n, {
57
+ let a = w(i(n, {
45
58
  ...r,
46
59
  children: n,
47
60
  plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
@@ -61,132 +74,132 @@ var y = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false", b = process.en
61
74
  });
62
75
  };
63
76
  }
64
- }, M = x ? l : {
77
+ }, E = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? c : {
65
78
  id: "markdown-string-plugin",
66
79
  canHandle: (e) => typeof e == "string",
67
- transform: (n, o, s) => {
68
- let { plugins: c, ...l } = o, u = s(h(n) ?? {}, {
80
+ transform: (t, a, o) => {
81
+ let { plugins: s, ...c } = a, l = o(m(t) ?? {}, {
69
82
  plugins: [{
70
83
  id: "markdown-metadata-plugin",
71
84
  canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
72
- transform: (o, s) => t({
73
- ...s,
74
- value: o,
75
- children: !w && a.enabled ? r(e, i(l, { get children() {
76
- return r(_, {
77
- fallback: n,
85
+ transform: (a, o) => e({
86
+ ...o,
87
+ value: a,
88
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(v, r(c, { get children() {
89
+ return n(g, {
90
+ fallback: t,
78
91
  get children() {
79
- return r(T, i(l, {
92
+ return n(y, r(c, {
80
93
  get metadataKeyPath() {
81
- return s.keyPath;
94
+ return o.keyPath;
82
95
  },
83
- children: n
96
+ children: t
84
97
  }));
85
98
  }
86
99
  });
87
- } })) : r(_, {
88
- fallback: n,
100
+ } })) : n(g, {
101
+ fallback: t,
89
102
  get children() {
90
- return r(T, i(l, {
103
+ return n(y, r(c, {
91
104
  get metadataKeyPath() {
92
- return s.keyPath;
105
+ return o.keyPath;
93
106
  },
94
- children: n
107
+ children: t
95
108
  }));
96
109
  }
97
110
  })
98
111
  })
99
112
  }],
100
- dictionaryKey: l.dictionaryKey,
113
+ dictionaryKey: c.dictionaryKey,
101
114
  keyPath: []
102
- }), d = (s) => t({
103
- ...o,
104
- value: n,
105
- children: !w && a.enabled ? r(e, i(l, { get children() {
106
- return r(_, {
107
- fallback: n,
108
- get children() {
109
- return r(E, i(l, {
110
- components: s,
111
- children: n
115
+ }), u = (o) => e({
116
+ ...a,
117
+ value: t,
118
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(g, {
119
+ fallback: t,
120
+ get children() {
121
+ return n(v, r(c, { get children() {
122
+ return n(b, r(c, {
123
+ components: o,
124
+ children: t
112
125
  }));
113
- }
114
- });
115
- } })) : r(_, {
116
- fallback: n,
126
+ } }));
127
+ }
128
+ }) : n(g, {
129
+ fallback: t,
117
130
  get children() {
118
- return r(E, i(l, {
119
- components: s,
120
- children: n
131
+ return n(b, r(c, {
132
+ components: o,
133
+ children: t
121
134
  }));
122
135
  }
123
136
  }),
124
- additionalProps: { metadata: u }
125
- }), f = d();
126
- return new Proxy(f, { get(e, t, r) {
127
- return t === "value" ? n : t === "metadata" ? u : t === "use" ? (e) => d(e) : Reflect.get(e, t, r);
137
+ additionalProps: { metadata: l }
138
+ }), d = u();
139
+ return new Proxy(d, { get(e, n, r) {
140
+ return n === "value" ? t : n === "metadata" ? l : n === "use" ? (e) => u(e) : Reflect.get(e, n, r);
128
141
  } });
129
142
  }
130
- }, N = x ? l : {
143
+ }, D = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? c : {
131
144
  id: "markdown-plugin",
132
- canHandle: (e) => typeof e == "object" && e?.nodeType === g.MARKDOWN,
145
+ canHandle: (e) => typeof e == "object" && e?.nodeType === h.MARKDOWN,
133
146
  transform: (e, t, n) => {
134
- let r = [...t.keyPath, { type: g.MARKDOWN }], i = e[g.MARKDOWN];
147
+ let r = [...t.keyPath, { type: h.MARKDOWN }], i = e[h.MARKDOWN];
135
148
  return n(i, {
136
149
  ...t,
137
150
  children: i,
138
151
  keyPath: r,
139
- plugins: [M, ...t.plugins ?? []]
152
+ plugins: [E, ...t.plugins ?? []]
140
153
  });
141
154
  }
142
- }, P = S ? l : {
155
+ }, O = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? c : {
143
156
  id: "html-plugin",
144
- canHandle: (e) => typeof e == "object" && e?.nodeType === g.HTML,
145
- transform: (n, o) => {
146
- let s = n[g.HTML], { plugins: c, ...l } = o, u = (n) => t({
147
- ...l,
148
- value: s,
149
- children: !w && a.enabled ? r(e, i(l, { get children() {
150
- return r(_, {
151
- fallback: s,
152
- get children() {
153
- return r(D, i(l, {
154
- html: s,
155
- components: n
157
+ canHandle: (e) => typeof e == "object" && e?.nodeType === h.HTML,
158
+ transform: (t, a) => {
159
+ let o = t[h.HTML], { plugins: s, ...c } = a, l = (t) => e({
160
+ ...c,
161
+ value: o,
162
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(g, {
163
+ fallback: o,
164
+ get children() {
165
+ return n(v, r(c, { get children() {
166
+ return n(x, r(c, {
167
+ html: o,
168
+ components: t
156
169
  }));
157
- }
158
- });
159
- } })) : r(_, {
160
- fallback: s,
170
+ } }));
171
+ }
172
+ }) : n(g, {
173
+ fallback: o,
161
174
  get children() {
162
- return r(D, i(l, {
163
- html: s,
164
- components: n
175
+ return n(x, r(c, {
176
+ html: o,
177
+ components: t
165
178
  }));
166
179
  }
167
180
  })
168
- }), d = [u()];
169
- return new Proxy(d, { get(e, t, n) {
170
- return t === "value" ? s : t === "use" ? (e) => u(e) : Reflect.get(e, t, n);
181
+ }), u = [l()];
182
+ return new Proxy(u, { get(e, t, n) {
183
+ return t === "value" ? o : t === "use" ? (e) => l(e) : Reflect.get(e, t, n);
171
184
  } });
172
185
  }
173
- }, F = /* @__PURE__ */ new Map(), I = (e, t = !0) => {
174
- let n = `${e ?? o.defaultLocale}_${t}`;
175
- if (F.has(n)) return F.get(n);
186
+ }, k = /* @__PURE__ */ new Map(), A = (e, t = !0) => {
187
+ let n = `${e ?? a.defaultLocale}_${t}`;
188
+ if (k.has(n)) return k.get(n);
176
189
  let r = [
177
- m(e ?? o.defaultLocale, t ? o.defaultLocale : void 0),
178
- c,
190
+ p(e ?? a.defaultLocale, t ? a.defaultLocale : void 0),
179
191
  s,
180
- f(e ?? o.defaultLocale),
192
+ o,
193
+ d(e ?? a.defaultLocale),
194
+ l,
181
195
  u,
182
- d,
183
- O,
184
- k,
185
- j,
186
- N,
187
- P
196
+ S,
197
+ C,
198
+ T,
199
+ D,
200
+ O
188
201
  ];
189
- return F.set(n, r), r;
202
+ return k.set(n, r), r;
190
203
  };
191
204
  //#endregion
192
- export { I as getPlugins, P as htmlPlugin, j as insertionPlugin, O as intlayerNodePlugins, N as markdownPlugin, M as markdownStringPlugin, k as solidNodePlugins };
205
+ export { A as getPlugins, O as htmlPlugin, T as insertionPlugin, S as intlayerNodePlugins, D as markdownPlugin, E as markdownStringPlugin, C as solidNodePlugins };
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./cjs/IntlayerNode.cjs`),l=require(`./cjs/solidElement/renderSolidElement.cjs`);let u=require(`solid-js/web`),d=require(`@intlayer/config/built`),f=require(`@intlayer/core/interpreter`),p=require(`@intlayer/core/markdown`),m=require(`@intlayer/types/nodeType`);m=s(m);let h=require(`solid-js`);var g=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,h.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/editor/ContentSelector.cjs`)).then(e=>({default:e.ContentSelector}))),_=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?null:(0,h.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/markdown/MarkdownRenderer.cjs`)).then(e=>({default:e.MarkdownMetadataRenderer}))),v=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?null:(0,h.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/markdown/MarkdownRenderer.cjs`)).then(e=>({default:e.MarkdownRenderer}))),y=process.env.INTLAYER_NODE_TYPE_HTML===`false`?null:(0,h.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/html/HTMLRenderer.cjs`)).then(e=>({default:e.HTMLRenderer}))),b={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{plugins:t,...n})=>c.renderIntlayerNode({...n,value:n.children,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(h.Suspense,{get fallback(){return n.children},get children(){return(0,u.createComponent)(g,(0,u.mergeProps)(n,{get children(){return n.children}}))}}):n.children})},x=process.env.INTLAYER_NODE_TYPE_SOLID_NODE===`false`?f.fallbackPlugin:{id:`solid-node-plugin`,canHandle:e=>typeof e==`object`&&e?.props!==void 0||typeof Node<`u`&&e instanceof Node,transform:(e,{plugins:t,...n})=>c.renderIntlayerNode({...n,value:`[[solid-element]]`,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(h.Suspense,{get fallback(){return typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)},get children(){return(0,u.createComponent)(g,(0,u.mergeProps)(n,{get children(){return typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)}}))}}):typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)})},S=(e,t)=>{let n=(0,f.splitInsertionTemplate)(e,t);return n.isSimple,n.parts},C=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?f.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.INSERTION}],i=e[m.INSERTION];return e=>{let a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(n,r,i)=>{let a=S(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??[]]})}}},w=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,a=n((0,p.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>c.renderIntlayerNode({...n,value:t,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(g,(0,u.mergeProps)(i,{get children(){return(0,u.createComponent)(h.Suspense,{fallback:e,get children(){return(0,u.createComponent)(_,(0,u.mergeProps)(i,{get metadataKeyPath(){return n.keyPath},children:e}))}})}})):(0,u.createComponent)(h.Suspense,{fallback:e,get children(){return(0,u.createComponent)(_,(0,u.mergeProps)(i,{get metadataKeyPath(){return n.keyPath},children:e}))}})})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),o=n=>c.renderIntlayerNode({...t,value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(h.Suspense,{fallback:e,get children(){return(0,u.createComponent)(g,(0,u.mergeProps)(i,{get children(){return(0,u.createComponent)(v,(0,u.mergeProps)(i,{components:n,children:e}))}}))}}):(0,u.createComponent)(h.Suspense,{fallback:e,get children(){return(0,u.createComponent)(v,(0,u.mergeProps)(i,{components:n,children:e}))}}),additionalProps:{metadata:a}}),s=o();return new Proxy(s,{get(t,n,r){return n===`value`?e:n===`metadata`?a:n===`use`?e=>o(e):Reflect.get(t,n,r)}})}},T=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.MARKDOWN}],i=e[m.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[w,...t.plugins??[]]})}},E=process.env.INTLAYER_NODE_TYPE_HTML===`false`?f.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.HTML,transform:(e,t)=>{let n=e[m.HTML],{plugins:r,...i}=t,a=e=>c.renderIntlayerNode({...i,value:n,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(h.Suspense,{fallback:n,get children(){return(0,u.createComponent)(g,(0,u.mergeProps)(i,{get children(){return(0,u.createComponent)(y,(0,u.mergeProps)(i,{html:n,components:e}))}}))}}):(0,u.createComponent)(h.Suspense,{fallback:n,get children(){return(0,u.createComponent)(y,(0,u.mergeProps)(i,{html:n,components:e}))}})}),o=[a()];return new Proxy(o,{get(e,t,r){return t===`value`?n:t===`use`?e=>a(e):Reflect.get(e,t,r)}})}},D=new Map,O=(e,t=!0)=>{let n=`${e??d.internationalization.defaultLocale}_${t}`;if(D.has(n))return D.get(n);let r=[(0,f.translationPlugin)(e??d.internationalization.defaultLocale,t?d.internationalization.defaultLocale:void 0),f.enumerationPlugin,f.conditionPlugin,(0,f.nestedPlugin)(e??d.internationalization.defaultLocale),f.filePlugin,f.genderPlugin,b,x,C,T,E];return D.set(n,r),r};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return O}});
@@ -5,4 +5,4 @@ import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from '@intlayer/ty
5
5
  *
6
6
  * If the locale is not provided, it will use the locale from the client context
7
7
  */
8
- export declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => import('solid-js').Accessor<import('@intlayer/core/interpreter').DeepTransformContent<T["content"], import('../plugins').IInterpreterPluginState, "is" | "id" | (string & {}) | "hr" | "th" | "tr" | "mi" | "mn" | "ms" | "af" | "af-ZA" | "sq" | "sq-AL" | "am" | "am-ET" | "ar" | "ar-DZ" | "ar-BH" | "ar-TD" | "ar-KM" | "ar-DJ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MR" | "ar-MA" | "ar-OM" | "ar-PS" | "ar-QA" | "ar-SA" | "ar-SO" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-AE" | "ar-YE" | "hy" | "hy-AM" | "az" | "az-AZ" | "eu" | "eu-ES" | "be" | "be-BY" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "bs" | "bs-BA" | "bg" | "bg-BG" | "my" | "my-MM" | "ca" | "ca-ES" | "zh" | "zh-HK" | "zh-MO" | "zh-Hans" | "zh-CN" | "zh-SG" | "zh-TW" | "zh-Hant" | "hr-BA" | "hr-HR" | "cs" | "cs-CZ" | "da" | "da-DK" | "dv" | "dv-MV" | "nl" | "nl-BE" | "nl-NL" | "en" | "en-AU" | "en-BZ" | "en-BW" | "en-CA" | "en-CB" | "en-GH" | "en-HK" | "en-IN" | "en-IE" | "en-JM" | "en-KE" | "en-MY" | "en-NZ" | "en-NG" | "en-PK" | "en-PH" | "en-SG" | "en-ZA" | "en-TZ" | "en-TT" | "en-UG" | "en-GB" | "en-US" | "en-ZW" | "eo" | "et" | "et-EE" | "fo" | "fo-FO" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fr" | "fr-BE" | "fr-CA" | "fr-FR" | "fr-LU" | "fr-MC" | "fr-CH" | "mk" | "mk-MK" | "gl" | "gl-ES" | "ka" | "ka-GE" | "de" | "de-AT" | "de-DE" | "de-LI" | "de-LU" | "de-CH" | "el" | "el-GR" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hu" | "hu-HU" | "is-IS" | "id-ID" | "ga" | "ga-IE" | "it" | "it-IT" | "it-CH" | "ja" | "ja-JP" | "kn" | "kn-IN" | "kk" | "kk-KZ" | "km" | "km-KH" | "kok" | "kok-IN" | "ko" | "ko-KR" | "ku" | "ku-TR" | "ky" | "ky-KG" | "lo" | "lo-LA" | "lv" | "lv-LV" | "lt" | "lt-LT" | "dsb" | "dsb-DE" | "mg-MG" | "ml" | "ml-IN" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "mi-NZ" | "mr" | "mr-IN" | "mn-MN" | "ne" | "ne-NP" | "ns" | "ns-ZA" | "no" | "nb" | "nb-NO" | "nn" | "nn-NO" | "ps" | "ps-AR" | "pl" | "pl-PL" | "pt" | "pt-BR" | "pt-CV" | "pt-GW" | "pt-MO" | "pt-MZ" | "pt-PT" | "pt-ST" | "pt-TL" | "pa" | "pa-IN" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-MD" | "ro-RO" | "rm" | "rm-CH" | "ru" | "ru-MD" | "ru-RU" | "se" | "se-FI" | "se-NO" | "se-SE" | "sa" | "sa-IN" | "gd" | "gd-GB" | "sr-Cyrl" | "sr-BA" | "sr-RS" | "sr" | "sr-SP" | "si" | "si-LK" | "sk" | "sk-SK" | "sl" | "sl-SI" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-CU" | "es-DO" | "es-EC" | "es-SV" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PY" | "es-PE" | "es-PR" | "es-ES" | "es-US" | "es-UY" | "es-VE" | "sw" | "sw-KE" | "sv" | "sv-FI" | "sv-SE" | "syr" | "syr-SY" | "tl" | "tl-PH" | "ta" | "ta-IN" | "tt" | "tt-RU" | "te" | "te-IN" | "th-TH" | "ts" | "tn" | "tn-ZA" | "tr-TR" | "uk" | "uk-UA" | "hsb" | "hsb-DE" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "ve" | "ve-ZA" | "vi" | "vi-VN" | "cy" | "cy-GB" | "xh" | "xh-ZA" | "yi" | "yi-001" | "yo" | "yo-NG" | "zu" | "zu-ZA">>;
8
+ export declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => import('solid-js').Accessor<import('@intlayer/core/interpreter').DeepTransformContent<T["content"], import('../plugins').IInterpreterPluginState, (string & {}) | "tr" | "th" | "hr" | "mi" | "mn" | "ms" | "is" | "id" | "af" | "af-ZA" | "sq" | "sq-AL" | "am" | "am-ET" | "ar" | "ar-DZ" | "ar-BH" | "ar-TD" | "ar-KM" | "ar-DJ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MR" | "ar-MA" | "ar-OM" | "ar-PS" | "ar-QA" | "ar-SA" | "ar-SO" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-AE" | "ar-YE" | "hy" | "hy-AM" | "az" | "az-AZ" | "eu" | "eu-ES" | "be" | "be-BY" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "bs" | "bs-BA" | "bg" | "bg-BG" | "my" | "my-MM" | "ca" | "ca-ES" | "zh" | "zh-HK" | "zh-MO" | "zh-Hans" | "zh-CN" | "zh-SG" | "zh-TW" | "zh-Hant" | "hr-BA" | "hr-HR" | "cs" | "cs-CZ" | "da" | "da-DK" | "dv" | "dv-MV" | "nl" | "nl-BE" | "nl-NL" | "en" | "en-AU" | "en-BZ" | "en-BW" | "en-CA" | "en-CB" | "en-GH" | "en-HK" | "en-IN" | "en-IE" | "en-JM" | "en-KE" | "en-MY" | "en-NZ" | "en-NG" | "en-PK" | "en-PH" | "en-SG" | "en-ZA" | "en-TZ" | "en-TT" | "en-UG" | "en-GB" | "en-US" | "en-ZW" | "eo" | "et" | "et-EE" | "fo" | "fo-FO" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fr" | "fr-BE" | "fr-CA" | "fr-FR" | "fr-LU" | "fr-MC" | "fr-CH" | "mk" | "mk-MK" | "gl" | "gl-ES" | "ka" | "ka-GE" | "de" | "de-AT" | "de-DE" | "de-LI" | "de-LU" | "de-CH" | "el" | "el-GR" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hu" | "hu-HU" | "is-IS" | "id-ID" | "ga" | "ga-IE" | "it" | "it-IT" | "it-CH" | "ja" | "ja-JP" | "kn" | "kn-IN" | "kk" | "kk-KZ" | "km" | "km-KH" | "kok" | "kok-IN" | "ko" | "ko-KR" | "ku" | "ku-TR" | "ky" | "ky-KG" | "lo" | "lo-LA" | "lv" | "lv-LV" | "lt" | "lt-LT" | "dsb" | "dsb-DE" | "mg-MG" | "ml" | "ml-IN" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "mi-NZ" | "mr" | "mr-IN" | "mn-MN" | "ne" | "ne-NP" | "ns" | "ns-ZA" | "no" | "nb" | "nb-NO" | "nn" | "nn-NO" | "ps" | "ps-AR" | "pl" | "pl-PL" | "pt" | "pt-BR" | "pt-CV" | "pt-GW" | "pt-MO" | "pt-MZ" | "pt-PT" | "pt-ST" | "pt-TL" | "pa" | "pa-IN" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-MD" | "ro-RO" | "rm" | "rm-CH" | "ru" | "ru-MD" | "ru-RU" | "se" | "se-FI" | "se-NO" | "se-SE" | "sa" | "sa-IN" | "gd" | "gd-GB" | "sr-Cyrl" | "sr-BA" | "sr-RS" | "sr" | "sr-SP" | "si" | "si-LK" | "sk" | "sk-SK" | "sl" | "sl-SI" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-CU" | "es-DO" | "es-EC" | "es-SV" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PY" | "es-PE" | "es-PR" | "es-ES" | "es-US" | "es-UY" | "es-VE" | "sw" | "sw-KE" | "sv" | "sv-FI" | "sv-SE" | "syr" | "syr-SY" | "tl" | "tl-PH" | "ta" | "ta-IN" | "tt" | "tt-RU" | "te" | "te-IN" | "th-TH" | "ts" | "tn" | "tn-ZA" | "tr-TR" | "uk" | "uk-UA" | "hsb" | "hsb-DE" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "ve" | "ve-ZA" | "vi" | "vi-VN" | "cy" | "cy-GB" | "xh" | "xh-ZA" | "yi" | "yi-001" | "yo" | "yo-NG" | "zu" | "zu-ZA">>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-intlayer",
3
- "version": "8.7.11",
3
+ "version": "8.7.12",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -104,11 +104,11 @@
104
104
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
105
105
  },
106
106
  "dependencies": {
107
- "@intlayer/api": "8.7.11",
108
- "@intlayer/config": "8.7.11",
109
- "@intlayer/core": "8.7.11",
110
- "@intlayer/editor": "8.7.11",
111
- "@intlayer/types": "8.7.11"
107
+ "@intlayer/api": "8.7.12",
108
+ "@intlayer/config": "8.7.12",
109
+ "@intlayer/core": "8.7.12",
110
+ "@intlayer/editor": "8.7.12",
111
+ "@intlayer/types": "8.7.12"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@solidjs/testing-library": "0.8.10",
@@ -1,107 +0,0 @@
1
- import { getIntlayer as e } from "./esm/getIntlayer.mjs";
2
- import { getDictionary as t } from "./esm/getDictionary.mjs";
3
- import { localeInStorage as n, setLocaleInStorage as r } from "./esm/client/useLocaleStorage.mjs";
4
- import { useLoadDynamic as i } from "./esm/client/useLoadDynamic.mjs";
5
- import { createComponent as a, memo as o, mergeProps as s } from "solid-js/web";
6
- import { internationalization as c, routing as l } from "@intlayer/config/built";
7
- import { getTranslation as u } from "@intlayer/core/interpreter";
8
- import { createContext as d, createEffect as f, createMemo as p, createSignal as m, on as h, onCleanup as g, onMount as _, untrack as v, useContext as y } from "solid-js";
9
- import { isEnabled as b } from "@intlayer/editor/isEnabled";
10
- import { getRewritePath as x, localeResolver as S } from "@intlayer/core/localization";
11
- import { setIntlayerIdentifier as C } from "@intlayer/config/client";
12
- //#region src/editor/useEditor.tsx
13
- var w = process.env.INTLAYER_EDITOR_ENABLED === "false", T = () => {
14
- if (w || !b) return;
15
- let { locale: e } = O(), [t, n] = m(null);
16
- _(() => {
17
- import("@intlayer/editor").then(({ initEditorClient: e }) => {
18
- n(e());
19
- });
20
- }), f(() => {
21
- let n = t(), r = e();
22
- n && r && n.currentLocale.set(r);
23
- }), g(() => {
24
- import("@intlayer/editor").then(({ stopEditorClient: e }) => {
25
- e();
26
- });
27
- });
28
- }, E = ({ children: e }) => (T(), e), D = d({
29
- locale: () => n ?? c?.defaultLocale,
30
- setLocale: () => null
31
- }), O = () => y(D) ?? {}, k = (e) => {
32
- let { defaultLocale: t, locales: i } = c ?? {}, [o, s] = m(e.locale ?? n ?? e.defaultLocale ?? t), l = e.setLocale ?? ((t) => {
33
- if (o().toString() !== t.toString()) {
34
- if (!i?.map(String).includes(t)) {
35
- console.error(`Locale ${t} is not available`);
36
- return;
37
- }
38
- s(t), r(t, e.isCookieEnabled);
39
- }
40
- }), u = p(() => S(o()));
41
- return f(h(() => e.locale, (e) => {
42
- e && e !== v(o) && s(e);
43
- }, { defer: !0 })), _(() => {
44
- C();
45
- }), a(D.Provider, {
46
- value: {
47
- locale: u,
48
- setLocale: l
49
- },
50
- get children() {
51
- return e.children;
52
- }
53
- });
54
- }, A = (e) => a(k, s(e, { get children() {
55
- return [a(E, {}), o(() => e.children)];
56
- } })), j = (e, t) => {
57
- let { locale: n } = y(D) ?? {};
58
- return u(e, t ?? (typeof n == "function" ? n() : n));
59
- }, M = (e, n) => {
60
- let r = y(D) ?? {};
61
- return p(() => t(e, n ?? r?.locale?.()));
62
- }, N = async (e, t) => {
63
- let { locale: n } = y(D) ?? {}, r = c.defaultLocale, i = t ?? n() ?? r;
64
- return M(await e[i]?.(), i);
65
- }, P = (e, t, n) => {
66
- let { locale: r } = y(D) ?? {}, a = c.defaultLocale, o = n ?? r?.() ?? a;
67
- return M(i(`${String(t)}.${o}`, e[o]?.()), o);
68
- }, F = (t, n) => {
69
- let r = y(D) ?? {};
70
- return p(() => {
71
- let i = r?.locale();
72
- return e(t, n ?? i);
73
- });
74
- }, I = ({ isCookieEnabled: e, onLocaleChange: t } = {}) => {
75
- let { defaultLocale: n, locales: i } = c ?? {}, a = y(D) ?? {};
76
- return f(h(() => a?.locale?.(), (e) => {
77
- t && e !== void 0 && t(e);
78
- }, { defer: !0 })), {
79
- locale: a?.locale,
80
- defaultLocale: n,
81
- availableLocales: i,
82
- setLocale: (t) => {
83
- if (!i?.map(String).includes(t)) {
84
- console.error(`Locale ${t} is not available`);
85
- return;
86
- }
87
- a?.setLocale(t), r(t, e ?? a?.isCookieEnabled ?? !0);
88
- }
89
- };
90
- }, { defaultLocale: L, locales: R } = c, z = () => {
91
- let { locale: e, setLocale: t } = y(D) ?? {};
92
- return {
93
- locale: e,
94
- defaultLocale: L,
95
- availableLocales: R,
96
- setLocale: t
97
- };
98
- }, B = () => {
99
- let { locale: e } = I(), t = l?.rewrite;
100
- f(() => {
101
- if (typeof window > "u" || !t) return;
102
- let n = e(), r = window.location.pathname, i = x(r, n, t);
103
- i && i !== r && window.history.replaceState(window.history.state, "", i + window.location.search + window.location.hash);
104
- });
105
- };
106
- //#endregion
107
- export { P as a, j as c, k as d, O as f, F as i, D as l, T as m, z as n, N as o, E as p, I as r, M as s, B as t, A as u };
@@ -1 +0,0 @@
1
- require(`./plugins-JJ37BmVk.js`);const e=require(`./cjs/getIntlayer.cjs`),t=require(`./cjs/getDictionary.cjs`),n=require(`./cjs/client/useLocaleStorage.cjs`),r=require(`./cjs/client/useLoadDynamic.cjs`);let i=require(`solid-js/web`),a=require(`@intlayer/config/built`),o=require(`@intlayer/core/interpreter`),s=require(`solid-js`),c=require(`@intlayer/editor/isEnabled`),l=require(`@intlayer/core/localization`),u=require(`@intlayer/config/client`);var d=process.env.INTLAYER_EDITOR_ENABLED===`false`,f=()=>{if(d||!c.isEnabled)return;let{locale:e}=h(),[t,n]=(0,s.createSignal)(null);(0,s.onMount)(()=>{import(`@intlayer/editor`).then(({initEditorClient:e})=>{n(e())})}),(0,s.createEffect)(()=>{let n=t(),r=e();n&&r&&n.currentLocale.set(r)}),(0,s.onCleanup)(()=>{import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()})})},p=({children:e})=>(f(),e),m=(0,s.createContext)({locale:()=>n.localeInStorage??a.internationalization?.defaultLocale,setLocale:()=>null}),h=()=>(0,s.useContext)(m)??{},g=e=>{let{defaultLocale:t,locales:r}=a.internationalization??{},[o,c]=(0,s.createSignal)(e.locale??n.localeInStorage??e.defaultLocale??t),d=e.setLocale??(t=>{if(o().toString()!==t.toString()){if(!r?.map(String).includes(t)){console.error(`Locale ${t} is not available`);return}c(t),n.setLocaleInStorage(t,e.isCookieEnabled)}}),f=(0,s.createMemo)(()=>(0,l.localeResolver)(o()));return(0,s.createEffect)((0,s.on)(()=>e.locale,e=>{e&&e!==(0,s.untrack)(o)&&c(e)},{defer:!0})),(0,s.onMount)(()=>{(0,u.setIntlayerIdentifier)()}),(0,i.createComponent)(m.Provider,{value:{locale:f,setLocale:d},get children(){return e.children}})},_=e=>(0,i.createComponent)(g,(0,i.mergeProps)(e,{get children(){return[(0,i.createComponent)(p,{}),(0,i.memo)(()=>e.children)]}})),v=(e,t)=>{let{locale:n}=(0,s.useContext)(m)??{};return(0,o.getTranslation)(e,t??(typeof n==`function`?n():n))},y=(e,n)=>{let r=(0,s.useContext)(m)??{};return(0,s.createMemo)(()=>t.getDictionary(e,n??r?.locale?.()))},b=async(e,t)=>{let{locale:n}=(0,s.useContext)(m)??{},r=a.internationalization.defaultLocale,i=t??n()??r;return y(await e[i]?.(),i)},x=(e,t,n)=>{let{locale:i}=(0,s.useContext)(m)??{},o=a.internationalization.defaultLocale,c=n??i?.()??o;return y(r.useLoadDynamic(`${String(t)}.${c}`,e[c]?.()),c)},S=(t,n)=>{let r=(0,s.useContext)(m)??{};return(0,s.createMemo)(()=>{let i=r?.locale();return e.getIntlayer(t,n??i)})},C=({isCookieEnabled:e,onLocaleChange:t}={})=>{let{defaultLocale:r,locales:i}=a.internationalization??{},o=(0,s.useContext)(m)??{};return(0,s.createEffect)((0,s.on)(()=>o?.locale?.(),e=>{t&&e!==void 0&&t(e)},{defer:!0})),{locale:o?.locale,defaultLocale:r,availableLocales:i,setLocale:t=>{if(!i?.map(String).includes(t)){console.error(`Locale ${t} is not available`);return}o?.setLocale(t),n.setLocaleInStorage(t,e??o?.isCookieEnabled??!0)}}},{defaultLocale:w,locales:T}=a.internationalization,E=()=>{let{locale:e,setLocale:t}=(0,s.useContext)(m)??{};return{locale:e,defaultLocale:w,availableLocales:T,setLocale:t}},D=()=>{let{locale:e}=C(),t=a.routing?.rewrite;(0,s.createEffect)(()=>{if(typeof window>`u`||!t)return;let n=e(),r=window.location.pathname,i=(0,l.getRewritePath)(r,n,t);i&&i!==r&&window.history.replaceState(window.history.state,``,i+window.location.search+window.location.hash)})};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return _}});
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./cjs/editor/ContentSelector.cjs`),l=require(`./cjs/IntlayerNode.cjs`),u=require(`./cjs/solidElement/renderSolidElement.cjs`);let d=require(`solid-js/web`),f=require(`@intlayer/config/built`),p=require(`@intlayer/core/interpreter`),m=require(`@intlayer/core/markdown`),h=require(`@intlayer/types/nodeType`);h=s(h);let g=require(`solid-js`);var _=process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE===`false`,v=process.env.INTLAYER_NODE_TYPE_SOLID_NODE===`false`,y=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`,b=process.env.INTLAYER_NODE_TYPE_HTML===`false`,x=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`,S=process.env.INTLAYER_EDITOR_ENABLED===`false`,C=y?null:(0,g.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/markdown/MarkdownRenderer.cjs`)).then(e=>({default:e.MarkdownMetadataRenderer}))),w=y?null:(0,g.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/markdown/MarkdownRenderer.cjs`)).then(e=>({default:e.MarkdownRenderer}))),T=b?null:(0,g.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/html/HTMLRenderer.cjs`)).then(e=>({default:e.HTMLRenderer}))),E=_?p.fallbackPlugin:{id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{plugins:t,...n})=>l.renderIntlayerNode({...n,value:n.children,children:!S&&f.editor.enabled?(0,d.createComponent)(c.ContentSelector,(0,d.mergeProps)(n,{get children(){return n.children}})):n.children})},D=v?p.fallbackPlugin:{id:`solid-node-plugin`,canHandle:e=>typeof e==`object`&&e?.props!==void 0||typeof Node<`u`&&e instanceof Node,transform:(e,{plugins:t,...n})=>l.renderIntlayerNode({...n,value:`[[solid-element]]`,children:!S&&f.editor.enabled?(0,d.createComponent)(c.ContentSelector,(0,d.mergeProps)(n,{get children(){return typeof Node<`u`&&e instanceof Node?e:u.renderSolidElement(e)}})):typeof Node<`u`&&e instanceof Node?e:u.renderSolidElement(e)})},O=(e,t)=>{let n=(0,p.splitInsertionTemplate)(e,t);return n.isSimple,n.parts},k=x?p.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.INSERTION}],i=e[h.INSERTION];return e=>{let a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(n,r,i)=>{let a=O(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??[]]})}}},A=y?p.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,a=n((0,m.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>l.renderIntlayerNode({...n,value:t,children:!S&&f.editor.enabled?(0,d.createComponent)(c.ContentSelector,(0,d.mergeProps)(i,{get children(){return(0,d.createComponent)(g.Suspense,{fallback:e,get children(){return(0,d.createComponent)(C,(0,d.mergeProps)(i,{get metadataKeyPath(){return n.keyPath},children:e}))}})}})):(0,d.createComponent)(g.Suspense,{fallback:e,get children(){return(0,d.createComponent)(C,(0,d.mergeProps)(i,{get metadataKeyPath(){return n.keyPath},children:e}))}})})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),o=n=>l.renderIntlayerNode({...t,value:e,children:!S&&f.editor.enabled?(0,d.createComponent)(c.ContentSelector,(0,d.mergeProps)(i,{get children(){return(0,d.createComponent)(g.Suspense,{fallback:e,get children(){return(0,d.createComponent)(w,(0,d.mergeProps)(i,{components:n,children:e}))}})}})):(0,d.createComponent)(g.Suspense,{fallback:e,get children(){return(0,d.createComponent)(w,(0,d.mergeProps)(i,{components:n,children:e}))}}),additionalProps:{metadata:a}}),s=o();return new Proxy(s,{get(t,n,r){return n===`value`?e:n===`metadata`?a:n===`use`?e=>o(e):Reflect.get(t,n,r)}})}},j=y?p.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.MARKDOWN}],i=e[h.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[A,...t.plugins??[]]})}},M=b?p.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.HTML,transform:(e,t)=>{let n=e[h.HTML],{plugins:r,...i}=t,a=e=>l.renderIntlayerNode({...i,value:n,children:!S&&f.editor.enabled?(0,d.createComponent)(c.ContentSelector,(0,d.mergeProps)(i,{get children(){return(0,d.createComponent)(g.Suspense,{fallback:n,get children(){return(0,d.createComponent)(T,(0,d.mergeProps)(i,{html:n,components:e}))}})}})):(0,d.createComponent)(g.Suspense,{fallback:n,get children(){return(0,d.createComponent)(T,(0,d.mergeProps)(i,{html:n,components:e}))}})}),o=[a()];return new Proxy(o,{get(e,t,r){return t===`value`?n:t===`use`?e=>a(e):Reflect.get(e,t,r)}})}},N=new Map,P=(e,t=!0)=>{let n=`${e??f.internationalization.defaultLocale}_${t}`;if(N.has(n))return N.get(n);let r=[(0,p.translationPlugin)(e??f.internationalization.defaultLocale,t?f.internationalization.defaultLocale:void 0),p.enumerationPlugin,p.conditionPlugin,(0,p.nestedPlugin)(e??f.internationalization.defaultLocale),p.filePlugin,p.genderPlugin,E,D,k,j,M];return N.set(n,r),r};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return P}});