@mvriu5/payload-ai 0.5.8 → 0.5.9
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/components/AIActionProposalList.d.ts +2 -1
- package/dist/components/AIActionProposalList.js +74 -6
- package/dist/components/AIActionProposalList.module.css +49 -5
- package/dist/components/AIInput.js +125 -10
- package/dist/components/AIInput.module.css +27 -6
- package/dist/components/DiffDialog.d.ts +12 -0
- package/dist/components/DiffDialog.js +310 -0
- package/dist/components/DiffDialog.module.css +249 -0
- package/dist/components/Icons.d.ts +4 -0
- package/dist/components/Icons.js +87 -0
- package/dist/components/RecentChangesList.d.ts +18 -0
- package/dist/components/RecentChangesList.js +66 -0
- package/dist/components/RecentChangesList.module.css +135 -0
- package/dist/endpoints/aiApplyActionEndpointHandler.d.ts +1 -0
- package/dist/endpoints/aiApplyActionEndpointHandler.js +200 -4
- package/dist/endpoints/aiChatEndpointHandler.js +85 -24
- package/dist/endpoints/aiProposalDiffEndpointHandler.d.ts +7 -0
- package/dist/endpoints/aiProposalDiffEndpointHandler.js +138 -0
- package/dist/endpoints/aiRecentChangesEndpointHandler.d.ts +6 -0
- package/dist/endpoints/aiRecentChangesEndpointHandler.js +35 -0
- package/dist/index.js +111 -0
- package/dist/payload/schemaContext.d.ts +44 -1
- package/dist/payload/schemaContext.js +100 -12
- package/package.json +1 -1
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { XIcon } from "@payloadcms/ui/icons/X";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import styles from "./DiffDialog.module.css";
|
|
4
|
+
const formatDiffValue = (value)=>{
|
|
5
|
+
return JSON.stringify(value, null, 2);
|
|
6
|
+
};
|
|
7
|
+
const createLine = ({ changed, path, placeholder = false, text = "" })=>({
|
|
8
|
+
changed,
|
|
9
|
+
path,
|
|
10
|
+
placeholder,
|
|
11
|
+
text
|
|
12
|
+
});
|
|
13
|
+
const getJSONLineKey = (line)=>{
|
|
14
|
+
const match = /^(\s*)"([^"]+)":/.exec(line);
|
|
15
|
+
return match ? `${match[1]}${match[2]}` : null;
|
|
16
|
+
};
|
|
17
|
+
const shouldPairChangedLines = (beforeLine, afterLine)=>{
|
|
18
|
+
const beforeKey = getJSONLineKey(beforeLine);
|
|
19
|
+
const afterKey = getJSONLineKey(afterLine);
|
|
20
|
+
return Boolean(beforeKey && afterKey && beforeKey === afterKey);
|
|
21
|
+
};
|
|
22
|
+
const getJSONLinePaths = (lines)=>{
|
|
23
|
+
const stack = [];
|
|
24
|
+
return lines.map((line)=>{
|
|
25
|
+
const indentation = line.match(/^\s*/)?.[0].length || 0;
|
|
26
|
+
const level = Math.floor(indentation / 2);
|
|
27
|
+
const keyMatch = /^\s*"([^"]+)":/.exec(line);
|
|
28
|
+
stack.length = level;
|
|
29
|
+
if (keyMatch?.[1]) {
|
|
30
|
+
stack[level] = keyMatch[1];
|
|
31
|
+
return stack.slice(0, level + 1).join(".");
|
|
32
|
+
}
|
|
33
|
+
return stack.slice(0, level).join(".");
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const getRowPath = (row)=>{
|
|
37
|
+
return row.after.path || row.before.path;
|
|
38
|
+
};
|
|
39
|
+
const isChangedRow = (row)=>{
|
|
40
|
+
return row.before.changed || row.after.changed;
|
|
41
|
+
};
|
|
42
|
+
const buildDisplayRows = (rows, expandedGroups)=>{
|
|
43
|
+
const displayRows = [];
|
|
44
|
+
const contextRows = 2;
|
|
45
|
+
let index = 0;
|
|
46
|
+
while(index < rows.length){
|
|
47
|
+
if (isChangedRow(rows[index])) {
|
|
48
|
+
displayRows.push({
|
|
49
|
+
index,
|
|
50
|
+
row: rows[index],
|
|
51
|
+
type: "row"
|
|
52
|
+
});
|
|
53
|
+
index += 1;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const start = index;
|
|
57
|
+
while(index < rows.length && !isChangedRow(rows[index])){
|
|
58
|
+
index += 1;
|
|
59
|
+
}
|
|
60
|
+
const end = index;
|
|
61
|
+
const count = end - start;
|
|
62
|
+
const groupID = `${start}-${end}`;
|
|
63
|
+
if (count <= contextRows * 2 + 2) {
|
|
64
|
+
for(let rowIndex = start; rowIndex < end; rowIndex += 1){
|
|
65
|
+
displayRows.push({
|
|
66
|
+
index: rowIndex,
|
|
67
|
+
row: rows[rowIndex],
|
|
68
|
+
type: "row"
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const isExpanded = expandedGroups.has(groupID);
|
|
74
|
+
for(let rowIndex = start; rowIndex < start + contextRows; rowIndex += 1){
|
|
75
|
+
displayRows.push({
|
|
76
|
+
index: rowIndex,
|
|
77
|
+
row: rows[rowIndex],
|
|
78
|
+
type: "row"
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
displayRows.push({
|
|
82
|
+
count: count - contextRows * 2,
|
|
83
|
+
expanded: isExpanded,
|
|
84
|
+
id: groupID,
|
|
85
|
+
path: getRowPath(rows[start + contextRows]),
|
|
86
|
+
type: "collapsed"
|
|
87
|
+
});
|
|
88
|
+
if (isExpanded) {
|
|
89
|
+
for(let rowIndex = start + contextRows; rowIndex < end - contextRows; rowIndex += 1){
|
|
90
|
+
displayRows.push({
|
|
91
|
+
index: rowIndex,
|
|
92
|
+
row: rows[rowIndex],
|
|
93
|
+
type: "row"
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
for(let rowIndex = end - contextRows; rowIndex < end; rowIndex += 1){
|
|
98
|
+
displayRows.push({
|
|
99
|
+
index: rowIndex,
|
|
100
|
+
row: rows[rowIndex],
|
|
101
|
+
type: "row"
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return displayRows;
|
|
106
|
+
};
|
|
107
|
+
const getDiffRows = (before, after)=>{
|
|
108
|
+
const beforeLines = before.split("\n");
|
|
109
|
+
const afterLines = after.split("\n");
|
|
110
|
+
const beforeLinePaths = getJSONLinePaths(beforeLines);
|
|
111
|
+
const afterLinePaths = getJSONLinePaths(afterLines);
|
|
112
|
+
const dp = Array.from({
|
|
113
|
+
length: beforeLines.length + 1
|
|
114
|
+
}, ()=>Array(afterLines.length + 1).fill(0));
|
|
115
|
+
for(let i = beforeLines.length - 1; i >= 0; i -= 1){
|
|
116
|
+
for(let j = afterLines.length - 1; j >= 0; j -= 1){
|
|
117
|
+
dp[i][j] = beforeLines[i] === afterLines[j] ? dp[i + 1][j + 1] + 1 : Math.max(dp[i + 1][j], dp[i][j + 1]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const rows = [];
|
|
121
|
+
let beforeIndex = 0;
|
|
122
|
+
let afterIndex = 0;
|
|
123
|
+
while(beforeIndex < beforeLines.length && afterIndex < afterLines.length){
|
|
124
|
+
if (beforeLines[beforeIndex] === afterLines[afterIndex]) {
|
|
125
|
+
rows.push({
|
|
126
|
+
after: createLine({
|
|
127
|
+
changed: false,
|
|
128
|
+
path: afterLinePaths[afterIndex],
|
|
129
|
+
text: afterLines[afterIndex]
|
|
130
|
+
}),
|
|
131
|
+
before: createLine({
|
|
132
|
+
changed: false,
|
|
133
|
+
path: beforeLinePaths[beforeIndex],
|
|
134
|
+
text: beforeLines[beforeIndex]
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
beforeIndex += 1;
|
|
138
|
+
afterIndex += 1;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (shouldPairChangedLines(beforeLines[beforeIndex], afterLines[afterIndex])) {
|
|
142
|
+
rows.push({
|
|
143
|
+
after: createLine({
|
|
144
|
+
changed: true,
|
|
145
|
+
path: afterLinePaths[afterIndex],
|
|
146
|
+
text: afterLines[afterIndex]
|
|
147
|
+
}),
|
|
148
|
+
before: createLine({
|
|
149
|
+
changed: true,
|
|
150
|
+
path: beforeLinePaths[beforeIndex],
|
|
151
|
+
text: beforeLines[beforeIndex]
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
beforeIndex += 1;
|
|
155
|
+
afterIndex += 1;
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (dp[beforeIndex + 1][afterIndex] >= dp[beforeIndex][afterIndex + 1]) {
|
|
159
|
+
rows.push({
|
|
160
|
+
after: createLine({
|
|
161
|
+
changed: false,
|
|
162
|
+
placeholder: true
|
|
163
|
+
}),
|
|
164
|
+
before: createLine({
|
|
165
|
+
changed: true,
|
|
166
|
+
path: beforeLinePaths[beforeIndex],
|
|
167
|
+
text: beforeLines[beforeIndex]
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
beforeIndex += 1;
|
|
171
|
+
} else {
|
|
172
|
+
rows.push({
|
|
173
|
+
after: createLine({
|
|
174
|
+
changed: true,
|
|
175
|
+
path: afterLinePaths[afterIndex],
|
|
176
|
+
text: afterLines[afterIndex]
|
|
177
|
+
}),
|
|
178
|
+
before: createLine({
|
|
179
|
+
changed: false,
|
|
180
|
+
placeholder: true
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
afterIndex += 1;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
while(beforeIndex < beforeLines.length){
|
|
187
|
+
rows.push({
|
|
188
|
+
after: createLine({
|
|
189
|
+
changed: false,
|
|
190
|
+
placeholder: true
|
|
191
|
+
}),
|
|
192
|
+
before: createLine({
|
|
193
|
+
changed: true,
|
|
194
|
+
path: beforeLinePaths[beforeIndex],
|
|
195
|
+
text: beforeLines[beforeIndex]
|
|
196
|
+
})
|
|
197
|
+
});
|
|
198
|
+
beforeIndex += 1;
|
|
199
|
+
}
|
|
200
|
+
while(afterIndex < afterLines.length){
|
|
201
|
+
rows.push({
|
|
202
|
+
after: createLine({
|
|
203
|
+
changed: true,
|
|
204
|
+
path: afterLinePaths[afterIndex],
|
|
205
|
+
text: afterLines[afterIndex]
|
|
206
|
+
}),
|
|
207
|
+
before: createLine({
|
|
208
|
+
changed: false,
|
|
209
|
+
placeholder: true
|
|
210
|
+
})
|
|
211
|
+
});
|
|
212
|
+
afterIndex += 1;
|
|
213
|
+
}
|
|
214
|
+
return rows;
|
|
215
|
+
};
|
|
216
|
+
export const DiffDialog = ({ diff, onClose, proposal })=>{
|
|
217
|
+
const [scrollLeft, setScrollLeft] = useState(0);
|
|
218
|
+
const [expandedGroups, setExpandedGroups] = useState(()=>new Set());
|
|
219
|
+
const beforeValue = formatDiffValue(diff.before);
|
|
220
|
+
const afterValue = formatDiffValue(diff.after);
|
|
221
|
+
const diffRows = getDiffRows(beforeValue, afterValue);
|
|
222
|
+
const displayRows = buildDisplayRows(diffRows, expandedGroups);
|
|
223
|
+
const longestLineLength = Math.max(...beforeValue.split("\n").map((line)=>line.length), ...afterValue.split("\n").map((line)=>line.length), 80);
|
|
224
|
+
const diffShellStyle = {
|
|
225
|
+
"--diff-line-offset": `-${scrollLeft}px`,
|
|
226
|
+
"--diff-line-width": `${longestLineLength + 8}ch`
|
|
227
|
+
};
|
|
228
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
229
|
+
"aria-modal": "true",
|
|
230
|
+
className: styles.dialogOverlay,
|
|
231
|
+
role: "dialog"
|
|
232
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
233
|
+
className: styles.dialog
|
|
234
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
235
|
+
className: styles.dialogHeader
|
|
236
|
+
}, /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("div", {
|
|
237
|
+
className: styles.dialogTitle
|
|
238
|
+
}, proposal.label), /*#__PURE__*/ React.createElement("div", {
|
|
239
|
+
className: styles.meta
|
|
240
|
+
}, proposal.action, " in ", proposal.collection || proposal.slug, proposal.id ? ` #${proposal.id}` : "")), /*#__PURE__*/ React.createElement("button", {
|
|
241
|
+
"aria-label": "Close",
|
|
242
|
+
className: styles.closeButton,
|
|
243
|
+
onClick: onClose,
|
|
244
|
+
type: "button"
|
|
245
|
+
}, /*#__PURE__*/ React.createElement(XIcon, null))), /*#__PURE__*/ React.createElement("div", {
|
|
246
|
+
className: styles.diffShell,
|
|
247
|
+
style: diffShellStyle
|
|
248
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
249
|
+
className: styles.diffScroll
|
|
250
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
251
|
+
className: styles.diffHeaderGrid
|
|
252
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
253
|
+
className: styles.diffPaneHeader
|
|
254
|
+
}, "Current"), /*#__PURE__*/ React.createElement("div", {
|
|
255
|
+
className: styles.diffPaneHeader
|
|
256
|
+
}, "Proposed")), /*#__PURE__*/ React.createElement("div", {
|
|
257
|
+
className: styles.diffRows
|
|
258
|
+
}, displayRows.map((displayRow)=>{
|
|
259
|
+
if (displayRow.type === "collapsed") {
|
|
260
|
+
return /*#__PURE__*/ React.createElement("button", {
|
|
261
|
+
className: styles.diffCollapsedRow,
|
|
262
|
+
key: `collapsed-${displayRow.id}`,
|
|
263
|
+
onClick: ()=>{
|
|
264
|
+
setExpandedGroups((current)=>{
|
|
265
|
+
const next = new Set(current);
|
|
266
|
+
if (displayRow.expanded) {
|
|
267
|
+
next.delete(displayRow.id);
|
|
268
|
+
} else {
|
|
269
|
+
next.add(displayRow.id);
|
|
270
|
+
}
|
|
271
|
+
return next;
|
|
272
|
+
});
|
|
273
|
+
},
|
|
274
|
+
type: "button"
|
|
275
|
+
}, displayRow.expanded ? "Hide" : "Show", " ", displayRow.count, " unchanged lines", displayRow.path ? /*#__PURE__*/ React.createElement("span", {
|
|
276
|
+
className: styles.diffCollapsedPath
|
|
277
|
+
}, displayRow.path) : null);
|
|
278
|
+
}
|
|
279
|
+
const row = displayRow.row;
|
|
280
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
281
|
+
className: styles.diffRow,
|
|
282
|
+
key: `row-${displayRow.index}`
|
|
283
|
+
}, /*#__PURE__*/ React.createElement("span", {
|
|
284
|
+
className: [
|
|
285
|
+
styles.diffLine,
|
|
286
|
+
row.before.changed ? styles.diffLineRemoved : "",
|
|
287
|
+
row.before.placeholder ? styles.diffLinePlaceholder : ""
|
|
288
|
+
].filter(Boolean).join(" ")
|
|
289
|
+
}, row.before.changed && row.before.path ? /*#__PURE__*/ React.createElement("span", {
|
|
290
|
+
className: styles.diffPathBadge
|
|
291
|
+
}, row.before.path) : null, /*#__PURE__*/ React.createElement("span", {
|
|
292
|
+
className: styles.diffLineContent
|
|
293
|
+
}, row.before.text || " ")), /*#__PURE__*/ React.createElement("span", {
|
|
294
|
+
className: [
|
|
295
|
+
styles.diffLine,
|
|
296
|
+
row.after.changed ? styles.diffLineAdded : "",
|
|
297
|
+
row.after.placeholder ? styles.diffLinePlaceholder : ""
|
|
298
|
+
].filter(Boolean).join(" ")
|
|
299
|
+
}, row.after.changed && row.after.path ? /*#__PURE__*/ React.createElement("span", {
|
|
300
|
+
className: styles.diffPathBadge
|
|
301
|
+
}, row.after.path) : null, /*#__PURE__*/ React.createElement("span", {
|
|
302
|
+
className: styles.diffLineContent
|
|
303
|
+
}, row.after.text || " ")));
|
|
304
|
+
}))), /*#__PURE__*/ React.createElement("div", {
|
|
305
|
+
className: styles.horizontalScroll,
|
|
306
|
+
onScroll: (event)=>setScrollLeft(event.currentTarget.scrollLeft)
|
|
307
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
308
|
+
className: styles.horizontalScrollSpacer
|
|
309
|
+
})))));
|
|
310
|
+
};
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
.dialogOverlay {
|
|
2
|
+
align-items: center;
|
|
3
|
+
background: rgba(0, 0, 0, 0.42);
|
|
4
|
+
display: flex;
|
|
5
|
+
inset: 0;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
padding: 24px;
|
|
8
|
+
position: fixed;
|
|
9
|
+
z-index: 1100;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.dialog {
|
|
13
|
+
background: var(--theme-bg);
|
|
14
|
+
border: 1px solid var(--theme-elevation-150);
|
|
15
|
+
border-radius: 6px;
|
|
16
|
+
box-shadow: 0 20px 64px rgba(0, 0, 0, 0.26);
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: 16px;
|
|
20
|
+
max-height: min(760px, calc(100vh - 48px));
|
|
21
|
+
max-width: min(1120px, calc(100vw - 48px));
|
|
22
|
+
padding: 16px;
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dialogHeader {
|
|
27
|
+
align-items: flex-start;
|
|
28
|
+
display: flex;
|
|
29
|
+
gap: 12px;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.dialogTitle {
|
|
34
|
+
color: var(--theme-text);
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
line-height: 1.4;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.meta {
|
|
41
|
+
color: var(--theme-elevation-600);
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
line-height: 1.4;
|
|
44
|
+
margin-top: 2px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.closeButton {
|
|
48
|
+
align-items: center;
|
|
49
|
+
background: transparent;
|
|
50
|
+
border: 1px solid var(--theme-elevation-150);
|
|
51
|
+
border-radius: 4px;
|
|
52
|
+
color: var(--theme-text);
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
display: inline-flex;
|
|
55
|
+
flex: 0 0 auto;
|
|
56
|
+
font: inherit;
|
|
57
|
+
height: 24px;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
line-height: 24px;
|
|
60
|
+
min-height: 24px;
|
|
61
|
+
padding: 0;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
width: 24px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.closeButton svg {
|
|
67
|
+
height: 12px;
|
|
68
|
+
width: 12px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.diffShell {
|
|
72
|
+
border: 1px solid var(--theme-elevation-150);
|
|
73
|
+
border-radius: 0;
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
min-height: 0;
|
|
77
|
+
min-width: 0;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.diffHeaderGrid {
|
|
82
|
+
display: grid;
|
|
83
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
84
|
+
min-width: 100%;
|
|
85
|
+
position: sticky;
|
|
86
|
+
top: 0;
|
|
87
|
+
z-index: 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.diffPaneHeader {
|
|
91
|
+
background: var(--theme-elevation-50);
|
|
92
|
+
border-bottom: 1px solid var(--theme-elevation-150);
|
|
93
|
+
color: var(--theme-elevation-700);
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
font-weight: 600;
|
|
96
|
+
line-height: 1.4;
|
|
97
|
+
min-width: 0;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
padding: 8px 10px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.diffPaneHeader + .diffPaneHeader {
|
|
103
|
+
border-left: 1px solid var(--theme-elevation-150);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.diffScroll {
|
|
107
|
+
background: var(--theme-elevation-50);
|
|
108
|
+
color: var(--theme-text);
|
|
109
|
+
flex: 1 1 auto;
|
|
110
|
+
font-size: 12px;
|
|
111
|
+
line-height: 1.5;
|
|
112
|
+
min-height: 260px;
|
|
113
|
+
overflow-x: hidden;
|
|
114
|
+
overflow-y: auto;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.diffRows {
|
|
118
|
+
display: grid;
|
|
119
|
+
font-family: monospace;
|
|
120
|
+
min-width: 100%;
|
|
121
|
+
padding: 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.diffRow {
|
|
125
|
+
display: grid;
|
|
126
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
127
|
+
min-width: 100%;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.diffLine {
|
|
131
|
+
display: block;
|
|
132
|
+
min-height: 18px;
|
|
133
|
+
min-width: 0;
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
padding: 0;
|
|
136
|
+
text-overflow: clip;
|
|
137
|
+
white-space: pre;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.diffPathBadge {
|
|
141
|
+
background: rgba(255, 255, 255, 0.08);
|
|
142
|
+
border: 1px solid rgba(255, 255, 255, 0.16);
|
|
143
|
+
border-radius: 3px;
|
|
144
|
+
color: var(--theme-elevation-700);
|
|
145
|
+
display: block;
|
|
146
|
+
font-family: monospace;
|
|
147
|
+
font-size: 11px;
|
|
148
|
+
line-height: 18px;
|
|
149
|
+
margin: 2px 6px 1px;
|
|
150
|
+
max-width: calc(100% - 12px);
|
|
151
|
+
overflow: hidden;
|
|
152
|
+
padding: 0 6px;
|
|
153
|
+
text-overflow: ellipsis;
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.diffLineContent {
|
|
158
|
+
display: inline-block;
|
|
159
|
+
min-width: var(--diff-line-width);
|
|
160
|
+
transform: translateX(var(--diff-line-offset));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.diffLine + .diffLine {
|
|
164
|
+
box-shadow: inset 1px 0 0 var(--theme-elevation-150);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.diffLineAdded {
|
|
168
|
+
background: rgba(39, 132, 90, 0.28);
|
|
169
|
+
border-left: 3px solid rgba(39, 132, 90, 0.92);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.diffLineRemoved {
|
|
173
|
+
background: rgba(160, 26, 26, 0.28);
|
|
174
|
+
border-left: 3px solid rgba(136, 18, 18, 0.96);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.diffLinePlaceholder {
|
|
178
|
+
background: var(--theme-elevation-50);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.diffCollapsedRow {
|
|
182
|
+
align-items: center;
|
|
183
|
+
background: var(--theme-elevation-100);
|
|
184
|
+
border: 0;
|
|
185
|
+
border-bottom: 1px solid var(--theme-elevation-150);
|
|
186
|
+
border-top: 1px solid var(--theme-elevation-150);
|
|
187
|
+
color: var(--theme-elevation-600);
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
display: flex;
|
|
190
|
+
font: inherit;
|
|
191
|
+
font-family: monospace;
|
|
192
|
+
font-size: 12px;
|
|
193
|
+
gap: 8px;
|
|
194
|
+
grid-column: 1 / -1;
|
|
195
|
+
justify-content: center;
|
|
196
|
+
line-height: 24px;
|
|
197
|
+
min-height: 24px;
|
|
198
|
+
padding: 0 10px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.diffCollapsedRow:hover {
|
|
202
|
+
background: var(--theme-elevation-150);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.diffCollapsedPath {
|
|
206
|
+
color: var(--theme-elevation-500);
|
|
207
|
+
min-width: 0;
|
|
208
|
+
overflow: hidden;
|
|
209
|
+
text-overflow: ellipsis;
|
|
210
|
+
white-space: nowrap;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.horizontalScroll {
|
|
214
|
+
flex: 0 0 auto;
|
|
215
|
+
height: 16px;
|
|
216
|
+
overflow-x: auto;
|
|
217
|
+
overflow-y: hidden;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.horizontalScrollSpacer {
|
|
221
|
+
height: 1px;
|
|
222
|
+
min-width: 100%;
|
|
223
|
+
width: calc(50% + var(--diff-line-width));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@media (max-width: 768px) {
|
|
227
|
+
.dialogOverlay {
|
|
228
|
+
padding: 12px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.dialog {
|
|
232
|
+
max-height: calc(100vh - 24px);
|
|
233
|
+
max-width: calc(100vw - 24px);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.dialogHeader {
|
|
237
|
+
align-items: stretch;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.closeButton {
|
|
242
|
+
align-self: flex-end;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.diffScroll {
|
|
246
|
+
min-height: 180px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
}
|
|
@@ -3,3 +3,7 @@ export declare function MistralAiIcon(props: SVGProps<SVGSVGElement>): import("r
|
|
|
3
3
|
export declare function OpenaiIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
4
4
|
export declare function ClaudeIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
5
5
|
export declare function GoogleGeminiIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
6
|
+
export declare function FileDiff(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
7
|
+
export declare function Send(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
8
|
+
export declare function Apply(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
9
|
+
export declare function Reject(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
package/dist/components/Icons.js
CHANGED
|
@@ -177,3 +177,90 @@ export function GoogleGeminiIcon(props) {
|
|
|
177
177
|
d: "M348.374 72.76c-2.846-18.788-17.592-33.533-36.38-36.38c18.788-2.847 33.534-17.593 36.38-36.38c2.847 18.787 17.593 33.533 36.38 36.38c-18.787 2.847-33.533 17.592-36.38 36.38"
|
|
178
178
|
}));
|
|
179
179
|
}
|
|
180
|
+
export function FileDiff(props) {
|
|
181
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
182
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
183
|
+
viewBox: "0 0 24 24",
|
|
184
|
+
fill: "none",
|
|
185
|
+
stroke: "currentColor",
|
|
186
|
+
strokeWidth: 2,
|
|
187
|
+
strokeLinecap: "round",
|
|
188
|
+
strokeLinejoin: "round",
|
|
189
|
+
...props
|
|
190
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
191
|
+
stroke: "none",
|
|
192
|
+
d: "M0 0h24v24H0z",
|
|
193
|
+
fill: "none"
|
|
194
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
195
|
+
d: "M14 3v4a1 1 0 0 0 1 1h4"
|
|
196
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
197
|
+
d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2"
|
|
198
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
199
|
+
d: "M12 10l0 4"
|
|
200
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
201
|
+
d: "M10 12l4 0"
|
|
202
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
203
|
+
d: "M10 17l4 0"
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
export function Send(props) {
|
|
207
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
208
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
209
|
+
viewBox: "0 0 24 24",
|
|
210
|
+
fill: "none",
|
|
211
|
+
stroke: "currentColor",
|
|
212
|
+
strokeWidth: 2,
|
|
213
|
+
strokeLinecap: "round",
|
|
214
|
+
strokeLinejoin: "round",
|
|
215
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-send",
|
|
216
|
+
...props
|
|
217
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
218
|
+
stroke: "none",
|
|
219
|
+
d: "M0 0h24v24H0z",
|
|
220
|
+
fill: "none"
|
|
221
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
222
|
+
d: "M10 14l11 -11"
|
|
223
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
224
|
+
d: "M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5"
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
export function Apply(props) {
|
|
228
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
229
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
230
|
+
viewBox: "0 0 24 24",
|
|
231
|
+
fill: "none",
|
|
232
|
+
stroke: "currentColor",
|
|
233
|
+
strokeWidth: 2,
|
|
234
|
+
strokeLinecap: "round",
|
|
235
|
+
strokeLinejoin: "round",
|
|
236
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-check",
|
|
237
|
+
...props
|
|
238
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
239
|
+
stroke: "none",
|
|
240
|
+
d: "M0 0h24v24H0z",
|
|
241
|
+
fill: "none"
|
|
242
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
243
|
+
d: "M5 12l5 5l10 -10"
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
export function Reject(props) {
|
|
247
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
248
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
249
|
+
viewBox: "0 0 24 24",
|
|
250
|
+
fill: "none",
|
|
251
|
+
stroke: "currentColor",
|
|
252
|
+
strokeWidth: 2,
|
|
253
|
+
strokeLinecap: "round",
|
|
254
|
+
strokeLinejoin: "round",
|
|
255
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-x",
|
|
256
|
+
...props
|
|
257
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
258
|
+
stroke: "none",
|
|
259
|
+
d: "M0 0h24v24H0z",
|
|
260
|
+
fill: "none"
|
|
261
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
262
|
+
d: "M18 6l-12 12"
|
|
263
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
264
|
+
d: "M6 6l12 12"
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AIActionProposal } from "./AIActionProposalList.js";
|
|
2
|
+
export type AppliedChange = {
|
|
3
|
+
action?: AIActionProposal["action"] | null;
|
|
4
|
+
additions: number;
|
|
5
|
+
after?: unknown;
|
|
6
|
+
before?: unknown;
|
|
7
|
+
collection?: string | null;
|
|
8
|
+
documentID?: string | null;
|
|
9
|
+
removals: number;
|
|
10
|
+
slug?: string | null;
|
|
11
|
+
title: string;
|
|
12
|
+
url?: string | null;
|
|
13
|
+
};
|
|
14
|
+
type RecentChangesListProps = {
|
|
15
|
+
changes: AppliedChange[];
|
|
16
|
+
};
|
|
17
|
+
export declare const RecentChangesList: ({ changes }: RecentChangesListProps) => import("react").JSX.Element;
|
|
18
|
+
export {};
|