@tangle-network/brand 1.27.1 → 1.29.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.
@@ -43,18 +43,6 @@ const dangerAlpha = alphaOf(
43
43
  /--focus-border-danger:\s*color-mix\(in srgb, var\(--surface-danger-text\) ([\d.]+)(%), transparent\)/,
44
44
  );
45
45
 
46
- /** Reads a token from the first source that declares it, as the cascade would. */
47
- function effective<T>(sources: string[], readToken: (css: string) => T): T {
48
- for (const css of sources) {
49
- try {
50
- return readToken(css);
51
- } catch {
52
- // Not declared here; fall through to the scope it inherits from.
53
- }
54
- }
55
- throw new Error("token resolves to nothing");
56
- }
57
-
58
46
  const lightStatus = blocksIn(themes, '[data-theme="tangle-light"]').join("\n");
59
47
  const scopes: Array<{ name: string; sources: string[] }> = [
60
48
  { name: "canonical dark", sources: [DARK] },
@@ -89,12 +77,13 @@ describe("the focus palette resolves in every theme scope", () => {
89
77
  describe("a focused field's border clears 3:1 against the field", () => {
90
78
  for (const { name, sources } of scopes) {
91
79
  it(name, () => {
92
- const field = hslToRgb(effective(sources, (css) => hslIn(css, "hsl-card")));
93
- const ring = hslToRgb(effective(sources, (css) => hslIn(css, "hsl-ring")));
80
+ // The scope chain models the cascade: a theme's own rule, then the spine it inherits.
81
+ const field = hslToRgb(hslIn(sources, "hsl-card"));
82
+ const ring = hslToRgb(hslIn(sources, "hsl-ring"));
94
83
  const border = compositeOver(ring, field, borderAlpha);
95
84
  expect(contrastRatio(border, field), "focus border on field").toBeGreaterThanOrEqual(3);
96
85
 
97
- const danger = effective(sources, (css) => hexIn(css, "surface-danger-text"));
86
+ const danger = hexIn(sources, "surface-danger-text");
98
87
  const dangerBorder = compositeOver(danger, field, dangerAlpha);
99
88
  expect(contrastRatio(dangerBorder, field), "danger focus border on field").toBeGreaterThanOrEqual(3);
100
89
  });