solid-intlayer 8.4.0-canary.0 → 8.4.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.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../chunk-C91j1N6u.js`);let t=require(`@intlayer/config/built`);t=e.t(t);let n=require(`@intlayer/core/localization`),r=require(`@intlayer/core/utils`),i=require(`@intlayer/types/locales`);i=e.t(i);var a=function(e){return e.Querystring=`querystring`,e.Storage=`storage`,e.Navigator=`navigator`,e.HtmlTag=`htmlTag`,e}({}),o=()=>({order:[a.Querystring,a.Storage,a.Navigator,a.HtmlTag],lookupQuerystring:`locale`,htmlTag:typeof document<`u`?document.documentElement:null}),s=(e,i)=>{let o={},s=()=>{if(typeof window>`u`)return;let e=window.location.search||``,t=new URLSearchParams(e).get(i.lookupQuerystring??``);t&&(o[a.Querystring]=t)},c=()=>{if(typeof window>`u`)return;let e=(0,r.getLocaleFromStorage)({getCookie:e=>{try{let t=document.cookie.split(`;`),n=`${e}=`,r=t.find(e=>e.trim().startsWith(n));if(r)return r.split(`=`)[1].trim()}catch{}},getSessionStorage:e=>{try{return window.sessionStorage.getItem(e)??void 0}catch{}},getLocaleStorage:e=>{try{return window.localStorage.getItem(e)??void 0}catch{}}});e&&(o[a.Storage]=e)},l=()=>{if(typeof navigator>`u`)return;let{internationalization:e}=t.default,r=navigator.languages??[navigator.language],i=(0,n.localeDetector)({"accept-language":r.join(`,`)},e.locales,e.defaultLocale);i&&(o[a.Navigator]=i)},u=()=>{let e=i.htmlTag;if(e&&typeof e.getAttribute==`function`){let r=e.getAttribute(`lang`);if(r){let{internationalization:e}=t.default,i=(0,n.localeDetector)({"accept-language":r},e.locales,e.defaultLocale);o[a.HtmlTag]=i}}},d={[a.Querystring]:s,[a.Storage]:c,[a.Navigator]:l,[a.HtmlTag]:u};return e.forEach(e=>{d[e]?.()}),o},c=(e,n)=>{let{internationalization:r}=t.default;for(let t of n){let n=e[t];if(n&&r.locales.includes(n))return n}return r?.defaultLocale??i.ENGLISH},l=(e={})=>{let t={...o(),...e};return c(s(t.order??[],t),t.order??[])};exports.LanguageDetector=a,exports.getBrowserLocale=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../chunk-C91j1N6u.js`);let t=require(`@intlayer/config/built`);t=e.t(t);let n=require(`@intlayer/core/localization`),r=require(`@intlayer/core/utils`),i=require(`@intlayer/types/locales`);var a=function(e){return e.Querystring=`querystring`,e.Storage=`storage`,e.Navigator=`navigator`,e.HtmlTag=`htmlTag`,e}({}),o=()=>({order:[a.Querystring,a.Storage,a.Navigator,a.HtmlTag],lookupQuerystring:`locale`,htmlTag:typeof document<`u`?document.documentElement:null}),s=(e,i)=>{let o={},s=()=>{if(typeof window>`u`)return;let e=window.location.search||``,t=new URLSearchParams(e).get(i.lookupQuerystring??``);t&&(o[a.Querystring]=t)},c=()=>{if(typeof window>`u`)return;let e=(0,r.getLocaleFromStorage)({getCookie:e=>{try{let t=document.cookie.split(`;`),n=`${e}=`,r=t.find(e=>e.trim().startsWith(n));if(r)return r.split(`=`)[1].trim()}catch{}},getSessionStorage:e=>{try{return window.sessionStorage.getItem(e)??void 0}catch{}},getLocaleStorage:e=>{try{return window.localStorage.getItem(e)??void 0}catch{}}});e&&(o[a.Storage]=e)},l=()=>{if(typeof navigator>`u`)return;let{internationalization:e}=t.default,r=navigator.languages??[navigator.language],i=(0,n.localeDetector)({"accept-language":r.join(`,`)},e.locales,e.defaultLocale);i&&(o[a.Navigator]=i)},u=()=>{let e=i.htmlTag;if(e&&typeof e.getAttribute==`function`){let r=e.getAttribute(`lang`);if(r){let{internationalization:e}=t.default,i=(0,n.localeDetector)({"accept-language":r},e.locales,e.defaultLocale);o[a.HtmlTag]=i}}},d={[a.Querystring]:s,[a.Storage]:c,[a.Navigator]:l,[a.HtmlTag]:u};return e.forEach(e=>{d[e]?.()}),o},c=(e,n)=>{let{internationalization:r}=t.default;for(let t of n){let n=e[t];if(n&&r.locales.includes(n))return n}return r?.defaultLocale??i.ENGLISH},l=(e={})=>{let t={...o(),...e};return c(s(t.order??[],t),t.order??[])};exports.LanguageDetector=a,exports.getBrowserLocale=l;
@@ -1,7 +1,7 @@
1
1
  import e from "@intlayer/config/built";
2
2
  import { localeDetector as t } from "@intlayer/core/localization";
3
3
  import { getLocaleFromStorage as n } from "@intlayer/core/utils";
4
- import * as r from "@intlayer/types/locales";
4
+ import { ENGLISH as r } from "@intlayer/types/locales";
5
5
  //#region src/client/getBrowserLocale.tsx
6
6
  var i = /* @__PURE__ */ function(e) {
7
7
  return e.Querystring = "querystring", e.Storage = "storage", e.Navigator = "navigator", e.HtmlTag = "htmlTag", e;
@@ -68,7 +68,7 @@ var i = /* @__PURE__ */ function(e) {
68
68
  let n = t[e];
69
69
  if (n && i.locales.includes(n)) return n;
70
70
  }
71
- return i?.defaultLocale ?? r.ENGLISH;
71
+ return i?.defaultLocale ?? r;
72
72
  }, c = (e = {}) => {
73
73
  let t = {
74
74
  ...a(),
@@ -1,3 +1,4 @@
1
+ import { WrappedIntl } from '@intlayer/core/formatters';
1
2
  import { LocalesValues } from '@intlayer/types/module_augmentation';
2
3
  /**
3
4
  * Solid client hook that provides a locale-bound `Intl` object.
@@ -17,62 +18,4 @@ import { LocalesValues } from '@intlayer/types/module_augmentation';
17
18
  * }).format(123.45);
18
19
  * ```
19
20
  */
20
- export declare const useIntl: (locale?: LocalesValues) => import('solid-js').Accessor<{
21
- Collator: {
22
- new (locales?: LocalesValues, options?: Intl.CollatorOptions | undefined): Intl.Collator;
23
- new (options?: (Intl.CollatorOptions & {
24
- locale?: LocalesValues;
25
- }) | undefined): Intl.Collator;
26
- };
27
- NumberFormat: {
28
- new (locales?: LocalesValues, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat;
29
- new (options?: (Intl.NumberFormatOptions & {
30
- locale?: LocalesValues;
31
- }) | undefined): Intl.NumberFormat;
32
- };
33
- DateTimeFormat: {
34
- new (locales?: LocalesValues, options?: Intl.DateTimeFormatOptions | undefined): Intl.DateTimeFormat;
35
- new (options?: (Intl.DateTimeFormatOptions & {
36
- locale?: LocalesValues;
37
- }) | undefined): Intl.DateTimeFormat;
38
- };
39
- getCanonicalLocales: typeof Intl.getCanonicalLocales;
40
- readonly PluralRules: {
41
- new (locales?: LocalesValues, options?: Intl.PluralRulesOptions | undefined): Intl.PluralRules;
42
- new (options?: (Intl.PluralRulesOptions & {
43
- locale?: LocalesValues;
44
- }) | undefined): Intl.PluralRules;
45
- };
46
- readonly RelativeTimeFormat: {
47
- new (locales?: LocalesValues, options?: Intl.RelativeTimeFormatOptions | undefined): Intl.RelativeTimeFormat;
48
- new (options?: (Intl.RelativeTimeFormatOptions & {
49
- locale?: LocalesValues;
50
- }) | undefined): Intl.RelativeTimeFormat;
51
- };
52
- readonly Locale: {
53
- new (locales?: LocalesValues, options?: Intl.LocaleOptions | undefined): Intl.Locale;
54
- new (options?: (Intl.LocaleOptions & {
55
- locale?: LocalesValues;
56
- }) | undefined): Intl.Locale;
57
- };
58
- readonly DisplayNames: {
59
- prototype: Intl.DisplayNames;
60
- new (locales: Intl.LocalesArgument, options: Intl.DisplayNamesOptions): Intl.DisplayNames;
61
- supportedLocalesOf(locales?: Intl.LocalesArgument, options?: {
62
- localeMatcher?: Intl.RelativeTimeFormatLocaleMatcher;
63
- }): Intl.UnicodeBCP47LocaleIdentifier[];
64
- };
65
- readonly ListFormat: {
66
- new (locales?: LocalesValues, options?: Intl.ListFormatOptions | undefined): Intl.ListFormat;
67
- new (options?: (Intl.ListFormatOptions & {
68
- locale?: LocalesValues;
69
- }) | undefined): Intl.ListFormat;
70
- };
71
- supportedValuesOf: typeof Intl.supportedValuesOf;
72
- readonly Segmenter: {
73
- new (locales?: LocalesValues, options?: Intl.SegmenterOptions | undefined): Intl.Segmenter;
74
- new (options?: (Intl.SegmenterOptions & {
75
- locale?: LocalesValues;
76
- }) | undefined): Intl.Segmenter;
77
- };
78
- }>;
21
+ export declare const useIntl: (locale?: LocalesValues) => import('solid-js').Accessor<WrappedIntl>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-intlayer",
3
- "version": "8.4.0-canary.0",
3
+ "version": "8.4.1",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -73,11 +73,11 @@
73
73
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
74
74
  },
75
75
  "dependencies": {
76
- "@intlayer/api": "8.4.0-canary.0",
77
- "@intlayer/config": "8.4.0-canary.0",
78
- "@intlayer/core": "8.4.0-canary.0",
79
- "@intlayer/editor": "8.4.0-canary.0",
80
- "@intlayer/types": "8.4.0-canary.0"
76
+ "@intlayer/api": "8.4.1",
77
+ "@intlayer/config": "8.4.1",
78
+ "@intlayer/core": "8.4.1",
79
+ "@intlayer/editor": "8.4.1",
80
+ "@intlayer/types": "8.4.1"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@solidjs/testing-library": "0.8.10",