@ckbox/i18n 1.6.0 → 2.0.0-rc.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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ Using a build served from the CDN is the simplest and fastest way of embedding C
12
12
  To start using CKBox on your website, embed the following `script` element in the HTML code of the page:
13
13
 
14
14
  ```html
15
- <script src="https://cdn.ckbox.io/ckbox/1.6.0/ckbox.js"></script>
15
+ <script src="https://cdn.ckbox.io/ckbox/2.0.0-rc.1/ckbox.js"></script>
16
16
  ```
17
17
 
18
18
  Quick implementation example:
@@ -22,7 +22,7 @@ Quick implementation example:
22
22
  <html>
23
23
  <head>
24
24
  <meta charset="UTF-8" />
25
- <script src="https://cdn.ckbox.io/ckbox/1.6.0/ckbox.js"></script>
25
+ <script src="https://cdn.ckbox.io/ckbox/2.0.0-rc.1/ckbox.js"></script>
26
26
  </head>
27
27
  <body>
28
28
  <div id="ckbox"></div>
@@ -48,7 +48,7 @@ The code snippet below presents the simplest scenario for integration of CKEdito
48
48
  <head>
49
49
  <meta charset="UTF-8" />
50
50
  <script src="https://cdn.ckeditor.com/ckeditor5/36.0.0/classic/ckeditor.js"></script>
51
- <script src="https://cdn.ckbox.io/ckbox/1.6.0/ckbox.js"></script>
51
+ <script src="https://cdn.ckbox.io/ckbox/2.0.0-rc.1/ckbox.js"></script>
52
52
  </head>
53
53
  <body>
54
54
  <div id="editor"></div>
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  */
4
- function _0x15df(_0x2234b3,_0x48946f){const _0x3bee47=_0x3bee();return _0x15df=function(_0x15df46,_0x18b161){_0x15df46=_0x15df46-0x19c;let _0x5643d0=_0x3bee47[_0x15df46];return _0x5643d0;},_0x15df(_0x2234b3,_0x48946f);}const _0x331998=_0x15df;(function(_0x1d1b4d,_0x19749e){const _0x3f9612=_0x15df,_0x2d7a9a=_0x1d1b4d();while(!![]){try{const _0x541e83=parseInt(_0x3f9612(0x1b7))/0x1+parseInt(_0x3f9612(0x1a5))/0x2+parseInt(_0x3f9612(0x1a3))/0x3+-parseInt(_0x3f9612(0x1b6))/0x4+-parseInt(_0x3f9612(0x1a2))/0x5+-parseInt(_0x3f9612(0x1ba))/0x6+parseInt(_0x3f9612(0x1ae))/0x7;if(_0x541e83===_0x19749e)break;else _0x2d7a9a['push'](_0x2d7a9a['shift']());}catch(_0x1d49d7){_0x2d7a9a['push'](_0x2d7a9a['shift']());}}}(_0x3bee,0xd7ab6));import*as _0x9de0a3 from'react';import{sprintf}from'sprintf-js';class Plural{constructor(_0x3658b9){const _0x49e2c1=_0x15df;this[_0x49e2c1(0x1bb)]=_0x3658b9;try{this[_0x49e2c1(0x1c1)]=new Intl[(_0x49e2c1(0x1c4))](_0x3658b9);}catch(_0x276738){console[_0x49e2c1(0x19f)]('Plural\x20rules\x20could\x20not\x20be\x20created.\x20Perhaps\x20`Intl.PluralRules`\x20is\x20not\x20supported?');}}['getKey'](_0x190e11,_0x3dab08){const _0x5337a1=_0x15df;if(!this['_rules'])return _0x190e11+_0x5337a1(0x1b1);const _0x502bc3=this[_0x5337a1(0x1c1)][_0x5337a1(0x1bc)](_0x3dab08);return _0x190e11+'_'+_0x502bc3;}}function _0x3bee(){const _0x490ab8=['createContext','useContext','push','processTags','charAt','10165708jiqiyV','isSupported','text','_one','indexOf','code','Fragment',']:\x20Translation\x20for\x20key\x20\x27','5634092MWRdHV','1642529ZUWdVb','log','map','6455484ZyPfpS','lang','select','strong','values','filter','\x27\x20is\x20missing.','_rules','supportedLocalesOf','useEffect','PluralRules','plural','\x22\x20is\x20not\x20supported.','tag','length','warn','includes','pluralUtils','6811210URunmn','86976fkcDdw','getKey','3212592CdmCev','slice','keys','createElement'];_0x3bee=function(){return _0x490ab8;};return _0x3bee();}Plural[_0x331998(0x1af)]=_0x39ae9d=>{const _0x3047e4=_0x331998;try{return Intl['PluralRules'][_0x3047e4(0x1c2)]([_0x39ae9d])['length']>0x0;}catch(_0x2789c9){return![];}};const I18nContext=_0x9de0a3[_0x331998(0x1a9)]({'debug':![],'lang':'en','resources':{},'pluralUtils':new Plural('en')}),I18nProvider=({children:_0x10b6fe,debug:debug=![],lang:lang='en',resources:resources={}})=>{const _0x28d799=_0x331998;return _0x9de0a3[_0x28d799(0x1c3)](()=>{const _0x1e2ac0=_0x28d799,_0x117203=Plural[_0x1e2ac0(0x1af)](lang);!_0x117203&&console[_0x1e2ac0(0x19f)]('Plural\x20form\x20for\x20language\x20\x22'+lang+_0x1e2ac0(0x19c));},[lang]),_0x9de0a3[_0x28d799(0x1a8)](I18nContext['Provider'],{'value':{'debug':debug,'lang':lang,'pluralUtils':new Plural(lang),'resources':resources}},_0x10b6fe);},TAG_REGEX=/<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,ALLOWED_TAGS=['em',_0x331998(0x1bd),_0x331998(0x1b3)],getMsg=(_0x2bb7b6,_0x5ce761={},_0x3328fa)=>{const _0x4a585c=_0x331998,_0x2589e9=_0x3328fa[_0x4a585c(0x1c5)];if(_0x5ce761[_0x2bb7b6]&&_0x2589e9===undefined)return{'found':!![],'msg':_0x5ce761[_0x2bb7b6]};const _0x15e85b=Object[_0x4a585c(0x1a7)](_0x5ce761)[_0x4a585c(0x1bf)](_0x19e9b0=>_0x19e9b0[_0x4a585c(0x1b2)](_0x2bb7b6)===0x0);if(_0x15e85b[_0x4a585c(0x19e)]===0x0||_0x2589e9===undefined)return{'found':![],'msg':_0x2bb7b6};const _0x32277d=_0x3328fa[_0x4a585c(0x1a1)][_0x4a585c(0x1a4)](_0x2bb7b6,_0x2589e9);return{'found':!![],'msg':_0x5ce761[_0x32277d]};},parseMsgTags=_0x482ca1=>{const _0x458acc=_0x331998,_0xfaab06=[];let _0x12ed4e=0x0,_0x147a81;while((_0x147a81=TAG_REGEX['exec'](_0x482ca1))!==null){const _0x5656b6=_0x147a81[0x0],{index:_0x18f88e}=_0x147a81,_0x584259=_0x5656b6[_0x458acc(0x1ad)](0x1)==='/',_0xc7b594=_0x584259?_0x5656b6[_0x458acc(0x1a6)](0x2,-0x1):_0x5656b6[_0x458acc(0x1a6)](0x1,-0x1),_0x34b85c=ALLOWED_TAGS[_0x458acc(0x1a0)](_0xc7b594);if(!_0x34b85c)continue;const _0x28faa2=_0x482ca1['slice'](_0x12ed4e,_0x18f88e);if(!_0x28faa2){_0x12ed4e=_0x18f88e+_0x5656b6[_0x458acc(0x19e)];continue;}_0x584259?_0xfaab06['push']({'type':_0x458acc(0x19d),'name':_0x5656b6[_0x458acc(0x1a6)](0x2,-0x1),'content':_0x28faa2}):_0xfaab06['push']({'type':_0x458acc(0x1b0),'content':_0x28faa2}),_0x12ed4e=_0x18f88e+_0x5656b6[_0x458acc(0x19e)];}return _0x12ed4e<_0x482ca1[_0x458acc(0x19e)]&&_0xfaab06[_0x458acc(0x1ab)]({'type':_0x458acc(0x1b0),'content':_0x482ca1[_0x458acc(0x1a6)](_0x12ed4e)}),_0xfaab06;};function formatMsgWithTags(_0x40d607){const _0x28181a=_0x331998,_0x22aac0=parseMsgTags(_0x40d607),_0x566772=_0x22aac0[_0x28181a(0x1b9)](({content:_0x3ddf23,type:_0x4570f4,name:_0x4cf089},_0x30c221)=>{const _0x51ad45=_0x28181a,_0x4595b9=_0x4570f4!==_0x51ad45(0x1b0)&&_0x4cf089?_0x4cf089:_0x9de0a3[_0x51ad45(0x1b4)];return _0x9de0a3[_0x51ad45(0x1a8)](_0x4595b9,{'key':''+_0x30c221},_0x3ddf23);});return _0x566772;}function formatMsg(_0x8802c3,_0x201aaf,_0x3aebad){const _0x1b8118=sprintf(_0x8802c3,..._0x201aaf!==null&&_0x201aaf!==void 0x0?_0x201aaf:[]);if(!_0x3aebad)return _0x1b8118;return formatMsgWithTags(_0x1b8118);}const useTranslation=()=>{const _0xe82ba7=_0x331998,{lang:_0x461df0,debug:_0x100edc,pluralUtils:_0x1fd591,resources:_0x4841de}=_0x9de0a3[_0xe82ba7(0x1aa)](I18nContext);function _0x2fa4ea(_0x17f53b,_0x405b53){const _0x6d1c05=_0xe82ba7,{found:_0x2a76fc,msg:_0x7668ef}=getMsg(_0x17f53b,_0x4841de[_0x461df0],{'plural':_0x405b53===null||_0x405b53===void 0x0?void 0x0:_0x405b53['plural'],'pluralUtils':_0x1fd591});_0x100edc&&!_0x2a76fc&&console[_0x6d1c05(0x1b8)]('['+_0x461df0+_0x6d1c05(0x1b5)+_0x17f53b+_0x6d1c05(0x1c0));if(_0x405b53===null||_0x405b53===void 0x0?void 0x0:_0x405b53[_0x6d1c05(0x1ac)])return formatMsg(_0x7668ef,_0x405b53===null||_0x405b53===void 0x0?void 0x0:_0x405b53[_0x6d1c05(0x1be)],!![]);return formatMsg(_0x7668ef,_0x405b53===null||_0x405b53===void 0x0?void 0x0:_0x405b53['values'],![]);}return{'t':_0x2fa4ea,'lang':_0x461df0};};export{I18nContext,I18nProvider,useTranslation};
4
+ const _0x52ec30=_0x5286;(function(_0x138b12,_0x3f2c59){const _0xb52895=_0x5286,_0x2fddcd=_0x138b12();while(!![]){try{const _0x442db9=-parseInt(_0xb52895(0x135))/0x1*(parseInt(_0xb52895(0x141))/0x2)+parseInt(_0xb52895(0x146))/0x3+parseInt(_0xb52895(0x123))/0x4+-parseInt(_0xb52895(0x132))/0x5*(-parseInt(_0xb52895(0x140))/0x6)+parseInt(_0xb52895(0x128))/0x7*(parseInt(_0xb52895(0x12c))/0x8)+parseInt(_0xb52895(0x13f))/0x9+parseInt(_0xb52895(0x145))/0xa*(-parseInt(_0xb52895(0x130))/0xb);if(_0x442db9===_0x3f2c59)break;else _0x2fddcd['push'](_0x2fddcd['shift']());}catch(_0x27f44c){_0x2fddcd['push'](_0x2fddcd['shift']());}}}(_0x5a69,0x50f8c));import*as _0x50cf7e from'react';import{sprintf}from'sprintf-js';class Plural{constructor(_0x54fb72){const _0x2e1719=_0x5286;this[_0x2e1719(0x127)]=_0x54fb72;try{this[_0x2e1719(0x147)]=new Intl[(_0x2e1719(0x122))](_0x54fb72);}catch(_0x456365){console['warn']('Plural\x20rules\x20could\x20not\x20be\x20created.\x20Perhaps\x20`Intl.PluralRules`\x20is\x20not\x20supported?');}}['getKey'](_0x45fbf2,_0x21e535){const _0x22c88c=_0x5286;if(!this['_rules'])return _0x45fbf2+'_one';const _0x598f6e=this[_0x22c88c(0x147)][_0x22c88c(0x131)](_0x21e535);return _0x45fbf2+'_'+_0x598f6e;}}function _0x5286(_0x1bc229,_0x5bf740){const _0x5a69ce=_0x5a69();return _0x5286=function(_0x5286c3,_0x56c57a){_0x5286c3=_0x5286c3-0x121;let _0x14bd78=_0x5a69ce[_0x5286c3];return _0x14bd78;},_0x5286(_0x1bc229,_0x5bf740);}Plural['isSupported']=_0x28ca9a=>{const _0x707913=_0x5286;try{return Intl[_0x707913(0x122)]['supportedLocalesOf']([_0x28ca9a])[_0x707913(0x12a)]>0x0;}catch(_0x50f833){return![];}};function _0x5a69(){const _0x6bc67a=['exec','useContext','7216AIduij','select','1230490eFwIlw','map','useEffect','5bpgrPN','createContext','\x27\x20is\x20missing.','values','push','plural','warn','code','isSupported','Plural\x20form\x20for\x20language\x20\x22','2108916EnhAXD','6CikSMO','164102mfLzrb','tag','keys','strong','4100iykyzG','299241LYmnpt','_rules','filter',']:\x20Translation\x20for\x20key\x20\x27','PluralRules','1556636OEqcid','charAt','createElement','slice','lang','96943DQaTSZ','getKey','length','text','24ndTAxC','Provider'];_0x5a69=function(){return _0x6bc67a;};return _0x5a69();}const I18nContext=_0x50cf7e[_0x52ec30(0x136)]({'debug':![],'lang':'en','resources':{},'pluralUtils':new Plural('en')}),I18nProvider=({children:_0x4c425d,debug:debug=![],lang:lang='en',resources:resources={}})=>{const _0x821796=_0x52ec30;return _0x50cf7e[_0x821796(0x134)](()=>{const _0x490271=_0x821796,_0x4d2a6e=Plural[_0x490271(0x13d)](lang);!_0x4d2a6e&&console[_0x490271(0x13b)](_0x490271(0x13e)+lang+'\x22\x20is\x20not\x20supported.');},[lang]),_0x50cf7e[_0x821796(0x125)](I18nContext[_0x821796(0x12d)],{'value':{'debug':debug,'lang':lang,'pluralUtils':new Plural(lang),'resources':resources}},_0x4c425d);},TAG_REGEX=/<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,ALLOWED_TAGS=['em',_0x52ec30(0x144),_0x52ec30(0x13c)],getMsg=(_0x3da1b6,_0x148639={},_0x5da305)=>{const _0x4f6e0e=_0x52ec30,_0x7ffe6=_0x5da305['plural'];if(_0x148639[_0x3da1b6]&&_0x7ffe6===undefined)return{'found':!![],'msg':_0x148639[_0x3da1b6]};const _0x32c04e=Object[_0x4f6e0e(0x143)](_0x148639)[_0x4f6e0e(0x148)](_0x4abe28=>_0x4abe28['indexOf'](_0x3da1b6)===0x0);if(_0x32c04e[_0x4f6e0e(0x12a)]===0x0||_0x7ffe6===undefined)return{'found':![],'msg':_0x3da1b6};const _0x124f2b=_0x5da305['pluralUtils'][_0x4f6e0e(0x129)](_0x3da1b6,_0x7ffe6);return{'found':!![],'msg':_0x148639[_0x124f2b]};},parseMsgTags=_0x4e7cb6=>{const _0x36ea74=_0x52ec30,_0xd6e095=[];let _0x13b55c=0x0,_0x881e02;while((_0x881e02=TAG_REGEX[_0x36ea74(0x12e)](_0x4e7cb6))!==null){const _0x4e65cb=_0x881e02[0x0],{index:_0x1c68ee}=_0x881e02,_0x4f401b=_0x4e65cb[_0x36ea74(0x124)](0x1)==='/',_0x3197f4=_0x4f401b?_0x4e65cb[_0x36ea74(0x126)](0x2,-0x1):_0x4e65cb[_0x36ea74(0x126)](0x1,-0x1),_0x12612d=ALLOWED_TAGS['includes'](_0x3197f4);if(!_0x12612d)continue;const _0x160bb8=_0x4e7cb6['slice'](_0x13b55c,_0x1c68ee);if(!_0x160bb8){_0x13b55c=_0x1c68ee+_0x4e65cb['length'];continue;}_0x4f401b?_0xd6e095[_0x36ea74(0x139)]({'type':_0x36ea74(0x142),'name':_0x4e65cb[_0x36ea74(0x126)](0x2,-0x1),'content':_0x160bb8}):_0xd6e095['push']({'type':_0x36ea74(0x12b),'content':_0x160bb8}),_0x13b55c=_0x1c68ee+_0x4e65cb[_0x36ea74(0x12a)];}return _0x13b55c<_0x4e7cb6[_0x36ea74(0x12a)]&&_0xd6e095['push']({'type':'text','content':_0x4e7cb6[_0x36ea74(0x126)](_0x13b55c)}),_0xd6e095;};function formatMsgWithTags(_0xd5b115){const _0x466b15=_0x52ec30,_0x1d57d5=parseMsgTags(_0xd5b115),_0x3cc195=_0x1d57d5[_0x466b15(0x133)](({content:_0x52e890,type:_0x4c5c74,name:_0x4ac6a6},_0x431039)=>{const _0x1ad09b=_0x466b15,_0x357220=_0x4c5c74!==_0x1ad09b(0x12b)&&_0x4ac6a6?_0x4ac6a6:_0x50cf7e['Fragment'];return _0x50cf7e[_0x1ad09b(0x125)](_0x357220,{'key':''+_0x431039},_0x52e890);});return _0x3cc195;}function formatMsg(_0x3560b1,_0x3aebd1,_0x434b9b){const _0x115b7f=sprintf(_0x3560b1,..._0x3aebd1!==null&&_0x3aebd1!==void 0x0?_0x3aebd1:[]);if(!_0x434b9b)return _0x115b7f;return formatMsgWithTags(_0x115b7f);}const useTranslation=()=>{const _0x43780a=_0x52ec30,{lang:_0xbd3ade,debug:_0x450c55,pluralUtils:_0x2ee417,resources:_0x275c25}=_0x50cf7e[_0x43780a(0x12f)](I18nContext);function _0x2116ec(_0x42aea4,_0xf61045){const _0x3a1e6e=_0x43780a,{found:_0x5dda25,msg:_0x2fa3a9}=getMsg(_0x42aea4,_0x275c25[_0xbd3ade],{'plural':_0xf61045===null||_0xf61045===void 0x0?void 0x0:_0xf61045[_0x3a1e6e(0x13a)],'pluralUtils':_0x2ee417});_0x450c55&&!_0x5dda25&&console['log']('['+_0xbd3ade+_0x3a1e6e(0x121)+_0x42aea4+_0x3a1e6e(0x137));if(_0xf61045===null||_0xf61045===void 0x0?void 0x0:_0xf61045['processTags'])return formatMsg(_0x2fa3a9,_0xf61045===null||_0xf61045===void 0x0?void 0x0:_0xf61045['values'],!![]);return formatMsg(_0x2fa3a9,_0xf61045===null||_0xf61045===void 0x0?void 0x0:_0xf61045[_0x3a1e6e(0x138)],![]);}return{'t':_0x2116ec,'lang':_0xbd3ade};};export{I18nContext,I18nProvider,useTranslation};
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "license": "SEE LICENSE IN LICENSE.md",
22
22
  "name": "@ckbox/i18n",
23
- "version": "1.6.0",
23
+ "version": "2.0.0-rc.1",
24
24
  "description": "I18n utils of CKBox",
25
25
  "main": "dist/index.js",
26
26
  "types": "dist/index.d.ts",
@@ -29,6 +29,6 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "sprintf-js": "^1.1.2",
32
- "tslib": "^2.5.3"
32
+ "tslib": "^2.6.0"
33
33
  }
34
34
  }