@kontourai/survey 0.7.1 → 0.8.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.
@@ -95,6 +95,27 @@ const TOKEN_INHERIT_CSS = `/* 1. Host token defaults — literal values, not var
95
95
  --k-font-ui: inherit;
96
96
  --k-font-mono: inherit;
97
97
  --k-font-display: inherit;
98
+ }
99
+ /* 3. Light mode token overrides — applied when color-scheme="light" sets data-theme="light"
100
+ on the embed root. These are literal values (not var()) to avoid self-reference cycles.
101
+ The [data-theme="light"] selector has specificity (0,1,0) which is overridden by the
102
+ .survey-workbench-embed[class] inheritance block above for the embed container,
103
+ but the override chain means host-level --k-* tokens still win. */
104
+ .survey-workbench-embed[data-theme="light"] {
105
+ color-scheme: light;
106
+ --k-bg: #f5f4ef;
107
+ --k-panel: #ffffff;
108
+ --k-panel-raised: #fbfaf7;
109
+ --k-line: rgba(36, 40, 46, 0.12);
110
+ --k-line-strong: rgba(36, 40, 46, 0.20);
111
+ --k-text: #202124;
112
+ --k-text-muted: #5b626b;
113
+ --k-text-faint: #707782;
114
+ --k-brand: #16806f;
115
+ --k-positive: #168257;
116
+ --k-caution: #8a5a00;
117
+ --k-negative: #c83b3b;
118
+ --k-active: #3f6fd6;
98
119
  }`;
99
120
  export class SurveyReviewWorkbenchElement extends HTMLElement {
100
121
  static observedAttributes = ["theme", "color-scheme", "src"];
@@ -247,10 +268,14 @@ export class SurveyReviewWorkbenchElement extends HTMLElement {
247
268
  const colorScheme = this.getAttribute("color-scheme") ?? "dark";
248
269
  this.#mountRoot.className = `workbench survey-workbench-embed theme-${theme}`;
249
270
  this.#mountRoot.setAttribute("data-color-scheme", colorScheme);
271
+ // data-theme="light" is required by the token sheet for light mode token overrides.
272
+ // data-dark is kept for any existing selectors that used it.
250
273
  if (colorScheme === "light") {
274
+ this.#mountRoot.setAttribute("data-theme", "light");
251
275
  this.#mountRoot.removeAttribute("data-dark");
252
276
  }
253
277
  else {
278
+ this.#mountRoot.removeAttribute("data-theme");
254
279
  this.#mountRoot.setAttribute("data-dark", "");
255
280
  }
256
281
  }