fb-slides 0.4.2 → 0.4.3

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": "fb-slides",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "description": "Markdown-driven reveal.js decks: live demo embeds, annotation, mermaid, and a zero-config dev server",
6
6
  "keywords": [
@@ -102,6 +102,7 @@ const RevealSpotlight = () => ({
102
102
  let rect = null; // {x, y, w, h} in screen px, or null when the veil is clear
103
103
  let press = null; // where the current drag started, or null
104
104
  let grab = null; // the pointer's offset into a rectangle being moved, or null
105
+ let ghostTimer = 0; // closes the old hole once the veil has faded out
105
106
 
106
107
  const layout = () => {
107
108
  if (!rect) return;
@@ -120,7 +121,11 @@ const RevealSpotlight = () => ({
120
121
  };
121
122
 
122
123
  // The clip-path stays as it was, so the hole holds its place while the
123
- // veil fades out around it.
124
+ // veil fades out around it — but only for as long as the fade runs. The
125
+ // clip cuts hit-testing along with paint, so a ghost hole left on an
126
+ // armed veil would keep handing the pointer to the slide underneath:
127
+ // right where the light last was, a drag would select text instead of
128
+ // drawing the next rectangle.
124
129
  const clear = () => {
125
130
  rect = null;
126
131
  press = null;
@@ -128,12 +133,19 @@ const RevealSpotlight = () => ({
128
133
  veil.classList.remove('has-hole');
129
134
  ring.classList.remove('has-hole', 'is-live');
130
135
  ring.style.cursor = '';
136
+ clearTimeout(ghostTimer);
137
+ ghostTimer = setTimeout(() => {
138
+ if (!rect) veil.style.clipPath = '';
139
+ }, 320); // just past the 0.3s fade
131
140
  };
132
141
 
133
142
  const setSpot = (on) => {
134
143
  armed = on;
135
144
  button.setAttribute('aria-pressed', String(on));
136
145
  toolbar.classList.toggle('is-armed', on);
146
+ // Arming must start from a whole veil: a hole still mid-fade from last
147
+ // time would leak the pointer through (see clear above).
148
+ if (on) veil.style.clipPath = '';
137
149
  // Only an armed veil takes the pointer; the rest of the time clicks fall
138
150
  // through to the slide underneath — same contract as the pen's canvas.
139
151
  veil.classList.toggle('is-live', on);