svelte-intlayer 5.7.7 → 5.8.0-canary.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/README.md CHANGED
@@ -121,8 +121,8 @@ const component1Content = {
121
121
  content: {
122
122
  myTranslatedContent: t({
123
123
  en: "Hello World",
124
- fr: "Bonjour le monde",
125
124
  es: "Hola Mundo",
125
+ fr: "Bonjour le monde",
126
126
  }),
127
127
  numberOfCar: enu({
128
128
  "<-1": "Less than minus one car",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=()=>{var n;if(typeof navigator>"u")return"en";const e=navigator.language||((n=navigator.languages)==null?void 0:n[0]);return e&&e.split("-")[0]||"en"};exports.getBrowserLocale=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=()=>{if(typeof navigator>"u")return"en";const e=navigator.language||navigator.languages?.[0];return e&&e.split("-")[0]||"en"};exports.getBrowserLocale=n;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("svelte/store"),c=require("../getDictionary.cjs"),a=require("./intlayerContext.cjs"),l=require("./intlayerStore.cjs"),s=(t,r)=>{const e=a.getIntlayerContext();return i.derived([l.intlayerStore],([n])=>{const o=r??(e==null?void 0:e.locale)??n.locale;return c.getDictionary(t,o)})};exports.useDictionary=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("svelte/store"),c=require("../getDictionary.cjs"),a=require("./intlayerContext.cjs"),l=require("./intlayerStore.cjs"),s=(e,t)=>{const r=a.getIntlayerContext();return i.derived([l.intlayerStore],([n])=>{const o=t??r?.locale??n.locale;return c.getDictionary(e,o)})};exports.useDictionary=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("svelte/store"),s=require("./intlayerContext.cjs"),y=require("./intlayerStore.cjs"),d=async(i,c)=>{const e=s.getIntlayerContext(),r=n.writable(null);return n.derived([y.intlayerStore],([a])=>{const o=c??(e==null?void 0:e.locale)??a.locale;return(async()=>{try{const t=i[o];if(t){const l=await t();r.set(l)}else r.set(null)}catch(t){console.error(`Failed to load dictionary for key: ${String(o)}`,t),r.set(null)}})(),null})};exports.useDictionaryAsync=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("svelte/store"),s=require("./intlayerContext.cjs"),y=require("./intlayerStore.cjs"),d=async(n,c)=>{const i=s.getIntlayerContext(),e=r.writable(null);return r.derived([y.intlayerStore],([a])=>{const o=c??i?.locale??a.locale;return(async()=>{try{const t=n[o];if(t){const l=await t();e.set(l)}else e.set(null)}catch(t){console.error(`Failed to load dictionary for key: ${String(o)}`,t),e.set(null)}})(),null})};exports.useDictionaryAsync=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("svelte/store"),y=require("./intlayerContext.cjs"),d=require("./intlayerStore.cjs"),u=(n,i,a)=>{const e=y.getIntlayerContext(),r=o.writable(null);return o.derived([d.intlayerStore],([c])=>{const l=a??(e==null?void 0:e.locale)??c.locale;return(async()=>{try{const t=n[l];if(t){const s=await t();r.set(s)}else r.set(null)}catch(t){console.error(`Failed to load dictionary for key: ${String(i)}`,t),r.set(null)}})(),null})};exports.useDictionaryDynamic=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("svelte/store"),y=require("./intlayerContext.cjs"),d=require("./intlayerStore.cjs"),u=(r,n,i)=>{const c=y.getIntlayerContext(),e=o.writable(null);return o.derived([d.intlayerStore],([a])=>{const l=i??c?.locale??a.locale;return(async()=>{try{const t=r[l];if(t){const s=await t();e.set(s)}else e.set(null)}catch(t){console.error(`Failed to load dictionary for key: ${String(n)}`,t),e.set(null)}})(),null})};exports.useDictionaryDynamic=u;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("svelte/store"),a=require("../getIntlayer.cjs"),c=require("./intlayerContext.cjs"),i=require("./intlayerStore.cjs"),s=(t,r)=>{const e=c.getIntlayerContext();return o.derived([i.intlayerStore],([n])=>{const l=r??(e==null?void 0:e.locale)??n.locale;return a.getIntlayer(t,l)})};exports.useIntlayer=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("svelte/store"),c=require("../getIntlayer.cjs"),a=require("./intlayerContext.cjs"),i=require("./intlayerStore.cjs"),s=(e,t)=>{const r=a.getIntlayerContext();return l.derived([i.intlayerStore],([n])=>{const o=t??r?.locale??n.locale;return c.getIntlayer(e,o)})};exports.useIntlayer=s;
@@ -1,10 +1,9 @@
1
- const o = () => {
2
- var n;
1
+ const a = () => {
3
2
  if (typeof navigator > "u")
4
3
  return "en";
5
- const e = navigator.language || ((n = navigator.languages) == null ? void 0 : n[0]);
4
+ const e = navigator.language || navigator.languages?.[0];
6
5
  return e && e.split("-")[0] || "en";
7
6
  };
8
7
  export {
9
- o as getBrowserLocale
8
+ a as getBrowserLocale
10
9
  };
@@ -1,12 +1,12 @@
1
- import { derived as n } from "svelte/store";
2
- import { getDictionary as a } from "../getDictionary.mjs";
3
- import { getIntlayerContext as m } from "./intlayerContext.mjs";
4
- import { intlayerStore as c } from "./intlayerStore.mjs";
1
+ import { derived as i } from "svelte/store";
2
+ import { getDictionary as c } from "../getDictionary.mjs";
3
+ import { getIntlayerContext as a } from "./intlayerContext.mjs";
4
+ import { intlayerStore as m } from "./intlayerStore.mjs";
5
5
  const y = (t, o) => {
6
- const r = m();
7
- return n([c], ([e]) => {
8
- const i = o ?? (r == null ? void 0 : r.locale) ?? e.locale;
9
- return a(t, i);
6
+ const r = a();
7
+ return i([m], ([e]) => {
8
+ const n = o ?? r?.locale ?? e.locale;
9
+ return c(t, n);
10
10
  });
11
11
  };
12
12
  export {
@@ -1,23 +1,23 @@
1
- import { writable as c, derived as s } from "svelte/store";
1
+ import { writable as l, derived as s } from "svelte/store";
2
2
  import { getIntlayerContext as y } from "./intlayerContext.mjs";
3
3
  import { intlayerStore as d } from "./intlayerStore.mjs";
4
- const D = async (n, a) => {
5
- const t = y(), r = c(null);
6
- return s([d], ([i]) => {
7
- const e = a ?? (t == null ? void 0 : t.locale) ?? i.locale;
4
+ const D = async (e, n) => {
5
+ const a = y(), o = l(null);
6
+ return s([d], ([c]) => {
7
+ const r = n ?? a?.locale ?? c.locale;
8
8
  return (async () => {
9
9
  try {
10
- const o = n[e];
11
- if (o) {
12
- const l = await o();
13
- r.set(l);
10
+ const t = e[r];
11
+ if (t) {
12
+ const i = await t();
13
+ o.set(i);
14
14
  } else
15
- r.set(null);
16
- } catch (o) {
15
+ o.set(null);
16
+ } catch (t) {
17
17
  console.error(
18
- `Failed to load dictionary for key: ${String(e)}`,
19
- o
20
- ), r.set(null);
18
+ `Failed to load dictionary for key: ${String(r)}`,
19
+ t
20
+ ), o.set(null);
21
21
  }
22
22
  })(), null;
23
23
  });
@@ -1,23 +1,23 @@
1
1
  import { writable as s, derived as y } from "svelte/store";
2
2
  import { getIntlayerContext as d } from "./intlayerContext.mjs";
3
3
  import { intlayerStore as m } from "./intlayerStore.mjs";
4
- const g = (e, n, a) => {
5
- const t = d(), r = s(null);
4
+ const g = (r, e, n) => {
5
+ const a = d(), o = s(null);
6
6
  return y([m], ([i]) => {
7
- const l = a ?? (t == null ? void 0 : t.locale) ?? i.locale;
7
+ const c = n ?? a?.locale ?? i.locale;
8
8
  return (async () => {
9
9
  try {
10
- const o = e[l];
11
- if (o) {
12
- const c = await o();
13
- r.set(c);
10
+ const t = r[c];
11
+ if (t) {
12
+ const l = await t();
13
+ o.set(l);
14
14
  } else
15
- r.set(null);
16
- } catch (o) {
15
+ o.set(null);
16
+ } catch (t) {
17
17
  console.error(
18
- `Failed to load dictionary for key: ${String(n)}`,
19
- o
20
- ), r.set(null);
18
+ `Failed to load dictionary for key: ${String(e)}`,
19
+ t
20
+ ), o.set(null);
21
21
  }
22
22
  })(), null;
23
23
  });
@@ -1,12 +1,12 @@
1
- import { derived as n } from "svelte/store";
1
+ import { derived as l } from "svelte/store";
2
2
  import { getIntlayer as a } from "../getIntlayer.mjs";
3
3
  import { getIntlayerContext as m } from "./intlayerContext.mjs";
4
- import { intlayerStore as i } from "./intlayerStore.mjs";
5
- const y = (t, e) => {
6
- const r = m();
7
- return n([i], ([o]) => {
8
- const l = e ?? (r == null ? void 0 : r.locale) ?? o.locale;
9
- return a(t, l);
4
+ import { intlayerStore as c } from "./intlayerStore.mjs";
5
+ const y = (t, r) => {
6
+ const e = m();
7
+ return l([c], ([o]) => {
8
+ const n = r ?? e?.locale ?? o.locale;
9
+ return a(t, n);
10
10
  });
11
11
  };
12
12
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-intlayer",
3
- "version": "5.7.7",
3
+ "version": "5.8.0-canary.0",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Svelte applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -58,35 +58,35 @@
58
58
  ],
59
59
  "dependencies": {
60
60
  "js-cookie": "^3.0.5",
61
- "@intlayer/config": "5.7.7",
62
- "@intlayer/api": "5.7.7",
63
- "@intlayer/core": "5.7.7",
64
- "@intlayer/editor": "5.7.7"
61
+ "@intlayer/core": "5.8.0-canary.0",
62
+ "@intlayer/config": "5.8.0-canary.0",
63
+ "@intlayer/api": "5.8.0-canary.0",
64
+ "@intlayer/editor": "5.8.0-canary.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@sveltejs/vite-plugin-svelte": "^5.1.0",
67
+ "@sveltejs/vite-plugin-svelte": "^6.1.2",
68
68
  "@types/js-cookie": "^3.0.6",
69
- "@types/node": "^22.15.30",
69
+ "@types/node": "^24.2.1",
70
70
  "@typescript-eslint/parser": "^8.33.1",
71
71
  "concurrently": "^9.1.2",
72
- "eslint": "^9.28.0",
72
+ "eslint": "^9.33.0",
73
73
  "prettier": "^3.5.3",
74
74
  "rimraf": "^6.0.1",
75
- "typescript": "^5.8.3",
76
- "vite": "^6.3.5",
75
+ "typescript": "^5.9.2",
76
+ "vite": "^7.1.2",
77
77
  "vite-plugin-dts": "^4.5.3",
78
78
  "vitest": "^3.2.2",
79
79
  "@utils/eslint-config": "1.0.4",
80
- "@utils/ts-config": "1.0.4",
81
80
  "@utils/ts-config-types": "1.0.4",
81
+ "@utils/ts-config": "1.0.4",
82
82
  "@utils/tsup-config": "1.0.4"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "svelte": ">=5.0.0",
86
- "@intlayer/config": "5.7.7",
87
- "@intlayer/core": "5.7.7",
88
- "@intlayer/api": "5.7.7",
89
- "@intlayer/editor": "5.7.7"
86
+ "@intlayer/api": "5.8.0-canary.0",
87
+ "@intlayer/config": "5.8.0-canary.0",
88
+ "@intlayer/editor": "5.8.0-canary.0",
89
+ "@intlayer/core": "5.8.0-canary.0"
90
90
  },
91
91
  "engines": {
92
92
  "node": ">=14.18"