@cube-drone/marquee-react-renderer 0.9.1 → 0.9.2

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/render.js CHANGED
@@ -245,17 +245,20 @@ function embed(node, ctx, key) {
245
245
  return h("span", nodeProps(node, ctx, { key, className: "mq-placeholder" }), node.alt === "" ? node.target : node.alt);
246
246
  }
247
247
  const common = { key, className: "mq-embed" };
248
+ // Audio and video have no alt attribute; the description labels them for
249
+ // assistive tech instead, as the static renderer does.
250
+ const label = { "aria-label": node.alt === "" ? undefined : node.alt };
248
251
  if (media.kind === "image") {
249
252
  return h("img", nodeProps(node, ctx, { ...common, src: media.url, alt: node.alt, loading: "lazy" }));
250
253
  }
251
254
  if (media.kind === "audio") {
252
- return h("audio", nodeProps(node, ctx, { ...common, src: media.url, controls: true }));
255
+ return h("audio", nodeProps(node, ctx, { ...common, ...label, src: media.url, controls: true }));
253
256
  }
254
257
  if (media.loop === true) {
255
258
  // A silent animation: the gif's own manners - looping, muted, autoplaying, no controls.
256
- return h("video", nodeProps(node, ctx, { ...common, src: media.url, autoPlay: true, loop: true, muted: true, playsInline: true }));
259
+ return h("video", nodeProps(node, ctx, { ...common, ...label, src: media.url, autoPlay: true, loop: true, muted: true, playsInline: true }));
257
260
  }
258
- return h("video", nodeProps(node, ctx, { ...common, src: media.url, controls: true }));
261
+ return h("video", nodeProps(node, ctx, { ...common, ...label, src: media.url, controls: true }));
259
262
  }
260
263
  const TURBOLINK_LEVELS = new Set(["full", "title", "bare"]);
261
264
  function turbolink(node, target, levelAttr, ctx, key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cube-drone/marquee-react-renderer",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Interactive React renderer for the Marquee markup language: the JS halves of the animation contract (start-on-visible, tap-to-skip) plus source-position scroll sync for side-by-side editors",
5
5
  "license": "MPL-2.0",
6
6
  "repository": {
@@ -34,8 +34,8 @@
34
34
  "demo": "node --conditions=marquee-src scripts/demo.ts"
35
35
  },
36
36
  "dependencies": {
37
- "@cube-drone/marquee-html-renderer": "^0.9.1",
38
- "@cube-drone/marquee-parser": "^0.9.1"
37
+ "@cube-drone/marquee-html-renderer": "^0.9.2",
38
+ "@cube-drone/marquee-parser": "^0.9.2"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=18"
@@ -48,9 +48,9 @@
48
48
  "react": "^19.0.0",
49
49
  "react-dom": "^19.0.0",
50
50
  "typescript": "^5.9.0",
51
- "@cube-drone/marquee-css": "^0.9.1",
52
- "@cube-drone/marquee-fonts": "^0.9.1",
53
- "@cube-drone/marquee-emoji": "^0.9.1",
54
- "@cube-drone/marquee-turbolink": "^0.9.1"
51
+ "@cube-drone/marquee-css": "^0.9.2",
52
+ "@cube-drone/marquee-fonts": "^0.9.2",
53
+ "@cube-drone/marquee-emoji": "^0.9.2",
54
+ "@cube-drone/marquee-turbolink": "^0.9.2"
55
55
  }
56
56
  }
package/src/render.ts CHANGED
@@ -332,20 +332,23 @@ function embed(node: Node & { type: "embed" }, ctx: Ctx, key: string): ReactNode
332
332
  );
333
333
  }
334
334
  const common = { key, className: "mq-embed" };
335
+ // Audio and video have no alt attribute; the description labels them for
336
+ // assistive tech instead, as the static renderer does.
337
+ const label = { "aria-label": node.alt === "" ? undefined : node.alt };
335
338
  if (media.kind === "image") {
336
339
  return h("img", nodeProps(node, ctx, { ...common, src: media.url, alt: node.alt, loading: "lazy" }));
337
340
  }
338
341
  if (media.kind === "audio") {
339
- return h("audio", nodeProps(node, ctx, { ...common, src: media.url, controls: true }));
342
+ return h("audio", nodeProps(node, ctx, { ...common, ...label, src: media.url, controls: true }));
340
343
  }
341
344
  if (media.loop === true) {
342
345
  // A silent animation: the gif's own manners - looping, muted, autoplaying, no controls.
343
346
  return h(
344
347
  "video",
345
- nodeProps(node, ctx, { ...common, src: media.url, autoPlay: true, loop: true, muted: true, playsInline: true }),
348
+ nodeProps(node, ctx, { ...common, ...label, src: media.url, autoPlay: true, loop: true, muted: true, playsInline: true }),
346
349
  );
347
350
  }
348
- return h("video", nodeProps(node, ctx, { ...common, src: media.url, controls: true }));
351
+ return h("video", nodeProps(node, ctx, { ...common, ...label, src: media.url, controls: true }));
349
352
  }
350
353
 
351
354
  const TURBOLINK_LEVELS = new Set<TurbolinkLevel>(["full", "title", "bare"]);