diff --git a/frontend/src/components/TokenPreview.vue b/frontend/src/components/TokenPreview.vue new file mode 100644 index 0000000..4accb5e --- /dev/null +++ b/frontend/src/components/TokenPreview.vue @@ -0,0 +1,298 @@ + + + + + diff --git a/frontend/src/views/DesignSystemsView.vue b/frontend/src/views/DesignSystemsView.vue index 856957a..d574c1d 100644 --- a/frontend/src/views/DesignSystemsView.vue +++ b/frontend/src/views/DesignSystemsView.vue @@ -46,6 +46,7 @@ import { import { ApiError } from "@/api/client"; import { useToastStore } from "@/stores/toast"; import StarterRolePicker from "@/components/StarterRolePicker.vue"; +import TokenPreview from "@/components/TokenPreview.vue"; const toast = useToastStore(); @@ -492,8 +493,23 @@ watch(selectedId, () => { snippetCheck.value = null; }); -function isColourish(value: string): boolean { - return /^(#|rgba?\(|hsla?\(|color-mix\()/.test(value.trim()); +/** + * A colour this row can draw HONESTLY — self-contained, no `var()` inside. + * + * The provenance list below shows values as the record states them, and a + * `var()` reference states nothing on its own: rendering + * `color-mix(in srgb, var(--accent) 15%, transparent)` as a background resolves + * `--accent` against THIS app, so a system that isn't the one Scribe runs on + * would be drawn in Scribe's palette. It looked right, which is why it went + * unnoticed (#274). + * + * The preview above resolves values properly, on a probe carrying only that + * system's declarations. So this list draws only what needs no resolving, and + * leaves the rest to the surface built for it. + */ +function isSelfContainedColour(value: string): boolean { + const v = value.trim(); + return /^(#|rgba?\(|hsla?\(|color-mix\()/.test(v) && !v.includes("var("); } @@ -770,7 +786,7 @@ function isColourish(value: string): boolean { + +
+

Preview

+

+ {{ selected.title }} as it would render — resolved from the record, + not from the stylesheet this app happens to be running. +

+ +
+

Effective tokens

@@ -1022,7 +1050,7 @@ function isColourish(value: string): boolean {