decklight 0.10.0 → 0.11.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/NOTICE +2 -0
- package/PLATFORM.md +17 -0
- package/README.md +53 -25
- package/SPEC.md +1239 -67
- package/cli/agents.mjs +139 -15
- package/cli/bundle.mjs +68 -2
- package/cli/cast.mjs +45 -14
- package/cli/check-fixes.mjs +12 -4
- package/cli/check-watch.mjs +151 -0
- package/cli/check.mjs +460 -71
- package/cli/code-editor.mjs +287 -0
- package/cli/commands.mjs +13 -2
- package/cli/commit-message.mjs +34 -7
- package/cli/commit-split.mjs +123 -23
- package/cli/decklight.mjs +11 -1
- package/cli/design-system-edit.mjs +37 -1
- package/cli/edit-address.mjs +184 -0
- package/cli/edit-git.mjs +21 -4
- package/cli/edit-handover.mjs +136 -25
- package/cli/edit-look.mjs +45 -1
- package/cli/edit-open.mjs +143 -0
- package/cli/edit-slides.mjs +1043 -67
- package/cli/edit-translate.mjs +243 -0
- package/cli/edit.mjs +3182 -267
- package/cli/editor-support.mjs +286 -0
- package/cli/enhance.mjs +148 -20
- package/cli/find-replace.mjs +142 -0
- package/cli/fix-review.mjs +368 -0
- package/cli/init.mjs +93 -19
- package/cli/keep-awake.mjs +68 -0
- package/cli/migrate-writing.mjs +214 -0
- package/cli/narrate.mjs +51 -10
- package/cli/open.mjs +29 -9
- package/cli/outside-edit.mjs +257 -0
- package/cli/paste.mjs +92 -0
- package/cli/pdf.mjs +61 -2
- package/cli/pptx-export.mjs +3 -1
- package/cli/publish.mjs +24 -3
- package/cli/record.mjs +19 -8
- package/cli/rewrite.mjs +265 -0
- package/cli/runtime-link.mjs +218 -17
- package/cli/serve.mjs +7 -4
- package/cli/setup.mjs +2 -2
- package/cli/skill-content.mjs +212 -8
- package/cli/skills/slide-writing.md +333 -0
- package/cli/skills/voiceover.md +423 -0
- package/cli/skills.mjs +36 -13
- package/cli/starter-full.mjs +353 -0
- package/cli/supervise.mjs +14 -0
- package/cli/theme.mjs +3 -2
- package/cli/translate-core.mjs +466 -0
- package/cli/translate-files.mjs +149 -0
- package/cli/translate.mjs +458 -0
- package/cli/util.mjs +25 -0
- package/cli/vocabulary-docs.mjs +138 -0
- package/dist/decklight.css +2087 -91
- package/dist/decklight.js +367 -203
- package/dist/decklight.js.map +4 -4
- package/docs/GLOSSARY.md +9 -2
- package/docs/WRITING_RESEARCH.md +327 -0
- package/package.json +5 -3
- package/themes/coastal.css +3 -0
- package/themes/metropolis.css +2 -0
- package/themes/reveal-blood.css +3 -0
- package/themes/reveal-league.css +2 -0
- package/themes/reveal-moon.css +2 -0
- package/themes/reveal-serif.css +1 -0
- package/themes/reveal-sky.css +1 -0
- package/themes/reveal-solarized.css +4 -0
- package/tools/brand-palette.mjs +6 -1
- package/tools/build-groups.mjs +28 -8
- package/tools/cdp.mjs +176 -0
- package/tools/chart-spec.mjs +242 -0
- package/tools/click-match.mjs +70 -0
- package/tools/code-options.mjs +174 -0
- package/tools/conversation.mjs +49 -0
- package/tools/deck-family.mjs +101 -0
- package/tools/deck-html.mjs +212 -15
- package/tools/design-system-format.mjs +15 -1
- package/tools/diagram-shapes.mjs +221 -0
- package/tools/elevenlabs-tts.mjs +62 -53
- package/tools/face-clip.mjs +96 -0
- package/tools/face-layout.mjs +94 -0
- package/tools/gemini-tts.mjs +1 -1
- package/tools/invisible-in-print.mjs +27 -0
- package/tools/lipsync-auto.mjs +197 -0
- package/tools/lipsync-config.mjs +16 -0
- package/tools/lipsync-engines.mjs +22 -4
- package/tools/lipsync-server.mjs +8 -5
- package/tools/lipsync.mjs +122 -30
- package/tools/local-voice.mjs +1 -1
- package/tools/mouth-file.mjs +26 -0
- package/tools/mouth.mjs +320 -0
- package/tools/narration-manifest.mjs +24 -4
- package/tools/narration-synth.mjs +96 -76
- package/tools/recording-impact.mjs +16 -1
- package/tools/sentences.mjs +7 -1
- package/tools/starters.mjs +402 -0
- package/tools/steps.mjs +118 -0
- package/tools/take-check.mjs +146 -0
- package/tools/template-theme.mjs +3 -1
- package/tools/test-impact.mjs +36 -12
- package/tools/theme-check.mjs +196 -1
- package/tools/tone-cue.mjs +108 -0
- package/tools/tts-cache.mjs +9 -3
- package/tools/tts-engines.mjs +100 -11
- package/tools/video-cache.mjs +93 -0
- package/tools/video-live.mjs +349 -0
- package/tools/video-options.mjs +11 -0
- package/tools/video.mjs +772 -127
- package/tools/viseme-fit.mjs +27 -0
- package/tools/viseme-match.mjs +77 -0
- package/tools/vocabulary.mjs +397 -0
- package/tools/voice-renumber.mjs +605 -0
- package/tools/voiceover-server.mjs +42 -11
- package/tools/voiceover.mjs +48 -20
- package/dist/build-info.json +0 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// A code block's settings (SPEC CODE_AND_MATH), as the inspector's Options tab
|
|
5
|
+
// offers them and the edit server writes them: its language, line numbers,
|
|
6
|
+
// fit to its space, the line steps and their callouts. Pure and shared, so the page (which
|
|
7
|
+
// shows a change at once) and the server (which writes it) hold one closed set
|
|
8
|
+
// and one reading of `data-lines`.
|
|
9
|
+
|
|
10
|
+
/** The languages the runtime highlights (src/code/code.js), as the field lists them. */
|
|
11
|
+
export const CODE_LANGUAGES = [
|
|
12
|
+
['bash', 'Bash, shell'], ['css', 'CSS'], ['go', 'Go'], ['xml', 'HTML, XML'], ['java', 'Java'],
|
|
13
|
+
['javascript', 'JavaScript'], ['json', 'JSON'], ['python', 'Python'], ['rust', 'Rust'],
|
|
14
|
+
['sql', 'SQL'], ['typescript', 'TypeScript'], ['yaml', 'YAML'],
|
|
15
|
+
];
|
|
16
|
+
/** The other names a `language-` class may carry for the same language (code.js's aliases). */
|
|
17
|
+
const ALIASES = {
|
|
18
|
+
js: 'javascript', ts: 'typescript', shell: 'bash', sh: 'bash', zsh: 'bash', html: 'xml',
|
|
19
|
+
text: '', plain: '', plaintext: '',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The language a `language-` class names, as the field shows it: one of
|
|
24
|
+
* CODE_LANGUAGES, '' for plain text (no class, or a plain one), or null for a
|
|
25
|
+
* name the runtime does not highlight (shown as it is, never rewritten).
|
|
26
|
+
*/
|
|
27
|
+
export function languageOf(name) {
|
|
28
|
+
if (name == null || name === '') return '';
|
|
29
|
+
const n = String(name).toLowerCase();
|
|
30
|
+
if (Object.hasOwn(ALIASES, n)) return ALIASES[n];
|
|
31
|
+
return CODE_LANGUAGES.some(([v]) => v === n) ? n : null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* How a block fits its space, as the field offers it: `off` (no `data-fit`),
|
|
36
|
+
* `shrink` (bare `data-fit`: as large as fits, never past its own size) or
|
|
37
|
+
* `fill` (`data-fit="fill"`: grows short code too, up to `--code-max-size`).
|
|
38
|
+
*/
|
|
39
|
+
export const FIT_MODES = [['off', 'off'], ['shrink', 'shrink to fit'], ['fill', 'fill']];
|
|
40
|
+
|
|
41
|
+
/** `data-fit`'s value (null when absent) as one of FIT_MODES: any value but fill reads as a plain fit, as the runtime reads it. */
|
|
42
|
+
export const fitOf = (value) => (value == null ? 'off' : String(value).trim().toLowerCase() === 'fill' ? 'fill' : 'shrink');
|
|
43
|
+
|
|
44
|
+
/** A FIT_MODES value as the edit route's `data-fit`: null takes it off, true writes it bare. */
|
|
45
|
+
export const fitAttr = (mode) => (mode === 'fill' ? 'fill' : mode === 'shrink' ? true : null);
|
|
46
|
+
|
|
47
|
+
/** The lines a block's code has, counted as the runtime counts them (its file's first newline and trailing space are layout). */
|
|
48
|
+
export function lineCount(code) {
|
|
49
|
+
const text = String(code ?? '').replace(/^\n/, '').replace(/\s+$/, '');
|
|
50
|
+
return text === '' ? 0 : text.split('\n').length;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** `data-lines` as its steps, one string each (`1-2|4` → `['1-2', '4']`); none is []. */
|
|
54
|
+
export const stepsOf = (spec) => (spec == null || String(spec).trim() === '' ? [] : String(spec).split('|').map((s) => s.trim()));
|
|
55
|
+
/** The steps written back as `data-lines`, or null for none. */
|
|
56
|
+
export const specOf = (steps) => (steps.length ? steps.map((s) => String(s).trim()).join('|') : null);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* What is wrong with one step for a block of `total` lines, in a sentence, or
|
|
60
|
+
* null: `all`, a line (`4`), a range (`6-9`), or several (`1,3-4`).
|
|
61
|
+
*/
|
|
62
|
+
export function stepError(step, total) {
|
|
63
|
+
const s = String(step ?? '').trim();
|
|
64
|
+
if (s === '') return 'a step needs its lines, like 1-2, or all';
|
|
65
|
+
if (s === 'all') return null;
|
|
66
|
+
for (const part of s.split(',')) {
|
|
67
|
+
const m = /^(\d+)(?:-(\d+))?$/.exec(part.trim());
|
|
68
|
+
if (!m) return `“${part.trim()}” is not a line or a range: write 4, 6-9, or 1,3`;
|
|
69
|
+
const a = Number(m[1]);
|
|
70
|
+
const b = m[2] === undefined ? a : Number(m[2]);
|
|
71
|
+
if (a < 1) return 'lines are counted from 1';
|
|
72
|
+
if (b < a) return `${a}-${b} runs backwards: write ${b}-${a}`;
|
|
73
|
+
if (b > total) return `the block has ${total} line${total === 1 ? '' : 's'}: ${b} is past its end`;
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The first step's error in `data-lines` for `total` lines, with its number, or null. */
|
|
79
|
+
export function linesError(spec, total) {
|
|
80
|
+
const steps = stepsOf(spec);
|
|
81
|
+
for (let i = 0; i < steps.length; i++) {
|
|
82
|
+
const why = stepError(steps[i], total);
|
|
83
|
+
if (why) return steps.length > 1 ? `step ${i + 1}: ${why}` : why;
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* A step with line `n` added (a click on a line of the block), its lines kept
|
|
90
|
+
* in order and joined into ranges: `1-2` with 3 is `1-3`, with 5 is `1-2,5`.
|
|
91
|
+
* A line it already has is taken out again.
|
|
92
|
+
*/
|
|
93
|
+
export function toggleLine(step, n) {
|
|
94
|
+
const have = new Set();
|
|
95
|
+
const s = String(step ?? '').trim();
|
|
96
|
+
if (s !== 'all') {
|
|
97
|
+
for (const part of s.split(',')) {
|
|
98
|
+
const m = /^(\d+)(?:-(\d+))?$/.exec(part.trim());
|
|
99
|
+
if (!m) continue;
|
|
100
|
+
const a = Number(m[1]);
|
|
101
|
+
const b = m[2] === undefined ? a : Number(m[2]);
|
|
102
|
+
for (let i = a; i <= b && i - a < 10000; i++) have.add(i);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (have.has(n)) have.delete(n); else have.add(n);
|
|
106
|
+
const lines = [...have].sort((x, y) => x - y);
|
|
107
|
+
const out = [];
|
|
108
|
+
for (let i = 0; i < lines.length; i++) {
|
|
109
|
+
let j = i;
|
|
110
|
+
while (j + 1 < lines.length && lines[j + 1] === lines[j] + 1) j++;
|
|
111
|
+
out.push(j > i ? `${lines[i]}-${lines[j]}` : String(lines[i]));
|
|
112
|
+
i = j;
|
|
113
|
+
}
|
|
114
|
+
return out.join(',');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* `data-callouts` as its labels, one a step in step order (#1182): `|` between
|
|
119
|
+
* them, `\|` a bar inside one, an empty entry a step with none. Trailing
|
|
120
|
+
* empties are no labels at all, so `a|b|` is two. None is [].
|
|
121
|
+
*/
|
|
122
|
+
export function calloutsOf(spec) {
|
|
123
|
+
if (spec == null) return [];
|
|
124
|
+
const s = String(spec);
|
|
125
|
+
const out = [''];
|
|
126
|
+
for (let i = 0; i < s.length; i++) {
|
|
127
|
+
if (s[i] === '\\' && s[i + 1] === '|') { out[out.length - 1] += '|'; i++; }
|
|
128
|
+
else if (s[i] === '|') out.push('');
|
|
129
|
+
else out[out.length - 1] += s[i];
|
|
130
|
+
}
|
|
131
|
+
const labels = out.map((t) => t.replace(/\s+/g, ' ').trim());
|
|
132
|
+
while (labels.length && labels[labels.length - 1] === '') labels.pop();
|
|
133
|
+
return labels;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** The labels written back as `data-callouts` (a bar in one escaped), or null for none. */
|
|
137
|
+
export function calloutsSpec(labels) {
|
|
138
|
+
const l = [...(labels ?? [])].map((t) => String(t ?? '').replace(/\s+/g, ' ').trim());
|
|
139
|
+
while (l.length && l[l.length - 1] === '') l.pop();
|
|
140
|
+
return l.length ? l.map((t) => t.replace(/\|/g, '\\|')).join('|') : null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Which stepped block each `<aside class="callouts">` of a slide labels: the
|
|
145
|
+
* one its `data-for` names (an id, with or without `#`), else the next stepped
|
|
146
|
+
* block, in order, that no aside names. `blocks` are the slide's stepped
|
|
147
|
+
* blocks as `{ id }`, `asides` its callout asides as `{ for }`, both in
|
|
148
|
+
* document order; the answer is a block index (or -1, none) per aside.
|
|
149
|
+
*/
|
|
150
|
+
export function calloutBlocks(blocks, asides) {
|
|
151
|
+
const idOf = (v) => String(v ?? '').trim().replace(/^#/, '');
|
|
152
|
+
const named = new Set(asides.map((a) => idOf(a.for)).filter(Boolean));
|
|
153
|
+
const free = blocks.map((_, i) => i).filter((i) => !(blocks[i].id && named.has(blocks[i].id)));
|
|
154
|
+
let k = 0;
|
|
155
|
+
return asides.map((a) => {
|
|
156
|
+
const id = idOf(a.for);
|
|
157
|
+
if (id) return blocks.findIndex((b) => b.id === id);
|
|
158
|
+
return k < free.length ? free[k++] : -1;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The step each entry of a callouts aside labels: its `data-step` when it has
|
|
164
|
+
* one, else the step after the entry before it. `steps` are the entries'
|
|
165
|
+
* `data-step` values (undefined for none); the answer is 1-based.
|
|
166
|
+
*/
|
|
167
|
+
export function calloutSteps(steps) {
|
|
168
|
+
let n = 0;
|
|
169
|
+
return steps.map((s) => {
|
|
170
|
+
const v = parseInt(s ?? '', 10);
|
|
171
|
+
n = Number.isFinite(v) && v >= 1 ? v : n + 1;
|
|
172
|
+
return n;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// A conversation's vocabulary (SPEC DECK_ANATOMY, #1179), shared by the
|
|
5
|
+
// runtime (src/core/conversation.js), the edit server's turn writes
|
|
6
|
+
// (cli/edit.mjs setConversationTurn) and the element menu's Turn ▸, so the
|
|
7
|
+
// three agree on what a turn may be. Pure; it ships in the runtime bundle.
|
|
8
|
+
|
|
9
|
+
/** The kinds a turn may be (`data-kind`): speech is the default, written as no attribute. */
|
|
10
|
+
export const TURN_KINDS = ['speech', 'thought', 'tool-call'];
|
|
11
|
+
/** The roles Turn ▸ offers; any other word is a role too, shown as the turn's label. */
|
|
12
|
+
export const TURN_ROLES = ['user', 'agent', 'tool', 'system'];
|
|
13
|
+
/** A role as an author may write one: a word, the label it shows. */
|
|
14
|
+
export const ROLE_WORD = /^[A-Za-z][\w-]{0,23}$/;
|
|
15
|
+
|
|
16
|
+
/** A call as an agent writes one: a name, its arguments in brackets. */
|
|
17
|
+
const CALL = /^([A-Za-z_$][\w$.:-]*)\s*\([\s\S]*\)\s*;?$/;
|
|
18
|
+
|
|
19
|
+
/** The tool a call names (`get_order(4417)` → `get_order`), or null. */
|
|
20
|
+
export function callName(text) {
|
|
21
|
+
return CALL.exec(String(text ?? '').trim())?.[1] ?? null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The language a tool turn's words are coloured as: `json` when they parse
|
|
26
|
+
* as a JSON object or array, `javascript` when they read as a call, null when
|
|
27
|
+
* they are words.
|
|
28
|
+
*/
|
|
29
|
+
export function codeLanguage(text) {
|
|
30
|
+
const t = String(text ?? '').trim();
|
|
31
|
+
if (!t) return null;
|
|
32
|
+
if (/^[[{]/.test(t)) {
|
|
33
|
+
try { JSON.parse(t); return 'json'; } catch { /* not JSON */ }
|
|
34
|
+
}
|
|
35
|
+
return CALL.test(t) ? 'javascript' : null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Who speaks after a turn of `role` and `kind`, for "Add a turn after": the
|
|
40
|
+
* agent answers the user, the tool answers the agent's call, the agent reads
|
|
41
|
+
* the tool's answer, and the user answers the agent; any other role speaks
|
|
42
|
+
* again.
|
|
43
|
+
*/
|
|
44
|
+
export function nextTurnRole(role, kind = null) {
|
|
45
|
+
if (role === 'agent') return kind === 'tool-call' ? 'tool' : 'user';
|
|
46
|
+
if (role === 'user' || role === 'tool') return 'agent';
|
|
47
|
+
if (role === 'system') return 'user';
|
|
48
|
+
return role || 'user';
|
|
49
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// A deck and the same deck in other languages, side by side in one folder:
|
|
5
|
+
// `talk.html`, `talk.fr.html`, `talk.pt-br.html` (SPEC PRESENTING_VOICE). They
|
|
6
|
+
// are one deck for the rules that count the decks in a folder, and each has
|
|
7
|
+
// its own narration: a take in French is not a track of the English deck.
|
|
8
|
+
//
|
|
9
|
+
// Nothing here is configured. A file is another language of a deck when its
|
|
10
|
+
// name says so AND its `<html lang>` agrees, so `talk.old.html` and
|
|
11
|
+
// `talk.min.html` are what they always were: other decks.
|
|
12
|
+
|
|
13
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
14
|
+
import { basename, dirname, join } from 'node:path';
|
|
15
|
+
import { deckLang } from './deck-html.mjs';
|
|
16
|
+
|
|
17
|
+
const TAG = '[a-z]{2,3}(?:-[a-z0-9]{2,8})*';
|
|
18
|
+
const SUFFIXED = new RegExp(`^(.+)\\.(${TAG})(\\.html?)$`, 'i');
|
|
19
|
+
const LANG_ROOT = new RegExp(`^voices-(${TAG})$`, 'i');
|
|
20
|
+
|
|
21
|
+
const primary = (tag) => String(tag ?? '').trim().toLowerCase().split(/[-_]/)[0] || null;
|
|
22
|
+
|
|
23
|
+
/** The language a deck file is in, when its name carries one its `<html lang>` agrees with: `fr` for `talk.fr.html`. */
|
|
24
|
+
function suffixLang(dir, name) {
|
|
25
|
+
const m = SUFFIXED.exec(name);
|
|
26
|
+
if (!m) return null;
|
|
27
|
+
let html;
|
|
28
|
+
try { html = readFileSync(join(dir, name), 'utf8'); } catch { return null; }
|
|
29
|
+
if (!/class\s*=\s*["'][^"']*\bdecklight\b/.test(html)) return null;
|
|
30
|
+
return primary(deckLang(html)) === primary(m[2]) ? m[2].toLowerCase() : null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The deck's family: `{ lang, members }`.
|
|
35
|
+
*
|
|
36
|
+
* `lang` is this deck's own language when it is another language of a deck
|
|
37
|
+
* beside it (`fr` for `talk.fr.html` next to `talk.html`), null for the deck
|
|
38
|
+
* the others are languages of, and for a deck with no such company.
|
|
39
|
+
* `members` are the OTHER files of the family: `[{ name, lang }]`, `lang`
|
|
40
|
+
* null for the one with no language in its name.
|
|
41
|
+
*/
|
|
42
|
+
export function deckFamily(deckPath) {
|
|
43
|
+
const dir = dirname(deckPath);
|
|
44
|
+
const name = basename(deckPath);
|
|
45
|
+
const m = SUFFIXED.exec(name);
|
|
46
|
+
// `talk.fr.html` is a language of `talk.html` only when that deck is there
|
|
47
|
+
const own = m && existsSync(join(dir, m[1] + m[3])) ? suffixLang(dir, name) : null;
|
|
48
|
+
const stem = own ? m[1] : name.replace(/\.html?$/i, '');
|
|
49
|
+
let names = [];
|
|
50
|
+
try { names = readdirSync(dir); } catch { /* no folder, no family */ }
|
|
51
|
+
const members = [];
|
|
52
|
+
for (const n of names) {
|
|
53
|
+
if (n === name) continue;
|
|
54
|
+
if (own && new RegExp(`^${escapeRe(stem)}\\.html?$`, 'i').test(n)) { members.push({ name: n, lang: null }); continue; }
|
|
55
|
+
const s = SUFFIXED.exec(n);
|
|
56
|
+
if (!s || s[1] !== stem) continue;
|
|
57
|
+
const lang = suffixLang(dir, n);
|
|
58
|
+
if (lang) members.push({ name: n, lang });
|
|
59
|
+
}
|
|
60
|
+
return { lang: own, members };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The language a track was recorded in, as far as it says: its folder's
|
|
67
|
+
* (`voices-fr/anna`), else the one its manifest was voiced in. Null for a
|
|
68
|
+
* track that says nothing, which is every track recorded in English.
|
|
69
|
+
*/
|
|
70
|
+
export function trackLang(rel, manifest = null) {
|
|
71
|
+
const top = String(rel ?? '').split(/[/\\]/).filter(Boolean)[0] ?? '';
|
|
72
|
+
const m = LANG_ROOT.exec(top);
|
|
73
|
+
if (m) return m[1].toLowerCase();
|
|
74
|
+
return typeof manifest?.lang === 'string' && manifest.lang ? manifest.lang.toLowerCase() : null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Is the track at `rel` this deck's? Another language of a deck takes only
|
|
79
|
+
* the tracks in its language. The deck the others are languages of takes
|
|
80
|
+
* everything that is not one of theirs — so a deck with no family, which is
|
|
81
|
+
* every deck before a second language exists, takes what it always took.
|
|
82
|
+
*/
|
|
83
|
+
export function ownsTrack(family, rel, manifest = null) {
|
|
84
|
+
const lang = primary(trackLang(rel, manifest));
|
|
85
|
+
if (family.lang) return lang === primary(family.lang);
|
|
86
|
+
return !lang || !family.members.some((f) => f.lang && primary(f.lang) === lang);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Where a deck's new takes go: `voices`, or `voices-fr` for the French of a deck. */
|
|
90
|
+
export const tracksRoot = (family) => (family.lang ? `voices-${family.lang}` : 'voices');
|
|
91
|
+
|
|
92
|
+
/** The folder a deck is voiced into when nothing names one: `voiceover`, or `voices-fr/voiceover` for the French of a deck. */
|
|
93
|
+
export const defaultTrackDir = (deckPath) => {
|
|
94
|
+
const family = deckFamily(deckPath);
|
|
95
|
+
return family.lang ? `${tracksRoot(family)}/voiceover` : 'voiceover';
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** `manifest.json` in a folder, parsed, or null. */
|
|
99
|
+
export function readManifest(abs) {
|
|
100
|
+
try { return JSON.parse(readFileSync(join(abs, 'manifest.json'), 'utf8')); } catch { return null; }
|
|
101
|
+
}
|
package/tools/deck-html.mjs
CHANGED
|
@@ -22,6 +22,16 @@ export const NOTES_ASIDE = /<aside class="notes">([\s\S]*?)<\/aside>/;
|
|
|
22
22
|
* What video and voiceover walk to count slides and pull notes — they MUST see
|
|
23
23
|
* the same list, which is exactly why they share this.
|
|
24
24
|
*/
|
|
25
|
+
/**
|
|
26
|
+
* The deck's language: `<html lang>`, as written (`fr`, `pt-BR`), or null.
|
|
27
|
+
* It is what the voice is asked to speak (SPEC PRESENTING_VOICE) and what
|
|
28
|
+
* captions and lip-sync are cut for, so it is read here, once, from the file.
|
|
29
|
+
*/
|
|
30
|
+
export const deckLang = (html) => {
|
|
31
|
+
const m = /<html\b[^>]*?\slang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(String(html ?? ''));
|
|
32
|
+
return (m?.[1] ?? m?.[2] ?? m?.[3] ?? '').trim() || null;
|
|
33
|
+
};
|
|
34
|
+
|
|
25
35
|
export const sectionBodies = (html) => html.split(/<section\b/).slice(1);
|
|
26
36
|
|
|
27
37
|
/**
|
|
@@ -104,6 +114,58 @@ export const slideHeading = (sectionBody, i) => {
|
|
|
104
114
|
return fromHeading || slideText(sectionBody).slice(0, 60) || `slide ${i + 1}`;
|
|
105
115
|
};
|
|
106
116
|
|
|
117
|
+
/** How long a slide's name may run in a commit subject before it is cut. */
|
|
118
|
+
export const SLIDE_NAME_MAX = 40;
|
|
119
|
+
|
|
120
|
+
/** `s` cut at a word to `max` characters, with an ellipsis when it was cut. */
|
|
121
|
+
const clip = (s, max = SLIDE_NAME_MAX) => {
|
|
122
|
+
if (s.length <= max) return s;
|
|
123
|
+
const cut = s.slice(0, max - 1).replace(/[\uD800-\uDBFF]$/, '');
|
|
124
|
+
const word = cut.replace(/\s+\S*$/, '');
|
|
125
|
+
return `${(word.length >= max / 2 ? word : cut).replace(/[\s,;:.–—-]+$/, '')}…`;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* What a commit subject calls a slide (PRESENTING_EDITING, git autocommit): its
|
|
130
|
+
* heading in quotes, else a few words that describe it: a diagram's
|
|
131
|
+
* `aria-label`, its opening words, or its layout. Never its number, which stops
|
|
132
|
+
* being true the moment a slide is inserted above it, and leaves `git log`
|
|
133
|
+
* pointing at the wrong slide a day later. `sectionBody` is a `sectionBodies`
|
|
134
|
+
* entry, open tag's attributes and all.
|
|
135
|
+
*/
|
|
136
|
+
export const slideName = (sectionBody) => {
|
|
137
|
+
const body = String(sectionBody ?? '');
|
|
138
|
+
const inner = sectionInner(body);
|
|
139
|
+
const h = /<h[1-3]\b[^>]*>([\s\S]*?)<\/h[1-3]>/i.exec(inner);
|
|
140
|
+
const heading = h ? slideText(h[1]) : '';
|
|
141
|
+
if (heading) return `"${clip(heading)}"`;
|
|
142
|
+
const label = /<(?:svg|figure|img)\b[^>]*?\s(?:aria-label|alt)="([^"]+)"/i.exec(inner);
|
|
143
|
+
if (label && slideText(label[1])) return `the "${clip(slideText(label[1]), SLIDE_NAME_MAX - 8)}" diagram`;
|
|
144
|
+
const words = slideText(inner.replace(/<svg\b[\s\S]*?<\/svg>/gi, ' ')).split(' ').slice(0, 6).join(' ');
|
|
145
|
+
if (words) return `the slide "${clip(words, SLIDE_NAME_MAX - 10)}"`;
|
|
146
|
+
const layout = /^[^>]*\sdata-layout="([a-z-]+)"/i.exec(body)?.[1];
|
|
147
|
+
return layout ? `the ${layout} slide` : 'an empty slide';
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Several slides' names as one phrase: `"A"`, `"A" and "B"`, or `"A" and 2
|
|
152
|
+
* other slides` when naming them all would crowd the subject out.
|
|
153
|
+
*/
|
|
154
|
+
export const slideNamesPhrase = (names) => {
|
|
155
|
+
const ns = [...new Set(names.filter(Boolean))];
|
|
156
|
+
if (ns.length <= 1) return ns[0] ?? '';
|
|
157
|
+
if (ns.length === 2) return `${ns[0]} and ${ns[1]}`;
|
|
158
|
+
return `${ns[0]} and ${ns.length - 1} other slides`;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* A trailing ` on <slides>` as subjects name them, the old numbered way or
|
|
163
|
+
* by `slideNamesPhrase`, so a draft can swap where a fix landed for the slides
|
|
164
|
+
* it actually landed on.
|
|
165
|
+
*/
|
|
166
|
+
const ONE_NAME = String.raw`(?:"[^"]*"|the slide "[^"]*"|the "[^"]*" diagram|the [a-z-]+ slide|an (?:empty|untitled) slide)`;
|
|
167
|
+
export const SLIDES_TAIL = new RegExp(String.raw`\s+on (?:slides? [\d, and]+|the deck|${ONE_NAME}(?: and (?:${ONE_NAME}|\d+ other slides))?)$`);
|
|
168
|
+
|
|
107
169
|
/**
|
|
108
170
|
* Speaker-note HTML as plain text: tags out, entities back, whitespace flat.
|
|
109
171
|
*
|
|
@@ -414,6 +476,16 @@ export function elementChildRanges(el) {
|
|
|
414
476
|
return ranges;
|
|
415
477
|
}
|
|
416
478
|
|
|
479
|
+
// ── what a slide carries (PRESENTING_EDITING, Moving) ─────────────────────
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* What a slide carries rather than shows (DECK_ANATOMY): its notes, sources
|
|
483
|
+
* and rehearsed time, and a script or a style. They stay where they are; an
|
|
484
|
+
* element moves among the rest.
|
|
485
|
+
*/
|
|
486
|
+
export const carriedChild = (seg, r) => r.tag === 'script' || r.tag === 'style'
|
|
487
|
+
|| (r.tag === 'aside' && /^<aside\b[^>]*\bclass\s*=\s*["'][^"']*\b(?:notes|sources|rehearse)\b/i.test(seg.slice(r.start, r.end)));
|
|
488
|
+
|
|
417
489
|
/** A section body split into its open tag's attributes and everything after. */
|
|
418
490
|
export function splitOpenTag(body) {
|
|
419
491
|
const src = String(body ?? '');
|
|
@@ -573,21 +645,43 @@ export function swapSlides(html, a, b) {
|
|
|
573
645
|
}
|
|
574
646
|
|
|
575
647
|
/**
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
648
|
+
* `markup` written at `indent`: every line but the first shifted by it, and
|
|
649
|
+
* the lines inside a `<pre>` left exactly as they are, because there the
|
|
650
|
+
* leading spaces are the code's own and a reindent would put them on screen.
|
|
651
|
+
* A slide written on one line (`indent === null`) keeps the markup as given.
|
|
652
|
+
*/
|
|
653
|
+
function indentMarkup(markup, indent) {
|
|
654
|
+
const lines = String(markup).replace(/^\s*\n|\s+$/g, '').split('\n');
|
|
655
|
+
if (indent === null) return lines.join('\n');
|
|
656
|
+
let inPre = 0;
|
|
657
|
+
return lines.map((line, i) => {
|
|
658
|
+
const out = i === 0 || inPre > 0 || !line.trim() ? line : indent + line;
|
|
659
|
+
inPre += (line.match(/<pre\b/gi)?.length ?? 0) - (line.match(/<\/pre\s*>/gi)?.length ?? 0);
|
|
660
|
+
return out;
|
|
661
|
+
}).join('\n');
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* A deck with `markup` (one element or several siblings, written at zero
|
|
666
|
+
* indentation) inserted into slide `slide`, after top-level child `index`:
|
|
667
|
+
* the same addressing the element-edit routes use (`sectionChildRanges`).
|
|
668
|
+
*
|
|
669
|
+
* `index === null` means "on the slide": the markup goes after the last
|
|
670
|
+
* content child and BEFORE the asides, so whatever is added to a slide that
|
|
671
|
+
* has speaker notes lands on the slide and not inside the notes, where the
|
|
672
|
+
* audience would never see it (DECK_ANATOMY: notes, sources and rehearse are
|
|
673
|
+
* all `<aside>` siblings at the end of a section). An explicit `index` is
|
|
674
|
+
* the author's choice, even one that names an aside.
|
|
579
675
|
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
* audience would never see it (DECK_ANATOMY — notes, sources and rehearse are
|
|
584
|
-
* all `<aside>` siblings at the end of a section).
|
|
676
|
+
* The markup lands on its own line at the indentation of the child it
|
|
677
|
+
* follows, its later lines shifted with it (`indentMarkup`), so a list or a
|
|
678
|
+
* diagram reads in the file as if it had been typed there.
|
|
585
679
|
*
|
|
586
680
|
* Returns `{ html, index }`: the caller has to be able to tell the browser
|
|
587
681
|
* which child the new element IS, since every element route addresses by
|
|
588
682
|
* position and everything after the insertion has just shifted.
|
|
589
683
|
*/
|
|
590
|
-
export function
|
|
684
|
+
export function insertElement(html, slide, index, markup) {
|
|
591
685
|
const deck = String(html ?? '');
|
|
592
686
|
const { parts, idx } = locateSlide(deck, slide);
|
|
593
687
|
const seg = parts[idx];
|
|
@@ -596,6 +690,9 @@ export function insertImage(html, slide, index, { src = '', alt = '' } = {}) {
|
|
|
596
690
|
// begin a line (a slide written on one line stays on one line)
|
|
597
691
|
const indentOf = (r) => (r ? /\n([ \t]*)$/.exec(seg.slice(0, r.start))?.[1] ?? null : null);
|
|
598
692
|
|
|
693
|
+
if (index !== null && index !== undefined && !ranges[index]) {
|
|
694
|
+
throw new Error(`slide ${slide}: no element at index ${index} (has ${ranges.length})`);
|
|
695
|
+
}
|
|
599
696
|
let at; // offset in `seg` to insert at
|
|
600
697
|
let position; // the new element's child index once it is in
|
|
601
698
|
if (index === null || index === undefined) {
|
|
@@ -604,13 +701,113 @@ export function insertImage(html, slide, index, { src = '', alt = '' } = {}) {
|
|
|
604
701
|
position = k;
|
|
605
702
|
at = k > 0 ? ranges[k - 1].end : seg.indexOf('>') + 1;
|
|
606
703
|
} else {
|
|
607
|
-
const r = ranges[index];
|
|
608
|
-
if (!r) throw new Error(`slide ${slide}: no element at index ${index} (has ${ranges.length})`);
|
|
609
704
|
position = index + 1;
|
|
610
|
-
at =
|
|
705
|
+
at = ranges[index].end;
|
|
611
706
|
}
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
|
|
707
|
+
// a slide with no children to read it from: the section's own, plus two
|
|
708
|
+
const sectionIndent = /\n([ \t]*)$/.exec(parts[idx - 2] ?? '')?.[1];
|
|
709
|
+
const indent = indentOf(ranges[Math.max(0, position - 1)]) ?? indentOf(ranges[0])
|
|
710
|
+
?? (!ranges.length && sectionIndent !== undefined && seg.includes('\n') ? `${sectionIndent} ` : null);
|
|
711
|
+
const block = indentMarkup(markup, indent);
|
|
712
|
+
parts[idx] = seg.slice(0, at) + (indent === null ? block : `\n${indent}${block}`) + seg.slice(at);
|
|
615
713
|
return { html: parts.join(''), index: position };
|
|
616
714
|
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* A deck with `<img src alt>` inserted into slide `slide`, after top-level
|
|
718
|
+
* child `index`: `insertElement`, whose placement it keeps (`null` is after
|
|
719
|
+
* the last content child and before the asides).
|
|
720
|
+
*/
|
|
721
|
+
export function insertImage(html, slide, index, { src = '', alt = '' } = {}) {
|
|
722
|
+
return insertElement(html, slide, index, `<img src="${escapeHtml(src)}" alt="${escapeHtml(alt)}">`);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* The whitespace node `at` (an offset into `seg`) begins its line at, or null
|
|
727
|
+
* when something else stands before it on that line (a slide written on one
|
|
728
|
+
* line stays on one line).
|
|
729
|
+
*/
|
|
730
|
+
const lineIndent = (seg, at) => /\n([ \t]*)$/.exec(seg.slice(0, at))?.[1] ?? null;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Where the node at `path` below slide `slide`'s top-level child `index` is:
|
|
734
|
+
* the slide's parts, its segment, and the node's `[start, end)` in it. A path
|
|
735
|
+
* the file does not have throws.
|
|
736
|
+
*/
|
|
737
|
+
function nodeRange(html, slide, index, path = []) {
|
|
738
|
+
const { parts, idx } = locateSlide(html, slide);
|
|
739
|
+
const seg = parts[idx];
|
|
740
|
+
const ranges = sectionChildRanges(seg);
|
|
741
|
+
const top = ranges[index];
|
|
742
|
+
if (!top) throw new Error(`slide ${slide}: no element at index ${index} (has ${ranges.length})`);
|
|
743
|
+
let { start, end } = top;
|
|
744
|
+
for (const n of path) {
|
|
745
|
+
const kid = elementChildRanges(seg.slice(start, end))[n];
|
|
746
|
+
if (!kid) throw new Error(`slide ${slide} #${index}: no element at ${path.join('.')}`);
|
|
747
|
+
end = start + kid.end; start += kid.start;
|
|
748
|
+
}
|
|
749
|
+
return { parts, idx, seg, start, end };
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* A deck with `markup` (one element, written at zero indentation) put INSIDE
|
|
754
|
+
* the node at `path` below slide `slide`'s top-level child `index` (`[]`: the
|
|
755
|
+
* child itself), as its own child: after its element child `after`, first
|
|
756
|
+
* with `after === -1`, last with `after` null (or past its last child). The
|
|
757
|
+
* markup lands on its own line at its new siblings' indentation, or two
|
|
758
|
+
* spaces in from the node's own when it has none, the way `insertElement`
|
|
759
|
+
* writes onto a slide.
|
|
760
|
+
*
|
|
761
|
+
* Returns `{ html, path }`: where the new node is below `index`, since the
|
|
762
|
+
* element routes address a node inside one by that path.
|
|
763
|
+
*/
|
|
764
|
+
export function insertInElement(html, slide, index, { path = [], markup, after = null } = {}) {
|
|
765
|
+
const { parts, idx, seg, start, end } = nodeRange(String(html ?? ''), slide, index, path);
|
|
766
|
+
const kids = elementChildRanges(seg.slice(start, end)).map((k) => ({ start: start + k.start, end: start + k.end }));
|
|
767
|
+
let at; let position; let text;
|
|
768
|
+
if (!kids.length) {
|
|
769
|
+
const own = lineIndent(seg, start);
|
|
770
|
+
const indent = own === null ? null : `${own} `;
|
|
771
|
+
const close = seg.lastIndexOf('</', end - 1);
|
|
772
|
+
if (close <= start) throw new Error(`slide ${slide} #${index}: nothing can go inside a <${readTagName(seg, start + 1)}>`);
|
|
773
|
+
position = 0;
|
|
774
|
+
const block = indentMarkup(markup, indent);
|
|
775
|
+
// the close tag keeps a line of its own when it had one
|
|
776
|
+
const closeLine = /\n[ \t]*$/.exec(seg.slice(start, close));
|
|
777
|
+
if (indent === null) { at = close; text = block; }
|
|
778
|
+
else if (closeLine) { at = start + closeLine.index; text = `\n${indent}${block}`; }
|
|
779
|
+
else { at = close; text = `\n${indent}${block}\n${own}`; }
|
|
780
|
+
} else if (after === -1) {
|
|
781
|
+
const indent = lineIndent(seg, kids[0].start);
|
|
782
|
+
at = kids[0].start;
|
|
783
|
+
position = 0;
|
|
784
|
+
const block = indentMarkup(markup, indent);
|
|
785
|
+
text = indent === null ? block : `${block}\n${indent}`;
|
|
786
|
+
} else {
|
|
787
|
+
const k = Number.isInteger(after) && after >= 0 && after < kids.length ? after : kids.length - 1;
|
|
788
|
+
const indent = lineIndent(seg, kids[k].start);
|
|
789
|
+
at = kids[k].end;
|
|
790
|
+
position = k + 1;
|
|
791
|
+
const block = indentMarkup(markup, indent);
|
|
792
|
+
text = indent === null ? block : `\n${indent}${block}`;
|
|
793
|
+
}
|
|
794
|
+
parts[idx] = seg.slice(0, at) + text + seg.slice(at);
|
|
795
|
+
return { html: parts.join(''), path: [...path, position] };
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* A deck with slide `slide`'s top-level child `index` wrapped in a
|
|
800
|
+
* `<div class="column">`, its lines two spaces further in (a `<pre>`'s own
|
|
801
|
+
* lines kept as they are): what a column that is one bare block (a lone list,
|
|
802
|
+
* a picture) needs before anything can go in it beside that block. The class
|
|
803
|
+
* keeps the look the bare block had (COMPARISON_SLIDES): its blocks take the
|
|
804
|
+
* column's whole width, where a plain `<div>`'s are sized to their content.
|
|
805
|
+
*/
|
|
806
|
+
export function wrapInDiv(html, slide, index) {
|
|
807
|
+
const { parts, idx, seg, start, end } = nodeRange(String(html ?? ''), slide, index);
|
|
808
|
+
const own = lineIndent(seg, start);
|
|
809
|
+
const el = seg.slice(start, end);
|
|
810
|
+
const wrapped = own === null ? `<div class="column">${el}</div>` : `<div class="column">\n${own} ${indentMarkup(el, ' ')}\n${own}</div>`;
|
|
811
|
+
parts[idx] = seg.slice(0, start) + wrapped + seg.slice(end);
|
|
812
|
+
return parts.join('');
|
|
813
|
+
}
|
|
@@ -78,6 +78,20 @@ export const THEME_CONTRACT = [
|
|
|
78
78
|
'ansi-bright-blue', 'ansi-bright-magenta', 'ansi-bright-cyan', 'ansi-bright-white',
|
|
79
79
|
].map((t) => `--${t}`);
|
|
80
80
|
const CONTRACT = new Set(THEME_CONTRACT);
|
|
81
|
+
/**
|
|
82
|
+
* Tokens a theme MAY set and a design system may set too, per template, with
|
|
83
|
+
* no prefix and no exception: knobs the runtime reads rather than colours or
|
|
84
|
+
* type a theme answers for. `--code-max-size` is how large `data-fit="fill"`
|
|
85
|
+
* grows code (CODE_AND_MATH), which a template with a big code slot raises;
|
|
86
|
+
* `--code-callout-width` the gutter a line walk's callouts take beside it;
|
|
87
|
+
* `--figure-size` the size a figure's value is set at (DECK_ANATOMY), which a
|
|
88
|
+
* template built round one large number raises; `--steps-top`,
|
|
89
|
+
* `--steps-bottom`, `--steps-inset`, `--steps-align` and `--steps-size`
|
|
90
|
+
* where a run's strip sits and how large it is (DECK_ANATOMY), which a design
|
|
91
|
+
* system places.
|
|
92
|
+
*/
|
|
93
|
+
export const OPEN_TOKENS = ['--code-max-size', '--code-callout-width', '--figure-size', '--steps-top', '--steps-bottom', '--steps-inset', '--steps-align', '--steps-size'];
|
|
94
|
+
const OPEN = new Set(OPEN_TOKENS);
|
|
81
95
|
|
|
82
96
|
const lineAt = (text, index) => text.slice(0, index).split('\n').length;
|
|
83
97
|
const ext = (path) => (/\.([A-Za-z0-9]+)$/.exec(path)?.[1] ?? '').toLowerCase();
|
|
@@ -263,7 +277,7 @@ function styleProblems(css, { file, prefix, files }) {
|
|
|
263
277
|
if (!excepted.has(t.name)) {
|
|
264
278
|
push(t.line, 'contract-token', `${t.name} is a theme-contract token — a design system sits beside any theme; set it only with a /* ds-exception: ${t.name} <reason> */ comment`);
|
|
265
279
|
}
|
|
266
|
-
} else if (prefix && !t.name.startsWith(prefix)) {
|
|
280
|
+
} else if (prefix && !t.name.startsWith(prefix) && !OPEN.has(t.name)) {
|
|
267
281
|
push(t.line, 'unprefixed-token', `${t.name} does not start with this package's tokenPrefix ${prefix}`);
|
|
268
282
|
}
|
|
269
283
|
}
|