@brad-frost-web/eddie-recipes 0.51.0 → 0.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.
@@ -1,32 +1,67 @@
1
- import { E as u } from "../../../chunks/EdElement.DJfwJlMF.js";
2
- import { a as z, r as f, o as d, b as l, A as m, n as s } from "../../../chunks/lit.DaG29oZV.js";
3
- const v = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}:host{display:block}:host([ratio=fill]){width:100%;height:100%}.ed-r-visualzzz{position:relative;isolation:isolate;overflow:hidden;background:var(--ed-theme-color-background-brand)}.ed-r-visualzzz__frame{position:absolute;inset:0;display:block;width:100%;height:100%;border:0}.ed-r-visualzzz__poster{display:block;width:100%;height:100%;object-fit:cover}.ed-r-visualzzz ::slotted(*){position:absolute;inset:0;width:100%!important;height:100%!important;object-fit:cover}.ed-r-visualzzz--decorative{pointer-events:none}.ed-r-visualzzz--ratio-16-9{aspect-ratio:16/9}.ed-r-visualzzz--ratio-21-9{aspect-ratio:21/9}.ed-r-visualzzz--ratio-4-3{aspect-ratio:4/3}.ed-r-visualzzz--ratio-3-2{aspect-ratio:3/2}.ed-r-visualzzz--ratio-1-1{aspect-ratio:1/1}.ed-r-visualzzz--ratio-4-5{aspect-ratio:4/5}.ed-r-visualzzz--ratio-9-16{aspect-ratio:9/16}.ed-r-visualzzz--fill{width:100%;height:100%}';
4
- var b = Object.defineProperty, i = (n, e, t, o) => {
5
- for (var a = void 0, c = n.length - 1, h; c >= 0; c--)
6
- (h = n[c]) && (a = h(e, t, a) || a);
7
- return a && b(e, t, a), a;
1
+ import { E as z } from "../../../chunks/EdElement.DJfwJlMF.js";
2
+ import { a as k, r as _, o as p, b as l, A as v, n as a } from "../../../chunks/lit.DaG29oZV.js";
3
+ const b = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}:host{display:block}:host([ratio=fill]){width:100%;height:100%}.ed-r-visualzzz{position:relative;isolation:isolate;overflow:hidden;background:var(--ed-theme-color-background-brand)}.ed-r-visualzzz__frame{position:absolute;inset:0;display:block;width:100%;height:100%;border:0}.ed-r-visualzzz__poster{display:block;width:100%;height:100%;object-fit:cover}.ed-r-visualzzz ::slotted(*){position:absolute;inset:0;width:100%!important;height:100%!important;object-fit:cover}.ed-r-visualzzz--decorative{pointer-events:none}.ed-r-visualzzz--ratio-16-9{aspect-ratio:16/9}.ed-r-visualzzz--ratio-21-9{aspect-ratio:21/9}.ed-r-visualzzz--ratio-4-3{aspect-ratio:4/3}.ed-r-visualzzz--ratio-3-2{aspect-ratio:3/2}.ed-r-visualzzz--ratio-1-1{aspect-ratio:1/1}.ed-r-visualzzz--ratio-4-5{aspect-ratio:4/5}.ed-r-visualzzz--ratio-9-16{aspect-ratio:9/16}.ed-r-visualzzz--fill{width:100%;height:100%}';
4
+ var y = Object.defineProperty, i = (d, e, t, s) => {
5
+ for (var o = void 0, h = d.length - 1, n; h >= 0; h--)
6
+ (n = d[h]) && (o = n(e, t, o) || o);
7
+ return o && y(e, t, o), o;
8
8
  };
9
- const y = "https://visualzzz.bradfrost.com/", _ = ["16:9", "21:9", "4:3", "3:2", "1:1", "4:5", "9:16", "fill"];
10
- function p(n) {
11
- if (!n) return {};
12
- if (typeof n == "object") return n;
13
- if (typeof n == "string")
9
+ const g = "https://visualzzz.bradfrost.com/", w = ["16:9", "21:9", "4:3", "3:2", "1:1", "4:5", "9:16", "fill"], M = "[data-visualzzz-avoid]", c = 200, S = {
10
+ speed: "g.globalSpeed",
11
+ aspect: "g.aspectRatio"
12
+ }, E = [
13
+ "textAxes",
14
+ "textAxisAnim",
15
+ "textSource",
16
+ "quoteAttrColor",
17
+ "quoteMarks"
18
+ ];
19
+ function f(d) {
20
+ if (!d) return {};
21
+ if (typeof d == "object") return d;
22
+ if (typeof d == "string")
14
23
  try {
15
- const e = JSON.parse(n);
24
+ const e = JSON.parse(d);
16
25
  return e && typeof e == "object" ? e : {};
17
26
  } catch {
18
27
  return {};
19
28
  }
20
29
  return {};
21
30
  }
22
- class r extends u {
31
+ class r extends z {
23
32
  constructor() {
24
- super(...arguments), this.ratio = "16:9", this.interactive = !1, this.baseUrl = y, this._reducedMotion = !1, this._seen = !1, this._onMotionChange = (e) => {
33
+ super(...arguments), this.ratio = "16:9", this.interactive = !1, this.baseUrl = g, this._reducedMotion = !1, this._seen = !1, this._onMotionChange = (e) => {
25
34
  this._reducedMotion = e.matches;
26
- };
35
+ }, this._maskScheduled = !1, this._maskReady = !1, this._readMask = () => {
36
+ this._maskScheduled = !1;
37
+ const e = this._maskFrame, t = this._maskSelectorInUse;
38
+ if (!e?.contentWindow || !t || !this._maskReady) return;
39
+ const s = e.getBoundingClientRect(), o = [];
40
+ for (const h of document.querySelectorAll(t))
41
+ for (const n of this._rectsFor(h)) {
42
+ if (n.width <= 0 || n.height <= 0) continue;
43
+ const m = n.left - s.left, u = n.top - s.top;
44
+ u + n.height < -c || u > s.height + c || m + n.width < -c || m > s.width + c || o.push({ x: m, y: u, w: n.width, h: n.height });
45
+ }
46
+ e.contentWindow.postMessage(
47
+ {
48
+ type: "visualzzz:mask",
49
+ v: 1,
50
+ rects: o,
51
+ vw: s.width,
52
+ vh: s.height,
53
+ dpr: window.devicePixelRatio || 1
54
+ },
55
+ new URL(this.baseUrl).origin
56
+ );
57
+ }, this._scheduleMask = () => {
58
+ this._maskScheduled || (this._maskScheduled = !0, requestAnimationFrame(this._readMask));
59
+ }, this._onEmbedMessage = (e) => {
60
+ e.source === this._maskFrame?.contentWindow && e.origin === new URL(this.baseUrl).origin && (!e.data || e.data.type !== "visualzzz:mask-ready" || (this._maskReady = !0, this._scheduleMask()));
61
+ }, this._warnedDrops = /* @__PURE__ */ new Set();
27
62
  }
28
63
  static get styles() {
29
- return f(v);
64
+ return _(b);
30
65
  }
31
66
  connectedCallback() {
32
67
  if (super.connectedCallback(), typeof window < "u" && window.matchMedia && (this._motionQuery = window.matchMedia("(prefers-reduced-motion: reduce)"), this._reducedMotion = this._motionQuery.matches, this._motionQuery.addEventListener("change", this._onMotionChange)), typeof IntersectionObserver > "u") {
@@ -38,7 +73,40 @@ class r extends u {
38
73
  }, { rootMargin: "200px" }), this._observer.observe(this);
39
74
  }
40
75
  disconnectedCallback() {
41
- super.disconnectedCallback(), this._motionQuery?.removeEventListener("change", this._onMotionChange), this._observer?.disconnect();
76
+ super.disconnectedCallback(), this._motionQuery?.removeEventListener("change", this._onMotionChange), this._observer?.disconnect(), this._stopMask();
77
+ }
78
+ /**
79
+ * The mask can only be wired once an iframe exists to talk to, and the
80
+ * iframe arrives late — after first intersection, and never at all under
81
+ * reduced motion. So this runs on every update rather than at connect, and
82
+ * tears itself down again when the frame goes away.
83
+ */
84
+ updated() {
85
+ const e = this.renderRoot?.querySelector?.("iframe") ?? null;
86
+ e && this.maskSelector ? this._startMask(e) : this._stopMask();
87
+ }
88
+ _rectsFor(e) {
89
+ if (e.dataset?.visualzzzAvoid === "box") {
90
+ const s = e.getBoundingClientRect();
91
+ return s.width > 0 && s.height > 0 ? [s] : [];
92
+ }
93
+ const t = document.createRange();
94
+ return t.selectNodeContents(e), [...t.getClientRects()];
95
+ }
96
+ _startMask(e) {
97
+ const t = this.maskSelector;
98
+ if (t && !(this._maskFrame === e && this._maskSelectorInUse === t)) {
99
+ this._stopMask(), this._maskFrame = e, this._maskSelectorInUse = t, window.addEventListener("message", this._onEmbedMessage), window.addEventListener("scroll", this._scheduleMask, { passive: !0 }), window.addEventListener("resize", this._scheduleMask), e.addEventListener("load", this._scheduleMask), this._maskResize = new ResizeObserver(this._scheduleMask), this._maskResize.observe(e);
100
+ for (const s of document.querySelectorAll(t)) this._maskResize.observe(s);
101
+ this._maskMutations = new MutationObserver(this._scheduleMask), this._maskMutations.observe(document.body, {
102
+ childList: !0,
103
+ subtree: !0,
104
+ characterData: !0
105
+ }), document.fonts?.ready?.then(this._scheduleMask), this._scheduleMask();
106
+ }
107
+ }
108
+ _stopMask() {
109
+ this._maskFrame && (window.removeEventListener("message", this._onEmbedMessage), window.removeEventListener("scroll", this._scheduleMask), window.removeEventListener("resize", this._scheduleMask), this._maskFrame.removeEventListener("load", this._scheduleMask), this._maskResize?.disconnect(), this._maskMutations?.disconnect(), this._maskResize = void 0, this._maskMutations = void 0, this._maskFrame = void 0, this._maskSelectorInUse = void 0, this._maskReady = !1);
42
110
  }
43
111
  /**
44
112
  * Build the embed URL: share-URL baseline, then structural props, then the
@@ -47,25 +115,60 @@ class r extends u {
47
115
  get embedUrl() {
48
116
  const e = new URL(this.configUrl || this.baseUrl, this.baseUrl);
49
117
  if (this.configUrl) {
50
- const o = new URL(this.baseUrl);
51
- e.protocol = o.protocol, e.host = o.host, e.pathname = o.pathname;
118
+ const s = new URL(this.baseUrl);
119
+ e.protocol = s.protocol, e.host = s.host, e.pathname = s.pathname;
120
+ for (const [h, n] of Object.entries(S))
121
+ e.searchParams.has(h) && !e.searchParams.has(n) && e.searchParams.set(n, e.searchParams.get(h));
122
+ const o = E.filter((h) => e.searchParams.has(h));
123
+ o.length && this._warnDropped(o);
124
+ }
125
+ const t = (s, o) => e.searchParams.set(s, String(o));
126
+ this.anim && t("anim", this.anim), this.theme && t("theme", this.theme), this.dark !== void 0 && t("dark", this.dark ? "1" : "0"), this.speed !== void 0 && (t("speed", this.speed), t("g.globalSpeed", this.speed));
127
+ for (const [s, o] of Object.entries(f(this.params)))
128
+ t(`p.${s}`, o);
129
+ for (const [s, o] of Object.entries(f(this.globals)))
130
+ t(`g.${s}`, o);
131
+ if (e.pathname.endsWith("embed.html") || (e.pathname = e.pathname.replace(/\/?$/, "/embed.html")), this.maskSelector) {
132
+ t("mask", "1");
133
+ const s = [
134
+ ["maskFeather", this.maskFeather],
135
+ ["maskCorner", this.maskCorner],
136
+ ["maskWobble", this.maskWobble],
137
+ ["maskLobes", this.maskLobes],
138
+ ["maskDrift", this.maskDrift],
139
+ ["maskPad", this.maskPad]
140
+ ];
141
+ for (const [o, h] of s)
142
+ h !== void 0 && t(o, h);
52
143
  }
53
- const t = (o, a) => e.searchParams.set(o, String(a));
54
- this.anim && t("anim", this.anim), this.theme && t("theme", this.theme), this.dark !== void 0 && t("dark", this.dark ? "1" : "0"), this.speed !== void 0 && t("speed", this.speed);
55
- for (const [o, a] of Object.entries(p(this.params)))
56
- t(`p.${o}`, a);
57
- for (const [o, a] of Object.entries(p(this.globals)))
58
- t(`g.${o}`, a);
59
144
  return t("controls", "0"), e.toString();
60
145
  }
146
+ _warnDropped(e) {
147
+ const t = e.join(",");
148
+ this._warnedDrops.has(t) || (this._warnedDrops.add(t), console.warn(
149
+ `<ed-r-visualzzz> configUrl carries ${e.length} parameter(s) the embed does not read, so they will have no effect: ${e.join(", ")}.
150
+ Tracked upstream as Brad-Frost-Web/bf-visualzzz#71. Set the visual with \`anim\` + \`params\` + \`globals\` instead if you need these.`
151
+ ));
152
+ }
153
+ /**
154
+ * The selector whose elements the animation must avoid, or `null` when this
155
+ * embed is not masking.
156
+ *
157
+ * A bare attribute (`<ed-r-visualzzz mask>`) arrives as `''`, and a
158
+ * framework binding of `true` arrives as `'true'`; both mean "use the
159
+ * default marker". Anything else is taken as the consumer's own selector.
160
+ */
161
+ get maskSelector() {
162
+ return this.mask === void 0 || this.mask === null || this.mask === "false" ? null : this.mask === "" || this.mask === "true" ? M : this.mask;
163
+ }
61
164
  render() {
62
- const e = _.includes(this.ratio) ? this.ratio : "16:9", t = !this.label, o = this.componentClassNames("ed-r-visualzzz", {
165
+ const e = w.includes(this.ratio) ? this.ratio : "16:9", t = !this.label, s = this.componentClassNames("ed-r-visualzzz", {
63
166
  [`ed-r-visualzzz--ratio-${e.replace(":", "-")}`]: e !== "fill",
64
167
  "ed-r-visualzzz--fill": e === "fill",
65
168
  "ed-r-visualzzz--decorative": t && !this.interactive
66
169
  });
67
170
  return l`
68
- <div class="${o}" part="frame" aria-hidden="${d(t ? "true" : void 0)}">
171
+ <div class="${s}" part="frame" aria-hidden="${p(t ? "true" : void 0)}">
69
172
  ${this._reducedMotion ? this.renderStill() : this.renderLive(t)}
70
173
  </div>
71
174
  `;
@@ -89,61 +192,82 @@ class r extends u {
89
192
  class="ed-r-visualzzz__frame"
90
193
  part="iframe"
91
194
  src="${this.embedUrl}"
92
- title="${d(this.label)}"
195
+ title="${p(this.label)}"
93
196
  loading="lazy"
94
- tabindex="${d(e ? "-1" : void 0)}"
197
+ tabindex="${p(e ? "-1" : void 0)}"
95
198
  ></iframe>` : this.posterSrc ? l`<img
96
199
  class="ed-r-visualzzz__poster"
97
200
  part="poster"
98
201
  src="${this.posterSrc}"
99
202
  alt="${this.posterAlt ?? ""}"
100
- />` : m;
203
+ />` : v;
101
204
  }
102
205
  }
103
206
  i([
104
- s()
207
+ a()
105
208
  ], r.prototype, "anim");
106
209
  i([
107
- s({ type: Object })
210
+ a({ type: Object })
108
211
  ], r.prototype, "params");
109
212
  i([
110
- s({ type: Object })
213
+ a({ type: Object })
111
214
  ], r.prototype, "globals");
112
215
  i([
113
- s()
216
+ a()
114
217
  ], r.prototype, "configUrl");
115
218
  i([
116
- s()
219
+ a()
117
220
  ], r.prototype, "theme");
118
221
  i([
119
- s({ type: Boolean })
222
+ a({ type: Boolean })
120
223
  ], r.prototype, "dark");
121
224
  i([
122
- s({ type: Number })
225
+ a({ type: Number })
123
226
  ], r.prototype, "speed");
124
227
  i([
125
- s({ reflect: !0 })
228
+ a({ reflect: !0 })
126
229
  ], r.prototype, "ratio");
127
230
  i([
128
- s()
231
+ a()
129
232
  ], r.prototype, "posterSrc");
130
233
  i([
131
- s()
234
+ a()
132
235
  ], r.prototype, "posterAlt");
133
236
  i([
134
- s()
237
+ a()
135
238
  ], r.prototype, "label");
136
239
  i([
137
- s({ type: Boolean })
240
+ a({ type: Boolean })
138
241
  ], r.prototype, "interactive");
139
242
  i([
140
- s()
243
+ a()
244
+ ], r.prototype, "mask");
245
+ i([
246
+ a({ type: Number })
247
+ ], r.prototype, "maskFeather");
248
+ i([
249
+ a({ type: Number })
250
+ ], r.prototype, "maskCorner");
251
+ i([
252
+ a({ type: Number })
253
+ ], r.prototype, "maskWobble");
254
+ i([
255
+ a({ type: Number })
256
+ ], r.prototype, "maskLobes");
257
+ i([
258
+ a({ type: Number })
259
+ ], r.prototype, "maskDrift");
260
+ i([
261
+ a({ type: Number })
262
+ ], r.prototype, "maskPad");
263
+ i([
264
+ a()
141
265
  ], r.prototype, "baseUrl");
142
266
  i([
143
- z()
267
+ k()
144
268
  ], r.prototype, "_reducedMotion");
145
269
  i([
146
- z()
270
+ k()
147
271
  ], r.prototype, "_seen");
148
272
  customElements.get("ed-r-visualzzz") === void 0 && customElements.define("ed-r-visualzzz", r);
149
273
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brad-frost-web/eddie-recipes",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -55,10 +55,15 @@ type ParamBag = Record<string, string | number | boolean>;
55
55
  * Share URL into `configUrl`
56
56
  * @use Matching the visual to the host page by forwarding `theme` (an Eddie
57
57
  * token theme name) and `dark`
58
+ * @use Behind real page copy with `mask` set — the animation flows around the
59
+ * marked content instead of running under it, which is what makes the
60
+ * contrast deterministic rather than lucky
58
61
  *
59
62
  * @dontuse Behind body copy without a contrast treatment — a generative
60
- * animation is a busy, *moving* background; use the hero's
61
- * `variant="shadow"` / `"boxed"`, or `ed-band`'s `scrim`
63
+ * animation is a busy, *moving* background. Reach for `mask` first;
64
+ * fall back to the hero's `variant="shadow"` / `"boxed"` or
65
+ * `ed-band`'s `scrim` when you want the mood rather than the
66
+ * guarantee
62
67
  * @dontuse Many times on one page — each embed is a separate live canvas loop;
63
68
  * use `posterSrc` for dense layouts and save the live visual for one
64
69
  * or two focal surfaces
@@ -79,8 +84,16 @@ type ParamBag = Record<string, string | number | boolean>;
79
84
  * when the poster is decorative and the surrounding content carries the
80
85
  * meaning
81
86
  * @a11y Text placed over a visualzzz background must meet WCAG AA contrast
82
- * against the *animation at every frame*, not one lucky screenshot —
83
- * that is what the scrim treatments are for, and why they are not optional
87
+ * against the *animation at every frame*, not one lucky screenshot.
88
+ * `mask` is the strongest answer: the animation is removed from the
89
+ * text's box entirely, so the contrast is computed against a known flat
90
+ * colour rather than against whatever the animation is doing. A scrim
91
+ * damps the problem; masking removes it
92
+ * @a11y `mask` fails closed by design — a masked embed renders its backdrop
93
+ * and does not animate until it has been told where the content is. If
94
+ * this recipe never gets to measure (script error, the elements never
95
+ * appear), the visitor sees a plain surface rather than body copy over a
96
+ * live canvas
84
97
  * @a11y When `label` is set the frame becomes focusable content; give it a
85
98
  * name that describes what it is ("Generative visual: concentric
86
99
  * amoeba"), not "iframe" or "animation"
@@ -95,7 +108,8 @@ type ParamBag = Record<string, string | number | boolean>;
95
108
  *
96
109
  * @state Live — the iframe is mounted and animating (in view, motion allowed).
97
110
  * @state Deferred — before first intersection nothing is mounted; the box holds its ratio so layout never shifts when the visual arrives.
98
- * @state Reduced motion — no iframe is created; the `fallback` slot, then `posterSrc`, then a token-colored surface.
111
+ * @state Reduced motion — no iframe is created; the `fallback` slot, then `posterSrc`, then a token-colored surface. Nothing to mask, so `mask` is simply inert here.
112
+ * @state Masked, waiting — with `mask` set, the embed shows its backdrop and does not animate until this recipe has measured the marked content and sent it over. Normally a frame or two; permanent if the measurement never happens, which is the intended failure direction.
99
113
  * @state The recipe has no loading, error, disabled, or selected states — a frame that fails to load simply shows the surface behind it.
100
114
  *
101
115
  * @slot fallback - Content shown instead of the animation under `prefers-reduced-motion` (an `<img>`, an `ed-r-*` visual, anything). Takes precedence over `posterSrc`.
@@ -133,6 +147,13 @@ export declare class EdRVisualzzz extends EdElement {
133
147
  * becomes the baseline configuration; `anim`, `params`, `globals`, `theme`,
134
148
  * `dark`, and `speed` override whatever it carried. Use this when you tuned
135
149
  * a visual by hand and want exactly that one back.
150
+ *
151
+ * **Not every share-URL parameter survives.** Embeds load visualzzz's lean
152
+ * entry, which reads a subset of what the tool does — variable-font axis
153
+ * values and a few quote options among them. `speed` and `aspect` are
154
+ * translated automatically; anything else that will be ignored is named in a
155
+ * console warning rather than dropped in silence. Tracked upstream as
156
+ * bf-visualzzz#71.
136
157
  */
137
158
  configUrl?: string;
138
159
  /**
@@ -184,6 +205,54 @@ export declare class EdRVisualzzz extends EdElement {
184
205
  * the content on top of it is a bug, not a feature.
185
206
  */
186
207
  interactive: boolean;
208
+ /**
209
+ * Make the animation flow **around** the page's content instead of running
210
+ * behind it: the embed carves a soft negative space wherever the marked
211
+ * elements sit, and keeps it there as the page scrolls and reflows.
212
+ *
213
+ * Set it bare (`<ed-r-visualzzz mask>`) to protect everything marked
214
+ * `data-visualzzz-avoid`, or pass a selector of your own. The elements live
215
+ * in your document, not this component — the recipe measures them and tells
216
+ * the embed where they are.
217
+ *
218
+ * **Prefer this over a scrim when type sits on the visual.** A scrim dims
219
+ * the animation everywhere and still leaves contrast depending on which
220
+ * frame happens to be under the text. Masking removes the animation from
221
+ * the text's box entirely, which makes the contrast computable instead of
222
+ * hopeful.
223
+ *
224
+ * Text is measured line by line, so a paragraph gets a shape that follows
225
+ * its lines rather than one rectangle around the block. Mark an element
226
+ * `data-visualzzz-avoid="box"` to use its bounding box instead — right for
227
+ * a bordered masthead, wrong for prose.
228
+ */
229
+ mask?: string;
230
+ /**
231
+ * Softness of the mask's edge, px. **This is the control that carries the
232
+ * effect** — at `0` the result reads as an opaque highlight sitting behind
233
+ * the text rather than as anything flowing around it.
234
+ */
235
+ maskFeather?: number;
236
+ /**
237
+ * Shape of the mask's corners, `0`–`1`: `0` is an ellipse, `1` is nearly
238
+ * square. Barely visible once `maskFeather` is up, which is the correct
239
+ * order of importance.
240
+ */
241
+ maskCorner?: number;
242
+ /**
243
+ * Irregularity of the mask's outline, px. Stops the negative space reading
244
+ * as a rounded rectangle. A seasoning rather than the main flavour.
245
+ */
246
+ maskWobble?: number;
247
+ /** How many undulations run around each masked shape. */
248
+ maskLobes?: number;
249
+ /**
250
+ * Movement of the mask's outline, cycles/sec. `0` — the default — is frozen,
251
+ * which is both cheaper and deterministic. Turn it up for a living edge.
252
+ */
253
+ maskDrift?: number;
254
+ /** Extra clearance between the content and the animation, px. */
255
+ maskPad?: number;
187
256
  /**
188
257
  * Origin of the visualzzz deployment. Override only to point at a local dev
189
258
  * server or a preview deploy.
@@ -198,11 +267,65 @@ export declare class EdRVisualzzz extends EdElement {
198
267
  private _onMotionChange;
199
268
  connectedCallback(): void;
200
269
  disconnectedCallback(): void;
270
+ /**
271
+ * The mask can only be wired once an iframe exists to talk to, and the
272
+ * iframe arrives late — after first intersection, and never at all under
273
+ * reduced motion. So this runs on every update rather than at connect, and
274
+ * tears itself down again when the frame goes away.
275
+ */
276
+ updated(): void;
277
+ private _maskFrame?;
278
+ private _maskSelectorInUse?;
279
+ private _maskResize?;
280
+ private _maskMutations?;
281
+ private _maskScheduled;
282
+ private _maskReady;
283
+ /**
284
+ * Measure the marked elements and hand the embed their boxes.
285
+ *
286
+ * Two details carry this, and both are easy to get subtly wrong:
287
+ *
288
+ * **Coordinates are relative to the FRAME, not the viewport.** The embed
289
+ * treats what it receives as canvas coordinates. visualzzz's own snippet
290
+ * sends viewport-relative boxes and gets away with it because its
291
+ * documented shape is a fixed, full-viewport iframe where the two spaces
292
+ * coincide. Here the frame is a box on the page — a hero background, a
293
+ * timeline marker — so the frame's own origin has to come off, or the holes
294
+ * land further from the text the further down the page the embed sits.
295
+ *
296
+ * **Text is measured per line box.** `getClientRects()` on a Range returns
297
+ * one box per line, which is what lets the animation follow the shape of a
298
+ * paragraph instead of clearing one rectangle around it — for the same cost.
299
+ */
300
+ private _readMask;
301
+ private _rectsFor;
302
+ private _scheduleMask;
303
+ /**
304
+ * The embed announces itself once its message listener is installed, and
305
+ * that ping — not the iframe's `load` event — is what makes the handshake
306
+ * reliable. The embed boots asynchronously, so geometry posted at `load`
307
+ * frequently arrives before anything is listening and is silently dropped.
308
+ */
309
+ private _onEmbedMessage;
310
+ private _startMask;
311
+ private _stopMask;
201
312
  /**
202
313
  * Build the embed URL: share-URL baseline, then structural props, then the
203
314
  * params Eddie always forces.
204
315
  */
205
316
  get embedUrl(): string;
317
+ /** Params already warned about, so a re-render does not repeat itself. */
318
+ private _warnedDrops;
319
+ private _warnDropped;
320
+ /**
321
+ * The selector whose elements the animation must avoid, or `null` when this
322
+ * embed is not masking.
323
+ *
324
+ * A bare attribute (`<ed-r-visualzzz mask>`) arrives as `''`, and a
325
+ * framework binding of `true` arrives as `'true'`; both mean "use the
326
+ * default marker". Anything else is taken as the consumer's own selector.
327
+ */
328
+ get maskSelector(): string | null;
206
329
  render(): import('lit-html').TemplateResult<1>;
207
330
  /**
208
331
  * Reduced-motion path. Slot first (a consumer can put anything there),
@@ -1 +1 @@
1
- {"version":3,"file":"visualzzz.d.ts","sourceRoot":"","sources":["../../../../../packages/eddie-recipes/recipes/common/visualzzz/visualzzz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8DAA8D,CAAC;AAQzF,QAAA,MAAM,MAAM,uEAAwE,CAAC;AAErF,KAAK,cAAc,GAAG,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;AAE5C,sEAAsE;AACtE,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAoB1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACzC,MAAM,KAAK,MAAM,4BAEhB;IAED;;;;;OAKG;IAEH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IAEH,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,C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AAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
@@ -1,34 +1,69 @@
1
- import { EdElement as u } from "@brad-frost-web/eddie-web-components/components/EdElement.js";
2
- import { unsafeCSS as f, html as l, nothing as m } from "lit";
3
- import { property as o, state as z } from "lit/decorators.js";
4
- import { ifDefined as c } from "lit/directives/if-defined.js";
5
- const v = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}:host{display:block}:host([ratio=fill]){width:100%;height:100%}.ed-r-visualzzz{position:relative;isolation:isolate;overflow:hidden;background:var(--ed-theme-color-background-brand)}.ed-r-visualzzz__frame{position:absolute;inset:0;display:block;width:100%;height:100%;border:0}.ed-r-visualzzz__poster{display:block;width:100%;height:100%;object-fit:cover}.ed-r-visualzzz ::slotted(*){position:absolute;inset:0;width:100%!important;height:100%!important;object-fit:cover}.ed-r-visualzzz--decorative{pointer-events:none}.ed-r-visualzzz--ratio-16-9{aspect-ratio:16/9}.ed-r-visualzzz--ratio-21-9{aspect-ratio:21/9}.ed-r-visualzzz--ratio-4-3{aspect-ratio:4/3}.ed-r-visualzzz--ratio-3-2{aspect-ratio:3/2}.ed-r-visualzzz--ratio-1-1{aspect-ratio:1/1}.ed-r-visualzzz--ratio-4-5{aspect-ratio:4/5}.ed-r-visualzzz--ratio-9-16{aspect-ratio:9/16}.ed-r-visualzzz--fill{width:100%;height:100%}';
6
- var b = Object.defineProperty, i = (n, e, t, s) => {
7
- for (var a = void 0, d = n.length - 1, h; d >= 0; d--)
8
- (h = n[d]) && (a = h(e, t, a) || a);
9
- return a && b(e, t, a), a;
1
+ import { EdElement as z } from "@brad-frost-web/eddie-web-components/components/EdElement.js";
2
+ import { unsafeCSS as _, html as l, nothing as v } from "lit";
3
+ import { property as a, state as k } from "lit/decorators.js";
4
+ import { ifDefined as p } from "lit/directives/if-defined.js";
5
+ const b = '@charset "UTF-8";:root,:host{--size-base-unit: .5rem}*,::slotted(*),*:before,*:after{box-sizing:border-box}h1,h2,h3,h4,h5,h6{margin:0}:host{display:block}:host([ratio=fill]){width:100%;height:100%}.ed-r-visualzzz{position:relative;isolation:isolate;overflow:hidden;background:var(--ed-theme-color-background-brand)}.ed-r-visualzzz__frame{position:absolute;inset:0;display:block;width:100%;height:100%;border:0}.ed-r-visualzzz__poster{display:block;width:100%;height:100%;object-fit:cover}.ed-r-visualzzz ::slotted(*){position:absolute;inset:0;width:100%!important;height:100%!important;object-fit:cover}.ed-r-visualzzz--decorative{pointer-events:none}.ed-r-visualzzz--ratio-16-9{aspect-ratio:16/9}.ed-r-visualzzz--ratio-21-9{aspect-ratio:21/9}.ed-r-visualzzz--ratio-4-3{aspect-ratio:4/3}.ed-r-visualzzz--ratio-3-2{aspect-ratio:3/2}.ed-r-visualzzz--ratio-1-1{aspect-ratio:1/1}.ed-r-visualzzz--ratio-4-5{aspect-ratio:4/5}.ed-r-visualzzz--ratio-9-16{aspect-ratio:9/16}.ed-r-visualzzz--fill{width:100%;height:100%}';
6
+ var y = Object.defineProperty, i = (d, e, t, s) => {
7
+ for (var o = void 0, h = d.length - 1, n; h >= 0; h--)
8
+ (n = d[h]) && (o = n(e, t, o) || o);
9
+ return o && y(e, t, o), o;
10
10
  };
11
- const y = "https://visualzzz.bradfrost.com/", _ = ["16:9", "21:9", "4:3", "3:2", "1:1", "4:5", "9:16", "fill"];
12
- function p(n) {
13
- if (!n) return {};
14
- if (typeof n == "object") return n;
15
- if (typeof n == "string")
11
+ const g = "https://visualzzz.bradfrost.com/", w = ["16:9", "21:9", "4:3", "3:2", "1:1", "4:5", "9:16", "fill"], M = "[data-visualzzz-avoid]", c = 200, S = {
12
+ speed: "g.globalSpeed",
13
+ aspect: "g.aspectRatio"
14
+ }, R = [
15
+ "textAxes",
16
+ "textAxisAnim",
17
+ "textSource",
18
+ "quoteAttrColor",
19
+ "quoteMarks"
20
+ ];
21
+ function f(d) {
22
+ if (!d) return {};
23
+ if (typeof d == "object") return d;
24
+ if (typeof d == "string")
16
25
  try {
17
- const e = JSON.parse(n);
26
+ const e = JSON.parse(d);
18
27
  return e && typeof e == "object" ? e : {};
19
28
  } catch {
20
29
  return {};
21
30
  }
22
31
  return {};
23
32
  }
24
- class r extends u {
33
+ class r extends z {
25
34
  constructor() {
26
- super(...arguments), this.ratio = "16:9", this.interactive = !1, this.baseUrl = y, this._reducedMotion = !1, this._seen = !1, this._onMotionChange = (e) => {
35
+ super(...arguments), this.ratio = "16:9", this.interactive = !1, this.baseUrl = g, this._reducedMotion = !1, this._seen = !1, this._onMotionChange = (e) => {
27
36
  this._reducedMotion = e.matches;
28
- };
37
+ }, this._maskScheduled = !1, this._maskReady = !1, this._readMask = () => {
38
+ this._maskScheduled = !1;
39
+ const e = this._maskFrame, t = this._maskSelectorInUse;
40
+ if (!e?.contentWindow || !t || !this._maskReady) return;
41
+ const s = e.getBoundingClientRect(), o = [];
42
+ for (const h of document.querySelectorAll(t))
43
+ for (const n of this._rectsFor(h)) {
44
+ if (n.width <= 0 || n.height <= 0) continue;
45
+ const m = n.left - s.left, u = n.top - s.top;
46
+ u + n.height < -c || u > s.height + c || m + n.width < -c || m > s.width + c || o.push({ x: m, y: u, w: n.width, h: n.height });
47
+ }
48
+ e.contentWindow.postMessage(
49
+ {
50
+ type: "visualzzz:mask",
51
+ v: 1,
52
+ rects: o,
53
+ vw: s.width,
54
+ vh: s.height,
55
+ dpr: window.devicePixelRatio || 1
56
+ },
57
+ new URL(this.baseUrl).origin
58
+ );
59
+ }, this._scheduleMask = () => {
60
+ this._maskScheduled || (this._maskScheduled = !0, requestAnimationFrame(this._readMask));
61
+ }, this._onEmbedMessage = (e) => {
62
+ e.source === this._maskFrame?.contentWindow && e.origin === new URL(this.baseUrl).origin && (!e.data || e.data.type !== "visualzzz:mask-ready" || (this._maskReady = !0, this._scheduleMask()));
63
+ }, this._warnedDrops = /* @__PURE__ */ new Set();
29
64
  }
30
65
  static get styles() {
31
- return f(v);
66
+ return _(b);
32
67
  }
33
68
  connectedCallback() {
34
69
  if (super.connectedCallback(), typeof window < "u" && window.matchMedia && (this._motionQuery = window.matchMedia("(prefers-reduced-motion: reduce)"), this._reducedMotion = this._motionQuery.matches, this._motionQuery.addEventListener("change", this._onMotionChange)), typeof IntersectionObserver > "u") {
@@ -40,7 +75,40 @@ class r extends u {
40
75
  }, { rootMargin: "200px" }), this._observer.observe(this);
41
76
  }
42
77
  disconnectedCallback() {
43
- super.disconnectedCallback(), this._motionQuery?.removeEventListener("change", this._onMotionChange), this._observer?.disconnect();
78
+ super.disconnectedCallback(), this._motionQuery?.removeEventListener("change", this._onMotionChange), this._observer?.disconnect(), this._stopMask();
79
+ }
80
+ /**
81
+ * The mask can only be wired once an iframe exists to talk to, and the
82
+ * iframe arrives late — after first intersection, and never at all under
83
+ * reduced motion. So this runs on every update rather than at connect, and
84
+ * tears itself down again when the frame goes away.
85
+ */
86
+ updated() {
87
+ const e = this.renderRoot?.querySelector?.("iframe") ?? null;
88
+ e && this.maskSelector ? this._startMask(e) : this._stopMask();
89
+ }
90
+ _rectsFor(e) {
91
+ if (e.dataset?.visualzzzAvoid === "box") {
92
+ const s = e.getBoundingClientRect();
93
+ return s.width > 0 && s.height > 0 ? [s] : [];
94
+ }
95
+ const t = document.createRange();
96
+ return t.selectNodeContents(e), [...t.getClientRects()];
97
+ }
98
+ _startMask(e) {
99
+ const t = this.maskSelector;
100
+ if (t && !(this._maskFrame === e && this._maskSelectorInUse === t)) {
101
+ this._stopMask(), this._maskFrame = e, this._maskSelectorInUse = t, window.addEventListener("message", this._onEmbedMessage), window.addEventListener("scroll", this._scheduleMask, { passive: !0 }), window.addEventListener("resize", this._scheduleMask), e.addEventListener("load", this._scheduleMask), this._maskResize = new ResizeObserver(this._scheduleMask), this._maskResize.observe(e);
102
+ for (const s of document.querySelectorAll(t)) this._maskResize.observe(s);
103
+ this._maskMutations = new MutationObserver(this._scheduleMask), this._maskMutations.observe(document.body, {
104
+ childList: !0,
105
+ subtree: !0,
106
+ characterData: !0
107
+ }), document.fonts?.ready?.then(this._scheduleMask), this._scheduleMask();
108
+ }
109
+ }
110
+ _stopMask() {
111
+ this._maskFrame && (window.removeEventListener("message", this._onEmbedMessage), window.removeEventListener("scroll", this._scheduleMask), window.removeEventListener("resize", this._scheduleMask), this._maskFrame.removeEventListener("load", this._scheduleMask), this._maskResize?.disconnect(), this._maskMutations?.disconnect(), this._maskResize = void 0, this._maskMutations = void 0, this._maskFrame = void 0, this._maskSelectorInUse = void 0, this._maskReady = !1);
44
112
  }
45
113
  /**
46
114
  * Build the embed URL: share-URL baseline, then structural props, then the
@@ -51,23 +119,58 @@ class r extends u {
51
119
  if (this.configUrl) {
52
120
  const s = new URL(this.baseUrl);
53
121
  e.protocol = s.protocol, e.host = s.host, e.pathname = s.pathname;
122
+ for (const [h, n] of Object.entries(S))
123
+ e.searchParams.has(h) && !e.searchParams.has(n) && e.searchParams.set(n, e.searchParams.get(h));
124
+ const o = R.filter((h) => e.searchParams.has(h));
125
+ o.length && this._warnDropped(o);
126
+ }
127
+ const t = (s, o) => e.searchParams.set(s, String(o));
128
+ this.anim && t("anim", this.anim), this.theme && t("theme", this.theme), this.dark !== void 0 && t("dark", this.dark ? "1" : "0"), this.speed !== void 0 && (t("speed", this.speed), t("g.globalSpeed", this.speed));
129
+ for (const [s, o] of Object.entries(f(this.params)))
130
+ t(`p.${s}`, o);
131
+ for (const [s, o] of Object.entries(f(this.globals)))
132
+ t(`g.${s}`, o);
133
+ if (e.pathname.endsWith("embed.html") || (e.pathname = e.pathname.replace(/\/?$/, "/embed.html")), this.maskSelector) {
134
+ t("mask", "1");
135
+ const s = [
136
+ ["maskFeather", this.maskFeather],
137
+ ["maskCorner", this.maskCorner],
138
+ ["maskWobble", this.maskWobble],
139
+ ["maskLobes", this.maskLobes],
140
+ ["maskDrift", this.maskDrift],
141
+ ["maskPad", this.maskPad]
142
+ ];
143
+ for (const [o, h] of s)
144
+ h !== void 0 && t(o, h);
54
145
  }
55
- const t = (s, a) => e.searchParams.set(s, String(a));
56
- this.anim && t("anim", this.anim), this.theme && t("theme", this.theme), this.dark !== void 0 && t("dark", this.dark ? "1" : "0"), this.speed !== void 0 && t("speed", this.speed);
57
- for (const [s, a] of Object.entries(p(this.params)))
58
- t(`p.${s}`, a);
59
- for (const [s, a] of Object.entries(p(this.globals)))
60
- t(`g.${s}`, a);
61
146
  return t("controls", "0"), e.toString();
62
147
  }
148
+ _warnDropped(e) {
149
+ const t = e.join(",");
150
+ this._warnedDrops.has(t) || (this._warnedDrops.add(t), console.warn(
151
+ `<ed-r-visualzzz> configUrl carries ${e.length} parameter(s) the embed does not read, so they will have no effect: ${e.join(", ")}.
152
+ Tracked upstream as Brad-Frost-Web/bf-visualzzz#71. Set the visual with \`anim\` + \`params\` + \`globals\` instead if you need these.`
153
+ ));
154
+ }
155
+ /**
156
+ * The selector whose elements the animation must avoid, or `null` when this
157
+ * embed is not masking.
158
+ *
159
+ * A bare attribute (`<ed-r-visualzzz mask>`) arrives as `''`, and a
160
+ * framework binding of `true` arrives as `'true'`; both mean "use the
161
+ * default marker". Anything else is taken as the consumer's own selector.
162
+ */
163
+ get maskSelector() {
164
+ return this.mask === void 0 || this.mask === null || this.mask === "false" ? null : this.mask === "" || this.mask === "true" ? M : this.mask;
165
+ }
63
166
  render() {
64
- const e = _.includes(this.ratio) ? this.ratio : "16:9", t = !this.label, s = this.componentClassNames("ed-r-visualzzz", {
167
+ const e = w.includes(this.ratio) ? this.ratio : "16:9", t = !this.label, s = this.componentClassNames("ed-r-visualzzz", {
65
168
  [`ed-r-visualzzz--ratio-${e.replace(":", "-")}`]: e !== "fill",
66
169
  "ed-r-visualzzz--fill": e === "fill",
67
170
  "ed-r-visualzzz--decorative": t && !this.interactive
68
171
  });
69
172
  return l`
70
- <div class="${s}" part="frame" aria-hidden="${c(t ? "true" : void 0)}">
173
+ <div class="${s}" part="frame" aria-hidden="${p(t ? "true" : void 0)}">
71
174
  ${this._reducedMotion ? this.renderStill() : this.renderLive(t)}
72
175
  </div>
73
176
  `;
@@ -91,61 +194,82 @@ class r extends u {
91
194
  class="ed-r-visualzzz__frame"
92
195
  part="iframe"
93
196
  src="${this.embedUrl}"
94
- title="${c(this.label)}"
197
+ title="${p(this.label)}"
95
198
  loading="lazy"
96
- tabindex="${c(e ? "-1" : void 0)}"
199
+ tabindex="${p(e ? "-1" : void 0)}"
97
200
  ></iframe>` : this.posterSrc ? l`<img
98
201
  class="ed-r-visualzzz__poster"
99
202
  part="poster"
100
203
  src="${this.posterSrc}"
101
204
  alt="${this.posterAlt ?? ""}"
102
- />` : m;
205
+ />` : v;
103
206
  }
104
207
  }
105
208
  i([
106
- o()
209
+ a()
107
210
  ], r.prototype, "anim");
108
211
  i([
109
- o({ type: Object })
212
+ a({ type: Object })
110
213
  ], r.prototype, "params");
111
214
  i([
112
- o({ type: Object })
215
+ a({ type: Object })
113
216
  ], r.prototype, "globals");
114
217
  i([
115
- o()
218
+ a()
116
219
  ], r.prototype, "configUrl");
117
220
  i([
118
- o()
221
+ a()
119
222
  ], r.prototype, "theme");
120
223
  i([
121
- o({ type: Boolean })
224
+ a({ type: Boolean })
122
225
  ], r.prototype, "dark");
123
226
  i([
124
- o({ type: Number })
227
+ a({ type: Number })
125
228
  ], r.prototype, "speed");
126
229
  i([
127
- o({ reflect: !0 })
230
+ a({ reflect: !0 })
128
231
  ], r.prototype, "ratio");
129
232
  i([
130
- o()
233
+ a()
131
234
  ], r.prototype, "posterSrc");
132
235
  i([
133
- o()
236
+ a()
134
237
  ], r.prototype, "posterAlt");
135
238
  i([
136
- o()
239
+ a()
137
240
  ], r.prototype, "label");
138
241
  i([
139
- o({ type: Boolean })
242
+ a({ type: Boolean })
140
243
  ], r.prototype, "interactive");
141
244
  i([
142
- o()
245
+ a()
246
+ ], r.prototype, "mask");
247
+ i([
248
+ a({ type: Number })
249
+ ], r.prototype, "maskFeather");
250
+ i([
251
+ a({ type: Number })
252
+ ], r.prototype, "maskCorner");
253
+ i([
254
+ a({ type: Number })
255
+ ], r.prototype, "maskWobble");
256
+ i([
257
+ a({ type: Number })
258
+ ], r.prototype, "maskLobes");
259
+ i([
260
+ a({ type: Number })
261
+ ], r.prototype, "maskDrift");
262
+ i([
263
+ a({ type: Number })
264
+ ], r.prototype, "maskPad");
265
+ i([
266
+ a()
143
267
  ], r.prototype, "baseUrl");
144
268
  i([
145
- z()
269
+ k()
146
270
  ], r.prototype, "_reducedMotion");
147
271
  i([
148
- z()
272
+ k()
149
273
  ], r.prototype, "_seen");
150
274
  customElements.get("ed-r-visualzzz") === void 0 && customElements.define("ed-r-visualzzz", r);
151
275
  export {