@dxos/plugin-github 0.6.14-main.2b6a0f3 → 0.6.14-main.69511f5
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.
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./chunk-KVP4SDH2.mjs";
|
|
6
6
|
|
|
7
7
|
// packages/plugins/experimental/plugin-github/src/GithubPlugin.tsx
|
|
8
|
-
import
|
|
8
|
+
import React16 from "react";
|
|
9
9
|
import { resolvePlugin } from "@dxos/app-framework";
|
|
10
10
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
11
|
-
import { log as
|
|
11
|
+
import { log as log7 } from "@dxos/log";
|
|
12
12
|
import { parseClientPlugin } from "@dxos/plugin-client";
|
|
13
13
|
import { createExtension } from "@dxos/plugin-graph";
|
|
14
14
|
import { isMarkdownProperties } from "@dxos/plugin-markdown";
|
|
@@ -36,8 +36,8 @@ import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
|
36
36
|
// packages/plugins/experimental/plugin-github/src/components/GithubApiProviders/GitHubSettings.tsx
|
|
37
37
|
import { ArrowSquareOut } from "@phosphor-icons/react";
|
|
38
38
|
import React2, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
39
|
-
import { SettingsValue } from "@dxos/plugin-settings";
|
|
40
39
|
import { Link, Input, Trans, useTranslation, useId } from "@dxos/react-ui";
|
|
40
|
+
import { FormInput } from "@dxos/react-ui-data";
|
|
41
41
|
import { getSize, mx } from "@dxos/react-ui-theme";
|
|
42
42
|
|
|
43
43
|
// packages/plugins/experimental/plugin-github/src/components/GithubApiProviders/OctokitProvider.tsx
|
|
@@ -129,7 +129,7 @@ var GitHubSettings = () => {
|
|
|
129
129
|
}, [
|
|
130
130
|
patValue
|
|
131
131
|
]);
|
|
132
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
132
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(FormInput, {
|
|
133
133
|
label: t("github pat label"),
|
|
134
134
|
description: /* @__PURE__ */ React2.createElement(Trans, {
|
|
135
135
|
t,
|
|
@@ -993,15 +993,20 @@ var EmbeddedMain = () => {
|
|
|
993
993
|
return /* @__PURE__ */ React10.createElement(SpaceResolverProvider, null, /* @__PURE__ */ React10.createElement(DocumentResolverProvider, null, /* @__PURE__ */ React10.createElement(EmbeddedLayoutImpl, null)));
|
|
994
994
|
};
|
|
995
995
|
|
|
996
|
-
// packages/plugins/experimental/plugin-github/src/components/
|
|
997
|
-
import React11, { useCallback as useCallback3 } from "react";
|
|
996
|
+
// packages/plugins/experimental/plugin-github/src/components/ExportDialog.tsx
|
|
997
|
+
import React11, { useCallback as useCallback3, useState as useState7 } from "react";
|
|
998
998
|
import { log as log4 } from "@dxos/log";
|
|
999
|
-
import { Button as Button5, Dialog as Dialog3, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
999
|
+
import { Button as Button5, Dialog as Dialog3, Input as Input2, Trans as Trans2, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1000
|
+
|
|
1001
|
+
// packages/plugins/experimental/plugin-github/src/components/ImportDialog.tsx
|
|
1002
|
+
import React12, { useCallback as useCallback4 } from "react";
|
|
1003
|
+
import { log as log5 } from "@dxos/log";
|
|
1004
|
+
import { Button as Button6, Dialog as Dialog4, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
1000
1005
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/components/ImportDialog.tsx";
|
|
1001
1006
|
var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
1002
|
-
const { t } =
|
|
1007
|
+
const { t } = useTranslation9(GITHUB_PLUGIN);
|
|
1003
1008
|
const { octokit } = useOctokitContext();
|
|
1004
|
-
const importGhIssueContent =
|
|
1009
|
+
const importGhIssueContent = useCallback4(async () => {
|
|
1005
1010
|
if (octokit && docGhId && "issueNumber") {
|
|
1006
1011
|
try {
|
|
1007
1012
|
const { owner, repo, issueNumber } = docGhId;
|
|
@@ -1012,7 +1017,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1012
1017
|
});
|
|
1013
1018
|
onUpdate(data.body ?? "");
|
|
1014
1019
|
} catch (err) {
|
|
1015
|
-
|
|
1020
|
+
log5.error("Failed to import from Github issue", err, {
|
|
1016
1021
|
F: __dxlog_file4,
|
|
1017
1022
|
L: 25,
|
|
1018
1023
|
S: void 0,
|
|
@@ -1020,7 +1025,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1020
1025
|
});
|
|
1021
1026
|
}
|
|
1022
1027
|
} else {
|
|
1023
|
-
|
|
1028
|
+
log5.error("Not prepared to import from Github issue when requested.", void 0, {
|
|
1024
1029
|
F: __dxlog_file4,
|
|
1025
1030
|
L: 28,
|
|
1026
1031
|
S: void 0,
|
|
@@ -1031,7 +1036,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1031
1036
|
octokit,
|
|
1032
1037
|
docGhId
|
|
1033
1038
|
]);
|
|
1034
|
-
const importGhFileContent =
|
|
1039
|
+
const importGhFileContent = useCallback4(async () => {
|
|
1035
1040
|
if (octokit && docGhId && "path" in docGhId) {
|
|
1036
1041
|
try {
|
|
1037
1042
|
const { owner, repo, path } = docGhId;
|
|
@@ -1043,7 +1048,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1043
1048
|
if (!Array.isArray(data) && data.type === "file") {
|
|
1044
1049
|
onUpdate(atob(data.content));
|
|
1045
1050
|
} else {
|
|
1046
|
-
|
|
1051
|
+
log5.error("Did not receive file with content from Github.", void 0, {
|
|
1047
1052
|
F: __dxlog_file4,
|
|
1048
1053
|
L: 40,
|
|
1049
1054
|
S: void 0,
|
|
@@ -1051,7 +1056,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1051
1056
|
});
|
|
1052
1057
|
}
|
|
1053
1058
|
} catch (err) {
|
|
1054
|
-
|
|
1059
|
+
log5.error("Failed to import from Github file", err, {
|
|
1055
1060
|
F: __dxlog_file4,
|
|
1056
1061
|
L: 43,
|
|
1057
1062
|
S: void 0,
|
|
@@ -1059,7 +1064,7 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1059
1064
|
});
|
|
1060
1065
|
}
|
|
1061
1066
|
} else {
|
|
1062
|
-
|
|
1067
|
+
log5.error("Not prepared to import from Github file when requested.", void 0, {
|
|
1063
1068
|
F: __dxlog_file4,
|
|
1064
1069
|
L: 46,
|
|
1065
1070
|
S: void 0,
|
|
@@ -1070,46 +1075,112 @@ var ImportDialog = ({ docGhId, onUpdate }) => {
|
|
|
1070
1075
|
octokit,
|
|
1071
1076
|
docGhId
|
|
1072
1077
|
]);
|
|
1073
|
-
const handleGhImport =
|
|
1078
|
+
const handleGhImport = useCallback4(() => {
|
|
1074
1079
|
return docGhId && ("issueNumber" in docGhId ? importGhIssueContent() : "path" in docGhId ? importGhFileContent() : null);
|
|
1075
1080
|
}, [
|
|
1076
1081
|
importGhIssueContent,
|
|
1077
1082
|
importGhFileContent,
|
|
1078
1083
|
docGhId
|
|
1079
1084
|
]);
|
|
1080
|
-
return /* @__PURE__ */
|
|
1085
|
+
return /* @__PURE__ */ React12.createElement(Dialog4.Content, null, /* @__PURE__ */ React12.createElement(Dialog4.Title, null, t("confirm import title")), /* @__PURE__ */ React12.createElement("p", {
|
|
1081
1086
|
className: "plb-2"
|
|
1082
|
-
}, t("confirm import body")), /* @__PURE__ */
|
|
1087
|
+
}, t("confirm import body")), /* @__PURE__ */ React12.createElement("div", {
|
|
1083
1088
|
role: "none",
|
|
1084
1089
|
className: "flex justify-end gap-2"
|
|
1085
|
-
}, /* @__PURE__ */
|
|
1090
|
+
}, /* @__PURE__ */ React12.createElement(Dialog4.Close, {
|
|
1086
1091
|
asChild: true
|
|
1087
|
-
}, /* @__PURE__ */
|
|
1092
|
+
}, /* @__PURE__ */ React12.createElement(Button6, null, t("cancel label", {
|
|
1088
1093
|
ns: "appkit"
|
|
1089
|
-
}))), /* @__PURE__ */
|
|
1094
|
+
}))), /* @__PURE__ */ React12.createElement(Dialog4.Close, {
|
|
1090
1095
|
asChild: true
|
|
1091
|
-
}, /* @__PURE__ */
|
|
1096
|
+
}, /* @__PURE__ */ React12.createElement(Button6, {
|
|
1092
1097
|
variant: "primary",
|
|
1093
1098
|
onClick: handleGhImport
|
|
1094
1099
|
}, t("import from github label")))));
|
|
1095
1100
|
};
|
|
1096
1101
|
|
|
1102
|
+
// packages/plugins/experimental/plugin-github/src/components/Issue.tsx
|
|
1103
|
+
import { IconBase } from "@phosphor-icons/react";
|
|
1104
|
+
import React13, { forwardRef } from "react";
|
|
1105
|
+
var weights = /* @__PURE__ */ new Map([
|
|
1106
|
+
[
|
|
1107
|
+
"bold",
|
|
1108
|
+
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1109
|
+
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"
|
|
1110
|
+
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1111
|
+
d: "M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128Z"
|
|
1112
|
+
}))
|
|
1113
|
+
],
|
|
1114
|
+
[
|
|
1115
|
+
"duotone",
|
|
1116
|
+
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1117
|
+
d: "M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",
|
|
1118
|
+
opacity: "0.2"
|
|
1119
|
+
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1120
|
+
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"
|
|
1121
|
+
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1122
|
+
d: "M176,128a48,48,0,1,1-48-48A48,48,0,0,1,176,128Z",
|
|
1123
|
+
opacity: "0.2"
|
|
1124
|
+
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1125
|
+
d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z"
|
|
1126
|
+
}))
|
|
1127
|
+
],
|
|
1128
|
+
[
|
|
1129
|
+
"fill",
|
|
1130
|
+
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1131
|
+
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"
|
|
1132
|
+
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1133
|
+
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"
|
|
1134
|
+
}))
|
|
1135
|
+
],
|
|
1136
|
+
[
|
|
1137
|
+
"light",
|
|
1138
|
+
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1139
|
+
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"
|
|
1140
|
+
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1141
|
+
d: "M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128Z"
|
|
1142
|
+
}))
|
|
1143
|
+
],
|
|
1144
|
+
[
|
|
1145
|
+
"regular",
|
|
1146
|
+
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1147
|
+
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"
|
|
1148
|
+
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1149
|
+
d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z"
|
|
1150
|
+
}))
|
|
1151
|
+
],
|
|
1152
|
+
[
|
|
1153
|
+
"thin",
|
|
1154
|
+
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("path", {
|
|
1155
|
+
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"
|
|
1156
|
+
}), /* @__PURE__ */ React13.createElement("path", {
|
|
1157
|
+
d: "M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Z"
|
|
1158
|
+
}))
|
|
1159
|
+
]
|
|
1160
|
+
]);
|
|
1161
|
+
var Issue = /* @__PURE__ */ forwardRef((props, ref) => /* @__PURE__ */ React13.createElement(IconBase, {
|
|
1162
|
+
ref,
|
|
1163
|
+
...props,
|
|
1164
|
+
weights
|
|
1165
|
+
}));
|
|
1166
|
+
Issue.displayName = "Issue";
|
|
1167
|
+
|
|
1097
1168
|
// packages/plugins/experimental/plugin-github/src/components/MarkdownActions.tsx
|
|
1098
1169
|
import { ArrowSquareOut as ArrowSquareOut3, FileArrowDown, FileArrowUp, Link as Link2, LinkBreak } from "@phosphor-icons/react";
|
|
1099
|
-
import
|
|
1170
|
+
import React14, { useCallback as useCallback5 } from "react";
|
|
1100
1171
|
import { LayoutAction, useIntent as useIntent2 } from "@dxos/app-framework";
|
|
1101
|
-
import { log as
|
|
1172
|
+
import { log as log6 } from "@dxos/log";
|
|
1102
1173
|
import { getMeta as getMeta3 } from "@dxos/react-client/echo";
|
|
1103
|
-
import { DropdownMenu as DropdownMenu2, useTranslation as
|
|
1174
|
+
import { DropdownMenu as DropdownMenu2, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
1104
1175
|
import { getSize as getSize4 } from "@dxos/react-ui-theme";
|
|
1105
1176
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-github/src/components/MarkdownActions.tsx";
|
|
1106
1177
|
var MarkdownActions = ({ content, properties }) => {
|
|
1107
1178
|
const ghId = getMeta3(properties)?.keys?.find((key) => key.source === "github.com")?.id;
|
|
1108
1179
|
const { octokit } = useOctokitContext();
|
|
1109
|
-
const { t } =
|
|
1180
|
+
const { t } = useTranslation10(GITHUB_PLUGIN);
|
|
1110
1181
|
const { dispatch } = useIntent2();
|
|
1111
1182
|
const docGhId = useDocGhId(properties.__meta?.keys ?? []);
|
|
1112
|
-
const updateIssueContent =
|
|
1183
|
+
const updateIssueContent = useCallback5(() => {
|
|
1113
1184
|
const { owner, repo, issueNumber } = docGhId;
|
|
1114
1185
|
return octokit.rest.issues.update({
|
|
1115
1186
|
owner,
|
|
@@ -1122,7 +1193,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1122
1193
|
docGhId,
|
|
1123
1194
|
content
|
|
1124
1195
|
]);
|
|
1125
|
-
const exportGhIssueContent =
|
|
1196
|
+
const exportGhIssueContent = useCallback5(async () => {
|
|
1126
1197
|
if (octokit && docGhId && "issueNumber" in docGhId && content) {
|
|
1127
1198
|
try {
|
|
1128
1199
|
const { data: { html_url: issueUrl } } = await updateIssueContent();
|
|
@@ -1140,7 +1211,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1140
1211
|
}
|
|
1141
1212
|
});
|
|
1142
1213
|
} catch (err) {
|
|
1143
|
-
|
|
1214
|
+
log6.error("Failed to export to Github issue", void 0, {
|
|
1144
1215
|
F: __dxlog_file5,
|
|
1145
1216
|
L: 56,
|
|
1146
1217
|
S: void 0,
|
|
@@ -1148,7 +1219,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1148
1219
|
});
|
|
1149
1220
|
}
|
|
1150
1221
|
} else {
|
|
1151
|
-
|
|
1222
|
+
log6.error("Not prepared to export to Github issue when requested.", void 0, {
|
|
1152
1223
|
F: __dxlog_file5,
|
|
1153
1224
|
L: 59,
|
|
1154
1225
|
S: void 0,
|
|
@@ -1160,7 +1231,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1160
1231
|
docGhId,
|
|
1161
1232
|
content
|
|
1162
1233
|
]);
|
|
1163
|
-
const handleGhExport =
|
|
1234
|
+
const handleGhExport = useCallback5(() => {
|
|
1164
1235
|
if ("issueNumber" in docGhId) {
|
|
1165
1236
|
void exportGhIssueContent();
|
|
1166
1237
|
} else if ("path" in docGhId) {
|
|
@@ -1181,7 +1252,7 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1181
1252
|
exportGhIssueContent,
|
|
1182
1253
|
docGhId
|
|
1183
1254
|
]);
|
|
1184
|
-
return /* @__PURE__ */
|
|
1255
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(DropdownMenu2.GroupLabel, null, t("markdown actions label")), docGhId ? /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
|
|
1185
1256
|
classNames: "gap-2",
|
|
1186
1257
|
disabled: !docGhId,
|
|
1187
1258
|
onClick: () => (
|
|
@@ -1197,43 +1268,43 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1197
1268
|
}
|
|
1198
1269
|
})
|
|
1199
1270
|
)
|
|
1200
|
-
}, /* @__PURE__ */
|
|
1271
|
+
}, /* @__PURE__ */ React14.createElement(FileArrowDown, {
|
|
1201
1272
|
className: getSize4(4)
|
|
1202
|
-
}), /* @__PURE__ */
|
|
1273
|
+
}), /* @__PURE__ */ React14.createElement("span", {
|
|
1203
1274
|
className: "grow"
|
|
1204
|
-
}, t("import from github label"))), /* @__PURE__ */
|
|
1275
|
+
}, t("import from github label"))), /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
|
|
1205
1276
|
classNames: "gap-2",
|
|
1206
1277
|
disabled: !docGhId,
|
|
1207
1278
|
onClick: () => docGhId && handleGhExport()
|
|
1208
|
-
}, /* @__PURE__ */
|
|
1279
|
+
}, /* @__PURE__ */ React14.createElement(FileArrowUp, {
|
|
1209
1280
|
className: getSize4(4)
|
|
1210
|
-
}), /* @__PURE__ */
|
|
1281
|
+
}), /* @__PURE__ */ React14.createElement("span", {
|
|
1211
1282
|
className: "grow"
|
|
1212
|
-
}, t("export to github label"))), /* @__PURE__ */
|
|
1283
|
+
}, t("export to github label"))), /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
|
|
1213
1284
|
asChild: true,
|
|
1214
1285
|
classNames: "gap-2",
|
|
1215
1286
|
disabled: !ghId
|
|
1216
|
-
}, /* @__PURE__ */
|
|
1287
|
+
}, /* @__PURE__ */ React14.createElement("a", ghId ? {
|
|
1217
1288
|
href: `https://github.com/${ghId}`,
|
|
1218
1289
|
target: "_blank",
|
|
1219
1290
|
rel: "noreferrer"
|
|
1220
1291
|
} : {
|
|
1221
1292
|
href: "#"
|
|
1222
|
-
}, /* @__PURE__ */
|
|
1293
|
+
}, /* @__PURE__ */ React14.createElement(ArrowSquareOut3, {
|
|
1223
1294
|
className: getSize4(4)
|
|
1224
|
-
}), /* @__PURE__ */
|
|
1295
|
+
}), /* @__PURE__ */ React14.createElement("span", {
|
|
1225
1296
|
className: "grow"
|
|
1226
|
-
}, t("open in github label")))), /* @__PURE__ */
|
|
1297
|
+
}, t("open in github label")))), /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
|
|
1227
1298
|
classNames: "gap-2",
|
|
1228
1299
|
onClick: () => {
|
|
1229
1300
|
const index = getMeta3(properties)?.keys?.findIndex((key) => key.source === "github.com");
|
|
1230
1301
|
typeof index !== "undefined" && index >= 0 && properties.__meta?.keys?.splice(index, 1);
|
|
1231
1302
|
}
|
|
1232
|
-
}, /* @__PURE__ */
|
|
1303
|
+
}, /* @__PURE__ */ React14.createElement(LinkBreak, {
|
|
1233
1304
|
className: getSize4(4)
|
|
1234
|
-
}), /* @__PURE__ */
|
|
1305
|
+
}), /* @__PURE__ */ React14.createElement("span", {
|
|
1235
1306
|
className: "grow"
|
|
1236
|
-
}, t("unbind to file in github label")))) : /* @__PURE__ */
|
|
1307
|
+
}, t("unbind to file in github label")))) : /* @__PURE__ */ React14.createElement(DropdownMenu2.Item, {
|
|
1237
1308
|
classNames: "gap-2",
|
|
1238
1309
|
onClick: () => dispatch({
|
|
1239
1310
|
action: LayoutAction.SET_LAYOUT,
|
|
@@ -1243,34 +1314,34 @@ var MarkdownActions = ({ content, properties }) => {
|
|
|
1243
1314
|
subject: properties
|
|
1244
1315
|
}
|
|
1245
1316
|
})
|
|
1246
|
-
}, /* @__PURE__ */
|
|
1317
|
+
}, /* @__PURE__ */ React14.createElement(Link2, {
|
|
1247
1318
|
className: getSize4(4)
|
|
1248
|
-
}), /* @__PURE__ */
|
|
1319
|
+
}), /* @__PURE__ */ React14.createElement("span", {
|
|
1249
1320
|
className: "grow"
|
|
1250
1321
|
}, t("bind to file in github label"))));
|
|
1251
1322
|
};
|
|
1252
1323
|
|
|
1253
1324
|
// packages/plugins/experimental/plugin-github/src/components/UrlDialog.tsx
|
|
1254
|
-
import
|
|
1255
|
-
import { Dialog as
|
|
1325
|
+
import React15, { useState as useState8 } from "react";
|
|
1326
|
+
import { Dialog as Dialog5, Button as Button7, useTranslation as useTranslation11, Input as Input3 } from "@dxos/react-ui";
|
|
1256
1327
|
var UrlDialog = ({ properties }) => {
|
|
1257
|
-
const { t } =
|
|
1258
|
-
const [ghUrlValue, setGhUrlValue] =
|
|
1328
|
+
const { t } = useTranslation11(GITHUB_PLUGIN);
|
|
1329
|
+
const [ghUrlValue, setGhUrlValue] = useState8("");
|
|
1259
1330
|
const ghId = useGhIdFromUrl(ghUrlValue);
|
|
1260
|
-
return /* @__PURE__ */
|
|
1331
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(Dialog5.Title, {
|
|
1261
1332
|
classNames: "mbe-2"
|
|
1262
|
-
}, t("bind to file in github label")), /* @__PURE__ */
|
|
1333
|
+
}, t("bind to file in github label")), /* @__PURE__ */ React15.createElement(Input3.Root, {
|
|
1263
1334
|
validationValence: "error"
|
|
1264
|
-
}, /* @__PURE__ */
|
|
1335
|
+
}, /* @__PURE__ */ React15.createElement(Input3.Label, null, t("paste url to file in github label")), /* @__PURE__ */ React15.createElement(Input3.TextInput, {
|
|
1265
1336
|
placeholder: t("paste url to file in github placeholder"),
|
|
1266
1337
|
value: ghUrlValue,
|
|
1267
1338
|
onChange: ({ target: { value } }) => setGhUrlValue(value)
|
|
1268
|
-
}), /* @__PURE__ */
|
|
1339
|
+
}), /* @__PURE__ */ React15.createElement(Input3.DescriptionAndValidation, null, ghUrlValue.length > 0 && !ghId && /* @__PURE__ */ React15.createElement(Input3.Validation, null, t("error github markdown path message")), /* @__PURE__ */ React15.createElement(Input3.Description, null, t("paste url to file in github description")))), /* @__PURE__ */ React15.createElement("div", {
|
|
1269
1340
|
role: "none",
|
|
1270
1341
|
className: "flex justify-end gap-2"
|
|
1271
|
-
}, /* @__PURE__ */
|
|
1342
|
+
}, /* @__PURE__ */ React15.createElement(Dialog5.Close, {
|
|
1272
1343
|
asChild: true
|
|
1273
|
-
}, /* @__PURE__ */
|
|
1344
|
+
}, /* @__PURE__ */ React15.createElement(Button7, {
|
|
1274
1345
|
classNames: "mbs-2",
|
|
1275
1346
|
onClick: () => {
|
|
1276
1347
|
if (ghId && document) {
|
|
@@ -1396,7 +1467,7 @@ var GithubPlugin = () => {
|
|
|
1396
1467
|
});
|
|
1397
1468
|
}
|
|
1398
1469
|
},
|
|
1399
|
-
context: (props) => /* @__PURE__ */
|
|
1470
|
+
context: (props) => /* @__PURE__ */ React16.createElement(OctokitProvider, {
|
|
1400
1471
|
pat: settings.values.pat,
|
|
1401
1472
|
onPatChanged: (pat) => settings.values.pat = pat,
|
|
1402
1473
|
...props
|
|
@@ -1405,13 +1476,13 @@ var GithubPlugin = () => {
|
|
|
1405
1476
|
component: ({ data, role }) => {
|
|
1406
1477
|
switch (data.component) {
|
|
1407
1478
|
case `${GITHUB_PLUGIN}/embedded`:
|
|
1408
|
-
return /* @__PURE__ */
|
|
1479
|
+
return /* @__PURE__ */ React16.createElement(EmbeddedMain, null);
|
|
1409
1480
|
}
|
|
1410
1481
|
switch (role) {
|
|
1411
1482
|
case "dialog":
|
|
1412
1483
|
switch (data.content) {
|
|
1413
1484
|
case "dxos.org/plugin/github/BindDialog":
|
|
1414
|
-
return isMarkdownProperties(data.properties) ? /* @__PURE__ */
|
|
1485
|
+
return isMarkdownProperties(data.properties) ? /* @__PURE__ */ React16.createElement(UrlDialog, {
|
|
1415
1486
|
properties: data.properties
|
|
1416
1487
|
}) : null;
|
|
1417
1488
|
// TODO(burdon): Model should not be passed via surfaces.
|
|
@@ -1426,10 +1497,10 @@ var GithubPlugin = () => {
|
|
|
1426
1497
|
case "dxos.org/plugin/github/ExportDialog":
|
|
1427
1498
|
return null;
|
|
1428
1499
|
case "dxos.org/plugin/github/ImportDialog":
|
|
1429
|
-
return /* @__PURE__ */
|
|
1500
|
+
return /* @__PURE__ */ React16.createElement(ImportDialog, {
|
|
1430
1501
|
docGhId: data.docGhId,
|
|
1431
1502
|
onUpdate: (content) => {
|
|
1432
|
-
|
|
1503
|
+
log7.info("onUpdate", content, {
|
|
1433
1504
|
F: __dxlog_file6,
|
|
1434
1505
|
L: 105,
|
|
1435
1506
|
S: void 0,
|
|
@@ -1441,12 +1512,12 @@ var GithubPlugin = () => {
|
|
|
1441
1512
|
return null;
|
|
1442
1513
|
}
|
|
1443
1514
|
case "menuitem":
|
|
1444
|
-
return typeof data.content === "string" && isMarkdownProperties(data.properties) && !data.properties.readonly ? /* @__PURE__ */
|
|
1515
|
+
return typeof data.content === "string" && isMarkdownProperties(data.properties) && !data.properties.readonly ? /* @__PURE__ */ React16.createElement(MarkdownActions, {
|
|
1445
1516
|
content: data.content,
|
|
1446
1517
|
properties: data.properties
|
|
1447
1518
|
}) : null;
|
|
1448
1519
|
case "settings":
|
|
1449
|
-
return data.plugin === meta_default.id ? /* @__PURE__ */
|
|
1520
|
+
return data.plugin === meta_default.id ? /* @__PURE__ */ React16.createElement(GitHubSettings, null) : null;
|
|
1450
1521
|
default:
|
|
1451
1522
|
return null;
|
|
1452
1523
|
}
|