solid-intlayer 5.5.10 → 5.5.11

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 (192) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/IntlayerNode.cjs +1 -0
  3. package/dist/cjs/UI/ContentSelector.cjs +1 -0
  4. package/dist/cjs/client/IntlayerProvider.cjs +1 -0
  5. package/dist/cjs/client/getBrowserLocale.cjs +1 -0
  6. package/dist/cjs/client/index.cjs +1 -29
  7. package/dist/cjs/client/t.cjs +1 -0
  8. package/dist/cjs/client/useContent.cjs +1 -0
  9. package/dist/cjs/client/useDictionary.cjs +1 -41
  10. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -0
  11. package/dist/cjs/client/useIntlayer.cjs +1 -44
  12. package/dist/cjs/client/useIntlayerAsync.cjs +1 -0
  13. package/dist/cjs/client/useLoadDynamic.cjs +1 -0
  14. package/dist/cjs/client/useLocale.cjs +1 -33
  15. package/dist/cjs/client/useLocaleBase.cjs +1 -0
  16. package/dist/cjs/client/useLocaleCookie.cjs +1 -0
  17. package/dist/cjs/client/useTraduction.cjs +1 -0
  18. package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -0
  19. package/dist/cjs/editor/IntlayerEditorProvider.cjs +1 -0
  20. package/dist/cjs/editor/contexts/ChangedContentContext.cjs +1 -0
  21. package/dist/cjs/editor/contexts/CommunicatorContext.cjs +1 -0
  22. package/dist/cjs/editor/contexts/ConfigurationContext.cjs +1 -0
  23. package/dist/cjs/editor/contexts/DictionariesRecordContext.cjs +1 -0
  24. package/dist/cjs/editor/contexts/EditedContentContext.cjs +1 -0
  25. package/dist/cjs/editor/contexts/EditorEnabledContext.cjs +1 -0
  26. package/dist/cjs/editor/contexts/EditorProvider.cjs +1 -0
  27. package/dist/cjs/editor/contexts/FocusDictionaryContext.cjs +1 -0
  28. package/dist/cjs/editor/contexts/index.cjs +1 -0
  29. package/dist/cjs/editor/contexts/useCrossFrameMessageListener.cjs +1 -0
  30. package/dist/cjs/editor/contexts/useCrossFrameState.cjs +1 -0
  31. package/dist/cjs/editor/contexts/useCrossURLPathState.cjs +1 -0
  32. package/dist/cjs/editor/contexts/useIframeClickInterceptor.cjs +1 -0
  33. package/dist/cjs/editor/index.cjs +1 -0
  34. package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -0
  35. package/dist/cjs/getDictionary.cjs +1 -42
  36. package/dist/cjs/getIntlayer.cjs +1 -38
  37. package/dist/cjs/index.cjs +1 -31
  38. package/dist/cjs/markdown/MarkdownProvider.cjs +1 -0
  39. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -0
  40. package/dist/cjs/markdown/index.cjs +1 -36
  41. package/dist/cjs/plugins.cjs +1 -53
  42. package/dist/cjs/solidElement/renderSolidElement.cjs +1 -0
  43. package/dist/esm/IntlayerNode.mjs +17 -0
  44. package/dist/esm/UI/ContentSelector.mjs +58 -0
  45. package/dist/esm/client/IntlayerProvider.mjs +69 -0
  46. package/dist/esm/client/getBrowserLocale.mjs +100 -0
  47. package/dist/esm/client/index.mjs +29 -5
  48. package/dist/esm/client/t.mjs +10 -0
  49. package/dist/esm/client/useContent.mjs +13 -0
  50. package/dist/esm/client/useDictionary.mjs +18 -13
  51. package/dist/esm/client/useDictionaryDynamic.mjs +14 -0
  52. package/dist/esm/client/useIntlayer.mjs +18 -15
  53. package/dist/esm/client/useIntlayerAsync.mjs +15 -0
  54. package/dist/esm/client/useLoadDynamic.mjs +21 -0
  55. package/dist/esm/client/useLocale.mjs +29 -6
  56. package/dist/esm/client/useLocaleBase.mjs +19 -0
  57. package/dist/esm/client/useLocaleCookie.mjs +19 -0
  58. package/dist/esm/client/useTraduction.mjs +10 -0
  59. package/dist/esm/editor/ContentSelectorWrapper.mjs +52 -0
  60. package/dist/esm/editor/IntlayerEditorProvider.mjs +64 -0
  61. package/dist/esm/editor/contexts/ChangedContentContext.mjs +39 -0
  62. package/dist/esm/editor/contexts/CommunicatorContext.mjs +30 -0
  63. package/dist/esm/editor/contexts/ConfigurationContext.mjs +19 -0
  64. package/dist/esm/editor/contexts/DictionariesRecordContext.mjs +44 -0
  65. package/dist/esm/editor/contexts/EditedContentContext.mjs +147 -0
  66. package/dist/esm/editor/contexts/EditorEnabledContext.mjs +27 -0
  67. package/dist/esm/editor/contexts/EditorProvider.mjs +85 -0
  68. package/dist/esm/editor/contexts/FocusDictionaryContext.mjs +47 -0
  69. package/dist/esm/editor/contexts/index.mjs +43 -0
  70. package/dist/esm/editor/contexts/useCrossFrameMessageListener.mjs +35 -0
  71. package/dist/esm/editor/contexts/useCrossFrameState.mjs +57 -0
  72. package/dist/esm/editor/contexts/useCrossURLPathState.mjs +25 -0
  73. package/dist/esm/editor/contexts/useIframeClickInterceptor.mjs +18 -0
  74. package/dist/esm/editor/index.mjs +4 -0
  75. package/dist/esm/editor/useEditedContentRenderer.mjs +29 -0
  76. package/dist/esm/getDictionary.mjs +13 -18
  77. package/dist/esm/getIntlayer.mjs +10 -15
  78. package/dist/esm/index.mjs +41 -6
  79. package/dist/esm/markdown/MarkdownProvider.mjs +24 -0
  80. package/dist/esm/markdown/MarkdownRenderer.mjs +31 -0
  81. package/dist/esm/markdown/index.mjs +7 -10
  82. package/dist/esm/plugins.mjs +113 -20
  83. package/dist/esm/solidElement/renderSolidElement.mjs +31 -0
  84. package/dist/types/IntlayerNode.d.ts +15 -0
  85. package/dist/types/IntlayerNode.d.ts.map +1 -0
  86. package/dist/types/UI/ContentSelector.d.ts +11 -0
  87. package/dist/types/UI/ContentSelector.d.ts.map +1 -0
  88. package/dist/types/client/IntlayerProvider.d.ts +28 -0
  89. package/dist/types/client/IntlayerProvider.d.ts.map +1 -0
  90. package/dist/types/client/getBrowserLocale.d.ts +25 -0
  91. package/dist/types/client/getBrowserLocale.d.ts.map +1 -0
  92. package/dist/types/client/index.d.ts +11 -4
  93. package/dist/types/client/index.d.ts.map +1 -1
  94. package/dist/types/client/t.d.ts +9 -0
  95. package/dist/types/client/t.d.ts.map +1 -0
  96. package/dist/types/client/useContent.d.ts +10 -0
  97. package/dist/types/client/useContent.d.ts.map +1 -0
  98. package/dist/types/client/useDictionary.d.ts +7 -2
  99. package/dist/types/client/useDictionary.d.ts.map +1 -1
  100. package/dist/types/client/useDictionaryDynamic.d.ts +9 -0
  101. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -0
  102. package/dist/types/client/useIntlayer.d.ts +9 -6
  103. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  104. package/dist/types/client/useIntlayerAsync.d.ts +15 -0
  105. package/dist/types/client/useIntlayerAsync.d.ts.map +1 -0
  106. package/dist/types/client/useLoadDynamic.d.ts +2 -0
  107. package/dist/types/client/useLoadDynamic.d.ts.map +1 -0
  108. package/dist/types/client/useLocale.d.ts +14 -3
  109. package/dist/types/client/useLocale.d.ts.map +1 -1
  110. package/dist/types/client/useLocaleBase.d.ts +10 -0
  111. package/dist/types/client/useLocaleBase.d.ts.map +1 -0
  112. package/dist/types/client/useLocaleCookie.d.ts +17 -0
  113. package/dist/types/client/useLocaleCookie.d.ts.map +1 -0
  114. package/dist/types/client/useTraduction.d.ts +24 -0
  115. package/dist/types/client/useTraduction.d.ts.map +1 -0
  116. package/dist/types/editor/ContentSelectorWrapper.d.ts +7 -0
  117. package/dist/types/editor/ContentSelectorWrapper.d.ts.map +1 -0
  118. package/dist/types/editor/IntlayerEditorProvider.d.ts +3 -0
  119. package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -0
  120. package/dist/types/editor/contexts/ChangedContentContext.d.ts +13 -0
  121. package/dist/types/editor/contexts/ChangedContentContext.d.ts.map +1 -0
  122. package/dist/types/editor/contexts/CommunicatorContext.d.ts +10 -0
  123. package/dist/types/editor/contexts/CommunicatorContext.d.ts.map +1 -0
  124. package/dist/types/editor/contexts/ConfigurationContext.d.ts +9 -0
  125. package/dist/types/editor/contexts/ConfigurationContext.d.ts.map +1 -0
  126. package/dist/types/editor/contexts/DictionariesRecordContext.d.ts +16 -0
  127. package/dist/types/editor/contexts/DictionariesRecordContext.d.ts.map +1 -0
  128. package/dist/types/editor/contexts/EditedContentContext.d.ts +33 -0
  129. package/dist/types/editor/contexts/EditedContentContext.d.ts.map +1 -0
  130. package/dist/types/editor/contexts/EditorEnabledContext.d.ts +11 -0
  131. package/dist/types/editor/contexts/EditorEnabledContext.d.ts.map +1 -0
  132. package/dist/types/editor/contexts/EditorProvider.d.ts +6 -0
  133. package/dist/types/editor/contexts/EditorProvider.d.ts.map +1 -0
  134. package/dist/types/editor/contexts/FocusDictionaryContext.d.ts +21 -0
  135. package/dist/types/editor/contexts/FocusDictionaryContext.d.ts.map +1 -0
  136. package/dist/types/editor/contexts/index.d.ts +13 -0
  137. package/dist/types/editor/contexts/index.d.ts.map +1 -0
  138. package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts +19 -0
  139. package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts.map +1 -0
  140. package/dist/types/editor/contexts/useCrossFrameState.d.ts +29 -0
  141. package/dist/types/editor/contexts/useCrossFrameState.d.ts.map +1 -0
  142. package/dist/types/editor/contexts/useCrossURLPathState.d.ts +4 -0
  143. package/dist/types/editor/contexts/useCrossURLPathState.d.ts.map +1 -0
  144. package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts +9 -0
  145. package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts.map +1 -0
  146. package/dist/types/editor/index.d.ts +2 -0
  147. package/dist/types/editor/index.d.ts.map +1 -0
  148. package/dist/types/editor/useEditedContentRenderer.d.ts +13 -0
  149. package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -0
  150. package/dist/types/getDictionary.d.ts +1 -1
  151. package/dist/types/getDictionary.d.ts.map +1 -1
  152. package/dist/types/getIntlayer.d.ts +1 -1
  153. package/dist/types/getIntlayer.d.ts.map +1 -1
  154. package/dist/types/index.d.ts +3 -5
  155. package/dist/types/index.d.ts.map +1 -1
  156. package/dist/types/markdown/MarkdownProvider.d.ts +12 -0
  157. package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -0
  158. package/dist/types/markdown/MarkdownRenderer.d.ts +16 -0
  159. package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -0
  160. package/dist/types/markdown/index.d.ts +2 -3
  161. package/dist/types/markdown/index.d.ts.map +1 -1
  162. package/dist/types/plugins.d.ts +49 -23
  163. package/dist/types/plugins.d.ts.map +1 -1
  164. package/dist/types/solidElement/renderSolidElement.d.ts +3 -0
  165. package/dist/types/solidElement/renderSolidElement.d.ts.map +1 -0
  166. package/dist/web-BFg6-54-.mjs +443 -0
  167. package/dist/web-qH6jV2Kc.js +1 -0
  168. package/package.json +24 -18
  169. package/dist/cjs/client/index.cjs.map +0 -1
  170. package/dist/cjs/client/installIntlayer.cjs +0 -53
  171. package/dist/cjs/client/installIntlayer.cjs.map +0 -1
  172. package/dist/cjs/client/useDictionary.cjs.map +0 -1
  173. package/dist/cjs/client/useIntlayer.cjs.map +0 -1
  174. package/dist/cjs/client/useLocale.cjs.map +0 -1
  175. package/dist/cjs/getDictionary.cjs.map +0 -1
  176. package/dist/cjs/getIntlayer.cjs.map +0 -1
  177. package/dist/cjs/index.cjs.map +0 -1
  178. package/dist/cjs/markdown/index.cjs.map +0 -1
  179. package/dist/cjs/plugins.cjs.map +0 -1
  180. package/dist/esm/client/index.mjs.map +0 -1
  181. package/dist/esm/client/installIntlayer.mjs +0 -26
  182. package/dist/esm/client/installIntlayer.mjs.map +0 -1
  183. package/dist/esm/client/useDictionary.mjs.map +0 -1
  184. package/dist/esm/client/useIntlayer.mjs.map +0 -1
  185. package/dist/esm/client/useLocale.mjs.map +0 -1
  186. package/dist/esm/getDictionary.mjs.map +0 -1
  187. package/dist/esm/getIntlayer.mjs.map +0 -1
  188. package/dist/esm/index.mjs.map +0 -1
  189. package/dist/esm/markdown/index.mjs.map +0 -1
  190. package/dist/esm/plugins.mjs.map +0 -1
  191. package/dist/types/client/installIntlayer.d.ts +0 -11
  192. package/dist/types/client/installIntlayer.d.ts.map +0 -1
@@ -0,0 +1,58 @@
1
+ import { d as T, t as k, s as L, i as y, u as C } from "../../web-BFg6-54-.mjs";
2
+ import { createSignal as m, createEffect as P, onCleanup as w, mergeProps as D } from "solid-js";
3
+ var O = /* @__PURE__ */ k("<span role=button tabindex=0>");
4
+ const _ = 250, x = (t) => {
5
+ let s;
6
+ const [f, a] = m(!1), [u, r] = m(t.isSelecting);
7
+ let o = null;
8
+ const h = typeof t.children == "string", v = () => {
9
+ r(!0), t.onPress();
10
+ }, $ = () => {
11
+ o = setTimeout(() => {
12
+ v();
13
+ }, t.pressDuration ?? _);
14
+ }, l = () => {
15
+ o && (clearTimeout(o), o = null);
16
+ }, c = () => {
17
+ l(), $();
18
+ }, g = () => {
19
+ a(!0);
20
+ }, i = () => {
21
+ a(!1), l();
22
+ }, d = (e) => {
23
+ var n;
24
+ s && !s.contains(e.target) && (r(!1), (n = t.onClickOutside) == null || n.call(t));
25
+ };
26
+ P(() => {
27
+ document.addEventListener("mousedown", d), w(() => {
28
+ document.removeEventListener("mousedown", d), l();
29
+ });
30
+ });
31
+ const E = (e) => {
32
+ u() && (e.preventDefault(), e.stopPropagation());
33
+ }, S = () => {
34
+ r(!1);
35
+ };
36
+ return (() => {
37
+ var e = O(), n = s;
38
+ return typeof n == "function" ? C(n, e) : s = e, e.addEventListener("mouseenter", g), e.addEventListener("blur", S), e.addEventListener("touchcancel", i), e.$$touchend = i, e.$$touchstart = c, e.addEventListener("mouseleave", i), e.$$mouseup = i, e.$$mousedown = c, e.$$click = E, e.$$keyup = () => null, L(e, D({
39
+ get style() {
40
+ return {
41
+ display: h ? "inline" : "inline-block",
42
+ cursor: "pointer",
43
+ "user-select": "none",
44
+ "border-radius": "0.375rem",
45
+ "outline-width": "2px",
46
+ "outline-offset": "4px",
47
+ "outline-style": "solid",
48
+ "outline-color": t.isSelecting || u() || f() ? "inherit" : "transparent",
49
+ transition: "all 100ms 50ms ease-in-out"
50
+ };
51
+ }
52
+ }, t), !1, !0), y(e, () => t.children), e;
53
+ })();
54
+ };
55
+ T(["keyup", "click", "mousedown", "mouseup", "touchstart", "touchend"]);
56
+ export {
57
+ x as ContentSelector
58
+ };
@@ -0,0 +1,69 @@
1
+ import f from "@intlayer/config/built";
2
+ import { localeResolver as v } from "@intlayer/core";
3
+ import { createContext as w, createComponent as i, useContext as I, createSignal as A, createEffect as d } from "solid-js";
4
+ import { IntlayerEditorProvider as x } from "../editor/IntlayerEditorProvider.mjs";
5
+ import { localeCookie as u, setLocaleCookie as h } from "./useLocaleCookie.mjs";
6
+ const L = w({
7
+ locale: () => {
8
+ var e, n;
9
+ return u ?? ((n = (e = f) == null ? void 0 : e.internationalization) == null ? void 0 : n.defaultLocale);
10
+ },
11
+ setLocale: () => null,
12
+ disableEditor: !1
13
+ }), k = () => I(L), N = (e) => {
14
+ const {
15
+ internationalization: n
16
+ } = f ?? {}, {
17
+ defaultLocale: m,
18
+ locales: o
19
+ } = n ?? {}, C = e.locale ?? u ?? e.defaultLocale ?? m, [r, l] = A(C);
20
+ d(() => {
21
+ if (typeof window < "u") {
22
+ const t = (a) => {
23
+ var c;
24
+ if (((c = a.data) == null ? void 0 : c.type) === "INTLAYER_LOCALE_CHANGE") {
25
+ const s = a.data.locale;
26
+ o != null && o.includes(s) && l(s);
27
+ }
28
+ };
29
+ return window.addEventListener("message", t), () => window.removeEventListener("message", t);
30
+ }
31
+ }), d(() => {
32
+ const t = r();
33
+ typeof window < "u" && window.postMessage({
34
+ type: "INTLAYER_LOCALE_CHANGE",
35
+ locale: t
36
+ }, "*");
37
+ });
38
+ const g = (t) => {
39
+ if (r().toString() !== t.toString()) {
40
+ if (!(o != null && o.map(String).includes(t))) {
41
+ console.error(`Locale ${t} is not available`);
42
+ return;
43
+ }
44
+ l(t), h(t);
45
+ }
46
+ }, E = e.setLocale ?? g, y = () => v(e.locale ?? r());
47
+ return i(L.Provider, {
48
+ get value() {
49
+ return {
50
+ locale: y,
51
+ setLocale: E,
52
+ disableEditor: e.disableEditor
53
+ };
54
+ },
55
+ get children() {
56
+ return e.children;
57
+ }
58
+ });
59
+ }, z = (e) => i(x, {
60
+ get children() {
61
+ return i(N, e);
62
+ }
63
+ });
64
+ export {
65
+ L as IntlayerClientContext,
66
+ z as IntlayerProvider,
67
+ N as IntlayerProviderContent,
68
+ k as useIntlayerContext
69
+ };
@@ -0,0 +1,100 @@
1
+ import u from "@intlayer/config/built";
2
+ import { Locales as f } from "@intlayer/config/client";
3
+ var d = /* @__PURE__ */ ((o) => (o.Querystring = "querystring", o.Cookie = "cookie", o.LocalStorage = "localStorage", o.SessionStorage = "sessionStorage", o.Navigator = "navigator", o.HtmlTag = "htmlTag", o))(d || {});
4
+ const m = () => {
5
+ const {
6
+ middleware: o
7
+ } = u;
8
+ return {
9
+ order: [
10
+ "querystring",
11
+ "cookie",
12
+ "navigator",
13
+ "htmlTag"
14
+ /* HtmlTag */
15
+ ],
16
+ lookupQuerystring: "locale",
17
+ lookupCookie: o == null ? void 0 : o.cookieName,
18
+ htmlTag: document.documentElement
19
+ };
20
+ }, S = () => {
21
+ try {
22
+ if (typeof window > "u") return !1;
23
+ const o = "intlayer.translate.boo";
24
+ return window.localStorage.setItem(o, "foo"), window.localStorage.removeItem(o), !0;
25
+ } catch {
26
+ return !1;
27
+ }
28
+ }, y = () => {
29
+ try {
30
+ if (typeof window > "u") return !1;
31
+ const o = "intlayer.translate.boo";
32
+ return window.sessionStorage.setItem(o, "foo"), window.sessionStorage.removeItem(o), !0;
33
+ } catch {
34
+ return !1;
35
+ }
36
+ }, w = (o, r) => {
37
+ const e = {}, c = {
38
+ querystring: () => {
39
+ if (typeof window > "u") return;
40
+ const t = window.location.search || "", a = new URLSearchParams(t).get(r.lookupQuerystring ?? "");
41
+ a && (e.querystring = a);
42
+ },
43
+ cookie: () => {
44
+ if (typeof document > "u") return;
45
+ const t = document.cookie.split(";"), n = `${r.lookupCookie ?? ""}=`, a = t.find((i) => i.trim().startsWith(n));
46
+ if (a) {
47
+ const i = a.split("=")[1].trim();
48
+ e.cookie = i;
49
+ }
50
+ },
51
+ localStorage: () => {
52
+ if (!S()) return;
53
+ const t = window.localStorage.getItem(r.lookupLocalStorage ?? "");
54
+ t && (e.localStorage = t);
55
+ },
56
+ sessionStorage: () => {
57
+ if (!y()) return;
58
+ const t = window.sessionStorage.getItem(r.lookupSessionStorage ?? "");
59
+ t && (e.sessionStorage = t);
60
+ },
61
+ navigator: () => {
62
+ typeof navigator > "u" || navigator.language && (e.navigator = navigator.language);
63
+ },
64
+ htmlTag: () => {
65
+ const t = r.htmlTag;
66
+ if (t && typeof t.getAttribute == "function") {
67
+ const n = t.getAttribute("lang");
68
+ n && (e.htmlTag = n);
69
+ }
70
+ }
71
+ };
72
+ return o.forEach((t) => {
73
+ var n;
74
+ (n = c[t]) == null || n.call(c);
75
+ }), e;
76
+ }, k = (o, r) => {
77
+ const {
78
+ internationalization: e
79
+ } = u;
80
+ for (const l of r) {
81
+ const g = [o[l]].flat();
82
+ for (const s of g) {
83
+ if (s && (e == null ? void 0 : e.locales).includes(s))
84
+ return s;
85
+ if (s != null && s.includes("-") && (e == null ? void 0 : e.locales).includes(s.split("-")[0]))
86
+ return s.split("-")[0];
87
+ }
88
+ }
89
+ return (e == null ? void 0 : e.defaultLocale) ?? f.ENGLISH;
90
+ }, b = (o = {}) => {
91
+ const r = {
92
+ ...m(),
93
+ ...o
94
+ }, e = w(r.order ?? [], r);
95
+ return k(e, r.order ?? []);
96
+ };
97
+ export {
98
+ d as LanguageDetector,
99
+ b as getBrowserLocale
100
+ };
@@ -1,5 +1,29 @@
1
- export * from "./installIntlayer.mjs";
2
- export * from "./useDictionary.mjs";
3
- export * from "./useIntlayer.mjs";
4
- export * from "./useLocale.mjs";
5
- //# sourceMappingURL=index.mjs.map
1
+ import { getBrowserLocale as r } from "./getBrowserLocale.mjs";
2
+ import { IntlayerClientContext as a, IntlayerProvider as n, IntlayerProviderContent as l, useIntlayerContext as m } from "./IntlayerProvider.mjs";
3
+ import { t as x } from "./t.mjs";
4
+ import { useDictionary as c } from "./useDictionary.mjs";
5
+ import { useDictionaryDynamic as p } from "./useDictionaryDynamic.mjs";
6
+ import { useIntlayer as u } from "./useIntlayer.mjs";
7
+ import { useIntlayerAsync as I } from "./useIntlayerAsync.mjs";
8
+ import { useLoadDynamic as D } from "./useLoadDynamic.mjs";
9
+ import { useLocale as k } from "./useLocale.mjs";
10
+ import { useLocaleBase as B } from "./useLocaleBase.mjs";
11
+ import { localeCookie as g, setLocaleCookie as w, useLocaleCookie as A } from "./useLocaleCookie.mjs";
12
+ export {
13
+ a as IntlayerClientContext,
14
+ n as IntlayerProvider,
15
+ l as IntlayerProviderContent,
16
+ r as getBrowserLocale,
17
+ g as localeCookie,
18
+ w as setLocaleCookie,
19
+ x as t,
20
+ c as useDictionary,
21
+ p as useDictionaryDynamic,
22
+ u as useIntlayer,
23
+ I as useIntlayerAsync,
24
+ m as useIntlayerContext,
25
+ D as useLoadDynamic,
26
+ k as useLocale,
27
+ B as useLocaleBase,
28
+ A as useLocaleCookie
29
+ };
@@ -0,0 +1,10 @@
1
+ import { getTranslation as n } from "@intlayer/core";
2
+ import { useContext as c } from "solid-js";
3
+ import { IntlayerClientContext as l } from "./IntlayerProvider.mjs";
4
+ const f = (o, e) => {
5
+ const { locale: t } = c(l), r = e ?? (typeof t == "function" ? t() : t);
6
+ return n(o, r);
7
+ };
8
+ export {
9
+ f as t
10
+ };
@@ -0,0 +1,13 @@
1
+ import { useLocaleBase as r } from "./useLocaleBase.mjs";
2
+ import { useTranslation as o } from "./useTraduction.mjs";
3
+ const a = (t) => {
4
+ const { locale: e } = r(), n = o(t);
5
+ return {
6
+ locale: e,
7
+ content: n,
8
+ t: o
9
+ };
10
+ };
11
+ export {
12
+ a as useContent
13
+ };
@@ -1,17 +1,22 @@
1
- import { createEffect, createMemo, createSignal } from "solid-js";
2
- import { getDictionary } from "../getDictionary.mjs";
3
- import { useIntlayerContext } from "./installIntlayer.mjs";
4
- const useDictionary = (dictionary, locale) => {
5
- const intlayer = useIntlayerContext();
6
- const localeTarget = createMemo(() => locale ?? intlayer.locale());
7
- const [content, setContent] = createSignal({});
8
- createEffect(() => {
9
- const next = getDictionary(dictionary, localeTarget());
10
- setContent(next);
1
+ import { useContext as s, createMemo as l } from "solid-js";
2
+ import "@intlayer/editor";
3
+ import { useChangedContent as u } from "../editor/contexts/ChangedContentContext.mjs";
4
+ import "../editor/contexts/ConfigurationContext.mjs";
5
+ import "../editor/contexts/DictionariesRecordContext.mjs";
6
+ import "../editor/contexts/EditedContentContext.mjs";
7
+ import "../editor/contexts/EditorEnabledContext.mjs";
8
+ import "../editor/contexts/CommunicatorContext.mjs";
9
+ import "../editor/contexts/FocusDictionaryContext.mjs";
10
+ import { getDictionary as i } from "../getDictionary.mjs";
11
+ import { IntlayerClientContext as f } from "./IntlayerProvider.mjs";
12
+ const g = (t, p) => {
13
+ const o = s(f), { changedContent: r } = u();
14
+ return l(() => {
15
+ var e;
16
+ const m = p ?? ((e = o == null ? void 0 : o.locale) == null ? void 0 : e.call(o));
17
+ return r != null && r[t.key] ? i(r == null ? void 0 : r[t.key], m) : i(t, m);
11
18
  });
12
- return content();
13
19
  };
14
20
  export {
15
- useDictionary
21
+ g as useDictionary
16
22
  };
17
- //# sourceMappingURL=useDictionary.mjs.map
@@ -0,0 +1,14 @@
1
+ import { useContext as c } from "solid-js";
2
+ import { IntlayerClientContext as a } from "./IntlayerProvider.mjs";
3
+ import { useDictionary as m } from "./useDictionary.mjs";
4
+ import { useLoadDynamic as s } from "./useLoadDynamic.mjs";
5
+ const f = (t, r, n) => {
6
+ const { locale: e } = c(a), o = n ?? e(), i = s(
7
+ `${String(r)}.${o}`,
8
+ t[o]()
9
+ );
10
+ return m(i, o);
11
+ };
12
+ export {
13
+ f as useDictionaryDynamic
14
+ };
@@ -1,19 +1,22 @@
1
- import { createEffect, createMemo, createSignal } from "solid-js";
2
- import { getIntlayer } from "../getIntlayer.mjs";
3
- import { useIntlayerContext } from "./installIntlayer.mjs";
4
- const isUpdatableNode = (val) => !!val && typeof val === "object" && typeof val.__update === "function";
5
- const useIntlayer = (key, locale) => {
6
- const intlayer = useIntlayerContext();
7
- const localeTarget = createMemo(() => locale ?? intlayer.locale());
8
- const [content, setContent] = createSignal({});
9
- createEffect(() => {
10
- const next = getIntlayer(key, localeTarget());
11
- setContent(next);
1
+ import { useContext as p, createMemo as l } from "solid-js";
2
+ import "@intlayer/editor";
3
+ import { useChangedContent as n } from "../editor/contexts/ChangedContentContext.mjs";
4
+ import "../editor/contexts/ConfigurationContext.mjs";
5
+ import "../editor/contexts/DictionariesRecordContext.mjs";
6
+ import "../editor/contexts/EditedContentContext.mjs";
7
+ import "../editor/contexts/EditorEnabledContext.mjs";
8
+ import "../editor/contexts/CommunicatorContext.mjs";
9
+ import "../editor/contexts/FocusDictionaryContext.mjs";
10
+ import { getDictionary as s } from "../getDictionary.mjs";
11
+ import { getIntlayer as a } from "../getIntlayer.mjs";
12
+ import { IntlayerClientContext as c } from "./IntlayerProvider.mjs";
13
+ const j = (t, e) => {
14
+ const o = p(c), { changedContent: r } = n();
15
+ return l(() => {
16
+ const i = o == null ? void 0 : o.locale(), m = e ?? i;
17
+ return r != null && r[t] ? s(r == null ? void 0 : r[t], m) : a(t, m);
12
18
  });
13
- return content();
14
19
  };
15
20
  export {
16
- isUpdatableNode,
17
- useIntlayer
21
+ j as useIntlayer
18
22
  };
19
- //# sourceMappingURL=useIntlayer.mjs.map
@@ -0,0 +1,15 @@
1
+ import { getIntlayer as g, getIntlayerAsync as m } from "@intlayer/core";
2
+ import { useContext as u, createSignal as e, onMount as f, createMemo as d } from "solid-js";
3
+ import { IntlayerClientContext as I } from "./IntlayerProvider.mjs";
4
+ const C = (t, a) => {
5
+ const { locale: r } = u(I), i = a ?? r(), c = g(t, i), [s, l] = e(null), [y, n] = e(!1);
6
+ return f(() => {
7
+ n(!0), m(t).then((o) => o && l(o)).finally(() => n(!1));
8
+ }), {
9
+ ...d(() => s() ?? c)(),
10
+ isLoading: y()
11
+ };
12
+ };
13
+ export {
14
+ C as useIntlayerAsync
15
+ };
@@ -0,0 +1,21 @@
1
+ const o = (r) => {
2
+ let e = "pending", t;
3
+ const c = r.then(
4
+ (n) => {
5
+ e = "success", t = n;
6
+ },
7
+ (n) => {
8
+ e = "error", t = n;
9
+ }
10
+ );
11
+ return {
12
+ read() {
13
+ if (e === "pending") throw c;
14
+ if (e === "error") throw t;
15
+ return t;
16
+ }
17
+ };
18
+ }, s = /* @__PURE__ */ new Map(), a = (r, e) => (s.has(r) || s.set(r, o(e)), s.get(r).read());
19
+ export {
20
+ a as useLoadDynamic
21
+ };
@@ -1,9 +1,32 @@
1
- import { useIntlayerContext } from "./installIntlayer.mjs";
2
- const useLocale = () => {
3
- const intlayer = useIntlayerContext();
4
- return [intlayer.locale, intlayer.setLocale];
1
+ import l from "@intlayer/config/built";
2
+ import { useContext as m, createEffect as u } from "solid-js";
3
+ import { IntlayerClientContext as n } from "./IntlayerProvider.mjs";
4
+ import { useLocaleCookie as p } from "./useLocaleCookie.mjs";
5
+ const z = ({ onLocaleChange: o } = {}) => {
6
+ var e;
7
+ const { defaultLocale: s, locales: i } = ((e = l) == null ? void 0 : e.internationalization) ?? {}, r = m(n), { setLocaleCookie: f } = p(), c = (t) => {
8
+ if (!(i != null && i.map(String).includes(t))) {
9
+ console.error(`Locale ${t} is not available`);
10
+ return;
11
+ }
12
+ r == null || r.setLocale(t), f(t), o == null || o(t);
13
+ };
14
+ return u(() => {
15
+ if (o && (r != null && r.locale)) {
16
+ const t = r.locale();
17
+ o(t);
18
+ }
19
+ }), {
20
+ locale: r == null ? void 0 : r.locale,
21
+ // Current locale (signal accessor)
22
+ defaultLocale: s,
23
+ // Principal locale defined in config
24
+ availableLocales: i,
25
+ // List of the available locales defined in config
26
+ setLocale: c
27
+ // Function to set the locale
28
+ };
5
29
  };
6
30
  export {
7
- useLocale
31
+ z as useLocale
8
32
  };
9
- //# sourceMappingURL=useLocale.mjs.map
@@ -0,0 +1,19 @@
1
+ import e from "@intlayer/config/built";
2
+ import { useContext as a } from "solid-js";
3
+ import { IntlayerClientContext as l } from "./IntlayerProvider.mjs";
4
+ const { defaultLocale: n, locales: r } = e.internationalization, m = () => {
5
+ const { locale: o, setLocale: t } = a(l);
6
+ return {
7
+ locale: o,
8
+ // Current locale
9
+ defaultLocale: n,
10
+ // Principal locale defined in config
11
+ availableLocales: r,
12
+ // List of the available locales defined in config
13
+ setLocale: t
14
+ // Function to set the locale
15
+ };
16
+ };
17
+ export {
18
+ m as useLocaleBase
19
+ };
@@ -0,0 +1,19 @@
1
+ import i from "@intlayer/config/built";
2
+ import o from "js-cookie";
3
+ const { cookieName: e } = i.middleware, s = {
4
+ path: "/",
5
+ expires: void 0,
6
+ domain: void 0,
7
+ secure: !1,
8
+ sameSite: "strict"
9
+ }, c = o.get(e), r = (t) => {
10
+ o.set(e, t, s);
11
+ }, n = () => ({
12
+ localeCookie: c,
13
+ setLocaleCookie: r
14
+ });
15
+ export {
16
+ c as localeCookie,
17
+ r as setLocaleCookie,
18
+ n as useLocaleCookie
19
+ };
@@ -0,0 +1,10 @@
1
+ import { getTranslation as r } from "@intlayer/core";
2
+ import { useContext as n } from "solid-js";
3
+ import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
4
+ const m = (t) => {
5
+ const { locale: o } = n(e);
6
+ return r(t, o());
7
+ };
8
+ export {
9
+ m as useTranslation
10
+ };
@@ -0,0 +1,52 @@
1
+ import { isSameKeyPath as c } from "@intlayer/core";
2
+ import { createComponent as o, mergeProps as a, createMemo as l } from "solid-js";
3
+ import "@intlayer/config/built";
4
+ import "@intlayer/config/client";
5
+ import { useIntlayerContext as y } from "../client/IntlayerProvider.mjs";
6
+ import "@intlayer/editor";
7
+ import "./contexts/ChangedContentContext.mjs";
8
+ import "./contexts/ConfigurationContext.mjs";
9
+ import "./contexts/DictionariesRecordContext.mjs";
10
+ import "./contexts/EditedContentContext.mjs";
11
+ import { useEditorEnabled as d } from "./contexts/EditorEnabledContext.mjs";
12
+ import "./contexts/CommunicatorContext.mjs";
13
+ import { useFocusDictionary as h } from "./contexts/FocusDictionaryContext.mjs";
14
+ import "../markdown/MarkdownProvider.mjs";
15
+ import "../client/useLocaleCookie.mjs";
16
+ import "../client/useLocaleBase.mjs";
17
+ import { ContentSelector as p } from "../UI/ContentSelector.mjs";
18
+ const s = (t) => {
19
+ const {
20
+ focusedContent: e,
21
+ setFocusedContent: r
22
+ } = h(), n = () => r({
23
+ dictionaryKey: t.dictionaryKey,
24
+ keyPath: t.keyPath
25
+ }), m = l(() => {
26
+ var i;
27
+ return ((e == null ? void 0 : e.dictionaryKey) === t.dictionaryKey && (((i = e == null ? void 0 : e.keyPath) == null ? void 0 : i.length) ?? 0) > 0 && c((e == null ? void 0 : e.keyPath) ?? [], t.keyPath)) ?? !1;
28
+ });
29
+ return o(p, {
30
+ onPress: n,
31
+ get isSelecting() {
32
+ return m();
33
+ },
34
+ get children() {
35
+ return t.children;
36
+ }
37
+ });
38
+ }, j = (t) => {
39
+ const {
40
+ enabled: e
41
+ } = d(), {
42
+ disableEditor: r
43
+ } = y();
44
+ return e() && !r ? o(s, a(t, {
45
+ get children() {
46
+ return t.children;
47
+ }
48
+ })) : t.children;
49
+ };
50
+ export {
51
+ j as ContentSelectorRenderer
52
+ };
@@ -0,0 +1,64 @@
1
+ import { m as p } from "../../web-BFg6-54-.mjs";
2
+ import { IntlayerEventListener as a } from "@intlayer/api";
3
+ import m from "@intlayer/config/built";
4
+ import { createComponent as i, onMount as c, onCleanup as l } from "solid-js";
5
+ import "@intlayer/editor";
6
+ import { useChangedContentActions as f } from "./contexts/ChangedContentContext.mjs";
7
+ import "./contexts/ConfigurationContext.mjs";
8
+ import "./contexts/DictionariesRecordContext.mjs";
9
+ import "./contexts/EditedContentContext.mjs";
10
+ import { useEditorEnabled as u } from "./contexts/EditorEnabledContext.mjs";
11
+ import { EditorProvider as d } from "./contexts/EditorProvider.mjs";
12
+ import "./contexts/FocusDictionaryContext.mjs";
13
+ import "./contexts/CommunicatorContext.mjs";
14
+ import { useCrossURLPathSetter as g } from "./contexts/useCrossURLPathState.mjs";
15
+ import { useIframeClickInterceptor as w } from "./contexts/useIframeClickInterceptor.mjs";
16
+ const I = () => (g(), w(), []), {
17
+ editor: e
18
+ } = m, L = () => {
19
+ const {
20
+ enabled: n
21
+ } = u(), r = f();
22
+ return c(() => {
23
+ if (!e.hotReload || !e.clientId || !e.clientSecret) return;
24
+ const o = new a();
25
+ try {
26
+ o.initialize().then(() => {
27
+ o.onDictionaryChange = (t) => r == null ? void 0 : r.setChangedContent(t.key, t.content);
28
+ });
29
+ } catch (t) {
30
+ console.error("Error initializing IntlayerEventListener:", t);
31
+ }
32
+ l(() => o.cleanup());
33
+ }), n() ? i(I, {}) : [];
34
+ }, D = (n) => i(d, {
35
+ postMessage: (r) => {
36
+ var t, s;
37
+ typeof window > "u" || !(window.self !== window.top) || (e.applicationURL.length > 0 && (window == null || window.postMessage(
38
+ r,
39
+ // Use to restrict the origin of the editor for security reasons.
40
+ // Correspond to the current application URL to synchronize the locales states.
41
+ e.applicationURL
42
+ )), e.editorURL.length > 0 && ((t = window.parent) == null || t.postMessage(
43
+ r,
44
+ // Use to restrict the origin of the editor for security reasons.
45
+ // Correspond to the editor URL to synchronize the locales states.
46
+ e.editorURL
47
+ )), e.cmsURL.length > 0 && ((s = window.parent) == null || s.postMessage(
48
+ r,
49
+ // Use to restrict the origin of the CMS for security reasons.
50
+ // Correspond to the CMS URL.
51
+ e.cmsURL
52
+ )));
53
+ },
54
+ get allowedOrigins() {
55
+ return [e == null ? void 0 : e.editorURL, e == null ? void 0 : e.cmsURL, e == null ? void 0 : e.applicationURL];
56
+ },
57
+ configuration: m,
58
+ get children() {
59
+ return [i(L, {}), p(() => n.children)];
60
+ }
61
+ });
62
+ export {
63
+ D as IntlayerEditorProvider
64
+ };
@@ -0,0 +1,39 @@
1
+ import { createContext as r, createSignal as i, createComponent as C, useContext as d } from "solid-js";
2
+ const a = r(void 0), s = r(void 0), x = (n) => {
3
+ const [o, t] = i({}), g = (c, h) => {
4
+ t((e) => ({
5
+ ...e,
6
+ [c]: {
7
+ ...e == null ? void 0 : e[c],
8
+ content: h
9
+ }
10
+ }));
11
+ };
12
+ return C(a.Provider, {
13
+ value: {
14
+ changedContent: o
15
+ },
16
+ get children() {
17
+ return C(s.Provider, {
18
+ value: {
19
+ setChangedContent: g
20
+ },
21
+ get children() {
22
+ return n.children;
23
+ }
24
+ });
25
+ }
26
+ });
27
+ }, u = () => d(s), m = () => {
28
+ var t;
29
+ const n = d(a), o = u();
30
+ return {
31
+ changedContent: (t = n == null ? void 0 : n.changedContent) == null ? void 0 : t.call(n),
32
+ ...o
33
+ };
34
+ };
35
+ export {
36
+ x as ChangedContentProvider,
37
+ m as useChangedContent,
38
+ u as useChangedContentActions
39
+ };