forlogic-core 1.16.10 → 1.16.11

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.
@@ -29,4 +29,4 @@ lib/services/<Service>.ts → src/design-system/docs/ServicesDoc.tsx
29
29
  lib/components/layout/<comp>.tsx → src/design-system/docs/components/layout/<Comp>Doc.tsx
30
30
  ```
31
31
 
32
- Consultar `.note/memory/documentation/consolidated-components-registry.md` para componentes agrupados sob uma única doc.
32
+ Consultar `.note/memory/patterns/components-registry.md` para componentes agrupados sob uma única doc.
@@ -29,26 +29,73 @@ function copyFile(src, dest) {
29
29
  fs.copyFileSync(src, dest);
30
30
  return true;
31
31
  }
32
- function copyDirRecursive(src, dest) {
33
- if (!fs.existsSync(src)) {
34
- return 0;
35
- }
36
- let count = 0;
37
- if (!fs.existsSync(dest)) {
38
- fs.mkdirSync(dest, { recursive: true });
39
- }
40
- const entries = fs.readdirSync(src, { withFileTypes: true });
41
- for (const entry of entries) {
42
- const srcPath = path.join(src, entry.name);
43
- const destPath = path.join(dest, entry.name);
44
- if (entry.isDirectory()) {
45
- count += copyDirRecursive(srcPath, destPath);
46
- } else {
47
- fs.copyFileSync(srcPath, destPath);
48
- count++;
32
+ const README_MARKER = "<!-- managed by lib-update -->";
33
+ function generateProjectReadme(readmePath, projectName, coreVersion) {
34
+ const template = `${README_MARKER}
35
+ # ${projectName}
36
+
37
+ > Projeto baseado em [forlogic-core](https://www.npmjs.com/package/forlogic-core) v${coreVersion}
38
+
39
+ ## Setup
40
+
41
+ \`\`\`bash
42
+ # Instalar depend\xEAncias
43
+ npm install
44
+
45
+ # Rodar em desenvolvimento
46
+ npm run dev
47
+
48
+ # Build de produ\xE7\xE3o
49
+ npm run build
50
+ \`\`\`
51
+
52
+ ## Scripts Dispon\xEDveis
53
+
54
+ | Comando | Descri\xE7\xE3o |
55
+ |---------|-----------|
56
+ | \`npm run dev\` | Servidor de desenvolvimento (Vite) |
57
+ | \`npm run build\` | Build de produ\xE7\xE3o |
58
+ | \`npm run preview\` | Preview do build |
59
+ | \`npx lib-update\` | Sincronizar regras e docs do forlogic-core |
60
+
61
+ ## Documenta\xE7\xE3o
62
+
63
+ - \u{1F4D6} **Regras do projeto**: \`docs/KNOWLEDGE.md\`
64
+ - \u{1F916} **Mem\xF3rias da IA**: \`.note/memory/\`
65
+ - \u{1F3A8} **Design System**: Rota \`/ds\` no app (projeto Admin)
66
+ - \u{1F4E6} **forlogic-core**: [README no npm](https://www.npmjs.com/package/forlogic-core)
67
+
68
+ ## Conven\xE7\xF5es
69
+
70
+ - Schema Supabase: \`common\` (nunca \`public\`)
71
+ - Soft delete obrigat\xF3rio (coluna \`deleted_at\`)
72
+ - Sempre usar componentes do \`forlogic-core\` antes de criar novos
73
+ - RLS policies: nunca \`FOR DELETE\`
74
+
75
+ ---
76
+ *Gerado automaticamente por \`lib-update\`. \xDAltima sync: forlogic-core v${coreVersion}*
77
+ ${README_MARKER}`;
78
+ if (fs.existsSync(readmePath)) {
79
+ const existing = fs.readFileSync(readmePath, "utf-8");
80
+ if (existing.includes(README_MARKER)) {
81
+ const markerRegex = new RegExp(
82
+ `${README_MARKER.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}[\\s\\S]*?${README_MARKER.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`,
83
+ "m"
84
+ );
85
+ const updated2 = existing.replace(markerRegex, template);
86
+ fs.writeFileSync(readmePath, updated2, "utf-8");
87
+ return true;
49
88
  }
89
+ const updated = template + "\n\n" + existing;
90
+ fs.writeFileSync(readmePath, updated, "utf-8");
91
+ return true;
92
+ }
93
+ const destDir = path.dirname(readmePath);
94
+ if (!fs.existsSync(destDir)) {
95
+ fs.mkdirSync(destDir, { recursive: true });
50
96
  }
51
- return count;
97
+ fs.writeFileSync(readmePath, template, "utf-8");
98
+ return true;
52
99
  }
53
100
  async function syncDocs() {
54
101
  console.log("\u{1F4E5} Sincronizando regras e conven\xE7\xF5es do forlogic-core...\n");
@@ -79,15 +126,46 @@ async function syncDocs() {
79
126
  errorCount++;
80
127
  }
81
128
  }
82
- const rulesSrc = path.join(pkgPath, ".note", "memory", "rules");
83
- const rulesDest = path.join(projectRoot, ".note", "memory", "rules");
84
- if (fs.existsSync(rulesSrc)) {
85
- const filesCopied = copyDirRecursive(rulesSrc, rulesDest);
86
- console.log(`\u2705 .note/memory/rules/ (${filesCopied} arquivos)`);
129
+ const obsoleteFiles = [
130
+ "docs/DESIGN_SYSTEM.md",
131
+ "docs/COMPONENTS.md",
132
+ "docs/PATTERNS.md",
133
+ ".note/memory/rules/supabase-schema-rule.md",
134
+ ".note/memory/rules/supabase-import-rule.md",
135
+ ".note/memory/rules/lib-first-rule.md",
136
+ ".note/memory/rules/no-auto-index-rule.md",
137
+ ".note/memory/rules/no-delete-policy-rule.md",
138
+ ".note/memory/rules/no-env-modification-rule.md",
139
+ ".note/memory/rules/rls-syntax-rule.md",
140
+ ".note/memory/rules/sql-naming-rule.md",
141
+ ".note/memory/rules/i18n-import-rule.md",
142
+ ".note/memory/patterns/deprecated-patterns.md",
143
+ ".note/memory/patterns/spa-navigation-pattern.md",
144
+ ".note/memory/architecture/documentation-strategy.md",
145
+ // Pastas reestruturadas (v2 — padronização 3 pastas)
146
+ ".note/memory/rules/doc-sync-rule.md",
147
+ ".note/memory/ui/components/combo-tree.md",
148
+ ".note/memory/ui/design-system/documentation-standard.md",
149
+ ".note/memory/documentation/consolidated-components-registry.md"
150
+ ];
151
+ let cleanedCount = 0;
152
+ for (const relPath of obsoleteFiles) {
153
+ const fullPath = path.join(projectRoot, relPath);
154
+ if (fs.existsSync(fullPath)) {
155
+ fs.unlinkSync(fullPath);
156
+ console.log(`\u{1F5D1}\uFE0F ${relPath} (removido \u2014 obsoleto)`);
157
+ cleanedCount++;
158
+ }
159
+ }
160
+ if (cleanedCount > 0) {
161
+ successCount++;
162
+ }
163
+ const projectReadmePath = path.join(projectRoot, "README.md");
164
+ const projectName = path.basename(projectRoot);
165
+ const readmeGenerated = generateProjectReadme(projectReadmePath, projectName, pkgJson.version);
166
+ if (readmeGenerated) {
167
+ console.log(`\u2705 README.md (gerado/atualizado)`);
87
168
  successCount++;
88
- } else {
89
- console.warn("\u26A0\uFE0F .note/memory/rules/ \u2014 n\xE3o encontrado no pacote");
90
- errorCount++;
91
169
  }
92
170
  console.log("\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
93
171
  console.log(`\u{1F389} Sincroniza\xE7\xE3o conclu\xEDda!`);
@@ -98,8 +176,8 @@ async function syncDocs() {
98
176
  console.log("");
99
177
  if (successCount > 0) {
100
178
  console.log("\u{1F4A1} Arquivos sincronizados:");
101
- console.log(" docs/KNOWLEDGE.md \u2014 Regras cr\xEDticas + mapa de m\xF3dulos");
102
- console.log(" .note/memory/rules/ \u2014 Regras de schema, RLS, \xEDndices, .env");
179
+ console.log(" docs/KNOWLEDGE.md \u2014 Regras cr\xEDticas + mapa de m\xF3dulos (fonte \xFAnica de verdade)");
180
+ console.log(" README.md \u2014 Template com setup, scripts e links");
103
181
  console.log("");
104
182
  console.log("\u{1F4D6} Documenta\xE7\xE3o de componentes, props e padr\xF5es s\xE3o lidos");
105
183
  console.log(" diretamente do forlogic-core via cross-project.\n");
@@ -1,2 +1,2 @@
1
1
  import type { TreeNode, TreeTableProps } from './types';
2
- export declare function TreeTable<T extends TreeNode>({ data, columns, nameKey, nameHeader, iconComponent, expandedIds, onToggleExpand, onRowClick, renderActions, actionsHeader, rowActionsVariant, isLoading, emptyMessage, className, }: TreeTableProps<T>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function TreeTable<T extends TreeNode>({ data, columns, nameKey, nameHeader, iconComponent, expandedIds, onToggleExpand, onRowClick, renderActions, actionsHeader, rowActionsVariant, isLoading, emptyMessage, className, enableSelection, selectedIds: selectedIdsArray, onSelectItem, onSelectAll, isAllSelected, enableRowDrag, onMoveNode, onMoveNodes, }: TreeTableProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -98,6 +98,17 @@ export interface TreeTableProps<T extends TreeNode = TreeNode> {
98
98
  isLoading?: boolean;
99
99
  emptyMessage?: string;
100
100
  className?: string;
101
+ enableSelection?: boolean;
102
+ selectedIds?: string[];
103
+ onSelectItem?: (id: string) => void;
104
+ onSelectAll?: () => void;
105
+ isAllSelected?: boolean;
106
+ /** Habilita drag-and-drop de linhas para reordenar a hierarquia */
107
+ enableRowDrag?: boolean;
108
+ /** Callback ao mover um nó: targetId=null significa tornar raiz */
109
+ onMoveNode?: (draggedId: string, targetId: string | null) => void;
110
+ /** Callback ao mover múltiplos nós (seleção em lote): targetId=null significa tornar raiz */
111
+ onMoveNodes?: (draggedIds: string[], targetId: string | null) => void;
101
112
  }
102
113
  export interface FilterBarProps {
103
114
  searchValue?: string;
@@ -98,10 +98,12 @@ supabase.from('tabela').select('*');
98
98
 
99
99
  ## 6. Fontes de Contexto
100
100
 
101
- | Fonte | Caminho |
102
- |-------|---------|
103
- | Memory rules | `.note/memory/rules/` |
104
- | Memory patterns | `.note/memory/patterns/` |
105
- | Memory components | `.note/memory/components/` |
106
- | Código-fonte da lib | Cross-project → projeto **Admin** (forlogic-core) |
107
- | Design System (visual) | Rota `/ds` no app do projeto **Admin** |
101
+ | Fonte | Caminho | Conteúdo |
102
+ |-------|---------|----------|
103
+ | Memory components | `.note/memory/components/` | Props, variantes e exemplos de componentes |
104
+ | Memory patterns | `.note/memory/patterns/` | Layouts, setup, convenções, regras do projeto |
105
+ | Memory features | `.note/memory/features/` | Contexto de features específicas do projeto |
106
+ | Código-fonte da lib | Cross-project → projeto **Admin** (forlogic-core) | Props, tipos, implementação |
107
+ | Design System (visual) | Rota `/ds` no app do projeto **Admin** | Documentação interativa |
108
+
109
+ > ℹ️ `.note/memory/` usa 3 pastas padronizadas: `components/`, `patterns/`, `features/`. `KNOWLEDGE.md` é a fonte única de verdade para regras e convenções.