@promovaweb/ebookfy 0.2.0 → 0.3.1
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 +6 -2
- package/dist/bin/main.js +367 -165
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -28,7 +28,11 @@ ebookfy build
|
|
|
28
28
|
|
|
29
29
|
Edite `ebook.toml` na raiz para definir autoria, capa, ordem dos capítulos, pasta de saída e formatos. Cada capítulo tem seu próprio `CHAPTER.md` e pode guardar figuras na pasta `imagens/` ao lado do texto. O CLI imprime os caminhos dos arquivos gerados.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Na aba **Livro**, escolha uma opção com as setas e abra com Enter ou com um clique. Use `f` para a ficha, `c` para capítulos, `a` para os arquivos gerados e `g` para o guia.
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
No repositório do framework, o [livro de exemplo](ebook.toml) é **Meu primeiro ebook**. Abra o [primeiro capítulo](capitulos/01-primeiro-capitulo/CHAPTER.md), edite um parágrafo e execute `ebookfy build` na raiz para ler sua edição.
|
|
32
36
|
|
|
33
37
|
## Skills e documentação
|
|
34
38
|
|
|
@@ -38,7 +42,7 @@ O starter kit já traz as skills numeradas. Para instalá-las em outro projeto,
|
|
|
38
42
|
npx skills add promovaweb/ebookfy -a universal -a claude-code -a codex -a opencode -y
|
|
39
43
|
```
|
|
40
44
|
|
|
41
|
-
Consulte o [manual editável](manual/01-primeira-edicao/CHAPTER.md), a [documentação completa](docs/README.md) ou baixe o [PDF](ebook/manual-ebookfy-v0.
|
|
45
|
+
Consulte o [manual editável](manual/01-primeira-edicao/CHAPTER.md), a [documentação completa](docs/README.md) ou baixe o [PDF](manual/ebook/manual-ebookfy-v0.3.1.pdf), o [EPUB](manual/ebook/manual-ebookfy-v0.3.1.epub) e o [MOBI](manual/ebook/manual-ebookfy-v0.3.1.mobi). Em automações, use `ebookfy info --json`. A referência embutida está disponível com `ebookfy --skill`.
|
|
42
46
|
|
|
43
47
|
## Feito com
|
|
44
48
|
|
package/dist/bin/main.js
CHANGED
|
@@ -99,7 +99,7 @@ var package_default;
|
|
|
99
99
|
var init_package = __esm(() => {
|
|
100
100
|
package_default = {
|
|
101
101
|
name: "@promovaweb/ebookfy",
|
|
102
|
-
version: "0.
|
|
102
|
+
version: "0.3.1",
|
|
103
103
|
description: "Organize cap\xEDtulos e exporte seu ebook em PDF, EPUB e MOBI.",
|
|
104
104
|
type: "module",
|
|
105
105
|
private: false,
|
|
@@ -120,7 +120,7 @@ var init_package = __esm(() => {
|
|
|
120
120
|
start: "bun src/main.ts",
|
|
121
121
|
typecheck: "tsc --noEmit",
|
|
122
122
|
test: "node --test tests/*.test.mjs",
|
|
123
|
-
manual: "bun src/main.ts build",
|
|
123
|
+
manual: "cd manual && bun ../src/main.ts build",
|
|
124
124
|
build: "bun build ./src/main.ts --target=bun --packages=external --outdir dist/bin",
|
|
125
125
|
prepack: "npm run build"
|
|
126
126
|
},
|
|
@@ -155,11 +155,11 @@ var init_package = __esm(() => {
|
|
|
155
155
|
"@oven/bun-darwin-aarch64": "1.4.4",
|
|
156
156
|
"@oven/bun-darwin-x64": "1.4.4",
|
|
157
157
|
"@oven/bun-linux-aarch64": "1.4.4",
|
|
158
|
-
"@oven/bun-linux-x64": "1.4.4",
|
|
159
158
|
"@oven/bun-linux-aarch64-musl": "1.4.4",
|
|
159
|
+
"@oven/bun-linux-x64": "1.4.4",
|
|
160
160
|
"@oven/bun-linux-x64-musl": "1.4.4",
|
|
161
|
-
"@oven/bun-windows-
|
|
162
|
-
"@oven/bun-windows-
|
|
161
|
+
"@oven/bun-windows-aarch64": "1.4.4",
|
|
162
|
+
"@oven/bun-windows-x64": "1.4.4"
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
165
|
});
|
|
@@ -801,7 +801,7 @@ Para consultar o guia editorial no pr\xF3prio terminal, execute \`ebookfy --skil
|
|
|
801
801
|
|
|
802
802
|
## Ler o manual completo
|
|
803
803
|
|
|
804
|
-
O manual re\xFAne os doze guias na ordem configurada no TOML do
|
|
804
|
+
O manual re\xFAne os doze guias na ordem configurada no [TOML do manual](../manual/ebook.toml). Escolha [PDF](../manual/ebook/manual-ebookfy-v0.3.1.pdf) para p\xE1ginas fixas, [EPUB](../manual/ebook/manual-ebookfy-v0.3.1.epub) para ajustar a fonte no leitor ou [MOBI](../manual/ebook/manual-ebookfy-v0.3.1.mobi) para leitores compat\xEDveis.
|
|
805
805
|
`;
|
|
806
806
|
var init_README = () => {};
|
|
807
807
|
|
|
@@ -810,38 +810,7 @@ var CHAPTER_default7 = "# Consultar os comandos e a sa\xEDda JSON\n\n## Conven\x
|
|
|
810
810
|
var init_CHAPTER7 = () => {};
|
|
811
811
|
|
|
812
812
|
// manual/07-terminal/CHAPTER.md
|
|
813
|
-
var CHAPTER_default8 =
|
|
814
|
-
|
|
815
|
-
Abra um terminal na pasta do livro ou dentro de um cap\xEDtulo e execute \`ebookfy\`. Para abrir diretamente a ficha quando sua prefer\xEAncia inicial aponta para outra aba, use \`ebookfy tui --tab overview\`. O aplicativo l\xEA o TOML do projeto e os t\xEDtulos dos arquivos de cap\xEDtulo.
|
|
816
|
-
|
|
817
|
-

|
|
818
|
-
|
|
819
|
-
Na captura, a aba **Livro** est\xE1 selecionada. A primeira linha do terminal identifica o aplicativo e seu runtime. Dentro do quadro, **Edi\xE7\xE3o** pertence ao livro. A lista numerada reproduz a ordem declarada em \`[[chapters]]\`, e o rodap\xE9 informa a quantidade de cap\xEDtulos carregados.
|
|
820
|
-
|
|
821
|
-
## Conferir uma altera\xE7\xE3o durante a escrita
|
|
822
|
-
|
|
823
|
-
Mantenha a TUI aberta e edite o t\xEDtulo de um cap\xEDtulo em outro terminal ou no editor. Salve o arquivo, volte \xE0 aba Livro e pressione \`r\`. Confira o novo t\xEDtulo na mesma posi\xE7\xE3o da lista. Depois, mova a tabela desse cap\xEDtulo no TOML e salve. A aba acompanha mudan\xE7as na configura\xE7\xE3o e permite conferir a nova ordem antes de compilar.
|
|
824
|
-
|
|
825
|
-
| A\xE7\xE3o | Atalho |
|
|
826
|
-
| --- | --- |
|
|
827
|
-
| Abrir Livro, Prefer\xEAncias, Credenciais, Docs ou Sobre | Teclas de \`1\` a \`5\`, conforme a barra superior |
|
|
828
|
-
| Avan\xE7ar ou voltar uma aba | Setas direita e esquerda ou \`]\` e \`[\` |
|
|
829
|
-
| Alternar o foco entre pain\xE9is | \`Tab\` e \`Shift+Tab\` |
|
|
830
|
-
| Abrir a lista de comandos da interface | \`Ctrl+K\` ou \`:\` |
|
|
831
|
-
| Ver a ajuda de teclado e mouse | \`?\` |
|
|
832
|
-
| Fechar um di\xE1logo | \`Esc\` |
|
|
833
|
-
| Sair da TUI | \`q\` na tela principal |
|
|
834
|
-
|
|
835
|
-
## Consultar o manual sem sair do terminal
|
|
836
|
-
|
|
837
|
-
Pressione \`4\` para abrir **Docs** ou execute \`ebookfy tui --tab docs\` diretamente no terminal. Use \`t\` para escolher um t\xF3pico. As setas para cima e para baixo percorrem o texto. \`PageUp\` e \`PageDown\` percorrem trechos maiores. Consulte o t\xF3pico de configura\xE7\xE3o para ajustar prefer\xEAncias pessoais ou a refer\xEAncia de comandos para conferir argumentos e op\xE7\xF5es.
|
|
838
|
-
|
|
839
|
-

|
|
840
|
-
|
|
841
|
-
Em um script, use \`ebookfy info --json\` para ler a ficha sem abrir a TUI. A op\xE7\xE3o \xE9 apropriada para uma etapa de integra\xE7\xE3o cont\xEDnua que precisa extrair a lista de cap\xEDtulos ou os formatos antes do build.
|
|
842
|
-
|
|
843
|
-
O t\xF3pico \`ebook\` re\xFAne os guias de instala\xE7\xE3o, configura\xE7\xE3o, cap\xEDtulos, migra\xE7\xE3o, exporta\xE7\xE3o e skills editoriais. Ele acompanha o aplicativo instalado. Voc\xEA pode consult\xE1-lo mesmo que apenas o manuscrito e o CLI estejam dispon\xEDveis na m\xE1quina.
|
|
844
|
-
`;
|
|
813
|
+
var CHAPTER_default8 = "# Usar a interface de terminal\n\nAbra um terminal na pasta do livro ou dentro de um cap\xEDtulo e execute `ebookfy`. Para abrir diretamente o menu do livro quando sua prefer\xEAncia inicial aponta para outra aba, use `ebookfy tui --tab overview`. O aplicativo l\xEA o TOML do projeto e os t\xEDtulos dos arquivos de cap\xEDtulo.\n\n\n\nUse as setas para cima e para baixo para escolher uma op\xE7\xE3o. O marcador `>` indica a sele\xE7\xE3o. Pressione Enter ou clique no nome para abrir. Em terminais com 80 colunas ou mais, o sum\xE1rio aparece ao lado do menu. Em uma janela mais estreita, abra **Cap\xEDtulos** para consultar a mesma lista.\n\n| Op\xE7\xE3o | Tecla | O que voc\xEA encontra |\n| --- | --- | --- |\n| Ficha editorial | `f` | Autoria, editora, edi\xE7\xE3o, data, idioma, identificador e descri\xE7\xE3o do livro aberto. |\n| Cap\xEDtulos | `c` | T\xEDtulos na ordem de `[[chapters]]` e caminho de cada arquivo Markdown para edi\xE7\xE3o. |\n| Arquivos de sa\xEDda | `a` | Formatos da edi\xE7\xE3o e caminho de cada arquivo. **A gerar** indica que o arquivo ainda falta. **Dispon\xEDvel** indica que ele existe na pasta configurada. |\n| Guia do Ebookfy | `g` | Documenta\xE7\xE3o embutida e \xEDndice de assuntos na aba Docs. |\n\nNas tr\xEAs consultas do livro, pressione Esc para voltar ao menu. Para verificar uma exporta\xE7\xE3o, pressione `a`, execute `ebookfy build` em outro terminal e pressione `r`. Um arquivo dispon\xEDvel pode pertencer a uma compila\xE7\xE3o anterior. Gere a edi\xE7\xE3o novamente depois de editar o manuscrito.\n\n## Conferir uma altera\xE7\xE3o durante a escrita\n\nMantenha a TUI aberta e edite o t\xEDtulo de um cap\xEDtulo em outro terminal ou no editor. Salve o arquivo, volte \xE0 aba Livro e pressione `r`. Confira o novo t\xEDtulo na mesma posi\xE7\xE3o da lista. Depois, mova a tabela desse cap\xEDtulo no TOML e salve. A aba acompanha mudan\xE7as na configura\xE7\xE3o e permite conferir a nova ordem antes de compilar.\n\n| A\xE7\xE3o | Atalho |\n| --- | --- |\n| Abrir Livro, Prefer\xEAncias, Credenciais, Docs ou Sobre | Teclas de `1` a `5`, conforme a barra superior |\n| Avan\xE7ar ou voltar uma aba | Setas direita e esquerda ou `]` e `[` |\n| Alternar o foco entre pain\xE9is | `Tab` e `Shift+Tab` |\n| Abrir a lista de comandos da interface | `Ctrl+K` ou `:` |\n| Ver a ajuda de teclado e mouse | `?` |\n| Fechar um di\xE1logo | `Esc` |\n| Sair da TUI | `q` na tela principal |\n\n## Consultar o manual sem sair do terminal\n\nPressione `4` para abrir **Docs** ou execute `ebookfy tui --tab docs` diretamente no terminal. Use `t` para escolher um t\xF3pico. As setas para cima e para baixo percorrem o texto. `PageUp` e `PageDown` percorrem trechos maiores. Consulte o t\xF3pico de configura\xE7\xE3o para ajustar prefer\xEAncias pessoais ou a refer\xEAncia de comandos para conferir argumentos e op\xE7\xF5es.\n\n\n\nEm um script, use `ebookfy info --json` para ler a ficha sem abrir a TUI. A op\xE7\xE3o \xE9 apropriada para uma etapa de integra\xE7\xE3o cont\xEDnua que precisa extrair a lista de cap\xEDtulos ou os formatos antes do build.\n\nO t\xF3pico `ebook` re\xFAne os guias de instala\xE7\xE3o, configura\xE7\xE3o, cap\xEDtulos, migra\xE7\xE3o, exporta\xE7\xE3o e skills editoriais. Ele acompanha o aplicativo instalado. Voc\xEA pode consult\xE1-lo mesmo que apenas o manuscrito e o CLI estejam dispon\xEDveis na m\xE1quina.\n";
|
|
845
814
|
var init_CHAPTER8 = () => {};
|
|
846
815
|
|
|
847
816
|
// manual/09-agentes/CHAPTER.md
|
|
@@ -2490,6 +2459,8 @@ function terminalTheme(colors) {
|
|
|
2490
2459
|
error: ref(slots.error),
|
|
2491
2460
|
barBackground: RGBA.defaultBackground(),
|
|
2492
2461
|
barText: ref(slots.textDim),
|
|
2462
|
+
headerBackground: ref(slots.accent),
|
|
2463
|
+
headerText: ref(slots.keyText),
|
|
2493
2464
|
keyBackground: ref(slots.accent),
|
|
2494
2465
|
keyText: ref(slots.keyText)
|
|
2495
2466
|
};
|
|
@@ -2550,23 +2521,25 @@ var init_theme = __esm(() => {
|
|
|
2550
2521
|
themes = {
|
|
2551
2522
|
night: {
|
|
2552
2523
|
name: "night",
|
|
2553
|
-
background: "#
|
|
2554
|
-
surface: "#
|
|
2555
|
-
surfaceHigh: "#
|
|
2556
|
-
border: "#
|
|
2557
|
-
borderActive: "#
|
|
2558
|
-
text: "#
|
|
2559
|
-
textDim: "#
|
|
2560
|
-
textStrong: "#
|
|
2561
|
-
accent: "#
|
|
2562
|
-
accentSecondary: "#
|
|
2524
|
+
background: "#000A0E",
|
|
2525
|
+
surface: "#001117",
|
|
2526
|
+
surfaceHigh: "#03212A",
|
|
2527
|
+
border: "#5F7D8C",
|
|
2528
|
+
borderActive: "#5EEDE1",
|
|
2529
|
+
text: "#F2F8F9",
|
|
2530
|
+
textDim: "#B2C6CE",
|
|
2531
|
+
textStrong: "#F2F8F9",
|
|
2532
|
+
accent: "#5EEDE1",
|
|
2533
|
+
accentSecondary: "#C4B5FD",
|
|
2563
2534
|
ok: "#9ece6a",
|
|
2564
|
-
warn: "#
|
|
2535
|
+
warn: "#FCD34D",
|
|
2565
2536
|
error: "#f7768e",
|
|
2566
|
-
barBackground: "#
|
|
2567
|
-
barText: "#
|
|
2568
|
-
|
|
2569
|
-
|
|
2537
|
+
barBackground: "#001117",
|
|
2538
|
+
barText: "#B2C6CE",
|
|
2539
|
+
headerBackground: "#6D28D9",
|
|
2540
|
+
headerText: "#FFFFFF",
|
|
2541
|
+
keyBackground: "#5EEDE1",
|
|
2542
|
+
keyText: "#001117"
|
|
2570
2543
|
},
|
|
2571
2544
|
day: {
|
|
2572
2545
|
name: "day",
|
|
@@ -2576,16 +2549,18 @@ var init_theme = __esm(() => {
|
|
|
2576
2549
|
border: "#a8aecb",
|
|
2577
2550
|
borderActive: "#2e7de9",
|
|
2578
2551
|
text: "#3760bf",
|
|
2579
|
-
textDim: "#
|
|
2552
|
+
textDim: "#46506A",
|
|
2580
2553
|
textStrong: "#1b2a5e",
|
|
2581
2554
|
accent: "#2e7de9",
|
|
2582
|
-
accentSecondary: "#
|
|
2583
|
-
ok: "#
|
|
2584
|
-
warn: "#
|
|
2555
|
+
accentSecondary: "#64349A",
|
|
2556
|
+
ok: "#365918",
|
|
2557
|
+
warn: "#734C13",
|
|
2585
2558
|
error: "#f52a65",
|
|
2586
2559
|
barBackground: "#c4c8da",
|
|
2587
2560
|
barText: "#3760bf",
|
|
2588
|
-
|
|
2561
|
+
headerBackground: "#512A88",
|
|
2562
|
+
headerText: "#FFFFFF",
|
|
2563
|
+
keyBackground: "#234CAB",
|
|
2589
2564
|
keyText: "#ffffff"
|
|
2590
2565
|
}
|
|
2591
2566
|
};
|
|
@@ -2951,8 +2926,8 @@ class Overlays {
|
|
|
2951
2926
|
resolve(value);
|
|
2952
2927
|
};
|
|
2953
2928
|
const paint = this.buttons(body, [
|
|
2954
|
-
{ key: "y", label: options.confirmLabel ?? "
|
|
2955
|
-
{ key: "Esc", label: "
|
|
2929
|
+
{ key: "y", label: options.confirmLabel ?? "Confirmar", danger: options.danger, run: () => answer(true) },
|
|
2930
|
+
{ key: "Esc", label: "Cancelar", run: () => answer(false) }
|
|
2956
2931
|
], () => focus);
|
|
2957
2932
|
return {
|
|
2958
2933
|
onKey: (key) => {
|
|
@@ -3012,7 +2987,7 @@ class Overlays {
|
|
|
3012
2987
|
close();
|
|
3013
2988
|
resolve(undefined);
|
|
3014
2989
|
};
|
|
3015
|
-
this.buttons(body, [{ key: "Enter", label: "OK", run: submit }, { key: "Esc", label: "
|
|
2990
|
+
this.buttons(body, [{ key: "Enter", label: "OK", run: submit }, { key: "Esc", label: "Cancelar", run: cancel }], () => 0);
|
|
3016
2991
|
render();
|
|
3017
2992
|
return {
|
|
3018
2993
|
onKey: (key) => {
|
|
@@ -3167,7 +3142,7 @@ class Overlays {
|
|
|
3167
3142
|
list.setItems(options.items.map((text) => ({ text })));
|
|
3168
3143
|
for (let i = 0;i < (options.initial ?? 0); i++)
|
|
3169
3144
|
list.key({ name: "down" }, false);
|
|
3170
|
-
body.add(new TextRenderable(this.renderer, { content: "\u2191\u2193
|
|
3145
|
+
body.add(new TextRenderable(this.renderer, { content: "\u2191\u2193 escolher \xB7 Enter abrir \xB7 Esc voltar", fg: this.theme.textDim, wrapMode: "none", selectable: false }));
|
|
3171
3146
|
return {
|
|
3172
3147
|
onKey: (key) => {
|
|
3173
3148
|
if (key.name === "escape") {
|
|
@@ -3211,7 +3186,7 @@ class Overlays {
|
|
|
3211
3186
|
field.content = `${this.icons.select || ">"} ${query}\u258F`;
|
|
3212
3187
|
filtered = entries.filter((entry) => matches(query, entry.label));
|
|
3213
3188
|
list.setItems(filtered.map((entry) => ({ text: withIcon(this.icons, entry.icon ?? "select", entry.label), hint: entry.hint })));
|
|
3214
|
-
empty.content = filtered.length ? `${filtered.length}
|
|
3189
|
+
empty.content = filtered.length ? `${filtered.length} comando(s) \xB7 Enter executar \xB7 Esc voltar` : "Nenhum comando encontrado";
|
|
3215
3190
|
};
|
|
3216
3191
|
update();
|
|
3217
3192
|
return {
|
|
@@ -3989,57 +3964,281 @@ var init_about2 = __esm(() => {
|
|
|
3989
3964
|
});
|
|
3990
3965
|
|
|
3991
3966
|
// src/tui/screens/overview.ts
|
|
3992
|
-
import {
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3967
|
+
import { statSync as statSync4 } from "fs";
|
|
3968
|
+
import { join as join6, resolve as resolve3 } from "path";
|
|
3969
|
+
import { BoxRenderable as BoxRenderable4, TextAttributes as TextAttributes3, TextRenderable as TextRenderable4 } from "@opentui/core";
|
|
3970
|
+
function sumario(ctx, livro, caminhos) {
|
|
3971
|
+
const lista = scrollPanel(ctx.renderer, ctx.theme, {
|
|
3972
|
+
title: caminhos ? "Cap\xEDtulos e fontes" : "Sum\xE1rio",
|
|
3973
|
+
flexGrow: 1
|
|
3974
|
+
});
|
|
3975
|
+
for (const [i, capitulo] of livro.chapters.entries()) {
|
|
3976
|
+
const linha = new BoxRenderable4(ctx.renderer, {
|
|
3977
|
+
flexDirection: "row",
|
|
3978
|
+
flexShrink: 0,
|
|
3979
|
+
gap: 1
|
|
3980
|
+
});
|
|
3981
|
+
linha.add(new TextRenderable4(ctx.renderer, {
|
|
3982
|
+
content: String(i + 1).padStart(2, "0"),
|
|
3983
|
+
fg: ctx.theme.accentSecondary,
|
|
3984
|
+
flexShrink: 0
|
|
3985
|
+
}));
|
|
3986
|
+
linha.add(new TextRenderable4(ctx.renderer, {
|
|
3987
|
+
content: capitulo.title,
|
|
3988
|
+
fg: ctx.theme.text,
|
|
3989
|
+
flexShrink: 1,
|
|
3990
|
+
minWidth: 0
|
|
3991
|
+
}));
|
|
3992
|
+
lista.add(linha);
|
|
3993
|
+
if (caminhos)
|
|
3994
|
+
lista.add(dim(ctx.renderer, ctx.theme, capitulo.file));
|
|
3995
|
+
}
|
|
3996
|
+
return lista;
|
|
3997
|
+
}
|
|
3998
|
+
function criarTelaLivro() {
|
|
3999
|
+
let selecionado = 0;
|
|
4000
|
+
let detalhe = false;
|
|
4001
|
+
let pintar;
|
|
4002
|
+
let temLivro = false;
|
|
4003
|
+
let rolagem;
|
|
4004
|
+
function abrir(ctx, i) {
|
|
4005
|
+
if (i === 3) {
|
|
4006
|
+
ctx.goTo("docs");
|
|
4007
|
+
return;
|
|
4008
|
+
}
|
|
4009
|
+
if (!temLivro)
|
|
4010
|
+
return;
|
|
4011
|
+
selecionado = i;
|
|
4012
|
+
detalhe = true;
|
|
4013
|
+
ctx.refresh();
|
|
4014
|
+
}
|
|
4015
|
+
function voltar(ctx) {
|
|
4016
|
+
detalhe = false;
|
|
4017
|
+
ctx.refresh();
|
|
4018
|
+
}
|
|
4019
|
+
return {
|
|
3998
4020
|
id: "overview",
|
|
3999
4021
|
title: "Livro",
|
|
4000
4022
|
icon: "overview",
|
|
4001
|
-
description: "
|
|
4023
|
+
description: "Menu do livro, cap\xEDtulos e arquivos da edi\xE7\xE3o",
|
|
4002
4024
|
watch: () => [resolve3(localizarLivro() ?? process.cwd(), "ebook.toml")],
|
|
4003
4025
|
actions: [
|
|
4004
4026
|
{
|
|
4005
4027
|
keys: ["r"],
|
|
4006
|
-
description: "
|
|
4028
|
+
description: "atualizar",
|
|
4007
4029
|
icon: "refresh",
|
|
4008
4030
|
run: (ctx) => ctx.refresh()
|
|
4009
4031
|
}
|
|
4010
4032
|
],
|
|
4033
|
+
onKey(tecla, ctx) {
|
|
4034
|
+
if (detalhe && (tecla === "escape" || tecla === "backspace")) {
|
|
4035
|
+
voltar(ctx);
|
|
4036
|
+
return true;
|
|
4037
|
+
}
|
|
4038
|
+
const indice = opcoes.findIndex((op) => op.atalho === tecla);
|
|
4039
|
+
if (indice >= 0 && (temLivro || indice === 3)) {
|
|
4040
|
+
abrir(ctx, indice);
|
|
4041
|
+
return true;
|
|
4042
|
+
}
|
|
4043
|
+
if (!temLivro)
|
|
4044
|
+
return false;
|
|
4045
|
+
if (tecla === "up" || tecla === "down") {
|
|
4046
|
+
const delta = tecla === "down" ? 1 : -1;
|
|
4047
|
+
if (detalhe)
|
|
4048
|
+
rolagem?.scrollBy(delta);
|
|
4049
|
+
else {
|
|
4050
|
+
selecionado = (selecionado + delta + opcoes.length) % opcoes.length;
|
|
4051
|
+
pintar?.();
|
|
4052
|
+
}
|
|
4053
|
+
return true;
|
|
4054
|
+
}
|
|
4055
|
+
if (!detalhe && (tecla === "return" || tecla === "space")) {
|
|
4056
|
+
abrir(ctx, selecionado);
|
|
4057
|
+
return true;
|
|
4058
|
+
}
|
|
4059
|
+
return false;
|
|
4060
|
+
},
|
|
4011
4061
|
mount(ctx) {
|
|
4012
|
-
const
|
|
4013
|
-
|
|
4062
|
+
const { renderer, theme } = ctx;
|
|
4063
|
+
const raiz = new BoxRenderable4(renderer, {
|
|
4064
|
+
flexDirection: "column",
|
|
4014
4065
|
flexGrow: 1,
|
|
4015
|
-
|
|
4066
|
+
minHeight: 0,
|
|
4067
|
+
gap: ctx.space.gapY
|
|
4016
4068
|
});
|
|
4069
|
+
pintar = undefined;
|
|
4070
|
+
rolagem = undefined;
|
|
4071
|
+
let livro;
|
|
4017
4072
|
try {
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
["T\xEDtulo", livro.title],
|
|
4021
|
-
["Autoria", livro.authors.join(", ")],
|
|
4022
|
-
["Editora", livro.publisher],
|
|
4023
|
-
["Edi\xE7\xE3o", livro.version],
|
|
4024
|
-
["Idioma", livro.language],
|
|
4025
|
-
["Formatos", livro.output.formats.join(", ")],
|
|
4026
|
-
...livro.chapters.map((c, i) => [
|
|
4027
|
-
String(i + 1),
|
|
4028
|
-
c.title
|
|
4029
|
-
])
|
|
4030
|
-
]));
|
|
4031
|
-
ctx.status(livro.chapters.length + " cap\xEDtulos");
|
|
4073
|
+
livro = resumo();
|
|
4074
|
+
temLivro = true;
|
|
4032
4075
|
} catch (erro) {
|
|
4033
|
-
|
|
4034
|
-
|
|
4076
|
+
temLivro = false;
|
|
4077
|
+
detalhe = false;
|
|
4078
|
+
const aviso = scrollPanel(renderer, theme, {
|
|
4079
|
+
title: "Abrir um livro",
|
|
4080
|
+
flexGrow: 1
|
|
4081
|
+
});
|
|
4082
|
+
aviso.add(heading(renderer, theme, "Projeto indispon\xEDvel"));
|
|
4083
|
+
aviso.add(dim(renderer, theme, erro instanceof Error ? erro.message : String(erro)));
|
|
4084
|
+
aviso.add(dim(renderer, theme, "Para come\xE7ar em uma pasta vazia, execute ebookfy init."));
|
|
4085
|
+
aviso.add(button(renderer, theme, {
|
|
4086
|
+
key: "g",
|
|
4087
|
+
label: "Abrir guia",
|
|
4088
|
+
onPress: () => ctx.goTo("docs")
|
|
4089
|
+
}));
|
|
4090
|
+
raiz.add(aviso);
|
|
4091
|
+
ctx.status("Projeto indispon\xEDvel");
|
|
4092
|
+
return raiz;
|
|
4093
|
+
}
|
|
4094
|
+
raiz.add(heading(renderer, theme, fitText(livro.title, renderer.width - 2 * ctx.space.pageX)));
|
|
4095
|
+
const formatos = livro.output.formats.map((f) => f.toUpperCase()).join(" / ");
|
|
4096
|
+
raiz.add(dim(renderer, theme, fitText(livro.publisher + " \xB7 v" + livro.version + " \xB7 " + formatos, renderer.width - 2 * ctx.space.pageX)));
|
|
4097
|
+
if (detalhe) {
|
|
4098
|
+
raiz.add(button(renderer, theme, {
|
|
4099
|
+
key: "Esc",
|
|
4100
|
+
label: "Voltar ao menu",
|
|
4101
|
+
onPress: () => voltar(ctx)
|
|
4102
|
+
}));
|
|
4103
|
+
const painel = selecionado === 1 ? sumario(ctx, livro, true) : scrollPanel(renderer, theme, {
|
|
4104
|
+
title: opcoes[selecionado].nome,
|
|
4105
|
+
flexGrow: 1
|
|
4106
|
+
});
|
|
4107
|
+
if (selecionado === 0) {
|
|
4108
|
+
painel.add(keyValueTable(renderer, theme, [
|
|
4109
|
+
["Autoria", livro.authors.join(", ")],
|
|
4110
|
+
["Editora", livro.publisher],
|
|
4111
|
+
["Edi\xE7\xE3o", livro.version],
|
|
4112
|
+
["Data", livro.date],
|
|
4113
|
+
["Idioma", livro.language],
|
|
4114
|
+
["Identificador", livro.identifier]
|
|
4115
|
+
]));
|
|
4116
|
+
painel.add(dim(renderer, theme, livro.description));
|
|
4117
|
+
}
|
|
4118
|
+
if (selecionado === 2) {
|
|
4119
|
+
const pasta = localizarLivro();
|
|
4120
|
+
for (const formato of livro.output.formats) {
|
|
4121
|
+
const caminho = join6(livro.output.directory, livro.slug + "-v" + livro.version + "." + formato);
|
|
4122
|
+
const existe = statSync4(join6(pasta, caminho), {
|
|
4123
|
+
throwIfNoEntry: false
|
|
4124
|
+
})?.isFile();
|
|
4125
|
+
painel.add(new TextRenderable4(renderer, {
|
|
4126
|
+
content: formato.toUpperCase() + " " + (existe ? "Dispon\xEDvel" : "A gerar"),
|
|
4127
|
+
fg: existe ? theme.ok : theme.warn
|
|
4128
|
+
}));
|
|
4129
|
+
painel.add(dim(renderer, theme, caminho));
|
|
4130
|
+
}
|
|
4131
|
+
painel.add(heading(renderer, theme, "Gerar a edi\xE7\xE3o: ebookfy build"));
|
|
4132
|
+
}
|
|
4133
|
+
rolagem = painel.body;
|
|
4134
|
+
raiz.add(painel);
|
|
4135
|
+
ctx.status(opcoes[selecionado].nome);
|
|
4136
|
+
return raiz;
|
|
4035
4137
|
}
|
|
4036
|
-
|
|
4138
|
+
const compacto = ctx.layout() === "compact";
|
|
4139
|
+
const corpo = new BoxRenderable4(renderer, {
|
|
4140
|
+
flexDirection: "row",
|
|
4141
|
+
flexGrow: 1,
|
|
4142
|
+
minHeight: 0,
|
|
4143
|
+
gap: ctx.space.gapX
|
|
4144
|
+
});
|
|
4145
|
+
const menu = scrollPanel(renderer, theme, {
|
|
4146
|
+
title: "Menu do livro",
|
|
4147
|
+
width: compacto ? "100%" : 32,
|
|
4148
|
+
flexGrow: 0,
|
|
4149
|
+
active: true
|
|
4150
|
+
});
|
|
4151
|
+
const linhas = opcoes.map((op, i) => {
|
|
4152
|
+
const item = new BoxRenderable4(renderer, {
|
|
4153
|
+
flexDirection: "column",
|
|
4154
|
+
flexShrink: 0,
|
|
4155
|
+
marginTop: i > 0 && !compacto ? 1 : 0
|
|
4156
|
+
});
|
|
4157
|
+
const rotulo = new TextRenderable4(renderer, {
|
|
4158
|
+
height: 1,
|
|
4159
|
+
attributes: TextAttributes3.BOLD,
|
|
4160
|
+
selectable: false
|
|
4161
|
+
});
|
|
4162
|
+
item.add(rotulo);
|
|
4163
|
+
item.add(new TextRenderable4(renderer, {
|
|
4164
|
+
content: " " + op.dica,
|
|
4165
|
+
fg: theme.textDim,
|
|
4166
|
+
selectable: false,
|
|
4167
|
+
height: 1
|
|
4168
|
+
}));
|
|
4169
|
+
menu.add(item);
|
|
4170
|
+
const atualizar = () => {
|
|
4171
|
+
const atual = i === selecionado;
|
|
4172
|
+
rotulo.content = (atual ? "> " : " ") + withIcon(ctx.icons, op.icone, op.nome) + " [" + op.atalho + "]";
|
|
4173
|
+
rotulo.fg = atual ? theme.keyText : theme[op.cor];
|
|
4174
|
+
rotulo.bg = atual ? theme.keyBackground : theme.surface;
|
|
4175
|
+
};
|
|
4176
|
+
clickable(renderer, item, {
|
|
4177
|
+
onClick: () => abrir(ctx, i),
|
|
4178
|
+
onHover: (ativo) => {
|
|
4179
|
+
if (ativo) {
|
|
4180
|
+
selecionado = i;
|
|
4181
|
+
pintar?.();
|
|
4182
|
+
}
|
|
4183
|
+
}
|
|
4184
|
+
});
|
|
4185
|
+
return { item, atualizar };
|
|
4186
|
+
});
|
|
4187
|
+
pintar = () => {
|
|
4188
|
+
for (const linha of linhas)
|
|
4189
|
+
linha.atualizar();
|
|
4190
|
+
menu.body.scrollChildIntoView(linhas[selecionado].item.id);
|
|
4191
|
+
};
|
|
4192
|
+
pintar();
|
|
4193
|
+
corpo.add(menu);
|
|
4194
|
+
if (!compacto)
|
|
4195
|
+
corpo.add(sumario(ctx, livro, false));
|
|
4196
|
+
raiz.add(corpo);
|
|
4197
|
+
ctx.status("\u2191\u2193 escolher \xB7 Enter abrir");
|
|
4198
|
+
return raiz;
|
|
4037
4199
|
}
|
|
4038
4200
|
};
|
|
4201
|
+
}
|
|
4202
|
+
var opcoes, overviewScreen;
|
|
4203
|
+
var init_overview = __esm(() => {
|
|
4204
|
+
init_project();
|
|
4205
|
+
init_components();
|
|
4206
|
+
init_icons();
|
|
4207
|
+
opcoes = [
|
|
4208
|
+
{
|
|
4209
|
+
nome: "Ficha editorial",
|
|
4210
|
+
atalho: "f",
|
|
4211
|
+
icone: "user",
|
|
4212
|
+
cor: "accent",
|
|
4213
|
+
dica: "Autoria, editora e edi\xE7\xE3o"
|
|
4214
|
+
},
|
|
4215
|
+
{
|
|
4216
|
+
nome: "Cap\xEDtulos",
|
|
4217
|
+
atalho: "c",
|
|
4218
|
+
icone: "list",
|
|
4219
|
+
cor: "accentSecondary",
|
|
4220
|
+
dica: "Ordem de leitura e fontes"
|
|
4221
|
+
},
|
|
4222
|
+
{
|
|
4223
|
+
nome: "Arquivos de sa\xEDda",
|
|
4224
|
+
atalho: "a",
|
|
4225
|
+
icone: "state",
|
|
4226
|
+
cor: "ok",
|
|
4227
|
+
dica: "PDF, EPUB e MOBI"
|
|
4228
|
+
},
|
|
4229
|
+
{
|
|
4230
|
+
nome: "Guia do Ebookfy",
|
|
4231
|
+
atalho: "g",
|
|
4232
|
+
icone: "docs",
|
|
4233
|
+
cor: "warn",
|
|
4234
|
+
dica: "Consultar o manual"
|
|
4235
|
+
}
|
|
4236
|
+
];
|
|
4237
|
+
overviewScreen = criarTelaLivro();
|
|
4039
4238
|
});
|
|
4040
4239
|
|
|
4041
4240
|
// src/tui/screens/settings.ts
|
|
4042
|
-
import { BoxRenderable as
|
|
4241
|
+
import { BoxRenderable as BoxRenderable5, TextRenderable as TextRenderable5 } from "@opentui/core";
|
|
4043
4242
|
function createSettingsScreen() {
|
|
4044
4243
|
let grid;
|
|
4045
4244
|
let rows = [];
|
|
@@ -4174,7 +4373,7 @@ Accepted: ${def.values?.join(", ")}` : ""}`;
|
|
|
4174
4373
|
value: String(value),
|
|
4175
4374
|
default: String(definitionOf(key)?.default ?? "\u2014")
|
|
4176
4375
|
}));
|
|
4177
|
-
const root = new
|
|
4376
|
+
const root = new BoxRenderable5(renderer, {
|
|
4178
4377
|
flexDirection: ctx.layout() === "compact" ? "column" : "row",
|
|
4179
4378
|
gap: ctx.layout() === "compact" ? ctx.space.gapY : ctx.space.gapX,
|
|
4180
4379
|
height: Math.min(renderer.height - (ctx.layout() === "compact" ? 4 : 8), ctx.layout() === "compact" ? 17 : rows.length + 6),
|
|
@@ -4187,7 +4386,7 @@ Accepted: ${def.values?.join(", ")}` : ""}`;
|
|
|
4187
4386
|
height: ctx.layout() === "compact" ? 6 : undefined,
|
|
4188
4387
|
flexGrow: 0
|
|
4189
4388
|
});
|
|
4190
|
-
const text = new
|
|
4389
|
+
const text = new TextRenderable5(renderer, {
|
|
4191
4390
|
fg: theme.text,
|
|
4192
4391
|
wrapMode: "word"
|
|
4193
4392
|
});
|
|
@@ -4232,7 +4431,7 @@ var init_settings2 = __esm(() => {
|
|
|
4232
4431
|
});
|
|
4233
4432
|
|
|
4234
4433
|
// src/tui/screens/credentials.ts
|
|
4235
|
-
import { BoxRenderable as
|
|
4434
|
+
import { BoxRenderable as BoxRenderable6 } from "@opentui/core";
|
|
4236
4435
|
function createCredentialsScreen() {
|
|
4237
4436
|
let grid;
|
|
4238
4437
|
let rows = [];
|
|
@@ -4346,7 +4545,7 @@ function createCredentialsScreen() {
|
|
|
4346
4545
|
const vault = vaultStatus();
|
|
4347
4546
|
current = rows.find((row) => row.name === current)?.name ?? rows[0]?.name ?? "";
|
|
4348
4547
|
ctx.status(`${rows.length} credential${rows.length === 1 ? "" : "s"} \xB7 master key: ${vault.masterKeySource}`);
|
|
4349
|
-
const root = new
|
|
4548
|
+
const root = new BoxRenderable6(renderer, {
|
|
4350
4549
|
flexDirection: ctx.layout() === "compact" ? "column" : "row",
|
|
4351
4550
|
gap: ctx.layout() === "compact" ? ctx.space.gapY : ctx.space.gapX,
|
|
4352
4551
|
height: Math.min(renderer.height - (ctx.layout() === "compact" ? 4 : 8), Math.max(8 + ctx.space.cardPadY * 2, rows.length + 4 + ctx.space.cardPadY * 2)),
|
|
@@ -4420,7 +4619,7 @@ var init_credentials3 = __esm(() => {
|
|
|
4420
4619
|
|
|
4421
4620
|
// src/tui/screens/docs.ts
|
|
4422
4621
|
import {
|
|
4423
|
-
BoxRenderable as
|
|
4622
|
+
BoxRenderable as BoxRenderable7,
|
|
4424
4623
|
MarkdownRenderable,
|
|
4425
4624
|
SyntaxStyle
|
|
4426
4625
|
} from "@opentui/core";
|
|
@@ -4469,8 +4668,8 @@ function createDocsScreen() {
|
|
|
4469
4668
|
let loadTopic;
|
|
4470
4669
|
async function choose(ctx) {
|
|
4471
4670
|
const selected = await ctx.choose({
|
|
4472
|
-
title: "
|
|
4473
|
-
items:
|
|
4671
|
+
title: "Escolher assunto",
|
|
4672
|
+
items: nomes,
|
|
4474
4673
|
initial: topic
|
|
4475
4674
|
});
|
|
4476
4675
|
if (selected !== undefined)
|
|
@@ -4489,19 +4688,19 @@ function createDocsScreen() {
|
|
|
4489
4688
|
id: "docs",
|
|
4490
4689
|
title: "Docs",
|
|
4491
4690
|
icon: "docs",
|
|
4492
|
-
description: "
|
|
4691
|
+
description: "Consultar o manual no terminal",
|
|
4493
4692
|
actions: [
|
|
4494
|
-
{ keys: ["t"], description: "
|
|
4693
|
+
{ keys: ["t"], description: "assuntos", icon: "docs", run: choose },
|
|
4495
4694
|
{
|
|
4496
4695
|
keys: ["up", "k"],
|
|
4497
|
-
description: "
|
|
4696
|
+
description: "rolar para cima",
|
|
4498
4697
|
icon: "select",
|
|
4499
4698
|
hidden: true,
|
|
4500
4699
|
run: () => scroll(-1)
|
|
4501
4700
|
},
|
|
4502
4701
|
{
|
|
4503
4702
|
keys: ["down", "j"],
|
|
4504
|
-
description: "
|
|
4703
|
+
description: "rolar para baixo",
|
|
4505
4704
|
icon: "select",
|
|
4506
4705
|
hidden: true,
|
|
4507
4706
|
run: () => scroll(1)
|
|
@@ -4543,13 +4742,13 @@ function createDocsScreen() {
|
|
|
4543
4742
|
},
|
|
4544
4743
|
mount(ctx) {
|
|
4545
4744
|
const { renderer, theme, icons } = ctx;
|
|
4546
|
-
const root2 = new
|
|
4745
|
+
const root2 = new BoxRenderable7(renderer, {
|
|
4547
4746
|
flexDirection: "row",
|
|
4548
4747
|
flexGrow: 1,
|
|
4549
4748
|
minHeight: 0,
|
|
4550
4749
|
gap: ctx.space.gapX
|
|
4551
4750
|
});
|
|
4552
|
-
const host = new
|
|
4751
|
+
const host = new BoxRenderable7(renderer, {
|
|
4553
4752
|
flexDirection: "column",
|
|
4554
4753
|
flexGrow: 1,
|
|
4555
4754
|
minWidth: 0,
|
|
@@ -4586,7 +4785,7 @@ function createDocsScreen() {
|
|
|
4586
4785
|
clear();
|
|
4587
4786
|
host.add(stateView(renderer, theme, icons, {
|
|
4588
4787
|
kind: "loading",
|
|
4589
|
-
title: "
|
|
4788
|
+
title: "Carregando o manual"
|
|
4590
4789
|
}));
|
|
4591
4790
|
ctx.status(`docs: ${selected}`);
|
|
4592
4791
|
try {
|
|
@@ -4595,7 +4794,7 @@ function createDocsScreen() {
|
|
|
4595
4794
|
return;
|
|
4596
4795
|
const content = normalizeMarkdown(skillText(root, selected)).replace(/^# [^\n]+\n+/, "");
|
|
4597
4796
|
clear();
|
|
4598
|
-
const card = scrollPanel(renderer, theme, { title: selected, active: true });
|
|
4797
|
+
const card = scrollPanel(renderer, theme, { title: rotulos[selected], active: true });
|
|
4599
4798
|
document = card.body;
|
|
4600
4799
|
document.add(new MarkdownRenderable(renderer, {
|
|
4601
4800
|
content,
|
|
@@ -4609,11 +4808,11 @@ function createDocsScreen() {
|
|
|
4609
4808
|
if (request !== generation || root2.isDestroyed || renderer.isDestroyed)
|
|
4610
4809
|
return;
|
|
4611
4810
|
clear();
|
|
4612
|
-
ctx.notify(error instanceof Error ? error.message : "
|
|
4811
|
+
ctx.notify(error instanceof Error ? error.message : "Falha ao carregar o manual", "error");
|
|
4613
4812
|
host.add(stateView(renderer, theme, icons, {
|
|
4614
4813
|
kind: "error",
|
|
4615
|
-
title: "
|
|
4616
|
-
action: { key: "t", label: "
|
|
4814
|
+
title: "Falha ao carregar o manual",
|
|
4815
|
+
action: { key: "t", label: "assuntos", onPress: chooseTopic }
|
|
4617
4816
|
}));
|
|
4618
4817
|
}
|
|
4619
4818
|
}
|
|
@@ -4624,8 +4823,8 @@ function createDocsScreen() {
|
|
|
4624
4823
|
topicIndex = undefined;
|
|
4625
4824
|
if (ctx.layout() !== "compact") {
|
|
4626
4825
|
const index = listPanel(renderer, theme, {
|
|
4627
|
-
title: "
|
|
4628
|
-
items:
|
|
4826
|
+
title: "Assuntos",
|
|
4827
|
+
items: nomes,
|
|
4629
4828
|
onSelect: selectTopic
|
|
4630
4829
|
});
|
|
4631
4830
|
topicIndex = index;
|
|
@@ -4641,10 +4840,12 @@ function createDocsScreen() {
|
|
|
4641
4840
|
}
|
|
4642
4841
|
};
|
|
4643
4842
|
}
|
|
4644
|
-
var docsScreen;
|
|
4843
|
+
var rotulos, nomes, docsScreen;
|
|
4645
4844
|
var init_docs = __esm(() => {
|
|
4646
4845
|
init_skill();
|
|
4647
4846
|
init_components();
|
|
4847
|
+
rotulos = { ebook: "Produzir um ebook", cli: "Linha de comando", tui: "Interface do terminal", mcp: "Conectar agentes", config: "Configura\xE7\xE3o local", "exit-codes": "C\xF3digos de sa\xEDda", reference: "Refer\xEAncia completa" };
|
|
4848
|
+
nomes = SKILL_TOPICS.map((topico) => rotulos[topico]);
|
|
4648
4849
|
docsScreen = createDocsScreen();
|
|
4649
4850
|
});
|
|
4650
4851
|
|
|
@@ -4663,9 +4864,9 @@ var init_screens = __esm(() => {
|
|
|
4663
4864
|
import { watch as watchFile, existsSync as existsSync4 } from "fs";
|
|
4664
4865
|
import { basename as basename2, dirname as dirname3 } from "path";
|
|
4665
4866
|
import {
|
|
4666
|
-
BoxRenderable as
|
|
4667
|
-
TextRenderable as
|
|
4668
|
-
TextAttributes as
|
|
4867
|
+
BoxRenderable as BoxRenderable8,
|
|
4868
|
+
TextRenderable as TextRenderable6,
|
|
4869
|
+
TextAttributes as TextAttributes4,
|
|
4669
4870
|
createCliRenderer
|
|
4670
4871
|
} from "@opentui/core";
|
|
4671
4872
|
function layoutFor(width) {
|
|
@@ -4733,28 +4934,28 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
4733
4934
|
if (!renderer.isDestroyed)
|
|
4734
4935
|
renderer.destroy();
|
|
4735
4936
|
};
|
|
4736
|
-
const app = new
|
|
4937
|
+
const app = new BoxRenderable8(renderer, {
|
|
4737
4938
|
width: "100%",
|
|
4738
4939
|
height: "100%",
|
|
4739
4940
|
flexDirection: "column",
|
|
4740
4941
|
backgroundColor: theme.background
|
|
4741
4942
|
});
|
|
4742
|
-
const header = new
|
|
4743
|
-
const brand = new
|
|
4744
|
-
brand.add(new
|
|
4745
|
-
brand.add(new
|
|
4746
|
-
brand.add(new
|
|
4943
|
+
const header = new BoxRenderable8(renderer, { backgroundColor: theme.headerBackground, height: 1, flexDirection: "row", paddingLeft: initialSpace.pageX, paddingRight: initialSpace.pageX, gap: controlSpacing.gap });
|
|
4944
|
+
const brand = new BoxRenderable8(renderer, { flexDirection: "row", flexShrink: 0 });
|
|
4945
|
+
brand.add(new TextRenderable6(renderer, { content: `${glyphs.block} `, fg: theme.headerText, selectable: false }));
|
|
4946
|
+
brand.add(new TextRenderable6(renderer, { content: manifest.title + " Produ\xE7\xE3o de ebooks", fg: theme.headerText, attributes: TextAttributes4.BOLD }));
|
|
4947
|
+
brand.add(new TextRenderable6(renderer, { content: ` v${manifest.version}`, fg: theme.headerText }));
|
|
4747
4948
|
header.add(brand);
|
|
4748
|
-
header.add(new
|
|
4749
|
-
const platform = new
|
|
4949
|
+
header.add(new BoxRenderable8(renderer, { flexGrow: 1 }));
|
|
4950
|
+
const platform = new TextRenderable6(renderer, {
|
|
4750
4951
|
content: `${process.platform}-${process.arch} \xB7 Bun ${Bun.version}`,
|
|
4751
|
-
fg: theme.
|
|
4952
|
+
fg: theme.headerText,
|
|
4752
4953
|
flexShrink: 0,
|
|
4753
4954
|
wrapMode: "none"
|
|
4754
4955
|
});
|
|
4755
4956
|
header.add(platform);
|
|
4756
4957
|
app.add(header);
|
|
4757
|
-
const tabBar = new
|
|
4958
|
+
const tabBar = new BoxRenderable8(renderer, {
|
|
4758
4959
|
height: 1,
|
|
4759
4960
|
flexDirection: "row",
|
|
4760
4961
|
paddingLeft: initialSpace.pageX,
|
|
@@ -4769,9 +4970,9 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
4769
4970
|
});
|
|
4770
4971
|
let hovered = -1;
|
|
4771
4972
|
const tabItems = screens.map((screen, index) => {
|
|
4772
|
-
const label = new
|
|
4773
|
-
const item = new
|
|
4774
|
-
const indicator = new
|
|
4973
|
+
const label = new TextRenderable6(renderer, { content: "", fg: theme.textDim, wrapMode: "none", selectable: false });
|
|
4974
|
+
const item = new BoxRenderable8(renderer, { flexDirection: "column", flexShrink: 0 });
|
|
4975
|
+
const indicator = new TextRenderable6(renderer, { content: "", height: 1, fg: theme.accent, selectable: false, wrapMode: "none" });
|
|
4775
4976
|
item.add(label);
|
|
4776
4977
|
item.add(indicator);
|
|
4777
4978
|
clickable(renderer, item, {
|
|
@@ -4784,25 +4985,25 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
4784
4985
|
tabBar.add(item);
|
|
4785
4986
|
return { item, label, indicator, screen, index };
|
|
4786
4987
|
});
|
|
4787
|
-
const headerGap = new
|
|
4988
|
+
const headerGap = new BoxRenderable8(renderer, { height: initialSpace.pageY, flexShrink: 0 });
|
|
4788
4989
|
app.add(headerGap);
|
|
4789
4990
|
app.add(tabBar);
|
|
4790
|
-
const tabGap = new
|
|
4991
|
+
const tabGap = new BoxRenderable8(renderer, { height: initialSpace.pageY, flexShrink: 0 });
|
|
4791
4992
|
app.add(tabGap);
|
|
4792
|
-
const content = new
|
|
4993
|
+
const content = new BoxRenderable8(renderer, { flexGrow: 1, flexDirection: "column", paddingLeft: initialSpace.pageX, paddingRight: initialSpace.pageX, minHeight: 0 });
|
|
4793
4994
|
app.add(content);
|
|
4794
|
-
const tooSmall = new
|
|
4795
|
-
const tooSmallText = new
|
|
4995
|
+
const tooSmall = new BoxRenderable8(renderer, { flexGrow: 1, alignItems: "center", justifyContent: "center", flexDirection: "column" });
|
|
4996
|
+
const tooSmallText = new TextRenderable6(renderer, { content: "", fg: theme.warn, selectable: false });
|
|
4796
4997
|
tooSmall.add(tooSmallText);
|
|
4797
|
-
tooSmall.add(new
|
|
4798
|
-
const contentGap = new
|
|
4998
|
+
tooSmall.add(new TextRenderable6(renderer, { content: "Amplie o terminal ou pressione q para sair.", fg: theme.textDim, selectable: false }));
|
|
4999
|
+
const contentGap = new BoxRenderable8(renderer, { height: initialSpace.pageY, flexShrink: 0 });
|
|
4799
5000
|
app.add(contentGap);
|
|
4800
|
-
const bar = new
|
|
4801
|
-
const statusText = new
|
|
4802
|
-
let barItems = new
|
|
4803
|
-
const paletteHint = new
|
|
4804
|
-
paletteHint.add(new
|
|
4805
|
-
const paletteLabel = new
|
|
5001
|
+
const bar = new BoxRenderable8(renderer, { height: 1, flexDirection: "row", paddingLeft: initialSpace.pageX, paddingRight: initialSpace.pageX, gap: controlSpacing.gap });
|
|
5002
|
+
const statusText = new TextRenderable6(renderer, { content: "", fg: theme.textDim, wrapMode: "none", flexShrink: 1, minWidth: 0, selectable: false });
|
|
5003
|
+
let barItems = new BoxRenderable8(renderer, { flexDirection: "row", gap: controlSpacing.gap, flexGrow: 1, flexShrink: 1, minWidth: 0 });
|
|
5004
|
+
const paletteHint = new BoxRenderable8(renderer, { flexDirection: "row", flexShrink: 0, width: 12 });
|
|
5005
|
+
paletteHint.add(new TextRenderable6(renderer, { content: "^K", fg: theme.accent, attributes: TextAttributes4.BOLD, selectable: false }));
|
|
5006
|
+
const paletteLabel = new TextRenderable6(renderer, { content: " comandos", fg: theme.textDim, selectable: false });
|
|
4806
5007
|
paletteHint.add(paletteLabel);
|
|
4807
5008
|
clickable(renderer, paletteHint, {
|
|
4808
5009
|
onClick: () => openPalette(),
|
|
@@ -4872,8 +5073,8 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
4872
5073
|
}
|
|
4873
5074
|
};
|
|
4874
5075
|
const globalActions = [
|
|
4875
|
-
{ keys: ["?"], description: "
|
|
4876
|
-
{ keys: ["q", "escape"], description: "
|
|
5076
|
+
{ keys: ["?"], description: "ajuda", icon: "help", run: () => openHelp() },
|
|
5077
|
+
{ keys: ["q", "escape"], description: "sair", icon: "quit", run: () => quit() }
|
|
4877
5078
|
];
|
|
4878
5079
|
const screenActions = () => {
|
|
4879
5080
|
const screen = active();
|
|
@@ -4897,15 +5098,16 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
4897
5098
|
const text = `${number}${title}`;
|
|
4898
5099
|
label.content = text;
|
|
4899
5100
|
indicator.content = selected ? "\u2501".repeat(Bun.stringWidth(text)) : "";
|
|
4900
|
-
label.
|
|
4901
|
-
label.
|
|
5101
|
+
label.bg = selected ? theme.keyBackground : theme.background;
|
|
5102
|
+
label.fg = selected ? theme.keyText : index === hovered ? theme.text : theme.textDim;
|
|
5103
|
+
label.attributes = selected ? TextAttributes4.BOLD : TextAttributes4.NONE;
|
|
4902
5104
|
item.backgroundColor = theme.background;
|
|
4903
5105
|
}
|
|
4904
5106
|
};
|
|
4905
5107
|
const barItem = (action) => {
|
|
4906
|
-
const item = new
|
|
4907
|
-
const text = new
|
|
4908
|
-
item.add(new
|
|
5108
|
+
const item = new BoxRenderable8(renderer, { flexDirection: "row", flexShrink: 0, width: Bun.stringWidth(keyLabel(action)) + Bun.stringWidth(action.description) + 1 });
|
|
5109
|
+
const text = new TextRenderable6(renderer, { content: ` ${action.description}`, fg: theme.textDim, selectable: false });
|
|
5110
|
+
item.add(new TextRenderable6(renderer, { content: keyLabel(action), fg: theme.accent, attributes: TextAttributes4.BOLD, selectable: false }));
|
|
4909
5111
|
item.add(text);
|
|
4910
5112
|
clickable(renderer, item, {
|
|
4911
5113
|
onClick: () => runAction(action),
|
|
@@ -4920,7 +5122,7 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
4920
5122
|
fitStatus();
|
|
4921
5123
|
barItems.destroyRecursively();
|
|
4922
5124
|
bar.remove(paletteHint);
|
|
4923
|
-
barItems = new
|
|
5125
|
+
barItems = new BoxRenderable8(renderer, { flexDirection: "row", gap: controlSpacing.gap, flexGrow: 1, flexShrink: 1, minWidth: 0 });
|
|
4924
5126
|
const own = currentLayout === "compact" ? [] : screenActions().filter((action) => !action.hidden);
|
|
4925
5127
|
const statusWidth = statusText.visible ? statusText.width + 2 : 0;
|
|
4926
5128
|
const paletteWidth = paletteHint.width;
|
|
@@ -5024,7 +5226,7 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
5024
5226
|
}
|
|
5025
5227
|
screens.forEach((target, index) => {
|
|
5026
5228
|
if (index !== activeIndex)
|
|
5027
|
-
entries.push({ label: `
|
|
5229
|
+
entries.push({ label: `Abrir ${target.title}`, hint: index < 9 ? String(index + 1) : undefined, icon: target.icon, run: () => show(index) });
|
|
5028
5230
|
});
|
|
5029
5231
|
screens.forEach((target, index) => {
|
|
5030
5232
|
if (index === activeIndex)
|
|
@@ -5040,9 +5242,9 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
5040
5242
|
});
|
|
5041
5243
|
}
|
|
5042
5244
|
});
|
|
5043
|
-
entries.push({ label: "
|
|
5044
|
-
entries.push({ label: "
|
|
5045
|
-
entries.push({ label: "
|
|
5245
|
+
entries.push({ label: "Atualizar esta tela", icon: "refresh", run: () => remount() });
|
|
5246
|
+
entries.push({ label: "Ajuda de teclado e mouse", hint: "?", icon: "help", run: () => openHelp() });
|
|
5247
|
+
entries.push({ label: "Sair", hint: "q", icon: "quit", run: () => quit() });
|
|
5046
5248
|
overlays.palette(entries);
|
|
5047
5249
|
};
|
|
5048
5250
|
const openHelp = () => {
|
|
@@ -5058,20 +5260,20 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
5058
5260
|
sections.push({
|
|
5059
5261
|
title: "Global",
|
|
5060
5262
|
rows: [
|
|
5061
|
-
{ key: "Ctrl+K :", description: "
|
|
5062
|
-
{ key: "\u2190 \u2192 [ ]", description: "
|
|
5063
|
-
{ key: `1 \u2026 ${Math.min(9, screens.length)}`, description: "
|
|
5064
|
-
{ key: "Tab Shift+Tab", description: "
|
|
5065
|
-
{ key: "Esc", description: "
|
|
5066
|
-
{ key: "q Ctrl+C", description: "
|
|
5263
|
+
{ key: "Ctrl+K :", description: "menu de comandos", icon: "keyboard", run: () => openPalette() },
|
|
5264
|
+
{ key: "\u2190 \u2192 [ ]", description: "aba anterior ou seguinte", icon: "tabs", run: () => step(1) },
|
|
5265
|
+
{ key: `1 \u2026 ${Math.min(9, screens.length)}`, description: "abrir aba pelo n\xFAmero" },
|
|
5266
|
+
{ key: "Tab Shift+Tab", description: "alternar painel" },
|
|
5267
|
+
{ key: "Esc", description: "voltar ou fechar o di\xE1logo", icon: "close" },
|
|
5268
|
+
{ key: "q Ctrl+C", description: "sair", icon: "quit", run: () => quit() }
|
|
5067
5269
|
]
|
|
5068
5270
|
});
|
|
5069
5271
|
sections.push({
|
|
5070
5272
|
title: "Mouse",
|
|
5071
5273
|
rows: [
|
|
5072
|
-
{ key: "click", description: "
|
|
5073
|
-
{ key: "wheel", description: "
|
|
5074
|
-
{ key: "Shift+drag", description: "
|
|
5274
|
+
{ key: "click", description: "abrir aba, item ou bot\xE3o" },
|
|
5275
|
+
{ key: "wheel", description: "rolar lista ou alternar aba" },
|
|
5276
|
+
{ key: "Shift+drag", description: "selecionar texto" }
|
|
5075
5277
|
]
|
|
5076
5278
|
});
|
|
5077
5279
|
overlays.help(sections);
|
|
@@ -5105,7 +5307,7 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
5105
5307
|
content.add(node);
|
|
5106
5308
|
}
|
|
5107
5309
|
}
|
|
5108
|
-
tooSmallText.content = withIcon(icons, "warn", `Terminal
|
|
5310
|
+
tooSmallText.content = withIcon(icons, "warn", `Terminal pequeno: ${renderer.width}\xD7${renderer.height}, m\xEDnimo ${MIN_WIDTH}\xD7${MIN_HEIGHT}.`);
|
|
5109
5311
|
if (nextLayout !== currentLayout) {
|
|
5110
5312
|
currentLayout = nextLayout;
|
|
5111
5313
|
for (const screen of screens)
|
|
@@ -5163,7 +5365,7 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
|
|
|
5163
5365
|
}
|
|
5164
5366
|
restartWatchers();
|
|
5165
5367
|
remount();
|
|
5166
|
-
context.notify("
|
|
5368
|
+
context.notify("Dados atualizados", "info");
|
|
5167
5369
|
};
|
|
5168
5370
|
watchTimer = setTimeout(update, 250);
|
|
5169
5371
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promovaweb/ebookfy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Organize capítulos e exporte seu ebook em PDF, EPUB e MOBI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"start": "bun src/main.ts",
|
|
22
22
|
"typecheck": "tsc --noEmit",
|
|
23
23
|
"test": "node --test tests/*.test.mjs",
|
|
24
|
-
"manual": "bun src/main.ts build",
|
|
24
|
+
"manual": "cd manual && bun ../src/main.ts build",
|
|
25
25
|
"build": "bun build ./src/main.ts --target=bun --packages=external --outdir dist/bin",
|
|
26
26
|
"prepack": "npm run build"
|
|
27
27
|
},
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"@oven/bun-darwin-aarch64": "1.4.4",
|
|
57
57
|
"@oven/bun-darwin-x64": "1.4.4",
|
|
58
58
|
"@oven/bun-linux-aarch64": "1.4.4",
|
|
59
|
-
"@oven/bun-linux-x64": "1.4.4",
|
|
60
59
|
"@oven/bun-linux-aarch64-musl": "1.4.4",
|
|
60
|
+
"@oven/bun-linux-x64": "1.4.4",
|
|
61
61
|
"@oven/bun-linux-x64-musl": "1.4.4",
|
|
62
|
-
"@oven/bun-windows-
|
|
63
|
-
"@oven/bun-windows-
|
|
62
|
+
"@oven/bun-windows-aarch64": "1.4.4",
|
|
63
|
+
"@oven/bun-windows-x64": "1.4.4"
|
|
64
64
|
}
|
|
65
65
|
}
|