@tjakoen/grain 0.1.15 → 0.1.17

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.
@@ -150,6 +150,11 @@
150
150
  position: absolute; left: calc(var(--u) * 11.7); right: calc(var(--u) * 11.7); top: calc(var(--u) * 3);
151
151
  display: flex; justify-content: space-between; align-items: baseline;
152
152
  gap: calc(var(--u) * 3); min-width: 0;
153
+ /* the bar is the FIRST child and a slide is inset:0, so without this the current slide paints
154
+ over the bar and eats its clicks. It still looked fine, because a slide is transparent: the
155
+ link was visible and dead. The dots and controls escape it only by sitting after the slides
156
+ in the DOM. */
157
+ z-index: 1;
153
158
  }
154
159
  .presentation__meta, .presentation__hint, .presentation__legend {
155
160
  margin: 0; font-size: calc(var(--u) * 1.4); color: var(--ink-faint);
@@ -37,6 +37,14 @@ test("fragments move opacity and transform only, never layout", () => {
37
37
  expect(frag![1]).not.toMatch(/display|height|margin|padding/);
38
38
  });
39
39
 
40
+ test("the bar stacks above the slides, or a link in it is visible and dead", () => {
41
+ // the bar is the first child and a slide is inset:0 with z-index auto, so the slide wins the
42
+ // paint order and swallows the clicks. It looks fine, because slides are transparent.
43
+ const bar = css.match(/\.presentation__bar\s*\{([^}]*)\}/);
44
+ expect(bar).not.toBeNull();
45
+ expect(bar![1]).toMatch(/z-index:\s*[1-9]/);
46
+ });
47
+
40
48
  test("speaker notes never render on the slide itself", () => {
41
49
  expect(css).toMatch(/\.presentation__slide \.slide-notes\s*\{\s*display:\s*none/);
42
50
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tjakoen/grain",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "GRAIN — an AI-interaction design system where every surface is operable by both a human and an AI through one shared vocabulary.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -203,6 +203,13 @@
203
203
  case "p": window.open(`${location.pathname}?presenter=1`, "grain-presenter", "width=1100,height=760"); break;
204
204
  case "f": togglePresent(); break;
205
205
  case "d": {
206
+ // Hand this to grain's theme control when the page has one, so the key and the button
207
+ // agree and the choice persists like every other scheme switch on the site. Flipping the
208
+ // attribute here as well would look identical on screen and quietly forget the choice.
209
+ const ctl = document.querySelector("[data-toggle-scheme]");
210
+ if (ctl) { ctl.click(); break; }
211
+ // standalone deck, no theme island on the page: flip it ourselves and accept that it
212
+ // lasts as long as the tab does.
206
213
  const root = document.documentElement;
207
214
  const dark = root.dataset.colorScheme
208
215
  ? root.dataset.colorScheme === "dark"
@@ -57,6 +57,16 @@ test("the presenter window is the same page, synced, and never shown to the room
57
57
  expect(js).toMatch(/postMessage\(\{ type: "key"/);
58
58
  });
59
59
 
60
+ test("the D key defers to grain's theme control, so it persists like the button", () => {
61
+ // flipping data-color-scheme here as well looks identical and forgets the choice the moment
62
+ // you leave the deck, which is how the key and the button came to disagree
63
+ const block = js.slice(js.indexOf('case "d"'), js.indexOf('case "."'));
64
+ expect(block).toMatch(/querySelector\("\[data-toggle-scheme\]"\)/);
65
+ expect(block).toMatch(/ctl\.click\(\)/);
66
+ // the standalone fallback stays, for a deck on a page with no theme island
67
+ expect(block).toMatch(/root\.dataset\.colorScheme = dark \? "light" : "dark"/);
68
+ });
69
+
60
70
  test("typing in a field never moves the deck", () => {
61
71
  expect(js).toMatch(/INPUT\|TEXTAREA\|SELECT/);
62
72
  expect(js).toMatch(/isContentEditable/);