@dxos/plugin-github 0.14.0 → 0.16.0-next-60712ab191a99ba90316cc4be753e9e11b17100a

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 (86) hide show
  1. package/dist/lib/GitHubCapabilities.mjs +1 -10
  2. package/dist/lib/GitHubEvents.mjs +1 -15
  3. package/dist/lib/GitHubOperation.mjs +1 -384
  4. package/dist/lib/GitHubPlugin.mjs +1 -16
  5. package/dist/lib/Walkthrough.mjs +1 -59
  6. package/dist/lib/capabilities.browser.mjs +1 -2
  7. package/dist/lib/capabilities.browser.mjs.map +1 -1
  8. package/dist/lib/capabilities.mjs +1 -2
  9. package/dist/lib/capabilities.mjs.map +1 -1
  10. package/dist/lib/capabilities.tauri.mjs +1 -2
  11. package/dist/lib/capabilities.tauri.mjs.map +1 -1
  12. package/dist/lib/chunk-Extensions.mjs +18 -0
  13. package/dist/lib/chunk-Extensions.mjs.map +1 -0
  14. package/dist/lib/chunk-GitHubCapabilities.mjs +10 -0
  15. package/dist/lib/chunk-GitHubCapabilities.mjs.map +1 -0
  16. package/dist/lib/chunk-GitHubEvents.mjs +15 -0
  17. package/dist/lib/chunk-GitHubEvents.mjs.map +1 -0
  18. package/dist/lib/chunk-GitHubOperation.mjs +386 -0
  19. package/dist/lib/chunk-GitHubOperation.mjs.map +1 -0
  20. package/dist/lib/chunk-GitHubPlugin.mjs +16 -0
  21. package/dist/lib/chunk-GitHubPlugin.mjs.map +1 -0
  22. package/dist/lib/chunk-ImportPullRequestDialog.mjs.map +1 -1
  23. package/dist/lib/chunk-PLUGIN.mjs +1 -1
  24. package/dist/lib/chunk-PullRequestArticle.mjs +33 -10
  25. package/dist/lib/chunk-PullRequestArticle.mjs.map +1 -1
  26. package/dist/lib/chunk-PullRequestArticle2.mjs +1 -2
  27. package/dist/lib/chunk-PullRequestCardMenu.mjs +1 -1
  28. package/dist/lib/chunk-PullRequestsArticle.mjs +3 -3
  29. package/dist/lib/chunk-PullRequestsArticle.mjs.map +1 -1
  30. package/dist/lib/chunk-Walkthrough.mjs +59 -0
  31. package/dist/lib/chunk-Walkthrough.mjs.map +1 -0
  32. package/dist/lib/chunk-WalkthroughArticle.mjs +1 -1
  33. package/dist/lib/chunk-add-pull-request-comment.mjs.map +1 -1
  34. package/dist/lib/chunk-add-pull-request-review-comment.mjs.map +1 -1
  35. package/dist/lib/chunk-connector.mjs.map +1 -1
  36. package/dist/lib/chunk-generate-walkthrough.mjs.map +1 -1
  37. package/dist/lib/chunk-get-pull-request-diff.mjs.map +1 -1
  38. package/dist/lib/chunk-get-pull-request-status.mjs.map +1 -1
  39. package/dist/lib/chunk-get-repositories.mjs.map +1 -1
  40. package/dist/lib/chunk-github-api.mjs +1 -0
  41. package/dist/lib/chunk-github-api.mjs.map +1 -1
  42. package/dist/lib/chunk-import-pull-request.mjs.map +1 -1
  43. package/dist/lib/chunk-link-resolver.mjs.map +1 -1
  44. package/dist/lib/chunk-pull-request2.mjs +1 -0
  45. package/dist/lib/chunk-pull-request2.mjs.map +1 -1
  46. package/dist/lib/chunk-react-surface.mjs +4 -4
  47. package/dist/lib/chunk-react-surface.mjs.map +1 -1
  48. package/dist/lib/chunk-submit-pull-request-approval.mjs.map +1 -1
  49. package/dist/lib/chunk-sync.mjs.map +1 -1
  50. package/dist/lib/index.mjs +2 -2
  51. package/dist/lib/meta.mjs.map +1 -1
  52. package/dist/lib/ns/Extensions.mjs +2 -16
  53. package/dist/lib/types.mjs +4 -4
  54. package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -1
  55. package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -1
  56. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  57. package/dist/types/src/cards/GitHubCard.d.ts.map +1 -1
  58. package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts +1 -1
  59. package/dist/types/src/components/PullRequestOverview/CheckRunList.d.ts.map +1 -1
  60. package/dist/types/src/components/PullRequestOverview/PullRequestOverview.d.ts.map +1 -1
  61. package/dist/types/src/operations/pull-request.d.ts.map +1 -1
  62. package/dist/types/src/services/github-api.d.ts +1 -0
  63. package/dist/types/src/services/github-api.d.ts.map +1 -1
  64. package/dist/types/src/stories/PullRequestOverview.stories.d.ts +2 -0
  65. package/dist/types/src/stories/PullRequestOverview.stories.d.ts.map +1 -1
  66. package/dist/types/src/types/GitHubOperation.d.ts +3 -0
  67. package/dist/types/src/types/GitHubOperation.d.ts.map +1 -1
  68. package/dist/types/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +47 -47
  70. package/src/capabilities/gen/browser.ts +1 -3
  71. package/src/capabilities/gen/tauri.ts +1 -3
  72. package/src/capabilities/index.ts +1 -4
  73. package/src/cards/GitHubCard.tsx +7 -3
  74. package/src/components/PullRequestOverview/CheckRunList.tsx +34 -6
  75. package/src/components/PullRequestOverview/PullRequestOverview.tsx +5 -1
  76. package/src/containers/PullRequestsArticle/PullRequestsArticle.tsx +12 -10
  77. package/src/operations/pull-request.ts +1 -0
  78. package/src/services/github-api.ts +1 -0
  79. package/src/stories/PullRequestOverview.stories.tsx +20 -0
  80. package/src/types/GitHubOperation.ts +2 -0
  81. package/dist/lib/GitHubCapabilities.mjs.map +0 -1
  82. package/dist/lib/GitHubEvents.mjs.map +0 -1
  83. package/dist/lib/GitHubOperation.mjs.map +0 -1
  84. package/dist/lib/GitHubPlugin.mjs.map +0 -1
  85. package/dist/lib/Walkthrough.mjs.map +0 -1
  86. package/dist/lib/ns/Extensions.mjs.map +0 -1
@@ -14,11 +14,11 @@ import * as Schema from "effect/Schema";
14
14
  import * as AppCapabilities from "@dxos/app-toolkit/AppCapabilities";
15
15
  import * as LayoutOperation from "@dxos/app-toolkit/LayoutOperation";
16
16
  import { log } from "@dxos/log";
17
+ import { useObject, useQuery } from "@dxos/echo-react";
17
18
  import * as Card from "@dxos/react-ui/Card";
18
19
  import * as Hooks from "@dxos/react-ui/Hooks";
19
20
  import * as Layout from "@dxos/react-ui/Layout";
20
21
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
21
- import { useObject, useQuery } from "@dxos/echo-react";
22
22
  import * as Hooks$1 from "@dxos/app-framework/Hooks";
23
23
  import * as ToolkitHooks from "@dxos/app-toolkit/Hooks";
24
24
  import * as EffectEx from "@dxos/effect/EffectEx";
@@ -40,6 +40,7 @@ import { TextEditor } from "@dxos/react-ui-editor";
40
40
  import { DxAnchor } from "@dxos/lit-ui/react";
41
41
  import { MarkdownLink, MarkdownView } from "@dxos/react-ui-markdown";
42
42
  import * as Icon from "@dxos/react-ui/Icon";
43
+ import * as Typography from "@dxos/react-ui/Typography";
43
44
  import { Masonry } from "@dxos/react-ui-masonry";
44
45
  //#region src/components/PullRequestFiles/files.ts
45
46
  /** Id of the synthetic root the tree model anchors its top-level rows to; never rendered. */
@@ -642,20 +643,25 @@ var useNow = (active) => {
642
643
  }, [active]);
643
644
  return now;
644
645
  };
646
+ /** The row's value: GitHub's run id, or its name and URL for a run recorded without one. */
647
+ var checkRunId = (run) => run.id !== void 0 ? String(run.id) : `${run.name}-${run.url ?? ""}`;
645
648
  /** Sorts runs by what needs attention, then by name so shards read in order. */
646
649
  var sortCheckRuns = (runs) => [...runs].sort((a, b) => outcomeOrder.indexOf(a.outcome) - outcomeOrder.indexOf(b.outcome) || a.name.localeCompare(b.name, void 0, { numeric: true }));
647
- /** Every check on the head commit: its outcome, how long it took, and its logs a click away. */
650
+ /** Every check on the head commit: its outcome, how long it took, and a button to its logs. */
648
651
  var CheckRunList = ({ runs }) => {
649
652
  const { t } = Hooks.useTranslation(meta.profile.key);
650
653
  const sorted = useMemo(() => runs ? sortCheckRuns(runs) : void 0, [runs]);
651
654
  const summary = useCheckSummary(runs);
652
655
  const now = useNow(runs?.some((run) => run.outcome === "pending" && run.startedAt) ?? false);
656
+ const [current, setCurrent] = useState();
653
657
  if (!sorted || sorted.length === 0) return /* @__PURE__ */ jsx(Status.Empty, { children: t(sorted ? "no-checks.message" : "checks-loading.message") });
654
658
  return /* @__PURE__ */ jsx(Listbox.Root, {
655
659
  items: sorted.map((run) => ({
656
- value: `${run.name}-${run.url ?? ""}`,
660
+ value: checkRunId(run),
657
661
  label: run.name
658
662
  })),
663
+ columns: "var(--dx-block-size) minmax(0, 1fr) max-content var(--dx-block-size)",
664
+ onHighlightChange: (value) => value && setCurrent(value),
659
665
  children: /* @__PURE__ */ jsx(Listbox.Content, {
660
666
  "aria-label": summary,
661
667
  "data-testid": "pull-request.checks",
@@ -665,20 +671,34 @@ var CheckRunList = ({ runs }) => {
665
671
  const detail = run.conclusion && run.conclusion !== run.outcome && run.conclusion !== "failure" ? run.conclusion.replace(/_/g, " ") : void 0;
666
672
  const outcome = run.outcome === "skipped" ? t("check-outcome.skipped.label") : run.outcome === "pending" ? [t("check-outcome.pending.label"), duration].filter(Boolean).join(" · ") : duration ?? t(`check-outcome.${run.outcome}.label`);
667
673
  const url = run.url;
674
+ const id = checkRunId(run);
668
675
  return /* @__PURE__ */ jsxs(Listbox.Item, {
669
- id: `${run.name}-${url ?? ""}`,
676
+ id,
677
+ current: id === current,
678
+ highlightOnHover: false,
679
+ classNames: "dx-hover",
670
680
  "data-outcome": run.outcome,
671
681
  "data-testid": "pull-request.check",
672
- onClick: url ? () => window.open(url, "_blank", "noopener,noreferrer") : void 0,
673
682
  children: [
674
683
  /* @__PURE__ */ jsx(Listbox.ItemIcon, {
675
684
  icon,
676
685
  classNames
677
686
  }),
678
687
  /* @__PURE__ */ jsx(Listbox.ItemText, { children: run.name }),
679
- /* @__PURE__ */ jsx(Listbox.ItemDescription, { children: [detail, outcome].filter(Boolean).join(" · ") })
688
+ /* @__PURE__ */ jsx(Listbox.ItemDescription, {
689
+ classNames: "text-right tabular-nums",
690
+ children: [detail, outcome].filter(Boolean).join(" · ")
691
+ }),
692
+ url ? /* @__PURE__ */ jsx(Button.Root, {
693
+ iconOnly: true,
694
+ variant: "ghost",
695
+ icon: "ph--arrow-square-out--regular",
696
+ label: t("open-link.label"),
697
+ "data-testid": "pull-request.check.open",
698
+ onClick: () => window.open(url, "_blank", "noopener,noreferrer")
699
+ }) : /* @__PURE__ */ jsx("span", {})
680
700
  ]
681
- }, `${run.name}-${url ?? ""}`);
701
+ }, id);
682
702
  })
683
703
  })
684
704
  });
@@ -960,9 +980,12 @@ var PullRequestOverview = ({ body, details, runs }) => {
960
980
  label: t("related.label"),
961
981
  children: /* @__PURE__ */ jsx(RelatedCards, { items: related })
962
982
  }),
963
- /* @__PURE__ */ jsx(Form.FieldSet, {
964
- label: checkSummary,
965
- children: /* @__PURE__ */ jsx(CheckRunList, { runs })
983
+ /* @__PURE__ */ jsxs(Form.FieldSet, {
984
+ label: t("checks.label"),
985
+ children: [runs && runs.length > 0 && /* @__PURE__ */ jsx(Typography.Text, {
986
+ "data-testid": "pull-request.checks.summary",
987
+ children: checkSummary
988
+ }), /* @__PURE__ */ jsx(CheckRunList, { runs })]
966
989
  })
967
990
  ] })
968
991
  })