@tiennm99/aboutme 1.4.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/dist/aboutme.js +26 -5
- package/package.json +1 -1
- package/profile.schema.json +5 -0
package/dist/aboutme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var Ct="aboutme:hiddenUntil";var Zt=["home","blog","github","facebook","linkedin","x","youtube","email","telegram","cv","link"],Qt=["list","grid","icons","orbit"],Ht="aboutme:pos";var te={m:6e4,h:36e5,d:864e5,w:6048e5},Ot=/^(\d{1,4})\s*([mhdw])$/i,ee=/^[a-z0-9-]{1,32}$/;function ft(t){let e=Ot.exec(String(t??"").trim());return!e||Number(e[1])===0?ft("7d"):Number(e[1])*te[e[2].toLowerCase()]}var mt={en:{about:"About {name}",drag:"Drag to the bottom to hide",close:"Close",hide:"Hide for {period}",units:{m:"minute",h:"hour",d:"day",w:"week"},plural:"s"},vi:{about:"Gi\u1EDBi thi\u1EC7u v\u1EC1 {name}",drag:"K\xE9o xu\u1ED1ng d\u01B0\u1EDBi \u0111\u1EC3 \u1EA9n",close:"\u0110\xF3ng",hide:"\u1EA8n trong {period}",units:{m:"ph\xFAt",h:"gi\u1EDD",d:"ng\xE0y",w:"tu\u1EA7n"},plural:""}};function _t(t,e){return t==="en"||t==="vi"?t:/^vi(-|$)/i.test(String(e??"").trim())?"vi":"en"}function gt(t,e,o){return t.replace(`{${e}}`,()=>o)}function bt(t,e="en"){let o=Ot.exec(String(t??"").trim());if(!o||Number(o[1])===0)return bt("7d",e);let r=Number(o[1]),{units:i,plural:d}=mt[e];return`${r} ${i[o[2].toLowerCase()]}${r===1?"":d}`}function zt(t){let e=/^(?:(top|bottom)-)?(left|right)$/.exec(String(t??""));return e?{side:e[2],fromBottom:e[1]!=="top"}:{side:"right",fromBottom:!0}}function Dt(t){let e=/^(\d+)(px)?$/.exec(String(t??"").trim());return e?Number(e[1]):32}function Rt(t){try{let e=JSON.parse(t?.getItem(Ht)??"null"),{side:o,fromBottom:r,gap:i,share:d}=e??{},a=(h,y)=>typeof h=="number"&&h>=0&&h<=y;if((o==="left"||o==="right")&&typeof r=="boolean"&&a(i,1e5)&&a(d,1))return{side:o,fromBottom:r,gap:i,share:d}}catch{}return null}function Nt(t,{side:e,fromBottom:o,gap:r,share:i}){try{t?.setItem(Ht,JSON.stringify({side:e,fromBottom:o,gap:r,share:i}))}catch{}}function ne(t,e){try{let o=new URL(t),r=new URL(e);if(!/^https?:$/.test(o.protocol)||o.origin!==r.origin)return!1;let i=o.pathname.replace(/(.)\/$/,"$1");return i==="/"||r.pathname===i||r.pathname.startsWith(`${i}/`)}catch{return!1}}function Pt(t,e){let o=t.filter(r=>!ne(r.url,e));return o.length?o:t}function Ut(t){return Qt.includes(t)?t:"list"}function Ft(t,e){try{let o=Number(t?.getItem(Ct));return Number.isFinite(o)&&o>e}catch{return!1}}function Bt(t,e,o){try{t?.setItem(Ct,String(e+o))}catch{}}function ut(t,e){if(typeof t!="string")return null;try{let o=new URL(t);return e.includes(o.protocol)?o.href:null}catch{return null}}function ht(t,e){return typeof t=="string"?t.trim().slice(0,e):""}var oe=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i;function re(t){if(typeof t!="string"||!oe.test(t.trim()))return null;let e=t.trim().slice(1).toLowerCase();e.length===3&&(e=[...e].map(d=>d+d).join(""));let[o,r,i]=[0,2,4].map(d=>{let a=parseInt(e.slice(d,d+2),16)/255;return a<=.04045?a/12.92:((a+.055)/1.055)**2.4});return{color:`#${e}`,fg:.2126*o+.7152*r+.0722*i>.19?"#111111":"#ffffff"}}function Yt(t,e){if(!t||typeof t!="object"||t.schemaVersion!==1)return null;let o=ht(t.name,60);if(!o)return null;let r=[],i=new Set;for(let a of Array.isArray(t.links)?t.links.slice(0,12):[]){let h=typeof a?.id=="string"&&ee.test(a.id)?a.id:null,y=ht(a?.label,40),x=ut(a?.url,["https:","http:","mailto:"]);!h||!y||!x||i.has(h)||(i.add(h),r.push({id:h,label:y,url:x,icon:Zt.includes(a.icon)?a.icon:"link"}))}if(r.length===0)return null;let d=null;if(typeof t.events=="string")try{d=ut(new URL(t.events,e).href,["https:","http:"])}catch{d=null}return{name:o,tagline:ht(t.tagline,120),avatar:ut(t.avatar,["https:"]),links:r,events:d,accent:re(t.accent)}}var ie=/^(rgba?|oklch|oklab|lab|lch|color)\((.*)\)$/i;function q(t,e){return t==="none"?0:t?.endsWith("%")?parseFloat(t)/100*e:parseFloat(t??"")}function $t(t){let e=ie.exec(String(t??"").trim());if(!e)return null;let o=e[1].toLowerCase(),r=e[2].split(/[\s,/]+/).filter(Boolean),i;if(o==="color"){let a=r.shift()?.toLowerCase();if(a!=="srgb"&&a!=="srgb-linear"&&a!=="display-p3")return null;let h=m=>a!=="srgb-linear"?m:m<=.0031308?12.92*m:1.055*m**(1/2.4)-.055,[y,x,k]=r.slice(0,3).map(m=>h(q(m,1)));i=.299*y+.587*x+.114*k}else if(o.startsWith("rgb")){let[a,h,y]=r.map(x=>q(x,255));i=(.299*a+.587*h+.114*y)/255}else i=q(r[0],1)/(o.startsWith("ok")||r[0]?.endsWith("%")?1:100);let d=r.length>3?q(r[3],1):1;return!Number.isFinite(i)||!(d>=.5)?null:Math.min(Math.max(i,0),1)}function Gt({backgrounds:t,markers:e,text:o,prefersDark:r}){for(let d of t){let a=$t(d);if(a!==null)return a<.5?"dark":"light"}for(let d of e){let a=d?.trim().toLowerCase();if(a==="dark"||a==="light")return a}let i=$t(o);return i!==null&&i>.6?"dark":i!==null&&i<.4?"light":r?"dark":"light"}var u=52,g=16,A=8,xt=280,ae=160,se=2,ce=g*2+u+A+xt,le=6,de=72,F=44,Wt=54,pe=58,ue=u/2+A+F/2+6,he=["data-theme","data-bs-theme","data-mode","data-color-mode","data-color-scheme"],jt={person:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-7 8-7s8 3 8 7"/>',close:'<path d="M6 6l12 12M18 6L6 18"/>',hide:'<path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/><path d="M3 3l18 18"/>',home:'<path d="M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"/>',blog:'<path d="M4 20h4L19 9l-4-4L4 16z"/><path d="M14 6l4 4"/>',linkedin:'<rect x="3" y="7" width="18" height="13" rx="2"/><path d="M9 7V5h6v2"/>',email:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/>',cv:'<path d="M6 3h9l4 4v14H6z"/><path d="M14 3v5h5M9 12h7M9 16h7"/>',link:'<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>'},fe={github:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",facebook:"M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z",x:"M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z",youtube:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z",telegram:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"},me=`
|
|
2
2
|
:host { all: initial; }
|
|
3
3
|
* { box-sizing: border-box; }
|
|
4
4
|
.root {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
|
|
15
15
|
svg.fill { fill: currentColor; stroke: none; padding: 1px; }
|
|
16
16
|
.bubble {
|
|
17
|
-
position: fixed; left: 0; top: 0; width: ${
|
|
17
|
+
position: fixed; left: 0; top: 0; width: ${u}px; height: ${u}px; z-index: 2147483001;
|
|
18
18
|
border: 0; border-radius: 50%; padding: 0; cursor: grab; touch-action: none; user-select: none;
|
|
19
19
|
background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; overflow: hidden;
|
|
20
20
|
box-shadow: 0 4px 14px rgb(0 0 0 / 25%); transition: transform .2s ease;
|
|
@@ -25,7 +25,7 @@ svg.fill { fill: currentColor; stroke: none; padding: 1px; }
|
|
|
25
25
|
a:focus-visible { outline-offset: -3px; }
|
|
26
26
|
.bubble.dragging { cursor: grabbing; transition: none; }
|
|
27
27
|
.panel {
|
|
28
|
-
position: fixed; z-index: 2147483000; width: ${
|
|
28
|
+
position: fixed; z-index: 2147483000; width: ${xt}px; display: flex; flex-direction: column;
|
|
29
29
|
background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
|
|
30
30
|
box-shadow: 0 8px 30px rgb(0 0 0 / 20%); animation: open .12s ease-out;
|
|
31
31
|
overflow-y: auto; overscroll-behavior: contain;
|
|
@@ -53,6 +53,27 @@ a span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-over
|
|
|
53
53
|
.root[data-l="icons"] a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
54
54
|
.hide { flex: none; width: 100%; margin-top: 8px; padding: 6px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
|
|
55
55
|
.hide:hover { color: var(--fg); }
|
|
56
|
+
/* Orbit layout: no panel box, only round items placed around the bubble's centre. */
|
|
57
|
+
.root[data-l="orbit"] .panel:not([hidden]) { width: 0; height: 0; padding: 0; border: 0; background: none; box-shadow: none; overflow: visible; animation: none; display: block; }
|
|
58
|
+
.root[data-l="orbit"] .head { display: none; }
|
|
59
|
+
.root[data-l="orbit"] ul { display: block; overflow: visible; }
|
|
60
|
+
.root[data-l="orbit"] a, .root[data-l="orbit"] .hide {
|
|
61
|
+
position: absolute; left: var(--x); top: var(--y); width: ${F}px; height: ${F}px; min-height: 0; margin: -${F/2}px 0 0 -${F/2}px;
|
|
62
|
+
padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%;
|
|
63
|
+
background: var(--bg); color: var(--fg); box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
|
|
64
|
+
animation: fly .18s ease-out backwards; animation-delay: calc(var(--i) * 15ms);
|
|
65
|
+
}
|
|
66
|
+
.root[data-l="orbit"] a:hover, .root[data-l="orbit"] .hide:hover { background: var(--hover); }
|
|
67
|
+
.root[data-l="orbit"] :focus-visible { outline-offset: 2px; z-index: 1; }
|
|
68
|
+
@keyframes fly { from { left: 0; top: 0; opacity: 0; transform: scale(.4); } }
|
|
69
|
+
/* The label shows as a chip on the item's roomier side while the item has focus. */
|
|
70
|
+
.root[data-l="orbit"] a span, .root[data-l="orbit"] .hide span {
|
|
71
|
+
position: absolute; top: 50%; right: calc(100% + 6px); flex: none; width: auto; max-width: calc(50vw - 40px); transform: translateY(-50%);
|
|
72
|
+
padding: 2px 8px; border-radius: 6px; background: var(--fg); color: var(--bg); font-size: 12px; line-height: 1.4; text-align: left;
|
|
73
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; pointer-events: none;
|
|
74
|
+
}
|
|
75
|
+
.root[data-l="orbit"] [data-c] span { right: auto; left: calc(100% + 6px); }
|
|
76
|
+
.root[data-l="orbit"] :focus-visible > span { opacity: 1; }
|
|
56
77
|
.target {
|
|
57
78
|
position: fixed; left: 0; top: 0; width: 64px; height: 64px; z-index: 2147483000;
|
|
58
79
|
border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgb(0 0 0 / 55%);
|
|
@@ -60,6 +81,6 @@ a span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-over
|
|
|
60
81
|
}
|
|
61
82
|
.target[hidden] { display: none; }
|
|
62
83
|
.target.active { transform: scale(1.25); background: var(--danger); }
|
|
63
|
-
@media (prefers-reduced-motion: reduce) { .bubble, .target { transition: none; } .panel { animation: none; } }
|
|
84
|
+
@media (prefers-reduced-motion: reduce) { .bubble, .target { transition: none; } .panel, .root[data-l] a, .root[data-l] .hide { animation: none; } }
|
|
64
85
|
@media print { .root { display: none; } }
|
|
65
|
-
`;function
|
|
86
|
+
`;function P(t){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("aria-hidden","true");let o=fe[t];return o&&e.classList.add("fill"),e.innerHTML=o?`<path d="${o}"/>`:jt[t]??jt.link,e}function f(t,e,o){let r=document.createElement(t);return e&&(r.className=e),o&&(r.textContent=o),r}function O(){let t=document.compatMode==="BackCompat"?document.body:document.documentElement,e={w:t.clientWidth,h:t.clientHeight},o=window.visualViewport;return o&&o.scale<1&&(e.w=Math.max(e.w,o.width),e.h=Math.max(e.h,o.height)),e}function U(t,e,o){return Math.max(Math.min(t,o),e)}function ge(t){let e=[document.documentElement,document.body],o=[];for(let r of e)o.push(...["dark","light"].filter(i=>r.classList.contains(i))),o.push(...he.map(i=>r.getAttribute(i)));return Gt({backgrounds:[e[1],e[0]].map(r=>getComputedStyle(r).backgroundColor),markers:o,text:getComputedStyle(e[1]).color,prefersDark:t.matches})}function Vt({profile:t,placement:e,lang:o,theme:r,layout:i,hide:d,track:a,onDismiss:h,onMove:y}){let x=mt[o],k=gt(x.about,"name",t.name),m=document.createElement("aboutme-widget"),vt=m.attachShadow({mode:"open"}),_=f("div","root"),G=i==="orbit";i!=="list"&&(_.dataset.l=i),t.accent&&(_.style.setProperty("--accent",t.accent.color),_.style.setProperty("--accent-fg",t.accent.fg));let wt=f("style");wt.textContent=me;let p=f("button","bubble");if(p.type="button",p.setAttribute("aria-label",k),p.setAttribute("aria-expanded","false"),p.setAttribute("aria-controls","aboutme-panel"),p.title=x.drag,t.avatar){let n=f("img");n.alt="",n.src=t.avatar,n.addEventListener("error",()=>n.replaceWith(P("person")),{once:!0}),p.append(n)}else p.append(P("person"));let l=f("div","panel");l.id="aboutme-panel",l.setAttribute("role","dialog"),l.setAttribute("aria-label",k),l.hidden=!0;let Z=f("div","head");if(t.avatar){let n=f("img");n.alt="",n.src=t.avatar,Z.append(n)}let Q=f("div","who");Q.append(f("div","name",t.name)),t.tagline&&Q.append(f("div","tagline",t.tagline));let B=f("button","icon-btn");B.type="button",B.setAttribute("aria-label",x.close),B.append(P("close")),Z.append(Q,B);let S=f("ul");for(let n of t.links){let c=f("li"),s=f("a");s.href=n.url,s.target="_blank",s.rel="noopener noreferrer",s.title=n.label,s.append(P(n.icon),f("span","",n.label)),s.addEventListener("click",()=>a("click",n.id)),c.append(s),S.append(c)}let tt=gt(x.hide,"period",bt(d,o)),Y=f("button","hide",G?"":tt);Y.type="button",G&&(Y.title=tt,Y.append(P("hide"),f("span","",tt))),l.append(Z,S,Y);let L=f("div","target");L.hidden=!0,L.append(P("close")),_.append(wt,p,l,L),vt.append(_),document.body.append(m);let et=window.matchMedia("(prefers-color-scheme: dark)"),nt=0,ot=0,W=null,rt=null;function j(){_.dataset.t=r==="auto"?ge(et):r}function it(){cancelAnimationFrame(nt),nt=requestAnimationFrame(j),clearTimeout(ot),ot=setTimeout(j,400)}let T=0,v=0,{side:z,fromBottom:V,gap:K,share:at}=e,st=O();function yt(){p.style.transform=`translate(${T}px, ${v}px)`}function ct(){let{w:n,h:c}=O(),s=Math.min(K,at*(c-u));T=z==="left"?g:n-u-g,v=U(V?c-u-s:s,g,c-u-g),st={w:n,h:c},yt()}function Xt(){let{w:n,h:c}=O();z=T+u/2<n/2?"left":"right",V=v+u/2>c/2;let s=U(v,g,c-u-g);K=V?c-u-s:s,at=c>u?Math.min(K/(c-u),1):1,ct(),y({side:z,fromBottom:V,gap:K,share:at})}function kt(){if(G){qt();return}let{w:n,h:c}=O(),s=v-A-g,R=c-v-u-A-g,X=Math.max(s,R),I=Math.min(xt,n-g*2);l.style.width=`${I}px`,l.style.maxHeight="none",S.style.minHeight="0px";let E=S.firstElementChild?.offsetHeight??0,M=l.offsetHeight-S.offsetHeight,w=X<Math.max(ae,M+Math.min(S.scrollHeight,E*se)),$=w&&n>=ce;l.classList.toggle("over",w&&!$),S.style.minHeight=`${Math.min(S.scrollHeight,E)}px`,l.style.maxHeight=`${Math.max(w?c-g*2:X,0)}px`;let C=l.offsetHeight,H=z==="left"?g:n-g-I,N;w?($&&(H+=z==="left"?u+A:-u-A),N=U(v+u/2-C/2,g,c-g-C)):N=s>=R?v-A-C:v+u+A,l.style.left=`${H}px`,l.style.top=`${N}px`}function qt(){let{w:n,h:c}=O(),s=T+u/2,R=v+u/2,X=z==="left"?1:-1,I=g+F/2,E=[...l.querySelectorAll("a, .hide")];l.style.left=`${s}px`,l.style.top=`${R}px`;for(let M=ue,w=0;w<E.length;M+=pe){let $=Math.asin(U((I-R)/M,-1,1)),C=Math.max($,Math.asin(U((c-I-R)/M,-1,1))),H=Math.min(E.length-w,Math.floor((C-$)*M/Wt)+1),N=H>1?Math.min((C-$)/(H-1),Wt*1.2/M):0,Jt=($+C)/2-N*(H-1)/2;for(let pt=0;pt<H;pt++,w++){let Tt=Jt+pt*N,It=U(s+X*M*Math.cos(Tt),I,n-I);E[w].style.setProperty("--x",`${It-s}px`),E[w].toggleAttribute("data-c",It<n/2),E[w].style.setProperty("--y",`${M*Math.sin(Tt)}px`),E[w].style.setProperty("--i",String(w))}}}function lt(){b?.moved||(ct(),l.hidden||kt())}function dt(){let{w:n,h:c}=O();(n!==st.w||c!==st.h)&<()}function D(n){n!==!l.hidden&&(l.hidden=!n,p.setAttribute("aria-expanded",String(n)),n&&(j(),kt(),a("open")))}function Lt(){a("dismiss"),m.remove(),window.removeEventListener("resize",lt),window.visualViewport?.removeEventListener("resize",dt),document.removeEventListener("pointerdown",Et,!0),document.removeEventListener("keydown",Mt),et.removeEventListener("change",it),W?.disconnect(),rt?.disconnect(),cancelAnimationFrame(nt),clearTimeout(ot),h()}function Et(n){n.composedPath().includes(m)||D(!1)}function Mt(n){n.key==="Escape"&&!l.hidden&&(D(!1),p.focus())}function St(){let n=L.getBoundingClientRect(),c=T+u/2-(n.left+n.width/2),s=v+u/2-(n.top+n.height/2);return Math.hypot(c,s)<de}let b=null;p.addEventListener("pointerdown",n=>{n.button===0&&(b={id:n.pointerId,startX:n.clientX,startY:n.clientY,dx:n.clientX-T,dy:n.clientY-v,moved:!1},p.setPointerCapture(n.pointerId))}),p.addEventListener("pointermove",n=>{if(!(!b||n.pointerId!==b.id)&&!(!b.moved&&Math.hypot(n.clientX-b.startX,n.clientY-b.startY)<le)){if(!b.moved){b.moved=!0,p.classList.add("dragging");let{w:c,h:s}=O();L.style.left=`${c/2-32}px`,L.style.top=`${s-96}px`,L.hidden=!1,D(!1)}T=n.clientX-b.dx,v=n.clientY-b.dy,yt(),L.classList.toggle("active",St())}});function At(n){if(!b||n.pointerId!==b.id)return;let{moved:c}=b;if(b=null,!c){n.type==="pointerup"&&D(l.hidden);return}p.classList.remove("dragging");let s=n.type==="pointerup"&&St();L.hidden=!0,L.classList.remove("active"),s?Lt():Xt()}return p.addEventListener("pointerup",At),p.addEventListener("pointercancel",At),p.addEventListener("click",n=>{n.detail===0&&D(l.hidden)}),B.addEventListener("click",()=>{D(!1),p.focus()}),Y.addEventListener("click",Lt),l.addEventListener("keydown",n=>{let c={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1}[n.key];if(!G||!c||n.altKey||n.ctrlKey||n.metaKey)return;let s=[...l.querySelectorAll("a, .hide")];s[(s.indexOf(vt.activeElement)+c+s.length)%s.length].focus(),n.preventDefault()}),window.addEventListener("resize",lt),window.visualViewport?.addEventListener("resize",dt),window.ResizeObserver&&(rt=new ResizeObserver(dt),rt.observe(document.compatMode==="BackCompat"?document.body:document.documentElement)),document.addEventListener("pointerdown",Et,!0),document.addEventListener("keydown",Mt),j(),r==="auto"&&(et.addEventListener("change",it),W=new MutationObserver(it),W.observe(document.documentElement,{attributes:!0}),W.observe(document.body,{attributes:!0})),p.classList.add("dragging"),ct(),p.getBoundingClientRect(),p.classList.remove("dragging"),m}function J(){try{return window.localStorage}catch{return null}}function be(t,e,o){if(!(!t||navigator.globalPrivacyControl===!0))try{fetch(t,{method:"POST",mode:"cors",credentials:"omit",keepalive:!0,headers:{"content-type":"text/plain"},body:JSON.stringify(o?{event:e,target:o}:{event:e})}).catch(()=>{})}catch{}}async function xe(t){let e=t.dataset.profile,o=t.dataset.hide,{position:r,offset:i}=t.dataset,d=["light","dark"].includes(t.dataset.theme)?t.dataset.theme:"auto",a=Ut(t.dataset.layout);if(!e||Ft(J(),Date.now()))return;let h;try{let k=new URL(e,document.baseURI).href,m=await fetch(k,{credentials:"omit"});if(!m.ok)return;h=Yt(await m.json(),k)}catch{return}if(!h)return;h.links=Pt(h.links,location.href);let y=Rt(J())??{...zt(r),gap:Dt(i),share:1},x=()=>Vt({profile:h,placement:y,lang:_t(t.dataset.lang,document.documentElement.lang),theme:d,layout:a,hide:o??"",track:(k,m)=>be(h.events,k,m),onDismiss:()=>Bt(J(),Date.now(),ft(o)),onMove:k=>Nt(J(),k)});document.body?x():document.addEventListener("DOMContentLoaded",x,{once:!0})}var Kt=document.currentScript;Kt instanceof HTMLScriptElement&&!window.__aboutmeLoaded&&(window.__aboutmeLoaded=!0,xe(Kt));})();
|
package/package.json
CHANGED
package/profile.schema.json
CHANGED
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"name": { "type": "string", "minLength": 1, "maxLength": 60 },
|
|
11
11
|
"tagline": { "type": "string", "maxLength": 120 },
|
|
12
12
|
"avatar": { "type": "string", "format": "uri", "pattern": "^https://" },
|
|
13
|
+
"accent": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"pattern": "^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$",
|
|
16
|
+
"description": "Bubble and focus-ring colour in both themes, as #rgb or #rrggbb. Leave it out for the default blue."
|
|
17
|
+
},
|
|
13
18
|
"events": {
|
|
14
19
|
"type": "string",
|
|
15
20
|
"description": "Count endpoint, absolute or relative to the profile URL. Leave it out to send no counts."
|