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,682 @@
|
|
|
1
|
+
import { useInfiniteQuery, useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useNavigate } from '@tanstack/react-router';
|
|
3
|
+
import {
|
|
4
|
+
CircleCheckIcon,
|
|
5
|
+
CircleDotIcon,
|
|
6
|
+
MessageSquareIcon,
|
|
7
|
+
SearchIcon,
|
|
8
|
+
TagIcon,
|
|
9
|
+
UserRoundXIcon,
|
|
10
|
+
UsersRoundIcon,
|
|
11
|
+
} from 'lucide-react';
|
|
12
|
+
import { useEffect, useState, type ReactNode } from 'react';
|
|
13
|
+
|
|
14
|
+
import { cn } from '#/lib/cn';
|
|
15
|
+
|
|
16
|
+
import { day, Go, usePreloaded } from '../code/controls.tsx';
|
|
17
|
+
import type { RepoPlace } from '../code/places.ts';
|
|
18
|
+
import { ItemList, More } from '../components/item-list.tsx';
|
|
19
|
+
import { OwnerCard } from '../components/owner-card.tsx';
|
|
20
|
+
import { UserAvatar } from '../components/user-avatar.tsx';
|
|
21
|
+
import { HotkeyHint, hotkeys } from '../components/hotkeys/hotkeys.tsx';
|
|
22
|
+
import { Alert, AlertDescription } from '../components/ui/alert.tsx';
|
|
23
|
+
import { buttonVariants } from '../components/ui/button.tsx';
|
|
24
|
+
import { DropdownMenuRadioGroup, DropdownMenuRadioItem } from '../components/ui/dropdown-menu.tsx';
|
|
25
|
+
import {
|
|
26
|
+
Empty,
|
|
27
|
+
EmptyDescription,
|
|
28
|
+
EmptyHeader,
|
|
29
|
+
EmptyMedia,
|
|
30
|
+
EmptyTitle,
|
|
31
|
+
} from '../components/ui/empty.tsx';
|
|
32
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from '../components/ui/input-group.tsx';
|
|
33
|
+
import {
|
|
34
|
+
Item,
|
|
35
|
+
ItemActions,
|
|
36
|
+
ItemContent,
|
|
37
|
+
ItemDescription,
|
|
38
|
+
ItemMedia,
|
|
39
|
+
ItemTitle,
|
|
40
|
+
} from '../components/ui/item.tsx';
|
|
41
|
+
import { Skeleton } from '../components/ui/skeleton.tsx';
|
|
42
|
+
import { useAllowed } from '../hooks/allowed.ts';
|
|
43
|
+
import { pagesMost } from '../hooks/answers.ts';
|
|
44
|
+
import { tabCounts, tabQueries, type Counts, type Tabbed } from './counts.ts';
|
|
45
|
+
import { authorsOf, issueList, vocabularyOf, type Issue, type Vocabulary } from './issues.ts';
|
|
46
|
+
import { LabelBadge } from './parts.tsx';
|
|
47
|
+
import { LabelRow, PersonRow, Picker, StandInRow } from './picker.tsx';
|
|
48
|
+
import {
|
|
49
|
+
filterOf,
|
|
50
|
+
queryOf,
|
|
51
|
+
searchQueryOf,
|
|
52
|
+
stretchesOf,
|
|
53
|
+
type Chosen,
|
|
54
|
+
type IssueFilter,
|
|
55
|
+
} from './search.ts';
|
|
56
|
+
import { Filter } from '../components/filter.tsx';
|
|
57
|
+
import { tones } from '../components/tones.ts';
|
|
58
|
+
import { Count } from '../components/count.tsx';
|
|
59
|
+
import { CreateButton } from '../components/create-button.tsx';
|
|
60
|
+
import { iconOnPhone, ListToolbar } from '../components/list-toolbar.tsx';
|
|
61
|
+
|
|
62
|
+
/** The issue list's URL for the box's `query`. */
|
|
63
|
+
export const issuesHref = (place: RepoPlace, query: string) =>
|
|
64
|
+
`/${place.owner}/${place.repo}/issues?${new URLSearchParams({ q: query })}`;
|
|
65
|
+
|
|
66
|
+
/** An issue's own page. */
|
|
67
|
+
export const issueHref = (place: RepoPlace, number: number) =>
|
|
68
|
+
`/${place.owner}/${place.repo}/issues/${number}`;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* An issue's or a pull request's row: `icon` for its state, its title, labels, and who opened it
|
|
72
|
+
* when, and `note` after that, such as "Draft".
|
|
73
|
+
*/
|
|
74
|
+
export function IssueRow({
|
|
75
|
+
href,
|
|
76
|
+
icon,
|
|
77
|
+
issue,
|
|
78
|
+
note,
|
|
79
|
+
}: {
|
|
80
|
+
readonly href: string;
|
|
81
|
+
readonly icon: ReactNode;
|
|
82
|
+
readonly issue: Issue;
|
|
83
|
+
readonly note?: string;
|
|
84
|
+
}) {
|
|
85
|
+
const comments = `${issue.comments} ${issue.comments === 1 ? 'comment' : 'comments'}`;
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<Item role="listitem" className="flex-nowrap items-start gap-3 px-3 py-3 sm:px-4">
|
|
89
|
+
<ItemMedia>{icon}</ItemMedia>
|
|
90
|
+
<ItemContent className="min-w-0">
|
|
91
|
+
<ItemTitle className="line-clamp-none flex max-w-full flex-wrap gap-1.5 text-sm/6 font-semibold sm:text-base/6 wrap-anywhere">
|
|
92
|
+
<Go href={href} className="hover:underline">
|
|
93
|
+
{issue.title}
|
|
94
|
+
</Go>
|
|
95
|
+
{issue.labels.map((label) => (
|
|
96
|
+
<LabelBadge key={label.name} label={label} />
|
|
97
|
+
))}
|
|
98
|
+
</ItemTitle>
|
|
99
|
+
<ItemDescription className="text-sm/5">
|
|
100
|
+
#{issue.number} opened {day.format(new Date(issue.created))} by{' '}
|
|
101
|
+
<OwnerCard login={issue.author}>{issue.author}</OwnerCard>
|
|
102
|
+
{issue.milestone !== null && ` · ${issue.milestone.title}`}
|
|
103
|
+
{note !== undefined && ` · ${note}`}
|
|
104
|
+
</ItemDescription>
|
|
105
|
+
</ItemContent>
|
|
106
|
+
{(issue.assignees.length > 0 || issue.comments > 0) && (
|
|
107
|
+
<ItemActions className="gap-3 text-sm">
|
|
108
|
+
{issue.assignees.length > 0 && (
|
|
109
|
+
<span className="flex -space-x-1.5">
|
|
110
|
+
<span className="sr-only">Assigned to</span>
|
|
111
|
+
{issue.assignees.map((login) => (
|
|
112
|
+
<OwnerCard key={login} login={login} label={login} className="rounded-full">
|
|
113
|
+
<UserAvatar
|
|
114
|
+
login={login}
|
|
115
|
+
upload={issue.pictures.get(login)}
|
|
116
|
+
size="sm"
|
|
117
|
+
account="user"
|
|
118
|
+
/>
|
|
119
|
+
</OwnerCard>
|
|
120
|
+
))}
|
|
121
|
+
</span>
|
|
122
|
+
)}
|
|
123
|
+
{issue.comments > 0 && (
|
|
124
|
+
<span className="flex items-center gap-1 text-muted-foreground">
|
|
125
|
+
<MessageSquareIcon aria-hidden className="size-4" />
|
|
126
|
+
<span aria-hidden>{issue.comments}</span>
|
|
127
|
+
<span className="sr-only">{comments}</span>
|
|
128
|
+
</span>
|
|
129
|
+
)}
|
|
130
|
+
</ItemActions>
|
|
131
|
+
)}
|
|
132
|
+
</Item>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** An issue's state, as its row's icon: open in green, closed in purple. */
|
|
137
|
+
function IssueIcon({ issue }: { readonly issue: Issue }) {
|
|
138
|
+
const open = issue.state === 'open';
|
|
139
|
+
const Icon = open ? CircleDotIcon : CircleCheckIcon;
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<Icon
|
|
143
|
+
aria-label={open ? 'Open' : 'Closed'}
|
|
144
|
+
className={cn('size-5', open ? tones.open : tones.closed)}
|
|
145
|
+
/>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** A radio group's value for no filter, and for none. */
|
|
150
|
+
const anyValue = '';
|
|
151
|
+
|
|
152
|
+
const noneValue = ':none';
|
|
153
|
+
|
|
154
|
+
/** A pick's value in a radio group: a name, none, or any. */
|
|
155
|
+
const pickValue = (chosen: Chosen | undefined) => {
|
|
156
|
+
if (chosen === undefined) return anyValue;
|
|
157
|
+
|
|
158
|
+
return chosen.kind === 'none' ? noneValue : chosen.name;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/** The pick a radio group's value stands for. */
|
|
162
|
+
const chosenOf = (value: string): Chosen | undefined => {
|
|
163
|
+
if (value === anyValue) return undefined;
|
|
164
|
+
|
|
165
|
+
return value === noneValue ? { kind: 'none' } : { kind: 'named', name: value };
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/** What the issue and pull request lists' menus filter by. */
|
|
169
|
+
type Menus = Pick<IssueFilter, 'author' | 'labels' | 'milestone' | 'assignee' | 'order'>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The labels `held` keeps after a pick leaves `next` of those `offered` picked: the rest in their
|
|
173
|
+
* order, and any it adds after them. A label the query names but the repo doesn't stays.
|
|
174
|
+
*/
|
|
175
|
+
const repicked = (held: readonly string[], offered: readonly string[], next: readonly string[]) => [
|
|
176
|
+
...held.filter((name) => !offered.includes(name) || next.includes(name)),
|
|
177
|
+
...next.filter((name) => !held.includes(name)),
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
/** The `@me` a query names the viewer by, as GitHub's search does. */
|
|
181
|
+
const me = '@me';
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The author menu: who opened an issue or a pull request in the repo, each with their avatar, the
|
|
185
|
+
* viewer first and the query's author checked. Picking the checked one again clears it. It reads
|
|
186
|
+
* the repo's authors only once it opens, newest first, 100 a page; a search none of those read
|
|
187
|
+
* matches reads on, a page at a time, to `pagesMost` pages.
|
|
188
|
+
*/
|
|
189
|
+
function Authors({
|
|
190
|
+
place,
|
|
191
|
+
viewer,
|
|
192
|
+
author,
|
|
193
|
+
onPick,
|
|
194
|
+
}: {
|
|
195
|
+
readonly place: RepoPlace;
|
|
196
|
+
readonly viewer: string | undefined;
|
|
197
|
+
/** The query's author, a login, or `@me` for the viewer. */
|
|
198
|
+
readonly author: string | undefined;
|
|
199
|
+
readonly onPick: (author: string | undefined) => void;
|
|
200
|
+
}) {
|
|
201
|
+
const [open, setOpen] = useState(false);
|
|
202
|
+
const [typed, setTyped] = useState('');
|
|
203
|
+
const authors = useInfiniteQuery({ ...authorsOf(place), enabled: open });
|
|
204
|
+
const { fetchNextPage, isFetchingNextPage } = authors;
|
|
205
|
+
const current = author === me ? viewer : author;
|
|
206
|
+
const read = authors.data?.pages.flatMap((page) => page.logins) ?? [];
|
|
207
|
+
const people = [...new Set([viewer, current, ...read])].filter((login) => login !== undefined);
|
|
208
|
+
const query = typed.trim().toLowerCase();
|
|
209
|
+
const found = people.some((login) => login.toLowerCase().includes(query));
|
|
210
|
+
const pages = authors.data?.pages.length ?? 0;
|
|
211
|
+
const seeking =
|
|
212
|
+
query !== '' && !found && authors.hasNextPage && pages < pagesMost && !authors.isError;
|
|
213
|
+
const reading = open && (authors.isPending || seeking);
|
|
214
|
+
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (seeking && !isFetchingNextPage) void fetchNextPage();
|
|
217
|
+
}, [seeking, isFetchingNextPage, fetchNextPage, pages]);
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<Picker
|
|
221
|
+
name="Authors"
|
|
222
|
+
trigger={{ text: 'Author' }}
|
|
223
|
+
multiple={false}
|
|
224
|
+
choices={people.map((login) => ({
|
|
225
|
+
value: login,
|
|
226
|
+
label: login,
|
|
227
|
+
drawn: <PersonRow login={login} />,
|
|
228
|
+
}))}
|
|
229
|
+
picked={current === undefined ? [] : [current]}
|
|
230
|
+
reading={reading ? 'Searching…' : undefined}
|
|
231
|
+
onOpen={() => setOpen(true)}
|
|
232
|
+
onType={setTyped}
|
|
233
|
+
onPick={([login]) => onPick(login === current ? undefined : login)}
|
|
234
|
+
/>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The author, label, milestone, assignee and order menus, in GitHub's order, each changing one
|
|
240
|
+
* part of the filter, and a list's own menus, `children`, before the order's. The first four are
|
|
241
|
+
* searchable, a row each.
|
|
242
|
+
*/
|
|
243
|
+
export function Filters<Filtered extends Menus>({
|
|
244
|
+
place,
|
|
245
|
+
viewer,
|
|
246
|
+
filter,
|
|
247
|
+
vocabulary,
|
|
248
|
+
go,
|
|
249
|
+
children,
|
|
250
|
+
}: {
|
|
251
|
+
readonly place: RepoPlace;
|
|
252
|
+
readonly viewer: string | undefined;
|
|
253
|
+
readonly filter: Filtered;
|
|
254
|
+
readonly vocabulary: Vocabulary;
|
|
255
|
+
readonly go: (filter: Filtered) => void;
|
|
256
|
+
readonly children?: ReactNode;
|
|
257
|
+
}) {
|
|
258
|
+
const labels = vocabulary.labels.map((label) => label.name);
|
|
259
|
+
|
|
260
|
+
return (
|
|
261
|
+
// On a phone the menus wrap under one another, so each stays in view.
|
|
262
|
+
<div className="flex max-w-full flex-wrap items-center">
|
|
263
|
+
<Authors
|
|
264
|
+
place={place}
|
|
265
|
+
viewer={viewer}
|
|
266
|
+
author={filter.author}
|
|
267
|
+
onPick={(author) => go({ ...filter, author })}
|
|
268
|
+
/>
|
|
269
|
+
<Picker
|
|
270
|
+
name="Labels"
|
|
271
|
+
trigger={{ text: 'Labels' }}
|
|
272
|
+
multiple
|
|
273
|
+
choices={vocabulary.labels.map((label) => ({
|
|
274
|
+
value: label.name,
|
|
275
|
+
label: label.name,
|
|
276
|
+
drawn: <LabelRow label={label} />,
|
|
277
|
+
}))}
|
|
278
|
+
picked={filter.labels}
|
|
279
|
+
onPick={(next) => go({ ...filter, labels: repicked(filter.labels, labels, next) })}
|
|
280
|
+
/>
|
|
281
|
+
<Picker
|
|
282
|
+
name="Milestones"
|
|
283
|
+
trigger={{ text: 'Milestones' }}
|
|
284
|
+
multiple={false}
|
|
285
|
+
choices={[
|
|
286
|
+
{ value: anyValue, label: 'Any milestone' },
|
|
287
|
+
{ value: noneValue, label: 'No milestone' },
|
|
288
|
+
...vocabulary.milestones.map((milestone) => ({
|
|
289
|
+
value: milestone.title,
|
|
290
|
+
label: milestone.title,
|
|
291
|
+
})),
|
|
292
|
+
]}
|
|
293
|
+
picked={[pickValue(filter.milestone)]}
|
|
294
|
+
onPick={([value = anyValue]) => go({ ...filter, milestone: chosenOf(value) })}
|
|
295
|
+
/>
|
|
296
|
+
<Picker
|
|
297
|
+
name="Assignees"
|
|
298
|
+
trigger={{ text: 'Assignees' }}
|
|
299
|
+
multiple={false}
|
|
300
|
+
choices={[
|
|
301
|
+
{
|
|
302
|
+
value: anyValue,
|
|
303
|
+
label: 'Anyone',
|
|
304
|
+
drawn: <StandInRow label="Anyone" icon={UsersRoundIcon} />,
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
value: noneValue,
|
|
308
|
+
label: 'No one assigned',
|
|
309
|
+
drawn: <StandInRow label="No one assigned" icon={UserRoundXIcon} />,
|
|
310
|
+
},
|
|
311
|
+
...vocabulary.assignees.map((login) => ({
|
|
312
|
+
value: login,
|
|
313
|
+
label: login,
|
|
314
|
+
drawn: <PersonRow login={login} />,
|
|
315
|
+
})),
|
|
316
|
+
]}
|
|
317
|
+
picked={[pickValue(filter.assignee)]}
|
|
318
|
+
onPick={([value = anyValue]) => go({ ...filter, assignee: chosenOf(value) })}
|
|
319
|
+
/>
|
|
320
|
+
{children}
|
|
321
|
+
<Filter name="Sort">
|
|
322
|
+
<DropdownMenuRadioGroup
|
|
323
|
+
value={filter.order}
|
|
324
|
+
onValueChange={(value) =>
|
|
325
|
+
go({ ...filter, order: value === 'oldest' ? 'oldest' : 'newest' })
|
|
326
|
+
}
|
|
327
|
+
>
|
|
328
|
+
<DropdownMenuRadioItem value="newest">Newest</DropdownMenuRadioItem>
|
|
329
|
+
<DropdownMenuRadioItem value="oldest">Oldest</DropdownMenuRadioItem>
|
|
330
|
+
</DropdownMenuRadioGroup>
|
|
331
|
+
</Filter>
|
|
332
|
+
</div>
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** The issues under `filter`, a page at a time as the reader asks for more. */
|
|
337
|
+
function Issues({
|
|
338
|
+
place,
|
|
339
|
+
filter,
|
|
340
|
+
vocabulary,
|
|
341
|
+
}: {
|
|
342
|
+
readonly place: RepoPlace;
|
|
343
|
+
readonly filter: IssueFilter;
|
|
344
|
+
readonly vocabulary: Vocabulary;
|
|
345
|
+
}) {
|
|
346
|
+
const pages = useInfiniteQuery(issueList(place, filter, vocabulary));
|
|
347
|
+
const issues = pages.data?.pages.flatMap((page) => page.issues) ?? [];
|
|
348
|
+
if (pages.isPending) return <Skeleton className="h-40" />;
|
|
349
|
+
|
|
350
|
+
if (pages.error !== null && issues.length === 0) {
|
|
351
|
+
return <LoadAlert message={pages.error.message} />;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return (
|
|
355
|
+
<>
|
|
356
|
+
{issues.length === 0 ? (
|
|
357
|
+
<NoneMatched />
|
|
358
|
+
) : (
|
|
359
|
+
<ItemList
|
|
360
|
+
aria-label="Issues"
|
|
361
|
+
rows={issues}
|
|
362
|
+
keyOf={(issue) => String(issue.number)}
|
|
363
|
+
row={(issue) => (
|
|
364
|
+
<IssueRow
|
|
365
|
+
href={issueHref(place, issue.number)}
|
|
366
|
+
icon={<IssueIcon issue={issue} />}
|
|
367
|
+
issue={issue}
|
|
368
|
+
/>
|
|
369
|
+
)}
|
|
370
|
+
/>
|
|
371
|
+
)}
|
|
372
|
+
<More pages={pages} label="More issues" />
|
|
373
|
+
</>
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** Why a list didn't load, in its box. */
|
|
378
|
+
export function LoadAlert({ message }: { readonly message: string }) {
|
|
379
|
+
return (
|
|
380
|
+
<div className="p-3">
|
|
381
|
+
<Alert variant="destructive">
|
|
382
|
+
<AlertDescription>{message}. Reload the page to try again.</AlertDescription>
|
|
383
|
+
</Alert>
|
|
384
|
+
</div>
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** A list with nothing under its filter: `more` when pages it hasn't read could still match. */
|
|
389
|
+
export function NoneMatched({ more = false }: { readonly more?: boolean }) {
|
|
390
|
+
return (
|
|
391
|
+
<Empty>
|
|
392
|
+
<EmptyHeader>
|
|
393
|
+
<EmptyMedia variant="icon">
|
|
394
|
+
<SearchIcon />
|
|
395
|
+
</EmptyMedia>
|
|
396
|
+
<EmptyTitle>No results matched your search</EmptyTitle>
|
|
397
|
+
<EmptyDescription>
|
|
398
|
+
{more
|
|
399
|
+
? 'None of those read so far match. Read on for more.'
|
|
400
|
+
: 'Try other filters, or clear the search.'}
|
|
401
|
+
</EmptyDescription>
|
|
402
|
+
</EmptyHeader>
|
|
403
|
+
</Empty>
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* The search box's field, holding `query` until it's sent to `hrefOf` its text. Each qualifier's
|
|
409
|
+
* value a filter takes, such as `issue` in `is:issue`, shows in the app's blue, as GitHub's box
|
|
410
|
+
* shows them: the field's own text is clear, over a copy of it in colour that scrolls with it.
|
|
411
|
+
*/
|
|
412
|
+
function SearchField({
|
|
413
|
+
query,
|
|
414
|
+
label,
|
|
415
|
+
hrefOf,
|
|
416
|
+
unfilteredOf,
|
|
417
|
+
}: {
|
|
418
|
+
readonly query: string;
|
|
419
|
+
readonly label: string;
|
|
420
|
+
readonly hrefOf: (query: string) => string;
|
|
421
|
+
readonly unfilteredOf: (text: string) => readonly string[];
|
|
422
|
+
}) {
|
|
423
|
+
const navigate = useNavigate();
|
|
424
|
+
const [text, setText] = useState(query);
|
|
425
|
+
const [scrolled, setScrolled] = useState(0);
|
|
426
|
+
|
|
427
|
+
const follow = (field: HTMLInputElement) => {
|
|
428
|
+
setText(field.value);
|
|
429
|
+
setScrolled(field.scrollLeft);
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
return (
|
|
433
|
+
<form
|
|
434
|
+
role="search"
|
|
435
|
+
className="min-w-0"
|
|
436
|
+
onSubmit={(event) => {
|
|
437
|
+
event.preventDefault();
|
|
438
|
+
void navigate({ href: hrefOf(text) });
|
|
439
|
+
}}
|
|
440
|
+
>
|
|
441
|
+
<InputGroup size="lg">
|
|
442
|
+
<div className="grid min-w-0 flex-1 self-stretch">
|
|
443
|
+
<div
|
|
444
|
+
aria-hidden
|
|
445
|
+
className="pointer-events-none col-start-1 row-start-1 flex items-center overflow-hidden pr-2.5 pl-1.5 text-sm whitespace-pre"
|
|
446
|
+
>
|
|
447
|
+
<span style={{ transform: `translateX(${-scrolled}px)` }}>
|
|
448
|
+
{stretchesOf(text, unfilteredOf(text)).map((stretch, index) =>
|
|
449
|
+
stretch.filter ? (
|
|
450
|
+
<span key={index} className={tones.link}>
|
|
451
|
+
{stretch.text}
|
|
452
|
+
</span>
|
|
453
|
+
) : (
|
|
454
|
+
stretch.text
|
|
455
|
+
),
|
|
456
|
+
)}
|
|
457
|
+
</span>
|
|
458
|
+
</div>
|
|
459
|
+
<InputGroupInput
|
|
460
|
+
name="q"
|
|
461
|
+
aria-label={label}
|
|
462
|
+
defaultValue={query}
|
|
463
|
+
spellCheck={false}
|
|
464
|
+
className="col-start-1 row-start-1 h-full pl-1.5 text-transparent caret-foreground selection:bg-link/30 selection:text-transparent"
|
|
465
|
+
onInput={(event) => follow(event.currentTarget)}
|
|
466
|
+
onScroll={(event) => follow(event.currentTarget)}
|
|
467
|
+
onSelect={(event) => follow(event.currentTarget)}
|
|
468
|
+
data-hotkey={hotkeys.search}
|
|
469
|
+
/>
|
|
470
|
+
</div>
|
|
471
|
+
<InputGroupAddon>
|
|
472
|
+
<SearchIcon />
|
|
473
|
+
</InputGroupAddon>
|
|
474
|
+
<HotkeyHint keys={hotkeys.search} className="end-2 bg-background" />
|
|
475
|
+
</InputGroup>
|
|
476
|
+
</form>
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* A list's toolbar: its search box, which goes to `hrefOf` its text, and `buttons`, such as its
|
|
482
|
+
* New button. `unfilteredOf` is what of a text the list's filter leaves, which shows uncoloured.
|
|
483
|
+
*/
|
|
484
|
+
export function SearchBox({
|
|
485
|
+
query,
|
|
486
|
+
label,
|
|
487
|
+
hrefOf,
|
|
488
|
+
unfilteredOf,
|
|
489
|
+
buttons,
|
|
490
|
+
}: {
|
|
491
|
+
readonly query: string;
|
|
492
|
+
readonly label: string;
|
|
493
|
+
readonly hrefOf: (query: string) => string;
|
|
494
|
+
readonly unfilteredOf: (text: string) => readonly string[];
|
|
495
|
+
readonly buttons: ReactNode;
|
|
496
|
+
}) {
|
|
497
|
+
return (
|
|
498
|
+
<ListToolbar
|
|
499
|
+
search={
|
|
500
|
+
<SearchField
|
|
501
|
+
key={query}
|
|
502
|
+
query={query}
|
|
503
|
+
label={label}
|
|
504
|
+
hrefOf={hrefOf}
|
|
505
|
+
unfilteredOf={unfilteredOf}
|
|
506
|
+
/>
|
|
507
|
+
}
|
|
508
|
+
buttons={buttons}
|
|
509
|
+
/>
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/** The qualifiers the box held that the list doesn't take, and what does filter: `filtering`. */
|
|
514
|
+
export function Unfiltered({
|
|
515
|
+
terms,
|
|
516
|
+
filtering,
|
|
517
|
+
}: {
|
|
518
|
+
readonly terms: readonly string[];
|
|
519
|
+
readonly filtering: string;
|
|
520
|
+
}) {
|
|
521
|
+
if (terms.length === 0) return null;
|
|
522
|
+
|
|
523
|
+
return (
|
|
524
|
+
<Alert>
|
|
525
|
+
<AlertDescription>
|
|
526
|
+
{terms.join(' ')} {terms.length === 1 ? 'filters' : 'filter'} nothing, as the list doesn't
|
|
527
|
+
take {terms.length === 1 ? 'it' : 'them'}. {filtering}
|
|
528
|
+
</AlertDescription>
|
|
529
|
+
</Alert>
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* A list's Open and Closed tabs, linking to `hrefOf` each state, the one it shows highlighted,
|
|
535
|
+
* and each with its count from `counts`: drawn while it loads, and left off when it can't be the
|
|
536
|
+
* list's, as `counts` is `undefined` then. The highlight slides to the tab picked.
|
|
537
|
+
*/
|
|
538
|
+
export function StateTabs({
|
|
539
|
+
label,
|
|
540
|
+
current,
|
|
541
|
+
hrefOf,
|
|
542
|
+
counts,
|
|
543
|
+
}: {
|
|
544
|
+
readonly label: string;
|
|
545
|
+
/** The state the list shows, or `all` for either, when neither tab is highlighted. */
|
|
546
|
+
readonly current: Tabbed | 'all';
|
|
547
|
+
readonly hrefOf: (state: Tabbed) => string;
|
|
548
|
+
readonly counts: { readonly data: Counts | undefined; readonly isPending: boolean } | undefined;
|
|
549
|
+
}) {
|
|
550
|
+
const tabs: readonly (readonly [Tabbed, string])[] = [
|
|
551
|
+
['open', 'Open'],
|
|
552
|
+
['closed', 'Closed'],
|
|
553
|
+
];
|
|
554
|
+
usePreloaded(tabs.flatMap(([state]) => (state === current ? [] : [hrefOf(state)])));
|
|
555
|
+
|
|
556
|
+
return (
|
|
557
|
+
<nav
|
|
558
|
+
aria-label={label}
|
|
559
|
+
className="relative inline-grid grid-cols-[1fr_1fr] rounded-md border bg-muted p-0.5 text-sm"
|
|
560
|
+
>
|
|
561
|
+
<span
|
|
562
|
+
aria-hidden
|
|
563
|
+
className={cn(
|
|
564
|
+
'absolute inset-y-0.5 left-0.5 w-[calc(50%-0.125rem)] rounded-sm border bg-background shadow-xs transition-[translate,opacity] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none',
|
|
565
|
+
current === 'closed' && 'translate-x-full',
|
|
566
|
+
current === 'all' && 'opacity-0',
|
|
567
|
+
)}
|
|
568
|
+
/>
|
|
569
|
+
{tabs.map(([state, name]) => {
|
|
570
|
+
const count = counts?.data?.[state];
|
|
571
|
+
|
|
572
|
+
return (
|
|
573
|
+
<Go
|
|
574
|
+
key={state}
|
|
575
|
+
aria-current={current === state ? 'page' : undefined}
|
|
576
|
+
href={hrefOf(state)}
|
|
577
|
+
className="pressable relative flex items-center justify-center gap-2 px-3 py-1 whitespace-nowrap text-muted-foreground hover:text-foreground aria-[current]:font-semibold aria-[current]:text-foreground rounded-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring"
|
|
578
|
+
>
|
|
579
|
+
{name}
|
|
580
|
+
{counts?.isPending === true && <Skeleton aria-hidden className="h-5 w-6" />}
|
|
581
|
+
{count !== undefined && <Count value={count} />}
|
|
582
|
+
</Go>
|
|
583
|
+
);
|
|
584
|
+
})}
|
|
585
|
+
</nav>
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/** A list's vocabulary while it loads or if it fails, and `children` once it's there. */
|
|
590
|
+
export function WithVocabulary({
|
|
591
|
+
place,
|
|
592
|
+
children,
|
|
593
|
+
}: {
|
|
594
|
+
readonly place: RepoPlace;
|
|
595
|
+
readonly children: (vocabulary: Vocabulary) => ReactNode;
|
|
596
|
+
}) {
|
|
597
|
+
const vocabulary = useQuery(vocabularyOf(place));
|
|
598
|
+
if (vocabulary.error !== null) return <LoadAlert message={vocabulary.error.message} />;
|
|
599
|
+
|
|
600
|
+
return vocabulary.data === undefined ? <Skeleton className="h-40" /> : children(vocabulary.data);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* A repo's issues, as GitHub's list shows them: the search box's filter, open or closed, by
|
|
605
|
+
* label, milestone, assignee and author, newest first or oldest.
|
|
606
|
+
*/
|
|
607
|
+
export function IssueList({
|
|
608
|
+
place,
|
|
609
|
+
query,
|
|
610
|
+
viewer,
|
|
611
|
+
}: {
|
|
612
|
+
readonly place: RepoPlace;
|
|
613
|
+
readonly query: string;
|
|
614
|
+
/** Who's signed in, whose own issues the author menu offers first. */
|
|
615
|
+
readonly viewer: string | undefined;
|
|
616
|
+
}) {
|
|
617
|
+
const navigate = useNavigate();
|
|
618
|
+
const filter = filterOf(query);
|
|
619
|
+
const vocabulary = useQuery(vocabularyOf(place));
|
|
620
|
+
const allowed = useAllowed(place);
|
|
621
|
+
const queries = tabQueries((state) => searchQueryOf(place, { ...filter, state }));
|
|
622
|
+
const counts = useQuery(tabCounts(place, 'issues', queries));
|
|
623
|
+
const go = (next: IssueFilter) => void navigate({ href: issuesHref(place, queryOf(next)) });
|
|
624
|
+
|
|
625
|
+
return (
|
|
626
|
+
<div className="flex flex-col gap-3">
|
|
627
|
+
<SearchBox
|
|
628
|
+
query={query}
|
|
629
|
+
label="Search issues"
|
|
630
|
+
hrefOf={(text) => issuesHref(place, text)}
|
|
631
|
+
unfilteredOf={(text) => filterOf(text).unfiltered}
|
|
632
|
+
buttons={
|
|
633
|
+
<>
|
|
634
|
+
{/* Named apart from the Labels filter below it, and its icon alone on a phone. */}
|
|
635
|
+
<Go
|
|
636
|
+
href={`/${place.owner}/${place.repo}/labels`}
|
|
637
|
+
aria-label="All labels"
|
|
638
|
+
className={cn(buttonVariants({ variant: 'outline', size: 'lg' }), iconOnPhone)}
|
|
639
|
+
>
|
|
640
|
+
<TagIcon aria-hidden />
|
|
641
|
+
<span className="@max-md:sr-only">Labels</span>
|
|
642
|
+
</Go>
|
|
643
|
+
{allowed.has('issue.create') && (
|
|
644
|
+
<CreateButton
|
|
645
|
+
hotkey
|
|
646
|
+
render={<Go href={`/${place.owner}/${place.repo}/issues/new`} />}
|
|
647
|
+
>
|
|
648
|
+
New issue
|
|
649
|
+
</CreateButton>
|
|
650
|
+
)}
|
|
651
|
+
</>
|
|
652
|
+
}
|
|
653
|
+
/>
|
|
654
|
+
<Unfiltered
|
|
655
|
+
terms={filter.unfiltered}
|
|
656
|
+
filtering="Labels, milestones, assignees, authors and words filter as GitHub's search does."
|
|
657
|
+
/>
|
|
658
|
+
<section aria-label="Issue list" className="border">
|
|
659
|
+
<div className="flex flex-wrap items-center justify-between gap-2 border-b bg-muted/50 px-3 py-1.5">
|
|
660
|
+
<StateTabs
|
|
661
|
+
label="Issue states"
|
|
662
|
+
current={filter.state}
|
|
663
|
+
hrefOf={(state) => issuesHref(place, queryOf({ ...filter, state }))}
|
|
664
|
+
counts={queries === undefined ? undefined : counts}
|
|
665
|
+
/>
|
|
666
|
+
{vocabulary.data !== undefined && (
|
|
667
|
+
<Filters
|
|
668
|
+
place={place}
|
|
669
|
+
viewer={viewer}
|
|
670
|
+
filter={filter}
|
|
671
|
+
vocabulary={vocabulary.data}
|
|
672
|
+
go={go}
|
|
673
|
+
/>
|
|
674
|
+
)}
|
|
675
|
+
</div>
|
|
676
|
+
<WithVocabulary place={place}>
|
|
677
|
+
{(loaded) => <Issues place={place} filter={filter} vocabulary={loaded} />}
|
|
678
|
+
</WithVocabulary>
|
|
679
|
+
</section>
|
|
680
|
+
</div>
|
|
681
|
+
);
|
|
682
|
+
}
|