@hazem3500/palette 0.9.108 → 0.9.110
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/NODE.md +32 -30
- package/README.md +58 -46
- package/cli/agent.mjs +93 -69
- package/cli/config.mjs +17 -1
- package/cli/design-edit.mjs +9 -7
- package/cli/index.mjs +26 -24
- package/cli/snapshots.mjs +3 -3
- package/cli/workflow.mjs +15 -7
- package/dist/{accent-picker-TTIZ65XF.js → accent-picker-PPVPURA7.js} +1 -1
- package/dist/account-tokens-LBRVZAEJ.js +1 -0
- package/dist/adapters/css-variables.js +1 -1
- package/dist/adapters/tailwind.js +1 -1
- package/dist/chunk-2FX2JEMO.js +1 -0
- package/dist/chunk-4HBBEVFK.js +1 -0
- package/dist/chunk-5HZI7HRR.js +1 -0
- package/dist/chunk-DU7H4TEX.js +1 -0
- package/dist/chunk-FGZXQUAD.js +1 -0
- package/dist/{chunk-AYGLN3MI.js → chunk-HLXSRXTK.js} +1 -1
- package/dist/{chunk-DZRM3YUQ.js → chunk-J47R52WX.js} +1 -1
- package/dist/chunk-KELFDOEC.js +1 -0
- package/dist/{chunk-2J3IID4N.js → chunk-KLPQTFVH.js} +1 -1
- package/dist/chunk-ONUORDYE.js +1 -0
- package/dist/chunk-PF4NYFZK.js +1 -0
- package/dist/chunk-S6NEYT36.js +1 -0
- package/dist/chunk-U55ASP2Y.js +1 -0
- package/dist/chunk-VX6XCU4E.js +1 -0
- package/dist/color-editor-QPJQD36F.js +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/design-comment-BF2KGPWU.js +1 -0
- package/dist/{design-export-BNNHI4JP.js → design-export-Y2GU3KER.js} +1 -1
- package/dist/design-geometry-HJLEXLPO.js +1 -0
- package/dist/design-mode-styles.d.ts +1 -1
- package/dist/design-mode.js +1 -1
- package/dist/design-panel-ZQS4WQCI.js +1 -0
- package/dist/design-panel-styles.d.ts +1 -1
- package/dist/design-popup.d.ts +1 -1
- package/dist/design-system.d.ts +5 -4
- package/dist/{field-controls-4ROTPXMO.js → field-controls-4AIIXPNQ.js} +1 -1
- package/dist/{frame-iframe-WBEP3R6S.js → frame-iframe-PYLYMCOK.js} +1 -1
- package/dist/frame-size-TF6SIUFO.js +1 -0
- package/dist/frame-target.d.ts +5 -2
- package/dist/host-motion.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/inline-text-editor-MK6FHDAM.js +1 -0
- package/dist/live-colors-D426RBEC.js +1 -0
- package/dist/live-colors.d.ts +1 -1
- package/dist/node.mjs +102 -75
- package/dist/onboarding-6OSADOWE.js +1 -0
- package/dist/{pin-groups-YAYFPJYA.js → pin-groups-GF53RTHP.js} +1 -1
- package/dist/{pin-move-PG54WWPU.js → pin-move-G6EWHLDO.js} +1 -1
- package/dist/public-env.d.ts +49 -11
- package/dist/react-props-panel-ZSKQ44GS.js +1 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +1 -1
- package/dist/select-menu-OZVNHZ73.js +1 -0
- package/dist/server.js +80 -57
- package/dist/setup.js +1 -1
- package/dist/shell-mode-PLV6F474.js +1 -0
- package/dist/shell-session.d.ts +5 -3
- package/dist/shell.d.ts +1 -1
- package/dist/shell.js +1 -1
- package/dist/shortcut-help-DIMOT2ZK.js +1 -0
- package/dist/snapshot-3PSQKXUV.js +1 -0
- package/dist/snapshot.d.ts +1 -1
- package/dist/source-info.d.ts +1 -1
- package/dist/storage-keys.d.ts +5 -0
- package/dist/tag-editor-B3I7WD4N.js +1 -0
- package/dist/thread-snapshot-ML2RZVID.js +1 -0
- package/dist/token-custom-CASAQWYW.js +1 -0
- package/dist/token-page-NIB5HAVS.js +1 -0
- package/dist/token-picker-AJ5E5IN5.js +1 -0
- package/dist/{toolbar-runtime-QCZONSWE.js → toolbar-runtime-TZWY2KH3.js} +1 -1
- package/dist/typed-custom.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/server/account-page.ts +6 -6
- package/server/iap.ts +2 -2
- package/server/index.ts +30 -24
- package/server/project-management.ts +5 -5
- package/server/proxy-auth.ts +17 -16
- package/server/public-env.ts +67 -11
- package/server/setup-client.txt +173 -173
- package/server/setup-page.ts +1 -1
- package/server/tokens.ts +9 -6
- package/server/webhooks.ts +9 -5
- package/src/types.ts +1 -1
- package/dist/account-tokens-PINQNSNE.js +0 -1
- package/dist/chunk-4KEVPMJJ.js +0 -1
- package/dist/chunk-4XQD75A2.js +0 -1
- package/dist/chunk-57MG3M5P.js +0 -1
- package/dist/chunk-5OVDW2RU.js +0 -1
- package/dist/chunk-6HM4JQLV.js +0 -1
- package/dist/chunk-DLC3CRFV.js +0 -1
- package/dist/chunk-DVYSFT6O.js +0 -1
- package/dist/chunk-FD4GACV2.js +0 -1
- package/dist/chunk-IQOPM3JF.js +0 -1
- package/dist/chunk-UEZCLURX.js +0 -1
- package/dist/color-editor-ATWWSENS.js +0 -1
- package/dist/design-comment-RXUCDTYA.js +0 -1
- package/dist/design-geometry-DPMHGQEK.js +0 -1
- package/dist/design-panel-HTN6LR3V.js +0 -1
- package/dist/frame-size-MRCN6XYD.js +0 -1
- package/dist/inline-text-editor-AMFRKW5Z.js +0 -1
- package/dist/live-colors-GWOVVQSO.js +0 -1
- package/dist/onboarding-BVTCFEHL.js +0 -1
- package/dist/react-props-panel-4XO3NSX3.js +0 -1
- package/dist/select-menu-QAYV7NKJ.js +0 -1
- package/dist/shell-mode-SUYLWDWW.js +0 -1
- package/dist/shortcut-help-XRDNX7MZ.js +0 -1
- package/dist/snapshot-V264ZMQG.js +0 -1
- package/dist/tag-editor-MMAMOEI4.js +0 -1
- package/dist/thread-snapshot-HLTNHS4N.js +0 -1
- package/dist/token-custom-UCA6CBOV.js +0 -1
- package/dist/token-page-PGPWPUKU.js +0 -1
- package/dist/token-picker-WMWUKLKJ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e,E as t}from"./chunk-IQOPM3JF.js";import{useEffect as r,useLayoutEffect as n,useRef as o,useState as a}from"react";import{createRoot as c}from"react-dom/client";import l,{useRef as i,useMemo as u,useEffect as s,useState as f,useCallback as d,useLayoutEffect as h}from"react";function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function v(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(o[r]=e[r]);return o}function m(e){var t=i(e),r=i(function(e){t.current&&t.current(e)});return t.current=e,r.current}var g=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e<t?t:e},b=function(e){return"touches"in e},_=function(e){return e&&e.ownerDocument.defaultView||self},w=function(e,t,r){var n=e.getBoundingClientRect(),o=b(t)?function(e,t){for(var r=0;r<e.length;r++)if(e[r].identifier===t)return e[r];return e[0]}(t.touches,r):t;return{left:g((o.pageX-(n.left+_(e).pageXOffset))/n.width),top:g((o.pageY-(n.top+_(e).pageYOffset))/n.height)}},x=function(e){!b(e)&&e.preventDefault()},C=l.memo(function(e){var t=e.onMove,r=e.onKey,n=e.onEnd,o=v(e,["onMove","onKey","onEnd"]),a=i(null),c=m(t),f=m(r),d=m(n),h=i(null),g=i(!1),C=u(function(){var e=function(e){x(e),(b(e)?e.touches.length>0:e.buttons>0)&&a.current?c(w(a.current,e,h.current)):(r(!1),d())},t=function(){r(!1),d()};function r(r){var n=g.current,o=_(a.current),c=r?o.addEventListener:o.removeEventListener;c(n?"touchmove":"mousemove",e),c(n?"touchend":"mouseup",t)}return[function(e){var t,n=e.nativeEvent,o=a.current;if(o&&(x(n),t=n,(!g.current||b(t))&&o)){if(b(n)){g.current=!0;var l=n.changedTouches||[];l.length&&(h.current=l[0].identifier)}o.focus(),c(w(o,n,h.current)),r(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),f({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},function(e){var t=e.which||e.keyCode;t>=37&&t<=40&&d()},r]},[f,c,d]),E=C[0],y=C[1],k=C[2],M=C[3];return s(function(){return M},[M]),l.createElement("div",p({},o,{onTouchStart:E,onMouseDown:E,className:"react-colorful__interactive",ref:a,onKeyDown:y,onKeyUp:k,tabIndex:0,role:"slider"}))}),E=function(e){return e.filter(Boolean).join(" ")},y=function(e){var t=e.color,r=e.left,n=e.top,o=void 0===n?.5:n,a=E(["react-colorful__pointer",e.className]);return l.createElement("div",{className:a,style:{top:100*o+"%",left:100*r+"%"}},l.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},k=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r},M=(Math.PI,function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?k(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?k(parseInt(e.substring(6,8),16)/255,2):1}}),N=function(e){var t=function(e){var t=e.s,r=e.v,n=e.a,o=(200-t)*r/100;return{h:k(e.h),s:k(o>0&&o<200?t*r/100/(o<=100?o:200-o)*100:0),l:k(o/2),a:k(n,2)}}(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},L=function(e){var t=e.h,r=e.s,n=e.v,o=e.a;t=t/360*6,r/=100,n/=100;var a=Math.floor(t),c=n*(1-r),l=n*(1-(t-a)*r),i=n*(1-(1-t+a)*r),u=a%6;return{r:k(255*[n,l,c,c,i,n][u]),g:k(255*[i,n,n,l,c,c][u]),b:k(255*[c,c,i,n,n,l][u]),a:k(o,2)}},P=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},D=function(e){var t=e.r,r=e.g,n=e.b,o=e.a,a=o<1?P(k(255*o)):"";return"#"+P(t)+P(r)+P(n)+a},H=function(e){var t=e.r,r=e.g,n=e.b,o=e.a,a=Math.max(t,r,n),c=a-Math.min(t,r,n),l=c?a===t?(r-n)/c:a===r?2+(n-t)/c:4+(t-r)/c:0;return{h:60*(l<0?l+6:l),s:a?c/a*100:0,v:a/255*100,a:o}},I=l.memo(function(e){var t=e.hue,r=e.onChange,n=e.onChangeEnd,o=E(["react-colorful__hue",e.className]);return l.createElement("div",{className:o},l.createElement(C,{onMove:function(e){r({h:360*e.left})},onKey:function(e){r({h:g(t+360*e.left,0,360)})},onEnd:n,"aria-label":"Hue","aria-valuenow":k(t),"aria-valuemax":"360","aria-valuemin":"0"},l.createElement(y,{className:"react-colorful__hue-pointer",left:t/360,color:N({h:t,s:100,v:100,a:1})})))}),j=l.memo(function(e){var t=e.hsva,r=e.onChange,n=e.onChangeEnd,o={backgroundColor:N({h:t.h,s:100,v:100,a:1})};return l.createElement("div",{className:"react-colorful__saturation",style:o},l.createElement(C,{onMove:function(e){r({s:100*e.left,v:100-100*e.top})},onKey:function(e){r({s:g(t.s+100*e.left,0,100),v:g(t.v-100*e.top,0,100)})},onEnd:n,"aria-label":"Color","aria-valuetext":"Saturation "+k(t.s)+"%, Brightness "+k(t.v)+"%"},l.createElement(y,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:N(t)})))}),z=function(e,t){if(e===t)return!0;for(var r in e)if(e[r]!==t[r])return!1;return!0};var B=typeof window<"u"?h:s,O=new WeakMap,K=function(e){B(function(){var t=e.current;if(typeof document<"u"&&t){var r=t.getRootNode?t.getRootNode():t.ownerDocument,n=r&&("head"in r||"host"in r)?r:t.ownerDocument;if(!O.has(n)){var o="head"in n?n.head:n,a=(o.ownerDocument||document).createElement("style");a.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}';var c=typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0;c&&a.setAttribute("nonce",c),O.set(n,a),o.appendChild(a)}}},[])},R=function(e){var t=e.className,r=e.colorModel,n=e.color,o=void 0===n?r.defaultColor:n,a=e.onChange,c=e.onChangeEnd,u=v(e,["className","colorModel","color","onChange","onChangeEnd"]),h=i(null);K(h);var g=function(e,t,r,n){var o=m(r),a=m(n),c=f(function(){return e.toHsva(t)}),l=c[0],u=c[1],h=i({color:t,hsva:l}),p=i(!1);s(function(){if(!e.equal(t,h.current.color)){var r=e.toHsva(t);h.current={hsva:r,color:t},u(r),p.current=!1}},[t,e]),s(function(){var t;z(l,h.current.hsva)||e.equal(t=e.fromHsva(l),h.current.color)||(h.current={hsva:l,color:t},o(t),p.current=!0)},[l,e,o]);var v=d(function(e){u(function(t){return Object.assign({},t,e)})},[]),g=d(function(){p.current&&(p.current=!1,a(h.current.color))},[a]);return[l,v,g]}(r,o,a,c),b=g[0],_=g[1],w=g[2],x=E(["react-colorful",t]);return l.createElement("div",p({},u,{ref:h,className:x}),l.createElement(j,{hsva:b,onChange:_,onChangeEnd:w}),l.createElement(I,{hue:b.h,onChange:_,onChangeEnd:w,className:"react-colorful__last-control"}))},S={defaultColor:"000",toHsva:function(e){return H(M(e))},fromHsva:function(e){return function(e){return D(L(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||z(M(e),M(t))}},A=function(e){return l.createElement(R,p({},e,{colorModel:S}))},T=/^#?([0-9A-F]{3,8})$/i,W=function(e){var t=e.color,r=void 0===t?"":t,n=e.onChange,o=e.onBlur,a=e.escape,c=e.validate,i=e.format,u=e.process,h=v(e,["color","onChange","onBlur","escape","validate","format","process"]),g=f(function(){return a(r)}),b=g[0],_=g[1],w=m(n),x=m(o),C=d(function(e){var t=a(e.target.value);_(t),c(t)&&w(u?u(t):t)},[a,u,c,w]),E=d(function(e){c(e.target.value)||_(a(r)),x(e)},[r,a,c,x]);return s(function(){_(a(r))},[r,a]),l.createElement("input",p({},h,{value:i?i(b):b,spellCheck:"false",onChange:C,onBlur:E}))},q=function(e){return"#"+e},$=function(e){var t=e.prefixed,r=e.alpha,n=v(e,["prefixed","alpha"]),o=d(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,r?8:6)},[r]),a=d(function(e){return t=e,n=r,o=T.exec(t),3===(a=o?o[1].length:0)||6===a||!!n&&4===a||!!n&&8===a;var t,n,o,a},[r]);return l.createElement(W,p({},n,{escape:o,format:t?q:void 0,process:q,validate:a}))};import*as F from"react";var Y=({size:e=24,color:t="currentColor",...r})=>F.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},F.createElement("path",{d:"M12 5v14m-7-7h14"}));Y.displayName="Plus";import{jsx as X,jsxs as J}from"react/jsx-runtime";var Q=[["Lavender","#c8b5f4"],["Blue","#85b5ff"],["Mint","#84d9bb"],["Yellow","#f4d779"],["Peach","#f5af87"],["Pink","#efa5c6"]];function U({initial:t,onChange:c}){let[l,i]=a(t),[u,s]=a(!1),f=o(null),d=o(null),h=!Q.some(([,e])=>e===l),p=e=>{if(!/^#[0-9a-f]{6}$/i.test(e))return;let t=e.toLowerCase();i(t),c(t)};return n(()=>{let e=f.current;if(!e)return;if(!u){let t=window.setTimeout(()=>e.hidePopover(),150);return()=>clearTimeout(t)}e.showPopover();let t=()=>{let t=d.current.getBoundingClientRect();e.style.left=`${Math.max(8,Math.min(t.right-e.offsetWidth,innerWidth-e.offsetWidth-8))}px`,e.style.top=`${Math.max(8,t.top-e.offsetHeight-8)}px`};return t(),e.querySelector('[role="slider"]')?.focus({preventScroll:!0}),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[u]),r(()=>{if(!u)return;let t=new AbortController;return e(d.current,"pointerdown",e=>{!e.composedPath().includes(f.current)&&!e.composedPath().includes(d.current)&&s(!1)},{signal:t.signal}),()=>t.abort()},[u]),J("div",{className:"account-accent",children:[X("span",{className:"account-accent-label",children:"Accent color"}),J("div",{className:"accent-swatches",role:"group","aria-label":"Accent color",children:[Q.map(([e,t])=>X("button",{type:"button",className:"accent-swatch","aria-label":e,title:e,"aria-pressed":l===t,style:{"--swatch":t},onClick:()=>{p(t),s(!1)}},e)),X("button",{ref:d,type:"button",className:"accent-swatch accent-custom","aria-label":"Custom accent color","aria-haspopup":"dialog","aria-expanded":u,"aria-pressed":h,onClick:()=>s(!u),children:X(Y,{"aria-hidden":"true"})})]}),J("div",{ref:f,popover:"manual",role:"dialog","aria-label":"Custom accent color",className:u?"accent-popover t-dropdown is-open":"accent-popover t-dropdown is-closing",onKeyDown:e=>{e.stopPropagation(),"Escape"===e.key&&(e.preventDefault(),s(!1),d.current?.focus())},children:[J("div",{className:"accent-popover-head",children:[X("span",{children:"Color"}),X("span",{children:l})]}),J("div",{className:"accent-picker-body",children:[X(A,{color:l,onChange:p}),X($,{"aria-label":"Hex accent color",className:"accent-hex",color:l,onChange:p,prefixed:!0})]})]})]})}function V(e,r){let n=t("div","account-accent-mount"),o=c(n);return o.render(X(U,{initial:e,onChange:r})),{element:n,destroy:()=>o.unmount()}}export{V as accentPicker};
|
|
1
|
+
import{D as e,E as t}from"./chunk-4HBBEVFK.js";import{useEffect as r,useLayoutEffect as n,useRef as o,useState as a}from"react";import{createRoot as c}from"react-dom/client";import l,{useRef as i,useMemo as u,useEffect as s,useState as f,useCallback as d,useLayoutEffect as h}from"react";function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function v(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(o[r]=e[r]);return o}function m(e){var t=i(e),r=i(function(e){t.current&&t.current(e)});return t.current=e,r.current}var g=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e<t?t:e},b=function(e){return"touches"in e},_=function(e){return e&&e.ownerDocument.defaultView||self},w=function(e,t,r){var n=e.getBoundingClientRect(),o=b(t)?function(e,t){for(var r=0;r<e.length;r++)if(e[r].identifier===t)return e[r];return e[0]}(t.touches,r):t;return{left:g((o.pageX-(n.left+_(e).pageXOffset))/n.width),top:g((o.pageY-(n.top+_(e).pageYOffset))/n.height)}},x=function(e){!b(e)&&e.preventDefault()},C=l.memo(function(e){var t=e.onMove,r=e.onKey,n=e.onEnd,o=v(e,["onMove","onKey","onEnd"]),a=i(null),c=m(t),f=m(r),d=m(n),h=i(null),g=i(!1),C=u(function(){var e=function(e){x(e),(b(e)?e.touches.length>0:e.buttons>0)&&a.current?c(w(a.current,e,h.current)):(r(!1),d())},t=function(){r(!1),d()};function r(r){var n=g.current,o=_(a.current),c=r?o.addEventListener:o.removeEventListener;c(n?"touchmove":"mousemove",e),c(n?"touchend":"mouseup",t)}return[function(e){var t,n=e.nativeEvent,o=a.current;if(o&&(x(n),t=n,(!g.current||b(t))&&o)){if(b(n)){g.current=!0;var l=n.changedTouches||[];l.length&&(h.current=l[0].identifier)}o.focus(),c(w(o,n,h.current)),r(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),f({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},function(e){var t=e.which||e.keyCode;t>=37&&t<=40&&d()},r]},[f,c,d]),E=C[0],y=C[1],k=C[2],N=C[3];return s(function(){return N},[N]),l.createElement("div",p({},o,{onTouchStart:E,onMouseDown:E,className:"react-colorful__interactive",ref:a,onKeyDown:y,onKeyUp:k,tabIndex:0,role:"slider"}))}),E=function(e){return e.filter(Boolean).join(" ")},y=function(e){var t=e.color,r=e.left,n=e.top,o=void 0===n?.5:n,a=E(["react-colorful__pointer",e.className]);return l.createElement("div",{className:a,style:{top:100*o+"%",left:100*r+"%"}},l.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},k=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r},N=(Math.PI,function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?k(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?k(parseInt(e.substring(6,8),16)/255,2):1}}),M=function(e){var t=function(e){var t=e.s,r=e.v,n=e.a,o=(200-t)*r/100;return{h:k(e.h),s:k(o>0&&o<200?t*r/100/(o<=100?o:200-o)*100:0),l:k(o/2),a:k(n,2)}}(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},L=function(e){var t=e.h,r=e.s,n=e.v,o=e.a;t=t/360*6,r/=100,n/=100;var a=Math.floor(t),c=n*(1-r),l=n*(1-(t-a)*r),i=n*(1-(1-t+a)*r),u=a%6;return{r:k(255*[n,l,c,c,i,n][u]),g:k(255*[i,n,n,l,c,c][u]),b:k(255*[c,c,i,n,n,l][u]),a:k(o,2)}},H=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},B=function(e){var t=e.r,r=e.g,n=e.b,o=e.a,a=o<1?H(k(255*o)):"";return"#"+H(t)+H(r)+H(n)+a},D=function(e){var t=e.r,r=e.g,n=e.b,o=e.a,a=Math.max(t,r,n),c=a-Math.min(t,r,n),l=c?a===t?(r-n)/c:a===r?2+(n-t)/c:4+(t-r)/c:0;return{h:60*(l<0?l+6:l),s:a?c/a*100:0,v:a/255*100,a:o}},P=l.memo(function(e){var t=e.hue,r=e.onChange,n=e.onChangeEnd,o=E(["react-colorful__hue",e.className]);return l.createElement("div",{className:o},l.createElement(C,{onMove:function(e){r({h:360*e.left})},onKey:function(e){r({h:g(t+360*e.left,0,360)})},onEnd:n,"aria-label":"Hue","aria-valuenow":k(t),"aria-valuemax":"360","aria-valuemin":"0"},l.createElement(y,{className:"react-colorful__hue-pointer",left:t/360,color:M({h:t,s:100,v:100,a:1})})))}),j=l.memo(function(e){var t=e.hsva,r=e.onChange,n=e.onChangeEnd,o={backgroundColor:M({h:t.h,s:100,v:100,a:1})};return l.createElement("div",{className:"react-colorful__saturation",style:o},l.createElement(C,{onMove:function(e){r({s:100*e.left,v:100-100*e.top})},onKey:function(e){r({s:g(t.s+100*e.left,0,100),v:g(t.v-100*e.top,0,100)})},onEnd:n,"aria-label":"Color","aria-valuetext":"Saturation "+k(t.s)+"%, Brightness "+k(t.v)+"%"},l.createElement(y,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:M(t)})))}),z=function(e,t){if(e===t)return!0;for(var r in e)if(e[r]!==t[r])return!1;return!0};var I=typeof window<"u"?h:s,K=new WeakMap,O=function(e){I(function(){var t=e.current;if(typeof document<"u"&&t){var r=t.getRootNode?t.getRootNode():t.ownerDocument,n=r&&("head"in r||"host"in r)?r:t.ownerDocument;if(!K.has(n)){var o="head"in n?n.head:n,a=(o.ownerDocument||document).createElement("style");a.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}';var c=typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0;c&&a.setAttribute("nonce",c),K.set(n,a),o.appendChild(a)}}},[])},R=function(e){var t=e.className,r=e.colorModel,n=e.color,o=void 0===n?r.defaultColor:n,a=e.onChange,c=e.onChangeEnd,u=v(e,["className","colorModel","color","onChange","onChangeEnd"]),h=i(null);O(h);var g=function(e,t,r,n){var o=m(r),a=m(n),c=f(function(){return e.toHsva(t)}),l=c[0],u=c[1],h=i({color:t,hsva:l}),p=i(!1);s(function(){if(!e.equal(t,h.current.color)){var r=e.toHsva(t);h.current={hsva:r,color:t},u(r),p.current=!1}},[t,e]),s(function(){var t;z(l,h.current.hsva)||e.equal(t=e.fromHsva(l),h.current.color)||(h.current={hsva:l,color:t},o(t),p.current=!0)},[l,e,o]);var v=d(function(e){u(function(t){return Object.assign({},t,e)})},[]),g=d(function(){p.current&&(p.current=!1,a(h.current.color))},[a]);return[l,v,g]}(r,o,a,c),b=g[0],_=g[1],w=g[2],x=E(["react-colorful",t]);return l.createElement("div",p({},u,{ref:h,className:x}),l.createElement(j,{hsva:b,onChange:_,onChangeEnd:w}),l.createElement(P,{hue:b.h,onChange:_,onChangeEnd:w,className:"react-colorful__last-control"}))},S={defaultColor:"000",toHsva:function(e){return D(N(e))},fromHsva:function(e){return function(e){return B(L(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||z(N(e),N(t))}},A=function(e){return l.createElement(R,p({},e,{colorModel:S}))},T=/^#?([0-9A-F]{3,8})$/i,W=function(e){var t=e.color,r=void 0===t?"":t,n=e.onChange,o=e.onBlur,a=e.escape,c=e.validate,i=e.format,u=e.process,h=v(e,["color","onChange","onBlur","escape","validate","format","process"]),g=f(function(){return a(r)}),b=g[0],_=g[1],w=m(n),x=m(o),C=d(function(e){var t=a(e.target.value);_(t),c(t)&&w(u?u(t):t)},[a,u,c,w]),E=d(function(e){c(e.target.value)||_(a(r)),x(e)},[r,a,c,x]);return s(function(){_(a(r))},[r,a]),l.createElement("input",p({},h,{value:i?i(b):b,spellCheck:"false",onChange:C,onBlur:E}))},q=function(e){return"#"+e},$=function(e){var t=e.prefixed,r=e.alpha,n=v(e,["prefixed","alpha"]),o=d(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,r?8:6)},[r]),a=d(function(e){return t=e,n=r,o=T.exec(t),3===(a=o?o[1].length:0)||6===a||!!n&&4===a||!!n&&8===a;var t,n,o,a},[r]);return l.createElement(W,p({},n,{escape:o,format:t?q:void 0,process:q,validate:a}))};import*as F from"react";var Y=({size:e=24,color:t="currentColor",...r})=>F.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},F.createElement("path",{d:"M12 5v14m-7-7h14"}));Y.displayName="Plus";import{jsx as V,jsxs as X}from"react/jsx-runtime";var U=[["Lavender","#c8b5f4"],["Blue","#85b5ff"],["Mint","#84d9bb"],["Yellow","#f4d779"],["Peach","#f5af87"],["Pink","#efa5c6"]];function G({initial:t,onChange:c}){let[l,i]=a(t),[u,s]=a(!1),f=o(null),d=o(null),h=!U.some(([,e])=>e===l),p=e=>{if(!/^#[0-9a-f]{6}$/i.test(e))return;let t=e.toLowerCase();i(t),c(t)};return n(()=>{let e=f.current;if(!e)return;if(!u){let t=window.setTimeout(()=>e.hidePopover(),150);return()=>clearTimeout(t)}e.showPopover();let t=()=>{let t=d.current.getBoundingClientRect();e.style.left=`${Math.max(8,Math.min(t.right-e.offsetWidth,innerWidth-e.offsetWidth-8))}px`,e.style.top=`${Math.max(8,t.top-e.offsetHeight-8)}px`};return t(),e.querySelector('[role="slider"]')?.focus({preventScroll:!0}),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[u]),r(()=>{if(!u)return;let t=new AbortController;return e(d.current,"pointerdown",e=>{!e.composedPath().includes(f.current)&&!e.composedPath().includes(d.current)&&s(!1)},{signal:t.signal}),()=>t.abort()},[u]),X("div",{className:"account-accent",children:[V("span",{className:"account-accent-label",children:"Accent color"}),X("div",{className:"accent-swatches",role:"group","aria-label":"Accent color",children:[U.map(([e,t])=>V("button",{type:"button",className:"accent-swatch","aria-label":e,title:e,"aria-pressed":l===t,style:{"--swatch":t},onClick:()=>{p(t),s(!1)}},e)),V("button",{ref:d,type:"button",className:"accent-swatch accent-custom","aria-label":"Custom accent color","aria-haspopup":"dialog","aria-expanded":u,"aria-pressed":h,onClick:()=>s(!u),children:V(Y,{"aria-hidden":"true"})})]}),X("div",{ref:f,popover:"manual",role:"dialog","aria-label":"Custom accent color",className:u?"accent-popover t-dropdown is-open":"accent-popover t-dropdown is-closing",onKeyDown:e=>{e.stopPropagation(),"Escape"===e.key&&(e.preventDefault(),s(!1),d.current?.focus())},children:[X("div",{className:"accent-popover-head",children:[V("span",{children:"Color"}),V("span",{children:l})]}),X("div",{className:"accent-picker-body",children:[V(A,{color:l,onChange:p}),V($,{"aria-label":"Hex accent color",className:"accent-hex",color:l,onChange:p,prefixed:!0})]})]})]})}function J(e,r){let n=t("div","account-accent-mount"),o=c(n);return o.render(V(G,{initial:e,onChange:r})),{element:n,destroy:()=>o.unmount()}}export{J as accentPicker};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-DU7H4TEX.js";import"./chunk-5HZI7HRR.js";import{E as t,F as n,G as o,y as a}from"./chunk-4HBBEVFK.js";var i=864e5,r=[["7 days",7],["30 days",30],["90 days",90],["1 year",365],["Never",null]],s={"comments:read":"Read","comments:write":"Write"},p=[["year",365*i],["month",30*i],["week",7*i],["day",i],["hour",36e5],["minute",6e4]];function d(e,t=Date.now()){let n=e-t,o=new Intl.RelativeTimeFormat(void 0,{numeric:"auto",style:"short"});for(let[e,t]of p)if(Math.abs(n)>=t)return o.format(Math.round(n/t),e);return"just now"}var l=e=>new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e),c=0;function u(i,p,u){let k=t("div","account account-tokens");k.setAttribute("role","region");let f=t("style");f.textContent=".account-layer .account.account-tokens{padding-top:16px;gap:16px}\n.api-tokens-head{display:flex;align-items:center;gap:6px;margin-right:36px;min-height:30px}\n.api-tokens-head h2{margin:0;font-size:15px;font-weight:500;letter-spacing:-.01em}\n.api-tokens-head h2:focus{outline:none}\n.account-layer .account .api-tokens-back{border-radius:8px;color:#bbb}\n.api-tokens-back svg{rotate:90deg;width:16px;height:16px}\n.api-tokens-back:hover{background:color-mix(in oklab,var(--mm-ink) 7%,transparent);color:var(--mm-ink)}\n.api-tokens-lede,.api-tokens-note{margin:0;font-size:12px;line-height:1.5;color:#999}\n.api-tokens-note code,.api-token-id{font:11px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;color:#aaa;overflow-wrap:anywhere}\n.api-tokens-list{list-style:none;margin:0;padding:0;display:grid;gap:8px}\n.api-token,.api-tokens-sheet,.api-tokens-empty{display:grid;gap:8px;padding:14px;border-radius:14px;background:#ffffff05;box-shadow:inset 0 0 0 1px #ffffff09;font-size:12px;color:#ddd}\n.api-tokens-empty{gap:4px;color:#999;text-align:center;padding:20px 14px}\n.api-tokens-empty strong{color:#ddd;font-weight:500}\n.api-token-row{display:flex;align-items:center;gap:8px;min-width:0}\n.api-token-row strong{font-weight:500;color:#eee;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}\n.api-token-chips{display:flex;flex-wrap:wrap;gap:4px}\n.api-token-chip{padding:0 6px;border-radius:5px;background:color-mix(in oklab,var(--mm-ink) 9%,transparent);color:color-mix(in oklab,var(--mm-ink) 78%,transparent);font-size:10px;font-weight:500;line-height:18px;white-space:nowrap}\n.api-token-chip[data-tone=warn]{background:#f1b77d1f;color:#f1b77d}\n.api-token-meta{display:flex;flex-wrap:wrap;gap:2px 10px;margin:0;color:#909090;font-size:11px}\n.api-token-meta div{display:flex;gap:4px}\n.api-token-meta dd{margin:0;color:#bbb}\n.api-token-meta time{cursor:default}\n.account-layer .account .api-token-revoke{margin-left:auto;padding:4px 8px;min-height:26px;border-radius:7px;font-size:11px;background:transparent;color:#fda29b}\n.api-token-revoke:hover,.api-tokens-actions .api-tokens-danger:hover{background:#fda29b14}\n.api-token-confirm{display:grid;gap:8px;padding-top:8px;box-shadow:0 -1px #ffffff0b}\n.api-token-confirm p,.api-tokens-sheet p{margin:0;line-height:1.5;color:#bbb}\n.api-tokens-actions{display:flex;justify-content:flex-end;gap:8px}\n.account-layer .account .api-tokens-actions button{width:auto;min-height:32px;padding:6px 12px;border-radius:9px;font-size:12px}\n.account-layer .account .api-tokens-actions .api-tokens-danger{background:#fda29b1a;color:#fda29b}\n.api-tokens-sheet{gap:14px;padding:16px}\n.api-tokens-sheet h3{margin:0;font-size:13px;font-weight:500;color:#eee}\n.api-tokens-sheet fieldset{border:0;margin:0;padding:0;display:grid;gap:8px;min-width:0}\n.api-tokens-sheet legend{padding:0;margin-bottom:8px;font-size:12px;color:#999}\n.account-layer .account .api-tokens-sheet input[type=text]{min-height:38px;padding:8px 10px;font-size:13px;border-radius:10px}\n.api-tokens-choices{display:flex;flex-wrap:wrap;gap:6px}\n.api-tokens-choice{position:relative;display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:9px;background:#ffffff06;box-shadow:inset 0 0 0 1px #ffffff0b;color:#bbb;cursor:pointer;font-size:12px;line-height:16px}\n.api-tokens-choice:hover{color:#eee}\n.account-layer .account .api-tokens-choice input{position:absolute;inset:0;width:100%;height:100%;min-height:0;margin:0;opacity:0;cursor:pointer}\n.api-tokens-choice:has(input:checked){background:#bda6ef24;box-shadow:inset 0 0 0 1px #bda6ef80;color:#eee}\n.api-tokens-choice:has(input:focus-visible){outline:2px solid #bda6ef;outline-offset:2px}\n.api-tokens-choice small{color:#888;font-size:10px}\n.api-tokens-sheet p.api-tokens-error,.api-tokens-error{margin:0;color:#fda29b;font-size:12px;line-height:1.5}\n.api-tokens-error:empty{display:none}\n.api-tokens-secret{display:flex;gap:8px;align-items:center}\n.api-tokens-secret code{flex:1;min-width:0;padding:8px 10px;border-radius:10px;background:#00000040;box-shadow:inset 0 0 0 1px #ffffff0b;font:11px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;color:#eee;overflow-wrap:anywhere;user-select:all}\n.account-layer .account .api-tokens-secret button{width:auto;min-height:34px;padding:0 12px;font-size:12px}\n.api-tokens-secret svg{width:14px;height:14px}\n.api-tokens-warning{display:flex;gap:7px;align-items:flex-start}\n.api-tokens-warning svg{flex:none;width:13px;height:13px;margin-top:2px;color:#f1b77d}\n.api-tokens-skeleton{height:84px;border-radius:14px;background:linear-gradient(90deg,#ffffff05,#ffffff0d,#ffffff05) 0 0/200% 100%;animation:api-tokens-shimmer 1.4s linear infinite}\n@keyframes api-tokens-shimmer{to{background-position:-200% 0}}\n@media (prefers-reduced-motion:reduce){.api-tokens-skeleton{animation:none}}";let h=t("div","api-tokens-head"),m=o("Back to account",()=>z(),"icon api-tokens-back","chevron"),g=t("h2","","API tokens");g.id="api-tokens-"+ ++c,g.tabIndex=-1,g.dataset.focusKey="api-tokens-title",k.setAttribute("aria-labelledby",g.id),h.append(m,g);let x=t("p","api-tokens-lede","Let bots and CI read or write comments as you. Treat tokens like passwords."),y=t("p","sr-only");y.setAttribute("role","status"),y.setAttribute("aria-live","polite");let b=t("div"),v=t("div"),w=t("div","morphing-menu__tooltip sidebar-tooltip");w.setAttribute("aria-hidden","true"),k.append(f,h,x,b,v,y,w),m.dataset.focusKey="api-tokens-back";let A=null,C=null,T=!1,$=!1,E="",j=null,S=new Map,N=e=>{y.textContent="",setTimeout(()=>y.textContent=e,30)},I=e=>{a()||e.animate([{opacity:0,transform:"translateY(4px)"},{opacity:1,transform:"none"}],{duration:250,easing:"cubic-bezier(.22,1,.36,1)"})},K=e=>requestAnimationFrame(()=>k.querySelector(`[data-focus-key="${e}"]`)?.focus()),R=t=>t instanceof e&&404===t.status?"This Palette server doesn’t support API tokens.":t instanceof Error?t.message:"Something went wrong. Try again.";k.focusStart=()=>K("api-tokens-title"),k.dispose=()=>{q(),w.remove()};let z=()=>{k.dispose(),u()};k.addEventListener("keydown",e=>{if("Escape"===e.key)if(e.stopPropagation(),e.preventDefault(),E){let e=E;E="",B(),K(`api-tokens-revoke-${e}`)}else j?K("api-tokens-done"):T?H():z()});let L=0,q=()=>{clearTimeout(L),delete w.dataset.open};k.addEventListener("pointerover",e=>{let t=e.target.closest?.("[data-tip]");if(!t)return q();clearTimeout(L),L=window.setTimeout(()=>{if(!t.isConnected)return;let e=k.getRootNode();w.parentNode!==e&&e instanceof ShadowRoot&&e.append(w);let n=t.getBoundingClientRect();w.textContent=t.dataset.tip??"";let o=w.offsetWidth/2;w.style.left=`${Math.max(8+o,Math.min(document.documentElement.clientWidth-8-o,n.left+n.width/2))}px`,w.style.top=n.top-8-w.offsetHeight+"px",w.dataset.open="true"},w.dataset.open?0:400)}),k.addEventListener("pointerleave",k.dispose),k.addEventListener("pointerdown",k.dispose);let D=(e,n,o)=>{let a=t("div"),i=t("dd");if(null===n)i.textContent=o;else{let e=t("time","",d(n));e.dateTime=new Date(n).toISOString(),e.dataset.tip=l(n),i.append(e,t("span","sr-only",` (${l(n)})`))}return a.append(t("dt","",e),i),a},M=(e,n,o)=>{let a=t("span","api-token-chip",e);return n&&(a.dataset.tone=n),o&&(a.dataset.tip=o),a},P=e=>e?1===e.length&&e[0]===p?"This project":1===e.length?e[0]:`${e.length} projects`:"All projects";function F(n){let a=t("li","api-token");a.dataset.token=n.id;let r=t("div","api-token-row"),p=t("strong","",n.name);p.id=`api-token-${n.id}-${g.id}`,a.setAttribute("aria-labelledby",p.id),r.append(p),n.expired&&r.append(M("Expired","warn"));let d=o(`Revoke ${n.name}`,()=>{E=n.id,S.delete(n.id),B(),K(`api-tokens-keep-${n.id}`)},"api-token-revoke");d.textContent="Revoke",d.removeAttribute("title"),d.dataset.focusKey=`api-tokens-revoke-${n.id}`,d.disabled=E===n.id,r.append(d);let l=t("div","api-token-chips");for(let e of n.scopes)l.append(M(s[e]??e,"",e));l.append(M(P(n.projects),"",n.projects?.join(", ")??"Every project you can access"));let c=t("dl","api-token-meta");c.append(D("Created",n.createdAt,""),D("Last used",n.lastUsedAt,"Never"),D(n.expired?"Expired":"Expires",n.expiresAt,"Never")),a.append(r,t("code","api-token-id",`${n.prefix}…${n.last4}`),l,c);let u=S.get(n.id);if(u){let e=t("p","api-tokens-error",u);e.setAttribute("role","alert"),a.append(e)}if(E===n.id){let r=t("div","api-token-confirm");r.setAttribute("role","group"),r.setAttribute("aria-label",`Revoke ${n.name}`);let s=t("div","api-tokens-actions"),p=o("Keep token",()=>{E="",B(),K(`api-tokens-revoke-${n.id}`)},"secondary");p.dataset.focusKey=`api-tokens-keep-${n.id}`;let d=o("Revoke token",()=>{!async function(t){if(!A)return;let n=A,o=n.tokens.findIndex(e=>e.id===t.id);if(o<0)return;n.tokens.splice(o,1),E="",B();let a=n.tokens[o]??n.tokens[o-1];K(a?`api-tokens-revoke-${a.id}`:"api-tokens-new");try{await i.request(`account/tokens/${encodeURIComponent(t.id)}`,"DELETE"),N(`Revoked ${t.name}.`)}catch(a){if(a instanceof e&&404===a.status)return void N(`Revoked ${t.name}.`);if(A!==n)return;n.tokens.splice(Math.min(o,n.tokens.length),0,t),S.set(t.id,`Couldn’t revoke: ${R(a)}`),B(),N(`Couldn’t revoke ${t.name}.`),K(`api-tokens-revoke-${t.id}`)}}(n)},"secondary api-tokens-danger");d.dataset.focusKey=`api-tokens-confirm-${n.id}`,s.append(p,d),r.append(t("p","","Anything using this token stops working right away. This can’t be undone."),s),a.append(r),I(r)}return a}function H(){T=!1,B(),K("api-tokens-new")}let Y="";function B(){q();let a=A?j?"secret":T?"form":"list":C?"error":"loading",d=[];if(A&&"list"===a){let e=o("New token",()=>{T=!0,B(),K("api-tokens-name")},"secondary");e.replaceChildren(n("plus"),document.createTextNode("New token")),e.removeAttribute("title"),e.dataset.focusKey="api-tokens-new",d.push(e)}else A&&"form"===a?d.push(function(n){let a=t("form","api-tokens-sheet");a.noValidate=!0,a.setAttribute("aria-labelledby",`${g.id}-new`);let d=t("h3","","New token");d.id=`${g.id}-new`;let l=t("label","account-name-label","Name"),c=t("input");c.type="text",c.maxLength=60,c.required=!0,c.autocomplete="off",c.placeholder="e.g. Deploy bot",c.dataset.focusKey="api-tokens-name",l.append(c);let u=(e,n,o,a)=>{let i=t("fieldset"),r=t("div","api-tokens-choices");for(let[e,i,s,p]of a){let a=t("label","api-tokens-choice",i),d=t("input");d.type=n,d.name=o,d.value=e,d.checked=s,d.dataset.focusKey=`api-tokens-${o}-${e}`,p&&a.append(t("small","",p)),a.prepend(d),r.append(a)}return i.append(t("legend","",e),r),i},k=u("Access","checkbox","scope",n.scopes.map(e=>[e,s[e]?`${s[e]} comments`:e,"comments:read"===e])),f=n.projects.includes(p),h=u("Projects","radio","projects",[...f?[["this","This project",!0]]:[],["all","All your projects",!f]]),m=u("Expires","radio","expiry",r.map(([e,t])=>[String(t),e,30===t])),x=t("p","api-tokens-error");x.setAttribute("role","alert");let y=t("div","api-tokens-actions"),b=o("Cancel",H,"secondary");b.dataset.focusKey="api-tokens-cancel";let v=o("Create token",()=>{},"primary");return v.type="submit",v.dataset.focusKey="api-tokens-create",y.append(b,v),a.append(d,l,k,h,m,x,y),a.addEventListener("submit",async t=>{if(t.preventDefault(),$)return;let o=[...a.querySelectorAll("input[name=scope]:checked")].map(e=>e.value),r=a.querySelector("input[name=expiry]:checked")?.value,s=c.value.trim()?o.length?null:k.querySelector("input"):c;if(x.textContent=c.value.trim()?o.length?"":"Choose read, write, or both.":"Name your token.",s)s.focus();else{$=!0,v.disabled=b.disabled=!0,v.setAttribute("aria-busy","true");try{let e=await i.request("account/tokens","POST",{name:c.value.trim(),scopes:o,expiresInDays:r&&"null"!==r?Number(r):null,projects:"this"===a.querySelector("input[name=projects]:checked")?.value?[p]:[]});if(A!==n)return;n.tokens.unshift(e.item),T=!1,j=e,B(),N("Token created. Copy it now. You won’t see it again."),K("api-tokens-copy")}catch(t){x.textContent=t instanceof e&&429===t.status?"You’ve created several tokens recently. Try again later.":R(t),v.focus()}finally{$=!1,v.disabled=b.disabled=!1,v.removeAttribute("aria-busy")}}}),a}(A)):j&&d.push(function(e){let a=t("section","api-tokens-sheet");a.setAttribute("aria-labelledby",`${g.id}-secret`);let i=t("h3","",`Copy “${e.item.name}”`);i.id=`${g.id}-secret`;let r=t("p","api-tokens-warning");r.append(n("info"),t("span","","You won’t see this token again. Store it in a secret manager, never in source control."));let s=t("div","api-tokens-secret"),p=t("code","",e.token);p.setAttribute("aria-label","New API token"),p.tabIndex=0,p.dataset.focusKey="api-tokens-secret";let d=o("Copy token",async()=>{try{await navigator.clipboard.writeText(e.token),d.replaceChildren(n("check"),document.createTextNode("Copied")),N("Token copied to the clipboard.")}catch{getSelection()?.selectAllChildren(p),N("Couldn’t copy. The token is selected; copy it with your keyboard.")}},"primary");d.replaceChildren(n("copy"),document.createTextNode("Copy")),d.removeAttribute("title"),d.dataset.focusKey="api-tokens-copy",s.append(p,d);let l=t("div","api-tokens-actions"),c=o("Done",()=>{j=null,B(),K("api-tokens-new")},"secondary");return c.dataset.focusKey="api-tokens-done",l.append(c),a.append(i,r,s,l),a}(j));if(a!==Y&&d[0]&&I(d[0]),Y=a,b.replaceChildren(...d),v.setAttribute("aria-busy",String(!A&&!C)),!A){if(C){let n=t("p","api-tokens-error",R(C));n.setAttribute("role","alert");let a=C instanceof e&&[403,404].includes(C.status),i=o("Try again",()=>{U()},"secondary");i.dataset.focusKey="api-tokens-retry",v.replaceChildren(n,...a?[]:[i])}else{let e=t("div","api-tokens-list");e.setAttribute("aria-hidden","true"),e.append(t("div","api-tokens-skeleton"),t("div","api-tokens-skeleton"));let n=t("span","sr-only","Loading API tokens");n.setAttribute("role","status"),v.replaceChildren(e,n)}return}if(!A.tokens.length){let e=t("p","api-tokens-empty");return e.append(t("strong","","No tokens yet"),t("span","","Create one for a bot, a script, or a CI job.")),void v.replaceChildren(e)}let l=t("ul","api-tokens-list");l.setAttribute("aria-label","Your API tokens"),l.append(...A.tokens.map(F));let c=t("p","api-tokens-note");c.append(document.createTextNode("Use a token as "),t("code","","PALETTE_TOKEN"),document.createTextNode(" with the palette CLI.")),v.replaceChildren(l,c)}async function U(){C=null,A=null,B();try{let t=await i.request("account/tokens");if(!Array.isArray(t.tokens)||!Array.isArray(t.projects))throw new e(0,"Couldn’t read your tokens. Try again.");A={tokens:t.tokens,projects:t.projects,scopes:Array.isArray(t.scopes)?t.scopes:["comments:read","comments:write"]}}catch(e){C=e instanceof Error?e:new Error(String(e))}B()}return U(),k}export{u as accountTokens,d as relativeTime};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=e=>{let t=e?.cssVariable??(e?.ref?.startsWith("--")?e.ref:void 0);return t&&/^--[\w-]+$/.test(t)?t:void 0};var t=["padding","margin","gap"],r={color:["color",["color","background-color","border-color"],"Color"],spacing:["dimension",t,"Spacing"],radius:["dimension",["border-radius"],"Radius"],text:["dimension",["font-size"],"Font size"],font:["fontFamily",["font-family"],"Font"],leading:["lineHeight",["line-height"],"Line height"],"font-weight":["fontWeight",["font-weight"],"Font weight"]},o=/^(#[0-9a-f]{3,8}|(rgb|hsl|hwb|lab|lch|oklab|oklch|color)a?\(.*\))$/i,l=/^-?\d*\.?\d+(px|rem|em|%|vw|vh|ch)$/,n=(e,t=("object"==typeof window?window:null))=>{let{conditionText:r}=e;return"string"!=typeof r||("media"in e?"function"!=typeof t?.matchMedia||t.matchMedia(r).matches:!!(typeof CSS<"u"&&"supports"in CSS&&e.constructor.name.includes("Supports"))&&CSS.supports(r))},a=/^(:root|html|:host)$/,i=(e,t,r,o)=>{for(let l of Array.from(e))if("selectorText"in l&&l.style){let{selectorText:e,style:n}=l,i=e.split(",").map(e=>e.trim()),s=i.some(e=>a.test(e));if(!s&&!i.some(e=>o.has(e)))continue;for(let e of Array.from(n))e.startsWith("--")&&(s?t:r).set(e,n.getPropertyValue(e).trim())}else"cssRules"in l&&i(l.cssRules,t,r,o)},s=/^(\d{1,3})(\s*,\s*|\s+)(\d{1,3})\2(\d{1,3})$/,c=e=>t=>{let r=document.createElement("span").style;r.color=t;let o=r.color.match(/[\d.]+/g);return o&&o.length>2?o.slice(0,3).map(e=>Math.round(+e)).join(e):t};function p(e,n){let a=e.slice(2),i=Object.keys(r).sort((e,t)=>t.length-e.length).find(e=>a===e||a.startsWith(`${e}-`));if(i){let[e,t,o]=r[i];if("fontFamily"!==e||!/^\d+$/.test(n))return{type:e,properties:t,group:o,ns:i}}return o.test(n)?{type:"color",properties:r.color[1],group:"Color"}:l.test(n)?{type:"dimension",properties:[...t,"border-radius"],group:"Size"}:null}var u=e=>{let t=e.replace(/::?(not|is|where|has)\(([^)]*)\)/g," $2 ");return 1e6*(t.match(/#[\w-]+/g)??[]).length+1e3*(t.match(/\.[\w-]+|\[[^\]]*\]|:(?!:)[\w-]+/g)??[]).length+(t.replace(/#[\w-]+|\.[\w-]+|\[[^\]]*\]|::?[\w-]+/g," ").match(/(^|[\s>+~])[a-z][\w-]*/gi)??[]).length},f={"background-color":["background-color","background"],"border-color":["border-color","border"],padding:["padding"],margin:["margin"],gap:["gap"],"border-radius":["border-radius"],font:["font"]};function d(t={}){let r=t.include??(e=>!e.startsWith("--tw-")),o=t.limit??300,l=t.scopes??{},a=new Map,d=new Map;function
|
|
1
|
+
var e=e=>{let t=e?.cssVariable??(e?.ref?.startsWith("--")?e.ref:void 0);return t&&/^--[\w-]+$/.test(t)?t:void 0};var t=["padding","margin","gap"],r={color:["color",["color","background-color","border-color"],"Color"],spacing:["dimension",t,"Spacing"],radius:["dimension",["border-radius"],"Radius"],text:["dimension",["font-size"],"Font size"],font:["fontFamily",["font-family"],"Font"],leading:["lineHeight",["line-height"],"Line height"],"font-weight":["fontWeight",["font-weight"],"Font weight"]},o=/^(#[0-9a-f]{3,8}|(rgb|hsl|hwb|lab|lch|oklab|oklch|color)a?\(.*\))$/i,l=/^-?\d*\.?\d+(px|rem|em|%|vw|vh|ch)$/,n=(e,t=("object"==typeof window?window:null))=>{let{conditionText:r}=e;return"string"!=typeof r||("media"in e?"function"!=typeof t?.matchMedia||t.matchMedia(r).matches:!!(typeof CSS<"u"&&"supports"in CSS&&e.constructor.name.includes("Supports"))&&CSS.supports(r))},a=/^(:root|html|:host)$/,i=(e,t,r,o)=>{for(let l of Array.from(e))if("selectorText"in l&&l.style){let{selectorText:e,style:n}=l,i=e.split(",").map(e=>e.trim()),s=i.some(e=>a.test(e));if(!s&&!i.some(e=>o.has(e)))continue;for(let e of Array.from(n))e.startsWith("--")&&(s?t:r).set(e,n.getPropertyValue(e).trim())}else"cssRules"in l&&i(l.cssRules,t,r,o)},s=/^(\d{1,3})(\s*,\s*|\s+)(\d{1,3})\2(\d{1,3})$/,c=e=>t=>{let r=document.createElement("span").style;r.color=t;let o=r.color.match(/[\d.]+/g);return o&&o.length>2?o.slice(0,3).map(e=>Math.round(+e)).join(e):t};function p(e,n){let a=e.slice(2),i=Object.keys(r).sort((e,t)=>t.length-e.length).find(e=>a===e||a.startsWith(`${e}-`));if(i){let[e,t,o]=r[i];if("fontFamily"!==e||!/^\d+$/.test(n))return{type:e,properties:t,group:o,ns:i}}return o.test(n)?{type:"color",properties:r.color[1],group:"Color"}:l.test(n)?{type:"dimension",properties:[...t,"border-radius"],group:"Size"}:null}var u=e=>{let t=e.replace(/::?(not|is|where|has)\(([^)]*)\)/g," $2 ");return 1e6*(t.match(/#[\w-]+/g)??[]).length+1e3*(t.match(/\.[\w-]+|\[[^\]]*\]|:(?!:)[\w-]+/g)??[]).length+(t.replace(/#[\w-]+|\.[\w-]+|\[[^\]]*\]|::?[\w-]+/g," ").match(/(^|[\s>+~])[a-z][\w-]*/gi)??[]).length},f={"background-color":["background-color","background"],"border-color":["border-color","border"],padding:["padding"],margin:["margin"],gap:["gap"],"border-radius":["border-radius"],font:["font"]};function d(t={}){let r=t.include??(e=>!e.startsWith("--tw-")),o=t.limit??300,l=t.scopes??{},a=new Map,d=new Map;function h(e={}){let t=new Map,n=new Map,c=new Set(Object.values(e).flatMap(e=>l[e]?[l[e]]:[]));for(let e of Array.from(document.styleSheets))try{i(e.cssRules,t,n,c)}catch{}let u=getComputedStyle(document.documentElement),f=new Map;for(let[e,l]of t){let t=u.getPropertyValue(e).trim(),a=t&&r(e)?p(e,t):null;if(!a||f.size>=o)continue;let i=e.slice(2),{ns:c,...d}=a,h=c?c.length:i.indexOf("-"),m=h>0&&i.length>h?`${i.slice(0,h)}.${i.slice(h+1)}`:i,g="color"===a.type?s.exec(t):null,y=g&&[g[1],g[3],g[4]].map(Number);y?.every(e=>e<256)&&(t=`#${y.map(e=>e.toString(16).padStart(2,"0")).join("")}`),f.set(e,{name:e,path:m,value:t,...d,declared:n.get(e)??l,...y?{channels:g[2].includes(",")?", ":" "}:{}})}return a=f,f}let m=e=>{let t=/^var\(\s*(--[\w-]+)\s*(?:,[^)]*)?\)$/.exec(e.trim());return t&&a.has(t[1])?t[1]:null};function g(e,t){let r=e.style,o=f[t]??[t];for(let e of o){let t=r?.getPropertyValue(e);if(t&&"important"!==r.getPropertyPriority(e))return m(t)}let l=null,a=0,i=t=>{for(let r of Array.from(t))if("selectorText"in r&&r.style){let{selectorText:t,style:n}=r;for(let r of t.split(",")){let t=!1;try{t=e.matches(r.trim())}catch{}if(t)for(let e of o){let t=n.getPropertyValue(e);if(!t)continue;let o=(n.getPropertyPriority(e)?1e12:0)+1e3*u(r)+a++;(!l||o>=l.rank)&&(l={rank:o,value:t})}}}else"cssRules"in r&&n(r,e.ownerDocument.defaultView)&&i(r.cssRules)};for(let t of Array.from(e.ownerDocument.styleSheets))try{i(t.cssRules)}catch{}return l?m(l.value):null}function y(e){let t=[...h(e).values()].map(e=>{let t=m(e.declared??"");return{path:e.path,type:e.type,value:e.value,properties:[...e.properties],group:e.group,ref:e.name,cssVariable:e.name,...t&&t!==e.name?{alias:a.get(t).path}:{},...e.channels?{toCss:c(e.channels)}:{}}});return d=new Map(t.map(e=>[e.path,e])),t}return{id:"css-variables",list:y,previewValues:(t,r,o)=>(d.size||y(),function(t,r,o={},l,n=document){let a=[];for(let n of t){let t=r(n.path),i=e(t);if(!t||!i)continue;let s=n.alias?e(r(n.alias)):void 0,c=n.value;try{c=s?`var(${s})`:t.toCss?t.toCss(n.value):n.value}catch{}if(!c||/[{};<]/.test(c))continue;let p=n.theme?.split("+")??[],u=p.flatMap(e=>o[e]?[`:is(${o[e]})`]:[]),f=n.theme?Object.entries(o).filter(([e])=>!p.includes(e)).map(([,e])=>`:not(${e})`):[];n.theme&&!u.length&&!f.length&&n.theme!==l||a.push(`${u.join("")||":root"}${f.join("")}{${i}:${c}!important}`)}if(!a.length)return()=>{};let i=n.createElement("style");return i.dataset.paletteTokenPreview="",i.textContent=a.join(""),(n.head??n.documentElement).append(i),()=>i.remove()}(t,e=>d.get(e),l,r,o?.document)),resolve(e){a.size||h();let t={},r=getComputedStyle(e);for(let o of new Set([...a.values()].flatMap(e=>e.properties))){let l=g(e,o);t[o]=l?{path:a.get(l).path}:{offToken:r.getPropertyValue(o).trim()}}return t},preview(e,t,r){let o=e.style,l=o.getPropertyValue(t),n=o.getPropertyPriority(t);return o.setProperty(t,`var(${r.ref??`--${r.path.replace(".","-")}`})`),()=>{l?o.setProperty(t,l,n):o.removeProperty(t)}},describe(e,t,r,o){let l=`var(${o.ref})`,n="path"in r?[...a.values()].find(e=>e.path===r.path)?.name:void 0;return n?n===o.ref?`Keep ${t}: ${l}`:`Replace var(${n}) with ${l} for ${t}`:`Set ${t} to ${l}`}}}export{d as discoverCssTokens};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return(e=>"http://www.w3.org/2000/svg"===e?.namespaceURI)(e)||"http://www.w3.org/1999/xhtml"===e?.namespaceURI}var t=new WeakMap;var r=e=>{let t=e?.cssVariable??(e?.ref?.startsWith("--")?e.ref:void 0);return t&&/^--[\w-]+$/.test(t)?t:void 0};var l,s=["top","right","bottom","left"],n={padding:s.map(e=>`padding-${e}`),margin:s.map(e=>`margin-${e}`),gap:["row-gap","column-gap"],"border-radius":["top-left","top-right","bottom-right","bottom-left"].map(e=>`border-${e}-radius`),"border-width":s.map(e=>`border-${e}-width`),"border-color":s.map(e=>`border-${e}-color`)},a=e=>(Array.isArray(e)?e:[e]).flatMap(e=>e.split(/\s+/)).filter(Boolean),o=e=>e.getAttribute("class"),i=e=>e.includes(":")?null:e.replace(/^!|!$/g,""),p=/\.((?:\\[\da-f]{1,6} ?|\\[^]|[\w-]|[^\0-\x7f])+)/gi,c=[new Set,0,!1,!1],u=()=>[...document.styleSheets,...document.adoptedStyleSheets??[]];function d(e=u()){let t=[...document.querySelectorAll("link[rel~=stylesheet]:not([disabled])")].map(e=>e.sheet);for(let r of e){let e;try{e=r.cssRules.length}catch{}t.push(r,e)}return t}var g=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]),f=e=>/^(style|link)$/i.test(e?.nodeName??""),m=e=>f(e.target)||f(e.target.parentNode)||[...e.addedNodes,...e.removedNodes].some(e=>f(e)||!!e.querySelector?.("style,link"));function y(e){let t=d(),r=()=>{let r=d();g(r,t)||(t=r,e())},l=new MutationObserver(e=>e.some(m)&&r()),s=new AbortController;l.observe(document,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["disabled","media","rel","href"]});for(let e of["load","error"])document.addEventListener(e,r,{capture:!0,signal:s.signal});return()=>{l.disconnect(),s.abort()}}function h(e,t={}){let r,l=0;for(let[s,n]of Object.entries(e.values??{})){let e=s.split("+");e.every(e=>{let[r,l]=e.split("=");return void 0===l?Object.values(t).includes(r):t[r]===l})&&e.length>l&&([r,l]=[n,e.length])}return r??e.value??""}function b(s,f={}){let m=s.tokens.map(e=>({token:e,classes:a(e.class),covers:new Set(e.properties.flatMap(e=>[e,...n[e]??[]]))})),b=new Map;for(let e of m)for(let t of e.classes)b.set(t,e);let v=new Map(m.map(e=>[e.token.path,e])),w=!1===f.offToken?[]:f.offToken??[...new Set(s.tokens.flatMap(e=>e.properties))],k=new WeakMap,P=e=>(e??"").split(/\s+/).flatMap(e=>{let t=i(e),r=t?b.get(t):void 0;return r?[{name:e,entry:r}]:[]});function $(e,t){if(!t.stack.length)return null===t.original?e.removeAttribute("class"):e.setAttribute("class",t.original),void k.delete(e);e.setAttribute("class",t.stack.reduce((e,t)=>function(e,t,r){let l=e.split(/\s+/).filter(Boolean),s=r.classes[0],a=-1,o=l.filter((e,l)=>{let s=i(e),o=s?b.get(s):void 0,p=!!o&&(o===r||[...o.covers].every(e=>r.covers.has(e))&&(o.covers.has(t)||(n[t]??[]).some(e=>o.covers.has(e))));return p&&a<0&&(a=l),!p}),p=l.slice(0,a<0?l.length:a).filter(e=>o.includes(e)).length;return o.splice(p,0,s),o.join(" ")}(e,t.property,t.entry),t.original??""))}return{id:"tailwind",list(e){let t=e??Object.fromEntries((f.themes??[]).map(e=>[e.id,e.current()])),r=f.onlyGenerated?function(e){let t=u(),r=d(t);if(!l||!g(r,l)){l=r,c=[new Set,0,!1,r.includes(null)];let e=t=>{let r;try{r=t()}catch{return void(c[2]=!0)}for(let t of r){if(null!=t.selectorText){c[1]++;for(let e of t.selectorText.matchAll(p))c[0].add(e[1])}t.cssRules&&e(()=>t.cssRules),"styleSheet"in t&&e(()=>t.styleSheet.cssRules)}};for(let r of t)e(()=>r.cssRules)}return c[3]||!c[1]||e&&c[2]?null:c[0]}(!0!==f.onlyGenerated&&!!f.onlyGenerated.strict):null;return m.filter(({token:e,classes:t})=>(!r||r.has(CSS.escape(t[0])))&&(!f.filter||f.filter(e))).map(({token:e,classes:r})=>({path:e.path,type:e.type,value:h(e,t),properties:[...e.properties],ref:r[0],...e.label?{label:e.label}:{},...e.group?{group:e.group}:{},...e.description?{description:e.description}:{},...e.states?{states:[...e.states]}:{},...e.cssVariable?{cssVariable:e.cssVariable}:{},...e.toCss?{toCss:e.toCss}:{}}))},...s.tokens.some(e=>e.cssVariable)?{previewValues:(e,t,l)=>function(e,t,l={},s,n=document){let a=[];for(let n of e){let e=t(n.path),o=r(e);if(!e||!o)continue;let i=n.alias?r(t(n.alias)):void 0,p=n.value;try{p=i?`var(${i})`:e.toCss?e.toCss(n.value):n.value}catch{}if(!p||/[{};<]/.test(p))continue;let c=n.theme?.split("+")??[],u=c.flatMap(e=>l[e]?[`:is(${l[e]})`]:[]),d=n.theme?Object.entries(l).filter(([e])=>!c.includes(e)).map(([,e])=>`:not(${e})`):[];n.theme&&!u.length&&!d.length&&n.theme!==s||a.push(`${u.join("")||":root"}${d.join("")}{${o}:${p}!important}`)}if(!a.length)return()=>{};let o=n.createElement("style");return o.dataset.
|
|
1
|
+
function e(e){return(e=>"http://www.w3.org/2000/svg"===e?.namespaceURI)(e)||"http://www.w3.org/1999/xhtml"===e?.namespaceURI}var t=new WeakMap;var r=e=>{let t=e?.cssVariable??(e?.ref?.startsWith("--")?e.ref:void 0);return t&&/^--[\w-]+$/.test(t)?t:void 0};var l,s=["top","right","bottom","left"],n={padding:s.map(e=>`padding-${e}`),margin:s.map(e=>`margin-${e}`),gap:["row-gap","column-gap"],"border-radius":["top-left","top-right","bottom-right","bottom-left"].map(e=>`border-${e}-radius`),"border-width":s.map(e=>`border-${e}-width`),"border-color":s.map(e=>`border-${e}-color`)},a=e=>(Array.isArray(e)?e:[e]).flatMap(e=>e.split(/\s+/)).filter(Boolean),o=e=>e.getAttribute("class"),i=e=>e.includes(":")?null:e.replace(/^!|!$/g,""),p=/\.((?:\\[\da-f]{1,6} ?|\\[^]|[\w-]|[^\0-\x7f])+)/gi,c=[new Set,0,!1,!1],u=()=>[...document.styleSheets,...document.adoptedStyleSheets??[]];function d(e=u()){let t=[...document.querySelectorAll("link[rel~=stylesheet]:not([disabled])")].map(e=>e.sheet);for(let r of e){let e;try{e=r.cssRules.length}catch{}t.push(r,e)}return t}var g=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]),f=e=>/^(style|link)$/i.test(e?.nodeName??""),m=e=>f(e.target)||f(e.target.parentNode)||[...e.addedNodes,...e.removedNodes].some(e=>f(e)||!!e.querySelector?.("style,link"));function y(e){let t=d(),r=()=>{let r=d();g(r,t)||(t=r,e())},l=new MutationObserver(e=>e.some(m)&&r()),s=new AbortController;l.observe(document,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["disabled","media","rel","href"]});for(let e of["load","error"])document.addEventListener(e,r,{capture:!0,signal:s.signal});return()=>{l.disconnect(),s.abort()}}function h(e,t={}){let r,l=0;for(let[s,n]of Object.entries(e.values??{})){let e=s.split("+");e.every(e=>{let[r,l]=e.split("=");return void 0===l?Object.values(t).includes(r):t[r]===l})&&e.length>l&&([r,l]=[n,e.length])}return r??e.value??""}function b(s,f={}){let m=s.tokens.map(e=>({token:e,classes:a(e.class),covers:new Set(e.properties.flatMap(e=>[e,...n[e]??[]]))})),b=new Map;for(let e of m)for(let t of e.classes)b.set(t,e);let v=new Map(m.map(e=>[e.token.path,e])),w=!1===f.offToken?[]:f.offToken??[...new Set(s.tokens.flatMap(e=>e.properties))],k=new WeakMap,P=e=>(e??"").split(/\s+/).flatMap(e=>{let t=i(e),r=t?b.get(t):void 0;return r?[{name:e,entry:r}]:[]});function $(e,t){if(!t.stack.length)return null===t.original?e.removeAttribute("class"):e.setAttribute("class",t.original),void k.delete(e);e.setAttribute("class",t.stack.reduce((e,t)=>function(e,t,r){let l=e.split(/\s+/).filter(Boolean),s=r.classes[0],a=-1,o=l.filter((e,l)=>{let s=i(e),o=s?b.get(s):void 0,p=!!o&&(o===r||[...o.covers].every(e=>r.covers.has(e))&&(o.covers.has(t)||(n[t]??[]).some(e=>o.covers.has(e))));return p&&a<0&&(a=l),!p}),p=l.slice(0,a<0?l.length:a).filter(e=>o.includes(e)).length;return o.splice(p,0,s),o.join(" ")}(e,t.property,t.entry),t.original??""))}return{id:"tailwind",list(e){let t=e??Object.fromEntries((f.themes??[]).map(e=>[e.id,e.current()])),r=f.onlyGenerated?function(e){let t=u(),r=d(t);if(!l||!g(r,l)){l=r,c=[new Set,0,!1,r.includes(null)];let e=t=>{let r;try{r=t()}catch{return void(c[2]=!0)}for(let t of r){if(null!=t.selectorText){c[1]++;for(let e of t.selectorText.matchAll(p))c[0].add(e[1])}t.cssRules&&e(()=>t.cssRules),"styleSheet"in t&&e(()=>t.styleSheet.cssRules)}};for(let r of t)e(()=>r.cssRules)}return c[3]||!c[1]||e&&c[2]?null:c[0]}(!0!==f.onlyGenerated&&!!f.onlyGenerated.strict):null;return m.filter(({token:e,classes:t})=>(!r||r.has(CSS.escape(t[0])))&&(!f.filter||f.filter(e))).map(({token:e,classes:r})=>({path:e.path,type:e.type,value:h(e,t),properties:[...e.properties],ref:r[0],...e.label?{label:e.label}:{},...e.group?{group:e.group}:{},...e.description?{description:e.description}:{},...e.states?{states:[...e.states]}:{},...e.cssVariable?{cssVariable:e.cssVariable}:{},...e.toCss?{toCss:e.toCss}:{}}))},...s.tokens.some(e=>e.cssVariable)?{previewValues:(e,t,l)=>function(e,t,l={},s,n=document){let a=[];for(let n of e){let e=t(n.path),o=r(e);if(!e||!o)continue;let i=n.alias?r(t(n.alias)):void 0,p=n.value;try{p=i?`var(${i})`:e.toCss?e.toCss(n.value):n.value}catch{}if(!p||/[{};<]/.test(p))continue;let c=n.theme?.split("+")??[],u=c.flatMap(e=>l[e]?[`:is(${l[e]})`]:[]),d=n.theme?Object.entries(l).filter(([e])=>!c.includes(e)).map(([,e])=>`:not(${e})`):[];n.theme&&!u.length&&!d.length&&n.theme!==s||a.push(`${u.join("")||":root"}${d.join("")}{${o}:${p}!important}`)}if(!a.length)return()=>{};let o=n.createElement("style");return o.dataset.paletteTokenPreview="",o.textContent=a.join(""),(n.head??n.documentElement).append(o),()=>o.remove()}(e,e=>v.get(e)?.token,f.scopes,t,l?.document)}:{},...f.onlyGenerated?{subscribe:y}:{},resolve(t){let r,l={},s=function(e){let t=new Map;for(let r of P(e))for(let e of r.entry.covers){let l=t.get(e);(!l||r.entry.covers.size<=l.entry.covers.size)&&t.set(e,r)}for(let[e,r]of t)n[e]?.some(e=>t.get(e)?.entry!==r.entry)&&t.delete(e);return t}(o(t));if(e(t)){for(let[e,r]of s){let l=t.style.getPropertyValue(e),n=r.name.startsWith("!")||r.name.endsWith("!");l&&(!n||"important"===t.style.getPropertyPriority(e))&&s.delete(e)}for(let[e,t]of s)n[e]?.some(e=>s.get(e)?.entry!==t.entry)&&s.delete(e)}for(let[e,t]of s)l[e]={path:t.entry.token.path};for(let e of w){if(s.has(e)||n[e]?.some(e=>s.has(e)))continue;r??=getComputedStyle(t);let a=r.getPropertyValue(e);a&&(l[e]={offToken:a})}return l},preview(r,l,s){let n=v.get(s.path);if(!n)return()=>{};let a=k.get(r)??{original:o(r),stack:[],inline:new Map};k.set(r,a),e(r)&&(a.inline.has(l)||a.inline.set(l,function(e,r){let l=e.getAttribute("style"),s=e.style.cssText,n=e.style.getPropertyValue(r),a=e.style.getPropertyPriority(r),o=getComputedStyle(e).getPropertyValue(r).trim(),i=t=>{let l=e.ownerDocument.createElement("span").style;return l.cssText=t,l.setProperty(r,""),l.cssText},p=i(s),c={value:n,priority:a,computed:o,absent:null===l,restore(){t.get(e)?.push(()=>{e.style.getPropertyValue(r)===n&&e.style.getPropertyPriority(r)===a&&c.restore()}),i(e.style.cssText)===p?null===l?(e.getAttribute("style"),e.removeAttribute("style")):e.setAttribute("style",l):(e.style.setProperty(r,n,a),null===l&&!e.style.length&&function(e){e.style.length||(e.getAttribute("style"),e.removeAttribute("style"))}(e))}};return c}(r,l)),r.style.setProperty(l,""));let i={property:l,entry:n};return a.stack.push(i),$(r,a),()=>{let e=a.stack.indexOf(i);e<0||(a.stack.splice(e,1),$(r,a),a.stack.some(e=>e.property===l)||(a.inline.get(l)?.restore(),a.inline.delete(l)))}},describe(e,t,r,l){let s=v.get(l.path)?.classes[0]??l.ref??l.path;if("path"in r){let t=v.get(r.path),l=k.get(e)?.original??o(e),n=P(l).find(e=>e.entry===t)?.name??t?.classes[0]??r.path;return n===s?`Keep class "${s}"`:`Replace class "${n}" with "${s}"`}return`Add class "${s}"`}}}var v={p:["Padding",["padding"]],px:["Padding",["padding-left","padding-right"]],py:["Padding",["padding-top","padding-bottom"]],pt:["Padding",["padding-top"]],pr:["Padding",["padding-right"]],pb:["Padding",["padding-bottom"]],pl:["Padding",["padding-left"]],m:["Margin",["margin"]],mx:["Margin",["margin-left","margin-right"]],my:["Margin",["margin-top","margin-bottom"]],mt:["Margin",["margin-top"]],mr:["Margin",["margin-right"]],mb:["Margin",["margin-bottom"]],ml:["Margin",["margin-left"]],gap:["Gap",["gap"]],"gap-x":["Gap",["column-gap"]],"gap-y":["Gap",["row-gap"]]},w=[0,.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96];function k(e={}){let t=e.scale??4,r=e.steps??w;return(e.prefix??Object.keys(v)).flatMap(e=>{let l=v[e];if(!l)throw new Error(`Palette: unknown spacing prefix "${e}"`);return r.map(r=>{let s=`${e}-${r}`;return{path:`spacing.${s}`,type:"dimension",class:s,properties:l[1],value:r*t+"px",group:l[0],label:s}})})}export{w as defaultSpacingSteps,k as tailwindSpacing,b as tailwindTokens,h as tokenValue};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-QFDNGHSH.js";import{a as t,c as n}from"./chunk-RBHY7UDS.js";import{a as o}from"./chunk-XOMOONGK.js";import{a as i,d as r}from"./chunk-VX6XCU4E.js";import{B as a,E as s,F as d,c as l,h as p,i as c,z as g}from"./chunk-4HBBEVFK.js";function f(e,t=!1){return e.composedPath().some(e=>c(e)&&!(t&&e.matches("button,a[href],summary")&&!e.matches("[contenteditable],[inert],[role]:not([role=button]):not([role=link])"))&&e.matches('input,textarea,select,button,a[href],summary,dialog,[contenteditable]:not([contenteditable="false"]),[inert],[role]:not([role="none"]):not([role="presentation"]):not([role="img"]):not([role="group"]):not([role="region"]):not([role="main"]):not([role="article"]):not([role="heading"]):not([role="paragraph"]):not([role="generic"])'))}function m(e){let r=e.keys??t(),s=t=>{let n=t.composedPath()[0];n instanceof HTMLSelectElement&&t.composedPath().includes(e.host)&&!g(n)&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&(/^[b?]$/i.test(t.key)||e.reserved?.(t))&&t.preventDefault()},{root:d,signal:m}=e;addEventListener("keydown",s,{signal:m}),d?.addEventListener("keydown",e=>a(e,d)&&s(e),{signal:m});return t=>{if(t.isComposing||229===t.keyCode)return!1;let a=t.key.toLowerCase(),s=t.composedPath(),m=g(s[0]),u=i()?t.metaKey&&!t.ctrlKey:t.ctrlKey&&!t.metaKey,h=m||!u||t.altKey?void 0:"z"===a?t.shiftKey?e.redo:e.undo:"y"!==a||i()||t.shiftKey?void 0:e.redo;if(h)return!h.disabled&&(t.preventDefault(),t.stopImmediatePropagation(),((t,n)=>{let o=d?.activeElement??document.activeElement,i=o?.closest("[data-field-property]")?.dataset.fieldProperty;t.click();let r=e.selected();r&&(!n.includes(e.host)||o?.matches(".design-geometry__frame"))&&e.select(r);let a=o?.isConnected?o:i&&d?.querySelector(`[data-field-property="${CSS.escape(i)}"] ${o.localName}`);a instanceof HTMLElement&&a.focus({preventScroll:!0}),!n.includes(e.host)&&d?.activeElement!==p()&&d?.activeElement?.blur()})(h,s),!0);if("escape"===a)return m?(s.some(e=>c(e)&&e.matches("[data-field-property]"))||(t.preventDefault(),s[0].blur()),!0):s.some(e=>c(e)&&e.matches("[popover],[role=listbox]"));if(t.defaultPrevented||e.reserved?.(t))return!1;let b=!(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey),x=!!n(t,r.before)||!n(t,r.after)&&void 0,y=m||s.some(e=>c(e)&&e.matches("input[type=range],[role=slider],.design-geometry__frame"));if(!e.compare.hidden&&(void 0!==x&&!y||b&&"b"===a&&!m))return t.preventDefault(),t.stopImmediatePropagation(),e.compareBefore(x),!0;if("?"===t.key&&e.help&&!m&&!t.altKey&&!t.ctrlKey&&!t.metaKey)return t.preventDefault(),t.stopImmediatePropagation(),e.help(),!0;let _=b&&" "===a;if(b&&"enter"===a&&!t.repeat){let n=m||s.some(e=>c(e)&&e.matches("[data-field-property],[popover],[role=listbox],[role=menu],textarea,.new-comment-composer,.reply-composer")),o=s.includes(e.host)&&f(t);if(!n&&!o)return!(!e.selected()?.isConnected||!e.comment?.())&&(t.preventDefault(),t.stopImmediatePropagation(),!0)}if(s.includes(e.host)||f(t,_))return!1;let v=e.selected(),w=t=>o(t)&&t.isConnected&&t!==t.ownerDocument.body&&t!==t.ownerDocument.documentElement&&!e.host.contains(t)&&!t.matches("script,style,defs,title,desc,metadata,[hidden],[inert]")&&"none"!==getComputedStyle(t).display&&"hidden"!==getComputedStyle(t).visibility,k=l(),E=k.activeElement,$=!E||E===k.body||E===k.documentElement||E===v,C=null,S=n(t,r.next)?"nextElementSibling":n(t,r.prev)?"previousElementSibling":void 0,K=t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(v?.isConnected&&S){for(C=v[S];C&&!w(C);)C=C[S];t.preventDefault(),t.stopImmediatePropagation()}else v?.isConnected&&$&&(n(t,r.child)||K&&"arrowdown"===a)?C=[...v.children].find(w)??null:v?.isConnected&&(n(t,r.parent)||K&&"arrowup"===a)?C=v.parentElement:_&&(C=E);return w(C)?(t.preventDefault(),t.stopImmediatePropagation(),C.scrollIntoView?.({block:"nearest",inline:"nearest"}),e.select(C),!0):t.defaultPrevented}}function u(e,t,n,o){let i=e.getRootNode(),r=function(e){let t=e.closest("[data-field-property]")?.dataset.fieldProperty,n=t?`[data-field-property=${JSON.stringify(t)}] `:"",o=e.getAttribute("data-property"),i=e.getAttribute("aria-label");return o?`${e.localName}[data-property=${JSON.stringify(o)}]`:i?`${n}${e.localName}[aria-label=${JSON.stringify(i)}]`:e.id?`[id=${JSON.stringify(e.id)}]`:n&&`${n}${e.localName}`}(t),a=()=>!(i.activeElement||document.activeElement&&document.activeElement!==document.body),s=e=>{d.disconnect(),clearTimeout(l),n(),e&&a()&&o()},d=new MutationObserver(()=>{if(!a())return s(!1);let t=r?e.querySelector(r):null;t&&(t.focus({preventScroll:!0}),s(!1))});d.observe(e,{childList:!0,subtree:!0});let l=setTimeout(s,400,!0);return s}var h={style:"style","inline text":"text","design-token":"token",token:"token","React prop":"prop",geometry:"geometry"};function b(e=""){let t=[...e.matchAll(/^Proposed (.+?) changes? \(preview only\)$/gm)].map(([,e])=>h[e]);return t.includes("geometry")?"geometry":t.find(Boolean)??"style"}var x=e=>`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="${e}"/></svg>`,y={style:"M8 2.5c2 2.4 4 4.6 4 6.8a4 4 0 0 1-8 0c0-2.2 2-4.4 4-6.8z",token:"M8 2.5 13.5 8 8 13.5 2.5 8z",text:"M3.5 4.5V3h9v1.5M8 3v10M6 13h4",prop:"M2.5 5h6m3 0h2m-11 6h2m3 0h6M10 3.5v3m-4 3v3",geometry:"M2.5 6V2.5H6m4 0h3.5V6m0 4v3.5H10m-4 0H2.5V10"},_=e=>`${e} change${1===e?"":"s"}`;function v(e,t,n,o){e.innerHTML=x(y[t]??y.style),e.dataset.kind=t,e.append(s("span","",n),s("small","",String(o))),e.setAttribute("aria-label",`${n} · ${_(o)}`)}function w(t){let n=s("div","design-inspector__empty");n.append(d("design"),s("strong","","Select an element"),s("p","","Click to inspect · Double-click text to edit"));let o=(e,t,n="")=>{let o=s("button",n,e);return o.type="button",o.addEventListener("click",t),o},a=(e,t,n=t)=>(e.setAttribute("aria-label",t),e.dataset.tip=n,e),p=s("section","design-inspector__pending design-card");p.setAttribute("aria-label","Unsaved changes"),p.hidden=!0;let c=s("div","design-card-head"),g=s("div","design-card-label"),f=s("h3","design-card-title");g.append(f,s("p","design-card-target","Preview only. Nothing is saved until you comment or copy.")),c.append(g);let m=s("div","design-rows design-pending__list"),u=s("div","design-pending__actions");p.append(c,m,u);let h=e=>t.mode?.root.dispatchEvent(new CustomEvent("palette-announce",{detail:e})),y=[],w=[],k=0,E=0,$=()=>[...y.map(e=>e.proposal),L?.proposal()].filter(Boolean).join("\n\n"),S=a(o("",async()=>{try{await navigator.clipboard.writeText($()),t.message("Changes copied")}catch{t.message("Couldn't copy changes. Try again.")}}),"Copy changes");S.append(d("copy")),u.append(o("Comment with changes",()=>{let e=$(),[n]=y,o=1===y.length&&!L?.size&&n.here?n.element:l().body;t.reset(),t.mode?.onComment(o,e||void 0)}),S,a(o("Discard all",()=>{T(),t.mode?.root.querySelector(".design-inspector__target")?.focus({preventScroll:!0})}),"Discard all","Undo · "+(i()?"⌘Z":"Ctrl+Z")));let K=e=>{p.removeEventListener("pointerover",K),p.removeEventListener("focusin",K),t.mode&&t.signal&&C(p,t.mode.root,t.signal,e)};function T(){E=k,t.before(!0),h(`${_(E)} discarded`)}p.addEventListener("pointerover",K),p.addEventListener("focusin",K);let L,M=()=>{E&&(E=0,t.reset())},{history:z=[]}=t,D=()=>{let e=new Set(L?.steps);for(let t=z.length;t--;)"token"===z[t].kind&&!e.delete(z[t].step)&&z.splice(t,1);for(let t of e)z.push({kind:"token",step:t});t.update?.()},P=t.mode&&{...t.mode,link:e=>(L=e,D)},j=o("Edit tokens",()=>{M();let e=t.mode?.root.querySelector(".design-inspector");e&&P&&import("./token-page-NIB5HAVS.js").then(t=>t.openTokenPage(e,P),()=>t.message("Tokens unavailable · try again"))},"design-inspector__tokens"),N=o("Keyboard shortcuts",()=>t.help?.(),"design-inspector__help");N.setAttribute("aria-label","Keyboard shortcuts"),N.setAttribute("aria-keyshortcuts","?"),N.append(r(["?"],"?")),N.hidden=!t.help,n.append(j,N);let A=()=>{t.clear?.(),L?.open()},H=o("",A,"design-change-row"),O=o("",A,"design-change-row design-inspector__token-chip");return O.title="Open the Tokens view",O.hidden=!0,{empty:n,pending:p,chip:O,get tokens(){return L},get parked(){return E>0},settle:M,discard:T,restore:()=>!!E&&(h(`${_(E)} restored`),E=0,t.before(!1),!0),icons:{undo:x("M5.5 3.5 2.5 6.5l3 3m-3-3h7a4 4 0 0 1 0 8h-2"),redo:x("M10.5 3.5 13.5 6.5l-3 3m3-3h-7a4 4 0 0 0 0 8h2"),reset:x("M2.5 2.5v3h3M3 5.5a5.5 5.5 0 1 1-.5 2.5")},styles:'@keyframes design-status{from{opacity:0;translate:0 2px}}.design-inspector__count{white-space:nowrap;font-variant-numeric:tabular-nums}.design-inspector__status{display:none;min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;animation:design-status .2s var(--ease-smooth-out)}.design-inspector__bar[data-message] .design-inspector__status{display:block}.design-inspector__bar[data-message] .design-inspector__count,.design-inspector__bar:not([data-changes]) .design-inspector__tool{display:none}.design-inspector__compare { display:inline-flex; flex:none; padding:2px; border-radius:7px; background:#ffffff0a; }.design-inspector__compare[hidden],.design-inspector__bar[data-message] .design-inspector__compare { display:none; }.design-inspector__compare button { height:22px; padding:0 8px; border-radius:5px; color:#9a9a9a; font:inherit; font-size:11px; }.design-inspector__compare button:hover { color:#fff; }.design-inspector__compare button[aria-pressed="true"] { color:#fff; background:#ffffff1a; }.design-inspector__empty { display:flex; flex-direction:column; align-items:center; gap:4px; padding:0 24px 28px; color:#898680; font-size:11px; text-align:center; }.design-inspector__empty > svg { box-sizing:content-box; width:20px; height:20px; margin-bottom:8px; padding:8px; border-radius:10px; background:#ffffff0a; color:#77736f; }.design-inspector__empty strong { color:#e9e6e1; font-size:12px; font-weight:600; }.design-inspector__empty p { margin:2px 0 0; line-height:1.5; }.design-inspector__pick-hint{flex:none;margin:0 12px 10px;color:#989898;font-size:10px;line-height:1.5}.design-inspector__pending{margin:0 12px 12px;min-width:0;border-radius:10px;background:#ffffff08;box-shadow:inset 0 0 0 1px #ffffff0d;font-size:12px;animation:design-status .2s var(--ease-smooth-out)}.design-inspector__pending[hidden]{display:none}.design-inspector__pending .design-card-head{display:flex;min-width:0;padding:10px 12px}.design-inspector__pending .design-card-label{display:grid;flex:1;min-width:0;gap:2px}.design-inspector__pending .design-card-title{margin:0;overflow:hidden;color:#eee;font-size:12px;font-weight:600;font-variant-numeric:tabular-nums;text-overflow:ellipsis;white-space:nowrap}.design-inspector__pending .design-card-target{margin:0;color:#8a8a8a;font-size:11px;line-height:1.45}.design-pending__list{display:flex;flex-direction:column;max-height:168px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;border-top:1px solid #ffffff0a}.design-pending__list .design-change-row{padding:0 12px;border-radius:0}.design-pending__list .design-change-row+.design-change-row{border-top:1px solid #ffffff06}.design-change-row{display:grid;grid-template-columns:12px minmax(0,1fr) auto;align-items:center;gap:8px;flex:none;box-sizing:border-box;height:28px;padding:0 8px;border-radius:6px;color:#ddd;font:inherit;font-size:12px;text-align:left}.design-change-row:hover:not([aria-disabled]){background:#ffffff0a;color:#fff}.design-change-row:focus-visible{outline:1px solid #bda6ef;outline-offset:-1px}.design-change-row[aria-disabled]{opacity:.5;cursor:default}.design-change-row svg{width:12px;height:12px;color:#8a8a8a}.design-change-row[data-kind=token] svg{color:var(--accent,#bda6ef)}.design-change-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.design-change-row small{color:#8a8a8a;font-size:11px;font-variant-numeric:tabular-nums}.design-pending__actions{display:flex;align-items:center;gap:4px;padding:8px 8px 8px 12px;border-top:1px solid #ffffff0a}.design-pending__actions button{display:grid;place-items:center;min-width:28px;height:28px;padding:0 8px;border-radius:7px;color:#9a9a9a;font:inherit;font-size:12px}.design-pending__actions button:hover{background:#ffffff0f;color:#fff}.design-pending__actions button:first-child{padding:0 12px;background:var(--accent,#bda6ef);color:#211b2d;font-weight:500}.design-pending__actions button:first-child:hover{background:var(--accent,#bda6ef);color:#211b2d;filter:brightness(1.08)}.design-pending__actions button:last-child{margin-left:auto}.design-pending__actions svg{width:16px;height:16px}.design-pending__actions button:focus-visible{outline:2px solid #bda6ef;outline-offset:1px}@media (prefers-reduced-motion:reduce){.design-inspector__pending{animation:none}}@media (pointer:coarse){.design-change-row,.design-pending__actions button{height:36px}}.design-inspector__tokens{margin-top:16px;min-height:34px;padding:0 14px;border-radius:8px;background:var(--accent,#bda6ef);color:#211b2d;font:inherit;font-size:12px;font-weight:500}.design-inspector__tokens:hover{filter:brightness(1.08)}.design-inspector__help{gap:6px;margin-top:8px;min-height:28px;padding:0 8px;border-radius:7px;color:#898680;font:inherit;font-size:11px}.design-inspector__tokens[hidden]+.design-inspector__help{margin-top:14px}.design-inspector__help:hover{background:#ffffff0a;color:#e9e6e1}.design-inspector__tokens[hidden],.design-inspector__help[hidden]{display:none}.design-inspector__token-chip{flex:none;align-self:flex-start;margin:0 12px 8px;background:#ffffff08;box-shadow:inset 0 0 0 1px #ffffff0d}.design-inspector__token-chip[hidden]{display:none}',update(n=!1){let i=E?0:L?.size??0;y=n||E?[]:t.items().reverse(),k=y.reduce((e,t)=>e+t.count,i),p.hidden=n||!!E||!k,f.textContent=`${k} unsaved change${1===k?"":"s"}`;let r=[...y.flatMap(e=>[e.element,e.count,e.here,e.proposal]),i];(r.length!==w.length||r.some((e,t)=>e!==w[t]))&&(w=r,function(n){t.peek(null),m.replaceChildren(...y.map(n=>{let i=o("",()=>{n.here&&(t.peek(null),n.element.scrollIntoView?.({block:"nearest",inline:"nearest"}),t.select(n.element))},"design-change-row"),r=/^Component: (.+?)(?: \(.*\))?$/m.exec(n.proposal??"")?.[1];if(v(i,b(n.proposal),r||e(n.element),n.count),n.here)for(let[e,o]of[["pointerenter",n.element],["pointerleave",null],["focus",n.element],["blur",null]])i.addEventListener(e,()=>t.peek(o));else i.setAttribute("aria-disabled","true"),i.dataset.tip="On another page";return i})),n&&(v(H,"token","Token changes",n),m.append(H))}(i)),j.hidden=!t.mode?.design?.tokens&&!l().querySelector("[data-palette-design-tokens],[data-komo-design-tokens]"),j.textContent=i?`Edit tokens · ${_(i)}`:"Edit tokens",O.hidden=!n||!i,v(O,"token","Token changes",i)}}}function k(e){let t=[];for(let n=e;n;n=n.parentElement){let o=n.id&&!/^radix-|^:r|_r_|«r/.test(n.id)?`#${CSS.escape(n.id)}`:"";if(o&&1===n.ownerDocument.querySelectorAll(o).length)return[o,...t].join(" > ");if(n===n.ownerDocument.body||!n.parentElement)return[n.tagName.toLowerCase(),...t].join(" > ");let i=n===e?[...n.classList].slice(0,2).map(e=>`.${CSS.escape(e)}`).join(""):"",r=[...n.parentElement.children].filter(e=>e.tagName===n.tagName).indexOf(n)+1;t.unshift(`${n.tagName.toLowerCase()}${i}:nth-of-type(${r})`)}return t.join(" > ")}function E(e,t){return`${k(e)} {\n${[...t].map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`}function $(e,t,n,o,i,r=[]){let a=[...t??[]].filter(([e])=>!o?.has(e)).map(([e,t])=>`- ${e}: ${n(e)||"(unset)"} → ${t}`),s=[a.length?`Proposed style changes (preview only)\nTarget: ${k(e)}\n${a.join("\n")}`:"",...i.map(t=>t&&!/^Target: /m.test(t)?t.replace("\n",`\nTarget: ${k(e)}\n`):t)].filter(e=>!!e);if(s[0]&&r.length){let e=s[0].split("\n"),t=r.filter(t=>!t.startsWith("Component: ")||!e.some(e=>e.startsWith("Component: ")));e.splice(e[1]?.startsWith("Target: ")?2:1,0,...t),s[0]=e.join("\n")}return s.join("\n\n")||void 0}function C(e,t,n,o,i){if(n.aborted)return;let r=s("div","morphing-menu__tooltip sidebar-tooltip");r.setAttribute("aria-hidden","true"),t.append(r);let a=0,d=()=>{clearTimeout(a),delete r.dataset.open},l=e=>{let t=e.target?.closest?.("[data-tip]");if(!t||"focusin"===e.type&&!t.matches(":focus-visible"))return d();clearTimeout(a),a=window.setTimeout(()=>{if(!t.isConnected)return;let e=t.getBoundingClientRect();r.textContent=t.dataset.tip??"";let n=r.offsetWidth/2;r.style.left=`${Math.max(8+n,Math.min(document.documentElement.clientWidth-8-n,e.left+e.width/2))}px`,r.style.top=e.top-8-r.offsetHeight+"px",i?.(r,t),r.dataset.open="true"},r.dataset.open?0:400)};e.addEventListener("pointerover",l,{signal:n}),e.addEventListener("focusin",l,{signal:n});for(let t of["pointerleave","pointerdown","focusout","scroll"])e.addEventListener(t,d,{signal:n});n.addEventListener("abort",()=>{d(),r.remove()}),("focusin"===o.type||e.matches(":hover"))&&l(o)}function S(e,t,n,o){let i=0,r=new MutationObserver(()=>{let o=e.textContent??"";e.title=o,t.toggleAttribute("data-message",!!o),clearTimeout(i),o&&(i=window.setTimeout(function t(){n()?i=window.setTimeout(t,2600):e.textContent=""},2600))});r.observe(e,{childList:!0,characterData:!0,subtree:!0}),o.addEventListener("abort",()=>{r.disconnect(),clearTimeout(i)},{once:!0})}export{m as a,u as b,b as c,v as d,w as e,k as f,E as g,$ as h,C as i,S as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){try{return x?.contentDocument??null}catch{return null}}function t(e){let t=e&&("nodeType"in e?e.ownerDocument?.defaultView:e);if(!t||t===window)return;let o=t;return M().map(e=>o[e]).find(Boolean)}function o(e){if(C())for(let t of M())Object.assign(window[t]??={},e)}function n(e){({screenRect:G,toScreen:J,toView:Z,clientPoint:z,pageElementsAt:X,counterpart:K}=e)}function r(t,o){if(o?.aborted)return;let n=[t,o];A.add(n),o?.addEventListener("abort",()=>A.delete(n),{once:!0});let r=e();r&&v&&t(r,L(v.signal,o))}function a(e,t,o,n="document"){r((r,a)=>{("window"===n?r.defaultView:r)?.addEventListener(e,t,{...o,signal:a})},o?.signal)}function i(t){v?.abort(),v=void 0,x=t;let o=e();if(o){v=new AbortController;for(let[e,t]of A)e(o,L(v.signal,t))}}function s(e,t){let o=t&&/^#[0-9a-f]{6}$/i.test(t)?t:T,n=[1,3,5].map(e=>{let t=parseInt(o.slice(e,e+2),16)/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}),r=.2126*n[0]+.7152*n[1]+.0722*n[2];e.style.backgroundColor=o,e.style.color=r>.179?"#161616":"#ffffff",e.style.setProperty("--reviewer-accent",o),e.style.setProperty("--reviewer-ink",r>.179?"#161616":"#ffffff")}function l(e,t){e.ownerDocument.defaultView?.addEventListener("keydown",t=>{"Escape"===t.key&&t.composedPath().includes(e)&&t.preventDefault()},{capture:!0,signal:t})}function d(e,t,o,n){let r=e.getRootNode();document.addEventListener(t,o,n),a(t,o,n),r.addEventListener(t,e=>P(e,r)&&o(e),n)}function h(e,t="",o){let n=document.createElement(e);return t&&(n.className=t),void 0!==o&&(n.textContent=o),n}function c(e){let t=R.get(e);if(!t){let o=document.createElement("div");o.innerHTML=j[e],t=o.querySelector("svg"),R.set(e,t)}return t.cloneNode(!0)}function u(e,t,o="icon",n){let r=h("button",o);return r.type="button",r.title=e,r.setAttribute("aria-label",e),n?r.append(c(n)):r.textContent=e,r.addEventListener("click",t),r}function p(e){let t=Math.max(0,Math.floor((Date.now()-e)/6e4));return t?t<60?`${t}m`:t<1440?`${Math.floor(t/60)}h`:`${Math.floor(t/1440)}d`:"Just now"}function w(e){let t=e.avatarUrl;if(t?.startsWith("data:image/jpeg;base64,"))return t;try{return t||=e.verified?m?.({id:e.id,name:e.name}):"","https:"==new URL(t).protocol?t:void 0}catch{}}function g(e){let t=h("span","avatar",Y(e.name));s(t,e.accentColor);let o=w(e);if(o){let e=h("img");e.alt="",e.referrerPolicy="no-referrer",e.loading="lazy",e.decoding="async",e.addEventListener("error",()=>e.remove(),{once:!0}),e.src=o,t.append(e)}return t}function k(){let e=h("img","google-logo");return e.src="data:image/webp;base64,UklGRgAMAABXRUJQVlA4TPMLAAAvOsAOEAGGbdtGgu3gnCDp/gN/t0JE/ycAj9w3m2Q5YlvLRneVRGKt5QEAbbQtbcfyN2+AJHTfun+A5MvMtvcCoZk42SakmdhsWwhNVWMybQmIqmpmprXtzZyRpIHbSLLVqE0xS8eQf3TfPAvFGbBpJMlRnQFgARx/PA/gotdHFsDJaWzbTrVwOeNzAfRfCQ4kkp+j6P8EAECFCTjyRIHZCkyzA3iRgEl6KBQAZAA68ISef4S5YTqA3QkJFwSwnPkdLSJg4cSYcoLuLSMDtb/HuPI7CgkJCekJCWGEzsNxc68IXIVAIySEjRY4UoGCIwDYAbhkyiMYH8E0p+W43sWGjo6IkciO/H+KZDn/f1Z191ve9VbkMbjMFjPLYkZXJrPkyWJmmczMzHgDZmled1X+jdFM1fQJfkJTXkaG6H+CjlgoZcSSKZyIFuUJxJroWCoxsybG6xOIJ8oTy+x4Vgn8500s7wHW3XgO3dq2Xe3J3PeTdxUowsYu9BEpJVAABVCPBjEN2C4YZGSe3zvpe+/eTce2tmXPcs71PElwd+nooYLK3d2hdq+dKTABKgbgLnNgDFS/u+XLc1GAJNm0bVUfP9u2bdu2bdu2bdu2bdv/P9vG0UwAQSj5vH0sKjmXWCQ1IT+XAoQ0EuJSdTI/kzzheIUmZ5OD9zfh6QPCBwzv+ftgSoviwtJccgmScvQRIUUA0UAUC0xqKUHmO07u0OK4GZtDl+xLzqE4U2+OsNukIo00+ZEJ0YSIhRQIRhUKaKSIIiqJDKgnUvxzOHXhvtzpQn0t3pJdvvf4Xu/CBjm6iJFDBAG22JQBULUcUNWg1KBRAxliFiBjNpVLF+0bgy7YV2MvzaV6Z7kMI4idhAnyalIhRanAEadNUHVhWoGrYlSBOWrhkWjGLCkdzdN5XiUqKu+yvT1WJqOypq1NnFmxKVoots0QAN/UXNBIwWogRmngyvqUM1PzYVS+pDeTlHWV3pZnYC62ZtbN4Md/0b9Ap6GlYFgHNK4oVKNjJXyeBW6oV2kLxoTXyGWPI2051+6t9XLOy4wYc7SsIRf+8heFghIcAMX84CoEB1oRCas1dcBrwmsYzcBmXDZT3cBXjhKu19Hu6VYnAXlrRiQB3Ziut/UU2qhGwGlQADOAVCE4UbzdMHskkrnP/Bd/9/2kG/RrR7Eb9cnmT5R2FpAYWkw/oBKZQqlqW62qmO80Nt43rQMX1uBkAsNQ/DZNzcdJxxz8FK2inX6gVpXCrKHKPorZbLaVaQC8h+MW793qWoXr+9KK3aHk6nOHpRFsPAOmx7V1i/rYVimKDFjw/+bq/yJVD4842KAWENzYYxlueWSXoPjDemnMuzs3xyBs1RIQo6q2lUT0L+EATmRIXr7RylVJz3G5bQ++YPPX9xL4csRjSc/IJ03+5N5MQIIcy08lxZPFqiO1GxaVcNIvGbWzXTJYCOMABdBoQ6K1rD6yHUtluOVB+fMRFr7oq2fjZs9mOZY2HIu8S1pqUagLpt1g01D8Yb2s9IOdrvm+BGZACCFEQIh+wBiy5VOeMSkLxx4yDoPFn/PhPa6de3197hhpHqH312TDb1H8WSXioznOICS0348n44AQ6qZJDdlywowx9N45B4pf2CtJzEO28yh2QUSJfefVTtAuV08wyiQYEhgKMewi2hnskvy3g1PPUOoF/3wzYu85lU777IYtN8hX4RKeXyIZtCckw+8xGY9/sfaLEHYFu8B/Tif/YIitC8p0NFsOzwS/D5PJZDxBl9rVSvAS1zgxxFJEVgMDD0EhhnGc/GIySSHShydyNgaG+c3mFZFYRCeRGCYQCsrK1gRBZl8MtTUeb6LLUBpCgAYNPbBZt18whxgua/xJhK8EjUE1CMWK1X89znobGKqX9aoolg6ijDANUYOqdqABTp3RMT0JDBVrIjY8Ig4SPDwE+LrenqWf54LWKHqDb+ra4ZLaHKJKsNIEMuGfObCrb6VKhYYFeAHwEGVGxrTn9+J0hegKT6YTuzGJBaUhwa9BqGY0dwKLCsD7GomKsPkhxVsIVP4NgFXKS4d/s9JPmGsPJuoBwOP/J3Hpegx1EgMGay1S7BEUHvMTkuPVcBmGSc/njKUAKcAe3wN8B9+GSzk89qLyADzg6xpDTnhv9JMf+zXAA54sBvaiDRnhVWI9Zg0f7+Hxse/ZUXGx7oZMSTRcXM0Mboh1NdXA+Pga3jlfJ5Ddm/qVrXeoTAyZsCuzLpP6vR/B/dY5WkCrkp0Ubz/upChGcIRYQJTFpPyXh4mJ8T+13z+x5tzIHbhGE36bLCLZG4oW4/Bd9AchDDgAFHBA4yAhshTnIpLhb4OGXcdfGTxMUhv5D+gItATB3pT8qnVvUBxFPnGrD0gwcMadOs+waIPYVg8IYy+kUvxm5+kp8UOsQ+loyEmACzVckILrnxe+beGL/raVp0jxm3/c4lxj/naBxsBo9P3mZ7wErc5ORv00C1WwvAosC5EbjG/wDk5W76Xq7Kt2CgevDSGwmAmgVkr5KOFR/2u+gLfRz04+0I44tVUXD1x1Tq5h7gToyurP/mFUXprbvn8yodlO15btNBYWQlCKABIxJcSj526wG4ZAz3nIelNr8gTaQVaRvWC5Xt6HYXbptsbEwSWXluT87hiSLsra7hpbfGnsKfAlNKTK1Z8kJwA8F9Vp7xpahY6gKgsQ1r+0Tw7rMa38s7m70+/7vizB7Z5cXpitmXk37rHzTXA8gMiyMY2yHmx3yXUAz99XpP6dh46RiWQH2oEDUqDKeJ/4gT7N/rfgf3jzYodCpd0xJKPHO4eoxLcKEwcDqq0BnJLaCnC791o/+hMAnvMfTXr4IxPRBJngoijVYfsI9T17Usn/Yk+G94R/3BKxpLvnSAo5nLdRDhfkzi0L8GF02CdioFbET+be3ID5z0JEU0+mi/CBB9IsB7pVIs4EkyhqbE603aAFGbX46rxkpdzvLUuwbOAkS6YWVljhAClwh41XUttBHrtb8Y5lpny6+LFxxIHtgbLQ9yjSCmi/txn0DhSzZ2SWU6o8xbsxCz3w8aeJBmN2tzKDk3i5mqp+YgV6WL1MQaRfOqHLAqf7ZEVLyoxNg8CBI8ewWqimDVAZMIANTgrfzJjZZVv2T2f7tNly1n79YBEP8Y2XX5zKaud2ncx2I+pFCTNxSTRJ0D1CBNxhIXQzAzZddt0f/1u2wOm/Wt17VoJkejGljUYj1C32ASva2KtBfhXrX4LZtlJnx813rtdocd6UW9lx70X32Xm/5Ih9K2timZ6XMu/Matd2nrznZUxc7J4r5N02ElSVBSi0Wa5+T+lDGrZ7qJ9/LABkZzO5XJJ4Ar+lpsIHIjVUVVQMGrLiscuoXIslDbaSdcH0k5jQ1QGShYnkwDJhBsenAT8eE3GqTQSlSubZpKkz+bDot52QvMNvnIqULZKicW1lRdVp2EdoWbGq2iOqJaK2tp4GBObhfQAi1MNrLzt+czyVGwXNsEUnhP6+JTbQSldwWBNQVQpAhcymYxul7bEKP/qSCFWzR0THdkiy2XyXX//1FTnjt8fdHbTvasCMKl/YYQKaWEG1iajg5ukHnGcYVLUBELWNe3SdJ5vNrl3mFW1RfHC99zW/5lenquKGSqMGIOwBxR4AvEaOaFTAo4HqilDpPEu67zrIEVAmX+cxy61eFVERXhVArBy+B3godNq22yQiQapQsKHUhPfTL151/r8f5aav9zIZzksY7jTa0MOgES0WbrQJAWEWwcrGcSTvWLpezZO/UfKZXv27+Wzf/5KPmopJe6GbKomCbzypsPCGMlFVbThh24+6QWSEBBuz0uzSb54/giV8rHt85uEVDWm3M23koCmDTWRiQSoVAIEAHwClFECqjNLJICuhQdbhrt0ll3nzykMs8f1ffhJhd1bMp03spHjKaLRKtsQWAHwPgGorIgMMSVJGmb60us8s1l7w9RtgGJ/46NuUtFk8N0sTc2VImsKnn99APWNRSqVRv7f8KuFx3lwwOGyMZ+e6fguyAcP6EN9F3ZGJszVS04H8vCjAeEUMEoz42eA6cVWGjlRK2PDl9WcnPZf2EWQXcgaUCAA=",e.alt="",e.width=e.height=18,e}var v,m,f="komo-viewport",C=()=>{try{let e=window.frameElement;return/^(palette|komo)-viewport$/.test(window.name)&&!!e&&["data-palette-viewport","data-komo-viewport"].some(t=>e.hasAttribute(t))}catch{return!1}},x=null,A=new Set,b=()=>e()??document,B=()=>b().defaultView??window,y=()=>{let e=b();return{document:e,root:e.documentElement}},M=()=>[Symbol.for("palette.frame-bridge"),Symbol.for("komo.frame-bridge")],V=()=>e()?x:null,E=e=>1===e?.nodeType,I=e=>E(e)&&"http://www.w3.org/1999/xhtml"===e.namespaceURI,S=e=>E(e)&&"http://www.w3.org/2000/svg"===e.namespaceURI,G=e=>e.getBoundingClientRect(),J=(e,t)=>new DOMRect(e.left,e.top,e.width,e.height),Z=(e,t,o)=>({x:e,y:t}),z=e=>({x:e.clientX,y:e.clientY}),X=(e,t)=>document.elementsFromPoint(e,t),K=(e,t)=>e.ownerDocument===t?e:null,L=(e,t)=>t?AbortSignal.any([e,t]):e,T="#c8b5f4",j={chevron:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"></path></svg>',edit:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 6.28 2 7.12 2 8.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 22 5.12 22 6.8 22h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C20 19.72 20 18.88 20 17.2V13M8 16h1.675c.489 0 .733 0 .963-.055.204-.05.4-.13.579-.24.201-.123.374-.296.72-.642L21.5 5.5a2.121 2.121 0 0 0-3-3l-9.563 9.563c-.346.346-.519.519-.642.72a2 2 0 0 0-.24.579c-.055.23-.055.474-.055.963V16Z"></path></svg>',trash:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 6v-.8c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C14.48 2 13.92 2 12.8 2h-1.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C8 3.52 8 4.08 8 5.2V6m2 5.5v5m4-5v5M3 6h18m-2 0v11.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C16.72 22 15.88 22 14.2 22H9.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C5 19.72 5 18.88 5 17.2V6"></path></svg>',info:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 16v-4m0-4h.01M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"></path></svg>',more:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm7 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path></svg>',person:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 21c0-1.396 0-2.093-.172-2.661a4 4 0 0 0-2.667-2.667c-.568-.172-1.265-.172-2.661-.172h-5c-1.396 0-2.093 0-2.661.172a4 4 0 0 0-2.667 2.667C4 18.907 4 19.604 4 21M16.5 7.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Z"></path></svg>',search:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21 21-3.5-3.5m2.5-6a8.5 8.5 0 1 1-17 0 8.5 8.5 0 0 1 17 0Z"></path></svg>',plus:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14m-7-7h14"></path></svg>',comment:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.094 11.229A8.01 8.01 0 0 1 6 10c0-4.418 3.605-8 8.053-8 4.447 0 8.052 3.582 8.052 8a7.94 7.94 0 0 1-.52 2.835c-.07.182-.105.274-.12.345a.897.897 0 0 0-.024.194c-.002.073.008.153.028.314l.403 3.27c.043.355.065.532.006.66a.5.5 0 0 1-.257.252c-.13.055-.306.03-.66-.022l-3.184-.467c-.167-.024-.25-.037-.326-.036a.898.898 0 0 0-.2.021 2.989 2.989 0 0 0-.358.122 8.174 8.174 0 0 1-4.07.42M7.632 22C10.597 22 13 19.538 13 16.5S10.597 11 7.632 11c-2.965 0-5.369 2.462-5.369 5.5 0 .61.097 1.198.277 1.747.075.232.113.348.126.427.013.083.015.13.01.213-.005.08-.025.17-.065.351L2 22l2.995-.409c.163-.022.245-.034.316-.033.076 0 .115.005.19.02.07.013.173.05.381.123a5.246 5.246 0 0 0 1.75.299Z"></path></svg>',copy:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 15c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C2 13.398 2 12.932 2 12V5.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C3.52 2 4.08 2 5.2 2H12c.932 0 1.398 0 1.765.152a2 2 0 0 1 1.083 1.083C15 3.602 15 4.068 15 5m-2.8 17h6.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 20.48 22 19.92 22 18.8v-6.6c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 9 19.92 9 18.8 9h-6.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C9 10.52 9 11.08 9 12.2v6.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C10.52 22 11.08 22 12.2 22Z"></path></svg>',pointer:'<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path transform="translate(24 0) scale(-1 1)" d="M3.41345 10.7445C2.81811 10.513 2.52043 10.3972 2.43353 10.2304C2.35819 10.0858 2.35809 9.91354 2.43326 9.76886C2.51997 9.60195 2.8175 9.48584 3.41258 9.25361L20.3003 2.66327C20.8375 2.45364 21.1061 2.34883 21.2777 2.40616C21.4268 2.45596 21.5437 2.57292 21.5935 2.72197C21.6509 2.8936 21.5461 3.16219 21.3364 3.69937L14.7461 20.5871C14.5139 21.1822 14.3977 21.4797 14.2308 21.5664C14.0862 21.6416 13.9139 21.6415 13.7693 21.5662C13.6025 21.4793 13.4867 21.1816 13.2552 20.5862L10.6271 13.8282C10.5801 13.7074 10.5566 13.647 10.5203 13.5961C10.4881 13.551 10.4487 13.5115 10.4036 13.4794C10.3527 13.4431 10.2923 13.4196 10.1715 13.3726L3.41345 10.7445Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>',expand:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 3v18M7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3Z"></path></svg>',close:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"></path></svg>',check:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"></path></svg>',arrow:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 19V5m0 0-7 7m7-7 7 7"></path></svg>',link:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12.708 18.364-1.415 1.414a5 5 0 1 1-7.07-7.07l1.413-1.415m12.728 1.414 1.415-1.414a5 5 0 0 0-7.071-7.071l-1.415 1.414M8.5 15.5l7-7"></path></svg>',code:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"></path></svg>',smile:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><path d="M8 14s1.5 2 4 2 4-2 4-2"></path><line x1="9" y1="9" x2="9.01" y2="9"></line><line x1="15" y1="9" x2="15.01" y2="9"></line></svg>',tag:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 8h.01M2 5.2v4.475c0 .489 0 .733.055.963.05.204.13.4.24.579.123.201.296.374.642.72l7.669 7.669c1.188 1.188 1.782 1.782 2.467 2.004a3 3 0 0 0 1.854 0c.685-.222 1.28-.816 2.467-2.004l2.212-2.212c1.188-1.188 1.782-1.782 2.004-2.467a3 3 0 0 0 0-1.854c-.222-.685-.816-1.28-2.004-2.467l-7.669-7.669c-.346-.346-.519-.519-.72-.642a2.001 2.001 0 0 0-.579-.24C10.409 2 10.165 2 9.676 2H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 3.52 2 4.08 2 5.2ZM8.5 8a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0Z"></path></svg>',design:'<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12c0 5.523 4.477 10 10 10a3 3 0 0 0 3-3v-.5c0-.464 0-.697.026-.892a3 3 0 0 1 2.582-2.582c.195-.026.428-.026.892-.026h.5a3 3 0 0 0 3-3c0-5.523-4.477-10-10-10S2 6.477 2 12Z"></path><path d="M7 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm9-4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm-6-1a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path></svg>'},U=()=>matchMedia("(prefers-reduced-motion: reduce)").matches,W=e=>E(e)&&(e.isContentEditable||"textarea"===e.localName||"input"===e.localName&&/^(text|search|number|url|email|tel|password)$/.test(e.type)&&!e.readOnly&&!e.matches("[data-scrub]:not([data-editing])")||e.matches('[aria-expanded="true"]:is(select,[role=combobox])')||!!e.closest('[contenteditable]:not([contenteditable="false"]),[role=textbox],[role=searchbox],[role=listbox]')),D="pointerdown mousedown touchstart touchmove touchend click wheel focusin focusout keydown keyup keypress".split(" "),P=(e,t)=>t instanceof ShadowRoot&&t.host.hasAttribute("data-isolate")&&(!e.type.startsWith("key")||(e=>I(e)&&(e.matches("input,textarea,select")||e.isContentEditable))(e.composedPath()[0])),R=new Map,Y=e=>e.trim().split(/\s+/).slice(0,2).map(e=>e[0]).join("").toUpperCase(),H=e=>{m=e};export{f as a,C as b,b as c,B as d,y as e,t as f,o as g,V as h,E as i,I as j,S as k,G as l,J as m,Z as n,z as o,X as p,K as q,n as r,r as s,a as t,i as u,T as v,s as w,j as x,U as y,W as z,D as A,P as B,l as C,d as D,h as E,c as F,u as G,Y as H,p as I,H as J,w as K,g as L,k as M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){for(let e of["localStorage","sessionStorage"])try{let t=globalThis[e];for(let e of Object.keys(t)){let m=`palette:${s(e)}`;o.test(e)&&null===t.getItem(m)&&t.setItem(m,t.getItem(e))}}catch{}}function t(e,t){e.removeItem(t);let o=m(t);o&&e.removeItem(o)}var o=/^(?:branch-comments:(?:https?:\/\/|(?:sidebar-mode|pin-size|read|channel|drawer|sidebar|frame-size|open|toolbar-dismissed|comments-hidden|emoji|colors):|(?:dismissed-tips|color-format)$)|komo:(?:(?:shell|shell-off|geometry-moved)$|setup:))/,s=e=>e.slice(e.indexOf(":")+1),m=e=>e.startsWith("palette:")?["branch-comments:","komo:"].map(t=>t+s(e)).find(e=>o.test(e)):void 0;export{m as a,e as b,t as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return!!e&&"string"==typeof e.id&&"string"==typeof e.name&&"boolean"==typeof e.verified&&[e.avatarUrl,e.accentColor].every(e=>void 0===e||"string"==typeof e)}function t(t){return Array.isArray(t)&&t.every(t=>t&&"string"==typeof t.id&&"string"==typeof t.page&&"boolean"==typeof t.resolved&&Number.isFinite(t.createdAt)&&Number.isFinite(t.updatedAt)&&(null===t.resolvedBy||e(t.resolvedBy))&&t.anchor&&(!("context"in t.anchor)||function(e){if(void 0===e)return!0;if(!e||"object"!=typeof e||Array.isArray(e))return!1;let t={tag:32,role:80,label:160,nearby:160,classes:200,selectedText:200,styles:500,scope:2e3};return Object.entries(e).every(([e,s])=>"number"==typeof t[e]&&"string"==typeof s&&s.length<=t[e])}(t.anchor.context))&&"string"==typeof t.anchor.selector&&"string"==typeof t.anchor.text&&[t.anchor.x,t.anchor.y,t.anchor.width,t.anchor.height,t.anchor.pageX,t.anchor.pageY,t.anchor.viewportWidth].every(Number.isFinite)&&Array.isArray(t.comments)&&t.comments.every(t=>t&&"string"==typeof t.id&&"string"==typeof t.body&&e(t.author)&&Number.isFinite(t.createdAt)&&(null===t.editedAt||Number.isFinite(t.editedAt))&&t.reactions&&"object"==typeof t.reactions&&!Array.isArray(t.reactions)&&Object.values(t.reactions).every(e=>Array.isArray(e)&&e.every(e=>"string"==typeof e))))}function s(e,t){if(!t||!Array.isArray(e))return e;let s=e=>"string"==typeof e?Object.hasOwn(t,e)?t[e]:void 0:e;return e.map(e=>e&&{...e,resolvedBy:s(e.resolvedBy),comments:Array.isArray(e.comments)&&e.comments.map(e=>e&&{...e,author:s(e.author)})})}function o(){return new r(0,"Could not read comments. Try again.","invalid_response")}var r,i;import{a as n,c as a}from"./chunk-5HZI7HRR.js";r=class extends Error{constructor(e,t,s){super(t),this.status=e,this.code=s}status;code},i=class{constructor(t){this.options=t;let s=new URL(t.sessionEndpoint??t.endpoint).href.replace(/\/$/,""),o=t.sessionDomain?.replace(/^\./,"")??"";this.cookieDomain=o&&(location.hostname===o||location.hostname.endsWith(`.${o}`))?o:"",this.cookieName=`${this.cookieDomain?"__Secure-":"__Host-"}bc-session-${encodeURIComponent(JSON.stringify([s,t.project]))}`,this.key=`palette:${t.endpoint}:${t.project}`;let r=!1;try{let e=document.cookie.split("; ").find(e=>e.startsWith(`${this.cookieName}=`));r=void 0!==e,this.token=e?.slice(this.cookieName.length+1)||null}catch{}try{let t;try{t=JSON.parse(localStorage.getItem(this.userKey)??"null")}catch{}let s=localStorage.getItem(this.key)??(e(t?.user)&&"string"==typeof t.token?t.token:null);r?!this.token&&s&&this.clear():this.token=s,this.token&&t?.token===this.token&&e(t.user)&&(this.user=t.user)}catch{}try{let e=`bc-session-${encodeURIComponent(t.project)}`,s=location.hostname.match(/^[^.]+\.([^.]+\.(?:workers|pages)\.dev)$/)?.[1];for(let t of new Set(["",this.cookieDomain,s]))void 0!==t&&(document.cookie=`${e}=; Max-Age=0; Path=/${t?`; Domain=${t}`:""}`)}catch{}}options;token=null;user=null;transient=!1;revision;cachedThreads=[];reads=new AbortController;persistenceQueued=!1;persistenceBlocked=!1;key;cookieName;cookieDomain;get sessionKey(){return this.key}get userKey(){return`${this.key}:user`}rememberUser(){try{this.token&&this.user?localStorage.setItem(this.userKey,JSON.stringify({token:this.token,user:this.user})):a(localStorage,this.userKey)}catch{}}cancelReads(){this.reads.abort(),this.reads=new AbortController}async request(e,t="GET",s,i){let n=new URL(e,this.options.endpoint.replace(/\/?$/,"/"));n.searchParams.set("project",this.options.project),n.searchParams.set("repo",this.options.repo),n.searchParams.set("branch",this.options.branch);let a={},h=this.token;h&&(a.Authorization=`Bearer ${h}`),void 0!==s&&(a["Content-Type"]=i??"application/json");let c="GET"===t?this.reads.signal:void 0,l=AbortSignal.timeout(15e3),u=await fetch(n,{method:t,headers:a,body:void 0===s?void 0:i?s:JSON.stringify(s),credentials:"omit",cache:"no-store",signal:c?AbortSignal.any([c,l]):l}).catch(e=>{throw e instanceof TypeError?!1===navigator.onLine?new r(0,"You’re offline.","offline"):new r(0,"Can’t connect to comments.","unreachable"):e});c?.throwIfAborted();let d=await u.json().catch(()=>{if(c?.throwIfAborted(),u.ok)throw o();return{}});if(c?.throwIfAborted(),u.ok&&(!d||"object"!=typeof d||Array.isArray(d)))throw o();if(!u.ok)throw 401===u.status&&h&&this.token===h&&this.clear(),new r(u.status,"site_not_approved"===d?.code?"Comments aren’t turned on for this site yet.":d?.error??"Could not load comments.",d?.code);return d}get listKey(){return`${this.key}:${JSON.stringify([this.options.repo,this.options.branch])}:threads`}cached(){try{let e=JSON.parse(localStorage.getItem(this.listKey)??"null");return e&&(e.threads=s(e.threads,e.authors)),e?.token!==(this.token??"")||!t(e.threads)||void 0!==e.revision&&(!Number.isSafeInteger(e.revision)||e.revision<0)?null:(this.revision=e.revision,this.cachedThreads=e.threads,e.threads)}catch{return null}}persist(){this.persistenceQueued||this.persistenceBlocked||(this.persistenceQueued=!0,queueMicrotask(()=>{this.persistenceQueued=!1;try{let e=Object.create(null),t=[],s=0,o=!1,r=this.options.page?.()??location.pathname,i=[...this.cachedThreads].sort((e,t)=>+(t.page===r)-+(e.page===r));for(let r of i){let i=Object.create(null),n=t=>(t&&(i[t.id]={...e[t.id],...i[t.id],...t}),t?.id??null),a={...r,resolvedBy:n(r.resolvedBy),comments:r.comments.map(e=>({...e,author:n(e.author)}))},h=JSON.stringify(a).length+Object.entries(i).reduce((t,[s,o])=>t+JSON.stringify([s,o]).length-(e[s]?JSON.stringify([s,e[s]]).length:0),0)+2;s+h>25e4?o=!0:(s+=h,Object.assign(e,i),t.push(a))}if(o&&!t.length)return void a(localStorage,this.listKey);localStorage.setItem(this.listKey,JSON.stringify({token:this.token??"",revision:o?void 0:this.revision,threads:t,authors:e}))}catch{this.persistenceBlocked=!0;try{a(localStorage,this.listKey)}catch{}}}))}async list(){let e,i,n=this.token,a=this.reads.signal,h=[],c=0;for(;null!==c;){let l=await this.request(`threads?authors=1&offset=${c}${e?`&cursor=${encodeURIComponent(e)}`:""}${0===c&&void 0!==this.revision?`&revision=${this.revision}`:""}`).catch(e=>{throw e instanceof r&&403===e.status&&this.token===n&&(this.revision=void 0,this.cachedThreads=[],this.persist()),e});if(a.throwIfAborted(),l.threads=s(l.threads,l.authors),!0===l.notModified&&0===c&&void 0!==this.revision)return this.cachedThreads;if(!t(l.threads)||null!=l.nextCursor&&("string"!=typeof l.nextCursor||l.nextCursor.length>200||l.nextCursor===e)||void 0!==l.revision&&(!Number.isSafeInteger(l.revision)||l.revision<0)||null!=l.next&&(!Number.isSafeInteger(l.next)||l.next<=c))throw o();0===c&&(i=l.revision),h.push(...l.threads??[]),e=l.nextCursor??void 0,c=l.next??null}return this.revision=i,this.cachedThreads=h,this.persist(),h}save(e){e.token!==this.token&&(this.cancelReads(),this.revision=void 0,this.cachedThreads=[]),this.token=e.token,this.user=e.user,this.rememberUser();let t=!1;try{localStorage.setItem(this.key,e.token),t=!0}catch{}this.transient=!this.writeCookie(e.token,3456e4)&&!t}writeCookie(e,t){if("https:"!==location.protocol)return;let s="Path=/; SameSite=Lax; Secure";try{return this.cookieDomain&&(document.cookie=`${this.cookieName}=; Max-Age=0; ${s}`),document.cookie=`${this.cookieName}=${e}; Max-Age=${t}; ${s}${this.cookieDomain?`; Domain=${this.cookieDomain}`:""}`,document.cookie.split("; ").includes(`${this.cookieName}=${e}`)}catch{}}clear(){this.cancelReads();try{a(localStorage,this.listKey);let e=n(this.key);for(let t of Object.keys(localStorage))(t.startsWith(`${this.key}:`)||e&&t.startsWith(`${e}:`))&&localStorage.removeItem(t)}catch{}this.revision=void 0,this.cachedThreads=[],this.token=null,this.user=null,this.transient=!1,this.rememberUser(),this.writeCookie("",3456e4);try{a(localStorage,this.key)}catch{}}async restore(){if(!this.token)return;let t=this.token,s=await this.request("me");if(this.token===t){if(!e(s.user))throw o();this.save({token:t,user:s.user})}}async guest(e){this.save(await this.request("auth/guest","POST",{name:e}))}async logout(){let e=this.request("me","DELETE");this.clear(),await e}};export{r as a,i as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-XOMOONGK.js";import{d as t,f as r,g as n,q as o}from"./chunk-4HBBEVFK.js";var i=new WeakMap,l=new WeakMap,s=new WeakMap;function a(e,t){let r=s.get(e.element);if(r?.editor===t)return r.component;let n={id:e.name,name:e.name,source:e.source??"",line:0,props:t.schema},o={definition:n,preview:"adapter",releaseProps:e=>t.release?.(e),subscribe:t.subscribe?.bind(t),get props(){return f(n,t.read())},onChange:e=>t.apply(e),setProps(e){if(!1===t.available?.())throw new Error("This component instance is no longer available.");let r=f(n,e);if(Object.keys(e).some(e=>!(e in r))||n.props.some(e=>"unsupported"!==e.kind&&e.required&&!(e.name in r)))throw new Error("Component props no longer match the editor schema.");t.apply(r)}};return s.set(e.element,{editor:t,component:o}),o}function p(e){let t=r(e)?.currentInspectableElement,n=t?.(e);if(n)return n;let o=s.get(e);if(!o||!1===o.editor.available?.())return null;let i=o.editor.currentElement?.();return i?.isConnected?(i!==e&&s.set(i,o),i):null}function u(e,t){return void 0===t?!e.required:!(!function(e){return void 0===e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e}(t)||"unsupported"===e.kind)&&("string"===e.kind?"string"==typeof t&&t.length<=500:"number"===e.kind?"number"==typeof t&&Number.isFinite(t):"boolean"===e.kind?"boolean"==typeof t:"enum"===e.kind&&(e.values??[]).includes(t))}function f(e,t){let r={};for(let n of e.props){if("unsupported"===n.kind)continue;let e=t[n.name];u(n,e)&&(r[n.name]=e)}return r}function d(e,t,r,n){let o=t.textProp&&t.props.some(e=>e.name===t.textProp&&"string"===e.kind)?t.textProp:void 0,s=f(t,r),a=new Set,p={definition:t,props:s,onChange:n,subscribe:e=>(a.add(e),()=>{a.delete(e)}),setProps(e){let r=f(t,e);if(Object.keys(r).length===Object.keys(e).length){for(let e of t.props)if("unsupported"!==e.kind&&e.required&&!(e.name in r))return;p.props=r,p.onChange(r)}}};return i.set(e,p),e.dataset.paletteInspectable=t.id,o?e.dataset.paletteTextProp=o:delete e.dataset.paletteTextProp,l.set(p,a),()=>{i.get(e)===p&&(i.delete(e),a.clear(),e.dataset.paletteInspectable===t.id&&delete e.dataset.paletteInspectable,e.dataset.paletteTextProp===o&&delete e.dataset.paletteTextProp)}}function c(e,t,r,n){if(!e)return;let o=i.get(e);if(!o||o.definition.id!==t.id)return;o.definition=t,o.props=f(t,r),o.onChange=n;let s=t.textProp&&t.props.some(e=>e.name===t.textProp&&"string"===e.kind)?t.textProp:void 0;s?e.dataset.paletteTextProp=s:delete e.dataset.paletteTextProp,l.get(o)?.forEach(e=>e())}function m(e){let t=r(e)?.inspectableFor,n=t?.(e);if(n)return n;let o=e&&i.get(e);if(o&&e.getAttribute("data-palette-inspectable")===o.definition.id)return o;let l=e&&s.get(e);return l&&!1!==l.editor.available?.()?l.component:null}function h(e){for(let t=e?.parentElement;t;t=t.parentElement){let e=m(t);if(e)return{root:t,component:e}}return null}n({inspectableFor:m,currentInspectableElement:p});var g=new Set,y=new WeakMap,k=new WeakMap,b=new WeakMap,P={color:new Set(["color","background-color","border-color"]),dimension:new Set(["gap","padding","margin","border-radius","font-size","width","height"]),fontFamily:new Set(["font-family"]),fontWeight:new Set(["font-weight"]),lineHeight:new Set(["line-height"])};function v(e,t){if(t.length>100||t.some(e=>!function(e){return!!e&&"string"==typeof e.path&&e.path.length<=160&&/^--[a-zA-Z0-9_-]+$/.test(e.cssVariable)&&!!P[e.type]&&Array.isArray(e.properties)&&e.properties.length>0&&e.properties.every(t=>P[e.type].has(t))&&"string"==typeof e.impactSelector&&e.impactSelector.length<=200}(e)))throw new Error("Palette design tokens must use supported, explicit CSS-variable metadata");let r=new Set(t.map(e=>e.path)),n=new Set(t.map(e=>e.cssVariable));if(r.size!==t.length||n.size!==t.length)throw new Error("Palette design token paths and CSS variables must be unique");for(let r of t)e.querySelectorAll(r.impactSelector);let o={root:e,tokens:t.map(e=>({...e,properties:[...e.properties]})),themeEdits:new Map,elementOriginals:new Map,elementBindings:new Map,previousMarker:e.getAttribute("data-palette-design-tokens")};return y.set(e,o),g.add(o),b.set(o,[]),e.setAttribute("data-palette-design-tokens",String(t.length)),()=>{if(y.get(e)===o){for(let[t,r]of o.themeEdits){let n=o.tokens.find(e=>e.path===t);n&&(r.inlineBefore?e.style.setProperty(n.cssVariable,r.inlineBefore):e.style.removeProperty(n.cssVariable))}for(let[e,t]of o.elementOriginals)for(let[r,n]of t)n.value?e.style.setProperty(r,n.value,n.priority):e.style.removeProperty(r);o.elementBindings.clear(),g.delete(o),y.delete(e),null===o.previousMarker?e.removeAttribute("data-palette-design-tokens"):e.setAttribute("data-palette-design-tokens",o.previousMarker)}}}function w(){let e=r(t())?.tokenSources;return e?e():g}function V(e){if(!e)return null;let t=r(e)?.tokenSourceFor;if(t)return t(e);let n=null;for(let t of g){let r=o(t.root,e.ownerDocument);r&&(r===e||r.contains(e))&&(!n||n.root.contains(t.root))&&(n=t)}return n}function B(e,t){return e.root.ownerDocument.defaultView?.getComputedStyle(e.root).getPropertyValue(t.cssVariable).trim()??""}function S(e,t){try{return e.root.querySelectorAll(t.impactSelector).length}catch{return 0}}function E(e,t,r){if(!r||r.length>160||/[{};]/.test(r)||/(?:url|expression)\s*\(/i.test(r))return!1;let n=e.root.ownerDocument.defaultView?.CSS;return!n?.supports||t.properties.some(e=>n.supports(e,r))}function $(e,t,r,n=!1){if(!e.tokens.some(e=>e===t||e.path===t.path)||!E(e,t,r))return!1;let o=B(e,t),i=e.themeEdits.get(t.path),l=e.root.style.getPropertyValue(t.cssVariable),s=i?.inlineBefore??l,a=b.get(e)??[];if(o===r)return!0;e.root.style.setProperty(t.cssVariable,r),r===(i?.before??o)?e.themeEdits.delete(t.path):e.themeEdits.set(t.path,{before:i?.before??o,after:r,inlineBefore:s});let p=a.at(-1);return n&&"theme"===p?.kind&&p.token.path===t.path?r===p.before?a.pop():p.after=r:a.push({kind:"theme",source:e,token:t,before:o,after:r,inlineBefore:l}),b.set(e,a),!0}function M(e){for(let t of w())for(let[r,n]of t.themeEdits){let o=t.tokens.find(e=>e.path===r)?.cssVariable;if(!o)continue;let i=e?n.inlineBefore:n.after;i?t.root.style.setProperty(o,i):t.root.style.removeProperty(o)}}function x(e,t){let r=e.themeEdits.get(t.path),n=b.get(e)??[],o=n.find(e=>"theme"===e.kind&&e.token.path===t.path),i=r?.inlineBefore??("theme"===o?.kind?o.inlineBefore:void 0);void 0!==i&&(i?e.root.style.setProperty(t.cssVariable,i):e.root.style.removeProperty(t.cssVariable),e.themeEdits.delete(t.path),b.set(e,n.filter(e=>"theme"!==e.kind||e.token.path!==t.path)))}function A(e,t,r,n,o={}){if(!e.tokens.some(e=>e.path===r.path)||!r.properties.includes(n))return!1;let i=e.elementOriginals.get(t);i||e.elementOriginals.set(t,i=new Map),i.has(n)||i.set(n,{value:t.style.getPropertyValue(n),priority:t.style.getPropertyPriority(n)});let l=t.style.getPropertyValue(n),s=t.style.getPropertyPriority(n),a=`var(${r.cssVariable})`,p=e.elementBindings.get(t);p||e.elementBindings.set(t,p=new Map);let u=p.get(n);if(p.set(n,{tokenPath:r.path,initialValue:u?.initialValue??l,initialPriority:u?.initialPriority??s,mode:"token",declaredPath:u?u.declaredPath:W(e,t,n)?.token.path}),t.style.setProperty(n,a,s),!1===o.recordHistory)return!0;let f={kind:"element",element:t,property:n,before:l,priority:s,after:a},d=b.get(e)??[];d.push(f),b.set(e,d);let c=k.get(t)??[];return c.push(f),k.set(t,c),!0}function O(e,t,r,n){let o=e.elementBindings.get(t),i=o?.get(r);if(!i){let n=W(e,t,r);if(!n)return;o||e.elementBindings.set(t,o=new Map),i={tokenPath:n.token.path,initialValue:t.style.getPropertyValue(r),initialPriority:t.style.getPropertyPriority(r),mode:"custom",declaredPath:n.token.path},o.set(r,i)}i.mode="custom",i.customValue=n}function T(e,t,r){let n=e.elementBindings.get(t)?.get(r);if(!n)return;let o=t.style.getPropertyValue(r);o!==n.initialValue||t.style.getPropertyPriority(r)!==n.initialPriority?e.tokens.find(e=>e.path===n.tokenPath&&e.properties.includes(r)&&o===`var(${e.cssVariable})`)?(n.mode="token",delete n.customValue):(n.mode="custom",n.customValue=o):e.elementBindings.get(t)?.delete(r)}function C(e,t,r){let n=e.elementBindings.get(t)?.get(r);return n?{...n}:null}var z={"background-color":["background"],"border-color":["border"],"font-family":["font"],"font-size":["font"],"font-weight":["font"],"line-height":["font"]};function q(e,t,r,n){let o=[...r.matchAll(/var\(\s*(--[\w-]+)/g)].map(e=>e[1]);if(!o.length||n&&!/^var\(\s*--[\w-]+\s*(?:,[^;{}]*)?\)$/.test(r.trim()))return;let i=e.tokens.filter(e=>e.properties.includes(t)&&o.includes(e.cssVariable));return 1===i.length?i[0]:void 0}function F(e){let t=e.replace(/:(?:where)\([^)]*\)/g,"").replace(/"[^"]*"|'[^']*'/g,"");return 1e4*(t.match(/#[\w-]+/g)?.length??0)+100*(t.match(/\.[\w-]+|\[[^\]]*\]|:(?!:)[\w-]+/g)?.length??0)+(t.match(/(?:^|[\s>+~(])[a-z][\w-]*/gi)?.length??0)}function j(e){let t=[],r=0,n=0;for(let o=0;o<e.length;o++){let i=e[o];"("===i||"["===i?r++:")"===i||"]"===i?r--:","===i&&0===r&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t.map(e=>e.trim()).filter(Boolean)}function W(e,t,r,n=t.style.getPropertyValue(r),o=t.style.getPropertyPriority(r)){let i=t.ownerDocument.defaultView,l=null,s=0,a=e=>{for(let n of e){s++;let e=n.media;if(e&&i?.matchMedia&&e.mediaText&&!i.matchMedia(e.mediaText).matches)continue;let o=n.style,p=n.selectorText;if(o&&p)for(let e of[r,...z[r]??[]]){let r=o.getPropertyValue(e).trim();if(!r)continue;let n=-1;for(let e of j(p))try{t.matches(e)&&(n=Math.max(n,F(e)))}catch{}if(!(n<0)){n+=o.getPropertyPriority(e)?1e9:0,(!l||n>l.rank||n===l.rank&&s>=l.order)&&(l={value:r,property:e,rank:n,order:s});break}}let u=n.cssRules;u&&!o&&a(u)}};for(let e of t.ownerDocument.styleSheets)try{e.disabled||a(e.cssRules)}catch{}let p=l;if(n&&(!(p&&p.rank>=1e9)||o)){let t=q(e,r,n,!0);return t?{token:t,origin:"inline"}:null}if(!p)return null;let u=q(e,r,p.value,p.property===r);return u?{token:u,origin:"stylesheet"}:null}function D(e,t,r){let n=e.elementBindings.get(t)?.get(r),o=e.elementOriginals.get(t)?.get(r),i=n?.initialValue??o?.value??"",l=n?.initialPriority??o?.priority??"";i?t.style.setProperty(r,i,l):t.style.removeProperty(r),e.elementBindings.get(t)?.delete(r)}function I(e,t){return e.tokens.filter(e=>e.properties.includes(t))}function H(e){let t=V(e);return!!t&&(t.themeEdits.size>0||!!k.get(e)?.length||!!t.elementBindings.get(e)?.size)}function N(e){let t=V(e);return!!t&&!!b.get(t)?.length}function K(e){let t=V(e),r=t&&b.get(t)?.pop();if(!t||!r)return;if("theme"===r.kind){r.inlineBefore?t.root.style.setProperty(r.token.cssVariable,r.inlineBefore):t.root.style.removeProperty(r.token.cssVariable);let e=t.themeEdits.get(r.token.path);if(e&&e.after===r.after)e.before===r.before?t.themeEdits.delete(r.token.path):t.themeEdits.set(r.token.path,{...e,after:r.before});else if(!e){let e=b.get(t).find(e=>"theme"===e.kind&&e.token.path===r.token.path);t.themeEdits.set(r.token.path,{before:r.after,after:r.before,inlineBefore:("theme"===e?.kind?e:r).inlineBefore})}return}r.before?r.element.style.setProperty(r.property,r.before,r.priority):r.element.style.removeProperty(r.property);let n=k.get(r.element)??[];n.pop(),n.length||k.delete(r.element)}function R(e){let t=V(e);if(!t)return;for(let[e,r]of t.themeEdits){let n=t.tokens.find(t=>t.path===e);n&&(r.inlineBefore?t.root.style.setProperty(n.cssVariable,r.inlineBefore):t.root.style.removeProperty(n.cssVariable))}t.themeEdits.clear();let r=t.elementOriginals.get(e);for(let[t,n]of r??[])n.value?e.style.setProperty(t,n.value,n.priority):e.style.removeProperty(t);t.elementOriginals.delete(e),t.elementBindings.delete(e),k.delete(e),b.set(t,(b.get(t)??[]).filter(t=>"element"===t.kind&&t.element!==e))}function G(){for(let e of new Set([...g,...w()])){for(let t of[e.root,...e.elementOriginals.keys(),...e.elementBindings.keys()])R(t);b.set(e,[])}}function X(e){let t=V(e);if(!t)return;let r=[];for(let[n,o]of t.elementBindings.get(e)??[]){let e=t.tokens.find(e=>e.path===o.tokenPath&&e.properties.includes(n));if(!e)continue;let i=t.tokens.find(e=>e.path===o.declaredPath),l=i?`var(${i.cssVariable}) [${i.path}]`:o.initialValue||"(unset)";"token"===o.mode?i!==e&&r.push(`Element ${n}: ${l} → var(${e.cssVariable}) [${e.path}]${i?" [rebind]":""}`):r.push(`Element ${n}: ${l} → ${o.customValue||"(unset)"} [${i?"custom override":"custom value"}]`)}for(let n of k.get(e)??[]){if("element"!==n.kind||t.elementBindings.get(e)?.has(n.property))continue;let o=t.tokens.find(e=>n.after===`var(${e.cssVariable})`);o&&r.push(`Element ${n.property}: ${n.before||"(unset)"} → var(${o.cssVariable}) [${o.path}]`)}for(let[e,n]of t.themeEdits){let o=t.tokens.find(t=>t.path===e);o&&r.push(`Shared theme ${e} (${o.cssVariable}): ${n.before} → ${n.after}; preview scope ${o.impactSelector} (${S(t,o)} matching elements)`)}return r.length?["Proposed design-token changes (preview only)",...r,"Token references are preserved for element assignments; refresh resets previews."].join("\n"):void 0}function Z(){return{id:"css-variables",list:()=>[...w()].flatMap(e=>e.tokens.map(t=>function(e,t){return{path:t.path,type:t.type,value:B(e,t),properties:[...t.properties],group:t.path.split(".")[0],ref:t.cssVariable,cssVariable:t.cssVariable}}(e,t))),resolve(t){let r=V(t),n={};if(!r||!e(t))return n;let o=t.ownerDocument.defaultView?.getComputedStyle(t);for(let e of new Set(r.tokens.flatMap(e=>e.properties))){let i=W(r,t,e);n[e]=i?{path:i.token.path}:{offToken:o?.getPropertyValue(e).trim()??""}}return n},preview(t,r,n){let o=V(t),i=o?.tokens.find(e=>e.path===n.path);if(!o||!i||!e(t))return()=>{};let l=t.style.getPropertyValue(r),s=t.style.getPropertyPriority(r);return A(o,t,i,r,{recordHistory:!1}),()=>{l?t.style.setProperty(r,l,s):t.style.removeProperty(r),T(o,t,r)}},describe:(e,t,r,n)=>`Set ${t} to var(${n.ref})`,previewValues(e,t,r){let n=[];for(let i of e)if(!i.theme||i.theme===t)for(let e of w()){let t=e.tokens.find(e=>e.path===i.path),l=i.alias&&e.tokens.find(e=>e.path===i.alias),s=l?`var(${l.cssVariable})`:i.value;if(!t||!E(e,t,s))continue;let a=r?o(e.root,r.document):e.root;if(!a?.style)continue;let p=a.hasAttribute("style"),u=a.style.getPropertyValue(t.cssVariable),f=a.style.getPropertyPriority(t.cssVariable);a.style.setProperty(t.cssVariable,s,"important"),n.unshift(()=>{u?a.style.setProperty(t.cssVariable,u,f):a.style.removeProperty(t.cssVariable),!p&&!a.getAttribute("style")&&a.removeAttribute("style")})}return()=>{for(let e of n.splice(0))e()}}}}n({tokenSourceFor:V,tokenSources:()=>g});export{a,p as b,u as c,d,c as e,m as f,h as g,v as h,V as i,B as j,S as k,$ as l,M as m,x as n,A as o,O as p,T as q,C as r,W as s,D as t,I as u,H as v,N as w,K as x,R as y,G as z,X as A,Z as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,h as t}from"./chunk-4FX5IS2U.js";import{a as r}from"./chunk-XOMOONGK.js";import{e as n}from"./chunk-
|
|
1
|
+
import{f as e,h as t}from"./chunk-4FX5IS2U.js";import{a as r}from"./chunk-XOMOONGK.js";import{e as n}from"./chunk-4HBBEVFK.js";var o=new Set("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen transparent".split(" ")),a=new Map,l=new Map,i=new WeakMap,s=new WeakMap,u=new Map,p=new WeakMap,d=new WeakMap,f=!1;function c(e,t){let r=l.get(e);r?.delete(t),r?.size||l.delete(e)}function g(t,n,u,p,d){let f=i.get(t);if(f||i.set(t,f=new Map),(!f.has(n)||!a.has(t)&&!l.has(t))&&(f.set(n,u),r(t))){let r=s.get(t);r||s.set(t,r=new Map);let a=e(t,n),l=a.value.trim().toLowerCase(),i=/^(?:inherit|initial|unset|revert(?:-layer)?|currentcolor|context-fill|context-stroke)$|%|\b(?:var|env|attr|calc|min|max|clamp|color-mix|light-dark|anchor|anchor-size)\(|\(\s*from\b|\d(?:r?(?:em|ex|ch|cap|ic|lh)|[sld]?v(?:w|h|i|b|min|max)|cq(?:w|h|i|b|min|max))\b/.test(l),u=!!l&&!i&&(o.has(l)||j(l)===j(a.computed)),d=r.get(n);if(d?.adapter===p)d.original=a,d.concrete=u;else{let e={adapter:p,original:a,concrete:u,style:a,token:void 0};e.style={get value(){let r=e.original;if(!e.concrete||!e.token)return r.value;let o=t.ownerDocument.createElement("span").style;return o.setProperty(n,e.token.value),o.getPropertyValue(n)||r.value},get priority(){return e.original.priority},get absent(){return e.original.absent},get computed(){return e.token?.value??e.original.computed},restore(){let r=e.original;r.restore(),e.concrete&&e.token&&j(e.token.value)!==j(r.value)&&t.style.setProperty(n,e.token.value,r.priority)}},r.set(n,e)}}return m(t,p,d),f.get(n)}function h(e,t){return e?i.get(e)?.get(t):void 0}function m(e,t,r,n){let o=n&&new Set(n);for(let[n,a]of s.get(e)??[]){if(a.adapter!==t)continue;let l=h(e,n);a.token=l&&"path"in l?r.find(e=>e.path===l.path):void 0,a.token&&o?.has(n)&&a.style.restore()}}function y(e,t,r){if(l.get(e)?.has(t))return{offToken:getComputedStyle(e).getPropertyValue(t).trim()};let n=T(e,t);return n?{path:n.path}:r}function k(e,t){if(!i.get(e)?.has(t))return;let r=l.get(e),n=r?.has(t)??!1,o=i.get(e)?.get(t),a=!!T(e,t)||!!o&&"path"in o;return r||l.set(e,r=new Set),r.add(t),{priority:"important",...n?{}:{undo:()=>{c(e,t),a&&!f&&(C(!0),C(!1))}}}}function b(e,t){return s.get(e)?.get(t)?.style??a.get(e)?.find(e=>e.property===t)?.inline}function v(e){let t={};for(let r of e?.themes??[])try{t[r.id]=r.current(n())}catch{}return t}function w(e,t,r,o){if(function(e,t,r){if(e?.subscribe&&!r.aborted){p.delete(e);try{let n=e.subscribe(()=>{let r=d.get(e)??p.get(e);d.set(e,r),queueMicrotask(()=>d.delete(e)),p.delete(e),Promise.all([...r??[]].map(([t,r])=>Promise.all([r,$(e,Object.fromEntries(JSON.parse(t)))]).then(([e,t])=>JSON.stringify(e)===JSON.stringify(t)))).then(e=>e.length&&e.every(Boolean)||t(),t)});r.addEventListener("abort",()=>{try{n()}catch{}},{once:!0})}catch{}}}(e?.tokens,r,o),o.aborted||!e?.themes?.length)return;let a=JSON.stringify(v(e)),l=()=>{let t=JSON.stringify(v(e));t===a||o.aborted||(a=t,r())},i=[],s=!1;for(let t of e.themes)try{t.subscribe?i.push(t.subscribe(l)):s=!0}catch{s=!0}let u=s?new MutationObserver(l):void 0,f=n().document;u?.observe(f.documentElement,{attributes:!0}),f.body&&u?.observe(f.body,{attributes:!0}),o.addEventListener("abort",()=>{u?.disconnect();for(let e of i)e()},{once:!0})}function $(e,t={}){let r=p.get(e);r||p.set(e,r=new Map);let n=JSON.stringify(Object.entries(t).sort()),o=r.get(n);return o||(o=Promise.resolve().then(()=>e.list(Object.keys(t).length?t:void 0)).then(e=>Array.isArray(e)?e.filter(e=>e&&"string"==typeof e.path):[]),o.catch(()=>r.delete(n)),r.set(n,o)),o}function M(e,t){return Promise.resolve().then(()=>e.resolve(t)).then(e=>e??{},()=>({}))}function S(e,t){return e.filter(e=>e.properties?.includes(t))}function j(e){let t,r=e.trim().toLowerCase().replace(/\s+/g," "),n=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/.exec(r)?.[1];if(n)t=(n.length<5?[...n].map(e=>e+e).join(""):n).match(/../g).map((e,t)=>parseInt(e,16)/(t>2?255:1));else{let e=/^rgba?\(([^)]*)\)$/.exec(r)?.[1].split(/\s*[,/]\s*|\s+/);e&&(3===e.length||4===e.length)&&e.every(e=>/^[\d.]+%?$/.test(e))&&(t=e.map((e,t)=>parseFloat(e)*(e.endsWith("%")?t>2?.01:2.55:1)))}if(!t)return r.replace(/\s*,\s*/g,",");let[o,a,l,i=1]=t.map((e,t)=>t>2?+e.toFixed(2):Math.round(e));return 1===i?`rgb(${o},${a},${l})`:`rgba(${o},${a},${l},${i})`}function O(e,t){let r=j(t);return r?e.find(e=>"string"==typeof e.value&&j(e.value)===r):void 0}function q(e){return e.label||e.path}function x(e,t=e.value,r){return[e.path,e.ref,t,r,e.states?.length?`States: ${e.states.join(", ")}`:"",e.description].filter(Boolean).join(" · ")}function P(){let e=document.createElement("span");return e.className="design-token-off",e.setAttribute("role","img"),e}function E(e,t,r){e.title=`Not from a token · ${t||"unset"}${r?` · matches ${q(r)}`:""}`,e.setAttribute("aria-label",e.title)}function N(n,o,a,l){let i=r(o)?e(o,a):void 0;try{r(o)&&o.style.setProperty(a,"");let e=n.preview?n.preview(o,a,l):t(o,a,l.value),s=!0;return()=>{s&&(s=!1,e?.(),i?.restore())}}catch{throw i?.restore(),new Error("This token could not be previewed.")}}function T(e,t){if(!l.get(e)?.has(t))return[...a.get(e)??[]].reverse().find(e=>e.property===t)?.token}function B(t,n,o,i,s,u){let p=a.get(n);p||a.set(n,p=[]);let d=p.find(e=>e.property===o),f=r(n)?e(n,o):void 0,g=l.get(n)?.has(o)??!1,h=N(t,n,o,i);return c(n,o),p.push({adapter:t,property:o,token:i,from:d?.from??s,fromToken:d?d.fromToken:u,undo:h,inline:f,customBefore:g}),()=>A(n)}function A(e){let t=a.get(e),r=t?.pop();if(r?.undo(),r?.customBefore){let t=l.get(e);t||l.set(e,t=new Set),t.add(r.property)}else r&&c(e,r.property);t&&!t.length&&a.delete(e)}function J(e){return!!a.get(e)?.length}function z(e){return!!l.get(e)?.size}function W(e){for(;a.has(e);)A(e);l.delete(e)}function F(){for(let e of[...a.keys()])W(e);l.clear(),u.clear()}function L(e){return[...new Set(a.get(e)?.map(e=>e.property))].filter(t=>!l.get(e)?.has(t))}function C(t){if(t!==f){f=t,t&&(u=new Map([...l].flatMap(([t,n])=>r(t)?[[t,new Map([...n].map(r=>[r,e(t,r)]))]]:[])));for(let[n,o]of a)if(t)for(let e of[...o].reverse())e.undo();else for(let t of o)t.customBefore&&t.inline?.restore(),r(n)&&(t.inline=e(n,t.property)),t.undo=N(t.adapter,n,t.property,t.token);if(!t){for(let e of u.values())for(let t of e.values())t.restore();u.clear()}}}function V(e,t){let r=f;r||C(!0);for(let r of new Set([...a.keys(),...l.keys()])){let n=[...(a.get(r)??[]).filter(t=>t.adapter===e).map(e=>e.property),...l.get(r)??[]];m(r,e,t,n)}for(let r of a.values())for(let n of r)n.adapter===e&&(n.token=t.find(e=>e.path===n.token.path)??n.token,"path"in n.from&&(n.fromToken=t.find(e=>e.path===n.from.path)));r||C(!1)}function I(e,t){try{let r=t.adapter.describe?.(e,t.property,t.from,t.token);return r?String(r).replace(/\s+/g," ").replace(/→/g,"->").trim().slice(0,300):void 0}catch{return}}function K(e){let t=[],r=new Set;for(let n of function(e){let t=new Map;for(let r of a.get(e)??[])t.set(r.property,r);return[...t.values()].filter(t=>!(l.get(e)?.has(t.property)||"path"in t.from&&t.from.path===t.token.path))}(e)){r.add(n.adapter.id);let o="path"in n.from?`${n.fromToken?.value?`${n.fromToken.value} `:""}[${n.from.path}]`:n.from.offToken||"(unset)";t.push(`Element ${n.property}: ${o} → ${n.token.value} [${n.token.path}]`);let a=I(e,n);a&&t.push(`Apply: ${a}`)}if(t.length)return["Proposed design-token changes (preview only)",...t,`Token adapter: ${[...r].join(", ")}`].join("\n")}export{g as a,h as b,m as c,y as d,k as e,b as f,v as g,w as h,$ as i,M as j,S as k,O as l,q as m,x as n,P as o,E as p,N as q,T as r,B as s,J as t,z as u,W as v,F as w,L as x,C as y,V as z,K as A};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,e,o,r={left:0,top:0,right:innerWidth,bottom:innerHeight}){let n=Math.max(0,r.left,e.left),i=Math.max(r.top,e.top),s=Math.min(r.right,e.right),l=Math.min(r.bottom,e.bottom);if(s<=n||l<=i)return!1;let d="0px";if(o){let t=getComputedStyle(o),r=parseFloat(t.width);if("border-box"!==t.boxSizing)for(let e of["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"])r+=parseFloat(t[e])||0;(!r||"inline"===t.display)&&(r=o.offsetWidth);let n=r?(e.right-e.left)/r:1;d=t.borderRadius.replace(/([+-]?[\d.]+(?:e[+-]?\d+)?)px/gi,(t,e)=>+e*n+"px");let i=e=>!["none","hidden"].includes(t.getPropertyValue(`${e}-style`))&&parseFloat(t.getPropertyValue(`${e}-width`))>0&&a(t.getPropertyValue(`${e}-color`));!/[1-9]/.test(d)&&!a(t.backgroundColor)&&(!t.backgroundImage||"none"===t.backgroundImage)&&!["border-top","border-right","border-bottom","border-left","outline"].some(i)&&(d=4*n+"px")}return Object.assign(t.style,{left:`${e.left}px`,top:`${e.top}px`,width:e.right-e.left+"px",height:e.bottom-e.top+"px",borderRadius:d,clipPath:`inset(${Math.max(r.top-e.top,-4)}px ${Math.max(e.right-r.right,-4)}px ${Math.max(e.bottom-r.bottom,-4)}px ${Math.max(Math.max(0,r.left)-e.left,-4)}px)`}),!0}function e(t,e,a,n,i){function s(){p||n.aborted||!e().some(Boolean)||(p=l.requestAnimationFrame(()=>{p=0,a();for(let t of e())for(let e=t;e?.isConnected;e=e.parentElement)if(e.getAnimations?.().some(t=>"running"===t.playState))return void s()}))}if(n.aborted)return;let l=t.ownerDocument.defaultView,d="style,link[rel~=stylesheet]",m=t=>o(t)?t.matches(d)||!!t.closest("style"):!!t.parentElement?.closest("style"),p=0,c=o=>o!==t&&!t.contains(o)&&e().some(t=>t&&(!t.isConnected||o.contains(t)||t.contains(o)||m(o))),h=(t,r)=>{let a=new MutationObserver(t=>{if(!e().some(Boolean))return;let r=e()[0];r&&!r.isConnected&&i?.(),t.some(t=>c(t.target)||"attributes"===t.type&&"rel"===t.attributeName&&"LINK"===t.target.nodeName||"childList"===t.type&&[...t.addedNodes,...t.removedNodes].some(t=>o(t)&&(t.matches(d)||t.querySelector(d))))&&s()});a.observe(t.documentElement,{attributes:!0,childList:!0,characterData:!0,subtree:!0});for(let e of["transitionrun","animationstart"])t.addEventListener(e,t=>{o(t.target)&&c(t.target)&&s()},{capture:!0,signal:r});t.addEventListener("load",t=>{o(t.target)&&m(t.target)&&s()},{capture:!0,signal:r}),r.addEventListener("abort",()=>a.disconnect(),{once:!0})};h(t.ownerDocument,n),r(h,n),n.addEventListener("abort",()=>l.cancelAnimationFrame(p),{once:!0})}import{i as o,s as r}from"./chunk-
|
|
1
|
+
function t(t,e,o,r={left:0,top:0,right:innerWidth,bottom:innerHeight}){let n=Math.max(0,r.left,e.left),i=Math.max(r.top,e.top),s=Math.min(r.right,e.right),l=Math.min(r.bottom,e.bottom);if(s<=n||l<=i)return!1;let d="0px";if(o){let t=getComputedStyle(o),r=parseFloat(t.width);if("border-box"!==t.boxSizing)for(let e of["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"])r+=parseFloat(t[e])||0;(!r||"inline"===t.display)&&(r=o.offsetWidth);let n=r?(e.right-e.left)/r:1;d=t.borderRadius.replace(/([+-]?[\d.]+(?:e[+-]?\d+)?)px/gi,(t,e)=>+e*n+"px");let i=e=>!["none","hidden"].includes(t.getPropertyValue(`${e}-style`))&&parseFloat(t.getPropertyValue(`${e}-width`))>0&&a(t.getPropertyValue(`${e}-color`));!/[1-9]/.test(d)&&!a(t.backgroundColor)&&(!t.backgroundImage||"none"===t.backgroundImage)&&!["border-top","border-right","border-bottom","border-left","outline"].some(i)&&(d=4*n+"px")}return Object.assign(t.style,{left:`${e.left}px`,top:`${e.top}px`,width:e.right-e.left+"px",height:e.bottom-e.top+"px",borderRadius:d,clipPath:`inset(${Math.max(r.top-e.top,-4)}px ${Math.max(e.right-r.right,-4)}px ${Math.max(e.bottom-r.bottom,-4)}px ${Math.max(Math.max(0,r.left)-e.left,-4)}px)`}),!0}function e(t,e,a,n,i){function s(){p||n.aborted||!e().some(Boolean)||(p=l.requestAnimationFrame(()=>{p=0,a();for(let t of e())for(let e=t;e?.isConnected;e=e.parentElement)if(e.getAnimations?.().some(t=>"running"===t.playState))return void s()}))}if(n.aborted)return;let l=t.ownerDocument.defaultView,d="style,link[rel~=stylesheet]",m=t=>o(t)?t.matches(d)||!!t.closest("style"):!!t.parentElement?.closest("style"),p=0,c=o=>o!==t&&!t.contains(o)&&e().some(t=>t&&(!t.isConnected||o.contains(t)||t.contains(o)||m(o))),h=(t,r)=>{let a=new MutationObserver(t=>{if(!e().some(Boolean))return;let r=e()[0];r&&!r.isConnected&&i?.(),t.some(t=>c(t.target)||"attributes"===t.type&&"rel"===t.attributeName&&"LINK"===t.target.nodeName||"childList"===t.type&&[...t.addedNodes,...t.removedNodes].some(t=>o(t)&&(t.matches(d)||t.querySelector(d))))&&s()});a.observe(t.documentElement,{attributes:!0,childList:!0,characterData:!0,subtree:!0});for(let e of["transitionrun","animationstart"])t.addEventListener(e,t=>{o(t.target)&&c(t.target)&&s()},{capture:!0,signal:r});t.addEventListener("load",t=>{o(t.target)&&m(t.target)&&s()},{capture:!0,signal:r}),r.addEventListener("abort",()=>a.disconnect(),{once:!0})};h(t.ownerDocument,n),r(h,n),n.addEventListener("abort",()=>l.cancelAnimationFrame(p),{once:!0})}import{i as o,s as r}from"./chunk-4HBBEVFK.js";var a=t=>t&&"transparent"!==t&&!/(?:^rgba\([^)]*,|\/)\s*0(?:\.0+)?%?\s*\)$/.test(t);export{t as a,e as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="data-palette-still",t=`:is([${e}],[${e}] *),:is([${e}],[${e}] *)::before,:is([${e}],[${e}] *)::after{transition:none!important}`,n=new Map,o=new Map,i=e=>e.getAnimations?.({subtree:!0})??[];function r(e,n,i){let r=e;if(!r.adoptedStyleSheets)return;let a=o.get(e);try{if(i&&!a){let i=new(n.ownerDocument.defaultView??window).CSSStyleSheet;i.replaceSync(t),o.set(e,a={sheet:i,count:0}),r.adoptedStyleSheets=[...r.adoptedStyleSheets,i]}if(!a||(a.count+=i?1:-1,a.count))return;o.delete(e),r.adoptedStyleSheets=r.adoptedStyleSheets.filter(e=>e!==a.sheet)}catch{}}function a(e,t){e.getBoundingClientRect();for(let n of i(e))if(!t.seen.has(n)&&Number.isFinite(n.effect?.getComputedTiming().endTime))try{n.finish()}catch{}}function s(t){let o=n.get(t);o?cancelAnimationFrame(o.frame):(n.set(t,o={count:0,root:t.getRootNode(),seen:new Set(i(t))}),t.setAttribute(e,""),r(o.root,t,!0));let s=o;s.count++,requestAnimationFrame(()=>{n.get(t)===s&&a(t,s)});let l=!0;return()=>{l&&(l=!1,! --s.count&&(s.frame=requestAnimationFrame(()=>s.frame=requestAnimationFrame(()=>{s.count||n.get(t)!==s||(a(t,s),n.delete(t),t.removeAttribute(e),r(s.root,t,!1))}))))}}function l(e,t){let n,o=e?s(e):()=>{};try{n=t()}catch(e){throw o(),e}return()=>{try{n?.()}finally{o()}}}export{e as a,s as b,l as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){let i=n("details","comment-menu"),o=n("summary","icon");o.setAttribute("aria-label",e),o.setAttribute("aria-haspopup","menu"),o.setAttribute("aria-expanded","false"),o.title=e,o.append(r("more"));let l=n("div","comment-menu-items");l.popover="manual",l.setAttribute("role","menu"),l.setAttribute("aria-label",e);let s=t.map(e=>{let t=a(e.label,()=>{i.open=!1,o.focus({preventScroll:!0}),e.onSelect()},"menu-action"+(e.destructive?" destructive":""),e.icon);return t.append(n("span","",e.label)),t.setAttribute("role","menuitem"),t.tabIndex=-1,l.append(t),t});return i.addEventListener("toggle",()=>{if(o.setAttribute("aria-expanded",String(i.open)),i.open){l.showPopover();let e=o.getBoundingClientRect();l.style.left=`${Math.max(8,Math.min(e.right-l.offsetWidth,innerWidth-l.offsetWidth-8))}px`,l.style.top=`${Math.max(8,Math.min(e.bottom+6,innerHeight-l.offsetHeight-8))}px`,(s.find(e=>"true"===e.getAttribute("aria-checked"))??s[0])?.focus({preventScroll:!0})}else l.hidePopover()}),i.addEventListener("keydown",e=>{if(!i.open)return;let t,n=s.indexOf(e.target);"ArrowDown"===e.key&&(t=(n+1)%s.length),"ArrowUp"===e.key&&(t=(n-1+s.length)%s.length),"Home"===e.key&&(t=0),"End"===e.key&&(t=s.length-1),void 0!==t&&(e.preventDefault(),s[t]?.focus()),"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),i.open=!1,o.focus({preventScroll:!0})),"Tab"===e.key&&(i.open=!1)}),i.append(o,l),i}function t(t,a,i,o){let l=e(t,a.map(([e,t])=>({label:t,icon:"check",onSelect:()=>o(e)})));l.classList.add("selection-menu");let s=l.querySelector("summary");return s.className="selection-trigger",s.replaceChildren(n("span","selection-label",a.find(([e])=>e===i)?.[1]),r("chevron")),l.querySelectorAll("[role=menuitem]").forEach((e,t)=>{e.setAttribute("role","menuitemradio"),e.setAttribute("aria-checked",String(a[t][0]===i))}),l}import{E as n,F as r,G as a}from"./chunk-
|
|
1
|
+
function e(e,t){let i=n("details","comment-menu"),o=n("summary","icon");o.setAttribute("aria-label",e),o.setAttribute("aria-haspopup","menu"),o.setAttribute("aria-expanded","false"),o.title=e,o.append(r("more"));let l=n("div","comment-menu-items");l.popover="manual",l.setAttribute("role","menu"),l.setAttribute("aria-label",e);let s=t.map(e=>{let t=a(e.label,()=>{i.open=!1,o.focus({preventScroll:!0}),e.onSelect()},"menu-action"+(e.destructive?" destructive":""),e.icon);return t.append(n("span","",e.label)),t.setAttribute("role","menuitem"),t.tabIndex=-1,l.append(t),t});return i.addEventListener("toggle",()=>{if(o.setAttribute("aria-expanded",String(i.open)),i.open){l.showPopover();let e=o.getBoundingClientRect();l.style.left=`${Math.max(8,Math.min(e.right-l.offsetWidth,innerWidth-l.offsetWidth-8))}px`,l.style.top=`${Math.max(8,Math.min(e.bottom+6,innerHeight-l.offsetHeight-8))}px`,(s.find(e=>"true"===e.getAttribute("aria-checked"))??s[0])?.focus({preventScroll:!0})}else l.hidePopover()}),i.addEventListener("keydown",e=>{if(!i.open)return;let t,n=s.indexOf(e.target);"ArrowDown"===e.key&&(t=(n+1)%s.length),"ArrowUp"===e.key&&(t=(n-1+s.length)%s.length),"Home"===e.key&&(t=0),"End"===e.key&&(t=s.length-1),void 0!==t&&(e.preventDefault(),s[t]?.focus()),"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),i.open=!1,o.focus({preventScroll:!0})),"Tab"===e.key&&(i.open=!1)}),i.append(o,l),i}function t(t,a,i,o){let l=e(t,a.map(([e,t])=>({label:t,icon:"check",onSelect:()=>o(e)})));l.classList.add("selection-menu");let s=l.querySelector("summary");return s.className="selection-trigger",s.replaceChildren(n("span","selection-label",a.find(([e])=>e===i)?.[1]),r("chevron")),l.querySelectorAll("[role=menuitem]").forEach((e,t)=>{e.setAttribute("role","menuitemradio"),e.setAttribute("aria-checked",String(a[t][0]===i))}),l}import{E as n,F as r,G as a}from"./chunk-4HBBEVFK.js";export{e as a,t as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./chunk-3BVM3I52.js";import{e as t,f as n}from"./chunk-4FX5IS2U.js";var l,o=new WeakSet,r=new WeakMap;function a(t,n,o,a){let s=()=>{},i=e=>{if(t instanceof HTMLInputElement&&"length"===n.kind&&(t.type="text"),t instanceof HTMLSelectElement&&![...t.options].some(t=>t.value===e)){let n=document.createElement("option");n.value=n.textContent=e,t.prepend(n)}t.value="length"===n.kind&&/^-?[\d.]+px$/.test(e)?e.slice(0,-2):e,t.title=e,s()};if("length"===n.kind&&i(o.element.style.getPropertyValue(n.property)||getComputedStyle(o.element).getPropertyValue(n.property)),"font-family"===n.property){let n=t.parentElement,l=document.createElement("style");l.textContent=".palette-font-name{position:absolute;inset:0 28px 0 var(--lead,8px);display:flex;align-items:center;gap:6px;pointer-events:none;overflow:hidden;white-space:nowrap}.palette-font-name span{overflow:hidden;color:#f1efeb;text-overflow:ellipsis}.palette-font-name small{flex:none;color:#898680;font-size:10px}.palette-font-name[data-unresolved] span{color:#e7c27d}.design-field:has(.palette-font-name)>input:not(:focus){color:transparent}.design-field:has(>input:focus)>.palette-font-name,.design-field[data-token-mode=token]>.palette-font-name,.design-field[data-token-mode=connected]>.palette-font-name{display:none}";let r=document.createElement("span"),a=document.createElement("b"),i=document.createElement("span"),p=document.createElement("small");r.className="palette-font-name",r.setAttribute("aria-hidden","true"),a.textContent="Aa",r.append(a,i,p);let d=()=>{let n=o.element,l=getComputedStyle(n),s=e(n.style.getPropertyValue("font-family")||function(e){let t="",n=l=>{for(let o of l)if(o instanceof CSSStyleRule){let n=o.style.getPropertyValue("font-family");try{n.includes("var(")&&e.matches(o.selectorText)&&(t=n)}catch{}}else"cssRules"in o&&n(o.cssRules)};for(let t of e.ownerDocument.styleSheets)try{n(t.cssRules)}catch{}return t}(n),l.fontFamily,e=>l.getPropertyValue(e));i.textContent=s.label,p.textContent=s.note,t.title=s.title,r.toggleAttribute("data-unresolved",s.label.endsWith(" unresolved")),a.style.fontFamily=i.style.fontFamily=l.fontFamily};s=d,t.addEventListener("input",d),t.addEventListener("blur",d);let c=new MutationObserver(()=>n.isConnected?d():c.disconnect());c.observe(o.element,{attributeFilter:["style","class"]}),d(),n.append(l,r)}let p=()=>o.element.style.getPropertyValue(n.property),d={field:n,declared:p,seen:p(),set(e){c(()=>{o.begin(t,n.property),o.apply(t,n.property,e),o.commit(t,n.property)}),i(e)},keep(e){c(()=>{o.apply(t,n.property,e),o.commit(t,n.property,!1)}),i(e)},refresh(){d.seen=p(),"length"===n.kind?i(d.seen||getComputedStyle(o.element).getPropertyValue(n.property)):a()}},c=e=>{l=t;try{e()}finally{l=void 0,d.seen=p()}};return r.set(t,d),c}function s(e,t){for(let n of e.querySelectorAll(".design-field > [data-property]")){let e=r.get(n);e&&n!==l&&!t(n)&&n.getRootNode().activeElement!==n&&e.declared()!==e.seen&&e.refresh()}}function i(e,t,l){if(!(l instanceof HTMLInputElement||l instanceof HTMLSelectElement))return;let a=r.get(l);return!a&&(l instanceof HTMLSelectElement||"number"===l.type)||"select"===a?.field.kind||"opacity"===t?void 0:{get value(){return!/color|^(fill|stroke)$/.test(t)&&e.style.getPropertyValue(t).trim()||getComputedStyle(e).getPropertyValue(t).trim()},field:a?.field,onPreview(l){let o=n(e,t);return e.style.setProperty(t,l,"important"),o.restore},onSelect(e){if(a&&"color"!==a.field.kind)return a.set(e);l.dispatchEvent(new Event("focus")),l.value=e,l.dispatchEvent(new Event("input",{bubbles:!0})),l.dispatchEvent(new Event("change",{bubbles:!0}))},onCommit(e){if(o.has(l)||l.dispatchEvent(new Event("focus")),o.add(l),a&&"color"!==a.field.kind)return a.keep(e);l.value=e,l.dispatchEvent(new Event("input",{bubbles:!0}))},onDone(){o.delete(l)&&l.dispatchEvent(new Event("change",{bubbles:!0}))},onCancel(){o.delete(l)&&l.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0}))}}}function p(e,n){let l=n.value.trim();return"color"===e.kind?t(e.property,l):"length"===e.kind?l?t(e.property,/^-?[\d.]+$/.test(l)?`${l}px`:l):null:"size"===e.kind||"line-height"===e.property?/^(auto|normal|(?:\d+(?:\.\d+)?)(?:px|%|vw|vh|rem|em)?)$/.test(l)?"size"===e.kind&&/^[\d.]+$/.test(l)?`${l}px`:l:null:t(e.property,"letter-spacing"===e.property&&/^-?[\d.]+$/.test(l)?`${l}px`:l)}export{a,s as b,i as c,p as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=".palette-select,.palette-tokens{position:absolute;z-index:20;box-sizing:border-box;border-radius:10px;background:#232323;box-shadow:0 0 0 1px #ffffff14,0 12px 32px #0008;color:#d9d6d1;font-size:11px;font-weight:400;line-height:1.25;text-align:left;cursor:default;transform-origin:top;animation:palette-popup-in var(--duration-fast,250ms) var(--ease-smooth-out,cubic-bezier(.22,1,.36,1)) backwards}.palette-select[data-up],.palette-tokens[data-up]{transform-origin:bottom}@keyframes palette-popup-in{from{opacity:0;transform:scale(.97)}}@media (prefers-reduced-motion:reduce){.palette-select,.palette-tokens{animation:none}}";function e(t){let e={top:0,left:0,bottom:innerHeight,right:innerWidth};for(let o=t.parentElement;o;o=o.parentElement)if(/auto|scroll|hidden/.test(getComputedStyle(o).overflowY)){let t=o.getBoundingClientRect();return{top:Math.max(t.top,0),left:Math.max(t.left,0),bottom:Math.min(t.bottom,e.bottom),right:Math.min(t.right,e.right)}}return e}function o(t,e,o){let n=t.getRootNode();n.addEventListener("palette-preview-cancel",e,{signal:o});let a=new MutationObserver(()=>{t.isConnected||e()});a.observe(document,{childList:!0,subtree:!0}),n instanceof ShadowRoot&&a.observe(n,{childList:!0,subtree:!0}),o.addEventListener("abort",()=>a.disconnect(),{once:!0})}export{t as a,e as b,o as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e}from"./chunk-4HBBEVFK.js";var t='.palette-source{position:relative;flex:none;display:flex}.palette-source>button{width:24px;height:24px;padding:0;border:0;border-radius:6px;background:none;color:#898680;cursor:pointer}.palette-source>button::before{content:"i";display:inline-grid;place-items:center;width:12px;height:12px;border:1.2px solid;border-radius:50%;font:italic 600 9px/1 Georgia,serif}.palette-source>button:is(:hover,[aria-expanded=true]){background:#ffffff12;color:#f1efeb}.palette-source>span{position:absolute;z-index:12;top:calc(100% + 4px);right:0;width:max-content;padding:10px;border-radius:10px;background:#191819;box-shadow:0 0 0 1px #ffffff1a,0 12px 40px #0008;color:#e9e6e1;font:11px/1.45 ui-monospace,Menlo,monospace;overflow-wrap:anywhere}.palette-source span button{margin:8px 6px 0 0;padding:4px 10px;border:0;border-radius:6px;background:#ffffff12;color:#f1efeb;font:12px system-ui,sans-serif;cursor:pointer}@media (max-width:520px){.palette-source>button{width:32px;height:32px}.palette-source span button{padding:9px 12px}}';function o(t,o,n){let r=e("span","palette-source"),a=e("button","palette-source__button"),i=e("span","",o),p=`${t} source`,d=(t,o,n)=>{let r=e("button","",t);return r.type="button",r.setAttribute("aria-label",o),r.addEventListener("click",n),i.append(r),r};a.type="button",a.title=o,a.setAttribute("aria-label",p),a.setAttribute("aria-expanded","false"),i.hidden=!0,i.setAttribute("role","dialog"),i.setAttribute("aria-label",p),i.append(e("br"));let s,l,u=d("Copy","Copy source path",()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(o)).then(()=>{u.textContent="Copied"},()=>getSelection()?.selectAllChildren(i.firstChild))}),c=/^([\w@.-][^:]*?\.\w+)(?::(\d+))?(?::\d+)?$/.exec(o);try{s=c?n?.(c[1],Number(c[2])||void 0):void 0}catch{}function f(e){if(i.hidden=!e,a.setAttribute("aria-expanded",String(e)),u.textContent="Copy",l?.abort(),!e)return;let t=8,o=innerWidth-8,n=r.parentElement;for(;n&&"visible"===getComputedStyle(n).overflowX;)n=n.parentElement;if(n){let e=n.getBoundingClientRect();t=Math.max(t,e.left+4),o=Math.min(o,e.right-4)}i.style.translate="",i.style.maxWidth=`${Math.min(280,o-t)}px`;let p=i.getBoundingClientRect();i.style.translate=Math.max(0,t-p.left)-Math.max(0,p.right-o)+"px";let{signal:d}=l=new AbortController;a.getRootNode().addEventListener("pointerdown",e=>{e.composedPath().includes(r)||f(!1)},{capture:!0,signal:d}),window.addEventListener("keydown",e=>{"Escape"!==e.key||!e.composedPath().includes(r)||(e.preventDefault(),e.stopImmediatePropagation(),f(!1),a.focus())},{capture:!0,signal:d})}return s&&/^(https?|vscode|cursor):/.test(s)&&d("Open","Open source",()=>{window.open(s,"_blank","noopener,noreferrer"),f(!1)}),a.addEventListener("click",()=>f(!0===i.hidden)),r.addEventListener("focusout",e=>{e.relatedTarget instanceof Node&&!r.contains(e.relatedTarget)&&f(!1)}),r.append(a,i),r}export{t as a,o as b};
|