create-nodebuilderjs 0.2.1 → 0.2.5

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.
Files changed (33) hide show
  1. package/index.js +10 -10
  2. package/package.json +2 -2
  3. package/template/.agents/skills/nodebuilder-charts/SKILL.md +87 -0
  4. package/template/.agents/skills/nodebuilder-drawing/SKILL.md +54 -0
  5. package/template/.agents/skills/nodebuilder-from-react/SKILL.md +69 -0
  6. package/template/.agents/skills/nodebuilder-icons/SKILL.md +53 -0
  7. package/template/.agents/skills/nodebuilder-images/SKILL.md +50 -0
  8. package/template/.agents/skills/nodebuilder-packaging/SKILL.md +37 -0
  9. package/template/.agents/skills/nodebuilder-performance/SKILL.md +40 -0
  10. package/template/.agents/skills/nodebuilder-testing/SKILL.md +97 -0
  11. package/template/.agents/skills/nodebuilder-ui/SKILL.md +282 -55
  12. package/template/AGENTS.md +30 -27
  13. package/template/README.md +18 -18
  14. package/template/src/App.tsx +16 -13
  15. package/template/src/components/Activity.tsx +24 -0
  16. package/template/src/components/Counter.tsx +24 -0
  17. package/template/src/components/Tasks.tsx +54 -0
  18. package/template/src/icons.ts +11 -0
  19. package/template/src/state.ts +50 -0
  20. package/template/test/App.test.tsx +45 -35
  21. package/template/.agents/skills/nodebuilder-desempenho/SKILL.md +0 -36
  22. package/template/.agents/skills/nodebuilder-desenho/SKILL.md +0 -54
  23. package/template/.agents/skills/nodebuilder-empacotar/SKILL.md +0 -37
  24. package/template/.agents/skills/nodebuilder-graficos/SKILL.md +0 -87
  25. package/template/.agents/skills/nodebuilder-icones/SKILL.md +0 -53
  26. package/template/.agents/skills/nodebuilder-imagens/SKILL.md +0 -50
  27. package/template/.agents/skills/nodebuilder-sem-react/SKILL.md +0 -48
  28. package/template/.agents/skills/nodebuilder-testes/SKILL.md +0 -56
  29. package/template/src/componentes/Atividade.tsx +0 -24
  30. package/template/src/componentes/Contador.tsx +0 -22
  31. package/template/src/componentes/Tarefas.tsx +0 -38
  32. package/template/src/estado.ts +0 -50
  33. package/template/src/icones.ts +0 -11
@@ -1,24 +0,0 @@
1
- import { Card, Icon, Row, Text, theme } from "@nodebuilderjs/core";
2
- import { Area, AreaChart, CartesianGrid, Legend, Line, Tooltip, YAxis } from "@nodebuilderjs/core/charts";
3
- import type { Estado } from "../estado.js";
4
- import { grafico } from "../icones.js";
5
-
6
- export function Atividade(props: { estado: Estado }) {
7
- return (
8
- <Card gap={8}>
9
- <Row gap={8} align="center" color={theme.text.secondary}>
10
- <Icon svg={grafico} size={16} />
11
- <Text bold>Atividade</Text>
12
- </Row>
13
- {/* data é um signal: o gráfico acompanha cada clique e cada tarefa. */}
14
- <AreaChart data={props.estado.historico} height={180}>
15
- <CartesianGrid vertical={false} strokeDasharray="3 3" />
16
- <YAxis />
17
- <Area dataKey="cliques" name="Cliques" type="monotone" />
18
- <Line dataKey="pendentes" name="Pendentes" stroke="#e5a50a" dot={false} />
19
- <Tooltip />
20
- <Legend />
21
- </AreaChart>
22
- </Card>
23
- );
24
- }
@@ -1,22 +0,0 @@
1
- import { Button, Card, Icon, Row, Text, theme } from "@nodebuilderjs/core";
2
- import type { Estado } from "../estado.js";
3
- import { ponteiro } from "../icones.js";
4
-
5
- export function Contador(props: { estado: Estado }) {
6
- const { cliques, clicar, zerar } = props.estado;
7
- // Só funções são reativas: `vezes` é lida pelo Text sempre que `cliques` muda.
8
- const vezes = () => `Você clicou ${cliques()} ${cliques() === 1 ? "vez" : "vezes"}`;
9
- return (
10
- <Card gap={12}>
11
- <Row gap={8} align="center" color={theme.text.secondary}>
12
- <Icon svg={ponteiro} size={16} />
13
- <Text bold>Contador</Text>
14
- </Row>
15
- <Text fontSize={20}>{vezes}</Text>
16
- <Row gap={8}>
17
- <Button label="Zerar" variant="flat" onClick={zerar} />
18
- <Button label="Clique aqui" variant="primary" onClick={clicar} />
19
- </Row>
20
- </Card>
21
- );
22
- }
@@ -1,38 +0,0 @@
1
- import { Button, Card, Checkbox, Column, For, Icon, Row, Show, Spacer, Text, TextField, createSignal, theme } from "@nodebuilderjs/core";
2
- import type { Estado } from "../estado.js";
3
- import { lista, mais } from "../icones.js";
4
-
5
- export function Tarefas(props: { estado: Estado }) {
6
- const { tarefas, pendentes, adicionar, limparConcluidas } = props.estado;
7
- const [texto, setTexto] = createSignal("");
8
- const enviar = () => adicionar(texto()) && setTexto("");
9
-
10
- return (
11
- <Card gap={12}>
12
- <Row gap={8} align="center" color={theme.text.secondary}>
13
- <Icon svg={lista} size={16} />
14
- <Text bold>Tarefas</Text>
15
- <Spacer />
16
- <Text fontSize={12}>{() => `${pendentes()} ${pendentes() === 1 ? "pendente" : "pendentes"}`}</Text>
17
- </Row>
18
- <Row gap={8}>
19
- <TextField grow={1} value={texto} onInput={setTexto} onSubmit={enviar} placeholder="Nova tarefa" />
20
- <Button variant="primary" onClick={enviar} disabled={() => !texto().trim()}>
21
- <Icon svg={mais} size={16} />
22
- <Text>Adicionar</Text>
23
- </Button>
24
- </Row>
25
- <Column gap={8}>
26
- {/* For é keyed por referência: cada tarefa mantém seu estado ao reordenar. */}
27
- <For each={tarefas} fallback={<Text color={theme.text.secondary}>Nada por aqui.</Text>}>
28
- {(t) => <Checkbox checked={t.feita} onChange={t.marcar} label={t.titulo} />}
29
- </For>
30
- </Column>
31
- <Show when={() => tarefas().some((t) => t.feita())}>
32
- <Row>
33
- <Button label="Limpar concluídas" variant="flat" onClick={limparConcluidas} />
34
- </Row>
35
- </Show>
36
- </Card>
37
- );
38
- }
@@ -1,50 +0,0 @@
1
- import { createMemo, createSignal } from "@nodebuilderjs/core";
2
-
3
- export interface Tarefa {
4
- id: number;
5
- titulo: string;
6
- feita: () => boolean;
7
- marcar: (feita: boolean) => void;
8
- }
9
-
10
- /**
11
- * O estado do app em um lugar só: signals e ações. Cada <App /> cria o seu (os testes
12
- * também), e os componentes o recebem por props.
13
- */
14
- export function criarEstado() {
15
- const [cliques, setCliques] = createSignal(0);
16
- // Um ponto por mudança, para o gráfico de atividade.
17
- const [historico, setHistorico] = createSignal<{ passo: number; cliques: number; pendentes: number }[]>([]);
18
- const [tarefas, setTarefas] = createSignal<Tarefa[]>([]);
19
- let proximoId = 1;
20
-
21
- const pendentes = createMemo(() => tarefas().filter((t) => !t.feita()).length);
22
- const registrar = () =>
23
- setHistorico((h) => [...h.slice(-29), { passo: h[h.length - 1]!.passo + 1, cliques: cliques(), pendentes: pendentes() }]);
24
-
25
- const novaTarefa = (titulo: string): Tarefa => {
26
- const [feita, setFeita] = createSignal(false);
27
- return { id: proximoId++, titulo, feita, marcar: (v) => (setFeita(v), registrar()) };
28
- };
29
- setTarefas([novaTarefa("Ler o README"), novaTarefa("Criar um componente")]);
30
- setHistorico([{ passo: 0, cliques: 0, pendentes: pendentes() }]);
31
-
32
- return {
33
- cliques,
34
- historico,
35
- tarefas,
36
- pendentes,
37
- clicar: () => (setCliques((c) => c + 1), registrar()),
38
- zerar: () => (setCliques(0), registrar()),
39
- adicionar: (titulo: string) => {
40
- const texto = titulo.trim();
41
- if (!texto) return false;
42
- setTarefas((ts) => [...ts, novaTarefa(texto)]);
43
- registrar();
44
- return true;
45
- },
46
- limparConcluidas: () => (setTarefas((ts) => ts.filter((t) => !t.feita())), registrar()),
47
- };
48
- }
49
-
50
- export type Estado = ReturnType<typeof criarEstado>;
@@ -1,11 +0,0 @@
1
- // Ícones em SVG (desenhados para este template). Para mais ícones, `bun add lucide-static`
2
- // e `import x from "lucide-static/icons/x.svg" with { type: "text" }`: veja a skill
3
- // nodebuilder-icones.
4
- const svg = (corpo: string) =>
5
- `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${corpo}</svg>`;
6
-
7
- export const brilho = svg('<path d="M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z"/><path d="M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z"/>');
8
- export const mais = svg('<path d="M12 5v14M5 12h14"/>');
9
- export const lista = svg('<path d="M9 6h11M9 12h11M9 18h11"/><circle cx="4.5" cy="6" r="1"/><circle cx="4.5" cy="12" r="1"/><circle cx="4.5" cy="18" r="1"/>');
10
- export const grafico = svg('<path d="M4 20V10M10 20V4M16 20v-7M22 20H2"/>');
11
- export const ponteiro = svg('<path d="M5 3l14 8-6 2-3 6z"/>');