plggmatic 0.5.2 → 0.5.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigationScript.d.ts","sourceRoot":"","sources":["../../../src/Navigate/usecase/navigationScript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AA8DpC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"navigationScript.d.ts","sourceRoot":"","sources":["../../../src/Navigate/usecase/navigationScript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AA8DpC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,OAka1B,CAAC;AAEV;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,SAC3B,OAAO,KACZ,OAMO,CAAC"}
|
package/dist/index.es.js
CHANGED
|
@@ -2745,11 +2745,15 @@ exports.navigationInitScript = "(function(){" +
|
|
|
2745
2745
|
"function metaList(n){var m=document.querySelector('meta[name=\"'+n+'\"]');" +
|
|
2746
2746
|
"return m?(m.getAttribute('content')||'').split(' ').filter(Boolean):[];}" +
|
|
2747
2747
|
"var PT=metaList(PM),EB=metaList(EM);" +
|
|
2748
|
-
"function abs(r){return r.
|
|
2749
|
-
"function partner(u){try{
|
|
2748
|
+
"function abs(r){return /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(r)||r.charAt(0)!=='/'||r.charAt(1)==='/'||r.charAt(1)==='\\\\';}" +
|
|
2749
|
+
"function partner(u){try{var x=new URL(u);" +
|
|
2750
|
+
"return (x.protocol==='https:'||x.protocol==='http:')&&PT.indexOf(x.origin)>=0;}catch(e){return false;}}" +
|
|
2751
|
+
"function local(r){if(abs(r)){return null;}var x;" +
|
|
2752
|
+
"try{x=new URL(r,window.location.origin);}catch(e){return null;}" +
|
|
2753
|
+
"return x.origin===window.location.origin&&(x.protocol==='https:'||x.protocol==='http:')?x:null;}" +
|
|
2750
2754
|
"function bare0(p){return p.length>1?p.replace(/\\/+$/,''):p;}" +
|
|
2751
2755
|
"var EMB=window.parent!==window&&EB.length>0&&new URL(window.location.href).searchParams.get(EP)==='1';" +
|
|
2752
|
-
"
|
|
2756
|
+
"var HS=false;" +
|
|
2753
2757
|
"function tell(m){for(var i=0;i<EB.length;i++){window.parent.postMessage(m,EB[i]);}}" +
|
|
2754
2758
|
"function esc(v){return v.split(E).join(E+'t')" +
|
|
2755
2759
|
".split(N).join(E+'c').split(F).join(E+'f');}" +
|
|
@@ -2759,7 +2763,7 @@ exports.navigationInitScript = "(function(){" +
|
|
|
2759
2763
|
".split('%2F').join('/').split('%2C').join(N)" +
|
|
2760
2764
|
".split('%3A').join(F);}" +
|
|
2761
2765
|
"function ps(){return new URL(window.location.href).searchParams;}" +
|
|
2762
|
-
"function entries(){var v=ps().get(R);return v?v.split(N):[];}" +
|
|
2766
|
+
"function entries(){var v=ps().get(R);return v?v.split(N).slice(0,12):[];}" +
|
|
2763
2767
|
"function entryOf(r,s){return esc(r)+(s?F+esc(s):'');}" +
|
|
2764
2768
|
"function routeOf(e){var i=e.indexOf(F);" +
|
|
2765
2769
|
"return unesc(i<0?e:e.slice(0,i));}" +
|
|
@@ -2804,15 +2808,19 @@ exports.navigationInitScript = "(function(){" +
|
|
|
2804
2808
|
"f.title=sp.textContent;var src=new URL(x.origin+x.pathname);src.searchParams.set(EP,'1');f.src=src.href;" +
|
|
2805
2809
|
"col.appendChild(f);" +
|
|
2806
2810
|
"setTimeout(function(){if(col.hasAttribute(RD)||!col.isConnected){return;}" +
|
|
2807
|
-
"var
|
|
2808
|
-
"
|
|
2809
|
-
"
|
|
2811
|
+
"f.remove();var bd=base.querySelector(':scope>div');" +
|
|
2812
|
+
"var box=document.createElement('div');box.className=bd?bd.className:'';" +
|
|
2813
|
+
"var ln=document.createElement('a');ln.href=x.origin+x.pathname;ln.target='_top';ln.rel='noopener';" +
|
|
2814
|
+
"ln.textContent=x.host+x.pathname;box.appendChild(ln);col.appendChild(box);},FT);" +
|
|
2810
2815
|
"return col;}" +
|
|
2811
2816
|
"function fetchCol(route,span){" +
|
|
2812
2817
|
"if(abs(route)){return partner(route)&&strip()&&cols().length" +
|
|
2813
2818
|
"?Promise.resolve(frameCol(route)):Promise.reject(new Error('nav'));}" +
|
|
2814
|
-
"
|
|
2815
|
-
"
|
|
2819
|
+
"var lu=local(route);if(!lu){return Promise.reject(new Error('nav'));}" +
|
|
2820
|
+
"return fetch(colUrl(lu.pathname,span),{credentials:'same-origin',mode:'same-origin',redirect:'follow'})" +
|
|
2821
|
+
".then(function(r){var at;try{at=new URL(r.url).origin;}catch(e){at='';}" +
|
|
2822
|
+
"if(!r.ok||at!==window.location.origin||(r.headers.get('content-type')||'').indexOf('text/html')!==0){throw new Error('nav');}" +
|
|
2823
|
+
"return r.text();})" +
|
|
2816
2824
|
".then(function(t){" +
|
|
2817
2825
|
"var d=new DOMParser().parseFromString(t,'text/html');" +
|
|
2818
2826
|
"var col=d.querySelector('['+C+']');" +
|
|
@@ -2831,7 +2839,7 @@ exports.navigationInitScript = "(function(){" +
|
|
|
2831
2839
|
"if(rep){col.setAttribute(RP,'');}" +
|
|
2832
2840
|
"truncate(at,rep);place(col,at);" +
|
|
2833
2841
|
"window.history.pushState(null,'',url);return true;}).catch(function(){" +
|
|
2834
|
-
"window.location.assign(
|
|
2842
|
+
"if(!abs(route)&&local(route)){window.location.assign(url);}return false;});}" +
|
|
2835
2843
|
"function last(){return cols().length-1;}" +
|
|
2836
2844
|
"function open(route,span){return openFrom(last(),route,span);}" +
|
|
2837
2845
|
"function columnOf(node){var c=cols();" +
|
|
@@ -2915,9 +2923,11 @@ exports.navigationInitScript = "(function(){" +
|
|
|
2915
2923
|
".observe(document.documentElement,{attributes:true,attributeFilter:['class']});}" +
|
|
2916
2924
|
"if(EMB){window.addEventListener('message',function(ev){" +
|
|
2917
2925
|
"if(ev.source!==window.parent||EB.indexOf(ev.origin)<0||!ev.data||ev.data.type!=='pm:scheme'){return;}" +
|
|
2926
|
+
"if(ev.data.scheme!=='dark'&&ev.data.scheme!=='light'){return;}" +
|
|
2927
|
+
"if(!HS){HS=true;document.documentElement.setAttribute(EA,'');}" +
|
|
2918
2928
|
"if(ev.data.scheme==='dark'){document.documentElement.classList.add('dark');}" +
|
|
2919
2929
|
"else if(ev.data.scheme==='light'){document.documentElement.classList.remove('dark');}});" +
|
|
2920
|
-
"window.addEventListener('wheel',function(ev){" +
|
|
2930
|
+
"window.addEventListener('wheel',function(ev){if(!HS){return;}" +
|
|
2921
2931
|
"var dx=ev.deltaX*(ev.deltaMode===1?16:1);" +
|
|
2922
2932
|
"if(!dx||Math.abs(dx)<=Math.abs(ev.deltaY)){return;}" +
|
|
2923
2933
|
"var e=ev.target;while(e&&e!==document&&e.nodeType===1){" +
|
|
@@ -2936,7 +2946,7 @@ exports.navigationInitScript = "(function(){" +
|
|
|
2936
2946
|
"var d=ev.data;" +
|
|
2937
2947
|
"if(d.type==='pm:title'&&typeof d.title==='string'){" +
|
|
2938
2948
|
"c[at].setAttribute(RD,'');shade(c[at]);" +
|
|
2939
|
-
"var sp=c[at].querySelector(':scope>header>span');if(sp){sp.textContent=d.title.slice(0,120);}sync();return;}" +
|
|
2949
|
+
"var sp=c[at].querySelector(':scope>header>span');if(sp){sp.textContent=d.title.slice(0,120)+' \u2014 '+ev.origin.replace(/^https?:\\/\\//,'');}sync();return;}" +
|
|
2940
2950
|
"if(d.type==='pm:scroll'&&typeof d.dx==='number'&&isFinite(d.dx)){" +
|
|
2941
2951
|
"var now=Date.now();if(now<SW){return;}" +
|
|
2942
2952
|
"if(now-SL>250){SX=0;}SL=now;SX+=Math.max(-600,Math.min(600,d.dx));" +
|
|
@@ -2955,7 +2965,7 @@ exports.navigationInitScript = "(function(){" +
|
|
|
2955
2965
|
"(function(){var t=target(),c=current();" +
|
|
2956
2966
|
"if(c.length&&t[0]===c[0]&&t.length>c.length){reconcile();}else{sync();}})();" +
|
|
2957
2967
|
"document.addEventListener('click',function(ev){" +
|
|
2958
|
-
"if(EMB){var a0=anchorOf(ev.target);" +
|
|
2968
|
+
"if(EMB&&HS){var a0=anchorOf(ev.target);" +
|
|
2959
2969
|
"if(a0&&plain(ev,a0)&&(a0.origin===window.location.origin||partner(a0.href))" +
|
|
2960
2970
|
"&&!(a0.pathname===window.location.pathname&&a0.hash!=='')){" +
|
|
2961
2971
|
"ev.preventDefault();tell({type:'pm:open',href:a0.origin+a0.pathname});}return;}" +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plggmatic",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "A column-oriented UI design framework on the plgg family: pane alignment, a typed light/dark color scheme, and fundamental components as pure functions returning plgg-view Html",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.es.js",
|