@octaviaflow/core 3.1.0-beta.114 → 3.1.0-beta.115

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.
Files changed (249) hide show
  1. package/dist/chunk-75JAQ4ZG.js +2694 -0
  2. package/dist/chunk-75JAQ4ZG.js.map +1 -0
  3. package/dist/chunk-LQVPNIO5.js +6789 -0
  4. package/dist/chunk-LQVPNIO5.js.map +1 -0
  5. package/dist/chunk-P46JGJC2.js +5619 -0
  6. package/dist/chunk-P46JGJC2.js.map +1 -0
  7. package/dist/chunk-ZALBYWCU.js +1547 -0
  8. package/dist/chunk-ZALBYWCU.js.map +1 -0
  9. package/dist/components/Accordion/Accordion.d.ts.map +1 -1
  10. package/dist/components/AgentAppMark/AgentAppMark.d.ts +28 -0
  11. package/dist/components/AgentAppMark/AgentAppMark.d.ts.map +1 -0
  12. package/dist/components/AgentAppMark/index.d.ts +3 -0
  13. package/dist/components/AgentAppMark/index.d.ts.map +1 -0
  14. package/dist/components/AgentCard/AgentCard.d.ts.map +1 -1
  15. package/dist/components/AlertCard/AlertCard.d.ts.map +1 -1
  16. package/dist/components/AuthCard/AuthCard.d.ts.map +1 -1
  17. package/dist/components/AuthScreen/AuthScreen.d.ts.map +1 -1
  18. package/dist/components/Badge/Badge.d.ts.map +1 -1
  19. package/dist/components/Banner/Banner.d.ts.map +1 -1
  20. package/dist/components/BarChart/BarChart.d.ts.map +1 -1
  21. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  22. package/dist/components/CalendarHeatmap/CalendarHeatmap.d.ts.map +1 -1
  23. package/dist/components/CalendarHeatmap/index.d.ts +1 -1
  24. package/dist/components/CalendarHeatmap/index.d.ts.map +1 -1
  25. package/dist/components/Callout/Callout.d.ts.map +1 -1
  26. package/dist/components/Card/Card.d.ts.map +1 -1
  27. package/dist/components/Catalog/Catalog.d.ts.map +1 -1
  28. package/dist/components/Catalog/index.d.ts +1 -1
  29. package/dist/components/Catalog/index.d.ts.map +1 -1
  30. package/dist/components/ChatAttachment/ChatAttachment.d.ts.map +1 -1
  31. package/dist/components/ChatAttachment/index.d.ts +1 -1
  32. package/dist/components/ChatAttachment/index.d.ts.map +1 -1
  33. package/dist/components/ChatBubble/ChatBubble.d.ts.map +1 -1
  34. package/dist/components/ChatCodeBlock/ChatCodeBlock.d.ts.map +1 -1
  35. package/dist/components/ChatDayDivider/ChatDayDivider.d.ts.map +1 -1
  36. package/dist/components/ChatFeedback/ChatFeedback.d.ts.map +1 -1
  37. package/dist/components/ChatPanel/ChatPanel.d.ts +1 -1
  38. package/dist/components/ChatPanel/ChatPanel.d.ts.map +1 -1
  39. package/dist/components/ChatScrollToBottom/ChatScrollToBottom.d.ts.map +1 -1
  40. package/dist/components/ChatSources/ChatSources.d.ts.map +1 -1
  41. package/dist/components/ChatSources/index.d.ts +1 -1
  42. package/dist/components/ChatSources/index.d.ts.map +1 -1
  43. package/dist/components/ChatSuggestions/ChatSuggestions.d.ts.map +1 -1
  44. package/dist/components/ChatSuggestions/index.d.ts +1 -1
  45. package/dist/components/ChatSuggestions/index.d.ts.map +1 -1
  46. package/dist/components/ChatThinking/ChatThinking.d.ts.map +1 -1
  47. package/dist/components/ChatThinking/index.d.ts +1 -1
  48. package/dist/components/ChatThinking/index.d.ts.map +1 -1
  49. package/dist/components/ChatThread/ChatThread.d.ts.map +1 -1
  50. package/dist/components/ChatThread/index.d.ts +1 -1
  51. package/dist/components/ChatThread/index.d.ts.map +1 -1
  52. package/dist/components/ChatToolTrace/ChatToolTrace.d.ts.map +1 -1
  53. package/dist/components/ChatToolTrace/index.d.ts +1 -1
  54. package/dist/components/ChatToolTrace/index.d.ts.map +1 -1
  55. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
  56. package/dist/components/Chip/Chip.d.ts.map +1 -1
  57. package/dist/components/ChoiceCard/ChoiceCard.d.ts.map +1 -1
  58. package/dist/components/Coachmark/Coachmark.d.ts.map +1 -1
  59. package/dist/components/CodeEditor/CodeEditor.d.ts +15 -0
  60. package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
  61. package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  62. package/dist/components/Combobox/Combobox.d.ts.map +1 -1
  63. package/dist/components/Combobox/index.d.ts +1 -1
  64. package/dist/components/Combobox/index.d.ts.map +1 -1
  65. package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
  66. package/dist/components/ConditionBuilder/ConditionBuilder.d.ts.map +1 -1
  67. package/dist/components/ConfigPanel/ConfigPanel.d.ts.map +1 -1
  68. package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
  69. package/dist/components/ConnectorCard/ConnectorCard.d.ts.map +1 -1
  70. package/dist/components/ConnectorCard/index.d.ts +1 -1
  71. package/dist/components/ConnectorCard/index.d.ts.map +1 -1
  72. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  73. package/dist/components/CountUp/CountUp.d.ts.map +1 -1
  74. package/dist/components/CsvViewer/CsvViewer.d.ts.map +1 -1
  75. package/dist/components/DataMapper/DataMapper.d.ts.map +1 -1
  76. package/dist/components/DataTable/DataTable.d.ts.map +1 -1
  77. package/dist/components/DatasetCard/DatasetCard.d.ts.map +1 -1
  78. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  79. package/dist/components/DescriptionList/DescriptionList.d.ts.map +1 -1
  80. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  81. package/dist/components/Divider/Divider.d.ts.map +1 -1
  82. package/dist/components/DonutChart/DonutChart.d.ts.map +1 -1
  83. package/dist/components/Drawer/Drawer.d.ts.map +1 -1
  84. package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  85. package/dist/components/EmptyState/EmptyState.d.ts.map +1 -1
  86. package/dist/components/ExecutionConsole/ExecutionConsole.d.ts.map +1 -1
  87. package/dist/components/ExpressionField/ExpressionField.d.ts +21 -3
  88. package/dist/components/ExpressionField/ExpressionField.d.ts.map +1 -1
  89. package/dist/components/ExpressionField/dataRefTokens.d.ts +52 -0
  90. package/dist/components/ExpressionField/dataRefTokens.d.ts.map +1 -0
  91. package/dist/components/ExpressionField/index.d.ts +3 -2
  92. package/dist/components/ExpressionField/index.d.ts.map +1 -1
  93. package/dist/components/FeatureCard/FeatureCard.d.ts.map +1 -1
  94. package/dist/components/FieldPicker/FieldPicker.d.ts.map +1 -1
  95. package/dist/components/FieldPicker/index.d.ts +1 -1
  96. package/dist/components/FieldPicker/index.d.ts.map +1 -1
  97. package/dist/components/FileBrowser/FileBrowser.d.ts.map +1 -1
  98. package/dist/components/FileDropzone/FileDropzone.d.ts.map +1 -1
  99. package/dist/components/FileList/FileList.d.ts.map +1 -1
  100. package/dist/components/FilePicker/FilePicker.d.ts +6 -1
  101. package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
  102. package/dist/components/FileViewer/FileViewer.d.ts.map +1 -1
  103. package/dist/components/FlowMinimap/FlowMinimap.d.ts.map +1 -1
  104. package/dist/components/Gauge/Gauge.d.ts.map +1 -1
  105. package/dist/components/Grid/Grid.d.ts.map +1 -1
  106. package/dist/components/GroupByBuilder/index.d.ts +1 -1
  107. package/dist/components/GroupByBuilder/index.d.ts.map +1 -1
  108. package/dist/components/Heatmap/Heatmap.d.ts.map +1 -1
  109. package/dist/components/IconCard/IconCard.d.ts.map +1 -1
  110. package/dist/components/InlineMessage/InlineMessage.d.ts.map +1 -1
  111. package/dist/components/IntegrationCard/IntegrationCard.d.ts.map +1 -1
  112. package/dist/components/ItemDetail/ItemDetail.d.ts.map +1 -1
  113. package/dist/components/ItemDetail/index.d.ts +1 -1
  114. package/dist/components/ItemDetail/index.d.ts.map +1 -1
  115. package/dist/components/JsonViewer/JsonViewer.d.ts.map +1 -1
  116. package/dist/components/Kbd/Kbd.d.ts.map +1 -1
  117. package/dist/components/KeyValueEditor/KeyValueEditor.d.ts +22 -1
  118. package/dist/components/KeyValueEditor/KeyValueEditor.d.ts.map +1 -1
  119. package/dist/components/KeyValueEditor/index.d.ts +1 -1
  120. package/dist/components/KeyValueEditor/index.d.ts.map +1 -1
  121. package/dist/components/LinkButton/LinkButton.d.ts.map +1 -1
  122. package/dist/components/MetricCard/MetricCard.d.ts.map +1 -1
  123. package/dist/components/MonacoEditor/MonacoDiffEditor.d.ts.map +1 -1
  124. package/dist/components/MonacoEditor/MonacoEditor.d.ts.map +1 -1
  125. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  126. package/dist/components/NumberInput/NumberInput.d.ts.map +1 -1
  127. package/dist/components/OnboardingFlow/OnboardingFlow.d.ts.map +1 -1
  128. package/dist/components/OrgSwitcher/OrgSwitcher.d.ts.map +1 -1
  129. package/dist/components/PageHeader/PageHeader.d.ts.map +1 -1
  130. package/dist/components/Pagination/Pagination.d.ts.map +1 -1
  131. package/dist/components/PasswordInput/PasswordInput.d.ts.map +1 -1
  132. package/dist/components/PhoneInput/PhoneInput.d.ts.map +1 -1
  133. package/dist/components/PhoneInput/countries.d.ts.map +1 -1
  134. package/dist/components/PhoneInput/index.d.ts +1 -1
  135. package/dist/components/PhoneInput/index.d.ts.map +1 -1
  136. package/dist/components/PipelineCard/PipelineCard.d.ts +1 -1
  137. package/dist/components/PipelineCard/PipelineCard.d.ts.map +1 -1
  138. package/dist/components/PlanCard/PlanCard.d.ts.map +1 -1
  139. package/dist/components/PlanPicker/PlanPicker.d.ts.map +1 -1
  140. package/dist/components/PlanPicker/context.d.ts.map +1 -1
  141. package/dist/components/PresenceBar/PresenceBar.d.ts +11 -0
  142. package/dist/components/PresenceBar/PresenceBar.d.ts.map +1 -1
  143. package/dist/components/PricingCard/PricingCard.d.ts.map +1 -1
  144. package/dist/components/ProductCard/ProductCard.d.ts.map +1 -1
  145. package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -1
  146. package/dist/components/ProgressRing/ProgressRing.d.ts.map +1 -1
  147. package/dist/components/PromptInput/PromptInput.d.ts.map +1 -1
  148. package/dist/components/Quote/Quote.d.ts.map +1 -1
  149. package/dist/components/Radio/Radio.d.ts.map +1 -1
  150. package/dist/components/Radio/RadioGroup.d.ts.map +1 -1
  151. package/dist/components/RangeSlider/RangeSlider.d.ts.map +1 -1
  152. package/dist/components/Rating/BinaryRating.d.ts.map +1 -1
  153. package/dist/components/Rating/Rating.d.ts.map +1 -1
  154. package/dist/components/Rating/index.d.ts +1 -1
  155. package/dist/components/Rating/index.d.ts.map +1 -1
  156. package/dist/components/Resizable/Resizable.d.ts.map +1 -1
  157. package/dist/components/Ribbon/Ribbon.d.ts.map +1 -1
  158. package/dist/components/Sankey/Sankey.d.ts.map +1 -1
  159. package/dist/components/ScheduleBuilder/ScheduleBuilder.d.ts.map +1 -1
  160. package/dist/components/ScheduleBuilder/index.d.ts +1 -1
  161. package/dist/components/ScheduleBuilder/index.d.ts.map +1 -1
  162. package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  163. package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  164. package/dist/components/Select/Select.d.ts.map +1 -1
  165. package/dist/components/Show/Show.d.ts.map +1 -1
  166. package/dist/components/Skeleton/Skeleton.d.ts.map +1 -1
  167. package/dist/components/SlideoutPanel/SlideoutPanel.d.ts.map +1 -1
  168. package/dist/components/Slider/Slider.d.ts.map +1 -1
  169. package/dist/components/SocialButton/SocialButton.d.ts.map +1 -1
  170. package/dist/components/SortBuilder/index.d.ts +1 -1
  171. package/dist/components/SortBuilder/index.d.ts.map +1 -1
  172. package/dist/components/Sortable/Sortable.d.ts.map +1 -1
  173. package/dist/components/Sparkline/Sparkline.d.ts.map +1 -1
  174. package/dist/components/Spinner/Spinner.d.ts.map +1 -1
  175. package/dist/components/Spotlight/Spotlight.d.ts.map +1 -1
  176. package/dist/components/Stack/Stack.d.ts.map +1 -1
  177. package/dist/components/Stat/Stat.d.ts.map +1 -1
  178. package/dist/components/StatusList/StatusList.d.ts +1 -1
  179. package/dist/components/StatusList/StatusList.d.ts.map +1 -1
  180. package/dist/components/StatusList/index.d.ts +1 -1
  181. package/dist/components/StatusList/index.d.ts.map +1 -1
  182. package/dist/components/StatusTiles/StatusTiles.d.ts.map +1 -1
  183. package/dist/components/StatusTiles/index.d.ts +1 -1
  184. package/dist/components/StatusTiles/index.d.ts.map +1 -1
  185. package/dist/components/Stepper/Stepper.d.ts.map +1 -1
  186. package/dist/components/Switch/Switch.d.ts.map +1 -1
  187. package/dist/components/Table/Table.d.ts.map +1 -1
  188. package/dist/components/TagsInput/TagsInput.d.ts.map +1 -1
  189. package/dist/components/Textarea/Textarea.d.ts.map +1 -1
  190. package/dist/components/TimePicker/TimePicker.d.ts.map +1 -1
  191. package/dist/components/Timeline/Timeline.d.ts.map +1 -1
  192. package/dist/components/TimezonePicker/TimezonePicker.d.ts.map +1 -1
  193. package/dist/components/Toggle/Toggle.d.ts.map +1 -1
  194. package/dist/components/ToolCard/ToolCard.d.ts.map +1 -1
  195. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  196. package/dist/components/TraceStep/TraceStep.d.ts.map +1 -1
  197. package/dist/components/TreeView/TreeView.d.ts.map +1 -1
  198. package/dist/components/TreeView/index.d.ts +1 -1
  199. package/dist/components/TreeView/index.d.ts.map +1 -1
  200. package/dist/components/UsageMeter/UsageMeter.d.ts.map +1 -1
  201. package/dist/components/VersionHistory/VersionHistory.d.ts.map +1 -1
  202. package/dist/components/VersionHistory/index.d.ts +1 -1
  203. package/dist/components/VersionHistory/index.d.ts.map +1 -1
  204. package/dist/components/XmlViewer/XmlViewer.d.ts.map +1 -1
  205. package/dist/components/YamlViewer/YamlViewer.d.ts.map +1 -1
  206. package/dist/email/emailPalette.d.ts.map +1 -1
  207. package/dist/email/emailSystem.d.ts +3 -3
  208. package/dist/email/emailSystem.d.ts.map +1 -1
  209. package/dist/email/emailTemplates.d.ts +1 -1
  210. package/dist/email/emailTemplates.d.ts.map +1 -1
  211. package/dist/hooks/useRating.d.ts.map +1 -1
  212. package/dist/hooks/useTextareaCommands.d.ts.map +1 -1
  213. package/dist/hooks/useTextareaSelection.d.ts.map +1 -1
  214. package/dist/hooks/useTextareaTools.d.ts.map +1 -1
  215. package/dist/hooks/useTraceTimeline.d.ts.map +1 -1
  216. package/dist/index.cjs +15999 -17094
  217. package/dist/index.cjs.map +1 -1
  218. package/dist/index.d.ts +6 -5
  219. package/dist/index.d.ts.map +1 -1
  220. package/dist/index.js +14076 -16193
  221. package/dist/index.js.map +1 -1
  222. package/dist/marketing.cjs +580 -726
  223. package/dist/marketing.cjs.map +1 -1
  224. package/dist/marketing.js +2 -2
  225. package/dist/monaco.cjs +364 -389
  226. package/dist/monaco.cjs.map +1 -1
  227. package/dist/monaco.js +381 -410
  228. package/dist/monaco.js.map +1 -1
  229. package/dist/notifications/components/NotificationBell/NotificationBell.d.ts.map +1 -1
  230. package/dist/styles.css +1 -1
  231. package/dist/utils/Slot.d.ts.map +1 -1
  232. package/dist/utils/gradients.d.ts.map +1 -1
  233. package/dist/utils/useAnchoredPopover.d.ts +8 -1
  234. package/dist/utils/useAnchoredPopover.d.ts.map +1 -1
  235. package/dist/workflow/components/ConfigPanel/ConfigPanel.d.ts.map +1 -1
  236. package/dist/workflow/components/FlowNode/FlowNode.d.ts.map +1 -1
  237. package/dist/workflow/components/FxPanel/DataRefButton.d.ts +1 -1
  238. package/dist/workflow/components/FxPanel/DataRefButton.d.ts.map +1 -1
  239. package/dist/workflow/components/FxPanel/FxPanel.d.ts.map +1 -1
  240. package/dist/workflow/editor.d.ts +22 -0
  241. package/dist/workflow/editor.d.ts.map +1 -1
  242. package/dist/workflow/index.d.ts +6 -6
  243. package/dist/workflow/index.d.ts.map +1 -1
  244. package/dist/workflow/types.d.ts.map +1 -1
  245. package/dist/workflow.cjs +10310 -9355
  246. package/dist/workflow.cjs.map +1 -1
  247. package/dist/workflow.js +1932 -1963
  248. package/dist/workflow.js.map +1 -1
  249. package/package.json +2 -2
package/dist/monaco.cjs CHANGED
@@ -38,8 +38,8 @@ __export(monaco_exports, {
38
38
  module.exports = __toCommonJS(monaco_exports);
39
39
 
40
40
  // src/components/MonacoEditor/MonacoDiffEditor.tsx
41
- var import_react = require("react");
42
41
  var import_icons = require("@octaviaflow/icons");
42
+ var import_react = require("react");
43
43
 
44
44
  // src/utils/cn.ts
45
45
  var import_clsx = require("clsx");
@@ -147,451 +147,426 @@ function LoadingPlaceholder() {
147
147
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Loading diff\u2026" })
148
148
  ] });
149
149
  }
150
- var MonacoDiffEditor = (0, import_react.forwardRef)(function MonacoDiffEditor2({
151
- original,
152
- modified,
153
- onModifiedChange,
150
+ var MonacoDiffEditor = (0, import_react.forwardRef)(
151
+ function MonacoDiffEditor2({
152
+ original,
153
+ modified,
154
+ onModifiedChange,
155
+ language = "plaintext",
156
+ renderSideBySide = true,
157
+ readOnly = false,
158
+ hideUnchangedRegions = false,
159
+ height = 360,
160
+ minHeight = 200,
161
+ originalLabel = "Original",
162
+ modifiedLabel = "Modified",
163
+ toolbar,
164
+ options,
165
+ onMount,
166
+ className,
167
+ theme,
168
+ hideToolbar = false,
169
+ ...rest
170
+ }, ref) {
171
+ const editorRef = (0, import_react.useRef)(null);
172
+ const monacoRef = (0, import_react.useRef)(null);
173
+ const [sideBySide, setSideBySide] = (0, import_react.useState)(renderSideBySide);
174
+ (0, import_react.useImperativeHandle)(
175
+ ref,
176
+ () => ({
177
+ focus: () => editorRef.current?.getModifiedEditor().focus(),
178
+ getDiffEditor: () => editorRef.current,
179
+ getMonaco: () => monacoRef.current,
180
+ getOriginalValue: () => editorRef.current?.getOriginalEditor().getValue() ?? "",
181
+ getModifiedValue: () => editorRef.current?.getModifiedEditor().getValue() ?? "",
182
+ setModifiedValue: (v) => editorRef.current?.getModifiedEditor().setValue(v)
183
+ }),
184
+ []
185
+ );
186
+ const handleMount = (diffEditor, monaco) => {
187
+ editorRef.current = diffEditor;
188
+ monacoRef.current = monaco;
189
+ monaco.editor.defineTheme(OCTAVIAFLOW_THEME_ID, OCTAVIAFLOW_LIGHT);
190
+ monaco.editor.setTheme(theme ?? OCTAVIAFLOW_THEME_ID);
191
+ const modifiedEditor = diffEditor.getModifiedEditor();
192
+ modifiedEditor.onDidChangeModelContent(() => {
193
+ onModifiedChange?.(modifiedEditor.getValue());
194
+ });
195
+ onMount?.(diffEditor, monaco);
196
+ };
197
+ const mergedOptions = {
198
+ readOnly,
199
+ originalEditable: false,
200
+ renderSideBySide: sideBySide,
201
+ fontFamily: "ui-monospace, SFMono-Regular, 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace",
202
+ fontSize: 13,
203
+ lineHeight: 20,
204
+ automaticLayout: true,
205
+ lineNumbersMinChars: 3,
206
+ lineDecorationsWidth: 6,
207
+ folding: true,
208
+ glyphMargin: false,
209
+ minimap: { enabled: false },
210
+ scrollBeyondLastLine: false,
211
+ smoothScrolling: true,
212
+ renderOverviewRuler: true,
213
+ diffWordWrap: "off",
214
+ padding: { top: 8, bottom: 8 },
215
+ hideUnchangedRegions: {
216
+ enabled: hideUnchangedRegions,
217
+ revealLineCount: 20,
218
+ minimumLineCount: 3,
219
+ contextLineCount: 3
220
+ },
221
+ scrollbar: {
222
+ verticalScrollbarSize: 8,
223
+ horizontalScrollbarSize: 8,
224
+ useShadows: false
225
+ },
226
+ ...options
227
+ };
228
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...rest, className: cn("ods-monaco-diff", `ods-monaco-diff--${language}`, className), children: [
229
+ !hideToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ods-monaco__toolbar", children: [
230
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ods-monaco__toolbar-left", children: [
231
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "ods-monaco__lang", children: [
232
+ "DIFF \xB7 ",
233
+ language.toUpperCase()
234
+ ] }),
235
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "ods-monaco-diff__labels", children: [
236
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco-diff__label ods-monaco-diff__label--orig", children: originalLabel }),
237
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco-diff__arrow", "aria-hidden": "true", children: "\u2192" }),
238
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco-diff__label ods-monaco-diff__label--mod", children: modifiedLabel })
239
+ ] }),
240
+ toolbar
241
+ ] }),
242
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ods-monaco__toolbar-right", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
243
+ "button",
244
+ {
245
+ type: "button",
246
+ className: cn("ods-monaco__btn", sideBySide && "ods-monaco__btn--active"),
247
+ onClick: () => setSideBySide((s) => !s),
248
+ "aria-pressed": sideBySide,
249
+ "aria-label": sideBySide ? "Switch to inline diff" : "Switch to side-by-side",
250
+ title: sideBySide ? "Inline" : "Side-by-side",
251
+ children: sideBySide ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SplitIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SquareOutlineIcon, {})
252
+ }
253
+ ) })
254
+ ] }),
255
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ods-monaco__body", style: { minHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingPlaceholder, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
256
+ DiffEditor,
257
+ {
258
+ original,
259
+ modified,
260
+ language,
261
+ height,
262
+ theme: theme ?? OCTAVIAFLOW_THEME_ID,
263
+ options: mergedOptions,
264
+ onMount: handleMount,
265
+ loading: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingPlaceholder, {})
266
+ }
267
+ ) }) })
268
+ ] });
269
+ }
270
+ );
271
+ MonacoDiffEditor.displayName = "MonacoDiffEditor";
272
+
273
+ // src/components/MonacoEditor/MonacoEditor.tsx
274
+ var import_icons2 = require("@octaviaflow/icons");
275
+ var import_react2 = require("react");
276
+ var import_jsx_runtime2 = require("react/jsx-runtime");
277
+ var Editor = (0, import_react2.lazy)(() => import("@monaco-editor/react").then((mod) => ({ default: mod.Editor })));
278
+ var MARKER_SEVERITY = {
279
+ hint: 1,
280
+ info: 2,
281
+ warning: 4,
282
+ error: 8
283
+ };
284
+ function LoadingPlaceholder2({ label }) {
285
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__loading", children: [
286
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.RenewIcon, {}) }),
287
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: label })
288
+ ] });
289
+ }
290
+ var MonacoEditor = (0, import_react2.forwardRef)(function MonacoEditor2({
291
+ value,
292
+ onChange,
154
293
  language = "plaintext",
155
- renderSideBySide = true,
156
294
  readOnly = false,
157
- hideUnchangedRegions = false,
158
- height = 360,
159
- minHeight = 200,
160
- originalLabel = "Original",
161
- modifiedLabel = "Modified",
295
+ height = 320,
296
+ minHeight = 120,
162
297
  toolbar,
298
+ status,
299
+ hideToolbar = false,
300
+ hideFooter = false,
301
+ showCopy = true,
302
+ showFormat = true,
303
+ showWordWrapToggle = true,
304
+ showMinimapToggle = true,
305
+ wordWrap: wordWrapProp,
306
+ minimap: minimapProp,
307
+ showLineNumbers = true,
308
+ markers,
163
309
  options,
164
310
  onMount,
311
+ onCopy,
312
+ copySuccessTimeoutMs = 1200,
165
313
  className,
314
+ ariaLabel = "Code editor",
166
315
  theme,
167
- hideToolbar = false,
168
316
  ...rest
169
317
  }, ref) {
170
- const editorRef = (0, import_react.useRef)(null);
171
- const monacoRef = (0, import_react.useRef)(null);
172
- const [sideBySide, setSideBySide] = (0, import_react.useState)(renderSideBySide);
173
- (0, import_react.useImperativeHandle)(
318
+ const editorRef = (0, import_react2.useRef)(null);
319
+ const monacoRef = (0, import_react2.useRef)(null);
320
+ const [wordWrap, setWordWrap] = (0, import_react2.useState)(wordWrapProp ?? false);
321
+ const [minimap, setMinimap] = (0, import_react2.useState)(minimapProp ?? false);
322
+ const [copied, setCopied] = (0, import_react2.useState)(false);
323
+ const [cursor, setCursor] = (0, import_react2.useState)({ line: 1, column: 1 });
324
+ const [selection, setSelection] = (0, import_react2.useState)({ chars: 0, lines: 0 });
325
+ const [lineCount, setLineCount] = (0, import_react2.useState)(value.split("\n").length);
326
+ (0, import_react2.useImperativeHandle)(
174
327
  ref,
175
328
  () => ({
176
- focus: () => editorRef.current?.getModifiedEditor().focus(),
177
- getDiffEditor: () => editorRef.current,
329
+ focus: () => editorRef.current?.focus(),
330
+ getEditor: () => editorRef.current,
178
331
  getMonaco: () => monacoRef.current,
179
- getOriginalValue: () => editorRef.current?.getOriginalEditor().getValue() ?? "",
180
- getModifiedValue: () => editorRef.current?.getModifiedEditor().getValue() ?? "",
181
- setModifiedValue: (v) => editorRef.current?.getModifiedEditor().setValue(v)
332
+ getValue: () => editorRef.current?.getValue() ?? "",
333
+ setValue: (v) => editorRef.current?.setValue(v),
334
+ format: () => editorRef.current?.getAction("editor.action.formatDocument")?.run()
182
335
  }),
183
336
  []
184
337
  );
185
- const handleMount = (diffEditor, monaco) => {
186
- editorRef.current = diffEditor;
187
- monacoRef.current = monaco;
188
- monaco.editor.defineTheme(OCTAVIAFLOW_THEME_ID, OCTAVIAFLOW_LIGHT);
189
- monaco.editor.setTheme(theme ?? OCTAVIAFLOW_THEME_ID);
190
- const modifiedEditor = diffEditor.getModifiedEditor();
191
- modifiedEditor.onDidChangeModelContent(() => {
192
- onModifiedChange?.(modifiedEditor.getValue());
338
+ (0, import_react2.useEffect)(() => {
339
+ if (wordWrapProp !== void 0) setWordWrap(wordWrapProp);
340
+ }, [wordWrapProp]);
341
+ (0, import_react2.useEffect)(() => {
342
+ if (minimapProp !== void 0) setMinimap(minimapProp);
343
+ }, [minimapProp]);
344
+ (0, import_react2.useEffect)(() => {
345
+ editorRef.current?.updateOptions({
346
+ wordWrap: wordWrap ? "on" : "off",
347
+ minimap: { enabled: minimap }
193
348
  });
194
- onMount?.(diffEditor, monaco);
349
+ }, [wordWrap, minimap]);
350
+ (0, import_react2.useEffect)(() => {
351
+ const ed = editorRef.current;
352
+ const monaco = monacoRef.current;
353
+ if (!ed || !monaco || !markers) return;
354
+ const model = ed.getModel();
355
+ if (!model) return;
356
+ monaco.editor.setModelMarkers(
357
+ model,
358
+ "octaviaflow",
359
+ markers.map((m) => ({
360
+ severity: MARKER_SEVERITY[m.severity ?? "error"],
361
+ message: m.message,
362
+ startLineNumber: m.line,
363
+ startColumn: m.column ?? 1,
364
+ endLineNumber: m.endLine ?? m.line,
365
+ endColumn: m.endColumn ?? (m.column ?? 1) + 1,
366
+ source: m.source
367
+ }))
368
+ );
369
+ }, [markers]);
370
+ const handleMount = (0, import_react2.useCallback)(
371
+ (ed, monaco) => {
372
+ editorRef.current = ed;
373
+ monacoRef.current = monaco;
374
+ monaco.editor.defineTheme(OCTAVIAFLOW_THEME_ID, OCTAVIAFLOW_LIGHT);
375
+ monaco.editor.setTheme(theme ?? OCTAVIAFLOW_THEME_ID);
376
+ ed.onDidChangeCursorPosition((e) => {
377
+ setCursor({ line: e.position.lineNumber, column: e.position.column });
378
+ });
379
+ ed.onDidChangeCursorSelection((e) => {
380
+ const sel = e.selection;
381
+ if (sel.isEmpty()) {
382
+ setSelection({ chars: 0, lines: 0 });
383
+ return;
384
+ }
385
+ const model2 = ed.getModel();
386
+ if (!model2) return;
387
+ const text = model2.getValueInRange(sel);
388
+ setSelection({
389
+ chars: text.length,
390
+ lines: text.split("\n").length
391
+ });
392
+ });
393
+ const model = ed.getModel();
394
+ if (model) {
395
+ setLineCount(model.getLineCount());
396
+ model.onDidChangeContent(() => setLineCount(model.getLineCount()));
397
+ }
398
+ onMount?.(ed, monaco);
399
+ },
400
+ [onMount, theme]
401
+ );
402
+ const handleCopy = async () => {
403
+ if (typeof navigator === "undefined") return;
404
+ try {
405
+ await navigator.clipboard.writeText(value);
406
+ setCopied(true);
407
+ onCopy?.(value);
408
+ setTimeout(() => setCopied(false), copySuccessTimeoutMs);
409
+ } catch {
410
+ }
411
+ };
412
+ const handleFormat = () => {
413
+ editorRef.current?.getAction("editor.action.formatDocument")?.run();
195
414
  };
196
415
  const mergedOptions = {
197
416
  readOnly,
198
- originalEditable: false,
199
- renderSideBySide: sideBySide,
200
417
  fontFamily: "ui-monospace, SFMono-Regular, 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace",
201
418
  fontSize: 13,
419
+ fontLigatures: true,
202
420
  lineHeight: 20,
203
- automaticLayout: true,
421
+ lineNumbers: showLineNumbers ? "on" : "off",
204
422
  lineNumbersMinChars: 3,
205
423
  lineDecorationsWidth: 6,
206
424
  folding: true,
207
425
  glyphMargin: false,
208
- minimap: { enabled: false },
426
+ minimap: { enabled: minimap },
427
+ wordWrap: wordWrap ? "on" : "off",
209
428
  scrollBeyondLastLine: false,
210
429
  smoothScrolling: true,
211
- renderOverviewRuler: true,
212
- diffWordWrap: "off",
430
+ cursorBlinking: "smooth",
431
+ cursorSmoothCaretAnimation: "on",
432
+ renderLineHighlight: "line",
213
433
  padding: { top: 8, bottom: 8 },
214
- hideUnchangedRegions: {
215
- enabled: hideUnchangedRegions,
216
- revealLineCount: 20,
217
- minimumLineCount: 3,
218
- contextLineCount: 3
219
- },
434
+ bracketPairColorization: { enabled: true },
435
+ guides: { bracketPairs: true, indentation: true },
436
+ automaticLayout: true,
437
+ tabSize: 2,
438
+ insertSpaces: true,
220
439
  scrollbar: {
221
440
  verticalScrollbarSize: 8,
222
441
  horizontalScrollbarSize: 8,
223
442
  useShadows: false
224
443
  },
444
+ fixedOverflowWidgets: true,
445
+ contextmenu: true,
446
+ suggestOnTriggerCharacters: true,
447
+ quickSuggestions: { other: true, comments: false, strings: false },
448
+ formatOnPaste: false,
449
+ formatOnType: false,
450
+ "semanticHighlighting.enabled": true,
225
451
  ...options
226
452
  };
227
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
453
+ const showWrapBtn = showWordWrapToggle && wordWrapProp === void 0;
454
+ const showMinimapBtn = showMinimapToggle && minimapProp === void 0;
455
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
228
456
  "div",
229
457
  {
230
458
  ...rest,
231
459
  className: cn(
232
- "ods-monaco-diff",
233
- `ods-monaco-diff--${language}`,
460
+ "ods-monaco",
461
+ `ods-monaco--${language}`,
462
+ readOnly && "ods-monaco--readonly",
234
463
  className
235
464
  ),
236
465
  children: [
237
- !hideToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ods-monaco__toolbar", children: [
238
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ods-monaco__toolbar-left", children: [
239
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "ods-monaco__lang", children: [
240
- "DIFF \xB7 ",
241
- language.toUpperCase()
242
- ] }),
243
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "ods-monaco-diff__labels", children: [
244
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco-diff__label ods-monaco-diff__label--orig", children: originalLabel }),
245
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco-diff__arrow", "aria-hidden": "true", children: "\u2192" }),
246
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ods-monaco-diff__label ods-monaco-diff__label--mod", children: modifiedLabel })
247
- ] }),
466
+ !hideToolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar", children: [
467
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar-left", children: [
468
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__lang", children: language.toUpperCase() }),
248
469
  toolbar
249
470
  ] }),
250
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ods-monaco__toolbar-right", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
251
- "button",
252
- {
253
- type: "button",
254
- className: cn(
255
- "ods-monaco__btn",
256
- sideBySide && "ods-monaco__btn--active"
257
- ),
258
- onClick: () => setSideBySide((s) => !s),
259
- "aria-pressed": sideBySide,
260
- "aria-label": sideBySide ? "Switch to inline diff" : "Switch to side-by-side",
261
- title: sideBySide ? "Inline" : "Side-by-side",
262
- children: sideBySide ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SplitIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SquareOutlineIcon, {})
263
- }
264
- ) })
471
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar-right", children: [
472
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__lines", children: [
473
+ lineCount,
474
+ " line",
475
+ lineCount === 1 ? "" : "s"
476
+ ] }),
477
+ status && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__status", children: status }),
478
+ showWrapBtn && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
479
+ "button",
480
+ {
481
+ type: "button",
482
+ className: cn("ods-monaco__btn", wordWrap && "ods-monaco__btn--active"),
483
+ onClick: () => setWordWrap((w) => !w),
484
+ "aria-pressed": wordWrap,
485
+ "aria-label": "Toggle word wrap",
486
+ title: "Word wrap",
487
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.TextWrapIcon, {})
488
+ }
489
+ ),
490
+ showMinimapBtn && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
491
+ "button",
492
+ {
493
+ type: "button",
494
+ className: cn("ods-monaco__btn", minimap && "ods-monaco__btn--active"),
495
+ onClick: () => setMinimap((m) => !m),
496
+ "aria-pressed": minimap,
497
+ "aria-label": "Toggle minimap",
498
+ title: "Minimap",
499
+ children: minimap ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.MinimapOnIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.MinimapOffIcon, {})
500
+ }
501
+ ),
502
+ showFormat && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
503
+ "button",
504
+ {
505
+ type: "button",
506
+ className: "ods-monaco__btn",
507
+ onClick: handleFormat,
508
+ "aria-label": "Format document",
509
+ title: "Format (Shift+Alt+F)",
510
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.MagicWandIcon, {})
511
+ }
512
+ ),
513
+ showCopy && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
514
+ "button",
515
+ {
516
+ type: "button",
517
+ className: cn("ods-monaco__btn", copied && "ods-monaco__btn--success"),
518
+ onClick: handleCopy,
519
+ "aria-label": copied ? "Copied" : "Copy",
520
+ title: copied ? "Copied" : "Copy",
521
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.CheckmarkIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.CopyIcon, {})
522
+ }
523
+ )
524
+ ] })
265
525
  ] }),
266
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ods-monaco__body", style: { minHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingPlaceholder, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
267
- DiffEditor,
526
+ /* @__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.jsx)(LoadingPlaceholder2, { label: "Loading editor\u2026" }), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
527
+ Editor,
268
528
  {
269
- original,
270
- modified,
529
+ value,
530
+ onChange: (v) => onChange?.(v ?? ""),
271
531
  language,
272
532
  height,
273
533
  theme: theme ?? OCTAVIAFLOW_THEME_ID,
274
534
  options: mergedOptions,
275
535
  onMount: handleMount,
276
- loading: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingPlaceholder, {})
536
+ loading: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingPlaceholder2, { label: "Loading editor\u2026" }),
537
+ "aria-label": ariaLabel
277
538
  }
278
- ) }) })
539
+ ) }) }),
540
+ !hideFooter && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__footer", children: [
541
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__pos", children: [
542
+ "Ln ",
543
+ cursor.line,
544
+ ", Col ",
545
+ cursor.column,
546
+ selection.chars > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
547
+ " ",
548
+ "\xB7 ",
549
+ selection.chars,
550
+ " char",
551
+ selection.chars === 1 ? "" : "s",
552
+ selection.lines > 1 && ` \xB7 ${selection.lines} lines`
553
+ ] })
554
+ ] }),
555
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__shortcut-hint", children: [
556
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: "ods-monaco__kbd", children: "\u2318F" }),
557
+ " find",
558
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__sep", children: "\xB7" }),
559
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: "ods-monaco__kbd", children: "\u2318\u21E7F" }),
560
+ " replace",
561
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__sep", children: "\xB7" }),
562
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: "ods-monaco__kbd", children: "F1" }),
563
+ " commands"
564
+ ] })
565
+ ] })
279
566
  ]
280
567
  }
281
568
  );
282
569
  });
283
- MonacoDiffEditor.displayName = "MonacoDiffEditor";
284
-
285
- // src/components/MonacoEditor/MonacoEditor.tsx
286
- var import_react2 = require("react");
287
- var import_icons2 = require("@octaviaflow/icons");
288
- var import_jsx_runtime2 = require("react/jsx-runtime");
289
- var Editor = (0, import_react2.lazy)(
290
- () => import("@monaco-editor/react").then((mod) => ({ default: mod.Editor }))
291
- );
292
- var MARKER_SEVERITY = {
293
- hint: 1,
294
- info: 2,
295
- warning: 4,
296
- error: 8
297
- };
298
- function LoadingPlaceholder2({ label }) {
299
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__loading", children: [
300
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.RenewIcon, {}) }),
301
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: label })
302
- ] });
303
- }
304
- var MonacoEditor = (0, import_react2.forwardRef)(
305
- function MonacoEditor2({
306
- value,
307
- onChange,
308
- language = "plaintext",
309
- readOnly = false,
310
- height = 320,
311
- minHeight = 120,
312
- toolbar,
313
- status,
314
- hideToolbar = false,
315
- hideFooter = false,
316
- showCopy = true,
317
- showFormat = true,
318
- showWordWrapToggle = true,
319
- showMinimapToggle = true,
320
- wordWrap: wordWrapProp,
321
- minimap: minimapProp,
322
- showLineNumbers = true,
323
- markers,
324
- options,
325
- onMount,
326
- onCopy,
327
- copySuccessTimeoutMs = 1200,
328
- className,
329
- ariaLabel = "Code editor",
330
- theme,
331
- ...rest
332
- }, ref) {
333
- const editorRef = (0, import_react2.useRef)(null);
334
- const monacoRef = (0, import_react2.useRef)(null);
335
- const [wordWrap, setWordWrap] = (0, import_react2.useState)(wordWrapProp ?? false);
336
- const [minimap, setMinimap] = (0, import_react2.useState)(minimapProp ?? false);
337
- const [copied, setCopied] = (0, import_react2.useState)(false);
338
- const [cursor, setCursor] = (0, import_react2.useState)({ line: 1, column: 1 });
339
- const [selection, setSelection] = (0, import_react2.useState)({ chars: 0, lines: 0 });
340
- const [lineCount, setLineCount] = (0, import_react2.useState)(value.split("\n").length);
341
- (0, import_react2.useImperativeHandle)(
342
- ref,
343
- () => ({
344
- focus: () => editorRef.current?.focus(),
345
- getEditor: () => editorRef.current,
346
- getMonaco: () => monacoRef.current,
347
- getValue: () => editorRef.current?.getValue() ?? "",
348
- setValue: (v) => editorRef.current?.setValue(v),
349
- format: () => editorRef.current?.getAction("editor.action.formatDocument")?.run()
350
- }),
351
- []
352
- );
353
- (0, import_react2.useEffect)(() => {
354
- if (wordWrapProp !== void 0) setWordWrap(wordWrapProp);
355
- }, [wordWrapProp]);
356
- (0, import_react2.useEffect)(() => {
357
- if (minimapProp !== void 0) setMinimap(minimapProp);
358
- }, [minimapProp]);
359
- (0, import_react2.useEffect)(() => {
360
- editorRef.current?.updateOptions({
361
- wordWrap: wordWrap ? "on" : "off",
362
- minimap: { enabled: minimap }
363
- });
364
- }, [wordWrap, minimap]);
365
- (0, import_react2.useEffect)(() => {
366
- const ed = editorRef.current;
367
- const monaco = monacoRef.current;
368
- if (!ed || !monaco || !markers) return;
369
- const model = ed.getModel();
370
- if (!model) return;
371
- monaco.editor.setModelMarkers(
372
- model,
373
- "octaviaflow",
374
- markers.map((m) => ({
375
- severity: MARKER_SEVERITY[m.severity ?? "error"],
376
- message: m.message,
377
- startLineNumber: m.line,
378
- startColumn: m.column ?? 1,
379
- endLineNumber: m.endLine ?? m.line,
380
- endColumn: m.endColumn ?? (m.column ?? 1) + 1,
381
- source: m.source
382
- }))
383
- );
384
- }, [markers]);
385
- const handleMount = (0, import_react2.useCallback)(
386
- (ed, monaco) => {
387
- editorRef.current = ed;
388
- monacoRef.current = monaco;
389
- monaco.editor.defineTheme(OCTAVIAFLOW_THEME_ID, OCTAVIAFLOW_LIGHT);
390
- monaco.editor.setTheme(theme ?? OCTAVIAFLOW_THEME_ID);
391
- ed.onDidChangeCursorPosition((e) => {
392
- setCursor({ line: e.position.lineNumber, column: e.position.column });
393
- });
394
- ed.onDidChangeCursorSelection((e) => {
395
- const sel = e.selection;
396
- if (sel.isEmpty()) {
397
- setSelection({ chars: 0, lines: 0 });
398
- return;
399
- }
400
- const model2 = ed.getModel();
401
- if (!model2) return;
402
- const text = model2.getValueInRange(sel);
403
- setSelection({
404
- chars: text.length,
405
- lines: text.split("\n").length
406
- });
407
- });
408
- const model = ed.getModel();
409
- if (model) {
410
- setLineCount(model.getLineCount());
411
- model.onDidChangeContent(() => setLineCount(model.getLineCount()));
412
- }
413
- onMount?.(ed, monaco);
414
- },
415
- [onMount, theme]
416
- );
417
- const handleCopy = async () => {
418
- if (typeof navigator === "undefined") return;
419
- try {
420
- await navigator.clipboard.writeText(value);
421
- setCopied(true);
422
- onCopy?.(value);
423
- setTimeout(() => setCopied(false), copySuccessTimeoutMs);
424
- } catch {
425
- }
426
- };
427
- const handleFormat = () => {
428
- editorRef.current?.getAction("editor.action.formatDocument")?.run();
429
- };
430
- const mergedOptions = {
431
- readOnly,
432
- fontFamily: "ui-monospace, SFMono-Regular, 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace",
433
- fontSize: 13,
434
- fontLigatures: true,
435
- lineHeight: 20,
436
- lineNumbers: showLineNumbers ? "on" : "off",
437
- lineNumbersMinChars: 3,
438
- lineDecorationsWidth: 6,
439
- folding: true,
440
- glyphMargin: false,
441
- minimap: { enabled: minimap },
442
- wordWrap: wordWrap ? "on" : "off",
443
- scrollBeyondLastLine: false,
444
- smoothScrolling: true,
445
- cursorBlinking: "smooth",
446
- cursorSmoothCaretAnimation: "on",
447
- renderLineHighlight: "line",
448
- padding: { top: 8, bottom: 8 },
449
- bracketPairColorization: { enabled: true },
450
- guides: { bracketPairs: true, indentation: true },
451
- automaticLayout: true,
452
- tabSize: 2,
453
- insertSpaces: true,
454
- scrollbar: {
455
- verticalScrollbarSize: 8,
456
- horizontalScrollbarSize: 8,
457
- useShadows: false
458
- },
459
- fixedOverflowWidgets: true,
460
- contextmenu: true,
461
- suggestOnTriggerCharacters: true,
462
- quickSuggestions: { other: true, comments: false, strings: false },
463
- formatOnPaste: false,
464
- formatOnType: false,
465
- "semanticHighlighting.enabled": true,
466
- ...options
467
- };
468
- const showWrapBtn = showWordWrapToggle && wordWrapProp === void 0;
469
- const showMinimapBtn = showMinimapToggle && minimapProp === void 0;
470
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
471
- "div",
472
- {
473
- ...rest,
474
- className: cn(
475
- "ods-monaco",
476
- `ods-monaco--${language}`,
477
- readOnly && "ods-monaco--readonly",
478
- className
479
- ),
480
- children: [
481
- !hideToolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar", children: [
482
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar-left", children: [
483
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__lang", children: language.toUpperCase() }),
484
- toolbar
485
- ] }),
486
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__toolbar-right", children: [
487
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__lines", children: [
488
- lineCount,
489
- " line",
490
- lineCount === 1 ? "" : "s"
491
- ] }),
492
- status && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__status", children: status }),
493
- showWrapBtn && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
494
- "button",
495
- {
496
- type: "button",
497
- className: cn(
498
- "ods-monaco__btn",
499
- wordWrap && "ods-monaco__btn--active"
500
- ),
501
- onClick: () => setWordWrap((w) => !w),
502
- "aria-pressed": wordWrap,
503
- "aria-label": "Toggle word wrap",
504
- title: "Word wrap",
505
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.TextWrapIcon, {})
506
- }
507
- ),
508
- showMinimapBtn && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
509
- "button",
510
- {
511
- type: "button",
512
- className: cn(
513
- "ods-monaco__btn",
514
- minimap && "ods-monaco__btn--active"
515
- ),
516
- onClick: () => setMinimap((m) => !m),
517
- "aria-pressed": minimap,
518
- "aria-label": "Toggle minimap",
519
- title: "Minimap",
520
- children: minimap ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.MinimapOnIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.MinimapOffIcon, {})
521
- }
522
- ),
523
- showFormat && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
524
- "button",
525
- {
526
- type: "button",
527
- className: "ods-monaco__btn",
528
- onClick: handleFormat,
529
- "aria-label": "Format document",
530
- title: "Format (Shift+Alt+F)",
531
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.MagicWandIcon, {})
532
- }
533
- ),
534
- showCopy && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
535
- "button",
536
- {
537
- type: "button",
538
- className: cn(
539
- "ods-monaco__btn",
540
- copied && "ods-monaco__btn--success"
541
- ),
542
- onClick: handleCopy,
543
- "aria-label": copied ? "Copied" : "Copy",
544
- title: copied ? "Copied" : "Copy",
545
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.CheckmarkIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.CopyIcon, {})
546
- }
547
- )
548
- ] })
549
- ] }),
550
- /* @__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.jsx)(LoadingPlaceholder2, { label: "Loading editor\u2026" }), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
551
- Editor,
552
- {
553
- value,
554
- onChange: (v) => onChange?.(v ?? ""),
555
- language,
556
- height,
557
- theme: theme ?? OCTAVIAFLOW_THEME_ID,
558
- options: mergedOptions,
559
- onMount: handleMount,
560
- loading: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingPlaceholder2, { label: "Loading editor\u2026" }),
561
- "aria-label": ariaLabel
562
- }
563
- ) }) }),
564
- !hideFooter && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ods-monaco__footer", children: [
565
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__pos", children: [
566
- "Ln ",
567
- cursor.line,
568
- ", Col ",
569
- cursor.column,
570
- selection.chars > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
571
- " ",
572
- "\xB7 ",
573
- selection.chars,
574
- " char",
575
- selection.chars === 1 ? "" : "s",
576
- selection.lines > 1 && ` \xB7 ${selection.lines} lines`
577
- ] })
578
- ] }),
579
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "ods-monaco__shortcut-hint", children: [
580
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: "ods-monaco__kbd", children: "\u2318F" }),
581
- " find",
582
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__sep", children: "\xB7" }),
583
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: "ods-monaco__kbd", children: "\u2318\u21E7F" }),
584
- " replace",
585
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ods-monaco__sep", children: "\xB7" }),
586
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { className: "ods-monaco__kbd", children: "F1" }),
587
- " commands"
588
- ] })
589
- ] })
590
- ]
591
- }
592
- );
593
- }
594
- );
595
570
  MonacoEditor.displayName = "MonacoEditor";
596
571
  // Annotate the CommonJS export names for ESM import in node:
597
572
  0 && (module.exports = {