@ruckc/truss-code 1.51.1 → 1.52.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.
package/dist/theme.d.ts CHANGED
@@ -78,5 +78,5 @@ export interface Theme {
78
78
  }
79
79
  /** The theme in effect at `el`: nearest `data-theme`, else the OS preference; tokens and density as computed there. */
80
80
  export declare function readTheme(el: Element): Theme;
81
- /** Calls `cb` whenever the theme or density can have changed (`data-theme`, `data-density`, class or style on any ancestor, or the OS scheme). Returns a stop function. */
81
+ /** Calls `cb` whenever the theme or density can have changed (`data-theme`, `data-truss-theme`, `data-density`, class or style on any ancestor, or the OS scheme). Returns a stop function. */
82
82
  export declare function watchTheme(el: Element, cb: () => void): () => void;
package/dist/theme.js CHANGED
@@ -208,11 +208,11 @@ export function readTheme(el) {
208
208
  metrics: fontMetrics(cs.getPropertyValue('--tr-text-md'), cs.getPropertyValue('--tr-leading-normal'), cs.getPropertyValue('--tr-font-mono'))
209
209
  };
210
210
  }
211
- /** Calls `cb` whenever the theme or density can have changed (`data-theme`, `data-density`, class or style on any ancestor, or the OS scheme). Returns a stop function. */
211
+ /** Calls `cb` whenever the theme or density can have changed (`data-theme`, `data-truss-theme`, `data-density`, class or style on any ancestor, or the OS scheme). Returns a stop function. */
212
212
  export function watchTheme(el, cb) {
213
213
  const mo = new MutationObserver(cb);
214
214
  for (let n = el; n; n = n.parentElement)
215
- mo.observe(n, { attributes: true, attributeFilter: ['data-theme', 'data-density', 'class', 'style'] });
215
+ mo.observe(n, { attributes: true, attributeFilter: ['data-theme', 'data-truss-theme', 'data-density', 'class', 'style'] });
216
216
  const mq = matchMedia('(prefers-color-scheme: dark)');
217
217
  mq.addEventListener('change', cb);
218
218
  return () => { mo.disconnect(); mq.removeEventListener('change', cb); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruckc/truss-code",
3
- "version": "1.51.1",
3
+ "version": "1.52.0",
4
4
  "description": "Read-only code blocks, diff and merge views, plus an optional Monaco code editor, styled with Truss UI",
5
5
  "type": "module",
6
6
  "license": "MIT",