ref0-git 0.0.0 → 0.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/app/apps/github/.dev.vars.example +6 -0
- package/app/apps/github/README.md +70 -0
- package/app/apps/github/THIRD_PARTY_NOTICES.md +214 -0
- package/app/apps/github/components.json +25 -0
- package/app/apps/github/generated/git-rest.ts +10444 -0
- package/app/apps/github/generated/routeTree.gen.ts +1242 -0
- package/app/apps/github/migrations/postgres/0001_auth.sql +46 -0
- package/app/apps/github/migrations/sql/0001_auth.sql +19 -0
- package/app/apps/github/migrations/sql/0002_passkeys.sql +9 -0
- package/app/apps/github/migrations/sql/0003_orgs.sql +22 -0
- package/app/apps/github/migrations/sql/0004_avatars.sql +6 -0
- package/app/apps/github/package.json +80 -0
- package/app/apps/github/src/branches/branch-list.tsx +385 -0
- package/app/apps/github/src/branches/branches.ts +55 -0
- package/app/apps/github/src/clients/allowed.ts +213 -0
- package/app/apps/github/src/clients/at-most.ts +17 -0
- package/app/apps/github/src/clients/avatars.ts +410 -0
- package/app/apps/github/src/clients/cached.ts +65 -0
- package/app/apps/github/src/clients/calls.ts +160 -0
- package/app/apps/github/src/clients/clients.ts +82 -0
- package/app/apps/github/src/clients/graphql.ts +50 -0
- package/app/apps/github/src/clients/host-answer.ts +28 -0
- package/app/apps/github/src/clients/host-calls.ts +382 -0
- package/app/apps/github/src/clients/icon-bytes.ts +203 -0
- package/app/apps/github/src/clients/proxy.ts +59 -0
- package/app/apps/github/src/clients/session-ended.ts +18 -0
- package/app/apps/github/src/clients/transfers.ts +212 -0
- package/app/apps/github/src/code/breadcrumbs.tsx +50 -0
- package/app/apps/github/src/code/code-page.tsx +147 -0
- package/app/apps/github/src/code/code-tree.tsx +338 -0
- package/app/apps/github/src/code/controls.tsx +230 -0
- package/app/apps/github/src/code/file-view.tsx +450 -0
- package/app/apps/github/src/code/files.ts +332 -0
- package/app/apps/github/src/code/folder-list.tsx +122 -0
- package/app/apps/github/src/code/go-to-file.tsx +131 -0
- package/app/apps/github/src/code/highlighted.tsx +58 -0
- package/app/apps/github/src/code/lines.ts +46 -0
- package/app/apps/github/src/code/load.ts +147 -0
- package/app/apps/github/src/code/markdown-files.ts +58 -0
- package/app/apps/github/src/code/places.ts +88 -0
- package/app/apps/github/src/code/ref-pages.ts +179 -0
- package/app/apps/github/src/code/ref-switcher.tsx +203 -0
- package/app/apps/github/src/code/refs.ts +142 -0
- package/app/apps/github/src/code/repo-home.tsx +240 -0
- package/app/apps/github/src/code/repo.ts +105 -0
- package/app/apps/github/src/code/saved-reads.ts +199 -0
- package/app/apps/github/src/code/saved.ts +110 -0
- package/app/apps/github/src/code/tree-fold.ts +186 -0
- package/app/apps/github/src/code/trees.ts +136 -0
- package/app/apps/github/src/components/avatar-picture.ts +53 -0
- package/app/apps/github/src/components/avatar-url.ts +16 -0
- package/app/apps/github/src/components/confirm-action.tsx +100 -0
- package/app/apps/github/src/components/count.tsx +24 -0
- package/app/apps/github/src/components/create-button.tsx +38 -0
- package/app/apps/github/src/components/file-icons/file-icons.css +225 -0
- package/app/apps/github/src/components/file-icons/file-icons.tsx +138 -0
- package/app/apps/github/src/components/filter.tsx +35 -0
- package/app/apps/github/src/components/hotkeys/hotkeys.tsx +255 -0
- package/app/apps/github/src/components/item-list.tsx +65 -0
- package/app/apps/github/src/components/language-dot.tsx +29 -0
- package/app/apps/github/src/components/list-toolbar.tsx +82 -0
- package/app/apps/github/src/components/markdown/editor.tsx +57 -0
- package/app/apps/github/src/components/markdown/markdown.css +177 -0
- package/app/apps/github/src/components/markdown/markdown.tsx +82 -0
- package/app/apps/github/src/components/owner-card.tsx +196 -0
- package/app/apps/github/src/components/pull-status.tsx +34 -0
- package/app/apps/github/src/components/recent.ts +41 -0
- package/app/apps/github/src/components/relative-time.tsx +78 -0
- package/app/apps/github/src/components/repos/icon-hashes.ts +91 -0
- package/app/apps/github/src/components/repos/new-repo-form.tsx +196 -0
- package/app/apps/github/src/components/repos/repo-icon.tsx +47 -0
- package/app/apps/github/src/components/repos/repo-list.tsx +528 -0
- package/app/apps/github/src/components/repos/your-repos.tsx +124 -0
- package/app/apps/github/src/components/review-state.tsx +75 -0
- package/app/apps/github/src/components/route-dialog.tsx +137 -0
- package/app/apps/github/src/components/save-button.tsx +58 -0
- package/app/apps/github/src/components/shell/app-shell.tsx +164 -0
- package/app/apps/github/src/components/shell/create-org-dialog.tsx +118 -0
- package/app/apps/github/src/components/shell/create-row.tsx +49 -0
- package/app/apps/github/src/components/shell/link-menu.tsx +94 -0
- package/app/apps/github/src/components/shell/nav-user.tsx +97 -0
- package/app/apps/github/src/components/shell/owner-repos.tsx +247 -0
- package/app/apps/github/src/components/shell/owner-switcher.tsx +104 -0
- package/app/apps/github/src/components/shell/repo-switcher.tsx +179 -0
- package/app/apps/github/src/components/shell/sections.ts +31 -0
- package/app/apps/github/src/components/shell/submenu-chevron.ts +147 -0
- package/app/apps/github/src/components/signin/device-card.tsx +139 -0
- package/app/apps/github/src/components/signin/login-form.tsx +88 -0
- package/app/apps/github/src/components/signin/signin-page.tsx +33 -0
- package/app/apps/github/src/components/signin/signup-form.tsx +106 -0
- package/app/apps/github/src/components/states/live-status.tsx +42 -0
- package/app/apps/github/src/components/states/states.tsx +126 -0
- package/app/apps/github/src/components/tab-indicator.tsx +143 -0
- package/app/apps/github/src/components/theme-choice.tsx +108 -0
- package/app/apps/github/src/components/theme-provider.tsx +126 -0
- package/app/apps/github/src/components/tones.ts +23 -0
- package/app/apps/github/src/components/ui/alert-dialog.tsx +187 -0
- package/app/apps/github/src/components/ui/alert.tsx +78 -0
- package/app/apps/github/src/components/ui/avatar.tsx +106 -0
- package/app/apps/github/src/components/ui/badge.tsx +51 -0
- package/app/apps/github/src/components/ui/breadcrumb.tsx +124 -0
- package/app/apps/github/src/components/ui/button-group.tsx +87 -0
- package/app/apps/github/src/components/ui/button.tsx +61 -0
- package/app/apps/github/src/components/ui/calendar.tsx +221 -0
- package/app/apps/github/src/components/ui/card.tsx +102 -0
- package/app/apps/github/src/components/ui/checkbox.tsx +26 -0
- package/app/apps/github/src/components/ui/collapsible.tsx +19 -0
- package/app/apps/github/src/components/ui/combobox.tsx +304 -0
- package/app/apps/github/src/components/ui/command.tsx +208 -0
- package/app/apps/github/src/components/ui/dialog.tsx +156 -0
- package/app/apps/github/src/components/ui/dropdown-menu.tsx +290 -0
- package/app/apps/github/src/components/ui/empty.tsx +100 -0
- package/app/apps/github/src/components/ui/field.tsx +236 -0
- package/app/apps/github/src/components/ui/hover-card.tsx +48 -0
- package/app/apps/github/src/components/ui/input-group.tsx +163 -0
- package/app/apps/github/src/components/ui/input.tsx +19 -0
- package/app/apps/github/src/components/ui/item.tsx +201 -0
- package/app/apps/github/src/components/ui/kbd.tsx +27 -0
- package/app/apps/github/src/components/ui/label.tsx +33 -0
- package/app/apps/github/src/components/ui/popover.tsx +87 -0
- package/app/apps/github/src/components/ui/radio-group.tsx +35 -0
- package/app/apps/github/src/components/ui/select.tsx +198 -0
- package/app/apps/github/src/components/ui/separator.tsx +22 -0
- package/app/apps/github/src/components/ui/sheet.tsx +138 -0
- package/app/apps/github/src/components/ui/sidebar.tsx +724 -0
- package/app/apps/github/src/components/ui/skeleton.tsx +13 -0
- package/app/apps/github/src/components/ui/sonner.tsx +47 -0
- package/app/apps/github/src/components/ui/styles.css +242 -0
- package/app/apps/github/src/components/ui/table.tsx +113 -0
- package/app/apps/github/src/components/ui/tabs.tsx +79 -0
- package/app/apps/github/src/components/ui/textarea.tsx +17 -0
- package/app/apps/github/src/components/ui/title.ts +6 -0
- package/app/apps/github/src/components/ui/toggle-group.tsx +89 -0
- package/app/apps/github/src/components/ui/toggle.tsx +42 -0
- package/app/apps/github/src/components/ui/tooltip.tsx +63 -0
- package/app/apps/github/src/components/user-avatar.tsx +145 -0
- package/app/apps/github/src/components/view-tabs.tsx +42 -0
- package/app/apps/github/src/context/context.ts +133 -0
- package/app/apps/github/src/diffs/blobs.ts +94 -0
- package/app/apps/github/src/diffs/diff-view.tsx +155 -0
- package/app/apps/github/src/diffs/files.ts +121 -0
- package/app/apps/github/src/diffs/hunks.tsx +454 -0
- package/app/apps/github/src/diffs/patch.ts +131 -0
- package/app/apps/github/src/diffs/rows.ts +137 -0
- package/app/apps/github/src/history/commit-diff.ts +54 -0
- package/app/apps/github/src/history/commit-list.tsx +207 -0
- package/app/apps/github/src/history/commit-page.tsx +147 -0
- package/app/apps/github/src/history/history.ts +129 -0
- package/app/apps/github/src/hooks/allowed.ts +31 -0
- package/app/apps/github/src/hooks/answers.ts +65 -0
- package/app/apps/github/src/hooks/avatars.ts +54 -0
- package/app/apps/github/src/hooks/draft.ts +38 -0
- package/app/apps/github/src/hooks/open-counts.ts +127 -0
- package/app/apps/github/src/hooks/profiles.ts +120 -0
- package/app/apps/github/src/hooks/repos.ts +440 -0
- package/app/apps/github/src/hooks/use-mobile.ts +19 -0
- package/app/apps/github/src/hooks/viewer.ts +39 -0
- package/app/apps/github/src/inbox/count.ts +70 -0
- package/app/apps/github/src/inbox/inbox-item.tsx +66 -0
- package/app/apps/github/src/inbox/inbox-page.tsx +572 -0
- package/app/apps/github/src/inbox/marks.ts +130 -0
- package/app/apps/github/src/inbox/release-tags.ts +65 -0
- package/app/apps/github/src/inbox/search.ts +97 -0
- package/app/apps/github/src/inbox/subjects.ts +184 -0
- package/app/apps/github/src/inbox/subscription-controls.tsx +184 -0
- package/app/apps/github/src/inbox/subscriptions.ts +189 -0
- package/app/apps/github/src/inbox/threads.ts +198 -0
- package/app/apps/github/src/issues/changes.ts +332 -0
- package/app/apps/github/src/issues/counts.ts +62 -0
- package/app/apps/github/src/issues/issue-list.tsx +682 -0
- package/app/apps/github/src/issues/issue-page.tsx +533 -0
- package/app/apps/github/src/issues/issues.ts +566 -0
- package/app/apps/github/src/issues/label-dialog.tsx +310 -0
- package/app/apps/github/src/issues/labels-page.tsx +119 -0
- package/app/apps/github/src/issues/new-issue.tsx +79 -0
- package/app/apps/github/src/issues/parts.tsx +71 -0
- package/app/apps/github/src/issues/picker.tsx +298 -0
- package/app/apps/github/src/issues/search.ts +238 -0
- package/app/apps/github/src/issues/sidebar.tsx +236 -0
- package/app/apps/github/src/lib/cn.ts +8 -0
- package/app/apps/github/src/lib/highlighting.ts +13 -0
- package/app/apps/github/src/live/follow.ts +129 -0
- package/app/apps/github/src/live/sse.ts +74 -0
- package/app/apps/github/src/live/use-follow.ts +37 -0
- package/app/apps/github/src/markdown/README.md +53 -0
- package/app/apps/github/src/markdown/allowed-html.ts +69 -0
- package/app/apps/github/src/markdown/context.ts +206 -0
- package/app/apps/github/src/markdown/images.ts +81 -0
- package/app/apps/github/src/markdown/lookup.ts +127 -0
- package/app/apps/github/src/markdown/patches.ts +299 -0
- package/app/apps/github/src/markdown/query.ts +25 -0
- package/app/apps/github/src/markdown/references.ts +158 -0
- package/app/apps/github/src/markdown/render.ts +103 -0
- package/app/apps/github/src/names/owners.ts +51 -0
- package/app/apps/github/src/names/repos.ts +24 -0
- package/app/apps/github/src/palette/palette.tsx +562 -0
- package/app/apps/github/src/palette/recent.ts +116 -0
- package/app/apps/github/src/palette/rows.tsx +487 -0
- package/app/apps/github/src/palette/server.ts +107 -0
- package/app/apps/github/src/palette/targets.ts +306 -0
- package/app/apps/github/src/policy.ts +606 -0
- package/app/apps/github/src/private-repos.ts +47 -0
- package/app/apps/github/src/pulls/compare-page.tsx +342 -0
- package/app/apps/github/src/pulls/files-tab.tsx +776 -0
- package/app/apps/github/src/pulls/live.ts +124 -0
- package/app/apps/github/src/pulls/merge-box.tsx +367 -0
- package/app/apps/github/src/pulls/merge-button.ts +86 -0
- package/app/apps/github/src/pulls/pull-list.tsx +235 -0
- package/app/apps/github/src/pulls/pull-page.tsx +474 -0
- package/app/apps/github/src/pulls/pull.ts +468 -0
- package/app/apps/github/src/pulls/pulls.ts +318 -0
- package/app/apps/github/src/pulls/review.ts +350 -0
- package/app/apps/github/src/pulls/search.ts +130 -0
- package/app/apps/github/src/queue/queue-page.tsx +405 -0
- package/app/apps/github/src/queue/queue.ts +231 -0
- package/app/apps/github/src/releases/latest-release.tsx +55 -0
- package/app/apps/github/src/releases/overview.tsx +30 -0
- package/app/apps/github/src/releases/release-form.tsx +353 -0
- package/app/apps/github/src/releases/release-list.tsx +173 -0
- package/app/apps/github/src/releases/release-view.tsx +183 -0
- package/app/apps/github/src/releases/releases.ts +308 -0
- package/app/apps/github/src/releases/tag-list.tsx +134 -0
- package/app/apps/github/src/router.tsx +46 -0
- package/app/apps/github/src/routes/$owner/$repo/_code/blob/$.tsx +33 -0
- package/app/apps/github/src/routes/$owner/$repo/_code/tree/$.tsx +28 -0
- package/app/apps/github/src/routes/$owner/$repo/_code.tsx +11 -0
- package/app/apps/github/src/routes/$owner/$repo/_releases/releases/index.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/_releases/tags.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/_releases.tsx +23 -0
- package/app/apps/github/src/routes/$owner/$repo/branches.tsx +39 -0
- package/app/apps/github/src/routes/$owner/$repo/commit/$sha.tsx +34 -0
- package/app/apps/github/src/routes/$owner/$repo/commits/$.tsx +42 -0
- package/app/apps/github/src/routes/$owner/$repo/compare/$.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/index.tsx +24 -0
- package/app/apps/github/src/routes/$owner/$repo/issues/$number.tsx +50 -0
- package/app/apps/github/src/routes/$owner/$repo/issues/index.tsx +53 -0
- package/app/apps/github/src/routes/$owner/$repo/issues/new.tsx +43 -0
- package/app/apps/github/src/routes/$owner/$repo/labels.tsx +22 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/checks.tsx +15 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/commits.tsx +15 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/files.tsx +15 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/index.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/route.tsx +52 -0
- package/app/apps/github/src/routes/$owner/$repo/pulls/index.tsx +48 -0
- package/app/apps/github/src/routes/$owner/$repo/queue.tsx +22 -0
- package/app/apps/github/src/routes/$owner/$repo/releases/edit/$.tsx +58 -0
- package/app/apps/github/src/routes/$owner/$repo/releases/new.tsx +40 -0
- package/app/apps/github/src/routes/$owner/$repo/releases/tag/$.tsx +35 -0
- package/app/apps/github/src/routes/$owner/$repo/route.tsx +102 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/access.tsx +9 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/hooks/index.tsx +16 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/hooks/new.tsx +25 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/index.tsx +17 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/route.tsx +28 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/rules.tsx +12 -0
- package/app/apps/github/src/routes/$owner/$repo/tokens.tsx +16 -0
- package/app/apps/github/src/routes/$owner/index.tsx +45 -0
- package/app/apps/github/src/routes/-nav.tsx +293 -0
- package/app/apps/github/src/routes/-root-testing.ts +107 -0
- package/app/apps/github/src/routes/__root.tsx +225 -0
- package/app/apps/github/src/routes/api.auth.$.ts +18 -0
- package/app/apps/github/src/routes/downloads/$owner/$repo/$asset.tsx +10 -0
- package/app/apps/github/src/routes/file-icons[.]svg.ts +21 -0
- package/app/apps/github/src/routes/icons/$owner/$repo.tsx +14 -0
- package/app/apps/github/src/routes/icons/$owner/index.tsx +14 -0
- package/app/apps/github/src/routes/icons/index.tsx +12 -0
- package/app/apps/github/src/routes/index.tsx +48 -0
- package/app/apps/github/src/routes/login.tsx +24 -0
- package/app/apps/github/src/routes/login_.code.tsx +31 -0
- package/app/apps/github/src/routes/new.tsx +91 -0
- package/app/apps/github/src/routes/notifications.tsx +20 -0
- package/app/apps/github/src/routes/orgs/$owner/issues.tsx +8 -0
- package/app/apps/github/src/routes/orgs/$owner/pulls.tsx +8 -0
- package/app/apps/github/src/routes/orgs/$owner/releases.tsx +8 -0
- package/app/apps/github/src/routes/orgs/$owner/route.tsx +25 -0
- package/app/apps/github/src/routes/orgs/$owner/settings.tsx +30 -0
- package/app/apps/github/src/routes/orgs/$owner/tokens.tsx +15 -0
- package/app/apps/github/src/routes/settings.tsx +54 -0
- package/app/apps/github/src/routes/signup.tsx +24 -0
- package/app/apps/github/src/routes/uploads/$owner/$repo/$release.tsx +10 -0
- package/app/apps/github/src/seed/acme.ts +498 -0
- package/app/apps/github/src/seed/licenses.ts +114 -0
- package/app/apps/github/src/seed/seed.ts +528 -0
- package/app/apps/github/src/server.ts +97 -0
- package/app/apps/github/src/settings/account-avatar.tsx +43 -0
- package/app/apps/github/src/settings/avatar-section.tsx +140 -0
- package/app/apps/github/src/settings/avatar.ts +58 -0
- package/app/apps/github/src/settings/general-settings.tsx +439 -0
- package/app/apps/github/src/settings/general.ts +73 -0
- package/app/apps/github/src/settings/hook-form.tsx +195 -0
- package/app/apps/github/src/settings/hook-list.tsx +166 -0
- package/app/apps/github/src/settings/hooks.ts +87 -0
- package/app/apps/github/src/settings/org-settings.tsx +228 -0
- package/app/apps/github/src/settings/orgs.ts +116 -0
- package/app/apps/github/src/settings/rule-list.tsx +72 -0
- package/app/apps/github/src/settings/rules.ts +27 -0
- package/app/apps/github/src/settings/settings-layout.tsx +114 -0
- package/app/apps/github/src/signin/approval.ts +186 -0
- package/app/apps/github/src/signin/auth-client.ts +127 -0
- package/app/apps/github/src/signin/auth.ts +753 -0
- package/app/apps/github/src/signin/avatars.ts +126 -0
- package/app/apps/github/src/signin/client-ip.ts +39 -0
- package/app/apps/github/src/signin/credentials.ts +26 -0
- package/app/apps/github/src/signin/device-code.ts +95 -0
- package/app/apps/github/src/signin/device-prompt.ts +125 -0
- package/app/apps/github/src/signin/errors.ts +135 -0
- package/app/apps/github/src/signin/host-session.ts +68 -0
- package/app/apps/github/src/signin/orgs.ts +283 -0
- package/app/apps/github/src/signin/owner-names.ts +183 -0
- package/app/apps/github/src/signin/person-lock.ts +104 -0
- package/app/apps/github/src/signin/seal.ts +88 -0
- package/app/apps/github/src/signin/seed-people.ts +92 -0
- package/app/apps/github/src/signin/session.ts +48 -0
- package/app/apps/github/src/signin/unborn.ts +110 -0
- package/app/apps/github/src/signin/viewer-orgs.ts +47 -0
- package/app/apps/github/src/signin/viewer.ts +74 -0
- package/app/apps/github/src/signin/with-headers.ts +14 -0
- package/app/apps/github/src/tokens/tokens-page.tsx +529 -0
- package/app/apps/github/src/tokens/tokens.ts +54 -0
- package/app/apps/github/tsconfig.json +25 -0
- package/app/apps/github/tsconfig.worker.json +24 -0
- package/app/apps/github/vite.config.ts +21 -0
- package/app/pnpm-workspace.yaml +216 -0
- package/app/tsconfig.base.json +127 -0
- package/dist/LICENSE +202 -0
- package/dist/cli/child.mjs +42 -0
- package/dist/cli/commands.mjs +23 -0
- package/dist/cli/credentials.mjs +84 -0
- package/dist/cli/documents.mjs +214 -0
- package/dist/cli/events.mjs +55 -0
- package/dist/cli/failure.mjs +105 -0
- package/dist/cli/folders.mjs +32 -0
- package/dist/cli/git-remote-ref0.d.mts +1 -0
- package/dist/cli/git-remote-ref0.mjs +29 -0
- package/dist/cli/git.mjs +69 -0
- package/dist/cli/helpers.mjs +184 -0
- package/dist/cli/hosts.mjs +127 -0
- package/dist/cli/node.mjs +15 -0
- package/dist/cli/output.mjs +135 -0
- package/dist/cli/prompt.mjs +35 -0
- package/dist/cli/queue.mjs +215 -0
- package/dist/cli/ref0-git.d.mts +1 -0
- package/dist/cli/ref0-git.mjs +144 -0
- package/dist/cli/repos.mjs +162 -0
- package/dist/cli/resources.mjs +131 -0
- package/dist/cli/run-end.mjs +57 -0
- package/dist/cli/runtime.mjs +50 -0
- package/dist/cli/setup.mjs +1410 -0
- package/dist/cli/sign-in.mjs +162 -0
- package/dist/cli/sign-ins.mjs +136 -0
- package/dist/cli/sqlite.mjs +28 -0
- package/dist/cli/tokens.mjs +141 -0
- package/dist/cli/vendor.mjs +123 -0
- package/dist/init/app.mjs +231 -0
- package/dist/init/astro.mjs +49 -0
- package/dist/init/choices.mjs +497 -0
- package/dist/init/cloudflare.mjs +324 -0
- package/dist/init/create.mjs +151 -0
- package/dist/init/detect.mjs +297 -0
- package/dist/init/files.mjs +80 -0
- package/dist/init/frameworks.mjs +248 -0
- package/dist/init/git-module.mjs +49 -0
- package/dist/init/github-routes.mjs +66 -0
- package/dist/init/jsonc.mjs +143 -0
- package/dist/init/metadata.mjs +48 -0
- package/dist/init/mounts.mjs +109 -0
- package/dist/init/next.mjs +203 -0
- package/dist/init/node-app.mjs +189 -0
- package/dist/init/node.mjs +460 -0
- package/dist/init/nuxt.mjs +115 -0
- package/dist/init/output.mjs +21 -0
- package/dist/init/plan.mjs +82 -0
- package/dist/init/range-major.mjs +257 -0
- package/dist/init/react-router.mjs +59 -0
- package/dist/init/routes.mjs +148 -0
- package/dist/init/shell.mjs +4 -0
- package/dist/init/stores.mjs +51 -0
- package/dist/init/sveltekit.mjs +139 -0
- package/dist/init/template.mjs +142 -0
- package/dist/init/templates.mjs +343 -0
- package/dist/init/vercel.mjs +384 -0
- package/dist/init/versions.mjs +32 -0
- package/dist/init/workspace.mjs +20 -0
- package/package.json +48 -6
- package/README.md +0 -5
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import { Link, useLocation } from '@tanstack/react-router';
|
|
2
|
+
import { type ReactNode, useEffect } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
BookMarkedIcon,
|
|
5
|
+
ChevronDownIcon,
|
|
6
|
+
CircleDotIcon,
|
|
7
|
+
GitPullRequestIcon,
|
|
8
|
+
type LucideIcon,
|
|
9
|
+
ScaleIcon,
|
|
10
|
+
SearchIcon,
|
|
11
|
+
} from 'lucide-react';
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
filtersInBrowser,
|
|
15
|
+
languagesOf,
|
|
16
|
+
maxFiltered,
|
|
17
|
+
type Owner,
|
|
18
|
+
type RepoFilter,
|
|
19
|
+
type RepoRow,
|
|
20
|
+
type RepoSort,
|
|
21
|
+
type RepoType,
|
|
22
|
+
shownRepos,
|
|
23
|
+
useRepos,
|
|
24
|
+
} from '../../hooks/repos.ts';
|
|
25
|
+
import { type OpenCounts, useOpenCounts } from '../../hooks/open-counts.ts';
|
|
26
|
+
import { HotkeyHint, hotkeys } from '../hotkeys/hotkeys.tsx';
|
|
27
|
+
import { ItemList } from '../item-list.tsx';
|
|
28
|
+
import { LanguageDot, LanguageMark } from '../language-dot.tsx';
|
|
29
|
+
import { RelativeTime } from '../relative-time.tsx';
|
|
30
|
+
import { Alert, AlertDescription } from '../ui/alert.tsx';
|
|
31
|
+
import { Badge } from '../ui/badge.tsx';
|
|
32
|
+
import { Button } from '../ui/button.tsx';
|
|
33
|
+
import {
|
|
34
|
+
DropdownMenu,
|
|
35
|
+
DropdownMenuContent,
|
|
36
|
+
DropdownMenuRadioGroup,
|
|
37
|
+
DropdownMenuRadioItem,
|
|
38
|
+
DropdownMenuTrigger,
|
|
39
|
+
} from '../ui/dropdown-menu.tsx';
|
|
40
|
+
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '../ui/empty.tsx';
|
|
41
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from '../ui/input-group.tsx';
|
|
42
|
+
import { Item, ItemContent, ItemDescription, ItemTitle } from '../ui/item.tsx';
|
|
43
|
+
import { Skeleton } from '../ui/skeleton.tsx';
|
|
44
|
+
import { cn } from '#/lib/cn';
|
|
45
|
+
import { CreateButton } from '../create-button.tsx';
|
|
46
|
+
import { ListToolbar } from '../list-toolbar.tsx';
|
|
47
|
+
import { RepoIcon } from './repo-icon.tsx';
|
|
48
|
+
|
|
49
|
+
/** One choice in a toolbar menu: what the filter holds, what the menu says, and its mark. */
|
|
50
|
+
interface Choice<Value extends string> {
|
|
51
|
+
readonly value: Value;
|
|
52
|
+
readonly label: string;
|
|
53
|
+
/** What the menu draws before its label, such as a language's `LanguageMark`. */
|
|
54
|
+
readonly mark?: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const types: readonly Choice<RepoType>[] = [
|
|
58
|
+
{ value: 'all', label: 'All' },
|
|
59
|
+
{ value: 'public', label: 'Public' },
|
|
60
|
+
{ value: 'private', label: 'Private' },
|
|
61
|
+
{ value: 'sources', label: 'Sources' },
|
|
62
|
+
{ value: 'forks', label: 'Forks' },
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
const sorts: readonly Choice<RepoSort>[] = [
|
|
66
|
+
{ value: 'updated', label: 'Last updated' },
|
|
67
|
+
{ value: 'name', label: 'Name' },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A toolbar menu that picks one of `choices`, as GitHub's Type, Language and Sort menus do: its
|
|
72
|
+
* button names the menu and the choice it holds. When a choice has a mark, every item keeps a slot
|
|
73
|
+
* of the menu's icon size before its label, empty for a choice with none, so the labels line up.
|
|
74
|
+
*/
|
|
75
|
+
function FilterMenu<Value extends string>({
|
|
76
|
+
name,
|
|
77
|
+
choices,
|
|
78
|
+
value,
|
|
79
|
+
onPick,
|
|
80
|
+
}: {
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly choices: readonly Choice<Value>[];
|
|
83
|
+
readonly value: Value;
|
|
84
|
+
readonly onPick: (value: Value) => void;
|
|
85
|
+
}) {
|
|
86
|
+
const held = choices.find((choice) => choice.value === value)?.label ?? value;
|
|
87
|
+
const marked = choices.some((choice) => choice.mark !== undefined);
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<DropdownMenu>
|
|
91
|
+
<DropdownMenuTrigger render={<Button variant="outline" size="lg" />}>
|
|
92
|
+
{name}: {held}
|
|
93
|
+
<ChevronDownIcon data-icon="inline-end" />
|
|
94
|
+
</DropdownMenuTrigger>
|
|
95
|
+
<DropdownMenuContent align="end" className="w-auto">
|
|
96
|
+
<DropdownMenuRadioGroup
|
|
97
|
+
value={value}
|
|
98
|
+
onValueChange={(picked) => {
|
|
99
|
+
const choice = choices.find((each) => each.value === picked);
|
|
100
|
+
if (choice !== undefined) onPick(choice.value);
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
{choices.map((choice) => (
|
|
104
|
+
<DropdownMenuRadioItem key={choice.value} value={choice.value}>
|
|
105
|
+
{marked && (
|
|
106
|
+
<span
|
|
107
|
+
data-slot="menu-mark"
|
|
108
|
+
className="flex size-4 shrink-0 items-center justify-center"
|
|
109
|
+
>
|
|
110
|
+
{choice.mark}
|
|
111
|
+
</span>
|
|
112
|
+
)}
|
|
113
|
+
{choice.label}
|
|
114
|
+
</DropdownMenuRadioItem>
|
|
115
|
+
))}
|
|
116
|
+
</DropdownMenuRadioGroup>
|
|
117
|
+
</DropdownMenuContent>
|
|
118
|
+
</DropdownMenu>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** One of a row's counts: what it counts, its icon, and the list it links to. */
|
|
123
|
+
interface Counted {
|
|
124
|
+
readonly kind: 'issues' | 'pulls';
|
|
125
|
+
readonly one: string;
|
|
126
|
+
readonly many: string;
|
|
127
|
+
readonly Icon: LucideIcon;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const issuesCounted: Counted = {
|
|
131
|
+
kind: 'issues',
|
|
132
|
+
one: 'open issue',
|
|
133
|
+
many: 'open issues',
|
|
134
|
+
Icon: CircleDotIcon,
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const pullsCounted: Counted = {
|
|
138
|
+
kind: 'pulls',
|
|
139
|
+
one: 'open pull request',
|
|
140
|
+
many: 'open pull requests',
|
|
141
|
+
Icon: GitPullRequestIcon,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A repo's open issues or open pull requests: the sidebar's icon and the count, linking to that
|
|
146
|
+
* open list, above the row's covering link. A zero is muted. Until the count is known, or when it
|
|
147
|
+
* can't be, nothing shows, never 0, in a space the count's width holds so the row doesn't shift.
|
|
148
|
+
*/
|
|
149
|
+
function OpenCount({
|
|
150
|
+
owner,
|
|
151
|
+
repo,
|
|
152
|
+
counted,
|
|
153
|
+
count,
|
|
154
|
+
}: {
|
|
155
|
+
readonly owner: string;
|
|
156
|
+
readonly repo: string;
|
|
157
|
+
readonly counted: Counted;
|
|
158
|
+
readonly count: number | undefined;
|
|
159
|
+
}) {
|
|
160
|
+
const { Icon } = counted;
|
|
161
|
+
|
|
162
|
+
if (count === undefined) {
|
|
163
|
+
return (
|
|
164
|
+
<span aria-hidden data-slot="open-count-held" className="invisible inline-flex gap-1">
|
|
165
|
+
<Icon className="size-4" />
|
|
166
|
+
<span className="min-w-[2ch]" />
|
|
167
|
+
</span>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<Link
|
|
173
|
+
to={counted.kind === 'issues' ? '/$owner/$repo/issues' : '/$owner/$repo/pulls'}
|
|
174
|
+
params={{ owner, repo }}
|
|
175
|
+
aria-label={`${count.toLocaleString('en')} ${count === 1 ? counted.one : counted.many}`}
|
|
176
|
+
className={cn(
|
|
177
|
+
'relative inline-flex items-center gap-1 rounded-sm tabular-nums outline-none hover:text-link focus-visible:ring-[3px] focus-visible:ring-ring',
|
|
178
|
+
count === 0 ? 'text-muted-foreground' : 'text-foreground',
|
|
179
|
+
)}
|
|
180
|
+
>
|
|
181
|
+
<Icon aria-hidden className="size-4" />
|
|
182
|
+
<span className="min-w-[2ch]">{count.toLocaleString('en')}</span>
|
|
183
|
+
</Link>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* One repository's row: its name and visibility, what it is, its language and license, and when it
|
|
189
|
+
* last changed, with its open issues and pull requests at its top right, or on a phone beside its
|
|
190
|
+
* language.
|
|
191
|
+
*/
|
|
192
|
+
function RepoItem({
|
|
193
|
+
repo,
|
|
194
|
+
counts,
|
|
195
|
+
}: {
|
|
196
|
+
readonly repo: RepoRow;
|
|
197
|
+
readonly counts: OpenCounts | undefined;
|
|
198
|
+
}) {
|
|
199
|
+
// Its owner, as its full name has it before its name.
|
|
200
|
+
const [owner = ''] = repo.full_name.split('/');
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
// The whole row is the repository's link: its name's link covers the row, which highlights
|
|
204
|
+
// while it's hovered or focused, so the row stays one list item with one link, named for it.
|
|
205
|
+
// Square, as the list's rows sit flush against its edge and its separators. No press: a row
|
|
206
|
+
// that sinks pulls its highlight in from the list's borders.
|
|
207
|
+
// A grid, so the counts take the title's line at the top right, and on a phone the details'
|
|
208
|
+
// line, after them.
|
|
209
|
+
<Item
|
|
210
|
+
role="listitem"
|
|
211
|
+
className="relative rounded-none has-[a:hover]:bg-hover has-[a[data-row-link]:focus-visible]:ring-[3px] has-[a[data-row-link]:focus-visible]:ring-ring"
|
|
212
|
+
>
|
|
213
|
+
<ItemContent className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto] gap-x-4">
|
|
214
|
+
<ItemTitle className="col-start-1 line-clamp-none flex max-w-full flex-wrap wrap-anywhere">
|
|
215
|
+
<RepoIcon owner={owner} repo={repo.name} />
|
|
216
|
+
{/* The router's link, so going into a repo is a page change, not a whole page load. */}
|
|
217
|
+
<Link
|
|
218
|
+
data-row-link
|
|
219
|
+
className="text-sm font-semibold wrap-anywhere outline-none after:absolute after:inset-0 hover:underline"
|
|
220
|
+
to="/$owner/$repo"
|
|
221
|
+
params={{ owner, repo: repo.name }}
|
|
222
|
+
>
|
|
223
|
+
{repo.name}
|
|
224
|
+
</Link>
|
|
225
|
+
<Badge variant="outline">{repo.private ? 'Private' : 'Public'}</Badge>
|
|
226
|
+
{repo.fork && <Badge variant="secondary">Fork</Badge>}
|
|
227
|
+
{repo.archived && <Badge variant="secondary">Archived</Badge>}
|
|
228
|
+
</ItemTitle>
|
|
229
|
+
{repo.description !== null && repo.description !== '' && (
|
|
230
|
+
<ItemDescription className="col-span-2">{repo.description}</ItemDescription>
|
|
231
|
+
)}
|
|
232
|
+
<div className="col-start-1 flex flex-wrap items-center gap-x-4 gap-y-1 text-meta text-muted-foreground">
|
|
233
|
+
<LanguageDot name={repo.language} />
|
|
234
|
+
{repo.license !== null && (
|
|
235
|
+
<span className="inline-flex items-center gap-1">
|
|
236
|
+
<ScaleIcon aria-hidden className="size-3.5" />
|
|
237
|
+
{repo.license}
|
|
238
|
+
</span>
|
|
239
|
+
)}
|
|
240
|
+
{repo.updated_at !== null && (
|
|
241
|
+
<span>
|
|
242
|
+
Updated <RelativeTime at={repo.updated_at} />
|
|
243
|
+
</span>
|
|
244
|
+
)}
|
|
245
|
+
</div>
|
|
246
|
+
{/* Placed by its column alone, it follows the details onto their line; from `sm` up, the title's. */}
|
|
247
|
+
<div
|
|
248
|
+
data-slot="open-counts"
|
|
249
|
+
className="col-start-2 flex items-center gap-3 self-start text-meta sm:row-start-1"
|
|
250
|
+
>
|
|
251
|
+
<OpenCount
|
|
252
|
+
owner={owner}
|
|
253
|
+
repo={repo.name}
|
|
254
|
+
counted={issuesCounted}
|
|
255
|
+
count={counts?.issues}
|
|
256
|
+
/>
|
|
257
|
+
<OpenCount owner={owner} repo={repo.name} counted={pullsCounted} count={counts?.pulls} />
|
|
258
|
+
</div>
|
|
259
|
+
</ItemContent>
|
|
260
|
+
</Item>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** How many rows a list draws while it loads: before it does, nothing knows how many it holds. */
|
|
265
|
+
const loadingRows = [0, 1, 2];
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* A list loading, drawn as `RepoItem` draws its rows: the same bordered list, and in each row a
|
|
269
|
+
* name and badge, a description and a line of details, each inside the text it stands for, so it
|
|
270
|
+
* takes that text's height and the rows replace it in place.
|
|
271
|
+
*/
|
|
272
|
+
function LoadingRepos() {
|
|
273
|
+
return (
|
|
274
|
+
<ItemList
|
|
275
|
+
aria-label="Loading repositories"
|
|
276
|
+
aria-busy
|
|
277
|
+
className="border"
|
|
278
|
+
rows={loadingRows}
|
|
279
|
+
keyOf={String}
|
|
280
|
+
row={() => (
|
|
281
|
+
<Item aria-hidden>
|
|
282
|
+
<ItemContent className="min-w-0">
|
|
283
|
+
<ItemTitle>
|
|
284
|
+
<Skeleton className="h-5 w-28" />
|
|
285
|
+
<Skeleton className="h-5 w-12 rounded-sm" />
|
|
286
|
+
</ItemTitle>
|
|
287
|
+
<div className="text-sm">
|
|
288
|
+
<Skeleton className="inline-block h-3 w-2/3 align-middle" />
|
|
289
|
+
</div>
|
|
290
|
+
<div className="text-sm">
|
|
291
|
+
<Skeleton className="inline-block h-3 w-48 align-middle" />
|
|
292
|
+
</div>
|
|
293
|
+
</ItemContent>
|
|
294
|
+
</Item>
|
|
295
|
+
)}
|
|
296
|
+
/>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** `/new`'s search for a repository of `owner`'s: an org's names it, so the form starts there. */
|
|
301
|
+
const newUnder = (owner: Owner) => (owner.kind === 'org' ? { owner: owner.login } : {});
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Where New repository closes back to: the page New was pressed on, as `href` names it, with its
|
|
305
|
+
* query. `/` is where it closes anyway, and `/new`'s own list sits behind its dialog.
|
|
306
|
+
*/
|
|
307
|
+
const returnFrom = (href: string, pathname: string) =>
|
|
308
|
+
href === '/' || pathname === '/new' ? {} : { return_to: href };
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* What a list says when it has nothing to show. With no repositories yet, a quiet line: the toolbar
|
|
312
|
+
* above offers New. A search that matched none says what to try, and a list under another's toolbar
|
|
313
|
+
* says it in a line, so the lists after it stay in view.
|
|
314
|
+
*/
|
|
315
|
+
function NoRepos({ searched, brief }: { readonly searched: boolean; readonly brief: boolean }) {
|
|
316
|
+
if (brief || !searched) {
|
|
317
|
+
return (
|
|
318
|
+
<p className="text-sm text-muted-foreground">
|
|
319
|
+
{searched ? 'No repositories matched your search.' : 'No repositories yet.'}
|
|
320
|
+
</p>
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return (
|
|
325
|
+
<Empty>
|
|
326
|
+
<EmptyHeader>
|
|
327
|
+
<EmptyMedia variant="icon">
|
|
328
|
+
<BookMarkedIcon />
|
|
329
|
+
</EmptyMedia>
|
|
330
|
+
<EmptyTitle>No repositories matched your search</EmptyTitle>
|
|
331
|
+
<EmptyDescription>Try a different name, or show all of them.</EmptyDescription>
|
|
332
|
+
</EmptyHeader>
|
|
333
|
+
</Empty>
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* The search and the Type, Language and Sort menus, over `languages`, the loaded rows' own; the
|
|
339
|
+
* Language menu waits until a row has one. New, where the viewer may make `owner`'s repositories.
|
|
340
|
+
*/
|
|
341
|
+
export function RepoToolbar({
|
|
342
|
+
owner,
|
|
343
|
+
filter,
|
|
344
|
+
onFilter,
|
|
345
|
+
languages,
|
|
346
|
+
owns,
|
|
347
|
+
}: {
|
|
348
|
+
readonly owner: Owner;
|
|
349
|
+
readonly filter: RepoFilter;
|
|
350
|
+
readonly onFilter: (filter: RepoFilter) => void;
|
|
351
|
+
readonly languages: readonly string[];
|
|
352
|
+
readonly owns: boolean;
|
|
353
|
+
}) {
|
|
354
|
+
const location = useLocation();
|
|
355
|
+
const languageChoices: readonly Choice<string>[] = [
|
|
356
|
+
{ value: '', label: 'All' },
|
|
357
|
+
...languages.map((language) => ({
|
|
358
|
+
value: language,
|
|
359
|
+
label: language,
|
|
360
|
+
mark: <LanguageMark name={language} />,
|
|
361
|
+
})),
|
|
362
|
+
];
|
|
363
|
+
|
|
364
|
+
return (
|
|
365
|
+
<ListToolbar
|
|
366
|
+
search={
|
|
367
|
+
<InputGroup size="lg">
|
|
368
|
+
<InputGroupInput
|
|
369
|
+
aria-label="Find a repository"
|
|
370
|
+
placeholder="Find a repository…"
|
|
371
|
+
value={filter.search}
|
|
372
|
+
onChange={(event) => onFilter({ ...filter, search: event.target.value })}
|
|
373
|
+
data-hotkey={hotkeys.search}
|
|
374
|
+
/>
|
|
375
|
+
<InputGroupAddon>
|
|
376
|
+
<SearchIcon />
|
|
377
|
+
</InputGroupAddon>
|
|
378
|
+
<HotkeyHint keys={hotkeys.search} className="end-2 bg-background" />
|
|
379
|
+
</InputGroup>
|
|
380
|
+
}
|
|
381
|
+
filters={
|
|
382
|
+
<>
|
|
383
|
+
<FilterMenu
|
|
384
|
+
name="Type"
|
|
385
|
+
choices={types}
|
|
386
|
+
value={filter.type}
|
|
387
|
+
onPick={(type) => onFilter({ ...filter, type })}
|
|
388
|
+
/>
|
|
389
|
+
{(languages.length > 0 || filter.language !== '') && (
|
|
390
|
+
<FilterMenu
|
|
391
|
+
name="Language"
|
|
392
|
+
choices={languageChoices}
|
|
393
|
+
value={filter.language}
|
|
394
|
+
onPick={(language) => onFilter({ ...filter, language })}
|
|
395
|
+
/>
|
|
396
|
+
)}
|
|
397
|
+
<FilterMenu
|
|
398
|
+
name="Sort"
|
|
399
|
+
choices={sorts}
|
|
400
|
+
value={filter.sort}
|
|
401
|
+
onPick={(sort) => onFilter({ ...filter, sort })}
|
|
402
|
+
/>
|
|
403
|
+
</>
|
|
404
|
+
}
|
|
405
|
+
buttons={
|
|
406
|
+
owns ? (
|
|
407
|
+
<CreateButton
|
|
408
|
+
hotkey
|
|
409
|
+
render={
|
|
410
|
+
<Link
|
|
411
|
+
to="/new"
|
|
412
|
+
search={{ ...newUnder(owner), ...returnFrom(location.href, location.pathname) }}
|
|
413
|
+
/>
|
|
414
|
+
}
|
|
415
|
+
>
|
|
416
|
+
New
|
|
417
|
+
</CreateButton>
|
|
418
|
+
) : undefined
|
|
419
|
+
}
|
|
420
|
+
/>
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* `owner`'s repositories, in the order the drop-in sorts them, filtered by the drop-in where its
|
|
426
|
+
* list takes the filter. A search, a language or a type it doesn't take loads every page first, up
|
|
427
|
+
* to `maxFiltered` rows, and past them the list says it searched only those. Without `toolbar`, as
|
|
428
|
+
* an org's list on `/`, it follows a toolbar drawn above it, and tells it the languages its loaded
|
|
429
|
+
* rows are in through `onLanguages`.
|
|
430
|
+
*/
|
|
431
|
+
export function RepoList({
|
|
432
|
+
owner,
|
|
433
|
+
owns,
|
|
434
|
+
filter,
|
|
435
|
+
onFilter,
|
|
436
|
+
toolbar = true,
|
|
437
|
+
onLanguages,
|
|
438
|
+
}: {
|
|
439
|
+
readonly owner: Owner;
|
|
440
|
+
/** Whether the viewer may make repositories here. */
|
|
441
|
+
readonly owns: boolean;
|
|
442
|
+
readonly filter: RepoFilter;
|
|
443
|
+
readonly onFilter: (filter: RepoFilter) => void;
|
|
444
|
+
readonly toolbar?: boolean;
|
|
445
|
+
readonly onLanguages?: (languages: readonly string[]) => void;
|
|
446
|
+
}) {
|
|
447
|
+
const repos = useRepos(owner, filter);
|
|
448
|
+
const loaded = repos.data?.pages.flatMap((page) => page.repos) ?? [];
|
|
449
|
+
const shown = shownRepos(loaded, filter);
|
|
450
|
+
const languages = languagesOf(loaded);
|
|
451
|
+
// Each page's rows' names, whose counts are read a page at a time, for a page with a row shown.
|
|
452
|
+
const pageNames = repos.data?.pages.map((page) => page.repos.map((repo) => repo.full_name)) ?? [];
|
|
453
|
+
const shownNames = new Set(shown.map((repo) => repo.full_name));
|
|
454
|
+
const counts = useOpenCounts(pageNames, (page) => page.some((name) => shownNames.has(name)));
|
|
455
|
+
// The languages as one string, so the toolbar hears of a change, not of each render.
|
|
456
|
+
const heard = languages.join('\n');
|
|
457
|
+
|
|
458
|
+
useEffect(() => onLanguages?.(heard === '' ? [] : heard.split('\n')), [heard, onLanguages]);
|
|
459
|
+
|
|
460
|
+
const searched = filter.search.trim() !== '' || filter.type !== 'all' || filter.language !== '';
|
|
461
|
+
// A filter the drop-in can't apply reads every page first, up to `maxFiltered` rows.
|
|
462
|
+
const inBrowser = filtersInBrowser(owner, filter);
|
|
463
|
+
const capped = loaded.length >= maxFiltered;
|
|
464
|
+
const loadingRest =
|
|
465
|
+
inBrowser && repos.hasNextPage && !capped && !repos.isPlaceholderData && !repos.isError;
|
|
466
|
+
const { fetchNextPage, isFetchingNextPage } = repos;
|
|
467
|
+
|
|
468
|
+
const rows = loaded.length;
|
|
469
|
+
|
|
470
|
+
// Each page loaded asks for the next: a fast page can come back before React draws it loading.
|
|
471
|
+
useEffect(() => {
|
|
472
|
+
if (loadingRest && !isFetchingNextPage) void fetchNextPage();
|
|
473
|
+
}, [loadingRest, isFetchingNextPage, fetchNextPage, rows]);
|
|
474
|
+
|
|
475
|
+
return (
|
|
476
|
+
<section aria-label={`${owner.login}'s repositories`} className="flex flex-col gap-3">
|
|
477
|
+
{toolbar && (
|
|
478
|
+
<RepoToolbar
|
|
479
|
+
owner={owner}
|
|
480
|
+
filter={filter}
|
|
481
|
+
onFilter={onFilter}
|
|
482
|
+
languages={languages}
|
|
483
|
+
owns={owns}
|
|
484
|
+
/>
|
|
485
|
+
)}
|
|
486
|
+
{inBrowser && capped && repos.hasNextPage && (
|
|
487
|
+
<Alert>
|
|
488
|
+
<AlertDescription>
|
|
489
|
+
Searched the first {loaded.length.toLocaleString('en')} repositories. Narrow the search,
|
|
490
|
+
or load more to search past them.
|
|
491
|
+
</AlertDescription>
|
|
492
|
+
</Alert>
|
|
493
|
+
)}
|
|
494
|
+
{repos.isPending && <LoadingRepos />}
|
|
495
|
+
{repos.isError && (
|
|
496
|
+
<Alert variant="destructive">
|
|
497
|
+
<AlertDescription>{repos.error.message}</AlertDescription>
|
|
498
|
+
</Alert>
|
|
499
|
+
)}
|
|
500
|
+
{loadingRest && (
|
|
501
|
+
<p aria-live="polite" className="text-meta text-muted-foreground">
|
|
502
|
+
Loading every repository to filter them…
|
|
503
|
+
</p>
|
|
504
|
+
)}
|
|
505
|
+
{repos.isSuccess && !loadingRest && shown.length === 0 && (
|
|
506
|
+
<NoRepos searched={searched} brief={!toolbar} />
|
|
507
|
+
)}
|
|
508
|
+
{shown.length > 0 && (
|
|
509
|
+
<ItemList
|
|
510
|
+
className="border"
|
|
511
|
+
rows={shown}
|
|
512
|
+
keyOf={(repo) => repo.full_name}
|
|
513
|
+
row={(repo) => <RepoItem repo={repo} counts={counts.get(repo.full_name)} />}
|
|
514
|
+
/>
|
|
515
|
+
)}
|
|
516
|
+
{repos.hasNextPage && !loadingRest && (
|
|
517
|
+
<Button
|
|
518
|
+
variant="outline"
|
|
519
|
+
className="self-center"
|
|
520
|
+
disabled={repos.isFetchingNextPage}
|
|
521
|
+
onClick={() => void repos.fetchNextPage()}
|
|
522
|
+
>
|
|
523
|
+
Load more
|
|
524
|
+
</Button>
|
|
525
|
+
)}
|
|
526
|
+
</section>
|
|
527
|
+
);
|
|
528
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { type ReactNode, useCallback, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { languagesOf, repoList, type Owner, type RepoFilter } from '../../hooks/repos.ts';
|
|
5
|
+
import { OwnerCard } from '../owner-card.tsx';
|
|
6
|
+
import { UserAvatar, type Account } from '../user-avatar.tsx';
|
|
7
|
+
import { RepoList, RepoToolbar } from './repo-list.tsx';
|
|
8
|
+
|
|
9
|
+
/** Each list's languages, by its owner's login, as each one heard them from its loaded rows. */
|
|
10
|
+
type Heard = Readonly<Record<string, readonly string[]>>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* One owner's section of `/`, under its heading: the owner's avatar, round for a person and square
|
|
14
|
+
* for an org, and its login, leading to its page. The viewer's own section and each org's share it,
|
|
15
|
+
* so every section is headed the same way. A section whose owner has no repositories for the
|
|
16
|
+
* filter keeps its heading and says so.
|
|
17
|
+
*/
|
|
18
|
+
function OwnerSection({
|
|
19
|
+
login,
|
|
20
|
+
account,
|
|
21
|
+
children,
|
|
22
|
+
}: {
|
|
23
|
+
readonly login: string;
|
|
24
|
+
readonly account: Account;
|
|
25
|
+
readonly children: ReactNode;
|
|
26
|
+
}) {
|
|
27
|
+
return (
|
|
28
|
+
<section
|
|
29
|
+
aria-labelledby={`owner-${login}`}
|
|
30
|
+
className="flex flex-col gap-3 pt-4 first-of-type:pt-0"
|
|
31
|
+
>
|
|
32
|
+
<h2 id={`owner-${login}`} className="flex items-center gap-2 text-sm font-medium">
|
|
33
|
+
<UserAvatar login={login} size="sm" account={account} />
|
|
34
|
+
<OwnerCard login={login} account={account}>
|
|
35
|
+
{login}
|
|
36
|
+
</OwnerCard>
|
|
37
|
+
</h2>
|
|
38
|
+
{children}
|
|
39
|
+
</section>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Every repository `viewer` can see: their own section first, then each of their `orgs`', each
|
|
45
|
+
* under its owner's heading, all under one toolbar, whose Language menu offers every list's
|
|
46
|
+
* languages. The orgs are the switcher's, so a person with no repositories of their own still lands
|
|
47
|
+
* on their orgs'.
|
|
48
|
+
*/
|
|
49
|
+
export function YourRepos({
|
|
50
|
+
viewer,
|
|
51
|
+
orgs,
|
|
52
|
+
filter,
|
|
53
|
+
onFilter,
|
|
54
|
+
}: {
|
|
55
|
+
readonly viewer: string;
|
|
56
|
+
readonly orgs: readonly string[];
|
|
57
|
+
readonly filter: RepoFilter;
|
|
58
|
+
readonly onFilter: (filter: RepoFilter) => void;
|
|
59
|
+
}) {
|
|
60
|
+
const queryClient = useQueryClient();
|
|
61
|
+
const owners: readonly Owner[] = [
|
|
62
|
+
{ kind: 'viewer', login: viewer },
|
|
63
|
+
...orgs.map((org) => ({ kind: 'org' as const, login: org })),
|
|
64
|
+
];
|
|
65
|
+
// What `/`'s loader read, so the server draws the Language menu and the browser keeps it: each
|
|
66
|
+
// list's `onLanguages` comes only once it has drawn.
|
|
67
|
+
const [heard, setHeard] = useState<Heard>(() =>
|
|
68
|
+
Object.fromEntries(
|
|
69
|
+
owners.map((owner) => [
|
|
70
|
+
owner.login,
|
|
71
|
+
languagesOf(
|
|
72
|
+
queryClient
|
|
73
|
+
.getQueryData(repoList(owner, filter).queryKey)
|
|
74
|
+
?.pages.flatMap((page) => page.repos) ?? [],
|
|
75
|
+
),
|
|
76
|
+
]),
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const hear = useCallback(
|
|
81
|
+
(login: string) => (languages: readonly string[]) =>
|
|
82
|
+
setHeard((before) =>
|
|
83
|
+
before[login]?.join('\n') === languages.join('\n')
|
|
84
|
+
? before
|
|
85
|
+
: { ...before, [login]: languages },
|
|
86
|
+
),
|
|
87
|
+
[],
|
|
88
|
+
);
|
|
89
|
+
const languages = [...new Set(Object.values(heard).flat())].sort((a, b) => a.localeCompare(b));
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<RepoToolbar
|
|
94
|
+
owner={{ kind: 'viewer', login: viewer }}
|
|
95
|
+
filter={filter}
|
|
96
|
+
onFilter={onFilter}
|
|
97
|
+
languages={languages}
|
|
98
|
+
owns
|
|
99
|
+
/>
|
|
100
|
+
<OwnerSection login={viewer} account="user">
|
|
101
|
+
<RepoList
|
|
102
|
+
owner={{ kind: 'viewer', login: viewer }}
|
|
103
|
+
owns
|
|
104
|
+
filter={filter}
|
|
105
|
+
onFilter={onFilter}
|
|
106
|
+
toolbar={false}
|
|
107
|
+
onLanguages={hear(viewer)}
|
|
108
|
+
/>
|
|
109
|
+
</OwnerSection>
|
|
110
|
+
{orgs.map((org) => (
|
|
111
|
+
<OwnerSection key={org} login={org} account="org">
|
|
112
|
+
<RepoList
|
|
113
|
+
owner={{ kind: 'org', login: org }}
|
|
114
|
+
owns
|
|
115
|
+
filter={filter}
|
|
116
|
+
onFilter={onFilter}
|
|
117
|
+
toolbar={false}
|
|
118
|
+
onLanguages={hear(org)}
|
|
119
|
+
/>
|
|
120
|
+
</OwnerSection>
|
|
121
|
+
))}
|
|
122
|
+
</>
|
|
123
|
+
);
|
|
124
|
+
}
|