@dxos/plugin-github 0.7.4 → 0.14.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 (642) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +784 -0
  3. package/dist/lib/GitHubCapabilities.mjs +10 -0
  4. package/dist/lib/GitHubCapabilities.mjs.map +1 -0
  5. package/dist/lib/GitHubEvents.mjs +15 -0
  6. package/dist/lib/GitHubEvents.mjs.map +1 -0
  7. package/dist/lib/GitHubOperation.mjs +384 -0
  8. package/dist/lib/GitHubOperation.mjs.map +1 -0
  9. package/dist/lib/GitHubPlugin.mjs +16 -0
  10. package/dist/lib/GitHubPlugin.mjs.map +1 -0
  11. package/dist/lib/Walkthrough.mjs +59 -0
  12. package/dist/lib/Walkthrough.mjs.map +1 -0
  13. package/dist/lib/capabilities.browser.mjs +54 -0
  14. package/dist/lib/capabilities.browser.mjs.map +1 -0
  15. package/dist/lib/capabilities.mjs +54 -0
  16. package/dist/lib/capabilities.mjs.map +1 -0
  17. package/dist/lib/capabilities.node.mjs +30 -0
  18. package/dist/lib/capabilities.node.mjs.map +1 -0
  19. package/dist/lib/capabilities.tauri.mjs +54 -0
  20. package/dist/lib/capabilities.tauri.mjs.map +1 -0
  21. package/dist/lib/capabilities.workerd.mjs +30 -0
  22. package/dist/lib/capabilities.workerd.mjs.map +1 -0
  23. package/dist/lib/chunk-ImportPullRequestDialog.mjs +116 -0
  24. package/dist/lib/chunk-ImportPullRequestDialog.mjs.map +1 -0
  25. package/dist/lib/chunk-PLUGIN.mjs +6 -0
  26. package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
  27. package/dist/lib/chunk-PullRequestArticle.mjs +1506 -0
  28. package/dist/lib/chunk-PullRequestArticle.mjs.map +1 -0
  29. package/dist/lib/chunk-PullRequestArticle2.mjs +2 -0
  30. package/dist/lib/chunk-PullRequestCardMenu.mjs +123 -0
  31. package/dist/lib/chunk-PullRequestCardMenu.mjs.map +1 -0
  32. package/dist/lib/chunk-PullRequestsArticle.mjs +594 -0
  33. package/dist/lib/chunk-PullRequestsArticle.mjs.map +1 -0
  34. package/dist/lib/chunk-WalkthroughArticle.mjs +26 -0
  35. package/dist/lib/chunk-WalkthroughArticle.mjs.map +1 -0
  36. package/dist/lib/chunk-add-pull-request-comment.mjs +19 -0
  37. package/dist/lib/chunk-add-pull-request-comment.mjs.map +1 -0
  38. package/dist/lib/chunk-add-pull-request-review-comment.mjs +25 -0
  39. package/dist/lib/chunk-add-pull-request-review-comment.mjs.map +1 -0
  40. package/dist/lib/chunk-app-graph-builder.mjs +39 -0
  41. package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
  42. package/dist/lib/chunk-connector.mjs +70 -0
  43. package/dist/lib/chunk-connector.mjs.map +1 -0
  44. package/dist/lib/chunk-constants.mjs +11 -0
  45. package/dist/lib/chunk-constants.mjs.map +1 -0
  46. package/dist/lib/chunk-errors.mjs +29 -0
  47. package/dist/lib/chunk-errors.mjs.map +1 -0
  48. package/dist/lib/chunk-generate-walkthrough.mjs +86 -0
  49. package/dist/lib/chunk-generate-walkthrough.mjs.map +1 -0
  50. package/dist/lib/chunk-generate.mjs +719 -0
  51. package/dist/lib/chunk-generate.mjs.map +1 -0
  52. package/dist/lib/chunk-get-pull-request-diff.mjs +25 -0
  53. package/dist/lib/chunk-get-pull-request-diff.mjs.map +1 -0
  54. package/dist/lib/chunk-get-pull-request-status.mjs +29 -0
  55. package/dist/lib/chunk-get-pull-request-status.mjs.map +1 -0
  56. package/dist/lib/chunk-get-repositories.mjs +32 -0
  57. package/dist/lib/chunk-get-repositories.mjs.map +1 -0
  58. package/dist/lib/chunk-github-api.mjs +375 -0
  59. package/dist/lib/chunk-github-api.mjs.map +1 -0
  60. package/dist/lib/chunk-github-link.mjs +59 -0
  61. package/dist/lib/chunk-github-link.mjs.map +1 -0
  62. package/dist/lib/chunk-import-pull-request-from-snapshot.mjs +25 -0
  63. package/dist/lib/chunk-import-pull-request-from-snapshot.mjs.map +1 -0
  64. package/dist/lib/chunk-import-pull-request.mjs +171 -0
  65. package/dist/lib/chunk-import-pull-request.mjs.map +1 -0
  66. package/dist/lib/chunk-link-resolver.mjs +109 -0
  67. package/dist/lib/chunk-link-resolver.mjs.map +1 -0
  68. package/dist/lib/chunk-markdown-extension.mjs +92 -0
  69. package/dist/lib/chunk-markdown-extension.mjs.map +1 -0
  70. package/dist/lib/chunk-materialize-target.mjs +36 -0
  71. package/dist/lib/chunk-materialize-target.mjs.map +1 -0
  72. package/dist/lib/chunk-operation-handler.mjs +12 -0
  73. package/dist/lib/chunk-operation-handler.mjs.map +1 -0
  74. package/dist/lib/chunk-page-action.mjs +22 -0
  75. package/dist/lib/chunk-page-action.mjs.map +1 -0
  76. package/dist/lib/chunk-pull-request.mjs +58 -0
  77. package/dist/lib/chunk-pull-request.mjs.map +1 -0
  78. package/dist/lib/chunk-pull-request2.mjs +110 -0
  79. package/dist/lib/chunk-pull-request2.mjs.map +1 -0
  80. package/dist/lib/chunk-react-surface.mjs +233 -0
  81. package/dist/lib/chunk-react-surface.mjs.map +1 -0
  82. package/dist/lib/chunk-refresh-pull-requests.mjs +49 -0
  83. package/dist/lib/chunk-refresh-pull-requests.mjs.map +1 -0
  84. package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
  85. package/dist/lib/chunk-schema.mjs +15 -0
  86. package/dist/lib/chunk-schema.mjs.map +1 -0
  87. package/dist/lib/chunk-skill-definition.mjs +10 -0
  88. package/dist/lib/chunk-skill-definition.mjs.map +1 -0
  89. package/dist/lib/chunk-submit-pull-request-approval.mjs +56 -0
  90. package/dist/lib/chunk-submit-pull-request-approval.mjs.map +1 -0
  91. package/dist/lib/chunk-sync-pull-request.mjs +26 -0
  92. package/dist/lib/chunk-sync-pull-request.mjs.map +1 -0
  93. package/dist/lib/chunk-sync.mjs +481 -0
  94. package/dist/lib/chunk-sync.mjs.map +1 -0
  95. package/dist/lib/chunk-useOpenObject.mjs +43 -0
  96. package/dist/lib/chunk-useOpenObject.mjs.map +1 -0
  97. package/dist/lib/extensions.mjs +132 -0
  98. package/dist/lib/extensions.mjs.map +1 -0
  99. package/dist/lib/index.mjs +4 -0
  100. package/dist/lib/meta.mjs +47 -0
  101. package/dist/lib/meta.mjs.map +1 -0
  102. package/dist/lib/ns/Extensions.mjs +18 -0
  103. package/dist/lib/ns/Extensions.mjs.map +1 -0
  104. package/dist/lib/operations.mjs +23 -0
  105. package/dist/lib/operations.mjs.map +1 -0
  106. package/dist/lib/plugin.mjs +9 -0
  107. package/dist/lib/plugin.mjs.map +1 -0
  108. package/dist/lib/skills.mjs +44 -0
  109. package/dist/lib/skills.mjs.map +1 -0
  110. package/dist/lib/testing.mjs +189 -0
  111. package/dist/lib/testing.mjs.map +1 -0
  112. package/dist/lib/translations.mjs +136 -0
  113. package/dist/lib/translations.mjs.map +1 -0
  114. package/dist/lib/types.mjs +5 -0
  115. package/dist/types/dx.config.d.ts +28 -0
  116. package/dist/types/dx.config.d.ts.map +1 -0
  117. package/dist/types/src/Extensions.d.ts +2 -0
  118. package/dist/types/src/Extensions.d.ts.map +1 -0
  119. package/dist/types/src/GitHubPlugin.d.ts +37 -0
  120. package/dist/types/src/GitHubPlugin.d.ts.map +1 -0
  121. package/dist/types/src/GitHubPlugin.workerd.test.d.ts +2 -0
  122. package/dist/types/src/GitHubPlugin.workerd.test.d.ts.map +1 -0
  123. package/dist/types/src/approval.d.ts +21 -0
  124. package/dist/types/src/approval.d.ts.map +1 -0
  125. package/dist/types/src/approval.test.d.ts +2 -0
  126. package/dist/types/src/approval.test.d.ts.map +1 -0
  127. package/dist/types/src/capabilities/app-graph-builder.d.ts +9 -0
  128. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  129. package/dist/types/src/capabilities/connector.d.ts +17 -0
  130. package/dist/types/src/capabilities/connector.d.ts.map +1 -0
  131. package/dist/types/src/capabilities/gen/browser.d.ts +13 -0
  132. package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
  133. package/dist/types/src/capabilities/gen/node.d.ts +13 -0
  134. package/dist/types/src/capabilities/gen/node.d.ts.map +1 -0
  135. package/dist/types/src/capabilities/gen/tauri.d.ts +13 -0
  136. package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
  137. package/dist/types/src/capabilities/gen/workerd.d.ts +13 -0
  138. package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -0
  139. package/dist/types/src/capabilities/index.d.ts +13 -0
  140. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  141. package/dist/types/src/capabilities/link-resolver.d.ts +10 -0
  142. package/dist/types/src/capabilities/link-resolver.d.ts.map +1 -0
  143. package/dist/types/src/capabilities/markdown-extension.d.ts +14 -0
  144. package/dist/types/src/capabilities/markdown-extension.d.ts.map +1 -0
  145. package/dist/types/src/capabilities/operation-handler.d.ts +5 -0
  146. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  147. package/dist/types/src/capabilities/page-action.d.ts +5 -0
  148. package/dist/types/src/capabilities/page-action.d.ts.map +1 -0
  149. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  150. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  151. package/dist/types/src/capabilities/schema.d.ts +12 -0
  152. package/dist/types/src/capabilities/schema.d.ts.map +1 -0
  153. package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
  154. package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
  155. package/dist/types/src/cards/GitHubCard.d.ts +11 -0
  156. package/dist/types/src/cards/GitHubCard.d.ts.map +1 -0
  157. package/dist/types/src/cards/GitHubCard.stories.d.ts +45 -0
  158. package/dist/types/src/cards/GitHubCard.stories.d.ts.map +1 -0
  159. package/dist/types/src/cards/PullRequestCard.d.ts +9 -0
  160. package/dist/types/src/cards/PullRequestCard.d.ts.map +1 -0
  161. package/dist/types/src/cards/index.d.ts +3 -0
  162. package/dist/types/src/cards/index.d.ts.map +1 -0
  163. package/dist/types/src/components/CommentComposer/CommentComposer.d.ts +30 -0
  164. package/dist/types/src/components/CommentComposer/CommentComposer.d.ts.map +1 -0
  165. package/dist/types/src/components/CommentComposer/index.d.ts +2 -0
  166. package/dist/types/src/components/CommentComposer/index.d.ts.map +1 -0
  167. package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts +8 -0
  168. package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts.map +1 -0
  169. package/dist/types/src/components/PullRequestFiles/FileTree.d.ts +17 -0
  170. package/dist/types/src/components/PullRequestFiles/FileTree.d.ts.map +1 -0
  171. package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts +23 -0
  172. package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts.map +1 -0
  173. package/dist/types/src/components/PullRequestFiles/files.d.ts +39 -0
  174. package/dist/types/src/components/PullRequestFiles/files.d.ts.map +1 -0
  175. package/dist/types/src/components/PullRequestFiles/files.test.d.ts +2 -0
  176. package/dist/types/src/components/PullRequestFiles/files.test.d.ts.map +1 -0
  177. package/dist/types/src/components/PullRequestFiles/index.d.ts +5 -0
  178. package/dist/types/src/components/PullRequestFiles/index.d.ts.map +1 -0
  179. package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts +21 -0
  180. package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts.map +1 -0
  181. package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts +18 -0
  182. package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts.map +1 -0
  183. package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts +2 -0
  184. package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts.map +1 -0
  185. package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts +10 -0
  186. package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts.map +1 -0
  187. package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts +16 -0
  188. package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts.map +1 -0
  189. package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts +28 -0
  190. package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts.map +1 -0
  191. package/dist/types/src/components/PullRequestOverview/index.d.ts +6 -0
  192. package/dist/types/src/components/PullRequestOverview/index.d.ts.map +1 -0
  193. package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts +20 -0
  194. package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts.map +1 -0
  195. package/dist/types/src/components/PullRequestStatus/index.d.ts +2 -0
  196. package/dist/types/src/components/PullRequestStatus/index.d.ts.map +1 -0
  197. package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts +18 -0
  198. package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts.map +1 -0
  199. package/dist/types/src/components/WalkthroughView/extensions.d.ts +16 -0
  200. package/dist/types/src/components/WalkthroughView/extensions.d.ts.map +1 -0
  201. package/dist/types/src/components/WalkthroughView/index.d.ts +3 -0
  202. package/dist/types/src/components/WalkthroughView/index.d.ts.map +1 -0
  203. package/dist/types/src/components/index.d.ts +5 -8
  204. package/dist/types/src/components/index.d.ts.map +1 -1
  205. package/dist/types/src/constants.d.ts +7 -0
  206. package/dist/types/src/constants.d.ts.map +1 -0
  207. package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts +6 -0
  208. package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts.map +1 -0
  209. package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts +3 -0
  210. package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts.map +1 -0
  211. package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts +15 -0
  212. package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts.map +1 -0
  213. package/dist/types/src/containers/PullRequestArticle/failure.d.ts +10 -0
  214. package/dist/types/src/containers/PullRequestArticle/failure.d.ts.map +1 -0
  215. package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts +2 -0
  216. package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts.map +1 -0
  217. package/dist/types/src/containers/PullRequestArticle/index.d.ts +2 -0
  218. package/dist/types/src/containers/PullRequestArticle/index.d.ts.map +1 -0
  219. package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts +14 -0
  220. package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts.map +1 -0
  221. package/dist/types/src/containers/PullRequestCardMenu/index.d.ts +2 -0
  222. package/dist/types/src/containers/PullRequestCardMenu/index.d.ts.map +1 -0
  223. package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts +13 -0
  224. package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts.map +1 -0
  225. package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts +44 -0
  226. package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts.map +1 -0
  227. package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts +2 -0
  228. package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts.map +1 -0
  229. package/dist/types/src/containers/PullRequestsArticle/format.d.ts +3 -0
  230. package/dist/types/src/containers/PullRequestsArticle/format.d.ts.map +1 -0
  231. package/dist/types/src/containers/PullRequestsArticle/index.d.ts +2 -0
  232. package/dist/types/src/containers/PullRequestsArticle/index.d.ts.map +1 -0
  233. package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts +13 -0
  234. package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts.map +1 -0
  235. package/dist/types/src/containers/WalkthroughArticle/index.d.ts +2 -0
  236. package/dist/types/src/containers/WalkthroughArticle/index.d.ts.map +1 -0
  237. package/dist/types/src/containers/index.d.ts +7 -0
  238. package/dist/types/src/containers/index.d.ts.map +1 -0
  239. package/dist/types/src/errors.d.ts +157 -0
  240. package/dist/types/src/errors.d.ts.map +1 -0
  241. package/dist/types/src/extensions/index.d.ts +3 -0
  242. package/dist/types/src/extensions/index.d.ts.map +1 -0
  243. package/dist/types/src/extensions/links.d.ts +21 -0
  244. package/dist/types/src/extensions/links.d.ts.map +1 -0
  245. package/dist/types/src/extensions/links.test.d.ts +2 -0
  246. package/dist/types/src/extensions/links.test.d.ts.map +1 -0
  247. package/dist/types/src/extensions/references.d.ts +23 -0
  248. package/dist/types/src/extensions/references.d.ts.map +1 -0
  249. package/dist/types/src/extensions/references.test.d.ts +2 -0
  250. package/dist/types/src/extensions/references.test.d.ts.map +1 -0
  251. package/dist/types/src/github-link.d.ts +29 -0
  252. package/dist/types/src/github-link.d.ts.map +1 -0
  253. package/dist/types/src/hooks/index.d.ts +5 -2
  254. package/dist/types/src/hooks/index.d.ts.map +1 -1
  255. package/dist/types/src/hooks/useOpenObject.d.ts +9 -0
  256. package/dist/types/src/hooks/useOpenObject.d.ts.map +1 -0
  257. package/dist/types/src/hooks/usePullRequestChecks.d.ts +10 -0
  258. package/dist/types/src/hooks/usePullRequestChecks.d.ts.map +1 -0
  259. package/dist/types/src/hooks/usePullRequestDiff.d.ts +12 -0
  260. package/dist/types/src/hooks/usePullRequestDiff.d.ts.map +1 -0
  261. package/dist/types/src/hooks/usePullRequestFiles.d.ts +22 -0
  262. package/dist/types/src/hooks/usePullRequestFiles.d.ts.map +1 -0
  263. package/dist/types/src/hooks/useSyncPullRequest.d.ts +10 -0
  264. package/dist/types/src/hooks/useSyncPullRequest.d.ts.map +1 -0
  265. package/dist/types/src/index.d.ts +3 -3
  266. package/dist/types/src/index.d.ts.map +1 -1
  267. package/dist/types/src/meta.d.ts +34 -11
  268. package/dist/types/src/meta.d.ts.map +1 -1
  269. package/dist/types/src/operations/add-pull-request-comment.d.ts +5 -0
  270. package/dist/types/src/operations/add-pull-request-comment.d.ts.map +1 -0
  271. package/dist/types/src/operations/add-pull-request-review-comment.d.ts +5 -0
  272. package/dist/types/src/operations/add-pull-request-review-comment.d.ts.map +1 -0
  273. package/dist/types/src/operations/generate-walkthrough.d.ts +11 -0
  274. package/dist/types/src/operations/generate-walkthrough.d.ts.map +1 -0
  275. package/dist/types/src/operations/get-pull-request-diff.d.ts +5 -0
  276. package/dist/types/src/operations/get-pull-request-diff.d.ts.map +1 -0
  277. package/dist/types/src/operations/get-pull-request-status.d.ts +5 -0
  278. package/dist/types/src/operations/get-pull-request-status.d.ts.map +1 -0
  279. package/dist/types/src/operations/get-repositories.d.ts +13 -0
  280. package/dist/types/src/operations/get-repositories.d.ts.map +1 -0
  281. package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts +12 -0
  282. package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts.map +1 -0
  283. package/dist/types/src/operations/import-pull-request.d.ts +63 -0
  284. package/dist/types/src/operations/import-pull-request.d.ts.map +1 -0
  285. package/dist/types/src/operations/import-pull-request.test.d.ts +2 -0
  286. package/dist/types/src/operations/import-pull-request.test.d.ts.map +1 -0
  287. package/dist/types/src/operations/index.d.ts +3 -0
  288. package/dist/types/src/operations/index.d.ts.map +1 -0
  289. package/dist/types/src/operations/materialize-target.d.ts +12 -0
  290. package/dist/types/src/operations/materialize-target.d.ts.map +1 -0
  291. package/dist/types/src/operations/pull-request.d.ts +48 -0
  292. package/dist/types/src/operations/pull-request.d.ts.map +1 -0
  293. package/dist/types/src/operations/pull-request.test.d.ts +2 -0
  294. package/dist/types/src/operations/pull-request.test.d.ts.map +1 -0
  295. package/dist/types/src/operations/refresh-pull-requests.d.ts +5 -0
  296. package/dist/types/src/operations/refresh-pull-requests.d.ts.map +1 -0
  297. package/dist/types/src/operations/refresh.d.ts +37 -0
  298. package/dist/types/src/operations/refresh.d.ts.map +1 -0
  299. package/dist/types/src/operations/refresh.test.d.ts +2 -0
  300. package/dist/types/src/operations/refresh.test.d.ts.map +1 -0
  301. package/dist/types/src/operations/submit-pull-request-approval.d.ts +5 -0
  302. package/dist/types/src/operations/submit-pull-request-approval.d.ts.map +1 -0
  303. package/dist/types/src/operations/sync-pull-request.d.ts +5 -0
  304. package/dist/types/src/operations/sync-pull-request.d.ts.map +1 -0
  305. package/dist/types/src/operations/sync.d.ts +123 -0
  306. package/dist/types/src/operations/sync.d.ts.map +1 -0
  307. package/dist/types/src/operations/sync.test.d.ts +2 -0
  308. package/dist/types/src/operations/sync.test.d.ts.map +1 -0
  309. package/dist/types/src/plugin.d.ts +4 -0
  310. package/dist/types/src/plugin.d.ts.map +1 -0
  311. package/dist/types/src/plugin.test.d.ts +2 -0
  312. package/dist/types/src/plugin.test.d.ts.map +1 -0
  313. package/dist/types/src/pull-request-body.d.ts +37 -0
  314. package/dist/types/src/pull-request-body.d.ts.map +1 -0
  315. package/dist/types/src/pull-request-body.test.d.ts +2 -0
  316. package/dist/types/src/pull-request-body.test.d.ts.map +1 -0
  317. package/dist/types/src/pull-request.d.ts +28 -0
  318. package/dist/types/src/pull-request.d.ts.map +1 -0
  319. package/dist/types/src/pull-request.test.d.ts +2 -0
  320. package/dist/types/src/pull-request.test.d.ts.map +1 -0
  321. package/dist/types/src/services/github-api.d.ts +332 -0
  322. package/dist/types/src/services/github-api.d.ts.map +1 -0
  323. package/dist/types/src/services/index.d.ts +2 -0
  324. package/dist/types/src/services/index.d.ts.map +1 -0
  325. package/dist/types/src/skills/GitHubSkill.d.ts +12 -0
  326. package/dist/types/src/skills/GitHubSkill.d.ts.map +1 -0
  327. package/dist/types/src/skills/index.d.ts +2 -0
  328. package/dist/types/src/skills/index.d.ts.map +1 -0
  329. package/dist/types/src/stories/Generate.stories.d.ts +27 -0
  330. package/dist/types/src/stories/Generate.stories.d.ts.map +1 -0
  331. package/dist/types/src/stories/Links.stories.d.ts +23 -0
  332. package/dist/types/src/stories/Links.stories.d.ts.map +1 -0
  333. package/dist/types/src/stories/PullRequestArticle.stories.d.ts +359 -0
  334. package/dist/types/src/stories/PullRequestArticle.stories.d.ts.map +1 -0
  335. package/dist/types/src/stories/PullRequestFiles.stories.d.ts +365 -0
  336. package/dist/types/src/stories/PullRequestFiles.stories.d.ts.map +1 -0
  337. package/dist/types/src/stories/PullRequestOverview.stories.d.ts +367 -0
  338. package/dist/types/src/stories/PullRequestOverview.stories.d.ts.map +1 -0
  339. package/dist/types/src/stories/PullRequestsArticle.stories.d.ts +357 -0
  340. package/dist/types/src/stories/PullRequestsArticle.stories.d.ts.map +1 -0
  341. package/dist/types/src/stories/Walkthrough.stories.d.ts +380 -0
  342. package/dist/types/src/stories/Walkthrough.stories.d.ts.map +1 -0
  343. package/dist/types/src/stories/github.d.ts +23 -0
  344. package/dist/types/src/stories/github.d.ts.map +1 -0
  345. package/dist/types/src/stories/github.test.d.ts +2 -0
  346. package/dist/types/src/stories/github.test.d.ts.map +1 -0
  347. package/dist/types/src/stories/walkthrough-fixture.d.ts +8 -0
  348. package/dist/types/src/stories/walkthrough-fixture.d.ts.map +1 -0
  349. package/dist/types/src/testing/fixtures.d.ts +14 -0
  350. package/dist/types/src/testing/fixtures.d.ts.map +1 -0
  351. package/dist/types/src/testing/index.d.ts +4 -0
  352. package/dist/types/src/testing/index.d.ts.map +1 -0
  353. package/dist/types/src/testing/plugin.d.ts +4 -0
  354. package/dist/types/src/testing/plugin.d.ts.map +1 -0
  355. package/dist/types/src/testing/pull-request-13348.d.ts +6 -0
  356. package/dist/types/src/testing/pull-request-13348.d.ts.map +1 -0
  357. package/dist/types/src/translations.d.ts +339 -53
  358. package/dist/types/src/translations.d.ts.map +1 -1
  359. package/dist/types/src/types/GitHubCapabilities.d.ts +13 -0
  360. package/dist/types/src/types/GitHubCapabilities.d.ts.map +1 -0
  361. package/dist/types/src/types/GitHubEvents.d.ts +8 -0
  362. package/dist/types/src/types/GitHubEvents.d.ts.map +1 -0
  363. package/dist/types/src/types/GitHubOperation.d.ts +281 -0
  364. package/dist/types/src/types/GitHubOperation.d.ts.map +1 -0
  365. package/dist/types/src/types/PullRequestsView.d.ts +35 -0
  366. package/dist/types/src/types/PullRequestsView.d.ts.map +1 -0
  367. package/dist/types/src/types/Walkthrough.d.ts +31 -0
  368. package/dist/types/src/types/Walkthrough.d.ts.map +1 -0
  369. package/dist/types/src/types/Walkthrough.test.d.ts +2 -0
  370. package/dist/types/src/types/Walkthrough.test.d.ts.map +1 -0
  371. package/dist/types/src/types/index.d.ts +5 -0
  372. package/dist/types/src/types/index.d.ts.map +1 -0
  373. package/dist/types/src/walkthrough/fill.d.ts +28 -0
  374. package/dist/types/src/walkthrough/fill.d.ts.map +1 -0
  375. package/dist/types/src/walkthrough/fill.test.d.ts +2 -0
  376. package/dist/types/src/walkthrough/fill.test.d.ts.map +1 -0
  377. package/dist/types/src/walkthrough/generate.d.ts +67 -0
  378. package/dist/types/src/walkthrough/generate.d.ts.map +1 -0
  379. package/dist/types/src/walkthrough/generate.test.d.ts +2 -0
  380. package/dist/types/src/walkthrough/generate.test.d.ts.map +1 -0
  381. package/dist/types/src/walkthrough/generated.d.ts +20 -0
  382. package/dist/types/src/walkthrough/generated.d.ts.map +1 -0
  383. package/dist/types/src/walkthrough/generated.test.d.ts +2 -0
  384. package/dist/types/src/walkthrough/generated.test.d.ts.map +1 -0
  385. package/dist/types/src/walkthrough/headings.d.ts +8 -0
  386. package/dist/types/src/walkthrough/headings.d.ts.map +1 -0
  387. package/dist/types/src/walkthrough/headings.test.d.ts +2 -0
  388. package/dist/types/src/walkthrough/headings.test.d.ts.map +1 -0
  389. package/dist/types/src/walkthrough/index.d.ts +9 -0
  390. package/dist/types/src/walkthrough/index.d.ts.map +1 -0
  391. package/dist/types/src/walkthrough/patch.d.ts +48 -0
  392. package/dist/types/src/walkthrough/patch.d.ts.map +1 -0
  393. package/dist/types/src/walkthrough/plan.d.ts +55 -0
  394. package/dist/types/src/walkthrough/plan.d.ts.map +1 -0
  395. package/dist/types/src/walkthrough/plan.test.d.ts +2 -0
  396. package/dist/types/src/walkthrough/plan.test.d.ts.map +1 -0
  397. package/dist/types/src/walkthrough/prompt.d.ts +33 -0
  398. package/dist/types/src/walkthrough/prompt.d.ts.map +1 -0
  399. package/dist/types/src/walkthrough/prompt.test.d.ts +2 -0
  400. package/dist/types/src/walkthrough/prompt.test.d.ts.map +1 -0
  401. package/dist/types/src/walkthrough/score.d.ts +43 -0
  402. package/dist/types/src/walkthrough/score.d.ts.map +1 -0
  403. package/dist/types/src/walkthrough/score.test.d.ts +2 -0
  404. package/dist/types/src/walkthrough/score.test.d.ts.map +1 -0
  405. package/dist/types/tsconfig.tsbuildinfo +1 -0
  406. package/dx.config.ts +39 -0
  407. package/package.json +167 -48
  408. package/src/Extensions.ts +7 -0
  409. package/src/GitHubPlugin.ts +15 -0
  410. package/src/GitHubPlugin.workerd.test.ts +23 -0
  411. package/src/approval.test.ts +40 -0
  412. package/src/approval.ts +39 -0
  413. package/src/capabilities/app-graph-builder.ts +47 -0
  414. package/src/capabilities/connector.ts +95 -0
  415. package/src/capabilities/gen/browser.ts +82 -0
  416. package/src/capabilities/gen/node.ts +43 -0
  417. package/src/capabilities/gen/tauri.ts +82 -0
  418. package/src/capabilities/gen/workerd.ts +43 -0
  419. package/src/capabilities/index.ts +71 -0
  420. package/src/capabilities/link-resolver.ts +137 -0
  421. package/src/capabilities/markdown-extension.ts +146 -0
  422. package/src/capabilities/operation-handler.ts +16 -0
  423. package/src/capabilities/page-action.ts +32 -0
  424. package/src/capabilities/react-surface.ts +98 -0
  425. package/src/capabilities/schema.ts +16 -0
  426. package/src/capabilities/skill-definition.ts +14 -0
  427. package/src/cards/GitHubCard.stories.tsx +165 -0
  428. package/src/cards/GitHubCard.tsx +93 -0
  429. package/src/cards/PullRequestCard.tsx +23 -0
  430. package/src/cards/index.ts +6 -0
  431. package/src/components/CommentComposer/CommentComposer.tsx +109 -0
  432. package/src/components/CommentComposer/index.ts +5 -0
  433. package/src/components/PullRequestFiles/DiffStat.tsx +15 -0
  434. package/src/components/PullRequestFiles/FileTree.tsx +102 -0
  435. package/src/components/PullRequestFiles/PullRequestFiles.tsx +87 -0
  436. package/src/components/PullRequestFiles/files.test.ts +59 -0
  437. package/src/components/PullRequestFiles/files.ts +115 -0
  438. package/src/components/PullRequestFiles/index.ts +8 -0
  439. package/src/components/PullRequestOverview/ArtifactPill.tsx +82 -0
  440. package/src/components/PullRequestOverview/CheckRunList.test.ts +29 -0
  441. package/src/components/PullRequestOverview/CheckRunList.tsx +141 -0
  442. package/src/components/PullRequestOverview/PullRequestDetails.tsx +15 -0
  443. package/src/components/PullRequestOverview/PullRequestOverview.tsx +110 -0
  444. package/src/components/PullRequestOverview/RelatedCards.tsx +147 -0
  445. package/src/components/PullRequestOverview/index.ts +9 -0
  446. package/src/components/PullRequestStatus/PullRequestStatus.tsx +84 -0
  447. package/src/components/PullRequestStatus/index.ts +5 -0
  448. package/src/components/WalkthroughView/WalkthroughView.tsx +62 -0
  449. package/src/components/WalkthroughView/extensions.ts +53 -0
  450. package/src/components/WalkthroughView/index.ts +6 -0
  451. package/src/components/index.ts +6 -9
  452. package/src/constants.ts +12 -0
  453. package/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.tsx +160 -0
  454. package/src/containers/ImportPullRequestDialog/index.ts +7 -0
  455. package/src/containers/PullRequestArticle/PullRequestArticle.tsx +573 -0
  456. package/src/containers/PullRequestArticle/failure.test.ts +42 -0
  457. package/src/containers/PullRequestArticle/failure.ts +16 -0
  458. package/src/containers/PullRequestArticle/index.ts +5 -0
  459. package/src/containers/PullRequestCardMenu/PullRequestCardMenu.tsx +134 -0
  460. package/src/containers/PullRequestCardMenu/index.ts +5 -0
  461. package/src/containers/PullRequestsArticle/PullRequestsArticle.tsx +361 -0
  462. package/src/containers/PullRequestsArticle/arrange.test.ts +122 -0
  463. package/src/containers/PullRequestsArticle/arrange.ts +245 -0
  464. package/src/containers/PullRequestsArticle/format.ts +31 -0
  465. package/src/containers/PullRequestsArticle/index.ts +5 -0
  466. package/src/containers/WalkthroughArticle/WalkthroughArticle.tsx +31 -0
  467. package/src/containers/WalkthroughArticle/index.ts +5 -0
  468. package/src/containers/index.ts +11 -0
  469. package/src/errors.ts +61 -0
  470. package/src/extensions/index.ts +6 -0
  471. package/src/extensions/links.test.ts +133 -0
  472. package/src/extensions/links.ts +91 -0
  473. package/src/extensions/references.test.ts +83 -0
  474. package/src/extensions/references.ts +100 -0
  475. package/src/github-link.ts +70 -0
  476. package/src/hooks/index.ts +6 -3
  477. package/src/hooks/useOpenObject.ts +48 -0
  478. package/src/hooks/usePullRequestChecks.ts +81 -0
  479. package/src/hooks/usePullRequestDiff.ts +57 -0
  480. package/src/hooks/usePullRequestFiles.ts +98 -0
  481. package/src/hooks/useSyncPullRequest.ts +51 -0
  482. package/src/index.ts +4 -6
  483. package/src/meta.ts +8 -13
  484. package/src/operations/add-pull-request-comment.ts +31 -0
  485. package/src/operations/add-pull-request-review-comment.ts +32 -0
  486. package/src/operations/generate-walkthrough.ts +124 -0
  487. package/src/operations/get-pull-request-diff.ts +37 -0
  488. package/src/operations/get-pull-request-status.ts +44 -0
  489. package/src/operations/get-repositories.ts +53 -0
  490. package/src/operations/import-pull-request-from-snapshot.ts +48 -0
  491. package/src/operations/import-pull-request.test.ts +151 -0
  492. package/src/operations/import-pull-request.ts +149 -0
  493. package/src/operations/index.ts +30 -0
  494. package/src/operations/materialize-target.ts +60 -0
  495. package/src/operations/pull-request.test.ts +120 -0
  496. package/src/operations/pull-request.ts +141 -0
  497. package/src/operations/refresh-pull-requests.ts +69 -0
  498. package/src/operations/refresh.test.ts +112 -0
  499. package/src/operations/refresh.ts +111 -0
  500. package/src/operations/submit-pull-request-approval.ts +41 -0
  501. package/src/operations/sync-pull-request.ts +34 -0
  502. package/src/operations/sync.test.ts +453 -0
  503. package/src/operations/sync.ts +807 -0
  504. package/src/plugin.test.ts +40 -0
  505. package/src/plugin.ts +37 -0
  506. package/src/pull-request-body.test.ts +61 -0
  507. package/src/pull-request-body.ts +144 -0
  508. package/src/pull-request.test.ts +67 -0
  509. package/src/pull-request.ts +80 -0
  510. package/src/services/github-api.ts +735 -0
  511. package/src/services/index.ts +5 -0
  512. package/src/skills/GitHubSkill.ts +46 -0
  513. package/src/skills/index.ts +5 -0
  514. package/src/stories/Generate.stories.tsx +152 -0
  515. package/src/stories/Links.stories.tsx +153 -0
  516. package/src/stories/PullRequestArticle.stories.tsx +107 -0
  517. package/src/stories/PullRequestFiles.stories.tsx +69 -0
  518. package/src/stories/PullRequestOverview.stories.tsx +114 -0
  519. package/src/stories/PullRequestsArticle.stories.tsx +170 -0
  520. package/src/stories/Walkthrough.stories.tsx +110 -0
  521. package/src/stories/github.test.ts +65 -0
  522. package/src/stories/github.ts +70 -0
  523. package/src/stories/walkthrough-fixture.ts +115 -0
  524. package/src/testing/fixtures.ts +99 -0
  525. package/src/testing/index.ts +7 -0
  526. package/src/testing/plugin.ts +25 -0
  527. package/src/testing/pull-request-13348.ts +104 -0
  528. package/src/testing/pull-request-13363.patch +2981 -0
  529. package/src/translations.ts +135 -63
  530. package/src/types/GitHubCapabilities.ts +27 -0
  531. package/src/types/GitHubEvents.ts +16 -0
  532. package/src/types/GitHubOperation.ts +397 -0
  533. package/src/types/PullRequestsView.ts +45 -0
  534. package/src/types/Walkthrough.test.ts +75 -0
  535. package/src/types/Walkthrough.ts +66 -0
  536. package/src/types/index.ts +8 -0
  537. package/src/vite-env.d.ts +15 -0
  538. package/src/walkthrough/fill.test.ts +337 -0
  539. package/src/walkthrough/fill.ts +246 -0
  540. package/src/walkthrough/generate.test.ts +219 -0
  541. package/src/walkthrough/generate.ts +248 -0
  542. package/src/walkthrough/generated.test.ts +70 -0
  543. package/src/walkthrough/generated.ts +70 -0
  544. package/src/walkthrough/headings.test.ts +40 -0
  545. package/src/walkthrough/headings.ts +39 -0
  546. package/src/walkthrough/index.ts +12 -0
  547. package/src/walkthrough/patch.ts +154 -0
  548. package/src/walkthrough/plan.test.ts +178 -0
  549. package/src/walkthrough/plan.ts +251 -0
  550. package/src/walkthrough/prompt.test.ts +100 -0
  551. package/src/walkthrough/prompt.ts +147 -0
  552. package/src/walkthrough/score.test.ts +272 -0
  553. package/src/walkthrough/score.ts +430 -0
  554. package/README.md +0 -15
  555. package/dist/lib/browser/chunk-S4MPSBA5.mjs +0 -21
  556. package/dist/lib/browser/chunk-S4MPSBA5.mjs.map +0 -7
  557. package/dist/lib/browser/index.css +0 -7
  558. package/dist/lib/browser/index.css.map +0 -7
  559. package/dist/lib/browser/index.mjs +0 -1535
  560. package/dist/lib/browser/index.mjs.map +0 -7
  561. package/dist/lib/browser/meta.json +0 -1
  562. package/dist/lib/browser/meta.mjs +0 -11
  563. package/dist/lib/browser/meta.mjs.map +0 -7
  564. package/dist/types/src/GithubPlugin.d.ts +0 -4
  565. package/dist/types/src/GithubPlugin.d.ts.map +0 -1
  566. package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts +0 -4
  567. package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts.map +0 -1
  568. package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts +0 -9
  569. package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts.map +0 -1
  570. package/dist/types/src/components/EmbeddedMain/index.d.ts +0 -2
  571. package/dist/types/src/components/EmbeddedMain/index.d.ts.map +0 -1
  572. package/dist/types/src/components/ExportDialog.d.ts +0 -8
  573. package/dist/types/src/components/ExportDialog.d.ts.map +0 -1
  574. package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts +0 -3
  575. package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts.map +0 -1
  576. package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts +0 -15
  577. package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts.map +0 -1
  578. package/dist/types/src/components/GithubApiProviders/index.d.ts +0 -3
  579. package/dist/types/src/components/GithubApiProviders/index.d.ts.map +0 -1
  580. package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts +0 -6
  581. package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts.map +0 -1
  582. package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts +0 -7
  583. package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts.map +0 -1
  584. package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts +0 -6
  585. package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts.map +0 -1
  586. package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts +0 -16
  587. package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts.map +0 -1
  588. package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts +0 -3
  589. package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts.map +0 -1
  590. package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts +0 -11
  591. package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts.map +0 -1
  592. package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts +0 -3
  593. package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts.map +0 -1
  594. package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts +0 -6
  595. package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts.map +0 -1
  596. package/dist/types/src/components/ImportDialog.d.ts +0 -7
  597. package/dist/types/src/components/ImportDialog.d.ts.map +0 -1
  598. package/dist/types/src/components/Issue.d.ts +0 -5
  599. package/dist/types/src/components/Issue.d.ts.map +0 -1
  600. package/dist/types/src/components/Loading/Loading.d.ts +0 -15
  601. package/dist/types/src/components/Loading/Loading.d.ts.map +0 -1
  602. package/dist/types/src/components/Loading/Loading.stories.d.ts +0 -40
  603. package/dist/types/src/components/Loading/Loading.stories.d.ts.map +0 -1
  604. package/dist/types/src/components/Loading/index.d.ts +0 -2
  605. package/dist/types/src/components/Loading/index.d.ts.map +0 -1
  606. package/dist/types/src/components/MarkdownActions.d.ts +0 -7
  607. package/dist/types/src/components/MarkdownActions.d.ts.map +0 -1
  608. package/dist/types/src/components/UrlDialog.d.ts +0 -6
  609. package/dist/types/src/components/UrlDialog.d.ts.map +0 -1
  610. package/dist/types/src/hooks/useDocGhId.d.ts +0 -6
  611. package/dist/types/src/hooks/useDocGhId.d.ts.map +0 -1
  612. package/dist/types/src/hooks/useGhIdFromUrl.d.ts +0 -2
  613. package/dist/types/src/hooks/useGhIdFromUrl.d.ts.map +0 -1
  614. package/dist/types/src/types.d.ts +0 -30
  615. package/dist/types/src/types.d.ts.map +0 -1
  616. package/src/GithubPlugin.tsx +0 -127
  617. package/src/components/EmbeddedMain/EmbeddedMain.tsx +0 -294
  618. package/src/components/EmbeddedMain/GfmPreview.tsx +0 -110
  619. package/src/components/EmbeddedMain/embedded.css +0 -3
  620. package/src/components/EmbeddedMain/index.ts +0 -5
  621. package/src/components/ExportDialog.tsx +0 -157
  622. package/src/components/GithubApiProviders/GitHubSettings.tsx +0 -72
  623. package/src/components/GithubApiProviders/OctokitProvider.tsx +0 -60
  624. package/src/components/GithubApiProviders/index.ts +0 -6
  625. package/src/components/GithubEchoResolverProviders/DocumentTreeItem.tsx +0 -26
  626. package/src/components/GithubEchoResolverProviders/ResolverContext.tsx +0 -137
  627. package/src/components/GithubEchoResolverProviders/ResolverDialog.tsx +0 -34
  628. package/src/components/GithubEchoResolverProviders/ResolverProps.ts +0 -23
  629. package/src/components/GithubEchoResolverProviders/ResolverTree.tsx +0 -86
  630. package/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.tsx +0 -105
  631. package/src/components/GithubEchoResolverProviders/index.ts +0 -6
  632. package/src/components/GithubEchoResolverProviders/spaceResolvers.ts +0 -86
  633. package/src/components/ImportDialog.tsx +0 -72
  634. package/src/components/Issue.tsx +0 -62
  635. package/src/components/Loading/Loading.stories.tsx +0 -32
  636. package/src/components/Loading/Loading.tsx +0 -70
  637. package/src/components/Loading/index.ts +0 -5
  638. package/src/components/MarkdownActions.tsx +0 -136
  639. package/src/components/UrlDialog.tsx +0 -52
  640. package/src/hooks/useDocGhId.ts +0 -38
  641. package/src/hooks/useGhIdFromUrl.ts +0 -26
  642. package/src/types.ts +0 -51
@@ -1,1535 +0,0 @@
1
- import {
2
- GITHUB_PLUGIN,
3
- GITHUB_PLUGIN_SHORT_ID,
4
- meta_default
5
- } from "./chunk-S4MPSBA5.mjs";
6
-
7
- // packages/plugins/experimental/plugin-github/src/GithubPlugin.tsx
8
- import React16 from "react";
9
- import { resolvePlugin } from "@dxos/app-framework";
10
- import { LocalStorageStore } from "@dxos/local-storage";
11
- import { log as log7 } from "@dxos/log";
12
- import { parseClientPlugin } from "@dxos/plugin-client";
13
- import { createExtension } from "@dxos/plugin-graph";
14
- import { isMarkdownProperties } from "@dxos/plugin-markdown";
15
- import { DocumentType as DocumentType3 } from "@dxos/plugin-markdown/types";
16
- import { memoizeQuery } from "@dxos/plugin-space";
17
- import { getMeta as getMeta3, isSpace, Filter as Filter3 } from "@dxos/react-client/echo";
18
-
19
- // packages/plugins/experimental/plugin-github/src/components/EmbeddedMain/EmbeddedMain.tsx
20
- import { ArrowSquareOut as ArrowSquareOut2, CaretDown as CaretDown2, DotsThreeVertical, Eye, Option, PencilSimpleLine, UserPlus } from "@phosphor-icons/react";
21
- import React10, { useCallback as useCallback2, useContext as useContext4, useRef, useState as useState6 } from "react";
22
- import { Surface, useIntent } from "@dxos/app-framework";
23
- import { SPACE_PLUGIN, SpaceAction, getSpaceDisplayName as getSpaceDisplayName2 } from "@dxos/plugin-space";
24
- import { useClient as useClient2 } from "@dxos/react-client";
25
- import { getMeta } from "@dxos/react-client/echo";
26
- import { Avatar, Button as Button4, ButtonGroup, Dialog as Dialog2, DropdownMenu, Main, Toggle, Tooltip as Tooltip2, toLocalizedString, useTranslation as useTranslation7 } from "@dxos/react-ui";
27
- import { defaultTx, descriptionText, getSize as getSize3, mx as mx4 } from "@dxos/react-ui-theme";
28
- import { hexToFallback } from "@dxos/util";
29
-
30
- // packages/plugins/experimental/plugin-github/src/components/EmbeddedMain/GfmPreview.tsx
31
- import "github-markdown-css/github-markdown.css";
32
- import DOMPurify from "dompurify";
33
- import React4, { useEffect as useEffect3, useState as useState3 } from "react";
34
- import { useTranslation as useTranslation2 } from "@dxos/react-ui";
35
-
36
- // packages/plugins/experimental/plugin-github/src/components/GithubApiProviders/GitHubSettings.tsx
37
- import { ArrowSquareOut } from "@phosphor-icons/react";
38
- import React2, { useEffect as useEffect2, useState as useState2 } from "react";
39
- import { Link, Input, Trans, useTranslation, useId } from "@dxos/react-ui";
40
- import { DeprecatedFormInput } from "@dxos/react-ui-form";
41
- import { getSize, mx } from "@dxos/react-ui-theme";
42
-
43
- // packages/plugins/experimental/plugin-github/src/components/GithubApiProviders/OctokitProvider.tsx
44
- import { Octokit } from "octokit";
45
- import React, { createContext, useContext, useEffect, useState } from "react";
46
- import { log } from "@dxos/log";
47
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/components/GithubApiProviders/OctokitProvider.tsx";
48
- var OctokitContext = /* @__PURE__ */ createContext({
49
- setPat: () => {
50
- },
51
- patError: null,
52
- octokit: null
53
- });
54
- var useOctokitContext = () => useContext(OctokitContext);
55
- var OctokitProvider = ({ pat, onPatChanged, children }) => {
56
- const [octokit, setOctokit] = useState(null);
57
- const [patError, setPatError] = useState(null);
58
- useEffect(() => {
59
- if (pat && !octokit) {
60
- void setPat(pat);
61
- }
62
- }, [
63
- pat,
64
- octokit
65
- ]);
66
- const setPat = async (pat2) => {
67
- onPatChanged?.(pat2);
68
- if (pat2) {
69
- const octokit2 = new Octokit({
70
- auth: pat2
71
- });
72
- return octokit2.rest.users.getAuthenticated().then(() => {
73
- setPatError(null);
74
- setOctokit(octokit2);
75
- }, (err) => {
76
- log.warn("Failed to authenticate Octokit from PAT", err, {
77
- F: __dxlog_file,
78
- L: 49,
79
- S: void 0,
80
- C: (f, a) => f(...a)
81
- });
82
- setPatError("failed");
83
- setOctokit(null);
84
- });
85
- } else {
86
- setOctokit(null);
87
- }
88
- };
89
- return /* @__PURE__ */ React.createElement(OctokitContext.Provider, {
90
- value: {
91
- pat,
92
- setPat,
93
- patError,
94
- octokit
95
- }
96
- }, children);
97
- };
98
-
99
- // packages/plugins/experimental/plugin-github/src/components/GithubApiProviders/GitHubSettings.tsx
100
- var ExternalLink = ({ children }) => {
101
- const { t } = useTranslation(GITHUB_PLUGIN);
102
- const descriptionId = useId("link--external");
103
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Link, {
104
- href: t("github pat description href"),
105
- target: "_blank",
106
- rel: "noreferrer",
107
- "aria-describedby": descriptionId
108
- }, children, /* @__PURE__ */ React2.createElement(ArrowSquareOut, {
109
- weight: "bold",
110
- className: mx(getSize(3), "inline-block leading-none -mbs-0.5 mli-px")
111
- })), /* @__PURE__ */ React2.createElement("span", {
112
- className: "sr-only",
113
- id: descriptionId
114
- }, t("target blank description", {
115
- ns: GITHUB_PLUGIN
116
- })));
117
- };
118
- var GitHubSettings = () => {
119
- const { t } = useTranslation(GITHUB_PLUGIN);
120
- const { pat, setPat } = useOctokitContext();
121
- const [patValue, setPatValue] = useState2(pat);
122
- useEffect2(() => {
123
- setPatValue(pat);
124
- }, [
125
- pat
126
- ]);
127
- useEffect2(() => {
128
- void setPat(patValue);
129
- }, [
130
- patValue
131
- ]);
132
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
133
- label: t("github pat label"),
134
- description: /* @__PURE__ */ React2.createElement(Trans, {
135
- t,
136
- i18nKey: "github pat description",
137
- components: {
138
- docsLink: /* @__PURE__ */ React2.createElement(ExternalLink, null)
139
- }
140
- })
141
- }, /* @__PURE__ */ React2.createElement(Input.TextInput, {
142
- autoFocus: true,
143
- spellCheck: false,
144
- classNames: "font-mono mlb-1",
145
- value: patValue ?? "",
146
- onChange: ({ target: { value } }) => setPatValue(value)
147
- })));
148
- };
149
-
150
- // packages/plugins/experimental/plugin-github/src/components/Loading/Loading.tsx
151
- import React3 from "react";
152
- import { useId as useId2 } from "@dxos/react-ui";
153
- import { mx as mx2 } from "@dxos/react-ui-theme";
154
- var sizeMap = /* @__PURE__ */ new Map([
155
- [
156
- "sm",
157
- "w-4 h-4"
158
- ],
159
- [
160
- "md",
161
- "w-8 h-8"
162
- ],
163
- [
164
- "lg",
165
- "w-12 h-12"
166
- ],
167
- [
168
- "xl",
169
- "w-16 h-16"
170
- ]
171
- ]);
172
- var Loading = ({ size, color, label, slots = {} }) => {
173
- const labelId = useId2("loading-label");
174
- const sizeClassName = sizeMap.get(size ?? "md");
175
- return /* @__PURE__ */ React3.createElement("div", {
176
- ...slots.root,
177
- className: mx2("flex justify-center p-4", slots.root?.className),
178
- role: "status",
179
- "aria-labelledby": labelId
180
- }, /* @__PURE__ */ React3.createElement("svg", {
181
- role: "none",
182
- className: mx2(sizeClassName, "text-neutral-200/50 animate-spin dark:text-neutral-600/50", color === "neutral" ? "fill-neutral-400" : "fill-primary-400", slots.svg?.className),
183
- viewBox: "0 0 100 101",
184
- fill: "none",
185
- xmlns: "http://www.w3.org/2000/svg"
186
- }, /* @__PURE__ */ React3.createElement("path", {
187
- d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",
188
- fill: "currentColor"
189
- }), /* @__PURE__ */ React3.createElement("path", {
190
- d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",
191
- fill: "currentFill"
192
- })), /* @__PURE__ */ React3.createElement("span", {
193
- className: "sr-only",
194
- id: labelId
195
- }, label));
196
- };
197
-
198
- // packages/plugins/experimental/plugin-github/src/components/EmbeddedMain/GfmPreview.tsx
199
- var defaultOptions = {
200
- ALLOWED_TAGS: [
201
- "span",
202
- "div",
203
- "b",
204
- "i",
205
- "em",
206
- "strong",
207
- "a",
208
- "p",
209
- "h1",
210
- "h2",
211
- "h3",
212
- "h4",
213
- "h5",
214
- "h6",
215
- "table",
216
- "td",
217
- "th",
218
- "tr",
219
- "blockquote",
220
- "ul",
221
- "ol",
222
- "li",
223
- "dd",
224
- "tt",
225
- "dl",
226
- "dt",
227
- "details",
228
- "figcaption",
229
- "figure",
230
- "summary",
231
- "abbr",
232
- "dfn",
233
- "mark",
234
- "sub",
235
- "sup",
236
- "img",
237
- "code",
238
- "kbd",
239
- "pre",
240
- "samp",
241
- "hr",
242
- "input",
243
- "pre",
244
- "del",
245
- "g-emoji",
246
- "label"
247
- ],
248
- ALLOWED_ATTR: [
249
- "class",
250
- "href",
251
- "target",
252
- "hidden",
253
- "title",
254
- "type",
255
- "role",
256
- "align",
257
- "data-footnote-ref"
258
- ]
259
- };
260
- var sanitize = (dirty, options) => ({
261
- __html: DOMPurify.sanitize(dirty, {
262
- ...defaultOptions,
263
- ...options
264
- })
265
- });
266
- var GfmPreview = ({ markdown, owner, repo }) => {
267
- const [html, setHtml] = useState3("");
268
- const { octokit } = useOctokitContext();
269
- const { t } = useTranslation2(GITHUB_PLUGIN);
270
- useEffect3(() => {
271
- if (octokit && markdown) {
272
- void octokit.request("POST /markdown", {
273
- text: markdown,
274
- ...owner && repo && {
275
- context: `${owner}/${repo}`
276
- }
277
- }).then(({ data }) => setHtml(data), () => {
278
- });
279
- }
280
- }, [
281
- markdown,
282
- octokit
283
- ]);
284
- return html ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("style", null, ".markdown-body ol, .markdown-body ul {list-style-type: disc; list-style-position: outside;}"), /* @__PURE__ */ React4.createElement("div", {
285
- className: "markdown-body grow is-full max-is-[980px] mli-auto p-[15px] sm:pli-[45px] sm:plb-[30px]",
286
- dangerouslySetInnerHTML: sanitize(html, {})
287
- })) : /* @__PURE__ */ React4.createElement("div", {
288
- role: "none",
289
- className: "mli-auto max-is-md pli-2 text-center"
290
- }, !octokit && /* @__PURE__ */ React4.createElement("p", {
291
- className: "mlb-4 text-lg font-medium"
292
- }, t("empty github pat message")), octokit ? /* @__PURE__ */ React4.createElement(Loading, {
293
- label: t("loading preview message")
294
- }) : /* @__PURE__ */ React4.createElement(GitHubSettings, null));
295
- };
296
-
297
- // packages/plugins/experimental/plugin-github/src/hooks/useDocGhId.ts
298
- import { useMemo } from "react";
299
- import { log as log2 } from "@dxos/log";
300
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/hooks/useDocGhId.ts";
301
- var useDocGhId = (keys) => {
302
- return useMemo(() => {
303
- try {
304
- const key = keys?.find((key2) => key2.source === "github.com");
305
- const [owner, repo, type, ...rest] = key?.id?.split("/") ?? [];
306
- if (type === "issues") {
307
- return {
308
- owner,
309
- repo,
310
- issueNumber: parseInt(rest[0], 10)
311
- };
312
- } else if (type === "blob") {
313
- const [ref, ...pathParts] = rest;
314
- return {
315
- owner,
316
- repo,
317
- ref,
318
- path: pathParts.join("/")
319
- };
320
- } else {
321
- return null;
322
- }
323
- } catch (err) {
324
- log2.catch(err, void 0, {
325
- F: __dxlog_file2,
326
- L: 34,
327
- S: void 0,
328
- C: (f, a) => f(...a)
329
- });
330
- return null;
331
- }
332
- }, [
333
- keys
334
- ]);
335
- };
336
-
337
- // packages/plugins/experimental/plugin-github/src/hooks/useGhIdFromUrl.ts
338
- import { useMemo as useMemo2 } from "react";
339
- var useGhIdFromUrl = (ghUrlValue) => useMemo2(() => {
340
- try {
341
- const url = new URL(ghUrlValue);
342
- const [_, owner, repo, type, ...rest] = url.pathname.split("/");
343
- if (type === "blob") {
344
- const [ref, ...pathParts] = rest;
345
- const path = pathParts.join("/");
346
- const ext = pathParts[pathParts.length - 1].split(".")[1];
347
- return ext === "md" ? `${owner}/${repo}/blob/${ref}/${path}` : null;
348
- } else if (type === "issues") {
349
- const [issueNumberString] = rest;
350
- return `${owner}/${repo}/issues/${issueNumberString}`;
351
- } else {
352
- return null;
353
- }
354
- } catch (e) {
355
- return null;
356
- }
357
- }, [
358
- ghUrlValue
359
- ]);
360
-
361
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/ResolverDialog.tsx
362
- import React9 from "react";
363
- import { Button as Button3, useTranslation as useTranslation6 } from "@dxos/react-ui";
364
-
365
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/ResolverTree.tsx
366
- import React8, { useCallback, useContext as useContext3 } from "react";
367
- import { useClient } from "@dxos/react-client";
368
- import { useSpaces as useSpaces2 } from "@dxos/react-client/echo";
369
- import { Button as Button2, Dialog, Tree as Tree2, useId as useId3, useTranslation as useTranslation5 } from "@dxos/react-ui";
370
-
371
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/ResolverContext.tsx
372
- import React5, { createContext as createContext2, useContext as useContext2, useEffect as useEffect4, useMemo as useMemo3, useState as useState4 } from "react";
373
- import { create } from "@dxos/live-object";
374
- import { log as log3 } from "@dxos/log";
375
- import { DocumentType, TextType } from "@dxos/plugin-markdown/types";
376
- import { useMulticastObservable } from "@dxos/react-client";
377
- import { Filter, SpaceState, useQuery, useSpaces } from "@dxos/react-client/echo";
378
- import { useIdentity } from "@dxos/react-client/halo";
379
-
380
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/spaceResolvers.ts
381
- import get from "lodash.get";
382
- import update from "lodash.update";
383
- var ghMatch = (space, identityHex, id) => {
384
- const [ghOwner, ghRepo, ..._ghEtc] = id.split("/");
385
- return get(space.properties, [
386
- "members",
387
- identityHex,
388
- "github",
389
- "repos"
390
- ], []).includes(`${ghOwner}/${ghRepo}`);
391
- };
392
- var matchSpace = (space, identityHex, source, id) => {
393
- if (!id) {
394
- return false;
395
- }
396
- switch (source) {
397
- case "github.com":
398
- return ghMatch(space, identityHex, id);
399
- default:
400
- return false;
401
- }
402
- };
403
- var ghBind = (space, identityHex, id) => {
404
- const [ghOwner, ghRepo, ..._ghEtc] = id.split("/");
405
- update(space.properties, [
406
- "members",
407
- identityHex,
408
- "github",
409
- "repos"
410
- ], (ghBindings) => {
411
- return [
412
- ...ghBindings ?? [],
413
- `${ghOwner}/${ghRepo}`
414
- ];
415
- });
416
- return space.properties.members?.[identityHex]?.github?.repos ?? [];
417
- };
418
- var bindSpace = (space, identityHex, source, id) => {
419
- switch (source) {
420
- case "github.com":
421
- return ghBind(space, identityHex, id);
422
- default:
423
- return [];
424
- }
425
- };
426
- var ghUnbind = (space, identityHex, id) => {
427
- const [ghOwner, ghRepo, ..._ghEtc] = id.split("/");
428
- update(space.properties, [
429
- "members",
430
- identityHex,
431
- "github",
432
- "repos"
433
- ], (ghBindings) => {
434
- const index = ghBindings.indexOf(`${ghOwner}/${ghRepo}`);
435
- if (index >= 0) {
436
- const result = [
437
- ...ghBindings
438
- ];
439
- result.splice(index, 1);
440
- return result;
441
- } else {
442
- return ghBindings;
443
- }
444
- });
445
- return space.properties.members?.[identityHex]?.github?.repos ?? [];
446
- };
447
- var unbindSpace = (space, identityHex, source, id) => {
448
- switch (source) {
449
- case "github.com":
450
- return ghUnbind(space, identityHex, id);
451
- default:
452
- return [];
453
- }
454
- };
455
- var ghDisplayName = (id) => {
456
- const [ghOwner, ghRepo, ghResource, ...etc] = id.split("/");
457
- switch (ghResource) {
458
- case "issues":
459
- return `${ghOwner}/${ghRepo} #${etc[0]}`;
460
- default:
461
- return `${ghOwner}/${ghRepo} ${[
462
- ghResource,
463
- ...etc
464
- ].join("/")}`;
465
- }
466
- };
467
- var displayName = (source, id) => {
468
- switch (source) {
469
- case "github.com":
470
- return ghDisplayName(id);
471
- default:
472
- return id;
473
- }
474
- };
475
-
476
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/ResolverContext.tsx
477
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/ResolverContext.tsx";
478
- var getLocationIdentifier = () => {
479
- const searchParams = new URLSearchParams(window.location.search);
480
- const location2 = searchParams.get("location");
481
- let source, id;
482
- try {
483
- const url = location2 ? new URL(location2) : void 0;
484
- source = url?.hostname.split(".").reverse().join(".");
485
- id = url?.pathname.slice(1);
486
- } catch (err) {
487
- log3.catch(err, void 0, {
488
- F: __dxlog_file3,
489
- L: 34,
490
- S: void 0,
491
- C: (f, a) => f(...a)
492
- });
493
- }
494
- return [
495
- source,
496
- id
497
- ];
498
- };
499
- var SpaceResolverContext = /* @__PURE__ */ createContext2({
500
- space: null,
501
- setSpace: (_space) => {
502
- }
503
- });
504
- var SpaceResolverProvider = ({ children }) => {
505
- const identity = useIdentity();
506
- const identityHex = identity?.identityKey.toHex();
507
- const [source, id] = getLocationIdentifier();
508
- const spaces = useSpaces({
509
- all: true
510
- });
511
- const [nextSpace, setSpace] = useState4(null);
512
- const space = useMemo3(() => nextSpace ?? (identityHex ? spaces.find((space2) => matchSpace(space2, identityHex, source, id)) ?? null : null), [
513
- spaces,
514
- nextSpace,
515
- identityHex,
516
- source,
517
- id
518
- ]);
519
- return /* @__PURE__ */ React5.createElement(SpaceResolverContext.Provider, {
520
- value: {
521
- space,
522
- setSpace,
523
- source,
524
- id,
525
- identityHex
526
- }
527
- }, children);
528
- };
529
- var defaultDocumentResolverContext = {
530
- document: null,
531
- setDocument: (_document) => {
532
- }
533
- };
534
- var DocumentResolverContext = /* @__PURE__ */ createContext2(defaultDocumentResolverContext);
535
- var DocumentResolverProviderImpl = ({ space, source, id, children }) => {
536
- const spaceState = useMulticastObservable(space.state);
537
- const [document2, setDocument] = useState4(null);
538
- const defaultDisplayName = displayName(source, id);
539
- const documents = useQuery(space, Filter.foreignKeys([
540
- {
541
- source,
542
- id
543
- }
544
- ]));
545
- useEffect4(() => {
546
- const handler = (event) => {
547
- if (event.source !== window.parent || spaceState !== SpaceState.SPACE_READY) {
548
- return;
549
- }
550
- if (event.data.type === "initial-data") {
551
- const nextDocument = space.db.add(create(DocumentType, {
552
- name: defaultDisplayName,
553
- content: create(TextType, {
554
- content: event.data.content
555
- }),
556
- threads: []
557
- }, {
558
- keys: [
559
- {
560
- source,
561
- id
562
- }
563
- ]
564
- }));
565
- setDocument(nextDocument);
566
- }
567
- };
568
- if (documents.length === 0) {
569
- window.addEventListener("message", handler);
570
- window.parent.postMessage({
571
- type: "request-initial-data"
572
- }, "https://github.com");
573
- return () => window.removeEventListener("message", handler);
574
- } else {
575
- setDocument(documents[0]);
576
- }
577
- }, [
578
- spaceState,
579
- space,
580
- documents
581
- ]);
582
- return /* @__PURE__ */ React5.createElement(DocumentResolverContext.Provider, {
583
- value: {
584
- document: document2,
585
- setDocument
586
- }
587
- }, children);
588
- };
589
- var DocumentResolverProvider = ({ children }) => {
590
- const { space, source, id } = useContext2(SpaceResolverContext);
591
- return space && source && id ? /* @__PURE__ */ React5.createElement(DocumentResolverProviderImpl, {
592
- space,
593
- source,
594
- id
595
- }, children) : /* @__PURE__ */ React5.createElement(DocumentResolverContext.Provider, {
596
- value: defaultDocumentResolverContext
597
- }, children);
598
- };
599
-
600
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.tsx
601
- import { CaretDown, CaretRight } from "@phosphor-icons/react";
602
- import React7, { useMemo as useMemo4, useState as useState5 } from "react";
603
- import { DocumentType as DocumentType2 } from "@dxos/plugin-markdown/types";
604
- import { getSpaceDisplayName } from "@dxos/plugin-space";
605
- import { useMulticastObservable as useMulticastObservable2 } from "@dxos/react-client";
606
- import { SpaceState as SpaceState2, useQuery as useQuery2, Filter as Filter2 } from "@dxos/react-client/echo";
607
- import { Button, Tag, Tooltip, Tree, TreeItem as TreeItem2, useTranslation as useTranslation4 } from "@dxos/react-ui";
608
- import { staticDisabled } from "@dxos/react-ui-theme";
609
-
610
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/DocumentTreeItem.tsx
611
- import { TextAa } from "@phosphor-icons/react";
612
- import React6 from "react";
613
- import { useTranslation as useTranslation3, TreeItem } from "@dxos/react-ui";
614
- import { getSize as getSize2, mx as mx3 } from "@dxos/react-ui-theme";
615
- var DocumentTreeItem = ({ document: document2 }) => {
616
- const { t } = useTranslation3(GITHUB_PLUGIN);
617
- return /* @__PURE__ */ React6.createElement(TreeItem.Root, {
618
- classNames: "flex gap-2"
619
- }, /* @__PURE__ */ React6.createElement(TreeItem.Heading, {
620
- classNames: "contents"
621
- }, /* @__PURE__ */ React6.createElement(TextAa, {
622
- weight: "regular",
623
- className: mx3(getSize2(4), "shrink-0 mbs-2")
624
- }), /* @__PURE__ */ React6.createElement("span", {
625
- className: "grow mbs-2 text-sm no-leading"
626
- }, document2.name || t("document title placeholder", {
627
- ns: "dxos.org/plugin/markdown"
628
- }))));
629
- };
630
-
631
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.tsx
632
- var SpacePickerTreeItem = ({ identityHex, space, source, id, setSpace, selected }) => {
633
- const { t } = useTranslation4(GITHUB_PLUGIN);
634
- const spaceSate = useMulticastObservable2(space.state);
635
- const disabled = spaceSate !== SpaceState2.SPACE_READY;
636
- const spaceDisplayName = getSpaceDisplayName(space);
637
- const documents = useQuery2(space, Filter2.schema(DocumentType2));
638
- const hasDocuments = documents.length > 0;
639
- const [open, setOpen] = useState5(false);
640
- const nBoundMembers = useMemo4(() => {
641
- return Object.keys(space.properties.members ?? {}).filter((identityHex2) => matchSpace(space, identityHex2, source, id)).length;
642
- }, [
643
- source,
644
- id,
645
- space.properties
646
- ]);
647
- const OpenTriggerIcon = open ? CaretDown : CaretRight;
648
- return /* @__PURE__ */ React7.createElement(TreeItem2.Root, {
649
- collapsible: true,
650
- open,
651
- onOpenChange: setOpen,
652
- classNames: [
653
- "mbe-2 block",
654
- disabled && staticDisabled
655
- ],
656
- ...disabled && {
657
- "aria-disabled": true
658
- }
659
- }, /* @__PURE__ */ React7.createElement("div", {
660
- role: "none",
661
- className: "flex items-center gap-2"
662
- }, hasDocuments ? /* @__PURE__ */ React7.createElement(TreeItem2.OpenTrigger, null, /* @__PURE__ */ React7.createElement(OpenTriggerIcon, null)) : /* @__PURE__ */ React7.createElement(TreeItem2.OpenTrigger, {
663
- disabled: true,
664
- classNames: staticDisabled
665
- }, /* @__PURE__ */ React7.createElement(CaretRight, null)), /* @__PURE__ */ React7.createElement(TreeItem2.Heading, {
666
- classNames: "grow break-words pbs-1 text-baseText font-medium",
667
- "data-testid": "composer.spaceTreeItemHeading"
668
- }, Array.isArray(spaceDisplayName) ? t(...spaceDisplayName) : spaceDisplayName), nBoundMembers > 0 && /* @__PURE__ */ React7.createElement(Tooltip.Root, null, /* @__PURE__ */ React7.createElement(Tooltip.Trigger, {
669
- asChild: true
670
- }, /* @__PURE__ */ React7.createElement(Tag, {
671
- palette: "info",
672
- "aria-label": t("bound members message", {
673
- count: nBoundMembers
674
- })
675
- }, nBoundMembers)), /* @__PURE__ */ React7.createElement(Tooltip.Portal, null, /* @__PURE__ */ React7.createElement(Tooltip.Content, {
676
- side: "bottom"
677
- }, /* @__PURE__ */ React7.createElement(Tooltip.Arrow, null), t("bound members message", {
678
- count: nBoundMembers
679
- })))), /* @__PURE__ */ React7.createElement(Button, {
680
- disabled: selected,
681
- density: "fine",
682
- classNames: "shrink-0",
683
- onClick: () => setSpace(space)
684
- }, t(selected ? "selected label" : "select label"))), /* @__PURE__ */ React7.createElement(TreeItem2.Body, {
685
- className: "pis-4"
686
- }, hasDocuments && /* @__PURE__ */ React7.createElement(Tree.Branch, null, documents.map((document2) => /* @__PURE__ */ React7.createElement(DocumentTreeItem, {
687
- key: document2.id,
688
- document: document2
689
- })))));
690
- };
691
-
692
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/ResolverTree.tsx
693
- var ResolverTree = () => {
694
- const client = useClient();
695
- const spaces = useSpaces2({
696
- all: true
697
- });
698
- const treeLabel = useId3("treeLabel");
699
- const { t } = useTranslation5(GITHUB_PLUGIN);
700
- const { space: selectedSpace, setSpace: setSelectedSpace, source, id, identityHex } = useContext3(SpaceResolverContext);
701
- const setSpace = useCallback((nextSpace) => {
702
- if (identityHex && source && id) {
703
- selectedSpace && unbindSpace(selectedSpace, identityHex, source, id);
704
- nextSpace && bindSpace(nextSpace, identityHex, source, id);
705
- }
706
- setSelectedSpace(nextSpace);
707
- }, [
708
- selectedSpace,
709
- setSelectedSpace,
710
- identityHex,
711
- source,
712
- id
713
- ]);
714
- return spaces.length ? /* @__PURE__ */ React8.createElement(React8.Fragment, null, " ", /* @__PURE__ */ React8.createElement(Dialog.Title, {
715
- tabIndex: -1,
716
- classNames: "shrink-0"
717
- }, t("resolver tree label")), /* @__PURE__ */ React8.createElement(Dialog.Description, null, t("resolver tree description")), /* @__PURE__ */ React8.createElement("div", {
718
- role: "separator",
719
- className: "shrink-0 bs-px bg-neutral-500/20 mlb-1"
720
- }), /* @__PURE__ */ React8.createElement(Tree2.Root, {
721
- "aria-label": t("resolver tree label"),
722
- "data-testid": "composer.sidebarTree",
723
- classNames: "overflow-y-auto -mli-2 p-2"
724
- }, spaces.map((space) => {
725
- return /* @__PURE__ */ React8.createElement(SpacePickerTreeItem, {
726
- key: space.key.toHex(),
727
- space,
728
- selected: selectedSpace === space,
729
- setSpace,
730
- identityHex,
731
- source,
732
- id
733
- });
734
- }))) : /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("h1", {
735
- className: "text-lg font-normal",
736
- id: treeLabel
737
- }, t("resolver no spaces message")), /* @__PURE__ */ React8.createElement("div", {
738
- role: "separator",
739
- className: "bs-px bg-neutral-500/20 mlb-2"
740
- }), /* @__PURE__ */ React8.createElement(Button2, {
741
- classNames: "block is-full",
742
- onClick: async () => {
743
- const space = await client.spaces.create();
744
- bindSpace(space, identityHex, source, id);
745
- setSpace(space);
746
- }
747
- }, t("resolver create space label")));
748
- };
749
-
750
- // packages/plugins/experimental/plugin-github/src/components/GithubEchoResolverProviders/ResolverDialog.tsx
751
- var ResolverDialog = ({ handleJoinSpace, handleCreateSpace }) => {
752
- const { t } = useTranslation6(GITHUB_PLUGIN);
753
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(ResolverTree, null), /* @__PURE__ */ React9.createElement("div", {
754
- role: "group",
755
- className: "shrink-0 flex is-full gap-2"
756
- }, /* @__PURE__ */ React9.createElement(Button3, {
757
- classNames: "grow",
758
- onClick: handleCreateSpace
759
- }, t("create space label", {
760
- ns: "appkit"
761
- })), /* @__PURE__ */ React9.createElement(Button3, {
762
- classNames: "grow",
763
- onClick: handleJoinSpace
764
- }, t("join space label", {
765
- ns: "appkit"
766
- }))));
767
- };
768
-
769
- // packages/plugins/experimental/plugin-github/src/components/EmbeddedMain/EmbeddedMain.tsx
770
- var overlayAttrs = {
771
- side: "top",
772
- sideOffset: 4
773
- };
774
- var EmbeddedLayoutImpl = () => {
775
- const { t } = useTranslation7(GITHUB_PLUGIN);
776
- const { space, source, id, identityHex } = useContext4(SpaceResolverContext);
777
- const { document: document2 } = useContext4(DocumentResolverContext);
778
- const { dispatch } = useIntent();
779
- const client = useClient2();
780
- const handleCloseEmbed = useCallback2(() => {
781
- window.parent.postMessage({
782
- type: "close-embed"
783
- }, "https://github.com");
784
- }, []);
785
- const handleSaveAndCloseEmbed = useCallback2(() => {
786
- document2 && window.parent.postMessage({
787
- type: "save-data",
788
- content: document2.content?.content
789
- }, "https://github.com");
790
- }, [
791
- document2
792
- ]);
793
- const handleCreateSpace = () => dispatch({
794
- action: SpaceAction.CREATE
795
- });
796
- const handleJoinSpace = () => dispatch({
797
- action: SpaceAction.JOIN
798
- });
799
- const handleInvite = useCallback2(() => {
800
- if (client && space) {
801
- }
802
- }, [
803
- client,
804
- space
805
- ]);
806
- const [editorViewState, setEditorViewState] = useState6("editor");
807
- const isPreviewing = editorViewState === "preview";
808
- const suppressNextTooltip = useRef(false);
809
- const [optionsTooltipOpen, setOptionsTooltipOpen] = useState6(false);
810
- const [optionsMenuOpen, setOptionsMenuOpen] = useState6(false);
811
- const [renameDialogOpen, setRenameDialogOpen] = useState6(false);
812
- const [resolverDialogOpen, setResolverDialogOpen] = useState6(false);
813
- const spaceFallbackValue = hexToFallback(space?.key.toHex() ?? "0");
814
- const docGhId = useDocGhId((document2 ? getMeta(document2)?.keys : []) ?? []);
815
- const name = space && getSpaceDisplayName2(space);
816
- return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("style", {
817
- type: "text/css"
818
- }, `
819
- :root {
820
- --surface-bg: #F6F8FA;
821
- }
822
- .dark:root {
823
- --surface-bg: #161b22;
824
- }
825
- `), /* @__PURE__ */ React10.createElement("div", {
826
- role: "none",
827
- className: "fixed inline-end-2 block-end-2 z-10 flex gap-2"
828
- }, /* @__PURE__ */ React10.createElement(Tooltip2.Root, null, /* @__PURE__ */ React10.createElement(Tooltip2.Trigger, {
829
- asChild: true
830
- }, /* @__PURE__ */ React10.createElement(Button4, {
831
- disabled: !space,
832
- onClick: handleInvite
833
- }, /* @__PURE__ */ React10.createElement("span", {
834
- className: "sr-only"
835
- }, t("create invitation label", {
836
- ns: "appkit"
837
- })), /* @__PURE__ */ React10.createElement(UserPlus, {
838
- className: getSize3(5)
839
- }))), /* @__PURE__ */ React10.createElement(Tooltip2.Content, overlayAttrs, t("create invitation label", {
840
- ns: "appkit"
841
- }), /* @__PURE__ */ React10.createElement(Tooltip2.Arrow, null))), /* @__PURE__ */ React10.createElement(Tooltip2.Root, null, /* @__PURE__ */ React10.createElement(Tooltip2.Trigger, {
842
- asChild: true
843
- }, /* @__PURE__ */ React10.createElement(Toggle, {
844
- disabled: !(space && document2),
845
- pressed: isPreviewing,
846
- onPressedChange: (nextPressed) => setEditorViewState(nextPressed ? "preview" : "editor")
847
- }, /* @__PURE__ */ React10.createElement("span", {
848
- className: "sr-only"
849
- }, t(isPreviewing ? "exit gfm preview label" : "preview gfm label")), isPreviewing ? /* @__PURE__ */ React10.createElement(PencilSimpleLine, {
850
- className: getSize3(5)
851
- }) : /* @__PURE__ */ React10.createElement(Eye, {
852
- className: getSize3(5)
853
- }))), /* @__PURE__ */ React10.createElement(Tooltip2.Content, overlayAttrs, t(isPreviewing ? "exit gfm preview label" : "preview gfm label"), /* @__PURE__ */ React10.createElement(Tooltip2.Arrow, null))), /* @__PURE__ */ React10.createElement(Tooltip2.Root, {
854
- open: optionsTooltipOpen,
855
- onOpenChange: (nextOpen) => {
856
- if (suppressNextTooltip.current) {
857
- setOptionsTooltipOpen(false);
858
- suppressNextTooltip.current = false;
859
- } else {
860
- setOptionsTooltipOpen(nextOpen);
861
- }
862
- }
863
- }, /* @__PURE__ */ React10.createElement(DropdownMenu.Root, {
864
- modal: false,
865
- open: optionsMenuOpen,
866
- onOpenChange: (nextOpen) => {
867
- if (!nextOpen) {
868
- suppressNextTooltip.current = true;
869
- }
870
- return setOptionsMenuOpen(nextOpen);
871
- }
872
- }, /* @__PURE__ */ React10.createElement(Tooltip2.Trigger, {
873
- asChild: true
874
- }, /* @__PURE__ */ React10.createElement(DropdownMenu.Trigger, {
875
- asChild: true,
876
- disabled: !(space && document2)
877
- }, /* @__PURE__ */ React10.createElement(Button4, null, /* @__PURE__ */ React10.createElement(DotsThreeVertical, {
878
- className: getSize3(5)
879
- }), /* @__PURE__ */ React10.createElement("span", {
880
- className: "sr-only"
881
- }, t("embedded options label"))))), /* @__PURE__ */ React10.createElement(DropdownMenu.Content, overlayAttrs, /* @__PURE__ */ React10.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React10.createElement(DropdownMenu.Item, {
882
- asChild: true
883
- }, /* @__PURE__ */ React10.createElement("a", {
884
- target: "_blank",
885
- rel: "noreferrer",
886
- href: space && document2 ? `${location.origin}/dxos/space/${space?.key.toHex() ?? "never"}/${document2.id}` : "#"
887
- }, /* @__PURE__ */ React10.createElement(ArrowSquareOut2, {
888
- className: mx4("shrink-0", getSize3(5))
889
- }), /* @__PURE__ */ React10.createElement("span", {
890
- className: "grow"
891
- }, t("open in composer label", {
892
- ns: GITHUB_PLUGIN
893
- })))), /* @__PURE__ */ React10.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React10.createElement(DropdownMenu.GroupLabel, null, t("active space label", {
894
- ns: SPACE_PLUGIN
895
- }), /* @__PURE__ */ React10.createElement(Avatar.Root, {
896
- size: 5,
897
- variant: "circle"
898
- }, /* @__PURE__ */ React10.createElement("div", {
899
- role: "none",
900
- className: "flex gap-1 mlb-1 items-center"
901
- }, /* @__PURE__ */ React10.createElement(Avatar.Frame, null, /* @__PURE__ */ React10.createElement(Avatar.Fallback, {
902
- text: spaceFallbackValue.emoji
903
- })), /* @__PURE__ */ React10.createElement(Avatar.Label, {
904
- classNames: "text-sm text-[--surface-text]"
905
- }, name && toLocalizedString(name, t))))), /* @__PURE__ */ React10.createElement(DropdownMenu.Item, {
906
- onClick: () => setRenameDialogOpen(true)
907
- }, /* @__PURE__ */ React10.createElement("span", {
908
- className: "grow"
909
- }, t("rename space label", {
910
- ns: SPACE_PLUGIN
911
- })), /* @__PURE__ */ React10.createElement(PencilSimpleLine, {
912
- className: mx4("shrink-0", getSize3(5))
913
- })), /* @__PURE__ */ React10.createElement(DropdownMenu.Item, {
914
- onClick: () => setResolverDialogOpen(true)
915
- }, /* @__PURE__ */ React10.createElement("span", {
916
- className: "grow"
917
- }, t("unset repo space label")), /* @__PURE__ */ React10.createElement(Option, {
918
- className: mx4("shrink-0", getSize3(5))
919
- }))), /* @__PURE__ */ React10.createElement(DropdownMenu.Arrow, null)), /* @__PURE__ */ React10.createElement(Tooltip2.Content, overlayAttrs, t("embedded options label"), /* @__PURE__ */ React10.createElement(Tooltip2.Arrow, null)))), /* @__PURE__ */ React10.createElement(ButtonGroup, {
920
- classNames: [
921
- !(space && document2) && "shadow-none"
922
- ]
923
- }, /* @__PURE__ */ React10.createElement(Button4, {
924
- disabled: !(space && document2),
925
- onClick: handleSaveAndCloseEmbed
926
- }, t("save and close label")), /* @__PURE__ */ React10.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React10.createElement(DropdownMenu.Trigger, {
927
- asChild: true,
928
- disabled: !(space && document2)
929
- }, /* @__PURE__ */ React10.createElement(Button4, null, /* @__PURE__ */ React10.createElement(CaretDown2, null))), /* @__PURE__ */ React10.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React10.createElement(DropdownMenu.Content, overlayAttrs, /* @__PURE__ */ React10.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React10.createElement(DropdownMenu.Item, {
930
- onClick: handleSaveAndCloseEmbed,
931
- classNames: "block"
932
- }, /* @__PURE__ */ React10.createElement("p", null, t("save and close label")), /* @__PURE__ */ React10.createElement("p", {
933
- className: descriptionText
934
- }, t("save and close description"))), /* @__PURE__ */ React10.createElement(DropdownMenu.Item, {
935
- onClick: handleCloseEmbed,
936
- classNames: "block"
937
- }, /* @__PURE__ */ React10.createElement("p", null, t("close label", {
938
- ns: "appkit"
939
- })), /* @__PURE__ */ React10.createElement("p", {
940
- className: descriptionText
941
- }, t("close embed description")))), /* @__PURE__ */ React10.createElement(DropdownMenu.Arrow, null)))))), space && document2 ? editorViewState === "preview" ? /* @__PURE__ */ React10.createElement(Main.Content, {
942
- classNames: "min-bs-[100dvh] flex flex-col p-0.5"
943
- }, /* @__PURE__ */ React10.createElement(GfmPreview, {
944
- markdown: document2.content?.toString() ?? "",
945
- ...docGhId && {
946
- owner: docGhId.owner,
947
- repo: docGhId.repo
948
- }
949
- })) : (
950
- // TODO(burdon): This will break since model is not defined.
951
- /* @__PURE__ */ React10.createElement(Surface, {
952
- role: "main",
953
- data: {
954
- properties: document2,
955
- view: "embedded"
956
- }
957
- })
958
- ) : source && id && identityHex ? /* @__PURE__ */ React10.createElement(Dialog2.Root, {
959
- open: true,
960
- onOpenChange: () => true
961
- }, /* @__PURE__ */ React10.createElement("div", {
962
- role: "none",
963
- className: defaultTx("dialog.overlay", "dialog--resolver__overlay", {}, "static bs-full")
964
- }, /* @__PURE__ */ React10.createElement("div", {
965
- role: "none",
966
- className: defaultTx("dialog.content", "dialog--resolver__content", {}, "p-2 bs-72 flex flex-col shadow-none bg-transparent")
967
- }, /* @__PURE__ */ React10.createElement(ResolverDialog, {
968
- handleCreateSpace,
969
- handleJoinSpace
970
- })))) : null, space && /* @__PURE__ */ React10.createElement(Dialog2.Root, {
971
- open: renameDialogOpen,
972
- onOpenChange: setRenameDialogOpen
973
- }, /* @__PURE__ */ React10.createElement(Dialog2.Overlay, {
974
- classNames: "backdrop-blur"
975
- }, /* @__PURE__ */ React10.createElement(Dialog2.Content, null, /* @__PURE__ */ React10.createElement(Surface, {
976
- role: "dialog",
977
- data: {
978
- content: "dxos.org/plugin/space/RenameSpaceDialog",
979
- subject: space
980
- }
981
- })))), /* @__PURE__ */ React10.createElement(Dialog2.Root, {
982
- open: resolverDialogOpen,
983
- onOpenChange: setResolverDialogOpen
984
- }, /* @__PURE__ */ React10.createElement(Dialog2.Overlay, {
985
- classNames: "backdrop-blur"
986
- }, /* @__PURE__ */ React10.createElement(Dialog2.Content, null, /* @__PURE__ */ React10.createElement(ResolverDialog, {
987
- handleCreateSpace,
988
- handleJoinSpace
989
- })))));
990
- };
991
- var EmbeddedMain = () => {
992
- return /* @__PURE__ */ React10.createElement(SpaceResolverProvider, null, /* @__PURE__ */ React10.createElement(DocumentResolverProvider, null, /* @__PURE__ */ React10.createElement(EmbeddedLayoutImpl, null)));
993
- };
994
-
995
- // packages/plugins/experimental/plugin-github/src/components/ExportDialog.tsx
996
- import React11, { useCallback as useCallback3, useState as useState7 } from "react";
997
- import { log as log4 } from "@dxos/log";
998
- import { Button as Button5, Dialog as Dialog3, Input as Input2, Trans as Trans2, useTranslation as useTranslation8 } from "@dxos/react-ui";
999
-
1000
- // packages/plugins/experimental/plugin-github/src/components/ImportDialog.tsx
1001
- import React12, { useCallback as useCallback4 } from "react";
1002
- import { log as log5 } from "@dxos/log";
1003
- import { Button as Button6, Dialog as Dialog4, useTranslation as useTranslation9 } from "@dxos/react-ui";
1004
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/components/ImportDialog.tsx";
1005
- var ImportDialog = ({ docGhId, onUpdate }) => {
1006
- const { t } = useTranslation9(GITHUB_PLUGIN);
1007
- const { octokit } = useOctokitContext();
1008
- const importGhIssueContent = useCallback4(async () => {
1009
- if (octokit && docGhId && "issueNumber") {
1010
- try {
1011
- const { owner, repo, issueNumber } = docGhId;
1012
- const { data } = await octokit.rest.issues.get({
1013
- owner,
1014
- repo,
1015
- issue_number: issueNumber
1016
- });
1017
- onUpdate(data.body ?? "");
1018
- } catch (err) {
1019
- log5.error("Failed to import from Github issue", err, {
1020
- F: __dxlog_file4,
1021
- L: 25,
1022
- S: void 0,
1023
- C: (f, a) => f(...a)
1024
- });
1025
- }
1026
- } else {
1027
- log5.error("Not prepared to import from Github issue when requested.", void 0, {
1028
- F: __dxlog_file4,
1029
- L: 28,
1030
- S: void 0,
1031
- C: (f, a) => f(...a)
1032
- });
1033
- }
1034
- }, [
1035
- octokit,
1036
- docGhId
1037
- ]);
1038
- const importGhFileContent = useCallback4(async () => {
1039
- if (octokit && docGhId && "path" in docGhId) {
1040
- try {
1041
- const { owner, repo, path } = docGhId;
1042
- const { data } = await octokit.rest.repos.getContent({
1043
- owner,
1044
- repo,
1045
- path
1046
- });
1047
- if (!Array.isArray(data) && data.type === "file") {
1048
- onUpdate(atob(data.content));
1049
- } else {
1050
- log5.error("Did not receive file with content from Github.", void 0, {
1051
- F: __dxlog_file4,
1052
- L: 40,
1053
- S: void 0,
1054
- C: (f, a) => f(...a)
1055
- });
1056
- }
1057
- } catch (err) {
1058
- log5.error("Failed to import from Github file", err, {
1059
- F: __dxlog_file4,
1060
- L: 43,
1061
- S: void 0,
1062
- C: (f, a) => f(...a)
1063
- });
1064
- }
1065
- } else {
1066
- log5.error("Not prepared to import from Github file when requested.", void 0, {
1067
- F: __dxlog_file4,
1068
- L: 46,
1069
- S: void 0,
1070
- C: (f, a) => f(...a)
1071
- });
1072
- }
1073
- }, [
1074
- octokit,
1075
- docGhId
1076
- ]);
1077
- const handleGhImport = useCallback4(() => {
1078
- return docGhId && ("issueNumber" in docGhId ? importGhIssueContent() : "path" in docGhId ? importGhFileContent() : null);
1079
- }, [
1080
- importGhIssueContent,
1081
- importGhFileContent,
1082
- docGhId
1083
- ]);
1084
- return /* @__PURE__ */ React12.createElement(Dialog4.Content, null, /* @__PURE__ */ React12.createElement(Dialog4.Title, null, t("confirm import title")), /* @__PURE__ */ React12.createElement("p", {
1085
- className: "plb-2"
1086
- }, t("confirm import body")), /* @__PURE__ */ React12.createElement("div", {
1087
- role: "none",
1088
- className: "flex justify-end gap-2"
1089
- }, /* @__PURE__ */ React12.createElement(Dialog4.Close, {
1090
- asChild: true
1091
- }, /* @__PURE__ */ React12.createElement(Button6, null, t("cancel label", {
1092
- ns: "appkit"
1093
- }))), /* @__PURE__ */ React12.createElement(Dialog4.Close, {
1094
- asChild: true
1095
- }, /* @__PURE__ */ React12.createElement(Button6, {
1096
- variant: "primary",
1097
- onClick: handleGhImport
1098
- }, t("import from github label")))));
1099
- };
1100
-
1101
- // packages/plugins/experimental/plugin-github/src/components/Issue.tsx
1102
- import { IconBase } from "@phosphor-icons/react";
1103
- import React13, { forwardRef } from "react";
1104
- var weights = /* @__PURE__ */ new Map([
1105
- [
1106
- "bold",
1107
- /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
1108
- d: "M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Z"
1109
- }), /* @__PURE__ */ React13.createElement("path", {
1110
- d: "M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128Z"
1111
- }))
1112
- ],
1113
- [
1114
- "duotone",
1115
- /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
1116
- d: "M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",
1117
- opacity: "0.2"
1118
- }), /* @__PURE__ */ React13.createElement("path", {
1119
- d: "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"
1120
- }), /* @__PURE__ */ React13.createElement("path", {
1121
- d: "M176,128a48,48,0,1,1-48-48A48,48,0,0,1,176,128Z",
1122
- opacity: "0.2"
1123
- }), /* @__PURE__ */ React13.createElement("path", {
1124
- d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z"
1125
- }))
1126
- ],
1127
- [
1128
- "fill",
1129
- /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
1130
- d: "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"
1131
- }), /* @__PURE__ */ React13.createElement("path", {
1132
- d: "M128,80a48,48,0,1,0,48,48A48,48,0,0,0,128,80Zm0,60a12,12,0,1,1,12-12A12,12,0,0,1,128,140Z"
1133
- }))
1134
- ],
1135
- [
1136
- "light",
1137
- /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
1138
- d: "M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z"
1139
- }), /* @__PURE__ */ React13.createElement("path", {
1140
- d: "M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128Z"
1141
- }))
1142
- ],
1143
- [
1144
- "regular",
1145
- /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
1146
- d: "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"
1147
- }), /* @__PURE__ */ React13.createElement("path", {
1148
- d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z"
1149
- }))
1150
- ],
1151
- [
1152
- "thin",
1153
- /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
1154
- d: "M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Z"
1155
- }), /* @__PURE__ */ React13.createElement("path", {
1156
- d: "M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Z"
1157
- }))
1158
- ]
1159
- ]);
1160
- var Issue = /* @__PURE__ */ forwardRef((props, ref) => /* @__PURE__ */ React13.createElement(IconBase, {
1161
- ref,
1162
- ...props,
1163
- weights
1164
- }));
1165
- Issue.displayName = "Issue";
1166
-
1167
- // packages/plugins/experimental/plugin-github/src/components/MarkdownActions.tsx
1168
- import { ArrowSquareOut as ArrowSquareOut3, FileArrowDown, FileArrowUp, Link as Link2, LinkBreak } from "@phosphor-icons/react";
1169
- import React14, { useCallback as useCallback5 } from "react";
1170
- import { LayoutAction, useIntent as useIntent2 } from "@dxos/app-framework";
1171
- import { log as log6 } from "@dxos/log";
1172
- import { getMeta as getMeta2 } from "@dxos/react-client/echo";
1173
- import { DropdownMenu as DropdownMenu2, useTranslation as useTranslation10 } from "@dxos/react-ui";
1174
- import { getSize as getSize4 } from "@dxos/react-ui-theme";
1175
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/components/MarkdownActions.tsx";
1176
- var MarkdownActions = ({ content, properties }) => {
1177
- const ghId = getMeta2(properties)?.keys?.find((key) => key.source === "github.com")?.id;
1178
- const { octokit } = useOctokitContext();
1179
- const { t } = useTranslation10(GITHUB_PLUGIN);
1180
- const { dispatch } = useIntent2();
1181
- const docGhId = useDocGhId(properties.__meta?.keys ?? []);
1182
- const updateIssueContent = useCallback5(() => {
1183
- const { owner, repo, issueNumber } = docGhId;
1184
- return octokit.rest.issues.update({
1185
- owner,
1186
- repo,
1187
- issue_number: issueNumber,
1188
- body: content
1189
- });
1190
- }, [
1191
- octokit,
1192
- docGhId,
1193
- content
1194
- ]);
1195
- const exportGhIssueContent = useCallback5(async () => {
1196
- if (octokit && docGhId && "issueNumber" in docGhId && content) {
1197
- try {
1198
- const { data: { html_url: issueUrl } } = await updateIssueContent();
1199
- await dispatch({
1200
- action: LayoutAction.SET_LAYOUT,
1201
- data: {
1202
- element: "dialog",
1203
- component: "dxos.org/plugin/github/ExportDialog",
1204
- subject: {
1205
- type: "response",
1206
- target: issueUrl,
1207
- docGhId,
1208
- content
1209
- }
1210
- }
1211
- });
1212
- } catch (err) {
1213
- log6.error("Failed to export to Github issue", void 0, {
1214
- F: __dxlog_file5,
1215
- L: 56,
1216
- S: void 0,
1217
- C: (f, a) => f(...a)
1218
- });
1219
- }
1220
- } else {
1221
- log6.error("Not prepared to export to Github issue when requested.", void 0, {
1222
- F: __dxlog_file5,
1223
- L: 59,
1224
- S: void 0,
1225
- C: (f, a) => f(...a)
1226
- });
1227
- }
1228
- }, [
1229
- octokit,
1230
- docGhId,
1231
- content
1232
- ]);
1233
- const handleGhExport = useCallback5(() => {
1234
- if ("issueNumber" in docGhId) {
1235
- void exportGhIssueContent();
1236
- } else if ("path" in docGhId) {
1237
- void dispatch({
1238
- action: LayoutAction.SET_LAYOUT,
1239
- data: {
1240
- element: "dialog",
1241
- component: "dxos.org/plugin/github/ExportDialog",
1242
- subject: {
1243
- type: "create-pr",
1244
- content,
1245
- docGhId
1246
- }
1247
- }
1248
- });
1249
- }
1250
- }, [
1251
- exportGhIssueContent,
1252
- docGhId
1253
- ]);
1254
- return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(DropdownMenu2.GroupLabel, null, t("markdown actions label")), docGhId ? /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
1255
- classNames: "gap-2",
1256
- disabled: !docGhId,
1257
- onClick: () => (
1258
- // TODO(burdon): Intent should return content value from dialog.
1259
- dispatch({
1260
- action: LayoutAction.SET_LAYOUT,
1261
- data: {
1262
- element: "dialog",
1263
- component: "dxos.org/plugin/github/ImportDialog",
1264
- subject: {
1265
- docGhId
1266
- }
1267
- }
1268
- })
1269
- )
1270
- }, /* @__PURE__ */ React14.createElement(FileArrowDown, {
1271
- className: getSize4(4)
1272
- }), /* @__PURE__ */ React14.createElement("span", {
1273
- className: "grow"
1274
- }, t("import from github label"))), /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
1275
- classNames: "gap-2",
1276
- disabled: !docGhId,
1277
- onClick: () => docGhId && handleGhExport()
1278
- }, /* @__PURE__ */ React14.createElement(FileArrowUp, {
1279
- className: getSize4(4)
1280
- }), /* @__PURE__ */ React14.createElement("span", {
1281
- className: "grow"
1282
- }, t("export to github label"))), /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
1283
- asChild: true,
1284
- classNames: "gap-2",
1285
- disabled: !ghId
1286
- }, /* @__PURE__ */ React14.createElement("a", ghId ? {
1287
- href: `https://github.com/${ghId}`,
1288
- target: "_blank",
1289
- rel: "noreferrer"
1290
- } : {
1291
- href: "#"
1292
- }, /* @__PURE__ */ React14.createElement(ArrowSquareOut3, {
1293
- className: getSize4(4)
1294
- }), /* @__PURE__ */ React14.createElement("span", {
1295
- className: "grow"
1296
- }, t("open in github label")))), /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
1297
- classNames: "gap-2",
1298
- onClick: () => {
1299
- const index = getMeta2(properties)?.keys?.findIndex((key) => key.source === "github.com");
1300
- typeof index !== "undefined" && index >= 0 && properties.__meta?.keys?.splice(index, 1);
1301
- }
1302
- }, /* @__PURE__ */ React14.createElement(LinkBreak, {
1303
- className: getSize4(4)
1304
- }), /* @__PURE__ */ React14.createElement("span", {
1305
- className: "grow"
1306
- }, t("unbind to file in github label")))) : /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
1307
- classNames: "gap-2",
1308
- onClick: () => dispatch({
1309
- action: LayoutAction.SET_LAYOUT,
1310
- data: {
1311
- element: "dialog",
1312
- component: "dxos.org/plugin/github/BindDialog",
1313
- subject: properties
1314
- }
1315
- })
1316
- }, /* @__PURE__ */ React14.createElement(Link2, {
1317
- className: getSize4(4)
1318
- }), /* @__PURE__ */ React14.createElement("span", {
1319
- className: "grow"
1320
- }, t("bind to file in github label"))));
1321
- };
1322
-
1323
- // packages/plugins/experimental/plugin-github/src/components/UrlDialog.tsx
1324
- import React15, { useState as useState8 } from "react";
1325
- import { Dialog as Dialog5, Button as Button7, useTranslation as useTranslation11, Input as Input3 } from "@dxos/react-ui";
1326
- var UrlDialog = ({ properties }) => {
1327
- const { t } = useTranslation11(GITHUB_PLUGIN);
1328
- const [ghUrlValue, setGhUrlValue] = useState8("");
1329
- const ghId = useGhIdFromUrl(ghUrlValue);
1330
- return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(Dialog5.Title, {
1331
- classNames: "mbe-2"
1332
- }, t("bind to file in github label")), /* @__PURE__ */ React15.createElement(Input3.Root, {
1333
- validationValence: "error"
1334
- }, /* @__PURE__ */ React15.createElement(Input3.Label, null, t("paste url to file in github label")), /* @__PURE__ */ React15.createElement(Input3.TextInput, {
1335
- placeholder: t("paste url to file in github placeholder"),
1336
- value: ghUrlValue,
1337
- onChange: ({ target: { value } }) => setGhUrlValue(value)
1338
- }), /* @__PURE__ */ React15.createElement(Input3.DescriptionAndValidation, null, ghUrlValue.length > 0 && !ghId && /* @__PURE__ */ React15.createElement(Input3.Validation, null, t("error github markdown path message")), /* @__PURE__ */ React15.createElement(Input3.Description, null, t("paste url to file in github description")))), /* @__PURE__ */ React15.createElement("div", {
1339
- role: "none",
1340
- className: "flex justify-end gap-2"
1341
- }, /* @__PURE__ */ React15.createElement(Dialog5.Close, {
1342
- asChild: true
1343
- }, /* @__PURE__ */ React15.createElement(Button7, {
1344
- classNames: "mbs-2",
1345
- onClick: () => {
1346
- if (ghId && document) {
1347
- properties.__meta.keys.push({
1348
- source: "github.com",
1349
- id: ghId
1350
- });
1351
- }
1352
- }
1353
- }, t("done label", {
1354
- ns: "os"
1355
- })))));
1356
- };
1357
-
1358
- // packages/plugins/experimental/plugin-github/src/translations.ts
1359
- var translations_default = [
1360
- {
1361
- "en-US": {
1362
- [GITHUB_PLUGIN]: {
1363
- "plugin name": "GitHub",
1364
- "markdown actions label": "GitHub actions",
1365
- "unbind to file in github label": "Disconnect from\xA0GitHub",
1366
- "bind to file in github label": "Connect to issue or file in\xA0GitHub",
1367
- "github pat label": "GitHub personal access\xA0token:",
1368
- "github pat description": "Composer needs this in order to communicate with GitHub. <docsLink>GitHub\u2019s documentation describes how to create a token.</docsLink> Composer only needs write access to issues, contents, and pull\xA0requests.",
1369
- "github pat description href": "https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens",
1370
- "empty github pat message": "Set a GitHub personal access token to\xA0continue.",
1371
- "set github pat label": "Set GitHub token",
1372
- "error github pat message": "There was a problem authenticating with GitHub using the personal access token\xA0provided.",
1373
- "error github markdown path message": "This is not a valid path to a Markdown file or Issue in\xA0GitHub.",
1374
- "paste url to file in github label": "Paste the URL to the Issue or Markdown file in\xA0GitHub.",
1375
- "paste url to file in github description": "Navigate to the issue or file in GitHub, then copy the URL in your browser and paste it\xA0here.",
1376
- "paste url to file in github placeholder": "https://github.com/owner/repo/blob/main/path/to/README.md",
1377
- "confirm export title": "Export to GitHub",
1378
- "export to github success message": "<resultStyle>Success!</resultStyle> Your changes are now live here: <prLink>{{linkText}}</prLink>",
1379
- "github branch name label": "Name of the branch to\xA0create",
1380
- "github branch name placeholder": "update-readme",
1381
- "github commit message label": "Commit message",
1382
- "github commit message placeholder": "Updated README.md",
1383
- "save and close description": "Save changes to GitHub and close the\xA0editor",
1384
- "close embed description": "Close the editor without saving changes to GitHub. Your changes will still persist in\xA0Composer.",
1385
- "resolver init document message": "Syncing this document, one\xA0moment\u2026",
1386
- "comment stale title": "No longer in-sync",
1387
- "comment stale body": "The document in GitHub was updated in another session. To re-sync, please save your changes, reload the page, and choose to edit from GitHub\xA0again.",
1388
- "open in github label": "Open in GitHub",
1389
- "stale rescue title": "Set a personal access\xA0token",
1390
- "stale rescue description": "Another user has recently updated this issue, so GitHub won\u2019t accept your changes unless you set a personal access token (a PAT) here, or refresh the\xA0page.",
1391
- "embedded options label": "Options",
1392
- "unset repo space label": "Select a different space for this\xA0repository",
1393
- "loading preview message": "Loading preview\u2026",
1394
- "preview gfm label": "Preview Markdown",
1395
- "exit gfm preview label": "Exit preview",
1396
- "save and close label": "Save & close",
1397
- "export to github label": "Export to GitHub",
1398
- "import from github label": "Import from GitHub",
1399
- "resolver tree label": "Choose a Space",
1400
- "resolver tree description": "To collaborate on documents in this repository, choose the Space that will store and control access to the documents.",
1401
- "resolver no spaces message": "You aren\u2019t in any spaces yet",
1402
- "resolver create space label": "Create a space for this repository",
1403
- "bound members message_one": "One member uses this space for this repository",
1404
- "bound members message_other": "{{count}} members use this space for this repository",
1405
- "select label": "Select",
1406
- "selected label": "Selected",
1407
- "open in composer label": "Open in Composer",
1408
- "confirm import title": "Overwrite this document\u2019s content?",
1409
- "confirm import body": "Importing will overwrite this document\u2019s content. If you\u2019d rather import into a new document, first create a new document and then import into it.",
1410
- "target blank description": "Link opens in a new tab."
1411
- }
1412
- }
1413
- }
1414
- ];
1415
-
1416
- // packages/plugins/experimental/plugin-github/src/GithubPlugin.tsx
1417
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/GithubPlugin.tsx";
1418
- var GithubPlugin = () => {
1419
- const settings = new LocalStorageStore(GITHUB_PLUGIN);
1420
- return {
1421
- meta: meta_default,
1422
- ready: async () => {
1423
- settings.prop({
1424
- key: "pat",
1425
- type: LocalStorageStore.string({
1426
- allowUndefined: true
1427
- })
1428
- });
1429
- },
1430
- unload: async () => {
1431
- settings.close();
1432
- },
1433
- provides: {
1434
- settings: settings.values,
1435
- translations: translations_default,
1436
- graph: {
1437
- builder: (plugins) => {
1438
- const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
1439
- if (!client) {
1440
- return [];
1441
- }
1442
- return createExtension({
1443
- id: GITHUB_PLUGIN,
1444
- filter: (node) => isSpace(node.data),
1445
- connector: ({ node }) => {
1446
- const documents = memoizeQuery(node.data, Filter3.schema(DocumentType3, (doc) => getMeta3(doc)?.keys?.find((key) => key?.source?.includes("github"))));
1447
- if (documents.length > 0) {
1448
- return [
1449
- {
1450
- id: `${GITHUB_PLUGIN_SHORT_ID}:${node.id}`,
1451
- data: GITHUB_PLUGIN_SHORT_ID,
1452
- type: GITHUB_PLUGIN,
1453
- properties: {
1454
- label: [
1455
- "plugin name",
1456
- {
1457
- ns: GITHUB_PLUGIN
1458
- }
1459
- ],
1460
- icon: "ph--github-logo--regular"
1461
- }
1462
- }
1463
- ];
1464
- }
1465
- }
1466
- });
1467
- }
1468
- },
1469
- context: (props) => /* @__PURE__ */ React16.createElement(OctokitProvider, {
1470
- pat: settings.values.pat,
1471
- onPatChanged: (pat) => settings.values.pat = pat,
1472
- ...props
1473
- }),
1474
- surface: {
1475
- component: ({ data, role }) => {
1476
- switch (data.component) {
1477
- case `${GITHUB_PLUGIN}/embedded`:
1478
- return /* @__PURE__ */ React16.createElement(EmbeddedMain, null);
1479
- }
1480
- switch (role) {
1481
- case "dialog":
1482
- switch (data.content) {
1483
- case "dxos.org/plugin/github/BindDialog":
1484
- return isMarkdownProperties(data.properties) ? /* @__PURE__ */ React16.createElement(UrlDialog, {
1485
- properties: data.properties
1486
- }) : null;
1487
- // TODO(burdon): Model should not be passed via surfaces.
1488
- // return isEditorModel(data.model) ? (
1489
- // <ExportDialog
1490
- // model={data.model}
1491
- // type={data.type as ExportViewState}
1492
- // target={data.target as string | null}
1493
- // docGhId={data.docGhId as GhIdentifier}
1494
- // />
1495
- // ) : null;
1496
- case "dxos.org/plugin/github/ExportDialog":
1497
- return null;
1498
- case "dxos.org/plugin/github/ImportDialog":
1499
- return /* @__PURE__ */ React16.createElement(ImportDialog, {
1500
- docGhId: data.docGhId,
1501
- onUpdate: (content) => {
1502
- log7.info("onUpdate", content, {
1503
- F: __dxlog_file6,
1504
- L: 105,
1505
- S: void 0,
1506
- C: (f, a) => f(...a)
1507
- });
1508
- }
1509
- });
1510
- default:
1511
- return null;
1512
- }
1513
- case "menuitem":
1514
- return typeof data.content === "string" && isMarkdownProperties(data.properties) && !data.properties.readonly ? /* @__PURE__ */ React16.createElement(MarkdownActions, {
1515
- content: data.content,
1516
- properties: data.properties
1517
- }) : null;
1518
- case "settings":
1519
- return data.plugin === meta_default.id ? /* @__PURE__ */ React16.createElement(GitHubSettings, null) : null;
1520
- default:
1521
- return null;
1522
- }
1523
- }
1524
- }
1525
- }
1526
- };
1527
- };
1528
-
1529
- // packages/plugins/experimental/plugin-github/src/index.ts
1530
- var src_default = GithubPlugin;
1531
- export {
1532
- GithubPlugin,
1533
- src_default as default
1534
- };
1535
- //# sourceMappingURL=index.mjs.map