@cube-drone/marquee-html-renderer 0.4.0 → 0.6.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 +22 -0
- package/package.json +5 -5
- package/src/render.ts +22 -0
package/dist/render.js
CHANGED
|
@@ -328,6 +328,28 @@ function directive(name, attrs, nodes, ctx) {
|
|
|
328
328
|
// a paragraph) behind the same blur, same reveal-on-hover. Reuses the
|
|
329
329
|
// mq-spoiler class - the CSS is element-agnostic.
|
|
330
330
|
return `<div class="mq-spoiler mq-spoiler-block" tabindex="0">${inner}</div>`;
|
|
331
|
+
case "conflict":
|
|
332
|
+
// Versioned-document conflict: a container of two-or-more :::variant
|
|
333
|
+
// alternatives, synthesized by an embedder at read time (never authored
|
|
334
|
+
// by hand, never parsed back). The unknown-container shrug keeps it
|
|
335
|
+
// lossless on a renderer that predates it - the variants' words survive,
|
|
336
|
+
// stacked - so this rendering is pure presentation over that guarantee.
|
|
337
|
+
return `<div class="mq-conflict">${inner}</div>`;
|
|
338
|
+
case "variant": {
|
|
339
|
+
// One alternative. label/when are advisory display text, shown VERBATIM
|
|
340
|
+
// (reformatting a timestamp would make two renderers disagree - the
|
|
341
|
+
// differential-rendering hazard); role=base marks the common ancestor.
|
|
342
|
+
const head = [];
|
|
343
|
+
if (attrs["label"] !== undefined) {
|
|
344
|
+
head.push(`<span class="mq-variant-label">${escapeText(attrs["label"])}</span>`);
|
|
345
|
+
}
|
|
346
|
+
if (attrs["when"] !== undefined) {
|
|
347
|
+
head.push(`<span class="mq-variant-when">${escapeText(attrs["when"])}</span>`);
|
|
348
|
+
}
|
|
349
|
+
const cls = attrs["role"] === "base" ? "mq-variant mq-variant-base" : "mq-variant";
|
|
350
|
+
const headHtml = head.length === 0 ? "" : `<div class="mq-variant-head">${head.join(" ")}</div>`;
|
|
351
|
+
return `<div class="${cls}">${headHtml}${inner}</div>`;
|
|
352
|
+
}
|
|
331
353
|
}
|
|
332
354
|
// Unknown vocabulary: a container renders its children with an affordance
|
|
333
355
|
// that something wrapped them; a leaf renders the inert placeholder.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cube-drone/marquee-html-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Reference static HTML renderer for the Marquee markup language",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"prepack": "npm run build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@cube-drone/marquee-parser": "^0.
|
|
38
|
+
"@cube-drone/marquee-parser": "^0.6.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@cube-drone/marquee-css": "^0.
|
|
42
|
-
"@cube-drone/marquee-fonts": "^0.
|
|
43
|
-
"@cube-drone/marquee-turbolink": "^0.
|
|
41
|
+
"@cube-drone/marquee-css": "^0.6.0",
|
|
42
|
+
"@cube-drone/marquee-fonts": "^0.6.0",
|
|
43
|
+
"@cube-drone/marquee-turbolink": "^0.6.0",
|
|
44
44
|
"@types/node": "^24.0.0",
|
|
45
45
|
"typescript": "^5.9.0"
|
|
46
46
|
}
|
package/src/render.ts
CHANGED
|
@@ -362,6 +362,28 @@ function directive(name: string, attrs: Attrs, nodes: Node[], ctx: Ctx): string
|
|
|
362
362
|
// a paragraph) behind the same blur, same reveal-on-hover. Reuses the
|
|
363
363
|
// mq-spoiler class - the CSS is element-agnostic.
|
|
364
364
|
return `<div class="mq-spoiler mq-spoiler-block" tabindex="0">${inner}</div>`;
|
|
365
|
+
case "conflict":
|
|
366
|
+
// Versioned-document conflict: a container of two-or-more :::variant
|
|
367
|
+
// alternatives, synthesized by an embedder at read time (never authored
|
|
368
|
+
// by hand, never parsed back). The unknown-container shrug keeps it
|
|
369
|
+
// lossless on a renderer that predates it - the variants' words survive,
|
|
370
|
+
// stacked - so this rendering is pure presentation over that guarantee.
|
|
371
|
+
return `<div class="mq-conflict">${inner}</div>`;
|
|
372
|
+
case "variant": {
|
|
373
|
+
// One alternative. label/when are advisory display text, shown VERBATIM
|
|
374
|
+
// (reformatting a timestamp would make two renderers disagree - the
|
|
375
|
+
// differential-rendering hazard); role=base marks the common ancestor.
|
|
376
|
+
const head: string[] = [];
|
|
377
|
+
if (attrs["label"] !== undefined) {
|
|
378
|
+
head.push(`<span class="mq-variant-label">${escapeText(attrs["label"])}</span>`);
|
|
379
|
+
}
|
|
380
|
+
if (attrs["when"] !== undefined) {
|
|
381
|
+
head.push(`<span class="mq-variant-when">${escapeText(attrs["when"])}</span>`);
|
|
382
|
+
}
|
|
383
|
+
const cls = attrs["role"] === "base" ? "mq-variant mq-variant-base" : "mq-variant";
|
|
384
|
+
const headHtml = head.length === 0 ? "" : `<div class="mq-variant-head">${head.join(" ")}</div>`;
|
|
385
|
+
return `<div class="${cls}">${headHtml}${inner}</div>`;
|
|
386
|
+
}
|
|
365
387
|
}
|
|
366
388
|
// Unknown vocabulary: a container renders its children with an affordance
|
|
367
389
|
// that something wrapped them; a leaf renders the inert placeholder.
|