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.
Files changed (385) hide show
  1. package/app/apps/github/.dev.vars.example +6 -0
  2. package/app/apps/github/README.md +70 -0
  3. package/app/apps/github/THIRD_PARTY_NOTICES.md +214 -0
  4. package/app/apps/github/components.json +25 -0
  5. package/app/apps/github/generated/git-rest.ts +10444 -0
  6. package/app/apps/github/generated/routeTree.gen.ts +1242 -0
  7. package/app/apps/github/migrations/postgres/0001_auth.sql +46 -0
  8. package/app/apps/github/migrations/sql/0001_auth.sql +19 -0
  9. package/app/apps/github/migrations/sql/0002_passkeys.sql +9 -0
  10. package/app/apps/github/migrations/sql/0003_orgs.sql +22 -0
  11. package/app/apps/github/migrations/sql/0004_avatars.sql +6 -0
  12. package/app/apps/github/package.json +80 -0
  13. package/app/apps/github/src/branches/branch-list.tsx +385 -0
  14. package/app/apps/github/src/branches/branches.ts +55 -0
  15. package/app/apps/github/src/clients/allowed.ts +213 -0
  16. package/app/apps/github/src/clients/at-most.ts +17 -0
  17. package/app/apps/github/src/clients/avatars.ts +410 -0
  18. package/app/apps/github/src/clients/cached.ts +65 -0
  19. package/app/apps/github/src/clients/calls.ts +160 -0
  20. package/app/apps/github/src/clients/clients.ts +82 -0
  21. package/app/apps/github/src/clients/graphql.ts +50 -0
  22. package/app/apps/github/src/clients/host-answer.ts +28 -0
  23. package/app/apps/github/src/clients/host-calls.ts +382 -0
  24. package/app/apps/github/src/clients/icon-bytes.ts +203 -0
  25. package/app/apps/github/src/clients/proxy.ts +59 -0
  26. package/app/apps/github/src/clients/session-ended.ts +18 -0
  27. package/app/apps/github/src/clients/transfers.ts +212 -0
  28. package/app/apps/github/src/code/breadcrumbs.tsx +50 -0
  29. package/app/apps/github/src/code/code-page.tsx +147 -0
  30. package/app/apps/github/src/code/code-tree.tsx +338 -0
  31. package/app/apps/github/src/code/controls.tsx +230 -0
  32. package/app/apps/github/src/code/file-view.tsx +450 -0
  33. package/app/apps/github/src/code/files.ts +332 -0
  34. package/app/apps/github/src/code/folder-list.tsx +122 -0
  35. package/app/apps/github/src/code/go-to-file.tsx +131 -0
  36. package/app/apps/github/src/code/highlighted.tsx +58 -0
  37. package/app/apps/github/src/code/lines.ts +46 -0
  38. package/app/apps/github/src/code/load.ts +147 -0
  39. package/app/apps/github/src/code/markdown-files.ts +58 -0
  40. package/app/apps/github/src/code/places.ts +88 -0
  41. package/app/apps/github/src/code/ref-pages.ts +179 -0
  42. package/app/apps/github/src/code/ref-switcher.tsx +203 -0
  43. package/app/apps/github/src/code/refs.ts +142 -0
  44. package/app/apps/github/src/code/repo-home.tsx +240 -0
  45. package/app/apps/github/src/code/repo.ts +105 -0
  46. package/app/apps/github/src/code/saved-reads.ts +199 -0
  47. package/app/apps/github/src/code/saved.ts +110 -0
  48. package/app/apps/github/src/code/tree-fold.ts +186 -0
  49. package/app/apps/github/src/code/trees.ts +136 -0
  50. package/app/apps/github/src/components/avatar-picture.ts +53 -0
  51. package/app/apps/github/src/components/avatar-url.ts +16 -0
  52. package/app/apps/github/src/components/confirm-action.tsx +100 -0
  53. package/app/apps/github/src/components/count.tsx +24 -0
  54. package/app/apps/github/src/components/create-button.tsx +38 -0
  55. package/app/apps/github/src/components/file-icons/file-icons.css +225 -0
  56. package/app/apps/github/src/components/file-icons/file-icons.tsx +138 -0
  57. package/app/apps/github/src/components/filter.tsx +35 -0
  58. package/app/apps/github/src/components/hotkeys/hotkeys.tsx +255 -0
  59. package/app/apps/github/src/components/item-list.tsx +65 -0
  60. package/app/apps/github/src/components/language-dot.tsx +29 -0
  61. package/app/apps/github/src/components/list-toolbar.tsx +82 -0
  62. package/app/apps/github/src/components/markdown/editor.tsx +57 -0
  63. package/app/apps/github/src/components/markdown/markdown.css +177 -0
  64. package/app/apps/github/src/components/markdown/markdown.tsx +82 -0
  65. package/app/apps/github/src/components/owner-card.tsx +196 -0
  66. package/app/apps/github/src/components/pull-status.tsx +34 -0
  67. package/app/apps/github/src/components/recent.ts +41 -0
  68. package/app/apps/github/src/components/relative-time.tsx +78 -0
  69. package/app/apps/github/src/components/repos/icon-hashes.ts +91 -0
  70. package/app/apps/github/src/components/repos/new-repo-form.tsx +196 -0
  71. package/app/apps/github/src/components/repos/repo-icon.tsx +47 -0
  72. package/app/apps/github/src/components/repos/repo-list.tsx +528 -0
  73. package/app/apps/github/src/components/repos/your-repos.tsx +124 -0
  74. package/app/apps/github/src/components/review-state.tsx +75 -0
  75. package/app/apps/github/src/components/route-dialog.tsx +137 -0
  76. package/app/apps/github/src/components/save-button.tsx +58 -0
  77. package/app/apps/github/src/components/shell/app-shell.tsx +164 -0
  78. package/app/apps/github/src/components/shell/create-org-dialog.tsx +118 -0
  79. package/app/apps/github/src/components/shell/create-row.tsx +49 -0
  80. package/app/apps/github/src/components/shell/link-menu.tsx +94 -0
  81. package/app/apps/github/src/components/shell/nav-user.tsx +97 -0
  82. package/app/apps/github/src/components/shell/owner-repos.tsx +247 -0
  83. package/app/apps/github/src/components/shell/owner-switcher.tsx +104 -0
  84. package/app/apps/github/src/components/shell/repo-switcher.tsx +179 -0
  85. package/app/apps/github/src/components/shell/sections.ts +31 -0
  86. package/app/apps/github/src/components/shell/submenu-chevron.ts +147 -0
  87. package/app/apps/github/src/components/signin/device-card.tsx +139 -0
  88. package/app/apps/github/src/components/signin/login-form.tsx +88 -0
  89. package/app/apps/github/src/components/signin/signin-page.tsx +33 -0
  90. package/app/apps/github/src/components/signin/signup-form.tsx +106 -0
  91. package/app/apps/github/src/components/states/live-status.tsx +42 -0
  92. package/app/apps/github/src/components/states/states.tsx +126 -0
  93. package/app/apps/github/src/components/tab-indicator.tsx +143 -0
  94. package/app/apps/github/src/components/theme-choice.tsx +108 -0
  95. package/app/apps/github/src/components/theme-provider.tsx +126 -0
  96. package/app/apps/github/src/components/tones.ts +23 -0
  97. package/app/apps/github/src/components/ui/alert-dialog.tsx +187 -0
  98. package/app/apps/github/src/components/ui/alert.tsx +78 -0
  99. package/app/apps/github/src/components/ui/avatar.tsx +106 -0
  100. package/app/apps/github/src/components/ui/badge.tsx +51 -0
  101. package/app/apps/github/src/components/ui/breadcrumb.tsx +124 -0
  102. package/app/apps/github/src/components/ui/button-group.tsx +87 -0
  103. package/app/apps/github/src/components/ui/button.tsx +61 -0
  104. package/app/apps/github/src/components/ui/calendar.tsx +221 -0
  105. package/app/apps/github/src/components/ui/card.tsx +102 -0
  106. package/app/apps/github/src/components/ui/checkbox.tsx +26 -0
  107. package/app/apps/github/src/components/ui/collapsible.tsx +19 -0
  108. package/app/apps/github/src/components/ui/combobox.tsx +304 -0
  109. package/app/apps/github/src/components/ui/command.tsx +208 -0
  110. package/app/apps/github/src/components/ui/dialog.tsx +156 -0
  111. package/app/apps/github/src/components/ui/dropdown-menu.tsx +290 -0
  112. package/app/apps/github/src/components/ui/empty.tsx +100 -0
  113. package/app/apps/github/src/components/ui/field.tsx +236 -0
  114. package/app/apps/github/src/components/ui/hover-card.tsx +48 -0
  115. package/app/apps/github/src/components/ui/input-group.tsx +163 -0
  116. package/app/apps/github/src/components/ui/input.tsx +19 -0
  117. package/app/apps/github/src/components/ui/item.tsx +201 -0
  118. package/app/apps/github/src/components/ui/kbd.tsx +27 -0
  119. package/app/apps/github/src/components/ui/label.tsx +33 -0
  120. package/app/apps/github/src/components/ui/popover.tsx +87 -0
  121. package/app/apps/github/src/components/ui/radio-group.tsx +35 -0
  122. package/app/apps/github/src/components/ui/select.tsx +198 -0
  123. package/app/apps/github/src/components/ui/separator.tsx +22 -0
  124. package/app/apps/github/src/components/ui/sheet.tsx +138 -0
  125. package/app/apps/github/src/components/ui/sidebar.tsx +724 -0
  126. package/app/apps/github/src/components/ui/skeleton.tsx +13 -0
  127. package/app/apps/github/src/components/ui/sonner.tsx +47 -0
  128. package/app/apps/github/src/components/ui/styles.css +242 -0
  129. package/app/apps/github/src/components/ui/table.tsx +113 -0
  130. package/app/apps/github/src/components/ui/tabs.tsx +79 -0
  131. package/app/apps/github/src/components/ui/textarea.tsx +17 -0
  132. package/app/apps/github/src/components/ui/title.ts +6 -0
  133. package/app/apps/github/src/components/ui/toggle-group.tsx +89 -0
  134. package/app/apps/github/src/components/ui/toggle.tsx +42 -0
  135. package/app/apps/github/src/components/ui/tooltip.tsx +63 -0
  136. package/app/apps/github/src/components/user-avatar.tsx +145 -0
  137. package/app/apps/github/src/components/view-tabs.tsx +42 -0
  138. package/app/apps/github/src/context/context.ts +133 -0
  139. package/app/apps/github/src/diffs/blobs.ts +94 -0
  140. package/app/apps/github/src/diffs/diff-view.tsx +155 -0
  141. package/app/apps/github/src/diffs/files.ts +121 -0
  142. package/app/apps/github/src/diffs/hunks.tsx +454 -0
  143. package/app/apps/github/src/diffs/patch.ts +131 -0
  144. package/app/apps/github/src/diffs/rows.ts +137 -0
  145. package/app/apps/github/src/history/commit-diff.ts +54 -0
  146. package/app/apps/github/src/history/commit-list.tsx +207 -0
  147. package/app/apps/github/src/history/commit-page.tsx +147 -0
  148. package/app/apps/github/src/history/history.ts +129 -0
  149. package/app/apps/github/src/hooks/allowed.ts +31 -0
  150. package/app/apps/github/src/hooks/answers.ts +65 -0
  151. package/app/apps/github/src/hooks/avatars.ts +54 -0
  152. package/app/apps/github/src/hooks/draft.ts +38 -0
  153. package/app/apps/github/src/hooks/open-counts.ts +127 -0
  154. package/app/apps/github/src/hooks/profiles.ts +120 -0
  155. package/app/apps/github/src/hooks/repos.ts +440 -0
  156. package/app/apps/github/src/hooks/use-mobile.ts +19 -0
  157. package/app/apps/github/src/hooks/viewer.ts +39 -0
  158. package/app/apps/github/src/inbox/count.ts +70 -0
  159. package/app/apps/github/src/inbox/inbox-item.tsx +66 -0
  160. package/app/apps/github/src/inbox/inbox-page.tsx +572 -0
  161. package/app/apps/github/src/inbox/marks.ts +130 -0
  162. package/app/apps/github/src/inbox/release-tags.ts +65 -0
  163. package/app/apps/github/src/inbox/search.ts +97 -0
  164. package/app/apps/github/src/inbox/subjects.ts +184 -0
  165. package/app/apps/github/src/inbox/subscription-controls.tsx +184 -0
  166. package/app/apps/github/src/inbox/subscriptions.ts +189 -0
  167. package/app/apps/github/src/inbox/threads.ts +198 -0
  168. package/app/apps/github/src/issues/changes.ts +332 -0
  169. package/app/apps/github/src/issues/counts.ts +62 -0
  170. package/app/apps/github/src/issues/issue-list.tsx +682 -0
  171. package/app/apps/github/src/issues/issue-page.tsx +533 -0
  172. package/app/apps/github/src/issues/issues.ts +566 -0
  173. package/app/apps/github/src/issues/label-dialog.tsx +310 -0
  174. package/app/apps/github/src/issues/labels-page.tsx +119 -0
  175. package/app/apps/github/src/issues/new-issue.tsx +79 -0
  176. package/app/apps/github/src/issues/parts.tsx +71 -0
  177. package/app/apps/github/src/issues/picker.tsx +298 -0
  178. package/app/apps/github/src/issues/search.ts +238 -0
  179. package/app/apps/github/src/issues/sidebar.tsx +236 -0
  180. package/app/apps/github/src/lib/cn.ts +8 -0
  181. package/app/apps/github/src/lib/highlighting.ts +13 -0
  182. package/app/apps/github/src/live/follow.ts +129 -0
  183. package/app/apps/github/src/live/sse.ts +74 -0
  184. package/app/apps/github/src/live/use-follow.ts +37 -0
  185. package/app/apps/github/src/markdown/README.md +53 -0
  186. package/app/apps/github/src/markdown/allowed-html.ts +69 -0
  187. package/app/apps/github/src/markdown/context.ts +206 -0
  188. package/app/apps/github/src/markdown/images.ts +81 -0
  189. package/app/apps/github/src/markdown/lookup.ts +122 -0
  190. package/app/apps/github/src/markdown/patches.ts +299 -0
  191. package/app/apps/github/src/markdown/query.ts +25 -0
  192. package/app/apps/github/src/markdown/references.ts +158 -0
  193. package/app/apps/github/src/markdown/render.ts +103 -0
  194. package/app/apps/github/src/names/owners.ts +51 -0
  195. package/app/apps/github/src/names/repos.ts +24 -0
  196. package/app/apps/github/src/palette/palette.tsx +547 -0
  197. package/app/apps/github/src/palette/recent.ts +116 -0
  198. package/app/apps/github/src/palette/rows.tsx +455 -0
  199. package/app/apps/github/src/palette/server.ts +104 -0
  200. package/app/apps/github/src/palette/targets.ts +306 -0
  201. package/app/apps/github/src/policy.ts +600 -0
  202. package/app/apps/github/src/private-repos.ts +47 -0
  203. package/app/apps/github/src/pulls/compare-page.tsx +342 -0
  204. package/app/apps/github/src/pulls/files-tab.tsx +776 -0
  205. package/app/apps/github/src/pulls/live.ts +124 -0
  206. package/app/apps/github/src/pulls/merge-box.tsx +367 -0
  207. package/app/apps/github/src/pulls/merge-button.ts +86 -0
  208. package/app/apps/github/src/pulls/pull-list.tsx +235 -0
  209. package/app/apps/github/src/pulls/pull-page.tsx +474 -0
  210. package/app/apps/github/src/pulls/pull.ts +468 -0
  211. package/app/apps/github/src/pulls/pulls.ts +318 -0
  212. package/app/apps/github/src/pulls/review.ts +350 -0
  213. package/app/apps/github/src/pulls/search.ts +130 -0
  214. package/app/apps/github/src/queue/queue-page.tsx +405 -0
  215. package/app/apps/github/src/queue/queue.ts +231 -0
  216. package/app/apps/github/src/releases/latest-release.tsx +55 -0
  217. package/app/apps/github/src/releases/overview.tsx +30 -0
  218. package/app/apps/github/src/releases/release-form.tsx +353 -0
  219. package/app/apps/github/src/releases/release-list.tsx +173 -0
  220. package/app/apps/github/src/releases/release-view.tsx +183 -0
  221. package/app/apps/github/src/releases/releases.ts +308 -0
  222. package/app/apps/github/src/releases/tag-list.tsx +134 -0
  223. package/app/apps/github/src/router.tsx +46 -0
  224. package/app/apps/github/src/routes/$owner/$repo/_code/blob/$.tsx +33 -0
  225. package/app/apps/github/src/routes/$owner/$repo/_code/tree/$.tsx +28 -0
  226. package/app/apps/github/src/routes/$owner/$repo/_code.tsx +11 -0
  227. package/app/apps/github/src/routes/$owner/$repo/_releases/releases/index.tsx +19 -0
  228. package/app/apps/github/src/routes/$owner/$repo/_releases/tags.tsx +19 -0
  229. package/app/apps/github/src/routes/$owner/$repo/_releases.tsx +23 -0
  230. package/app/apps/github/src/routes/$owner/$repo/branches.tsx +39 -0
  231. package/app/apps/github/src/routes/$owner/$repo/commit/$sha.tsx +34 -0
  232. package/app/apps/github/src/routes/$owner/$repo/commits/$.tsx +42 -0
  233. package/app/apps/github/src/routes/$owner/$repo/compare/$.tsx +19 -0
  234. package/app/apps/github/src/routes/$owner/$repo/index.tsx +24 -0
  235. package/app/apps/github/src/routes/$owner/$repo/issues/$number.tsx +50 -0
  236. package/app/apps/github/src/routes/$owner/$repo/issues/index.tsx +53 -0
  237. package/app/apps/github/src/routes/$owner/$repo/issues/new.tsx +43 -0
  238. package/app/apps/github/src/routes/$owner/$repo/labels.tsx +22 -0
  239. package/app/apps/github/src/routes/$owner/$repo/pull/$number/checks.tsx +15 -0
  240. package/app/apps/github/src/routes/$owner/$repo/pull/$number/commits.tsx +15 -0
  241. package/app/apps/github/src/routes/$owner/$repo/pull/$number/files.tsx +15 -0
  242. package/app/apps/github/src/routes/$owner/$repo/pull/$number/index.tsx +19 -0
  243. package/app/apps/github/src/routes/$owner/$repo/pull/$number/route.tsx +52 -0
  244. package/app/apps/github/src/routes/$owner/$repo/pulls/index.tsx +48 -0
  245. package/app/apps/github/src/routes/$owner/$repo/queue.tsx +22 -0
  246. package/app/apps/github/src/routes/$owner/$repo/releases/edit/$.tsx +58 -0
  247. package/app/apps/github/src/routes/$owner/$repo/releases/new.tsx +40 -0
  248. package/app/apps/github/src/routes/$owner/$repo/releases/tag/$.tsx +35 -0
  249. package/app/apps/github/src/routes/$owner/$repo/route.tsx +102 -0
  250. package/app/apps/github/src/routes/$owner/$repo/settings/access.tsx +9 -0
  251. package/app/apps/github/src/routes/$owner/$repo/settings/hooks/index.tsx +16 -0
  252. package/app/apps/github/src/routes/$owner/$repo/settings/hooks/new.tsx +25 -0
  253. package/app/apps/github/src/routes/$owner/$repo/settings/index.tsx +17 -0
  254. package/app/apps/github/src/routes/$owner/$repo/settings/route.tsx +28 -0
  255. package/app/apps/github/src/routes/$owner/$repo/settings/rules.tsx +12 -0
  256. package/app/apps/github/src/routes/$owner/$repo/tokens.tsx +16 -0
  257. package/app/apps/github/src/routes/$owner/index.tsx +45 -0
  258. package/app/apps/github/src/routes/-nav.tsx +293 -0
  259. package/app/apps/github/src/routes/-root-testing.ts +107 -0
  260. package/app/apps/github/src/routes/__root.tsx +225 -0
  261. package/app/apps/github/src/routes/api.auth.$.ts +18 -0
  262. package/app/apps/github/src/routes/downloads/$owner/$repo/$asset.tsx +10 -0
  263. package/app/apps/github/src/routes/file-icons[.]svg.ts +21 -0
  264. package/app/apps/github/src/routes/icons/$owner/$repo.tsx +14 -0
  265. package/app/apps/github/src/routes/icons/$owner/index.tsx +14 -0
  266. package/app/apps/github/src/routes/icons/index.tsx +12 -0
  267. package/app/apps/github/src/routes/index.tsx +48 -0
  268. package/app/apps/github/src/routes/login.tsx +24 -0
  269. package/app/apps/github/src/routes/login_.code.tsx +31 -0
  270. package/app/apps/github/src/routes/new.tsx +91 -0
  271. package/app/apps/github/src/routes/notifications.tsx +20 -0
  272. package/app/apps/github/src/routes/orgs/$owner/issues.tsx +8 -0
  273. package/app/apps/github/src/routes/orgs/$owner/pulls.tsx +8 -0
  274. package/app/apps/github/src/routes/orgs/$owner/releases.tsx +8 -0
  275. package/app/apps/github/src/routes/orgs/$owner/route.tsx +25 -0
  276. package/app/apps/github/src/routes/orgs/$owner/settings.tsx +30 -0
  277. package/app/apps/github/src/routes/orgs/$owner/tokens.tsx +15 -0
  278. package/app/apps/github/src/routes/settings.tsx +54 -0
  279. package/app/apps/github/src/routes/signup.tsx +24 -0
  280. package/app/apps/github/src/routes/uploads/$owner/$repo/$release.tsx +10 -0
  281. package/app/apps/github/src/seed/acme.ts +498 -0
  282. package/app/apps/github/src/seed/licenses.ts +114 -0
  283. package/app/apps/github/src/seed/seed.ts +538 -0
  284. package/app/apps/github/src/server.ts +97 -0
  285. package/app/apps/github/src/settings/account-avatar.tsx +43 -0
  286. package/app/apps/github/src/settings/avatar-section.tsx +140 -0
  287. package/app/apps/github/src/settings/avatar.ts +58 -0
  288. package/app/apps/github/src/settings/general-settings.tsx +439 -0
  289. package/app/apps/github/src/settings/general.ts +73 -0
  290. package/app/apps/github/src/settings/hook-form.tsx +195 -0
  291. package/app/apps/github/src/settings/hook-list.tsx +166 -0
  292. package/app/apps/github/src/settings/hooks.ts +87 -0
  293. package/app/apps/github/src/settings/org-settings.tsx +228 -0
  294. package/app/apps/github/src/settings/orgs.ts +116 -0
  295. package/app/apps/github/src/settings/rule-list.tsx +72 -0
  296. package/app/apps/github/src/settings/rules.ts +27 -0
  297. package/app/apps/github/src/settings/settings-layout.tsx +114 -0
  298. package/app/apps/github/src/signin/approval.ts +186 -0
  299. package/app/apps/github/src/signin/auth-client.ts +127 -0
  300. package/app/apps/github/src/signin/auth.ts +753 -0
  301. package/app/apps/github/src/signin/avatars.ts +126 -0
  302. package/app/apps/github/src/signin/client-ip.ts +39 -0
  303. package/app/apps/github/src/signin/credentials.ts +26 -0
  304. package/app/apps/github/src/signin/device-code.ts +95 -0
  305. package/app/apps/github/src/signin/device-prompt.ts +125 -0
  306. package/app/apps/github/src/signin/errors.ts +135 -0
  307. package/app/apps/github/src/signin/host-session.ts +68 -0
  308. package/app/apps/github/src/signin/orgs.ts +283 -0
  309. package/app/apps/github/src/signin/owner-names.ts +183 -0
  310. package/app/apps/github/src/signin/person-lock.ts +104 -0
  311. package/app/apps/github/src/signin/seal.ts +88 -0
  312. package/app/apps/github/src/signin/seed-people.ts +92 -0
  313. package/app/apps/github/src/signin/session.ts +48 -0
  314. package/app/apps/github/src/signin/unborn.ts +110 -0
  315. package/app/apps/github/src/signin/viewer-orgs.ts +47 -0
  316. package/app/apps/github/src/signin/viewer.ts +74 -0
  317. package/app/apps/github/src/signin/with-headers.ts +14 -0
  318. package/app/apps/github/src/tokens/tokens-page.tsx +529 -0
  319. package/app/apps/github/src/tokens/tokens.ts +54 -0
  320. package/app/apps/github/tsconfig.json +25 -0
  321. package/app/apps/github/tsconfig.worker.json +24 -0
  322. package/app/apps/github/vite.config.ts +21 -0
  323. package/app/pnpm-workspace.yaml +216 -0
  324. package/app/tsconfig.base.json +127 -0
  325. package/dist/LICENSE +202 -0
  326. package/dist/cli/child.mjs +42 -0
  327. package/dist/cli/commands.mjs +23 -0
  328. package/dist/cli/credentials.mjs +84 -0
  329. package/dist/cli/documents.mjs +214 -0
  330. package/dist/cli/events.mjs +55 -0
  331. package/dist/cli/failure.mjs +105 -0
  332. package/dist/cli/folders.mjs +32 -0
  333. package/dist/cli/git-remote-ref0.d.mts +1 -0
  334. package/dist/cli/git-remote-ref0.mjs +29 -0
  335. package/dist/cli/git.mjs +48 -0
  336. package/dist/cli/helpers.mjs +51 -0
  337. package/dist/cli/hosts.mjs +127 -0
  338. package/dist/cli/node.mjs +15 -0
  339. package/dist/cli/output.mjs +135 -0
  340. package/dist/cli/prompt.mjs +35 -0
  341. package/dist/cli/queue.mjs +215 -0
  342. package/dist/cli/ref0-git.d.mts +1 -0
  343. package/dist/cli/ref0-git.mjs +144 -0
  344. package/dist/cli/repos.mjs +162 -0
  345. package/dist/cli/resources.mjs +131 -0
  346. package/dist/cli/run-end.mjs +57 -0
  347. package/dist/cli/runtime.mjs +50 -0
  348. package/dist/cli/setup.mjs +1410 -0
  349. package/dist/cli/sign-in.mjs +162 -0
  350. package/dist/cli/sign-ins.mjs +79 -0
  351. package/dist/cli/sqlite.mjs +28 -0
  352. package/dist/cli/tokens.mjs +141 -0
  353. package/dist/cli/vendor.mjs +123 -0
  354. package/dist/init/app.mjs +231 -0
  355. package/dist/init/astro.mjs +49 -0
  356. package/dist/init/choices.mjs +497 -0
  357. package/dist/init/cloudflare.mjs +324 -0
  358. package/dist/init/create.mjs +151 -0
  359. package/dist/init/detect.mjs +297 -0
  360. package/dist/init/files.mjs +75 -0
  361. package/dist/init/frameworks.mjs +248 -0
  362. package/dist/init/git-module.mjs +49 -0
  363. package/dist/init/github-routes.mjs +66 -0
  364. package/dist/init/jsonc.mjs +143 -0
  365. package/dist/init/metadata.mjs +48 -0
  366. package/dist/init/mounts.mjs +109 -0
  367. package/dist/init/next.mjs +205 -0
  368. package/dist/init/node-app.mjs +189 -0
  369. package/dist/init/node.mjs +458 -0
  370. package/dist/init/nuxt.mjs +115 -0
  371. package/dist/init/output.mjs +21 -0
  372. package/dist/init/plan.mjs +82 -0
  373. package/dist/init/range-major.mjs +257 -0
  374. package/dist/init/react-router.mjs +59 -0
  375. package/dist/init/routes.mjs +148 -0
  376. package/dist/init/shell.mjs +4 -0
  377. package/dist/init/stores.mjs +51 -0
  378. package/dist/init/sveltekit.mjs +139 -0
  379. package/dist/init/template.mjs +142 -0
  380. package/dist/init/templates.mjs +343 -0
  381. package/dist/init/vercel.mjs +383 -0
  382. package/dist/init/versions.mjs +32 -0
  383. package/dist/init/workspace.mjs +20 -0
  384. package/package.json +52 -3
  385. package/README.md +0 -3
@@ -0,0 +1,94 @@
1
+ import { ChevronsUpDownIcon } from 'lucide-react';
2
+ import { useRouterState } from '@tanstack/react-router';
3
+ import { type ReactElement, type ReactNode, useEffect, useRef, useState } from 'react';
4
+
5
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from '../ui/dropdown-menu.tsx';
6
+ import {
7
+ SidebarMenuAction,
8
+ SidebarMenuButton,
9
+ SidebarMenuItem,
10
+ useSidebar,
11
+ } from '../ui/sidebar.tsx';
12
+
13
+ /**
14
+ * A sidebar row that is a link with a menu beside it, as the owner switcher at the sidebar's top
15
+ * and the account at its foot both are, so the two can't drift apart. Pressing the row goes to its
16
+ * page. The chevrons at its right, a `SidebarMenuAction` named `label`, open the menu, which opens
17
+ * against the whole row, below it or above it as `side` says. Tab reaches the link, then the
18
+ * chevrons. A phone's sheet draws the row as a desktop's sidebar does.
19
+ *
20
+ * The folded icon rail has no room for the chevrons, so there pressing the picture opens the menu,
21
+ * to the rail's right: each menu leads to the viewer's own repositories too.
22
+ *
23
+ * The menu closes once the page changes, as a submenu's row, a link that is no menu item, leads on.
24
+ */
25
+ export function LinkMenu({
26
+ link,
27
+ label,
28
+ side,
29
+ menuClassName,
30
+ children,
31
+ menu,
32
+ }: {
33
+ /** Where the row goes, as the element its button renders, such as a `Link`. */
34
+ readonly link: ReactElement;
35
+ /** The chevrons' accessible name, such as "Open account menu". */
36
+ readonly label: string;
37
+ /** Which side of the row the menu opens on: `bottom` at the sidebar's top, `top` at its foot. */
38
+ readonly side: 'top' | 'bottom';
39
+ readonly menuClassName?: string;
40
+ /** What the row shows: a picture, then its words. */
41
+ readonly children: ReactNode;
42
+ /** The menu's items. */
43
+ readonly menu: ReactNode;
44
+ }) {
45
+ const { state, isMobile } = useSidebar();
46
+ const folded = state === 'collapsed' && !isMobile;
47
+ const row = useRef<HTMLLIElement>(null);
48
+ const [open, setOpen] = useState(false);
49
+ const path = useRouterState({ select: (state) => state.location.pathname });
50
+
51
+ useEffect(() => setOpen(false), [path]);
52
+
53
+ return (
54
+ <SidebarMenuItem ref={row}>
55
+ <DropdownMenu open={open} onOpenChange={setOpen}>
56
+ {folded ? (
57
+ <DropdownMenuTrigger
58
+ aria-label={label}
59
+ render={<SidebarMenuButton size="lg" className="data-popup-open:bg-sidebar-accent" />}
60
+ >
61
+ {children}
62
+ </DropdownMenuTrigger>
63
+ ) : (
64
+ <>
65
+ <SidebarMenuButton
66
+ size="lg"
67
+ className="group-has-data-[sidebar=menu-action]/menu-item:pr-11"
68
+ render={link}
69
+ >
70
+ {children}
71
+ </SidebarMenuButton>
72
+ <DropdownMenuTrigger
73
+ aria-label={label}
74
+ render={
75
+ <SidebarMenuAction className="right-2 size-8 peer-data-[size=lg]/menu-button:top-2 data-popup-open:bg-sidebar-accent" />
76
+ }
77
+ >
78
+ <ChevronsUpDownIcon />
79
+ </DropdownMenuTrigger>
80
+ </>
81
+ )}
82
+ <DropdownMenuContent
83
+ anchor={folded ? undefined : row}
84
+ className={menuClassName}
85
+ side={folded ? 'right' : side}
86
+ align={folded && side === 'top' ? 'end' : 'start'}
87
+ sideOffset={4}
88
+ >
89
+ {menu}
90
+ </DropdownMenuContent>
91
+ </DropdownMenu>
92
+ </SidebarMenuItem>
93
+ );
94
+ }
@@ -0,0 +1,97 @@
1
+ import { Link } from '@tanstack/react-router';
2
+ import { LogInIcon, LogOutIcon, SettingsIcon } from 'lucide-react';
3
+
4
+ import { signOutAndLeave } from '../../signin/auth-client.ts';
5
+ import { signInReturn } from '../../signin/session.ts';
6
+ import { signInHref } from '../states/states.tsx';
7
+ import { ThemeMenu } from '../theme-choice.tsx';
8
+ import {
9
+ DropdownMenuGroup,
10
+ DropdownMenuItem,
11
+ DropdownMenuSeparator,
12
+ } from '../ui/dropdown-menu.tsx';
13
+ import { SidebarMenu, SidebarMenuButton, SidebarMenuItem } from '../ui/sidebar.tsx';
14
+ import { UserAvatar } from '../user-avatar.tsx';
15
+ import { LinkMenu } from './link-menu.tsx';
16
+
17
+ /**
18
+ * The sidebar's foot, from shadcn's `sidebar-07` user menu, a `LinkMenu` as the owner switcher at
19
+ * the top is: who is signed in, by their picture and login, a link to every repository they can
20
+ * see, at `/`. Its chevrons open the account menu: their repositories again, Theme, then Settings,
21
+ * their account's page, where they set their picture (Q757) and the theme too, and Sign out, which
22
+ * ends the session and goes home. A visitor has Sign in instead, which comes back to the page, or from a sign-in page
23
+ * to where that page goes after. A visitor whose sign-in just ended reads that it did.
24
+ */
25
+ export function NavUser({
26
+ viewer,
27
+ ended,
28
+ path,
29
+ }: {
30
+ readonly viewer: string | undefined;
31
+ readonly ended: boolean;
32
+ readonly path: string;
33
+ }) {
34
+ if (viewer === undefined) {
35
+ return (
36
+ <SidebarMenu>
37
+ <SidebarMenuItem>
38
+ <SidebarMenuButton
39
+ size={ended ? 'lg' : 'default'}
40
+ tooltip="Sign in"
41
+ render={<a href={signInHref(signInReturn(path))} />}
42
+ >
43
+ <LogInIcon />
44
+ {ended ? (
45
+ <span className="grid flex-1 text-left leading-tight">
46
+ <span className="truncate font-medium">Sign in</span>
47
+ <span className="truncate text-meta text-muted-foreground">Your sign-in ended</span>
48
+ </span>
49
+ ) : (
50
+ <span>Sign in</span>
51
+ )}
52
+ </SidebarMenuButton>
53
+ </SidebarMenuItem>
54
+ </SidebarMenu>
55
+ );
56
+ }
57
+
58
+ return (
59
+ <SidebarMenu>
60
+ <LinkMenu
61
+ label="Open account menu"
62
+ side="top"
63
+ menuClassName="min-w-[max(var(--anchor-width),14rem)]"
64
+ link={<Link to="/" />}
65
+ menu={
66
+ <>
67
+ <DropdownMenuGroup>
68
+ {/* Their own repositories, which pressing the row goes to: the rail's way there. */}
69
+ <DropdownMenuItem render={<Link to="/" />}>
70
+ <UserAvatar login={viewer} size="sm" account="user" />
71
+ <span className="truncate font-medium">{viewer}</span>
72
+ </DropdownMenuItem>
73
+ </DropdownMenuGroup>
74
+ <DropdownMenuSeparator />
75
+ <DropdownMenuGroup>
76
+ <ThemeMenu />
77
+ <DropdownMenuItem render={<Link to="/settings" />}>
78
+ <SettingsIcon />
79
+ Settings
80
+ </DropdownMenuItem>
81
+ </DropdownMenuGroup>
82
+ <DropdownMenuSeparator />
83
+ <DropdownMenuGroup>
84
+ <DropdownMenuItem onClick={() => void signOutAndLeave()}>
85
+ <LogOutIcon />
86
+ Sign out
87
+ </DropdownMenuItem>
88
+ </DropdownMenuGroup>
89
+ </>
90
+ }
91
+ >
92
+ <UserAvatar login={viewer} account="user" />
93
+ <span className="flex-1 truncate text-left font-medium">{viewer}</span>
94
+ </LinkMenu>
95
+ </SidebarMenu>
96
+ );
97
+ }
@@ -0,0 +1,247 @@
1
+ import { useInfiniteQuery } from '@tanstack/react-query';
2
+ import { Link, useLocation } from '@tanstack/react-router';
3
+ import { CheckIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
4
+ import { useEffect, useRef, useState } from 'react';
5
+
6
+ import { maxFiltered, type Owner, repoList } from '../../hooks/repos.ts';
7
+ import { RepoIcon } from '../repos/repo-icon.tsx';
8
+ import { Alert, AlertDescription } from '../ui/alert.tsx';
9
+ import {
10
+ DropdownMenuFilter,
11
+ DropdownMenuInput,
12
+ DropdownMenuItem,
13
+ DropdownMenuList,
14
+ DropdownMenuSub,
15
+ DropdownMenuSubContent,
16
+ DropdownMenuSubTrigger,
17
+ } from '../ui/dropdown-menu.tsx';
18
+ import { Skeleton } from '../ui/skeleton.tsx';
19
+ import { type Account, UserAvatar } from '../user-avatar.tsx';
20
+ import { MenuCreateRow } from './create-row.tsx';
21
+ import { useSubmenuChevron } from './submenu-chevron.ts';
22
+
23
+ /** The owner's repositories in the list page's own order, so its read is the submenu's too. */
24
+ /** The switcher's lists, each owner's every repo, newest updated first: the palette reads them too. */
25
+ export const switcherList = { search: '', type: 'all', language: '', sort: 'updated' } as const;
26
+
27
+ /** The rows a list's skeleton draws while it loads: what fills the list's fixed height. */
28
+ const skeletonRows = 6;
29
+
30
+ /**
31
+ * The labels of a phone's two rows above the search, the way back and the owner's page, which a
32
+ * search keeps: each holds a space, which no repository's name can.
33
+ */
34
+ const backLabel = 'Back to owners';
35
+
36
+ const pageLabel = (owner: Owner) => `${owner.login}'s page`;
37
+
38
+ /** The row that ends the list, which a search keeps too. */
39
+ const createLabel = 'Create repository';
40
+
41
+ /** Whether a row stays as `query` is typed: a repo whose name holds it, or a fixed row. */
42
+ const keeps = (owner: Owner) => (text: string, query: string) =>
43
+ text === backLabel ||
44
+ text === pageLabel(owner) ||
45
+ text === createLabel ||
46
+ text.toLocaleLowerCase().includes(query.trim().toLocaleLowerCase());
47
+
48
+ /** What an empty list says: the owner has none, a search found none, or it's still reading. */
49
+ const emptyText = (owner: Owner, typed: string, reading: boolean) => {
50
+ if (reading) return 'Searching…';
51
+
52
+ if (typed.trim() !== '') return `No repository of ${owner.login}'s matches.`;
53
+
54
+ return owner.kind === 'viewer'
55
+ ? 'You own no repositories yet.'
56
+ : `${owner.login} has no repositories yet.`;
57
+ };
58
+
59
+ /**
60
+ * One owner in the owner switcher, and its repositories in a submenu to its right: the registry's
61
+ * `DropdownMenuSub`, made searchable. The owner's row is a link to their page, and hovering it
62
+ * opens nothing: the chevron at its right opens the submenu, on a hover or a click, and so does
63
+ * ArrowRight on the row, while Enter goes to the page. The submenu's list is the list page's own
64
+ * read, the viewer's of the repos they own, and it reads only once the submenu opens, or once the
65
+ * menu does for the page's own owner. A search reads every page of it, up to `maxFiltered` rows,
66
+ * since the drop-in has no repository search to ask. Its list keeps one height while it loads, so
67
+ * the menu doesn't jump. It ends with Create repository, under the owner and back to this page, as
68
+ * the owner switcher ends with Create organization.
69
+ *
70
+ * The submenu never opens by itself, on the page's own repo too: once opened, that repo is checked
71
+ * and in view. On a phone there's no room to the right: tapping the owner opens its list over the
72
+ * menu, in its place, with a row back to the owners and one to the owner's page.
73
+ */
74
+ export function OwnerRepos({
75
+ owner,
76
+ account,
77
+ href,
78
+ hrefOf,
79
+ current,
80
+ eager,
81
+ inPlace,
82
+ menu,
83
+ }: {
84
+ readonly owner: Owner;
85
+ readonly account: Account;
86
+ /** The owner's page, where clicking the owner goes. */
87
+ readonly href: string;
88
+ /** Where picking one of its repos goes. */
89
+ readonly hrefOf: (repo: string) => string;
90
+ /** The page's repo, when it is this owner's: checked, and in view once the submenu opens. */
91
+ readonly current: string | undefined;
92
+ /** Whether its list loads as soon as the menu opens: the page's own owner's does. */
93
+ readonly eager: boolean;
94
+ /** Whether the list opens over the menu, in its place, as it does on a phone. */
95
+ readonly inPlace: boolean;
96
+ /** The owner switcher's menu, which a phone's list opens over. */
97
+ readonly menu: () => HTMLElement | null;
98
+ }) {
99
+ const [open, setOpen] = useState(false);
100
+ const [typed, setTyped] = useState('');
101
+ const here = useLocation({ select: (location) => location.href });
102
+ const repos = useInfiniteQuery({ ...repoList(owner, switcherList), enabled: open || eager });
103
+ const names = repos.data?.pages.flatMap((page) => page.repos.map((repo) => repo.name)) ?? [];
104
+ // A search, or the page's repo past the first page, reads on until it's found.
105
+ const seeking = typed.trim() !== '' || (current !== undefined && !names.includes(current));
106
+ const reading = seeking && repos.hasNextPage && names.length < maxFiltered && !repos.isError;
107
+ const { fetchNextPage, isFetchingNextPage } = repos;
108
+ const checked = useRef<HTMLDivElement>(null);
109
+ const search = useRef<HTMLInputElement>(null);
110
+ const popup = useRef<HTMLDivElement>(null);
111
+ const chevron = useSubmenuChevron({
112
+ open,
113
+ onOpen: () => setOpen(true),
114
+ menu,
115
+ submenu: () => popup.current,
116
+ });
117
+ const found = current !== undefined && names.includes(current);
118
+ // Drawn here rather than by the menu's own empty state, which a phone's fixed rows would hide.
119
+ const matched = names.filter((name) => keeps(owner)(name, typed));
120
+
121
+ useEffect(() => {
122
+ if (reading && !isFetchingNextPage) void fetchNextPage();
123
+ }, [reading, isFetchingNextPage, fetchNextPage, names.length]);
124
+
125
+ // The page's repo scrolls into view once its row is drawn.
126
+ useEffect(() => {
127
+ if (open && found) checked.current?.scrollIntoView({ block: 'nearest' });
128
+ }, [open, found]);
129
+
130
+ return (
131
+ <DropdownMenuFilter value={typed} onValueChange={setTyped} filter={keeps(owner)}>
132
+ <DropdownMenuSub open={open} onOpenChange={setOpen}>
133
+ {inPlace ? (
134
+ // A phone's tap opens the list, which holds the owner's page: a chevron is too small a
135
+ // target beside the row, so the whole row stays one.
136
+ <DropdownMenuSubTrigger className="py-1.5">
137
+ <UserAvatar login={owner.login} account={account} size="sm" />
138
+ <span className="truncate">{owner.login}</span>
139
+ </DropdownMenuSubTrigger>
140
+ ) : (
141
+ <DropdownMenuSubTrigger
142
+ openOnHover={false}
143
+ // The row's own built-in chevron gives way to the one that opens the submenu.
144
+ className="relative py-1.5 pr-10 [&>svg:last-child]:hidden"
145
+ render={<Link to={href} />}
146
+ onMouseDown={(event) => {
147
+ // A press goes to the page, or to the chevron's own click: it never toggles the list.
148
+ event.preventBaseUIHandler();
149
+ }}
150
+ >
151
+ <UserAvatar login={owner.login} account={account} size="sm" />
152
+ <span className="truncate">{owner.login}</span>
153
+ <span
154
+ data-slot="owner-repos-chevron"
155
+ className="absolute inset-y-0 right-0 flex w-9 items-center justify-center rounded-sm text-muted-foreground hover:bg-foreground/10"
156
+ {...chevron}
157
+ >
158
+ <ChevronRightIcon className="size-3.5" />
159
+ </span>
160
+ </DropdownMenuSubTrigger>
161
+ )}
162
+ <DropdownMenuSubContent
163
+ ref={popup}
164
+ aria-label={`${owner.login}'s repositories`}
165
+ {...(inPlace
166
+ ? {
167
+ anchor: menu,
168
+ side: 'bottom',
169
+ align: 'start',
170
+ alignOffset: 0,
171
+ sideOffset: ({ anchor }) => -anchor.height,
172
+ className: 'w-(--anchor-width)',
173
+ }
174
+ : { className: 'w-72' })}
175
+ >
176
+ {inPlace && (
177
+ <>
178
+ <DropdownMenuItem
179
+ label={backLabel}
180
+ closeOnClick={false}
181
+ onClick={() => setOpen(false)}
182
+ >
183
+ <ChevronLeftIcon />
184
+ Owners
185
+ </DropdownMenuItem>
186
+ <DropdownMenuItem
187
+ label={pageLabel(owner)}
188
+ className="py-1.5"
189
+ render={<Link to={href} />}
190
+ >
191
+ <UserAvatar login={owner.login} account={account} size="sm" />
192
+ <span className="truncate">{owner.login}</span>
193
+ </DropdownMenuItem>
194
+ </>
195
+ )}
196
+ <DropdownMenuInput
197
+ ref={search}
198
+ aria-label={`Find one of ${owner.login}'s repositories`}
199
+ placeholder="Find a repository…"
200
+ />
201
+ <div data-slot="owner-repos" className="h-54 overflow-y-auto">
202
+ {repos.isPending && (
203
+ <div aria-label="Loading repositories" role="status">
204
+ {Array.from({ length: skeletonRows }, (_, row) => (
205
+ <div key={row} className="flex h-9 items-center gap-2 px-2">
206
+ <Skeleton className="size-4" />
207
+ <Skeleton className="h-4 flex-1" />
208
+ </div>
209
+ ))}
210
+ </div>
211
+ )}
212
+ {repos.error !== null && (
213
+ <Alert variant="destructive" className="w-auto">
214
+ <AlertDescription>{repos.error.message}</AlertDescription>
215
+ </Alert>
216
+ )}
217
+ <DropdownMenuList>
218
+ {names.map((name) => (
219
+ <DropdownMenuItem
220
+ key={name}
221
+ label={name}
222
+ ref={name === current ? checked : undefined}
223
+ render={
224
+ <Link to={hrefOf(name)} aria-current={name === current ? 'page' : undefined} />
225
+ }
226
+ >
227
+ <RepoIcon owner={owner.login} repo={name} />
228
+ <span className="truncate">{name}</span>
229
+ {name === current && <CheckIcon className="ml-auto" />}
230
+ </DropdownMenuItem>
231
+ ))}
232
+ </DropdownMenuList>
233
+ {repos.isSuccess && matched.length === 0 && (
234
+ <div role="status" className="px-2 py-2 text-sm text-muted-foreground">
235
+ {emptyText(owner, typed, reading)}
236
+ </div>
237
+ )}
238
+ </div>
239
+ <MenuCreateRow
240
+ label={createLabel}
241
+ render={<Link to="/new" search={{ owner: owner.login, return_to: here }} />}
242
+ />
243
+ </DropdownMenuSubContent>
244
+ </DropdownMenuSub>
245
+ </DropdownMenuFilter>
246
+ );
247
+ }
@@ -0,0 +1,104 @@
1
+ import { Link } from '@tanstack/react-router';
2
+ import { useRef } from 'react';
3
+
4
+ import type { Owner } from '../../hooks/repos.ts';
5
+ import { DropdownMenuGroup, DropdownMenuLabel } from '../ui/dropdown-menu.tsx';
6
+ import { SidebarMenu, useSidebar } from '../ui/sidebar.tsx';
7
+ import { UserAvatar, type Account } from '../user-avatar.tsx';
8
+ import { MenuCreateRow } from './create-row.tsx';
9
+ import { LinkMenu } from './link-menu.tsx';
10
+ import { OwnerRepos } from './owner-repos.tsx';
11
+
12
+ /**
13
+ * The sidebar's top, from shadcn's `sidebar-07` team switcher, a `LinkMenu` as the account at the
14
+ * foot is: whose repositories the page shows, a link to them, the viewer's own leading to `/`,
15
+ * every repo they can see, their orgs' too. Its chevrons open the others the viewer can switch to
16
+ * below, the viewer first and then their orgs, each with its repositories in a submenu, then Create
17
+ * organization, which closes a phone's sheet and asks the shell for its dialog. The page's own
18
+ * owner may be an org the viewer isn't in, so its account comes from the page.
19
+ */
20
+ export function OwnerSwitcher({
21
+ current,
22
+ repo,
23
+ owners,
24
+ hrefOf,
25
+ repoHrefOf,
26
+ onCreate,
27
+ }: {
28
+ readonly current: { readonly login: string; readonly account: Account };
29
+ /** The page's repo, by its name, or `undefined` off a repo's pages. */
30
+ readonly repo: string | undefined;
31
+ readonly owners: readonly string[];
32
+ /** Where picking `owner` goes. */
33
+ readonly hrefOf: (owner: string) => string;
34
+ /** Where picking `owner`'s repo `name` goes. */
35
+ readonly repoHrefOf: (owner: string, name: string) => string;
36
+ readonly onCreate: () => void;
37
+ }) {
38
+ const { setOpenMobile, isMobile } = useSidebar();
39
+ const group = useRef<HTMLDivElement>(null);
40
+ // The viewer comes first in `owners`, and their orgs after.
41
+ const [viewer = current.login] = owners;
42
+ const accountOf = (owner: string): Account =>
43
+ owner !== viewer && owners.includes(owner) ? 'org' : 'user';
44
+ const ownerOf = (login: string): Owner =>
45
+ login === viewer ? { kind: 'viewer', login } : { kind: 'org', login };
46
+ const menu = () =>
47
+ group.current?.closest<HTMLElement>('[data-slot="dropdown-menu-content"]') ?? null;
48
+ const kind =
49
+ current.account === 'org'
50
+ ? 'Organization'
51
+ : current.login === viewer
52
+ ? 'Personal account'
53
+ : 'Owner';
54
+
55
+ return (
56
+ <SidebarMenu>
57
+ <LinkMenu
58
+ label="Switch owner"
59
+ side="bottom"
60
+ menuClassName="w-auto min-w-70"
61
+ link={
62
+ current.login === viewer ? (
63
+ <Link to="/" activeOptions={{ exact: true }} />
64
+ ) : (
65
+ <Link to="/$owner" params={{ owner: current.login }} activeOptions={{ exact: true }} />
66
+ )
67
+ }
68
+ menu={
69
+ <>
70
+ <DropdownMenuGroup ref={group}>
71
+ <DropdownMenuLabel>Switch to</DropdownMenuLabel>
72
+ {owners.map((owner) => (
73
+ <OwnerRepos
74
+ key={owner}
75
+ owner={ownerOf(owner)}
76
+ account={accountOf(owner)}
77
+ href={hrefOf(owner)}
78
+ hrefOf={(name) => repoHrefOf(owner, name)}
79
+ current={owner === current.login ? repo : undefined}
80
+ eager={owner === current.login}
81
+ inPlace={isMobile}
82
+ menu={menu}
83
+ />
84
+ ))}
85
+ </DropdownMenuGroup>
86
+ <MenuCreateRow
87
+ label="Create organization"
88
+ onClick={() => {
89
+ setOpenMobile(false);
90
+ onCreate();
91
+ }}
92
+ />
93
+ </>
94
+ }
95
+ >
96
+ <UserAvatar login={current.login} account={current.account} />
97
+ <span className="grid flex-1 text-left leading-tight">
98
+ <span className="truncate font-medium">{current.login}</span>
99
+ <span className="truncate text-meta text-muted-foreground">{kind}</span>
100
+ </span>
101
+ </LinkMenu>
102
+ </SidebarMenu>
103
+ );
104
+ }