@a2f0/agent-tool 0.1.54 → 0.1.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a2f0/agent-tool",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "packageManager": "bun@1.4.4",
5
5
  "type": "module",
6
6
  "description": "Portable cross-agent review, PR workflows, and shared skills",
@@ -222,6 +222,17 @@ function prefers(query: string): boolean {
222
222
  return typeof matchMedia === "function" && matchMedia(query).matches;
223
223
  }
224
224
 
225
+ /**
226
+ * Whether the page renders `element` dark: its computed `color-scheme` when
227
+ * that names light or dark alone, as a site's theme switch sets it, else the
228
+ * visitor's `prefers-color-scheme`, which `normal` and `light dark` follow.
229
+ */
230
+ function rendersDark(element: Element): boolean {
231
+ const declared = typeof getComputedStyle === "function" ? getComputedStyle(element).colorScheme ?? "" : "";
232
+ const schemes = new Set(declared.split(/\s+/).filter(scheme => scheme === "light" || scheme === "dark"));
233
+ return schemes.size === 1 ? schemes.has("dark") : prefers("(prefers-color-scheme: dark)");
234
+ }
235
+
225
236
  function editable(target: EventTarget | null): boolean {
226
237
  return target instanceof HTMLElement && (target.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName));
227
238
  }
@@ -361,7 +372,7 @@ function defineGallery(): CustomElementConstructor {
361
372
  const requestedScreen = this.getAttribute("initial-screen") ?? deepLink?.screen;
362
373
  this.#project = startingProject(manifest, requestedProject, prefers("(max-width: 699px)"));
363
374
  const screen = startingScreen(manifest, this.#project, requestedScreen);
364
- this.#theme = startingTheme(manifest, this.#project, screen, prefers("(prefers-color-scheme: dark)"));
375
+ this.#theme = startingTheme(manifest, this.#project, screen, rendersDark(this));
365
376
  const signal = this.#abort!.signal;
366
377
 
367
378
  const title = element("p", { class: "shots-title", "aria-live": "polite" });