Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,41 @@ platform API version.
The ram is drawn as the stack of a load, longer, with its shape (`text`)
after it, and it says `ram` when no shape is given. A product on an older
platform gets no spec for the kind and draws its node as before.
- **Sixteen more flow symbols**, which makes 45 kinds. A product that names
none of them draws as before, and no drawing of the 29 kinds changes.
- Decisions, in the choice family: `first`, `priority` and `race` are a
rounded block with an italic F, P or R. A priority names its inputs `hi`
and `lo` at the edge beside their pins, in a block a little longer than a
frame. The flags of a race, its last operands, end in a dot as a
condition does. `share` is a mux over a branch, for a unit that several
operations take turns on: the unit hangs off the side at the waist. Each
operation is numbered in a band at either end, clear of the slopes and of
the pins of the unit.
- A pass that does one more thing, in the branch family: `tap` gives a
second result out of its side when a token passes (`variant: 'at-valid'`
taps the base, for one that says so when the token is first offered),
`stand-in` takes what stops it on the side and answers 0, and `stall` is
a die on the wire, for one that holds a token back at random. Several
signals that stop a stand-in meet on a rail beside it, which ends in the
dot one signal would.
- `dead-buffer`, in the storage family: a buffer crossed out, with an input
and no output.
- Channels, in the bundle family: `no-ready` draws a channel wide with its
ready coming back to a bar, and `valid-merge` two channels with the valid
of the first going over to the second.
- Speculation, a family of its own, `spec`: `speculator`, `spec-save`,
`spec-commit`, `spec-save-commit`, `spec-branch` and `spec-tag`. A token
that is a guess is a ring and one that is not a dot. The family is purple
(`flow-spec` in `flow-symbols.css`), the chart colour that forks and joins
have and show on no body.
- `FlowDepiction.group` is new: the flags of a race, and the operands of
the unit a share serves. A share needs it, since its pins follow from it
(`n` operations of `group` operands give `n × group + 1` operands and
`n + group` results), and gets no spec without it or with other counts.
A race whose `group` is no count of its operands draws no flag.
- A symbol with several pins on its side spreads them along it, a pin pitch
apart: the signals that stop a stand-in, the unit of a share, the three
answers of a speculator, the two controls of a save and commit.
- **Find in the diagram.** The palette's loupe opens a box at the top of
the palette that finds nodes in the model, not in the drawing, so a node
off screen or too small to be drawn at the zoom is found too. It matches a
Expand Down
8 changes: 6 additions & 2 deletions packages/diagram-client/src/flow-symbols.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* Flow symbols (flow-symbols.ts, flow-symbol-views.ts): dataflow pictograms
in the theme's colours. A product that draws them imports this file.

The lines are the editor's foreground. The body of the six tinted families
The lines are the editor's foreground. The body of the seven tinted families
is a quarter of a chart colour over the editor's background (buffers green,
forks and joins purple, muxes and merges blue, branches yellow, memories
red, constants orange). The other families fill with the widget background,
red, constants orange, speculation purple). The other families fill with the widget background,
as a box does. Every colour is a theme variable, so a dark, a light and a
high contrast theme all draw them. The line widths go with the drawing's
scale (FlowSymbols.SCALE, 2): a symbol's outline reads as heavy as the
Expand All @@ -20,6 +20,9 @@
.flow-symbol.flow-branch { --flow-body: color-mix(in srgb, var(--vscode-charts-yellow) 24%, var(--flow-ground)); }
.flow-symbol.flow-memory { --flow-body: color-mix(in srgb, var(--vscode-charts-red) 24%, var(--flow-ground)); }
.flow-symbol.flow-constant { --flow-body: color-mix(in srgb, var(--vscode-charts-orange) 24%, var(--flow-ground)); }
/* Speculation takes purple too: a fork, a join and a blocker have no body, so
no other symbol shows it. */
.flow-symbol.flow-spec { --flow-body: color-mix(in srgb, var(--vscode-charts-purple) 24%, var(--flow-ground)); }

.flow-symbol .flow-hit { fill: transparent; stroke: none; }
.flow-symbol .flow-line {
Expand Down Expand Up @@ -51,6 +54,7 @@
pointer-events: none;
}
.flow-symbol .flow-glyph { font-weight: 600; }
.flow-symbol .flow-italic { font-style: italic; }
.flow-symbol .flow-value { font-family: var(--vscode-editor-font-family); }
.flow-symbol .flow-tiny { font-weight: 600; opacity: 0.72; }
.flow-symbol .flow-mark { opacity: 0.8; }
10 changes: 6 additions & 4 deletions packages/diagram-client/test/flow-symbol-views.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const css = readFileSync(path.join(here, '../src/flow-symbols.css'), 'utf8');
/** A count each kind draws, the least it takes but one result for a fork. */
function counts(kind: string): [number, number] {
for (let ins = 0; ins < 6; ins++) {
for (let outs = 0; outs < 4; outs++) {
for (let outs = 0; outs < 6; outs++) {
if (FlowSymbols.fits(kind as never, ins, outs)) {
return [ins, outs];
}
Expand All @@ -37,7 +37,8 @@ describe('flow symbol views', () => {
for (const kind of FlowSymbols.KINDS) {
for (const direction of ['DOWN', 'RIGHT'] as FlowDirection[]) {
const [ins, outs] = counts(kind);
const spec = FlowSymbols.spec({ symbol: kind, glyph: '+', text: 'x' }, ins, outs, direction)!;
// A share says how many operands its unit takes: one, for two operations.
const spec = FlowSymbols.spec({ symbol: kind, glyph: '+', text: 'x', group: 1 }, ins, outs, direction)!;
const g = renderFlowSymbol(spec) as unknown as Drawn;
expect(g.tag).toBe('g');
expect(g.props.class).toMatchObject({ 'flow-symbol': true, [`flow-${spec.family}`]: true, [`flow-kind-${kind}`]: true });
Expand Down Expand Up @@ -72,9 +73,10 @@ describe('flow symbol views', () => {
}
});

it('tint the six families from the theme chart colours', () => {
it('tint the seven families from the theme chart colours', () => {
const tinted = [...css.matchAll(/\.flow-symbol\.flow-([a-z]+) \{ --flow-body: color-mix\(in srgb, var\(--vscode-charts-([a-z]+)\)/g)]
.map(m => `${m[1]} ${m[2]}`);
expect(tinted).toEqual(['storage green', 'split purple', 'choice blue', 'branch yellow', 'memory red', 'constant orange']);
// Speculation shares purple with the forks and the joins, which have no body to tint.
expect(tinted).toEqual(['storage green', 'split purple', 'choice blue', 'branch yellow', 'memory red', 'constant orange', 'spec purple']);
});
});
Loading
Loading