@adminiumjs/tokens 0.1.2 → 0.2.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
- {"version":3,"file":"pre-hydration.d.ts","sourceRoot":"","sources":["../src/pre-hydration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,QAUmC,CAAC"}
1
+ {"version":3,"file":"pre-hydration.d.ts","sourceRoot":"","sources":["../src/pre-hydration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,QAauC,CAAC"}
@@ -20,5 +20,8 @@ export const preHydrationScript = '(function(){try{var d=document.documentElemen
20
20
  'var r=s.getItem("adminium-dir");' +
21
21
  'if(r==="rtl")d.setAttribute("dir","rtl");' +
22
22
  'var l=s.getItem("adminium-locale");' +
23
- 'if(l)d.setAttribute("lang",l.replace("_","-"))}catch(e){}})();';
23
+ // split/join, not replace: `replace("_","-")` swaps only the FIRST
24
+ // underscore, so a three-subtag id like `zh_Hant_TW` would stamp the invalid
25
+ // tag `zh-Hant_TW` (23 §5.5).
26
+ 'if(l)d.setAttribute("lang",l.split("_").join("-"))}catch(e){}})();';
24
27
  //# sourceMappingURL=pre-hydration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pre-hydration.js","sourceRoot":"","sources":["../src/pre-hydration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAC7B,gEAAgE;IAChE,8CAA8C;IAC9C,sFAAsF;IACtF,iCAAiC;IACjC,uEAAuE;IACvE,8EAA8E;IAC9E,kCAAkC;IAClC,2CAA2C;IAC3C,qCAAqC;IACrC,gEAAgE,CAAC"}
1
+ {"version":3,"file":"pre-hydration.js","sourceRoot":"","sources":["../src/pre-hydration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAC7B,gEAAgE;IAChE,8CAA8C;IAC9C,sFAAsF;IACtF,iCAAiC;IACjC,uEAAuE;IACvE,8EAA8E;IAC9E,kCAAkC;IAClC,2CAA2C;IAC3C,qCAAqC;IACrC,mEAAmE;IACnE,6EAA6E;IAC7E,8BAA8B;IAC9B,oEAAoE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminiumjs/tokens",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "license": "AGPL-3.0-only",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,4 +21,7 @@ export const preHydrationScript =
21
21
  'var r=s.getItem("adminium-dir");' +
22
22
  'if(r==="rtl")d.setAttribute("dir","rtl");' +
23
23
  'var l=s.getItem("adminium-locale");' +
24
- 'if(l)d.setAttribute("lang",l.replace("_","-"))}catch(e){}})();';
24
+ // split/join, not replace: `replace("_","-")` swaps only the FIRST
25
+ // underscore, so a three-subtag id like `zh_Hant_TW` would stamp the invalid
26
+ // tag `zh-Hant_TW` (23 §5.5).
27
+ 'if(l)d.setAttribute("lang",l.split("_").join("-"))}catch(e){}})();';