feat(editor): properties-panel toggle + LabVIEW-style type colours

Two visible UX fixes:

1. Properties-panel toggle. Tap a step → opens. Tap the
   same step again → closes (deselect via toggle). Tap the
   canvas background → also closes. selectStep now returns
   to null when called with the already-selected id; the
   editor-controller test updated for the new semantics.

2. LabVIEW-style type colours on every port + wire.
   _typeAccent now picks vibrant brightness-aware hues per
   datatype:
     text   → magenta/pink (LabVIEW string)
     json   → amber/orange (cluster feel)
     bytes  → cyan/teal (raw binary)
     file   → green (file reference)
     number → yellow/amber
   Step-input dots, step-output dots, and outputs-endpoint
   dots all switch from the generic theme.primary to the
   field's declared type accent. Operators read the
   payload from the dot alone.

Editor tests still pass (20).

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-06-02 11:13:01 +02:00
parent 7b256b5e35
commit 1e9968496e
6 changed files with 133 additions and 39 deletions

View file

@ -69,7 +69,7 @@ outputs: {}
expect(c.isDirty, isFalse);
});
test('selectStep notifies listeners only on change', () {
test('selectStep notifies on change + toggles off on same-id click', () {
final c = FlowEditorController();
addTearDown(c.dispose);
c.openFlow('demo', '''
@ -80,14 +80,20 @@ outputs: {}
''');
var calls = 0;
c.addListener(() => calls++);
// First select selectedStepId goes null 'only',
// listeners fire once.
c.selectStep('only');
final after = calls;
// Selecting the same thing again must NOT bump the
// listener count the controller short-circuits.
expect(c.selectedStepId, 'only');
expect(calls, 1);
// Clicking the same step again deselects (toggle
// semantics): selectedStepId goes 'only' null,
// listeners fire again. That IS a state change.
c.selectStep('only');
expect(calls, after);
expect(c.selectedStepId, null);
expect(calls, 2);
// Explicit null while already null is a no-op.
c.selectStep(null);
expect(calls, after + 1);
expect(calls, 2);
});
});
}