@uipath/apollo-react 6.75.0 → 6.76.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/dist/canvas/components/AgentCanvas/nodes/AgentNode.cjs +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/AgentNode.d.ts.map +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/AgentNode.js +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/ResourceNode.cjs +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/ResourceNode.d.ts.map +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/ResourceNode.js +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.cjs +2 -1
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +2 -1
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts +2 -0
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts +1 -1
- package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts.map +1 -1
- package/dist/canvas/components/CanvasDiffView/ApolloCanvasDiffPane.cjs +188 -0
- package/dist/canvas/components/CanvasDiffView/ApolloCanvasDiffPane.d.ts +18 -0
- package/dist/canvas/components/CanvasDiffView/ApolloCanvasDiffPane.d.ts.map +1 -0
- package/dist/canvas/components/CanvasDiffView/ApolloCanvasDiffPane.js +154 -0
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.cjs +470 -0
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.d.ts +3 -0
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.d.ts.map +1 -0
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.js +436 -0
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.types.cjs +18 -0
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.types.d.ts +76 -0
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.types.d.ts.map +1 -0
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.types.js +0 -0
- package/dist/canvas/components/CanvasDiffView/CodeDiffView.cjs +220 -0
- package/dist/canvas/components/CanvasDiffView/CodeDiffView.d.ts +7 -0
- package/dist/canvas/components/CanvasDiffView/CodeDiffView.d.ts.map +1 -0
- package/dist/canvas/components/CanvasDiffView/CodeDiffView.js +186 -0
- package/dist/canvas/components/CanvasDiffView/applyDiffHighlight.cjs +57 -0
- package/dist/canvas/components/CanvasDiffView/applyDiffHighlight.d.ts +7 -0
- package/dist/canvas/components/CanvasDiffView/applyDiffHighlight.d.ts.map +1 -0
- package/dist/canvas/components/CanvasDiffView/applyDiffHighlight.js +23 -0
- package/dist/canvas/components/CanvasDiffView/diffById.cjs +110 -0
- package/dist/canvas/components/CanvasDiffView/diffById.d.ts +15 -0
- package/dist/canvas/components/CanvasDiffView/diffById.d.ts.map +1 -0
- package/dist/canvas/components/CanvasDiffView/diffById.js +76 -0
- package/dist/canvas/components/CanvasDiffView/index.cjs +93 -0
- package/dist/canvas/components/CanvasDiffView/index.d.ts +7 -0
- package/dist/canvas/components/CanvasDiffView/index.d.ts.map +1 -0
- package/dist/canvas/components/CanvasDiffView/index.js +6 -0
- package/dist/canvas/components/CanvasDiffView/lineDiff.cjs +116 -0
- package/dist/canvas/components/CanvasDiffView/lineDiff.d.ts +7 -0
- package/dist/canvas/components/CanvasDiffView/lineDiff.d.ts.map +1 -0
- package/dist/canvas/components/CanvasDiffView/lineDiff.js +79 -0
- package/dist/canvas/components/Edges/CanvasEdge.cjs +5 -1
- package/dist/canvas/components/Edges/CanvasEdge.d.ts.map +1 -1
- package/dist/canvas/components/Edges/CanvasEdge.js +5 -1
- package/dist/canvas/components/Edges/shared/constants.cjs +1 -0
- package/dist/canvas/components/Edges/shared/constants.d.ts +1 -0
- package/dist/canvas/components/Edges/shared/constants.d.ts.map +1 -1
- package/dist/canvas/components/Edges/shared/constants.js +1 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.cjs +4 -1
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.d.ts +2 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.d.ts.map +1 -1
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.js +4 -1
- package/dist/canvas/components/Edges/shared/types.d.ts +2 -0
- package/dist/canvas/components/Edges/shared/types.d.ts.map +1 -1
- package/dist/canvas/components/index.cjs +69 -62
- package/dist/canvas/components/index.d.ts +1 -0
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +1 -0
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
CanvasDiffView: ()=>CanvasDiffView
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const index_cjs_namespaceObject = require("../../../i18n/index.cjs");
|
|
34
|
+
const KIND_DOT_CLASS = {
|
|
35
|
+
added: 'bg-success',
|
|
36
|
+
removed: 'bg-error',
|
|
37
|
+
changed: 'bg-warning'
|
|
38
|
+
};
|
|
39
|
+
const noopViewportChange = ()=>{};
|
|
40
|
+
function viewportsEqual(a, b) {
|
|
41
|
+
return !!a && a.x === b.x && a.y === b.y && a.zoom === b.zoom;
|
|
42
|
+
}
|
|
43
|
+
function highlightForSide(highlight, side) {
|
|
44
|
+
const hidden = 'before' === side ? 'added' : 'removed';
|
|
45
|
+
const keep = (kinds)=>new Map([
|
|
46
|
+
...kinds
|
|
47
|
+
].filter(([, kind])=>kind !== hidden));
|
|
48
|
+
return {
|
|
49
|
+
nodeKind: keep(highlight.nodeKind),
|
|
50
|
+
edgeKind: keep(highlight.edgeKind)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function useSummaryItems(summary) {
|
|
54
|
+
const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
|
|
55
|
+
return (0, external_react_namespaceObject.useMemo)(()=>{
|
|
56
|
+
const items = [
|
|
57
|
+
{
|
|
58
|
+
key: 'addedNodes',
|
|
59
|
+
kind: 'added',
|
|
60
|
+
label: _({
|
|
61
|
+
id: 'canvas.diff_view.added_nodes',
|
|
62
|
+
message: '{count, plural, one {# node added} other {# nodes added}}',
|
|
63
|
+
values: {
|
|
64
|
+
count: summary.addedNodes
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
key: 'removedNodes',
|
|
70
|
+
kind: 'removed',
|
|
71
|
+
label: _({
|
|
72
|
+
id: 'canvas.diff_view.removed_nodes',
|
|
73
|
+
message: '{count, plural, one {# node removed} other {# nodes removed}}',
|
|
74
|
+
values: {
|
|
75
|
+
count: summary.removedNodes
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: 'changedNodes',
|
|
81
|
+
kind: 'changed',
|
|
82
|
+
label: _({
|
|
83
|
+
id: 'canvas.diff_view.changed_nodes',
|
|
84
|
+
message: '{count, plural, one {# node changed} other {# nodes changed}}',
|
|
85
|
+
values: {
|
|
86
|
+
count: summary.changedNodes
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: 'addedEdges',
|
|
92
|
+
kind: 'added',
|
|
93
|
+
label: _({
|
|
94
|
+
id: 'canvas.diff_view.added_edges',
|
|
95
|
+
message: '{count, plural, one {# connection added} other {# connections added}}',
|
|
96
|
+
values: {
|
|
97
|
+
count: summary.addedEdges
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: 'removedEdges',
|
|
103
|
+
kind: 'removed',
|
|
104
|
+
label: _({
|
|
105
|
+
id: 'canvas.diff_view.removed_edges',
|
|
106
|
+
message: '{count, plural, one {# connection removed} other {# connections removed}}',
|
|
107
|
+
values: {
|
|
108
|
+
count: summary.removedEdges
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
key: 'changedEdges',
|
|
114
|
+
kind: 'changed',
|
|
115
|
+
label: _({
|
|
116
|
+
id: 'canvas.diff_view.changed_edges',
|
|
117
|
+
message: '{count, plural, one {# connection changed} other {# connections changed}}',
|
|
118
|
+
values: {
|
|
119
|
+
count: summary.changedEdges
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
|
+
return items.filter((item)=>summary[item.key] > 0);
|
|
125
|
+
}, [
|
|
126
|
+
_,
|
|
127
|
+
summary
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
function formatList(items, locale) {
|
|
131
|
+
try {
|
|
132
|
+
return new Intl.ListFormat(locale, {
|
|
133
|
+
style: 'long',
|
|
134
|
+
type: 'conjunction'
|
|
135
|
+
}).format(items);
|
|
136
|
+
} catch {
|
|
137
|
+
return items.join(', ');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function SummaryRow({ label, showLabel, summary, phaseId }) {
|
|
141
|
+
const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
|
|
142
|
+
const items = useSummaryItems(summary);
|
|
143
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
144
|
+
"data-change-phase": phaseId,
|
|
145
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-1",
|
|
146
|
+
children: [
|
|
147
|
+
showLabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
148
|
+
className: "font-medium text-foreground",
|
|
149
|
+
children: label
|
|
150
|
+
}),
|
|
151
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("ul", {
|
|
152
|
+
"aria-label": label,
|
|
153
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-1",
|
|
154
|
+
children: 0 === items.length ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("li", {
|
|
155
|
+
children: _({
|
|
156
|
+
id: 'canvas.diff_view.no_changes',
|
|
157
|
+
message: 'No changes'
|
|
158
|
+
})
|
|
159
|
+
}) : items.map((item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("li", {
|
|
160
|
+
"data-change-kind": item.kind,
|
|
161
|
+
className: "inline-flex items-center gap-1.5",
|
|
162
|
+
children: [
|
|
163
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
164
|
+
"aria-hidden": "true",
|
|
165
|
+
className: (0, apollo_wind_namespaceObject.cn)('inline-block size-2 rounded-full', KIND_DOT_CLASS[item.kind])
|
|
166
|
+
}),
|
|
167
|
+
item.label
|
|
168
|
+
]
|
|
169
|
+
}, item.key))
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function DiffPane({ ctx, label, renderPane, panelSlot }) {
|
|
175
|
+
const panel = panelSlot?.(ctx);
|
|
176
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("section", {
|
|
177
|
+
"aria-label": label,
|
|
178
|
+
"data-diff-side": ctx.side,
|
|
179
|
+
className: "relative flex h-full min-h-0 w-full",
|
|
180
|
+
children: [
|
|
181
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
182
|
+
className: "relative h-full min-w-0 flex-1",
|
|
183
|
+
children: [
|
|
184
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
185
|
+
className: "pointer-events-none absolute left-3 top-2 z-10 rounded bg-surface-raised px-1.5 py-0.5 text-[11px] font-medium uppercase tracking-wide text-foreground-muted",
|
|
186
|
+
children: label
|
|
187
|
+
}),
|
|
188
|
+
renderPane(ctx)
|
|
189
|
+
]
|
|
190
|
+
}),
|
|
191
|
+
null != panel && false !== panel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
192
|
+
className: "h-full shrink-0 overflow-auto border-l border-border-subtle",
|
|
193
|
+
children: panel
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function useReviewState(model) {
|
|
199
|
+
const [review, setReview] = (0, external_react_namespaceObject.useState)({
|
|
200
|
+
model,
|
|
201
|
+
key: 0
|
|
202
|
+
});
|
|
203
|
+
const [selectedNodeId, setSelectedNodeId] = (0, external_react_namespaceObject.useState)();
|
|
204
|
+
const [viewport, setViewport] = (0, external_react_namespaceObject.useState)();
|
|
205
|
+
if (review.model !== model) {
|
|
206
|
+
setReview({
|
|
207
|
+
model,
|
|
208
|
+
key: review.key + 1
|
|
209
|
+
});
|
|
210
|
+
setSelectedNodeId(void 0);
|
|
211
|
+
setViewport(void 0);
|
|
212
|
+
}
|
|
213
|
+
const onViewportChange = (0, external_react_namespaceObject.useCallback)((next)=>{
|
|
214
|
+
setViewport((prev)=>viewportsEqual(prev, next) ? prev : next);
|
|
215
|
+
}, []);
|
|
216
|
+
return {
|
|
217
|
+
reviewKey: review.key,
|
|
218
|
+
selectedNodeId,
|
|
219
|
+
setSelectedNodeId,
|
|
220
|
+
viewport,
|
|
221
|
+
onViewportChange
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function CanvasDiffView({ model, renderPane, panelSlot, codeView, headerActions, title, headingLevel = 2, onKeep, onRevert, keepLabel, revertLabel, showBefore = true, orientation: orientationProp, onOrientationChange, selection, syncViewport = true, className }) {
|
|
225
|
+
const { _, locale } = (0, index_cjs_namespaceObject.useSafeLingui)();
|
|
226
|
+
const [internalOrientation, setInternalOrientation] = (0, external_react_namespaceObject.useState)('vertical');
|
|
227
|
+
const orientation = orientationProp ?? internalOrientation;
|
|
228
|
+
const toggleOrientation = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
229
|
+
const next = 'vertical' === orientation ? 'horizontal' : 'vertical';
|
|
230
|
+
if (void 0 === orientationProp) setInternalOrientation(next);
|
|
231
|
+
onOrientationChange?.(next);
|
|
232
|
+
}, [
|
|
233
|
+
orientation,
|
|
234
|
+
orientationProp,
|
|
235
|
+
onOrientationChange
|
|
236
|
+
]);
|
|
237
|
+
const review = useReviewState(model);
|
|
238
|
+
const selectedNodeId = selection ? selection.selectedNodeId : review.selectedNodeId;
|
|
239
|
+
const onSelectNode = selection?.onChange ?? review.setSelectedNodeId;
|
|
240
|
+
const viewport = syncViewport ? review.viewport : void 0;
|
|
241
|
+
const onViewportChange = syncViewport ? review.onViewportChange : noopViewportChange;
|
|
242
|
+
const [view, setView] = (0, external_react_namespaceObject.useState)('visual');
|
|
243
|
+
const showCode = void 0 !== codeView && 'code' === view;
|
|
244
|
+
const overallItems = useSummaryItems(model.summary);
|
|
245
|
+
const announcement = overallItems.length > 0 ? formatList(overallItems.map((item)=>item.label), locale) : _({
|
|
246
|
+
id: 'canvas.diff_view.no_changes',
|
|
247
|
+
message: 'No changes'
|
|
248
|
+
});
|
|
249
|
+
const projections = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
250
|
+
const project = (side)=>({
|
|
251
|
+
highlight: highlightForSide(model.highlight, side),
|
|
252
|
+
changePhases: model.changePhases?.map((phase)=>({
|
|
253
|
+
...phase,
|
|
254
|
+
highlight: highlightForSide(phase.highlight, side)
|
|
255
|
+
}))
|
|
256
|
+
});
|
|
257
|
+
return {
|
|
258
|
+
before: project('before'),
|
|
259
|
+
after: project('after')
|
|
260
|
+
};
|
|
261
|
+
}, [
|
|
262
|
+
model
|
|
263
|
+
]);
|
|
264
|
+
const fitLeader = 0 === model.after.nodes.length && model.before.nodes.length > 0 ? 'before' : 'after';
|
|
265
|
+
const buildContext = (0, external_react_namespaceObject.useCallback)((side)=>({
|
|
266
|
+
side,
|
|
267
|
+
nodes: model[side].nodes,
|
|
268
|
+
edges: model[side].edges,
|
|
269
|
+
data: model[side].data,
|
|
270
|
+
highlight: projections[side].highlight,
|
|
271
|
+
changePhases: projections[side].changePhases,
|
|
272
|
+
selectedNodeId,
|
|
273
|
+
onSelectNode,
|
|
274
|
+
viewport,
|
|
275
|
+
onViewportChange,
|
|
276
|
+
fitViewOnMount: void 0 === viewport && (side === fitLeader || !syncViewport)
|
|
277
|
+
}), [
|
|
278
|
+
model,
|
|
279
|
+
projections,
|
|
280
|
+
selectedNodeId,
|
|
281
|
+
onSelectNode,
|
|
282
|
+
viewport,
|
|
283
|
+
onViewportChange,
|
|
284
|
+
syncViewport,
|
|
285
|
+
fitLeader
|
|
286
|
+
]);
|
|
287
|
+
const beforeContext = (0, external_react_namespaceObject.useMemo)(()=>buildContext('before'), [
|
|
288
|
+
buildContext
|
|
289
|
+
]);
|
|
290
|
+
const afterContext = (0, external_react_namespaceObject.useMemo)(()=>buildContext('after'), [
|
|
291
|
+
buildContext
|
|
292
|
+
]);
|
|
293
|
+
const beforeLabel = _({
|
|
294
|
+
id: 'canvas.diff_view.before_label',
|
|
295
|
+
message: 'Before'
|
|
296
|
+
});
|
|
297
|
+
const afterLabel = _({
|
|
298
|
+
id: 'canvas.diff_view.after_label',
|
|
299
|
+
message: 'After'
|
|
300
|
+
});
|
|
301
|
+
const summaryLabel = _({
|
|
302
|
+
id: 'canvas.diff_view.summary_label',
|
|
303
|
+
message: 'Change summary'
|
|
304
|
+
});
|
|
305
|
+
const orientationLabel = 'vertical' === orientation ? _({
|
|
306
|
+
id: 'canvas.diff_view.show_side_by_side',
|
|
307
|
+
message: 'Show side by side'
|
|
308
|
+
}) : _({
|
|
309
|
+
id: 'canvas.diff_view.show_stacked',
|
|
310
|
+
message: 'Show stacked'
|
|
311
|
+
});
|
|
312
|
+
const visualViewLabel = _({
|
|
313
|
+
id: 'canvas.diff_view.visual_view',
|
|
314
|
+
message: 'Visual diff'
|
|
315
|
+
});
|
|
316
|
+
const codeViewLabel = _({
|
|
317
|
+
id: 'canvas.diff_view.code_view',
|
|
318
|
+
message: 'Code diff'
|
|
319
|
+
});
|
|
320
|
+
const Heading = `h${headingLevel}`;
|
|
321
|
+
let body;
|
|
322
|
+
body = showCode ? codeView : showBefore ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.ResizablePanelGroup, {
|
|
323
|
+
orientation: orientation,
|
|
324
|
+
children: [
|
|
325
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ResizablePanel, {
|
|
326
|
+
id: "canvas-diff-before",
|
|
327
|
+
defaultSize: "50%",
|
|
328
|
+
minSize: "20%",
|
|
329
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DiffPane, {
|
|
330
|
+
ctx: beforeContext,
|
|
331
|
+
label: beforeLabel,
|
|
332
|
+
renderPane: renderPane,
|
|
333
|
+
panelSlot: panelSlot
|
|
334
|
+
})
|
|
335
|
+
}),
|
|
336
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ResizableHandle, {
|
|
337
|
+
withHandle: true
|
|
338
|
+
}),
|
|
339
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ResizablePanel, {
|
|
340
|
+
id: "canvas-diff-after",
|
|
341
|
+
defaultSize: "50%",
|
|
342
|
+
minSize: "20%",
|
|
343
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DiffPane, {
|
|
344
|
+
ctx: afterContext,
|
|
345
|
+
label: afterLabel,
|
|
346
|
+
renderPane: renderPane,
|
|
347
|
+
panelSlot: panelSlot
|
|
348
|
+
})
|
|
349
|
+
})
|
|
350
|
+
]
|
|
351
|
+
}, review.reviewKey) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DiffPane, {
|
|
352
|
+
ctx: afterContext,
|
|
353
|
+
label: afterLabel,
|
|
354
|
+
renderPane: renderPane,
|
|
355
|
+
panelSlot: panelSlot
|
|
356
|
+
}, review.reviewKey);
|
|
357
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
358
|
+
"data-testid": "canvas-diff-view",
|
|
359
|
+
"data-orientation": orientation,
|
|
360
|
+
className: (0, apollo_wind_namespaceObject.cn)('flex h-full w-full flex-col bg-surface text-foreground', className),
|
|
361
|
+
children: [
|
|
362
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("header", {
|
|
363
|
+
className: "flex shrink-0 flex-wrap items-center justify-between gap-3 border-b border-border-subtle px-4 py-2",
|
|
364
|
+
children: [
|
|
365
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
366
|
+
className: "flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1",
|
|
367
|
+
children: [
|
|
368
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Heading, {
|
|
369
|
+
className: "shrink-0 text-sm font-semibold",
|
|
370
|
+
children: title ?? _({
|
|
371
|
+
id: 'canvas.diff_view.title',
|
|
372
|
+
message: 'Proposed changes'
|
|
373
|
+
})
|
|
374
|
+
}),
|
|
375
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
376
|
+
className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-foreground-muted",
|
|
377
|
+
children: model.changePhases && model.changePhases.length > 0 ? model.changePhases.map((phase)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SummaryRow, {
|
|
378
|
+
phaseId: phase.id,
|
|
379
|
+
label: phase.label,
|
|
380
|
+
showLabel: true,
|
|
381
|
+
summary: phase.summary
|
|
382
|
+
}, phase.id)) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SummaryRow, {
|
|
383
|
+
label: summaryLabel,
|
|
384
|
+
summary: model.summary
|
|
385
|
+
})
|
|
386
|
+
})
|
|
387
|
+
]
|
|
388
|
+
}),
|
|
389
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
390
|
+
className: "flex shrink-0 items-center gap-2",
|
|
391
|
+
children: [
|
|
392
|
+
void 0 !== codeView && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.ToggleGroup, {
|
|
393
|
+
type: "single",
|
|
394
|
+
size: "sm",
|
|
395
|
+
variant: "outline",
|
|
396
|
+
value: view,
|
|
397
|
+
onValueChange: (next)=>next && setView(next),
|
|
398
|
+
"aria-label": _({
|
|
399
|
+
id: 'canvas.diff_view.view_toggle',
|
|
400
|
+
message: 'Diff view'
|
|
401
|
+
}),
|
|
402
|
+
children: [
|
|
403
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ToggleGroupItem, {
|
|
404
|
+
value: "visual",
|
|
405
|
+
"aria-label": visualViewLabel,
|
|
406
|
+
title: visualViewLabel,
|
|
407
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Workflow, {
|
|
408
|
+
className: "size-4"
|
|
409
|
+
})
|
|
410
|
+
}),
|
|
411
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ToggleGroupItem, {
|
|
412
|
+
value: "code",
|
|
413
|
+
"aria-label": codeViewLabel,
|
|
414
|
+
title: codeViewLabel,
|
|
415
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Code2, {
|
|
416
|
+
className: "size-4"
|
|
417
|
+
})
|
|
418
|
+
})
|
|
419
|
+
]
|
|
420
|
+
}),
|
|
421
|
+
showBefore && !showCode && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
422
|
+
variant: "ghost",
|
|
423
|
+
size: "xs",
|
|
424
|
+
icon: true,
|
|
425
|
+
onClick: toggleOrientation,
|
|
426
|
+
"aria-label": orientationLabel,
|
|
427
|
+
title: orientationLabel,
|
|
428
|
+
children: 'vertical' === orientation ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Columns2, {}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Rows2, {})
|
|
429
|
+
}),
|
|
430
|
+
headerActions,
|
|
431
|
+
onRevert && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
432
|
+
variant: "outline",
|
|
433
|
+
size: "xs",
|
|
434
|
+
onClick: onRevert,
|
|
435
|
+
children: revertLabel ?? _({
|
|
436
|
+
id: 'canvas.diff_view.revert',
|
|
437
|
+
message: 'Revert'
|
|
438
|
+
})
|
|
439
|
+
}),
|
|
440
|
+
onKeep && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
441
|
+
size: "xs",
|
|
442
|
+
onClick: onKeep,
|
|
443
|
+
children: keepLabel ?? _({
|
|
444
|
+
id: 'canvas.diff_view.keep',
|
|
445
|
+
message: 'Keep'
|
|
446
|
+
})
|
|
447
|
+
})
|
|
448
|
+
]
|
|
449
|
+
})
|
|
450
|
+
]
|
|
451
|
+
}),
|
|
452
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("output", {
|
|
453
|
+
"aria-live": "polite",
|
|
454
|
+
className: "sr-only",
|
|
455
|
+
children: announcement
|
|
456
|
+
}),
|
|
457
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
458
|
+
className: "relative min-h-0 flex-1",
|
|
459
|
+
children: body
|
|
460
|
+
})
|
|
461
|
+
]
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
exports.CanvasDiffView = __webpack_exports__.CanvasDiffView;
|
|
465
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
466
|
+
"CanvasDiffView"
|
|
467
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
468
|
+
Object.defineProperty(exports, '__esModule', {
|
|
469
|
+
value: true
|
|
470
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CanvasDiffViewProps } from './CanvasDiffView.types';
|
|
2
|
+
export declare function CanvasDiffView<Node, Edge>({ model, renderPane, panelSlot, codeView, headerActions, title, headingLevel, onKeep, onRevert, keepLabel, revertLabel, showBefore, orientation: orientationProp, onOrientationChange, selection, syncViewport, className, }: CanvasDiffViewProps<Node, Edge>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=CanvasDiffView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanvasDiffView.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/CanvasDiffView/CanvasDiffView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEV,mBAAmB,EAQpB,MAAM,wBAAwB,CAAC;AAkMhC,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,EACzC,KAAK,EACL,UAAU,EACV,SAAS,EACT,QAAQ,EACR,aAAa,EACb,KAAK,EACL,YAAgB,EAChB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,UAAiB,EACjB,WAAW,EAAE,eAAe,EAC5B,mBAAmB,EACnB,SAAS,EACT,YAAmB,EACnB,SAAS,GACV,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,2CAsMjC"}
|