solid-intlayer 8.2.4 → 8.3.0-canary.1
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.
- package/dist/cjs/client/getBrowserLocale.cjs +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
- package/dist/cjs/editor/contexts/EditedContentContext.cjs +1 -1
- package/dist/cjs/editor/index.cjs +1 -1
- package/dist/cjs/getDictionary.cjs +1 -1
- package/dist/cjs/getIntlayer.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/client/getBrowserLocale.mjs +21 -20
- package/dist/esm/editor/ContentSelectorWrapper.mjs +4 -3
- package/dist/esm/editor/contexts/EditedContentContext.mjs +1 -1
- package/dist/esm/editor/index.mjs +1 -1
- package/dist/esm/getDictionary.mjs +1 -1
- package/dist/esm/getIntlayer.mjs +1 -1
- package/dist/esm/plugins.mjs +2 -2
- package/dist/plugins-Da2V8QmE.js +1 -0
- package/dist/{plugins-DZkJ0Bhm.mjs → plugins-qgberWhD.mjs} +12 -11
- package/dist/types/client/IntlayerProvider.d.ts +1 -1
- package/dist/types/client/format/useIntl.d.ts +1 -1
- package/dist/types/client/getBrowserLocale.d.ts +1 -1
- package/dist/types/client/t.d.ts +1 -1
- package/dist/types/client/useContent.d.ts +2 -2
- package/dist/types/client/useDictionary.d.ts +2 -1
- package/dist/types/client/useDictionaryAsync.d.ts +2 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +3 -2
- package/dist/types/client/useIntlayer.d.ts +1 -1
- package/dist/types/client/useLocale.d.ts +1 -1
- package/dist/types/client/useLocaleBase.d.ts +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +5 -5
- package/dist/types/client/useTraduction.d.ts +1 -1
- package/dist/types/editor/contexts/ConfigurationContext.d.ts +1 -1
- package/dist/types/editor/contexts/DictionariesRecordContext.d.ts +1 -1
- package/dist/types/editor/contexts/EditedContentContext.d.ts +3 -1
- package/dist/types/editor/contexts/FocusDictionaryContext.d.ts +1 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts +2 -1
- package/dist/types/getDictionary.d.ts +2 -1
- package/dist/types/getIntlayer.d.ts +1 -1
- package/dist/types/html/HTMLRenderer.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts +2 -1
- package/dist/types/plugins.d.ts +2 -1
- package/package.json +16 -16
- package/dist/plugins-tjixCMrF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@intlayer/config/built"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@intlayer/config/built"),u=require("@intlayer/core/localization"),y=require("@intlayer/core/utils"),p=require("@intlayer/types/locales");function v(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const c=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,c.get?c:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const h=v(p);var d=(t=>(t.Querystring="querystring",t.Storage="storage",t.Navigator="navigator",t.HtmlTag="htmlTag",t))(d||{});const S=()=>({order:["querystring","storage","navigator","htmlTag"],lookupQuerystring:"locale",htmlTag:typeof document<"u"?document.documentElement:null}),w=(t,r)=>{const e={},f={querystring:()=>{if(typeof window>"u")return;const o=window.location.search||"",a=new URLSearchParams(o).get(r.lookupQuerystring??"");a&&(e.querystring=a)},storage:()=>{if(typeof window>"u")return;const o=y.getLocaleFromStorage({getCookie:n=>{try{const a=document.cookie.split(";"),s=`${n}=`,g=a.find(m=>m.trim().startsWith(s));if(g)return g.split("=")[1].trim()}catch{}},getSessionStorage:n=>{try{return window.sessionStorage.getItem(n)??void 0}catch{}},getLocaleStorage:n=>{try{return window.localStorage.getItem(n)??void 0}catch{}}});o&&(e.storage=o)},navigator:()=>{if(typeof navigator>"u")return;const{internationalization:o}=l,n=navigator.languages??[navigator.language],a=u.localeDetector({"accept-language":n.join(",")},o.locales,o.defaultLocale);a&&(e.navigator=a)},htmlTag:()=>{const o=r.htmlTag;if(o&&typeof o.getAttribute=="function"){const n=o.getAttribute("lang");if(n){const{internationalization:a}=l,s=u.localeDetector({"accept-language":n},a.locales,a.defaultLocale);e.htmlTag=s}}}};return t.forEach(o=>{f[o]?.()}),e},T=(t,r)=>{const{internationalization:e}=l;for(const c of r){const i=t[c];if(i&&e.locales.includes(i))return i}return e?.defaultLocale??h.ENGLISH},b=(t={})=>{const r={...S(),...t},e=w(r.order??[],r);return T(e,r.order??[])};exports.LanguageDetector=d;exports.getBrowserLocale=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("solid-js/web");require("@intlayer/core/utils");require("@intlayer/types");require("solid-js");require("@intlayer/core/formatters");require("../client/IntlayerProvider.cjs");require("@intlayer/config/built");require("@intlayer/core/localization");require("@intlayer/core/interpreter");const e=require("../../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("solid-js/web");require("@intlayer/core/utils");require("@intlayer/types/nodeType");require("solid-js");require("@intlayer/core/formatters");require("../client/IntlayerProvider.cjs");require("@intlayer/config/built");require("@intlayer/core/localization");require("@intlayer/types/locales");require("@intlayer/core/interpreter");const e=require("../../plugins-Da2V8QmE.js");require("../client/useLocaleStorage.cjs");require("../client/useLocaleBase.cjs");require("../UI/ContentSelector.cjs");require("@intlayer/editor");require("./contexts/ConfigurationContext.cjs");require("./contexts/DictionariesRecordContext.cjs");require("./contexts/EditedContentContext.cjs");require("./contexts/EditorEnabledContext.cjs");require("./contexts/CommunicatorContext.cjs");require("./contexts/FocusDictionaryContext.cjs");exports.ContentSelectorRenderer=e.ContentSelectorRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("solid-js/web"),l=require("@intlayer/core/dictionaryManipulator"),g=require("@intlayer/editor"),y=require("@intlayer/types/nodeType"),f=require("solid-js"),R=require("./DictionariesRecordContext.cjs"),_=require("./useCrossFrameMessageListener.cjs"),$=require("./useCrossFrameState.cjs"),P=f.createContext(void 0),j=C=>_.useCrossFrameMessageListener(`${g.MessageKey.INTLAYER_EDITED_CONTENT_CHANGED}/post`,C),k=C=>_.useCrossFrameMessageListener(`${g.MessageKey.INTLAYER_EDITED_CONTENT_CHANGED}/get`,C),m=f.createContext(void 0),v=C=>{const{localeDictionaries:a}=R.useDictionariesRecord(),[D,r]=$.useCrossFrameState(g.MessageKey.INTLAYER_EDITED_CONTENT_CHANGED),S=t=>{if(typeof t=="function")r(n=>{const e=n?.[Object.keys(n||{})[0]],s=t(e);return{...n,[s.key]:s}});else{const n=t;r(e=>({...e,[n.key]:n}))}},A=(t,n)=>{r(e=>({...e,[t]:{...e?.[t],content:n}}))},p=(t,n,e=[],s=!0)=>{r(d=>{const u=a[t]?.content,o=structuredClone(d?.[t]?.content??u);let c=e;if(!s){let E=0;const G=e.slice(0,-1),N=e[e.length-1];let h=N.key;for(;typeof l.getContentNodeByKeyPath(o,c)<"u";)E++,h=E===0?N.key:`${N.key} (${E})`,c=[...G,{...N,key:h}]}const i=l.editDictionaryByKeyPath(o,c,n);return{...d,[t]:{...d?.[t],content:i}}})},q=(t,n,e=[])=>{r(s=>{const d=a[t]?.content,u=structuredClone(s?.[t]?.content??d),o=l.renameContentNodeByKeyPath(u,n,e);return{...s,[t]:{...s?.[t],content:o}}})},M=(t,n)=>{r(e=>{const s=a[t]?.content,d=structuredClone(e?.[t]?.content??s),u=structuredClone(d),o=n.slice(0,-1),c=n[n.length-1]?.key;if(c){const i=l.getContentNodeByKeyPath(u,o.filter(E=>E.type!==y.NodeType.Translation));i&&typeof i=="object"&&c in i&&delete i[c]}return{...e,[t]:{...e?.[t],content:u}}})},b=t=>{r(n=>{const e={...n};return delete e[t],e})},F=t=>{r(n=>({...n,[t]:{...n?.[t],content:{}}}))},I=()=>{r({})},L=(t,n)=>{const e=D();if(!e)return;const s=n.filter(o=>o.type!==y.NodeType.Translation);if(t.includes(":local:")||t.includes(":remote:")){const o=e?.[t]?.content??{};return l.getContentNodeByKeyPath(o,s)}const u=Object.keys(e).filter(o=>o.startsWith(`${t}:`));for(const o of u){const c=e?.[o]?.content??{},i=l.getContentNodeByKeyPath(c,s);if(i)return i}},w={editedContent:D()},B={setEditedContentState:r,setEditedDictionary:S,setEditedContent:A,addEditedContent:p,renameEditedContent:q,removeEditedContent:M,restoreEditedContent:b,clearEditedDictionaryContent:F,clearEditedContent:I,getEditedContentValue:L};return T.createComponent(P.Provider,{value:w,get children(){return T.createComponent(m.Provider,{value:B,get children(){return C.children}})}})},x=()=>f.useContext(m),H=()=>{const C=x(),a=f.useContext(P);if(!a)throw new Error("useEditedContent must be used within a EditedContentProvider");return{...a,...C}};exports.EditedContentProvider=v;exports.useEditedContent=H;exports.useEditedContentActions=x;exports.useGetEditedContentState=k;exports.usePostEditedContentState=j;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../plugins-Da2V8QmE.js");exports.ContentSelectorRenderer=e.ContentSelectorRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@intlayer/core/interpreter"),e=require("../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@intlayer/core/interpreter"),e=require("../plugins-Da2V8QmE.js"),l=(t,i,n)=>{const r=[e.intlayerNodePlugins,e.solidNodePlugins,e.insertionPlugin,e.markdownPlugin,e.htmlPlugin,...n??[]];return o.getDictionary(t,i,r)};exports.getDictionary=l;
|
package/dist/cjs/getIntlayer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@intlayer/core/interpreter"),e=require("../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@intlayer/core/interpreter"),e=require("../plugins-Da2V8QmE.js"),o=(t,n,r)=>{const i=[e.intlayerNodePlugins,e.solidNodePlugins,e.insertionPlugin,e.markdownPlugin,e.htmlPlugin,...r??[]];return l.getIntlayer(t,n,i)};exports.getIntlayer=o;
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("solid-js/web");require("@intlayer/core/interpreter");require("@intlayer/core/markdown");require("@intlayer/core/transpiler");require("@intlayer/types");const e=require("../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("solid-js/web");require("@intlayer/core/interpreter");require("@intlayer/core/markdown");require("@intlayer/core/transpiler");require("@intlayer/types/nodeType");const e=require("../plugins-Da2V8QmE.js");require("./editor/useEditedContentRenderer.cjs");require("./IntlayerNode.cjs");require("./markdown/MarkdownProvider.cjs");require("./markdown/MarkdownRenderer.cjs");require("./solidElement/renderSolidElement.cjs");exports.htmlPlugin=e.htmlPlugin;exports.insertionPlugin=e.insertionPlugin;exports.intlayerNodePlugins=e.intlayerNodePlugins;exports.markdownPlugin=e.markdownPlugin;exports.markdownStringPlugin=e.markdownStringPlugin;exports.solidNodePlugins=e.solidNodePlugins;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import s from "@intlayer/config/built";
|
|
2
|
-
import { localeDetector as u
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { localeDetector as u } from "@intlayer/core/localization";
|
|
3
|
+
import { getLocaleFromStorage as m } from "@intlayer/core/utils";
|
|
4
|
+
import * as p from "@intlayer/types/locales";
|
|
5
|
+
var v = /* @__PURE__ */ ((o) => (o.Querystring = "querystring", o.Storage = "storage", o.Navigator = "navigator", o.HtmlTag = "htmlTag", o))(v || {});
|
|
5
6
|
const h = () => ({
|
|
6
7
|
order: [
|
|
7
8
|
"querystring",
|
|
@@ -12,7 +13,7 @@ const h = () => ({
|
|
|
12
13
|
],
|
|
13
14
|
lookupQuerystring: "locale",
|
|
14
15
|
htmlTag: typeof document < "u" ? document.documentElement : null
|
|
15
|
-
}), y = (
|
|
16
|
+
}), y = (o, a) => {
|
|
16
17
|
const r = {}, d = {
|
|
17
18
|
querystring: () => {
|
|
18
19
|
if (typeof window > "u") return;
|
|
@@ -22,23 +23,23 @@ const h = () => ({
|
|
|
22
23
|
storage: () => {
|
|
23
24
|
if (typeof window > "u") return;
|
|
24
25
|
const t = m({
|
|
25
|
-
getCookie: (
|
|
26
|
+
getCookie: (e) => {
|
|
26
27
|
try {
|
|
27
|
-
const n = document.cookie.split(";"), i = `${
|
|
28
|
+
const n = document.cookie.split(";"), i = `${e}=`, g = n.find((f) => f.trim().startsWith(i));
|
|
28
29
|
if (g)
|
|
29
30
|
return g.split("=")[1].trim();
|
|
30
31
|
} catch {
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
|
-
getSessionStorage: (
|
|
34
|
+
getSessionStorage: (e) => {
|
|
34
35
|
try {
|
|
35
|
-
return window.sessionStorage.getItem(
|
|
36
|
+
return window.sessionStorage.getItem(e) ?? void 0;
|
|
36
37
|
} catch {
|
|
37
38
|
}
|
|
38
39
|
},
|
|
39
|
-
getLocaleStorage: (
|
|
40
|
+
getLocaleStorage: (e) => {
|
|
40
41
|
try {
|
|
41
|
-
return window.localStorage.getItem(
|
|
42
|
+
return window.localStorage.getItem(e) ?? void 0;
|
|
42
43
|
} catch {
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -49,43 +50,43 @@ const h = () => ({
|
|
|
49
50
|
if (typeof navigator > "u") return;
|
|
50
51
|
const {
|
|
51
52
|
internationalization: t
|
|
52
|
-
} = s,
|
|
53
|
-
"accept-language":
|
|
53
|
+
} = s, e = navigator.languages ?? [navigator.language], n = u({
|
|
54
|
+
"accept-language": e.join(",")
|
|
54
55
|
}, t.locales, t.defaultLocale);
|
|
55
56
|
n && (r.navigator = n);
|
|
56
57
|
},
|
|
57
58
|
htmlTag: () => {
|
|
58
59
|
const t = a.htmlTag;
|
|
59
60
|
if (t && typeof t.getAttribute == "function") {
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
61
|
+
const e = t.getAttribute("lang");
|
|
62
|
+
if (e) {
|
|
62
63
|
const {
|
|
63
64
|
internationalization: n
|
|
64
65
|
} = s, i = u({
|
|
65
|
-
"accept-language":
|
|
66
|
+
"accept-language": e
|
|
66
67
|
}, n.locales, n.defaultLocale);
|
|
67
68
|
r.htmlTag = i;
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
};
|
|
72
|
-
return
|
|
73
|
+
return o.forEach((t) => {
|
|
73
74
|
d[t]?.();
|
|
74
75
|
}), r;
|
|
75
|
-
}, w = (
|
|
76
|
+
}, w = (o, a) => {
|
|
76
77
|
const {
|
|
77
78
|
internationalization: r
|
|
78
79
|
} = s;
|
|
79
80
|
for (const l of a) {
|
|
80
|
-
const c =
|
|
81
|
+
const c = o[l];
|
|
81
82
|
if (c && r.locales.includes(c))
|
|
82
83
|
return c;
|
|
83
84
|
}
|
|
84
85
|
return r?.defaultLocale ?? p.ENGLISH;
|
|
85
|
-
}, q = (
|
|
86
|
+
}, q = (o = {}) => {
|
|
86
87
|
const a = {
|
|
87
88
|
...h(),
|
|
88
|
-
...
|
|
89
|
+
...o
|
|
89
90
|
}, r = y(a.order ?? [], a);
|
|
90
91
|
return w(r, a.order ?? []);
|
|
91
92
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import "solid-js/web";
|
|
2
2
|
import "@intlayer/core/utils";
|
|
3
|
-
import "@intlayer/types";
|
|
3
|
+
import "@intlayer/types/nodeType";
|
|
4
4
|
import "solid-js";
|
|
5
5
|
import "@intlayer/core/formatters";
|
|
6
6
|
import "../client/IntlayerProvider.mjs";
|
|
7
7
|
import "@intlayer/config/built";
|
|
8
8
|
import "@intlayer/core/localization";
|
|
9
|
+
import "@intlayer/types/locales";
|
|
9
10
|
import "@intlayer/core/interpreter";
|
|
10
|
-
import { C as
|
|
11
|
+
import { C as k } from "../../plugins-qgberWhD.mjs";
|
|
11
12
|
import "../client/useLocaleStorage.mjs";
|
|
12
13
|
import "../client/useLocaleBase.mjs";
|
|
13
14
|
import "../UI/ContentSelector.mjs";
|
|
@@ -19,5 +20,5 @@ import "./contexts/EditorEnabledContext.mjs";
|
|
|
19
20
|
import "./contexts/CommunicatorContext.mjs";
|
|
20
21
|
import "./contexts/FocusDictionaryContext.mjs";
|
|
21
22
|
export {
|
|
22
|
-
|
|
23
|
+
k as ContentSelectorRenderer
|
|
23
24
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent as h } from "solid-js/web";
|
|
2
2
|
import { getContentNodeByKeyPath as f, renameContentNodeByKeyPath as j, editDictionaryByKeyPath as B } from "@intlayer/core/dictionaryManipulator";
|
|
3
3
|
import { MessageKey as m } from "@intlayer/editor";
|
|
4
|
-
import { NodeType as T } from "@intlayer/types";
|
|
4
|
+
import { NodeType as T } from "@intlayer/types/nodeType";
|
|
5
5
|
import { createContext as g, useContext as p } from "solid-js";
|
|
6
6
|
import { useDictionariesRecord as H } from "./DictionariesRecordContext.mjs";
|
|
7
7
|
import { useCrossFrameMessageListener as _ } from "./useCrossFrameMessageListener.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDictionary as s } from "@intlayer/core/interpreter";
|
|
2
|
-
import { i as r, s as a, a as e, m as g, h as l } from "../plugins-
|
|
2
|
+
import { i as r, s as a, a as e, m as g, h as l } from "../plugins-qgberWhD.mjs";
|
|
3
3
|
const c = (i, n, o) => {
|
|
4
4
|
const t = [
|
|
5
5
|
r,
|
package/dist/esm/getIntlayer.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getIntlayer as r } from "@intlayer/core/interpreter";
|
|
2
|
-
import { i as a, s as e, a as l, m as o, h as g } from "../plugins-
|
|
2
|
+
import { i as a, s as e, a as l, m as o, h as g } from "../plugins-qgberWhD.mjs";
|
|
3
3
|
const P = (n, t, s) => {
|
|
4
4
|
const i = [
|
|
5
5
|
a,
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import "solid-js/web";
|
|
|
2
2
|
import "@intlayer/core/interpreter";
|
|
3
3
|
import "@intlayer/core/markdown";
|
|
4
4
|
import "@intlayer/core/transpiler";
|
|
5
|
-
import "@intlayer/types";
|
|
6
|
-
import { h as P, a as d, i as e, m as h, b as k, s as w } from "../plugins-
|
|
5
|
+
import "@intlayer/types/nodeType";
|
|
6
|
+
import { h as P, a as d, i as e, m as h, b as k, s as w } from "../plugins-qgberWhD.mjs";
|
|
7
7
|
import "./editor/useEditedContentRenderer.mjs";
|
|
8
8
|
import "./IntlayerNode.mjs";
|
|
9
9
|
import "./markdown/MarkdownProvider.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("solid-js/web"),h=require("@intlayer/core/interpreter"),w=require("@intlayer/core/markdown"),T=require("@intlayer/core/transpiler"),d=require("@intlayer/types/nodeType"),N=require("@intlayer/core/utils"),f=require("solid-js");require("@intlayer/core/formatters");const M=require("./cjs/client/IntlayerProvider.cjs");require("@intlayer/config/built");require("@intlayer/core/localization");require("@intlayer/types/locales");const S=require("./cjs/editor/useEditedContentRenderer.cjs"),m=require("./cjs/IntlayerNode.cjs");require("./cjs/markdown/MarkdownProvider.cjs");const P=require("./cjs/markdown/MarkdownRenderer.cjs"),H=require("./cjs/solidElement/renderSolidElement.cjs");require("./cjs/client/useLocaleStorage.cjs");require("./cjs/client/useLocaleBase.cjs");const I=require("./cjs/UI/ContentSelector.cjs");require("@intlayer/editor");require("./cjs/editor/contexts/ConfigurationContext.cjs");require("./cjs/editor/contexts/DictionariesRecordContext.cjs");require("./cjs/editor/contexts/EditedContentContext.cjs");const b=require("./cjs/editor/contexts/EditorEnabledContext.cjs");require("./cjs/editor/contexts/CommunicatorContext.cjs");const K=require("./cjs/editor/contexts/FocusDictionaryContext.cjs"),_=e=>{const{focusedContent:n,setFocusedContent:t}=K.useFocusDictionary(),l=f.createMemo(()=>e.keyPath.filter(a=>a.type!==d.NodeType.Translation)),o=()=>t({dictionaryKey:e.dictionaryKey,keyPath:l()}),c=f.createMemo(()=>(n?.dictionaryKey===e.dictionaryKey&&(n?.keyPath?.length??0)>0&&N.isSameKeyPath(n?.keyPath??[],l()))??!1);return r.createComponent(I.ContentSelector,{onPress:o,get isSelecting(){return c()},get children(){return e.children}})},y=e=>{const{enabled:n}=b.useEditorEnabled(),{disableEditor:t}=M.useIntlayerContext();return n()&&!t?r.createComponent(_,r.mergeProps(e,{get children(){return e.children}})):e.children},E={id:"intlayer-node-plugin",canHandle:e=>typeof e=="bigint"||typeof e=="string"||typeof e=="number",transform:(e,{plugins:n,...t})=>m.renderIntlayerNode({...t,value:t.children,children:r.createComponent(y,r.mergeProps(t,{get children(){return r.createComponent(S.EditedContentRenderer,r.mergeProps(t,{get children(){return t.children}}))}}))})},R={id:"solid-node-plugin",canHandle:e=>typeof e=="object"&&e?.props!==void 0||typeof Node<"u"&&e instanceof Node,transform:(e,{plugins:n,...t})=>m.renderIntlayerNode({...t,value:"[[solid-element]]",children:r.createComponent(y,r.mergeProps(t,{get children(){return typeof Node<"u"&&e instanceof Node?e:H.renderSolidElement(e)}}))})},v=(e,n)=>{const t=h.splitInsertionTemplate(e,n);return t.isSimple,t.parts},x={id:"insertion-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===d.NodeType.Insertion,transform:(e,n,t)=>{const l=[...n.keyPath,{type:d.NodeType.Insertion}],o=e[d.NodeType.Insertion];return t(o,{...n,children:o,keyPath:l,plugins:[{id:"insertion-string-plugin",canHandle:a=>typeof a=="string",transform:(a,u,g)=>{const p=g(a,{...u,children:a,plugins:[...(n.plugins??[]).filter(i=>i.id!=="intlayer-node-plugin")]});return i=>{const s=v(p,i);return g(s,{...u,plugins:n.plugins,children:s})}}},...n.plugins??[]]})}},q={id:"markdown-string-plugin",canHandle:e=>typeof e=="string",transform:(e,n,t)=>{const{plugins:l,...o}=n,c=w.getMarkdownMetadata(e),u=t(c,{plugins:[{id:"markdown-metadata-plugin",canHandle:i=>typeof i=="string"||typeof i=="number"||typeof i=="boolean"||!i,transform:(i,s)=>m.renderIntlayerNode({...s,value:i,children:r.createComponent(y,r.mergeProps(o,{get children(){return r.createComponent(P.MarkdownMetadataRenderer,r.mergeProps(o,{get metadataKeyPath(){return s.keyPath},children:e}))}}))})}],dictionaryKey:o.dictionaryKey,keyPath:[]}),g=i=>m.renderIntlayerNode({...n,value:e,children:r.createComponent(y,r.mergeProps(o,{get children(){return r.createComponent(P.MarkdownRenderer,r.mergeProps(o,{components:i,children:e}))}})),additionalProps:{metadata:u}}),p=g();return new Proxy(p,{get(i,s,k){return s==="value"?e:s==="metadata"?u:s==="use"?C=>g(C):Reflect.get(i,s,k)}})}},L={id:"markdown-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===d.NodeType.Markdown,transform:(e,n,t)=>{const l=[...n.keyPath,{type:d.NodeType.Markdown}],o=e[d.NodeType.Markdown];return t(o,{...n,children:o,keyPath:l,plugins:[q,...n.plugins??[]]})}},j=()=>{const e={};for(const n of T.HTML_TAGS)e[n]=({children:t,...l})=>r.createComponent(r.Dynamic,r.mergeProps({component:n},l,{children:t}));return e},D=j(),F={id:"html-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===d.NodeType.HTML,transform:e=>{const n=e[d.NodeType.HTML],t=c=>{const a={...D,...c};return h.getHTML(n,a)},o=[t()];return new Proxy(o,{get(c,a,u){return a==="value"?n:a==="use"?g=>t(g):Reflect.get(c,a,u)}})}};exports.ContentSelectorRenderer=y;exports.htmlPlugin=F;exports.insertionPlugin=x;exports.intlayerNodePlugins=E;exports.markdownPlugin=L;exports.markdownStringPlugin=q;exports.solidNodePlugins=R;
|
|
@@ -2,13 +2,14 @@ import { createComponent as s, mergeProps as c, Dynamic as w } from "solid-js/we
|
|
|
2
2
|
import { getHTML as M, splitInsertionTemplate as H } from "@intlayer/core/interpreter";
|
|
3
3
|
import { getMarkdownMetadata as C } from "@intlayer/core/markdown";
|
|
4
4
|
import { HTML_TAGS as S } from "@intlayer/core/transpiler";
|
|
5
|
-
import { NodeType as d } from "@intlayer/types";
|
|
5
|
+
import { NodeType as d } from "@intlayer/types/nodeType";
|
|
6
6
|
import { isSameKeyPath as T } from "@intlayer/core/utils";
|
|
7
7
|
import { createMemo as h } from "solid-js";
|
|
8
8
|
import "@intlayer/core/formatters";
|
|
9
9
|
import { useIntlayerContext as b } from "./esm/client/IntlayerProvider.mjs";
|
|
10
10
|
import "@intlayer/config/built";
|
|
11
11
|
import "@intlayer/core/localization";
|
|
12
|
+
import "@intlayer/types/locales";
|
|
12
13
|
import { EditedContentRenderer as K } from "./esm/editor/useEditedContentRenderer.mjs";
|
|
13
14
|
import { renderIntlayerNode as f } from "./esm/IntlayerNode.mjs";
|
|
14
15
|
import "./esm/markdown/MarkdownProvider.mjs";
|
|
@@ -52,7 +53,7 @@ const j = (e) => {
|
|
|
52
53
|
return e.children;
|
|
53
54
|
}
|
|
54
55
|
})) : e.children;
|
|
55
|
-
},
|
|
56
|
+
}, ue = {
|
|
56
57
|
id: "intlayer-node-plugin",
|
|
57
58
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
58
59
|
transform: (e, {
|
|
@@ -72,7 +73,7 @@ const j = (e) => {
|
|
|
72
73
|
}
|
|
73
74
|
}))
|
|
74
75
|
})
|
|
75
|
-
},
|
|
76
|
+
}, ge = {
|
|
76
77
|
id: "solid-node-plugin",
|
|
77
78
|
canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
|
|
78
79
|
transform: (e, {
|
|
@@ -91,7 +92,7 @@ const j = (e) => {
|
|
|
91
92
|
}, x = (e, t) => {
|
|
92
93
|
const n = H(e, t);
|
|
93
94
|
return n.isSimple, n.parts;
|
|
94
|
-
},
|
|
95
|
+
}, fe = {
|
|
95
96
|
id: "insertion-plugin",
|
|
96
97
|
canHandle: (e) => typeof e == "object" && e?.nodeType === d.Insertion,
|
|
97
98
|
transform: (e, t, n) => {
|
|
@@ -173,7 +174,7 @@ const j = (e) => {
|
|
|
173
174
|
}
|
|
174
175
|
});
|
|
175
176
|
}
|
|
176
|
-
},
|
|
177
|
+
}, ye = {
|
|
177
178
|
id: "markdown-plugin",
|
|
178
179
|
canHandle: (e) => typeof e == "object" && e?.nodeType === d.Markdown,
|
|
179
180
|
transform: (e, t, n) => {
|
|
@@ -199,7 +200,7 @@ const j = (e) => {
|
|
|
199
200
|
children: n
|
|
200
201
|
}));
|
|
201
202
|
return e;
|
|
202
|
-
}, F = A(),
|
|
203
|
+
}, F = A(), pe = {
|
|
203
204
|
id: "html-plugin",
|
|
204
205
|
canHandle: (e) => typeof e == "object" && e?.nodeType === d.HTML,
|
|
205
206
|
transform: (e) => {
|
|
@@ -219,10 +220,10 @@ const j = (e) => {
|
|
|
219
220
|
};
|
|
220
221
|
export {
|
|
221
222
|
y as C,
|
|
222
|
-
|
|
223
|
+
fe as a,
|
|
223
224
|
D as b,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
pe as h,
|
|
226
|
+
ue as i,
|
|
227
|
+
ye as m,
|
|
228
|
+
ge as s
|
|
228
229
|
};
|
package/dist/types/client/t.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { StrictModeLocaleMap } from '@intlayer/types';
|
|
1
|
+
import { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
|
|
2
2
|
/**
|
|
3
3
|
* On the client side, hook to get the translation content based on the locale
|
|
4
4
|
*/
|
|
5
5
|
export declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
|
|
6
|
-
locale: import('
|
|
6
|
+
locale: import('intlayer').Locale;
|
|
7
7
|
content: Content;
|
|
8
8
|
t: <Content_1 = string>(languageContent: StrictModeLocaleMap<Content_1>) => Content_1;
|
|
9
9
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DeclaredLocales,
|
|
1
|
+
import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
2
|
+
import { Dictionary } from '@intlayer/types/dictionary';
|
|
2
3
|
import { Accessor } from 'solid-js';
|
|
3
4
|
import { DeepTransformContent } from '../plugins';
|
|
4
5
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DeclaredLocales,
|
|
1
|
+
import { DeclaredLocales, LocalesValues, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
|
|
2
|
+
import { Dictionary } from '@intlayer/types/dictionary';
|
|
2
3
|
/**
|
|
3
4
|
* On the server side, Hook that transform a dictionary and return the content
|
|
4
5
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Dictionary
|
|
1
|
+
import { Dictionary } from '@intlayer/types/dictionary';
|
|
2
|
+
import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
|
|
2
3
|
/**
|
|
3
4
|
* On the server side, Hook that transform a dictionary and return the content
|
|
4
5
|
*
|
|
5
6
|
* If the locale is not provided, it will use the locale from the client context
|
|
6
7
|
*/
|
|
7
|
-
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 & {}) | "af" | "af-ZA" | "ar" | "ar-
|
|
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 & {}) | "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" | "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-IS" | "id" | "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" | "ms" | "ml" | "ml-IN" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "mi" | "mi-NZ" | "mr" | "mr-IN" | "mn" | "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-TH" | "ts" | "tn" | "tn-ZA" | "tr" | "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">>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from '@intlayer/types';
|
|
1
|
+
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
2
2
|
import { Accessor } from 'solid-js';
|
|
3
3
|
import { DeepTransformContent } from '../plugins';
|
|
4
4
|
/**
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { LocalesValues } from '@intlayer/types';
|
|
1
|
+
import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
2
2
|
/**
|
|
3
3
|
* Get the locale cookie
|
|
4
4
|
*/
|
|
5
|
-
export declare const localeInStorage: import('
|
|
5
|
+
export declare const localeInStorage: import('intlayer').Locale | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use localeInStorage instead
|
|
8
8
|
*
|
|
9
9
|
* Get the locale cookie
|
|
10
10
|
*/
|
|
11
|
-
export declare const localeCookie: import('
|
|
11
|
+
export declare const localeCookie: import('intlayer').Locale | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* Set the locale cookie
|
|
14
14
|
*/
|
|
@@ -23,7 +23,7 @@ export declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled?:
|
|
|
23
23
|
* Hook that provides the locale storage and a function to set it
|
|
24
24
|
*/
|
|
25
25
|
export declare const useLocaleStorage: (isCookieEnabled?: boolean) => import('solid-js').Accessor<{
|
|
26
|
-
getLocale: () => import('
|
|
26
|
+
getLocale: () => import('intlayer').Locale;
|
|
27
27
|
setLocale: (locale: LocalesValues) => void;
|
|
28
28
|
}>;
|
|
29
29
|
/**
|
|
@@ -34,6 +34,6 @@ export declare const useLocaleStorage: (isCookieEnabled?: boolean) => import('so
|
|
|
34
34
|
* Hook that provides the locale cookie and a function to set it
|
|
35
35
|
*/
|
|
36
36
|
export declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
37
|
-
localeCookie: import('
|
|
37
|
+
localeCookie: import('intlayer').Locale;
|
|
38
38
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
39
39
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntlayerConfig } from '@intlayer/types';
|
|
1
|
+
import { IntlayerConfig } from '@intlayer/types/config';
|
|
2
2
|
import { Component, ParentProps } from 'solid-js';
|
|
3
3
|
export declare const useConfigurationState: () => [import('solid-js').Accessor<IntlayerConfig>, (value: IntlayerConfig | ((prev: IntlayerConfig) => IntlayerConfig)) => void, () => void];
|
|
4
4
|
export type ConfigurationProviderProps = ParentProps<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dictionary } from '@intlayer/types';
|
|
1
|
+
import { Dictionary } from '@intlayer/types/dictionary';
|
|
2
2
|
import { Component, ParentProps, Setter } from 'solid-js';
|
|
3
3
|
export type DictionaryContent = Record<Dictionary['key'], Dictionary>;
|
|
4
4
|
type DictionariesRecordActionsContextType = {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LocalDictionaryId } from '@intlayer/types/dictionary';
|
|
2
|
+
import { KeyPath } from '@intlayer/types/keyPath';
|
|
3
|
+
import { ContentNode, Dictionary } from 'intlayer';
|
|
2
4
|
import { Component, ParentProps } from 'solid-js';
|
|
3
5
|
export declare const usePostEditedContentState: <S>(onEventTriggered?: (data: S) => void) => (data?: S | undefined) => void;
|
|
4
6
|
export declare const useGetEditedContentState: <S>(onEventTriggered?: (data: S) => void) => (data?: S | undefined) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Plugins } from '@intlayer/core/interpreter';
|
|
2
|
-
import {
|
|
2
|
+
import { Dictionary } from '@intlayer/types/dictionary';
|
|
3
|
+
import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
3
4
|
import { DeepTransformContent } from './plugins';
|
|
4
5
|
export declare const getDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L, additionalPlugins?: Plugins[]) => DeepTransformContent<T["content"], L>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Plugins } from '@intlayer/core/interpreter';
|
|
2
|
-
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from '@intlayer/types';
|
|
2
|
+
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
3
3
|
import { DeepTransformContent } from './plugins';
|
|
4
4
|
export declare const getIntlayer: <T extends DictionaryKeys, L extends LocalesValues = DeclaredLocales>(key: T, locale?: L, additionalPlugins?: Plugins[]) => DeepTransformContent<DictionaryRegistryContent<T>, L>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LocalesValues } from '@intlayer/types';
|
|
1
|
+
import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
2
2
|
import { IInterpreterPluginSolid } from './plugins';
|
|
3
3
|
declare module '@intlayer/core/interpreter' {
|
|
4
4
|
interface IInterpreterPlugin<T, S, L extends LocalesValues> extends IInterpreterPluginSolid<T, S, L> {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { KeyPath
|
|
1
|
+
import { KeyPath } from '@intlayer/types/keyPath';
|
|
2
|
+
import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
2
3
|
import { Component, JSX } from 'solid-js';
|
|
3
4
|
import { HTMLComponents } from '../html/types';
|
|
4
5
|
type RenderMarkdownOptions = {
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DeepTransformContent as DeepTransformContentCore, IInterpreterPluginState as IInterpreterPluginStateCore, Plugins } from '@intlayer/core/interpreter';
|
|
2
|
-
import { DeclaredLocales, LocalesValues
|
|
2
|
+
import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
3
|
+
import { NodeType } from '@intlayer/types/nodeType';
|
|
3
4
|
import { JSX } from 'solid-js';
|
|
4
5
|
import { HTMLComponents } from './html/types';
|
|
5
6
|
import { IntlayerNode } from './IntlayerNode';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-intlayer",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0-canary.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -58,39 +58,39 @@
|
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "vite build",
|
|
60
60
|
"build:ci": "vite build",
|
|
61
|
-
"clean": "rimraf ./dist .turbo",
|
|
61
|
+
"clean": "bun --bun rimraf ./dist .turbo",
|
|
62
62
|
"dev": "vite build --watch",
|
|
63
|
-
"format": "biome format . --check",
|
|
64
|
-
"format:fix": "biome format --write .",
|
|
65
|
-
"lint": "biome lint .",
|
|
66
|
-
"lint:fix": "biome lint --write .",
|
|
63
|
+
"format": "bun --bun biome format . --check",
|
|
64
|
+
"format:fix": "bun --bun biome format --write .",
|
|
65
|
+
"lint": "bun --bun biome lint .",
|
|
66
|
+
"lint:fix": "bun --bun biome lint --write .",
|
|
67
67
|
"prepublish": "cp -f ../../README.md ./README.md",
|
|
68
68
|
"publish": "bun publish || true",
|
|
69
69
|
"publish:canary": "bun publish --access public --tag canary || true",
|
|
70
70
|
"publish:latest": "bun publish --access public --tag latest || true",
|
|
71
|
-
"test": "vitest run",
|
|
72
|
-
"test:watch": "vitest",
|
|
71
|
+
"test": "bun --bun vitest run",
|
|
72
|
+
"test:watch": "bun --bun vitest",
|
|
73
73
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@intlayer/api": "8.
|
|
77
|
-
"@intlayer/config": "8.
|
|
78
|
-
"@intlayer/core": "8.
|
|
79
|
-
"@intlayer/editor": "8.
|
|
80
|
-
"@intlayer/types": "8.
|
|
76
|
+
"@intlayer/api": "8.3.0-canary.1",
|
|
77
|
+
"@intlayer/config": "8.3.0-canary.1",
|
|
78
|
+
"@intlayer/core": "8.3.0-canary.1",
|
|
79
|
+
"@intlayer/editor": "8.3.0-canary.1",
|
|
80
|
+
"@intlayer/types": "8.3.0-canary.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@intlayer/unmerged-dictionaries-entry": "8.
|
|
83
|
+
"@intlayer/unmerged-dictionaries-entry": "8.3.0-canary.1",
|
|
84
84
|
"@solidjs/testing-library": "0.8.10",
|
|
85
85
|
"@testing-library/jest-dom": "6.9.1",
|
|
86
86
|
"@testing-library/user-event": "14.6.1",
|
|
87
|
-
"@types/node": "25.
|
|
87
|
+
"@types/node": "25.4.0",
|
|
88
88
|
"@utils/ts-config": "1.0.4",
|
|
89
89
|
"@utils/ts-config-types": "1.0.4",
|
|
90
90
|
"@utils/tsdown-config": "1.0.4",
|
|
91
91
|
"jsdom": "28.1.0",
|
|
92
92
|
"rimraf": "6.1.3",
|
|
93
|
-
"tsdown": "0.21.
|
|
93
|
+
"tsdown": "0.21.2",
|
|
94
94
|
"typescript": "5.9.3",
|
|
95
95
|
"vite": "7.3.1",
|
|
96
96
|
"vite-plugin-dts": "4.5.4",
|
package/dist/plugins-tjixCMrF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("solid-js/web"),h=require("@intlayer/core/interpreter"),w=require("@intlayer/core/markdown"),T=require("@intlayer/core/transpiler"),d=require("@intlayer/types"),N=require("@intlayer/core/utils"),f=require("solid-js");require("@intlayer/core/formatters");const M=require("./cjs/client/IntlayerProvider.cjs");require("@intlayer/config/built");require("@intlayer/core/localization");const S=require("./cjs/editor/useEditedContentRenderer.cjs"),m=require("./cjs/IntlayerNode.cjs");require("./cjs/markdown/MarkdownProvider.cjs");const P=require("./cjs/markdown/MarkdownRenderer.cjs"),H=require("./cjs/solidElement/renderSolidElement.cjs");require("./cjs/client/useLocaleStorage.cjs");require("./cjs/client/useLocaleBase.cjs");const I=require("./cjs/UI/ContentSelector.cjs");require("@intlayer/editor");require("./cjs/editor/contexts/ConfigurationContext.cjs");require("./cjs/editor/contexts/DictionariesRecordContext.cjs");require("./cjs/editor/contexts/EditedContentContext.cjs");const b=require("./cjs/editor/contexts/EditorEnabledContext.cjs");require("./cjs/editor/contexts/CommunicatorContext.cjs");const K=require("./cjs/editor/contexts/FocusDictionaryContext.cjs"),_=e=>{const{focusedContent:n,setFocusedContent:t}=K.useFocusDictionary(),l=f.createMemo(()=>e.keyPath.filter(a=>a.type!==d.NodeType.Translation)),o=()=>t({dictionaryKey:e.dictionaryKey,keyPath:l()}),c=f.createMemo(()=>(n?.dictionaryKey===e.dictionaryKey&&(n?.keyPath?.length??0)>0&&N.isSameKeyPath(n?.keyPath??[],l()))??!1);return r.createComponent(I.ContentSelector,{onPress:o,get isSelecting(){return c()},get children(){return e.children}})},y=e=>{const{enabled:n}=b.useEditorEnabled(),{disableEditor:t}=M.useIntlayerContext();return n()&&!t?r.createComponent(_,r.mergeProps(e,{get children(){return e.children}})):e.children},E={id:"intlayer-node-plugin",canHandle:e=>typeof e=="bigint"||typeof e=="string"||typeof e=="number",transform:(e,{plugins:n,...t})=>m.renderIntlayerNode({...t,value:t.children,children:r.createComponent(y,r.mergeProps(t,{get children(){return r.createComponent(S.EditedContentRenderer,r.mergeProps(t,{get children(){return t.children}}))}}))})},R={id:"solid-node-plugin",canHandle:e=>typeof e=="object"&&e?.props!==void 0||typeof Node<"u"&&e instanceof Node,transform:(e,{plugins:n,...t})=>m.renderIntlayerNode({...t,value:"[[solid-element]]",children:r.createComponent(y,r.mergeProps(t,{get children(){return typeof Node<"u"&&e instanceof Node?e:H.renderSolidElement(e)}}))})},v=(e,n)=>{const t=h.splitInsertionTemplate(e,n);return t.isSimple,t.parts},x={id:"insertion-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===d.NodeType.Insertion,transform:(e,n,t)=>{const l=[...n.keyPath,{type:d.NodeType.Insertion}],o=e[d.NodeType.Insertion];return t(o,{...n,children:o,keyPath:l,plugins:[{id:"insertion-string-plugin",canHandle:a=>typeof a=="string",transform:(a,u,g)=>{const p=g(a,{...u,children:a,plugins:[...(n.plugins??[]).filter(i=>i.id!=="intlayer-node-plugin")]});return i=>{const s=v(p,i);return g(s,{...u,plugins:n.plugins,children:s})}}},...n.plugins??[]]})}},k={id:"markdown-string-plugin",canHandle:e=>typeof e=="string",transform:(e,n,t)=>{const{plugins:l,...o}=n,c=w.getMarkdownMetadata(e),u=t(c,{plugins:[{id:"markdown-metadata-plugin",canHandle:i=>typeof i=="string"||typeof i=="number"||typeof i=="boolean"||!i,transform:(i,s)=>m.renderIntlayerNode({...s,value:i,children:r.createComponent(y,r.mergeProps(o,{get children(){return r.createComponent(P.MarkdownMetadataRenderer,r.mergeProps(o,{get metadataKeyPath(){return s.keyPath},children:e}))}}))})}],dictionaryKey:o.dictionaryKey,keyPath:[]}),g=i=>m.renderIntlayerNode({...n,value:e,children:r.createComponent(y,r.mergeProps(o,{get children(){return r.createComponent(P.MarkdownRenderer,r.mergeProps(o,{components:i,children:e}))}})),additionalProps:{metadata:u}}),p=g();return new Proxy(p,{get(i,s,q){return s==="value"?e:s==="metadata"?u:s==="use"?C=>g(C):Reflect.get(i,s,q)}})}},L={id:"markdown-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===d.NodeType.Markdown,transform:(e,n,t)=>{const l=[...n.keyPath,{type:d.NodeType.Markdown}],o=e[d.NodeType.Markdown];return t(o,{...n,children:o,keyPath:l,plugins:[k,...n.plugins??[]]})}},j=()=>{const e={};for(const n of T.HTML_TAGS)e[n]=({children:t,...l})=>r.createComponent(r.Dynamic,r.mergeProps({component:n},l,{children:t}));return e},D=j(),F={id:"html-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===d.NodeType.HTML,transform:e=>{const n=e[d.NodeType.HTML],t=c=>{const a={...D,...c};return h.getHTML(n,a)},o=[t()];return new Proxy(o,{get(c,a,u){return a==="value"?n:a==="use"?g=>t(g):Reflect.get(c,a,u)}})}};exports.ContentSelectorRenderer=y;exports.htmlPlugin=F;exports.insertionPlugin=x;exports.intlayerNodePlugins=E;exports.markdownPlugin=L;exports.markdownStringPlugin=k;exports.solidNodePlugins=R;
|