@octaviaflow/core 3.0.13 → 3.0.17-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/dist/chunk-2AWVQFSC.js +2456 -0
- package/dist/chunk-2AWVQFSC.js.map +1 -0
- package/dist/chunk-2K7IQR2F.js +2432 -0
- package/dist/chunk-2K7IQR2F.js.map +1 -0
- package/dist/chunk-2YUWZPIT.js +2483 -0
- package/dist/chunk-2YUWZPIT.js.map +1 -0
- package/dist/chunk-4VCRGPYQ.js +2452 -0
- package/dist/chunk-4VCRGPYQ.js.map +1 -0
- package/dist/chunk-4WU5YAL2.js +2470 -0
- package/dist/chunk-4WU5YAL2.js.map +1 -0
- package/dist/chunk-5L4TGL74.js +2448 -0
- package/dist/chunk-5L4TGL74.js.map +1 -0
- package/dist/chunk-7M5HFY2J.js +2483 -0
- package/dist/chunk-7M5HFY2J.js.map +1 -0
- package/dist/chunk-AJ4556EH.js +2490 -0
- package/dist/chunk-AJ4556EH.js.map +1 -0
- package/dist/chunk-AOL365B3.js +2448 -0
- package/dist/chunk-AOL365B3.js.map +1 -0
- package/dist/chunk-D4X7RMGF.js +2481 -0
- package/dist/chunk-D4X7RMGF.js.map +1 -0
- package/dist/chunk-DCGXCPD4.js +2389 -0
- package/dist/chunk-DCGXCPD4.js.map +1 -0
- package/dist/chunk-DG35MIV3.js +2480 -0
- package/dist/chunk-DG35MIV3.js.map +1 -0
- package/dist/chunk-DRZ73Q5X.js +2503 -0
- package/dist/chunk-DRZ73Q5X.js.map +1 -0
- package/dist/chunk-DRZMET2G.js +2458 -0
- package/dist/chunk-DRZMET2G.js.map +1 -0
- package/dist/chunk-DYCW4TYB.js +2546 -0
- package/dist/chunk-DYCW4TYB.js.map +1 -0
- package/dist/chunk-E7WR7DMP.js +2451 -0
- package/dist/chunk-E7WR7DMP.js.map +1 -0
- package/dist/chunk-ELNQQAHD.js +2454 -0
- package/dist/chunk-ELNQQAHD.js.map +1 -0
- package/dist/chunk-FN3MFN6C.js +2389 -0
- package/dist/chunk-FN3MFN6C.js.map +1 -0
- package/dist/chunk-IBTEGHFT.js +10 -0
- package/dist/chunk-IBTEGHFT.js.map +1 -0
- package/dist/chunk-JCPM7YF2.js +2474 -0
- package/dist/chunk-JCPM7YF2.js.map +1 -0
- package/dist/chunk-JLPCCZKG.js +2459 -0
- package/dist/chunk-JLPCCZKG.js.map +1 -0
- package/dist/chunk-KY4JHPIE.js +2546 -0
- package/dist/chunk-KY4JHPIE.js.map +1 -0
- package/dist/chunk-LCQMQAWJ.js +2461 -0
- package/dist/chunk-LCQMQAWJ.js.map +1 -0
- package/dist/chunk-LSDAQCUJ.js +2546 -0
- package/dist/chunk-LSDAQCUJ.js.map +1 -0
- package/dist/chunk-LW4ZHQKL.js +2432 -0
- package/dist/chunk-LW4ZHQKL.js.map +1 -0
- package/dist/chunk-MMZW3Q26.js +2442 -0
- package/dist/chunk-MMZW3Q26.js.map +1 -0
- package/dist/chunk-MXJR2WHG.js +2470 -0
- package/dist/chunk-MXJR2WHG.js.map +1 -0
- package/dist/chunk-OK2CUIKQ.js +2447 -0
- package/dist/chunk-OK2CUIKQ.js.map +1 -0
- package/dist/chunk-OSOP2WPT.js +2456 -0
- package/dist/chunk-OSOP2WPT.js.map +1 -0
- package/dist/chunk-PNBZLLWT.js +2529 -0
- package/dist/chunk-PNBZLLWT.js.map +1 -0
- package/dist/chunk-PULX2GK5.js +2447 -0
- package/dist/chunk-PULX2GK5.js.map +1 -0
- package/dist/chunk-QDT45KF4.js +2480 -0
- package/dist/chunk-QDT45KF4.js.map +1 -0
- package/dist/chunk-QI3ITHAZ.js +2450 -0
- package/dist/chunk-QI3ITHAZ.js.map +1 -0
- package/dist/chunk-QSGJ3DNA.js +2475 -0
- package/dist/chunk-QSGJ3DNA.js.map +1 -0
- package/dist/chunk-RDGJWRHM.js +2490 -0
- package/dist/chunk-RDGJWRHM.js.map +1 -0
- package/dist/chunk-SDE3ARKY.js +2451 -0
- package/dist/chunk-SDE3ARKY.js.map +1 -0
- package/dist/chunk-SX7WRJGD.js +2441 -0
- package/dist/chunk-SX7WRJGD.js.map +1 -0
- package/dist/chunk-TZ56MSYM.js +2452 -0
- package/dist/chunk-TZ56MSYM.js.map +1 -0
- package/dist/chunk-UEQLKS2B.js +2445 -0
- package/dist/chunk-UEQLKS2B.js.map +1 -0
- package/dist/chunk-UNU6YNTL.js +2452 -0
- package/dist/chunk-UNU6YNTL.js.map +1 -0
- package/dist/chunk-UUG6XYUC.js +2482 -0
- package/dist/chunk-UUG6XYUC.js.map +1 -0
- package/dist/chunk-VEY3BP5E.js +2447 -0
- package/dist/chunk-VEY3BP5E.js.map +1 -0
- package/dist/chunk-WBTXV3Q2.js +2482 -0
- package/dist/chunk-WBTXV3Q2.js.map +1 -0
- package/dist/chunk-WILVB7XA.js +2512 -0
- package/dist/chunk-WILVB7XA.js.map +1 -0
- package/dist/chunk-WQCHABP3.js +2441 -0
- package/dist/chunk-WQCHABP3.js.map +1 -0
- package/dist/chunk-WUFAW3TB.js +2512 -0
- package/dist/chunk-WUFAW3TB.js.map +1 -0
- package/dist/chunk-WYBJKALZ.js +2458 -0
- package/dist/chunk-WYBJKALZ.js.map +1 -0
- package/dist/chunk-XZ7FELMT.js +2448 -0
- package/dist/chunk-XZ7FELMT.js.map +1 -0
- package/dist/chunk-YATCRJVF.js +2458 -0
- package/dist/chunk-YATCRJVF.js.map +1 -0
- package/dist/chunk-YSSD2T4M.js +2451 -0
- package/dist/chunk-YSSD2T4M.js.map +1 -0
- package/dist/chunk-YW6ZOYCG.js +2451 -0
- package/dist/chunk-YW6ZOYCG.js.map +1 -0
- package/dist/components/ActionsDrawer/ActionsDrawer.d.ts +89 -0
- package/dist/components/ActionsDrawer/ActionsDrawer.d.ts.map +1 -0
- package/dist/components/ActionsDrawer/index.d.ts +2 -0
- package/dist/components/ActionsDrawer/index.d.ts.map +1 -0
- package/dist/components/AgentCard/AgentCard.d.ts +1 -1
- package/dist/components/AgentCard/AgentCard.d.ts.map +1 -1
- package/dist/components/AuthCard/AuthCard.d.ts.map +1 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/components/CodeEditor/index.d.ts +1 -1
- package/dist/components/CodeEditor/index.d.ts.map +1 -1
- package/dist/components/DataMapper/DataMapper.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/index.d.ts +1 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/ExecutionConsole/ExecutionConsole.d.ts +29 -3
- package/dist/components/ExecutionConsole/ExecutionConsole.d.ts.map +1 -1
- package/dist/components/FileDropzone/FileDropzone.d.ts.map +1 -1
- package/dist/components/FlowEdge/FlowEdge.d.ts +15 -14
- package/dist/components/FlowEdge/FlowEdge.d.ts.map +1 -1
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/MonacoEditor/MonacoDiffEditor.d.ts.map +1 -1
- package/dist/components/MonacoEditor/MonacoEditor.d.ts.map +1 -1
- package/dist/components/MonacoEditor/index.d.ts +1 -1
- package/dist/components/MonacoEditor/index.d.ts.map +1 -1
- package/dist/components/PromptInput/PromptInput.d.ts.map +1 -1
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Resizable/Resizable.d.ts.map +1 -1
- package/dist/components/Resizable/index.d.ts +1 -1
- package/dist/components/Resizable/index.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +16 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Sortable/Sortable.d.ts.map +1 -1
- package/dist/components/Sortable/index.d.ts +1 -1
- package/dist/components/Sortable/index.d.ts.map +1 -1
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/ToolCard/ToolCard.d.ts +1 -1
- package/dist/components/ToolCard/ToolCard.d.ts.map +1 -1
- package/dist/components/TopBar/TopBar.d.ts +22 -1
- package/dist/components/TopBar/TopBar.d.ts.map +1 -1
- package/dist/components/TraceStep/TraceStep.d.ts.map +1 -1
- package/dist/components/TraceStep/index.d.ts +1 -1
- package/dist/components/TraceStep/index.d.ts.map +1 -1
- package/dist/components/WorkflowEditor/WorkflowEditor.d.ts +10 -2
- package/dist/components/WorkflowEditor/WorkflowEditor.d.ts.map +1 -1
- package/dist/components/XmlViewer/XmlViewer.d.ts.map +1 -1
- package/dist/components/YamlViewer/YamlViewer.d.ts.map +1 -1
- package/dist/index.cjs +6875 -3288
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3296 -2147
- package/dist/index.js.map +1 -1
- package/dist/monaco.cjs +344 -201
- package/dist/monaco.cjs.map +1 -1
- package/dist/monaco.js +348 -205
- package/dist/monaco.js.map +1 -1
- package/dist/stories/state-matrix.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/a11y.d.ts.map +1 -1
- package/dist/utils/sanitizeUrl.d.ts.map +1 -1
- package/dist/workflow/components/ConfigPanel/ConfigPanel.d.ts +64 -0
- package/dist/workflow/components/ConfigPanel/ConfigPanel.d.ts.map +1 -0
- package/dist/workflow/components/FlowCanvas/FlowCanvas.d.ts +111 -0
- package/dist/workflow/components/FlowCanvas/FlowCanvas.d.ts.map +1 -0
- package/dist/workflow/components/FlowCanvas/FlowCanvasContext.d.ts +47 -0
- package/dist/workflow/components/FlowCanvas/FlowCanvasContext.d.ts.map +1 -0
- package/dist/workflow/components/FlowEdge/FlowEdge.d.ts +26 -0
- package/dist/workflow/components/FlowEdge/FlowEdge.d.ts.map +1 -0
- package/dist/workflow/components/FlowNode/FlowNode.d.ts +13 -0
- package/dist/workflow/components/FlowNode/FlowNode.d.ts.map +1 -0
- package/dist/workflow/components/FlowNode/FlowNodeContext.d.ts +9 -0
- package/dist/workflow/components/FlowNode/FlowNodeContext.d.ts.map +1 -0
- package/dist/workflow/components/FlowNode/nodeKinds.d.ts +25 -0
- package/dist/workflow/components/FlowNode/nodeKinds.d.ts.map +1 -0
- package/dist/workflow/components/Handle/Handle.d.ts +26 -0
- package/dist/workflow/components/Handle/Handle.d.ts.map +1 -0
- package/dist/workflow/components/Handle/handleRegistry.d.ts +32 -0
- package/dist/workflow/components/Handle/handleRegistry.d.ts.map +1 -0
- package/dist/workflow/components/NodeResizer/NodeResizer.d.ts +27 -0
- package/dist/workflow/components/NodeResizer/NodeResizer.d.ts.map +1 -0
- package/dist/workflow/components/NodeToolbar/NodeToolbar.d.ts +19 -0
- package/dist/workflow/components/NodeToolbar/NodeToolbar.d.ts.map +1 -0
- package/dist/workflow/components/kinds/BaseNode.d.ts +40 -0
- package/dist/workflow/components/kinds/BaseNode.d.ts.map +1 -0
- package/dist/workflow/components/kinds/index.d.ts +55 -0
- package/dist/workflow/components/kinds/index.d.ts.map +1 -0
- package/dist/workflow/editor.d.ts +181 -0
- package/dist/workflow/editor.d.ts.map +1 -0
- package/dist/workflow/hooks/useAutoLayout.d.ts +35 -0
- package/dist/workflow/hooks/useAutoLayout.d.ts.map +1 -0
- package/dist/workflow/hooks/useFlow.d.ts +61 -0
- package/dist/workflow/hooks/useFlow.d.ts.map +1 -0
- package/dist/workflow/hooks/useFlowState.d.ts +33 -0
- package/dist/workflow/hooks/useFlowState.d.ts.map +1 -0
- package/dist/workflow/index.d.ts +25 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/layout/dagre.d.ts +24 -0
- package/dist/workflow/layout/dagre.d.ts.map +1 -0
- package/dist/workflow/layout/elk.d.ts +22 -0
- package/dist/workflow/layout/elk.d.ts.map +1 -0
- package/dist/workflow/layout/types.d.ts +55 -0
- package/dist/workflow/layout/types.d.ts.map +1 -0
- package/dist/workflow/store/changes.d.ts +34 -0
- package/dist/workflow/store/changes.d.ts.map +1 -0
- package/dist/workflow/store/context.d.ts +4 -0
- package/dist/workflow/store/context.d.ts.map +1 -0
- package/dist/workflow/store/createFlowStore.d.ts +27 -0
- package/dist/workflow/store/createFlowStore.d.ts.map +1 -0
- package/dist/workflow/store/selectors.d.ts +33 -0
- package/dist/workflow/store/selectors.d.ts.map +1 -0
- package/dist/workflow/types/index.d.ts +181 -0
- package/dist/workflow/types/index.d.ts.map +1 -0
- package/dist/workflow/utils/collapse.d.ts +26 -0
- package/dist/workflow/utils/collapse.d.ts.map +1 -0
- package/dist/workflow/utils/collision.d.ts +37 -0
- package/dist/workflow/utils/collision.d.ts.map +1 -0
- package/dist/workflow/utils/geometry.d.ts +46 -0
- package/dist/workflow/utils/geometry.d.ts.map +1 -0
- package/dist/workflow/utils/parenting.d.ts +28 -0
- package/dist/workflow/utils/parenting.d.ts.map +1 -0
- package/dist/workflow/utils/paths.d.ts +19 -0
- package/dist/workflow/utils/paths.d.ts.map +1 -0
- package/dist/workflow.cjs +3562 -0
- package/dist/workflow.cjs.map +1 -0
- package/dist/workflow.js +1029 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +6 -1
package/dist/monaco.cjs
CHANGED
|
@@ -37,7 +37,7 @@ __export(monaco_exports, {
|
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(monaco_exports);
|
|
39
39
|
|
|
40
|
-
// src/components/MonacoEditor/
|
|
40
|
+
// src/components/MonacoEditor/MonacoDiffEditor.tsx
|
|
41
41
|
var import_react = require("react");
|
|
42
42
|
|
|
43
43
|
// src/utils/cn.ts
|
|
@@ -130,16 +130,199 @@ var OCTAVIAFLOW_LIGHT = {
|
|
|
130
130
|
"input.foreground": "#161616",
|
|
131
131
|
"input.border": "#C6C6C6",
|
|
132
132
|
"inputOption.activeBorder": "#0F62FE",
|
|
133
|
-
|
|
133
|
+
focusBorder: "#0F62FE"
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
var OCTAVIAFLOW_THEME_ID = "octaviaflow-light";
|
|
137
137
|
|
|
138
|
-
// src/components/MonacoEditor/
|
|
138
|
+
// src/components/MonacoEditor/MonacoDiffEditor.tsx
|
|
139
139
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
140
|
-
var
|
|
141
|
-
() => import("@monaco-editor/react").then((mod) => ({ default: mod.
|
|
140
|
+
var DiffEditor = (0, import_react.lazy)(
|
|
141
|
+
() => import("@monaco-editor/react").then((mod) => ({ default: mod.DiffEditor }))
|
|
142
142
|
);
|
|
143
|
+
function MonacoDiffEditor({
|
|
144
|
+
original,
|
|
145
|
+
modified,
|
|
146
|
+
onModifiedChange,
|
|
147
|
+
language = "plaintext",
|
|
148
|
+
renderSideBySide = true,
|
|
149
|
+
readOnly = false,
|
|
150
|
+
hideUnchangedRegions = false,
|
|
151
|
+
height = 360,
|
|
152
|
+
minHeight = 200,
|
|
153
|
+
originalLabel = "Original",
|
|
154
|
+
modifiedLabel = "Modified",
|
|
155
|
+
toolbar,
|
|
156
|
+
options,
|
|
157
|
+
onMount,
|
|
158
|
+
style,
|
|
159
|
+
className,
|
|
160
|
+
theme,
|
|
161
|
+
hideToolbar = false
|
|
162
|
+
}) {
|
|
163
|
+
const editorRef = (0, import_react.useRef)(null);
|
|
164
|
+
const [sideBySide, setSideBySide] = (0, import_react.useState)(renderSideBySide);
|
|
165
|
+
const handleMount = (diffEditor, monaco) => {
|
|
166
|
+
editorRef.current = diffEditor;
|
|
167
|
+
monaco.editor.defineTheme(OCTAVIAFLOW_THEME_ID, OCTAVIAFLOW_LIGHT);
|
|
168
|
+
monaco.editor.setTheme(theme ?? OCTAVIAFLOW_THEME_ID);
|
|
169
|
+
const modifiedEditor = diffEditor.getModifiedEditor();
|
|
170
|
+
modifiedEditor.onDidChangeModelContent(() => {
|
|
171
|
+
onModifiedChange?.(modifiedEditor.getValue());
|
|
172
|
+
});
|
|
173
|
+
onMount?.(diffEditor, monaco);
|
|
174
|
+
};
|
|
175
|
+
const mergedOptions = {
|
|
176
|
+
readOnly,
|
|
177
|
+
originalEditable: false,
|
|
178
|
+
renderSideBySide: sideBySide,
|
|
179
|
+
fontFamily: "ui-monospace, SFMono-Regular, 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace",
|
|
180
|
+
fontSize: 13,
|
|
181
|
+
lineHeight: 20,
|
|
182
|
+
automaticLayout: true,
|
|
183
|
+
lineNumbersMinChars: 3,
|
|
184
|
+
lineDecorationsWidth: 6,
|
|
185
|
+
folding: true,
|
|
186
|
+
glyphMargin: false,
|
|
187
|
+
minimap: { enabled: false },
|
|
188
|
+
scrollBeyondLastLine: false,
|
|
189
|
+
smoothScrolling: true,
|
|
190
|
+
renderOverviewRuler: true,
|
|
191
|
+
diffWordWrap: "off",
|
|
192
|
+
padding: { top: 8, bottom: 8 },
|
|
193
|
+
hideUnchangedRegions: {
|
|
194
|
+
enabled: hideUnchangedRegions,
|
|
195
|
+
revealLineCount: 20,
|
|
196
|
+
minimumLineCount: 3,
|
|
197
|
+
contextLineCount: 3
|
|
198
|
+
},
|
|
199
|
+
scrollbar: {
|
|
200
|
+
verticalScrollbarSize: 8,
|
|
201
|
+
horizontalScrollbarSize: 8,
|
|
202
|
+
useShadows: false
|
|
203
|
+
},
|
|
204
|
+
...options
|
|
205
|
+
};
|
|
206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: cn("ods-monaco-diff", `ods-monaco-diff--${language}`, className), style, children: [
|
|
207
|
+
!hideToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ods-monaco__toolbar", children: [
|
|
208
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ods-monaco__toolbar-left", children: [
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "ods-monaco__lang", children: [
|
|
210
|
+
"DIFF \xB7 ",
|
|
211
|
+
language.toUpperCase()
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "ods-monaco-diff__labels", children: [
|
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco-diff__label ods-monaco-diff__label--orig", children: originalLabel }),
|
|
215
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco-diff__arrow", "aria-hidden": "true", children: "\u2192" }),
|
|
216
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco-diff__label ods-monaco-diff__label--mod", children: modifiedLabel })
|
|
217
|
+
] }),
|
|
218
|
+
toolbar
|
|
219
|
+
] }),
|
|
220
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ods-monaco__toolbar-right", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
221
|
+
"button",
|
|
222
|
+
{
|
|
223
|
+
type: "button",
|
|
224
|
+
className: cn("ods-monaco__btn", sideBySide && "ods-monaco__btn--active"),
|
|
225
|
+
onClick: () => setSideBySide((s) => !s),
|
|
226
|
+
"aria-pressed": sideBySide,
|
|
227
|
+
"aria-label": "Toggle side-by-side",
|
|
228
|
+
title: sideBySide ? "Inline" : "Side-by-side",
|
|
229
|
+
children: sideBySide ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
231
|
+
"rect",
|
|
232
|
+
{
|
|
233
|
+
x: "1.5",
|
|
234
|
+
y: "2",
|
|
235
|
+
width: "5",
|
|
236
|
+
height: "10",
|
|
237
|
+
rx: "0.5",
|
|
238
|
+
stroke: "currentColor",
|
|
239
|
+
strokeWidth: "1.3"
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
243
|
+
"rect",
|
|
244
|
+
{
|
|
245
|
+
x: "7.5",
|
|
246
|
+
y: "2",
|
|
247
|
+
width: "5",
|
|
248
|
+
height: "10",
|
|
249
|
+
rx: "0.5",
|
|
250
|
+
stroke: "currentColor",
|
|
251
|
+
strokeWidth: "1.3"
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
255
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
256
|
+
"rect",
|
|
257
|
+
{
|
|
258
|
+
x: "1.5",
|
|
259
|
+
y: "2",
|
|
260
|
+
width: "11",
|
|
261
|
+
height: "10",
|
|
262
|
+
rx: "0.5",
|
|
263
|
+
stroke: "currentColor",
|
|
264
|
+
strokeWidth: "1.3"
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M1.5 7h11", stroke: "currentColor", strokeWidth: "1.3" })
|
|
268
|
+
] })
|
|
269
|
+
}
|
|
270
|
+
) })
|
|
271
|
+
] }),
|
|
272
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ods-monaco__body", style: { minHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
273
|
+
import_react.Suspense,
|
|
274
|
+
{
|
|
275
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ods-monaco__loading", children: [
|
|
276
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
277
|
+
"circle",
|
|
278
|
+
{
|
|
279
|
+
cx: "7",
|
|
280
|
+
cy: "7",
|
|
281
|
+
r: "5",
|
|
282
|
+
stroke: "currentColor",
|
|
283
|
+
strokeWidth: "1.4",
|
|
284
|
+
strokeDasharray: "4 18",
|
|
285
|
+
strokeLinecap: "round"
|
|
286
|
+
}
|
|
287
|
+
) }) }),
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Loading diff\u2026" })
|
|
289
|
+
] }),
|
|
290
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
291
|
+
DiffEditor,
|
|
292
|
+
{
|
|
293
|
+
original,
|
|
294
|
+
modified,
|
|
295
|
+
language,
|
|
296
|
+
height,
|
|
297
|
+
theme: theme ?? OCTAVIAFLOW_THEME_ID,
|
|
298
|
+
options: mergedOptions,
|
|
299
|
+
onMount: handleMount,
|
|
300
|
+
loading: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ods-monaco__loading", children: [
|
|
301
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
302
|
+
"circle",
|
|
303
|
+
{
|
|
304
|
+
cx: "7",
|
|
305
|
+
cy: "7",
|
|
306
|
+
r: "5",
|
|
307
|
+
stroke: "currentColor",
|
|
308
|
+
strokeWidth: "1.4",
|
|
309
|
+
strokeDasharray: "4 18",
|
|
310
|
+
strokeLinecap: "round"
|
|
311
|
+
}
|
|
312
|
+
) }) }),
|
|
313
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Loading diff\u2026" })
|
|
314
|
+
] })
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
) })
|
|
319
|
+
] });
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// src/components/MonacoEditor/MonacoEditor.tsx
|
|
323
|
+
var import_react2 = require("react");
|
|
324
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
325
|
+
var Editor = (0, import_react2.lazy)(() => import("@monaco-editor/react").then((mod) => ({ default: mod.Editor })));
|
|
143
326
|
var MARKER_SEVERITY = {
|
|
144
327
|
hint: 1,
|
|
145
328
|
info: 2,
|
|
@@ -172,27 +355,27 @@ function MonacoEditor({
|
|
|
172
355
|
ariaLabel = "Code editor",
|
|
173
356
|
theme
|
|
174
357
|
}) {
|
|
175
|
-
const editorRef = (0,
|
|
176
|
-
const monacoRef = (0,
|
|
177
|
-
const [wordWrap, setWordWrap] = (0,
|
|
178
|
-
const [minimap, setMinimap] = (0,
|
|
179
|
-
const [copied, setCopied] = (0,
|
|
180
|
-
const [cursor, setCursor] = (0,
|
|
181
|
-
const [selection, setSelection] = (0,
|
|
182
|
-
const [lineCount, setLineCount] = (0,
|
|
183
|
-
(0,
|
|
358
|
+
const editorRef = (0, import_react2.useRef)(null);
|
|
359
|
+
const monacoRef = (0, import_react2.useRef)(null);
|
|
360
|
+
const [wordWrap, setWordWrap] = (0, import_react2.useState)(wordWrapProp ?? false);
|
|
361
|
+
const [minimap, setMinimap] = (0, import_react2.useState)(minimapProp ?? false);
|
|
362
|
+
const [copied, setCopied] = (0, import_react2.useState)(false);
|
|
363
|
+
const [cursor, setCursor] = (0, import_react2.useState)({ line: 1, column: 1 });
|
|
364
|
+
const [selection, setSelection] = (0, import_react2.useState)({ chars: 0, lines: 0 });
|
|
365
|
+
const [lineCount, setLineCount] = (0, import_react2.useState)(value.split("\n").length);
|
|
366
|
+
(0, import_react2.useEffect)(() => {
|
|
184
367
|
if (wordWrapProp !== void 0) setWordWrap(wordWrapProp);
|
|
185
368
|
}, [wordWrapProp]);
|
|
186
|
-
(0,
|
|
369
|
+
(0, import_react2.useEffect)(() => {
|
|
187
370
|
if (minimapProp !== void 0) setMinimap(minimapProp);
|
|
188
371
|
}, [minimapProp]);
|
|
189
|
-
(0,
|
|
372
|
+
(0, import_react2.useEffect)(() => {
|
|
190
373
|
editorRef.current?.updateOptions({
|
|
191
374
|
wordWrap: wordWrap ? "on" : "off",
|
|
192
375
|
minimap: { enabled: minimap }
|
|
193
376
|
});
|
|
194
377
|
}, [wordWrap, minimap]);
|
|
195
|
-
(0,
|
|
378
|
+
(0, import_react2.useEffect)(() => {
|
|
196
379
|
const editor = editorRef.current;
|
|
197
380
|
const monaco = monacoRef.current;
|
|
198
381
|
if (!editor || !monaco || !markers) return;
|
|
@@ -212,7 +395,7 @@ function MonacoEditor({
|
|
|
212
395
|
}))
|
|
213
396
|
);
|
|
214
397
|
}, [markers]);
|
|
215
|
-
const handleMount = (0,
|
|
398
|
+
const handleMount = (0, import_react2.useCallback)(
|
|
216
399
|
(editor, monaco) => {
|
|
217
400
|
editorRef.current = editor;
|
|
218
401
|
monacoRef.current = monaco;
|
|
@@ -296,7 +479,7 @@ function MonacoEditor({
|
|
|
296
479
|
};
|
|
297
480
|
const showWrapBtn = showWordWrapToggle && wordWrapProp === void 0;
|
|
298
481
|
const showMinimapBtn = showMinimapToggle && minimapProp === void 0;
|
|
299
|
-
return /* @__PURE__ */ (0,
|
|
482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
300
483
|
"div",
|
|
301
484
|
{
|
|
302
485
|
className: cn(
|
|
@@ -307,19 +490,19 @@ function MonacoEditor({
|
|
|
307
490
|
),
|
|
308
491
|
style,
|
|
309
492
|
children: [
|
|
310
|
-
!hideToolbar && /* @__PURE__ */ (0,
|
|
311
|
-
/* @__PURE__ */ (0,
|
|
312
|
-
/* @__PURE__ */ (0,
|
|
493
|
+
!hideToolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar", children: [
|
|
494
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar-left", children: [
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__lang", children: language.toUpperCase() }),
|
|
313
496
|
toolbar
|
|
314
497
|
] }),
|
|
315
|
-
/* @__PURE__ */ (0,
|
|
316
|
-
/* @__PURE__ */ (0,
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar-right", children: [
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__lines", children: [
|
|
317
500
|
lineCount,
|
|
318
501
|
" line",
|
|
319
502
|
lineCount === 1 ? "" : "s"
|
|
320
503
|
] }),
|
|
321
|
-
status && /* @__PURE__ */ (0,
|
|
322
|
-
showWrapBtn && /* @__PURE__ */ (0,
|
|
504
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__status", children: status }),
|
|
505
|
+
showWrapBtn && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
323
506
|
"button",
|
|
324
507
|
{
|
|
325
508
|
type: "button",
|
|
@@ -328,7 +511,7 @@ function MonacoEditor({
|
|
|
328
511
|
"aria-pressed": wordWrap,
|
|
329
512
|
"aria-label": "Toggle word wrap",
|
|
330
513
|
title: "Word wrap",
|
|
331
|
-
children: /* @__PURE__ */ (0,
|
|
514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
332
515
|
"path",
|
|
333
516
|
{
|
|
334
517
|
d: "M2 3.5h10M2 7h7.5a2 2 0 1 1 0 4H8m0 0 1.5-1.5M8 11l1.5 1.5M2 10.5h3",
|
|
@@ -340,7 +523,7 @@ function MonacoEditor({
|
|
|
340
523
|
) })
|
|
341
524
|
}
|
|
342
525
|
),
|
|
343
|
-
showMinimapBtn && /* @__PURE__ */ (0,
|
|
526
|
+
showMinimapBtn && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
344
527
|
"button",
|
|
345
528
|
{
|
|
346
529
|
type: "button",
|
|
@@ -349,14 +532,44 @@ function MonacoEditor({
|
|
|
349
532
|
"aria-pressed": minimap,
|
|
350
533
|
"aria-label": "Toggle minimap",
|
|
351
534
|
title: "Minimap",
|
|
352
|
-
children: /* @__PURE__ */ (0,
|
|
353
|
-
/* @__PURE__ */ (0,
|
|
354
|
-
|
|
355
|
-
|
|
535
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
537
|
+
"rect",
|
|
538
|
+
{
|
|
539
|
+
x: "2",
|
|
540
|
+
y: "2.5",
|
|
541
|
+
width: "6",
|
|
542
|
+
height: "9",
|
|
543
|
+
rx: "0.5",
|
|
544
|
+
stroke: "currentColor",
|
|
545
|
+
strokeWidth: "1.2"
|
|
546
|
+
}
|
|
547
|
+
),
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
549
|
+
"rect",
|
|
550
|
+
{
|
|
551
|
+
x: "9",
|
|
552
|
+
y: "2.5",
|
|
553
|
+
width: "3",
|
|
554
|
+
height: "9",
|
|
555
|
+
rx: "0.5",
|
|
556
|
+
fill: "currentColor",
|
|
557
|
+
opacity: "0.25"
|
|
558
|
+
}
|
|
559
|
+
),
|
|
560
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
561
|
+
"path",
|
|
562
|
+
{
|
|
563
|
+
d: "M3.5 4.5h3M3.5 6.5h3M3.5 8.5h2",
|
|
564
|
+
stroke: "currentColor",
|
|
565
|
+
strokeWidth: "1",
|
|
566
|
+
strokeLinecap: "round"
|
|
567
|
+
}
|
|
568
|
+
)
|
|
356
569
|
] })
|
|
357
570
|
}
|
|
358
571
|
),
|
|
359
|
-
showFormat && !readOnly && /* @__PURE__ */ (0,
|
|
572
|
+
showFormat && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
360
573
|
"button",
|
|
361
574
|
{
|
|
362
575
|
type: "button",
|
|
@@ -364,13 +577,30 @@ function MonacoEditor({
|
|
|
364
577
|
onClick: handleFormat,
|
|
365
578
|
"aria-label": "Format document",
|
|
366
579
|
title: "Format (Shift+Alt+F)",
|
|
367
|
-
children: /* @__PURE__ */ (0,
|
|
368
|
-
/* @__PURE__ */ (0,
|
|
369
|
-
|
|
580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
582
|
+
"path",
|
|
583
|
+
{
|
|
584
|
+
d: "M2.5 4h9M4 7h7.5M5.5 10H11",
|
|
585
|
+
stroke: "currentColor",
|
|
586
|
+
strokeWidth: "1.3",
|
|
587
|
+
strokeLinecap: "round"
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
591
|
+
"path",
|
|
592
|
+
{
|
|
593
|
+
d: "M2.5 7 3.5 6 2.5 5",
|
|
594
|
+
stroke: "currentColor",
|
|
595
|
+
strokeWidth: "1.2",
|
|
596
|
+
strokeLinecap: "round",
|
|
597
|
+
strokeLinejoin: "round"
|
|
598
|
+
}
|
|
599
|
+
)
|
|
370
600
|
] })
|
|
371
601
|
}
|
|
372
602
|
),
|
|
373
|
-
showCopy && /* @__PURE__ */ (0,
|
|
603
|
+
showCopy && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
374
604
|
"button",
|
|
375
605
|
{
|
|
376
606
|
type: "button",
|
|
@@ -378,7 +608,7 @@ function MonacoEditor({
|
|
|
378
608
|
onClick: handleCopy,
|
|
379
609
|
"aria-label": "Copy",
|
|
380
610
|
title: "Copy",
|
|
381
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
611
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
382
612
|
"path",
|
|
383
613
|
{
|
|
384
614
|
d: "m3 7 3 3 5-6",
|
|
@@ -387,41 +617,88 @@ function MonacoEditor({
|
|
|
387
617
|
strokeLinecap: "round",
|
|
388
618
|
strokeLinejoin: "round"
|
|
389
619
|
}
|
|
390
|
-
) }) : /* @__PURE__ */ (0,
|
|
391
|
-
/* @__PURE__ */ (0,
|
|
392
|
-
|
|
620
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
622
|
+
"rect",
|
|
623
|
+
{
|
|
624
|
+
x: "3",
|
|
625
|
+
y: "3",
|
|
626
|
+
width: "8",
|
|
627
|
+
height: "8",
|
|
628
|
+
rx: "1",
|
|
629
|
+
stroke: "currentColor",
|
|
630
|
+
strokeWidth: "1.3"
|
|
631
|
+
}
|
|
632
|
+
),
|
|
633
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
634
|
+
"path",
|
|
635
|
+
{
|
|
636
|
+
d: "M5 1.5h6V8",
|
|
637
|
+
stroke: "currentColor",
|
|
638
|
+
strokeWidth: "1.3",
|
|
639
|
+
strokeLinecap: "round"
|
|
640
|
+
}
|
|
641
|
+
)
|
|
393
642
|
] })
|
|
394
643
|
}
|
|
395
644
|
)
|
|
396
645
|
] })
|
|
397
646
|
] }),
|
|
398
|
-
/* @__PURE__ */ (0,
|
|
399
|
-
|
|
400
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Loading editor\u2026" })
|
|
401
|
-
] }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
402
|
-
Editor,
|
|
647
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "ods-monaco__body", style: { minHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
648
|
+
import_react2.Suspense,
|
|
403
649
|
{
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
650
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__loading", children: [
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
652
|
+
"circle",
|
|
653
|
+
{
|
|
654
|
+
cx: "7",
|
|
655
|
+
cy: "7",
|
|
656
|
+
r: "5",
|
|
657
|
+
stroke: "currentColor",
|
|
658
|
+
strokeWidth: "1.4",
|
|
659
|
+
strokeDasharray: "4 18",
|
|
660
|
+
strokeLinecap: "round"
|
|
661
|
+
}
|
|
662
|
+
) }) }),
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Loading editor\u2026" })
|
|
414
664
|
] }),
|
|
415
|
-
|
|
665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
666
|
+
Editor,
|
|
667
|
+
{
|
|
668
|
+
value,
|
|
669
|
+
onChange: (v) => onChange?.(v ?? ""),
|
|
670
|
+
language,
|
|
671
|
+
height,
|
|
672
|
+
theme: theme ?? OCTAVIAFLOW_THEME_ID,
|
|
673
|
+
options: mergedOptions,
|
|
674
|
+
onMount: handleMount,
|
|
675
|
+
loading: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__loading", children: [
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
677
|
+
"circle",
|
|
678
|
+
{
|
|
679
|
+
cx: "7",
|
|
680
|
+
cy: "7",
|
|
681
|
+
r: "5",
|
|
682
|
+
stroke: "currentColor",
|
|
683
|
+
strokeWidth: "1.4",
|
|
684
|
+
strokeDasharray: "4 18",
|
|
685
|
+
strokeLinecap: "round"
|
|
686
|
+
}
|
|
687
|
+
) }) }),
|
|
688
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Loading editor\u2026" })
|
|
689
|
+
] }),
|
|
690
|
+
"aria-label": ariaLabel
|
|
691
|
+
}
|
|
692
|
+
)
|
|
416
693
|
}
|
|
417
|
-
) })
|
|
418
|
-
!hideFooter && /* @__PURE__ */ (0,
|
|
419
|
-
/* @__PURE__ */ (0,
|
|
694
|
+
) }),
|
|
695
|
+
!hideFooter && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__footer", children: [
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__pos", children: [
|
|
420
697
|
"Ln ",
|
|
421
698
|
cursor.line,
|
|
422
699
|
", Col ",
|
|
423
700
|
cursor.column,
|
|
424
|
-
selection.chars > 0 && /* @__PURE__ */ (0,
|
|
701
|
+
selection.chars > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
425
702
|
" ",
|
|
426
703
|
"\xB7 ",
|
|
427
704
|
selection.chars,
|
|
@@ -430,14 +707,14 @@ function MonacoEditor({
|
|
|
430
707
|
selection.lines > 1 && ` \xB7 ${selection.lines} lines`
|
|
431
708
|
] })
|
|
432
709
|
] }),
|
|
433
|
-
/* @__PURE__ */ (0,
|
|
434
|
-
/* @__PURE__ */ (0,
|
|
710
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__shortcut-hint", children: [
|
|
711
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: "ods-monaco__kbd", children: "\u2318F" }),
|
|
435
712
|
" find",
|
|
436
|
-
/* @__PURE__ */ (0,
|
|
437
|
-
/* @__PURE__ */ (0,
|
|
713
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__sep", children: "\xB7" }),
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: "ods-monaco__kbd", children: "\u2318\u21E7F" }),
|
|
438
715
|
" replace",
|
|
439
|
-
/* @__PURE__ */ (0,
|
|
440
|
-
/* @__PURE__ */ (0,
|
|
716
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__sep", children: "\xB7" }),
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: "ods-monaco__kbd", children: "F1" }),
|
|
441
718
|
" commands"
|
|
442
719
|
] })
|
|
443
720
|
] })
|
|
@@ -445,140 +722,6 @@ function MonacoEditor({
|
|
|
445
722
|
}
|
|
446
723
|
);
|
|
447
724
|
}
|
|
448
|
-
|
|
449
|
-
// src/components/MonacoEditor/MonacoDiffEditor.tsx
|
|
450
|
-
var import_react2 = require("react");
|
|
451
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
452
|
-
var DiffEditor = (0, import_react2.lazy)(
|
|
453
|
-
() => import("@monaco-editor/react").then((mod) => ({ default: mod.DiffEditor }))
|
|
454
|
-
);
|
|
455
|
-
function MonacoDiffEditor({
|
|
456
|
-
original,
|
|
457
|
-
modified,
|
|
458
|
-
onModifiedChange,
|
|
459
|
-
language = "plaintext",
|
|
460
|
-
renderSideBySide = true,
|
|
461
|
-
readOnly = false,
|
|
462
|
-
hideUnchangedRegions = false,
|
|
463
|
-
height = 360,
|
|
464
|
-
minHeight = 200,
|
|
465
|
-
originalLabel = "Original",
|
|
466
|
-
modifiedLabel = "Modified",
|
|
467
|
-
toolbar,
|
|
468
|
-
options,
|
|
469
|
-
onMount,
|
|
470
|
-
style,
|
|
471
|
-
className,
|
|
472
|
-
theme,
|
|
473
|
-
hideToolbar = false
|
|
474
|
-
}) {
|
|
475
|
-
const editorRef = (0, import_react2.useRef)(null);
|
|
476
|
-
const [sideBySide, setSideBySide] = (0, import_react2.useState)(renderSideBySide);
|
|
477
|
-
const handleMount = (diffEditor, monaco) => {
|
|
478
|
-
editorRef.current = diffEditor;
|
|
479
|
-
monaco.editor.defineTheme(OCTAVIAFLOW_THEME_ID, OCTAVIAFLOW_LIGHT);
|
|
480
|
-
monaco.editor.setTheme(theme ?? OCTAVIAFLOW_THEME_ID);
|
|
481
|
-
const modifiedEditor = diffEditor.getModifiedEditor();
|
|
482
|
-
modifiedEditor.onDidChangeModelContent(() => {
|
|
483
|
-
onModifiedChange?.(modifiedEditor.getValue());
|
|
484
|
-
});
|
|
485
|
-
onMount?.(diffEditor, monaco);
|
|
486
|
-
};
|
|
487
|
-
const mergedOptions = {
|
|
488
|
-
readOnly,
|
|
489
|
-
originalEditable: false,
|
|
490
|
-
renderSideBySide: sideBySide,
|
|
491
|
-
fontFamily: "ui-monospace, SFMono-Regular, 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace",
|
|
492
|
-
fontSize: 13,
|
|
493
|
-
lineHeight: 20,
|
|
494
|
-
automaticLayout: true,
|
|
495
|
-
lineNumbersMinChars: 3,
|
|
496
|
-
lineDecorationsWidth: 6,
|
|
497
|
-
folding: true,
|
|
498
|
-
glyphMargin: false,
|
|
499
|
-
minimap: { enabled: false },
|
|
500
|
-
scrollBeyondLastLine: false,
|
|
501
|
-
smoothScrolling: true,
|
|
502
|
-
renderOverviewRuler: true,
|
|
503
|
-
diffWordWrap: "off",
|
|
504
|
-
padding: { top: 8, bottom: 8 },
|
|
505
|
-
hideUnchangedRegions: {
|
|
506
|
-
enabled: hideUnchangedRegions,
|
|
507
|
-
revealLineCount: 20,
|
|
508
|
-
minimumLineCount: 3,
|
|
509
|
-
contextLineCount: 3
|
|
510
|
-
},
|
|
511
|
-
scrollbar: {
|
|
512
|
-
verticalScrollbarSize: 8,
|
|
513
|
-
horizontalScrollbarSize: 8,
|
|
514
|
-
useShadows: false
|
|
515
|
-
},
|
|
516
|
-
...options
|
|
517
|
-
};
|
|
518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
519
|
-
"div",
|
|
520
|
-
{
|
|
521
|
-
className: cn("ods-monaco-diff", `ods-monaco-diff--${language}`, className),
|
|
522
|
-
style,
|
|
523
|
-
children: [
|
|
524
|
-
!hideToolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar", children: [
|
|
525
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar-left", children: [
|
|
526
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__lang", children: [
|
|
527
|
-
"DIFF \xB7 ",
|
|
528
|
-
language.toUpperCase()
|
|
529
|
-
] }),
|
|
530
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco-diff__labels", children: [
|
|
531
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco-diff__label ods-monaco-diff__label--orig", children: originalLabel }),
|
|
532
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco-diff__arrow", "aria-hidden": "true", children: "\u2192" }),
|
|
533
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco-diff__label ods-monaco-diff__label--mod", children: modifiedLabel })
|
|
534
|
-
] }),
|
|
535
|
-
toolbar
|
|
536
|
-
] }),
|
|
537
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "ods-monaco__toolbar-right", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
538
|
-
"button",
|
|
539
|
-
{
|
|
540
|
-
type: "button",
|
|
541
|
-
className: cn(
|
|
542
|
-
"ods-monaco__btn",
|
|
543
|
-
sideBySide && "ods-monaco__btn--active"
|
|
544
|
-
),
|
|
545
|
-
onClick: () => setSideBySide((s) => !s),
|
|
546
|
-
"aria-pressed": sideBySide,
|
|
547
|
-
"aria-label": "Toggle side-by-side",
|
|
548
|
-
title: sideBySide ? "Inline" : "Side-by-side",
|
|
549
|
-
children: sideBySide ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
550
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "1.5", y: "2", width: "5", height: "10", rx: "0.5", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
551
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "7.5", y: "2", width: "5", height: "10", rx: "0.5", stroke: "currentColor", strokeWidth: "1.3" })
|
|
552
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
553
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "1.5", y: "2", width: "11", height: "10", rx: "0.5", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
554
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M1.5 7h11", stroke: "currentColor", strokeWidth: "1.3" })
|
|
555
|
-
] })
|
|
556
|
-
}
|
|
557
|
-
) })
|
|
558
|
-
] }),
|
|
559
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "ods-monaco__body", style: { minHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__loading", children: [
|
|
560
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "7", cy: "7", r: "5", stroke: "currentColor", strokeWidth: "1.4", strokeDasharray: "4 18", strokeLinecap: "round" }) }) }),
|
|
561
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Loading diff\u2026" })
|
|
562
|
-
] }), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
563
|
-
DiffEditor,
|
|
564
|
-
{
|
|
565
|
-
original,
|
|
566
|
-
modified,
|
|
567
|
-
language,
|
|
568
|
-
height,
|
|
569
|
-
theme: theme ?? OCTAVIAFLOW_THEME_ID,
|
|
570
|
-
options: mergedOptions,
|
|
571
|
-
onMount: handleMount,
|
|
572
|
-
loading: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__loading", children: [
|
|
573
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "7", cy: "7", r: "5", stroke: "currentColor", strokeWidth: "1.4", strokeDasharray: "4 18", strokeLinecap: "round" }) }) }),
|
|
574
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Loading diff\u2026" })
|
|
575
|
-
] })
|
|
576
|
-
}
|
|
577
|
-
) }) })
|
|
578
|
-
]
|
|
579
|
-
}
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
725
|
// Annotate the CommonJS export names for ESM import in node:
|
|
583
726
|
0 && (module.exports = {
|
|
584
727
|
MonacoDiffEditor,
|