github-stars-organizer 1.2.0 → 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.
Files changed (34) hide show
  1. package/dist/app/assets/{backups-r4Hq-y_s.js → backups-DrK5WGqD.js} +1 -1
  2. package/dist/app/assets/badge-Drt9JvOu.js +1 -0
  3. package/dist/app/assets/{button-C0MQwO-R.js → button-r9cVFa0_.js} +3 -3
  4. package/dist/app/assets/coerce-Cxjr6MIU.js +1 -0
  5. package/dist/app/assets/{esm-Cyyp48ez.js → esm-CVXsiVX8.js} +1 -1
  6. package/dist/app/assets/explore-Da5fm3tF.js +33 -0
  7. package/dist/app/assets/{history-OZ9l4TiG.js → history-CN5yGwhZ.js} +1 -1
  8. package/dist/app/assets/index-B-eCk0oM.js +10 -0
  9. package/dist/app/assets/index-DIdY6bcj.css +2 -0
  10. package/dist/app/assets/list._listId-CNuYrPaQ.js +2 -0
  11. package/dist/app/assets/list._listId-DBB3l--n.js +1 -0
  12. package/dist/app/assets/{local-backups-BGSAd5Gu.js → local-backups-DLhiWDk4.js} +1 -1
  13. package/dist/app/assets/{local-sync-Dd3hEb9I.js → local-sync-DiQe8mhd.js} +1 -1
  14. package/dist/app/assets/registry-BKf8LDk2.js +4 -0
  15. package/dist/app/assets/routes-C0Cvc6Pi.js +2 -0
  16. package/dist/app/assets/routes-CY3o7jPt.js +3 -0
  17. package/dist/app/assets/{schemas-B0gCwksU.js → schemas-DVvZEnxp.js} +1 -1
  18. package/dist/app/assets/star-BPue5Y4t.js +7 -0
  19. package/dist/app/assets/{triangle-alert-Cgw2r-Xm.js → triangle-alert-BL8M65pd.js} +1 -1
  20. package/dist/app/index.html +10 -10
  21. package/dist/cli.js +475 -1
  22. package/package.json +1 -1
  23. package/dist/app/assets/badge-DWmLT6OI.js +0 -1
  24. package/dist/app/assets/coerce-D595RIhb.js +0 -1
  25. package/dist/app/assets/explore-Cizp4zKW.js +0 -33
  26. package/dist/app/assets/index-BD7Q-Iqo.js +0 -10
  27. package/dist/app/assets/index-DR-cW8P1.css +0 -2
  28. package/dist/app/assets/list._listId-C5TBL1sd.js +0 -2
  29. package/dist/app/assets/list._listId-Cq8rSqKM.js +0 -1
  30. package/dist/app/assets/registry-DZ4hp3Pl.js +0 -4
  31. package/dist/app/assets/routes-C8TmhzRl.js +0 -2
  32. package/dist/app/assets/routes-CXgqVl-F.js +0 -3
  33. package/dist/app/assets/star-BoN7NVgv.js +0 -7
  34. /package/dist/app/assets/{sync-persistence-f8LlQoHO.js → sync-persistence-BJbWXISF.js} +0 -0
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-CXgqVl-F.js","assets/button-C0MQwO-R.js","assets/sync-persistence-f8LlQoHO.js","assets/registry-DZ4hp3Pl.js","assets/schemas-B0gCwksU.js","assets/coerce-D595RIhb.js","assets/badge-DWmLT6OI.js","assets/star-BoN7NVgv.js","assets/local-backups-BGSAd5Gu.js","assets/local-sync-Dd3hEb9I.js","assets/triangle-alert-Cgw2r-Xm.js"])))=>i.map(i=>d[i]);
2
- import{G as e,R as t}from"./button-C0MQwO-R.js";import{O as n,k as r,t as i}from"./coerce-D595RIhb.js";import{c as a,s as o}from"./schemas-B0gCwksU.js";var s=t(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),c=t(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),l=()=>e(()=>import(`./routes-CXgqVl-F.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),u=o({sort:a().optional(),group:a().optional(),search:a().optional(),page:i().optional(),language:a().optional(),archived:a().optional(),healthMin:i().optional(),healthMax:i().optional(),starsMin:i().optional(),starsMax:i().optional(),topics:a().optional(),lists:a().optional()}),d=r(`/`)({component:n(l,`component`),validateSearch:u});export{c as n,s as r,d as t};
@@ -1,3 +0,0 @@
1
- import{B as e,H as t,J as n,K as r,R as i,V as a,W as o,it as s,n as c,nt as l,q as u,st as d,t as f,z as p}from"./button-C0MQwO-R.js";import{S as m,i as h,n as g,r as _}from"./coerce-D595RIhb.js";import{n as v}from"./star-BoN7NVgv.js";import{C as y,T as b,_ as ee,a as te,b as ne,c as re,d as ie,f as ae,g as x,i as oe,l as se,m as ce,n as S,o as le,p as ue,r as de,s as fe,t as C,u as w,v as pe,w as T,x as E,y as D}from"./registry-DZ4hp3Pl.js";import{d as O,f as k,l as A,o as j,p as me,s as M,t as N,u as he}from"./local-backups-BGSAd5Gu.js";import{t as ge}from"./badge-DWmLT6OI.js";import{n as P,r as F,t as I}from"./routes-C8TmhzRl.js";import{t as L}from"./triangle-alert-Cgw2r-Xm.js";import{c as R,o as _e,r as z,s as B}from"./schemas-B0gCwksU.js";import{n as ve,t as V}from"./local-sync-Dd3hEb9I.js";var ye=i(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),H=i(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),U=d(s(),1);function be(e,t){return{lists:e.map(e=>({id:e.id,github_list_id:e.id,name:e.name,description:e.description,is_private:!1,created_at:e.createdAt,updated_at:e.updatedAt})),list_items:e.flatMap(e=>e.repoGithubIds.flatMap((n,r)=>{let i=t.get(n);return i?[{id:`${e.id}:${i}`,list_id:e.id,repo_id:i,position:r,added_at:e.updatedAt}]:[]}))}}var xe=5;async function Se(e){try{let t=await fetch(`/api/lists?user=${encodeURIComponent(e)}`);return t.ok?(await t.json()).lists:null}catch{return null}}async function Ce(n,r){let i=Se(n),o=[];for(let e=1;e<=xe;e++){let t=await fetch(`https://api.github.com/users/${encodeURIComponent(n)}/starred?per_page=100&page=${e}`,{headers:{Accept:`application/vnd.github.star+json`}});if(t.status===404)throw Error(`No GitHub user called ${n}.`);if(t.status===403||t.status===429)throw Error(`GitHub's limit for signed-out requests is 60 an hour. Try again later, or self-host it.`);if(!t.ok)throw Error(`GitHub returned ${t.status}.`);let i=await t.json();if(o.push(...i),r(`Read ${o.length} stars...`),i.length<100)break}if(o.length===0)throw Error(`${n} hasn't starred anything public.`);let s=new Date().toISOString(),c=o.map(({starred_at:e,repo:t})=>({id:String(t.id),github_id:t.id,node_id:t.node_id,name:t.name,full_name:t.full_name,owner:t.owner.login,description:t.description,url:t.html_url,homepage:t.homepage||null,language:t.language,stars:t.stargazers_count,forks:t.forks_count,topics:t.topics?.length?t.topics.join(`,`):null,starred_at:e,notes:null,usefulness_rating:null,imported_at:s,health_score:null,health_data:null,health_refreshed_at:null,is_archived:t.archived,pushed_at:t.pushed_at,created_at:t.created_at}));for(let n of[t,e,p,a]){let e=[...n.keys()];e.length>0&&n.delete(e)}a.insert(c),r(`Reading Lists...`);let l=await i;if(l===null)return{stars:c.length,lists:`unavailable`};let u=be(l,new Map(c.map(e=>[e.github_id,e.id])));return u.lists.length>0&&p.insert(u.lists),u.list_items.length>0&&e.insert(u.list_items),{stars:c.length,lists:u.lists.length}}var W=l();function we(){let[e,t]=(0,U.useState)(``),[r,i]=(0,U.useState)(n),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(``);async function l(){let n=e.trim().replace(/^@/,``);if(n){o(!0),c(`Reading stars...`);try{let e=await Ce(n,c);i(n),t(``),c(e.lists===`unavailable`?`${e.stars} recent stars from @${n}. Couldn't read their Lists.`:`${e.stars} recent stars and ${e.lists} Lists from @${n}.`)}catch(e){c(e instanceof Error?e.message:`Couldn't read those stars.`)}finally{o(!1)}}}return(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:items-end`,children:[(0,W.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),l()},className:`flex w-full items-center gap-2 sm:w-auto`,children:[(0,W.jsx)(m,{value:e,onChange:e=>t(e.target.value),placeholder:`Any GitHub username`,"aria-label":`GitHub username`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`go`,className:`h-10 min-w-0 flex-1 sm:h-9 sm:w-48 sm:flex-none`}),(0,W.jsx)(f,{type:`submit`,className:`h-10 sm:h-9`,disabled:a||!e.trim(),children:a?`Loading...`:`Load`})]}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s||(r?`Showing @${r}`:``)})]})}var Te=z(B({repo_id:_e().int(),notes:R().nullish(),tags:z(B({name:R()})).default([])})),G=class extends Error{};function Ee(e){let t=Te.safeParse(e);if(!t.success)throw new G(`This file isn't an Astral export. In Astral, open Settings and press Export to get one.`);if(t.data.length===0)throw new G(`This Astral export is empty. Astral only exports stars that have a tag or a note.`);return t.data}var De=`Astral tags: `;function Oe(e){let t=e.tags.map(e=>e.name.trim()).filter(Boolean);return[...new Map(t.map(e=>[e.toLowerCase(),e])).values()]}function ke(e,t){let n=e?.trim()??``,r=t.filter(e=>e&&!n.includes(e));return r.length===0?null:[n,...r].filter(Boolean).join(`
2
-
3
- `)}function K(e,t,n){let r=new Map(t.repos.map(e=>[e.github_id,e])),i=new Map(t.lists.map(e=>[e.name.toLowerCase(),e])),a=new Set(t.list_items.map(e=>`${e.list_id}:${e.repo_id}`)),o=new Set([...n].map(e=>e.toLowerCase())),s=new Map,c=[],l=0;for(let t of e){let e=r.get(t.repo_id);if(!e){l++;continue}let n=Oe(t);for(let t of n){let n=t.toLowerCase(),r=s.get(n);r||(r={name:t,existingList:i.get(n)??null,toAdd:[],starred:0},s.set(n,r)),r.starred++,(!r.existingList||!a.has(`${r.existingList.id}:${e.id}`))&&r.toAdd.push(e)}let u=n.filter(e=>!o.has(e.toLowerCase())),d=ke(e.notes,[t.notes?.trim()??``,u.length?`${De}${u.join(`, `)}`:``]);d!==null&&c.push({repo:e,notes:d})}return{tags:[...s.values()].sort((e,t)=>t.starred-e.starred||e.name.localeCompare(t.name)),notes:c,notStarred:l,listSlots:Math.max(0,32-t.lists.length)}}function Ae(e){let t=new Set,n=e.listSlots;for(let r of e.tags)r.existingList?t.add(r.name):n>0&&(t.add(r.name),n--);return t}function q(e,t){return e.tags.filter(e=>t.has(e.name)&&!e.existingList).length}function J(e){return e instanceof Error?e.message:String(e)}async function je(e,t,n,r=()=>{}){let i=e.tags.filter(e=>t.has(e.name)),a=i.reduce((e,t)=>e+t.toAdd.length+ +!t.existingList,0)+e.notes.length,o={listsCreated:0,added:0,notes:0,failed:[]},s=0,c=()=>r({done:++s,total:a});for(let e of i){let t=e.existingList;if(!t){try{t=await n.createList(e.name),o.listsCreated++}catch(t){o.failed.push({what:`List "${e.name}"`,reason:J(t)})}c()}for(let r of e.toAdd){if(t)try{await n.addToList(t,r),o.added++}catch(t){o.failed.push({what:`${r.full_name} in "${e.name}"`,reason:J(t)})}c()}}for(let t of e.notes){try{await n.setNotes(t.repo,t.notes),o.notes++}catch(e){o.failed.push({what:`Notes on ${t.repo.full_name}`,reason:J(e)})}c()}return o}var Me={createList:async e=>{let{githubListId:t}=await r.createList({name:e,description:null}),n=new Date().toISOString();return{id:t,github_list_id:t,name:e,description:null,is_private:!1,created_at:n,updated_at:n}},addToList:async(e,t)=>{if(!t.node_id||!e.github_list_id)throw Error(`Import your stars again first.`);await r.changeMembership({repoNodeId:t.node_id,repoGithubId:t.github_id,githubListId:e.github_list_id,change:`add`})},setNotes:(e,t)=>o(()=>a.update(e.id,e=>{e.notes=t}))};async function Ne(){await N()}async function Y(){await V()}function X(e){return e instanceof Error?e.message:String(e)}function Z({label:e,children:t}){return(0,W.jsxs)(g,{children:[(0,W.jsx)(h,{openOnHover:!0,delay:150,render:(0,W.jsx)(`button`,{type:`button`,"aria-label":e,className:`inline-flex text-muted-foreground hover:text-foreground`}),children:(0,W.jsx)(F,{className:`size-4`})}),(0,W.jsx)(_,{className:`w-64 p-3 text-sm`,children:t})]})}function Q({icon:e,count:t,label:n,className:r}){return(0,W.jsxs)(`span`,{title:n,"aria-label":`${t} ${n}`,className:c(`inline-flex items-center gap-1 tabular-nums [&>svg]:size-4`,r),children:[e,t]})}function Pe({stored:e,onClose:t}){let[n,r]=(0,U.useState)({step:`pick`}),i=(0,U.useRef)(null),a=(0,U.useRef)(null);async function o(t){if(t)try{let n=Ee(JSON.parse(await t.text()));r({step:`review`,stars:n,asLists:Ae(K(n,e,new Set))})}catch(e){r({step:`failed`,message:e instanceof SyntaxError?`${t.name} isn't a JSON file.`:X(e)})}}async function s(t,n){let i=K(t,e,n);r({step:`applying`,done:0,total:0});try{await Ne();let e=await je(i,n,Me,({done:e,total:t})=>r({step:`applying`,done:e,total:t}));await Y(),r({step:`done`,result:e})}catch(e){r({step:`failed`,message:X(e)})}}return(0,W.jsx)(j,{open:!0,onOpenChange:e=>{!e&&n.step!==`applying`&&t()},children:(0,W.jsxs)(M,{initialFocus:a,children:[(0,W.jsx)(he,{children:(0,W.jsxs)(O,{className:`flex items-center gap-2`,children:[`Import from Astral`,(0,W.jsx)(Z,{label:`How the import works`,children:`Each tag becomes a GitHub List. Astral notes go below your own. Tags you uncheck are saved in each repo's notes instead. Nothing changes until you press Import.`})]})}),n.step===`pick`&&(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{ref:i,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{o(e.target.files?.[0]),e.target.value=``}}),(0,W.jsxs)(f,{ref:a,variant:`outline`,onClick:()=>i.current?.click(),children:[(0,W.jsx)(k,{className:`mr-1.5 size-4`}),`Choose export`]}),(0,W.jsx)(Z,{label:`Where to get the export`,children:`In Astral, open Settings and press Export.`})]}),n.step===`review`&&(0,W.jsx)(Ie,{stars:n.stars,stored:e,asLists:n.asLists,onChange:e=>r({...n,asLists:e})}),n.step===`applying`&&(0,W.jsx)(Le,{done:n.done,total:n.total}),n.step===`done`&&(0,W.jsx)(Re,{result:n.result}),n.step===`failed`&&(0,W.jsx)(`p`,{className:`text-sm text-destructive`,children:n.message}),n.step!==`pick`&&n.step!==`applying`&&(0,W.jsxs)(A,{children:[n.step===`review`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(f,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,W.jsx)(f,{onClick:()=>void s(n.stars,n.asLists),disabled:!Fe(n.stars,e,n.asLists),children:`Import`})]}),(n.step===`done`||n.step===`failed`)&&(0,W.jsx)(f,{onClick:t,children:`Close`})]})]})})}function Fe(e,t,n){let r=K(e,t,n);return r.notes.length+r.tags.filter(e=>n.has(e.name)&&e.toAdd.length>0).length>0&&q(r,n)<=r.listSlots}function Ie({stars:e,stored:t,asLists:n,onChange:r}){let i=K(e,t,n),a=q(i,n),o=a>i.listSlots;function s(e,t){let i=new Set(n);t?i.add(e):i.delete(e),r(i)}return(0,W.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[i.tags.length>0&&(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:`Lists`}),(0,W.jsxs)(`span`,{className:c(`flex items-center gap-1.5 text-xs tabular-nums text-muted-foreground`,o&&`text-destructive`),children:[a,`/`,i.listSlots,` new`,(0,W.jsxs)(Z,{label:`GitHub's List limit`,children:[`GitHub allows `,32,` Lists, and you have room for `,i.listSlots,` more. A tag matching a List you have adds to it instead.`]})]})]}),(0,W.jsx)(`ul`,{className:`max-h-64 space-y-1 overflow-y-auto rounded-md border border-border p-2`,children:i.tags.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(E,{checked:n.has(e.name),onCheckedChange:t=>s(e.name,t===!0)}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),!e.existingList&&(0,W.jsx)(ge,{variant:`outline`,children:`new`}),e.toAdd.length>0?(0,W.jsx)(Q,{icon:(0,W.jsx)(P,{}),count:e.toAdd.length,label:`repos to add`,className:`text-xs text-muted-foreground`}):(0,W.jsx)(`span`,{title:`Already in your List`,"aria-label":`Already in your List`,children:(0,W.jsx)(b,{className:`size-4 text-muted-foreground`})})]})},e.name))})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-4 text-muted-foreground`,children:[i.notes.length>0&&(0,W.jsx)(Q,{icon:(0,W.jsx)(H,{}),count:i.notes.length,label:`repos getting notes`}),i.notStarred>0&&(0,W.jsx)(Q,{icon:(0,W.jsx)(y,{}),count:i.notStarred,label:`not starred any more, skipped`})]})]})}function Le({done:e,total:t}){return(0,W.jsxs)(`div`,{className:`space-y-1.5`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-label":`Writing to GitHub`,children:[(0,W.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,W.jsx)(`div`,{className:`h-full bg-primary transition-[width]`,style:{width:`${t>0?Math.round(e/t*100):0}%`}})}),(0,W.jsxs)(`p`,{className:`text-xs tabular-nums text-muted-foreground`,children:[e,`/`,t]})]})}function Re({result:e}){return(0,W.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,W.jsx)(Q,{icon:(0,W.jsx)(T,{}),count:e.listsCreated,label:`Lists created`}),(0,W.jsx)(Q,{icon:(0,W.jsx)(P,{}),count:e.added,label:`repos added to Lists`}),(0,W.jsx)(Q,{icon:(0,W.jsx)(H,{}),count:e.notes,label:`repos given notes`})]}),e.failed.length>0&&(0,W.jsxs)(`details`,{className:`rounded-md border border-destructive/40 p-2 text-destructive`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,W.jsx)(L,{className:`size-4`}),e.failed.length,` failed`]}),(0,W.jsx)(`ul`,{className:`mt-1 max-h-40 space-y-0.5 overflow-y-auto text-xs`,children:e.failed.map(e=>(0,W.jsxs)(`li`,{children:[e.what,`: `,e.reason]},e.what))})]})]})}var $=!1;async function ze(e){e(`Reading your stars and Lists from GitHub...`);let{stars:t,lists:n}=await V(),r=`Read ${t} stars and ${n} lists.`;e(r);let i=await ve(`missing`,({scored:t,total:n})=>e(`${r} Scoring health ${t}/${n}...`));i.total>0&&e(`${r} Scored ${i.scored} repos.`)}function Be(){let t=I.useNavigate(),n=I.useSearch(),{data:r}=v(e=>e.from({repoCollection:a}).select(({repoCollection:e})=>e)),{data:i}=v(e=>e.from({listCollection:p}).select(({listCollection:e})=>e)),{data:o}=v(t=>t.from({listItemCollection:e}).select(({listItemCollection:e})=>e)),[s,c]=(0,U.useState)(!1),[l,d]=(0,U.useState)(!1),[m,h]=(0,U.useState)(``),[g,_]=(0,U.useState)(null),y=ce(),b=r??[],T=(0,U.useMemo)(()=>{let e=new Map;for(let t of o??[]){let n=e.get(t.repo_id)??[];n.push(t.list_id),e.set(t.repo_id,n)}return e},[o]),{registry:E,sortDefinitions:O}=(0,U.useMemo)(()=>de(b,{lists:i??[],listIdsByRepo:T}),[b,i,T]),k=(0,U.useMemo)(()=>ie(n,E,S,C),[n,E]),A=(0,U.useCallback)(e=>{t({search:ae(e,E,S,C),replace:!0})},[t,E]);async function j(){c(!0);try{await ze(h)}catch(e){h(`Error: ${e instanceof Error?e.message:`Unknown`}`)}finally{c(!1)}}(0,U.useEffect)(()=>{$||($=!0,j())},[]);let M=(0,U.useCallback)(e=>(0,W.jsxs)(x,{repo:e,children:[(0,W.jsx)(x.AddToList,{repo:e,lists:i??[],listItems:o??[]}),(0,W.jsx)(x.Rate,{repo:e}),(0,W.jsx)(x.Separator,{}),(0,W.jsx)(x.OpenOnGithub,{url:e.url}),(0,W.jsx)(x.CopyUrl,{url:e.url}),(0,W.jsx)(x.Separator,{}),(0,W.jsx)(x.Unstar,{repo:e})]}),[i,o]),N=(0,U.useMemo)(()=>fe({selectable:!0,onPreview:e=>_(e),renderActions:M}),[M]);return(0,W.jsxs)(`div`,{className:`space-y-6`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h1`,{className:`font-display text-2xl font-bold tracking-tight sm:text-3xl`,children:`All Stars`}),(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[b.length,` starred repositories`]})]}),u?(0,W.jsx)(we,{}):(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[m&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m}),(0,W.jsxs)(ee,{children:[(0,W.jsxs)(ne,{render:(0,W.jsx)(f,{disabled:s}),children:[(0,W.jsx)(me,{className:`mr-2 h-4 w-4`}),s?`Importing...`:`Import Stars`,(0,W.jsx)(ye,{className:`ml-1 h-4 w-4`})]}),(0,W.jsxs)(pe,{align:`end`,className:`w-auto min-w-48`,children:[(0,W.jsx)(D,{onClick:j,children:`From GitHub`}),(0,W.jsx)(D,{disabled:b.length===0,onClick:()=>d(!0),children:`From an Astral export`})]})]}),l&&(0,W.jsx)(Pe,{stored:{repos:b,lists:i??[],list_items:o??[]},onClose:()=>d(!1)})]})]}),(0,W.jsx)(w,{items:b,registry:E,sortDefinitions:O,defaultSort:S,defaultGroupBy:C,viewState:k,onViewStateChange:A,searchFields:oe,children:(0,W.jsx)(se,{columns:N,getRowId:e=>e.id,toolbar:(0,W.jsx)(re,{}),onRowClick:y?void 0:_,renderMobileRow:(e,t)=>(0,W.jsx)(te,{repo:e,state:t,actions:M(e)}),renderBulkActions:(e,t)=>(0,W.jsx)(le,{selectedRepos:e,lists:i??[],listItems:o??[],clearSelection:t})})}),(0,W.jsx)(ue,{repo:g,lists:i??[],listItems:o??[],open:g!==null,onOpenChange:e=>{e||_(null)}})]})}export{Be as component};
@@ -1,7 +0,0 @@
1
- import{R as e,it as t,nt as n,st as r}from"./button-C0MQwO-R.js";import{M as i,a,c as o,d as s,i as c,l,o as u,p as d,s as f,w as p}from"./sync-persistence-f8LlQoHO.js";n();var m=r(t(),1),h=(0,m.createContext)(void 0);function g(){return(0,m.useContext)(h)}var _=Symbol(`liveQueryResultInfo`);function v(e,t){Object.defineProperty(e,_,{configurable:!0,value:t})}function y(e){try{return!1}catch{return!1}try{return{}[e]!==`1`}catch{return!0}}var b=new WeakMap,x=0;function S(e){let t=b.get(e);return t===void 0&&(t=++x,b.set(e,t)),t}function C(e,t,n){return a(e,!t&&n?e=>{throw Error(`[${n}] Collection descriptor "${e}" requires a DbClient when the query is consumed. Wrap this component in <DbProvider client={client}> or use a concrete Collection.`)}:void 0)}function w(){return{unscoped:new Map,byClient:new WeakMap}}function T(e,t,n,r,i){let a=n?e.byClient.get(n):e.unscoped,o=new Map;for(let e of C(t,n,r)){let t=S(e),n=o.get(e.id)??a?.get(e.id);if(n!==void 0&&n!==t)throw i(),Error(`[${r}] Source Collection "${e.id}" was replaced by a different Collection with the same ID while this hook is mounted. Unmount the hook and clean up its previous source and client scope before reusing the ID.`);o.set(e.id,t)}let s=a??new Map;for(let[e,t]of o)s.set(e,t);n&&e.byClient.set(n,s)}var E=1,D=5e3,O=16,k=10,A=50,j=new Set,M=new Set,N=new Set,P=Symbol(`unpreparedQueryValue`),F=new Map,I=new WeakMap;function L(e,t,n){let r=C(e,n,`useLiveSuspenseQuery`).map(S);return r.length===0?t:`${r.join(`,`)}:${t}`}function R(e){if(!e)return F;let t=I.get(e);return t||(t=new Map,I.set(e,t)),t}function z(e,t,n){let r=e.get(t);r?.collection===n&&(e.delete(t),r.removeStatusListeners())}function B(e=`useLiveQuery`){if(!y(`TANSTACK_DB_DISABLE_DEPRECATION_WARNINGS`))return;let t=H(4);j.has(t)||(j.add(t),console.warn(`[${e}] The dependency-array form is deprecated and will be removed in 1.0. Use ${e===`useLiveQuery`?`useLiveQuery({ query })`:`useLiveInfiniteQuery(query, { queryKey })`} instead. Provide queryKey only for functional/opaque queries or to avoid deriving identity from structured query IR on render.`))}function V(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function H(e){let t=Error().stack??`unknown`,n=t.split(`
2
- `);return n.slice(1).find(e=>!e.includes(`useLiveQuery.ts`)&&!e.includes(`useLiveSuspenseQuery.ts`)&&!e.includes(`useLiveInfiniteQuery.ts`))?.trim()??n[e]?.trim()??t}function U(e,t){if(e.warned||!y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`))return;let n=t>=O,r=e.renderCount>=k&&e.totalMs>=A;if(!n&&!r)return;let i=H(5);if(M.has(i)){e.warned=!0;return}M.add(i),e.warned=!0;let a=n?`one render took ${t.toFixed(1)}ms`:`${e.renderCount} renders took ${e.totalMs.toFixed(1)}ms`;console.warn(`[useLiveQuery] Deriving live query identity from structured query IR is running on a hot render path (${a}, max ${e.maxMs.toFixed(1)}ms). Provide an explicit queryKey to skip rebuilding and hashing the IR on every render: useLiveQuery({ queryKey: [...], query }).`)}function W(e){return e&&typeof e==`object`&&Array.isArray(e.queryKey)?e.queryKey:void 0}function G(e){return e&&typeof e==`object`&&`client`in e&&e.client!==void 0?e.client:void 0}function K(e,t,n){return u(e,t,n)}function q(e,t,n,r){let a=y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`),o=a?V():0,s=K(e,t,r);try{return{status:`hashable`,value:s,identityDeps:[`derived`,c(s)]}}catch(e){if(e instanceof i)return{status:`unhashable`,value:s,error:e};throw e}finally{if(a){let e=V()-o;n.renderCount+=1,n.totalMs+=e,n.maxMs=Math.max(n.maxMs,e),U(n,e)}}}function J(e){if(!y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`))return;let t=H(4);N.has(t)||(N.add(t),console.warn(`[useLiveQuery] This query cannot derive a stable identity because ${e.reason} at ${e.path}. It will keep the legacy mount-stable behavior for now. Add queryKey: [...] to make captured values reactive. Unhashable queries without queryKey will throw in 1.0.`))}function Y(e,t){return Z(e,t)}function X(e){return{collection:null,deps:null,config:null,client:e,legacyUnhashableIdentity:[`legacy-unhashable`],derivedIdentityProfiler:{renderCount:0,totalMs:0,maxMs:0,warned:!1},deferredCollections:new Set,sourceIds:w(),observer:null,queryHash:void 0,suspenseKey:void 0,identityError:void 0,subscribe:null}}function Z(e,t,n=!1){let r=g(),a=s(e),u=a?r:G(e)??r,h=t??[],_=(0,m.useRef)(null),b=_.current??=X(u),x=()=>o(b.deferredCollections),S=a?void 0:W(e),w=P,O,k,A;if(S)O=S,k=[`queryKey`,S];else if(t!==void 0){if(O=h,u||n||y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`))try{w=K(e,u,b.deferredCollections),k=[`deps`,h,c(w)]}catch(e){if(!(e instanceof i))throw e;J(e),A=e}}else if(a)O=[],k=[`collection`,e.id];else{let t=q(e,u,b.derivedIdentityProfiler,b.deferredCollections);w=t.value,t.status===`hashable`?(O=t.identityDeps,k=t.identityDeps):(J(t.error),O=b.legacyUnhashableIdentity,A=t.error)}let j;if(k!==void 0)try{j=d(k,`queryKey`)}catch(e){if(e instanceof i){if(S!==void 0)throw e;A=e}else throw e}t!==void 0&&B(),S===void 0&&t===void 0&&w!==P&&T(b.sourceIds,w,u,`useLiveQuery`,x);let M=n&&!a&&j!==void 0&&b.collection!==null&&b.client===u&&b.queryHash===j&&b.suspenseKey!==void 0;n&&!a&&j&&!M&&w===P&&(w=K(e,u,b.deferredCollections));let N=j&&n&&!a?M?b.suspenseKey:L(w,j,u):j,F=n&&!a&&N?R(u):void 0,I=(N?F?.get(N):void 0)?.collection,V=b.deps===null||(t===void 0?!p(b.deps,O):b.deps.length!==O.length||b.deps.some((e,t)=>e!==O[t])),H=!b.collection||a&&b.config!==e||!a&&(b.client!==u||V);if(H){if(a)e.config?.syncMode===`on-demand`&&y(`TANSTACK_DB_DISABLE_QUERY_IDENTITY_WARNINGS`)&&console.warn(`[useLiveQuery] Warning: Passing a collection with syncMode "on-demand" directly to useLiveQuery will not load any data. In on-demand mode, data is only loaded when queries with predicates request it.
3
-
4
- Instead, use a query builder function:
5
- const { data } = useLiveQuery({ query: (q) => q.from({ c: myCollection }).select(({ c }) => c) })
6
-
7
- Or switch to syncMode "eager" if you want all data to sync automatically.`),e.startSyncImmediate(),b.collection=e,b.config=e;else{if(I)b.collection=I;else if(w===P&&(w=K(e,u,b.deferredCollections)),u||C(w,u,`useLiveQuery`),b.collection=f(w,{gcTime:n?D:E,pool:!n&&!u,startSync:!n||u!==void 0}),F&&N&&b.collection){let e=b.collection,t=e.on(`status:cleaned-up`,()=>z(F,N,e)),n=e.on(`status:error`,()=>{setTimeout(()=>z(F,N,e),0)}),r={collection:e,removeStatusListeners:()=>{t(),n()}};F.set(N,r)}b.config=e,b.deps=[...O]}b.client=u,b.queryHash=j,b.suspenseKey=N,b.identityError=A}H&&(b.observer=l(b.collection,{mode:`wholesale`,client:u,queryHash:b.queryHash,onPreload:x}));let U=b.observer;n&&!u&&(b.collection?.status===`idle`||b.collection?.status===`cleaned-up`)&&U.preloadForInitialRender().catch(()=>{}),(!b.subscribe||H)&&(b.subscribe=e=>{let t=U.subscribe(e);return x(),t});let Y=(0,m.useSyncExternalStore)(b.subscribe,()=>U.getSnapshot(),()=>U.getServerSnapshot());return n&&v(Y,{client:u,queryHash:b.queryHash,identityError:b.identityError,observer:U}),Y}var Q=e(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]);export{Y as n,Q as t};