@dxos/plugin-github 0.6.13-staging.1e988a3 → 0.6.14-main.2b6a0f3
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/dist/lib/browser/chunk-KVP4SDH2.mjs +20 -0
- package/dist/lib/browser/chunk-KVP4SDH2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +69 -144
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/types/src/GithubPlugin.d.ts.map +1 -1
- package/dist/types/src/components/EmbeddedMain/EmbeddedMain.d.ts.map +1 -1
- package/dist/types/src/components/Loading/Loading.stories.d.ts +3 -15
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +5 -9
- package/dist/types/src/meta.d.ts.map +1 -1
- package/package.json +23 -22
- package/src/GithubPlugin.tsx +1 -3
- package/src/components/EmbeddedMain/EmbeddedMain.tsx +162 -165
- package/src/components/EmbeddedMain/GfmPreview.tsx +1 -1
- package/src/components/Loading/Loading.stories.tsx +11 -7
- package/src/meta.ts +17 -0
- package/dist/lib/browser/chunk-NJP5BGD2.mjs +0 -24
- package/dist/lib/browser/chunk-NJP5BGD2.mjs.map +0 -7
- package/src/meta.tsx +0 -21
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// packages/plugins/experimental/plugin-github/src/meta.ts
|
|
2
|
+
var GITHUB_PLUGIN = "dxos.org/plugin/github";
|
|
3
|
+
var GITHUB_PLUGIN_SHORT_ID = "github";
|
|
4
|
+
var meta_default = {
|
|
5
|
+
id: GITHUB_PLUGIN,
|
|
6
|
+
shortId: GITHUB_PLUGIN_SHORT_ID,
|
|
7
|
+
name: "GitHub",
|
|
8
|
+
description: "GitHub integration.",
|
|
9
|
+
tags: [
|
|
10
|
+
"experimental"
|
|
11
|
+
],
|
|
12
|
+
icon: "ph--github-logo--regular"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
GITHUB_PLUGIN,
|
|
17
|
+
GITHUB_PLUGIN_SHORT_ID,
|
|
18
|
+
meta_default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=chunk-KVP4SDH2.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const GITHUB_PLUGIN = 'dxos.org/plugin/github';\nexport const GITHUB_PLUGIN_SHORT_ID = 'github';\n\nexport default {\n id: GITHUB_PLUGIN,\n shortId: GITHUB_PLUGIN_SHORT_ID,\n name: 'GitHub',\n description: 'GitHub integration.',\n tags: ['experimental'],\n icon: 'ph--github-logo--regular',\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,gBAAgB;AACtB,IAAMC,yBAAyB;AAEtC,IAAA,eAAe;EACbC,IAAIF;EACJG,SAASF;EACTG,MAAM;EACNC,aAAa;EACbC,MAAM;IAAC;;EACPC,MAAM;AACR;",
|
|
6
|
+
"names": ["GITHUB_PLUGIN", "GITHUB_PLUGIN_SHORT_ID", "id", "shortId", "name", "description", "tags", "icon"]
|
|
7
|
+
}
|
|
@@ -2,14 +2,13 @@ import {
|
|
|
2
2
|
GITHUB_PLUGIN,
|
|
3
3
|
GITHUB_PLUGIN_SHORT_ID,
|
|
4
4
|
meta_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KVP4SDH2.mjs";
|
|
6
6
|
|
|
7
7
|
// packages/plugins/experimental/plugin-github/src/GithubPlugin.tsx
|
|
8
|
-
import
|
|
9
|
-
import React16 from "react";
|
|
8
|
+
import React14 from "react";
|
|
10
9
|
import { resolvePlugin } from "@dxos/app-framework";
|
|
11
10
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
12
|
-
import { log as
|
|
11
|
+
import { log as log6 } from "@dxos/log";
|
|
13
12
|
import { parseClientPlugin } from "@dxos/plugin-client";
|
|
14
13
|
import { createExtension } from "@dxos/plugin-graph";
|
|
15
14
|
import { isMarkdownProperties } from "@dxos/plugin-markdown";
|
|
@@ -24,7 +23,7 @@ import { Surface, useIntent } from "@dxos/app-framework";
|
|
|
24
23
|
import { SPACE_PLUGIN, SpaceAction, getSpaceDisplayName as getSpaceDisplayName2 } from "@dxos/plugin-space";
|
|
25
24
|
import { useClient as useClient2 } from "@dxos/react-client";
|
|
26
25
|
import { getMeta as getMeta2 } from "@dxos/react-client/echo";
|
|
27
|
-
import { Avatar, Button as Button4, ButtonGroup,
|
|
26
|
+
import { Avatar, Button as Button4, ButtonGroup, Dialog as Dialog2, DropdownMenu, Main, Toggle, Tooltip as Tooltip2, toLocalizedString, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
28
27
|
import { defaultTx, descriptionText, getSize as getSize3, mx as mx4 } from "@dxos/react-ui-theme";
|
|
29
28
|
import { hexToFallback } from "@dxos/util";
|
|
30
29
|
|
|
@@ -282,7 +281,7 @@ var GfmPreview = ({ markdown, owner, repo }) => {
|
|
|
282
281
|
markdown,
|
|
283
282
|
octokit
|
|
284
283
|
]);
|
|
285
|
-
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("
|
|
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", {
|
|
286
285
|
className: "markdown-body grow is-full max-is-[980px] mli-auto p-[15px] sm:pli-[45px] sm:plb-[30px]",
|
|
287
286
|
dangerouslySetInnerHTML: sanitize(html, {})
|
|
288
287
|
})) : /* @__PURE__ */ React4.createElement("div", {
|
|
@@ -824,9 +823,7 @@ var EmbeddedLayoutImpl = () => {
|
|
|
824
823
|
.dark:root {
|
|
825
824
|
--surface-bg: #161b22;
|
|
826
825
|
}
|
|
827
|
-
`), /* @__PURE__ */ React10.createElement(
|
|
828
|
-
density: "fine"
|
|
829
|
-
}, /* @__PURE__ */ React10.createElement("div", {
|
|
826
|
+
`), /* @__PURE__ */ React10.createElement("div", {
|
|
830
827
|
role: "none",
|
|
831
828
|
className: "fixed inline-end-2 block-end-2 z-10 flex gap-2"
|
|
832
829
|
}, /* @__PURE__ */ React10.createElement(Tooltip2.Root, null, /* @__PURE__ */ React10.createElement(Tooltip2.Trigger, {
|
|
@@ -990,26 +987,21 @@ var EmbeddedLayoutImpl = () => {
|
|
|
990
987
|
}, /* @__PURE__ */ React10.createElement(Dialog2.Content, null, /* @__PURE__ */ React10.createElement(ResolverDialog, {
|
|
991
988
|
handleCreateSpace,
|
|
992
989
|
handleJoinSpace
|
|
993
|
-
})))))
|
|
990
|
+
})))));
|
|
994
991
|
};
|
|
995
992
|
var EmbeddedMain = () => {
|
|
996
993
|
return /* @__PURE__ */ React10.createElement(SpaceResolverProvider, null, /* @__PURE__ */ React10.createElement(DocumentResolverProvider, null, /* @__PURE__ */ React10.createElement(EmbeddedLayoutImpl, null)));
|
|
997
994
|
};
|
|
998
995
|
|
|
999
|
-
// packages/plugins/experimental/plugin-github/src/components/ExportDialog.tsx
|
|
1000
|
-
import React11, { useCallback as useCallback3, useState as useState7 } from "react";
|
|
1001
|
-
import { log as log4 } from "@dxos/log";
|
|
1002
|
-
import { Button as Button5, Dialog as Dialog3, Input as Input2, Trans as Trans2, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1003
|
-
|
|
1004
996
|
// packages/plugins/experimental/plugin-github/src/components/ImportDialog.tsx
|
|
1005
|
-
import
|
|
1006
|
-
import { log as
|
|
1007
|
-
import { Button as
|
|
997
|
+
import React11, { useCallback as useCallback3 } from "react";
|
|
998
|
+
import { log as log4 } from "@dxos/log";
|
|
999
|
+
import { Button as Button5, Dialog as Dialog3, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1008
1000
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/components/ImportDialog.tsx";
|
|
1009
1001
|
var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
1010
|
-
const { t } =
|
|
1002
|
+
const { t } = useTranslation8(GITHUB_PLUGIN);
|
|
1011
1003
|
const { octokit } = useOctokitContext();
|
|
1012
|
-
const importGhIssueContent =
|
|
1004
|
+
const importGhIssueContent = useCallback3(async () => {
|
|
1013
1005
|
if (octokit && docGhId && "issueNumber") {
|
|
1014
1006
|
try {
|
|
1015
1007
|
const { owner, repo, issueNumber } = docGhId;
|
|
@@ -1020,7 +1012,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1020
1012
|
});
|
|
1021
1013
|
onUpdate(data.body ?? "");
|
|
1022
1014
|
} catch (err) {
|
|
1023
|
-
|
|
1015
|
+
log4.error("Failed to import from Github issue", err, {
|
|
1024
1016
|
F: __dxlog_file4,
|
|
1025
1017
|
L: 25,
|
|
1026
1018
|
S: void 0,
|
|
@@ -1028,7 +1020,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1028
1020
|
});
|
|
1029
1021
|
}
|
|
1030
1022
|
} else {
|
|
1031
|
-
|
|
1023
|
+
log4.error("Not prepared to import from Github issue when requested.", void 0, {
|
|
1032
1024
|
F: __dxlog_file4,
|
|
1033
1025
|
L: 28,
|
|
1034
1026
|
S: void 0,
|
|
@@ -1039,7 +1031,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1039
1031
|
octokit,
|
|
1040
1032
|
docGhId
|
|
1041
1033
|
]);
|
|
1042
|
-
const importGhFileContent =
|
|
1034
|
+
const importGhFileContent = useCallback3(async () => {
|
|
1043
1035
|
if (octokit && docGhId && "path" in docGhId) {
|
|
1044
1036
|
try {
|
|
1045
1037
|
const { owner, repo, path } = docGhId;
|
|
@@ -1051,7 +1043,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1051
1043
|
if (!Array.isArray(data) && data.type === "file") {
|
|
1052
1044
|
onUpdate(atob(data.content));
|
|
1053
1045
|
} else {
|
|
1054
|
-
|
|
1046
|
+
log4.error("Did not receive file with content from Github.", void 0, {
|
|
1055
1047
|
F: __dxlog_file4,
|
|
1056
1048
|
L: 40,
|
|
1057
1049
|
S: void 0,
|
|
@@ -1059,7 +1051,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1059
1051
|
});
|
|
1060
1052
|
}
|
|
1061
1053
|
} catch (err) {
|
|
1062
|
-
|
|
1054
|
+
log4.error("Failed to import from Github file", err, {
|
|
1063
1055
|
F: __dxlog_file4,
|
|
1064
1056
|
L: 43,
|
|
1065
1057
|
S: void 0,
|
|
@@ -1067,7 +1059,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1067
1059
|
});
|
|
1068
1060
|
}
|
|
1069
1061
|
} else {
|
|
1070
|
-
|
|
1062
|
+
log4.error("Not prepared to import from Github file when requested.", void 0, {
|
|
1071
1063
|
F: __dxlog_file4,
|
|
1072
1064
|
L: 46,
|
|
1073
1065
|
S: void 0,
|
|
@@ -1078,112 +1070,46 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1078
1070
|
octokit,
|
|
1079
1071
|
docGhId
|
|
1080
1072
|
]);
|
|
1081
|
-
const handleGhImport =
|
|
1073
|
+
const handleGhImport = useCallback3(() => {
|
|
1082
1074
|
return docGhId && ("issueNumber" in docGhId ? importGhIssueContent() : "path" in docGhId ? importGhFileContent() : null);
|
|
1083
1075
|
}, [
|
|
1084
1076
|
importGhIssueContent,
|
|
1085
1077
|
importGhFileContent,
|
|
1086
1078
|
docGhId
|
|
1087
1079
|
]);
|
|
1088
|
-
return /* @__PURE__ */
|
|
1080
|
+
return /* @__PURE__ */ React11.createElement(Dialog3.Content, null, /* @__PURE__ */ React11.createElement(Dialog3.Title, null, t("confirm import title")), /* @__PURE__ */ React11.createElement("p", {
|
|
1089
1081
|
className: "plb-2"
|
|
1090
|
-
}, t("confirm import body")), /* @__PURE__ */
|
|
1082
|
+
}, t("confirm import body")), /* @__PURE__ */ React11.createElement("div", {
|
|
1091
1083
|
role: "none",
|
|
1092
1084
|
className: "flex justify-end gap-2"
|
|
1093
|
-
}, /* @__PURE__ */
|
|
1085
|
+
}, /* @__PURE__ */ React11.createElement(Dialog3.Close, {
|
|
1094
1086
|
asChild: true
|
|
1095
|
-
}, /* @__PURE__ */
|
|
1087
|
+
}, /* @__PURE__ */ React11.createElement(Button5, null, t("cancel label", {
|
|
1096
1088
|
ns: "appkit"
|
|
1097
|
-
}))), /* @__PURE__ */
|
|
1089
|
+
}))), /* @__PURE__ */ React11.createElement(Dialog3.Close, {
|
|
1098
1090
|
asChild: true
|
|
1099
|
-
}, /* @__PURE__ */
|
|
1091
|
+
}, /* @__PURE__ */ React11.createElement(Button5, {
|
|
1100
1092
|
variant: "primary",
|
|
1101
1093
|
onClick: handleGhImport
|
|
1102
1094
|
}, t("import from github label")))));
|
|
1103
1095
|
};
|
|
1104
1096
|
|
|
1105
|
-
// packages/plugins/experimental/plugin-github/src/components/Issue.tsx
|
|
1106
|
-
import { IconBase } from "@phosphor-icons/react";
|
|
1107
|
-
import React13, { forwardRef } from "react";
|
|
1108
|
-
var weights = /* @__PURE__ */ new Map([
|
|
1109
|
-
[
|
|
1110
|
-
"bold",
|
|
1111
|
-
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1112
|
-
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"
|
|
1113
|
-
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1114
|
-
d: "M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128Z"
|
|
1115
|
-
}))
|
|
1116
|
-
],
|
|
1117
|
-
[
|
|
1118
|
-
"duotone",
|
|
1119
|
-
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1120
|
-
d: "M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",
|
|
1121
|
-
opacity: "0.2"
|
|
1122
|
-
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1123
|
-
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"
|
|
1124
|
-
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1125
|
-
d: "M176,128a48,48,0,1,1-48-48A48,48,0,0,1,176,128Z",
|
|
1126
|
-
opacity: "0.2"
|
|
1127
|
-
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1128
|
-
d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z"
|
|
1129
|
-
}))
|
|
1130
|
-
],
|
|
1131
|
-
[
|
|
1132
|
-
"fill",
|
|
1133
|
-
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1134
|
-
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"
|
|
1135
|
-
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1136
|
-
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"
|
|
1137
|
-
}))
|
|
1138
|
-
],
|
|
1139
|
-
[
|
|
1140
|
-
"light",
|
|
1141
|
-
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1142
|
-
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"
|
|
1143
|
-
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1144
|
-
d: "M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128Z"
|
|
1145
|
-
}))
|
|
1146
|
-
],
|
|
1147
|
-
[
|
|
1148
|
-
"regular",
|
|
1149
|
-
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1150
|
-
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"
|
|
1151
|
-
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1152
|
-
d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z"
|
|
1153
|
-
}))
|
|
1154
|
-
],
|
|
1155
|
-
[
|
|
1156
|
-
"thin",
|
|
1157
|
-
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1158
|
-
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"
|
|
1159
|
-
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1160
|
-
d: "M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Z"
|
|
1161
|
-
}))
|
|
1162
|
-
]
|
|
1163
|
-
]);
|
|
1164
|
-
var Issue = /* @__PURE__ */ forwardRef((props, ref) => /* @__PURE__ */ React13.createElement(IconBase, {
|
|
1165
|
-
ref,
|
|
1166
|
-
...props,
|
|
1167
|
-
weights
|
|
1168
|
-
}));
|
|
1169
|
-
Issue.displayName = "Issue";
|
|
1170
|
-
|
|
1171
1097
|
// packages/plugins/experimental/plugin-github/src/components/MarkdownActions.tsx
|
|
1172
1098
|
import { ArrowSquareOut as ArrowSquareOut3, FileArrowDown, FileArrowUp, Link as Link2, LinkBreak } from "@phosphor-icons/react";
|
|
1173
|
-
import
|
|
1099
|
+
import React12, { useCallback as useCallback4 } from "react";
|
|
1174
1100
|
import { LayoutAction, useIntent as useIntent2 } from "@dxos/app-framework";
|
|
1175
|
-
import { log as
|
|
1101
|
+
import { log as log5 } from "@dxos/log";
|
|
1176
1102
|
import { getMeta as getMeta3 } from "@dxos/react-client/echo";
|
|
1177
|
-
import { DropdownMenu as DropdownMenu2, useTranslation as
|
|
1103
|
+
import { DropdownMenu as DropdownMenu2, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
1178
1104
|
import { getSize as getSize4 } from "@dxos/react-ui-theme";
|
|
1179
1105
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/components/MarkdownActions.tsx";
|
|
1180
1106
|
var MarkdownActions = ({ content, properties }) => {
|
|
1181
1107
|
const ghId = getMeta3(properties)?.keys?.find((key) => key.source === "github.com")?.id;
|
|
1182
1108
|
const { octokit } = useOctokitContext();
|
|
1183
|
-
const { t } =
|
|
1109
|
+
const { t } = useTranslation9(GITHUB_PLUGIN);
|
|
1184
1110
|
const { dispatch } = useIntent2();
|
|
1185
1111
|
const docGhId = useDocGhId(properties.__meta?.keys ?? []);
|
|
1186
|
-
const updateIssueContent =
|
|
1112
|
+
const updateIssueContent = useCallback4(() => {
|
|
1187
1113
|
const { owner, repo, issueNumber } = docGhId;
|
|
1188
1114
|
return octokit.rest.issues.update({
|
|
1189
1115
|
owner,
|
|
@@ -1196,7 +1122,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1196
1122
|
docGhId,
|
|
1197
1123
|
content
|
|
1198
1124
|
]);
|
|
1199
|
-
const exportGhIssueContent =
|
|
1125
|
+
const exportGhIssueContent = useCallback4(async () => {
|
|
1200
1126
|
if (octokit && docGhId && "issueNumber" in docGhId && content) {
|
|
1201
1127
|
try {
|
|
1202
1128
|
const { data: { html_url: issueUrl } } = await updateIssueContent();
|
|
@@ -1214,7 +1140,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1214
1140
|
}
|
|
1215
1141
|
});
|
|
1216
1142
|
} catch (err) {
|
|
1217
|
-
|
|
1143
|
+
log5.error("Failed to export to Github issue", void 0, {
|
|
1218
1144
|
F: __dxlog_file5,
|
|
1219
1145
|
L: 56,
|
|
1220
1146
|
S: void 0,
|
|
@@ -1222,7 +1148,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1222
1148
|
});
|
|
1223
1149
|
}
|
|
1224
1150
|
} else {
|
|
1225
|
-
|
|
1151
|
+
log5.error("Not prepared to export to Github issue when requested.", void 0, {
|
|
1226
1152
|
F: __dxlog_file5,
|
|
1227
1153
|
L: 59,
|
|
1228
1154
|
S: void 0,
|
|
@@ -1234,7 +1160,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1234
1160
|
docGhId,
|
|
1235
1161
|
content
|
|
1236
1162
|
]);
|
|
1237
|
-
const handleGhExport =
|
|
1163
|
+
const handleGhExport = useCallback4(() => {
|
|
1238
1164
|
if ("issueNumber" in docGhId) {
|
|
1239
1165
|
void exportGhIssueContent();
|
|
1240
1166
|
} else if ("path" in docGhId) {
|
|
@@ -1255,7 +1181,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1255
1181
|
exportGhIssueContent,
|
|
1256
1182
|
docGhId
|
|
1257
1183
|
]);
|
|
1258
|
-
return /* @__PURE__ */
|
|
1184
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(DropdownMenu2.GroupLabel, null, t("markdown actions label")), docGhId ? /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(DropdownMenu2.Item, {
|
|
1259
1185
|
classNames: "gap-2",
|
|
1260
1186
|
disabled: !docGhId,
|
|
1261
1187
|
onClick: () => (
|
|
@@ -1271,43 +1197,43 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1271
1197
|
}
|
|
1272
1198
|
})
|
|
1273
1199
|
)
|
|
1274
|
-
}, /* @__PURE__ */
|
|
1200
|
+
}, /* @__PURE__ */ React12.createElement(FileArrowDown, {
|
|
1275
1201
|
className: getSize4(4)
|
|
1276
|
-
}), /* @__PURE__ */
|
|
1202
|
+
}), /* @__PURE__ */ React12.createElement("span", {
|
|
1277
1203
|
className: "grow"
|
|
1278
|
-
}, t("import from github label"))), /* @__PURE__ */
|
|
1204
|
+
}, t("import from github label"))), /* @__PURE__ */ React12.createElement(DropdownMenu2.Item, {
|
|
1279
1205
|
classNames: "gap-2",
|
|
1280
1206
|
disabled: !docGhId,
|
|
1281
1207
|
onClick: () => docGhId && handleGhExport()
|
|
1282
|
-
}, /* @__PURE__ */
|
|
1208
|
+
}, /* @__PURE__ */ React12.createElement(FileArrowUp, {
|
|
1283
1209
|
className: getSize4(4)
|
|
1284
|
-
}), /* @__PURE__ */
|
|
1210
|
+
}), /* @__PURE__ */ React12.createElement("span", {
|
|
1285
1211
|
className: "grow"
|
|
1286
|
-
}, t("export to github label"))), /* @__PURE__ */
|
|
1212
|
+
}, t("export to github label"))), /* @__PURE__ */ React12.createElement(DropdownMenu2.Item, {
|
|
1287
1213
|
asChild: true,
|
|
1288
1214
|
classNames: "gap-2",
|
|
1289
1215
|
disabled: !ghId
|
|
1290
|
-
}, /* @__PURE__ */
|
|
1216
|
+
}, /* @__PURE__ */ React12.createElement("a", ghId ? {
|
|
1291
1217
|
href: `https://github.com/${ghId}`,
|
|
1292
1218
|
target: "_blank",
|
|
1293
1219
|
rel: "noreferrer"
|
|
1294
1220
|
} : {
|
|
1295
1221
|
href: "#"
|
|
1296
|
-
}, /* @__PURE__ */
|
|
1222
|
+
}, /* @__PURE__ */ React12.createElement(ArrowSquareOut3, {
|
|
1297
1223
|
className: getSize4(4)
|
|
1298
|
-
}), /* @__PURE__ */
|
|
1224
|
+
}), /* @__PURE__ */ React12.createElement("span", {
|
|
1299
1225
|
className: "grow"
|
|
1300
|
-
}, t("open in github label")))), /* @__PURE__ */
|
|
1226
|
+
}, t("open in github label")))), /* @__PURE__ */ React12.createElement(DropdownMenu2.Item, {
|
|
1301
1227
|
classNames: "gap-2",
|
|
1302
1228
|
onClick: () => {
|
|
1303
1229
|
const index = getMeta3(properties)?.keys?.findIndex((key) => key.source === "github.com");
|
|
1304
1230
|
typeof index !== "undefined" && index >= 0 && properties.__meta?.keys?.splice(index, 1);
|
|
1305
1231
|
}
|
|
1306
|
-
}, /* @__PURE__ */
|
|
1232
|
+
}, /* @__PURE__ */ React12.createElement(LinkBreak, {
|
|
1307
1233
|
className: getSize4(4)
|
|
1308
|
-
}), /* @__PURE__ */
|
|
1234
|
+
}), /* @__PURE__ */ React12.createElement("span", {
|
|
1309
1235
|
className: "grow"
|
|
1310
|
-
}, t("unbind to file in github label")))) : /* @__PURE__ */
|
|
1236
|
+
}, t("unbind to file in github label")))) : /* @__PURE__ */ React12.createElement(DropdownMenu2.Item, {
|
|
1311
1237
|
classNames: "gap-2",
|
|
1312
1238
|
onClick: () => dispatch({
|
|
1313
1239
|
action: LayoutAction.SET_LAYOUT,
|
|
@@ -1317,34 +1243,34 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1317
1243
|
subject: properties
|
|
1318
1244
|
}
|
|
1319
1245
|
})
|
|
1320
|
-
}, /* @__PURE__ */
|
|
1246
|
+
}, /* @__PURE__ */ React12.createElement(Link2, {
|
|
1321
1247
|
className: getSize4(4)
|
|
1322
|
-
}), /* @__PURE__ */
|
|
1248
|
+
}), /* @__PURE__ */ React12.createElement("span", {
|
|
1323
1249
|
className: "grow"
|
|
1324
1250
|
}, t("bind to file in github label"))));
|
|
1325
1251
|
};
|
|
1326
1252
|
|
|
1327
1253
|
// packages/plugins/experimental/plugin-github/src/components/UrlDialog.tsx
|
|
1328
|
-
import
|
|
1329
|
-
import { Dialog as
|
|
1254
|
+
import React13, { useState as useState7 } from "react";
|
|
1255
|
+
import { Dialog as Dialog4, Button as Button6, useTranslation as useTranslation10, Input as Input2 } from "@dxos/react-ui";
|
|
1330
1256
|
var UrlDialog = ({ properties }) => {
|
|
1331
|
-
const { t } =
|
|
1332
|
-
const [ghUrlValue, setGhUrlValue] =
|
|
1257
|
+
const { t } = useTranslation10(GITHUB_PLUGIN);
|
|
1258
|
+
const [ghUrlValue, setGhUrlValue] = useState7("");
|
|
1333
1259
|
const ghId = useGhIdFromUrl(ghUrlValue);
|
|
1334
|
-
return /* @__PURE__ */
|
|
1260
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(Dialog4.Title, {
|
|
1335
1261
|
classNames: "mbe-2"
|
|
1336
|
-
}, t("bind to file in github label")), /* @__PURE__ */
|
|
1262
|
+
}, t("bind to file in github label")), /* @__PURE__ */ React13.createElement(Input2.Root, {
|
|
1337
1263
|
validationValence: "error"
|
|
1338
|
-
}, /* @__PURE__ */
|
|
1264
|
+
}, /* @__PURE__ */ React13.createElement(Input2.Label, null, t("paste url to file in github label")), /* @__PURE__ */ React13.createElement(Input2.TextInput, {
|
|
1339
1265
|
placeholder: t("paste url to file in github placeholder"),
|
|
1340
1266
|
value: ghUrlValue,
|
|
1341
1267
|
onChange: ({ target: { value } }) => setGhUrlValue(value)
|
|
1342
|
-
}), /* @__PURE__ */
|
|
1268
|
+
}), /* @__PURE__ */ React13.createElement(Input2.DescriptionAndValidation, null, ghUrlValue.length > 0 && !ghId && /* @__PURE__ */ React13.createElement(Input2.Validation, null, t("error github markdown path message")), /* @__PURE__ */ React13.createElement(Input2.Description, null, t("paste url to file in github description")))), /* @__PURE__ */ React13.createElement("div", {
|
|
1343
1269
|
role: "none",
|
|
1344
1270
|
className: "flex justify-end gap-2"
|
|
1345
|
-
}, /* @__PURE__ */
|
|
1271
|
+
}, /* @__PURE__ */ React13.createElement(Dialog4.Close, {
|
|
1346
1272
|
asChild: true
|
|
1347
|
-
}, /* @__PURE__ */
|
|
1273
|
+
}, /* @__PURE__ */ React13.createElement(Button6, {
|
|
1348
1274
|
classNames: "mbs-2",
|
|
1349
1275
|
onClick: () => {
|
|
1350
1276
|
if (ghId && document) {
|
|
@@ -1461,8 +1387,7 @@ var GithubPlugin = () => {
|
|
|
1461
1387
|
ns: GITHUB_PLUGIN
|
|
1462
1388
|
}
|
|
1463
1389
|
],
|
|
1464
|
-
icon:
|
|
1465
|
-
iconSymbol: "ph--github-logo--regular"
|
|
1390
|
+
icon: "ph--github-logo--regular"
|
|
1466
1391
|
}
|
|
1467
1392
|
}
|
|
1468
1393
|
];
|
|
@@ -1471,7 +1396,7 @@ var GithubPlugin = () => {
|
|
|
1471
1396
|
});
|
|
1472
1397
|
}
|
|
1473
1398
|
},
|
|
1474
|
-
context: (props) => /* @__PURE__ */
|
|
1399
|
+
context: (props) => /* @__PURE__ */ React14.createElement(OctokitProvider, {
|
|
1475
1400
|
pat: settings.values.pat,
|
|
1476
1401
|
onPatChanged: (pat) => settings.values.pat = pat,
|
|
1477
1402
|
...props
|
|
@@ -1480,13 +1405,13 @@ var GithubPlugin = () => {
|
|
|
1480
1405
|
component: ({ data, role }) => {
|
|
1481
1406
|
switch (data.component) {
|
|
1482
1407
|
case `${GITHUB_PLUGIN}/embedded`:
|
|
1483
|
-
return /* @__PURE__ */
|
|
1408
|
+
return /* @__PURE__ */ React14.createElement(EmbeddedMain, null);
|
|
1484
1409
|
}
|
|
1485
1410
|
switch (role) {
|
|
1486
1411
|
case "dialog":
|
|
1487
1412
|
switch (data.content) {
|
|
1488
1413
|
case "dxos.org/plugin/github/BindDialog":
|
|
1489
|
-
return isMarkdownProperties(data.properties) ? /* @__PURE__ */
|
|
1414
|
+
return isMarkdownProperties(data.properties) ? /* @__PURE__ */ React14.createElement(UrlDialog, {
|
|
1490
1415
|
properties: data.properties
|
|
1491
1416
|
}) : null;
|
|
1492
1417
|
// TODO(burdon): Model should not be passed via surfaces.
|
|
@@ -1501,12 +1426,12 @@ var GithubPlugin = () => {
|
|
|
1501
1426
|
case "dxos.org/plugin/github/ExportDialog":
|
|
1502
1427
|
return null;
|
|
1503
1428
|
case "dxos.org/plugin/github/ImportDialog":
|
|
1504
|
-
return /* @__PURE__ */
|
|
1429
|
+
return /* @__PURE__ */ React14.createElement(ImportDialog, {
|
|
1505
1430
|
docGhId: data.docGhId,
|
|
1506
1431
|
onUpdate: (content) => {
|
|
1507
|
-
|
|
1432
|
+
log6.info("onUpdate", content, {
|
|
1508
1433
|
F: __dxlog_file6,
|
|
1509
|
-
L:
|
|
1434
|
+
L: 105,
|
|
1510
1435
|
S: void 0,
|
|
1511
1436
|
C: (f, a) => f(...a)
|
|
1512
1437
|
});
|
|
@@ -1516,12 +1441,12 @@ var GithubPlugin = () => {
|
|
|
1516
1441
|
return null;
|
|
1517
1442
|
}
|
|
1518
1443
|
case "menuitem":
|
|
1519
|
-
return typeof data.content === "string" && isMarkdownProperties(data.properties) && !data.properties.readonly ? /* @__PURE__ */
|
|
1444
|
+
return typeof data.content === "string" && isMarkdownProperties(data.properties) && !data.properties.readonly ? /* @__PURE__ */ React14.createElement(MarkdownActions, {
|
|
1520
1445
|
content: data.content,
|
|
1521
1446
|
properties: data.properties
|
|
1522
1447
|
}) : null;
|
|
1523
1448
|
case "settings":
|
|
1524
|
-
return data.plugin === meta_default.id ? /* @__PURE__ */
|
|
1449
|
+
return data.plugin === meta_default.id ? /* @__PURE__ */ React14.createElement(GitHubSettings, null) : null;
|
|
1525
1450
|
default:
|
|
1526
1451
|
return null;
|
|
1527
1452
|
}
|