github-stars-organizer 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/assets/{backups-r4Hq-y_s.js → backups-DrK5WGqD.js} +1 -1
- package/dist/app/assets/badge-Drt9JvOu.js +1 -0
- package/dist/app/assets/{button-C0MQwO-R.js → button-r9cVFa0_.js} +3 -3
- package/dist/app/assets/coerce-Cxjr6MIU.js +1 -0
- package/dist/app/assets/{esm-Cyyp48ez.js → esm-CVXsiVX8.js} +1 -1
- package/dist/app/assets/explore-Da5fm3tF.js +33 -0
- package/dist/app/assets/{history-OZ9l4TiG.js → history-CN5yGwhZ.js} +1 -1
- package/dist/app/assets/index-B-eCk0oM.js +10 -0
- package/dist/app/assets/index-DIdY6bcj.css +2 -0
- package/dist/app/assets/list._listId-CNuYrPaQ.js +2 -0
- package/dist/app/assets/list._listId-DBB3l--n.js +1 -0
- package/dist/app/assets/{local-backups-BGSAd5Gu.js → local-backups-DLhiWDk4.js} +1 -1
- package/dist/app/assets/{local-sync-Dd3hEb9I.js → local-sync-DiQe8mhd.js} +1 -1
- package/dist/app/assets/registry-BKf8LDk2.js +4 -0
- package/dist/app/assets/routes-C0Cvc6Pi.js +2 -0
- package/dist/app/assets/routes-CY3o7jPt.js +3 -0
- package/dist/app/assets/{schemas-B0gCwksU.js → schemas-DVvZEnxp.js} +1 -1
- package/dist/app/assets/star-BPue5Y4t.js +7 -0
- package/dist/app/assets/{triangle-alert-Cgw2r-Xm.js → triangle-alert-BL8M65pd.js} +1 -1
- package/dist/app/index.html +10 -10
- package/dist/cli.js +475 -1
- package/package.json +1 -1
- package/dist/app/assets/badge-DWmLT6OI.js +0 -1
- package/dist/app/assets/coerce-D595RIhb.js +0 -1
- package/dist/app/assets/explore-Cizp4zKW.js +0 -33
- package/dist/app/assets/index-CTD9BpPN.js +0 -10
- package/dist/app/assets/index-DR-cW8P1.css +0 -2
- package/dist/app/assets/list._listId-C5TBL1sd.js +0 -2
- package/dist/app/assets/list._listId-Cq8rSqKM.js +0 -1
- package/dist/app/assets/registry-DZ4hp3Pl.js +0 -4
- package/dist/app/assets/routes-CqMycHWV.js +0 -2
- package/dist/app/assets/routes-DcRfe2TL.js +0 -3
- package/dist/app/assets/star-BoN7NVgv.js +0 -7
- /package/dist/app/assets/{sync-persistence-f8LlQoHO.js → sync-persistence-BJbWXISF.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as e,it as t,nt as n,st as r,t as i}from"./button-
|
|
1
|
+
import{K as e,it as t,nt as n,st as r,t as i}from"./button-r9cVFa0_.js";import{a,c as o,d as s,f as c,i as l,l as u,n as d,o as f,p,r as m,s as h,t as g,u as _}from"./local-backups-DLhiWDk4.js";import{t as v}from"./history-CN5yGwhZ.js";var y=r(t()),b=n(),x={launch:`On launch`,manual:`Backed up by hand`,"before-restore":`Before a restore`,uploaded:`From a file`},S=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function C(e){return e instanceof Error?e.message:String(e)}function w(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function T(){return(0,b.jsx)(E,{})}function E(){let[t,n]=(0,y.useState)(null),[r,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(!1),[u,f]=(0,y.useState)(null),m=(0,y.useRef)(null);async function h(){n(await e.listBackups())}(0,y.useEffect)(()=>{h().catch(e=>a(`Couldn't read the backups: ${C(e)}`))},[]);async function _(e,t){s(!0),a(e);try{a(await t()),await h()}catch(e){a(C(e))}finally{s(!1)}}function T(){_(`Backing up...`,async()=>{let e=await g();return`Backed up ${w(e.stars,`star`)} and ${w(e.lists,`List`)}, with your tags, ratings and notes.`})}function E(e){e&&_(`Reading ${e.name}...`,async()=>(f(await l(e)),`Kept a copy of ${e.name}.`))}return(0,b.jsxs)(`div`,{className:`max-w-3xl space-y-6`,children:[(0,b.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`h1`,{className:`font-display text-2xl font-bold tracking-tight`,children:`Backups`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Each launch backs up your stars and Lists before the app can change anything. A restore only adds back what is missing: it never unstars a repo or deletes a List.`}),t&&(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Saved in `,(0,b.jsx)(`code`,{children:t.directory})]})]}),(0,b.jsx)(i,{onClick:T,disabled:o,children:`Back up now`})]}),r&&(0,b.jsx)(`p`,{role:`status`,className:`text-sm`,children:r}),(0,b.jsxs)(`ul`,{className:`divide-y divide-border rounded-lg border border-border`,children:[t?.backups.length===0&&(0,b.jsx)(`li`,{className:`p-4 text-sm text-muted-foreground`,children:`No backups yet.`}),t?.backups.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 p-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:S.format(new Date(e.createdAt))}),(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[x[e.reason],` · `,w(e.stars,`star`),` · `,w(e.lists,`List`)]})]}),(0,b.jsxs)(i,{variant:`ghost`,size:`sm`,disabled:o,onClick:()=>void _(`Preparing the file...`,async()=>(await d(e),`Downloaded.`)),children:[(0,b.jsx)(p,{className:`mr-1.5 size-4`}),`Download`]}),(0,b.jsxs)(i,{variant:`outline`,size:`sm`,disabled:o,onClick:()=>f(e),children:[(0,b.jsx)(v,{className:`mr-1.5 size-4`}),`Restore...`]})]},e.id))]}),(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Restore from a file`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`A backup you downloaded, from this computer or another. You see what it would change before anything does.`}),(0,b.jsx)(`input`,{ref:m,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{E(e.target.files?.[0]),e.target.value=``}}),(0,b.jsxs)(i,{variant:`outline`,size:`sm`,disabled:o,onClick:()=>m.current?.click(),children:[(0,b.jsx)(c,{className:`mr-1.5 size-4`}),`Choose a file`]})]}),u&&(0,b.jsx)(k,{backup:u,onClose:()=>f(null),onRestored:()=>void h()})]})}var D=5;function O({names:e}){let t=e.length-D;return(0,b.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[e.slice(0,D).join(`, `),t>0&&`, and ${t} more`]})}function k({backup:t,onClose:n,onRestored:r}){let[c,l]=(0,y.useState)({step:`planning`});(0,y.useEffect)(()=>{Promise.all([e.planRestore({backupId:t.id}),e.readBackup(t.id)]).then(([e,t])=>l({step:`review`,plan:e,hasLocal:t.local!==void 0})).catch(e=>l({step:`failed`,message:C(e)}))},[t.id]);async function d(){l({step:`applying`});try{l({step:`done`,result:await m(t)}),r()}catch(e){l({step:`failed`,message:C(e)})}}return(0,b.jsx)(f,{open:!0,onOpenChange:e=>{!e&&c.step!==`applying`&&n()},children:(0,b.jsxs)(h,{children:[(0,b.jsxs)(_,{children:[(0,b.jsxs)(s,{children:[`Restore the backup from `,S.format(new Date(t.createdAt))]}),(0,b.jsx)(o,{children:`Only adds what GitHub is missing. Nothing you starred or made since is touched.`})]}),(0,b.jsx)(A,{state:c}),(0,b.jsxs)(u,{children:[c.step===`review`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,b.jsx)(i,{onClick:()=>void d(),disabled:a(c.plan)===0&&!c.hasLocal,children:`Restore`})]}),(c.step===`done`||c.step===`failed`)&&(0,b.jsx)(i,{onClick:n,children:`Close`})]})]})})}function A({state:e}){switch(e.step){case`planning`:return(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Comparing the backup with GitHub...`});case`applying`:return(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Restoring. Leave this open until it finishes.`});case`failed`:return(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:e.message});case`review`:return(0,b.jsx)(j,{plan:e.plan,hasLocal:e.hasLocal});case`done`:return(0,b.jsx)(N,{result:e.result})}}function j({plan:e,hasLocal:t}){let n=new Set(e.addToLists.map(e=>e.repo.fullName));return a(e)===0?(0,b.jsxs)(`p`,{className:`text-sm`,children:[`GitHub already has every star and List in this backup.`,t&&` Restoring fills in any tags, ratings and notes this browser is missing.`]}):(0,b.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[e.restar.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{children:[`Star `,w(e.restar.length,`repo`),` again. GitHub dates them today, so they move to the top.`]}),(0,b.jsx)(O,{names:e.restar.map(e=>e.fullName)})]}),e.recreateLists.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{children:[`Recreate `,w(e.recreateLists.length,`List`),`.`]}),(0,b.jsx)(O,{names:e.recreateLists.map(e=>e.isPrivate?`${e.name} (private)`:e.name)})]}),n.size>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{children:[`Put `,w(n.size,`repo`),` back in their Lists.`]}),(0,b.jsx)(O,{names:[...n]})]}),t&&(0,b.jsx)(`p`,{children:`Fill in tags, ratings and notes this browser is missing. Nothing you have is overwritten.`}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A backup of how things are now is taken first, so you can go back.`})]})}function M(e){let t=[e.notesAndRatings>0&&`notes or ratings on ${w(e.notesAndRatings,`repo`)}`,e.tagLinks>0&&w(e.tagLinks,`tag`)].filter(e=>e!==!1);return t.length===0?`This browser already had every tag, rating and note.`:`Filled in ${t.join(` and `)}.`}function N({result:e}){return(0,b.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,b.jsxs)(`p`,{children:[`Starred `,w(e.restarred,`repo`),` again, recreated `,w(e.recreatedLists,`List`),`, and re-added`,` `,w(e.addedToLists,`List entry`,`List entries`),`.`,e.local&&` ${M(e.local)}`]}),e.failed.length>0&&(0,b.jsxs)(`div`,{className:`rounded-md border border-destructive/40 p-2`,children:[(0,b.jsxs)(`p`,{className:`font-medium text-destructive`,children:[`GitHub refused `,w(e.failed.length,`change`),`:`]}),(0,b.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs`,children:e.failed.map(e=>(0,b.jsxs)(`li`,{children:[e.what,`: `,e.reason]},e.what))})]})]})}export{T as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as e,a as t,m as n,n as r,r as i}from"./button-r9cVFa0_.js";var a=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),o=[{id:`active`,label:`Active (<6mo)`,maxDays:180},{id:`aging`,label:`Aging (6–12mo)`,maxDays:365},{id:`stale`,label:`Stale (1–2yr)`,maxDays:730},{id:`dormant`,label:`Dormant (>2yr)`,maxDays:1/0}],s=864e5;function c(e,t=Date.now()){let n=e?(t-new Date(e).getTime())/s:1/0;return o.find(e=>n<e.maxDays)?.id??`dormant`}function l(e){return{...e,archived:`+true,+false`}}function u(e){return t(e.defaultTagName??`div`,e,e)}var d=i(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function f({className:e,variant:t=`default`,render:i,...a}){return u({defaultTagName:`span`,props:n({className:r(d({variant:t}),e)},a),render:i,state:{slot:`badge`,variant:t}})}export{a,l as i,o as n,c as r,f as t};
|