ref0-git 0.0.0-stage → 0.2.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 +122 -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 +547 -0
- package/app/apps/github/src/palette/recent.ts +116 -0
- package/app/apps/github/src/palette/rows.tsx +455 -0
- package/app/apps/github/src/palette/server.ts +104 -0
- package/app/apps/github/src/palette/targets.ts +306 -0
- package/app/apps/github/src/policy.ts +600 -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 +538 -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 +48 -0
- package/dist/cli/helpers.mjs +51 -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 +79 -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 +75 -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 +205 -0
- package/dist/init/node-app.mjs +189 -0
- package/dist/init/node.mjs +458 -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 +383 -0
- package/dist/init/versions.mjs +32 -0
- package/dist/init/workspace.mjs +20 -0
- package/package.json +52 -3
- package/README.md +0 -3
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
2
|
+
import { Link, useLocation } from '@tanstack/react-router';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { maxFiltered, type Owner, repoList } from '../../hooks/repos.ts';
|
|
6
|
+
import { RepoIcon } from '../repos/repo-icon.tsx';
|
|
7
|
+
import { Alert, AlertDescription } from '../ui/alert.tsx';
|
|
8
|
+
import { Button } from '../ui/button.tsx';
|
|
9
|
+
import {
|
|
10
|
+
Combobox,
|
|
11
|
+
ComboboxContent,
|
|
12
|
+
ComboboxInput,
|
|
13
|
+
ComboboxItem,
|
|
14
|
+
ComboboxList,
|
|
15
|
+
ComboboxTrigger,
|
|
16
|
+
} from '../ui/combobox.tsx';
|
|
17
|
+
import { Skeleton } from '../ui/skeleton.tsx';
|
|
18
|
+
import { ComboboxCreateRow } from './create-row.tsx';
|
|
19
|
+
|
|
20
|
+
/** The owner's repositories in the list page's own order, so its read is the switcher's too. */
|
|
21
|
+
const listed = { search: '', type: 'all', language: '', sort: 'updated' } as const;
|
|
22
|
+
|
|
23
|
+
/** The item that leads back to the owner's level: a name no repo can take. */
|
|
24
|
+
const everyRepo = '';
|
|
25
|
+
|
|
26
|
+
/** The last item, which leads to New repository: a name no repo can take either. */
|
|
27
|
+
const createRepo = '/new';
|
|
28
|
+
|
|
29
|
+
const labelOf = (item: string) =>
|
|
30
|
+
item === everyRepo ? 'All repositories' : item === createRepo ? 'Create repository' : item;
|
|
31
|
+
|
|
32
|
+
/** Whether `item`'s name holds the search `typed`, as the combobox's own filter reads it. */
|
|
33
|
+
const matches = (item: string, typed: string) =>
|
|
34
|
+
labelOf(item).toLocaleLowerCase().includes(typed.trim().toLocaleLowerCase());
|
|
35
|
+
|
|
36
|
+
/** An item's repo icon, beside its name: none for "All repositories", which is no one repo. */
|
|
37
|
+
function ItemIcon({ owner, item }: { readonly owner: string; readonly item: string }) {
|
|
38
|
+
return item === everyRepo ? null : <RepoIcon owner={owner} repo={item} />;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The top bar's repo switcher: the page's repo, or "All repositories" at its owner's level, and a
|
|
43
|
+
* menu of the owner's repositories, "All repositories" first, each a link to the same section
|
|
44
|
+
* there. It reads the owner's list only once it opens, the list page's own read, and a search reads
|
|
45
|
+
* every page of it, up to `maxFiltered` rows, so a repo past the first page is found. It ends with
|
|
46
|
+
* Create repository, as the owner switcher ends with Create organization: an item, so a search
|
|
47
|
+
* keeps it and the arrow keys reach it, that opens `/new` under the owner and closes back here. A
|
|
48
|
+
* visitor, whom Git lists no repos for, sees only the name.
|
|
49
|
+
*/
|
|
50
|
+
export function RepoSwitcher({
|
|
51
|
+
owner,
|
|
52
|
+
current,
|
|
53
|
+
hrefOf,
|
|
54
|
+
signedIn,
|
|
55
|
+
}: {
|
|
56
|
+
readonly owner: Owner;
|
|
57
|
+
/** The page's repo, by its name, or `undefined` at the owner's level. */
|
|
58
|
+
readonly current: string | undefined;
|
|
59
|
+
/** Where picking a repo goes, or `undefined` for the owner's level. */
|
|
60
|
+
readonly hrefOf: (repo: string | undefined) => string;
|
|
61
|
+
readonly signedIn: boolean;
|
|
62
|
+
}) {
|
|
63
|
+
const [open, setOpen] = useState(false);
|
|
64
|
+
const [typed, setTyped] = useState('');
|
|
65
|
+
const repos = useInfiniteQuery({ ...repoList(owner, listed), enabled: open && signedIn });
|
|
66
|
+
const names = repos.data?.pages.flatMap((page) => page.repos.map((repo) => repo.name)) ?? [];
|
|
67
|
+
const reading =
|
|
68
|
+
typed.trim() !== '' && repos.hasNextPage && names.length < maxFiltered && !repos.isError;
|
|
69
|
+
const { fetchNextPage, isFetchingNextPage } = repos;
|
|
70
|
+
const label = labelOf(current ?? everyRepo);
|
|
71
|
+
const here = useLocation({ select: (location) => location.href });
|
|
72
|
+
const found = [everyRepo, ...names].filter((item) => matches(item, typed));
|
|
73
|
+
|
|
74
|
+
// Each page read asks for the next while a search is typed, as the list page's search does.
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (reading && !isFetchingNextPage) void fetchNextPage();
|
|
77
|
+
}, [reading, isFetchingNextPage, fetchNextPage, names.length]);
|
|
78
|
+
|
|
79
|
+
if (!signedIn) {
|
|
80
|
+
return (
|
|
81
|
+
<span className="flex min-w-0 items-center gap-1.5 text-sm font-medium">
|
|
82
|
+
<ItemIcon owner={owner.login} item={current ?? everyRepo} />
|
|
83
|
+
<span className="truncate">{label}</span>
|
|
84
|
+
</span>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Combobox
|
|
90
|
+
items={[everyRepo, ...names, createRepo]}
|
|
91
|
+
filteredItems={[...found, createRepo]}
|
|
92
|
+
itemToStringLabel={labelOf}
|
|
93
|
+
value={current ?? everyRepo}
|
|
94
|
+
open={open}
|
|
95
|
+
onOpenChange={setOpen}
|
|
96
|
+
inputValue={typed}
|
|
97
|
+
onInputValueChange={setTyped}
|
|
98
|
+
autoHighlight
|
|
99
|
+
>
|
|
100
|
+
<ComboboxTrigger
|
|
101
|
+
render={
|
|
102
|
+
<Button
|
|
103
|
+
variant="ghost"
|
|
104
|
+
size="sm"
|
|
105
|
+
className="max-w-64 text-sm font-medium"
|
|
106
|
+
aria-label={`Switch repository: ${label}`}
|
|
107
|
+
/>
|
|
108
|
+
}
|
|
109
|
+
>
|
|
110
|
+
<ItemIcon owner={owner.login} item={current ?? everyRepo} />
|
|
111
|
+
<span className="truncate">{label}</span>
|
|
112
|
+
</ComboboxTrigger>
|
|
113
|
+
<ComboboxContent aria-label="Switch repository" className="w-72">
|
|
114
|
+
<ComboboxInput
|
|
115
|
+
showTrigger={false}
|
|
116
|
+
aria-label={`Find one of ${owner.login}'s repositories`}
|
|
117
|
+
placeholder="Find a repository…"
|
|
118
|
+
/>
|
|
119
|
+
{repos.isPending && <Skeleton className="m-1.5 h-24" />}
|
|
120
|
+
{repos.error !== null && (
|
|
121
|
+
<Alert variant="destructive" className="m-1.5 w-auto">
|
|
122
|
+
<AlertDescription>{repos.error.message}</AlertDescription>
|
|
123
|
+
</Alert>
|
|
124
|
+
)}
|
|
125
|
+
{/*
|
|
126
|
+
* Create repository is always listed, so Base UI's Empty, which speaks only for an empty
|
|
127
|
+
* list, never would: this says when no repository matches, kept mounted so it's heard.
|
|
128
|
+
*/}
|
|
129
|
+
{repos.isSuccess && (
|
|
130
|
+
<div
|
|
131
|
+
role="status"
|
|
132
|
+
aria-live="polite"
|
|
133
|
+
aria-atomic
|
|
134
|
+
className="flex w-full justify-center py-2 text-center text-sm text-muted-foreground empty:py-0"
|
|
135
|
+
>
|
|
136
|
+
{found.length > 0
|
|
137
|
+
? null
|
|
138
|
+
: reading
|
|
139
|
+
? 'Searching…'
|
|
140
|
+
: `No repository of ${owner.login}'s matches.`}
|
|
141
|
+
</div>
|
|
142
|
+
)}
|
|
143
|
+
<ComboboxList aria-label={`${owner.login}'s repositories`}>
|
|
144
|
+
{(item: string) =>
|
|
145
|
+
item === createRepo ? (
|
|
146
|
+
<ComboboxCreateRow
|
|
147
|
+
key="create"
|
|
148
|
+
label={labelOf(item)}
|
|
149
|
+
separated={found.length > 0}
|
|
150
|
+
value={item}
|
|
151
|
+
render={
|
|
152
|
+
<Link
|
|
153
|
+
to="/new"
|
|
154
|
+
search={{ owner: owner.login, return_to: here }}
|
|
155
|
+
onClick={() => setOpen(false)}
|
|
156
|
+
/>
|
|
157
|
+
}
|
|
158
|
+
/>
|
|
159
|
+
) : (
|
|
160
|
+
<ComboboxItem
|
|
161
|
+
key={item === everyRepo ? 'every' : item}
|
|
162
|
+
value={item}
|
|
163
|
+
render={
|
|
164
|
+
<Link
|
|
165
|
+
to={hrefOf(item === everyRepo ? undefined : item)}
|
|
166
|
+
onClick={() => setOpen(false)}
|
|
167
|
+
/>
|
|
168
|
+
}
|
|
169
|
+
>
|
|
170
|
+
<ItemIcon owner={owner.login} item={item} />
|
|
171
|
+
<span className="break-all">{labelOf(item)}</span>
|
|
172
|
+
</ComboboxItem>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
</ComboboxList>
|
|
176
|
+
</ComboboxContent>
|
|
177
|
+
</Combobox>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BookMarkedIcon,
|
|
3
|
+
CircleDotIcon,
|
|
4
|
+
CodeIcon,
|
|
5
|
+
GitPullRequestIcon,
|
|
6
|
+
KeyRoundIcon,
|
|
7
|
+
type LucideIcon,
|
|
8
|
+
SettingsIcon,
|
|
9
|
+
TagIcon,
|
|
10
|
+
} from 'lucide-react';
|
|
11
|
+
|
|
12
|
+
/** The sidebar's sections, in its order, at either level. */
|
|
13
|
+
export type Section = 'code' | 'issues' | 'pulls' | 'releases' | 'tokens' | 'settings';
|
|
14
|
+
|
|
15
|
+
const icons: Readonly<Record<Exclude<Section, 'code'>, LucideIcon>> = {
|
|
16
|
+
issues: CircleDotIcon,
|
|
17
|
+
pulls: GitPullRequestIcon,
|
|
18
|
+
releases: TagIcon,
|
|
19
|
+
tokens: KeyRoundIcon,
|
|
20
|
+
settings: SettingsIcon,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A section's icon, as the sidebar and the command palette's pages draw it: Code's is a book at
|
|
25
|
+
* an org's level, where the section is Repositories.
|
|
26
|
+
*/
|
|
27
|
+
export const sectionIcon = (section: Section, inRepo: boolean): LucideIcon => {
|
|
28
|
+
if (section === 'code') return inRepo ? CodeIcon : BookMarkedIcon;
|
|
29
|
+
|
|
30
|
+
return icons[section];
|
|
31
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { type MouseEvent, type PointerEvent, useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
/** How long a pointer stays on a chevron before its submenu opens, as Base UI's own triggers wait. */
|
|
4
|
+
export const restMs = 100;
|
|
5
|
+
|
|
6
|
+
/** How long a pointer may take crossing from the chevron to its submenu before other rows wake. */
|
|
7
|
+
const crossingMs = 400;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The pointer's moves a crossing holds back from the menu's rows, so none lights or opens: the outs
|
|
11
|
+
* too, since React makes a row's enter from the out of the row before it.
|
|
12
|
+
*/
|
|
13
|
+
const held = [
|
|
14
|
+
'pointerout',
|
|
15
|
+
'mouseout',
|
|
16
|
+
'pointerover',
|
|
17
|
+
'pointerenter',
|
|
18
|
+
'pointermove',
|
|
19
|
+
'mouseover',
|
|
20
|
+
'mouseenter',
|
|
21
|
+
'mousemove',
|
|
22
|
+
] as const;
|
|
23
|
+
|
|
24
|
+
/** Marks the menu while a pointer crosses it, for every chevron in it to see. */
|
|
25
|
+
const crossingMark = 'data-crossing';
|
|
26
|
+
|
|
27
|
+
interface Point {
|
|
28
|
+
readonly x: number;
|
|
29
|
+
readonly y: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Whether `point` is inside the triangle `a`, `b`, `c`, edges included. */
|
|
33
|
+
const inside = (point: Point, a: Point, b: Point, c: Point) => {
|
|
34
|
+
const side = (p: Point, q: Point) =>
|
|
35
|
+
(q.x - p.x) * (point.y - p.y) - (q.y - p.y) * (point.x - p.x);
|
|
36
|
+
const [ab, bc, ca] = [side(a, b), side(b, c), side(c, a)];
|
|
37
|
+
|
|
38
|
+
return (ab >= 0 && bc >= 0 && ca >= 0) || (ab <= 0 && bc <= 0 && ca <= 0);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A row's chevron that opens its submenu, while the rest of the row stays a link: resting the
|
|
43
|
+
* pointer on it for `restMs`, or clicking it, opens the submenu, and nothing else on the row does.
|
|
44
|
+
* Leaving it toward the submenu, the pointer crosses the rows below without waking them, so the
|
|
45
|
+
* submenu stays open: while the pointer is inside the triangle from where it left to the submenu's
|
|
46
|
+
* near edge, for up to `crossingMs`, its moves never reach the menu's rows.
|
|
47
|
+
*/
|
|
48
|
+
export function useSubmenuChevron({
|
|
49
|
+
open,
|
|
50
|
+
onOpen,
|
|
51
|
+
menu,
|
|
52
|
+
submenu,
|
|
53
|
+
}: {
|
|
54
|
+
readonly open: boolean;
|
|
55
|
+
readonly onOpen: () => void;
|
|
56
|
+
/** The menu the row is in, whose rows the crossing quiets. */
|
|
57
|
+
readonly menu: () => HTMLElement | null;
|
|
58
|
+
/** The submenu, once it's drawn. */
|
|
59
|
+
readonly submenu: () => HTMLElement | null;
|
|
60
|
+
}) {
|
|
61
|
+
const rest = useRef<number | undefined>(undefined);
|
|
62
|
+
const crossing = useRef<(() => void) | undefined>(undefined);
|
|
63
|
+
// A chevron the crossing passes over is entered in the same move that left the first one, before
|
|
64
|
+
// any move is held back, so it checks the mark itself and stays shut.
|
|
65
|
+
const quiet = () => menu()?.hasAttribute(crossingMark) === true;
|
|
66
|
+
|
|
67
|
+
useEffect(
|
|
68
|
+
() => () => {
|
|
69
|
+
window.clearTimeout(rest.current);
|
|
70
|
+
crossing.current?.();
|
|
71
|
+
},
|
|
72
|
+
[],
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const stopResting = () => {
|
|
76
|
+
window.clearTimeout(rest.current);
|
|
77
|
+
rest.current = undefined;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const startResting = () => {
|
|
81
|
+
if (open || quiet() || rest.current !== undefined) return;
|
|
82
|
+
|
|
83
|
+
rest.current = window.setTimeout(() => {
|
|
84
|
+
rest.current = undefined;
|
|
85
|
+
|
|
86
|
+
if (!quiet()) onOpen();
|
|
87
|
+
}, restMs);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const cross = (from: Point) => {
|
|
91
|
+
const quieted = menu();
|
|
92
|
+
const target = submenu()?.getBoundingClientRect();
|
|
93
|
+
if (quieted === null || target === undefined) return;
|
|
94
|
+
|
|
95
|
+
const near = target.left >= from.x ? target.left : target.right;
|
|
96
|
+
const a = { x: near, y: target.top };
|
|
97
|
+
const b = { x: near, y: target.bottom };
|
|
98
|
+
const end = () => {
|
|
99
|
+
window.clearTimeout(timer);
|
|
100
|
+
|
|
101
|
+
for (const type of held) document.removeEventListener(type, hold, true);
|
|
102
|
+
quieted.removeAttribute(crossingMark);
|
|
103
|
+
crossing.current = undefined;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const hold = (event: Event) => {
|
|
107
|
+
if (!(event instanceof globalThis.MouseEvent)) return;
|
|
108
|
+
|
|
109
|
+
const reached = event.target instanceof Node ? event.target : null;
|
|
110
|
+
if (reached !== null && submenu()?.contains(reached) === true) return end();
|
|
111
|
+
|
|
112
|
+
if (!inside({ x: event.clientX, y: event.clientY }, from, a, b)) return end();
|
|
113
|
+
|
|
114
|
+
if (reached !== null && quieted.contains(reached)) event.stopPropagation();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const timer = window.setTimeout(end, crossingMs);
|
|
118
|
+
|
|
119
|
+
crossing.current?.();
|
|
120
|
+
quieted.setAttribute(crossingMark, '');
|
|
121
|
+
|
|
122
|
+
for (const type of held) document.addEventListener(type, hold, true);
|
|
123
|
+
crossing.current = end;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
'aria-hidden': true,
|
|
128
|
+
onPointerEnter(event: PointerEvent) {
|
|
129
|
+
if (event.pointerType === 'mouse') startResting();
|
|
130
|
+
},
|
|
131
|
+
// A pointer still on the chevron once a crossing has ended rests there afresh.
|
|
132
|
+
onPointerMove(event: PointerEvent) {
|
|
133
|
+
if (event.pointerType === 'mouse') startResting();
|
|
134
|
+
},
|
|
135
|
+
onPointerLeave(event: PointerEvent) {
|
|
136
|
+
stopResting();
|
|
137
|
+
|
|
138
|
+
if (open) cross({ x: event.clientX, y: event.clientY });
|
|
139
|
+
},
|
|
140
|
+
onClick(event: MouseEvent) {
|
|
141
|
+
// The row around it is a link: the chevron opens the submenu instead of following it.
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
stopResting();
|
|
144
|
+
onOpen();
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { MonitorSmartphoneIcon } from 'lucide-react';
|
|
2
|
+
|
|
3
|
+
import type { DeviceCardState } from '../../signin/device-code.ts';
|
|
4
|
+
import { Alert, AlertDescription } from '../ui/alert.tsx';
|
|
5
|
+
import { Badge } from '../ui/badge.tsx';
|
|
6
|
+
import { Button } from '../ui/button.tsx';
|
|
7
|
+
import {
|
|
8
|
+
Card,
|
|
9
|
+
CardContent,
|
|
10
|
+
CardDescription,
|
|
11
|
+
CardFooter,
|
|
12
|
+
CardHeader,
|
|
13
|
+
CardTitle,
|
|
14
|
+
} from '../ui/card.tsx';
|
|
15
|
+
import { Field, FieldDescription, FieldLabel } from '../ui/field.tsx';
|
|
16
|
+
import { Input } from '../ui/input.tsx';
|
|
17
|
+
|
|
18
|
+
/** Where the Card's forms post: Git's `/login/device`, which decides and redirects back. */
|
|
19
|
+
const action = '/login/device';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `/login/code`'s Card, its title the page's heading: the Code field, the confirm, whose Approve and Deny post `user_code`, the
|
|
23
|
+
* sealed `prompt` and `decision`, or what was decided. Its forms are plain posts, so they work
|
|
24
|
+
* before the page hydrates. Each form holds the Card's content and footer, laid out as the Card's
|
|
25
|
+
* own children.
|
|
26
|
+
*/
|
|
27
|
+
export function DeviceCard({ state }: { readonly state: DeviceCardState }) {
|
|
28
|
+
if (state.kind === 'done') {
|
|
29
|
+
return (
|
|
30
|
+
<Card>
|
|
31
|
+
<CardHeader>
|
|
32
|
+
<CardTitle className="flex items-center gap-2">
|
|
33
|
+
<MonitorSmartphoneIcon aria-hidden className="size-4" />
|
|
34
|
+
<h1>{state.text}</h1>
|
|
35
|
+
</CardTitle>
|
|
36
|
+
</CardHeader>
|
|
37
|
+
</Card>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (state.kind === 'confirm') {
|
|
42
|
+
// The form holds the whole Card, so who it names, the code and what Approve grants are read
|
|
43
|
+
// with the fields it posts.
|
|
44
|
+
return (
|
|
45
|
+
<Card>
|
|
46
|
+
<form method="post" action={action} className="contents">
|
|
47
|
+
<CardHeader>
|
|
48
|
+
<CardTitle className="wrap-anywhere">
|
|
49
|
+
<h1>Authorize {state.client}</h1>
|
|
50
|
+
</CardTitle>
|
|
51
|
+
{/* Another client is named by its raw ID, and a login can be long: both wrap anywhere. */}
|
|
52
|
+
<CardDescription className="wrap-anywhere">
|
|
53
|
+
<strong>{state.client}</strong> wants to act as <strong>{state.login}</strong>.
|
|
54
|
+
</CardDescription>
|
|
55
|
+
</CardHeader>
|
|
56
|
+
<CardContent className="flex flex-col gap-4">
|
|
57
|
+
<p>
|
|
58
|
+
Check that your device shows this code:{' '}
|
|
59
|
+
<Badge variant="outline" className="font-mono tracking-widest">
|
|
60
|
+
{state.userCode}
|
|
61
|
+
</Badge>
|
|
62
|
+
</p>
|
|
63
|
+
<p>
|
|
64
|
+
Approve lets it read and write every repository you can, as you, for {state.days}{' '}
|
|
65
|
+
days.
|
|
66
|
+
</p>
|
|
67
|
+
{state.scopes.length > 0 && (
|
|
68
|
+
<div className="flex flex-col gap-2">
|
|
69
|
+
<p>Asked for:</p>
|
|
70
|
+
{/* Each scope as Git records it, as GitHub's page lists them. */}
|
|
71
|
+
<ul className="flex flex-wrap gap-1.5">
|
|
72
|
+
{state.scopes.map((scope) => (
|
|
73
|
+
<li key={scope}>
|
|
74
|
+
<Badge variant="outline" className="font-mono">
|
|
75
|
+
{scope}
|
|
76
|
+
</Badge>
|
|
77
|
+
</li>
|
|
78
|
+
))}
|
|
79
|
+
</ul>
|
|
80
|
+
</div>
|
|
81
|
+
)}
|
|
82
|
+
<input type="hidden" name="user_code" value={state.userCode} />
|
|
83
|
+
<input type="hidden" name="prompt" value={state.prompt} />
|
|
84
|
+
</CardContent>
|
|
85
|
+
<CardFooter className="justify-end gap-2">
|
|
86
|
+
<Button type="submit" name="decision" value="deny" variant="outline">
|
|
87
|
+
Deny
|
|
88
|
+
</Button>
|
|
89
|
+
<Button type="submit" name="decision" value="approve">
|
|
90
|
+
Approve
|
|
91
|
+
</Button>
|
|
92
|
+
</CardFooter>
|
|
93
|
+
</form>
|
|
94
|
+
</Card>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<Card>
|
|
100
|
+
<CardHeader>
|
|
101
|
+
<CardTitle>
|
|
102
|
+
<h1>Sign in a device</h1>
|
|
103
|
+
</CardTitle>
|
|
104
|
+
<CardDescription>Enter the code shown on your device.</CardDescription>
|
|
105
|
+
</CardHeader>
|
|
106
|
+
<form method="post" action={action} className="contents">
|
|
107
|
+
<CardContent className="flex flex-col gap-4">
|
|
108
|
+
{state.error !== undefined && (
|
|
109
|
+
<Alert variant="destructive">
|
|
110
|
+
<AlertDescription>{state.error}</AlertDescription>
|
|
111
|
+
</Alert>
|
|
112
|
+
)}
|
|
113
|
+
<Field>
|
|
114
|
+
<FieldLabel htmlFor="user_code" required>
|
|
115
|
+
Code
|
|
116
|
+
</FieldLabel>
|
|
117
|
+
<Input
|
|
118
|
+
id="user_code"
|
|
119
|
+
name="user_code"
|
|
120
|
+
placeholder="XXXX-XXXX"
|
|
121
|
+
defaultValue={state.userCode}
|
|
122
|
+
autoComplete="off"
|
|
123
|
+
autoCapitalize="characters"
|
|
124
|
+
spellCheck={false}
|
|
125
|
+
className="font-mono tracking-widest uppercase"
|
|
126
|
+
required
|
|
127
|
+
/>
|
|
128
|
+
<FieldDescription>Any case, with or without the dash.</FieldDescription>
|
|
129
|
+
</Field>
|
|
130
|
+
</CardContent>
|
|
131
|
+
<CardFooter>
|
|
132
|
+
<Button type="submit" className="w-full">
|
|
133
|
+
Continue
|
|
134
|
+
</Button>
|
|
135
|
+
</CardFooter>
|
|
136
|
+
</form>
|
|
137
|
+
</Card>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type FormEvent, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { signIn } from '../../signin/auth-client.ts';
|
|
4
|
+
import { type RefusalText, signInRefusal } from '../../signin/errors.ts';
|
|
5
|
+
import { Alert, AlertDescription } from '../ui/alert.tsx';
|
|
6
|
+
import { Button } from '../ui/button.tsx';
|
|
7
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../ui/card.tsx';
|
|
8
|
+
import { Field, FieldDescription, FieldGroup, FieldLabel } from '../ui/field.tsx';
|
|
9
|
+
import { Input } from '../ui/input.tsx';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `/login`'s Card, from shadcn's `login-01`: a login and a password, sent to Better Auth, then back
|
|
13
|
+
* to `returnTo`, with sign-up a link away. A refusal never says which of the two was wrong.
|
|
14
|
+
*/
|
|
15
|
+
export function LoginForm({ returnTo }: { readonly returnTo: string }) {
|
|
16
|
+
const [login, setLogin] = useState('');
|
|
17
|
+
const [password, setPassword] = useState('');
|
|
18
|
+
const [refused, setRefused] = useState<RefusalText | undefined>(undefined);
|
|
19
|
+
const [pending, setPending] = useState(false);
|
|
20
|
+
|
|
21
|
+
const submit = async (event: FormEvent<HTMLFormElement>) => {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
setPending(true);
|
|
24
|
+
|
|
25
|
+
const { error } = await signIn(login, password);
|
|
26
|
+
setPending(false);
|
|
27
|
+
|
|
28
|
+
if (error === null) return window.location.assign(returnTo);
|
|
29
|
+
|
|
30
|
+
setRefused(signInRefusal(error));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Card>
|
|
35
|
+
<CardHeader>
|
|
36
|
+
<CardTitle>
|
|
37
|
+
<h1>Sign in</h1>
|
|
38
|
+
</CardTitle>
|
|
39
|
+
<CardDescription>Enter your username and password.</CardDescription>
|
|
40
|
+
</CardHeader>
|
|
41
|
+
<CardContent>
|
|
42
|
+
<form onSubmit={submit}>
|
|
43
|
+
<FieldGroup>
|
|
44
|
+
{refused !== undefined && (
|
|
45
|
+
<Alert variant="destructive">
|
|
46
|
+
<AlertDescription>{refused.text}</AlertDescription>
|
|
47
|
+
</Alert>
|
|
48
|
+
)}
|
|
49
|
+
<Field>
|
|
50
|
+
<FieldLabel htmlFor="login" required>
|
|
51
|
+
Username
|
|
52
|
+
</FieldLabel>
|
|
53
|
+
<Input
|
|
54
|
+
id="login"
|
|
55
|
+
autoComplete="username"
|
|
56
|
+
required
|
|
57
|
+
value={login}
|
|
58
|
+
onChange={(event) => setLogin(event.target.value)}
|
|
59
|
+
/>
|
|
60
|
+
</Field>
|
|
61
|
+
<Field>
|
|
62
|
+
<FieldLabel htmlFor="password" required>
|
|
63
|
+
Password
|
|
64
|
+
</FieldLabel>
|
|
65
|
+
<Input
|
|
66
|
+
id="password"
|
|
67
|
+
type="password"
|
|
68
|
+
autoComplete="current-password"
|
|
69
|
+
required
|
|
70
|
+
value={password}
|
|
71
|
+
onChange={(event) => setPassword(event.target.value)}
|
|
72
|
+
/>
|
|
73
|
+
</Field>
|
|
74
|
+
<Field>
|
|
75
|
+
<Button type="submit" disabled={pending}>
|
|
76
|
+
Sign in
|
|
77
|
+
</Button>
|
|
78
|
+
<FieldDescription className="text-center">
|
|
79
|
+
Don't have an account?{' '}
|
|
80
|
+
<a href={`/signup?${new URLSearchParams({ return_to: returnTo })}`}>Create one</a>
|
|
81
|
+
</FieldDescription>
|
|
82
|
+
</Field>
|
|
83
|
+
</FieldGroup>
|
|
84
|
+
</form>
|
|
85
|
+
</CardContent>
|
|
86
|
+
</Card>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ThemeToggles } from '../theme-choice.tsx';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The sign-in card's sizes, a step up from the app's compact ones, since the card is the page's
|
|
7
|
+
* only content: a larger title, text, fields and buttons, set by each part's `data-slot`.
|
|
8
|
+
*/
|
|
9
|
+
const larger = [
|
|
10
|
+
'[&_[data-slot=card-title]]:text-xl',
|
|
11
|
+
'[&_[data-slot=card-description]]:text-sm',
|
|
12
|
+
'[&_[data-slot=field-label]]:text-sm',
|
|
13
|
+
'[&_[data-slot=field-description]]:text-sm',
|
|
14
|
+
'[&_[data-slot=field-error]]:text-sm',
|
|
15
|
+
'[&_[data-slot=input]]:h-10 [&_[data-slot=input]]:text-sm',
|
|
16
|
+
'[&_[data-slot=button]]:h-10 [&_[data-slot=button]]:text-sm',
|
|
17
|
+
].join(' ');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A sign-in page's one Card, centred in the whole page in a column, as shadcn's `login-01` does.
|
|
21
|
+
* It stands alone, outside the shell, so it's the page's one `main`. Its foot holds the theme
|
|
22
|
+
* switch, the one a visitor reaches with no account menu.
|
|
23
|
+
*/
|
|
24
|
+
export function SigninPage({ children }: { readonly children: ReactNode }) {
|
|
25
|
+
return (
|
|
26
|
+
<main className="flex min-h-svh w-full flex-col items-center justify-center gap-6 p-6 md:p-10">
|
|
27
|
+
<div className={`w-full max-w-md ${larger}`}>{children}</div>
|
|
28
|
+
<footer className="flex justify-center">
|
|
29
|
+
<ThemeToggles />
|
|
30
|
+
</footer>
|
|
31
|
+
</main>
|
|
32
|
+
);
|
|
33
|
+
}
|