tokentracker-cli 0.5.61 → 0.5.63
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/dashboard/dist/app-icon.png +0 -0
- package/dashboard/dist/apple-touch-icon.png +0 -0
- package/dashboard/dist/assets/{Card-CZL20Xp7.js → Card-B74-O4bs.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-iwKM3V49.js +12 -0
- package/dashboard/dist/assets/{FadeIn-BcpCfJTX.js → FadeIn-ByqlgoT6.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-Dkmy87po.js → IpCheckPage-CfYn_nHq.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-CCbfxfXz.js → LeaderboardPage-BVOI6lCR.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-fGqBvaVT.js → LeaderboardProfilePage-CRygWLHI.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-B8BKBsdx.js → LimitsPage-CHxSFZH6.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-D358BSHB.js +1 -0
- package/dashboard/dist/assets/{WidgetsPage--kUrL3eW.js → WidgetsPage-BXqaU0FM.js} +1 -1
- package/dashboard/dist/assets/{download-DIE5ZXBs.js → download-sUJLwwbS.js} +1 -1
- package/dashboard/dist/assets/{leaderboard-columns-BIn2tUbK.js → leaderboard-columns-CvhOtPsL.js} +1 -1
- package/dashboard/dist/assets/{main-CTtC4fyZ.js → main-DgqtBkL2.js} +192 -193
- package/dashboard/dist/assets/{use-limits-display-prefs-B2TwiVVP.js → use-limits-display-prefs-HlhU9mMV.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-Bc4W8sUd.js → use-usage-limits-Bcram6HJ.js} +1 -1
- package/dashboard/dist/dashboard-dark.png +0 -0
- package/dashboard/dist/favicon-16.png +0 -0
- package/dashboard/dist/favicon-32.png +0 -0
- package/dashboard/dist/icon-192.png +0 -0
- package/dashboard/dist/icon-512.png +0 -0
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/neon_bg.png +0 -0
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/static-server.js +1 -0
- package/dashboard/dist/assets/DashboardPage-ZZbvMu5s.js +0 -12
- package/dashboard/dist/assets/SettingsPage-D3TxVlax.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,b as X,f as Y,aT as R,K as e,e as T,aU as Z,aV as Q,aW as ee,aX as H,aY as te,aZ as ae,ah as F,H as s,aF as k,I as ne,a_ as se,a$ as ie,b0 as oe,an as re,am as ce,aJ as le,aK as A,b1 as de,aN as ue,aL as ge,b2 as M,ao as me,b3 as xe}from"./main-CTtC4fyZ.js";import{L as he,a as B,u as ye}from"./use-limits-display-prefs-B2TwiVVP.js";import{C as fe}from"./Card-CZL20Xp7.js";import{D as be}from"./download-DIE5ZXBs.js";const pe=t=>!t.isLayoutDirty&&t.willUpdate(!1);function G(){const t=new Set,a=new WeakMap,n=()=>t.forEach(pe);return{add:i=>{t.add(i),a.set(i,i.addEventListener("willUpdate",n))},remove:i=>{t.delete(i);const r=a.get(i);r&&(r(),a.delete(i)),n()},dirty:n}}const ke=o.createContext(null);function ve(){const t=o.useRef(!1);return X(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function je(){const t=ve(),[a,n]=o.useState(0),i=o.useCallback(()=>{t.current&&n(a+1)},[a]);return[o.useCallback(()=>Y.postRender(i),[i]),a]}const U=t=>t===!0,Ne=t=>U(t===!0)||t==="id",we=({children:t,id:a,inherit:n=!0})=>{const i=o.useContext(R),r=o.useContext(ke),[m,d]=je(),x=o.useRef(null),u=i.id||r;x.current===null&&(Ne(n)&&u&&(a=a?u+"-"+a:u),x.current={id:a,group:U(n)&&i.group||G()});const b=o.useMemo(()=>({...x.current,forceRender:m}),[d]);return e.jsx(R.Provider,{value:b,children:t})};const Se=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Ce=T("grip-vertical",Se);const Le=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Ie=T("log-out",Le);const Ae=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],De=T("pencil",Ae);const Te=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ee=T("refresh-cw",Te);function V(){const[t,a]=o.useState(null),n=Z()&&Q();o.useEffect(()=>{if(!n)return;const d=ee(x=>a(x));return H(),d},[n]);const i=o.useCallback((d,x)=>{n&&(a(u=>u&&{...u,[d]:x}),te(d,x))},[n]),r=o.useCallback(d=>{n&&ae(d)},[n]),m=o.useCallback(()=>{n&&H()},[n]);return{available:n,settings:t,setSetting:i,runAction:r,refresh:m}}function Me({checked:t,onChange:a,ariaLabel:n}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":n,onClick:a,className:k("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:k("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function _e({prefs:t}){const{order:a,visibility:n,toggle:i,moveToward:r}=t,[m,d]=o.useState(null),[x,u]=o.useState(null),b=l=>g=>{d(l),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("text/plain",l)},y=l=>g=>{g.preventDefault(),g.dataTransfer.dropEffect="move",m&&m!==l&&x!==l&&(u(l),r(m,l))},N=()=>{d(null),u(null)},w=l=>{l.preventDefault(),d(null),u(null)};return e.jsx(we,{children:e.jsx("div",{className:"flex flex-col",children:a.map(l=>{const g=n[l]!==!1,f=m===l;return e.jsxs(F.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:b(l),onDragOver:y(l),onDragEnd:N,onDrop:w,className:k("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",f&&"opacity-40"),style:{cursor:f?"grabbing":"grab"},children:[e.jsx(Ce,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("img",{src:he[l],alt:"",width:18,height:18,className:"h-[18px] w-[18px] shrink-0 pointer-events-none",draggable:!1}),e.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:B[l]}),e.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:e.jsx(Me,{checked:g,onChange:()=>i(l),ariaLabel:`${s("limits.settings.toggle_visible")}: ${B[l]}`})})]},l)})})})}function Pe(t){if(!t||typeof t!="object")return"";const a=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},i=a.full_name||a.name||n.name||a.user_name||a.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof t.email=="string"&&t.email.includes("@")?t.email.split("@")[0].trim()||t.email.trim():typeof t.email=="string"?t.email.trim():""}function Oe(t){return!t||typeof t!="object"?"":typeof t.email=="string"?t.email.trim():""}function j({checked:t,onChange:a,disabled:n,ariaLabel:i}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":i,onClick:a,disabled:n,className:k("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:k("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function p({label:t,hint:a,control:n}){return e.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:t}),a&&e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),e.jsx("div",{className:"shrink-0",children:n})]})}function D({title:t,subtitle:a,action:n,children:i}){return e.jsxs(fe,{children:[e.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:t}),a&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate",children:a})]}),n&&e.jsx("div",{className:"shrink-0",children:n})]}),e.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:i})]})}const Re=[{value:"light",labelKey:"settings.appearance.theme.light",Icon:se},{value:"dark",labelKey:"settings.appearance.theme.dark",Icon:ie},{value:"system",labelKey:"settings.appearance.theme.system",Icon:oe}];function He({theme:t,onSetTheme:a}){return e.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900",children:Re.map(({value:n,labelKey:i,Icon:r})=>{const m=t===n;return e.jsxs("button",{type:"button",onClick:()=>a(n),className:k("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors",m?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"),"aria-pressed":m,children:[e.jsx(r,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{children:s(i)})]},n)})})}function Be(){const{enabled:t,signedIn:a,user:n,signOut:i,getAccessToken:r}=re(),{openLoginModal:m}=ce(),[d,x]=o.useState(()=>le()),[u,b]=o.useState(!1),[y,N]=o.useState(!1),[w,l]=o.useState(!1),[g,f]=o.useState(!1),[v,_]=o.useState(null),[E,S]=o.useState(!1),[C,P]=o.useState(""),$=t&&a&&xe(),L=o.useMemo(()=>Pe(n),[n]),K=o.useMemo(()=>Oe(n),[n]);o.useEffect(()=>{if(!a)return;let c=!0;return l(!0),(async()=>{try{const h=await A({getAccessToken:r});if(!c||!h)return;const I=await de({accessToken:h});if(!c)return;b(!!I?.enabled),N(!!I?.anonymous),I?.display_name&&_(I.display_name)}catch{}finally{c&&l(!1)}})(),()=>{c=!1}},[a,r]);const z=o.useCallback(async()=>{const c=!d;if(ue(c),x(c),typeof window<"u"&&window.dispatchEvent(new Event("tt.cloudSyncChanged")),c)try{await ge(()=>r())}catch(h){console.warn("[tokentracker] cloud sync:",h)}},[d,r]),W=o.useCallback(async()=>{if(!g){f(!0);try{const c=await A({getAccessToken:r});if(!c)return;const h=!u;await M({accessToken:c,enabled:h}),b(h)}catch{}finally{f(!1)}}},[u,g,r]),q=o.useCallback(async()=>{if(!g){f(!0);try{const c=await A({getAccessToken:r});if(!c)return;const h=!y;await M({accessToken:c,anonymous:h}),N(h)}catch{}finally{f(!1)}}},[y,g,r]),O=o.useCallback(async()=>{if(g)return;const c=C.trim().slice(0,50);if(c){f(!0);try{const h=await A({getAccessToken:r});if(!h)return;await M({accessToken:h,display_name:c}),_(c),S(!1)}catch{}finally{f(!1)}}},[C,g,r]),J=o.useCallback(()=>{P(v||L),S(!0)},[v,L]);return t?a?e.jsxs(D,{title:s("settings.section.account"),subtitle:K||v||L,action:e.jsxs("button",{type:"button",onClick:()=>i(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors",children:[e.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]}),children:[$&&e.jsx(p,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:e.jsx(j,{checked:d,onChange:z,ariaLabel:s("settings.account.cloudSync")})}),e.jsx(p,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:e.jsx(j,{checked:u,onChange:W,disabled:w||g,ariaLabel:s("settings.account.publicProfile")})}),e.jsx(me,{initial:!1,children:u&&e.jsxs(F.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:[e.jsx("div",{className:"py-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.displayName")}),!E&&e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate",children:v||L}),E&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{type:"text",value:C,onChange:c=>P(c.target.value),onKeyDown:c=>{c.key==="Enter"&&O(),c.key==="Escape"&&S(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-transparent px-2.5 py-1.5 text-sm text-oai-black dark:text-white outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500",placeholder:s("settings.account.displayName")}),e.jsx("button",{type:"button",onClick:O,disabled:g||!C.trim(),className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white hover:bg-oai-brand-600 disabled:opacity-50 transition-colors",children:g?s("settings.account.saving"):s("settings.account.save")}),e.jsx("button",{type:"button",onClick:()=>S(!1),className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors",children:s("settings.account.cancel")})]})]}),!E&&e.jsxs("button",{type:"button",onClick:J,className:"shrink-0 inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 px-3 text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:[e.jsx(De,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.edit")]})]})}),e.jsx(p,{label:s("settings.account.anonymous"),hint:s("settings.account.anonymousHint"),control:e.jsx(j,{checked:y,onChange:q,disabled:w||g,ariaLabel:s("settings.account.anonymous")})})]},"public-profile-fields")})]}):e.jsx(D,{title:s("settings.section.account"),children:e.jsxs("div",{className:"flex items-center justify-between py-3 gap-4",children:[e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),e.jsx("button",{type:"button",onClick:m,className:"shrink-0 inline-flex h-8 items-center justify-center rounded-md bg-oai-gray-900 text-white px-4 text-xs font-medium hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:s("settings.account.signIn")})]})}):null}function Ge(){const{available:t,settings:a,setSetting:n,runAction:i}=V();if(!t)return null;const r=!!a?.showStats,m=a?.animatedIcon!==!1,d=!!a?.launchAtLogin,x=a?.launchAtLoginSupported!==!1;a?.version;const u=a?.updateStatus||null,b=!!a?.updateBusy,y=!!a?.isSyncing;return e.jsxs(D,{title:s("settings.section.menubar"),children:[e.jsx(p,{label:s("settings.menubar.showStats"),hint:s("settings.menubar.showStatsHint"),control:e.jsx(j,{checked:r,onChange:()=>n("showStats",!r),ariaLabel:s("settings.menubar.showStats")})}),e.jsx(p,{label:s("settings.menubar.animatedIcon"),hint:s("settings.menubar.animatedIconHint"),control:e.jsx(j,{checked:m,onChange:()=>n("animatedIcon",!m),ariaLabel:s("settings.menubar.animatedIcon")})}),x&&e.jsx(p,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:e.jsx(j,{checked:d,onChange:()=>n("launchAtLogin",!d),ariaLabel:s("settings.menubar.launchAtLogin")})}),e.jsx(p,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:e.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:y,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 px-3 text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Ee,{className:k("h-3.5 w-3.5",y&&"animate-spin"),"aria-hidden":!0}),y?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),e.jsx(p,{label:s("settings.menubar.updates"),hint:u||void 0,control:e.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:b,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 px-3 text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(be,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Fe(){const{available:t,settings:a,runAction:n}=V();return!t||!a?.version?null:e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-500",children:[e.jsxs("span",{children:["TokenTrackerBar v",a.version]}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("button",{type:"button",onClick:()=>n("openAbout"),className:"hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors underline-offset-2 hover:underline",children:"GitHub"})]})}function ze(){const{theme:t,setTheme:a}=ne(),n=ye();return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8 flex items-center justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white",children:s("settings.page.title")}),e.jsx(He,{theme:t,onSetTheme:a})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ge,{}),e.jsx(Be,{}),e.jsx(D,{title:s("settings.section.limits"),children:e.jsx(_e,{prefs:n})})]}),e.jsx(Fe,{})]})})})}export{ze as SettingsPage};
|