wjec-one 4.1.2 → 4.1.3
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.
|
@@ -34,7 +34,7 @@ module.exports = (_env, { mode }) => ({
|
|
|
34
34
|
publicPath: '../'
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
},
|
|
38
38
|
{
|
|
39
39
|
test: /\.svg$/,
|
|
40
40
|
exclude: /(.*)\.favicon\.svg$/,
|
|
@@ -64,19 +64,6 @@ module.exports = (_env, { mode }) => ({
|
|
|
64
64
|
}
|
|
65
65
|
}]
|
|
66
66
|
},
|
|
67
|
-
{
|
|
68
|
-
type: 'javascript/auto',
|
|
69
|
-
test: /\.json$/,
|
|
70
|
-
include: /config/,
|
|
71
|
-
exclude: /node_modules/,
|
|
72
|
-
use: {
|
|
73
|
-
loader: 'file-loader',
|
|
74
|
-
options: {
|
|
75
|
-
name: './config/[name].json',
|
|
76
|
-
publicPath: '../'
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
67
|
{
|
|
81
68
|
test: /\.(ttf|eot|woff|woff2)$/,
|
|
82
69
|
use: {
|
package/localization/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{filterValidEntries as e,developerError as t,getLocalizationStrings as
|
|
1
|
+
import{filterValidEntries as e,developerError as t,getLocalizationStrings as r,getConfig as o}from"wjec-one/utils";import n from"react";import{createSimpleAction as l,createAsyncAction as a,createContext as c}from"wjec-one/store";const s=e=>{const r=e.props.children;let o=void 0!==r;return"string"!=typeof r&&"number"!=typeof r&&n.Children.forEach(r,e=>{i(e)&&s(e)||(o="string"==typeof e)}),t("A value passed to strings.format() can only contain a string, a number, or another FormattedPart",!o),o},i=e=>n.isValidElement(e),u=r(),m=o()?.defaultLocale||Object.keys(u||{})?.[0],p=(t,r=(e=>{let t;return e&&(t=Object.keys(e)[0]),t})(t))=>{const o=t=>(r,o)=>{let l;if(((e,t)=>{let r=!1;return t&&(r=Object.keys(t).includes(e)),r})(r,t)){const a=((e,t,r)=>Object.hasOwn(t,"count")&&"number"==typeof t.count&&Object.hasOwn(r,`${String(e)}_plural`))(r,o,t),c=a&&1!==o.count?t?.[`${String(r)}_plural`]:t?.[r],u=e(c.split(/({[^}]+})/g)).map((e,t)=>{let r=e;const l=e.match(/{(.*)}/);return l&&(r=o[l[1]]),i(r)?s(r)&&n.cloneElement(r,{...r.props,key:t}):r});l=n.createElement(n.Fragment,{},u)}else l=n.createElement(n.Fragment,{},[r]);return l},u=()=>{let e=[];return t&&(e=Object.keys(t)),e},m=e=>{const r=t?.[e],n=o(r),l={...r,format:n};return"Proxy"in self?new self.Proxy(l,{get:(e,t,r)=>Reflect.has(e,t)?Reflect.get(e,t,r):t}):l},p=(e,{payload:t,type:r})=>{switch(r){case"RECEIVE_STRINGS":return e.set("strings",Object.freeze(t));case"SELECT_LOCALE":return e.set("locale",t);default:return e}},g={availableLocales:u(),locale:r,strings:m(r)},{context:L,hook:f,provider:E}=c(p,g,({locale:e},{strings:t})=>({strings:e&&e!==r?m(e):t})),{selectLocale:y}=(e=>{const t=l("RECEIVE_STRINGS"),r=l("SELECT_LOCALE");return{selectLocale:a((o,n)=>{o(r(n)),o(t(e(n)))})}})(m);return{getLocales:u,getStringsForLocale:m,localizationContext:L,LocalizationProvider:E,selectLocale:y,useLocalization:f}},{getLocales:g,localizationContext:L,LocalizationProvider:f,selectLocale:E,useLocalization:y}=p(u,m);export{f as LocalizationProvider,g as getLocales,p as initialiseLocalization,L as localizationContext,E as selectLocale,y as useLocalization};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("wjec-one/utils"),require("react"),require("wjec-one/store")):"function"==typeof define&&define.amd?define(["exports","wjec-one/utils","react","wjec-one/store"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WJECOneLocalization={},e.WJECOneUtils,e.React,e.WJECOneStore)}(this,function(e,t,o,n){"use strict";const r=e=>{const n=e.props.children;let
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("wjec-one/utils"),require("react"),require("wjec-one/store")):"function"==typeof define&&define.amd?define(["exports","wjec-one/utils","react","wjec-one/store"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WJECOneLocalization={},e.WJECOneUtils,e.React,e.WJECOneStore)}(this,function(e,t,o,n){"use strict";const r=e=>{const n=e.props.children;let a=void 0!==n;return"string"!=typeof n&&"number"!=typeof n&&o.Children.forEach(n,e=>{l(e)&&r(e)||(a="string"==typeof e)}),t.developerError("A value passed to strings.format() can only contain a string, a number, or another FormattedPart",!a),a},l=e=>o.isValidElement(e),a=t.getLocalizationStrings(),c=t.getConfig()?.defaultLocale||Object.keys(a||{})?.[0],i=(e,a=(e=>{let t;return e&&(t=Object.keys(e)[0]),t})(e))=>{const c=e=>(n,a)=>{let c;if(((e,t)=>{let o=!1;return t&&(o=Object.keys(t).includes(e)),o})(n,e)){const i=((e,t,o)=>Object.hasOwn(t,"count")&&"number"==typeof t.count&&Object.hasOwn(o,`${String(e)}_plural`))(n,a,e),s=i&&1!==a.count?e?.[`${String(n)}_plural`]:e?.[n],u=t.filterValidEntries(s.split(/({[^}]+})/g)).map((e,t)=>{let n=e;const c=e.match(/{(.*)}/);return c&&(n=a[c[1]]),l(n)?r(n)&&o.cloneElement(n,{...n.props,key:t}):n});c=o.createElement(o.Fragment,{},u)}else c=o.createElement(o.Fragment,{},[n]);return c},i=()=>{let t=[];return e&&(t=Object.keys(e)),t},s=t=>{const o=e?.[t],n=c(o),r={...o,format:n};return"Proxy"in self?new self.Proxy(r,{get:(e,t,o)=>Reflect.has(e,t)?Reflect.get(e,t,o):t}):r},u=(e,{payload:t,type:o})=>{switch(o){case"RECEIVE_STRINGS":return e.set("strings",Object.freeze(t));case"SELECT_LOCALE":return e.set("locale",t);default:return e}},f={availableLocales:i(),locale:a,strings:s(a)},{context:g,hook:p,provider:L}=n.createContext(u,f,({locale:e},{strings:t})=>({strings:e&&e!==a?s(e):t})),{selectLocale:d}=(e=>{const t=n.createSimpleAction("RECEIVE_STRINGS"),o=n.createSimpleAction("SELECT_LOCALE");return{selectLocale:n.createAsyncAction((n,r)=>{n(o(r)),n(t(e(r)))})}})(s);return{getLocales:i,getStringsForLocale:s,localizationContext:g,LocalizationProvider:L,selectLocale:d,useLocalization:p}},{getLocales:s,localizationContext:u,LocalizationProvider:f,selectLocale:g,useLocalization:p}=i(a,c);e.LocalizationProvider=f,e.getLocales=s,e.initialiseLocalization=i,e.localizationContext=u,e.selectLocale=g,e.useLocalization=p});
|