@cube-drone/marquee-html-renderer 0.3.0 → 0.4.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.
package/dist/render.js CHANGED
@@ -323,6 +323,11 @@ function directive(name, attrs, nodes, ctx) {
323
323
  // only inside the other two, which is exactly when you want it).
324
324
  // Physical directions, deliberately: predictable beats logical.
325
325
  return `<div class="mq-${name}">${inner}</div>`;
326
+ case "spoiler":
327
+ // The block form of the [spoiler] span: hide a whole region (an image,
328
+ // a paragraph) behind the same blur, same reveal-on-hover. Reuses the
329
+ // mq-spoiler class - the CSS is element-agnostic.
330
+ return `<div class="mq-spoiler mq-spoiler-block" tabindex="0">${inner}</div>`;
326
331
  }
327
332
  // Unknown vocabulary: a container renders its children with an affordance
328
333
  // that something wrapped them; a leaf renders the inert placeholder.
@@ -397,6 +402,13 @@ function span(name, attrs, nodes, ctx) {
397
402
  return `<small>${inner}</small>`;
398
403
  case "big":
399
404
  return `<big>${inner}</big>`; // obsolete and eternal, like <font>
405
+ case "spoiler":
406
+ // The content is present and never eaten - just blurred, revealed on
407
+ // hover/focus (the static renderer has no JS to gate a click). An
408
+ // interactive renderer turns the same class into click-to-reveal.
409
+ // Degrades, like everything, to readable content: no stylesheet means
410
+ // a visible spoiler, which beats a hidden one.
411
+ return `<span class="mq-spoiler" tabindex="0">${inner}</span>`;
400
412
  case "size": {
401
413
  const value = attrs["size"];
402
414
  if (value !== undefined && /^[1-7]$/.test(value)) {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@cube-drone/marquee-html-renderer",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Reference static HTML renderer for the Marquee markup language",
5
5
  "license": "MPL-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/cube-drone/marqueemarkup.git",
9
- "directory": "ts/html_renderer"
9
+ "directory": "ts/marquee-html-renderer"
10
10
  },
11
11
  "type": "module",
12
12
  "engines": {
@@ -35,12 +35,12 @@
35
35
  "prepack": "npm run build"
36
36
  },
37
37
  "dependencies": {
38
- "@cube-drone/marquee-parser": "^0.3.0"
38
+ "@cube-drone/marquee-parser": "^0.4.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@cube-drone/marquee-css": "^0.3.0",
42
- "@cube-drone/marquee-fonts": "^0.3.0",
43
- "@cube-drone/marquee-turbolink": "^0.3.0",
41
+ "@cube-drone/marquee-css": "^0.4.0",
42
+ "@cube-drone/marquee-fonts": "^0.4.0",
43
+ "@cube-drone/marquee-turbolink": "^0.4.0",
44
44
  "@types/node": "^24.0.0",
45
45
  "typescript": "^5.9.0"
46
46
  }
package/src/render.ts CHANGED
@@ -357,6 +357,11 @@ function directive(name: string, attrs: Attrs, nodes: Node[], ctx: Ctx): string
357
357
  // only inside the other two, which is exactly when you want it).
358
358
  // Physical directions, deliberately: predictable beats logical.
359
359
  return `<div class="mq-${name}">${inner}</div>`;
360
+ case "spoiler":
361
+ // The block form of the [spoiler] span: hide a whole region (an image,
362
+ // a paragraph) behind the same blur, same reveal-on-hover. Reuses the
363
+ // mq-spoiler class - the CSS is element-agnostic.
364
+ return `<div class="mq-spoiler mq-spoiler-block" tabindex="0">${inner}</div>`;
360
365
  }
361
366
  // Unknown vocabulary: a container renders its children with an affordance
362
367
  // that something wrapped them; a leaf renders the inert placeholder.
@@ -433,6 +438,13 @@ function span(name: string, attrs: Attrs, nodes: Node[], ctx: Ctx): string {
433
438
  return `<small>${inner}</small>`;
434
439
  case "big":
435
440
  return `<big>${inner}</big>`; // obsolete and eternal, like <font>
441
+ case "spoiler":
442
+ // The content is present and never eaten - just blurred, revealed on
443
+ // hover/focus (the static renderer has no JS to gate a click). An
444
+ // interactive renderer turns the same class into click-to-reveal.
445
+ // Degrades, like everything, to readable content: no stylesheet means
446
+ // a visible spoiler, which beats a hidden one.
447
+ return `<span class="mq-spoiler" tabindex="0">${inner}</span>`;
436
448
  case "size": {
437
449
  const value = attrs["size"];
438
450
  if (value !== undefined && /^[1-7]$/.test(value)) {