@graphiql/plugin-collections 0.0.0 → 1.0.0-beta.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/README.md +162 -0
- package/dist/collections.stories.d.ts +14 -0
- package/dist/components/collection-item-row.d.ts +25 -0
- package/dist/components/collection-item-row.js +286 -0
- package/dist/components/collection-item-row.js.map +1 -0
- package/dist/components/collection-row.d.ts +32 -0
- package/dist/components/collection-row.js +162 -0
- package/dist/components/collection-row.js.map +1 -0
- package/dist/components/collections-panel.d.ts +9 -0
- package/dist/components/collections-panel.js +508 -0
- package/dist/components/collections-panel.js.map +1 -0
- package/dist/components/conflict-dialog.d.ts +11 -0
- package/dist/components/conflict-dialog.js +169 -0
- package/dist/components/conflict-dialog.js.map +1 -0
- package/dist/components/export-dialog.d.ts +7 -0
- package/dist/components/export-dialog.js +54 -0
- package/dist/components/export-dialog.js.map +1 -0
- package/dist/components/import-dialog.d.ts +10 -0
- package/dist/components/import-dialog.js +114 -0
- package/dist/components/import-dialog.js.map +1 -0
- package/dist/components/save-dialog.d.ts +7 -0
- package/dist/components/save-dialog.js +125 -0
- package/dist/components/save-dialog.js.map +1 -0
- package/dist/components/session-actions.d.ts +9 -0
- package/dist/components/session-actions.js +34 -0
- package/dist/components/session-actions.js.map +1 -0
- package/dist/icons/check.js +10 -0
- package/dist/icons/check.js.map +1 -0
- package/dist/icons/collections.js +10 -0
- package/dist/icons/collections.js.map +1 -0
- package/dist/icons/download.js +10 -0
- package/dist/icons/download.js.map +1 -0
- package/dist/icons/upload.js +10 -0
- package/dist/icons/upload.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/operation-method.d.ts +10 -0
- package/dist/operation-method.js +28 -0
- package/dist/operation-method.js.map +1 -0
- package/dist/storage/local-storage.d.ts +3 -0
- package/dist/storage/local-storage.js +39 -0
- package/dist/storage/local-storage.js.map +1 -0
- package/dist/storage/tab-links.d.ts +7 -0
- package/dist/storage/tab-links.js +36 -0
- package/dist/storage/tab-links.js.map +1 -0
- package/dist/store.d.ts +78 -0
- package/dist/store.js +413 -0
- package/dist/store.js.map +1 -0
- package/dist/style.css +442 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/utility/uuid.d.ts +4 -0
- package/dist/utility/uuid.js +11 -0
- package/dist/utility/uuid.js.map +1 -0
- package/package.json +60 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Dialog, Button } from "@graphiql/react";
|
|
4
|
+
import { useCollectionsStore } from "../store.js";
|
|
5
|
+
function updatedAtHint(incoming, current) {
|
|
6
|
+
const diffMs = incoming - current;
|
|
7
|
+
if (Math.abs(diffMs) < 6e4) {
|
|
8
|
+
return "same time";
|
|
9
|
+
}
|
|
10
|
+
const diffMin = Math.round(Math.abs(diffMs) / 6e4);
|
|
11
|
+
const diffHr = Math.round(Math.abs(diffMs) / 36e5);
|
|
12
|
+
const diffDays = Math.round(Math.abs(diffMs) / 864e5);
|
|
13
|
+
let magnitude;
|
|
14
|
+
if (diffDays >= 1) {
|
|
15
|
+
magnitude = `${diffDays}d`;
|
|
16
|
+
} else if (diffHr >= 1) {
|
|
17
|
+
magnitude = `${diffHr}h`;
|
|
18
|
+
} else {
|
|
19
|
+
magnitude = `${diffMin}m`;
|
|
20
|
+
}
|
|
21
|
+
return diffMs > 0 ? `theirs: ${magnitude} newer` : `theirs: ${magnitude} older`;
|
|
22
|
+
}
|
|
23
|
+
const ReviewRow = ({
|
|
24
|
+
conflict,
|
|
25
|
+
checked,
|
|
26
|
+
onChange,
|
|
27
|
+
collectionName
|
|
28
|
+
}) => {
|
|
29
|
+
const hint = updatedAtHint(
|
|
30
|
+
conflict.incoming.updatedAt,
|
|
31
|
+
conflict.current.updatedAt
|
|
32
|
+
);
|
|
33
|
+
return /* @__PURE__ */ jsxs("label", { className: "graphiql-conflict-review-row", children: [
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"input",
|
|
36
|
+
{
|
|
37
|
+
type: "checkbox",
|
|
38
|
+
checked,
|
|
39
|
+
onChange: (e) => onChange(conflict.incoming.id, e.target.checked),
|
|
40
|
+
className: "graphiql-conflict-review-checkbox"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-conflict-review-name", children: conflict.incoming.name }),
|
|
44
|
+
collectionName && /* @__PURE__ */ jsxs("span", { className: "graphiql-conflict-review-collection", children: [
|
|
45
|
+
"in ",
|
|
46
|
+
collectionName
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-conflict-review-hint", children: hint })
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
const ConflictDialog = ({
|
|
52
|
+
analysis,
|
|
53
|
+
sourceLabel,
|
|
54
|
+
open,
|
|
55
|
+
onClose,
|
|
56
|
+
onResolve
|
|
57
|
+
}) => {
|
|
58
|
+
const [reviewing, setReviewing] = useState(false);
|
|
59
|
+
const [checked, setChecked] = useState(/* @__PURE__ */ new Set());
|
|
60
|
+
const localCollections = useCollectionsStore((s) => s.collections);
|
|
61
|
+
const handleCheckChange = (id, isChecked) => {
|
|
62
|
+
setChecked((prev) => {
|
|
63
|
+
const next = new Set(prev);
|
|
64
|
+
if (isChecked) {
|
|
65
|
+
next.add(id);
|
|
66
|
+
} else {
|
|
67
|
+
next.delete(id);
|
|
68
|
+
}
|
|
69
|
+
return next;
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const handleOpenChange = (isOpen) => {
|
|
73
|
+
if (!isOpen) {
|
|
74
|
+
onClose();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const collectionNameById = new Map(localCollections.map((c) => [c.id, c.name]));
|
|
78
|
+
const summary = [
|
|
79
|
+
analysis.newItems.length > 0 && `${analysis.newItems.length} new`,
|
|
80
|
+
analysis.changedItems.length > 0 && `${analysis.changedItems.length} with changes`,
|
|
81
|
+
analysis.unchangedCount > 0 && `${analysis.unchangedCount} unchanged`
|
|
82
|
+
].filter(Boolean).join(", ");
|
|
83
|
+
const newCollectionCount = analysis.newCollections.length;
|
|
84
|
+
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
85
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: "Import conflicts" }),
|
|
86
|
+
/* @__PURE__ */ jsxs(Dialog.Body, { children: [
|
|
87
|
+
/* @__PURE__ */ jsxs("p", { className: "graphiql-conflict-summary", children: [
|
|
88
|
+
"Importing ",
|
|
89
|
+
/* @__PURE__ */ jsx("strong", { children: sourceLabel }),
|
|
90
|
+
": ",
|
|
91
|
+
summary,
|
|
92
|
+
" operation",
|
|
93
|
+
analysis.newItems.length + analysis.changedItems.length + analysis.unchangedCount !== 1 ? "s" : "",
|
|
94
|
+
newCollectionCount > 0 && `, ${newCollectionCount} new collection${newCollectionCount !== 1 ? "s" : ""}`,
|
|
95
|
+
"."
|
|
96
|
+
] }),
|
|
97
|
+
!reviewing ? /* @__PURE__ */ jsxs("div", { className: "graphiql-conflict-actions", children: [
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
Button,
|
|
100
|
+
{
|
|
101
|
+
type: "button",
|
|
102
|
+
variant: "primary",
|
|
103
|
+
onClick: () => onResolve({ mode: "merge", applyChanges: true }),
|
|
104
|
+
children: "Apply changes"
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
Button,
|
|
109
|
+
{
|
|
110
|
+
type: "button",
|
|
111
|
+
onClick: () => onResolve({ mode: "merge", applyChanges: false }),
|
|
112
|
+
children: "Keep my versions"
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
Button,
|
|
117
|
+
{
|
|
118
|
+
type: "button",
|
|
119
|
+
onClick: () => {
|
|
120
|
+
setChecked(/* @__PURE__ */ new Set());
|
|
121
|
+
setReviewing(true);
|
|
122
|
+
},
|
|
123
|
+
children: "Review each…"
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "graphiql-conflict-review", children: [
|
|
127
|
+
/* @__PURE__ */ jsx("p", { className: "graphiql-conflict-review-hint-label", children: "Check which incoming versions to accept (unchecked = keep yours):" }),
|
|
128
|
+
/* @__PURE__ */ jsx("div", { className: "graphiql-conflict-review-list", children: analysis.changedItems.map((conflict) => /* @__PURE__ */ jsx(
|
|
129
|
+
ReviewRow,
|
|
130
|
+
{
|
|
131
|
+
conflict,
|
|
132
|
+
checked: checked.has(conflict.incoming.id),
|
|
133
|
+
onChange: handleCheckChange,
|
|
134
|
+
collectionName: collectionNameById.get(
|
|
135
|
+
conflict.currentCollectionId
|
|
136
|
+
)
|
|
137
|
+
},
|
|
138
|
+
conflict.incoming.id
|
|
139
|
+
)) }),
|
|
140
|
+
/* @__PURE__ */ jsxs("div", { className: "graphiql-conflict-review-confirm", children: [
|
|
141
|
+
/* @__PURE__ */ jsx(
|
|
142
|
+
Button,
|
|
143
|
+
{
|
|
144
|
+
type: "button",
|
|
145
|
+
variant: "primary",
|
|
146
|
+
onClick: () => onResolve({ mode: "merge", changedItemIds: new Set(checked) }),
|
|
147
|
+
children: "Confirm selection"
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
Button,
|
|
152
|
+
{
|
|
153
|
+
type: "button",
|
|
154
|
+
onClick: () => {
|
|
155
|
+
setReviewing(false);
|
|
156
|
+
setChecked(/* @__PURE__ */ new Set());
|
|
157
|
+
},
|
|
158
|
+
children: "Back"
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] })
|
|
162
|
+
] })
|
|
163
|
+
] })
|
|
164
|
+
] });
|
|
165
|
+
};
|
|
166
|
+
export {
|
|
167
|
+
ConflictDialog
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=conflict-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflict-dialog.js","sources":["../../src/components/conflict-dialog.tsx"],"sourcesContent":["import { FC, useState } from 'react';\nimport { Button, Dialog } from '@graphiql/react';\nimport { useCollectionsStore } from '../store';\nimport type { ImportAnalysis, ImportResolution, ItemConflict } from '../types';\n\ntype ConflictDialogProps = {\n analysis: ImportAnalysis;\n sourceLabel: string;\n open: boolean;\n onClose(): void;\n onResolve(resolution: ImportResolution): void;\n};\n\n/** Returns a human-readable relative time hint comparing two timestamps. */\nfunction updatedAtHint(incoming: number, current: number): string {\n const diffMs = incoming - current;\n if (Math.abs(diffMs) < 60_000) {\n return 'same time';\n }\n const diffMin = Math.round(Math.abs(diffMs) / 60_000);\n const diffHr = Math.round(Math.abs(diffMs) / 3_600_000);\n const diffDays = Math.round(Math.abs(diffMs) / 86_400_000);\n let magnitude: string;\n if (diffDays >= 1) {\n magnitude = `${diffDays}d`;\n } else if (diffHr >= 1) {\n magnitude = `${diffHr}h`;\n } else {\n magnitude = `${diffMin}m`;\n }\n return diffMs > 0\n ? `theirs: ${magnitude} newer`\n : `theirs: ${magnitude} older`;\n}\n\ntype ReviewRowProps = {\n conflict: ItemConflict;\n checked: boolean;\n onChange(id: string, checked: boolean): void;\n collectionName: string | undefined;\n};\n\nconst ReviewRow: FC<ReviewRowProps> = ({\n conflict,\n checked,\n onChange,\n collectionName,\n}) => {\n const hint = updatedAtHint(\n conflict.incoming.updatedAt,\n conflict.current.updatedAt,\n );\n return (\n <label className=\"graphiql-conflict-review-row\">\n <input\n type=\"checkbox\"\n checked={checked}\n onChange={e => onChange(conflict.incoming.id, e.target.checked)}\n className=\"graphiql-conflict-review-checkbox\"\n />\n <span className=\"graphiql-conflict-review-name\">\n {conflict.incoming.name}\n </span>\n {collectionName && (\n <span className=\"graphiql-conflict-review-collection\">\n in {collectionName}\n </span>\n )}\n <span className=\"graphiql-conflict-review-hint\">{hint}</span>\n </label>\n );\n};\n\nexport const ConflictDialog: FC<ConflictDialogProps> = ({\n analysis,\n sourceLabel,\n open,\n onClose,\n onResolve,\n}) => {\n const [reviewing, setReviewing] = useState(false);\n // Default all to unchecked (keep mine = safe default)\n const [checked, setChecked] = useState<Set<string>>(new Set());\n // Conflicts always reference a collection the recipient already has, so the\n // \"in X\" label comes from local collections, not the incoming envelope.\n const localCollections = useCollectionsStore(s => s.collections);\n\n const handleCheckChange = (id: string, isChecked: boolean) => {\n setChecked(prev => {\n const next = new Set(prev);\n if (isChecked) {\n next.add(id);\n } else {\n next.delete(id);\n }\n return next;\n });\n };\n\n const handleOpenChange = (isOpen: boolean) => {\n if (!isOpen) {\n onClose();\n }\n };\n\n const collectionNameById = new Map(localCollections.map(c => [c.id, c.name]));\n\n const summary = [\n analysis.newItems.length > 0 && `${analysis.newItems.length} new`,\n analysis.changedItems.length > 0 &&\n `${analysis.changedItems.length} with changes`,\n analysis.unchangedCount > 0 && `${analysis.unchangedCount} unchanged`,\n ]\n .filter(Boolean)\n .join(', ');\n\n const newCollectionCount = analysis.newCollections.length;\n\n return (\n <Dialog open={open} onOpenChange={handleOpenChange}>\n <Dialog.Header>Import conflicts</Dialog.Header>\n <Dialog.Body>\n <p className=\"graphiql-conflict-summary\">\n Importing <strong>{sourceLabel}</strong>: {summary} operation\n {analysis.newItems.length +\n analysis.changedItems.length +\n analysis.unchangedCount !==\n 1\n ? 's'\n : ''}\n {newCollectionCount > 0 &&\n `, ${newCollectionCount} new collection${newCollectionCount !== 1 ? 's' : ''}`}\n .\n </p>\n\n {!reviewing ? (\n <div className=\"graphiql-conflict-actions\">\n <Button\n type=\"button\"\n variant=\"primary\"\n onClick={() => onResolve({ mode: 'merge', applyChanges: true })}\n >\n Apply changes\n </Button>\n <Button\n type=\"button\"\n onClick={() => onResolve({ mode: 'merge', applyChanges: false })}\n >\n Keep my versions\n </Button>\n <Button\n type=\"button\"\n onClick={() => {\n setChecked(new Set());\n setReviewing(true);\n }}\n >\n Review each…\n </Button>\n </div>\n ) : (\n <div className=\"graphiql-conflict-review\">\n <p className=\"graphiql-conflict-review-hint-label\">\n Check which incoming versions to accept (unchecked = keep yours):\n </p>\n <div className=\"graphiql-conflict-review-list\">\n {analysis.changedItems.map(conflict => (\n <ReviewRow\n key={conflict.incoming.id}\n conflict={conflict}\n checked={checked.has(conflict.incoming.id)}\n onChange={handleCheckChange}\n collectionName={collectionNameById.get(\n conflict.currentCollectionId,\n )}\n />\n ))}\n </div>\n <div className=\"graphiql-conflict-review-confirm\">\n <Button\n type=\"button\"\n variant=\"primary\"\n onClick={() =>\n onResolve({ mode: 'merge', changedItemIds: new Set(checked) })\n }\n >\n Confirm selection\n </Button>\n <Button\n type=\"button\"\n onClick={() => {\n setReviewing(false);\n setChecked(new Set());\n }}\n >\n Back\n </Button>\n </div>\n </div>\n )}\n </Dialog.Body>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;AAcA,SAAS,cAAc,UAAkB,SAAyB;AAChE,QAAM,SAAS,WAAW;AAC1B,MAAI,KAAK,IAAI,MAAM,IAAI,KAAQ;AACtB,WAAA;AAAA,EAAA;AAET,QAAM,UAAU,KAAK,MAAM,KAAK,IAAI,MAAM,IAAI,GAAM;AACpD,QAAM,SAAS,KAAK,MAAM,KAAK,IAAI,MAAM,IAAI,IAAS;AACtD,QAAM,WAAW,KAAK,MAAM,KAAK,IAAI,MAAM,IAAI,KAAU;AACrD,MAAA;AACJ,MAAI,YAAY,GAAG;AACjB,gBAAY,GAAG,QAAQ;AAAA,EAAA,WACd,UAAU,GAAG;AACtB,gBAAY,GAAG,MAAM;AAAA,EAAA,OAChB;AACL,gBAAY,GAAG,OAAO;AAAA,EAAA;AAExB,SAAO,SAAS,IACZ,WAAW,SAAS,WACpB,WAAW,SAAS;AAC1B;AASA,MAAM,YAAgC,CAAC;AAAA,EACrC;A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ACL,SAAS,MAAM;AACF,yBAAA,oBAAI,KAAK;AACpB,2BAAa,IAAI;AAAA,YACnB;AAAA,YACD,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAED,EACF,CAAA,IAEA,qBAAC,OAAI,EAAA,WAAU,4BACb,UAAA;AAAA,QAAC,oBAAA,KAAA,EAAE,WAAU,uCAAsC,UAEnD,qEAAA;AAAA,4BACC,OAAI,EAAA,WAAU,iCACZ,UAAS,SAAA,aAAa,IAAI,CACzB,aAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC;AAAA,YACA,SAAS,QAAQ,IAAI,SAAS,SAAS,EAAE;AAAA,YACzC,UAAU;AAAA,YACV,gBAAgB,mBAAmB;AAAA,cACjC,SAAS;AAAA,YAAA;AAAA,UACX;AAAA,UANK,SAAS,SAAS;AAAA,QAQ1B,CAAA,GACH;AAAA,QACA,qBAAC,OAAI,EAAA,WAAU,oCACb,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,SAAS,MACP,UAAU,EAAE,MAAM,SAAS,gBAAgB,IAAI,IAAI,OAAO,GAAG;AAAA,cAEhE,UAAA;AAAA,YAAA;AAAA,UAED;AAAA,UACA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS,MAAM;AACb,6BAAa,KAAK;AACP,2BAAA,oBAAI,KAAK;AAAA,cACtB;AAAA,cACD,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED,EACF,CAAA;AAAA,MAAA,EACF,CAAA;AAAA,IAAA,EAEJ,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, Button } from "@graphiql/react";
|
|
3
|
+
import { collectionsStore } from "../store.js";
|
|
4
|
+
const ExportDialog = ({ open, onClose }) => {
|
|
5
|
+
const exported = open ? collectionsStore.getState().actions.exportCollections() : "";
|
|
6
|
+
const handleCopy = async () => {
|
|
7
|
+
try {
|
|
8
|
+
await navigator.clipboard.writeText(exported);
|
|
9
|
+
} catch {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
onClose();
|
|
13
|
+
};
|
|
14
|
+
const handleDownload = () => {
|
|
15
|
+
const blob = new Blob([exported], { type: "application/json" });
|
|
16
|
+
const url = URL.createObjectURL(blob);
|
|
17
|
+
const a = document.createElement("a");
|
|
18
|
+
a.href = url;
|
|
19
|
+
a.download = "graphiql-collections.json";
|
|
20
|
+
a.click();
|
|
21
|
+
setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
22
|
+
onClose();
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: (o) => !o && onClose(), children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: "Export collections" }),
|
|
26
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs("div", { className: "graphiql-import-export-section", children: [
|
|
27
|
+
/* @__PURE__ */ jsx(
|
|
28
|
+
"textarea",
|
|
29
|
+
{
|
|
30
|
+
readOnly: true,
|
|
31
|
+
className: "graphiql-import-export-textarea",
|
|
32
|
+
value: exported,
|
|
33
|
+
rows: 12
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ jsxs("div", { className: "graphiql-import-export-actions", children: [
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
Button,
|
|
39
|
+
{
|
|
40
|
+
type: "button",
|
|
41
|
+
variant: "primary",
|
|
42
|
+
onClick: () => void handleCopy(),
|
|
43
|
+
children: "Copy JSON"
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ jsx(Button, { type: "button", onClick: handleDownload, children: "Download JSON" })
|
|
47
|
+
] })
|
|
48
|
+
] }) })
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
ExportDialog
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=export-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-dialog.js","sources":["../../src/components/export-dialog.tsx"],"sourcesContent":["import { FC } from 'react';\nimport { Button, Dialog } from '@graphiql/react';\nimport { collectionsStore } from '../store';\n\ntype ExportDialogProps = {\n open: boolean;\n onClose(): void;\n};\n\nexport const ExportDialog: FC<ExportDialogProps> = ({ open, onClose }) => {\n const exported = open\n ? collectionsStore.getState().actions.exportCollections()\n : '';\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(exported);\n } catch {\n // clipboard unavailable; leave the dialog open so the textarea stays\n // selectable as a fallback.\n return;\n }\n onClose();\n };\n\n const handleDownload = () => {\n const blob = new Blob([exported], { type: 'application/json' });\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = 'graphiql-collections.json';\n a.click();\n setTimeout(() => URL.revokeObjectURL(url), 0);\n onClose();\n };\n\n return (\n <Dialog open={open} onOpenChange={o => !o && onClose()}>\n <Dialog.Header>Export collections</Dialog.Header>\n <Dialog.Body>\n <div className=\"graphiql-import-export-section\">\n <textarea\n readOnly\n className=\"graphiql-import-export-textarea\"\n value={exported}\n rows={12}\n />\n <div className=\"graphiql-import-export-actions\">\n <Button\n type=\"button\"\n variant=\"primary\"\n onClick={() => void handleCopy()}\n >\n Copy JSON\n </Button>\n <Button type=\"button\" onClick={handleDownload}>\n Download JSON\n </Button>\n </div>\n </div>\n </Dialog.Body>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;AASO,MAAM,eAAsC,CAAC,EAAE,MAAM,cAAc;AACxE,QAAM,WAAW,OACb,iBAAiB,WAAW,QAAQ,sBACpC;AAEJ,QAAM,aAAa,YAAY;AACzB,QAAA;AACI,YAAA,UAAU,UAAU,UAAU,QAAQ;AAAA,IAAA,QACtC;AAGN;AAAA,IAAA;AAEM,YAAA;AAAA,EACV;AAEA,QAAM,iBAAiB,MAAM;AACrB,UAAA,OAAO,IAAI,KAAK,CAAC,QAAQ,GAAG,EAAE,MAAM,oBAAoB;AACxD,UAAA,MAAM,IAAI,gBAAgB,IAAI;AAC9B,UAAA,IAAI,SAAS,cAAc,GAAG;AACpC,MAAE,OAAO;AACT,MAAE,WAAW;AACb,MAAE,MAAM;AACR,eAAW,MAAM,IAAI,gBAAgB,GAAG,GAAG,CAAC;AACpC,YAAA;AAAA,EACV;AAGE,SAAA,qBAAC,UAAO,MAAY,cAAc,OAAK,CAAC,KAAK,QAC3C,GAAA,UAAA;AAAA,IAAC,oBAAA,OAAO,QAAP,EAAc,UAAkB,qBAAA,CAAA;AAAA,wBAChC,OAAO,MAAP,EACC,UAAC,qBAAA,OAAA,EAAI,WAAU,kCACb,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,UAAQ;AAAA,UACR,WAAU;AAAA,UACV,OAAO;AAAA,UACP,MAAM;AAAA,QAAA;AAAA,MACR;AAAA,MACA,qBAAC,OAAI,EAAA,WAAU,kCACb,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,SAAS,MAAM,KAAK,WAAW;AAAA,YAChC,UAAA;AAAA,UAAA;AAAA,QAED;AAAA,4BACC,QAAO,EAAA,MAAK,UAAS,SAAS,gBAAgB,UAE/C,gBAAA,CAAA;AAAA,MAAA,EACF,CAAA;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
type ImportDialogProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose(): void;
|
|
5
|
+
onImport(text: string, mode: 'merge' | 'replace'): void;
|
|
6
|
+
/** Hide the "Replace" import option (force merge) when false. */
|
|
7
|
+
allowReplace?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const ImportDialog: FC<ImportDialogProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef } from "react";
|
|
3
|
+
import { Dialog, Button } from "@graphiql/react";
|
|
4
|
+
import { collectionsStore } from "../store.js";
|
|
5
|
+
const ImportDialog = ({
|
|
6
|
+
open,
|
|
7
|
+
onClose,
|
|
8
|
+
onImport,
|
|
9
|
+
allowReplace = true
|
|
10
|
+
}) => {
|
|
11
|
+
const [importMode, setImportMode] = useState("merge");
|
|
12
|
+
const [importError, setImportError] = useState(null);
|
|
13
|
+
const [pastedText, setPastedText] = useState("");
|
|
14
|
+
const fileInputRef = useRef(null);
|
|
15
|
+
const validateAndImport = (text) => {
|
|
16
|
+
try {
|
|
17
|
+
JSON.parse(text);
|
|
18
|
+
} catch {
|
|
19
|
+
setImportError(
|
|
20
|
+
"Invalid JSON. Please paste or select a valid collections export."
|
|
21
|
+
);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const analysis = collectionsStore.getState().actions.analyzeImport(text);
|
|
25
|
+
if (!analysis.ok) {
|
|
26
|
+
setImportError("This isn’t a valid collections export.");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
onImport(text, allowReplace ? importMode : "merge");
|
|
30
|
+
onClose();
|
|
31
|
+
};
|
|
32
|
+
const handleImport = () => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const pasted = pastedText.trim();
|
|
35
|
+
if (pasted) {
|
|
36
|
+
validateAndImport(pasted);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const file = (_b = (_a = fileInputRef.current) == null ? void 0 : _a.files) == null ? void 0 : _b[0];
|
|
40
|
+
if (!file) {
|
|
41
|
+
setImportError("Paste a collections export or choose a file.");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const reader = new FileReader();
|
|
45
|
+
reader.onload = (e) => {
|
|
46
|
+
var _a2;
|
|
47
|
+
validateAndImport((_a2 = e.target) == null ? void 0 : _a2.result);
|
|
48
|
+
};
|
|
49
|
+
reader.readAsText(file);
|
|
50
|
+
};
|
|
51
|
+
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: (o) => !o && onClose(), children: [
|
|
52
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: "Import collections" }),
|
|
53
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs("div", { className: "graphiql-import-export-section", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
"textarea",
|
|
56
|
+
{
|
|
57
|
+
className: "graphiql-import-export-textarea",
|
|
58
|
+
rows: 6,
|
|
59
|
+
"aria-label": "Paste collections export JSON",
|
|
60
|
+
placeholder: "Paste a collections export (JSON)…",
|
|
61
|
+
value: pastedText,
|
|
62
|
+
onChange: (e) => {
|
|
63
|
+
setPastedText(e.target.value);
|
|
64
|
+
setImportError(null);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
"input",
|
|
70
|
+
{
|
|
71
|
+
ref: fileInputRef,
|
|
72
|
+
type: "file",
|
|
73
|
+
accept: ".json,application/json",
|
|
74
|
+
onChange: () => setImportError(null)
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsxs("fieldset", { className: "graphiql-import-export-mode", children: [
|
|
78
|
+
/* @__PURE__ */ jsx("legend", { children: "Import mode" }),
|
|
79
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
"input",
|
|
82
|
+
{
|
|
83
|
+
type: "radio",
|
|
84
|
+
name: "import-mode",
|
|
85
|
+
value: "merge",
|
|
86
|
+
checked: !allowReplace || importMode === "merge",
|
|
87
|
+
onChange: () => setImportMode("merge")
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
"Merge (add new, update changed in place)"
|
|
91
|
+
] }),
|
|
92
|
+
allowReplace && /* @__PURE__ */ jsxs("label", { children: [
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
"input",
|
|
95
|
+
{
|
|
96
|
+
type: "radio",
|
|
97
|
+
name: "import-mode",
|
|
98
|
+
value: "replace",
|
|
99
|
+
checked: importMode === "replace",
|
|
100
|
+
onChange: () => setImportMode("replace")
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
"Replace (remove all existing collections)"
|
|
104
|
+
] })
|
|
105
|
+
] }),
|
|
106
|
+
importError && /* @__PURE__ */ jsx("p", { className: "graphiql-import-export-error", children: importError }),
|
|
107
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "primary", onClick: handleImport, children: "Import" })
|
|
108
|
+
] }) })
|
|
109
|
+
] });
|
|
110
|
+
};
|
|
111
|
+
export {
|
|
112
|
+
ImportDialog
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=import-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-dialog.js","sources":["../../src/components/import-dialog.tsx"],"sourcesContent":["import { FC, useRef, useState } from 'react';\nimport { Button, Dialog } from '@graphiql/react';\nimport { collectionsStore } from '../store';\n\ntype ImportDialogProps = {\n open: boolean;\n onClose(): void;\n onImport(text: string, mode: 'merge' | 'replace'): void;\n /** Hide the \"Replace\" import option (force merge) when false. */\n allowReplace?: boolean;\n};\n\nexport const ImportDialog: FC<ImportDialogProps> = ({\n open,\n onClose,\n onImport,\n allowReplace = true,\n}) => {\n const [importMode, setImportMode] = useState<'merge' | 'replace'>('merge');\n const [importError, setImportError] = useState<string | null>(null);\n const [pastedText, setPastedText] = useState('');\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const validateAndImport = (text: string) => {\n try {\n JSON.parse(text);\n } catch {\n setImportError(\n 'Invalid JSON. Please paste or select a valid collections export.',\n );\n return;\n }\n const analysis = collectionsStore.getState().actions.analyzeImport(text);\n if (!analysis.ok) {\n setImportError('This isn’t a valid collections export.');\n return;\n }\n onImport(text, allowReplace ? importMode : 'merge');\n onClose();\n };\n\n const handleImport = () => {\n const pasted = pastedText.trim();\n if (pasted) {\n validateAndImport(pasted);\n return;\n }\n const file = fileInputRef.current?.files?.[0];\n if (!file) {\n setImportError('Paste a collections export or choose a file.');\n return;\n }\n const reader = new FileReader();\n reader.onload = e => {\n validateAndImport(e.target?.result as string);\n };\n reader.readAsText(file);\n };\n\n return (\n <Dialog open={open} onOpenChange={o => !o && onClose()}>\n <Dialog.Header>Import collections</Dialog.Header>\n <Dialog.Body>\n <div className=\"graphiql-import-export-section\">\n <textarea\n className=\"graphiql-import-export-textarea\"\n rows={6}\n aria-label=\"Paste collections export JSON\"\n placeholder=\"Paste a collections export (JSON)…\"\n value={pastedText}\n onChange={e => {\n setPastedText(e.target.value);\n setImportError(null);\n }}\n />\n <input\n ref={fileInputRef}\n type=\"file\"\n accept=\".json,application/json\"\n onChange={() => setImportError(null)}\n />\n <fieldset className=\"graphiql-import-export-mode\">\n <legend>Import mode</legend>\n <label>\n <input\n type=\"radio\"\n name=\"import-mode\"\n value=\"merge\"\n checked={!allowReplace || importMode === 'merge'}\n onChange={() => setImportMode('merge')}\n />\n Merge (add new, update changed in place)\n </label>\n {allowReplace && (\n <label>\n <input\n type=\"radio\"\n name=\"import-mode\"\n value=\"replace\"\n checked={importMode === 'replace'}\n onChange={() => setImportMode('replace')}\n />\n Replace (remove all existing collections)\n </label>\n )}\n </fieldset>\n {importError && (\n <p className=\"graphiql-import-export-error\">{importError}</p>\n )}\n <Button type=\"button\" variant=\"primary\" onClick={handleImport}>\n Import\n </Button>\n </div>\n </Dialog.Body>\n </Dialog>\n );\n};\n"],"names":["_a"],"mappings":";;;;AAYO,MAAM,eAAsC,CAAC;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AACjB,MAAM;AACJ,QAAM,CAAC,YAAY,a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AA,EAAE,OAAO,KAAK;AAC5B,2BAAe,IAAI;AAAA,UAAA;AAAA,QACrB;AAAA,MACF;AAAA,MACA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAK;AAAA,UACL,MAAK;AAAA,UACL,QAAO;AAAA,UACP,UAAU,MAAM,eAAe,IAAI;AAAA,QAAA;AAAA,MACrC;AAAA,MACA,qBAAC,YAAS,EAAA,WAAU,+BAClB,UAAA;AAAA,QAAA,oBAAC,YAAO,UAAW,cAAA,CAAA;AAAA,6BAClB,SACC,EAAA,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,MAAK;AAAA,cACL,OAAM;AAAA,cACN,SAAS,CAAC,gBAAgB,eAAe;AAAA,cACzC,UAAU,MAAM,cAAc,OAAO;AAAA,YAAA;AAAA,UACvC;AAAA,UAAE;AAAA,QAAA,GAEJ;AAAA,QACC,qCACE,SACC,EAAA,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,MAAK;AAAA,cACL,OAAM;AAAA,cACN,SAAS,eAAe;AAAA,cACxB,UAAU,MAAM,cAAc,SAAS;AAAA,YAAA;AAAA,UACzC;AAAA,UAAE;AAAA,QAAA,EAEJ,CAAA;AAAA,MAAA,GAEJ;AAAA,MACC,eACC,oBAAC,KAAE,EAAA,WAAU,gCAAgC,UAAY,aAAA;AAAA,MAE3D,oBAAC,UAAO,MAAK,UAAS,SAAQ,WAAU,SAAS,cAAc,UAE/D,SAAA,CAAA;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The single "Save to collection" dialog. Its open state and the operation
|
|
4
|
+
* being saved live in the collections store, so ⌘S and the save button can open
|
|
5
|
+
* it imperatively via `requestSave`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SaveDialog: FC;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { useGraphiQLActions, Dialog, Button } from "@graphiql/react";
|
|
4
|
+
import { useCollectionsStore, collectionsStore } from "../store.js";
|
|
5
|
+
const NEW_COLLECTION = "__new__";
|
|
6
|
+
const SaveDialog = () => {
|
|
7
|
+
const collections = useCollectionsStore((s) => s.collections);
|
|
8
|
+
const actions = useCollectionsStore((s) => s.actions);
|
|
9
|
+
const { open, name: initialName } = useCollectionsStore((s) => s.saveDialog);
|
|
10
|
+
const { markTabSaved } = useGraphiQLActions();
|
|
11
|
+
const [name, setName] = useState(initialName);
|
|
12
|
+
const [description, setDescription] = useState("");
|
|
13
|
+
const [selectedCollectionId, setSelectedCollectionId] = useState(NEW_COLLECTION);
|
|
14
|
+
const [newCollectionName, setNewCollectionName] = useState("New Collection");
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
var _a;
|
|
17
|
+
if (open) {
|
|
18
|
+
const { collections: current } = collectionsStore.getState();
|
|
19
|
+
setName(initialName);
|
|
20
|
+
setDescription("");
|
|
21
|
+
setSelectedCollectionId(((_a = current[0]) == null ? void 0 : _a.id) ?? NEW_COLLECTION);
|
|
22
|
+
setNewCollectionName("New Collection");
|
|
23
|
+
}
|
|
24
|
+
}, [open, initialName]);
|
|
25
|
+
const handleSave = () => {
|
|
26
|
+
const { saveDialog, actions: a } = collectionsStore.getState();
|
|
27
|
+
let collectionId = selectedCollectionId;
|
|
28
|
+
if (selectedCollectionId === NEW_COLLECTION) {
|
|
29
|
+
collectionId = a.createCollection(
|
|
30
|
+
newCollectionName || "New Collection"
|
|
31
|
+
).id;
|
|
32
|
+
}
|
|
33
|
+
const item = a.addItem(collectionId, {
|
|
34
|
+
name: name || "Unnamed operation",
|
|
35
|
+
description: description || void 0,
|
|
36
|
+
query: saveDialog.query,
|
|
37
|
+
variables: saveDialog.variables,
|
|
38
|
+
headers: saveDialog.headers
|
|
39
|
+
});
|
|
40
|
+
if (saveDialog.tabId) {
|
|
41
|
+
a.linkTab(saveDialog.tabId, collectionId, item.id);
|
|
42
|
+
markTabSaved(saveDialog.tabId);
|
|
43
|
+
}
|
|
44
|
+
a.closeSaveDialog();
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: (o) => !o && actions.closeSaveDialog(), children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: "Save to collection" }),
|
|
48
|
+
/* @__PURE__ */ jsxs(
|
|
49
|
+
"form",
|
|
50
|
+
{
|
|
51
|
+
onSubmit: (e) => {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
handleSave();
|
|
54
|
+
},
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsxs(Dialog.Body, { children: [
|
|
57
|
+
/* @__PURE__ */ jsxs("label", { className: "graphiql-save-dialog-field", children: [
|
|
58
|
+
/* @__PURE__ */ jsx("span", { children: "Operation name" }),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
"input",
|
|
61
|
+
{
|
|
62
|
+
type: "text",
|
|
63
|
+
value: name,
|
|
64
|
+
onChange: (e) => setName(e.target.value),
|
|
65
|
+
placeholder: "Unnamed operation",
|
|
66
|
+
className: "graphiql-save-dialog-input",
|
|
67
|
+
autoFocus: true
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ jsxs("label", { className: "graphiql-save-dialog-field", children: [
|
|
72
|
+
/* @__PURE__ */ jsx("span", { children: "Description" }),
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
"input",
|
|
75
|
+
{
|
|
76
|
+
type: "text",
|
|
77
|
+
value: description,
|
|
78
|
+
onChange: (e) => setDescription(e.target.value),
|
|
79
|
+
placeholder: "Description (optional)",
|
|
80
|
+
className: "graphiql-save-dialog-input"
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsxs("label", { className: "graphiql-save-dialog-field", children: [
|
|
85
|
+
/* @__PURE__ */ jsx("span", { children: "Collection" }),
|
|
86
|
+
/* @__PURE__ */ jsxs(
|
|
87
|
+
"select",
|
|
88
|
+
{
|
|
89
|
+
value: selectedCollectionId,
|
|
90
|
+
onChange: (e) => setSelectedCollectionId(e.target.value),
|
|
91
|
+
className: "graphiql-save-dialog-select",
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx("option", { value: NEW_COLLECTION, children: "+ New collection" }),
|
|
94
|
+
collections.map((c) => /* @__PURE__ */ jsx("option", { value: c.id, children: c.name }, c.id))
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] }),
|
|
99
|
+
selectedCollectionId === NEW_COLLECTION && /* @__PURE__ */ jsxs("label", { className: "graphiql-save-dialog-field", children: [
|
|
100
|
+
/* @__PURE__ */ jsx("span", { children: "Collection name" }),
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
"input",
|
|
103
|
+
{
|
|
104
|
+
type: "text",
|
|
105
|
+
value: newCollectionName,
|
|
106
|
+
onChange: (e) => setNewCollectionName(e.target.value),
|
|
107
|
+
placeholder: "Collection name",
|
|
108
|
+
className: "graphiql-save-dialog-input"
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
114
|
+
/* @__PURE__ */ jsx(Button, { type: "button", onClick: () => actions.closeSaveDialog(), children: "Cancel" }),
|
|
115
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", variant: "primary", children: "Save" })
|
|
116
|
+
] })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] });
|
|
121
|
+
};
|
|
122
|
+
export {
|
|
123
|
+
SaveDialog
|
|
124
|
+
};
|
|
125
|
+
//# sourceMappingURL=save-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-dialog.js","sources":["../../src/components/save-dialog.tsx"],"sourcesContent":["import { FC, useEffect, useState } from 'react';\nimport { Button, Dialog, useGraphiQLActions } from '@graphiql/react';\nimport { useCollectionsStore, collectionsStore } from '../store';\n\nconst NEW_COLLECTION = '__new__';\n\n/**\n * The single \"Save to collection\" dialog. Its open state and the operation\n * being saved live in the collections store, so ⌘S and the save button can open\n * it imperatively via `requestSave`.\n */\nexport const SaveDialog: FC = () => {\n const collections = useCollectionsStore(s => s.collections);\n const actions = useCollectionsStore(s => s.actions);\n const { open, name: initialName } = useCollectionsStore(s => s.saveDialog);\n const { markTabSaved } = useGraphiQLActions();\n\n const [name, setName] = useState(initialName);\n const [description, setDescription] = useState('');\n const [selectedCollectionId, setSelectedCollectionId] =\n useState<string>(NEW_COLLECTION);\n const [newCollectionName, setNewCollectionName] = useState('New Collection');\n\n // Reset the form each time the dialog opens with a fresh operation.\n useEffect(() => {\n if (open) {\n const { collections: current } = collectionsStore.getState();\n setName(initialName);\n setDescription('');\n setSelectedCollectionId(current[0]?.id ?? NEW_COLLECTION);\n setNewCollectionName('New Collection');\n }\n }, [open, initialName]);\n\n const handleSave = () => {\n const { saveDialog, actions: a } = collectionsStore.getState();\n let collectionId = selectedCollectionId;\n if (selectedCollectionId === NEW_COLLECTION) {\n collectionId = a.createCollection(\n newCollectionName || 'New Collection',\n ).id;\n }\n const item = a.addItem(collectionId, {\n name: name || 'Unnamed operation',\n description: description || undefined,\n query: saveDialog.query,\n variables: saveDialog.variables,\n headers: saveDialog.headers,\n });\n if (saveDialog.tabId) {\n a.linkTab(saveDialog.tabId, collectionId, item.id);\n markTabSaved(saveDialog.tabId);\n }\n a.closeSaveDialog();\n };\n\n return (\n <Dialog open={open} onOpenChange={o => !o && actions.closeSaveDialog()}>\n <Dialog.Header>Save to collection</Dialog.Header>\n <form\n onSubmit={e => {\n e.preventDefault();\n handleSave();\n }}\n >\n <Dialog.Body>\n <label className=\"graphiql-save-dialog-field\">\n <span>Operation name</span>\n <input\n type=\"text\"\n value={name}\n onChange={e => setName(e.target.value)}\n placeholder=\"Unnamed operation\"\n className=\"graphiql-save-dialog-input\"\n autoFocus\n />\n </label>\n <label className=\"graphiql-save-dialog-field\">\n <span>Description</span>\n <input\n type=\"text\"\n value={description}\n onChange={e => setDescription(e.target.value)}\n placeholder=\"Description (optional)\"\n className=\"graphiql-save-dialog-input\"\n />\n </label>\n <label className=\"graphiql-save-dialog-field\">\n <span>Collection</span>\n <select\n value={selectedCollectionId}\n onChange={e => setSelectedCollectionId(e.target.value)}\n className=\"graphiql-save-dialog-select\"\n >\n <option value={NEW_COLLECTION}>+ New collection</option>\n {collections.map(c => (\n <option key={c.id} value={c.id}>\n {c.name}\n </option>\n ))}\n </select>\n </label>\n {selectedCollectionId === NEW_COLLECTION && (\n <label className=\"graphiql-save-dialog-field\">\n <span>Collection name</span>\n <input\n type=\"text\"\n value={newCollectionName}\n onChange={e => setNewCollectionName(e.target.value)}\n placeholder=\"Collection name\"\n className=\"graphiql-save-dialog-input\"\n />\n </label>\n )}\n </Dialog.Body>\n <Dialog.Footer>\n <Button type=\"button\" onClick={() => actions.closeSaveDialog()}>\n Cancel\n </Button>\n <Button type=\"submit\" variant=\"primary\">\n Save\n </Button>\n </Dialog.Footer>\n </form>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;AAIA,MAAM,iBAAiB;AAOhB,MAAM,aAAiB,MAAM;AAClC,QAAM,cAAc,oBAAoB,CAAK,MAAA,EAAE,WAAW;AAC1D,QAAM,UAAU,oBAAoB,CAAK,MAAA,EAAE,OAAO;AAC5C,QAAA,EAAE,MAAM,MAAM,YAAA,IAAgB,oBAAoB,CAAA,MAAK,EAAE,UAAU;AACnE,QAAA,EAAE,aAAa,IAAI,mBAAmB;AAE5C,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,WAAW;AAC5C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gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,OAAO;AAAA,kBACP,UAAU,CAAA,MAAK,qBAAqB,EAAE,OAAO,KAAK;AAAA,kBAClD,aAAY;AAAA,kBACZ,WAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YACZ,EACF,CAAA;AAAA,UAAA,GAEJ;AAAA,UACA,qBAAC,OAAO,QAAP,EACC,UAAA;AAAA,YAAC,oBAAA,QAAA,EAAO,MAAK,UAAS,SAAS,MAAM,QAAQ,gBAAA,GAAmB,UAEhE,SAAA,CAAA;AAAA,gCACC,QAAO,EAAA,MAAK,UAAS,SAAQ,WAAU,UAExC,OAAA,CAAA;AAAA,UAAA,EACF,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CollectionsStorage } from '../types';
|
|
2
|
+
type CollectionsSessionActionsProps = {
|
|
3
|
+
storage?: CollectionsStorage;
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
allowImportExport?: boolean;
|
|
6
|
+
allowReplace?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const CollectionsSessionActions: ({ storage, readOnly, allowImportExport, allowReplace, }: CollectionsSessionActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useGraphiQLActions } from "@graphiql/react";
|
|
4
|
+
import { collectionsStore } from "../store.js";
|
|
5
|
+
import { localStorageAdapter } from "../storage/local-storage.js";
|
|
6
|
+
import { SaveDialog } from "./save-dialog.js";
|
|
7
|
+
const CollectionsSessionActions = ({
|
|
8
|
+
storage,
|
|
9
|
+
readOnly = false,
|
|
10
|
+
allowImportExport = true,
|
|
11
|
+
allowReplace = true
|
|
12
|
+
}) => {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
void collectionsStore.getState().actions.init(storage ?? localStorageAdapter, {
|
|
15
|
+
readOnly,
|
|
16
|
+
allowImportExport,
|
|
17
|
+
allowReplace
|
|
18
|
+
});
|
|
19
|
+
}, []);
|
|
20
|
+
const { registerSaveHandler } = useGraphiQLActions();
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (readOnly) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
return registerSaveHandler(
|
|
26
|
+
(tab) => collectionsStore.getState().actions.requestSave(tab)
|
|
27
|
+
);
|
|
28
|
+
}, [readOnly, registerSaveHandler]);
|
|
29
|
+
return /* @__PURE__ */ jsx(SaveDialog, {});
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
CollectionsSessionActions
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=session-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-actions.js","sources":["../../src/components/session-actions.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useGraphiQLActions } from '@graphiql/react';\nimport { collectionsStore } from '../store';\nimport { localStorageAdapter } from '../storage/local-storage';\nimport { SaveDialog } from './save-dialog';\nimport type { CollectionsStorage } from '../types';\n\ntype CollectionsSessionActionsProps = {\n storage?: CollectionsStorage;\n readOnly?: boolean;\n allowImportExport?: boolean;\n allowReplace?: boolean;\n};\n\nexport const CollectionsSessionActions = ({\n storage,\n readOnly = false,\n allowImportExport = true,\n allowReplace = true,\n}: CollectionsSessionActionsProps) => {\n useEffect(() => {\n void collectionsStore\n .getState()\n .actions.init(storage ?? localStorageAdapter, {\n readOnly,\n allowImportExport,\n allowReplace,\n });\n // storage/config are intentionally only read on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const { registerSaveHandler } = useGraphiQLActions();\n\n useEffect(() => {\n if (readOnly) {\n return;\n }\n return registerSaveHandler(tab =>\n collectionsStore.getState().actions.requestSave(tab),\n );\n }, [readOnly, registerSaveHandler]);\n\n return <SaveDialog />;\n};\n"],"names":[],"mappings":";;;;;;AAcO,MAAM,4BAA4B,CAAC;AAAA,EACxC;AAAA,EACA,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,eAAe;AACjB,MAAsC;AACpC,YAAU,MAAM;AACd,SAAK,iBACF,SAAS,EACT,QAAQ,KAAK,WAAW,qBAAqB;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EAGL,GAAG,EAAE;AAEC,QAAA,EAAE,oBAAoB,IAAI,mBAAmB;AAEnD,YAAU,MAAM;AACd,QAAI,UAAU;AACZ;AAAA,IAAA;AAEK,WAAA;AAAA,MAAoB,SACzB,iBAAiB,SAAW,EAAA,QAAQ,YAAY,GAAG;AAAA,IACrD;AAAA,EAAA,GACC,CAAC,UAAU,mBAAmB,CAAC;AAElC,6BAAQ,YAAW,EAAA;AACrB;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgCheck = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", "aria-labelledby": titleId, ...props }, title ? /* @__PURE__ */ React.createElement("title", { id: titleId }, title) : null, /* @__PURE__ */ React.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.75, d: "m3.5 8.5 3 3 6-7" }));
|
|
7
|
+
export {
|
|
8
|
+
SvgCheck as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sources":["../../src/icons/check.svg?react"],"sourcesContent":["import * as React from \"react\";\nconst SvgCheck = ({\n title,\n titleId,\n ...props\n}) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", fill: \"none\", viewBox: \"0 0 16 16\", \"aria-labelledby\": titleId, ...props }, title ? /* @__PURE__ */ React.createElement(\"title\", { id: titleId }, title) : null, /* @__PURE__ */ React.createElement(\"path\", { stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 1.75, d: \"m3.5 8.5 3 3 6-7\" }));\nexport default SvgCheck;\n"],"names":[],"mappings":";AACK,MAAC,WAAW,CAAC;AAAA,EAChB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsB,sBAAM,cAAc,OAAO,EAAE,OAAO,8BAA8B,MAAM,QAAQ,SAAS,aAAa,mBAAmB,SAAS,GAAG,MAAK,GAAI,QAAwB,sBAAM,cAAc,SAAS,EAAE,IAAI,QAAO,GAAI,KAAK,IAAI,MAAsB,sBAAM,cAAc,QAAQ,EAAE,QAAQ,gBAAgB,eAAe,SAAS,gBAAgB,SAAS,aAAa,MAAM,GAAG,oBAAoB,CAAC;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgCollections = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, viewBox: "0 0 24 24", "aria-labelledby": titleId, ...props }, title ? /* @__PURE__ */ React.createElement("title", { id: titleId }, title) : null, /* @__PURE__ */ React.createElement("path", { d: "M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" }));
|
|
7
|
+
export {
|
|
8
|
+
SvgCollections as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.js","sources":["../../src/icons/collections.svg?react"],"sourcesContent":["import * as React from \"react\";\nconst SvgCollections = ({\n title,\n titleId,\n ...props\n}) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", fill: \"none\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 2, viewBox: \"0 0 24 24\", \"aria-labelledby\": titleId, ...props }, title ? /* @__PURE__ */ React.createElement(\"title\", { id: titleId }, title) : null, /* @__PURE__ */ React.createElement(\"path\", { d: \"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z\" }));\nexport default SvgCollections;\n"],"names":[],"mappings":";AACK,MAAC,iBAAiB,CAAC;AAAA,EACtB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsB,sBAAM,cAAc,OAAO,EAAE,OAAO,8BAA8B,MAAM,QAAQ,QAAQ,gBAAgB,eAAe,SAAS,gBAAgB,SAAS,aAAa,GAAG,SAAS,aAAa,mBAAmB,SAAS,GAAG,MAAK,GAAI,QAAwB,sBAAM,cAAc,SAAS,EAAE,IAAI,QAAS,GAAE,KAAK,IAAI,MAAsB,sBAAM,cAAc,QAAQ,EAAE,GAAG,+EAA+E,CAAC;"}
|