@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.
- package/LICENSE +102 -5
- package/PLUGIN.mdl +784 -0
- package/dist/lib/GitHubCapabilities.mjs +10 -0
- package/dist/lib/GitHubCapabilities.mjs.map +1 -0
- package/dist/lib/GitHubEvents.mjs +15 -0
- package/dist/lib/GitHubEvents.mjs.map +1 -0
- package/dist/lib/GitHubOperation.mjs +384 -0
- package/dist/lib/GitHubOperation.mjs.map +1 -0
- package/dist/lib/GitHubPlugin.mjs +16 -0
- package/dist/lib/GitHubPlugin.mjs.map +1 -0
- package/dist/lib/Walkthrough.mjs +59 -0
- package/dist/lib/Walkthrough.mjs.map +1 -0
- package/dist/lib/capabilities.browser.mjs +54 -0
- package/dist/lib/capabilities.browser.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +54 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/capabilities.node.mjs +30 -0
- package/dist/lib/capabilities.node.mjs.map +1 -0
- package/dist/lib/capabilities.tauri.mjs +54 -0
- package/dist/lib/capabilities.tauri.mjs.map +1 -0
- package/dist/lib/capabilities.workerd.mjs +30 -0
- package/dist/lib/capabilities.workerd.mjs.map +1 -0
- package/dist/lib/chunk-ImportPullRequestDialog.mjs +116 -0
- package/dist/lib/chunk-ImportPullRequestDialog.mjs.map +1 -0
- package/dist/lib/chunk-PLUGIN.mjs +6 -0
- package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestArticle.mjs +1506 -0
- package/dist/lib/chunk-PullRequestArticle.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestArticle2.mjs +2 -0
- package/dist/lib/chunk-PullRequestCardMenu.mjs +123 -0
- package/dist/lib/chunk-PullRequestCardMenu.mjs.map +1 -0
- package/dist/lib/chunk-PullRequestsArticle.mjs +594 -0
- package/dist/lib/chunk-PullRequestsArticle.mjs.map +1 -0
- package/dist/lib/chunk-WalkthroughArticle.mjs +26 -0
- package/dist/lib/chunk-WalkthroughArticle.mjs.map +1 -0
- package/dist/lib/chunk-add-pull-request-comment.mjs +19 -0
- package/dist/lib/chunk-add-pull-request-comment.mjs.map +1 -0
- package/dist/lib/chunk-add-pull-request-review-comment.mjs +25 -0
- package/dist/lib/chunk-add-pull-request-review-comment.mjs.map +1 -0
- package/dist/lib/chunk-app-graph-builder.mjs +39 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
- package/dist/lib/chunk-connector.mjs +70 -0
- package/dist/lib/chunk-connector.mjs.map +1 -0
- package/dist/lib/chunk-constants.mjs +11 -0
- package/dist/lib/chunk-constants.mjs.map +1 -0
- package/dist/lib/chunk-errors.mjs +29 -0
- package/dist/lib/chunk-errors.mjs.map +1 -0
- package/dist/lib/chunk-generate-walkthrough.mjs +86 -0
- package/dist/lib/chunk-generate-walkthrough.mjs.map +1 -0
- package/dist/lib/chunk-generate.mjs +719 -0
- package/dist/lib/chunk-generate.mjs.map +1 -0
- package/dist/lib/chunk-get-pull-request-diff.mjs +25 -0
- package/dist/lib/chunk-get-pull-request-diff.mjs.map +1 -0
- package/dist/lib/chunk-get-pull-request-status.mjs +29 -0
- package/dist/lib/chunk-get-pull-request-status.mjs.map +1 -0
- package/dist/lib/chunk-get-repositories.mjs +32 -0
- package/dist/lib/chunk-get-repositories.mjs.map +1 -0
- package/dist/lib/chunk-github-api.mjs +375 -0
- package/dist/lib/chunk-github-api.mjs.map +1 -0
- package/dist/lib/chunk-github-link.mjs +59 -0
- package/dist/lib/chunk-github-link.mjs.map +1 -0
- package/dist/lib/chunk-import-pull-request-from-snapshot.mjs +25 -0
- package/dist/lib/chunk-import-pull-request-from-snapshot.mjs.map +1 -0
- package/dist/lib/chunk-import-pull-request.mjs +171 -0
- package/dist/lib/chunk-import-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-link-resolver.mjs +109 -0
- package/dist/lib/chunk-link-resolver.mjs.map +1 -0
- package/dist/lib/chunk-markdown-extension.mjs +92 -0
- package/dist/lib/chunk-markdown-extension.mjs.map +1 -0
- package/dist/lib/chunk-materialize-target.mjs +36 -0
- package/dist/lib/chunk-materialize-target.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +12 -0
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-page-action.mjs +22 -0
- package/dist/lib/chunk-page-action.mjs.map +1 -0
- package/dist/lib/chunk-pull-request.mjs +58 -0
- package/dist/lib/chunk-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-pull-request2.mjs +110 -0
- package/dist/lib/chunk-pull-request2.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +233 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-refresh-pull-requests.mjs +49 -0
- package/dist/lib/chunk-refresh-pull-requests.mjs.map +1 -0
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/chunk-schema.mjs +15 -0
- package/dist/lib/chunk-schema.mjs.map +1 -0
- package/dist/lib/chunk-skill-definition.mjs +10 -0
- package/dist/lib/chunk-skill-definition.mjs.map +1 -0
- package/dist/lib/chunk-submit-pull-request-approval.mjs +56 -0
- package/dist/lib/chunk-submit-pull-request-approval.mjs.map +1 -0
- package/dist/lib/chunk-sync-pull-request.mjs +26 -0
- package/dist/lib/chunk-sync-pull-request.mjs.map +1 -0
- package/dist/lib/chunk-sync.mjs +481 -0
- package/dist/lib/chunk-sync.mjs.map +1 -0
- package/dist/lib/chunk-useOpenObject.mjs +43 -0
- package/dist/lib/chunk-useOpenObject.mjs.map +1 -0
- package/dist/lib/extensions.mjs +132 -0
- package/dist/lib/extensions.mjs.map +1 -0
- package/dist/lib/index.mjs +4 -0
- package/dist/lib/meta.mjs +47 -0
- package/dist/lib/meta.mjs.map +1 -0
- package/dist/lib/ns/Extensions.mjs +18 -0
- package/dist/lib/ns/Extensions.mjs.map +1 -0
- package/dist/lib/operations.mjs +23 -0
- package/dist/lib/operations.mjs.map +1 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/skills.mjs +44 -0
- package/dist/lib/skills.mjs.map +1 -0
- package/dist/lib/testing.mjs +189 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/lib/translations.mjs +136 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +5 -0
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/Extensions.d.ts +2 -0
- package/dist/types/src/Extensions.d.ts.map +1 -0
- package/dist/types/src/GitHubPlugin.d.ts +37 -0
- package/dist/types/src/GitHubPlugin.d.ts.map +1 -0
- package/dist/types/src/GitHubPlugin.workerd.test.d.ts +2 -0
- package/dist/types/src/GitHubPlugin.workerd.test.d.ts.map +1 -0
- package/dist/types/src/approval.d.ts +21 -0
- package/dist/types/src/approval.d.ts.map +1 -0
- package/dist/types/src/approval.test.d.ts +2 -0
- package/dist/types/src/approval.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +9 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/connector.d.ts +17 -0
- package/dist/types/src/capabilities/connector.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/browser.d.ts +13 -0
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/node.d.ts +13 -0
- package/dist/types/src/capabilities/gen/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts +13 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts +13 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +13 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/link-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/link-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown-extension.d.ts +14 -0
- package/dist/types/src/capabilities/markdown-extension.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +5 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/page-action.d.ts +5 -0
- package/dist/types/src/capabilities/page-action.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema.d.ts +12 -0
- package/dist/types/src/capabilities/schema.d.ts.map +1 -0
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/cards/GitHubCard.d.ts +11 -0
- package/dist/types/src/cards/GitHubCard.d.ts.map +1 -0
- package/dist/types/src/cards/GitHubCard.stories.d.ts +45 -0
- package/dist/types/src/cards/GitHubCard.stories.d.ts.map +1 -0
- package/dist/types/src/cards/PullRequestCard.d.ts +9 -0
- package/dist/types/src/cards/PullRequestCard.d.ts.map +1 -0
- package/dist/types/src/cards/index.d.ts +3 -0
- package/dist/types/src/cards/index.d.ts.map +1 -0
- package/dist/types/src/components/CommentComposer/CommentComposer.d.ts +30 -0
- package/dist/types/src/components/CommentComposer/CommentComposer.d.ts.map +1 -0
- package/dist/types/src/components/CommentComposer/index.d.ts +2 -0
- package/dist/types/src/components/CommentComposer/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts +8 -0
- package/dist/types/src/components/PullRequestFiles/DiffStat.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/FileTree.d.ts +17 -0
- package/dist/types/src/components/PullRequestFiles/FileTree.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts +23 -0
- package/dist/types/src/components/PullRequestFiles/PullRequestFiles.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/files.d.ts +39 -0
- package/dist/types/src/components/PullRequestFiles/files.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/files.test.d.ts +2 -0
- package/dist/types/src/components/PullRequestFiles/files.test.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestFiles/index.d.ts +5 -0
- package/dist/types/src/components/PullRequestFiles/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts +21 -0
- package/dist/types/src/components/PullRequestOverview/ArtifactPill.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts +18 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts +2 -0
- package/dist/types/src/components/PullRequestOverview/CheckRunList.test.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts +10 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestDetails.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts +16 -0
- package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts +28 -0
- package/dist/types/src/components/PullRequestOverview/RelatedCards.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestOverview/index.d.ts +6 -0
- package/dist/types/src/components/PullRequestOverview/index.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts +20 -0
- package/dist/types/src/components/PullRequestStatus/PullRequestStatus.d.ts.map +1 -0
- package/dist/types/src/components/PullRequestStatus/index.d.ts +2 -0
- package/dist/types/src/components/PullRequestStatus/index.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts +18 -0
- package/dist/types/src/components/WalkthroughView/WalkthroughView.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/extensions.d.ts +16 -0
- package/dist/types/src/components/WalkthroughView/extensions.d.ts.map +1 -0
- package/dist/types/src/components/WalkthroughView/index.d.ts +3 -0
- package/dist/types/src/components/WalkthroughView/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +5 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +7 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts +6 -0
- package/dist/types/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ImportPullRequestDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts +15 -0
- package/dist/types/src/containers/PullRequestArticle/PullRequestArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/failure.d.ts +10 -0
- package/dist/types/src/containers/PullRequestArticle/failure.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts +2 -0
- package/dist/types/src/containers/PullRequestArticle/failure.test.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts +14 -0
- package/dist/types/src/containers/PullRequestCardMenu/PullRequestCardMenu.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestCardMenu/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestCardMenu/index.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts +13 -0
- package/dist/types/src/containers/PullRequestsArticle/PullRequestsArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts +44 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts +2 -0
- package/dist/types/src/containers/PullRequestsArticle/arrange.test.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/format.d.ts +3 -0
- package/dist/types/src/containers/PullRequestsArticle/format.d.ts.map +1 -0
- package/dist/types/src/containers/PullRequestsArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PullRequestsArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts +13 -0
- package/dist/types/src/containers/WalkthroughArticle/WalkthroughArticle.d.ts.map +1 -0
- package/dist/types/src/containers/WalkthroughArticle/index.d.ts +2 -0
- package/dist/types/src/containers/WalkthroughArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +157 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +3 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/links.d.ts +21 -0
- package/dist/types/src/extensions/links.d.ts.map +1 -0
- package/dist/types/src/extensions/links.test.d.ts +2 -0
- package/dist/types/src/extensions/links.test.d.ts.map +1 -0
- package/dist/types/src/extensions/references.d.ts +23 -0
- package/dist/types/src/extensions/references.d.ts.map +1 -0
- package/dist/types/src/extensions/references.test.d.ts +2 -0
- package/dist/types/src/extensions/references.test.d.ts.map +1 -0
- package/dist/types/src/github-link.d.ts +29 -0
- package/dist/types/src/github-link.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useOpenObject.d.ts +9 -0
- package/dist/types/src/hooks/useOpenObject.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestChecks.d.ts +10 -0
- package/dist/types/src/hooks/usePullRequestChecks.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestDiff.d.ts +12 -0
- package/dist/types/src/hooks/usePullRequestDiff.d.ts.map +1 -0
- package/dist/types/src/hooks/usePullRequestFiles.d.ts +22 -0
- package/dist/types/src/hooks/usePullRequestFiles.d.ts.map +1 -0
- package/dist/types/src/hooks/useSyncPullRequest.d.ts +10 -0
- package/dist/types/src/hooks/useSyncPullRequest.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +34 -11
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/add-pull-request-comment.d.ts +5 -0
- package/dist/types/src/operations/add-pull-request-comment.d.ts.map +1 -0
- package/dist/types/src/operations/add-pull-request-review-comment.d.ts +5 -0
- package/dist/types/src/operations/add-pull-request-review-comment.d.ts.map +1 -0
- package/dist/types/src/operations/generate-walkthrough.d.ts +11 -0
- package/dist/types/src/operations/generate-walkthrough.d.ts.map +1 -0
- package/dist/types/src/operations/get-pull-request-diff.d.ts +5 -0
- package/dist/types/src/operations/get-pull-request-diff.d.ts.map +1 -0
- package/dist/types/src/operations/get-pull-request-status.d.ts +5 -0
- package/dist/types/src/operations/get-pull-request-status.d.ts.map +1 -0
- package/dist/types/src/operations/get-repositories.d.ts +13 -0
- package/dist/types/src/operations/get-repositories.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts +12 -0
- package/dist/types/src/operations/import-pull-request-from-snapshot.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request.d.ts +63 -0
- package/dist/types/src/operations/import-pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/import-pull-request.test.d.ts +2 -0
- package/dist/types/src/operations/import-pull-request.test.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/materialize-target.d.ts +12 -0
- package/dist/types/src/operations/materialize-target.d.ts.map +1 -0
- package/dist/types/src/operations/pull-request.d.ts +48 -0
- package/dist/types/src/operations/pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/pull-request.test.d.ts +2 -0
- package/dist/types/src/operations/pull-request.test.d.ts.map +1 -0
- package/dist/types/src/operations/refresh-pull-requests.d.ts +5 -0
- package/dist/types/src/operations/refresh-pull-requests.d.ts.map +1 -0
- package/dist/types/src/operations/refresh.d.ts +37 -0
- package/dist/types/src/operations/refresh.d.ts.map +1 -0
- package/dist/types/src/operations/refresh.test.d.ts +2 -0
- package/dist/types/src/operations/refresh.test.d.ts.map +1 -0
- package/dist/types/src/operations/submit-pull-request-approval.d.ts +5 -0
- package/dist/types/src/operations/submit-pull-request-approval.d.ts.map +1 -0
- package/dist/types/src/operations/sync-pull-request.d.ts +5 -0
- package/dist/types/src/operations/sync-pull-request.d.ts.map +1 -0
- package/dist/types/src/operations/sync.d.ts +123 -0
- package/dist/types/src/operations/sync.d.ts.map +1 -0
- package/dist/types/src/operations/sync.test.d.ts +2 -0
- package/dist/types/src/operations/sync.test.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/plugin.test.d.ts +2 -0
- package/dist/types/src/plugin.test.d.ts.map +1 -0
- package/dist/types/src/pull-request-body.d.ts +37 -0
- package/dist/types/src/pull-request-body.d.ts.map +1 -0
- package/dist/types/src/pull-request-body.test.d.ts +2 -0
- package/dist/types/src/pull-request-body.test.d.ts.map +1 -0
- package/dist/types/src/pull-request.d.ts +28 -0
- package/dist/types/src/pull-request.d.ts.map +1 -0
- package/dist/types/src/pull-request.test.d.ts +2 -0
- package/dist/types/src/pull-request.test.d.ts.map +1 -0
- package/dist/types/src/services/github-api.d.ts +332 -0
- package/dist/types/src/services/github-api.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +2 -0
- package/dist/types/src/services/index.d.ts.map +1 -0
- package/dist/types/src/skills/GitHubSkill.d.ts +12 -0
- package/dist/types/src/skills/GitHubSkill.d.ts.map +1 -0
- package/dist/types/src/skills/index.d.ts +2 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/stories/Generate.stories.d.ts +27 -0
- package/dist/types/src/stories/Generate.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Links.stories.d.ts +23 -0
- package/dist/types/src/stories/Links.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestArticle.stories.d.ts +359 -0
- package/dist/types/src/stories/PullRequestArticle.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestFiles.stories.d.ts +365 -0
- package/dist/types/src/stories/PullRequestFiles.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts +367 -0
- package/dist/types/src/stories/PullRequestOverview.stories.d.ts.map +1 -0
- package/dist/types/src/stories/PullRequestsArticle.stories.d.ts +357 -0
- package/dist/types/src/stories/PullRequestsArticle.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Walkthrough.stories.d.ts +380 -0
- package/dist/types/src/stories/Walkthrough.stories.d.ts.map +1 -0
- package/dist/types/src/stories/github.d.ts +23 -0
- package/dist/types/src/stories/github.d.ts.map +1 -0
- package/dist/types/src/stories/github.test.d.ts +2 -0
- package/dist/types/src/stories/github.test.d.ts.map +1 -0
- package/dist/types/src/stories/walkthrough-fixture.d.ts +8 -0
- package/dist/types/src/stories/walkthrough-fixture.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures.d.ts +14 -0
- package/dist/types/src/testing/fixtures.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +4 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/plugin.d.ts +4 -0
- package/dist/types/src/testing/plugin.d.ts.map +1 -0
- package/dist/types/src/testing/pull-request-13348.d.ts +6 -0
- package/dist/types/src/testing/pull-request-13348.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +339 -53
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/GitHubCapabilities.d.ts +13 -0
- package/dist/types/src/types/GitHubCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/GitHubEvents.d.ts +8 -0
- package/dist/types/src/types/GitHubEvents.d.ts.map +1 -0
- package/dist/types/src/types/GitHubOperation.d.ts +281 -0
- package/dist/types/src/types/GitHubOperation.d.ts.map +1 -0
- package/dist/types/src/types/PullRequestsView.d.ts +35 -0
- package/dist/types/src/types/PullRequestsView.d.ts.map +1 -0
- package/dist/types/src/types/Walkthrough.d.ts +31 -0
- package/dist/types/src/types/Walkthrough.d.ts.map +1 -0
- package/dist/types/src/types/Walkthrough.test.d.ts +2 -0
- package/dist/types/src/types/Walkthrough.test.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/walkthrough/fill.d.ts +28 -0
- package/dist/types/src/walkthrough/fill.d.ts.map +1 -0
- package/dist/types/src/walkthrough/fill.test.d.ts +2 -0
- package/dist/types/src/walkthrough/fill.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generate.d.ts +67 -0
- package/dist/types/src/walkthrough/generate.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generate.test.d.ts +2 -0
- package/dist/types/src/walkthrough/generate.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generated.d.ts +20 -0
- package/dist/types/src/walkthrough/generated.d.ts.map +1 -0
- package/dist/types/src/walkthrough/generated.test.d.ts +2 -0
- package/dist/types/src/walkthrough/generated.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/headings.d.ts +8 -0
- package/dist/types/src/walkthrough/headings.d.ts.map +1 -0
- package/dist/types/src/walkthrough/headings.test.d.ts +2 -0
- package/dist/types/src/walkthrough/headings.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/index.d.ts +9 -0
- package/dist/types/src/walkthrough/index.d.ts.map +1 -0
- package/dist/types/src/walkthrough/patch.d.ts +48 -0
- package/dist/types/src/walkthrough/patch.d.ts.map +1 -0
- package/dist/types/src/walkthrough/plan.d.ts +55 -0
- package/dist/types/src/walkthrough/plan.d.ts.map +1 -0
- package/dist/types/src/walkthrough/plan.test.d.ts +2 -0
- package/dist/types/src/walkthrough/plan.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/prompt.d.ts +33 -0
- package/dist/types/src/walkthrough/prompt.d.ts.map +1 -0
- package/dist/types/src/walkthrough/prompt.test.d.ts +2 -0
- package/dist/types/src/walkthrough/prompt.test.d.ts.map +1 -0
- package/dist/types/src/walkthrough/score.d.ts +43 -0
- package/dist/types/src/walkthrough/score.d.ts.map +1 -0
- package/dist/types/src/walkthrough/score.test.d.ts +2 -0
- package/dist/types/src/walkthrough/score.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dx.config.ts +39 -0
- package/package.json +167 -48
- package/src/Extensions.ts +7 -0
- package/src/GitHubPlugin.ts +15 -0
- package/src/GitHubPlugin.workerd.test.ts +23 -0
- package/src/approval.test.ts +40 -0
- package/src/approval.ts +39 -0
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/connector.ts +95 -0
- package/src/capabilities/gen/browser.ts +82 -0
- package/src/capabilities/gen/node.ts +43 -0
- package/src/capabilities/gen/tauri.ts +82 -0
- package/src/capabilities/gen/workerd.ts +43 -0
- package/src/capabilities/index.ts +71 -0
- package/src/capabilities/link-resolver.ts +137 -0
- package/src/capabilities/markdown-extension.ts +146 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/page-action.ts +32 -0
- package/src/capabilities/react-surface.ts +98 -0
- package/src/capabilities/schema.ts +16 -0
- package/src/capabilities/skill-definition.ts +14 -0
- package/src/cards/GitHubCard.stories.tsx +165 -0
- package/src/cards/GitHubCard.tsx +93 -0
- package/src/cards/PullRequestCard.tsx +23 -0
- package/src/cards/index.ts +6 -0
- package/src/components/CommentComposer/CommentComposer.tsx +109 -0
- package/src/components/CommentComposer/index.ts +5 -0
- package/src/components/PullRequestFiles/DiffStat.tsx +15 -0
- package/src/components/PullRequestFiles/FileTree.tsx +102 -0
- package/src/components/PullRequestFiles/PullRequestFiles.tsx +87 -0
- package/src/components/PullRequestFiles/files.test.ts +59 -0
- package/src/components/PullRequestFiles/files.ts +115 -0
- package/src/components/PullRequestFiles/index.ts +8 -0
- package/src/components/PullRequestOverview/ArtifactPill.tsx +82 -0
- package/src/components/PullRequestOverview/CheckRunList.test.ts +29 -0
- package/src/components/PullRequestOverview/CheckRunList.tsx +141 -0
- package/src/components/PullRequestOverview/PullRequestDetails.tsx +15 -0
- package/src/components/PullRequestOverview/PullRequestOverview.tsx +110 -0
- package/src/components/PullRequestOverview/RelatedCards.tsx +147 -0
- package/src/components/PullRequestOverview/index.ts +9 -0
- package/src/components/PullRequestStatus/PullRequestStatus.tsx +84 -0
- package/src/components/PullRequestStatus/index.ts +5 -0
- package/src/components/WalkthroughView/WalkthroughView.tsx +62 -0
- package/src/components/WalkthroughView/extensions.ts +53 -0
- package/src/components/WalkthroughView/index.ts +6 -0
- package/src/components/index.ts +6 -9
- package/src/constants.ts +12 -0
- package/src/containers/ImportPullRequestDialog/ImportPullRequestDialog.tsx +160 -0
- package/src/containers/ImportPullRequestDialog/index.ts +7 -0
- package/src/containers/PullRequestArticle/PullRequestArticle.tsx +573 -0
- package/src/containers/PullRequestArticle/failure.test.ts +42 -0
- package/src/containers/PullRequestArticle/failure.ts +16 -0
- package/src/containers/PullRequestArticle/index.ts +5 -0
- package/src/containers/PullRequestCardMenu/PullRequestCardMenu.tsx +134 -0
- package/src/containers/PullRequestCardMenu/index.ts +5 -0
- package/src/containers/PullRequestsArticle/PullRequestsArticle.tsx +361 -0
- package/src/containers/PullRequestsArticle/arrange.test.ts +122 -0
- package/src/containers/PullRequestsArticle/arrange.ts +245 -0
- package/src/containers/PullRequestsArticle/format.ts +31 -0
- package/src/containers/PullRequestsArticle/index.ts +5 -0
- package/src/containers/WalkthroughArticle/WalkthroughArticle.tsx +31 -0
- package/src/containers/WalkthroughArticle/index.ts +5 -0
- package/src/containers/index.ts +11 -0
- package/src/errors.ts +61 -0
- package/src/extensions/index.ts +6 -0
- package/src/extensions/links.test.ts +133 -0
- package/src/extensions/links.ts +91 -0
- package/src/extensions/references.test.ts +83 -0
- package/src/extensions/references.ts +100 -0
- package/src/github-link.ts +70 -0
- package/src/hooks/index.ts +6 -3
- package/src/hooks/useOpenObject.ts +48 -0
- package/src/hooks/usePullRequestChecks.ts +81 -0
- package/src/hooks/usePullRequestDiff.ts +57 -0
- package/src/hooks/usePullRequestFiles.ts +98 -0
- package/src/hooks/useSyncPullRequest.ts +51 -0
- package/src/index.ts +4 -6
- package/src/meta.ts +8 -13
- package/src/operations/add-pull-request-comment.ts +31 -0
- package/src/operations/add-pull-request-review-comment.ts +32 -0
- package/src/operations/generate-walkthrough.ts +124 -0
- package/src/operations/get-pull-request-diff.ts +37 -0
- package/src/operations/get-pull-request-status.ts +44 -0
- package/src/operations/get-repositories.ts +53 -0
- package/src/operations/import-pull-request-from-snapshot.ts +48 -0
- package/src/operations/import-pull-request.test.ts +151 -0
- package/src/operations/import-pull-request.ts +149 -0
- package/src/operations/index.ts +30 -0
- package/src/operations/materialize-target.ts +60 -0
- package/src/operations/pull-request.test.ts +120 -0
- package/src/operations/pull-request.ts +141 -0
- package/src/operations/refresh-pull-requests.ts +69 -0
- package/src/operations/refresh.test.ts +112 -0
- package/src/operations/refresh.ts +111 -0
- package/src/operations/submit-pull-request-approval.ts +41 -0
- package/src/operations/sync-pull-request.ts +34 -0
- package/src/operations/sync.test.ts +453 -0
- package/src/operations/sync.ts +807 -0
- package/src/plugin.test.ts +40 -0
- package/src/plugin.ts +37 -0
- package/src/pull-request-body.test.ts +61 -0
- package/src/pull-request-body.ts +144 -0
- package/src/pull-request.test.ts +67 -0
- package/src/pull-request.ts +80 -0
- package/src/services/github-api.ts +735 -0
- package/src/services/index.ts +5 -0
- package/src/skills/GitHubSkill.ts +46 -0
- package/src/skills/index.ts +5 -0
- package/src/stories/Generate.stories.tsx +152 -0
- package/src/stories/Links.stories.tsx +153 -0
- package/src/stories/PullRequestArticle.stories.tsx +107 -0
- package/src/stories/PullRequestFiles.stories.tsx +69 -0
- package/src/stories/PullRequestOverview.stories.tsx +114 -0
- package/src/stories/PullRequestsArticle.stories.tsx +170 -0
- package/src/stories/Walkthrough.stories.tsx +110 -0
- package/src/stories/github.test.ts +65 -0
- package/src/stories/github.ts +70 -0
- package/src/stories/walkthrough-fixture.ts +115 -0
- package/src/testing/fixtures.ts +99 -0
- package/src/testing/index.ts +7 -0
- package/src/testing/plugin.ts +25 -0
- package/src/testing/pull-request-13348.ts +104 -0
- package/src/testing/pull-request-13363.patch +2981 -0
- package/src/translations.ts +135 -63
- package/src/types/GitHubCapabilities.ts +27 -0
- package/src/types/GitHubEvents.ts +16 -0
- package/src/types/GitHubOperation.ts +397 -0
- package/src/types/PullRequestsView.ts +45 -0
- package/src/types/Walkthrough.test.ts +75 -0
- package/src/types/Walkthrough.ts +66 -0
- package/src/types/index.ts +8 -0
- package/src/vite-env.d.ts +15 -0
- package/src/walkthrough/fill.test.ts +337 -0
- package/src/walkthrough/fill.ts +246 -0
- package/src/walkthrough/generate.test.ts +219 -0
- package/src/walkthrough/generate.ts +248 -0
- package/src/walkthrough/generated.test.ts +70 -0
- package/src/walkthrough/generated.ts +70 -0
- package/src/walkthrough/headings.test.ts +40 -0
- package/src/walkthrough/headings.ts +39 -0
- package/src/walkthrough/index.ts +12 -0
- package/src/walkthrough/patch.ts +154 -0
- package/src/walkthrough/plan.test.ts +178 -0
- package/src/walkthrough/plan.ts +251 -0
- package/src/walkthrough/prompt.test.ts +100 -0
- package/src/walkthrough/prompt.ts +147 -0
- package/src/walkthrough/score.test.ts +272 -0
- package/src/walkthrough/score.ts +430 -0
- package/README.md +0 -15
- package/dist/lib/browser/chunk-S4MPSBA5.mjs +0 -21
- package/dist/lib/browser/chunk-S4MPSBA5.mjs.map +0 -7
- package/dist/lib/browser/index.css +0 -7
- package/dist/lib/browser/index.css.map +0 -7
- package/dist/lib/browser/index.mjs +0 -1535
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/meta.mjs +0 -11
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/types/src/GithubPlugin.d.ts +0 -4
- package/dist/types/src/GithubPlugin.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts +0 -4
- package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts +0 -9
- package/dist/types/src/components/EmbeddedMain/GfmPreview.d.ts.map +0 -1
- package/dist/types/src/components/EmbeddedMain/index.d.ts +0 -2
- package/dist/types/src/components/EmbeddedMain/index.d.ts.map +0 -1
- package/dist/types/src/components/ExportDialog.d.ts +0 -8
- package/dist/types/src/components/ExportDialog.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts +0 -3
- package/dist/types/src/components/GithubApiProviders/GitHubSettings.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts +0 -15
- package/dist/types/src/components/GithubApiProviders/OctokitProvider.d.ts.map +0 -1
- package/dist/types/src/components/GithubApiProviders/index.d.ts +0 -3
- package/dist/types/src/components/GithubApiProviders/index.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/DocumentTreeItem.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts +0 -7
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverContext.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverDialog.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts +0 -16
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverProps.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts +0 -3
- package/dist/types/src/components/GithubEchoResolverProviders/ResolverTree.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts +0 -11
- package/dist/types/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts +0 -3
- package/dist/types/src/components/GithubEchoResolverProviders/index.d.ts.map +0 -1
- package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts +0 -6
- package/dist/types/src/components/GithubEchoResolverProviders/spaceResolvers.d.ts.map +0 -1
- package/dist/types/src/components/ImportDialog.d.ts +0 -7
- package/dist/types/src/components/ImportDialog.d.ts.map +0 -1
- package/dist/types/src/components/Issue.d.ts +0 -5
- package/dist/types/src/components/Issue.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.d.ts +0 -15
- package/dist/types/src/components/Loading/Loading.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.stories.d.ts +0 -40
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +0 -1
- package/dist/types/src/components/Loading/index.d.ts +0 -2
- package/dist/types/src/components/Loading/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownActions.d.ts +0 -7
- package/dist/types/src/components/MarkdownActions.d.ts.map +0 -1
- package/dist/types/src/components/UrlDialog.d.ts +0 -6
- package/dist/types/src/components/UrlDialog.d.ts.map +0 -1
- package/dist/types/src/hooks/useDocGhId.d.ts +0 -6
- package/dist/types/src/hooks/useDocGhId.d.ts.map +0 -1
- package/dist/types/src/hooks/useGhIdFromUrl.d.ts +0 -2
- package/dist/types/src/hooks/useGhIdFromUrl.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -30
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/GithubPlugin.tsx +0 -127
- package/src/components/EmbeddedMain/EmbeddedMain.tsx +0 -294
- package/src/components/EmbeddedMain/GfmPreview.tsx +0 -110
- package/src/components/EmbeddedMain/embedded.css +0 -3
- package/src/components/EmbeddedMain/index.ts +0 -5
- package/src/components/ExportDialog.tsx +0 -157
- package/src/components/GithubApiProviders/GitHubSettings.tsx +0 -72
- package/src/components/GithubApiProviders/OctokitProvider.tsx +0 -60
- package/src/components/GithubApiProviders/index.ts +0 -6
- package/src/components/GithubEchoResolverProviders/DocumentTreeItem.tsx +0 -26
- package/src/components/GithubEchoResolverProviders/ResolverContext.tsx +0 -137
- package/src/components/GithubEchoResolverProviders/ResolverDialog.tsx +0 -34
- package/src/components/GithubEchoResolverProviders/ResolverProps.ts +0 -23
- package/src/components/GithubEchoResolverProviders/ResolverTree.tsx +0 -86
- package/src/components/GithubEchoResolverProviders/SpacePickerTreeItem.tsx +0 -105
- package/src/components/GithubEchoResolverProviders/index.ts +0 -6
- package/src/components/GithubEchoResolverProviders/spaceResolvers.ts +0 -86
- package/src/components/ImportDialog.tsx +0 -72
- package/src/components/Issue.tsx +0 -62
- package/src/components/Loading/Loading.stories.tsx +0 -32
- package/src/components/Loading/Loading.tsx +0 -70
- package/src/components/Loading/index.ts +0 -5
- package/src/components/MarkdownActions.tsx +0 -136
- package/src/components/UrlDialog.tsx +0 -52
- package/src/hooks/useDocGhId.ts +0 -38
- package/src/hooks/useGhIdFromUrl.ts +0 -26
- package/src/types.ts +0 -51
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useContext } from 'react';
|
|
6
|
-
|
|
7
|
-
import { useClient } from '@dxos/react-client';
|
|
8
|
-
import { useSpaces, type Space } from '@dxos/react-client/echo';
|
|
9
|
-
import { Button, Dialog, Tree, useId, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
|
|
11
|
-
import { SpaceResolverContext } from './ResolverContext';
|
|
12
|
-
import { SpacePickerTreeItem } from './SpacePickerTreeItem';
|
|
13
|
-
import { bindSpace, unbindSpace } from './spaceResolvers';
|
|
14
|
-
import { GITHUB_PLUGIN } from '../../meta';
|
|
15
|
-
|
|
16
|
-
export const ResolverTree = () => {
|
|
17
|
-
const client = useClient();
|
|
18
|
-
const spaces = useSpaces({ all: true });
|
|
19
|
-
const treeLabel = useId('treeLabel');
|
|
20
|
-
const { t } = useTranslation(GITHUB_PLUGIN);
|
|
21
|
-
const {
|
|
22
|
-
space: selectedSpace,
|
|
23
|
-
setSpace: setSelectedSpace,
|
|
24
|
-
source,
|
|
25
|
-
id,
|
|
26
|
-
identityHex,
|
|
27
|
-
} = useContext(SpaceResolverContext);
|
|
28
|
-
const setSpace = useCallback(
|
|
29
|
-
(nextSpace: Space | null) => {
|
|
30
|
-
if (identityHex && source && id) {
|
|
31
|
-
selectedSpace && unbindSpace(selectedSpace, identityHex, source, id);
|
|
32
|
-
nextSpace && bindSpace(nextSpace, identityHex, source, id);
|
|
33
|
-
}
|
|
34
|
-
setSelectedSpace(nextSpace);
|
|
35
|
-
},
|
|
36
|
-
[selectedSpace, setSelectedSpace, identityHex, source, id],
|
|
37
|
-
);
|
|
38
|
-
return spaces.length ? (
|
|
39
|
-
<>
|
|
40
|
-
{' '}
|
|
41
|
-
<Dialog.Title tabIndex={-1} classNames='shrink-0'>
|
|
42
|
-
{t('resolver tree label')}
|
|
43
|
-
</Dialog.Title>
|
|
44
|
-
<Dialog.Description>{t('resolver tree description')}</Dialog.Description>
|
|
45
|
-
<div role='separator' className='shrink-0 bs-px bg-neutral-500/20 mlb-1' />
|
|
46
|
-
<Tree.Root
|
|
47
|
-
aria-label={t('resolver tree label')}
|
|
48
|
-
data-testid='composer.sidebarTree'
|
|
49
|
-
classNames='overflow-y-auto -mli-2 p-2'
|
|
50
|
-
>
|
|
51
|
-
{spaces.map((space) => {
|
|
52
|
-
return (
|
|
53
|
-
<SpacePickerTreeItem
|
|
54
|
-
key={space.key.toHex()}
|
|
55
|
-
{...{
|
|
56
|
-
space,
|
|
57
|
-
selected: selectedSpace === space,
|
|
58
|
-
setSpace,
|
|
59
|
-
identityHex: identityHex!,
|
|
60
|
-
source: source!,
|
|
61
|
-
id: id!,
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
65
|
-
})}
|
|
66
|
-
</Tree.Root>
|
|
67
|
-
</>
|
|
68
|
-
) : (
|
|
69
|
-
<>
|
|
70
|
-
<h1 className='text-lg font-normal' id={treeLabel}>
|
|
71
|
-
{t('resolver no spaces message')}
|
|
72
|
-
</h1>
|
|
73
|
-
<div role='separator' className='bs-px bg-neutral-500/20 mlb-2' />
|
|
74
|
-
<Button
|
|
75
|
-
classNames='block is-full'
|
|
76
|
-
onClick={async () => {
|
|
77
|
-
const space = await client.spaces.create();
|
|
78
|
-
bindSpace(space, identityHex!, source!, id!);
|
|
79
|
-
setSpace(space);
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
{t('resolver create space label')}
|
|
83
|
-
</Button>
|
|
84
|
-
</>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { CaretDown, CaretRight } from '@phosphor-icons/react';
|
|
6
|
-
import React, { useMemo, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
9
|
-
import { getSpaceDisplayName } from '@dxos/plugin-space';
|
|
10
|
-
import { useMulticastObservable } from '@dxos/react-client';
|
|
11
|
-
import { type Space, SpaceState, useQuery, Filter } from '@dxos/react-client/echo';
|
|
12
|
-
import { Button, Tag, Tooltip, Tree, TreeItem, useTranslation } from '@dxos/react-ui';
|
|
13
|
-
import { staticDisabled } from '@dxos/react-ui-theme';
|
|
14
|
-
|
|
15
|
-
import { DocumentTreeItem } from './DocumentTreeItem';
|
|
16
|
-
import { matchSpace } from './spaceResolvers';
|
|
17
|
-
import { GITHUB_PLUGIN } from '../../meta';
|
|
18
|
-
|
|
19
|
-
export const SpacePickerTreeItem = ({
|
|
20
|
-
identityHex,
|
|
21
|
-
space,
|
|
22
|
-
source,
|
|
23
|
-
id,
|
|
24
|
-
setSpace,
|
|
25
|
-
selected,
|
|
26
|
-
}: {
|
|
27
|
-
identityHex: string;
|
|
28
|
-
space: Space;
|
|
29
|
-
setSpace: (nextSpace: Space | null) => void;
|
|
30
|
-
source: string;
|
|
31
|
-
id: string;
|
|
32
|
-
selected?: boolean;
|
|
33
|
-
}) => {
|
|
34
|
-
const { t } = useTranslation(GITHUB_PLUGIN);
|
|
35
|
-
const spaceSate = useMulticastObservable(space.state);
|
|
36
|
-
const disabled = spaceSate !== SpaceState.SPACE_READY;
|
|
37
|
-
const spaceDisplayName = getSpaceDisplayName(space);
|
|
38
|
-
const documents = useQuery(space, Filter.schema(DocumentType));
|
|
39
|
-
const hasDocuments = documents.length > 0;
|
|
40
|
-
|
|
41
|
-
const [open, setOpen] = useState(false);
|
|
42
|
-
|
|
43
|
-
const nBoundMembers = useMemo(() => {
|
|
44
|
-
return Object.keys(space.properties.members ?? {}).filter((identityHex) =>
|
|
45
|
-
matchSpace(space, identityHex, source, id),
|
|
46
|
-
).length;
|
|
47
|
-
}, [source, id, space.properties]);
|
|
48
|
-
|
|
49
|
-
const OpenTriggerIcon = open ? CaretDown : CaretRight;
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<TreeItem.Root
|
|
53
|
-
collapsible
|
|
54
|
-
open={open}
|
|
55
|
-
onOpenChange={setOpen}
|
|
56
|
-
classNames={['mbe-2 block', disabled && staticDisabled]}
|
|
57
|
-
{...(disabled && { 'aria-disabled': true })}
|
|
58
|
-
>
|
|
59
|
-
<div role='none' className='flex items-center gap-2'>
|
|
60
|
-
{hasDocuments ? (
|
|
61
|
-
<TreeItem.OpenTrigger>
|
|
62
|
-
<OpenTriggerIcon />
|
|
63
|
-
</TreeItem.OpenTrigger>
|
|
64
|
-
) : (
|
|
65
|
-
<TreeItem.OpenTrigger disabled classNames={staticDisabled}>
|
|
66
|
-
<CaretRight />
|
|
67
|
-
</TreeItem.OpenTrigger>
|
|
68
|
-
)}
|
|
69
|
-
<TreeItem.Heading
|
|
70
|
-
classNames='grow break-words pbs-1 text-baseText font-medium'
|
|
71
|
-
data-testid='composer.spaceTreeItemHeading'
|
|
72
|
-
>
|
|
73
|
-
{Array.isArray(spaceDisplayName) ? t(...spaceDisplayName) : spaceDisplayName}
|
|
74
|
-
</TreeItem.Heading>
|
|
75
|
-
{nBoundMembers > 0 && (
|
|
76
|
-
<Tooltip.Root>
|
|
77
|
-
<Tooltip.Trigger asChild>
|
|
78
|
-
<Tag palette='info' aria-label={t('bound members message', { count: nBoundMembers })}>
|
|
79
|
-
{nBoundMembers}
|
|
80
|
-
</Tag>
|
|
81
|
-
</Tooltip.Trigger>
|
|
82
|
-
<Tooltip.Portal>
|
|
83
|
-
<Tooltip.Content side='bottom'>
|
|
84
|
-
<Tooltip.Arrow />
|
|
85
|
-
{t('bound members message', { count: nBoundMembers })}
|
|
86
|
-
</Tooltip.Content>
|
|
87
|
-
</Tooltip.Portal>
|
|
88
|
-
</Tooltip.Root>
|
|
89
|
-
)}
|
|
90
|
-
<Button disabled={selected} density='fine' classNames='shrink-0' onClick={() => setSpace(space)}>
|
|
91
|
-
{t(selected ? 'selected label' : 'select label')}
|
|
92
|
-
</Button>
|
|
93
|
-
</div>
|
|
94
|
-
<TreeItem.Body className='pis-4'>
|
|
95
|
-
{hasDocuments && (
|
|
96
|
-
<Tree.Branch>
|
|
97
|
-
{documents.map((document) => (
|
|
98
|
-
<DocumentTreeItem key={document.id} document={document} />
|
|
99
|
-
))}
|
|
100
|
-
</Tree.Branch>
|
|
101
|
-
)}
|
|
102
|
-
</TreeItem.Body>
|
|
103
|
-
</TreeItem.Root>
|
|
104
|
-
);
|
|
105
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import get from 'lodash.get';
|
|
6
|
-
import update from 'lodash.update';
|
|
7
|
-
|
|
8
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
9
|
-
|
|
10
|
-
// todo(thure): Why is the value that gets set in `ghBind` always undefined by the time this is called?
|
|
11
|
-
const ghMatch = (space: Space, identityHex: string, id: string): boolean => {
|
|
12
|
-
const [ghOwner, ghRepo, ..._ghEtc] = id.split('/');
|
|
13
|
-
return get(space.properties, ['members', identityHex, 'github', 'repos'], []).includes(`${ghOwner}/${ghRepo}`);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const matchSpace = (space: Space, identityHex: string, source?: string, id?: string) => {
|
|
17
|
-
if (!id) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
switch (source) {
|
|
21
|
-
case 'github.com':
|
|
22
|
-
return ghMatch(space, identityHex, id);
|
|
23
|
-
default:
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// todo(thure): Why does the new space.properties value not propagate?
|
|
29
|
-
const ghBind = (space: Space, identityHex: string, id: string): string[] => {
|
|
30
|
-
const [ghOwner, ghRepo, ..._ghEtc] = id.split('/');
|
|
31
|
-
update(space.properties, ['members', identityHex, 'github', 'repos'], (ghBindings) => {
|
|
32
|
-
return [...(ghBindings ?? []), `${ghOwner}/${ghRepo}`];
|
|
33
|
-
});
|
|
34
|
-
return space.properties.members?.[identityHex]?.github?.repos ?? [];
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const bindSpace = (space: Space, identityHex: string, source: string, id: string): string[] => {
|
|
38
|
-
switch (source) {
|
|
39
|
-
case 'github.com':
|
|
40
|
-
return ghBind(space, identityHex, id);
|
|
41
|
-
default:
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const ghUnbind = (space: Space, identityHex: string, id: string): string[] => {
|
|
46
|
-
const [ghOwner, ghRepo, ..._ghEtc] = id.split('/');
|
|
47
|
-
update(space.properties, ['members', identityHex, 'github', 'repos'], (ghBindings) => {
|
|
48
|
-
const index = ghBindings.indexOf(`${ghOwner}/${ghRepo}`);
|
|
49
|
-
if (index >= 0) {
|
|
50
|
-
const result = [...ghBindings];
|
|
51
|
-
result.splice(index, 1);
|
|
52
|
-
return result;
|
|
53
|
-
} else {
|
|
54
|
-
return ghBindings;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
return space.properties.members?.[identityHex]?.github?.repos ?? [];
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const unbindSpace = (space: Space, identityHex: string, source: string, id: string): string[] => {
|
|
61
|
-
switch (source) {
|
|
62
|
-
case 'github.com':
|
|
63
|
-
return ghUnbind(space, identityHex, id);
|
|
64
|
-
default:
|
|
65
|
-
return [];
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const ghDisplayName = (id: string): string => {
|
|
70
|
-
const [ghOwner, ghRepo, ghResource, ...etc] = id.split('/');
|
|
71
|
-
switch (ghResource) {
|
|
72
|
-
case 'issues':
|
|
73
|
-
return `${ghOwner}/${ghRepo} #${etc[0]}`;
|
|
74
|
-
default:
|
|
75
|
-
return `${ghOwner}/${ghRepo} ${[ghResource, ...etc].join('/')}`;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const displayName = (source: string, id: string): string => {
|
|
80
|
-
switch (source) {
|
|
81
|
-
case 'github.com':
|
|
82
|
-
return ghDisplayName(id);
|
|
83
|
-
default:
|
|
84
|
-
return id;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { log } from '@dxos/log';
|
|
8
|
-
import { Button, Dialog, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
|
|
10
|
-
import { useOctokitContext } from './GithubApiProviders';
|
|
11
|
-
import { GITHUB_PLUGIN } from '../meta';
|
|
12
|
-
import type { GhFileIdentifier, GhIdentifier, GhIssueIdentifier } from '../types';
|
|
13
|
-
|
|
14
|
-
export const ImportDialog = ({ docGhId, onUpdate }: { docGhId: GhIdentifier; onUpdate: (content: string) => void }) => {
|
|
15
|
-
const { t } = useTranslation(GITHUB_PLUGIN);
|
|
16
|
-
const { octokit } = useOctokitContext();
|
|
17
|
-
|
|
18
|
-
const importGhIssueContent = useCallback(async () => {
|
|
19
|
-
if (octokit && docGhId && 'issueNumber') {
|
|
20
|
-
try {
|
|
21
|
-
const { owner, repo, issueNumber } = docGhId as GhIssueIdentifier;
|
|
22
|
-
const { data } = await octokit.rest.issues.get({ owner, repo, issue_number: issueNumber });
|
|
23
|
-
onUpdate(data.body ?? '');
|
|
24
|
-
} catch (err) {
|
|
25
|
-
log.error('Failed to import from Github issue', err);
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
log.error('Not prepared to import from Github issue when requested.');
|
|
29
|
-
}
|
|
30
|
-
}, [octokit, docGhId]);
|
|
31
|
-
|
|
32
|
-
const importGhFileContent = useCallback(async () => {
|
|
33
|
-
if (octokit && docGhId && 'path' in docGhId) {
|
|
34
|
-
try {
|
|
35
|
-
const { owner, repo, path } = docGhId as GhFileIdentifier;
|
|
36
|
-
const { data } = await octokit.rest.repos.getContent({ owner, repo, path });
|
|
37
|
-
if (!Array.isArray(data) && data.type === 'file') {
|
|
38
|
-
onUpdate(atob(data.content));
|
|
39
|
-
} else {
|
|
40
|
-
log.error('Did not receive file with content from Github.');
|
|
41
|
-
}
|
|
42
|
-
} catch (err) {
|
|
43
|
-
log.error('Failed to import from Github file', err);
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
log.error('Not prepared to import from Github file when requested.');
|
|
47
|
-
}
|
|
48
|
-
}, [octokit, docGhId]);
|
|
49
|
-
|
|
50
|
-
const handleGhImport = useCallback(() => {
|
|
51
|
-
return (
|
|
52
|
-
docGhId && ('issueNumber' in docGhId ? importGhIssueContent() : 'path' in docGhId ? importGhFileContent() : null)
|
|
53
|
-
);
|
|
54
|
-
}, [importGhIssueContent, importGhFileContent, docGhId]);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<Dialog.Content>
|
|
58
|
-
<Dialog.Title>{t('confirm import title')}</Dialog.Title>
|
|
59
|
-
<p className='plb-2'>{t('confirm import body')}</p>
|
|
60
|
-
<div role='none' className='flex justify-end gap-2'>
|
|
61
|
-
<Dialog.Close asChild>
|
|
62
|
-
<Button>{t('cancel label', { ns: 'appkit' })}</Button>
|
|
63
|
-
</Dialog.Close>
|
|
64
|
-
<Dialog.Close asChild>
|
|
65
|
-
<Button variant='primary' onClick={handleGhImport}>
|
|
66
|
-
{t('import from github label')}
|
|
67
|
-
</Button>
|
|
68
|
-
</Dialog.Close>
|
|
69
|
-
</div>
|
|
70
|
-
</Dialog.Content>
|
|
71
|
-
);
|
|
72
|
-
};
|
package/src/components/Issue.tsx
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type IconWeight, IconBase, type IconProps } from '@phosphor-icons/react';
|
|
6
|
-
import React, { forwardRef, type ReactElement } from 'react';
|
|
7
|
-
|
|
8
|
-
// TODO(wittjosiah): This is a workaround until we have utilities to compose icons.
|
|
9
|
-
// This is a combination of the Circle and Dot icons.
|
|
10
|
-
|
|
11
|
-
const weights = new Map<IconWeight, ReactElement>([
|
|
12
|
-
[
|
|
13
|
-
'bold',
|
|
14
|
-
<>
|
|
15
|
-
<path 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' />
|
|
16
|
-
<path d='M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128Z' />
|
|
17
|
-
</>,
|
|
18
|
-
],
|
|
19
|
-
[
|
|
20
|
-
'duotone',
|
|
21
|
-
<>
|
|
22
|
-
<path d='M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z' opacity='0.2' />
|
|
23
|
-
<path 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' />
|
|
24
|
-
<path d='M176,128a48,48,0,1,1-48-48A48,48,0,0,1,176,128Z' opacity='0.2' />
|
|
25
|
-
<path d='M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z' />
|
|
26
|
-
</>,
|
|
27
|
-
],
|
|
28
|
-
[
|
|
29
|
-
'fill',
|
|
30
|
-
<>
|
|
31
|
-
<path 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' />
|
|
32
|
-
<path 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' />
|
|
33
|
-
</>,
|
|
34
|
-
],
|
|
35
|
-
[
|
|
36
|
-
'light',
|
|
37
|
-
<>
|
|
38
|
-
<path 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' />
|
|
39
|
-
<path d='M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128Z' />
|
|
40
|
-
</>,
|
|
41
|
-
],
|
|
42
|
-
[
|
|
43
|
-
'regular',
|
|
44
|
-
<>
|
|
45
|
-
<path 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' />
|
|
46
|
-
<path d='M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z' />
|
|
47
|
-
</>,
|
|
48
|
-
],
|
|
49
|
-
[
|
|
50
|
-
'thin',
|
|
51
|
-
<>
|
|
52
|
-
<path 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' />
|
|
53
|
-
<path d='M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Z' />
|
|
54
|
-
</>,
|
|
55
|
-
],
|
|
56
|
-
]);
|
|
57
|
-
|
|
58
|
-
const Issue = forwardRef<SVGSVGElement, IconProps>((props, ref) => <IconBase ref={ref} {...props} weights={weights} />);
|
|
59
|
-
|
|
60
|
-
Issue.displayName = 'Issue';
|
|
61
|
-
|
|
62
|
-
export { Issue };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react';
|
|
8
|
-
|
|
9
|
-
import { Loading } from './Loading';
|
|
10
|
-
|
|
11
|
-
export const Default = { args: { label: 'Loading', size: 'md', color: 'primary' } };
|
|
12
|
-
export const Small = { args: { ...Default.args, size: 'sm' } };
|
|
13
|
-
export const Neutral = { args: { ...Default.args, color: 'neutral' } };
|
|
14
|
-
export const Large = { args: { ...Default.args, size: 'lg' } };
|
|
15
|
-
export const ExtraLarge = { args: { ...Default.args, size: 'xl' } };
|
|
16
|
-
|
|
17
|
-
const meta: Meta = {
|
|
18
|
-
title: 'plugins/plugin-github/Loading',
|
|
19
|
-
component: Loading,
|
|
20
|
-
argTypes: {
|
|
21
|
-
size: {
|
|
22
|
-
control: 'select',
|
|
23
|
-
options: ['sm', 'md', 'lg', 'xl'],
|
|
24
|
-
},
|
|
25
|
-
color: {
|
|
26
|
-
control: 'select',
|
|
27
|
-
options: ['primary', 'neutral'],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default meta;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type ComponentProps } from 'react';
|
|
6
|
-
|
|
7
|
-
import { useId } from '@dxos/react-ui';
|
|
8
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
-
|
|
10
|
-
export type LoadingSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
-
|
|
12
|
-
export type LoadingColor = 'primary' | 'neutral';
|
|
13
|
-
|
|
14
|
-
export interface LoadingSlots {
|
|
15
|
-
root?: Omit<ComponentProps<'div'>, 'children'>;
|
|
16
|
-
svg?: Pick<ComponentProps<'svg'>, 'className'>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface LoadingProps {
|
|
20
|
-
label: string;
|
|
21
|
-
size?: LoadingSize;
|
|
22
|
-
color?: LoadingColor;
|
|
23
|
-
slots?: LoadingSlots;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const sizeMap = new Map<LoadingSize, string>([
|
|
27
|
-
['sm', 'w-4 h-4'],
|
|
28
|
-
['md', 'w-8 h-8'],
|
|
29
|
-
['lg', 'w-12 h-12'],
|
|
30
|
-
['xl', 'w-16 h-16'],
|
|
31
|
-
]);
|
|
32
|
-
|
|
33
|
-
// TODO(wittjosiah): Factor out.
|
|
34
|
-
export const Loading = ({ size, color, label, slots = {} }: LoadingProps) => {
|
|
35
|
-
const labelId = useId('loading-label');
|
|
36
|
-
const sizeClassName = sizeMap.get(size ?? 'md');
|
|
37
|
-
return (
|
|
38
|
-
<div
|
|
39
|
-
{...slots.root}
|
|
40
|
-
className={mx('flex justify-center p-4', slots.root?.className)}
|
|
41
|
-
role='status'
|
|
42
|
-
aria-labelledby={labelId}
|
|
43
|
-
>
|
|
44
|
-
<svg
|
|
45
|
-
role='none'
|
|
46
|
-
className={mx(
|
|
47
|
-
sizeClassName,
|
|
48
|
-
'text-neutral-200/50 animate-spin dark:text-neutral-600/50',
|
|
49
|
-
color === 'neutral' ? 'fill-neutral-400' : 'fill-primary-400',
|
|
50
|
-
slots.svg?.className,
|
|
51
|
-
)}
|
|
52
|
-
viewBox='0 0 100 101'
|
|
53
|
-
fill='none'
|
|
54
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
55
|
-
>
|
|
56
|
-
<path
|
|
57
|
-
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'
|
|
58
|
-
fill='currentColor'
|
|
59
|
-
/>
|
|
60
|
-
<path
|
|
61
|
-
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'
|
|
62
|
-
fill='currentFill'
|
|
63
|
-
/>
|
|
64
|
-
</svg>
|
|
65
|
-
<span className='sr-only' id={labelId}>
|
|
66
|
-
{label}
|
|
67
|
-
</span>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { ArrowSquareOut, FileArrowDown, FileArrowUp, Link, LinkBreak } from '@phosphor-icons/react';
|
|
6
|
-
import React, { useCallback } from 'react';
|
|
7
|
-
|
|
8
|
-
import { LayoutAction, useIntent } from '@dxos/app-framework';
|
|
9
|
-
import { log } from '@dxos/log';
|
|
10
|
-
import { type MarkdownProperties } from '@dxos/plugin-markdown';
|
|
11
|
-
import { getMeta } from '@dxos/react-client/echo';
|
|
12
|
-
import { DropdownMenu, useTranslation } from '@dxos/react-ui';
|
|
13
|
-
import { getSize } from '@dxos/react-ui-theme';
|
|
14
|
-
|
|
15
|
-
import { useOctokitContext } from './GithubApiProviders';
|
|
16
|
-
import { useDocGhId } from '../hooks';
|
|
17
|
-
import { GITHUB_PLUGIN } from '../meta';
|
|
18
|
-
import { type GhIssueIdentifier } from '../types';
|
|
19
|
-
|
|
20
|
-
// TODO(burdon): Requires test; very likely out of date.
|
|
21
|
-
// TODO(burdon): Where do "properties" come from? Is this the graph node datum?
|
|
22
|
-
export const MarkdownActions = ({ content, properties }: { content: string; properties: MarkdownProperties }) => {
|
|
23
|
-
// TODO(burdon): Ad hoc assumption that underlying object is ECHO?
|
|
24
|
-
const ghId = getMeta(properties)?.keys?.find((key) => key.source === 'github.com')?.id;
|
|
25
|
-
const { octokit } = useOctokitContext();
|
|
26
|
-
const { t } = useTranslation(GITHUB_PLUGIN);
|
|
27
|
-
const { dispatch } = useIntent();
|
|
28
|
-
|
|
29
|
-
const docGhId = useDocGhId(properties.__meta?.keys ?? []);
|
|
30
|
-
|
|
31
|
-
const updateIssueContent = useCallback(() => {
|
|
32
|
-
const { owner, repo, issueNumber } = docGhId as GhIssueIdentifier;
|
|
33
|
-
return octokit!.rest.issues.update({
|
|
34
|
-
owner,
|
|
35
|
-
repo,
|
|
36
|
-
issue_number: issueNumber,
|
|
37
|
-
body: content,
|
|
38
|
-
});
|
|
39
|
-
}, [octokit, docGhId, content]);
|
|
40
|
-
|
|
41
|
-
const exportGhIssueContent = useCallback(async () => {
|
|
42
|
-
if (octokit && docGhId && 'issueNumber' in docGhId && content) {
|
|
43
|
-
try {
|
|
44
|
-
const {
|
|
45
|
-
data: { html_url: issueUrl },
|
|
46
|
-
} = await updateIssueContent();
|
|
47
|
-
await dispatch({
|
|
48
|
-
action: LayoutAction.SET_LAYOUT,
|
|
49
|
-
data: {
|
|
50
|
-
element: 'dialog',
|
|
51
|
-
component: 'dxos.org/plugin/github/ExportDialog',
|
|
52
|
-
subject: { type: 'response', target: issueUrl, docGhId, content },
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
} catch (err) {
|
|
56
|
-
log.error('Failed to export to Github issue');
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
log.error('Not prepared to export to Github issue when requested.');
|
|
60
|
-
}
|
|
61
|
-
}, [octokit, docGhId, content]);
|
|
62
|
-
|
|
63
|
-
const handleGhExport = useCallback(() => {
|
|
64
|
-
if ('issueNumber' in docGhId!) {
|
|
65
|
-
void exportGhIssueContent();
|
|
66
|
-
} else if ('path' in docGhId!) {
|
|
67
|
-
void dispatch({
|
|
68
|
-
action: LayoutAction.SET_LAYOUT,
|
|
69
|
-
data: {
|
|
70
|
-
element: 'dialog',
|
|
71
|
-
component: 'dxos.org/plugin/github/ExportDialog',
|
|
72
|
-
subject: { type: 'create-pr', content, docGhId },
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}, [exportGhIssueContent, docGhId]);
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<>
|
|
80
|
-
<DropdownMenu.GroupLabel>{t('markdown actions label')}</DropdownMenu.GroupLabel>
|
|
81
|
-
{docGhId ? (
|
|
82
|
-
<>
|
|
83
|
-
<DropdownMenu.Item
|
|
84
|
-
classNames='gap-2'
|
|
85
|
-
disabled={!docGhId}
|
|
86
|
-
onClick={() =>
|
|
87
|
-
// TODO(burdon): Intent should return content value from dialog.
|
|
88
|
-
dispatch({
|
|
89
|
-
action: LayoutAction.SET_LAYOUT,
|
|
90
|
-
data: { element: 'dialog', component: 'dxos.org/plugin/github/ImportDialog', subject: { docGhId } },
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
>
|
|
94
|
-
<FileArrowDown className={getSize(4)} />
|
|
95
|
-
<span className='grow'>{t('import from github label')}</span>
|
|
96
|
-
</DropdownMenu.Item>
|
|
97
|
-
<DropdownMenu.Item classNames='gap-2' disabled={!docGhId} onClick={() => docGhId && handleGhExport()}>
|
|
98
|
-
<FileArrowUp className={getSize(4)} />
|
|
99
|
-
<span className='grow'>{t('export to github label')}</span>
|
|
100
|
-
</DropdownMenu.Item>
|
|
101
|
-
<DropdownMenu.Item asChild classNames='gap-2' disabled={!ghId}>
|
|
102
|
-
<a
|
|
103
|
-
{...(ghId ? { href: `https://github.com/${ghId}`, target: '_blank', rel: 'noreferrer' } : { href: '#' })}
|
|
104
|
-
>
|
|
105
|
-
<ArrowSquareOut className={getSize(4)} />
|
|
106
|
-
<span className='grow'>{t('open in github label')}</span>
|
|
107
|
-
</a>
|
|
108
|
-
</DropdownMenu.Item>
|
|
109
|
-
<DropdownMenu.Item
|
|
110
|
-
classNames='gap-2'
|
|
111
|
-
onClick={() => {
|
|
112
|
-
const index = getMeta(properties)?.keys?.findIndex((key) => key.source === 'github.com');
|
|
113
|
-
typeof index !== 'undefined' && index >= 0 && properties.__meta?.keys?.splice(index, 1);
|
|
114
|
-
}}
|
|
115
|
-
>
|
|
116
|
-
<LinkBreak className={getSize(4)} />
|
|
117
|
-
<span className='grow'>{t('unbind to file in github label')}</span>
|
|
118
|
-
</DropdownMenu.Item>
|
|
119
|
-
</>
|
|
120
|
-
) : (
|
|
121
|
-
<DropdownMenu.Item
|
|
122
|
-
classNames='gap-2'
|
|
123
|
-
onClick={() =>
|
|
124
|
-
dispatch({
|
|
125
|
-
action: LayoutAction.SET_LAYOUT,
|
|
126
|
-
data: { element: 'dialog', component: 'dxos.org/plugin/github/BindDialog', subject: properties },
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
>
|
|
130
|
-
<Link className={getSize(4)} />
|
|
131
|
-
<span className='grow'>{t('bind to file in github label')}</span>
|
|
132
|
-
</DropdownMenu.Item>
|
|
133
|
-
)}
|
|
134
|
-
</>
|
|
135
|
-
);
|
|
136
|
-
};
|