hydraloop-diagram-react 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,6 +66,33 @@ const RUN_Y = 404;
66
66
  const UV_Y = 466;
67
67
  /** Half the width of a pipe */
68
68
  const PIPE = 3.5;
69
+ /**
70
+ * The x of each train's T2, which leaves 30 px between the release air labels.
71
+ * Each train's other parts are placed relative to it
72
+ */
73
+ const T2_X = { A: 288, B: 540 };
74
+ /** T4's left edge */
75
+ const T4_X = 60;
76
+ /**
77
+ * The outer edge of the "Sewer" labels: on the left lined up with T4's left
78
+ * edge, mirrored on the right
79
+ */
80
+ const SEWER_LABEL_X = { left: T4_X, right: 1000 - T4_X };
81
+ /** The width of a "Sewer" label */
82
+ const SEWER_LABEL_W = 38;
83
+ /** The space between the end of a pipe to the sewer and its label */
84
+ const SEWER_LABEL_DX = 13;
85
+ /** Where the pipes to the sewer end, in an arrow pointing at their label */
86
+ const SEWER_END = {
87
+ left: SEWER_LABEL_X.left + SEWER_LABEL_W + SEWER_LABEL_DX,
88
+ right: SEWER_LABEL_X.right - SEWER_LABEL_W - SEWER_LABEL_DX,
89
+ };
90
+ /** The mains pipe into T4, level with the transfer pipes into UV-C */
91
+ const MAINS_Y = UV_Y;
92
+ /** Where the mains pipe enters T4's top */
93
+ const T4_INLET_X = 167;
94
+ /** The center of each T2, where its backwash pipe enters from below */
95
+ const T2_CENTER = { A: T2_X.A + 86, B: T2_X.B + 86 };
69
96
  /** Height of a distributor triangle, from its tip to its base */
70
97
  const DISTRIBUTOR = 24;
71
98
  /** Stroke width of a distributor's outline, as in .distributor polygon */
@@ -115,7 +142,7 @@ function distributorEnds(x, y, tip) {
115
142
  * the common pipe and the open branch's pipe, so it lines up with both. The
116
143
  * rest is an outline.
117
144
  */
118
- function Distributor({ x, y, tip = "up", kind, io, name, label, words, branches, labelAnchor = "middle", labelDx = 0, labelDy = 4, strong = false, }) {
145
+ function Distributor({ x, y, tip = "up", kind, io, name, label, words, branches, labelAnchor = "middle", labelDx = 0, labelDy = 4, strong = false, idle = false, }) {
119
146
  const p = PIPE;
120
147
  const w = DISTRIBUTOR;
121
148
  // Drawn with the tip above, then turned for a tip on the left or flipped
@@ -135,9 +162,11 @@ function Distributor({ x, y, tip = "up", kind, io, name, label, words, branches,
135
162
  ? "unknown"
136
163
  : !branch.open
137
164
  ? "closed"
138
- : branch.active
139
- ? "flowing"
140
- : "open";
165
+ : idle
166
+ ? "idle"
167
+ : branch.active
168
+ ? "flowing"
169
+ : "open";
141
170
  const open = left.open ? -1 : right.open ? 1 : 0;
142
171
  const title = ioTitle(label, name, io, words);
143
172
  return (_jsxs("g", { className: `hl-distributor hl-kind-${kind}`, tabIndex: 0, role: "img", "aria-label": title, children: [_jsx("title", { suppressHydrationWarning: true, children: title }), _jsx("rect", { x: up ? x - w - 4 : x + p - w - 4, y: tip === "up" ? y + p - w - 4 : tip === "down" ? y - p - 4 : y - w - 4, width: up ? 2 * w + 8 : w + 8, height: up ? w + 8 : 2 * w + 8, className: "hl-hit" }), _jsx("g", { className: "hl-valve-body", children: open === 0 || left.open === undefined ? (_jsx("polygon", { points: outline([
@@ -186,7 +215,7 @@ function Bubbles({ x, y, w, h, active, }) {
186
215
  const delay = (i * 0.37) % 1.6;
187
216
  return (_jsx("circle", { cx: cx, cy: y + h - 8, r: i % 3 === 0 ? 2.5 : 1.8, style: {
188
217
  animationDelay: `${delay}s`,
189
- ["--rise"]: `${-(h - 24)}px`,
218
+ ["--hl-rise"]: `${-(h - 24)}px`,
190
219
  } }, i));
191
220
  }) }));
192
221
  }
@@ -196,7 +225,7 @@ function Drips({ x, y, bottom, active, kind = "grey", }) {
196
225
  return null;
197
226
  return (_jsx("g", { className: `hl-drips hl-kind-${kind}`, "aria-hidden": true, children: [0, 0.3, 0.6].map((delay) => (_jsx("circle", { cx: x, cy: y, r: 1.6, style: {
198
227
  animationDelay: `${delay}s`,
199
- ["--fall"]: `${bottom - y}px`,
228
+ ["--hl-fall"]: `${bottom - y}px`,
200
229
  } }, delay))) }));
201
230
  }
202
231
  /**
@@ -228,7 +257,7 @@ function fillOf(level) {
228
257
  const size = level.capacity ?? level.max;
229
258
  return Math.max(0, Math.min(1, level.liters / size));
230
259
  }
231
- function Tank({ x, y, w, h, level, kind, label, sub, side, aeration, circulation, pressurized, pressureHeld = false, venting, small, square = false, base = 0, }) {
260
+ function Tank({ x, y, w, h, level, kind, label, sub, side, aeration, circulation, pressurized, pressureHeld = false, airX, venting, small, square = false, base = 0, inlinePercent = false, }) {
232
261
  const known = fillOf(level) !== undefined;
233
262
  const size = level?.capacity ?? level?.max ?? 0;
234
263
  const fill = fillOf(level) ?? 0;
@@ -245,7 +274,7 @@ function Tank({ x, y, w, h, level, kind, label, sub, side, aeration, circulation
245
274
  ? `, ${trend >= 0 ? "+" : ""}${trend.toFixed(1)} L/min`
246
275
  : ""}. ${capacityNote(level)}`.trimEnd();
247
276
  const clipId = `hl-pressure-${label}-${side ?? sub ?? ""}`;
248
- const ringX = venting ?? x + w / 2;
277
+ const ringX = venting ?? airX ?? x + w / 2;
249
278
  // Enough rings to reach the far corners of the space above the water
250
279
  const rings = Math.ceil(Math.hypot(Math.max(ringX - x, x + w - ringX), h - fillHeight) / 14) + 1;
251
280
  // Venting rings vanish where the pipe's dashes start, at its beginning
@@ -272,10 +301,13 @@ function Tank({ x, y, w, h, level, kind, label, sub, side, aeration, circulation
272
301
  transform: `scale(${i / rings})`,
273
302
  animationDuration: `${rings * 0.9}s`,
274
303
  animationDelay: `${phase - i * 0.9}s`,
275
- } }, i))) })] })] })), _jsxs("text", { x: textX, y: small ? y + h / 2 - 6 : y + 22, textAnchor: anchor, className: "hl-tank-label", children: [label, sub && (_jsx("tspan", { className: "hl-tank-sub", dx: 6, children: sub }))] }), known && small && (_jsx("text", { x: textX, y: y + h / 2 + 20, textAnchor: anchor, className: "hl-tank-value", children: percent })), known && !small && (_jsxs(_Fragment, { children: [_jsxs("text", { x: x + 12, y: y + h - (h > 100 ? 30 : 26), className: "hl-tank-value", children: [Math.round(level.liters), " L", " ", arrow && _jsx("tspan", { className: "hl-tank-trend", children: arrow })] }), _jsxs("text", { x: x + 12, y: y + h - 12, className: "hl-tank-meta", children: [percent, " of ", level.capacity ? "~" : "", Math.round(size), " L"] })] }))] }));
304
+ } }, i))) })] })] })), _jsxs("text", { x: textX, y: small ? y + h / 2 - 6 : y + 22, textAnchor: anchor, className: "hl-tank-label", children: [label, sub && (_jsx("tspan", { className: "hl-tank-sub", dx: 6, children: sub }))] }), pressureHeld && (
305
+ // Air pumped in before holds its pressure, in the top right corner,
306
+ // level with the label
307
+ _jsx("text", { x: x + w - 12, y: y + 22, textAnchor: "end", className: "hl-tank-meta", children: "pressurized" })), known && small && (_jsx("text", { x: textX, y: y + h / 2 + 20, textAnchor: anchor, className: "hl-tank-value", children: percent })), known && !small && inlinePercent && (_jsxs("text", { x: x + 12, y: y + h - 14, className: "hl-tank-value", children: [Math.round(level.liters), " L", " ", arrow && _jsxs("tspan", { className: "hl-tank-trend", children: [arrow, " "] }), _jsx("tspan", { className: "hl-tank-meta", children: percent })] })), known && !small && !inlinePercent && (_jsxs(_Fragment, { children: [_jsxs("text", { x: x + 12, y: y + h - (h > 100 ? 30 : 26), className: "hl-tank-value", children: [Math.round(level.liters), " L", " ", arrow && _jsx("tspan", { className: "hl-tank-trend", children: arrow })] }), _jsxs("text", { x: x + 12, y: y + h - 12, className: "hl-tank-meta", children: [percent, " of ", level.capacity ? "~" : "", Math.round(size), " L"] })] }))] }));
276
308
  }
277
309
  /** T4 has float sensors instead of a level reading */
278
- function BackupTank({ x, y, w, h, state, }) {
310
+ function BackupTank({ x, y, w, h, state, inletX, filling = false, }) {
279
311
  const { t4, io } = state;
280
312
  const maxY = y + h * 0.55;
281
313
  const minY = y + h * 0.82;
@@ -283,17 +315,29 @@ function BackupTank({ x, y, w, h, state, }) {
283
315
  const fillTop = t4.max ? maxY : t4.min ? minY : undefined;
284
316
  return (_jsxs("g", { className: "hl-tank hl-kind-mains", children: [_jsx("rect", { x: x, y: y, width: w, height: h, className: t4.max === undefined && t4.min === undefined
285
317
  ? "hl-tank-shell is-unknown"
286
- : "hl-tank-shell" }), fillTop !== undefined && (_jsxs(_Fragment, { children: [_jsx("rect", { x: x + 1, y: fillTop, width: w - 2, height: y + h - fillTop - 1, className: "hl-tank-fill" }), _jsx("line", { x1: x + 1, x2: x + w - 1, y1: fillTop, y2: fillTop, className: "hl-tank-surface is-dashed" })] })), _jsxs("text", { x: x + 12, y: y + 22, className: "hl-tank-label", children: ["T4", _jsx("tspan", { className: "hl-tank-sub", dx: 6, children: "Backup" })] }), _jsx(Sensor, { x: x + w - 14, y: maxY, kind: "mains", io: io[IO.t4Max], name: IO.t4Max, label: "Max", labelAnchor: "end", labelDx: -12 }), _jsx(Sensor, { x: x + w - 14, y: minY, kind: "mains", io: io[IO.t4Min], name: IO.t4Min, label: "Min", labelAnchor: "end", labelDx: -12 }), _jsx("text", { x: x + 12, y: y + 40, className: "hl-tank-meta", children: t4.label })] }));
318
+ : "hl-tank-shell" }), fillTop !== undefined && (_jsxs(_Fragment, { children: [_jsx("rect", { x: x + 1, y: fillTop, width: w - 2, height: y + h - fillTop - 1, className: "hl-tank-fill" }), _jsx("line", { x1: x + 1, x2: x + w - 1, y1: fillTop, y2: fillTop, className: "hl-tank-surface is-dashed" })] })), _jsxs("text", { x: x + 12, y: y + 22, className: "hl-tank-label", children: ["T4", _jsx("tspan", { className: "hl-tank-sub", dx: 6, children: "Backup" })] }), _jsx(Sensor, { x: x + w - 14, y: maxY, kind: "mains", io: io[IO.t4Max], name: IO.t4Max, label: "Max", labelAnchor: "end", labelDx: -12 }), _jsx(Sensor, { x: x + w - 14, y: minY, kind: "mains", io: io[IO.t4Min], name: IO.t4Min, label: "Min", labelAnchor: "end", labelDx: -12 }), _jsx("text", { x: x + 12, y: y + 40, className: "hl-tank-meta", children: t4.label }), _jsx(Drips, { x: inletX, y: y, bottom: fillTop ?? y + h, active: filling, kind: "mains" })] }));
287
319
  }
288
320
  export function FlowDiagram({ state, device, }) {
289
321
  const { io, tanks, inlet, supply, t3 } = state;
290
322
  const ab = io[IO.abSelector];
291
- const selected = ab ? (ab.on ? "B" : "A") : undefined;
292
323
  const bypass = io[IO.bypass];
324
+ // While the bypass is open, it's not known whether greywater comes in: its
325
+ // way to the sewer is drawn open, without flow, and the way to the trains
326
+ // neither open nor flowing. The A/B valve still shows its setting
327
+ const bypassOpen = bypass?.on === true;
328
+ const receivingSides = bypassOpen ? [] : inlet.receiving;
329
+ const abSide = ab ? (ab.on ? "B" : "A") : undefined;
330
+ const selected = bypassOpen ? undefined : abSide;
293
331
  // Switched on in the app
294
332
  const bypassOverride = state.systemBehaviors.some((b) => b.name === "bypassByAppBypassValve");
295
- const bypassEnds = distributorEnds(500, 24, "left");
296
- const abEnds = distributorEnds(500, 100, "up");
333
+ // The greywater inlet runs evenly spaced between the sewer pipe above it
334
+ // and the pipes to the trains below it, far enough apart to leave 5 px
335
+ // between the bypass and A/B valves
336
+ const abY = 100;
337
+ const inletY = abY - 49.5;
338
+ const sewerY = inletY - 49.5;
339
+ const bypassEnds = distributorEnds(500, inletY, "left");
340
+ const abEnds = distributorEnds(500, abY, "up");
297
341
  // The backup valve lines up with the bottom of T3 and T4
298
342
  const backupY = 640 - PIPE;
299
343
  const backupEnds = distributorEnds(260, backupY, "down");
@@ -301,17 +345,27 @@ export function FlowDiagram({ state, device, }) {
301
345
  const a = side === "A";
302
346
  // Tank areas are to scale: T1 ~24 L, T2 ~200 L, T3 ~280 L (TANK_CAPACITY),
303
347
  // except that T1 reaches further down, to fit the transfer pipe on its side
304
- const t1x = a ? 140 : 839;
305
- const t2x = a ? 214 : 614;
348
+ const t2x = T2_X[side];
349
+ const t1x = t2x + (a ? -74 : 225);
306
350
  const t1c = t1x + 10;
307
351
  const t1Bottom = 384;
308
- const t2c = t2x + 86;
352
+ // The add air and release air pipes enter T2's top evenly spread across
353
+ // it, the release air pipe on the inner side
354
+ const t2c = a ? t2x + 57 : t2x + 172 - 57;
309
355
  const transfer = io[sideIo("transfer_path", side)];
310
356
  const waste = io[sideIo("waste_clean_tank", side)];
311
357
  const air = io[sideIo("air_pump", side)];
312
- const airTop = 151;
358
+ const pumpY = 136;
359
+ const pumpR = 13;
313
360
  const addAir = io[sideIo("add_air_valve", side)];
314
- const addAirY = airTop + 3 * 14;
361
+ // The top run of the pipe into T1 and the add air valve are evenly spread
362
+ // between the air pump's bottom and T2's top
363
+ const airStep = (232 - (pumpY + pumpR)) / 3;
364
+ const teeY = pumpY + pumpR + airStep;
365
+ const addAirY = pumpY + pumpR + 2 * airStep;
366
+ // The pipe starts behind the pump, a multiple of 14 px above the valve,
367
+ // so the dashes of both parts line up, see .pipe-flow
368
+ const airTop = addAirY - 5 * 14;
315
369
  // Air only reaches T2 while the add air valve isn't closed
316
370
  const addingAir = air?.on && addAir?.on !== false;
317
371
  // After air was added, T2 holds the pressure until the release air valve
@@ -320,11 +374,10 @@ export function FlowDiagram({ state, device, }) {
320
374
  // The release air pipe leaves T2's top on the inner side and ends level
321
375
  // with the air pump's center, open to the room
322
376
  const release = io[sideIo("release_air", side)];
323
- const releaseX = a ? t2x + 172 - 14 : t2x + 14;
377
+ const releaseX = a ? t2x + 172 - 57 : t2x + 57;
324
378
  // The air pipe into T1 branches off above the add air valve, runs down
325
379
  // between T1 and T2, and enters T1's bottom from below, next to the waste
326
380
  // pipe. The waste pipe leaves T1's bottom on the outer side
327
- const teeY = 166;
328
381
  const airX = a ? t1x + 21 - 5 : t1x + 5;
329
382
  const wasteX = a ? t1x + 5.5 : t1x + 21 - 5.5;
330
383
  const wasteY = t1Bottom + 20;
@@ -348,8 +401,12 @@ export function FlowDiagram({ state, device, }) {
348
401
  // does. Air only reaches T1 while it isn't closed
349
402
  const bubblesX = a ? t2c - 4 * 14 : t2c + 4 * 14;
350
403
  const bubbling = air?.on && bubblesValve?.on !== false;
351
- const receiving = inlet.receiving.includes(side);
352
- const drainX = a ? 30 : 970;
404
+ const receiving = receivingSides.includes(side);
405
+ // The drain leaves to the outside, its arrow pointing at its label
406
+ const drainEnd = a ? SEWER_END.left : SEWER_END.right;
407
+ // The skim overflow joins the drain 23 px before its end, which keeps it
408
+ // clear of T1's level in percent ("100%") next to T1
409
+ const drainX = drainEnd + (a ? 23 : -23);
353
410
  const transferring = transfer?.on;
354
411
  const skimming = state.trains[side].skimming;
355
412
  const t2Level = tanks[a ? "t2a" : "t2b"];
@@ -379,19 +436,26 @@ export function FlowDiagram({ state, device, }) {
379
436
  // exchange pipe and T1's bottom. It crosses the air pipe, turns down
380
437
  // between T1 and T2, passes below T2 and enters UV-C from the side
381
438
  const transferY = (exchangeYs[1] + PIPE + t1Bottom) / 2;
382
- return (_jsxs("g", { children: [_jsxs("text", { x: a ? 20 : 980, y: 146, textAnchor: a ? "start" : "end", className: "hl-train-label", children: ["Train ", side] }), _jsx(Pipe, { d: a
383
- ? `M${abEnds.branches[0]} 100 H${t1c} V232`
384
- : `M${abEnds.branches[1]} 100 H${t1c} V232`, kind: "grey", active: receiving, open: selected === side, square: true }), _jsx(Pipe, { d: `M${t2c} ${teeY} H${bubblesX}`, kind: "air", active: air?.on }), _jsx(Pipe, { d: `M${bubblesX} ${teeY} H${gapX} V${airBelowY} H${airX} V${t1Bottom}`, kind: "air", active: bubbling, open: bubblesValve?.on }), _jsx(Valve, { x: bubblesX, y: teeY, kind: "air", io: bubblesValve, active: bubbling, name: sideIo("bubbles_block", side), label: "Bubbles block", labelAnchor: a ? "start" : "end", labelDx: gapX + (a ? 10 : -10) - bubblesX, labelDy: -14 }), _jsx(Pipe, { d: `M${t2c} ${airTop} V${addAirY}`, kind: "air", active: air?.on }), _jsx(Pipe, { d: `M${t2c} ${addAirY} V232`, kind: "air", active: addingAir || holdingAir, still: holdingAir, open: addAir?.on }), _jsx(Valve, { x: t2c, y: addAirY, vertical: true, kind: "air", io: addAir, active: addingAir, name: sideIo("add_air_valve", side), label: "Add air", labelAnchor: a ? "start" : "end", labelDx: a ? 16 : -16 }), _jsx(Pump, { x: t2c, y: 136, r: 13, kind: "air", io: air, name: sideIo("air_pump", side), label: "Air", labelAnchor: a ? "start" : "end", labelDx: 20 }), release?.on && (
439
+ const body = (_jsxs("g", { children: [_jsxs("text", { x: a ? SEWER_LABEL_X.left : SEWER_LABEL_X.right,
440
+ // The top of the capitals lines up with the top edge of the A/B
441
+ // inlet pipes (the label's cap height is 0.72 of its 15 px)
442
+ y: abY - PIPE + 15 * 0.72, textAnchor: a ? "start" : "end", className: "hl-train-label", children: ["Train ", side] }), _jsx(Pipe, { d: a
443
+ ? `M${abEnds.branches[0]} ${abY} H${t1c} V232`
444
+ : `M${abEnds.branches[1]} ${abY} H${t1c} V232`, kind: "grey", active: receiving, open: selected === side, square: true }), _jsx(Pipe, { d: `M${t2c} ${teeY} H${bubblesX}`, kind: "air", active: air?.on }), _jsx(Pipe, { d: `M${bubblesX} ${teeY} H${gapX} V${airBelowY} H${airX} V${t1Bottom}`, kind: "air", active: bubbling, open: bubblesValve?.on, square: true }), _jsx(Valve, { x: bubblesX, y: teeY, kind: "air", io: bubblesValve, active: bubbling, name: sideIo("bubbles_block", side), label: "Bubbles block",
445
+ // Above the pipe, ending short of the air pump
446
+ labelAnchor: a ? "end" : "start", labelDx: t2c + (a ? -21 : 21) - bubblesX, labelDy: -14 }), _jsx(Pipe, { d: `M${t2c} ${airTop} V${addAirY}`, kind: "air", active: air?.on }), _jsx(Pipe, { d: `M${t2c} ${addAirY} V232`, kind: "air", active: addingAir || holdingAir, still: holdingAir, open: addAir?.on, square: true }), _jsx(Valve, { x: t2c, y: addAirY, vertical: true, kind: "air", io: addAir, active: addingAir, name: sideIo("add_air_valve", side), label: "Add air", labelAnchor: a ? "end" : "start", labelDx: a ? -16 : 16 }), _jsx(Pump, { x: t2c, y: pumpY, r: pumpR, kind: "air", io: air, name: sideIo("air_pump", side), label: "Air", labelAnchor: a ? "start" : "end", labelDx: 20 }), release?.on && (
385
447
  // The air leaves the pipe's open end as circles that fade out at
386
448
  // the size of the air pump. A circle starts where the pipe's dashes
387
449
  // leave off, 96 px up the pipe, see the rings in Tank
388
450
  _jsx("circle", { cx: releaseX, cy: 136, r: 14, className: "hl-vent-ring", style: {
389
451
  animationDelay: `${(-((14 - (96 % 14)) % 14) / 14) * 0.9}s`,
390
- }, "aria-hidden": true })), _jsx(Pipe, { d: `M${releaseX} 232 V136`, kind: "air", active: release?.on, open: release?.on }), _jsx(Valve, { x: releaseX, y: 162, vertical: true, kind: "air", io: release, active: release?.on, name: sideIo("release_air", side), label: "Release air", labelAnchor: a ? "start" : "end", labelDx: a ? 16 : -16 }), exchangeYs.map((y, i) => {
452
+ }, "aria-hidden": true })), _jsx(Pipe, { d: `M${releaseX} 232 V136`, kind: "air", active: release?.on, open: release?.on, square: true }), _jsx(Valve, { x: releaseX,
453
+ // Level with the top run of the air pipe into T1
454
+ y: teeY, vertical: true, kind: "air", io: release, active: release?.on, name: sideIo("release_air", side), label: "Release air", labelAnchor: a ? "start" : "end", labelDx: a ? 16 : -16 }), exchangeYs.map((y, i) => {
391
455
  const filled = exchangeFilled(y);
392
456
  return (_jsxs("g", { children: [_jsx("path", { d: `M${gapX - 4} ${y} H${gapX + 4}`, className: "hl-pipe-gap" }), _jsx(Pipe, { d: i === 0
393
457
  ? `M${t1Edge} ${y} H${exchangeX} V${exchangeYs[1]} H${t2FarEdge}`
394
- : `M${t2Edge} ${y} H${t1Edge}`, kind: "grey", active: filled && bubbling === true, filled: filled }), i === 0 &&
458
+ : `M${t2Edge} ${y} H${t1Edge}`, kind: "grey", active: filled && bubbling === true, filled: filled, square: true }), i === 0 &&
395
459
  !filled &&
396
460
  exchangeSurface !== undefined &&
397
461
  exchangeSurface < exchangeYs[1] && (_jsx(Pipe, { d: `M${exchangeX} ${exchangeYs[1]} V${exchangeSurface}`, kind: "grey", active: false, filled: true, square: true })), i === 0 && (
@@ -407,11 +471,17 @@ export function FlowDiagram({ state, device, }) {
407
471
  exchangeYs[0] +
408
472
  Math.abs(exchangeX - t2FarEdge),
409
473
  }
410
- : undefined, pressurized: (addingAir || holdingAir) && 232 - addAirY, pressureHeld: holdingAir, venting: release?.on ? releaseX : undefined }), _jsx(Pipe, { d: a
411
- ? `M140 237 H${drainX} V${wasteY}`
412
- : `M860 237 H${drainX} V${wasteY}`, kind: "waste", active: skimming, title: `Skim overflow of T1 ${side}${skimming ? ": filth spilling over to the drain (inferred from the FILTH_REMOVAL routine)" : ""}` }), _jsx("text", { x: a ? 57 : 943, y: 228, textAnchor: "middle", className: "hl-diagram-label", children: "Skim" }), _jsx(Pipe, { d: `M${wasteX} ${t1Bottom} V${wasteY} H${drainX}`, kind: "waste", active: waste?.on, open: waste?.on }), _jsx(Pipe, { d: `M${drainX} ${wasteY} V470`, kind: "waste", active: skimming || waste?.on, open: waste?.on, arrow: { x: drainX, y: 470, dir: "down" } }), _jsx(Valve, { x: (wasteX + drainX) / 2, y: wasteY, kind: "waste", io: waste, active: waste?.on, name: sideIo("waste_clean_tank", side), label: "Waste", labelAnchor: "middle", labelDx: 0, labelDy: 24 }), _jsx("text", { x: drainX, y: 498, textAnchor: "middle", className: "hl-diagram-label", children: "Drain" }), _jsx("path", { d: `M${gapX - 4} ${transferY} H${gapX + 4}`, className: "hl-pipe-gap" }), _jsx(Pipe, { d: `M${t1Edge} ${transferY} H${transferX} V${UV_Y} H${a ? 460 : 540}`, kind: "clean", active: transferring, open: transferring }), _jsx(Valve, { x: a ? 380 : 620, y: UV_Y, kind: "clean", io: transfer, active: transferring, name: sideIo("transfer_path", side), label: "Transfer", labelAnchor: "middle", labelDx: 0, labelDy: 24 })] }, side));
474
+ : undefined, pressurized: (addingAir || holdingAir) && 232 - addAirY, pressureHeld: holdingAir, airX: t2c, venting: release?.on ? releaseX : undefined, inlinePercent: true }), _jsx(Pipe, { d: a
475
+ ? `M${t1x} 237 H${drainX} V${wasteY}`
476
+ : `M${t1x + 21} 237 H${drainX} V${wasteY}`, kind: "waste", active: skimming, title: `Skim overflow of T1 ${side}${skimming ? ": filth spilling over to the drain (inferred from the FILTH_REMOVAL routine)" : ""}`, square: true }), _jsx("text", { x: drainX + (a ? 27 : -27), y: 228, textAnchor: "middle", className: "hl-diagram-label", children: "Skim" }), _jsx(Pipe, { d: `M${wasteX} ${t1Bottom} V${wasteY} H${drainX}`, kind: "waste", active: waste?.on, open: waste?.on, square: true }), _jsx(Pipe, { d: `M${drainX} ${wasteY} H${drainEnd}`, kind: "waste", active: skimming || waste?.on, open: waste?.on, arrow: { x: drainEnd, y: wasteY, dir: a ? "left" : "right" } }), _jsx(Valve, { x: (wasteX + drainX) / 2, y: wasteY, kind: "waste", io: waste, active: waste?.on, name: sideIo("waste_clean_tank", side), label: "Waste", labelAnchor: "middle", labelDx: 0, labelDy: 24 }), _jsx("text", { x: a ? SEWER_LABEL_X.left : SEWER_LABEL_X.right, y: wasteY + 4, textAnchor: a ? "start" : "end", className: "hl-diagram-label", children: "Sewer" })] }, side));
477
+ // Drawn after the circulation pipes, so the transfer pipe passes in
478
+ // front of them
479
+ const transferPipe = (_jsxs("g", { children: [_jsx("path", { d: `M${gapX - 4} ${transferY} H${gapX + 4}`, className: "hl-pipe-gap" }), _jsx(Pipe, { d: `M${t1Edge} ${transferY} H${transferX} V${UV_Y} H${a ? 460 : 540}`, kind: "clean", active: transferring, open: transferring, square: true }), _jsx(Valve, { x: T2_CENTER[side], y: UV_Y, kind: "clean", io: transfer, active: transferring, name: sideIo("transfer_path", side), label: "Transfer", labelAnchor: "middle", labelDx: 0, labelDy: 24 })] }, side));
480
+ return { body, transferPipe };
413
481
  };
482
+ const trains = { A: train("A"), B: train("B") };
414
483
  const backup = io[IO.backupWater];
484
+ const preBackup = io[IO.preBackupWater];
415
485
  const recycledToPump = supply.pumping && supply.source !== "backup";
416
486
  const backupToPump = supply.pumping && supply.source === "backup";
417
487
  const circulatingThroughUv = t3.circulating && supply.pumping;
@@ -435,28 +505,34 @@ export function FlowDiagram({ state, device, }) {
435
505
  ? outletKind
436
506
  : "clean";
437
507
  const off = (connected) => connected === false ? " is-disconnected" : "";
438
- return (_jsxs("svg", { viewBox: "0 -38 1000 863", className: "hl-flow-diagram", role: "group", "aria-label": "Water flow through the H600", children: [_jsx("defs", { children: _jsx("pattern", { id: "hl-hatch", width: "6", height: "6", patternUnits: "userSpaceOnUse", patternTransform: "rotate(45)", children: _jsx("line", { x1: "0", y1: "0", x2: "0", y2: "6", className: "hl-hatch-line" }) }) }), _jsx("text", { x: 60, y: 10, className: "hl-diagram-label is-strong", children: "Greywater from showers and baths" }), _jsx(Pipe, { d: `M60 24 H${bypassEnds.common}`, kind: "grey", active: inlet.receiving.length > 0 || inlet.bypass, open: bypass?.on || (bypass?.on === false && selected !== undefined), square: true }), _jsx(Pipe, { d: `M500 ${bypassEnds.branches[0]} V${abEnds.common}`, kind: "grey", active: inlet.receiving.length > 0, open: bypass?.on === false && selected !== undefined, square: true }), _jsx(Pipe, { d: `M500 ${bypassEnds.branches[1]} V-22 H935`, kind: "grey", active: inlet.bypass, open: bypass?.on, square: true, arrow: { x: 935, y: -22, dir: "right" } }), _jsx(Distributor, { x: 500, y: 24, tip: "left", kind: "grey", io: bypass, name: IO.bypass, label: bypassOverride ? "Bypass (user override)" : "Bypass", strong: bypassOverride, words: ["to the sewer", "to the trains"], branches: [
439
- { open: bypass?.on, active: inlet.bypass === true },
508
+ return (_jsxs("svg", { viewBox: "0 -15 1000 840", className: "hl-flow-diagram", role: "group", "aria-label": "Water flow through the H600", children: [_jsx("defs", { children: _jsx("pattern", { id: "hl-hatch", width: "6", height: "6", patternUnits: "userSpaceOnUse", patternTransform: "rotate(45)", children: _jsx("line", { x1: "0", y1: "0", x2: "0", y2: "6", className: "hl-hatch-line" }) }) }), _jsx("text", { x: 60, y: inletY - 14, className: "hl-diagram-label is-strong", children: "Greywater from showers and baths" }), _jsx(Pipe, { d: `M60 ${inletY} H${bypassEnds.common}`, kind: "grey", active: receivingSides.length > 0
509
+ ? true
510
+ : inlet.bypass === undefined
511
+ ? undefined
512
+ : false, open: bypassOpen || (bypass?.on === false && selected !== undefined), square: true }), _jsx(Pipe, { d: `M500 ${bypassEnds.branches[0]} V${abEnds.common}`, kind: "grey", active: receivingSides.length > 0, open: bypass?.on === false && selected !== undefined, square: true }), _jsx(Pipe, { d: `M500 ${bypassEnds.branches[1]} V${sewerY} H${SEWER_END.right}`, kind: "grey", active: inlet.bypass === undefined ? undefined : false, open: bypassOpen, square: true, arrow: { x: SEWER_END.right, y: sewerY, dir: "right" } }), _jsx(Distributor, { x: 500, y: inletY, tip: "left", kind: "grey", io: bypass, name: IO.bypass, label: bypassOverride ? "Bypass (user override)" : "Bypass", strong: bypassOverride, words: ["to the sewer", "to the trains"], branches: [
513
+ { open: bypass?.on, active: false },
440
514
  {
441
515
  open: bypass && !bypass.on,
442
- active: inlet.receiving.length > 0,
516
+ active: receivingSides.length > 0,
443
517
  },
444
- ], labelAnchor: "start", labelDx: 14 }), _jsx("text", { x: 948, y: -18, className: "hl-diagram-label", children: "Sewer" }), train("A"), train("B"), _jsx(Distributor, { x: 500, y: 100, kind: "grey", io: ab, name: IO.abSelector, label: "A/B valve", words: ["to train B", "to train A"], branches: [
518
+ ], labelAnchor: "start", labelDx: 14 }), _jsx("text", { x: SEWER_LABEL_X.right, y: sewerY + 4, textAnchor: "end", className: "hl-diagram-label", children: "Sewer" }), trains.A.body, trains.B.body, _jsx(Distributor, { x: 500, y: abY, kind: "grey", io: ab, name: IO.abSelector, label: "A/B valve", idle: bypassOpen, words: ["to train B", "to train A"], branches: [
445
519
  {
446
- open: selected && selected === "A",
447
- active: inlet.receiving.includes("A"),
520
+ open: abSide && abSide === "A",
521
+ active: receivingSides.includes("A"),
448
522
  },
449
523
  {
450
- open: selected && selected === "B",
451
- active: inlet.receiving.includes("B"),
524
+ open: abSide && abSide === "B",
525
+ active: receivingSides.includes("B"),
452
526
  },
453
- ], labelDy: 24 }), _jsx(Pipe, { d: `M500 ${UV_Y + 17} V540`, kind: uvOutletKind, active: t3ReceivingFromUv, open: io[IO.uvValve]?.on }), _jsxs("g", { className: `hl-uv is-${t3.uv === undefined ? "unknown" : t3.uv ? "on" : "off"}`, tabIndex: 0, role: "img", "aria-label": ioTitle("UV-C", IO.uvPower, io[IO.uvPower], ["on", "off"]), children: [_jsx("title", { suppressHydrationWarning: true, children: ioTitle("UV-C", IO.uvPower, io[IO.uvPower], ["on", "off"]) }), _jsx("rect", { x: 460, y: UV_Y - 17, width: 80, height: 34, rx: 6 }), _jsx("text", { x: 500, y: UV_Y + 5, textAnchor: "middle", children: "UV-C" })] }), _jsx(Valve, { x: 500, y: (UV_Y + 17 + 540) / 2, vertical: true, kind: uvOutletKind, io: io[IO.uvValve], active: t3ReceivingFromUv, name: IO.uvValve, label: "UV valve" }), _jsx(Tank, { x: 346, y: 540, w: 309, h: 100, level: tanks.t3, kind: "clean", label: "T3", sub: "Recycled water", square: true }), _jsx(Drips, { x: 500, y: 540, bottom: t3Fill === undefined ? undefined : 640 - 100 * t3Fill, active: !!t3ReceivingFromUv, kind: uvOutletKind }), _jsx(Pipe, { d: `M655 ${backupY} H970 V735`, kind: "waste", active: t3.draining, open: io[IO.wasteStorageTank]?.on, square: true, arrow: { x: 970, y: 735, dir: "down" } }), _jsx(Valve, { x: 790, y: backupY, kind: "waste", io: io[IO.wasteStorageTank], active: t3.draining, name: IO.wasteStorageTank, label: "T3 drain", labelAnchor: "middle", labelDx: 0, labelDy: -16 }), _jsx("text", { x: 970, y: 763, textAnchor: "middle", className: "hl-diagram-label", children: "Drain" }), _jsx(BackupTank, { x: 60, y: 540, w: 130, h: 100, state: state }), _jsx("path", { d: `M700 ${backupY - 4} V${backupY + 4}`, className: "hl-pipe-gap" }), _jsx("path", { d: `M700 ${UV_Y - 4} V${UV_Y + 4}`, className: "hl-pipe-gap" }), _jsx(Pipe, { d: `M560 740 H700 V${RUN_Y}`, kind: outletKind, active: circulatingThroughUv || backwashing.A || backwashing.B, open: t3.circulating || backwash.A?.on || backwash.B?.on }), _jsx(Pipe, { d: `M700 ${RUN_Y} H500`, kind: outletKind, active: circulatingThroughUv || backwashing.A, open: t3.circulating || backwash.A?.on }), _jsx(Pipe, { d: `M500 ${RUN_Y} V${UV_Y - 17}`, kind: outletKind, active: circulatingThroughUv, open: t3.circulating }), ["A", "B"].map((side) => {
527
+ ], labelDy: 24 }), _jsx(Pipe, { d: `M500 ${UV_Y + 17} V540`, kind: uvOutletKind, active: t3ReceivingFromUv, open: io[IO.uvValve]?.on, square: true }), _jsxs("g", { className: `hl-uv is-${t3.uv === undefined ? "unknown" : t3.uv ? "on" : "off"}`, tabIndex: 0, role: "img", "aria-label": ioTitle("UV-C", IO.uvPower, io[IO.uvPower], ["on", "off"]), children: [_jsx("title", { suppressHydrationWarning: true, children: ioTitle("UV-C", IO.uvPower, io[IO.uvPower], ["on", "off"]) }), _jsx("rect", { x: 460, y: UV_Y - 17, width: 80, height: 34, rx: 6 }), _jsx("text", { x: 500, y: UV_Y + 5, textAnchor: "middle", children: "UV-C" })] }), _jsx(Valve, { x: 500, y: (UV_Y + 17 + 540) / 2, vertical: true, kind: uvOutletKind, io: io[IO.uvValve], active: t3ReceivingFromUv, name: IO.uvValve, label: "UV valve" }), _jsx(Tank, { x: 346, y: 540, w: 309, h: 100, level: tanks.t3, kind: "clean", label: "T3", sub: "Recycled water", square: true }), _jsx(Drips, { x: 500, y: 540, bottom: t3Fill === undefined ? undefined : 640 - 100 * t3Fill, active: !!t3ReceivingFromUv, kind: uvOutletKind }), _jsx(Pipe, { d: `M655 ${backupY} H${SEWER_END.right}`, kind: "waste", active: t3.draining, open: io[IO.wasteStorageTank]?.on, square: true, arrow: { x: SEWER_END.right, y: backupY, dir: "right" } }), _jsx(Valve, { x: 790, y: backupY, kind: "waste", io: io[IO.wasteStorageTank], active: t3.draining, name: IO.wasteStorageTank, label: "T3 drain", labelAnchor: "middle", labelDx: 0, labelDy: -16 }), _jsx("text", { x: SEWER_LABEL_X.right, y: backupY + 4, textAnchor: "end", className: "hl-diagram-label", children: "Sewer" }), _jsx(Pipe, { d: `M${T4_X} ${MAINS_Y} H${T4_INLET_X} V540`, kind: "mains", active: preBackup?.on, open: preBackup?.on, square: true }), _jsx(Valve, { x: (T4_X + T4_INLET_X) / 2, y: MAINS_Y, kind: "mains", io: preBackup, active: preBackup?.on, name: IO.preBackupWater, label: "Mains", labelAnchor: "middle", labelDx: 0, labelDy: -16 }), _jsx(BackupTank, { x: T4_X, y: 540, w: 130, h: 100, state: state, inletX: T4_INLET_X, filling: preBackup?.on }), _jsx("path", { d: `M700 ${backupY - 4} V${backupY + 4}`, className: "hl-pipe-gap" }), _jsx(Pipe, { d: `M560 740 H700 V${RUN_Y} H${T2_CENTER.B}`, kind: outletKind, active: circulatingThroughUv || backwashing.A || backwashing.B, open: t3.circulating || backwash.A?.on || backwash.B?.on }), _jsx(Pipe, { d: `M${T2_CENTER.B} ${RUN_Y} H500`, kind: outletKind, active: circulatingThroughUv || backwashing.A, open: t3.circulating || backwash.A?.on }), _jsx(Pipe, { d: `M500 ${RUN_Y} V${UV_Y - 17}`, kind: outletKind, active: circulatingThroughUv, open: t3.circulating, square: true }), ["A", "B"].map((side) => {
454
528
  const a = side === "A";
455
- return (_jsxs("g", { children: [_jsx(Pipe, { d: a ? `M500 ${RUN_Y} H300 V360` : `M700 ${RUN_Y} V360`, kind: outletKind, active: backwashing[side], open: backwash[side]?.on }), _jsx(Valve, { x: a ? 300 : 700, y: (RUN_Y + 360) / 2, vertical: true, kind: outletKind, io: backwash[side], active: backwashing[side], name: sideIo("diffuser_backwash", side), label: "Backwash", labelAnchor: a ? "end" : "start", labelDx: a ? -16 : 16 })] }, side));
456
- }), _jsx(Valve, { x: 500, y: (RUN_Y + UV_Y - 17) / 2, vertical: true, kind: outletKind, io: io[IO.circulation], active: circulatingThroughUv, name: IO.circulation, label: "Circulation", labelAnchor: "end", labelDx: -14 }), _jsx(Pipe, { d: `M190 ${backupY} H${backupEnds.branches[0]}`, kind: "mains", active: backupToPump, open: backup?.on, square: true }), _jsx(Pipe, { d: `M346 ${backupY} H${backupEnds.branches[1]}`, kind: "clean", active: recycledToPump, open: backup?.on === false, square: true }), _jsx(Pipe, { d: `M260 ${backupEnds.common} V724`, kind: outletKind, active: supply.pumping, open: backup !== undefined, square: true }), _jsx(Distributor, { x: 260, y: backupY, tip: "down", kind: outletKind, io: backup, name: IO.backupWater, label: "Backup valve", words: ["from T4", "from T3"], branches: [
529
+ return (_jsxs("g", { children: [_jsx(Pipe, { d: a
530
+ ? `M500 ${RUN_Y} H${T2_CENTER.A} V360`
531
+ : `M${T2_CENTER.B} ${RUN_Y} V360`, kind: outletKind, active: backwashing[side], open: backwash[side]?.on, square: true }), _jsx(Valve, { x: T2_CENTER[side], y: (RUN_Y + 360) / 2, vertical: true, kind: outletKind, io: backwash[side], active: backwashing[side], name: sideIo("diffuser_backwash", side), label: "Backwash", labelAnchor: a ? "end" : "start", labelDx: a ? -16 : 16 })] }, side));
532
+ }), _jsx(Valve, { x: 500, y: (RUN_Y + UV_Y - 17) / 2, vertical: true, kind: outletKind, io: io[IO.circulation], active: circulatingThroughUv, name: IO.circulation, label: "Circulation", labelAnchor: "end", labelDx: -14 }), _jsx("path", { d: `M696 ${UV_Y} H704`, className: "hl-pipe-gap" }), trains.A.transferPipe, trains.B.transferPipe, _jsx(Pipe, { d: `M190 ${backupY} H${backupEnds.branches[0]}`, kind: "mains", active: backupToPump, open: backup?.on, square: true }), _jsx(Pipe, { d: `M346 ${backupY} H${backupEnds.branches[1]}`, kind: "clean", active: recycledToPump, open: backup?.on === false, square: true }), _jsx(Pipe, { d: `M260 ${backupEnds.common} V724`, kind: outletKind, active: supply.pumping, open: backup !== undefined, square: true }), _jsx(Distributor, { x: 260, y: backupY, tip: "down", kind: outletKind, io: backup, name: IO.backupWater, label: "Backup valve", words: ["from T4", "from T3"], branches: [
457
533
  { open: backup?.on, active: backupToPump === true },
458
534
  { open: backup && !backup.on, active: recycledToPump === true },
459
- ], labelDy: -14 }), _jsx(Pump, { x: 260, y: 740, r: 16, kind: outletKind, io: io[IO.distributionPump], name: IO.distributionPump, label: "Distribution pump", labelAnchor: "end" }), _jsx(Pipe, { d: "M500 740 V640", kind: outletKind, active: backFlushing, open: io[IO.backFlush]?.on }), _jsx(Valve, { x: 500, y: 690, vertical: true, kind: outletKind, io: io[IO.backFlush], active: backFlushing, name: IO.backFlush, label: "Back flush" }), _jsx(Pipe, { d: "M276 740 H560", kind: outletKind, active: supply.toOutlets ?? false, open: true }), _jsxs("g", { className: `hl-outlet${off(device.outlets.toilet)}`, children: [_jsx(Pipe, { d: "M360 740 V790", kind: outletKind, active: supply.toilet ?? false, open: true, arrow: { x: 360, y: 790, dir: "down" } }), _jsx(Sensor, { x: 360, y: 765, kind: outletKind, io: io[IO.toilet], name: IO.toilet, label: "" }), _jsx("text", { x: 360, y: 815, textAnchor: "middle", className: "hl-diagram-label", children: "Toilets" })] }), _jsxs("g", { className: `hl-outlet${off(device.outlets.washingMachine)}`, children: [_jsx(Pipe, { d: "M460 740 V790", kind: outletKind, active: supply.wash ?? false, open: true, arrow: { x: 460, y: 790, dir: "down" } }), _jsx(Sensor, { x: 460, y: 765, kind: outletKind, io: io[IO.wash], name: IO.wash, label: "" }), _jsx("text", { x: 460, y: 815, textAnchor: "middle", className: "hl-diagram-label", children: "Washer" })] }), _jsxs("g", { className: `hl-outlet${off(device.outlets.auxiliary)}`, children: [_jsx(Pipe, { d: "M560 740 V790", kind: outletKind, active: supply.auxiliary, open: io[IO.auxiliary]?.on, arrow: { x: 560, y: 790, dir: "down" } }), _jsx(Valve, { x: 560, y: 765, vertical: true, kind: outletKind, io: io[IO.auxiliary], active: supply.auxiliary, name: IO.auxiliary, label: "" }), _jsx("text", { x: 560, y: 815, textAnchor: "middle", className: "hl-diagram-label", children: "Auxiliary" })] })] }));
535
+ ], labelDy: -14 }), _jsx(Pump, { x: 260, y: 740, r: 16, kind: outletKind, io: io[IO.distributionPump], name: IO.distributionPump, label: "Distribution pump", labelAnchor: "end" }), _jsx(Pipe, { d: "M500 740 V640", kind: outletKind, active: backFlushing, open: io[IO.backFlush]?.on, square: true }), _jsx(Valve, { x: 500, y: 690, vertical: true, kind: outletKind, io: io[IO.backFlush], active: backFlushing, name: IO.backFlush, label: "Back flush" }), _jsx(Pipe, { d: "M276 740 H560", kind: outletKind, active: supply.toOutlets ?? false, open: true }), _jsxs("g", { className: `hl-outlet${off(device.outlets.toilet)}`, children: [_jsx(Pipe, { d: "M360 740 V790", kind: outletKind, active: supply.toilet ?? false, open: true, arrow: { x: 360, y: 790, dir: "down" } }), _jsx(Sensor, { x: 360, y: 765, kind: outletKind, io: io[IO.toilet], name: IO.toilet, label: "" }), _jsx("text", { x: 360, y: 815, textAnchor: "middle", className: "hl-diagram-label", children: "Toilets" })] }), _jsxs("g", { className: `hl-outlet${off(device.outlets.washingMachine)}`, children: [_jsx(Pipe, { d: "M460 740 V790", kind: outletKind, active: supply.wash ?? false, open: true, arrow: { x: 460, y: 790, dir: "down" } }), _jsx(Sensor, { x: 460, y: 765, kind: outletKind, io: io[IO.wash], name: IO.wash, label: "" }), _jsx("text", { x: 460, y: 815, textAnchor: "middle", className: "hl-diagram-label", children: "Washer" })] }), _jsxs("g", { className: `hl-outlet${off(device.outlets.auxiliary)}`, children: [_jsx(Pipe, { d: "M560 740 V790", kind: outletKind, active: supply.auxiliary, open: io[IO.auxiliary]?.on, arrow: { x: 560, y: 790, dir: "down" } }), _jsx(Valve, { x: 560, y: 765, vertical: true, kind: outletKind, io: io[IO.auxiliary], active: supply.auxiliary, name: IO.auxiliary, label: "" }), _jsx("text", { x: 560, y: 815, textAnchor: "middle", className: "hl-diagram-label", children: "Auxiliary" })] })] }));
460
536
  }
461
537
  export function DiagramLegend() {
462
538
  const items = [
@@ -471,10 +547,12 @@ export function DiagramLegend() {
471
547
  export function activeFlows(state) {
472
548
  const { inlet, trains, io, t3, supply } = state;
473
549
  const flows = [];
474
- for (const side of inlet.receiving)
475
- flows.push(`Greywater → train ${side}`);
476
- if (inlet.bypass)
477
- flows.push("Greywater → sewer (bypass)");
550
+ // While the bypass is open, it's not known whether greywater comes in
551
+ if (!inlet.bypass) {
552
+ for (const side of inlet.receiving) {
553
+ flows.push(`Greywater → train ${side}`);
554
+ }
555
+ }
478
556
  for (const side of ["A", "B"]) {
479
557
  if (trains[side].t2ToT1)
480
558
  flows.push(`T2 ${side} → T1 ${side}`);
@@ -497,6 +575,8 @@ export function activeFlows(state) {
497
575
  flows.push("Back flush → T3");
498
576
  if (t3.draining)
499
577
  flows.push("T3 → drain");
578
+ if (io[IO.preBackupWater]?.on)
579
+ flows.push("Mains → T4");
500
580
  if (supply.toOutlets) {
501
581
  const to = [
502
582
  supply.toilet && "toilets",
package/dist/styles.css CHANGED
@@ -268,7 +268,8 @@
268
268
  fill: var(--hl-bg);
269
269
  stroke: var(--hl-muted);
270
270
  stroke-width: 1.5;
271
- stroke-linejoin: round;
271
+ stroke-linejoin: miter;
272
+ stroke-miterlimit: 10;
272
273
  }
273
274
  .hl-valve-body {
274
275
  transition: transform 0.3s ease;
@@ -295,7 +296,8 @@
295
296
  fill: var(--hl-bg);
296
297
  stroke: var(--hl-border-strong);
297
298
  stroke-width: 1.5;
298
- stroke-linejoin: round;
299
+ stroke-linejoin: miter;
300
+ stroke-miterlimit: 10;
299
301
  }
300
302
  .hl-distributor polygon.is-closed {
301
303
  stroke: var(--hl-pipe-idle);
@@ -305,6 +307,10 @@
305
307
  fill: var(--hl-pipe-open);
306
308
  stroke: none;
307
309
  }
310
+ .hl-distributor polygon.is-idle {
311
+ fill: var(--hl-pipe-idle);
312
+ stroke: none;
313
+ }
308
314
  .hl-distributor polygon.is-flowing {
309
315
  fill: var(--hl-k);
310
316
  stroke: none;
@@ -430,6 +436,10 @@
430
436
  fill: var(--hl-muted);
431
437
  font-variant-numeric: tabular-nums;
432
438
  }
439
+ .hl-tank-value .hl-tank-meta {
440
+ font-weight: 400;
441
+ letter-spacing: 0;
442
+ }
433
443
 
434
444
  .hl-bubbles circle {
435
445
  fill: var(--hl-air);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.0.1";
1
+ export declare const VERSION = "1.1.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.0.1";
1
+ export const VERSION = "1.1.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hydraloop-diagram-react",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "React flow diagram of a Hydraloop H600, and the model that derives what the device is doing from its signals",
5
5
  "type": "module",
6
6
  "exports": {