webc.site 0.1.1 → 0.1.10
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/Scroll.js +1 -1
- package/package.json +1 -1
- package/On.js +0 -3
- package/On.js.map +0 -10
- package/dom.js +0 -3
- package/dom.js.map +0 -10
package/Scroll.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{On as A}from"./
|
|
1
|
+
import{On as A}from"./x.js";import{D as I,newEl as H}from"./x.js";(()=>{let{round:h,max:b,min:D}=Math,a=(r,l,...p)=>{let c=H(r);if(l)c.setAttribute("part",l);return c.append(...p),c},k=(r,l,p)=>{let c=r.toLowerCase(),f=l.toLowerCase(),_="client"+r,y="scroll"+r,d="scroll"+l,w="client"+p;return(i)=>{let C,m,g,v=-1,P=i.firstElementChild,u=a("i","si"),o=a("b","bar",u),T=(e=u[_])=>{let t=i[_],s=P[y];return[s-t,b(1,t-e-6),e,t,s]},E=(e)=>{if(!o.parentNode)return;let[t,s]=T(e),n=b(0,D(i[d],t));if(v!==-1&&v!==n)o.style.opacity=1,clearTimeout(C),C=setTimeout(()=>o.style.opacity=0,1000);v=n,u.style[f]=3+h(s*n/t)+"px"},G=(e)=>{if(m)return;let t=I.body;t.setPointerCapture(e.pointerId),t.classList.add("drag"),o.part.add("drag");let s=e[w],n=()=>{t.classList.remove("drag"),o.part.remove("drag"),x(),m=null},x=A(t,{pointermove:(R)=>{let[z,B]=T();i[d]+=h(z*(R[w]-s)/B),s=R[w]},pointerup:n,lostpointercapture:n});m=n},S=(e)=>{let t=o.getBoundingClientRect(),s=t[f],[n,x,R]=T();i[d]=h(n*b(D((e[w]-s-3-R/2)/x,1),0)),G(e)},N=[A(o,{pointerdown:S}),A(u,{pointerdown:(e)=>{e.stopPropagation(),G(e)}}),A(i,{scroll:()=>E()})],L=new ResizeObserver(()=>{clearTimeout(g),g=setTimeout(()=>{let[,,,e,t]=T();if(e<t){if(o.parentNode!==i)i.appendChild(o);let n=b(16,h(e*e/t));u.style[c]=n+"px",E(n)}else if(o.parentNode)o.remove()},200)}),X=()=>{if(clearTimeout(C),clearTimeout(g),N.forEach((e)=>e()),m)m();if(L.disconnect(),o.parentNode)o.remove()};return o.style.opacity=0,[i,P].forEach((e)=>L.observe(e)),X}};[["v","Height","Top","Y","flex-direction:column;width:100%;min-height:100%"],["h","Width","Left","X","min-width:100%;width:max-content;height:100%"]].map(([r,l,p,c,f])=>{let _=k(l,p,c);customElements.define(r+"-scroll",class extends HTMLElement{connectedCallback(){let y=a("b","",a("slot")),d=a("b","scroll",y);y.style.cssText="display:flex;"+f,this.attachShadow({mode:"open"}).appendChild(d),this._unbind=_(d)}disconnectedCallback(){this._unbind?.()}})})})();
|
|
2
2
|
|
|
3
3
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"webc.site","version":"0.1.
|
|
1
|
+
{"name":"webc.site","version":"0.1.10","description":"","keywords":[],"homepage":"https://webc-zh.github.io","license":"MulanPSL-2.0","author":"i18n.site@gmail.com","repository":{"type":"git","url":"git+https://github.com/webc-zh/webc-zh.github.io.git"},"files":["./*"],"type":"module","exports":{"./*":"./*"},"scripts":{},"devDependencies":{}}
|
package/On.js
DELETED
package/On.js.map
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../importmap/x/On.js"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"export const On = (elem, dict) => {\n let event, func;\n for (event in dict) {\n func = dict[event];\n elem.addEventListener(event, func);\n }\n return () => {\n for (event in dict) {\n func = dict[event];\n elem.removeEventListener(event, func);\n }\n };\n};\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": "AAAO,IAAM,EAAK,CAAC,EAAM,IAAS,CAChC,IAAI,EAAO,EACX,IAAK,KAAS,EACZ,EAAO,EAAK,GACZ,EAAK,iBAAiB,EAAO,CAAI,EAEnC,MAAO,IAAM,CACX,IAAK,KAAS,EACZ,EAAO,EAAK,GACZ,EAAK,oBAAoB,EAAO,CAAI",
|
|
8
|
-
"debugId": "3DD78A4F28E4B48664756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dom.js
DELETED
package/dom.js.map
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../importmap/x/dom.js"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"export const D = document,\n B = D.body,\n newEl = D.createElement.bind(D);\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": "AAAO,IAAM,EAAI,SACf,EAAI,EAAE,KACN,EAAQ,EAAE,cAAc,KAAK,CAAC",
|
|
8
|
-
"debugId": "C12225273B2567DB64756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|