ref0-git 0.0.0 → 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 +48 -6
- package/README.md +0 -5
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { cn } from '#/lib/cn';
|
|
2
|
+
import { CheckIcon, DotIcon, FileDiffIcon, type LucideIcon, MessageSquareIcon } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip.tsx';
|
|
5
|
+
|
|
6
|
+
/** Where a reviewer stands on a pull request: what their last review said, or asked and waiting. */
|
|
7
|
+
export type ReviewStanding = 'approved' | 'changes_requested' | 'commented' | 'awaiting';
|
|
8
|
+
|
|
9
|
+
/** Each standing's icon, its colour and its name, as GitHub's Reviewers section draws them. */
|
|
10
|
+
const looks: Readonly<
|
|
11
|
+
Record<
|
|
12
|
+
ReviewStanding,
|
|
13
|
+
{ readonly Icon: LucideIcon; readonly tone: string; readonly name: string }
|
|
14
|
+
>
|
|
15
|
+
> = {
|
|
16
|
+
approved: { Icon: CheckIcon, tone: 'text-success', name: 'Approved' },
|
|
17
|
+
changes_requested: { Icon: FileDiffIcon, tone: 'text-destructive', name: 'Changes requested' },
|
|
18
|
+
commented: { Icon: MessageSquareIcon, tone: 'text-muted-foreground', name: 'Commented' },
|
|
19
|
+
awaiting: { Icon: DotIcon, tone: 'text-warning', name: 'Awaiting review' },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** A review's state as GitHub's REST names it, as a standing. */
|
|
23
|
+
export const standingOf = (state: string): ReviewStanding | undefined => {
|
|
24
|
+
if (state === 'APPROVED') return 'approved';
|
|
25
|
+
|
|
26
|
+
if (state === 'CHANGES_REQUESTED') return 'changes_requested';
|
|
27
|
+
|
|
28
|
+
return state === 'COMMENTED' ? 'commented' : undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A review's standing as an icon, not a word: its name in a tooltip, and read out as it. It takes
|
|
33
|
+
* focus, so a keyboard shows the tooltip too. Beside words that already say it, `said`, it's only
|
|
34
|
+
* drawn.
|
|
35
|
+
*/
|
|
36
|
+
export function ReviewState({
|
|
37
|
+
standing,
|
|
38
|
+
said = false,
|
|
39
|
+
className,
|
|
40
|
+
}: {
|
|
41
|
+
readonly standing: ReviewStanding;
|
|
42
|
+
readonly said?: boolean;
|
|
43
|
+
readonly className?: string;
|
|
44
|
+
}) {
|
|
45
|
+
const { Icon, tone, name } = looks[standing];
|
|
46
|
+
|
|
47
|
+
if (said) {
|
|
48
|
+
return (
|
|
49
|
+
<Icon
|
|
50
|
+
aria-hidden
|
|
51
|
+
data-standing={standing}
|
|
52
|
+
className={cn('size-4 shrink-0', tone, className)}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Tooltip>
|
|
59
|
+
<TooltipTrigger
|
|
60
|
+
render={
|
|
61
|
+
<span
|
|
62
|
+
role="img"
|
|
63
|
+
aria-label={name}
|
|
64
|
+
data-standing={standing}
|
|
65
|
+
tabIndex={0}
|
|
66
|
+
className={cn('inline-flex shrink-0 rounded-sm', tone, className)}
|
|
67
|
+
/>
|
|
68
|
+
}
|
|
69
|
+
>
|
|
70
|
+
<Icon aria-hidden className="size-4" />
|
|
71
|
+
</TooltipTrigger>
|
|
72
|
+
<TooltipContent>{name}</TooltipContent>
|
|
73
|
+
</Tooltip>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { useNavigate } from '@tanstack/react-router';
|
|
2
|
+
import { XIcon } from 'lucide-react';
|
|
3
|
+
import { type ReactNode, useId, useSyncExternalStore } from 'react';
|
|
4
|
+
|
|
5
|
+
import { cn } from '#/lib/cn';
|
|
6
|
+
|
|
7
|
+
import { buttonVariants } from './ui/button.tsx';
|
|
8
|
+
import {
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogContent,
|
|
11
|
+
DialogDescription,
|
|
12
|
+
DialogHeader,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
} from './ui/dialog.tsx';
|
|
15
|
+
import { titleClass } from './ui/title.ts';
|
|
16
|
+
|
|
17
|
+
const never = () => () => {};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Whether React runs in the browser, past hydration: `false` on the server and while hydrating,
|
|
21
|
+
* so both draw the same, then `true`.
|
|
22
|
+
*/
|
|
23
|
+
const useHydrated = () =>
|
|
24
|
+
useSyncExternalStore(
|
|
25
|
+
never,
|
|
26
|
+
() => true,
|
|
27
|
+
() => false,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
/** Where a dialog sits and how wide it is: a box, or for `wide`, the whole screen on a phone. */
|
|
31
|
+
const placed = (wide: boolean) =>
|
|
32
|
+
cn(
|
|
33
|
+
'max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-lg',
|
|
34
|
+
wide &&
|
|
35
|
+
'sm:max-w-2xl max-sm:top-0 max-sm:left-0 max-sm:h-dvh max-sm:max-h-none max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:content-start max-sm:ring-0',
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
/** What a route dialog shows, and where closing it goes. */
|
|
39
|
+
interface Shown {
|
|
40
|
+
readonly title: string;
|
|
41
|
+
readonly description: string | undefined;
|
|
42
|
+
readonly closeTo: string;
|
|
43
|
+
readonly wide: boolean;
|
|
44
|
+
readonly children: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The dialog as the server draws it, and the browser until it hydrates: Base UI's portal mounts
|
|
49
|
+
* only in the browser, so the server would send the page with no form. This draws the same
|
|
50
|
+
* backdrop and box in place, as `ui/dialog.tsx` draws them, with a link back for the close button.
|
|
51
|
+
*/
|
|
52
|
+
function DrawnDialog({ title, description, closeTo, wide, children }: Shown) {
|
|
53
|
+
const titleId = useId();
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
<div aria-hidden className="fixed inset-0 isolate z-50 bg-black/10" />
|
|
58
|
+
<div
|
|
59
|
+
role="dialog"
|
|
60
|
+
aria-modal="true"
|
|
61
|
+
aria-labelledby={titleId}
|
|
62
|
+
className={cn(
|
|
63
|
+
'fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg bg-popover p-4 text-sm/relaxed text-popover-foreground ring-1 ring-foreground/10 outline-none',
|
|
64
|
+
placed(wide),
|
|
65
|
+
)}
|
|
66
|
+
>
|
|
67
|
+
<div className="flex flex-col gap-1 text-left">
|
|
68
|
+
<h2 id={titleId} className={titleClass}>
|
|
69
|
+
{title}
|
|
70
|
+
</h2>
|
|
71
|
+
{description !== undefined && (
|
|
72
|
+
<p className="text-sm/relaxed text-muted-foreground">{description}</p>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
{children}
|
|
76
|
+
<a
|
|
77
|
+
href={closeTo}
|
|
78
|
+
className={cn(
|
|
79
|
+
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
|
|
80
|
+
'absolute top-2 right-2',
|
|
81
|
+
)}
|
|
82
|
+
>
|
|
83
|
+
<XIcon />
|
|
84
|
+
<span className="sr-only">Close</span>
|
|
85
|
+
</a>
|
|
86
|
+
</div>
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A form with a route of its own, such as `/new`, drawn as a Dialog over the page it belongs to,
|
|
93
|
+
* so a link to it still opens it, in the server's page too. Closing it, by Escape, the backdrop or
|
|
94
|
+
* its close button, goes to `closeTo`. A `wide` dialog holds a Markdown editor: wider on a desktop,
|
|
95
|
+
* and the whole screen on a phone, where a long text has no room in a box.
|
|
96
|
+
*/
|
|
97
|
+
export function RouteDialog({
|
|
98
|
+
title,
|
|
99
|
+
description,
|
|
100
|
+
closeTo,
|
|
101
|
+
wide = false,
|
|
102
|
+
children,
|
|
103
|
+
}: {
|
|
104
|
+
readonly title: string;
|
|
105
|
+
readonly description?: string;
|
|
106
|
+
readonly closeTo: string;
|
|
107
|
+
readonly wide?: boolean;
|
|
108
|
+
readonly children: ReactNode;
|
|
109
|
+
}) {
|
|
110
|
+
const navigate = useNavigate();
|
|
111
|
+
const hydrated = useHydrated();
|
|
112
|
+
|
|
113
|
+
if (!hydrated) {
|
|
114
|
+
return (
|
|
115
|
+
<DrawnDialog title={title} description={description} closeTo={closeTo} wide={wide}>
|
|
116
|
+
{children}
|
|
117
|
+
</DrawnDialog>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<Dialog
|
|
123
|
+
open
|
|
124
|
+
onOpenChange={(open) => {
|
|
125
|
+
if (!open) void navigate({ href: closeTo });
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
<DialogContent className={placed(wide)}>
|
|
129
|
+
<DialogHeader>
|
|
130
|
+
<DialogTitle>{title}</DialogTitle>
|
|
131
|
+
{description !== undefined && <DialogDescription>{description}</DialogDescription>}
|
|
132
|
+
</DialogHeader>
|
|
133
|
+
{children}
|
|
134
|
+
</DialogContent>
|
|
135
|
+
</Dialog>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Button } from './ui/button.tsx';
|
|
4
|
+
import { InputGroupButton } from './ui/input-group.tsx';
|
|
5
|
+
|
|
6
|
+
/** `data-changed`: present while the form holds something to save. */
|
|
7
|
+
export const saveButtonDataAttributes = { 'data-changed': 'The form holds something to save' };
|
|
8
|
+
|
|
9
|
+
type SaveProps = {
|
|
10
|
+
/** Whether the form differs from what's saved, as `useDraft` tells. */
|
|
11
|
+
readonly changed: boolean;
|
|
12
|
+
/** Whether a save is on its way. */
|
|
13
|
+
readonly pending: boolean;
|
|
14
|
+
/** The look while there's nothing to save: the form's quiet button, disabled. */
|
|
15
|
+
readonly quiet?: 'outline' | 'secondary';
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A form's Save: disabled until the form holds a change, while a save is on its way, and while
|
|
20
|
+
* `disabled` says the form can't be sent yet, and the primary button once there's something to
|
|
21
|
+
* save. It submits its form.
|
|
22
|
+
*/
|
|
23
|
+
export function SaveButton({
|
|
24
|
+
changed,
|
|
25
|
+
pending,
|
|
26
|
+
quiet = 'outline',
|
|
27
|
+
disabled = false,
|
|
28
|
+
...props
|
|
29
|
+
}: SaveProps & Omit<ComponentProps<typeof Button>, 'variant' | 'type'>) {
|
|
30
|
+
return (
|
|
31
|
+
<Button
|
|
32
|
+
type="submit"
|
|
33
|
+
variant={changed ? 'default' : quiet}
|
|
34
|
+
disabled={!changed || pending || disabled}
|
|
35
|
+
data-changed={changed || undefined}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** `SaveButton` inside an input group, as an inline Rename or Update. */
|
|
42
|
+
export function InputGroupSaveButton({
|
|
43
|
+
changed,
|
|
44
|
+
pending,
|
|
45
|
+
quiet = 'secondary',
|
|
46
|
+
disabled = false,
|
|
47
|
+
...props
|
|
48
|
+
}: SaveProps & Omit<ComponentProps<typeof InputGroupButton>, 'variant' | 'type'>) {
|
|
49
|
+
return (
|
|
50
|
+
<InputGroupButton
|
|
51
|
+
type="submit"
|
|
52
|
+
variant={changed ? 'default' : quiet}
|
|
53
|
+
disabled={!changed || pending || disabled}
|
|
54
|
+
data-changed={changed || undefined}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { createContext, type ReactNode, useContext, useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Separator } from '../ui/separator.tsx';
|
|
4
|
+
import {
|
|
5
|
+
Sidebar,
|
|
6
|
+
SidebarContent,
|
|
7
|
+
SidebarFooter,
|
|
8
|
+
SidebarHeader,
|
|
9
|
+
SidebarInset,
|
|
10
|
+
SidebarProvider,
|
|
11
|
+
SidebarRail,
|
|
12
|
+
SidebarTrigger,
|
|
13
|
+
useSidebar,
|
|
14
|
+
} from '../ui/sidebar.tsx';
|
|
15
|
+
import { Hotkeys } from '../hotkeys/hotkeys.tsx';
|
|
16
|
+
import { CreateOrgDialog } from './create-org-dialog.tsx';
|
|
17
|
+
import { NavUser } from './nav-user.tsx';
|
|
18
|
+
import { OwnerSwitcher } from './owner-switcher.tsx';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The sidebar's width: shadcn's `16rem`, but never more than 40% of the window. A media query's
|
|
22
|
+
* `rem` is the browser's 16px, not the root's, so a larger root text size grows the sidebar but
|
|
23
|
+
* not the breakpoint that shows it: at 200%, a 768px window would leave the page about 250px.
|
|
24
|
+
*/
|
|
25
|
+
const sidebarWidth: Record<`--${string}`, string> = { '--sidebar-width': 'min(16rem, 40vw)' };
|
|
26
|
+
|
|
27
|
+
/** The sign-in pages, which stand alone in the middle of the page, with no sidenav or header. */
|
|
28
|
+
const standalonePages: ReadonlySet<string> = new Set(['/login', '/signup', '/login/code']);
|
|
29
|
+
|
|
30
|
+
/** Whether the page at `path` stands alone, outside the shell. */
|
|
31
|
+
export const standsAlone = (path: string): boolean =>
|
|
32
|
+
standalonePages.has(path.split(/[?#]/)[0]?.replace(/\/+$/, '') ?? '');
|
|
33
|
+
|
|
34
|
+
/** Opens Create organization's dialog, which the shell holds: a no-op outside the shell. */
|
|
35
|
+
const CreateOrgContext = createContext<() => void>(() => {});
|
|
36
|
+
|
|
37
|
+
/** What opens Create organization's dialog, for a control the shell draws, such as the palette's. */
|
|
38
|
+
export const useCreateOrg = () => useContext(CreateOrgContext);
|
|
39
|
+
|
|
40
|
+
/** Closes the phone's sidebar sheet once a link in it has led to another page. */
|
|
41
|
+
function CloseSheetOnLeave({ path }: { readonly path: string }) {
|
|
42
|
+
const { setOpenMobile } = useSidebar();
|
|
43
|
+
|
|
44
|
+
useEffect(() => setOpenMobile(false), [path, setOpenMobile]);
|
|
45
|
+
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Every page, beside shadcn's `sidebar-07` sidebar: the current owner at its top, the same items
|
|
51
|
+
* at every level, pointing at the owner or at its repo, and who is signed in. The top bar holds
|
|
52
|
+
* the sidebar's trigger, then the repo switcher, which with the owner names where the page is.
|
|
53
|
+
* The sidebar folds to icons on a desktop and opens as a sheet on a phone, from the top bar's
|
|
54
|
+
* trigger. Create organization's dialog is the shell's, outside the sidebar, so it stays open once
|
|
55
|
+
* a phone's sheet closes. The command palette's input sits under the owner switcher, its phone
|
|
56
|
+
* button at the top bar's end, and its dialog in the shell, beside Create organization's.
|
|
57
|
+
*/
|
|
58
|
+
export function AppShell({
|
|
59
|
+
viewer,
|
|
60
|
+
ended,
|
|
61
|
+
owner,
|
|
62
|
+
repo,
|
|
63
|
+
owners,
|
|
64
|
+
ownerHref,
|
|
65
|
+
repoHref,
|
|
66
|
+
nav,
|
|
67
|
+
switcher,
|
|
68
|
+
heading,
|
|
69
|
+
path,
|
|
70
|
+
palette,
|
|
71
|
+
inbox,
|
|
72
|
+
children,
|
|
73
|
+
}: {
|
|
74
|
+
/** Who is signed in, or `undefined` for a visitor. */
|
|
75
|
+
readonly viewer: string | undefined;
|
|
76
|
+
/** Whether a visitor's sign-in just ended, as Git refused its token, which their foot says. */
|
|
77
|
+
readonly ended: boolean;
|
|
78
|
+
/** The owner the page is under, as its URL names it: the viewer's own on the app's pages. */
|
|
79
|
+
readonly owner: { readonly login: string; readonly account: 'org' | 'user' } | undefined;
|
|
80
|
+
/** The page's repo, by its name, or `undefined` off a repo's pages. */
|
|
81
|
+
readonly repo: string | undefined;
|
|
82
|
+
/** Who the owner switcher offers. */
|
|
83
|
+
readonly owners: readonly string[];
|
|
84
|
+
/** Where picking another owner goes: the same section, at its level. */
|
|
85
|
+
readonly ownerHref: (owner: string) => string;
|
|
86
|
+
/** Where picking an owner's repo in the owner switcher goes: the same section, in it. */
|
|
87
|
+
readonly repoHref: (owner: string, repo: string) => string;
|
|
88
|
+
/** The sidebar's items. */
|
|
89
|
+
readonly nav: ReactNode;
|
|
90
|
+
/** The repo switcher, on an owner's pages. */
|
|
91
|
+
readonly switcher: ReactNode;
|
|
92
|
+
/**
|
|
93
|
+
* The page's one heading, drawn for screen readers alone, or `undefined` for a page that draws
|
|
94
|
+
* its own.
|
|
95
|
+
*/
|
|
96
|
+
readonly heading: string | undefined;
|
|
97
|
+
/** The page's path, for sign-in to come back to. */
|
|
98
|
+
readonly path: string;
|
|
99
|
+
/** The command palette's parts, for a viewer. */
|
|
100
|
+
readonly palette?:
|
|
101
|
+
| {
|
|
102
|
+
readonly input: ReactNode;
|
|
103
|
+
readonly button: ReactNode;
|
|
104
|
+
readonly dialog: ReactNode;
|
|
105
|
+
}
|
|
106
|
+
| undefined;
|
|
107
|
+
/** The viewer's Inbox row, under the palette's input. */
|
|
108
|
+
readonly inbox?: ReactNode;
|
|
109
|
+
readonly children: ReactNode;
|
|
110
|
+
}) {
|
|
111
|
+
const [creating, setCreating] = useState(false);
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<CreateOrgContext value={() => setCreating(true)}>
|
|
115
|
+
<SidebarProvider style={sidebarWidth}>
|
|
116
|
+
<CloseSheetOnLeave path={path} />
|
|
117
|
+
<Hotkeys />
|
|
118
|
+
<Sidebar collapsible="icon">
|
|
119
|
+
{viewer !== undefined && (
|
|
120
|
+
<SidebarHeader className="gap-3">
|
|
121
|
+
<OwnerSwitcher
|
|
122
|
+
current={owner ?? { login: viewer, account: 'user' }}
|
|
123
|
+
repo={repo}
|
|
124
|
+
owners={owners}
|
|
125
|
+
hrefOf={ownerHref}
|
|
126
|
+
repoHrefOf={repoHref}
|
|
127
|
+
onCreate={() => setCreating(true)}
|
|
128
|
+
/>
|
|
129
|
+
{palette?.input}
|
|
130
|
+
{inbox}
|
|
131
|
+
</SidebarHeader>
|
|
132
|
+
)}
|
|
133
|
+
<SidebarContent>{nav}</SidebarContent>
|
|
134
|
+
<SidebarFooter>
|
|
135
|
+
<NavUser viewer={viewer} ended={ended} path={path} />
|
|
136
|
+
</SidebarFooter>
|
|
137
|
+
<SidebarRail />
|
|
138
|
+
</Sidebar>
|
|
139
|
+
<SidebarInset className="min-w-0">
|
|
140
|
+
<header className="flex h-12 shrink-0 items-center gap-2 border-b px-4">
|
|
141
|
+
<SidebarTrigger className="-ml-1" />
|
|
142
|
+
{switcher !== undefined && switcher !== null && (
|
|
143
|
+
<>
|
|
144
|
+
<Separator
|
|
145
|
+
orientation="vertical"
|
|
146
|
+
className="mr-1 bg-muted-foreground/40 data-vertical:h-4 data-vertical:self-center"
|
|
147
|
+
/>
|
|
148
|
+
{switcher}
|
|
149
|
+
</>
|
|
150
|
+
)}
|
|
151
|
+
{palette?.button}
|
|
152
|
+
</header>
|
|
153
|
+
{/* `SidebarInset` is the page's one `main`, its content the width of the page. */}
|
|
154
|
+
<div className="flex min-w-0 flex-1 flex-col gap-section px-4 pt-6 pb-4 md:px-6 md:pt-8 md:pb-6">
|
|
155
|
+
{heading !== undefined && <h1 className="sr-only">{heading}</h1>}
|
|
156
|
+
{children}
|
|
157
|
+
</div>
|
|
158
|
+
</SidebarInset>
|
|
159
|
+
{viewer !== undefined && <CreateOrgDialog open={creating} onOpenChange={setCreating} />}
|
|
160
|
+
{palette?.dialog}
|
|
161
|
+
</SidebarProvider>
|
|
162
|
+
</CreateOrgContext>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useNavigate } from '@tanstack/react-router';
|
|
3
|
+
import { type FormEvent, useState } from 'react';
|
|
4
|
+
import { toast } from 'sonner';
|
|
5
|
+
|
|
6
|
+
import { forgetViewer } from '../../hooks/viewer.ts';
|
|
7
|
+
import { ownerProblem } from '../../names/owners.ts';
|
|
8
|
+
import { createOrg } from '../../signin/auth-client.ts';
|
|
9
|
+
import { createOrgRefusal } from '../../signin/errors.ts';
|
|
10
|
+
import { Button } from '../ui/button.tsx';
|
|
11
|
+
import {
|
|
12
|
+
Dialog,
|
|
13
|
+
DialogContent,
|
|
14
|
+
DialogDescription,
|
|
15
|
+
DialogFooter,
|
|
16
|
+
DialogHeader,
|
|
17
|
+
DialogTitle,
|
|
18
|
+
} from '../ui/dialog.tsx';
|
|
19
|
+
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel } from '../ui/field.tsx';
|
|
20
|
+
import { Input } from '../ui/input.tsx';
|
|
21
|
+
|
|
22
|
+
/** The org made, or why the server refused it, in the form's words. */
|
|
23
|
+
const made = async (login: string): Promise<string> => {
|
|
24
|
+
const { error } = await createOrg(login);
|
|
25
|
+
if (error !== null) throw new Error(createOrgRefusal(error));
|
|
26
|
+
|
|
27
|
+
return login.toLowerCase();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The switcher's Create organization: one field, its login, checked as it's typed. The viewer owns
|
|
32
|
+
* the org it makes, and the page goes to it, whose load reads the viewer's orgs again, so it joins
|
|
33
|
+
* the switcher.
|
|
34
|
+
*/
|
|
35
|
+
export function CreateOrgDialog({
|
|
36
|
+
open,
|
|
37
|
+
onOpenChange,
|
|
38
|
+
}: {
|
|
39
|
+
readonly open: boolean;
|
|
40
|
+
readonly onOpenChange: (open: boolean) => void;
|
|
41
|
+
}) {
|
|
42
|
+
return (
|
|
43
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
44
|
+
<DialogContent className="sm:max-w-md">
|
|
45
|
+
<DialogHeader>
|
|
46
|
+
<DialogTitle>Create organization</DialogTitle>
|
|
47
|
+
<DialogDescription>
|
|
48
|
+
An org holds repositories its members share. You own it.
|
|
49
|
+
</DialogDescription>
|
|
50
|
+
</DialogHeader>
|
|
51
|
+
{/* The form mounts with the dialog, so each opening starts empty. */}
|
|
52
|
+
<CreateOrgForm onMade={() => onOpenChange(false)} />
|
|
53
|
+
</DialogContent>
|
|
54
|
+
</Dialog>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The dialog's form, which makes the org, then goes to it, its switcher reading the new org. */
|
|
59
|
+
function CreateOrgForm({ onMade }: { readonly onMade: () => void }) {
|
|
60
|
+
const navigate = useNavigate();
|
|
61
|
+
const client = useQueryClient();
|
|
62
|
+
const [login, setLogin] = useState('');
|
|
63
|
+
const create = useMutation({
|
|
64
|
+
mutationFn: () => made(login),
|
|
65
|
+
onSuccess: async (org) => {
|
|
66
|
+
toast.success(`Created ${org}`);
|
|
67
|
+
onMade();
|
|
68
|
+
forgetViewer(client);
|
|
69
|
+
await navigate({ to: '/$owner', params: { owner: org } });
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
const typed = login !== '';
|
|
73
|
+
const problem = typed ? ownerProblem(login) : undefined;
|
|
74
|
+
const refused = create.isError ? create.error.message : undefined;
|
|
75
|
+
const shown = problem ?? refused;
|
|
76
|
+
|
|
77
|
+
const submit = (event: FormEvent<HTMLFormElement>) => {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
|
|
80
|
+
if (!typed || problem !== undefined || create.isPending) return;
|
|
81
|
+
|
|
82
|
+
create.mutate();
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<form noValidate onSubmit={submit} className="flex flex-col gap-4">
|
|
87
|
+
<FieldGroup>
|
|
88
|
+
<Field data-invalid={shown !== undefined}>
|
|
89
|
+
<FieldLabel htmlFor="org-login" required>
|
|
90
|
+
Organization name
|
|
91
|
+
</FieldLabel>
|
|
92
|
+
<Input
|
|
93
|
+
id="org-login"
|
|
94
|
+
required
|
|
95
|
+
autoComplete="off"
|
|
96
|
+
autoFocus
|
|
97
|
+
aria-invalid={shown !== undefined}
|
|
98
|
+
value={login}
|
|
99
|
+
onChange={(event) => {
|
|
100
|
+
setLogin(event.target.value);
|
|
101
|
+
create.reset();
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
{shown === undefined ? (
|
|
105
|
+
<FieldDescription>Its login, in its repositories' addresses.</FieldDescription>
|
|
106
|
+
) : (
|
|
107
|
+
<FieldError>{shown}</FieldError>
|
|
108
|
+
)}
|
|
109
|
+
</Field>
|
|
110
|
+
</FieldGroup>
|
|
111
|
+
<DialogFooter>
|
|
112
|
+
<Button type="submit" disabled={!typed || problem !== undefined || create.isPending}>
|
|
113
|
+
Create organization
|
|
114
|
+
</Button>
|
|
115
|
+
</DialogFooter>
|
|
116
|
+
</form>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PlusIcon } from 'lucide-react';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
|
|
4
|
+
import { ComboboxItem, ComboboxSeparator } from '../ui/combobox.tsx';
|
|
5
|
+
import { DropdownMenuItem, DropdownMenuSeparator } from '../ui/dropdown-menu.tsx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The row that ends each switcher: Create organization in the owner switcher, and Create repository
|
|
9
|
+
* in an owner's repo submenu and in the top bar's repo switcher. A separator, then a plus and what
|
|
10
|
+
* it creates. Its label is its name for a search, so a search keeps it and the keyboard reaches it.
|
|
11
|
+
* A menu's items and a combo box's are different Base UI parts, so each has its own row here,
|
|
12
|
+
* drawn the same.
|
|
13
|
+
*/
|
|
14
|
+
export function MenuCreateRow({
|
|
15
|
+
label,
|
|
16
|
+
...props
|
|
17
|
+
}: Omit<ComponentProps<typeof DropdownMenuItem>, 'children' | 'label'> & {
|
|
18
|
+
readonly label: string;
|
|
19
|
+
}) {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<DropdownMenuSeparator />
|
|
23
|
+
<DropdownMenuItem label={label} {...props}>
|
|
24
|
+
<PlusIcon />
|
|
25
|
+
{label}
|
|
26
|
+
</DropdownMenuItem>
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The same row in a combo box, whose separator shows only with rows above it to separate. */
|
|
32
|
+
export function ComboboxCreateRow({
|
|
33
|
+
label,
|
|
34
|
+
separated,
|
|
35
|
+
...props
|
|
36
|
+
}: Omit<ComponentProps<typeof ComboboxItem>, 'children' | 'showIndicator'> & {
|
|
37
|
+
readonly label: string;
|
|
38
|
+
readonly separated: boolean;
|
|
39
|
+
}) {
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
{separated && <ComboboxSeparator />}
|
|
43
|
+
<ComboboxItem showIndicator={false} {...props}>
|
|
44
|
+
<PlusIcon />
|
|
45
|
+
{label}
|
|
46
|
+
</ComboboxItem>
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
}
|