solid-intlayer 6.1.6 → 7.0.0-canary.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) 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/useDictionaryAsync.cjs +1 -1
  5. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
  6. package/dist/cjs/client/useLocale.cjs +1 -1
  7. package/dist/cjs/client/useLocaleStorage.cjs +1 -0
  8. package/dist/cjs/client/useTraduction.cjs +1 -1
  9. package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
  10. package/dist/cjs/editor/contexts/CommunicatorContext.cjs +1 -1
  11. package/dist/cjs/editor/contexts/EditedContentContext.cjs +1 -1
  12. package/dist/cjs/editor/contexts/useCrossFrameMessageListener.cjs +1 -1
  13. package/dist/cjs/index.cjs +1 -1
  14. package/dist/cjs/plugins.cjs +1 -1
  15. package/dist/cjs/solidElement/renderSolidElement.cjs +1 -1
  16. package/dist/esm/client/IntlayerProvider.mjs +9 -9
  17. package/dist/esm/client/getBrowserLocale.mjs +80 -84
  18. package/dist/esm/client/index.mjs +21 -18
  19. package/dist/esm/client/useDictionaryAsync.mjs +1 -1
  20. package/dist/esm/client/useDictionaryDynamic.mjs +2 -2
  21. package/dist/esm/client/useLocale.mjs +19 -13
  22. package/dist/esm/client/useLocaleStorage.mjs +25 -0
  23. package/dist/esm/client/useTraduction.mjs +10 -6
  24. package/dist/esm/editor/ContentSelectorWrapper.mjs +2 -2
  25. package/dist/esm/editor/contexts/CommunicatorContext.mjs +10 -10
  26. package/dist/esm/editor/contexts/EditedContentContext.mjs +92 -83
  27. package/dist/esm/editor/contexts/useCrossFrameMessageListener.mjs +8 -8
  28. package/dist/esm/getDictionary.mjs +1 -5
  29. package/dist/esm/index.mjs +26 -23
  30. package/dist/esm/plugins.mjs +25 -24
  31. package/dist/esm/solidElement/renderSolidElement.mjs +1 -1
  32. package/dist/types/IntlayerNode.d.ts +0 -1
  33. package/dist/types/UI/ContentSelector.d.ts +0 -1
  34. package/dist/types/client/IntlayerProvider.d.ts +3 -2
  35. package/dist/types/client/getBrowserLocale.d.ts +16 -12
  36. package/dist/types/client/index.d.ts +2 -3
  37. package/dist/types/client/t.d.ts +2 -4
  38. package/dist/types/client/useContent.d.ts +4 -5
  39. package/dist/types/client/useDictionary.d.ts +4 -4
  40. package/dist/types/client/useDictionaryAsync.d.ts +2 -4
  41. package/dist/types/client/useDictionaryDynamic.d.ts +2 -4
  42. package/dist/types/client/useIntlayer.d.ts +3 -5
  43. package/dist/types/client/useLoadDynamic.d.ts +0 -1
  44. package/dist/types/client/useLocale.d.ts +9 -8
  45. package/dist/types/client/useLocaleBase.d.ts +9 -7
  46. package/dist/types/client/useLocaleStorage.d.ts +39 -0
  47. package/dist/types/client/useTraduction.d.ts +2 -3
  48. package/dist/types/editor/ContentSelectorWrapper.d.ts +0 -1
  49. package/dist/types/editor/IntlayerEditorProvider.d.ts +0 -1
  50. package/dist/types/editor/contexts/CommunicatorContext.d.ts +0 -1
  51. package/dist/types/editor/contexts/ConfigurationContext.d.ts +1 -2
  52. package/dist/types/editor/contexts/DictionariesRecordContext.d.ts +1 -2
  53. package/dist/types/editor/contexts/EditedContentContext.d.ts +3 -4
  54. package/dist/types/editor/contexts/EditorEnabledContext.d.ts +0 -1
  55. package/dist/types/editor/contexts/EditorProvider.d.ts +0 -1
  56. package/dist/types/editor/contexts/FocusDictionaryContext.d.ts +1 -2
  57. package/dist/types/editor/contexts/index.d.ts +0 -1
  58. package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts +1 -2
  59. package/dist/types/editor/contexts/useCrossFrameState.d.ts +0 -1
  60. package/dist/types/editor/contexts/useCrossURLPathState.d.ts +0 -1
  61. package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts +0 -1
  62. package/dist/types/editor/index.d.ts +0 -1
  63. package/dist/types/editor/useEditedContentRenderer.d.ts +2 -4
  64. package/dist/types/getDictionary.d.ts +3 -4
  65. package/dist/types/getIntlayer.d.ts +3 -4
  66. package/dist/types/index.d.ts +3 -4
  67. package/dist/types/markdown/MarkdownProvider.d.ts +1 -2
  68. package/dist/types/markdown/MarkdownRenderer.d.ts +1 -3
  69. package/dist/types/markdown/index.d.ts +0 -1
  70. package/dist/types/plugins.d.ts +3 -3
  71. package/dist/types/solidElement/renderSolidElement.d.ts +0 -1
  72. package/package.json +44 -46
  73. package/LICENSE +0 -202
  74. package/dist/cjs/client/useLocaleCookie.cjs +0 -1
  75. package/dist/esm/client/useLocaleCookie.mjs +0 -19
  76. package/dist/types/IntlayerNode.d.ts.map +0 -1
  77. package/dist/types/UI/ContentSelector.d.ts.map +0 -1
  78. package/dist/types/client/IntlayerProvider.d.ts.map +0 -1
  79. package/dist/types/client/getBrowserLocale.d.ts.map +0 -1
  80. package/dist/types/client/index.d.ts.map +0 -1
  81. package/dist/types/client/t.d.ts.map +0 -1
  82. package/dist/types/client/useContent.d.ts.map +0 -1
  83. package/dist/types/client/useDictionary.d.ts.map +0 -1
  84. package/dist/types/client/useDictionaryAsync.d.ts.map +0 -1
  85. package/dist/types/client/useDictionaryDynamic.d.ts.map +0 -1
  86. package/dist/types/client/useIntlayer.d.ts.map +0 -1
  87. package/dist/types/client/useLoadDynamic.d.ts.map +0 -1
  88. package/dist/types/client/useLocale.d.ts.map +0 -1
  89. package/dist/types/client/useLocaleBase.d.ts.map +0 -1
  90. package/dist/types/client/useLocaleCookie.d.ts +0 -17
  91. package/dist/types/client/useLocaleCookie.d.ts.map +0 -1
  92. package/dist/types/client/useTraduction.d.ts.map +0 -1
  93. package/dist/types/editor/ContentSelectorWrapper.d.ts.map +0 -1
  94. package/dist/types/editor/IntlayerEditorProvider.d.ts.map +0 -1
  95. package/dist/types/editor/contexts/CommunicatorContext.d.ts.map +0 -1
  96. package/dist/types/editor/contexts/ConfigurationContext.d.ts.map +0 -1
  97. package/dist/types/editor/contexts/DictionariesRecordContext.d.ts.map +0 -1
  98. package/dist/types/editor/contexts/EditedContentContext.d.ts.map +0 -1
  99. package/dist/types/editor/contexts/EditorEnabledContext.d.ts.map +0 -1
  100. package/dist/types/editor/contexts/EditorProvider.d.ts.map +0 -1
  101. package/dist/types/editor/contexts/FocusDictionaryContext.d.ts.map +0 -1
  102. package/dist/types/editor/contexts/index.d.ts.map +0 -1
  103. package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts.map +0 -1
  104. package/dist/types/editor/contexts/useCrossFrameState.d.ts.map +0 -1
  105. package/dist/types/editor/contexts/useCrossURLPathState.d.ts.map +0 -1
  106. package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts.map +0 -1
  107. package/dist/types/editor/index.d.ts.map +0 -1
  108. package/dist/types/editor/useEditedContentRenderer.d.ts.map +0 -1
  109. package/dist/types/getDictionary.d.ts.map +0 -1
  110. package/dist/types/getIntlayer.d.ts.map +0 -1
  111. package/dist/types/index.d.ts.map +0 -1
  112. package/dist/types/markdown/MarkdownProvider.d.ts.map +0 -1
  113. package/dist/types/markdown/MarkdownRenderer.d.ts.map +0 -1
  114. package/dist/types/markdown/index.d.ts.map +0 -1
  115. package/dist/types/plugins.d.ts.map +0 -1
  116. package/dist/types/solidElement/renderSolidElement.d.ts.map +0 -1
@@ -1,143 +1,152 @@
1
- import { getContentNodeByKeyPath as m, renameContentNodeByKeyPath as k, editDictionaryByKeyPath as B } from "@intlayer/core";
2
- import { MessageKey as f } from "@intlayer/editor";
1
+ import { getContentNodeByKeyPath as E, renameContentNodeByKeyPath as k, editDictionaryByKeyPath as B } from "@intlayer/core";
2
+ import { MessageKey as m } from "@intlayer/editor";
3
3
  import { createContext as h, useContext as T, createComponent as g } from "solid-js";
4
4
  import { useDictionariesRecord as H } from "./DictionariesRecordContext.mjs";
5
5
  import { useCrossFrameMessageListener as _ } from "./useCrossFrameMessageListener.mjs";
6
- import { useCrossFrameState as Y } from "./useCrossFrameState.mjs";
7
- const x = h(void 0), J = (c) => _(`${f.INTLAYER_EDITED_CONTENT_CHANGED}/post`, c), Q = (c) => _(`${f.INTLAYER_EDITED_CONTENT_CHANGED}/get`, c), A = h(void 0), U = (c) => {
6
+ import { useCrossFrameState as W } from "./useCrossFrameState.mjs";
7
+ const x = h(void 0), J = (C) => _(`${m.INTLAYER_EDITED_CONTENT_CHANGED}/post`, C), Q = (C) => _(`${m.INTLAYER_EDITED_CONTENT_CHANGED}/get`, C), A = h(void 0), U = (C) => {
8
8
  const {
9
- localeDictionaries: r
10
- } = H(), [D, s] = Y(f.INTLAYER_EDITED_CONTENT_CHANGED), p = (t) => {
9
+ localeDictionaries: u
10
+ } = H(), [N, c] = W(m.INTLAYER_EDITED_CONTENT_CHANGED), p = (t) => {
11
11
  if (typeof t == "function")
12
- s((e) => {
13
- const n = e?.[Object.keys(e || {})[0]], o = t(n);
12
+ c((n) => {
13
+ const e = n?.[Object.keys(n || {})[0]], s = t(e);
14
14
  return {
15
- ...e,
16
- [o.key]: o
15
+ ...n,
16
+ [s.key]: s
17
17
  };
18
18
  });
19
19
  else {
20
- const e = t;
21
- s((n) => ({
22
- ...n,
23
- [e.key]: e
20
+ const n = t;
21
+ c((e) => ({
22
+ ...e,
23
+ [n.key]: n
24
24
  }));
25
25
  }
26
- }, P = (t, e) => {
27
- s((n) => ({
28
- ...n,
26
+ }, I = (t, n) => {
27
+ c((e) => ({
28
+ ...e,
29
29
  [t]: {
30
- ...n?.[t],
31
- content: e
30
+ ...e?.[t],
31
+ content: n
32
32
  }
33
33
  }));
34
- }, I = (t, e, n = [], o = !0) => {
35
- s((d) => {
36
- const C = r[t]?.content, u = structuredClone(d?.[t]?.content ?? C);
37
- let i = n;
38
- if (!o) {
39
- let l = 0;
40
- const b = n.slice(0, -1), a = n[n.length - 1];
41
- let N = a.key;
42
- for (; typeof m(u, i) < "u"; )
43
- l++, N = l === 0 ? a.key : `${a.key} (${l})`, i = [...b, {
44
- ...a,
45
- key: N
34
+ }, P = (t, n, e = [], s = !0) => {
35
+ c((i) => {
36
+ const o = u[t]?.content, d = structuredClone(i?.[t]?.content ?? o);
37
+ let r = e;
38
+ if (!s) {
39
+ let f = 0;
40
+ const j = e.slice(0, -1), l = e[e.length - 1];
41
+ let D = l.key;
42
+ for (; typeof E(d, r) < "u"; )
43
+ f++, D = f === 0 ? l.key : `${l.key} (${f})`, r = [...j, {
44
+ ...l,
45
+ key: D
46
46
  }];
47
47
  }
48
- const E = B(u, i, e);
48
+ const a = B(d, r, n);
49
49
  return {
50
- ...d,
50
+ ...i,
51
51
  [t]: {
52
- ...d?.[t],
53
- content: E
52
+ ...i?.[t],
53
+ content: a
54
54
  }
55
55
  };
56
56
  });
57
- }, w = (t, e, n = []) => {
58
- s((o) => {
59
- const d = r[t]?.content, C = structuredClone(o?.[t]?.content ?? d), u = k(C, e, n);
57
+ }, w = (t, n, e = []) => {
58
+ c((s) => {
59
+ const i = u[t]?.content, o = structuredClone(s?.[t]?.content ?? i), d = k(o, n, e);
60
60
  return {
61
- ...o,
61
+ ...s,
62
62
  [t]: {
63
- ...o?.[t],
64
- content: u
63
+ ...s?.[t],
64
+ content: d
65
65
  }
66
66
  };
67
67
  });
68
- }, S = (t, e) => {
69
- s((n) => {
70
- const o = r[t]?.content, d = structuredClone(n?.[t]?.content ?? o), C = structuredClone(d), u = e.slice(0, -1), i = e[e.length - 1]?.key;
71
- if (i) {
72
- const E = m(C, u);
73
- E && typeof E == "object" && i in E && delete E[i];
68
+ }, L = (t, n) => {
69
+ c((e) => {
70
+ const s = u[t]?.content, i = structuredClone(e?.[t]?.content ?? s), o = structuredClone(i), d = n.slice(0, -1), r = n[n.length - 1]?.key;
71
+ if (r) {
72
+ const a = E(o, d);
73
+ a && typeof a == "object" && r in a && delete a[r];
74
74
  }
75
75
  return {
76
- ...n,
76
+ ...e,
77
77
  [t]: {
78
- ...n?.[t],
79
- content: C
78
+ ...e?.[t],
79
+ content: o
80
80
  }
81
81
  };
82
82
  });
83
- }, F = (t) => {
84
- s((e) => {
85
- const n = {
86
- ...e
83
+ }, S = (t) => {
84
+ c((n) => {
85
+ const e = {
86
+ ...n
87
87
  };
88
- return delete n[t], n;
88
+ return delete e[t], e;
89
89
  });
90
- }, G = (t) => {
91
- s((e) => ({
92
- ...e,
90
+ }, $ = (t) => {
91
+ c((n) => ({
92
+ ...n,
93
93
  [t]: {
94
- ...e?.[t],
94
+ ...n?.[t],
95
95
  content: {}
96
96
  }
97
97
  }));
98
- }, L = () => {
99
- s({});
100
- }, O = (t, e) => {
101
- const n = r[t]?.content, o = D()?.[t]?.content ?? n;
102
- return m(o, e);
98
+ }, b = () => {
99
+ c({});
100
+ }, F = (t, n) => {
101
+ const e = N();
102
+ if (!e) return;
103
+ if (t.includes(":local:") || t.includes(":remote:")) {
104
+ const o = e?.[t]?.content ?? {};
105
+ return E(o, n);
106
+ }
107
+ const i = Object.keys(e).filter((o) => o.startsWith(`${t}:`));
108
+ for (const o of i) {
109
+ const d = e?.[o]?.content ?? {}, r = E(d, n);
110
+ if (r) return r;
111
+ }
112
+ }, G = {
113
+ editedContent: N()
103
114
  }, R = {
104
- editedContent: D()
105
- }, $ = {
106
- setEditedContentState: s,
115
+ setEditedContentState: c,
107
116
  setEditedDictionary: p,
108
- setEditedContent: P,
109
- addEditedContent: I,
117
+ setEditedContent: I,
118
+ addEditedContent: P,
110
119
  renameEditedContent: w,
111
- removeEditedContent: S,
112
- restoreEditedContent: F,
113
- clearEditedDictionaryContent: G,
114
- clearEditedContent: L,
115
- getEditedContentValue: O
120
+ removeEditedContent: L,
121
+ restoreEditedContent: S,
122
+ clearEditedDictionaryContent: $,
123
+ clearEditedContent: b,
124
+ getEditedContentValue: F
116
125
  };
117
126
  return g(x.Provider, {
118
- value: R,
127
+ value: G,
119
128
  get children() {
120
129
  return g(A.Provider, {
121
- value: $,
130
+ value: R,
122
131
  get children() {
123
- return c.children;
132
+ return C.children;
124
133
  }
125
134
  });
126
135
  }
127
136
  });
128
- }, j = () => T(A), X = () => {
129
- const c = j(), r = T(x);
130
- if (!r)
137
+ }, Y = () => T(A), X = () => {
138
+ const C = Y(), u = T(x);
139
+ if (!u)
131
140
  throw new Error("useEditedContent must be used within a EditedContentProvider");
132
141
  return {
133
- ...r,
134
- ...c
142
+ ...u,
143
+ ...C
135
144
  };
136
145
  };
137
146
  export {
138
147
  U as EditedContentProvider,
139
148
  X as useEditedContent,
140
- j as useEditedContentActions,
149
+ Y as useEditedContentActions,
141
150
  Q as useGetEditedContentState,
142
151
  J as usePostEditedContentState
143
152
  };
@@ -1,15 +1,15 @@
1
1
  import { compareUrls as c } from "@intlayer/editor";
2
2
  import { onMount as f, onCleanup as g } from "solid-js";
3
3
  import { useCommunicator as w } from "./CommunicatorContext.mjs";
4
- const v = (r, o, l) => {
5
- const t = w();
6
- if (!t)
4
+ const h = (r, o) => {
5
+ const n = w();
6
+ if (!n)
7
7
  throw new Error("useCrossFrameMessageListener must be used within a CommunicatorProvider");
8
8
  const {
9
9
  allowedOrigins: s,
10
10
  postMessage: i,
11
- senderId: n
12
- } = t;
11
+ senderId: t
12
+ } = n;
13
13
  return f(() => {
14
14
  if (o) {
15
15
  const e = (a) => {
@@ -18,7 +18,7 @@ const v = (r, o, l) => {
18
18
  data: d,
19
19
  senderId: p
20
20
  } = a.data;
21
- m === r && p !== n && (typeof s > "u" || s?.some((u) => c(u, a.origin)) || s?.includes("*")) && o(d);
21
+ m === r && p !== t && (typeof s > "u" || s?.some((u) => c(u, a.origin)) || s?.includes("*")) && o(d);
22
22
  };
23
23
  window.addEventListener("message", e), g(() => window.removeEventListener("message", e));
24
24
  }
@@ -26,10 +26,10 @@ const v = (r, o, l) => {
26
26
  i({
27
27
  type: r,
28
28
  data: e,
29
- senderId: n
29
+ senderId: t
30
30
  });
31
31
  };
32
32
  };
33
33
  export {
34
- v as useCrossFrameMessageListener
34
+ h as useCrossFrameMessageListener
35
35
  };
@@ -7,11 +7,7 @@ const c = (i, o, t) => {
7
7
  s,
8
8
  ...t ?? []
9
9
  ];
10
- return r(
11
- i,
12
- o,
13
- n
14
- );
10
+ return r(i, o, n);
15
11
  };
16
12
  export {
17
13
  c as getDictionary
@@ -1,15 +1,15 @@
1
1
  import { getBrowserLocale as s } from "./client/getBrowserLocale.mjs";
2
- import { IntlayerClientContext as f, IntlayerProvider as y, IntlayerProviderContent as u, useIntlayerContext as C } from "./client/IntlayerProvider.mjs";
3
- import { t as d } from "./client/t.mjs";
4
- import { useDictionary as I } from "./client/useDictionary.mjs";
5
- import { useDictionaryAsync as v } from "./client/useDictionaryAsync.mjs";
6
- import { useDictionaryDynamic as w } from "./client/useDictionaryDynamic.mjs";
7
- import { useIntlayer as g } from "./client/useIntlayer.mjs";
8
- import { useLoadDynamic as M } from "./client/useLoadDynamic.mjs";
9
- import { useLocale as h } from "./client/useLocale.mjs";
10
- import { useLocaleBase as q } from "./client/useLocaleBase.mjs";
11
- import { localeCookie as E, setLocaleCookie as F, useLocaleCookie as G } from "./client/useLocaleCookie.mjs";
12
- import { MarkdownProvider as J } from "./markdown/MarkdownProvider.mjs";
2
+ import { IntlayerClientContext as f, IntlayerProvider as y, IntlayerProviderContent as u, useIntlayerContext as L } from "./client/IntlayerProvider.mjs";
3
+ import { t as I } from "./client/t.mjs";
4
+ import { useDictionary as D } from "./client/useDictionary.mjs";
5
+ import { useDictionaryAsync as k } from "./client/useDictionaryAsync.mjs";
6
+ import { useDictionaryDynamic as P } from "./client/useDictionaryDynamic.mjs";
7
+ import { useIntlayer as w } from "./client/useIntlayer.mjs";
8
+ import { useLoadDynamic as A } from "./client/useLoadDynamic.mjs";
9
+ import { useLocale as b } from "./client/useLocale.mjs";
10
+ import { useLocaleBase as j } from "./client/useLocaleBase.mjs";
11
+ import { localeCookie as z, localeInStorage as E, setLocaleCookie as F, setLocaleInStorage as G, useLocaleCookie as H, useLocaleStorage as J } from "./client/useLocaleStorage.mjs";
12
+ import { MarkdownProvider as N } from "./markdown/MarkdownProvider.mjs";
13
13
  import "@intlayer/core";
14
14
  import "@intlayer/editor";
15
15
  import "./editor/contexts/ConfigurationContext.mjs";
@@ -23,18 +23,21 @@ export {
23
23
  f as IntlayerClientContext,
24
24
  y as IntlayerProvider,
25
25
  u as IntlayerProviderContent,
26
- J as MarkdownProvider,
26
+ N as MarkdownProvider,
27
27
  s as getBrowserLocale,
28
- E as localeCookie,
28
+ z as localeCookie,
29
+ E as localeInStorage,
29
30
  F as setLocaleCookie,
30
- d as t,
31
- I as useDictionary,
32
- v as useDictionaryAsync,
33
- w as useDictionaryDynamic,
34
- g as useIntlayer,
35
- C as useIntlayerContext,
36
- M as useLoadDynamic,
37
- h as useLocale,
38
- q as useLocaleBase,
39
- G as useLocaleCookie
31
+ G as setLocaleInStorage,
32
+ I as t,
33
+ D as useDictionary,
34
+ k as useDictionaryAsync,
35
+ P as useDictionaryDynamic,
36
+ w as useIntlayer,
37
+ L as useIntlayerContext,
38
+ A as useLoadDynamic,
39
+ b as useLocale,
40
+ j as useLocaleBase,
41
+ H as useLocaleCookie,
42
+ J as useLocaleStorage
40
43
  };
@@ -1,22 +1,23 @@
1
- import { getMarkdownMetadata as p, NodeType as u } from "@intlayer/core";
2
- import { renderIntlayerNode as d } from "./IntlayerNode.mjs";
3
- import { ContentSelectorRenderer as l } from "./editor/ContentSelectorWrapper.mjs";
1
+ import { getMarkdownMetadata as p } from "@intlayer/core";
2
+ import { NodeType as u } from "@intlayer/types";
3
+ import { ContentSelectorRenderer as d } from "./editor/ContentSelectorWrapper.mjs";
4
4
  import { EditedContentRenderer as y } from "./editor/useEditedContentRenderer.mjs";
5
+ import { renderIntlayerNode as l } from "./IntlayerNode.mjs";
5
6
  import "./markdown/MarkdownProvider.mjs";
6
7
  import { MarkdownRenderer as f, MarkdownMetadataRenderer as h } from "./markdown/MarkdownRenderer.mjs";
7
8
  import { renderSolidElement as k } from "./solidElement/renderSolidElement.mjs";
8
9
  import { createComponent as o, mergeProps as i } from "solid-js";
9
- const C = {
10
+ const E = {
10
11
  id: "intlayer-node-plugin",
11
12
  canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
12
13
  transform: (e, {
13
14
  plugins: t,
14
15
  // Removed to avoid next error - Functions cannot be passed directly to Client Components
15
16
  ...n
16
- }) => d({
17
+ }) => l({
17
18
  ...n,
18
19
  value: n.children,
19
- children: o(l, i(n, {
20
+ children: o(d, i(n, {
20
21
  get children() {
21
22
  return o(y, i(n, {
22
23
  get children() {
@@ -26,17 +27,17 @@ const C = {
26
27
  }
27
28
  }))
28
29
  })
29
- }, E = {
30
+ }, j = {
30
31
  id: "solid-node-plugin",
31
32
  canHandle: (e) => typeof e == "object" && typeof e.props < "u",
32
33
  transform: (e, {
33
34
  plugins: t,
34
35
  // Removed to avoid next error - Functions cannot be passed directly to Client Components
35
36
  ...n
36
- }) => d({
37
+ }) => l({
37
38
  ...n,
38
39
  value: "[[solid-element]]",
39
- children: o(l, i(n, {
40
+ children: o(d, i(n, {
40
41
  get children() {
41
42
  return k(e);
42
43
  }
@@ -47,21 +48,21 @@ const C = {
47
48
  canHandle: (e) => typeof e == "string",
48
49
  transform: (e, t, n) => {
49
50
  const {
50
- plugins: c,
51
+ plugins: m,
51
52
  // Removed to avoid next error - Functions cannot be passed directly to Client Components
52
53
  ...r
53
54
  } = t, s = p(e), g = n(s, {
54
55
  plugins: [{
55
56
  id: "markdown-metadata-plugin",
56
57
  canHandle: (a) => typeof a == "string" || typeof a == "number" || typeof a == "boolean" || !a,
57
- transform: (a, m) => d({
58
- ...m,
58
+ transform: (a, c) => l({
59
+ ...c,
59
60
  value: a,
60
- children: o(l, i(r, {
61
+ children: o(d, i(r, {
61
62
  get children() {
62
63
  return o(h, i(r, {
63
64
  get metadataKeyPath() {
64
- return m.keyPath;
65
+ return c.keyPath;
65
66
  },
66
67
  children: e
67
68
  }));
@@ -72,10 +73,10 @@ const C = {
72
73
  dictionaryKey: r.dictionaryKey,
73
74
  keyPath: []
74
75
  });
75
- return d({
76
+ return l({
76
77
  ...t,
77
78
  value: e,
78
- children: o(l, i(r, {
79
+ children: o(d, i(r, {
79
80
  get children() {
80
81
  return o(f, i(r, {
81
82
  children: e
@@ -87,21 +88,21 @@ const C = {
87
88
  }
88
89
  });
89
90
  }
90
- }, j = {
91
+ }, T = {
91
92
  id: "markdown-plugin",
92
93
  canHandle: (e) => typeof e == "object" && e?.nodeType === u.Markdown,
93
94
  transform: (e, t, n) => {
94
- const c = [...t.keyPath, {
95
+ const m = [...t.keyPath, {
95
96
  type: u.Markdown
96
97
  }], r = e[u.Markdown];
97
98
  return n(r, {
98
99
  ...t,
99
100
  children: r,
100
- keyPath: c,
101
+ keyPath: m,
101
102
  plugins: [P, ...t.plugins ?? []]
102
103
  });
103
104
  }
104
- }, T = {
105
+ }, x = {
105
106
  translation: !0,
106
107
  enumeration: !0,
107
108
  condition: !0,
@@ -112,9 +113,9 @@ const C = {
112
113
  markdown: !0
113
114
  };
114
115
  export {
115
- T as interpreterPluginsEnabledState,
116
- C as intlayerNodePlugins,
117
- j as markdownPlugin,
116
+ x as interpreterPluginsEnabledState,
117
+ E as intlayerNodePlugins,
118
+ T as markdownPlugin,
118
119
  P as markdownStringPlugin,
119
- E as solidNodePlugins
120
+ j as solidNodePlugins
120
121
  };
@@ -7,7 +7,7 @@ const h = (o) => {
7
7
  const s = [], { children: c } = r.props;
8
8
  return Object.keys(c ?? {}).forEach((t) => {
9
9
  s.push(
10
- h((c ?? {})[t])
10
+ h(c?.[t])
11
11
  );
12
12
  }), {
13
13
  ...r,
@@ -12,4 +12,3 @@ type RenderIntlayerNodeProps<T> = ParentProps<{
12
12
  }>;
13
13
  export declare const renderIntlayerNode: <T extends number | string | boolean | undefined | null>({ children, value, additionalProps, }: RenderIntlayerNodeProps<T>) => IntlayerNode<T>;
14
14
  export {};
15
- //# sourceMappingURL=IntlayerNode.d.ts.map
@@ -9,4 +9,3 @@ type ContentSelectorProps = {
9
9
  } & JSX.HTMLAttributes<HTMLDivElement>;
10
10
  export declare const ContentSelector: Component<ContentSelectorProps>;
11
11
  export {};
12
- //# sourceMappingURL=ContentSelector.d.ts.map
@@ -1,9 +1,10 @@
1
- import { LocalesValues } from '@intlayer/config/client';
1
+ import { LocalesValues } from '@intlayer/types';
2
2
  import { Component, ParentProps } from 'solid-js';
3
3
  type IntlayerValue = {
4
4
  locale: () => LocalesValues;
5
5
  setLocale: (newLocale: LocalesValues) => void;
6
6
  disableEditor?: boolean;
7
+ isCookieEnabled?: boolean;
7
8
  };
8
9
  /**
9
10
  * Context that store the current locale on the client side
@@ -18,6 +19,7 @@ export type IntlayerProviderProps = ParentProps<{
18
19
  defaultLocale?: LocalesValues;
19
20
  setLocale?: (locale: LocalesValues) => void;
20
21
  disableEditor?: boolean;
22
+ isCookieEnabled?: boolean;
21
23
  }>;
22
24
  /**
23
25
  * Provider that store the current locale on the client side
@@ -25,4 +27,3 @@ export type IntlayerProviderProps = ParentProps<{
25
27
  export declare const IntlayerProviderContent: Component<IntlayerProviderProps>;
26
28
  export declare const IntlayerProvider: Component<IntlayerProviderProps>;
27
29
  export {};
28
- //# sourceMappingURL=IntlayerProvider.d.ts.map
@@ -1,25 +1,29 @@
1
- import { Locales } from '@intlayer/config/client';
1
+ import { Locale } from '@intlayer/types';
2
2
  export declare enum LanguageDetector {
3
3
  Querystring = "querystring",
4
- Cookie = "cookie",
5
- LocalStorage = "localStorage",
6
- SessionStorage = "sessionStorage",
4
+ Storage = "storage",
7
5
  Navigator = "navigator",
8
6
  HtmlTag = "htmlTag"
9
7
  }
10
8
  type LanguageDetectorOptions = {
11
9
  order?: LanguageDetector[];
12
10
  lookupQuerystring?: string;
13
- lookupCookie?: string;
14
- lookupLocalStorage?: string;
15
- lookupSessionStorage?: string;
16
- excludeCacheFor?: string[];
17
11
  htmlTag?: HTMLElement | null;
18
12
  };
19
13
  /**
20
- * Core language detector function
21
- * const detectedLanguages = detectLanguage(['LanguageDetector.Cookie', 'LanguageDetector.LocalStorage'], { lookupCookie: 'myCookie' });
14
+ * Core language detector function for browser environments.
15
+ *
16
+ * Detects the user's preferred locale by checking multiple sources in order:
17
+ * 1. Query string parameter
18
+ * 2. Storage (cookies, localStorage, sessionStorage) - uses getLocaleFromStorage
19
+ * 3. Navigator languages - uses localeDetector
20
+ * 4. HTML lang attribute - uses localeDetector
21
+ *
22
+ * @param userOptions - Optional configuration for detection order and lookup keys
23
+ * @returns The detected locale or the default locale
24
+ *
25
+ * @example
26
+ * const locale = getBrowserLocale({ order: [LanguageDetector.Storage, LanguageDetector.Navigator] });
22
27
  */
23
- export declare const getBrowserLocale: (userOptions?: LanguageDetectorOptions | undefined) => Locales;
28
+ export declare const getBrowserLocale: (userOptions?: LanguageDetectorOptions | undefined) => Locale;
24
29
  export {};
25
- //# sourceMappingURL=getBrowserLocale.d.ts.map
@@ -1,5 +1,5 @@
1
1
  export { getBrowserLocale } from './getBrowserLocale';
2
- export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, useIntlayerContext, type IntlayerProviderProps, } from './IntlayerProvider';
2
+ export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, useIntlayerContext, } from './IntlayerProvider';
3
3
  export { t } from './t';
4
4
  export { useDictionary } from './useDictionary';
5
5
  export { useDictionaryAsync } from './useDictionaryAsync';
@@ -8,5 +8,4 @@ export { useIntlayer } from './useIntlayer';
8
8
  export { useLoadDynamic } from './useLoadDynamic';
9
9
  export { useLocale } from './useLocale';
10
10
  export { useLocaleBase } from './useLocaleBase';
11
- export { localeCookie, setLocaleCookie, useLocaleCookie, } from './useLocaleCookie';
12
- //# sourceMappingURL=index.d.ts.map
11
+ export { localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage, } from './useLocaleStorage';
@@ -1,9 +1,7 @@
1
- import { Locales } from '@intlayer/config/client';
2
- import { LanguageContent } from '@intlayer/core';
1
+ import { LocalesValues, StrictModeLocaleMap } from '@intlayer/types';
3
2
  /**
4
3
  * On the client side, this function returns the translation of the provided multilang content.
5
4
  *
6
5
  * If the locale is not provided, it will use the locale from the client context
7
6
  */
8
- export declare const t: <Content = string>(multilangContent: LanguageContent<Content>, locale?: Locales) => Content;
9
- //# sourceMappingURL=t.d.ts.map
7
+ export declare const t: <Content = string>(multilangContent: StrictModeLocaleMap<Content>, locale?: LocalesValues) => Content;
@@ -1,10 +1,9 @@
1
- import { LanguageContent } from '@intlayer/core';
1
+ import { StrictModeLocaleMap } from '@intlayer/types';
2
2
  /**
3
3
  * On the client side, hook to get the translation content based on the locale
4
4
  */
5
- export declare const useContent: <Content>(languageContent: LanguageContent<Content>) => {
6
- locale: () => import('intlayer').LocalesValues;
5
+ export declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
6
+ locale: import('intlayer').Locale;
7
7
  content: Content;
8
- t: <Content_1 = string>(languageContent: LanguageContent<Content_1>) => Content_1;
8
+ t: <Content_1 = string>(languageContent: StrictModeLocaleMap<Content_1>) => Content_1;
9
9
  };
10
- //# sourceMappingURL=useContent.d.ts.map
@@ -1,9 +1,9 @@
1
- import { LocalesValues } from '@intlayer/config/client';
2
- import { Dictionary } from '@intlayer/core';
1
+ import { DeclaredLocales, Dictionary, LocalesValues } from '@intlayer/types';
2
+ import { Accessor } from 'solid-js';
3
+ import { DeepTransformContent } from '../plugins';
3
4
  /**
4
5
  * On the client side, Hook that transform a dictionary and return the content
5
6
  *
6
7
  * If the locale is not provided, it will use the locale from the client context
7
8
  */
8
- export declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?: LocalesValues) => import('solid-js').Accessor<import('@intlayer/core').DeepTransformContent<T["content"], import('../plugins').IInterpreterPluginState>>;
9
- //# sourceMappingURL=useDictionary.d.ts.map
9
+ export declare const useDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => Accessor<DeepTransformContent<T["content"], L>>;
@@ -1,9 +1,7 @@
1
- import { LocalesValues } from '@intlayer/config/client';
2
- import { Dictionary, LanguageContent } from '@intlayer/core';
1
+ import { DeclaredLocales, Dictionary, LocalesValues, StrictModeLocaleMap } from '@intlayer/types';
3
2
  /**
4
3
  * On the server side, Hook that transform a dictionary and return the content
5
4
  *
6
5
  * If the locale is not provided, it will use the locale from the client context
7
6
  */
8
- export declare const useDictionaryAsync: <T extends Dictionary>(dictionaryPromise: LanguageContent<() => Promise<T>>, locale?: LocalesValues) => Promise<import('solid-js').Accessor<import('@intlayer/core').DeepTransformContent<T["content"], import('../plugins').IInterpreterPluginState>>>;
9
- //# sourceMappingURL=useDictionaryAsync.d.ts.map
7
+ export declare const useDictionaryAsync: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: L) => Promise<import('solid-js').Accessor<import('@intlayer/core').DeepTransformContent<T["content"], import('../plugins').IInterpreterPluginState, L>>>;