summaryrefslogtreecommitdiffhomepage
path: root/src/features/layout/logic
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-09-05 20:44:09 +0900
committerAdam Malczewski <[email protected]>2026-09-05 20:44:09 +0900
commitd39cce17765c809cef4555c9640d12ed171cf4af (patch)
treef5a4db2ea6d8f7acf0e00b04e2712d5c7b8b3fb0 /src/features/layout/logic
parente3d5f3df3577f91b933d7ad51a339dbb05ba53dd (diff)
downloaddispatch-web-d39cce17765c809cef4555c9640d12ed171cf4af.tar.gz
dispatch-web-d39cce17765c809cef4555c9640d12ed171cf4af.zip
feat(layout): renderer renders tile border markers (main red / side green)
Diffstat (limited to 'src/features/layout/logic')
-rw-r--r--src/features/layout/logic/marker.test.ts16
-rw-r--r--src/features/layout/logic/marker.ts25
2 files changed, 41 insertions, 0 deletions
diff --git a/src/features/layout/logic/marker.test.ts b/src/features/layout/logic/marker.test.ts
new file mode 100644
index 0000000..d9e3826
--- /dev/null
+++ b/src/features/layout/logic/marker.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it } from "vitest";
+import { markerOutline } from "./marker";
+
+describe("markerOutline — the diagnostic tile-border mapping", () => {
+ it("main → a 4px solid red outline (the main tile's marker)", () => {
+ expect(markerOutline("main")).toBe("4px solid red");
+ });
+
+ it("side → a 4px solid green outline (the side tile's marker)", () => {
+ expect(markerOutline("side")).toBe("4px solid green");
+ });
+
+ it("no marker → no outline (existing trees render exactly as before)", () => {
+ expect(markerOutline(undefined)).toBeUndefined();
+ });
+});
diff --git a/src/features/layout/logic/marker.ts b/src/features/layout/logic/marker.ts
new file mode 100644
index 0000000..eb1ff84
--- /dev/null
+++ b/src/features/layout/logic/marker.ts
@@ -0,0 +1,25 @@
+/**
+ * Diagnostic tile-border markers (the contract's additive `TileMarker`
+ * presentation field) → the inline outline the renderer draws. Pure
+ * decision logic — the .svelte tile components just apply the returned
+ * style value.
+ *
+ * INLINE STYLES, deliberately: a marker value arrives in TREE DATA at
+ * runtime, and Tailwind only generates classes it sees in source files — a
+ * dynamic class from tree data would silently render nothing. An outline
+ * (not a border) is used so the diagnostic draws WITHOUT changing any
+ * tile's layout/size (4px solid, clearly visible).
+ *
+ * The marker is purely presentational: unknown/absent → no outline
+ * (existing trees render exactly as before), and no other behavior is
+ * attached to it anywhere in the renderer.
+ */
+
+import type { TileMarker } from "@dispatch/layout-contract";
+
+/** The diagnostic outline style for a marker — `undefined` = draw nothing. */
+export function markerOutline(marker: TileMarker | undefined): string | undefined {
+ if (marker === "main") return "4px solid red";
+ if (marker === "side") return "4px solid green";
+ return undefined;
+}