lit-intlayer 9.0.2 → 9.1.0
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/plugins.cjs +1 -1
- package/dist/esm/plugins.mjs +44 -43
- package/dist/types/plugins.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require("./renderIntlayerNode.cjs"),l=require("../installIntlayer-DFH3THoH.js"),u=require("./markdown/runtime.cjs");let d=require("@intlayer/core/interpreter"),f=require("@intlayer/config/built"),p=require("@intlayer/core/markdown"),m=require("@intlayer/types/nodeType");m=s(m);let h=require("lit/directives/unsafe-html.js"),g=require("lit/static-html.js");var _=(e=``,t={})=>(0,p.compileWithOptions)(e,u.default,t),v=(e,t,n={})=>{let r=typeof e==`string`?(0,h.unsafeHTML)(e):e;return new Proxy(r,{get(e,r,i){if(r===`value`||r===`raw`)return t;if(r===`toString`||r===Symbol.toPrimitive)return()=>t;if(r!==Symbol.iterator)return r===`__update`?()=>{}:r===`isJSX`?!0:r in n?n[r]:Reflect.get(e,r,i)}})},y=e=>e.replace(/&/g,`&`).replace(/"/g,`"`),b=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),x={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:t,keyPath:n,dictionaryKey:r,...i})=>{if(process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled){let e=String(t??``);return v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(n??[]))}" dictionary-key="${y(String(r??``))}">${b(e)}</intlayer-content-selector-wrapper>`,e)}return c.renderIntlayerNode({...i,value:t,children:t})}},S=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?d.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.INSERTION}],i=e[m.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,d.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,d.isInterpolableWrapperNode)(e))return i=>(0,d.transformInterpolableNode)(e,i,n,t.plugins,r);let i=r(e,{...n,children:e,plugins:(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)});return e=>{let a=(0,d.splitInsertionTemplate)(i,e),o=a.isSimple?a.parts:a.parts.join(``);return r(o,{...n,plugins:t.plugins,children:o})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return typeof i==`object`&&i&&`nodeType`in i&&[m.ENUMERATION,m.CONDITION].includes(i.nodeType)?e=>t=>{let n=o(t);return typeof n==`function`?n(e):n}:o}},C=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?d.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,{keyPath:a,dictionaryKey:o}=i,s=n((0,p.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>c.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),l=_(e),u=t=>{let n=_(e,{components:t});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(a??[]))}" dictionary-key="${y(String(o??``))}">${n}</intlayer-content-selector-wrapper>`,e):v(n,e)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(a??[]))}" dictionary-key="${y(String(o??``))}">${l}</intlayer-content-selector-wrapper>`,e,{metadata:s,use:u}):v(l,e,{metadata:s,use:u})}},w=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?d.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.MARKDOWN}],i=e[m.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[C,...t.plugins??[]]})}},T=process.env.INTLAYER_NODE_TYPE_HTML===`false`?d.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.HTML,transform:(e,t)=>{let n=e[m.HTML],{keyPath:r,dictionaryKey:i}=t,a=(e={})=>{let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e).map(([e,t])=>[e,e=>t(e)])),a=new Proxy(t,{get(e,t){if(typeof t==`string`&&t in e)return e[t];if(typeof t==`string`&&/^[a-z][a-z0-9]*$/.test(t))return e=>g.html`<${(0,g.unsafeStatic)(t)} ...${e}>${e.children}</${(0,g.unsafeStatic)(t)}>`}}),o=(0,d.getHTML)(n,a);return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(r??[]))}" dictionary-key="${y(String(i??``))}">${o}</intlayer-content-selector-wrapper>`,n):v(o,n)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(r??[]))}" dictionary-key="${y(String(i??``))}">${n}</intlayer-content-selector-wrapper>`,n,{use:a}):v(n,n,{use:a})}},E=new Map,D=(e,t=!0)=>{let n=e??(typeof window<`u`&&l.r()?.locale)??f.internationalization.defaultLocale,r=`${n}_${t}`;if(E.has(r))return E.get(r);let i=[(0,d.translationPlugin)(e??f.internationalization.defaultLocale,t?f.internationalization.defaultLocale:void 0),d.enumerationPlugin,(0,d.pluralPlugin)(n),d.conditionPlugin,(0,d.nestedPlugin)(n),d.filePlugin,d.genderPlugin,x,S,w,T];return E.set(r,i),i};exports.getPlugins=D,exports.htmlPlugin=T,exports.insertionPlugin=S,exports.intlayerNodePlugins=x,exports.markdownPlugin=w,exports.markdownStringPlugin=C;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require("./renderIntlayerNode.cjs"),l=require("../installIntlayer-DFH3THoH.js"),u=require("./markdown/runtime.cjs");let d=require("@intlayer/core/interpreter"),f=require("@intlayer/config/built"),p=require("@intlayer/core/markdown"),m=require("@intlayer/types/nodeType");m=s(m);let h=require("lit/directives/unsafe-html.js"),g=require("lit/static-html.js");var _=(e=``,t={})=>(0,p.compileWithOptions)(e,u.default,t),v=(e,t,n={})=>{let r=typeof e==`string`?(0,h.unsafeHTML)(e):e;return new Proxy(r,{get(e,r,i){if(r===`value`||r===`raw`)return t;if(r===`toString`||r===Symbol.toPrimitive)return()=>t;if(r!==Symbol.iterator)return r===`__update`?()=>{}:r===`isJSX`?!0:r in n?n[r]:Reflect.get(e,r,i)}})},y=e=>e.replace(/&/g,`&`).replace(/"/g,`"`),b=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),x={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:t,keyPath:n,dictionaryKey:r,...i})=>{if(process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled){let e=String(t??``);return v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(n??[]))}" dictionary-key="${y(String(r??``))}">${b(e)}</intlayer-content-selector-wrapper>`,e)}return c.renderIntlayerNode({...i,value:t,children:t})}},S=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?d.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.INSERTION}],i=e[m.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,d.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,d.isInterpolableWrapperNode)(e))return i=>(0,d.transformInterpolableNode)(e,i,n,t.plugins,r);let i=r(e,{...n,children:e,plugins:(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)});return e=>{let a=(0,d.splitInsertionTemplate)(i,e),o=a.isSimple?a.parts:a.parts.join(``);return r(o,{...n,plugins:t.plugins,children:o})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return typeof i==`object`&&i&&`nodeType`in i&&[m.ENUMERATION,m.CONDITION].includes(i.nodeType)?e=>t=>{let n=o(t);return typeof n==`function`?n(e):n}:o}},C=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?d.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,{keyPath:a,dictionaryKey:o}=i,s=n((0,p.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>c.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),l=_(e),u=t=>{let n=_(e,{components:t});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(a??[]))}" dictionary-key="${y(String(o??``))}">${n}</intlayer-content-selector-wrapper>`,e):v(n,e)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(a??[]))}" dictionary-key="${y(String(o??``))}">${l}</intlayer-content-selector-wrapper>`,e,{metadata:s,use:u}):v(l,e,{metadata:s,use:u})}},w=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?d.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.MARKDOWN}],i=e[m.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[C,...t.plugins??[]]})}},T=process.env.INTLAYER_NODE_TYPE_HTML===`false`?d.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.HTML,transform:(e,t)=>{let n=e[m.HTML],{keyPath:r,dictionaryKey:i}=t,a=(e={})=>{let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e).map(([e,t])=>[e,e=>t(e)])),a=new Proxy(t,{get(e,t){if(typeof t==`string`&&t in e)return e[t];if(typeof t==`string`&&/^[a-z][a-z0-9]*$/.test(t))return e=>g.html`<${(0,g.unsafeStatic)(t)} ...${e}>${e.children}</${(0,g.unsafeStatic)(t)}>`}}),o=(0,d.getHTML)(n,a);return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(r??[]))}" dictionary-key="${y(String(i??``))}">${o}</intlayer-content-selector-wrapper>`,n):v(o,n)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(r??[]))}" dictionary-key="${y(String(i??``))}">${n}</intlayer-content-selector-wrapper>`,n,{use:a}):v(n,n,{use:a})}},E=new Map,D=(e,t=!0)=>{let n=e??(typeof window<`u`&&l.r()?.locale)??f.internationalization.defaultLocale,r=`${n}_${t}`;if(E.has(r))return E.get(r);let i=[(0,d.translationPlugin)(e??f.internationalization.defaultLocale,t?f.internationalization.defaultLocale:void 0),d.enumerationPlugin,(0,d.pluralPlugin)(n),d.conditionPlugin,(0,d.nestedPlugin)(n),d.filePlugin,d.genderPlugin,d.selectPlugin,x,S,w,T];return E.set(r,i),i};exports.getPlugins=D,exports.htmlPlugin=T,exports.insertionPlugin=S,exports.intlayerNodePlugins=x,exports.markdownPlugin=w,exports.markdownStringPlugin=C;
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { renderIntlayerNode as e } from "./renderIntlayerNode.mjs";
|
|
2
2
|
import { r as t } from "../installIntlayer-DWDo9T68.mjs";
|
|
3
3
|
import n from "./markdown/runtime.mjs";
|
|
4
|
-
import { conditionPlugin as r, enumerationPlugin as i, fallbackPlugin as a, filePlugin as o, genderPlugin as s, getHTML as c, isInterpolableWrapperNode as l, nestedPlugin as u, pluralPlugin as d,
|
|
5
|
-
import { editor as
|
|
6
|
-
import { compileWithOptions as
|
|
7
|
-
import * as
|
|
8
|
-
import { unsafeHTML as
|
|
9
|
-
import { html as
|
|
4
|
+
import { conditionPlugin as r, enumerationPlugin as i, fallbackPlugin as a, filePlugin as o, genderPlugin as s, getHTML as c, isInterpolableWrapperNode as l, nestedPlugin as u, pluralPlugin as d, selectPlugin as f, splitInsertionTemplate as p, transformInterpolableNode as m, translationPlugin as h } from "@intlayer/core/interpreter";
|
|
5
|
+
import { editor as g, internationalization as _ } from "@intlayer/config/built";
|
|
6
|
+
import { compileWithOptions as v, getMarkdownMetadata as y } from "@intlayer/core/markdown";
|
|
7
|
+
import * as b from "@intlayer/types/nodeType";
|
|
8
|
+
import { unsafeHTML as x } from "lit/directives/unsafe-html.js";
|
|
9
|
+
import { html as S, unsafeStatic as C } from "lit/static-html.js";
|
|
10
10
|
//#region src/plugins.ts
|
|
11
|
-
var
|
|
12
|
-
let r = typeof e == "string" ?
|
|
11
|
+
var w = (e = "", t = {}) => v(e, n, t), T = (e, t, n = {}) => {
|
|
12
|
+
let r = typeof e == "string" ? x(e) : e;
|
|
13
13
|
return new Proxy(r, { get(e, r, i) {
|
|
14
14
|
if (r === "value" || r === "raw") return t;
|
|
15
15
|
if (r === "toString" || r === Symbol.toPrimitive) return () => t;
|
|
16
16
|
if (r !== Symbol.iterator) return r === "__update" ? () => {} : r === "isJSX" ? !0 : r in n ? n[r] : Reflect.get(e, r, i);
|
|
17
17
|
} });
|
|
18
|
-
},
|
|
18
|
+
}, E = (e) => e.replace(/&/g, "&").replace(/"/g, """), D = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), O = {
|
|
19
19
|
id: "intlayer-node-plugin",
|
|
20
20
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
21
21
|
transform: (t, { children: n, keyPath: r, dictionaryKey: i, ...a }) => {
|
|
22
|
-
if (process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
22
|
+
if (process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled) {
|
|
23
23
|
let e = String(n ?? "");
|
|
24
|
-
return
|
|
24
|
+
return T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(r ?? []))}" dictionary-key="${E(String(i ?? ""))}">${D(e)}</intlayer-content-selector-wrapper>`, e);
|
|
25
25
|
}
|
|
26
26
|
return e({
|
|
27
27
|
...a,
|
|
@@ -29,22 +29,22 @@ var C = (e = "", t = {}) => _(e, n, t), w = (e, t, n = {}) => {
|
|
|
29
29
|
children: n
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
},
|
|
32
|
+
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? a : {
|
|
33
33
|
id: "insertion-plugin",
|
|
34
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
34
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === b.INSERTION,
|
|
35
35
|
transform: (e, t, n) => {
|
|
36
|
-
let r = [...t.keyPath, { type:
|
|
36
|
+
let r = [...t.keyPath, { type: b.INSERTION }], i = e[b.INSERTION], a = {
|
|
37
37
|
id: "insertion-string-plugin",
|
|
38
38
|
canHandle: (e) => typeof e == "string" || l(e),
|
|
39
39
|
transform: (e, n, r) => {
|
|
40
|
-
if (l(e)) return (i) =>
|
|
40
|
+
if (l(e)) return (i) => m(e, i, n, t.plugins, r);
|
|
41
41
|
let i = r(e, {
|
|
42
42
|
...n,
|
|
43
43
|
children: e,
|
|
44
44
|
plugins: (t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")
|
|
45
45
|
});
|
|
46
46
|
return (e) => {
|
|
47
|
-
let a =
|
|
47
|
+
let a = p(i, e), o = a.isSimple ? a.parts : a.parts.join("");
|
|
48
48
|
return r(o, {
|
|
49
49
|
...n,
|
|
50
50
|
plugins: t.plugins,
|
|
@@ -58,16 +58,16 @@ var C = (e = "", t = {}) => _(e, n, t), w = (e, t, n = {}) => {
|
|
|
58
58
|
keyPath: r,
|
|
59
59
|
plugins: [a, ...t.plugins ?? []]
|
|
60
60
|
});
|
|
61
|
-
return typeof i == "object" && i && "nodeType" in i && [
|
|
61
|
+
return typeof i == "object" && i && "nodeType" in i && [b.ENUMERATION, b.CONDITION].includes(i.nodeType) ? (e) => (t) => {
|
|
62
62
|
let n = o(t);
|
|
63
63
|
return typeof n == "function" ? n(e) : n;
|
|
64
64
|
} : o;
|
|
65
65
|
}
|
|
66
|
-
},
|
|
66
|
+
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? a : {
|
|
67
67
|
id: "markdown-string-plugin",
|
|
68
68
|
canHandle: (e) => typeof e == "string",
|
|
69
69
|
transform: (t, n, r) => {
|
|
70
|
-
let { plugins: i, ...a } = n, { keyPath: o, dictionaryKey: s } = a, c = r(
|
|
70
|
+
let { plugins: i, ...a } = n, { keyPath: o, dictionaryKey: s } = a, c = r(y(t) ?? {}, {
|
|
71
71
|
plugins: [{
|
|
72
72
|
id: "markdown-metadata-plugin",
|
|
73
73
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
@@ -79,60 +79,61 @@ var C = (e = "", t = {}) => _(e, n, t), w = (e, t, n = {}) => {
|
|
|
79
79
|
}],
|
|
80
80
|
dictionaryKey: a.dictionaryKey,
|
|
81
81
|
keyPath: []
|
|
82
|
-
}), l =
|
|
83
|
-
let n =
|
|
84
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
82
|
+
}), l = w(t), u = (e) => {
|
|
83
|
+
let n = w(t, { components: e });
|
|
84
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(o ?? []))}" dictionary-key="${E(String(s ?? ""))}">${n}</intlayer-content-selector-wrapper>`, t) : T(n, t);
|
|
85
85
|
};
|
|
86
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
86
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(o ?? []))}" dictionary-key="${E(String(s ?? ""))}">${l}</intlayer-content-selector-wrapper>`, t, {
|
|
87
87
|
metadata: c,
|
|
88
88
|
use: u
|
|
89
|
-
}) :
|
|
89
|
+
}) : T(l, t, {
|
|
90
90
|
metadata: c,
|
|
91
91
|
use: u
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
},
|
|
94
|
+
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? a : {
|
|
95
95
|
id: "markdown-plugin",
|
|
96
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
96
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === b.MARKDOWN,
|
|
97
97
|
transform: (e, t, n) => {
|
|
98
|
-
let r = [...t.keyPath, { type:
|
|
98
|
+
let r = [...t.keyPath, { type: b.MARKDOWN }], i = e[b.MARKDOWN];
|
|
99
99
|
return n(i, {
|
|
100
100
|
...t,
|
|
101
101
|
children: i,
|
|
102
102
|
keyPath: r,
|
|
103
|
-
plugins: [
|
|
103
|
+
plugins: [A, ...t.plugins ?? []]
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
},
|
|
106
|
+
}, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? a : {
|
|
107
107
|
id: "html-plugin",
|
|
108
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
108
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === b.HTML,
|
|
109
109
|
transform: (e, t) => {
|
|
110
|
-
let n = e[
|
|
110
|
+
let n = e[b.HTML], { keyPath: r, dictionaryKey: i } = t, a = (e = {}) => {
|
|
111
111
|
let t = Object.fromEntries(Object.entries(e).filter(([, e]) => e).map(([e, t]) => [e, (e) => t(e)])), a = new Proxy(t, { get(e, t) {
|
|
112
112
|
if (typeof t == "string" && t in e) return e[t];
|
|
113
|
-
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return (e) =>
|
|
113
|
+
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return (e) => S`<${C(t)} ...${e}>${e.children}</${C(t)}>`;
|
|
114
114
|
} }), o = c(n, a);
|
|
115
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
115
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(r ?? []))}" dictionary-key="${E(String(i ?? ""))}">${o}</intlayer-content-selector-wrapper>`, n) : T(o, n);
|
|
116
116
|
};
|
|
117
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
117
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(r ?? []))}" dictionary-key="${E(String(i ?? ""))}">${n}</intlayer-content-selector-wrapper>`, n, { use: a }) : T(n, n, { use: a });
|
|
118
118
|
}
|
|
119
|
-
},
|
|
120
|
-
let a = e ?? (typeof window < "u" && t()?.locale) ??
|
|
121
|
-
if (
|
|
119
|
+
}, N = /* @__PURE__ */ new Map(), P = (e, n = !0) => {
|
|
120
|
+
let a = e ?? (typeof window < "u" && t()?.locale) ?? _.defaultLocale, c = `${a}_${n}`;
|
|
121
|
+
if (N.has(c)) return N.get(c);
|
|
122
122
|
let l = [
|
|
123
|
-
|
|
123
|
+
h(e ?? _.defaultLocale, n ? _.defaultLocale : void 0),
|
|
124
124
|
i,
|
|
125
125
|
d(a),
|
|
126
126
|
r,
|
|
127
127
|
u(a),
|
|
128
128
|
o,
|
|
129
129
|
s,
|
|
130
|
-
|
|
130
|
+
f,
|
|
131
131
|
O,
|
|
132
|
-
|
|
133
|
-
j
|
|
132
|
+
k,
|
|
133
|
+
j,
|
|
134
|
+
M
|
|
134
135
|
];
|
|
135
|
-
return
|
|
136
|
+
return N.set(c, l), l;
|
|
136
137
|
};
|
|
137
138
|
//#endregion
|
|
138
|
-
export {
|
|
139
|
+
export { P as getPlugins, M as htmlPlugin, k as insertionPlugin, O as intlayerNodePlugins, j as markdownPlugin, A as markdownStringPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/plugins.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,oBAAoB,IAAI,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AAM,CAAC,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;CAChB,GACG;IACE,gFAAgF;IAChF,GAAG,EAAE,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC;CACxE,GACD,KAAK,CAAC;AAEV,eAAO,MAAM,UAAU,EAAE,OA4DlB,CAAC;AAER;;mDAEmD;AAEnD,MAAM,WAAW,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,aAAa;IAClE,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACrC,YAAY,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACrC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAC7B,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CAC5B;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,2BAA2B,EAC3B,WAAW,CACZ,GAAG;IACF,eAAe,EAAE,IAAI,CAAC;IACtB,YAAY,EAAE,IAAI,CAAC;IACnB,WAAW,EAAE,IAAI,CAAC;IAClB,OAAO,EAAE,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAC9B,CAAC,EACD,CAAC,SAAS,aAAa,GAAG,eAAe,IACvC,wBAAwB,CAAC,CAAC,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC;AAI5D,eAAO,MAAM,UAAU,GACrB,SAAS,aAAa,EACtB,kBAAe,KACd,OAAO,EAkCT,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-intlayer",
|
|
3
|
-
"version": "9.0
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Lit applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -103,14 +103,14 @@
|
|
|
103
103
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@intlayer/api": "9.0
|
|
107
|
-
"@intlayer/config": "9.0
|
|
108
|
-
"@intlayer/core": "9.0
|
|
109
|
-
"@intlayer/editor": "9.0
|
|
110
|
-
"@intlayer/types": "9.0
|
|
106
|
+
"@intlayer/api": "9.1.0",
|
|
107
|
+
"@intlayer/config": "9.1.0",
|
|
108
|
+
"@intlayer/core": "9.1.0",
|
|
109
|
+
"@intlayer/editor": "9.1.0",
|
|
110
|
+
"@intlayer/types": "9.1.0"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@types/node": "26.1.
|
|
113
|
+
"@types/node": "26.1.2",
|
|
114
114
|
"@typescript/typescript6": "^6.0.2",
|
|
115
115
|
"@utils/ts-config": "1.0.4",
|
|
116
116
|
"@utils/ts-config-types": "1.0.4",
|
|
@@ -119,12 +119,12 @@
|
|
|
119
119
|
"rimraf": "6.1.3",
|
|
120
120
|
"tsdown": "0.22.14",
|
|
121
121
|
"typescript": "7.0.2",
|
|
122
|
-
"vite": "8.
|
|
122
|
+
"vite": "8.2.0",
|
|
123
123
|
"vite-plugin-dts": "5.0.3",
|
|
124
124
|
"vitest": "4.1.10"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
|
-
"intlayer": "9.0
|
|
127
|
+
"intlayer": "9.1.0",
|
|
128
128
|
"lit": ">=3.0.0"
|
|
129
129
|
},
|
|
130
130
|
"peerDependenciesMeta": {
|