@hypersocial/decks-cli 0.9.13 → 0.9.15
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/README.md +4 -0
- package/package.json +1 -1
- package/skills/hyperdecks/SKILL.md +22 -11
- package/skills/hyperdecks/chat.md +9 -4
- package/src/check.mjs +32 -7
- package/src/checkRules.mjs +133 -18
- package/src/commands.mjs +58 -4
- package/src/files.mjs +2 -0
- package/src/layouts.mjs +3 -3
- package/src/ops.mjs +21 -0
- package/src/runtime.mjs +4 -1
- package/src/scaffold.mjs +1 -1
- package/templates/layouts/_deck.html +3 -3
- package/templates/layouts/cover-band.html +1 -1
- package/templates/layouts/cover-frame.html +45 -0
- package/templates/layouts/cover-split.html +50 -0
- package/templates/layouts/hero.html +1 -1
package/README.md
CHANGED
|
@@ -59,6 +59,10 @@ deck list [--json]
|
|
|
59
59
|
deck stats <slug> [--json]
|
|
60
60
|
deck open <slug>
|
|
61
61
|
deck link <slug> [--json] # the owner link: present or check your own deck, untracked
|
|
62
|
+
deck archive <slug> [--json] # reversible, deletes nothing; share/preview links pause and exports are refused until unarchived
|
|
63
|
+
deck unarchive <slug> [--json] # back to the status it had (live stays live; draft if unknown)
|
|
64
|
+
deck rm <slug> --yes # PERMANENT: deletes the deck, every share link and its history.
|
|
65
|
+
# Without --yes (or --confirm <slug>) it only shows what would go.
|
|
62
66
|
|
|
63
67
|
share new <slug> <recipient> [--email e] [--note n] [--require-email] [--expires iso] [--limit n] [--qa] [--no-notify]
|
|
64
68
|
share list <slug> [--json]
|
package/package.json
CHANGED
|
@@ -502,19 +502,21 @@ saves one.
|
|
|
502
502
|
**Textures, icons, pictures:** the `look` topic (one texture, one icon set
|
|
503
503
|
from `search_icons` or `generate_icon_set`, a picture on every other slide).
|
|
504
504
|
|
|
505
|
-
**Pick the layout from what the slide says** (each file
|
|
506
|
-
|
|
505
|
+
**Pick the layout from what the slide says** (each layout file opens
|
|
506
|
+
with its slot, presenter and cues).
|
|
507
507
|
|
|
508
|
-
**
|
|
509
|
-
|
|
510
|
-
|
|
508
|
+
**Open on a cover, the title on a solid ground**; with a strong picture,
|
|
509
|
+
`cover-frame` or `cover-split`. A picture faded under the title is hard to
|
|
510
|
+
read (`check` warns).
|
|
511
511
|
|
|
512
512
|
| Layout | Use it for | Presenter, moves |
|
|
513
513
|
|---|---|---|
|
|
514
|
-
| `hero` | the default cover
|
|
515
|
-
| `cover-
|
|
516
|
-
| `cover-
|
|
517
|
-
| `cover-
|
|
514
|
+
| `hero` | the default cover: the subject framed beside the title | stage; `[wave]`, `[look: h1]` |
|
|
515
|
+
| `cover-frame` | a strong picture, framed under the title | as `hero` |
|
|
516
|
+
| `cover-split` | a big picture: a hard 50/50 | as `hero` |
|
|
517
|
+
| `cover-band` | the picture fills the slide, title on a panel | as `hero` |
|
|
518
|
+
| `cover-poster` | a wide scene on top, title below | as `hero` |
|
|
519
|
+
| `cover-type` | no picture: type only | as `hero` |
|
|
518
520
|
| `number` | one number with its source: proof, traction, a delta | stage; `[look: #<id>-figure]` as it is said |
|
|
519
521
|
| `product` | a screenshot in a browser frame (`.frame.card` for a phone) with the point beside it | stage; `[look: #<id>-frame]`, `[reveal: #<id>-callout]` |
|
|
520
522
|
| `split` | the workhorse: a real picture (phone, laptop, 16:9) beside sticker, title, three ticks | stage, bottom-left; `[look: #<id>-frame]`, `[go: #<id>-t1]` … `t3` |
|
|
@@ -846,8 +848,8 @@ with the player's `hyperdecks.ai` script tag. Messages and what to do:
|
|
|
846
848
|
| `forbidden phrase` | remove it from the page, script or narration |
|
|
847
849
|
| `slide <id>: needs a data-note` / ⚠ `no data-note` | add the source (required on a `data-kind="pitch"` deck and with `--strict`) |
|
|
848
850
|
| `slide <id>: title … needs a data-title-mobile` | add a shorter title |
|
|
849
|
-
| `slide <id>: the hero's art` / `the cover's picture` / `the product screenshot` / `the chart … is still the layout's placeholder` | make the real file (`gen-image`, `screenshot <url>`, `chart <spec.json>`) and swap the element for the `<img>` the message names; or delete the hero's `<div class="art">` for no art (on `cover-band` / `cover-poster`, switch to `cover-type` instead) |
|
|
850
|
-
| ⚠ `slide <id>: the
|
|
851
|
+
| `slide <id>: the hero's art` / `the cover's picture` / `the product screenshot` / `the chart … is still the layout's placeholder` | make the real file (`gen-image`, `screenshot <url>`, `chart <spec.json>`) and swap the element for the `<img>` the message names; or delete the hero's `<div class="art">` for no art (on `cover-frame` / `cover-split` / `cover-band` / `cover-poster`, switch to `cover-type` instead) |
|
|
852
|
+
| ⚠ `slide <id>: the cover fades its picture into the ground …` / `lays a gradient over its picture` / `the cover's title sits on its picture` | hard to read: open on `cover-frame` or `cover-split` (or `hero`, `cover-band`, `cover-poster`, `cover-type`), or drop the fade and keep the title off the picture |
|
|
851
853
|
| `… presenter style "…" is not one of` | use stage, bubble, glass or corner |
|
|
852
854
|
| `script.md line N: [go: …] matches nothing in slide <id>` | fix the selector, or add the element to that slide |
|
|
853
855
|
| `… transition "…" is not one of` | use drift, cut, push, wipe, zoom `<selector>`, morph or fly |
|
|
@@ -998,6 +1000,15 @@ rebuild's list on 2026-11-05 produced four.
|
|
|
998
1000
|
live changes, state the action and target clearly before executing when user
|
|
999
1001
|
intent is ambiguous.
|
|
1000
1002
|
- Avoid printing full share tokens unless the user needs the exact URL/token.
|
|
1003
|
+
- To retire a deck ("archive it", "put it away", a superseded draft), archive it:
|
|
1004
|
+
`hyperdecks deck archive <slug>` / `archive_deck`. It is reversible
|
|
1005
|
+
(`deck unarchive` / `unarchive_deck` puts back the status it had) and deletes
|
|
1006
|
+
nothing. While archived, its share and preview links show "no longer active"
|
|
1007
|
+
and exports are refused.
|
|
1008
|
+
`deck rm` / `remove_deck` is a permanent delete of the deck, every share link
|
|
1009
|
+
and all its visit history. Use it only when the user asks to delete, and
|
|
1010
|
+
confirm the slug first; `deck rm` refuses without `--yes` (or
|
|
1011
|
+
`--confirm <slug>`) and shows what would go.
|
|
1001
1012
|
|
|
1002
1013
|
## Animated email previews (0.1.10+)
|
|
1003
1014
|
|
|
@@ -49,8 +49,10 @@ makes the hello deck; continue from step 5 below.
|
|
|
49
49
|
layouts' stand-ins (the covers' `<div class="art">`, product's
|
|
50
50
|
`<div class="shot">`, chart's placeholder `<svg>`) fail `check_deck` until
|
|
51
51
|
you swap each for an `<img>` of its real file, or delete the hero's art.
|
|
52
|
-
Open on a cover (`hero`, `cover-
|
|
53
|
-
deck_guide topic layouts)
|
|
52
|
+
Open on a cover (`hero`, `cover-frame`, `cover-split`, `cover-band`,
|
|
53
|
+
`cover-poster` or `cover-type`, deck_guide topic layouts); with a strong
|
|
54
|
+
picture, `cover-frame` or `cover-split`. Keep the title and lead on a solid
|
|
55
|
+
ground: a picture faded into the ground under the title is hard to read.
|
|
54
56
|
Icons: one set per deck (`look` topic): `search_icons { query }` for real
|
|
55
57
|
line icons as inline `<svg>` in `currentColor`, or one `generate_icon_set`.
|
|
56
58
|
For motion, `generate_video` (poll `check_video_job`): `loop: true` for a
|
|
@@ -110,8 +112,11 @@ makes the hello deck; continue from step 5 below.
|
|
|
110
112
|
gates; owners can turn it off with `set_deck_view { slug, aiReadable: false }`.
|
|
111
113
|
`set_share_notify` to mute a link's "opened" alerts;
|
|
112
114
|
`set_recipient_archived` to tidy the activity feed; `credits` for the
|
|
113
|
-
balance. `
|
|
114
|
-
|
|
115
|
+
balance. `archive_deck` sets a deck aside reversibly (its links pause and
|
|
116
|
+
exports are refused while archived; nothing is deleted; `unarchive_deck` brings it back as it was): use it when
|
|
117
|
+
someone wants a deck archived or out of the way. `remove_deck` permanently
|
|
118
|
+
deletes a deck and breaks every link to it: only when they ask to delete,
|
|
119
|
+
and confirm the slug with them first.
|
|
115
120
|
11. When someone asks for "the PDF" (a data room, an attachment):
|
|
116
121
|
`export_deck { slug, kind: "pdf", notes? }` renders the released deck, one
|
|
117
122
|
1600×900 page per slide with a footer carrying its tracked link (pass
|
package/src/check.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// hosted check); this file adds the folder I/O and the Chromium measurements.
|
|
11
11
|
import { existsSync, lstatSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
13
|
-
import { PHONE, PRESENTER_FOOTPRINT, checkSources, overlapWarnings, phoneOverflowErrors, slideStyles, stageSize, MESSAGES } from "./checkRules.mjs";
|
|
13
|
+
import { COVER_LAYOUTS, PHONE, PRESENTER_FOOTPRINT, checkSources, coverTextWarnings, overlapWarnings, phoneOverflowErrors, slideStyles, stageSize, MESSAGES } from "./checkRules.mjs";
|
|
14
14
|
|
|
15
15
|
import { withLoadingBlock } from "./loadingBlock.mjs";
|
|
16
16
|
|
|
@@ -19,9 +19,11 @@ export * from "./loadingBlock.mjs";
|
|
|
19
19
|
|
|
20
20
|
// Lay each slide out in Chromium at the deck's stage size with JavaScript off
|
|
21
21
|
// (no player, no deck scripts), put the style's footprint in its slot, and
|
|
22
|
-
// measure it against the title's text
|
|
22
|
+
// measure it against the title's text; on the first slide and any cover, also
|
|
23
|
+
// whether a line of the title lands on a picture (onPicture, for
|
|
24
|
+
// coverTextWarnings). Needs `hyperdecks preview setup`.
|
|
23
25
|
export async function measureLayout(deckDir, styles, { width = 1600, height = 900 } = {}) {
|
|
24
|
-
return withDeckPage(deckDir, { width, height }, (page) => page.evaluate(({ styles, footprint, width, height }) => {
|
|
26
|
+
return withDeckPage(deckDir, { width, height }, (page) => page.evaluate(({ styles, footprint, width, height, covers }) => {
|
|
25
27
|
const box = (r) => ({ x: r.left, y: r.top, width: r.width, height: r.height });
|
|
26
28
|
const sections = [...document.querySelectorAll("section.slide")];
|
|
27
29
|
const host = sections[0]?.parentElement ?? document.body;
|
|
@@ -54,9 +56,30 @@ export async function measureLayout(deckDir, styles, { width = 1600, height = 90
|
|
|
54
56
|
title = { x: x0, y: y0, width: Math.max(...rects.map((r) => r.right)) - x0, height: Math.max(...rects.map((r) => r.bottom)) - y0 };
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
|
-
|
|
59
|
+
// The cover's title on its picture (coverTextWarnings): a line of the title over a picture
|
|
60
|
+
// (an <img>, <video> or <canvas> that is not a .brand-logo or .icon, or a one-picture url()
|
|
61
|
+
// background, the slide's own included; nothing inside the title itself), unless
|
|
62
|
+
// an opaque panel between them holds the line, as cover-band's does.
|
|
63
|
+
let onPicture = false;
|
|
64
|
+
if (heading && (i === 0 || covers.some((c) => slide.classList.contains(c)))) {
|
|
65
|
+
const range = document.createRange();
|
|
66
|
+
range.selectNodeContents(heading);
|
|
67
|
+
const lines = [...range.getClientRects()].filter((r) => r.width && r.height);
|
|
68
|
+
// A url() background counts when it is one picture (no-repeat or cover/contain), not a repeating texture.
|
|
69
|
+
const photoBackground = (cs) => /url\(/.test(cs.backgroundImage) && (/no-repeat/.test(cs.backgroundRepeat) || /cover|contain/.test(cs.backgroundSize));
|
|
70
|
+
const pictures = [slide, ...slide.querySelectorAll("*")].filter((n) => !heading.contains(n) &&
|
|
71
|
+
((/^(IMG|VIDEO|CANVAS)$/.test(n.tagName) && !n.closest(".brand-logo, .icon")) || photoBackground(getComputedStyle(n))));
|
|
72
|
+
// Opaque: any colour but transparent or one with an alpha below 1 (Chromium writes color-mix as color(srgb …) and keeps oklch).
|
|
73
|
+
const opaque = (bg) => bg !== "transparent" && !/^rgba\(.*,\s*(?:0|0?\.\d+)\s*\)$/.test(bg) && !/\/\s*(?:0|0?\.\d+|\d{1,2}(?:\.\d+)?%)\s*\)$/.test(bg);
|
|
74
|
+
const panels = [];
|
|
75
|
+
for (let n = heading; n && n !== slide; n = n.parentElement) if (opaque(getComputedStyle(n).backgroundColor)) panels.push(n);
|
|
76
|
+
const hit = (a, b) => Math.min(a.right, b.right) - Math.max(a.left, b.left) > 4 && Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top) > 4;
|
|
77
|
+
onPicture = lines.some((line) => pictures.some((p) => hit(line, p.getBoundingClientRect()) &&
|
|
78
|
+
!panels.some((panel) => !panel.contains(p) && hit(line, panel.getBoundingClientRect()))));
|
|
79
|
+
}
|
|
80
|
+
return { id, style, presenter, title, onPicture };
|
|
58
81
|
});
|
|
59
|
-
}, { styles, footprint: PRESENTER_FOOTPRINT, width, height }));
|
|
82
|
+
}, { styles, footprint: PRESENTER_FOOTPRINT, width, height, covers: COVER_LAYOUTS }));
|
|
60
83
|
}
|
|
61
84
|
|
|
62
85
|
// Lay each slide out as the framed player shows it on a phone: the deck's own
|
|
@@ -163,12 +186,14 @@ export function deckFolder(deckDir) {
|
|
|
163
186
|
// (the hosted release measures a draft the same way, from a temp folder). A
|
|
164
187
|
// presenter over the title is a warning, not a failure: only a person can judge
|
|
165
188
|
// it. A slide that overflows the phone card is an error: the player never
|
|
166
|
-
// scrolls a slide. No Chromium is a warning, as each measurement is optional.
|
|
189
|
+
// scrolls a slide. A cover whose title lands on its picture is a warning. No Chromium is a warning, as each measurement is optional.
|
|
167
190
|
export async function layoutCheck(deckDir, html, manifest = null, { measure = measureLayout, measureFit = measurePhoneFit } = {}) {
|
|
168
191
|
const errors = [], warnings = [];
|
|
169
192
|
const { width: w, height: h } = stageSize(html);
|
|
170
193
|
try {
|
|
171
|
-
|
|
194
|
+
const measured = await measure(deckDir, slideStyles(html, manifest), { width: w, height: h });
|
|
195
|
+
warnings.push(...overlapWarnings(measured, `${w}×${h}`));
|
|
196
|
+
warnings.push(...coverTextWarnings(measured));
|
|
172
197
|
} catch (e) {
|
|
173
198
|
warnings.push(MESSAGES.layoutUnchecked(e.message));
|
|
174
199
|
}
|
package/src/checkRules.mjs
CHANGED
|
@@ -72,7 +72,7 @@ export const MESSAGES = {
|
|
|
72
72
|
transitionStale: (where, script, manifest) => `${where}: script.md says transition "${script}" but the manifest has "${manifest}": run \`hyperdecks narrate\` so the player gets it`,
|
|
73
73
|
flyTwice: (ids) => `fly is for the deck's one big moment, but slides ${ids.join(", ")} all use it`,
|
|
74
74
|
// Warnings from the look topic (deck_guide look): the deck passes, but a person should look.
|
|
75
|
-
coverFade: (where,
|
|
75
|
+
coverFade: (where, what) => `${where}: the cover ${what}, so the title sits on a mix of picture and colour that is hard to read: prefer cover-frame or cover-split (or hero, cover-band, cover-poster, cover-type), which keep the title on a solid ground (deck_guide topic layouts)`,
|
|
76
76
|
fewPictures: (shown, total) => `only ${shown} of ${total} slides show a picture (a screenshot, a recording, a photo, a chart); aim for a real one on every other slide (deck_guide topic look)`,
|
|
77
77
|
presenterGutter: (where, decl) => `${where}: ${decl} keeps a right gutter for the presenter; leave that corner to the slide's .narration-slot so a deck without a presenter can use it (deck_guide topic look)`,
|
|
78
78
|
mixedIcons: (sets) => `the deck mixes icon sets (${sets.join(" and ")}); keep one set per deck (deck_guide topic look)`,
|
|
@@ -85,6 +85,7 @@ export const MESSAGES = {
|
|
|
85
85
|
layoutUnchecked: (why) => `layout not checked: ${why}`,
|
|
86
86
|
hotlink: (url) => `${url} is hotlinked from another site and can vanish after release; upload it with upload_deck_asset`,
|
|
87
87
|
transitionKinds: (kinds, deck) => `${kinds.length} kinds of transition besides the default (${deck}): ${kinds.join(", ")}; keep to ${MAX_TRANSITION_KINDS} so the deck reads as designed`,
|
|
88
|
+
coverText: (where) => `${where}: the cover's title sits on its picture, which is hard to read: prefer a cover that keeps the title on a solid ground beside, above or below the picture (cover-frame, cover-split, hero, cover-band, cover-poster or cover-type; deck_guide topic layouts)`,
|
|
88
89
|
overlap: (id, style, stage) => `slide ${id}: the ${style} presenter would overlap the title at ${stage}; move the .narration-slot or pick another style`,
|
|
89
90
|
// An error, though only check --layout can see it.
|
|
90
91
|
phoneOverflow: (id, px) => `slide ${id}: its content runs ${px}px past the slide on a ${PHONE.width}×${PHONE.height} phone; a slide must fit one screen without scrolling, so trim it or tighten its @media (max-width: 650px) rules`,
|
|
@@ -549,6 +550,14 @@ const PLACEHOLDERS = [
|
|
|
549
550
|
layout: "l-hero", tag: "div", cls: "art", what: "the hero's art", img: '<img class="art" src="…" alt="">, or delete the div for no art (the presenter is the visual)',
|
|
550
551
|
how: { hosted: "make a picture of the real subject with generate_image", cli: "make a picture of the real subject with `hyperdecks gen-image \"<prompt>\"`" },
|
|
551
552
|
},
|
|
553
|
+
{
|
|
554
|
+
layout: "l-cover-frame", tag: "div", cls: "art", what: "the cover's picture", img: '<img class="art" src="…" alt="">, or use the cover-type layout for no picture',
|
|
555
|
+
how: { hosted: "make a wide picture of the real subject with generate_image", cli: "make a wide picture of the real subject with `hyperdecks gen-image \"<prompt>\"`" },
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
layout: "l-cover-split", tag: "div", cls: "art", what: "the cover's picture", img: '<img class="art" src="…" alt="">, or use the cover-type layout for no picture',
|
|
559
|
+
how: { hosted: "make a portrait or square picture of the real subject with generate_image", cli: "make a portrait or square picture of the real subject with `hyperdecks gen-image \"<prompt>\"`" },
|
|
560
|
+
},
|
|
552
561
|
{
|
|
553
562
|
layout: "l-cover-band", tag: "div", cls: "art", what: "the cover's picture", img: '<img class="art" src="…" alt="">, or use the cover-type layout for no picture',
|
|
554
563
|
how: { hosted: "make a wide picture of the real subject with generate_image", cli: "make a wide picture of the real subject with `hyperdecks gen-image \"<prompt>\"`" },
|
|
@@ -732,6 +741,12 @@ export function overlapWarnings(measured, stage = "1600×900") {
|
|
|
732
741
|
return measured.filter((m) => hit(m.presenter, m.title)).map((m) => MESSAGES.overlap(m.id, m.style, stage));
|
|
733
742
|
}
|
|
734
743
|
|
|
744
|
+
// Covers whose rendered title lands on their picture, as warnings. Each entry: { id, onPicture }
|
|
745
|
+
// (measureLayout sets onPicture on the first slide and on any slide with a cover layout).
|
|
746
|
+
export function coverTextWarnings(measured) {
|
|
747
|
+
return measured.filter((m) => m.onPicture).map((m) => MESSAGES.coverText(`slide ${m.id}`));
|
|
748
|
+
}
|
|
749
|
+
|
|
735
750
|
// Slides whose content overflows the phone card, as errors. Each entry: { id, overflow } in px.
|
|
736
751
|
export function phoneOverflowErrors(measured) {
|
|
737
752
|
return measured.filter((m) => m.overflow > 1).map((m) => MESSAGES.phoneOverflow(m.id, Math.ceil(m.overflow)));
|
|
@@ -836,25 +851,125 @@ export function lookWarnings(html) {
|
|
|
836
851
|
if (iconImg(tag)) sets.add("image icons");
|
|
837
852
|
}
|
|
838
853
|
if (sets.size > 1) out.push(MESSAGES.mixedIcons([...sets].sort()));
|
|
839
|
-
out.push(...textureWarnings(all, html), ...coverFadeWarnings(
|
|
854
|
+
out.push(...textureWarnings(all, html), ...coverFadeWarnings(html));
|
|
840
855
|
return out;
|
|
841
856
|
}
|
|
842
857
|
|
|
843
|
-
// Covers
|
|
844
|
-
//
|
|
845
|
-
//
|
|
846
|
-
//
|
|
847
|
-
//
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
858
|
+
// Covers that fade a picture into the ground (docs/roadmap/covers-never-fade-a-picture-into-the-ground.md):
|
|
859
|
+
// discouraged, as hard to read, so a warning (never a failure) on the first slide, whatever its
|
|
860
|
+
// class, and on any slide that uses a cover layout. Two checks: this one reads the source (fast,
|
|
861
|
+
// and the only one the hosted check_deck runs), and check --layout (run by every release, hosted
|
|
862
|
+
// or not) measures the rendered title
|
|
863
|
+
// against the picture (coverTextWarnings), the authoritative one: only rendering proves text sits on a picture. In the source a
|
|
864
|
+
// fade is a gradient mask on a picture (or what holds one; or on a cover layout's own rule, picture
|
|
865
|
+
// in or not), a linear-gradient to or from transparent laid over a picture (a ::before/::after on it
|
|
866
|
+
// or what holds it, an absolutely positioned element on the cover, or a layer on the same background
|
|
867
|
+
// as its url()). Repeating gradients (the layouts' hatched stand-ins) and the kit's textures (radial
|
|
868
|
+
// masks on ::before) are not fades.
|
|
869
|
+
export const COVER_LAYOUTS = ["l-hero", "l-cover-band", "l-cover-poster", "l-cover-type", "l-cover-frame", "l-cover-split"];
|
|
870
|
+
const VOID_TAGS = new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "source", "track", "wbr"]);
|
|
871
|
+
// The elements of a slide: the section first, then each element of its body with where it ends.
|
|
872
|
+
function slideElements(s) {
|
|
873
|
+
const els = [{ tag: s.tag, name: "section", start: -1, end: Infinity }];
|
|
874
|
+
const stack = [];
|
|
875
|
+
for (const m of s.body.matchAll(/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/g)) {
|
|
876
|
+
const name = m[2].toLowerCase();
|
|
877
|
+
if (m[1]) {
|
|
878
|
+
const at = stack.map((e) => e.name).lastIndexOf(name);
|
|
879
|
+
if (at >= 0) for (const e of stack.splice(at)) e.end = m.index;
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
const el = { tag: m[0], name, start: m.index, end: m.index + m[0].length };
|
|
883
|
+
els.push(el);
|
|
884
|
+
if (!VOID_TAGS.has(name) && !m[3]) { el.end = Infinity; stack.push(el); }
|
|
885
|
+
}
|
|
886
|
+
for (const e of stack) e.end = s.body.length;
|
|
887
|
+
return els;
|
|
888
|
+
}
|
|
889
|
+
// Whether one compound selector (tag#id.class[attr], pseudo-classes dropped) names this element.
|
|
890
|
+
function compoundMatches(el, compound) {
|
|
891
|
+
const c = compound.replace(/\[[^\]]*\]/g, "");
|
|
892
|
+
const m = /^(\*|[a-zA-Z][\w-]*)?((?:[#.][\w-]+)*)$/.exec(c);
|
|
893
|
+
if (!m) return false;
|
|
894
|
+
if (m[1] && m[1] !== "*" && m[1].toLowerCase() !== el.name) return false;
|
|
895
|
+
const have = classes(el.tag);
|
|
896
|
+
return [...m[2].matchAll(/([#.])([\w-]+)/g)].every(([, k, v]) => (k === "#" ? attr(el.tag, "id") === v : have.includes(v)));
|
|
897
|
+
}
|
|
898
|
+
// A selector's subject on this slide: the elements its last compound names, when every compound
|
|
899
|
+
// before it names something on the slide too (a loose descendant test), and whether it is a ::before/::after.
|
|
900
|
+
function selectorSubjects(els, selector) {
|
|
901
|
+
const pseudo = /::?(before|after)\b/i.test(selector);
|
|
902
|
+
const plain = selector.replace(/\[[^\]]*\]/g, "").replace(/::?[\w-]+(\((?:[^()]|\([^()]*\))*\))?/g, "").trim();
|
|
903
|
+
if (!plain) return null;
|
|
904
|
+
const compounds = plain.split(/\s*[>+~]\s*|\s+/).filter(Boolean);
|
|
905
|
+
// Leading compounds that name nothing here are ancestors outside the slide (html, body, a wrapper,
|
|
906
|
+
// a root state class), so they always match, unless they name a slide or a layout this one is not.
|
|
907
|
+
const first = compounds.slice(0, -1).findIndex((c) => els.some((el) => compoundMatches(el, c)));
|
|
908
|
+
const outside = first === -1 ? compounds.slice(0, -1) : compounds.slice(0, first);
|
|
909
|
+
if (outside.some((c) => /\.l-[\w-]|\.slide(?![\w-])|^section\b/.test(c))) return null;
|
|
910
|
+
if (first !== -1 && !compounds.slice(first, -1).every((c) => els.some((el) => compoundMatches(el, c)))) return null;
|
|
911
|
+
const hits = els.filter((el) => compoundMatches(el, compounds.at(-1)));
|
|
912
|
+
return hits.length ? { els: hits, pseudo } : null;
|
|
913
|
+
}
|
|
914
|
+
// A selector list split on its own commas, not those inside :is(…) or :not(…).
|
|
915
|
+
function topLevel(list) {
|
|
916
|
+
const out = [""];
|
|
917
|
+
let depth = 0;
|
|
918
|
+
for (const ch of list) {
|
|
919
|
+
if (ch === "(") depth++;
|
|
920
|
+
else if (ch === ")") depth--;
|
|
921
|
+
if (ch === "," && depth === 0) out.push("");
|
|
922
|
+
else out[out.length - 1] += ch;
|
|
855
923
|
}
|
|
856
|
-
|
|
857
|
-
|
|
924
|
+
return out;
|
|
925
|
+
}
|
|
926
|
+
const FADE_MASK = /(?:^|[;\s])(?:-webkit-)?mask(?:-image)?\s*:[^;]*(?<!repeating-)(?:linear|radial|conic)-gradient\(/i;
|
|
927
|
+
// A linear-gradient (not repeating) with a transparent stop: a fade to or from the ground.
|
|
928
|
+
// (A color-mix(…, transparent) is a flat tint, not a stop.)
|
|
929
|
+
const fadeGradient = (value) => [...value.matchAll(/(?<!repeating-)linear-gradient\(((?:[^()]|\((?:[^()]|\([^()]*\))*\))*)\)/gi)]
|
|
930
|
+
.map(([, args]) => args.replace(/color-mix\((?:[^()]|\([^()]*\))*\)/gi, "c"))
|
|
931
|
+
.some((args) => /\btransparent\b|rgba?\([^)]*[,/]\s*0(?:\.0*)?\s*\)|hsla?\([^)]*[,/]\s*0(?:\.0*)?\s*\)|#[0-9a-f]{6}00\b|#[0-9a-f]{3}0\b/i.test(args));
|
|
932
|
+
const backgroundsOf = (body) => [...body.matchAll(/(?:^|[;\s])background(?:-image)?\s*:([^;]*)/gi)].map((m) => m[1]);
|
|
933
|
+
export function coverFadeWarnings(html) {
|
|
934
|
+
const css = [...uncommented(html).matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((m) => m[1].replace(/\/\*[\s\S]*?\*\//g, "")).join("\n");
|
|
935
|
+
const rules = [...css.matchAll(/([^{}]*)\{([^{}]*)\}/g)].flatMap(([, sel, body]) => topLevel(sel).map((s) => ({ selector: s.trim(), body })));
|
|
936
|
+
return slides(html).flatMap((s, i) => {
|
|
937
|
+
if (i > 0 && !classes(s.tag).some((c) => COVER_LAYOUTS.includes(c))) return [];
|
|
938
|
+
const els = slideElements(s);
|
|
939
|
+
// The slide's rules: each stylesheet rule that names something here, and each inline style.
|
|
940
|
+
const own = [
|
|
941
|
+
...rules.map((r) => ({ ...selectorSubjects(els, r.selector), body: r.body })).filter((r) => r.els),
|
|
942
|
+
...els.filter((el) => attr(el.tag, "style")).map((el) => ({ els: [el], pseudo: false, body: attr(el.tag, "style") })),
|
|
943
|
+
];
|
|
944
|
+
const urlBacked = new Set(own.filter((r) => !r.pseudo && backgroundsOf(r.body).some((v) => /url\(/i.test(v))).flatMap((r) => r.els));
|
|
945
|
+
const isPicture = (el) => urlBacked.has(el) || classes(el.tag).includes("art") ||
|
|
946
|
+
(/^(img|video|canvas|picture)$/.test(el.name) && !/\bbrand-logo\b/.test(attr(el.tag, "class") ?? "") && !(el.name === "img" && iconImg(el.tag)));
|
|
947
|
+
const where = `slide ${s.id || i + 1}`;
|
|
948
|
+
const out = new Set();
|
|
949
|
+
// A cover layout whose CSS masks its picture with a gradient (the old hero's look, still inlined in
|
|
950
|
+
// decks made from it) warns even before a picture is in: a deck copied from one gets the fade.
|
|
951
|
+
const layouts = classes(s.tag).filter((c) => COVER_LAYOUTS.includes(c));
|
|
952
|
+
if (rules.some((r) => FADE_MASK.test(r.body) && !/::?(before|after)\b/i.test(r.selector) && layouts.some((l) => new RegExp(`\\.${l}(?![\\w-])`).test(r.selector)))) {
|
|
953
|
+
out.add(MESSAGES.coverFade(where, "fades its picture into the ground with a gradient mask"));
|
|
954
|
+
}
|
|
955
|
+
const pictures = els.filter(isPicture);
|
|
956
|
+
if (!pictures.length) return [...out];
|
|
957
|
+
const holdsPicture = (el) => pictures.some((p) => p === el || (p.start > el.start && p.start < el.end));
|
|
958
|
+
for (const r of own) {
|
|
959
|
+
if (!r.els.some(holdsPicture)) continue;
|
|
960
|
+
const bgs = backgroundsOf(r.body);
|
|
961
|
+
if (!r.pseudo && FADE_MASK.test(r.body)) out.add(MESSAGES.coverFade(where, "fades its picture into the ground with a gradient mask"));
|
|
962
|
+
else if (r.pseudo && bgs.some(fadeGradient)) out.add(MESSAGES.coverFade(where, "lays a gradient over its picture"));
|
|
963
|
+
else if (bgs.some((v) => /url\(/i.test(v) && fadeGradient(v))) out.add(MESSAGES.coverFade(where, "lays a gradient over its picture"));
|
|
964
|
+
}
|
|
965
|
+
// An element of its own on the cover: positioned, with a fading gradient, and no picture itself
|
|
966
|
+
// (whether it overlaps the picture is not read here; check --layout measures the title).
|
|
967
|
+
for (const r of own) {
|
|
968
|
+
if (r.pseudo || !/(?:^|[;\s])position\s*:\s*(absolute|fixed)/i.test(r.body) || !backgroundsOf(r.body).some(fadeGradient)) continue;
|
|
969
|
+
if (r.els.some((el) => el.name !== "section" && !holdsPicture(el))) out.add(MESSAGES.coverFade(where, "lays a gradient over its picture"));
|
|
970
|
+
}
|
|
971
|
+
return [...out];
|
|
972
|
+
});
|
|
858
973
|
}
|
|
859
974
|
|
|
860
975
|
// Backgrounds (the look topic): the kit's textures are confined to the object they
|
|
@@ -871,10 +986,10 @@ const RETIRED_TEXTURES = {
|
|
|
871
986
|
const SIGNATURES = ["bg-corner", "bg-mark"];
|
|
872
987
|
export const MAX_SIGNATURE_SLIDES = 3;
|
|
873
988
|
const BUSY_LAYOUTS = ["l-number", "l-features", "l-team", "l-timeline", "l-compare"]; // full-width content: nothing to back
|
|
874
|
-
const PICTURE_COVERS = ["l-cover-band", "l-cover-poster"]; // the picture is the ground: a texture would only sit under it
|
|
989
|
+
const PICTURE_COVERS = ["l-cover-band", "l-cover-poster", "l-cover-split"]; // the picture is the ground (or half of it): a texture would only sit under it
|
|
875
990
|
export const TEXTURE_OFF = {
|
|
876
991
|
"bg-corner": ["l-split", "l-product", "l-chart", "l-quote", ...BUSY_LAYOUTS, ...PICTURE_COVERS],
|
|
877
|
-
"bg-stage": ["l-split", "l-chart", "l-quote", "l-closer", ...BUSY_LAYOUTS, ...PICTURE_COVERS, "l-cover-type"],
|
|
992
|
+
"bg-stage": ["l-split", "l-chart", "l-quote", "l-closer", ...BUSY_LAYOUTS, ...PICTURE_COVERS, "l-cover-type", "l-cover-frame"],
|
|
878
993
|
"bg-mark": ["l-split", "l-product", "l-chart", "l-phones", ...BUSY_LAYOUTS, ...PICTURE_COVERS],
|
|
879
994
|
};
|
|
880
995
|
function textureWarnings(all, html) {
|
package/src/commands.mjs
CHANGED
|
@@ -91,11 +91,55 @@ function deckOpen(pos, opts) {
|
|
|
91
91
|
openBrowser(ownerUrl);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
const RM_USAGE = "usage: deck rm <slug> --yes | --confirm <slug>";
|
|
95
|
+
|
|
96
|
+
// Whether `deck rm` was told to go ahead: --yes, or --confirm naming the slug.
|
|
97
|
+
export function rmConfirmed(slug, opts) {
|
|
98
|
+
if (opts.yes) return true;
|
|
99
|
+
return typeof opts.confirm === "string" && opts.confirm === slug;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// What `deck rm` would delete, in words.
|
|
103
|
+
export function removalLines(p) {
|
|
104
|
+
const n = (count, more) => `${count}${more ? "+" : ""}`;
|
|
105
|
+
return [
|
|
106
|
+
`deck rm permanently deletes "${p.title}" (${p.slug}, ${p.status}). It cannot be undone.`,
|
|
107
|
+
` share links: ${n(p.shareLinks, p.sharesMore)} (${n(p.enabledShareLinks, p.sharesMore)} enabled) — every one stops working`,
|
|
108
|
+
` visits: ${n(p.sessions, p.sessionsMore)} recorded visits and their engagement history`,
|
|
109
|
+
` assets: ${n(p.assets, p.assetsMore)} uploaded to this deck`,
|
|
110
|
+
`To set it aside instead (reversible, deletes nothing; links pause until unarchived): deck archive ${p.slug}`,
|
|
111
|
+
`To delete it: deck rm ${p.slug} --yes (or --confirm ${p.slug})`,
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
|
|
94
115
|
async function deckRemove(pos, opts) {
|
|
95
116
|
const [slug] = pos;
|
|
96
|
-
if (!slug) throw new Error(
|
|
117
|
+
if (!slug) throw new Error(RM_USAGE);
|
|
118
|
+
if ("confirm" in opts && typeof opts.confirm !== "string") throw new Error(`--confirm needs the slug: --confirm ${slug}`);
|
|
119
|
+
if (typeof opts.confirm === "string" && opts.confirm !== slug) {
|
|
120
|
+
throw new Error(`--confirm ${opts.confirm} does not match ${slug}; nothing was deleted`);
|
|
121
|
+
}
|
|
122
|
+
if (!rmConfirmed(slug, opts)) {
|
|
123
|
+
const preview = await ops.deckRemovalPreview(opts, slug);
|
|
124
|
+
if (opts.json) console.log(JSON.stringify({ removed: false, needs: "--yes", ...preview }, null, 2));
|
|
125
|
+
else for (const line of removalLines(preview)) console.error(line);
|
|
126
|
+
// Non-zero: nothing happened, and a script must not read this as success.
|
|
127
|
+
throw new Error("nothing was deleted; pass --yes (or --confirm <slug>) to delete permanently");
|
|
128
|
+
}
|
|
97
129
|
await ops.removeDeck(opts, slug);
|
|
98
|
-
console.log(
|
|
130
|
+
if (opts.json) console.log(JSON.stringify({ slug, removed: true }, null, 2));
|
|
131
|
+
else console.log(`OK removed deck ${slug} permanently`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function deckArchive(pos, opts, archived) {
|
|
135
|
+
const [slug] = pos;
|
|
136
|
+
const verb = archived ? "archive" : "unarchive";
|
|
137
|
+
if (!slug) throw new Error(`usage: deck ${verb} <slug> [--json]`);
|
|
138
|
+
const out = archived ? await ops.archiveDeck(opts, slug) : await ops.unarchiveDeck(opts, slug);
|
|
139
|
+
if (opts.json) return console.log(JSON.stringify(out, null, 2));
|
|
140
|
+
if (archived) console.log(`OK ${slug} is archived; its share links show "no longer active" until you run deck unarchive ${slug}`);
|
|
141
|
+
else if (out.changed === false) console.log(`OK ${slug} was not archived; status ${out.status}`);
|
|
142
|
+
else console.log(`OK ${slug} is ${out.status} again; its share links work again (any you turned off stay off)`);
|
|
99
143
|
}
|
|
100
144
|
|
|
101
145
|
async function shareNew(pos, opts) {
|
|
@@ -422,7 +466,14 @@ commands:
|
|
|
422
466
|
login [--token <pat>] [--broker <url>] [--dev]
|
|
423
467
|
logout [--dev]
|
|
424
468
|
whoami [--json] [--dev]
|
|
425
|
-
deck list|stats|open|link|rm|forward|view|transfer|transfers
|
|
469
|
+
deck list|stats|open|link|archive|unarchive|rm|forward|view|transfer|transfers
|
|
470
|
+
deck archive <slug> | deck unarchive <slug> [--json]
|
|
471
|
+
set a deck aside, reversibly; nothing is deleted. While archived its share and preview links show
|
|
472
|
+
"no longer active" and exports are refused. unarchive puts back the status it had (live stays
|
|
473
|
+
live; draft if unknown).
|
|
474
|
+
deck rm <slug> --yes | --confirm <slug>
|
|
475
|
+
PERMANENT delete: the deck, every share link, all visit history and its assets. Without the
|
|
476
|
+
flag it only shows what would go and exits non-zero. Prefer deck archive.
|
|
426
477
|
deck link <slug> [--json]
|
|
427
478
|
the owner link: present or check your own deck (only you, signed in; untracked;
|
|
428
479
|
Present or H hides your owner tools). Use it instead of a QA link. deck open opens it.
|
|
@@ -443,7 +494,8 @@ commands:
|
|
|
443
494
|
deck new <slug> "<title>" --narrated [--layouts hero,product,number,closer] [--presenter-style stage|bubble|glass|corner] [--no-brand] [--dir <path>]
|
|
444
495
|
scaffold decks/<slug>/: index.html (8 slides, or one per layout, player/v1), script.md, evidence.md,
|
|
445
496
|
in your saved brand's colours, fonts and logo (--no-brand: the template's look)
|
|
446
|
-
layouts: hero,
|
|
497
|
+
layouts: hero, cover-frame, cover-split, cover-band, cover-poster, cover-type, number, product, phones, quote,
|
|
498
|
+
compare, timeline, features, chart, team, closer
|
|
447
499
|
check <slug|deck-dir> [--forbid "<phrase>,<phrase>"] [--max-duration <s>] [--layout] [--strict] [--fix] [--json]
|
|
448
500
|
the narrated-deck gate: slides vs manifest, timing, captions, clip URLs,
|
|
449
501
|
local refs, pinned player, mobile titles. data-silent on the player script: no narration
|
|
@@ -1093,6 +1145,8 @@ function commandTable(pos, rest, opts) {
|
|
|
1093
1145
|
"deck open": () => deckOpen(rest, opts),
|
|
1094
1146
|
"deck link": () => deckLink(rest, opts),
|
|
1095
1147
|
"deck rm": () => deckRemove(rest, opts),
|
|
1148
|
+
"deck archive": () => deckArchive(rest, opts, true),
|
|
1149
|
+
"deck unarchive": () => deckArchive(rest, opts, false),
|
|
1096
1150
|
"deck forward": () => deckForward(rest, opts),
|
|
1097
1151
|
"deck view": () => deckView(rest, opts),
|
|
1098
1152
|
"deck transfer": () => deckTransfer(rest, opts),
|
package/src/files.mjs
CHANGED
|
@@ -13,6 +13,8 @@ const FILES = {
|
|
|
13
13
|
"templates/layouts/closer.html": () => new URL("../templates/layouts/closer.html", import.meta.url),
|
|
14
14
|
"templates/layouts/compare.html": () => new URL("../templates/layouts/compare.html", import.meta.url),
|
|
15
15
|
"templates/layouts/features.html": () => new URL("../templates/layouts/features.html", import.meta.url),
|
|
16
|
+
"templates/layouts/cover-frame.html": () => new URL("../templates/layouts/cover-frame.html", import.meta.url),
|
|
17
|
+
"templates/layouts/cover-split.html": () => new URL("../templates/layouts/cover-split.html", import.meta.url),
|
|
16
18
|
"templates/layouts/cover-band.html": () => new URL("../templates/layouts/cover-band.html", import.meta.url),
|
|
17
19
|
"templates/layouts/cover-poster.html": () => new URL("../templates/layouts/cover-poster.html", import.meta.url),
|
|
18
20
|
"templates/layouts/cover-type.html": () => new URL("../templates/layouts/cover-type.html", import.meta.url),
|
package/src/layouts.mjs
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import { packageText } from "./files.mjs";
|
|
5
5
|
|
|
6
6
|
export const NARRATED_FILES = { "index.html": "narrated-deck.html", "script.md": "script.md", "evidence.md": "evidence.md" };
|
|
7
|
-
// The library: the
|
|
8
|
-
// the rest in a sensible deck order. `--layouts` takes any order and repeats.
|
|
9
|
-
export const LAYOUTS = ["hero", "cover-band", "cover-poster", "cover-type", "number", "product", "split", "phones", "quote", "compare", "timeline", "features", "chart", "team", "closer"];
|
|
7
|
+
// The library: the six covers first (hero is the default; a deck opens on one; the
|
|
8
|
+
// clean picture covers cover-frame and cover-split next), then the rest in a sensible deck order. `--layouts` takes any order and repeats.
|
|
9
|
+
export const LAYOUTS = ["hero", "cover-frame", "cover-split", "cover-band", "cover-poster", "cover-type", "number", "product", "split", "phones", "quote", "compare", "timeline", "features", "chart", "team", "closer"];
|
|
10
10
|
const LAYOUT_ALIASES = { "big-number": "number", "product-shot": "product", "phone-row": "phones", comparison: "compare", "three-up": "features", "image-copy": "split", "image-text": "split" };
|
|
11
11
|
|
|
12
12
|
const escapeHtml = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
package/src/ops.mjs
CHANGED
|
@@ -704,6 +704,27 @@ export async function removeDeck(opts, slug) {
|
|
|
704
704
|
return { slug, removed: true };
|
|
705
705
|
}
|
|
706
706
|
|
|
707
|
+
// Archive: reversible, deletes nothing (only status changes). While archived its
|
|
708
|
+
// share and draft-preview links show "no longer active" and exports are refused.
|
|
709
|
+
export async function archiveDeck(opts, slug) {
|
|
710
|
+
if (!slug) throw new Error("slug is required");
|
|
711
|
+
await (await client(opts)).mutation(api.decks.setStatus, { slug, status: "archived" });
|
|
712
|
+
return { slug, status: "archived" };
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// Unarchive: back to the status it had before archiving (draft if unknown).
|
|
716
|
+
export async function unarchiveDeck(opts, slug) {
|
|
717
|
+
if (!slug) throw new Error("slug is required");
|
|
718
|
+
const out = await (await client(opts)).mutation(api.decks.unarchive, { slug });
|
|
719
|
+
return { slug, status: out.status, changed: out.changed };
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// What removeDeck would delete (share links, visits, assets), without deleting.
|
|
723
|
+
export async function deckRemovalPreview(opts, slug) {
|
|
724
|
+
if (!slug) throw new Error("slug is required");
|
|
725
|
+
return (await client(opts)).query(api.decks.removalPreview, { slug });
|
|
726
|
+
}
|
|
727
|
+
|
|
707
728
|
export async function setRecipientArchived(opts, recipient, archived) {
|
|
708
729
|
if (!recipient) throw new Error("recipient is required");
|
|
709
730
|
await (await client(opts)).mutation(api.activity.setArchived, { recipient, archived });
|
package/src/runtime.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
import { ConvexHttpClient } from "convex/browser";
|
|
9
9
|
import { makeFunctionReference } from "convex/server";
|
|
10
10
|
|
|
11
|
-
export const VERSION = "0.9.
|
|
11
|
+
export const VERSION = "0.9.15";
|
|
12
12
|
const UPLOAD_TIMEOUT_MS = 125_000;
|
|
13
13
|
|
|
14
14
|
// The app's home. HYPERDECKS_HOST points the prod target's broker and share
|
|
@@ -121,6 +121,9 @@ export const api = {
|
|
|
121
121
|
listForViewer: makeFunctionReference("decks:listForViewer"),
|
|
122
122
|
listAll: makeFunctionReference("decks:listAll"),
|
|
123
123
|
remove: makeFunctionReference("decks:remove"),
|
|
124
|
+
removalPreview: makeFunctionReference("decks:removalPreview"),
|
|
125
|
+
setStatus: makeFunctionReference("decks:setStatus"),
|
|
126
|
+
unarchive: makeFunctionReference("decks:unarchive"),
|
|
124
127
|
setAllowForward: makeFunctionReference("decks:setAllowForward"),
|
|
125
128
|
setView: makeFunctionReference("decks:setView"),
|
|
126
129
|
setViewToggle: makeFunctionReference("decks:setViewToggle"),
|
package/src/scaffold.mjs
CHANGED
|
@@ -48,7 +48,7 @@ export async function deckNew(pos, opts = {}, { log = (line) => console.log(line
|
|
|
48
48
|
for (const [out, text] of files) writeFileSync(join(/*turbopackIgnore: true*/ dir, out), text);
|
|
49
49
|
} catch (e) {
|
|
50
50
|
rmSync(dir, { recursive: true, force: true });
|
|
51
|
-
throw new Error(`deck ${slug} is registered but its files could not be written (${e.message}); remove the draft with \`hyperdecks deck rm ${slug}\` and run deck new again`);
|
|
51
|
+
throw new Error(`deck ${slug} is registered but its files could not be written (${e.message}); remove the empty draft with \`hyperdecks deck rm ${slug} --yes\` and run deck new again`);
|
|
52
52
|
}
|
|
53
53
|
// The face goes into the file now the deck is registered (the server answers whose).
|
|
54
54
|
const htmlPath = join(/*turbopackIgnore: true*/ dir, "index.html");
|
|
@@ -210,20 +210,20 @@ d.addEventListener("readystatechange",go);go()})();</script>
|
|
|
210
210
|
-webkit-mask-image: radial-gradient(circle at 100% 0, #000 45%, rgba(0,0,0,.4) 100%); mask-image: radial-gradient(circle at 100% 0, #000 45%, rgba(0,0,0,.4) 100%); }
|
|
211
211
|
.l-closer.bg-corner::before { --corner-r: 460px; }
|
|
212
212
|
.on-ink.bg-corner::before { --corner-a: 22%; }
|
|
213
|
-
:is(.l-split, .l-product, .l-chart, .l-quote, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster).bg-corner::before { content: none; }
|
|
213
|
+
:is(.l-split, .l-product, .l-chart, .l-quote, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster, .l-cover-split).bg-corner::before { content: none; }
|
|
214
214
|
/* bg-stage: a rounded dot plate exactly the picture's column plus 32px, so the frame or the phones stand on it; on the hero a tile behind the stickers. */
|
|
215
215
|
.slide.bg-stage::before { inset: auto; background: radial-gradient(color-mix(in srgb, currentColor var(--stage-a, 24%), transparent) 2.4px, transparent 2.9px) 0 0 / 22px 22px; border-radius: 40px; }
|
|
216
216
|
.l-product.bg-stage::before { position: relative; grid-area: frame; align-self: stretch; margin: var(--stage-m, -32px -24px -32px -40px); }
|
|
217
217
|
.l-phones.bg-stage::before { position: relative; grid-area: row; align-self: stretch; margin: var(--stage-m, -32px); }
|
|
218
218
|
.l-hero.bg-stage::before { right: 110px; top: 110px; width: 410px; height: 350px; }
|
|
219
|
-
:is(.l-split, .l-chart, .l-quote, .l-closer, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster, .l-cover-type).bg-stage::before { content: none; }
|
|
219
|
+
:is(.l-split, .l-chart, .l-quote, .l-closer, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster, .l-cover-split, .l-cover-type, .l-cover-frame).bg-stage::before { content: none; }
|
|
220
220
|
/* bg-mark: the slide number, set as style="--mark:'04'" on the section, huge in --display, faint,
|
|
221
221
|
cropped by the top edge; right on the hero, in the indent on slot-left slides. A signature: cover, an opener, closer. */
|
|
222
222
|
.slide.bg-mark::before { content: var(--mark, ""); inset: auto; right: 24px; top: -.26em; font: var(--display-weight, 700) var(--mark-size, 560px)/1 var(--display, var(--font)); font-synthesis: none; letter-spacing: var(--display-tracking, -.05em); white-space: nowrap;
|
|
223
223
|
color: color-mix(in srgb, currentColor var(--mark-a, 8%), transparent); }
|
|
224
224
|
.slide.on-ink.bg-mark::before { --mark-a: 6%; }
|
|
225
225
|
.slide.slot-left.bg-mark::before { right: auto; left: -.08em; font-size: var(--mark-size, 440px); } /* ends inside the 500px indent, clear of the title */
|
|
226
|
-
:is(.l-split, .l-product, .l-chart, .l-phones, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster).bg-mark::before { content: none; }
|
|
226
|
+
:is(.l-split, .l-product, .l-chart, .l-phones, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster, .l-cover-split).bg-mark::before { content: none; }
|
|
227
227
|
/* Pieces. .sticker: a logo or icon tile, tilted (--tilt), ink edge, hard offset
|
|
228
228
|
shadow (.sticker.photo for a face or an app icon that fills it). .ticks: a short
|
|
229
229
|
list with accent-square bullets. .panel: a quiet card. .pill: a small tag. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
layout: cover-band
|
|
3
|
-
summary: A cover with the picture
|
|
3
|
+
summary: A cover with the picture filling the slide and the title on a solid, inked panel of the theme's paper in the bottom-left, so the title's contrast never depends on the picture.
|
|
4
4
|
use: the first slide when the picture is the story (a place, an object, a crowd) and wants the whole frame. Its .art is a placeholder check fails on: put in a wide picture of the real subject (gen-image / generate_image, 16:9) as <img class="art">; keep the subject top or top-right: the panel covers the bottom-left and the presenter the bottom-right. The panel grows with the title; never move the title off the panel onto the picture. Without art the panel sits on the slide's ground.
|
|
5
5
|
slot: bottom-right
|
|
6
6
|
presenter: stage
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
layout: cover-frame
|
|
3
|
+
summary: A framed cover: the title across the top on the slide's own ground, the picture below it in a clean card (ink edge, rounded, a slight tilt) with a hard edge, never faded. The card takes whatever height the title leaves, so a long title shortens the card instead of covering it.
|
|
4
|
+
use: the first slide when there is a strong picture (a product, a person, a place) that reads as an object you hold up. Its .art is a placeholder check fails on: put in a wide picture of the real subject (gen-image / generate_image, 16:9 or 3:2) as <img class="art">; keep the subject in the middle, the card crops top and bottom. Never move the title onto the card; a fade or a gradient over the picture makes the title hard to read (check warns). Other covers: cover-split, hero, cover-band, cover-poster, cover-type.
|
|
5
|
+
slot: bottom-right
|
|
6
|
+
presenter: stage
|
|
7
|
+
nopresenter: The card runs nearly the slide's full width instead of stopping short of the corner.
|
|
8
|
+
cues: [wave] at the hello, [look: h1] when the narration says the title, [look: .art] when it turns to the picture.
|
|
9
|
+
script: Hi, [wave] this is __TITLE__. [look: h1] One idea, in a few minutes.
|
|
10
|
+
-->
|
|
11
|
+
<style>
|
|
12
|
+
/* The title on top in the slide's flow (the card comes first in the markup, shown after it); the picture a framed card below it that takes the height left, clear of the presenter's corner. */
|
|
13
|
+
.l-cover-frame { gap: 40px; }
|
|
14
|
+
.l-cover-frame .content { flex: none; display: flex; flex-direction: column; gap: 18px; }
|
|
15
|
+
.l-cover-frame .tt { font-size: min(var(--t-display), 104px); line-height: .92; }
|
|
16
|
+
.l-cover-frame .art { order: 1; display: block; flex: 1 1 0; min-height: 220px; width: calc(100% - 520px); margin: 0 0 14px 6px; border: 4px solid var(--ink); border-radius: 28px; object-fit: cover; box-shadow: 14px 14px 0 var(--accent); transform: rotate(-1.5deg); }
|
|
17
|
+
.on-ink.l-cover-frame .art { border-color: var(--paper); }
|
|
18
|
+
.on-accent.l-cover-frame .art { box-shadow: 14px 14px 0 var(--ink); }
|
|
19
|
+
/* Until then a labelled, hatched stand-in, so it reads as a slot to fill; check fails while it is here. */
|
|
20
|
+
.l-cover-frame div.art { position: relative; background: var(--paper) repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink) 10%, transparent) 0 2px, transparent 2px 22px); }
|
|
21
|
+
.l-cover-frame div.art::after { content: "Art goes here"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 14px 26px; border: 3px dashed var(--ink); border-radius: 16px; background: var(--paper); color: var(--ink); font: 700 24px var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
|
|
22
|
+
.l-cover-frame:not(:has(> .art)) .content { flex: 1; justify-content: center; }
|
|
23
|
+
@media (max-width: 650px) {
|
|
24
|
+
/* Phones: the title, then the card across the width below it. */
|
|
25
|
+
.l-cover-frame { gap: 14px; }
|
|
26
|
+
.l-cover-frame .content { gap: 12px; }
|
|
27
|
+
.l-cover-frame .tt { font-size: var(--t-display); }
|
|
28
|
+
.l-cover-frame .art { flex: none; height: 156px; min-height: 0; width: auto; margin: 0 6px 6px 2px; border-width: 2px; border-radius: 16px; box-shadow: 6px 6px 0 var(--accent); transform: rotate(-1deg); }
|
|
29
|
+
.on-accent.l-cover-frame .art { box-shadow: 6px 6px 0 var(--ink); }
|
|
30
|
+
.l-cover-frame div.art::after { padding: 8px 14px; border-width: 2px; font-size: 13px; }
|
|
31
|
+
}
|
|
32
|
+
/* No presenter (:root.hd-no-presenter: no face and no captions, deck_guide look): the corner is free. Phones keep this layout's rules. */
|
|
33
|
+
@media (min-width: 651px) {
|
|
34
|
+
:root.hd-no-presenter .l-cover-frame .art { width: calc(100% - 20px); }
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
<section class="slide l-cover-frame" id="__ID__" data-chapter="Hello" data-note="Title slide: no facts.">
|
|
38
|
+
<div class="art" role="presentation"></div>
|
|
39
|
+
<div class="content">
|
|
40
|
+
<div class="kicker">__SLUG__</div>
|
|
41
|
+
<h1 class="tt" data-title-mobile="__TITLE__">__TITLE__</h1>
|
|
42
|
+
<p class="lead">One sentence on what this deck is about.</p>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="narration-slot"></div>
|
|
45
|
+
</section>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
layout: cover-split
|
|
3
|
+
summary: A hard 50/50 cover: the title on the left half on a solid ground, the picture filling the right half edge to edge, the two meeting on a straight ink line. No fade, no overlap: the picture never reaches the title's half.
|
|
4
|
+
use: the first slide when there is a strong picture that should be big (a product shot, a portrait, a scene) and a title that wants room of its own. Its .art is a placeholder check fails on: put in a picture of the real subject (gen-image / generate_image, square or near it: the half is about 8:9) as <img class="art">; keep the subject in the top two thirds (the presenter stands on the half's bottom-right; on phones the picture is a wide strip). Never lay the title on the picture; a fade or a gradient over it makes the title hard to read (check warns). Other covers: cover-frame, hero, cover-band, cover-poster, cover-type.
|
|
5
|
+
slot: bottom-right
|
|
6
|
+
presenter: stage
|
|
7
|
+
nopresenter: The picture crops on its centre instead of keeping its subject high above the presenter.
|
|
8
|
+
cues: [wave] at the hello, [look: h1] when the narration says the title, [look: .art] when it turns to the picture.
|
|
9
|
+
script: Hi, [wave] this is __TITLE__. [look: h1] One idea, in a few minutes.
|
|
10
|
+
-->
|
|
11
|
+
<style>
|
|
12
|
+
/* Two equal halves: the title's on the slide's ground, the picture's out to the slide's edges, meeting on a straight line. */
|
|
13
|
+
.l-cover-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); column-gap: 72px; }
|
|
14
|
+
.l-cover-split .content { grid-column: 1; grid-row: 1; align-self: center; display: flex; flex-direction: column; gap: 22px; }
|
|
15
|
+
.l-cover-split .tt { font-size: min(var(--t-display), 96px); line-height: .92; }
|
|
16
|
+
/* The picture's half is the slide's own right half, out to its edges (a sized box: an absolute <img> never stretches to its insets). */
|
|
17
|
+
.l-cover-split .art { position: absolute; top: 0; right: 0; display: block; width: 50%; height: 100%; border-left: 4px solid var(--ink); object-fit: cover; object-position: 50% 30%; }
|
|
18
|
+
.on-ink.l-cover-split .art { border-left-color: var(--paper); }
|
|
19
|
+
/* A brand logo (applyBrand puts it first in the slide) heads the title's half. */
|
|
20
|
+
.l-cover-split:has(> .brand-logo) { grid-template-rows: auto minmax(0, 1fr); }
|
|
21
|
+
.l-cover-split > .brand-logo { grid-column: 1; grid-row: 1; }
|
|
22
|
+
.l-cover-split:has(> .brand-logo) .content { grid-row: 2; }
|
|
23
|
+
/* Until then a labelled, hatched stand-in, so it reads as a slot to fill; check fails while it is here. */
|
|
24
|
+
.l-cover-split div.art { background: color-mix(in srgb, var(--ink) 6%, var(--paper)) repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink) 10%, transparent) 0 2px, transparent 2px 22px); }
|
|
25
|
+
.l-cover-split div.art::after { content: "Art goes here"; position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); padding: 14px 26px; border: 3px dashed var(--ink); border-radius: 16px; background: var(--paper); color: var(--ink); font: 700 24px var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
|
|
26
|
+
.l-cover-split:not(:has(> .art)) { grid-template-columns: minmax(0, 1fr); }
|
|
27
|
+
@media (max-width: 650px) {
|
|
28
|
+
/* Phones: the picture across the top, edge to edge, the title below it on the ground. */
|
|
29
|
+
.l-cover-split { display: flex; flex-direction: column; gap: 0; }
|
|
30
|
+
.l-cover-split .art { position: relative; inset: auto; flex: none; width: auto; height: 186px; margin: -28px -20px 0; border-left: 0; border-bottom: 2px solid var(--ink); }
|
|
31
|
+
.on-ink.l-cover-split .art { border-bottom-color: var(--paper); }
|
|
32
|
+
.l-cover-split .content { align-self: stretch; gap: 12px; padding-top: 18px; }
|
|
33
|
+
.l-cover-split .tt { font-size: var(--t-display); }
|
|
34
|
+
.l-cover-split:has(> .art) > .brand-logo { position: absolute; top: 12px; left: 20px; z-index: 1; }
|
|
35
|
+
.l-cover-split div.art::after { top: 50%; padding: 8px 14px; border-width: 2px; font-size: 13px; }
|
|
36
|
+
}
|
|
37
|
+
/* No presenter (:root.hd-no-presenter: no face and no captions, deck_guide look): the corner is free. Phones keep this layout's rules. */
|
|
38
|
+
@media (min-width: 651px) {
|
|
39
|
+
:root.hd-no-presenter .l-cover-split .art { object-position: 50% 50%; }
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
42
|
+
<section class="slide l-cover-split" id="__ID__" data-chapter="Hello" data-note="Title slide: no facts.">
|
|
43
|
+
<div class="art" role="presentation"></div>
|
|
44
|
+
<div class="content">
|
|
45
|
+
<div class="kicker">__SLUG__</div>
|
|
46
|
+
<h1 class="tt" data-title-mobile="__TITLE__">__TITLE__</h1>
|
|
47
|
+
<p class="lead">One sentence on what this deck is about.</p>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="narration-slot"></div>
|
|
50
|
+
</section>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
layout: hero
|
|
3
3
|
summary: The opening, as a split cover: the title on the slide's own ground on the left, the picture in a clean frame top-right, the presenter's hello. Text never sits on the picture.
|
|
4
|
-
use: the first slide (the default cover); a section opener. Its .art is a placeholder check fails on: put in a picture of the real subject (gen-image / generate_image, landscape or near-square: the frame is about 7:6) as <img class="art">, or delete the div and the title takes the full frame with the presenter as the visual. Never lay the title over the picture
|
|
4
|
+
use: the first slide (the default cover); a section opener. Its .art is a placeholder check fails on: put in a picture of the real subject (gen-image / generate_image, landscape or near-square: the frame is about 7:6) as <img class="art">, or delete the div and the title takes the full frame with the presenter as the visual. Never lay the title over the picture; a picture faded behind it is hard to read (check warns). Other covers: cover-frame (the picture as a card under the title), cover-split (a hard 50/50, the picture edge to edge in its half), cover-band (the picture fills the slide, the title on a solid panel), cover-poster (the picture on top, the title below) and cover-type (type only).
|
|
5
5
|
slot: bottom-right
|
|
6
6
|
presenter: stage
|
|
7
7
|
nopresenter: With art, the picture grows to the full height of its column. Delete the art and the line re-centres in the full frame.
|