@zumer/orbit 1.5.0 → 1.6.0
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 +120 -159
- package/dist/orbit.css +72 -0
- package/dist/orbit.js +7 -2
- package/dist/orbit.min.css +1 -1
- package/dist/orbit.min.js +4 -4
- package/dist/orbit.mjs +7 -2
- package/package.json +3 -2
package/dist/orbit.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* orbit
|
|
3
|
-
* v.1.
|
|
3
|
+
* v.1.6.0
|
|
4
4
|
* Author Juan Martin Muda - Zumerlab
|
|
5
5
|
* License MIT
|
|
6
6
|
*/
|
|
7
|
-
(()=>{var x=Symbol.for("zumer.orbit.layout.state.v1"),F=Symbol.for("zumer.orbit.layout.registry.v1"),_=Symbol.for("zumer.orbit.layout.probe.v1"),z="o-arc, o-progress",Z={subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeOldValue:!0};function T(r){var t;for(let o of r.classList||[])if(/^orbit-\d+$/.test(o))return Number(o.slice(6));return(t=r.classList)!=null&&t.contains("orbit")?null:void 0}function P(r,t,o){let n=String(o);r.style.getPropertyValue(t)!==n&&r.style.setProperty(t,n)}function w(r,t,o=0,n="number"){let e=String(t||"").trim();if(!e)return o;if(n==="number"&&/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(e))return Number(e);let i=e.match(/^([+-]?(?:\d+\.?\d*|\.\d+))(deg|rad|grad|turn)?$/);if(n==="angle"&&i)return Number(i[1])*({deg:1,rad:180/Math.PI,grad:.9,turn:360}[i[2]]||1);let a=r.ownerDocument;if(!(a!=null&&a.documentElement))return o;let c=a[_];c||(c=a.createElement("span"),c.setAttribute("data-orbit-measure",""),c.setAttribute("aria-hidden","true"),c.style.cssText="all:initial!important;position:fixed!important;visibility:hidden!important;pointer-events:none!important;width:0!important;height:0!important;overflow:hidden!important;",a.documentElement.appendChild(c),Object.defineProperty(a,_,{value:c,configurable:!0}));let s=n==="angle"?"rotate":"scale";if(c.style.removeProperty(s),c.style.setProperty(s,e,"important"),!c.style.getPropertyValue(s))return o;let l=a.defaultView.getComputedStyle(c).getPropertyValue(s),h=parseFloat(l);return Number.isFinite(h)?h:o}function G(r){if(r.localName==="o-arc")return"arc";for(let t of["satellite","vector","side"])if(r.classList.contains(t))return t;return null}function X(r){let t={arc:0,satellite:0,vector:0,side:0};for(let e of r.children){let i=G(e);i?P(e,"--o-layout-index",t[i]++-(i==="side"?1:0)):e.localName==="o-progress"&&P(e,"--o-layout-index",0)}let o=Math.max(t.arc,t.satellite,t.vector,1),n=t.side?String(t.side):`max(1, ${o} - var(--o-fit-range, 0))`;P(r,"--o-layout-angle",`calc(var(--o-range, 360deg) / ${n})`)}function B(r){return(r==null?void 0:r.nodeType)===9||(r==null?void 0:r.nodeType)===11&&!!r.host}function V(r){var o;if(B(r))return r;let t=(o=r==null?void 0:r.getRootNode)==null?void 0:o.call(r);return B(t)?t:null}function Q(r,t){var o,n;for(let e=t;e;e=(o=e.getRootNode)==null?void 0:o.call(e).host)if(r===e||(n=r.contains)!=null&&n.call(r,e))return!0;return!1}function J(r){return r[F]||Object.defineProperty(r,F,{value:{states:new Set},configurable:!0}),r[F]}function O(r){if(!r.disposed){r.disposed=!0,r.view.cancelAnimationFrame(r.frame),r.observer.disconnect(),r.resize.disconnect();for(let t of r.listeners)t();r.rings.clear(),r.visuals.clear(),r.dirty.clear(),r.registry.states.delete(r),r.scope[x]===r&&delete r.scope[x]}}function W(r){for(let t of r.states)t.scope.host&&!t.scope.host.isConnected&&O(t)}function E(r,t=r.scope){for(let o of r.registry.states)o!==r&&o.scope.host&&Q(t,o.scope.host)&&(o.all=!0,o.queue())}function K(r){return r.nodeType!==1||r.hasAttribute("data-orbit-measure")?!1:T(r)!==void 0||r.matches(".gravity-spot, o-arc, o-progress")?!0:!!r.querySelector(".gravity-spot, .orbit, [data-orbit-ring], o-arc, o-progress")}function tt(r){return r.nodeType===1&&(r.matches('style, link[rel~="stylesheet"]')||!!r.querySelector('style, link[rel~="stylesheet"]'))}function et(r,t){if(r.type==="childList")return[...r.addedNodes,...r.removedNodes].some(K);if(r.attributeName!=="class")return!1;let o=r.target;return t.rings.has(o)||o.classList.contains("gravity-spot")||T(o)!==void 0||(r.oldValue||"").split(/\s+/).some(n=>n==="gravity-spot"||n==="orbit"||/^orbit-\d+$/.test(n))}function rt(r){let t=r.nodeType===9?r:r.ownerDocument,o=t.defaultView,n=J(t),e={scope:r,doc:t,view:o,registry:n,rings:new Set,visuals:new Set,dirty:new Set,scan:!0,all:!0,frame:0,disposed:!1,listeners:[]},i=(s,l,h,u)=>{s==null||s.addEventListener(l,h,u),e.listeners.push(()=>s==null?void 0:s.removeEventListener(l,h,u))},a=()=>{!e.disposed&&!e.frame&&(e.frame=o.requestAnimationFrame(()=>{e.frame=0,e.flush()}))};e.queue=a,e.flush=()=>ot(e),e.invalidate=(s=r,l=!0)=>{var h,u;if(l&&(s===r||s===t.documentElement||s===t.head))e.all=!0;else{for(let d of e.rings)(d===s||d.contains(s)||l&&((h=s.contains)!=null&&h.call(s,d)))&&e.dirty.add(d);for(let d of e.visuals)(d===s||d.contains(s)||l&&((u=s.contains)!=null&&u.call(s,d)))&&e.dirty.add(d)}(e.all||e.dirty.size||e.scan)&&a()},e.observer=new o.MutationObserver(s=>{var l,h;if(s.some(u=>u.type==="childList")&&W(n),!e.disposed)for(let u of s){let d=u.target.nodeType===3?u.target.parentElement:u.target;if(!d||(l=d.hasAttribute)!=null&&l.call(d,"data-orbit-measure"))continue;let f=et(u,e);f&&(e.scan=!0),u.type==="childList"&&[...u.addedNodes,...u.removedNodes].some(tt)||(h=d.closest)!=null&&h.call(d,"head, style")||d.localName==="link"?(e.all=!0,E(e)):u.type==="attributes"&&E(e,d),e.invalidate(d,u.type==="attributes"||f)}}),e.observer.observe(r,Z),e.resize=new o.ResizeObserver(s=>{for(let l of s)e.dirty.add(l.target);a()});let c=()=>{e.all=!0,E(e),a()};r===t&&(i(o,"resize",c),i(t.fonts,"loadingdone",c)),i(r,"load",s=>{s.target.localName==="link"&&c()},!0);for(let s of["pointerover","pointerout","focusin","focusout"])i(r,s,l=>{e.invalidate(l.target),E(e,l.target)},!0);return Object.defineProperty(r,x,{value:e,configurable:!0}),n.states.add(e),a(),e}function q(r){let t=r.nodeType===9?r:r.ownerDocument;if(!(t!=null&&t.defaultView)||!t.documentElement||r.host&&!r.host.isConnected)return null;if(r[x]&&r[x].doc!==t&&O(r[x]),r.host){let o=V(r.host);o&&q(o)}return r[x]||rt(r)}function nt(r){let t=new Set,o=new Map;for(let e of r.scope.querySelectorAll(".gravity-spot > *")){let i=T(e);if(i===void 0)continue;let a=o.get(e.parentElement)||0;e.classList.contains("orbit")&&o.set(e.parentElement,++a);let c=i===null?a:i;e.setAttribute("data-orbit-ring",""),P(e,"--o-layout-number",c===0?1e-5:c),t.add(e),r.dirty.add(e),r.rings.has(e)||r.resize.observe(e)}for(let e of r.rings)if(!t.has(e)){r.resize.unobserve(e),e.removeAttribute("data-orbit-ring");for(let i of["--o-layout-number","--o-layout-angle"])e.style.removeProperty(i)}r.rings=t;let n=new Set(r.scope.querySelectorAll(z));for(let e of r.visuals)n.has(e)||r.resize.unobserve(e);for(let e of n)r.visuals.has(e)||(r.resize.observe(e),r.dirty.add(e));r.visuals=n,r.scan=!1}function ot(r){var t;if(!r.disposed){if(r.scope.host&&!r.scope.host.isConnected){O(r);return}r.observer.disconnect();try{r.scan&&nt(r);let o=r.all?new Set([...r.rings,...r.visuals]):r.dirty,n=new Set;for(let e of o)if(e.isConnected)if(r.rings.has(e)){X(e);for(let i of e.querySelectorAll(z))n.add(i)}else r.visuals.has(e)&&n.add(e);for(let e of r.visuals)n.has(e)&&((t=e.update)==null||t.call(e));r.dirty=new Set,r.all=!1}finally{r.disposed||r.observer.observe(r.scope,Z)}}}function R(r=globalThis.document){var n;let t=V(r);if(!t)return;let o=q(t);o&&((n=r==null?void 0:r.matches)!=null&&n.call(r,z)&&!o.visuals.has(r)&&(o.scan=!0),o.invalidate(r||t))}function D(r=globalThis.document){let t=V(r);if(!t)return;let o=q(t);if(o){W(o.registry);for(let n of o.registry.states)n!==o&&(!n.scope.host||!Q(r,n.scope.host))||(n.scan=!0,n.all=!0,n.view.cancelAnimationFrame(n.frame),n.frame=0,n.flush())}}var S=class extends(globalThis.HTMLElement||class{}){constructor(){super()}connectedCallback(){R(this)}disconnectedCallback(){this._textFrame&&this.ownerDocument.defaultView.cancelAnimationFrame(this._textFrame),this._textFrame=0}readNumber(t,o,n=0){return w(this,t.getPropertyValue(o),n)}readAngle(t,o,n=0){return w(this,t.getPropertyValue(o),n,"angle")}getCommonAttributes(t){var f;let o=t.ownerDocument.defaultView.getComputedStyle(t),n=parseFloat(o.getPropertyValue("r")),e=Math.max(0,Number.isFinite(n)?n:(((f=t.parentElement)==null?void 0:f.clientWidth)||0)/2),i=Math.max(1e-5,this.readNumber(o,"--o-orbit-number",1)),a=Math.max(0,this.readNumber(o,"--o-size-ratio",1)),c=Math.max(0,this.readNumber(o,"--o-stroke-width",1)),s=t.getAttribute("shape")||"none",l=Math.max(0,e/i*a-c+.3),h=e>0?Math.min(49.999,l*25/e):0,u=0;t.classList.contains("outer-orbit")?u=h:t.classList.contains("quarter-outer-orbit")?u=h*-.5:t.classList.contains("inner-orbit")?u=h*-1:t.classList.contains("quarter-inner-orbit")&&(u=h*.5);let d=50+u;return{orbitRadius:e,arcHeight:l,realRadius:d,arcAngle:0,shape:s,arcHeightPercentage:h,orbitNumber:i,size:a,strokeWidth:c,style:o}}getProgressAngle(t,o,n=100){return!Number.isFinite(o)||!Number.isFinite(n)||n<=0?0:Math.min(1,Math.max(0,o/n))*Math.max(0,Math.min(360,t))}getControlPoint(t,o,n,e,i="clockwise"){let a=(t+n)/2,c=(o+e)/2,s=n-t,l=e-o;return i==="clockwise"?{xc:a+l*.4,yc:c-s*.4}:{xc:a-l*.4,yc:c+s*.4}}arcPoint(t,o,n=0,e=0){let i=t+n,a=o+e*Math.PI/180;return{x:50+i*Math.cos(a),y:50+i*Math.sin(a)}}calculateCommonArcParameters(t,o,n,e,i,a,c,s=0){let l=Math.PI/2,h=Math.max(0,Math.min(359.999999,t))*Math.PI/180,u=o+n,d=Math.max(.001,o-n),f=Math.min(h*.49,(s+a*1.25)/e/u),p=Math.min(h*.49,(s+a*1.25)/e/d),g=f-l,y=h-f-l,m=p-l,A=h-p-l,v=this.arcPoint(u,g),b=this.arcPoint(u,y),k=this.arcPoint(d,m),M=this.arcPoint(d,A),$=y-g,H=A-m,U=$>Math.PI?1:0,Y=H>Math.PI?1:0;return{upperArcStart:v,upperArcEnd:b,innerArcStart:k,innerArcEnd:M,largeArcFlag:U,largeArcFlagUpper:U,largeArcFlagInner:Y,bigRadius:u,smallRadius:d,radius:o,upperAngleStart:g,upperAngleEnd:y,innerAngleStart:m,innerAngleEnd:A}}generatePathData(t,o,n,e){let i="";switch(t){case"rounded":i=this.generateRoundedPath(o,n,e);break;case"circle":case"circle-a":case"bullet":i=this.generateCirclePath(o,t);break;case"circle-b":i=this.generateCircleBPath(o,n,e);break;case"arrow":i=this.generateArrowPath(o,e);break;case"backslash":case"slash":i=this.generateSlashPath(o,t,e);break;case"zigzag":i=this.generateZigzagPath(o,n,e);break;default:i=this.generateDefaultPath(o)}return i}generateRoundedPath(t,o,n){let{bigRadius:e,smallRadius:i}=t,a=Math.min(t.upperAngleEnd-t.upperAngleStart,t.innerAngleEnd-t.innerAngleStart),c=Math.min(o<5?2.5:o<10?5:10,a*180/Math.PI*n*.49),s=c/n*Math.PI/180,l=t.upperAngleEnd-t.upperAngleStart-2*s>Math.PI?1:0,h=t.innerAngleEnd-t.innerAngleStart-2*s>Math.PI?1:0,u=this.arcPoint(e,t.upperAngleStart,0,c/n),d=this.arcPoint(e,t.upperAngleEnd,0,-c/n),f=this.arcPoint(i,t.innerAngleStart,0,c/n),p=this.arcPoint(i,t.innerAngleEnd,0,-c/n),g=this.arcPoint(e,t.upperAngleStart,-(c/2)/n,0),y=this.arcPoint(e,t.upperAngleEnd,-(c/2)/n,0),m=this.arcPoint(i,t.innerAngleStart,c/2/n,0),A=this.arcPoint(i,t.innerAngleEnd,c/2/n,0),v=this.getControlPoint(d.x,d.y,y.x,y.y),b=this.getControlPoint(A.x,A.y,p.x,p.y),k=this.getControlPoint(f.x,f.y,m.x,m.y),M=this.getControlPoint(g.x,g.y,u.x,u.y),$=`M ${u.x},${u.y} A ${e},${e} 0 ${l} 1 ${d.x},${d.y}`;return $+=`Q ${v.xc},${v.yc} ${y.x},${y.y} L ${A.x},${A.y}`,$+=`Q ${b.xc},${b.yc} ${p.x},${p.y}`,$+=`A ${i},${i} 0 ${h} 0 ${f.x},${f.y}`,$+=`Q ${k.xc},${k.yc} ${m.x},${m.y} L ${g.x},${g.y}`,$+=` Q ${M.xc},${M.yc} ${u.x},${u.y}`,$+=" Z",$}generateCirclePath(t,o){let{upperArcStart:n,upperArcEnd:e,innerArcStart:i,innerArcEnd:a,bigRadius:c,smallRadius:s,largeArcFlagUpper:l,largeArcFlagInner:h}=t,u=`M ${n.x},${n.y} A ${c},${c} 0 ${l} 1 ${e.x},${e.y}`;return u+=` A 1,1 0 0 1 ${a.x},${a.y} `,u+=` A ${s},${s} 0 ${h} 0 ${i.x},${i.y}`,u+=` A 1,1 0 0 ${o==="circle"||o==="circle-a"?1:0} ${n.x},${n.y} `,u+=" Z",u}generateCircleBPath(t,o,n){let{upperAngleStart:e,upperAngleEnd:i,innerAngleStart:a,innerAngleEnd:c,bigRadius:s,smallRadius:l}=t,h=Math.min(i-e,c-a),u=Math.min(o*1.36,h*180/Math.PI*n*.49),d=u/n*Math.PI/180,f=i-e-2*d>Math.PI?1:0,p=c-a-2*d>Math.PI?1:0,g=this.arcPoint(s,e,0,u/n),y=this.arcPoint(s,i,0,-u/n),m=this.arcPoint(l,a,0,u/n),A=this.arcPoint(l,c,0,-u/n),v=`M ${g.x},${g.y} A ${s},${s} 0 ${f} 1 ${y.x},${y.y}`;return v+=` A 1,1 0 0 1 ${A.x},${A.y} `,v+=` A ${l},${l} 0 ${p} 0 ${m.x},${m.y}`,v+=` A 1,1 0 0 1 ${g.x},${g.y} `,v+=" Z",v}generateArrowPath(t,o){let{upperArcStart:n,upperArcEnd:e,innerArcStart:i,innerArcEnd:a,bigRadius:c,smallRadius:s,largeArcFlagUpper:l,largeArcFlagInner:h,radius:u}=t,d=this.arcPoint(u,t.upperAngleEnd,0,24/o/2),f=this.arcPoint(u,t.upperAngleStart,0,24/o/2),p=`M ${n.x},${n.y} A ${c},${c} 0 ${l} 1 ${e.x},${e.y}`;return p+=`L ${d.x} ${d.y}`,p+=`L ${a.x} ${a.y}`,p+=`A ${s},${s} 0 ${h} 0 ${i.x}, ${i.y}`,p+=`L ${f.x} ${f.y}`,p+="Z",p}generateSlashPath(t,o,n){let{upperAngleStart:e,upperAngleEnd:i,innerAngleStart:a,innerAngleEnd:c,bigRadius:s,smallRadius:l,largeArcFlagUpper:h,largeArcFlagInner:u}=t,d=this.arcPoint(s,e,0,o==="backslash"?0:24/n/2),f=this.arcPoint(s,i,0,o==="backslash"?0:24/n/2),p=this.arcPoint(l,a,0,o==="backslash"?24/n/2:0),g=this.arcPoint(l,c,0,o==="backslash"?24/n/2:0),y=`M ${d.x},${d.y} A ${s},${s} 0 ${h} 1 ${f.x},${f.y}`;return y+=`L ${g.x} ${g.y}`,y+=`A ${l},${l} 0 ${u} 0 ${p.x}, ${p.y}`,y+="Z",y}generateZigzagPath(t,o,n){let{upperArcStart:e,upperArcEnd:i,innerArcStart:a,innerArcEnd:c,bigRadius:s,smallRadius:l,largeArcFlagUpper:h,largeArcFlagInner:u,radius:d}=t,f=o/n/2,p=this.arcPoint(d,t.upperAngleStart,-f,3),g=this.arcPoint(d,t.upperAngleStart,0,0),y=this.arcPoint(d,t.upperAngleStart,f,3),m=this.arcPoint(d,t.innerAngleEnd,f,3),A=this.arcPoint(d,t.innerAngleEnd,0,0),v=this.arcPoint(d,t.innerAngleEnd,-f,3),b=`M ${e.x},${e.y} A ${s},${s} 0 ${h} 1 ${i.x},${i.y}`;return b+=`L ${m.x} ${m.y}`,b+=`L ${A.x} ${A.y}`,b+=`L ${v.x} ${v.y}`,b+=`L ${c.x} ${c.y}`,b+=`A ${l},${l} 0 ${u} 0 ${a.x}, ${a.y}`,b+=`L ${p.x} ${p.y}`,b+=`L ${g.x} ${g.y}`,b+=`L ${y.x} ${y.y}`,b+="Z",b}generateDefaultPath(t){let{upperArcStart:o,upperArcEnd:n,innerArcStart:e,innerArcEnd:i,bigRadius:a,smallRadius:c,largeArcFlagUpper:s,largeArcFlagInner:l}=t,h=`M ${o.x},${o.y} A ${a},${a} 0 ${s} 1 ${n.x},${n.y}`;return h+=`L ${i.x} ${i.y}`,h+=`A ${c},${c} 0 ${l} 0 ${e.x}, ${e.y}`,h+="Z",h}};var L=class extends S{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
|
|
7
|
+
(()=>{var x=Symbol.for("zumer.orbit.layout.state.v1"),F=Symbol.for("zumer.orbit.layout.registry.v1"),_=Symbol.for("zumer.orbit.layout.probe.v1"),z="o-arc, o-progress",Z={subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeOldValue:!0};function T(r){var t;for(let o of r.classList||[])if(/^orbit-\d+$/.test(o))return Number(o.slice(6));return(t=r.classList)!=null&&t.contains("orbit")?null:void 0}function P(r,t,o){let n=String(o);r.style.getPropertyValue(t)!==n&&r.style.setProperty(t,n)}function w(r,t,o=0,n="number"){let e=String(t||"").trim();if(!e)return o;if(n==="number"&&/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(e))return Number(e);let i=e.match(/^([+-]?(?:\d+\.?\d*|\.\d+))(deg|rad|grad|turn)?$/);if(n==="angle"&&i)return Number(i[1])*({deg:1,rad:180/Math.PI,grad:.9,turn:360}[i[2]]||1);let a=r.ownerDocument;if(!(a!=null&&a.documentElement))return o;let c=a[_];c||(c=a.createElement("span"),c.setAttribute("data-orbit-measure",""),c.setAttribute("aria-hidden","true"),c.style.cssText="all:initial!important;position:fixed!important;visibility:hidden!important;pointer-events:none!important;width:0!important;height:0!important;overflow:hidden!important;",a.documentElement.appendChild(c),Object.defineProperty(a,_,{value:c,configurable:!0}));let s=n==="angle"?"rotate":"scale";if(c.style.removeProperty(s),c.style.setProperty(s,e,"important"),!c.style.getPropertyValue(s))return o;let l=a.defaultView.getComputedStyle(c).getPropertyValue(s),d=parseFloat(l);return Number.isFinite(d)?d:o}function G(r){if(r.localName==="o-arc")return"arc";for(let t of["satellite","vector","side"])if(r.classList.contains(t))return t;return null}function X(r){let t={arc:0,satellite:0,vector:0,side:0};for(let e of r.children){let i=G(e);i?P(e,"--o-layout-index",t[i]++-(i==="side"?1:0)):e.localName==="o-progress"&&P(e,"--o-layout-index",0)}let o=Math.max(t.arc,t.satellite,t.vector,1),n=t.side?String(t.side):`max(1, ${o} - var(--o-fit-range, 0))`;P(r,"--o-layout-angle",`calc(var(--o-range, 360deg) / ${n})`)}function B(r){return(r==null?void 0:r.nodeType)===9||(r==null?void 0:r.nodeType)===11&&!!r.host}function V(r){var o;if(B(r))return r;let t=(o=r==null?void 0:r.getRootNode)==null?void 0:o.call(r);return B(t)?t:null}function Q(r,t){var o,n;for(let e=t;e;e=(o=e.getRootNode)==null?void 0:o.call(e).host)if(r===e||(n=r.contains)!=null&&n.call(r,e))return!0;return!1}function J(r){return r[F]||Object.defineProperty(r,F,{value:{states:new Set},configurable:!0}),r[F]}function O(r){if(!r.disposed){r.disposed=!0,r.view.cancelAnimationFrame(r.frame),r.observer.disconnect(),r.resize.disconnect();for(let t of r.listeners)t();r.rings.clear(),r.visuals.clear(),r.dirty.clear(),r.registry.states.delete(r),r.scope[x]===r&&delete r.scope[x]}}function W(r){for(let t of r.states)t.scope.host&&!t.scope.host.isConnected&&O(t)}function E(r,t=r.scope){for(let o of r.registry.states)o!==r&&o.scope.host&&Q(t,o.scope.host)&&(o.all=!0,o.queue())}function K(r){return r.nodeType!==1||r.hasAttribute("data-orbit-measure")?!1:T(r)!==void 0||r.matches(".gravity-spot, o-arc, o-progress")?!0:!!r.querySelector(".gravity-spot, .orbit, [data-orbit-ring], o-arc, o-progress")}function tt(r){return r.nodeType===1&&(r.matches('style, link[rel~="stylesheet"]')||!!r.querySelector('style, link[rel~="stylesheet"]'))}function et(r,t){if(r.type==="childList")return[...r.addedNodes,...r.removedNodes].some(K);if(r.attributeName!=="class")return!1;let o=r.target;return t.rings.has(o)||o.classList.contains("gravity-spot")||T(o)!==void 0||(r.oldValue||"").split(/\s+/).some(n=>n==="gravity-spot"||n==="orbit"||/^orbit-\d+$/.test(n))}function rt(r){let t=r.nodeType===9?r:r.ownerDocument,o=t.defaultView,n=J(t),e={scope:r,doc:t,view:o,registry:n,rings:new Set,visuals:new Set,dirty:new Set,scan:!0,all:!0,frame:0,disposed:!1,listeners:[]},i=(s,l,d,u)=>{s==null||s.addEventListener(l,d,u),e.listeners.push(()=>s==null?void 0:s.removeEventListener(l,d,u))},a=()=>{!e.disposed&&!e.frame&&(e.frame=o.requestAnimationFrame(()=>{e.frame=0,e.flush()}))};e.queue=a,e.flush=()=>ot(e),e.invalidate=(s=r,l=!0)=>{var d,u;if(l&&(s===r||s===t.documentElement||s===t.head))e.all=!0;else{for(let h of e.rings)(h===s||h.contains(s)||l&&((d=s.contains)!=null&&d.call(s,h)))&&e.dirty.add(h);for(let h of e.visuals)(h===s||h.contains(s)||l&&((u=s.contains)!=null&&u.call(s,h)))&&e.dirty.add(h)}(e.all||e.dirty.size||e.scan)&&a()},e.observer=new o.MutationObserver(s=>{var l,d;if(s.some(u=>u.type==="childList")&&W(n),!e.disposed)for(let u of s){let h=u.target.nodeType===3?u.target.parentElement:u.target;if(!h||(l=h.hasAttribute)!=null&&l.call(h,"data-orbit-measure"))continue;let f=et(u,e);f&&(e.scan=!0),u.type==="childList"&&[...u.addedNodes,...u.removedNodes].some(tt)||(d=h.closest)!=null&&d.call(h,"head, style")||h.localName==="link"?(e.all=!0,E(e)):u.type==="attributes"&&E(e,h),e.invalidate(h,u.type==="attributes"||f)}}),e.observer.observe(r,Z),e.resize=new o.ResizeObserver(s=>{for(let l of s)e.dirty.add(l.target);a()});let c=()=>{e.all=!0,E(e),a()};r===t&&(i(o,"resize",c),i(t.fonts,"loadingdone",c)),i(r,"load",s=>{s.target.localName==="link"&&c()},!0);for(let s of["pointerover","pointerout","focusin","focusout"])i(r,s,l=>{e.invalidate(l.target),E(e,l.target)},!0);return Object.defineProperty(r,x,{value:e,configurable:!0}),n.states.add(e),a(),e}function q(r){let t=r.nodeType===9?r:r.ownerDocument;if(!(t!=null&&t.defaultView)||!t.documentElement||r.host&&!r.host.isConnected)return null;if(r[x]&&r[x].doc!==t&&O(r[x]),r.host){let o=V(r.host);o&&q(o)}return r[x]||rt(r)}function nt(r){let t=new Set,o=new Map;for(let e of r.scope.querySelectorAll(".gravity-spot > *")){let i=T(e);if(i===void 0)continue;let a=o.get(e.parentElement)||0;e.classList.contains("orbit")&&o.set(e.parentElement,++a);let c=i===null?a:i;e.setAttribute("data-orbit-ring",""),P(e,"--o-layout-number",c===0?1e-5:c),t.add(e),r.dirty.add(e),r.rings.has(e)||r.resize.observe(e)}for(let e of r.rings)if(!t.has(e)){r.resize.unobserve(e),e.removeAttribute("data-orbit-ring");for(let i of["--o-layout-number","--o-layout-angle"])e.style.removeProperty(i)}r.rings=t;let n=new Set(r.scope.querySelectorAll(z));for(let e of r.visuals)n.has(e)||r.resize.unobserve(e);for(let e of n)r.visuals.has(e)||(r.resize.observe(e),r.dirty.add(e));r.visuals=n,r.scan=!1}function ot(r){var t;if(!r.disposed){if(r.scope.host&&!r.scope.host.isConnected){O(r);return}r.observer.disconnect();try{r.scan&&nt(r);let o=r.all?new Set([...r.rings,...r.visuals]):r.dirty,n=new Set;for(let e of o)if(e.isConnected)if(r.rings.has(e)){X(e);for(let i of e.querySelectorAll(z))n.add(i)}else r.visuals.has(e)&&n.add(e);for(let e of r.visuals)n.has(e)&&((t=e.update)==null||t.call(e));r.dirty=new Set,r.all=!1}finally{r.disposed||r.observer.observe(r.scope,Z)}}}function R(r=globalThis.document){var n;let t=V(r);if(!t)return;let o=q(t);o&&((n=r==null?void 0:r.matches)!=null&&n.call(r,z)&&!o.visuals.has(r)&&(o.scan=!0),o.invalidate(r||t))}function D(r=globalThis.document){let t=V(r);if(!t)return;let o=q(t);if(o){W(o.registry);for(let n of o.registry.states)n!==o&&(!n.scope.host||!Q(r,n.scope.host))||(n.scan=!0,n.all=!0,n.view.cancelAnimationFrame(n.frame),n.frame=0,n.flush())}}var S=class extends(globalThis.HTMLElement||class{}){constructor(){super()}connectedCallback(){R(this)}disconnectedCallback(){this._textFrame&&this.ownerDocument.defaultView.cancelAnimationFrame(this._textFrame),this._textFrame=0}readNumber(t,o,n=0){return w(this,t.getPropertyValue(o),n)}readAngle(t,o,n=0){return w(this,t.getPropertyValue(o),n,"angle")}getCommonAttributes(t){var f;let o=t.ownerDocument.defaultView.getComputedStyle(t),n=parseFloat(o.getPropertyValue("r")),e=Math.max(0,Number.isFinite(n)?n:(((f=t.parentElement)==null?void 0:f.clientWidth)||0)/2),i=Math.max(1e-5,this.readNumber(o,"--o-orbit-number",1)),a=Math.max(0,this.readNumber(o,"--o-size-ratio",1)),c=Math.max(0,this.readNumber(o,"--o-stroke-width",1)),s=t.getAttribute("shape")||"none",l=Math.max(0,e/i*a-c+.3),d=e>0?Math.min(49.999,l*25/e):0,u=0;t.classList.contains("outer-orbit")?u=d:t.classList.contains("quarter-outer-orbit")?u=d*-.5:t.classList.contains("inner-orbit")?u=d*-1:t.classList.contains("quarter-inner-orbit")&&(u=d*.5);let h=50+u;return{orbitRadius:e,arcHeight:l,realRadius:h,arcAngle:0,shape:s,arcHeightPercentage:d,orbitNumber:i,size:a,strokeWidth:c,style:o}}getProgressAngle(t,o,n=100){return!Number.isFinite(o)||!Number.isFinite(n)||n<=0?0:Math.min(1,Math.max(0,o/n))*Math.max(0,Math.min(360,t))}getControlPoint(t,o,n,e,i="clockwise"){let a=(t+n)/2,c=(o+e)/2,s=n-t,l=e-o;return i==="clockwise"?{xc:a+l*.4,yc:c-s*.4}:{xc:a-l*.4,yc:c+s*.4}}arcPoint(t,o,n=0,e=0){let i=t+n,a=o+e*Math.PI/180;return{x:50+i*Math.cos(a),y:50+i*Math.sin(a)}}calculateCommonArcParameters(t,o,n,e,i,a,c,s=0){let l=Math.PI/2,d=Math.max(0,Math.min(359.999999,t))*Math.PI/180,u=o+n,h=Math.max(.001,o-n),f=Math.min(d*.49,(s+a*1.25)/e/u),p=Math.min(d*.49,(s+a*1.25)/e/h),g=f-l,y=d-f-l,m=p-l,A=d-p-l,$=this.arcPoint(u,g),b=this.arcPoint(u,y),k=this.arcPoint(h,m),M=this.arcPoint(h,A),v=y-g,H=A-m,U=v>Math.PI?1:0,Y=H>Math.PI?1:0;return{upperArcStart:$,upperArcEnd:b,innerArcStart:k,innerArcEnd:M,largeArcFlag:U,largeArcFlagUpper:U,largeArcFlagInner:Y,bigRadius:u,smallRadius:h,radius:o,upperAngleStart:g,upperAngleEnd:y,innerAngleStart:m,innerAngleEnd:A}}generatePathData(t,o,n,e){let i="";switch(t){case"rounded":i=this.generateRoundedPath(o,n,e);break;case"circle":case"circle-a":case"bullet":i=this.generateCirclePath(o,t);break;case"circle-b":i=this.generateCircleBPath(o,n,e);break;case"arrow":i=this.generateArrowPath(o,e);break;case"backslash":case"slash":i=this.generateSlashPath(o,t,e);break;case"zigzag":i=this.generateZigzagPath(o,n,e);break;default:i=this.generateDefaultPath(o)}return i}generateRoundedPath(t,o,n){let{bigRadius:e,smallRadius:i}=t,a=Math.min(t.upperAngleEnd-t.upperAngleStart,t.innerAngleEnd-t.innerAngleStart),c=Math.min(o<5?2.5:o<10?5:10,a*180/Math.PI*n*.49),s=c/n*Math.PI/180,l=t.upperAngleEnd-t.upperAngleStart-2*s>Math.PI?1:0,d=t.innerAngleEnd-t.innerAngleStart-2*s>Math.PI?1:0,u=this.arcPoint(e,t.upperAngleStart,0,c/n),h=this.arcPoint(e,t.upperAngleEnd,0,-c/n),f=this.arcPoint(i,t.innerAngleStart,0,c/n),p=this.arcPoint(i,t.innerAngleEnd,0,-c/n),g=this.arcPoint(e,t.upperAngleStart,-(c/2)/n,0),y=this.arcPoint(e,t.upperAngleEnd,-(c/2)/n,0),m=this.arcPoint(i,t.innerAngleStart,c/2/n,0),A=this.arcPoint(i,t.innerAngleEnd,c/2/n,0),$=this.getControlPoint(h.x,h.y,y.x,y.y),b=this.getControlPoint(A.x,A.y,p.x,p.y),k=this.getControlPoint(f.x,f.y,m.x,m.y),M=this.getControlPoint(g.x,g.y,u.x,u.y),v=`M ${u.x},${u.y} A ${e},${e} 0 ${l} 1 ${h.x},${h.y}`;return v+=`Q ${$.xc},${$.yc} ${y.x},${y.y} L ${A.x},${A.y}`,v+=`Q ${b.xc},${b.yc} ${p.x},${p.y}`,v+=`A ${i},${i} 0 ${d} 0 ${f.x},${f.y}`,v+=`Q ${k.xc},${k.yc} ${m.x},${m.y} L ${g.x},${g.y}`,v+=` Q ${M.xc},${M.yc} ${u.x},${u.y}`,v+=" Z",v}generateCirclePath(t,o){let{upperArcStart:n,upperArcEnd:e,innerArcStart:i,innerArcEnd:a,bigRadius:c,smallRadius:s,largeArcFlagUpper:l,largeArcFlagInner:d}=t,u=`M ${n.x},${n.y} A ${c},${c} 0 ${l} 1 ${e.x},${e.y}`;return u+=` A 1,1 0 0 1 ${a.x},${a.y} `,u+=` A ${s},${s} 0 ${d} 0 ${i.x},${i.y}`,u+=` A 1,1 0 0 ${o==="circle"||o==="circle-a"?1:0} ${n.x},${n.y} `,u+=" Z",u}generateCircleBPath(t,o,n){let{upperAngleStart:e,upperAngleEnd:i,innerAngleStart:a,innerAngleEnd:c,bigRadius:s,smallRadius:l}=t,d=Math.min(i-e,c-a),u=Math.min(o*1.36,d*180/Math.PI*n*.49),h=u/n*Math.PI/180,f=i-e-2*h>Math.PI?1:0,p=c-a-2*h>Math.PI?1:0,g=this.arcPoint(s,e,0,u/n),y=this.arcPoint(s,i,0,-u/n),m=this.arcPoint(l,a,0,u/n),A=this.arcPoint(l,c,0,-u/n),$=`M ${g.x},${g.y} A ${s},${s} 0 ${f} 1 ${y.x},${y.y}`;return $+=` A 1,1 0 0 1 ${A.x},${A.y} `,$+=` A ${l},${l} 0 ${p} 0 ${m.x},${m.y}`,$+=` A 1,1 0 0 1 ${g.x},${g.y} `,$+=" Z",$}generateArrowPath(t,o){let{upperArcStart:n,upperArcEnd:e,innerArcStart:i,innerArcEnd:a,bigRadius:c,smallRadius:s,largeArcFlagUpper:l,largeArcFlagInner:d,radius:u}=t,h=this.arcPoint(u,t.upperAngleEnd,0,24/o/2),f=this.arcPoint(u,t.upperAngleStart,0,24/o/2),p=`M ${n.x},${n.y} A ${c},${c} 0 ${l} 1 ${e.x},${e.y}`;return p+=`L ${h.x} ${h.y}`,p+=`L ${a.x} ${a.y}`,p+=`A ${s},${s} 0 ${d} 0 ${i.x}, ${i.y}`,p+=`L ${f.x} ${f.y}`,p+="Z",p}generateSlashPath(t,o,n){let{upperAngleStart:e,upperAngleEnd:i,innerAngleStart:a,innerAngleEnd:c,bigRadius:s,smallRadius:l,largeArcFlagUpper:d,largeArcFlagInner:u}=t,h=this.arcPoint(s,e,0,o==="backslash"?0:24/n/2),f=this.arcPoint(s,i,0,o==="backslash"?0:24/n/2),p=this.arcPoint(l,a,0,o==="backslash"?24/n/2:0),g=this.arcPoint(l,c,0,o==="backslash"?24/n/2:0),y=`M ${h.x},${h.y} A ${s},${s} 0 ${d} 1 ${f.x},${f.y}`;return y+=`L ${g.x} ${g.y}`,y+=`A ${l},${l} 0 ${u} 0 ${p.x}, ${p.y}`,y+="Z",y}generateZigzagPath(t,o,n){let{upperArcStart:e,upperArcEnd:i,innerArcStart:a,innerArcEnd:c,bigRadius:s,smallRadius:l,largeArcFlagUpper:d,largeArcFlagInner:u,radius:h}=t,f=o/n/2,p=this.arcPoint(h,t.upperAngleStart,-f,3),g=this.arcPoint(h,t.upperAngleStart,0,0),y=this.arcPoint(h,t.upperAngleStart,f,3),m=this.arcPoint(h,t.innerAngleEnd,f,3),A=this.arcPoint(h,t.innerAngleEnd,0,0),$=this.arcPoint(h,t.innerAngleEnd,-f,3),b=`M ${e.x},${e.y} A ${s},${s} 0 ${d} 1 ${i.x},${i.y}`;return b+=`L ${m.x} ${m.y}`,b+=`L ${A.x} ${A.y}`,b+=`L ${$.x} ${$.y}`,b+=`L ${c.x} ${c.y}`,b+=`A ${l},${l} 0 ${u} 0 ${a.x}, ${a.y}`,b+=`L ${p.x} ${p.y}`,b+=`L ${g.x} ${g.y}`,b+=`L ${y.x} ${y.y}`,b+="Z",b}generateDefaultPath(t){let{upperArcStart:o,upperArcEnd:n,innerArcStart:e,innerArcEnd:i,bigRadius:a,smallRadius:c,largeArcFlagUpper:s,largeArcFlagInner:l}=t,d=`M ${o.x},${o.y} A ${a},${a} 0 ${s} 1 ${n.x},${n.y}`;return d+=`L ${i.x} ${i.y}`,d+=`A ${c},${c} 0 ${l} 0 ${e.x}, ${e.y}`,d+="Z",d}};var L=class extends S{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
|
|
8
8
|
<style>
|
|
9
9
|
:host {
|
|
10
10
|
--o-fill: var(--o-gray-light);
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<path class="progress-bg" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke"></path>
|
|
74
74
|
<path class="progress-bar" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke"></path>
|
|
75
75
|
</svg>
|
|
76
|
-
`}update(){let t=this.getAttributes(),o=this.getAttribute("variant")==="stroke",n=o?this.calculateStrokeArc(t,!0):this.calculateArcParameters(t,!0),e=o?this.calculateStrokeArc(t,!1):this.calculateArcParameters(t,!1);this.shadowRoot.querySelector(".progress-bg").setAttribute("d",n),this.shadowRoot.querySelector(".progress-bar").setAttribute("d",e)}calculateStrokeArc(t,o){let{realRadius:n}=t,e=Math.max(0,Math.min(this.getProgressAngle(t,o),
|
|
76
|
+
`}update(){let t=this.getAttributes(),o=this.getAttribute("variant")==="stroke",n=o?this.calculateStrokeArc(t,!0):this.calculateArcParameters(t,!0),e=o?this.calculateStrokeArc(t,!1):this.calculateArcParameters(t,!1);this.shadowRoot.querySelector(".progress-bg").setAttribute("d",n),this.shadowRoot.querySelector(".progress-bar").setAttribute("d",e)}calculateStrokeArc(t,o){let{realRadius:n}=t,e=Math.max(0,Math.min(this.getProgressAngle(t,o),360));if(!(e>0)||!(t.orbitRadius>0))return"";if(e>=359.9){let h=50-n,f=50+n;return`M 50,${h} A ${n},${n} 0 1 1 50,${f} A ${n},${n} 0 1 1 50,${h}`}let i=-90*(Math.PI/180),a=(-90+e)*(Math.PI/180),c=50+n*Math.cos(i),s=50+n*Math.sin(i),l=50+n*Math.cos(a),d=50+n*Math.sin(a),u=e>180?1:0;return`M ${c},${s} A ${n},${n} 0 ${u} 1 ${l},${d}`}getAttributes(){let t=super.getCommonAttributes(this),o=Math.max(0,Math.min(360,this.readAngle(t.style,"--o-range",360))),e=t.style.getPropertyValue("--o-progress").trim()?this.readNumber(t.style,"--o-progress",0):Number(this.getAttribute("value")||0),i=this.getAttribute("max"),a=i===null?100:Number(i);return{...t,range:o,progress:e,maxValue:a}}getProgressAngle(t,o){let{range:n,progress:e,maxValue:i}=t;return o?n:super.getProgressAngle(n,e,i)}calculateArcParameters(t,o){let{shape:n,realRadius:e,arcHeightPercentage:i,orbitNumber:a,strokeWidth:c,arcHeight:s}=t,l=this.getProgressAngle(t,o);if(!(l>0)||!(t.orbitRadius>0))return"";let d=super.calculateCommonArcParameters(l,e,i,a,n,c,s);return super.generatePathData(n,d,s,a)}};var N=typeof document=="undefined"?null:document.createElement("template");N&&(N.innerHTML=`
|
|
77
77
|
<style>
|
|
78
78
|
:host {
|
|
79
79
|
--o-fill: var(--o-gray-light);
|
|
@@ -128,4 +128,4 @@
|
|
|
128
128
|
<textPath href="#orbitPath" alignment-baseline="middle"></textPath>
|
|
129
129
|
</text>
|
|
130
130
|
</svg>
|
|
131
|
-
`);var I=class extends S{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(N.content.cloneNode(!0))}update(){let t=this.getAttributes(),{length:o,fontSize:n,textAnchor:e,fitRange:i}=t;this.hasAttribute("value")?(P(this,"--o-arc-start",`${t.stackOffset}deg`),P(this,"--o_stack",t.stackOffset+t.arcAngle)):(this.style.removeProperty("--o-arc-start"),this.style.removeProperty("--o_stack"));let a=this.shadowRoot.querySelector("#orbitPath"),c=this.shadowRoot.querySelector("#orbitShape"),s=this.shadowRoot.querySelector("textPath");c.setAttribute("d",this.calculateArcParameters(t).dShape),a.setAttribute("d",this.calculateTextArcParameters(t).dPath),e==="start"?(s.setAttribute("startOffset","0%"),s.setAttribute("text-anchor","start")):e==="middle"?(s.setAttribute("startOffset","50%"),s.setAttribute("text-anchor","middle")):e==="end"&&(s.setAttribute("startOffset","100%"),s.setAttribute("text-anchor","end")),i?s.parentElement.setAttribute("textLength",a.getTotalLength()):s.parentElement.removeAttribute("textLength"),s.parentElement.style.fontSize=`calc(${n} * (100 / (${o}) * (12 / var(--o-orbit-number)))`,s.textContent=this.textContent,this.warnIfTextOverflows(a,s,i)}warnIfTextOverflows(t,o,n){let e=(this.textContent||"").trim();!e||n||!this.isConnected||(this._textFrame&&this.ownerDocument.defaultView.cancelAnimationFrame(this._textFrame),this._textFrame=this.ownerDocument.defaultView.requestAnimationFrame(()=>{if(this._textFrame=0,!!this.isConnected)try{let i=t.getTotalLength(),a=o.parentElement.getComputedTextLength();i>0&&a>i&&this._truncWarned!==e&&(this._truncWarned=e,console.warn(`[orbit] <o-arc> text "${e.length>34?e.slice(0,34)+"\u2026":e}" overflows its arc (${Math.round(a)} > ${Math.round(i)} units) and will clip. Shorten the text, widen --o-range, or use fit-range to squeeze it.`))}catch(i){}}))}getAttributes(){let t=super.getCommonAttributes(this),{style:o}=t,n=Math.max(0,Math.min(360,this.readAngle(o,"--o-range",360))),e=this.hasAttribute("flip")||this.classList.contains("flip"),i=this.hasAttribute("fit-range")||this.classList.contains("fit-range"),a=t.orbitRadius*24/t.orbitNumber||100,c=this.getAttribute("text-anchor")||"middle",s=o.fontSize||"16px",l=Math.max(0,this.readNumber(o,"--o-gap",1)),
|
|
131
|
+
`);var I=class extends S{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(N.content.cloneNode(!0))}update(){let t=this.getAttributes(),{length:o,fontSize:n,textAnchor:e,fitRange:i}=t;this.hasAttribute("value")?(P(this,"--o-arc-start",`${t.stackOffset}deg`),P(this,"--o_stack",t.stackOffset+t.arcAngle)):(this.style.removeProperty("--o-arc-start"),this.style.removeProperty("--o_stack"));let a=this.shadowRoot.querySelector("#orbitPath"),c=this.shadowRoot.querySelector("#orbitShape"),s=this.shadowRoot.querySelector("textPath");c.setAttribute("d",this.calculateArcParameters(t).dShape),a.setAttribute("d",this.calculateTextArcParameters(t).dPath),e==="start"?(s.setAttribute("startOffset","0%"),s.setAttribute("text-anchor","start")):e==="middle"?(s.setAttribute("startOffset","50%"),s.setAttribute("text-anchor","middle")):e==="end"&&(s.setAttribute("startOffset","100%"),s.setAttribute("text-anchor","end")),i?s.parentElement.setAttribute("textLength",a.getTotalLength()):s.parentElement.removeAttribute("textLength"),s.parentElement.style.fontSize=`calc(${n} * (100 / (${o}) * (12 / var(--o-orbit-number)))`,s.textContent=this.textContent,this.warnIfTextOverflows(a,s,i)}warnIfTextOverflows(t,o,n){let e=(this.textContent||"").trim();!e||n||!this.isConnected||(this._textFrame&&this.ownerDocument.defaultView.cancelAnimationFrame(this._textFrame),this._textFrame=this.ownerDocument.defaultView.requestAnimationFrame(()=>{if(this._textFrame=0,!!this.isConnected)try{let i=t.getTotalLength(),a=o.parentElement.getComputedTextLength();i>0&&a>i&&this._truncWarned!==e&&(this._truncWarned=e,console.warn(`[orbit] <o-arc> text "${e.length>34?e.slice(0,34)+"\u2026":e}" overflows its arc (${Math.round(a)} > ${Math.round(i)} units) and will clip. Shorten the text, widen --o-range, or use fit-range to squeeze it.`))}catch(i){}}))}getAttributes(){let t=super.getCommonAttributes(this),{style:o}=t,n=Math.max(0,Math.min(360,this.readAngle(o,"--o-range",360))),e=this.hasAttribute("flip")||this.classList.contains("flip"),i=this.hasAttribute("fit-range")||this.classList.contains("fit-range"),a=t.orbitRadius*24/t.orbitNumber||100,c=this.getAttribute("text-anchor")||"middle",s=o.fontSize||"16px",l=Math.max(0,this.readNumber(o,"--o-gap",1)),d=Number(this.getAttribute("value")),u=this.getAttribute("max"),h=u===null?100:Number(u),f=this.hasAttribute("value")?super.getProgressAngle(n,d,h):Math.max(0,Math.min(360,this.readAngle(o,"--o-angle",0))),p=0;if(this.hasAttribute("value"))for(let g=this.previousElementSibling;g;g=g.previousElementSibling){if(g.localName!=="o-arc")continue;let y=this.ownerDocument.defaultView.getComputedStyle(g);if(g.hasAttribute("value")){let m=g.hasAttribute("max")?Number(g.getAttribute("max")):100,A=w(g,y.getPropertyValue("--o-range"),n,"angle");p+=super.getProgressAngle(A,Number(g.getAttribute("value")),m)}else p+=w(g,y.getPropertyValue("--o-angle"),0,"angle")}return{...t,gap:l,arcAngle:f,stackOffset:p,flip:e,fitRange:i,length:a,fontSize:s,textAnchor:c}}calculateArcParameters(t){let{arcAngle:o,realRadius:n,arcHeightPercentage:e,orbitNumber:i,shape:a,strokeWidth:c,arcHeight:s,gap:l}=t;if(!(o>0)||!(t.orbitRadius>0))return{dShape:""};let d=super.calculateCommonArcParameters(o,n,e,i,a,c,s,l);return{dShape:super.generatePathData(a,d,s,i)}}calculateTextArcParameters(t){let{arcAngle:o,realRadius:n,gap:e,flip:i}=t;if(!(o>0))return{dPath:""};let a=Math.min(e*.5,o*.49),c=i?0:1,s=o<=180?0:1,l=50+n*Math.cos((-90+a)*(Math.PI/180)),d=50+n*Math.sin((-90+a)*(Math.PI/180)),u=50+n*Math.cos((o-90-a)*Math.PI/180),h=50+n*Math.sin((o-90-a)*Math.PI/180),[f,p,g,y]=i?[u,h,l,d]:[l,d,u,h];return{dPath:`M ${f},${p} A ${n},${n} 0 ${s} ${c} ${g},${y}`}}calcularExpresionCSS(t){return w(this,t,0,"angle")}};var C=new WeakMap,j={refresh:D,resize(r){var a,c;let t=typeof r=="string"?(a=globalThis.document)==null?void 0:a.querySelector(r):r;if(!(t!=null&&t.ownerDocument))return console.error("Orbit.resize: element not found:",r),()=>{};(c=C.get(t))==null||c();let o=t.ownerDocument.defaultView,n=s=>{if(s>0){for(let l of t.querySelectorAll(".gravity-spot")){let d=String(s/500);l.style.getPropertyValue("--o-force-ratio")!==d&&l.style.setProperty("--o-force-ratio",d)}D(t)}},e=new o.ResizeObserver(s=>{for(let l of s)n(l.contentRect.width)});e.observe(t),n(t.clientWidth||t.getBoundingClientRect().width);let i=()=>{e.disconnect(),C.get(t)===i&&C.delete(t)};return C.set(t,i),i}};function st(){typeof customElements=="undefined"||typeof document=="undefined"||(customElements.get("o-progress")||customElements.define("o-progress",L),customElements.get("o-arc")||customElements.define("o-arc",I),R(document),window.Orbit=j)}st();})();
|
package/dist/orbit.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* orbit
|
|
3
|
-
* v.1.
|
|
3
|
+
* v.1.6.0
|
|
4
4
|
* Author Juan Martin Muda - Zumerlab
|
|
5
5
|
* License MIT
|
|
6
6
|
*/
|
|
@@ -655,8 +655,13 @@ var OrbitProgress = class extends OrbitBase {
|
|
|
655
655
|
*/
|
|
656
656
|
calculateStrokeArc(attrs, full) {
|
|
657
657
|
const { realRadius } = attrs;
|
|
658
|
-
const arcAngle = Math.max(0, Math.min(this.getProgressAngle(attrs, full),
|
|
658
|
+
const arcAngle = Math.max(0, Math.min(this.getProgressAngle(attrs, full), 360));
|
|
659
659
|
if (!(arcAngle > 0) || !(attrs.orbitRadius > 0)) return "";
|
|
660
|
+
if (arcAngle >= 359.9) {
|
|
661
|
+
const top = 50 - realRadius;
|
|
662
|
+
const bottom = 50 + realRadius;
|
|
663
|
+
return `M 50,${top} A ${realRadius},${realRadius} 0 1 1 50,${bottom} A ${realRadius},${realRadius} 0 1 1 50,${top}`;
|
|
664
|
+
}
|
|
660
665
|
const a0 = -90 * (Math.PI / 180);
|
|
661
666
|
const a1 = (-90 + arcAngle) * (Math.PI / 180);
|
|
662
667
|
const x0 = 50 + realRadius * Math.cos(a0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zumer/orbit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Orbit builds radial interfaces with CSS geometry and a small JavaScript layout runtime",
|
|
5
5
|
"main": "./dist/orbit.js",
|
|
6
6
|
"module": "./dist/orbit.mjs",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"test": "npm run compile && npm run test:package && npm run test:browser && npm run test:shadow",
|
|
25
25
|
"test:package": "node test/package.mjs",
|
|
26
26
|
"test:browser": "node test/browser.mjs",
|
|
27
|
-
"test:shadow": "node test/shadow.mjs"
|
|
27
|
+
"test:shadow": "node test/shadow.mjs",
|
|
28
|
+
"release:push": "git add CHANGELOG.md && git commit -m \"Bumped version\" && git push --follow-tags"
|
|
28
29
|
},
|
|
29
30
|
"repository": {
|
|
30
31
|
"type": "git",
|