lit-intlayer 9.9.0 → 9.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cjs/client/IntlayerBinding.cjs +1 -1
  2. package/dist/cjs/client/index.cjs +1 -1
  3. package/dist/cjs/client/installIntlayer.cjs +1 -1
  4. package/dist/cjs/client/useDictionary.cjs +1 -1
  5. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
  6. package/dist/cjs/client/useIntlayer.cjs +1 -1
  7. package/dist/cjs/client/useLocale.cjs +1 -1
  8. package/dist/cjs/client/useRewriteURL.cjs +1 -1
  9. package/dist/cjs/editor/useEditor.cjs +1 -1
  10. package/dist/cjs/format/useCompact.cjs +1 -1
  11. package/dist/cjs/format/useCurrency.cjs +1 -1
  12. package/dist/cjs/format/useDate.cjs +1 -1
  13. package/dist/cjs/format/useIntl.cjs +1 -1
  14. package/dist/cjs/format/useList.cjs +1 -1
  15. package/dist/cjs/format/useNumber.cjs +1 -1
  16. package/dist/cjs/format/usePercentage.cjs +1 -1
  17. package/dist/cjs/format/useRelativeTime.cjs +1 -1
  18. package/dist/cjs/format/useUnit.cjs +1 -1
  19. package/dist/cjs/getDictionary.cjs +1 -1
  20. package/dist/cjs/getIntlayer.cjs +1 -1
  21. package/dist/cjs/html/HTMLRenderer.cjs +1 -1
  22. package/dist/cjs/index.cjs +1 -1
  23. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
  24. package/dist/cjs/markdown/compiler.cjs +1 -1
  25. package/dist/cjs/plugins.cjs +3 -3
  26. package/dist/esm/client/IntlayerBinding.mjs +7 -7
  27. package/dist/esm/client/index.mjs +1 -1
  28. package/dist/esm/client/installIntlayer.mjs +1 -1
  29. package/dist/esm/client/useDictionary.mjs +5 -5
  30. package/dist/esm/client/useDictionaryDynamic.mjs +6 -6
  31. package/dist/esm/client/useIntlayer.mjs +5 -5
  32. package/dist/esm/client/useLocale.mjs +14 -14
  33. package/dist/esm/client/useRewriteURL.mjs +8 -8
  34. package/dist/esm/editor/useEditor.mjs +1 -1
  35. package/dist/esm/format/useCompact.mjs +10 -10
  36. package/dist/esm/format/useCurrency.mjs +10 -10
  37. package/dist/esm/format/useDate.mjs +15 -15
  38. package/dist/esm/format/useIntl.mjs +7 -7
  39. package/dist/esm/format/useList.mjs +10 -10
  40. package/dist/esm/format/useNumber.mjs +10 -10
  41. package/dist/esm/format/usePercentage.mjs +10 -10
  42. package/dist/esm/format/useRelativeTime.mjs +10 -10
  43. package/dist/esm/format/useUnit.mjs +10 -10
  44. package/dist/esm/getDictionary.mjs +3 -3
  45. package/dist/esm/getIntlayer.mjs +3 -3
  46. package/dist/esm/html/HTMLRenderer.mjs +9 -9
  47. package/dist/esm/index.mjs +1 -1
  48. package/dist/esm/markdown/MarkdownRenderer.mjs +13 -13
  49. package/dist/esm/markdown/compiler.mjs +10 -10
  50. package/dist/esm/markdown/runtime.mjs +1 -1
  51. package/dist/esm/plugins.mjs +62 -62
  52. package/dist/{installIntlayer-Btnci_ES.js → installIntlayer-CFvvijL7.js} +1 -1
  53. package/dist/{installIntlayer-Dvl7Prhw.mjs → installIntlayer-CTpPd7yz.mjs} +15 -15
  54. package/package.json +10 -10
@@ -1,5 +1,5 @@
1
- import { r as e } from "../../installIntlayer-Dvl7Prhw.mjs";
2
- import { number as t } from "@intlayer/core/formatters";
1
+ import { number as e } from "@intlayer/core/formatters";
2
+ import { r as t } from "../../installIntlayer-CTpPd7yz.mjs";
3
3
  // src/format/useNumber.ts
4
4
  var n = class {
5
5
  host;
@@ -7,18 +7,18 @@ var n = class {
7
7
  value;
8
8
  constructor(n) {
9
9
  this.host = n;
10
- let r = e();
11
- this.value = (...e) => t(e[0], {
12
- ...e[1],
13
- locale: e[1]?.locale ?? r.locale
10
+ let r = t();
11
+ this.value = (...t) => e(t[0], {
12
+ ...t[1],
13
+ locale: t[1]?.locale ?? r.locale
14
14
  }), n.addController(this);
15
15
  }
16
16
  hostConnected() {
17
- let n = e();
18
- this._unsubscribe = n.subscribe((e) => {
19
- this.value = (...n) => t(n[0], {
17
+ let n = t();
18
+ this._unsubscribe = n.subscribe((t) => {
19
+ this.value = (...n) => e(n[0], {
20
20
  ...n[1],
21
- locale: n[1]?.locale ?? e
21
+ locale: n[1]?.locale ?? t
22
22
  }), this.host.requestUpdate();
23
23
  });
24
24
  }
@@ -1,5 +1,5 @@
1
- import { r as e } from "../../installIntlayer-Dvl7Prhw.mjs";
2
- import { percentage as t } from "@intlayer/core/formatters";
1
+ import { percentage as e } from "@intlayer/core/formatters";
2
+ import { r as t } from "../../installIntlayer-CTpPd7yz.mjs";
3
3
  // src/format/usePercentage.ts
4
4
  var n = class {
5
5
  host;
@@ -7,18 +7,18 @@ var n = class {
7
7
  value;
8
8
  constructor(n) {
9
9
  this.host = n;
10
- let r = e();
11
- this.value = (...e) => t(e[0], {
12
- ...e[1],
13
- locale: e[1]?.locale ?? r.locale
10
+ let r = t();
11
+ this.value = (...t) => e(t[0], {
12
+ ...t[1],
13
+ locale: t[1]?.locale ?? r.locale
14
14
  }), n.addController(this);
15
15
  }
16
16
  hostConnected() {
17
- let n = e();
18
- this._unsubscribe = n.subscribe((e) => {
19
- this.value = (...n) => t(n[0], {
17
+ let n = t();
18
+ this._unsubscribe = n.subscribe((t) => {
19
+ this.value = (...n) => e(n[0], {
20
20
  ...n[1],
21
- locale: n[1]?.locale ?? e
21
+ locale: n[1]?.locale ?? t
22
22
  }), this.host.requestUpdate();
23
23
  });
24
24
  }
@@ -1,5 +1,5 @@
1
- import { r as e } from "../../installIntlayer-Dvl7Prhw.mjs";
2
- import { relativeTime as t } from "@intlayer/core/formatters";
1
+ import { relativeTime as e } from "@intlayer/core/formatters";
2
+ import { r as t } from "../../installIntlayer-CTpPd7yz.mjs";
3
3
  // src/format/useRelativeTime.ts
4
4
  var n = class {
5
5
  host;
@@ -7,18 +7,18 @@ var n = class {
7
7
  value;
8
8
  constructor(n) {
9
9
  this.host = n;
10
- let r = e();
11
- this.value = (...e) => t(e[0], e[1], {
12
- ...e[2],
13
- locale: e[2]?.locale ?? r.locale
10
+ let r = t();
11
+ this.value = (...t) => e(t[0], t[1], {
12
+ ...t[2],
13
+ locale: t[2]?.locale ?? r.locale
14
14
  }), n.addController(this);
15
15
  }
16
16
  hostConnected() {
17
- let n = e();
18
- this._unsubscribe = n.subscribe((e) => {
19
- this.value = (...n) => t(n[0], n[1], {
17
+ let n = t();
18
+ this._unsubscribe = n.subscribe((t) => {
19
+ this.value = (...n) => e(n[0], n[1], {
20
20
  ...n[2],
21
- locale: n[2]?.locale ?? e
21
+ locale: n[2]?.locale ?? t
22
22
  }), this.host.requestUpdate();
23
23
  });
24
24
  }
@@ -1,5 +1,5 @@
1
- import { r as e } from "../../installIntlayer-Dvl7Prhw.mjs";
2
- import { units as t } from "@intlayer/core/formatters";
1
+ import { units as e } from "@intlayer/core/formatters";
2
+ import { r as t } from "../../installIntlayer-CTpPd7yz.mjs";
3
3
  // src/format/useUnit.ts
4
4
  var n = class {
5
5
  host;
@@ -7,18 +7,18 @@ var n = class {
7
7
  value;
8
8
  constructor(n) {
9
9
  this.host = n;
10
- let r = e();
11
- this.value = (...e) => t(e[0], {
12
- ...e[1],
13
- locale: e[1]?.locale ?? r.locale
10
+ let r = t();
11
+ this.value = (...t) => e(t[0], {
12
+ ...t[1],
13
+ locale: t[1]?.locale ?? r.locale
14
14
  }), n.addController(this);
15
15
  }
16
16
  hostConnected() {
17
- let n = e();
18
- this._unsubscribe = n.subscribe((e) => {
19
- this.value = (...n) => t(n[0], {
17
+ let n = t();
18
+ this._unsubscribe = n.subscribe((t) => {
19
+ this.value = (...n) => e(n[0], {
20
20
  ...n[1],
21
- locale: n[1]?.locale ?? e
21
+ locale: n[1]?.locale ?? t
22
22
  }), this.host.requestUpdate();
23
23
  });
24
24
  }
@@ -1,8 +1,8 @@
1
- import { getPlugins as e } from "./plugins.mjs";
2
- import { getDictionary as t } from "@intlayer/core/interpreter";
1
+ import { getDictionary as e } from "@intlayer/core/interpreter";
2
+ import { getPlugins as t } from "./plugins.mjs";
3
3
  // src/getDictionary.ts
4
4
  var n = (n, r) => {
5
5
  let i = typeof r == "object" && r ? r.locale : r;
6
- return t(n, r, e(i));
6
+ return e(n, r, t(i));
7
7
  };
8
8
  export { n as getDictionary };
@@ -1,8 +1,8 @@
1
- import { getPlugins as e } from "./plugins.mjs";
2
- import { getIntlayer as t } from "@intlayer/core/interpreter";
1
+ import { getIntlayer as e } from "@intlayer/core/interpreter";
2
+ import { getPlugins as t } from "./plugins.mjs";
3
3
  // src/getIntlayer.ts
4
4
  var n = (n, r) => {
5
5
  let i = typeof r == "object" && r ? r.locale : r;
6
- return t(n, r, e(i));
6
+ return e(n, r, t(i));
7
7
  };
8
8
  export { n as getIntlayer };
@@ -1,11 +1,11 @@
1
- import { useHTML as e } from "./installIntlayerHTML.mjs";
2
- import { unsafeHTML as t } from "lit/directives/unsafe-html.js";
3
- import { LitElement as n, html as r, nothing as i } from "lit";
1
+ import { LitElement as e, html as t, nothing as n } from "lit";
2
+ import { unsafeHTML as r } from "lit/directives/unsafe-html.js";
3
+ import { useHTML as i } from "./installIntlayerHTML.mjs";
4
4
  // src/html/HTMLRenderer.ts
5
- var a = (e, t = {}) => e, o = ({ components: t } = {}) => {
6
- let n = e();
7
- return (e) => n.renderHTML(e, { components: t });
8
- }, s = class extends n {
5
+ var a = (e, t = {}) => e, o = ({ components: e } = {}) => {
6
+ let t = i();
7
+ return (n) => t.renderHTML(n, { components: e });
8
+ }, s = class extends e {
9
9
  static properties = {
10
10
  content: { type: String },
11
11
  components: { attribute: !1 }
@@ -16,9 +16,9 @@ var a = (e, t = {}) => e, o = ({ components: t } = {}) => {
16
16
  return this;
17
17
  }
18
18
  render() {
19
- if (!this.content) return i;
19
+ if (!this.content) return n;
20
20
  let e = o({ components: this.components });
21
- return r`${t(e(this.content))}`;
21
+ return t`${r(e(this.content))}`;
22
22
  }
23
23
  };
24
24
  customElements.get("intlayer-html-renderer") || customElements.define("intlayer-html-renderer", s);
@@ -1,5 +1,5 @@
1
1
  import { getLocaleInStorage as e, localeCookie as t, localeInStorage as n, setLocaleCookie as r, setLocaleInStorage as i, useLocaleCookie as a, useLocaleStorage as o } from "./client/useLocaleStorage.mjs";
2
- import { a as s, i as c, n as l, r as u, t as d } from "../installIntlayer-Dvl7Prhw.mjs";
2
+ import { a as s, i as c, n as l, r as u, t as d } from "../installIntlayer-CTpPd7yz.mjs";
3
3
  import { getDictionary as f } from "./getDictionary.mjs";
4
4
  import { getIntlayer as p } from "./getIntlayer.mjs";
5
5
  import { IntlayerBinding as m, createContentProxy as h } from "./client/IntlayerBinding.mjs";
@@ -1,22 +1,22 @@
1
- import { compileMarkdown as e } from "./compiler.mjs";
2
- import { useMarkdown as t } from "./installIntlayerMarkdown.mjs";
3
- import { unsafeHTML as n } from "lit/directives/unsafe-html.js";
4
- import { LitElement as r, html as i, nothing as a } from "lit";
1
+ import { LitElement as e, html as t, nothing as n } from "lit";
2
+ import { unsafeHTML as r } from "lit/directives/unsafe-html.js";
3
+ import { compileMarkdown as i } from "./compiler.mjs";
4
+ import { useMarkdown as a } from "./installIntlayerMarkdown.mjs";
5
5
  // src/markdown/MarkdownRenderer.ts
6
- var o = (t, { forceBlock: n, forceInline: r, preserveFrontmatter: i, tagfilter: a } = {}) => e(t, {
7
- forceBlock: n,
8
- forceInline: r,
9
- preserveFrontmatter: i,
6
+ var o = (e, { forceBlock: t, forceInline: n, preserveFrontmatter: r, tagfilter: a } = {}) => i(e, {
7
+ forceBlock: t,
8
+ forceInline: n,
9
+ preserveFrontmatter: r,
10
10
  tagfilter: a
11
11
  }), s = (e = {}) => {
12
- let n = t();
13
- return (t) => n.renderMarkdown(t, {
12
+ let t = a();
13
+ return (n) => t.renderMarkdown(n, {
14
14
  forceBlock: e.forceBlock,
15
15
  forceInline: e.forceInline,
16
16
  preserveFrontmatter: e.preserveFrontmatter,
17
17
  tagfilter: e.tagfilter
18
18
  }, e.components, e.wrapper);
19
- }, c = class extends r {
19
+ }, c = class extends e {
20
20
  static properties = {
21
21
  content: { type: [String, Object] },
22
22
  forceBlock: { type: Boolean },
@@ -35,7 +35,7 @@ var o = (t, { forceBlock: n, forceInline: r, preserveFrontmatter: i, tagfilter:
35
35
  return this;
36
36
  }
37
37
  render() {
38
- if (!this.content) return a;
38
+ if (!this.content) return n;
39
39
  let e;
40
40
  return e = this.renderMarkdownFn ? this.renderMarkdownFn(this.content, {
41
41
  forceBlock: this.forceBlock,
@@ -47,7 +47,7 @@ var o = (t, { forceBlock: n, forceInline: r, preserveFrontmatter: i, tagfilter:
47
47
  forceInline: this.forceInline,
48
48
  preserveFrontmatter: this.preserveFrontmatter,
49
49
  tagfilter: this.tagfilter
50
- })(this.content), i`${n(e)}`;
50
+ })(this.content), t`${r(e)}`;
51
51
  }
52
52
  };
53
53
  customElements.get("intlayer-markdown-renderer") || customElements.define("intlayer-markdown-renderer", c);
@@ -1,20 +1,20 @@
1
- import e from "./runtime.mjs";
2
- import { compileWithOptions as t, parseMarkdown as n, renderMarkdownAst as r } from "@intlayer/core/markdown";
1
+ import { compileWithOptions as e, parseMarkdown as t, renderMarkdownAst as n } from "@intlayer/core/markdown";
2
+ import r from "./runtime.mjs";
3
3
  // src/markdown/compiler.ts
4
- var i = (t = "", r = {}) => {
5
- let { components: i, namedCodesToUnicode: a, sanitizer: o, slugify: s, ...c } = r;
6
- return n(t, {
7
- runtime: e,
4
+ var i = (e = "", n = {}) => {
5
+ let { components: i, namedCodesToUnicode: a, sanitizer: o, slugify: s, ...c } = n;
6
+ return t(e, {
7
+ runtime: r,
8
8
  components: i,
9
9
  namedCodesToUnicode: a,
10
10
  sanitizer: o,
11
11
  slugify: s
12
12
  }, c);
13
- }, a = (n = "", i = {}) => {
14
- if (typeof n == "string") return t(n, e, i);
13
+ }, a = (t = "", i = {}) => {
14
+ if (typeof t == "string") return e(t, r, i);
15
15
  let { components: a, namedCodesToUnicode: o, sanitizer: s, slugify: c, ...l } = i;
16
- return r(n, {
17
- runtime: e,
16
+ return n(t, {
17
+ runtime: r,
18
18
  components: a,
19
19
  namedCodesToUnicode: o,
20
20
  sanitizer: s,
@@ -16,7 +16,7 @@ var e = /* @__PURE__ */ new Set([
16
16
  "wbr"
17
17
  ]), t = (e) => e ? Object.entries(e).filter(([e, t]) => t != null && e !== "key").map(([e, t]) => typeof t == "boolean" ? t ? e : "" : e === "_innerHTML" ? "" : `${e}="${String(t).replace(/&/g, "&").replace(/"/g, """)}"`).filter(Boolean).join(" ") : "", n = "__lit_fragment__", r = {
18
18
  createElement: (r, i, ...a) => {
19
- let o = a.flat(Infinity).join("");
19
+ let o = a.flat(1e400).join("");
20
20
  if (r === n) return o;
21
21
  if (typeof r == "string") {
22
22
  let n = t(i), a = n ? ` ${n}` : "", s = i?._innerHTML;
@@ -1,52 +1,52 @@
1
- import { r as e } from "../installIntlayer-Dvl7Prhw.mjs";
2
- import t from "./markdown/runtime.mjs";
3
- import { renderIntlayerNode as n } from "./renderIntlayerNode.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, resolveInsertedSelector as f, resolveInterpreterLocale as p, selectPlugin as m, splitInsertionTemplate as h, transformInterpolableNode as g, translationPlugin as _ } from "@intlayer/core/interpreter";
5
- import { editor as v, internationalization as y } from "@intlayer/config/built";
6
- import { compileWithOptions as b, getMarkdownMetadata as x } from "@intlayer/core/markdown";
7
- import { getIntlayerNodePrototype as S } from "@intlayer/core/utils";
8
- import * as C from "@intlayer/types/nodeType";
9
- import { unsafeHTML as w } from "lit/directives/unsafe-html.js";
10
- import { html as T, unsafeStatic as E } from "lit/static-html.js";
1
+ import { editor as e, internationalization as t } from "@intlayer/config/built";
2
+ import { conditionPlugin as n, enumerationPlugin as r, fallbackPlugin as i, filePlugin as a, genderPlugin as o, getHTML as s, isInterpolableWrapperNode as c, nestedPlugin as l, pluralPlugin as u, resolveInsertedSelector as d, resolveInterpreterLocale as f, selectPlugin as p, splitInsertionTemplate as m, transformInterpolableNode as h, translationPlugin as g } from "@intlayer/core/interpreter";
3
+ import { compileWithOptions as _, getMarkdownMetadata as v } from "@intlayer/core/markdown";
4
+ import { getIntlayerNodePrototype as y } from "@intlayer/core/utils";
5
+ import * as b from "@intlayer/types/nodeType";
6
+ import { unsafeHTML as x } from "lit/directives/unsafe-html.js";
7
+ import { html as S, unsafeStatic as C } from "lit/static-html.js";
8
+ import { r as w } from "../installIntlayer-CTpPd7yz.mjs";
9
+ import T from "./markdown/runtime.mjs";
10
+ import { renderIntlayerNode as E } from "./renderIntlayerNode.mjs";
11
11
  // src/plugins.ts
12
- var D = (e = "", n = {}) => b(e, t, n), O = (e, t, n = {}) => {
13
- let r = typeof e == "string" ? w(e) : e, i = Array.isArray(r), a = Object.assign(i ? [...r] : { ...r }, n, {
12
+ var D = (e = "", t = {}) => _(e, T, t), O = (e, t, n = {}) => {
13
+ let r = typeof e == "string" ? x(e) : e, i = Array.isArray(r), a = Object.assign(i ? [...r] : { ...r }, n, {
14
14
  value: t,
15
15
  raw: t,
16
16
  [Symbol.iterator]: void 0,
17
17
  __update: () => {},
18
18
  isJSX: !0
19
19
  });
20
- return Object.setPrototypeOf(a, S(t, i ? Array.prototype : Object.prototype));
20
+ return Object.setPrototypeOf(a, y(t, i ? Array.prototype : Object.prototype));
21
21
  }, k = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;"), A = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), j = {
22
22
  id: "intlayer-node-plugin",
23
23
  canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
24
- transform: (e, { children: t, keyPath: r, dictionaryKey: i }) => {
25
- if (process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled) {
26
- let e = String(t ?? "");
24
+ transform: (t, { children: n, keyPath: r, dictionaryKey: i }) => {
25
+ if (process.env.INTLAYER_EDITOR_ENABLED !== "false" && e.enabled) {
26
+ let e = String(n ?? "");
27
27
  return O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(r ?? []))}" dictionary-key="${k(String(i ?? ""))}">${A(e)}</intlayer-content-selector-wrapper>`, e);
28
28
  }
29
- return n({
30
- value: t,
31
- children: t
29
+ return E({
30
+ value: n,
31
+ children: n
32
32
  });
33
33
  }
34
- }, M = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? a : {
34
+ }, M = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? i : {
35
35
  id: "insertion-plugin",
36
- canHandle: (e) => typeof e == "object" && e?.nodeType === C.INSERTION,
36
+ canHandle: (e) => typeof e == "object" && e?.nodeType === b.INSERTION,
37
37
  transform: (e, t, n) => {
38
- let r = [...t.keyPath, { type: C.INSERTION }], i = e[C.INSERTION], a = {
38
+ let r = [...t.keyPath, { type: b.INSERTION }], i = e[b.INSERTION], a = {
39
39
  id: "insertion-string-plugin",
40
- canHandle: (e) => typeof e == "string" || l(e),
40
+ canHandle: (e) => typeof e == "string" || c(e),
41
41
  transform: (e, n, r) => {
42
- if (l(e)) return (i) => g(e, i, n, t.plugins, r);
42
+ if (c(e)) return (i) => h(e, i, n, t.plugins, r);
43
43
  let i = r(e, {
44
44
  ...n,
45
45
  children: e,
46
46
  plugins: (t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")
47
47
  });
48
48
  return (e) => {
49
- let a = h(i, e), o = a.isSimple ? a.parts : a.parts.join("");
49
+ let a = m(i, e), o = a.isSimple ? a.parts : a.parts.join("");
50
50
  return r(o, {
51
51
  ...n,
52
52
  plugins: t.plugins,
@@ -60,41 +60,41 @@ var D = (e = "", n = {}) => b(e, t, n), O = (e, t, n = {}) => {
60
60
  keyPath: r,
61
61
  plugins: [a, ...t.plugins ?? []]
62
62
  });
63
- return f(i, o);
63
+ return d(i, o);
64
64
  }
65
- }, N = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? a : {
65
+ }, N = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? i : {
66
66
  id: "markdown-string-plugin",
67
67
  canHandle: (e) => typeof e == "string",
68
- transform: (e, t, r) => {
69
- let { plugins: i, ...a } = t, { keyPath: o, dictionaryKey: s } = a, c = r(x(e) ?? {}, {
68
+ transform: (t, n, r) => {
69
+ let { plugins: i, ...a } = n, { keyPath: o, dictionaryKey: s } = a, c = r(v(t) ?? {}, {
70
70
  plugins: [{
71
71
  id: "markdown-metadata-plugin",
72
72
  canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
73
- transform: (t, r) => n({
74
- ...r,
75
- value: t,
76
- children: e
73
+ transform: (e, n) => E({
74
+ ...n,
75
+ value: e,
76
+ children: t
77
77
  })
78
78
  }],
79
79
  dictionaryKey: a.dictionaryKey,
80
80
  keyPath: []
81
- }), l = D(e), u = (t) => {
82
- let n = D(e, { components: t });
83
- return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(o ?? []))}" dictionary-key="${k(String(s ?? ""))}">${n}</intlayer-content-selector-wrapper>`, e) : O(n, e);
81
+ }), l = D(t), u = (n) => {
82
+ let r = D(t, { components: n });
83
+ return process.env.INTLAYER_EDITOR_ENABLED !== "false" && e.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(o ?? []))}" dictionary-key="${k(String(s ?? ""))}">${r}</intlayer-content-selector-wrapper>`, t) : O(r, t);
84
84
  };
85
- return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(o ?? []))}" dictionary-key="${k(String(s ?? ""))}">${l}</intlayer-content-selector-wrapper>`, e, {
85
+ return process.env.INTLAYER_EDITOR_ENABLED !== "false" && e.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(o ?? []))}" dictionary-key="${k(String(s ?? ""))}">${l}</intlayer-content-selector-wrapper>`, t, {
86
86
  metadata: c,
87
87
  use: u
88
- }) : O(l, e, {
88
+ }) : O(l, t, {
89
89
  metadata: c,
90
90
  use: u
91
91
  });
92
92
  }
93
- }, P = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? a : {
93
+ }, P = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? i : {
94
94
  id: "markdown-plugin",
95
- canHandle: (e) => typeof e == "object" && e?.nodeType === C.MARKDOWN,
95
+ canHandle: (e) => typeof e == "object" && e?.nodeType === b.MARKDOWN,
96
96
  transform: (e, t, n) => {
97
- let r = [...t.keyPath, { type: C.MARKDOWN }], i = e[C.MARKDOWN];
97
+ let r = [...t.keyPath, { type: b.MARKDOWN }], i = e[b.MARKDOWN];
98
98
  return n(i, {
99
99
  ...t,
100
100
  children: i,
@@ -102,38 +102,38 @@ var D = (e = "", n = {}) => b(e, t, n), O = (e, t, n = {}) => {
102
102
  plugins: [N, ...t.plugins ?? []]
103
103
  });
104
104
  }
105
- }, F = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? a : {
105
+ }, F = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? i : {
106
106
  id: "html-plugin",
107
- canHandle: (e) => typeof e == "object" && e?.nodeType === C.HTML,
108
- transform: (e, t) => {
109
- let n = e[C.HTML], { keyPath: r, dictionaryKey: i } = t, a = (e = {}) => {
110
- let t = Object.fromEntries(Object.entries(e).filter(([, e]) => e).map(([e, t]) => [e, (e) => t(e)])), a = new Proxy(t, { get(e, t) {
107
+ canHandle: (e) => typeof e == "object" && e?.nodeType === b.HTML,
108
+ transform: (t, n) => {
109
+ let r = t[b.HTML], { keyPath: i, dictionaryKey: a } = n, o = (t = {}) => {
110
+ let n = Object.fromEntries(Object.entries(t).filter(([, e]) => e).map(([e, t]) => [e, (e) => t(e)])), o = new Proxy(n, { get(e, t) {
111
111
  if (typeof t == "string" && t in e) return e[t];
112
- if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return (e) => T`<${E(t)} ...${e}
113
- >${e.children}</${E(t)}
112
+ if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return (e) => S`<${C(t)} ...${e}
113
+ >${e.children}</${C(t)}
114
114
  >`;
115
- } }), o = c(n, a);
116
- return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(r ?? []))}" dictionary-key="${k(String(i ?? ""))}">${o}</intlayer-content-selector-wrapper>`, n) : O(o, n);
115
+ } }), c = s(r, o);
116
+ return process.env.INTLAYER_EDITOR_ENABLED !== "false" && e.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(i ?? []))}" dictionary-key="${k(String(a ?? ""))}">${c}</intlayer-content-selector-wrapper>`, r) : O(c, r);
117
117
  };
118
- return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(r ?? []))}" dictionary-key="${k(String(i ?? ""))}">${n}</intlayer-content-selector-wrapper>`, n, { use: a }) : O(n, n, { use: a });
118
+ return process.env.INTLAYER_EDITOR_ENABLED !== "false" && e.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(i ?? []))}" dictionary-key="${k(String(a ?? ""))}">${r}</intlayer-content-selector-wrapper>`, r, { use: o }) : O(r, r, { use: o });
119
119
  }
120
- }, I = /* @__PURE__ */ new Map(), L = (t, n = !0) => {
121
- let c = t ?? (typeof window < "u" && e()?.locale) ?? p(), l = `${c}_${n}`;
122
- if (I.has(l)) return I.get(l);
123
- let f = [
120
+ }, I = /* @__PURE__ */ new Map(), L = (e, s = !0) => {
121
+ let c = e ?? (typeof window < "u" && w()?.locale) ?? f(), d = `${c}_${s}`;
122
+ if (I.has(d)) return I.get(d);
123
+ let m = [
124
124
  j,
125
- _(c, n ? y.defaultLocale : void 0),
126
- i,
127
- d(c),
125
+ g(c, s ? t.defaultLocale : void 0),
128
126
  r,
129
127
  u(c),
128
+ n,
129
+ l(c),
130
+ a,
130
131
  o,
131
- s,
132
- m,
132
+ p,
133
133
  M,
134
134
  P,
135
135
  F
136
- ].filter((e) => e !== a);
137
- return I.set(l, f), f;
136
+ ].filter((e) => e !== i);
137
+ return I.set(d, m), m;
138
138
  };
139
139
  export { L as getPlugins, F as htmlPlugin, M as insertionPlugin, j as intlayerNodePlugins, P as markdownPlugin, N as markdownStringPlugin };
@@ -1 +1 @@
1
- const e=require("./cjs/client/useLocaleStorage.cjs");let t=require("@intlayer/config/built"),n=require("@intlayer/config/client"),r=require("@intlayer/editor/isEnabled");var i=t=>{let n=u();t.currentLocale.set(n.locale);let r=n.subscribe(e=>{t.currentLocale.set(e)}),i=t.onLocaleChangeRequested(t=>{n.setLocale(t),e.setLocaleInStorage(t,n.isCookieEnabled)});return()=>{r(),i()}},a=class{host;_stopped=!1;_unsubscribeLocale=null;constructor(e){this.host=e,e.addController(this)}hostConnected(){this._stopped=!1,process.env.INTLAYER_EDITOR_ENABLED!==`false`&&r.isEnabled&&import(`@intlayer/editor`).then(({initEditorClient:e})=>{this._stopped||(this._unsubscribeLocale=i(e()))}).catch(()=>{})}hostDisconnected(){this._stopped=!0,this._unsubscribeLocale?.(),this._unsubscribeLocale=null,import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()}).catch(()=>{})}};function o(e){if(process.env.INTLAYER_EDITOR_ENABLED===`false`||!r.isEnabled)return e?void 0:()=>{};if(!e){let e=!1,t=null;return import(`@intlayer/editor`).then(({initEditorClient:n})=>{e||(t=i(n()))}).catch(()=>{}),()=>{e=!0,t?.(),import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()}).catch(()=>{})}}new a(e)}var s=class{_locale;_variant;_listeners=new Set;isCookieEnabled;constructor(r,i=!0,a){let{defaultLocale:o}=t.internationalization??{};(0,n.setIntlayerIdentifier)(),this._locale=r??e.getLocaleInStorage()??o,this._variant=a,this.isCookieEnabled=i}get locale(){return this._locale}get variant(){return this._variant}setLocale(e){this._locale=e;for(let t of this._listeners)t(e)}setVariant(e){this._variant=e;for(let e of this._listeners)e(this._locale)}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}},c=null,l=(e,t=!0,n)=>c||(c=new s(e,t,n),c),u=()=>(c||=new s,c),d=({locale:e,isCookieEnabled:t,variant:n}={})=>{let r=l(e,t,n);return o(),r};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
1
+ let e=require("@intlayer/config/built"),t=require("@intlayer/config/client"),n=require("@intlayer/editor/isEnabled");const r=require("./cjs/client/useLocaleStorage.cjs");var i=e=>{let t=u();e.currentLocale.set(t.locale);let n=t.subscribe(t=>{e.currentLocale.set(t)}),i=e.onLocaleChangeRequested(e=>{t.setLocale(e),r.setLocaleInStorage(e,t.isCookieEnabled)});return()=>{n(),i()}},a=class{host;_stopped=!1;_unsubscribeLocale=null;constructor(e){this.host=e,e.addController(this)}hostConnected(){this._stopped=!1,process.env.INTLAYER_EDITOR_ENABLED!==`false`&&n.isEnabled&&import(`@intlayer/editor`).then(({initEditorClient:e})=>{this._stopped||(this._unsubscribeLocale=i(e()))}).catch(()=>{})}hostDisconnected(){this._stopped=!0,this._unsubscribeLocale?.(),this._unsubscribeLocale=null,import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()}).catch(()=>{})}};function o(e){if(process.env.INTLAYER_EDITOR_ENABLED===`false`||!n.isEnabled)return e?void 0:()=>{};if(!e){let e=!1,t=null;return import(`@intlayer/editor`).then(({initEditorClient:n})=>{e||(t=i(n()))}).catch(()=>{}),()=>{e=!0,t?.(),import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()}).catch(()=>{})}}new a(e)}var s=class{_locale;_variant;_listeners=new Set;isCookieEnabled;constructor(n,i=!0,a){let{defaultLocale:o}=e.internationalization??{};(0,t.setIntlayerIdentifier)(),this._locale=n??r.getLocaleInStorage()??o,this._variant=a,this.isCookieEnabled=i}get locale(){return this._locale}get variant(){return this._variant}setLocale(e){this._locale=e;for(let t of this._listeners)t(e)}setVariant(e){this._variant=e;for(let e of this._listeners)e(this._locale)}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}},c=null,l=(e,t=!0,n)=>c||(c=new s(e,t,n),c),u=()=>(c||=new s,c),d=({locale:e,isCookieEnabled:t,variant:n}={})=>{let r=l(e,t,n);return o(),r};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
@@ -1,18 +1,18 @@
1
- import { getLocaleInStorage as e, setLocaleInStorage as t } from "./esm/client/useLocaleStorage.mjs";
2
- import { internationalization as n } from "@intlayer/config/built";
3
- import { setIntlayerIdentifier as r } from "@intlayer/config/client";
4
- import { isEnabled as i } from "@intlayer/editor/isEnabled";
1
+ import { internationalization as e } from "@intlayer/config/built";
2
+ import { setIntlayerIdentifier as t } from "@intlayer/config/client";
3
+ import { isEnabled as n } from "@intlayer/editor/isEnabled";
4
+ import { getLocaleInStorage as r, setLocaleInStorage as i } from "./esm/client/useLocaleStorage.mjs";
5
5
  // src/editor/useEditor.ts
6
6
  var a = (e) => {
7
- let n = d();
8
- e.currentLocale.set(n.locale);
9
- let r = n.subscribe((t) => {
7
+ let t = d();
8
+ e.currentLocale.set(t.locale);
9
+ let n = t.subscribe((t) => {
10
10
  e.currentLocale.set(t);
11
- }), i = e.onLocaleChangeRequested((e) => {
12
- n.setLocale(e), t(e, n.isCookieEnabled);
11
+ }), r = e.onLocaleChangeRequested((e) => {
12
+ t.setLocale(e), i(e, t.isCookieEnabled);
13
13
  });
14
14
  return () => {
15
- r(), i();
15
+ n(), r();
16
16
  };
17
17
  }, o = class {
18
18
  host;
@@ -22,7 +22,7 @@ var a = (e) => {
22
22
  this.host = e, e.addController(this);
23
23
  }
24
24
  hostConnected() {
25
- this._stopped = !1, process.env.INTLAYER_EDITOR_ENABLED !== "false" && i && import("@intlayer/editor").then(({ initEditorClient: e }) => {
25
+ this._stopped = !1, process.env.INTLAYER_EDITOR_ENABLED !== "false" && n && import("@intlayer/editor").then(({ initEditorClient: e }) => {
26
26
  this._stopped || (this._unsubscribeLocale = a(e()));
27
27
  }).catch(() => {});
28
28
  }
@@ -33,7 +33,7 @@ var a = (e) => {
33
33
  }
34
34
  };
35
35
  function s(e) {
36
- if (process.env.INTLAYER_EDITOR_ENABLED === "false" || !i) return e ? void 0 : () => {};
36
+ if (process.env.INTLAYER_EDITOR_ENABLED === "false" || !n) return e ? void 0 : () => {};
37
37
  if (!e) {
38
38
  let e = !1, t = null;
39
39
  return import("@intlayer/editor").then(({ initEditorClient: n }) => {
@@ -52,9 +52,9 @@ var c = class {
52
52
  _variant;
53
53
  _listeners = /* @__PURE__ */ new Set();
54
54
  isCookieEnabled;
55
- constructor(t, i = !0, a) {
56
- let { defaultLocale: o } = n ?? {};
57
- r(), this._locale = t ?? e() ?? o, this._variant = a, this.isCookieEnabled = i;
55
+ constructor(n, i = !0, a) {
56
+ let { defaultLocale: o } = e ?? {};
57
+ t(), this._locale = n ?? r() ?? o, this._variant = a, this.isCookieEnabled = i;
58
58
  }
59
59
  get locale() {
60
60
  return this._locale;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lit-intlayer",
3
- "version": "9.9.0",
3
+ "version": "9.9.2",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Lit applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -97,18 +97,18 @@
97
97
  "prepublish": "cp -f ../../README.md ./README.md",
98
98
  "publish": "bun publish || true",
99
99
  "publish:canary": "bun publish --access public --tag canary || true",
100
- "publish:ci": "bun ../../scripts/publish-package.mjs",
100
+ "publish:ci": "bun ../../scripts/publish-package.ts",
101
101
  "publish:latest": "bun publish --access public --tag latest || true",
102
102
  "test": "bun --bun vitest run",
103
103
  "test:watch": "bun --bun vitest",
104
104
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
105
105
  },
106
106
  "dependencies": {
107
- "@intlayer/api": "9.9.0",
108
- "@intlayer/config": "9.9.0",
109
- "@intlayer/core": "9.9.0",
110
- "@intlayer/editor": "9.9.0",
111
- "@intlayer/types": "9.9.0"
107
+ "@intlayer/api": "9.9.2",
108
+ "@intlayer/config": "9.9.2",
109
+ "@intlayer/core": "9.9.2",
110
+ "@intlayer/editor": "9.9.2",
111
+ "@intlayer/types": "9.9.2"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@types/node": "^26",
@@ -120,12 +120,12 @@
120
120
  "rimraf": "6.1.4",
121
121
  "tsdown": "0.23.7",
122
122
  "typescript": "7.0.2",
123
- "vite": "8.3.8",
123
+ "vite": "8.4.0",
124
124
  "vite-plugin-dts": "5.1.2",
125
- "vitest": "5.1.1"
125
+ "vitest": "5.1.2"
126
126
  },
127
127
  "peerDependencies": {
128
- "intlayer": "9.9.0",
128
+ "intlayer": "9.9.2",
129
129
  "lit": ">=3.0.0"
130
130
  },
131
131
  "peerDependenciesMeta": {