@hypersocial/decks-cli 0.9.29 → 0.9.30
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 +29 -11
- package/package.json +1 -1
- package/skills/hyperdecks/SKILL.md +78 -25
- package/skills/hyperdecks/terminal.md +1 -1
- package/src/aimedNotes.mjs +165 -0
- package/src/assetTypes.mjs +35 -5
- package/src/check.mjs +156 -12
- package/src/checkRules.mjs +211 -27
- package/src/commands.mjs +165 -19
- package/src/embedSources.mjs +15 -1
- package/src/files.mjs +4 -0
- package/src/guide.mjs +1 -1
- package/src/iconSlots.mjs +1 -1
- package/src/importer.mjs +57 -14
- package/src/init.mjs +14 -2
- package/src/layoutRoutes.mjs +7 -4
- package/src/layouts.mjs +2 -2
- package/src/notices.mjs +145 -0
- package/src/ops.mjs +1 -1
- package/src/runtime.mjs +20 -3
- package/src/skillFreshness.mjs +46 -13
- package/src/source.mjs +28 -22
- package/src/update.mjs +93 -30
- package/templates/layouts/_deck.html +3 -3
- package/templates/layouts/compare.html +50 -25
- package/templates/layouts/features.html +11 -1
- package/templates/layouts/phone-stage.html +20 -4
- package/templates/layouts/pictures.html +86 -0
- package/templates/layouts/scale.html +69 -0
- package/templates/layouts/screens.html +5 -0
- package/templates/layouts/sieve.html +62 -0
- package/templates/layouts/split.html +6 -0
- package/templates/layouts/statement.html +58 -0
- package/templates/layouts/tap-through.html +3 -3
- package/templates/layouts/video-beats.html +1 -1
package/src/check.mjs
CHANGED
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
import { closeSync, existsSync, lstatSync, openSync, readFileSync, readSync, realpathSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
13
13
|
import { deckSlug } from "./deckSlug.mjs";
|
|
14
|
-
import { LONGEST_ANSWER_MESSAGE, questionOffErrors, CELL_PICTURES, COVER_LAYOUTS, EDGE_PICTURES, PHONE, PHONE_SCREENS, UNMEASURED_PICTURES, WORD_PARTS, ROOMY_LAYOUTS, FIT_BOXES, FIT_ROWS, PRESENTER_FOOTPRINT, PRESENTER_SCALE, barsWarnings, checkSources, coverTextWarnings, lensOffSlideWarnings, lensWarnings, overlapWarnings, phoneOverflowErrors, pictureCornerWarnings, pictureFitWarnings, presenterMediaWarnings, silentWithoutPresenter, wordFitWarnings, slideStyles, stageSize, MESSAGES } from "./checkRules.mjs";
|
|
14
|
+
import { LONGEST_ANSWER_MESSAGE, questionOffErrors, CELL_PICTURES, COVER_LAYOUTS, EDGE_PICTURES, PHONE, PHONE_SCREENS, UNMEASURED_PICTURES, WORD_PARTS, ROOMY_LAYOUTS, FIT_BOXES, FIT_ROWS, PRESENTER_FOOTPRINT, PRESENTER_SCALE, barsWarnings, checkSources, collisionFindings, coverTextWarnings, lensOffSlideWarnings, lensWarnings, overlapWarnings, phoneOverflowErrors, pictureCornerWarnings, pictureFitWarnings, presenterMediaWarnings, silentWithoutPresenter, wordFitWarnings, slideStyles, stageSize, MESSAGES } from "./checkRules.mjs";
|
|
15
15
|
|
|
16
16
|
import { fitQuestion } from "./questionFit.mjs";
|
|
17
|
+
import { aimNotes, presenterKeepOut } from "./aimedNotes.mjs";
|
|
17
18
|
import { withLoadingBlock } from "./loadingBlock.mjs";
|
|
18
19
|
|
|
19
20
|
export * from "./checkRules.mjs";
|
|
@@ -28,8 +29,13 @@ export * from "./loadingBlock.mjs";
|
|
|
28
29
|
// presenterMediaWarnings) and zoom's lens enlargement (lens, for lensWarnings). With `card`, the page is
|
|
29
30
|
// `width`×`height` (a phone) and the slides are laid out in a card of that size with their mobile titles,
|
|
30
31
|
// as the framed player shows them there. Needs `hyperdecks preview setup`.
|
|
31
|
-
export async function measureLayout(deckDir, styles, { width = 1600, height = 900, card = null } = {}) {
|
|
32
|
-
return withDeckPage(deckDir, { width, height }, (page) =>
|
|
32
|
+
export async function measureLayout(deckDir, styles, { width = 1600, height = 900, card = null, noPresenter = false } = {}) {
|
|
33
|
+
return withDeckPage(deckDir, { width, height }, async (page) => {
|
|
34
|
+
// phone-stage's notes are placed by the player's own code (aimedNotes.mjs); a deck with no presenter is laid out
|
|
35
|
+
// as the player shows it (.hd-no-presenter on the root).
|
|
36
|
+
await page.evaluate(`window.__aimNotes = ${aimNotes}; window.__presenterKeepOut = ${presenterKeepOut}`);
|
|
37
|
+
if (noPresenter) await page.evaluate(() => document.documentElement.classList.add("hd-no-presenter"));
|
|
38
|
+
return page.evaluate(({ styles, words, roomy, fitBoxes, fitRows, footprint, scales, width, height, covers, edges, unmeasured, phoneScreens, cells, noPresenter, phone }) => {
|
|
33
39
|
const box = (r) => ({ x: r.left, y: r.top, width: r.width, height: r.height });
|
|
34
40
|
const sections = [...document.querySelectorAll("section.slide")];
|
|
35
41
|
// The deck's own CSS (a deck keeps the layout styles it was made with): does it have this card's rules? The wall's
|
|
@@ -187,7 +193,8 @@ export async function measureLayout(deckDir, styles, { width = 1600, height = 90
|
|
|
187
193
|
else if (slide.classList.contains("l-hero") && slide.querySelector(":scope > img.art")) media = { art: boxOf(":scope > img.art") };
|
|
188
194
|
else {
|
|
189
195
|
// The word layouts: what they set beside the presenter (the title is measured on its own, above).
|
|
190
|
-
|
|
196
|
+
// A compare slide still in its old two-box markup (.cols) is checked as before the rewrite rows: no word parts.
|
|
197
|
+
const sel = slide.querySelector(":scope.l-compare .cols") ? null : words[[...slide.classList].find((c) => Object.hasOwn(words, c))];
|
|
191
198
|
const parts = sel ? [...slide.querySelectorAll(sel)].map((n) => n.getBoundingClientRect()).filter((r) => r.width && r.height) : [];
|
|
192
199
|
if (parts.length) {
|
|
193
200
|
const [x0, y0] = [Math.min(...parts.map((r) => r.left)), Math.min(...parts.map((r) => r.top))];
|
|
@@ -227,7 +234,7 @@ export async function measureLayout(deckDir, styles, { width = 1600, height = 90
|
|
|
227
234
|
const layout = [...slide.classList].find((c) => c.startsWith("l-")) ?? null;
|
|
228
235
|
// The word layouts' boxes (wordFitWarnings): any line of text that runs past its box's edge, clipped or not.
|
|
229
236
|
const fit = [], broken = [];
|
|
230
|
-
if (layout && Object.hasOwn(fitBoxes, layout)) {
|
|
237
|
+
if (layout && Object.hasOwn(fitBoxes, layout) && !(layout === "l-compare" && slide.querySelector(".cols"))) {
|
|
231
238
|
for (const boxEl of slide.querySelectorAll(fitBoxes[layout])) {
|
|
232
239
|
const b = boxEl.getBoundingClientRect();
|
|
233
240
|
// A box with words that collapsed to nothing (a layout fault) is as bad as words running out of it.
|
|
@@ -277,10 +284,138 @@ export async function measureLayout(deckDir, styles, { width = 1600, height = 90
|
|
|
277
284
|
wide = names.sort((a, b) => b.length - a.length)[0] ?? row.textContent.trim().slice(0, 40);
|
|
278
285
|
}
|
|
279
286
|
const fitTexts = [...new Set(fit)]; // a text inside two boxes (scorecard's state in its row) is named once
|
|
280
|
-
|
|
281
|
-
|
|
287
|
+
// Every drawn text block on the slide (collisionFindings), line by line, as the player shows it: the presenter's
|
|
288
|
+
// footprint back in its slot and the slot's size in --hd-slot-w/h (the player sets them on the stage), phone-stage's
|
|
289
|
+
// aimed notes placed (aimed-notes.js, the player's own code) clear of the presenter, and every step (.reveal) shown
|
|
290
|
+
// as it is once it plays (.is-revealed, its transition off). A block is the nearest element around a text that is
|
|
291
|
+
// not inline (a note's <b> label and its words are one block each; in an <svg>, each <text>, which is a block). Not read: text faint enough
|
|
292
|
+
// to be decoration (below), text hidden with visibility, the slot, script, style, template and aria-hidden
|
|
293
|
+
// decoration. Each line is its ink (the canvas's measure of the letters in the line's own font), not its
|
|
294
|
+
// font's full height. `within` lists the blocks a block sits inside, `heading` marks the slide's title (its h1/h2, or
|
|
295
|
+
// a .tt), `clipped` a line cut off by the slide's edge or an ancestor that hides its overflow (the word layouts'
|
|
296
|
+
// boxes are wordFitWarnings' to name).
|
|
297
|
+
// The slot holds the presenter at the size the player gives it (its box: the head .87 tall and its caption over it,
|
|
298
|
+
// 360px wide at least; glass 42px wider and 44 taller; bubble the face and its caption beside it), so a layout that
|
|
299
|
+
// places the slot in its flow lays the slide out as the player shows it. Its stand-in parts are read below.
|
|
300
|
+
const f = (style === "bubble" ? 260 : style === "corner" ? 230 : 320) * scale;
|
|
301
|
+
const natural = raised || (Number.isFinite(fine) && fine > 0 && fine < 1) ? null
|
|
302
|
+
: style === "stage" ? { width: Math.max(f, 360), height: f * 0.87 + 71 } : style === "glass" ? { width: Math.max(f, 360) + 42, height: f * 0.87 + 115 } : style === "bubble" ? { width: f + 186, height: f + 44 } : null;
|
|
303
|
+
const slotSize = natural ?? size;
|
|
304
|
+
Object.assign(probe.style, { width: `${slotSize.width}px`, height: `${slotSize.height}px` });
|
|
305
|
+
if (slot && style !== "corner" && !noPresenter) slot.append(probe);
|
|
306
|
+
const reveals = [...slide.querySelectorAll(".reveal")].map((n) => [n, n.classList.contains("is-revealed"), n.style.transition]);
|
|
307
|
+
for (const [n] of reveals) { n.style.transition = "none"; n.classList.add("is-revealed"); }
|
|
308
|
+
// The deck's pre-ready rule hides every slide with visibility (JavaScript is off here); the slide is shown for the
|
|
309
|
+
// pass, so an element below it that is hidden (its own visibility) is the only text not drawn that way.
|
|
310
|
+
const shownWas = slide.style.visibility;
|
|
311
|
+
slide.style.visibility = "visible";
|
|
312
|
+
slide.style.setProperty("--hd-slot-w", `${slotSize.width}px`);
|
|
313
|
+
slide.style.setProperty("--hd-slot-h", `${slotSize.height}px`);
|
|
314
|
+
// What the presenter draws, as the player draws it (player.css; the parity test in lib/deckCollisions.test.ts holds
|
|
315
|
+
// it to the player's within a pixel): in its slot (the box above), a stage head centred at the foot with its
|
|
316
|
+
// caption (360×71) at home at the top; a glass panel, the whole box; a bubble's face and its caption beside it,
|
|
317
|
+
// the whole box; in the corner (the stage's, 28px in), a face (230px at m) 16px in and its caption (400×71) over
|
|
318
|
+
// it. A stand-in with the player's classes, read by presenterKeepOut, the player's own rule for what the notes keep
|
|
319
|
+
// clear of. Not when the presenter is raised, off, or shrunk by the slide (no box of its own).
|
|
320
|
+
let parts = null;
|
|
321
|
+
const home = slot && probe.isConnected ? box(probe.getBoundingClientRect()) : null;
|
|
322
|
+
if (natural && home) {
|
|
323
|
+
const { x, y, width: W, height: H } = home;
|
|
324
|
+
if (style === "stage") parts = { face: { x: x + (W - f) / 2, y: y + H - f, width: f, height: f }, bubble: { x: x + (W - 360) / 2, y, width: 360, height: 71 } };
|
|
325
|
+
else parts = { box: home };
|
|
326
|
+
} else if (style === "corner" && presenter && !noPresenter) {
|
|
327
|
+
const R = presenter.x + presenter.width, B = presenter.y + presenter.height;
|
|
328
|
+
parts = { face: { x: R - 16 - f, y: B - f, width: f, height: f }, bubble: { x: R - 400, y: B - f - 75, width: 400, height: 71 } };
|
|
329
|
+
}
|
|
330
|
+
const standIn = document.createElement("div");
|
|
331
|
+
if (parts) {
|
|
332
|
+
const at = (n, b) => Object.assign(n.style, { position: "fixed", left: `${b.x}px`, top: `${b.y}px`, width: `${b.width}px`, height: `${b.height}px`, margin: "0" });
|
|
333
|
+
if (parts.box) at(standIn, parts.box);
|
|
334
|
+
for (const name of ["face", "bubble"]) if (parts[name]) { const n = document.createElement("div"); n.className = `hd-${name}`; at(n, parts[name]); standIn.append(n); }
|
|
335
|
+
document.body.append(standIn);
|
|
336
|
+
}
|
|
337
|
+
const keepOut = parts ? window.__presenterKeepOut(standIn, style) : null;
|
|
338
|
+
standIn.remove();
|
|
339
|
+
const titleLine = heading ? parseFloat(getComputedStyle(heading).lineHeight) || (parseFloat(getComputedStyle(heading).fontSize) || 16) * 1.1 : 0;
|
|
340
|
+
// The notes' room keeps one more line of the title: another browser may wrap it once more (check measures Chromium).
|
|
341
|
+
const notes = window.__aimNotes ? window.__aimNotes(slide, keepOut, { slack: titleLine }) : {};
|
|
342
|
+
// Decoration: text drawn faint, such as a big quote mark behind a line, is not read as text: its opacity with its
|
|
343
|
+
// ancestors' (opacity and filter: opacity()) times how much ink it has (its fill's alpha; an outline-only letter, a
|
|
344
|
+
// transparent fill with a stroke, its stroke's; a fill clipped from a background, all of it) under .3. Text not drawn
|
|
345
|
+
// (visibility hidden, below) is not read; text under display: none has no boxes, so it is never measured.
|
|
346
|
+
const alpha = (c) => { const m = String(c).match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)$|\/\s*([\d.]+)\)$/); return c === "transparent" ? 0 : m ? parseFloat(m[1] ?? m[2]) : 1; };
|
|
347
|
+
const faint = (el) => {
|
|
348
|
+
let o = 1;
|
|
349
|
+
for (let e = el; e && e !== host; e = e.parentElement) {
|
|
350
|
+
const cs = getComputedStyle(e);
|
|
351
|
+
o *= parseFloat(cs.opacity);
|
|
352
|
+
for (const m of cs.filter.matchAll(/opacity\(([\d.]+)(%?)\)/g)) o *= parseFloat(m[1]) / (m[2] ? 100 : 1);
|
|
353
|
+
}
|
|
354
|
+
const cs = getComputedStyle(el);
|
|
355
|
+
const fill = alpha(cs.getPropertyValue("-webkit-text-fill-color") || cs.color);
|
|
356
|
+
const stroke = parseFloat(cs.getPropertyValue("-webkit-text-stroke-width")) > 0 ? alpha(cs.getPropertyValue("-webkit-text-stroke-color")) : 0;
|
|
357
|
+
const clipped = /text/.test(`${cs.backgroundClip} ${cs.getPropertyValue("-webkit-background-clip")}`) ? 1 : 0;
|
|
358
|
+
return o * Math.max(fill, stroke, clipped) < 0.3;
|
|
359
|
+
};
|
|
360
|
+
const blockOf = (n) => { let e = n; while (e !== slide && /^(inline|contents)$/.test(getComputedStyle(e).display)) e = e.parentElement; return e; };
|
|
361
|
+
const fitSel = layout && Object.hasOwn(fitBoxes, layout) ? fitBoxes[layout] : null;
|
|
362
|
+
const sb = slide.getBoundingClientRect();
|
|
363
|
+
const pen = document.createElement("canvas").getContext("2d");
|
|
364
|
+
// A line's ink: its range box is the font's full height (ascent to descent), well past the letters in a tight
|
|
365
|
+
// display figure (number's .82 line height) and different in every font; the canvas measures the letters themselves.
|
|
366
|
+
const ink = (el, text, r) => {
|
|
367
|
+
const cs = getComputedStyle(el);
|
|
368
|
+
pen.font = `${cs.fontStyle} ${cs.fontWeight} ${cs.fontSize} ${cs.fontFamily}`;
|
|
369
|
+
const m = pen.measureText(text.trim() || "x"), full = m.fontBoundingBoxAscent + m.fontBoundingBoxDescent;
|
|
370
|
+
const k = r.height / full, base = r.top + m.fontBoundingBoxAscent * k;
|
|
371
|
+
const up = Math.max(0, m.actualBoundingBoxAscent) * k, down = Math.max(0, m.actualBoundingBoxDescent) * k;
|
|
372
|
+
return { x: r.left, y: base - up, width: r.width, height: Math.max(1, up + down) };
|
|
373
|
+
};
|
|
374
|
+
const blocks = new Map();
|
|
375
|
+
const textWalker = document.createTreeWalker(slide, NodeFilter.SHOW_TEXT);
|
|
376
|
+
for (let t; (t = textWalker.nextNode());) {
|
|
377
|
+
const el = t.parentElement;
|
|
378
|
+
if (!t.textContent.trim() || !el || el.closest(".narration-slot, script, style, template, [aria-hidden='true']") || getComputedStyle(el).visibility !== "visible" || faint(el)) continue;
|
|
379
|
+
const range = document.createRange();
|
|
380
|
+
range.selectNodeContents(t);
|
|
381
|
+
const rects = [...range.getClientRects()].filter((r) => r.width > 1 && r.height > 1);
|
|
382
|
+
if (!rects.length) continue;
|
|
383
|
+
const block = blockOf(el);
|
|
384
|
+
if (!blocks.has(block)) blocks.set(block, { lines: [], clipped: false });
|
|
385
|
+
const entry = blocks.get(block);
|
|
386
|
+
entry.lines.push(...rects.map((r) => ink(el, t.textContent, r)));
|
|
387
|
+
if (fitSel && el.closest(fitSel)) continue;
|
|
388
|
+
const clips = [sb];
|
|
389
|
+
for (let e = el; e && e !== slide; e = e.parentElement) if (/hidden|clip|auto|scroll/.test(getComputedStyle(e).overflow)) clips.push(e.getBoundingClientRect());
|
|
390
|
+
if (rects.some((r) => clips.some((c) => r.left < c.left - 2 || r.right > c.right + 2 || r.top < c.top - 4 || r.bottom > c.bottom + 4))) entry.clipped = true;
|
|
391
|
+
}
|
|
392
|
+
// A block's words, its inner tags' text kept apart (a note's label and its line read "First What shipped").
|
|
393
|
+
const wordsOf = (el) => { const w = document.createTreeWalker(el, NodeFilter.SHOW_TEXT), parts = []; for (let t; (t = w.nextNode());) parts.push(t.textContent); return parts.join(" ").trim().replace(/\s+/g, " ").slice(0, 48); };
|
|
394
|
+
const order = [...blocks.keys()];
|
|
395
|
+
const isTitle = (el) => (!!heading && (el === heading || heading.contains(el))) || !!el.closest(".tt");
|
|
396
|
+
const texts = order.map((el, n) => ({ text: wordsOf(el), heading: isTitle(el), lines: blocks.get(el).lines, ...(blocks.get(el).clipped ? { clipped: true } : {}), ...(el.closest(".note") ? { note: true } : {}), within: order.flatMap((other, k) => (k !== n && other.contains(el) ? [k] : [])) }));
|
|
397
|
+
// On a phone the presenter is a head over the card's bottom corner (player.css .hd-compact): a 200px face (140 at
|
|
398
|
+
// size s) 12px in from the right (a bubble presenter's, from the left), hanging 28px (16) below the card. The head
|
|
399
|
+
// drawn in it is its middle (about 56% across, from 28% down to 83%), which text must keep clear of by 16px: check
|
|
400
|
+
// measures Chromium, and WebKit runs text a few px taller.
|
|
401
|
+
const phoneHead = phone && !noPresenter ? (() => {
|
|
402
|
+
const F = scaleName === "s" ? 140 : 200, x = style === "bubble" ? sb.left + 12 : sb.right - 12 - F, y = sb.bottom + (F === 140 ? 16 : 28) - F, M = 16;
|
|
403
|
+
return { x: x + 0.22 * F - M, y: y + 0.28 * F - M, width: 0.56 * F + 2 * M, height: 0.55 * F + M };
|
|
404
|
+
})() : null;
|
|
405
|
+
probe.remove();
|
|
406
|
+
for (const [n, was, tr] of reveals) { n.classList.toggle("is-revealed", was); n.style.transition = tr; }
|
|
407
|
+
slide.style.visibility = shownWas;
|
|
408
|
+
// What the presenter draws over the slide, for collisionFindings: its parts above; a stage presenter's head alone (its
|
|
409
|
+
// caption steps aside to the first spot clear of the slide's text, bubble-side.js). Else its footprint and caption.
|
|
410
|
+
const drawnPresenter = parts ? (style === "stage" ? [parts.face] : Object.values(parts)) : null;
|
|
411
|
+
// A compare slide from before the rewrite rows (its two .cols boxes) makes no room for a large presenter, and its
|
|
412
|
+
// advice must not send it to the new layout's styles, which do not draw that markup.
|
|
413
|
+
const legacy = layout === "l-compare" && !!slide.querySelector(".cols");
|
|
414
|
+
const current = legacy ? { legacy } : layout === "l-wall" ? { current: hasCells } : Object.hasOwn(roomy, layout ?? "") ? { current: hasRoom(layout) } : {};
|
|
415
|
+
return { id, style, ...current, ...(scaleName ? { size: scaleName } : {}), sized: slide.getAttribute("data-presenter-size")?.trim() || null, presenter, ...(head ? { head } : {}), ...(caption ? { caption } : {}), ...(steps ? { steps } : {}), ...(leadCaption ? { leadCaption } : {}), ...(lines ? { lines } : {}), title, onPicture, layout, pictures, framed, ...(media ? { media } : {}), ...(lens ? { lens } : {}), ...(fitTexts.length ? { fit: fitTexts } : {}), ...(broken.length ? { broken: [...new Set(broken)] } : {}), ...(wide ? { wide } : {}), texts, ...(drawnPresenter ? { drawnPresenter } : {}), ...(phoneHead ? { phoneHead } : {}), ...(Object.keys(notes).length ? { notes } : {}), ...(keepOut ? { keepOut } : {}), ...(slide.hasAttribute("data-question") ? { question: true } : {}), ...(slide.classList.contains("l-zoom") ? { bounds: box(slide.getBoundingClientRect()) } : {}), ...(slide.hasAttribute("data-flip") ? { flipped: true } : {}), ...(slide.classList.contains("slot-left") ? { slotLeft: true } : {}) };
|
|
282
416
|
});
|
|
283
|
-
}, { styles, words: WORD_PARTS, roomy: ROOMY_LAYOUTS, fitBoxes: FIT_BOXES, fitRows: FIT_ROWS, footprint: PRESENTER_FOOTPRINT, scales: PRESENTER_SCALE, width: card?.width ?? width, height: card?.height ?? height, covers: COVER_LAYOUTS, edges: EDGE_PICTURES, unmeasured: UNMEASURED_PICTURES, phoneScreens: PHONE_SCREENS, cells: CELL_PICTURES
|
|
417
|
+
}, { styles, words: WORD_PARTS, roomy: ROOMY_LAYOUTS, fitBoxes: FIT_BOXES, fitRows: FIT_ROWS, footprint: PRESENTER_FOOTPRINT, scales: PRESENTER_SCALE, width: card?.width ?? width, height: card?.height ?? height, covers: COVER_LAYOUTS, edges: EDGE_PICTURES, unmeasured: UNMEASURED_PICTURES, phoneScreens: PHONE_SCREENS, cells: CELL_PICTURES, noPresenter, phone: !!card });
|
|
418
|
+
}, { mobileTitles: !!card });
|
|
284
419
|
}
|
|
285
420
|
|
|
286
421
|
// Lay each slide out as the framed player shows it on a phone: the deck's own
|
|
@@ -553,7 +688,7 @@ export function deckFolder(deckDir) {
|
|
|
553
688
|
// scrolls a slide. A cover whose title lands on its picture is a warning, and so is a picture that
|
|
554
689
|
// leaves a band (over a fifth of its frame empty) or is cropped past the limit (pictureFitWarnings), or whose corner cuts into it (pictureCornerWarnings). No Chromium is a warning, as each measurement is optional.
|
|
555
690
|
// The pictures again as a phone shows them (its frames have other shapes).
|
|
556
|
-
const measurePhonePictures = (deckDir, styles) => measureLayout(deckDir, styles, { width: PHONE.width, height: PHONE.height, card: PHONE.card });
|
|
691
|
+
const measurePhonePictures = (deckDir, styles, { noPresenter = false } = {}) => measureLayout(deckDir, styles, { width: PHONE.width, height: PHONE.height, card: PHONE.card, noPresenter });
|
|
557
692
|
// A caller that injects `measure` and no `measurePhone` gets no phone pass.
|
|
558
693
|
// `readBars` reads the framed files for bars (measureFramedBars; a caller that injects `measure` and no
|
|
559
694
|
// `readBars` gets none).
|
|
@@ -561,12 +696,18 @@ export async function layoutCheck(deckDir, html, manifest = null, { measure = me
|
|
|
561
696
|
const errors = [], warnings = [];
|
|
562
697
|
const { width: w, height: h } = stageSize(html);
|
|
563
698
|
try {
|
|
564
|
-
const measured = await measure(deckDir, slideStyles(html, manifest), { width: w, height: h });
|
|
699
|
+
const measured = await measure(deckDir, slideStyles(html, manifest), { width: w, height: h, noPresenter: silentWithoutPresenter(html) });
|
|
565
700
|
// A silent deck with no presenter (silentWithoutPresenter) has nothing in the corner to overlap.
|
|
566
701
|
if (!silentWithoutPresenter(html)) {
|
|
567
702
|
warnings.push(...overlapWarnings(measured, `${w}×${h}`));
|
|
568
703
|
warnings.push(...presenterMediaWarnings(measured, `${w}×${h}`));
|
|
569
704
|
}
|
|
705
|
+
// Text over text, the presenter over text and clipped text (collisionFindings). The player draws this same stage, scaled,
|
|
706
|
+
// at every window wider than 650px, so the stage size stands for all of them; narrower windows are measured at the phone size below.
|
|
707
|
+
const silent = silentWithoutPresenter(html);
|
|
708
|
+
const stage = collisionFindings(measured, { where: `${w}×${h}`, presenter: !silent });
|
|
709
|
+
errors.push(...stage.errors);
|
|
710
|
+
warnings.push(...stage.warnings);
|
|
570
711
|
warnings.push(...coverTextWarnings(measured));
|
|
571
712
|
warnings.push(...pictureFitWarnings(measured));
|
|
572
713
|
warnings.push(...pictureCornerWarnings(measured));
|
|
@@ -574,7 +715,10 @@ export async function layoutCheck(deckDir, html, manifest = null, { measure = me
|
|
|
574
715
|
warnings.push(...lensOffSlideWarnings(measured));
|
|
575
716
|
warnings.push(...wordFitWarnings(measured));
|
|
576
717
|
if (measurePhone) {
|
|
577
|
-
const phone = await measurePhone(deckDir, slideStyles(html, manifest));
|
|
718
|
+
const phone = await measurePhone(deckDir, slideStyles(html, manifest), { noPresenter: silentWithoutPresenter(html) });
|
|
719
|
+
const small = collisionFindings(phone, { where: `${PHONE.width}×${PHONE.height} (a phone)`, presenter: false });
|
|
720
|
+
errors.push(...small.errors);
|
|
721
|
+
warnings.push(...small.warnings);
|
|
578
722
|
warnings.push(...wordFitWarnings(phone, { phone: true }));
|
|
579
723
|
warnings.push(...pictureFitWarnings(phone, { phone: true }));
|
|
580
724
|
warnings.push(...pictureCornerWarnings(phone, { phone: true }));
|
|
@@ -604,7 +748,7 @@ export async function layoutCheck(deckDir, html, manifest = null, { measure = me
|
|
|
604
748
|
warnings.push(MESSAGES.layoutUnchecked(e.message));
|
|
605
749
|
}
|
|
606
750
|
}
|
|
607
|
-
return { errors, warnings: [...new Set(warnings)] };
|
|
751
|
+
return { errors: [...new Set(errors)], warnings: [...new Set(warnings)] };
|
|
608
752
|
}
|
|
609
753
|
|
|
610
754
|
// Run every rule on a deck folder. Returns { deckDir, slug, slides, totalDuration, errors }.
|