@pep/term-deck 1.0.28 → 1.0.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 +261 -195
- package/dist/bin/term-deck.js +47 -28
- package/dist/bin/term-deck.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/term-deck.js
CHANGED
|
@@ -3,7 +3,7 @@ import { join } from 'path';
|
|
|
3
3
|
import { pathToFileURL } from 'url';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import matter from 'gray-matter';
|
|
6
|
-
import { mkdir, writeFile,
|
|
6
|
+
import { mkdir, writeFile, access, rm, readFile, unlink } from 'fs/promises';
|
|
7
7
|
import fg from 'fast-glob';
|
|
8
8
|
import blessed from 'neo-blessed';
|
|
9
9
|
import gradient2 from 'gradient-string';
|
|
@@ -11,6 +11,7 @@ import 'yaml';
|
|
|
11
11
|
import 'deepmerge';
|
|
12
12
|
import { mermaidToAscii as mermaidToAscii$1 } from 'mermaid-ascii';
|
|
13
13
|
import figlet from 'figlet';
|
|
14
|
+
import { createReadStream, createWriteStream } from 'fs';
|
|
14
15
|
import { Command } from 'commander';
|
|
15
16
|
import { intro, log, outro, spinner } from '@clack/prompts';
|
|
16
17
|
import { tmpdir } from 'os';
|
|
@@ -1047,35 +1048,42 @@ var init_screen = __esm({
|
|
|
1047
1048
|
init_text_generator();
|
|
1048
1049
|
}
|
|
1049
1050
|
});
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
"/dev/ttys001",
|
|
1053
|
-
"/dev/ttys002",
|
|
1054
|
-
"/dev/ttys003",
|
|
1055
|
-
"/dev/pts/1",
|
|
1056
|
-
"/dev/pts/2"
|
|
1057
|
-
];
|
|
1058
|
-
for (const tty of candidates) {
|
|
1059
|
-
try {
|
|
1060
|
-
await access(tty);
|
|
1061
|
-
return tty;
|
|
1062
|
-
} catch {
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
throw new Error(
|
|
1066
|
-
"Could not find available TTY for notes window. Open a second terminal, run `tty`, and pass the path with --notes-tty"
|
|
1067
|
-
);
|
|
1051
|
+
function getMissingTtyError() {
|
|
1052
|
+
return "The --notes flag requires --notes-tty to specify which terminal to use.\n\nHow to use presenter notes:\n 1. Open a second terminal window\n 2. In that terminal, run: tty\n 3. Copy the path shown (e.g., /dev/ttys001)\n 4. Run: term-deck present . --notes --notes-tty /dev/ttys001\n\nThe notes will appear in the second terminal while you present in the first.";
|
|
1068
1053
|
}
|
|
1069
1054
|
async function createNotesWindow(ttyPath) {
|
|
1055
|
+
if (!ttyPath) {
|
|
1056
|
+
throw new Error(getMissingTtyError());
|
|
1057
|
+
}
|
|
1070
1058
|
const blessed5 = (await import('neo-blessed')).default;
|
|
1071
|
-
|
|
1072
|
-
|
|
1059
|
+
try {
|
|
1060
|
+
await access(ttyPath);
|
|
1061
|
+
} catch {
|
|
1062
|
+
throw new Error(`TTY not found: ${ttyPath}
|
|
1063
|
+
|
|
1064
|
+
Make sure the path is correct and the terminal is open.`);
|
|
1065
|
+
}
|
|
1066
|
+
const input = createReadStream(ttyPath);
|
|
1067
|
+
const output = createWriteStream(ttyPath);
|
|
1068
|
+
await new Promise((resolve, reject) => {
|
|
1069
|
+
let ready = 0;
|
|
1070
|
+
const checkReady = () => {
|
|
1071
|
+
ready++;
|
|
1072
|
+
if (ready === 2) resolve();
|
|
1073
|
+
};
|
|
1074
|
+
input.once("open", checkReady);
|
|
1075
|
+
output.once("open", checkReady);
|
|
1076
|
+
input.once("error", reject);
|
|
1077
|
+
output.once("error", reject);
|
|
1078
|
+
});
|
|
1073
1079
|
const screen = blessed5.screen({
|
|
1074
1080
|
smartCSR: true,
|
|
1075
1081
|
title: "term-deck notes",
|
|
1076
1082
|
fullUnicode: true,
|
|
1077
|
-
input
|
|
1078
|
-
output
|
|
1083
|
+
input,
|
|
1084
|
+
output,
|
|
1085
|
+
terminal: "xterm-256color",
|
|
1086
|
+
forceUnicode: true
|
|
1079
1087
|
});
|
|
1080
1088
|
const contentBox = blessed5.box({
|
|
1081
1089
|
top: 0,
|
|
@@ -1094,7 +1102,7 @@ async function createNotesWindow(ttyPath) {
|
|
|
1094
1102
|
return {
|
|
1095
1103
|
screen,
|
|
1096
1104
|
contentBox,
|
|
1097
|
-
tty
|
|
1105
|
+
tty: ttyPath
|
|
1098
1106
|
};
|
|
1099
1107
|
}
|
|
1100
1108
|
function updateNotesWindow(notesWindow, currentSlide, nextSlide2, currentIndex, totalSlides) {
|
|
@@ -1131,7 +1139,12 @@ function toggleNotesVisibility(notesWindow) {
|
|
|
1131
1139
|
screen.render();
|
|
1132
1140
|
}
|
|
1133
1141
|
function destroyNotesWindow(notesWindow) {
|
|
1134
|
-
|
|
1142
|
+
try {
|
|
1143
|
+
if (notesWindow.screen && notesWindow.screen.program) {
|
|
1144
|
+
notesWindow.screen.destroy();
|
|
1145
|
+
}
|
|
1146
|
+
} catch {
|
|
1147
|
+
}
|
|
1135
1148
|
}
|
|
1136
1149
|
var init_notes_window = __esm({
|
|
1137
1150
|
"src/presenter/notes-window.ts"() {
|
|
@@ -1326,7 +1339,12 @@ async function present(slidesDir, options = {}) {
|
|
|
1326
1339
|
progressBar: null
|
|
1327
1340
|
};
|
|
1328
1341
|
if (options.showNotes) {
|
|
1329
|
-
|
|
1342
|
+
try {
|
|
1343
|
+
presenter.notesWindow = await createNotesWindow(options.notesTty);
|
|
1344
|
+
} catch (error) {
|
|
1345
|
+
destroyRenderer(renderer);
|
|
1346
|
+
throw error;
|
|
1347
|
+
}
|
|
1330
1348
|
}
|
|
1331
1349
|
if (deck.config.settings?.showProgress) {
|
|
1332
1350
|
presenter.progressBar = createProgressBar(presenter);
|
|
@@ -1399,7 +1417,7 @@ var init_main = __esm({
|
|
|
1399
1417
|
init_esm_shims();
|
|
1400
1418
|
|
|
1401
1419
|
// package.json
|
|
1402
|
-
var version = "1.0.
|
|
1420
|
+
var version = "1.0.30";
|
|
1403
1421
|
|
|
1404
1422
|
// src/cli/commands/present.ts
|
|
1405
1423
|
init_esm_shims();
|
|
@@ -1970,7 +1988,8 @@ function showHelp() {
|
|
|
1970
1988
|
console.log("");
|
|
1971
1989
|
console.log(pc.green(" present") + pc.dim(" <dir> ") + pc.white("Start a presentation"));
|
|
1972
1990
|
console.log(pc.dim(" -s, --start <n> ") + pc.white("Start at slide number"));
|
|
1973
|
-
console.log(pc.dim(" -n, --notes ") + pc.white("Show presenter notes"));
|
|
1991
|
+
console.log(pc.dim(" -n, --notes ") + pc.white("Show presenter notes (requires --notes-tty)"));
|
|
1992
|
+
console.log(pc.dim(" --notes-tty <path> ") + pc.white("TTY for notes (e.g., /dev/ttys001)"));
|
|
1974
1993
|
console.log(pc.dim(" -l, --loop ") + pc.white("Loop back after last slide"));
|
|
1975
1994
|
console.log("");
|
|
1976
1995
|
console.log(pc.green(" export") + pc.dim(" <dir> ") + pc.white("Export to GIF or MP4"));
|