2026-06-10 23:45:01 +00:00
|
|
|
<script setup lang="ts">
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
import { autocompletion } from '@codemirror/autocomplete';
|
2026-06-10 23:45:01 +00:00
|
|
|
import { indentWithTab } from '@codemirror/commands';
|
|
|
|
|
import { json } from '@codemirror/lang-json';
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
import { type Extension, EditorState } from '@codemirror/state';
|
2026-06-12 20:09:39 +00:00
|
|
|
import {
|
|
|
|
|
Decoration,
|
|
|
|
|
type DecorationSet,
|
|
|
|
|
EditorView,
|
|
|
|
|
keymap,
|
|
|
|
|
MatchDecorator,
|
|
|
|
|
placeholder as placeholderExt,
|
|
|
|
|
ViewPlugin,
|
|
|
|
|
type ViewUpdate,
|
|
|
|
|
} from '@codemirror/view';
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
import { IconArrowsMaximize, IconArrowsMinimize, IconCopy } from '@tabler/icons-vue';
|
2026-06-10 23:45:01 +00:00
|
|
|
import { basicSetup } from 'codemirror';
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
import { computed, inject, onBeforeUnmount, onMounted, type Ref, ref, watch } from 'vue';
|
2026-06-10 23:45:01 +00:00
|
|
|
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
|
import {
|
|
|
|
|
Tooltip,
|
|
|
|
|
TooltipContent,
|
|
|
|
|
TooltipProvider,
|
|
|
|
|
TooltipTrigger,
|
|
|
|
|
} from '@/components/ui/tooltip';
|
|
|
|
|
import {
|
|
|
|
|
type ExpressionSuggestion,
|
|
|
|
|
expressionCompletionSource,
|
2026-06-12 20:09:39 +00:00
|
|
|
isKnownExpression,
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
} from '@/composables/useExpressionCompletions';
|
2026-06-10 23:45:01 +00:00
|
|
|
import debounce from '@/debounce';
|
2026-06-11 18:47:29 +00:00
|
|
|
import { copyToClipboard } from '@/lib/utils';
|
2026-06-10 23:45:01 +00:00
|
|
|
|
|
|
|
|
const props = withDefaults(
|
|
|
|
|
defineProps<{
|
|
|
|
|
modelValue: string;
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
language?: 'json' | 'text';
|
2026-06-10 23:45:01 +00:00
|
|
|
readOnly?: boolean;
|
|
|
|
|
placeholder?: string;
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
expandable?: boolean;
|
|
|
|
|
label?: string;
|
2026-06-10 23:45:01 +00:00
|
|
|
}>(),
|
|
|
|
|
{
|
|
|
|
|
language: 'json',
|
|
|
|
|
readOnly: false,
|
|
|
|
|
placeholder: '',
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
expandable: false,
|
|
|
|
|
label: '',
|
2026-06-10 23:45:01 +00:00
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
'update:modelValue': [value: string];
|
|
|
|
|
}>();
|
|
|
|
|
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
// Provided by the automation editor (Form.vue) for the currently selected node.
|
|
|
|
|
// Empty elsewhere, so the editor degrades to a plain field with no `{{ ... }}`
|
|
|
|
|
// suggestions.
|
|
|
|
|
const expressionCompletions = inject<Ref<ExpressionSuggestion[]>>(
|
|
|
|
|
'automationExpressionCompletions',
|
|
|
|
|
ref([]),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Shared with Form.vue: toggling `.active` slides out the side panel (and shifts
|
|
|
|
|
// the sidebar to make room). Null outside the automation editor, so `expandable`
|
|
|
|
|
// only takes effect where Form provides the panel target.
|
|
|
|
|
const expandedPanel = inject<{ active: boolean } | null>('automationExpandedEditor', null);
|
|
|
|
|
|
|
|
|
|
const isExpanded = ref(false);
|
|
|
|
|
const canExpand = computed(() => props.expandable && expandedPanel !== null);
|
|
|
|
|
|
|
|
|
|
watch(isExpanded, (open) => {
|
|
|
|
|
if (expandedPanel) {
|
|
|
|
|
expandedPanel.active = open;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const onKeydown = (event: KeyboardEvent): void => {
|
|
|
|
|
if (event.key === 'Escape' && isExpanded.value) {
|
|
|
|
|
isExpanded.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-06-12 20:09:39 +00:00
|
|
|
// Paints `{{ ... }}` expressions as pills — primary-tinted when the path is
|
|
|
|
|
// resolvable for this node, amber/wavy when it isn't — so they read as
|
|
|
|
|
// variables and a wrong reference is obvious. Styles are inline on the mark so
|
|
|
|
|
// they win over the editor theme and JSON string-token colors.
|
|
|
|
|
const KNOWN_EXPR_STYLE =
|
|
|
|
|
'background-color:color-mix(in srgb,var(--primary) 16%,transparent);color:var(--primary);border-radius:4px;padding:1px 3px;font-weight:600;';
|
|
|
|
|
const UNKNOWN_EXPR_STYLE =
|
|
|
|
|
'background-color:color-mix(in srgb,#f59e0b 18%,transparent);color:#b45309;border-radius:4px;padding:1px 3px;font-weight:600;text-decoration:underline wavy #f59e0b;';
|
|
|
|
|
|
|
|
|
|
const expressionHighlighter = (() => {
|
|
|
|
|
const matcher = new MatchDecorator({
|
|
|
|
|
regexp: /\{\{\s*([\w.]+)\s*\}\}/g,
|
|
|
|
|
decoration: (match) =>
|
|
|
|
|
Decoration.mark({
|
|
|
|
|
attributes: {
|
|
|
|
|
style: isKnownExpression(match[1], expressionCompletions.value)
|
|
|
|
|
? KNOWN_EXPR_STYLE
|
|
|
|
|
: UNKNOWN_EXPR_STYLE,
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return ViewPlugin.fromClass(
|
|
|
|
|
class {
|
|
|
|
|
decorations: DecorationSet;
|
|
|
|
|
|
|
|
|
|
constructor(view: EditorView) {
|
|
|
|
|
this.decorations = matcher.createDeco(view);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update(update: ViewUpdate) {
|
|
|
|
|
this.decorations = matcher.updateDeco(update, this.decorations);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ decorations: (plugin) => plugin.decorations },
|
|
|
|
|
);
|
|
|
|
|
})();
|
|
|
|
|
|
2026-06-10 23:45:01 +00:00
|
|
|
const editorContainer = ref<HTMLElement>();
|
|
|
|
|
let view: EditorView | null = null;
|
|
|
|
|
|
|
|
|
|
const debouncedEmit = debounce((value: string) => {
|
|
|
|
|
emit('update:modelValue', value);
|
|
|
|
|
}, 250);
|
|
|
|
|
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
const languageExtension = (): Extension => {
|
2026-06-10 23:45:01 +00:00
|
|
|
switch (props.language) {
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
case 'text':
|
|
|
|
|
return [];
|
2026-06-10 23:45:01 +00:00
|
|
|
case 'json':
|
|
|
|
|
default:
|
|
|
|
|
return json();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const lightTheme = EditorView.theme({
|
|
|
|
|
'&': {
|
|
|
|
|
height: '100%',
|
|
|
|
|
fontSize: '13px',
|
|
|
|
|
color: 'var(--foreground)',
|
|
|
|
|
backgroundColor: 'var(--card)',
|
|
|
|
|
border: '2px solid var(--foreground)',
|
|
|
|
|
borderRadius: 'var(--radius-md)',
|
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
},
|
|
|
|
|
'&.cm-focused': {
|
|
|
|
|
outline: '2px solid var(--ring)',
|
|
|
|
|
outlineOffset: '0px',
|
|
|
|
|
},
|
|
|
|
|
'.cm-scroller': {
|
|
|
|
|
overflow: 'auto',
|
|
|
|
|
fontFamily: 'var(--font-mono)',
|
|
|
|
|
lineHeight: '1.6',
|
|
|
|
|
},
|
|
|
|
|
'.cm-content': {
|
|
|
|
|
caretColor: 'var(--foreground)',
|
|
|
|
|
padding: '8px 0',
|
|
|
|
|
},
|
|
|
|
|
'.cm-gutters': {
|
|
|
|
|
backgroundColor: 'var(--muted)',
|
|
|
|
|
color: 'var(--muted-foreground)',
|
|
|
|
|
border: 'none',
|
|
|
|
|
borderRight: '2px solid color-mix(in srgb, var(--foreground) 15%, transparent)',
|
|
|
|
|
},
|
|
|
|
|
'.cm-activeLine': {
|
|
|
|
|
backgroundColor: 'color-mix(in srgb, var(--foreground) 4%, transparent)',
|
|
|
|
|
},
|
|
|
|
|
'.cm-activeLineGutter': {
|
|
|
|
|
backgroundColor: 'color-mix(in srgb, var(--foreground) 8%, transparent)',
|
|
|
|
|
},
|
|
|
|
|
'.cm-selectionBackground, &.cm-focused .cm-selectionBackground, .cm-content ::selection':
|
|
|
|
|
{
|
|
|
|
|
backgroundColor: 'color-mix(in srgb, var(--ring) 20%, transparent)',
|
|
|
|
|
},
|
|
|
|
|
'.cm-cursor, .cm-dropCursor': {
|
|
|
|
|
borderLeftColor: 'var(--foreground)',
|
|
|
|
|
},
|
|
|
|
|
'.cm-placeholder': {
|
|
|
|
|
color: 'var(--muted-foreground)',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
if (!editorContainer.value) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const updateListener = EditorView.updateListener.of((update) => {
|
|
|
|
|
if (update.docChanged) {
|
|
|
|
|
debouncedEmit(update.state.doc.toString());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const extensions = [
|
|
|
|
|
basicSetup,
|
|
|
|
|
keymap.of([indentWithTab]),
|
|
|
|
|
languageExtension(),
|
|
|
|
|
EditorView.lineWrapping,
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
autocompletion({
|
|
|
|
|
override: [expressionCompletionSource(() => expressionCompletions.value)],
|
|
|
|
|
activateOnTyping: true,
|
|
|
|
|
icons: false,
|
|
|
|
|
}),
|
2026-06-12 20:09:39 +00:00
|
|
|
expressionHighlighter,
|
2026-06-10 23:45:01 +00:00
|
|
|
lightTheme,
|
|
|
|
|
updateListener,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (props.placeholder) {
|
|
|
|
|
extensions.push(placeholderExt(props.placeholder));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (props.readOnly) {
|
|
|
|
|
extensions.push(EditorState.readOnly.of(true));
|
|
|
|
|
extensions.push(EditorView.editable.of(false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
view = new EditorView({
|
|
|
|
|
state: EditorState.create({
|
|
|
|
|
doc: props.modelValue ?? '',
|
|
|
|
|
extensions,
|
|
|
|
|
}),
|
|
|
|
|
parent: editorContainer.value,
|
|
|
|
|
});
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
|
|
|
|
|
if (props.expandable) {
|
|
|
|
|
window.addEventListener('keydown', onKeydown);
|
|
|
|
|
}
|
2026-06-10 23:45:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => props.modelValue,
|
|
|
|
|
(value) => {
|
|
|
|
|
if (!view) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const current = view.state.doc.toString();
|
|
|
|
|
|
|
|
|
|
if ((value ?? '') !== current) {
|
|
|
|
|
view.dispatch({
|
|
|
|
|
changes: {
|
|
|
|
|
from: 0,
|
|
|
|
|
to: current.length,
|
|
|
|
|
insert: value ?? '',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
debouncedEmit.cancel();
|
|
|
|
|
view?.destroy();
|
|
|
|
|
view = null;
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
window.removeEventListener('keydown', onKeydown);
|
|
|
|
|
// Switching nodes unmounts the editor; make sure the side panel collapses
|
|
|
|
|
// instead of lingering empty.
|
|
|
|
|
if (isExpanded.value && expandedPanel) {
|
|
|
|
|
expandedPanel.active = false;
|
|
|
|
|
}
|
2026-06-10 23:45:01 +00:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
<div class="group relative h-full w-full">
|
2026-06-12 20:09:39 +00:00
|
|
|
<div ref="editorContainer" class="code-editor h-full w-full" />
|
Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
graph-aware (suggests only what upstream nodes provide + variables + now);
migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
(matching the sidebar card), with a minimize control; the inline field
collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form
HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
dates; first poll records a baseline and emits nothing (date path too)
Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
so the test panel aggregates all branches instead of one
Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 14:31:58 +00:00
|
|
|
|
|
|
|
|
<TooltipProvider :delay-duration="200">
|
|
|
|
|
<div
|
|
|
|
|
v-if="!isExpanded && (canExpand || modelValue)"
|
|
|
|
|
class="absolute right-2 top-2 z-10 flex gap-0.5 rounded-lg border-2 border-foreground bg-card p-0.5 opacity-0 shadow-[1px_1px_0_var(--foreground)] transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100"
|
|
|
|
|
>
|
|
|
|
|
<Tooltip v-if="canExpand">
|
|
|
|
|
<TooltipTrigger as-child>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="inline-flex size-6 items-center justify-center rounded-md text-foreground/70 transition-colors hover:bg-foreground/10 hover:text-foreground"
|
|
|
|
|
:aria-label="$t('automations.config.expand_editor')"
|
|
|
|
|
@click="isExpanded = true"
|
|
|
|
|
>
|
|
|
|
|
<IconArrowsMaximize class="size-3.5" stroke-width="2.5" />
|
|
|
|
|
</button>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>{{ $t('automations.config.expand_editor') }}</TooltipContent>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
|
|
<Tooltip v-if="modelValue">
|
|
|
|
|
<TooltipTrigger as-child>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="inline-flex size-6 items-center justify-center rounded-md text-foreground/70 transition-colors hover:bg-foreground/10 hover:text-foreground"
|
|
|
|
|
:aria-label="$t('common.actions.copy')"
|
|
|
|
|
@click="copyToClipboard(modelValue)"
|
|
|
|
|
>
|
|
|
|
|
<IconCopy class="size-3.5" stroke-width="2.5" />
|
|
|
|
|
</button>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>{{ $t('common.actions.copy') }}</TooltipContent>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
</TooltipProvider>
|
|
|
|
|
|
|
|
|
|
<Teleport v-if="canExpand && isExpanded" to="#automation-expanded-editor">
|
|
|
|
|
<div class="flex shrink-0 items-center justify-between gap-2 border-b-2 border-foreground/10 px-3 py-3">
|
|
|
|
|
<span class="truncate text-sm font-bold">{{ label || $t('automations.config.expand_editor') }}</span>
|
|
|
|
|
<TooltipProvider :delay-duration="200">
|
|
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger as-child>
|
|
|
|
|
<Button variant="ghost" size="icon-sm" :aria-label="$t('automations.config.minimize_editor')" @click="isExpanded = false">
|
|
|
|
|
<IconArrowsMinimize class="size-4" />
|
|
|
|
|
</Button>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>{{ $t('automations.config.minimize_editor') }}</TooltipContent>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</TooltipProvider>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="min-h-0 flex-1 p-4">
|
|
|
|
|
<CodeEditor
|
|
|
|
|
:model-value="modelValue"
|
|
|
|
|
:language="language"
|
|
|
|
|
:placeholder="placeholder"
|
|
|
|
|
:read-only="readOnly"
|
|
|
|
|
@update:model-value="emit('update:modelValue', $event)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</Teleport>
|
2026-06-11 18:47:29 +00:00
|
|
|
</div>
|
2026-06-10 23:45:01 +00:00
|
|
|
</template>
|