primocode 10.19.0 → 11.0.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/LICENSES/opencode-MIT.txt +24 -0
- package/LICENSES/pptxgenjs-MIT.txt +31 -0
- package/README.md +16 -3
- package/agentes/acessibilidade.md +10 -0
- package/agentes/ambiente.md +10 -0
- package/agentes/api.md +10 -0
- package/agentes/backend.md +10 -0
- package/agentes/copy.md +10 -0
- package/agentes/css-layout.md +10 -0
- package/agentes/dados.md +10 -0
- package/agentes/depuracao.md +10 -0
- package/agentes/design.md +10 -0
- package/agentes/docs.md +10 -0
- package/agentes/frontend.md +10 -0
- package/agentes/geral/capacidades/arquivos.json +132 -0
- package/agentes/geral/capacidades/codigo.json +132 -0
- package/agentes/geral/capacidades/dados.json +126 -0
- package/agentes/geral/capacidades/depuracao.json +126 -0
- package/agentes/geral/capacidades/escrita.json +126 -0
- package/agentes/geral/capacidades/git.json +126 -0
- package/agentes/geral/capacidades/pesquisa.json +126 -0
- package/agentes/geral/capacidades/seguranca.json +132 -0
- package/agentes/geral/capacidades/shell.json +132 -0
- package/agentes/geral/capacidades/web.json +126 -0
- package/agentes/git-pr.md +10 -0
- package/agentes/indice.md +86 -0
- package/agentes/nextjs.md +10 -0
- package/agentes/node.md +10 -0
- package/agentes/performance.md +10 -0
- package/agentes/pesquisa.md +10 -0
- package/agentes/python.md +10 -0
- package/agentes/react.md +10 -0
- package/agentes/refatoracao.md +10 -0
- package/agentes/revisor.md +10 -0
- package/agentes/seguranca.md +10 -0
- package/agentes/sql.md +10 -0
- package/agentes/testes.md +10 -0
- package/agentes/typescript.md +10 -0
- package/agentes/ux.md +10 -0
- package/bin/primocode.js +65 -8
- package/editor/helpers/camera_viva.py +28 -2
- package/lib/act.js +79 -10
- package/lib/agentes/index.js +146 -0
- package/lib/agentes/nucleo.js +18 -0
- package/lib/catalogo.js +12 -2
- package/lib/cli/review.js +64 -0
- package/lib/cli/subcomandos.js +34 -0
- package/lib/cli/tentativas.js +107 -0
- package/lib/cli/util.js +51 -0
- package/lib/comandos-extra.js +4 -2
- package/lib/editor-pro-maquina.js +165 -0
- package/lib/editor-pro.js +10 -7
- package/lib/entregaveis/cli.js +26 -0
- package/lib/entregaveis/especialistas.js +50 -0
- package/lib/entregaveis/nucleo.js +111 -0
- package/lib/entregaveis/slides.js +221 -0
- package/lib/estudio/materiais.js +172 -0
- package/lib/fundo.js +34 -1
- package/lib/kits.js +41 -2
- package/lib/nomes.js +6 -0
- package/lib/placar.js +173 -0
- package/lib/plugin/autoteste.js +99 -0
- package/lib/plugin/edicao-visual.js +133 -0
- package/lib/plugin/pesquisar.js +92 -0
- package/lib/plugin/preview-cli.js +38 -0
- package/lib/plugin/preview.js +89 -0
- package/lib/plugin/tunel.js +27 -0
- package/lib/review.js +134 -0
- package/lib/session/compactacao.js +124 -0
- package/lib/statusline.js +52 -0
- package/lib/tool/diagnostico.js +100 -0
- package/lib/tool/perguntar.js +60 -0
- package/lib/tool/reparar-entrada.js +66 -0
- package/lib/tool/web.js +102 -0
- package/lib/tools.js +20 -1
- package/lib/ui.js +1 -1
- package/materiais/saas-linear/base.ts +84 -0
- package/materiais/saas-linear/camera/Camera.tsx +38 -0
- package/materiais/saas-linear/fontes/OFL-Inter.txt +93 -0
- package/materiais/saas-linear/fontes/OFL-Newsreader.txt +93 -0
- package/materiais/saas-linear/fontes/inter-400.woff2 +0 -0
- package/materiais/saas-linear/fontes/inter-600.woff2 +0 -0
- package/materiais/saas-linear/fontes/newsreader-400.woff2 +0 -0
- package/materiais/saas-linear/formas/Agenda.tsx +46 -0
- package/materiais/saas-linear/formas/CaixaPrompt.tsx +41 -0
- package/materiais/saas-linear/formas/CartoesIntegracao.tsx +57 -0
- package/materiais/saas-linear/formas/Cursor.tsx +40 -0
- package/materiais/saas-linear/formas/Menu.tsx +46 -0
- package/materiais/saas-linear/formas/Monitor.tsx +28 -0
- package/materiais/saas-linear/paleta.json +18 -0
- package/materiais/saas-linear/pecas.json +590 -0
- package/materiais/saas-linear/regras.md +40 -0
- package/materiais/saas-linear/sons/Som.tsx +39 -0
- package/materiais/saas-linear/sons/assinatura.mp3 +0 -0
- package/materiais/saas-linear/sons/clique.mp3 +0 -0
- package/materiais/saas-linear/sons/impacto.mp3 +0 -0
- package/materiais/saas-linear/sons/pop-cartao.mp3 +0 -0
- package/materiais/saas-linear/sons/pop-palavra.mp3 +0 -0
- package/materiais/saas-linear/sons/subida.mp3 +0 -0
- package/materiais/saas-linear/sons/swoosh.mp3 +0 -0
- package/materiais/saas-linear/sons/trilha.mp3 +0 -0
- package/materiais/saas-linear/sons/whoosh-entra.mp3 +0 -0
- package/materiais/saas-linear/sons/whoosh-sai.mp3 +0 -0
- package/materiais/saas-linear/texturas/Fundo.tsx +18 -0
- package/materiais/saas-linear/texturas/Particulas.tsx +22 -0
- package/materiais/saas-linear/tipografia/FraseSerifa.tsx +25 -0
- package/materiais/saas-linear/tipografia/Marca.tsx +20 -0
- package/materiais/saas-linear/tipografia/MarcaFinal.tsx +22 -0
- package/materiais/saas-linear/tipografia/Saudacao.tsx +27 -0
- package/materiais/saas-linear/transicoes/Cena.tsx +38 -0
- package/materiais/saas-linear/transicoes/CorteImpacto.tsx +16 -0
- package/package.json +3 -1
- package/skills/deck-conferido/SKILL.md +29 -0
- package/vendor/pptxgenjs/carregar.js +12 -0
- package/vendor/pptxgenjs/jszip.min.js +13 -0
- package/vendor/pptxgenjs/pptxgen.cjs.js +7370 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reparar-entrada.js — conserta o argumento da ferramenta que o modelo grátis mandou com o TIPO errado.
|
|
3
|
+
*
|
|
4
|
+
* Modelo pequeno manda {"limit":"20"}, {"replace_all":"false"}, {"edits":"[...]"} ou {"offset":null}.
|
|
5
|
+
* Sem reparo, a ferramenta recusa e o modelo gasta uma volta inteira só pra trocar aspas.
|
|
6
|
+
* Ideia e regras portadas do ToolInputRepairPlugin do OpenCode (MIT, ver LICENSES/opencode-MIT.txt);
|
|
7
|
+
* código reescrito em JS, sobre um schema simples ({ campo: 'number'|'boolean'|'array'|'object'|'string' }).
|
|
8
|
+
*
|
|
9
|
+
* Regra de ouro (a mesma do casar.js): só repara quando o schema deixa claro. Na dúvida, devolve como veio.
|
|
10
|
+
*
|
|
11
|
+
* reparar(args, schema) → novo objeto (puro, não muda o original)
|
|
12
|
+
* SCHEMAS → tipos dos campos das ferramentas do agente
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
const SCHEMAS = {
|
|
18
|
+
read_file: { offset: 'number', limit: 'number' },
|
|
19
|
+
edit_file: { replace_all: 'boolean' },
|
|
20
|
+
multi_edit: { edits: 'array' },
|
|
21
|
+
write_todos: { todos: 'array' },
|
|
22
|
+
glob: { limit: 'number' },
|
|
23
|
+
run_shell: { timeout_ms: 'number', em_segundo_plano: 'boolean' },
|
|
24
|
+
perguntar: { opcoes: 'array', texto_livre: 'boolean' },
|
|
25
|
+
buscar_web: { limite: 'number' },
|
|
26
|
+
ler_url: { max_chars: 'number', desde: 'number' },
|
|
27
|
+
grep: { limit: 'number', context: 'number', ignore_case: 'boolean' },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function jsonOuNada(s) {
|
|
31
|
+
try { return { ok: true, v: JSON.parse(s) }; } catch { return { ok: false }; }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function converter(valor, tipo) {
|
|
35
|
+
if (valor === null) return undefined; // opcional com null → como se não tivesse vindo
|
|
36
|
+
if (typeof valor === 'string') {
|
|
37
|
+
const t = valor.trim();
|
|
38
|
+
if (tipo === 'number' && /^-?\d+(\.\d+)?$/.test(t)) return Number(t);
|
|
39
|
+
if (tipo === 'boolean' && /^(true|false)$/i.test(t)) return t.toLowerCase() === 'true';
|
|
40
|
+
if (tipo === 'array' || tipo === 'object') {
|
|
41
|
+
const j = jsonOuNada(t);
|
|
42
|
+
if (j.ok && (tipo === 'array' ? Array.isArray(j.v) : j.v && typeof j.v === 'object' && !Array.isArray(j.v))) return j.v;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return valor;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function reparar(args, schema) {
|
|
49
|
+
let a = args;
|
|
50
|
+
if (typeof a === 'string') { // objeto inteiro virou texto: '{"limit":"20"}'
|
|
51
|
+
const j = jsonOuNada(a);
|
|
52
|
+
if (!j.ok || !j.v || typeof j.v !== 'object' || Array.isArray(j.v)) return args;
|
|
53
|
+
a = j.v;
|
|
54
|
+
}
|
|
55
|
+
if (!a || typeof a !== 'object' || !schema) return a;
|
|
56
|
+
const out = { ...a };
|
|
57
|
+
for (const [campo, tipo] of Object.entries(schema)) {
|
|
58
|
+
if (!(campo in out)) continue;
|
|
59
|
+
const v = converter(out[campo], tipo);
|
|
60
|
+
if (v === undefined) delete out[campo];
|
|
61
|
+
else out[campo] = v;
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = { reparar, SCHEMAS };
|
package/lib/tool/web.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* web.js — buscar_web e ler_url (ideia: websearch/webfetch do OpenCode, MIT).
|
|
3
|
+
*
|
|
4
|
+
* Reaproveita lib/referencia.js: pegar() (UA de navegador, redirect, prazo, bloqueio de SSRF)
|
|
5
|
+
* e buscar() (Bing/Yahoo/DDG/Wikipedia, sem chave). Aqui só ficam a forma da resposta (curta,
|
|
6
|
+
* pra modelo pequeno) e o html → markdown simples, com teto de tamanho.
|
|
7
|
+
*
|
|
8
|
+
* Backend de busca é plugável: registrarBackend(nome, async (consulta, limite) => [{titulo,url,trecho?}]).
|
|
9
|
+
* Os registrados rodam ANTES dos padrões (ex.: um SearxNG próprio, uma API paga por config).
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const referencia = require('../referencia');
|
|
14
|
+
|
|
15
|
+
const TETO_PADRAO = 12000;
|
|
16
|
+
const TETO_MAXIMO = 40000;
|
|
17
|
+
const backends = [];
|
|
18
|
+
|
|
19
|
+
function registrarBackend(nome, fn) {
|
|
20
|
+
const i = backends.findIndex((b) => b.nome === nome);
|
|
21
|
+
if (i >= 0) backends.splice(i, 1);
|
|
22
|
+
backends.unshift({ nome, fn });
|
|
23
|
+
}
|
|
24
|
+
function limparBackends() { backends.length = 0; }
|
|
25
|
+
|
|
26
|
+
/** DuckDuckGo HTML com trecho (snippet). Grátis, sem chave. */
|
|
27
|
+
async function ddgHtml(consulta, limite, pegar = referencia.pegar) {
|
|
28
|
+
const html = await pegar(`https://html.duckduckgo.com/html/?q=${encodeURIComponent(consulta)}`, { timeout: 8000 });
|
|
29
|
+
if (!html) return [];
|
|
30
|
+
const out = [];
|
|
31
|
+
const re = /<a[^>]+class="[^"]*result__a[^"]*"[^>]+href="([^"]+)"[^>]*>([\s\S]*?)<\/a>([\s\S]*?)(?=<a[^>]+class="[^"]*result__a|$)/gi;
|
|
32
|
+
let m;
|
|
33
|
+
while ((m = re.exec(html)) && out.length < limite) {
|
|
34
|
+
let href = m[1];
|
|
35
|
+
const emb = href.match(/[?&]uddg=([^&]+)/);
|
|
36
|
+
if (emb) href = decodeURIComponent(emb[1]);
|
|
37
|
+
if (!/^https?:\/\//i.test(href)) continue;
|
|
38
|
+
const sn = m[3].match(/class="[^"]*result__snippet[^"]*"[^>]*>([\s\S]*?)<\/(?:a|td|div)>/i);
|
|
39
|
+
out.push({ titulo: referencia.textoDe(m[2]).slice(0, 140), url: href, trecho: sn ? referencia.textoDe(sn[1]).slice(0, 240) : '' });
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function buscarWeb({ consulta, query, limite } = {}, { pegar } = {}) {
|
|
45
|
+
const q = String(consulta || query || '').trim();
|
|
46
|
+
if (!q) return { ok: false, error: 'faltou "consulta": o que buscar na web.' };
|
|
47
|
+
const n = Math.max(1, Math.min(10, Number(limite) || 6));
|
|
48
|
+
const lista = [...backends, { nome: 'duckduckgo', fn: (c, l) => ddgHtml(c, l, pegar) },
|
|
49
|
+
{ nome: 'multi', fn: (c, l) => referencia.buscar(c, l) }];
|
|
50
|
+
for (const b of lista) {
|
|
51
|
+
let r = [];
|
|
52
|
+
try { r = await b.fn(q, n); } catch { r = []; }
|
|
53
|
+
if (r && r.length) {
|
|
54
|
+
return { ok: true, consulta: q, fonte: b.nome, resultados: r.slice(0, n),
|
|
55
|
+
proximoPasso: 'Escolha 1 ou 2 links e chame ler_url com a url pra ler a página. Não responda só com os títulos.' };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return { ok: false, error: `nada encontrado para "${q}" (sem internet ou buscadores bloqueados).`,
|
|
59
|
+
comoResolver: 'tente outras palavras, mais curtas, ou use ler_url se já souber o link.' };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** HTML → markdown simples: título, cabeçalhos, links, listas, código. */
|
|
63
|
+
function htmlParaMarkdown(html) {
|
|
64
|
+
let h = String(html || '');
|
|
65
|
+
const titulo = (h.match(/<title[^>]*>([\s\S]*?)<\/title>/i) || [])[1] || '';
|
|
66
|
+
h = h.replace(/<(script|style|noscript|svg|nav|footer|header|aside|form)[\s\S]*?<\/\1>/gi, ' ')
|
|
67
|
+
.replace(/<!--[\s\S]*?-->/g, ' ');
|
|
68
|
+
const principal = h.match(/<(main|article)[^>]*>([\s\S]*?)<\/\1>/i);
|
|
69
|
+
if (principal) h = principal[2];
|
|
70
|
+
h = h.replace(/<h([1-6])[^>]*>([\s\S]*?)<\/h\1>/gi, (_, n, t) => `\n\n${'#'.repeat(Number(n))} ${t.replace(/<[^>]+>/g, '')}\n\n`)
|
|
71
|
+
.replace(/<pre[^>]*>([\s\S]*?)<\/pre>/gi, (_, t) => `\n\n\`\`\`\n${t.replace(/<[^>]+>/g, '')}\n\`\`\`\n\n`)
|
|
72
|
+
.replace(/<code[^>]*>([\s\S]*?)<\/code>/gi, (_, t) => `\`${t.replace(/<[^>]+>/g, '')}\``)
|
|
73
|
+
.replace(/<a[^>]+href="([^"#][^"]*)"[^>]*>([\s\S]*?)<\/a>/gi, (_, u, t) => {
|
|
74
|
+
const tx = t.replace(/<[^>]+>/g, '').trim();
|
|
75
|
+
return tx && /^https?:/i.test(u) ? `[${tx}](${u})` : tx;
|
|
76
|
+
})
|
|
77
|
+
.replace(/<li[^>]*>/gi, '\n- ')
|
|
78
|
+
.replace(/<(br|\/p|\/div|\/tr|\/ul|\/ol)\b[^>]*>/gi, '\n')
|
|
79
|
+
.replace(/<[^>]+>/g, '');
|
|
80
|
+
h = h.replace(/ /g, ' ').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"')
|
|
81
|
+
.replace(/'/g, "'").replace(/&/g, '&')
|
|
82
|
+
.replace(/[ \t]+/g, ' ').replace(/ *\n */g, '\n').replace(/\n{3,}/g, '\n\n').trim();
|
|
83
|
+
return { titulo: referencia.textoDe(titulo).slice(0, 160), markdown: h };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function lerUrl({ url, max_chars, desde } = {}, { pegar = referencia.pegar } = {}) {
|
|
87
|
+
const u = String(url || '').trim();
|
|
88
|
+
if (!/^https?:\/\//i.test(u)) return { ok: false, error: 'faltou "url" completa, começando com http:// ou https://.' };
|
|
89
|
+
const teto = Math.max(500, Math.min(TETO_MAXIMO, Number(max_chars) || TETO_PADRAO));
|
|
90
|
+
const bruto = await pegar(u, { timeout: 12000 });
|
|
91
|
+
if (!bruto) return { ok: false, error: `não consegui abrir ${u} (fora do ar, bloqueado ou endereço interno).` };
|
|
92
|
+
const texto = String(bruto);
|
|
93
|
+
const ehHtml = /<(html|body|p|div|h1)\b/i.test(texto.slice(0, 4000));
|
|
94
|
+
const { titulo, markdown } = ehHtml ? htmlParaMarkdown(texto) : { titulo: '', markdown: texto.trim() };
|
|
95
|
+
const ini = Math.max(0, Number(desde) || 0);
|
|
96
|
+
const fatia = markdown.slice(ini, ini + teto);
|
|
97
|
+
const sobrou = markdown.length - (ini + fatia.length);
|
|
98
|
+
return { ok: true, url: u, titulo, texto: fatia, caracteres: fatia.length,
|
|
99
|
+
...(sobrou > 0 ? { cortado: sobrou, dica: `Faltam ${sobrou} caracteres. Chame ler_url de novo com desde:${ini + fatia.length} se precisar.` } : {}) };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = { buscarWeb, lerUrl, htmlParaMarkdown, registrarBackend, limparBackends, ddgHtml };
|
package/lib/tools.js
CHANGED
|
@@ -618,7 +618,12 @@ function getTodos() { return TODOS; }
|
|
|
618
618
|
*/
|
|
619
619
|
async function execute(name, args, ctx) {
|
|
620
620
|
try {
|
|
621
|
-
|
|
621
|
+
const r = await despachar(name, require('./tool/reparar-entrada').reparar(args, require('./tool/reparar-entrada').SCHEMAS[name]), ctx);
|
|
622
|
+
// Escreveu arquivo? O verificador mais barato da linguagem roda e o erro volta junto (lib/tool/diagnostico.js).
|
|
623
|
+
if (name === 'write_file' || name === 'edit_file' || name === 'multi_edit') {
|
|
624
|
+
return require('./tool/diagnostico').anexar(r, (ctx && ctx.projectDir) || process.cwd());
|
|
625
|
+
}
|
|
626
|
+
return r;
|
|
622
627
|
} catch (e) {
|
|
623
628
|
// Erro que sabe o que EXISTE leva a informação junto — mesma ideia do
|
|
624
629
|
// `trechosParecidos` do edit_file. Erro seco faz o modelo chutar de novo.
|
|
@@ -720,6 +725,10 @@ async function despachar(name, args, ctx) {
|
|
|
720
725
|
aoFalar: (t) => { try { process.stdout.write(require('./ui.js').c.muted(` ⎿ ${t}`) + '\n'); } catch { /* sem terminal */ } } });
|
|
721
726
|
if (kit) return kit;
|
|
722
727
|
// Dentro da cerca (lib/sandbox.js); desligada ou sem mecanismo cai no exec de sempre.
|
|
728
|
+
// em_segundo_plano: devolve um id na hora; a saída se lê com background_output e o fim chega como aviso.
|
|
729
|
+
if (args.em_segundo_plano === true || args.em_segundo_plano === 'true') {
|
|
730
|
+
return require('./fundo').iniciar(args.command, { projectDir, env: ambienteLimpo(process.env, permitidasNoShell()) });
|
|
731
|
+
}
|
|
723
732
|
const prazo = Number(args.timeout_ms) || 60000;
|
|
724
733
|
const r = await sandbox.executar(args.command, { projectDir, timeout: prazo,
|
|
725
734
|
env: ambienteLimpo(process.env, permitidasNoShell()) });
|
|
@@ -759,10 +768,20 @@ async function despachar(name, args, ctx) {
|
|
|
759
768
|
return multiEdit(args, projectDir);
|
|
760
769
|
case 'write_todos':
|
|
761
770
|
return writeTodos(args);
|
|
771
|
+
case 'agentes_buscar':
|
|
772
|
+
return require('./agentes').ferramentaBuscar(args || {});
|
|
773
|
+
case 'capacidade_buscar':
|
|
774
|
+
return require('./agentes').ferramentaCapacidade(args || {});
|
|
762
775
|
|
|
763
776
|
// Pesquisa de referência: abre documentação e exemplos sobre o
|
|
764
777
|
// pedido e devolve o TEXTO para o modelo aprender antes de
|
|
765
778
|
// escrever. Aparece no terminal, com as fontes — nada oculto.
|
|
779
|
+
case 'perguntar':
|
|
780
|
+
return require('./tool/perguntar').perguntar(args, ctx);
|
|
781
|
+
case 'buscar_web':
|
|
782
|
+
return require('./tool/web').buscarWeb(args);
|
|
783
|
+
case 'ler_url':
|
|
784
|
+
return require('./tool/web').lerUrl(args);
|
|
766
785
|
case 'pesquisar_referencia': {
|
|
767
786
|
const r = await referencia.pesquisar({
|
|
768
787
|
consulta: args.consulta || args.query || '',
|
package/lib/ui.js
CHANGED
|
@@ -547,7 +547,7 @@ const ROTULOS = {
|
|
|
547
547
|
read_file:'Read', write_file:'Write', edit_file:'Edit', multi_edit:'MultiEdit',
|
|
548
548
|
list_dir:'List', glob:'Glob', grep:'Grep', run_shell:'Bash',
|
|
549
549
|
run_in_new_terminal:'Terminal', run_background:'Fundo', background_output:'Fundo·log', stop_background:'Fundo·stop', open_in_browser:'Open', spawn_agent:'Agent',
|
|
550
|
-
write_todos:'Plano', finish:'Finish', pesquisar_referencia:'Pesquisa',
|
|
550
|
+
write_todos:'Plano', perguntar:'Pergunta', finish:'Finish', pesquisar_referencia:'Pesquisa',
|
|
551
551
|
browser_open:'Browser', browser_click:'Browser·click', browser_type:'Browser·type',
|
|
552
552
|
browser_key:'Browser·key', browser_read:'Browser·read', browser_screenshot:'Browser·shot',
|
|
553
553
|
browser_scroll:'Browser·scroll', browser_wait:'Browser·wait', browser_eval:'Browser·eval',
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Base do kit saas-linear (v2, "SaaS · produto em ação"): cores, fontes, curvas e medidas.
|
|
2
|
+
// Os elementos importam só este arquivo, 'react' e 'remotion'. Nada de fora da pasta do kit.
|
|
3
|
+
import {continueRender, delayRender} from 'remotion';
|
|
4
|
+
import serifaUrl from './fontes/newsreader-400.woff2';
|
|
5
|
+
import ui400Url from './fontes/inter-400.woff2';
|
|
6
|
+
import ui600Url from './fontes/inter-600.woff2';
|
|
7
|
+
|
|
8
|
+
// ---------- tela do vídeo ----------
|
|
9
|
+
export const LARGURA = 1080, ALTURA = 1920, FPS = 30;
|
|
10
|
+
export const SEGURA = {topo: 168, base: 1330, lado: 80};
|
|
11
|
+
|
|
12
|
+
// ---------- a tela do produto (o "monitor") ----------
|
|
13
|
+
// Todo elemento de cena se posiciona em coordenadas da TELA (0..1500 x 0..940), não do vídeo.
|
|
14
|
+
// No plano fechado (zoom 1) a tela aparece 1:1, centrada em x 540 / y 860 do vídeo:
|
|
15
|
+
// o que fica entre x 290 e 1210 da tela cabe na área útil do vídeo (80..1000).
|
|
16
|
+
export const TELA = {w: 1500, h: 940, cx: 750, cy: 470, util: {x0: 290, x1: 1210}};
|
|
17
|
+
export const CENTRO_VIDEO = {x: 540, y: 860};
|
|
18
|
+
|
|
19
|
+
// ---------- cor ----------
|
|
20
|
+
export const COR = {
|
|
21
|
+
parede: '#3B1E19', // fundo atrás do monitor (sala quente, pouca luz)
|
|
22
|
+
parede2: '#6A3426', // a luz quente que bate na parede
|
|
23
|
+
mesa: '#1E1512',
|
|
24
|
+
moldura: '#141312', // borda do monitor
|
|
25
|
+
tela: '#F4F1EA', // creme da interface
|
|
26
|
+
cartao: '#FFFFFF',
|
|
27
|
+
linha: '#E7E2D8',
|
|
28
|
+
tinta: '#29261F', // texto principal
|
|
29
|
+
mute: '#8C877C', // texto de apoio, placeholder
|
|
30
|
+
acento: '#D46F4D', // a marca (flor coral): só na marca e no botão de enviar
|
|
31
|
+
azul: '#3D7BF0', // toggle ligado, "Conectado"
|
|
32
|
+
agenda: ['#E7655A', '#F0A63A', '#3FA86C', '#4B83E6', '#E08A6C'],
|
|
33
|
+
};
|
|
34
|
+
export const SOMBRA = {
|
|
35
|
+
cartao: '0 2px 4px rgba(41,38,31,0.05), 0 18px 40px rgba(41,38,31,0.10)',
|
|
36
|
+
menu: '0 4px 10px rgba(41,38,31,0.08), 0 30px 70px rgba(41,38,31,0.16)',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// ---------- fonte ----------
|
|
40
|
+
export const FONTE_S = '"SL Newsreader", Georgia, serif';
|
|
41
|
+
export const FONTE_U = '"SL Inter", system-ui, sans-serif';
|
|
42
|
+
const LISTA = [
|
|
43
|
+
{fam: 'SL Newsreader', url: serifaUrl, peso: '400', estilo: 'normal'},
|
|
44
|
+
{fam: 'SL Inter', url: ui400Url, peso: '400', estilo: 'normal'},
|
|
45
|
+
{fam: 'SL Inter', url: ui600Url, peso: '600', estilo: 'normal'},
|
|
46
|
+
];
|
|
47
|
+
if (typeof document !== 'undefined' && !(globalThis as Record<string, unknown>).__kit_SL2) {
|
|
48
|
+
(globalThis as Record<string, unknown>).__kit_SL2 = true;
|
|
49
|
+
for (const f of LISTA) {
|
|
50
|
+
const h = delayRender('saas-linear: ' + f.fam + ' ' + f.peso);
|
|
51
|
+
new FontFace(f.fam, `url(${f.url}) format('woff2')`, {weight: f.peso, style: f.estilo}).load()
|
|
52
|
+
.then((ff) => {document.fonts.add(ff); continueRender(h);})
|
|
53
|
+
.catch(() => continueRender(h));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ---------- tempo e curva ----------
|
|
58
|
+
export const c01 = (t: number) => Math.max(0, Math.min(1, t));
|
|
59
|
+
/** progresso 0..1 de f entre a e b */
|
|
60
|
+
export const seg = (f: number, a: number, b: number) => c01((f - a) / (b - a));
|
|
61
|
+
/** curva padrão do kit: cubic-bezier(.22,1,.36,1) aproximada (saída rápida, pouso longo e preciso) */
|
|
62
|
+
export const e4 = (t: number) => 1 - Math.pow(1 - c01(t), 4);
|
|
63
|
+
/** entra e sai suave (câmera, cursor) */
|
|
64
|
+
export const e3 = (t: number) => {const x = c01(t); return x * x * (3 - 2 * x);};
|
|
65
|
+
/** overshoot pequeno, ~4% (cartões, blocos da agenda) */
|
|
66
|
+
export const eb = (t: number) => {const x = c01(t) - 1, c = 1.4; return 1 + (c + 1) * x * x * x + c * x * x;};
|
|
67
|
+
export const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
|
|
68
|
+
/** uma batida da trilha (100 bpm) em quadros */
|
|
69
|
+
export const BATIDA = 18;
|
|
70
|
+
|
|
71
|
+
// ---------- texto ----------
|
|
72
|
+
let canvas: HTMLCanvasElement | null = null;
|
|
73
|
+
export const larguraTexto = (texto: string, tamanho: number, familia = FONTE_S, peso = 400): number => {
|
|
74
|
+
if (typeof document === 'undefined') return texto.length * tamanho * 0.5;
|
|
75
|
+
canvas = canvas || document.createElement('canvas');
|
|
76
|
+
const ctx = canvas.getContext('2d'); if (!ctx) return texto.length * tamanho * 0.5;
|
|
77
|
+
ctx.font = `${peso} ${tamanho}px ${familia}`;
|
|
78
|
+
return ctx.measureText(texto).width;
|
|
79
|
+
};
|
|
80
|
+
/** o maior tamanho até `tamanho` em que o texto cabe em `largura`. Nunca palavra cortada. */
|
|
81
|
+
export const caber = (texto: string, tamanho: number, largura: number, familia = FONTE_S, peso = 400) => {
|
|
82
|
+
const w = larguraTexto(texto, tamanho, familia, peso);
|
|
83
|
+
return w > largura ? Math.floor(tamanho * (largura / w)) : tamanho;
|
|
84
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Camera: leva o monitor do plano aberto (z 0: o aparelho inteiro, em 3/4) ao plano fechado (z 1: a tela
|
|
2
|
+
// ocupa o vídeo). Entre as chaves a câmera anda devagar e com precisão; por baixo, uma deriva que não para.
|
|
3
|
+
// z acima de 1 aproxima de verdade (1.3 = tela 30% maior), pra mirar num pedaço da interface.
|
|
4
|
+
// `chaves`: [{em, z, x?, y?}] em quadros absolutos; x/y deslocam o foco em px da tela (positivo = olhar pra direita/baixo).
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import {AbsoluteFill, useCurrentFrame} from 'remotion';
|
|
7
|
+
import {CENTRO_VIDEO, e3, lerp} from '../base';
|
|
8
|
+
|
|
9
|
+
export type ChaveCamera = {em: number; z: number; x?: number; y?: number};
|
|
10
|
+
export type CameraProps = {chaves?: ChaveCamera[]; children: React.ReactNode};
|
|
11
|
+
|
|
12
|
+
export const posCamera = (f: number, chaves: ChaveCamera[]) => {
|
|
13
|
+
const ks = chaves.length ? [...chaves].sort((a, b) => a.em - b.em) : [{em: 0, z: 1}];
|
|
14
|
+
let z = ks[0].z, x = ks[0].x ?? 0, y = ks[0].y ?? 0;
|
|
15
|
+
for (let i = 0; i < ks.length - 1; i++) {
|
|
16
|
+
const a = ks[i], b = ks[i + 1];
|
|
17
|
+
if (f >= a.em) {
|
|
18
|
+
const t = e3((f - a.em) / Math.max(1, b.em - a.em));
|
|
19
|
+
z = lerp(a.z, b.z, t); x = lerp(a.x ?? 0, b.x ?? 0, t); y = lerp(a.y ?? 0, b.y ?? 0, t);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const zc = Math.min(1, z);
|
|
23
|
+
const escala = (z <= 1 ? lerp(0.58, 1, z) : z) * (1 + 0.035 * Math.sin(f / 110) + 0.00018 * f);
|
|
24
|
+
const rotY = lerp(-20, -9, zc) + 1.6 * Math.sin(f / 95);
|
|
25
|
+
const rotX = lerp(6, 2.5, zc) + 0.8 * Math.cos(f / 120);
|
|
26
|
+
const dx = Math.sin(f / 80) * 10 - x * escala, dy = Math.cos(f / 100) * 8 - y * escala + lerp(-40, 0, zc);
|
|
27
|
+
return {escala, rotY, rotX, dx, dy};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Camera: React.FC<CameraProps> = ({chaves = [], children}) => {
|
|
31
|
+
const c = posCamera(useCurrentFrame(), chaves);
|
|
32
|
+
return <AbsoluteFill style={{perspective: 2600, perspectiveOrigin: `${CENTRO_VIDEO.x}px ${CENTRO_VIDEO.y}px`}}>
|
|
33
|
+
<AbsoluteFill style={{transformOrigin: `${CENTRO_VIDEO.x}px ${CENTRO_VIDEO.y}px`,
|
|
34
|
+
transform: `translate(${c.dx}px, ${c.dy}px) rotateX(${c.rotX}deg) rotateY(${c.rotY}deg) scale(${c.escala})`}}>
|
|
35
|
+
{children}
|
|
36
|
+
</AbsoluteFill>
|
|
37
|
+
</AbsoluteFill>;
|
|
38
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2020 The Newsreader Project Authors (https://github.com/productiontype/Newsreader)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Agenda: um painel de semana que se enche sozinho. Cabeçalho, dias, linhas de hora; os blocos coloridos
|
|
2
|
+
// crescem da esquerda (overshoot pequeno) a cada `intervalo` quadros. `marcarEm` põe o check verde no bloco `marcar`.
|
|
3
|
+
// Bloco: {dia (0..), hora (0.. a partir de `horaInicial`), dur (em horas), texto, cor?}.
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import {useCurrentFrame} from 'remotion';
|
|
6
|
+
import {COR, FONTE_U, SOMBRA, TELA, e4, eb, seg} from '../base';
|
|
7
|
+
|
|
8
|
+
export type Bloco = {dia: number; hora: number; dur?: number; texto: string; cor?: string};
|
|
9
|
+
export type AgendaProps = {
|
|
10
|
+
titulo: string; subtitulo?: string; dias: string[]; horaInicial?: number; horas?: number; blocos: Bloco[];
|
|
11
|
+
x?: number; y?: number; largura?: number; altura?: number; inicio?: number; intervalo?: number; marcar?: number; marcarEm?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Agenda: React.FC<AgendaProps> = ({titulo, subtitulo, dias, horaInicial = 8, horas = 7, blocos, x = TELA.cx, y = 130, largura = 940, altura = 700, inicio = 0, intervalo = 3, marcar, marcarEm}) => {
|
|
15
|
+
const f = useCurrentFrame();
|
|
16
|
+
const p = e4(seg(f, inicio, inicio + 16));
|
|
17
|
+
const topo = 128, colH = 78, col = (largura - colH - 30) / dias.length, lin = (altura - topo - 24) / horas;
|
|
18
|
+
return <div style={{position: 'absolute', left: x - largura / 2, top: y, width: largura, height: altura, background: COR.cartao, borderRadius: 24,
|
|
19
|
+
boxShadow: SOMBRA.menu, border: `1.5px solid ${COR.linha}`, fontFamily: FONTE_U, opacity: p, transform: `translateY(${(1 - p) * 36}px) scale(${0.97 + 0.03 * p})`, overflow: 'hidden'}}>
|
|
20
|
+
<div style={{position: 'absolute', left: 30, top: 26, display: 'flex', alignItems: 'baseline', gap: 16}}>
|
|
21
|
+
<span style={{fontSize: 28, fontWeight: 600, color: COR.tinta}}>{titulo}</span>
|
|
22
|
+
{subtitulo && <span style={{fontSize: 20, color: COR.mute}}>{subtitulo}</span>}
|
|
23
|
+
</div>
|
|
24
|
+
{dias.map((d, i) => <div key={i} style={{position: 'absolute', top: 80, left: colH + i * col, width: col, textAlign: 'center', fontSize: 19, color: COR.mute,
|
|
25
|
+
opacity: seg(f, inicio + 4 + i, inicio + 10 + i)}}>{d}</div>)}
|
|
26
|
+
{Array.from({length: horas}).map((_, h) => <div key={h} style={{position: 'absolute', left: 0, right: 0, top: topo + h * lin}}>
|
|
27
|
+
<div style={{position: 'absolute', left: 22, top: -10, fontSize: 16, color: '#B4AEA2'}}>{String(horaInicial + h).padStart(2, '0')}:00</div>
|
|
28
|
+
<div style={{position: 'absolute', left: colH, right: 30, height: 1.5, background: '#F0ECE4', transform: `scaleX(${e4(seg(f, inicio + 2 + h, inicio + 16 + h))})`, transformOrigin: 'left'}} />
|
|
29
|
+
</div>)}
|
|
30
|
+
{blocos.map((b, i) => {
|
|
31
|
+
const t0 = inicio + 8 + i * intervalo;
|
|
32
|
+
const q = eb(seg(f, t0, t0 + 12));
|
|
33
|
+
const cor = b.cor ?? COR.agenda[i % COR.agenda.length];
|
|
34
|
+
const ok = marcar === i && marcarEm !== undefined ? eb(seg(f, marcarEm, marcarEm + 10)) : 0;
|
|
35
|
+
return <div key={i} style={{position: 'absolute', left: colH + b.dia * col + 6, top: topo + b.hora * lin + 5, width: col - 12, height: (b.dur ?? 1) * lin - 10,
|
|
36
|
+
background: cor, borderRadius: 10, opacity: seg(f, t0, t0 + 4), transform: `scaleX(${Math.max(0, q)})`, transformOrigin: 'left center',
|
|
37
|
+
boxShadow: `0 6px 14px color-mix(in srgb, ${cor} 35%, transparent)`, padding: '8px 12px', color: '#fff', fontSize: 17, fontWeight: 600, overflow: 'visible', whiteSpace: 'nowrap'}}>
|
|
38
|
+
<span style={{opacity: seg(f, t0 + 6, t0 + 12)}}>{b.texto}</span>
|
|
39
|
+
{ok > 0 && <div style={{position: 'absolute', right: -12, top: -12, width: 32, height: 32, borderRadius: 16, background: '#2E9E5B', border: '3px solid #fff',
|
|
40
|
+
transform: `scale(${ok})`, display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
|
|
41
|
+
<svg width="16" height="16" viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5" stroke="#fff" strokeWidth="3.4" fill="none" strokeLinecap="round" strokeLinejoin="round" /></svg>
|
|
42
|
+
</div>}
|
|
43
|
+
</div>;
|
|
44
|
+
})}
|
|
45
|
+
</div>;
|
|
46
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// CaixaPrompt: a caixa de pedido do produto. Branca, cantos 28 px, sombra macia. Placeholder cinza, botão "+"
|
|
2
|
+
// embaixo à esquerda (afunda no quadro `apertarMais`), botão de enviar coral à direita, atalhos em pílula embaixo.
|
|
3
|
+
// `digitar` + `digitarEm`: o texto entra letra a letra (1,4 quadro por letra) e troca o placeholder.
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import {useCurrentFrame} from 'remotion';
|
|
6
|
+
import {COR, FONTE_U, SOMBRA, TELA, e4, eb, seg} from '../base';
|
|
7
|
+
|
|
8
|
+
export type CaixaPromptProps = {
|
|
9
|
+
placeholder: string; digitar?: string; digitarEm?: number; atalhos?: string[];
|
|
10
|
+
x?: number; y?: number; largura?: number; inicio?: number; apertarMais?: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const CaixaPrompt: React.FC<CaixaPromptProps> = ({placeholder, digitar, digitarEm = 0, atalhos = [], x = TELA.cx, y = 470, largura = 880, inicio = 0, apertarMais}) => {
|
|
14
|
+
const f = useCurrentFrame();
|
|
15
|
+
const p = e4(seg(f, inicio, inicio + 18));
|
|
16
|
+
const n = digitar ? Math.floor(Math.max(0, f - digitarEm) / 1.4) : 0;
|
|
17
|
+
const texto = digitar && n > 0 ? digitar.slice(0, n) : '';
|
|
18
|
+
const aperto = apertarMais !== undefined ? 1 - 0.12 * Math.sin(Math.PI * seg(f, apertarMais, apertarMais + 8)) : 1;
|
|
19
|
+
const realce = apertarMais !== undefined ? seg(f, apertarMais, apertarMais + 4) : 0;
|
|
20
|
+
return <div style={{position: 'absolute', left: x - largura / 2, top: y, width: largura, opacity: p, transform: `translateY(${(1 - p) * 30}px)`, fontFamily: FONTE_U}}>
|
|
21
|
+
<div style={{background: COR.cartao, borderRadius: 28, boxShadow: SOMBRA.cartao, border: `1.5px solid ${COR.linha}`, padding: '30px 34px 24px', height: 190, position: 'relative'}}>
|
|
22
|
+
<div style={{fontSize: 30, color: texto ? COR.tinta : COR.mute, letterSpacing: '-0.005em'}}>
|
|
23
|
+
{texto || placeholder}{texto && texto.length < (digitar?.length ?? 0) && <span style={{display: 'inline-block', width: 2, height: 32, background: COR.tinta, marginLeft: 3, verticalAlign: -5}} />}
|
|
24
|
+
</div>
|
|
25
|
+
<div style={{position: 'absolute', left: 26, bottom: 22, width: 52, height: 52, borderRadius: 14, border: `1.5px solid ${COR.linha}`,
|
|
26
|
+
background: realce ? `rgba(41,38,31,${0.06 * realce})` : COR.cartao, display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
27
|
+
transform: `scale(${aperto})`, fontSize: 34, color: COR.tinta, lineHeight: 1}}>+</div>
|
|
28
|
+
<div style={{position: 'absolute', right: 26, bottom: 22, width: 52, height: 52, borderRadius: 14, background: COR.acento,
|
|
29
|
+
opacity: 0.35 + 0.65 * (texto ? 1 : 0), display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
|
|
30
|
+
<svg width="24" height="24" viewBox="0 0 24 24"><path d="M12 19V5M5 12l7-7 7 7" stroke="#fff" strokeWidth="2.6" fill="none" strokeLinecap="round" strokeLinejoin="round" /></svg>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
{atalhos.length > 0 && <div style={{display: 'flex', gap: 14, justifyContent: 'center', marginTop: 26}}>
|
|
34
|
+
{atalhos.map((a, i) => {
|
|
35
|
+
const q = eb(seg(f, inicio + 12 + i * 3, inicio + 26 + i * 3));
|
|
36
|
+
return <div key={i} style={{fontSize: 22, color: COR.mute, padding: '10px 20px', borderRadius: 999, border: `1.5px solid ${COR.linha}`,
|
|
37
|
+
background: 'rgba(255,255,255,0.6)', opacity: seg(f, inicio + 12 + i * 3, inicio + 18 + i * 3), transform: `scale(${0.9 + 0.1 * q})`}}>{a}</div>;
|
|
38
|
+
})}
|
|
39
|
+
</div>}
|
|
40
|
+
</div>;
|
|
41
|
+
};
|