eny-ai 1.0.0 → 2.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/V2_README.md +414 -0
- package/dist/chunk-2NUS77CI.js +195 -0
- package/dist/chunk-5KPALVCK.js +280 -0
- package/dist/{chunk-2WFUL4XJ.js → chunk-5PZUUNHS.js} +717 -751
- package/dist/{chunk-E4KJZEXX.js → chunk-AJH2I5ZI.js} +5 -0
- package/dist/chunk-LVJ3GJRQ.js +360 -0
- package/dist/{chunk-PNKVD2UK.js → chunk-MXA7TAAG.js} +11 -1
- package/dist/cli.js +5 -4
- package/dist/firebase.cjs +296 -0
- package/dist/firebase.d.cts +136 -0
- package/dist/firebase.d.ts +136 -0
- package/dist/firebase.js +17 -0
- package/dist/hooks.cjs +236 -0
- package/dist/hooks.d.cts +184 -0
- package/dist/hooks.d.ts +184 -0
- package/dist/hooks.js +31 -0
- package/dist/index.cjs +1622 -1092
- package/dist/index.d.cts +16 -195
- package/dist/index.d.ts +16 -195
- package/dist/index.js +68 -262
- package/dist/runtime.cjs +366 -0
- package/dist/runtime.d.cts +229 -0
- package/dist/runtime.d.ts +229 -0
- package/dist/runtime.js +25 -0
- package/dist/symbols.js +2 -2
- package/examples/app-simbolico-completo.tsx +249 -0
- package/examples/nextjs-integration.tsx +446 -0
- package/examples/v2-demo.tsx +377 -0
- package/package.json +23 -11
- package/dist/react/index.cjs +0 -342
- package/dist/react/index.d.cts +0 -751
- package/dist/react/index.d.ts +0 -751
- package/dist/react/index.js +0 -284
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚀 ENY-AI v2.0 - DEMO COMPLETO
|
|
3
|
+
* Aplicação 90% SIMBÓLICA rodando SEM BUILD
|
|
4
|
+
*
|
|
5
|
+
* Importa diretamente: import { Σ, ⚡, 🔑, ☐, ... } from 'eny-ai'
|
|
6
|
+
* Sem transpilação! Sem build! Apenas execute!
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import {
|
|
11
|
+
// Estado
|
|
12
|
+
Σ,
|
|
13
|
+
// Efeitos
|
|
14
|
+
⚡,
|
|
15
|
+
// HTTP
|
|
16
|
+
⇄,
|
|
17
|
+
// Armazenamento
|
|
18
|
+
𝓜,
|
|
19
|
+
// Componentes
|
|
20
|
+
☐,
|
|
21
|
+
// Navegação
|
|
22
|
+
🧭,
|
|
23
|
+
// Logging
|
|
24
|
+
📜,
|
|
25
|
+
// Memoização
|
|
26
|
+
λ⁺,
|
|
27
|
+
// Callbacks
|
|
28
|
+
λ⇄,
|
|
29
|
+
// Validação
|
|
30
|
+
🛡,
|
|
31
|
+
// Firebase
|
|
32
|
+
firebase,
|
|
33
|
+
// React Hooks
|
|
34
|
+
useAuth,
|
|
35
|
+
useRealtimeData
|
|
36
|
+
} from 'eny-ai';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 🎯 Componente Principal - TODO App 90% Simbólico
|
|
40
|
+
*/
|
|
41
|
+
export function EnhancedTODOApp() {
|
|
42
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
43
|
+
// ESTADO SIMBÓLICO
|
|
44
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
45
|
+
|
|
46
|
+
// Σ: Estado reativo (useState simbólico)
|
|
47
|
+
const [todos, setTodos] = Σ<{ id: string; text: string; done: boolean }[]>([]);
|
|
48
|
+
const [input, setInput] = Σ('');
|
|
49
|
+
const [filter, setFilter] = Σ<'all' | 'active' | 'done'>('all');
|
|
50
|
+
|
|
51
|
+
// 👤: Usuário autenticado
|
|
52
|
+
const user = firebase.👤;
|
|
53
|
+
const [showAuth, setShowAuth] = Σ(false);
|
|
54
|
+
const [email, setEmail] = Σ('');
|
|
55
|
+
const [password, setPassword] = Σ('');
|
|
56
|
+
|
|
57
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
58
|
+
// EFEITOS SIMBÓLICOS
|
|
59
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
60
|
+
|
|
61
|
+
// ⚡: Carregar dados ao montar
|
|
62
|
+
⚡(() => {
|
|
63
|
+
console.log('📜 App inicializado');
|
|
64
|
+
const saved = 𝓜.get('todos');
|
|
65
|
+
if (saved) {
|
|
66
|
+
setTodos(JSON.parse(saved));
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
// 📡: Observar dados em tempo real
|
|
71
|
+
const { data: realtimeTodos } = useRealtimeData(`users/${user?.uid}/todos`);
|
|
72
|
+
|
|
73
|
+
⚡(() => {
|
|
74
|
+
if (realtimeTodos) {
|
|
75
|
+
setTodos(realtimeTodos);
|
|
76
|
+
}
|
|
77
|
+
}, [realtimeTodos]);
|
|
78
|
+
|
|
79
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
80
|
+
// FUNÇÕES SIMBÓLICAS
|
|
81
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
82
|
+
|
|
83
|
+
// ➕ Adicionar TODO
|
|
84
|
+
const handleAddTodo = λ⇄(async () => {
|
|
85
|
+
if (!input.trim()) {
|
|
86
|
+
📜.warn('❌ Input vazio');
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const newTodo = {
|
|
91
|
+
id: Date.now().toString(),
|
|
92
|
+
text: input,
|
|
93
|
+
done: false
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const updated = [...todos, newTodo];
|
|
97
|
+
setTodos(updated);
|
|
98
|
+
setInput('');
|
|
99
|
+
|
|
100
|
+
// 💾 Salvar
|
|
101
|
+
𝓜.set('todos', JSON.stringify(updated));
|
|
102
|
+
|
|
103
|
+
// 📊 Sync Firebase se autenticado
|
|
104
|
+
if (user) {
|
|
105
|
+
await firebase.📊(`users/${user.uid}/todos/${newTodo.id}`, newTodo);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
📜.info(`✅ TODO adicionado: "${newTodo.text}"`);
|
|
109
|
+
}, [todos, input, user]);
|
|
110
|
+
|
|
111
|
+
// ✏️ Toggle TODO
|
|
112
|
+
const toggleTodo = (id: string) => {
|
|
113
|
+
const updated = todos.map(t =>
|
|
114
|
+
t.id === id ? { ...t, done: !t.done } : t
|
|
115
|
+
);
|
|
116
|
+
setTodos(updated);
|
|
117
|
+
𝓜.set('todos', JSON.stringify(updated));
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// 🗑️ Deletar TODO
|
|
121
|
+
const deleteTodo = async (id: string) => {
|
|
122
|
+
const updated = todos.filter(t => t.id !== id);
|
|
123
|
+
setTodos(updated);
|
|
124
|
+
𝓜.set('todos', JSON.stringify(updated));
|
|
125
|
+
|
|
126
|
+
if (user) {
|
|
127
|
+
await firebase.🗑️(`users/${user.uid}/todos/${id}`);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// 🔐 Login
|
|
132
|
+
const handleLogin = async () => {
|
|
133
|
+
try {
|
|
134
|
+
🛡.email(email); // Validar email
|
|
135
|
+
const result = await firebase.🔑(email, password);
|
|
136
|
+
|
|
137
|
+
if (result.success) {
|
|
138
|
+
📜.info('✅ Login bem-sucedido!');
|
|
139
|
+
setShowAuth(false);
|
|
140
|
+
setEmail('');
|
|
141
|
+
setPassword('');
|
|
142
|
+
}
|
|
143
|
+
} catch (error) {
|
|
144
|
+
📜.error(`❌ Erro: ${error}`);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// 🚪 Logout
|
|
149
|
+
const handleLogout = async () => {
|
|
150
|
+
await firebase.🚪();
|
|
151
|
+
setTodos([]);
|
|
152
|
+
📜.info('👋 Desconectado');
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
156
|
+
// COMPUTAÇÃO MEMOIZADA
|
|
157
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
158
|
+
|
|
159
|
+
// λ⁺: Memoizar computação
|
|
160
|
+
const filtered = λ⁺(() => {
|
|
161
|
+
switch (filter) {
|
|
162
|
+
case 'active':
|
|
163
|
+
return todos.filter(t => !t.done);
|
|
164
|
+
case 'done':
|
|
165
|
+
return todos.filter(t => t.done);
|
|
166
|
+
default:
|
|
167
|
+
return todos;
|
|
168
|
+
}
|
|
169
|
+
}, [todos, filter]);
|
|
170
|
+
|
|
171
|
+
const stats = λ⁺(() => ({
|
|
172
|
+
total: todos.length,
|
|
173
|
+
done: todos.filter(t => t.done).length,
|
|
174
|
+
active: todos.filter(t => !t.done).length,
|
|
175
|
+
percentage: todos.length ? Math.round((todos.filter(t => t.done).length / todos.length) * 100) : 0
|
|
176
|
+
}), [todos]);
|
|
177
|
+
|
|
178
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
179
|
+
// RENDERIZAÇÃO - 90% SIMBÓLICO
|
|
180
|
+
// ═════════════════════════════════════════════════════════════════════
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
☐.card({
|
|
184
|
+
className: 'max-w-2xl mx-auto p-6',
|
|
185
|
+
children: (
|
|
186
|
+
<>
|
|
187
|
+
{/* 🎯 HEADER */}
|
|
188
|
+
<☐.h1>📋 ENY-AI v2.0 TODO App</☐.h1>
|
|
189
|
+
<☐.text({ size: 'sm', children: '90% Simbólico • Zero Build • Runtime Execution' }) />
|
|
190
|
+
|
|
191
|
+
{/* 👤 AUTH STATUS */}
|
|
192
|
+
<div className='mt-4 p-3 bg-blue-50 rounded'>
|
|
193
|
+
{user ? (
|
|
194
|
+
<>
|
|
195
|
+
<☐.text>✅ Autenticado como: <strong>{user.email}</strong></☐.text>
|
|
196
|
+
<☐.btn({
|
|
197
|
+
onClick: handleLogout,
|
|
198
|
+
type: 'secondary',
|
|
199
|
+
children: '🚪 Logout',
|
|
200
|
+
className: 'mt-2'
|
|
201
|
+
})}
|
|
202
|
+
</>
|
|
203
|
+
) : (
|
|
204
|
+
<>
|
|
205
|
+
<☐.text>❌ Não autenticado</☐.text>
|
|
206
|
+
<☐.btn({
|
|
207
|
+
onClick: () => setShowAuth(true),
|
|
208
|
+
type: 'primary',
|
|
209
|
+
children: '🔐 Login',
|
|
210
|
+
className: 'mt-2'
|
|
211
|
+
})}
|
|
212
|
+
</>
|
|
213
|
+
)}
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
{/* 🔐 AUTH MODAL */}
|
|
217
|
+
{showAuth && (
|
|
218
|
+
☐.modal({
|
|
219
|
+
isOpen: showAuth,
|
|
220
|
+
onClose: () => setShowAuth(false),
|
|
221
|
+
title: '🔑 Login',
|
|
222
|
+
children: (
|
|
223
|
+
<div className='space-y-3'>
|
|
224
|
+
<☐.input({
|
|
225
|
+
type: 'email',
|
|
226
|
+
placeholder: 'seu@email.com',
|
|
227
|
+
value: email,
|
|
228
|
+
onChange: (e) => setEmail(e.target.value)
|
|
229
|
+
})}
|
|
230
|
+
<☐.input({
|
|
231
|
+
type: 'password',
|
|
232
|
+
placeholder: 'Senha',
|
|
233
|
+
value: password,
|
|
234
|
+
onChange: (e) => setPassword(e.target.value)
|
|
235
|
+
})}
|
|
236
|
+
<☐.btn({
|
|
237
|
+
onClick: handleLogin,
|
|
238
|
+
type: 'primary',
|
|
239
|
+
children: '✅ Entrar'
|
|
240
|
+
})}
|
|
241
|
+
</div>
|
|
242
|
+
)
|
|
243
|
+
})
|
|
244
|
+
)}
|
|
245
|
+
|
|
246
|
+
{/* 📊 STATS */}
|
|
247
|
+
<div className='mt-6 grid grid-cols-3 gap-2'>
|
|
248
|
+
<☐.card({ children: (
|
|
249
|
+
<div className='text-center'>
|
|
250
|
+
<☐.h2>{stats.total}</☐.h2>
|
|
251
|
+
<☐.text>Total</☐.text>
|
|
252
|
+
</div>
|
|
253
|
+
)}) }
|
|
254
|
+
<☐.card({ children: (
|
|
255
|
+
<div className='text-center'>
|
|
256
|
+
<☐.h2>{stats.active}</☐.h2>
|
|
257
|
+
<☐.text>Ativas</☐.text>
|
|
258
|
+
</div>
|
|
259
|
+
)}) }
|
|
260
|
+
<☐.card({ children: (
|
|
261
|
+
<div className='text-center'>
|
|
262
|
+
<☐.h2>{stats.percentage}%</☐.h2>
|
|
263
|
+
<☐.text>Concluído</☐.text>
|
|
264
|
+
</div>
|
|
265
|
+
)}) }
|
|
266
|
+
</div>
|
|
267
|
+
|
|
268
|
+
{/* ➕ INPUT */}
|
|
269
|
+
<div className='mt-6 flex gap-2'>
|
|
270
|
+
<☐.input({
|
|
271
|
+
placeholder: 'Adicione um TODO...',
|
|
272
|
+
value: input,
|
|
273
|
+
onChange: (e) => setInput(e.target.value),
|
|
274
|
+
className: 'flex-1'
|
|
275
|
+
})}
|
|
276
|
+
<☐.btn({
|
|
277
|
+
onClick: handleAddTodo,
|
|
278
|
+
type: 'primary',
|
|
279
|
+
children: '➕ Adicionar'
|
|
280
|
+
})}
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
{/* 🎨 FILTROS */}
|
|
284
|
+
<div className='mt-4 flex gap-2'>
|
|
285
|
+
{(['all', 'active', 'done'] as const).map(f => (
|
|
286
|
+
<☐.btn({
|
|
287
|
+
key: f,
|
|
288
|
+
onClick: () => setFilter(f),
|
|
289
|
+
type: filter === f ? 'primary' : 'secondary',
|
|
290
|
+
children: {
|
|
291
|
+
all: '📋 Todos',
|
|
292
|
+
active: '⚡ Ativas',
|
|
293
|
+
done: '✅ Concluídas'
|
|
294
|
+
}[f]
|
|
295
|
+
})}
|
|
296
|
+
))}
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
{/* 📝 LISTA TODO */}
|
|
300
|
+
<div className='mt-6 space-y-2'>
|
|
301
|
+
{filtered.length === 0 ? (
|
|
302
|
+
<☐.text>Nenhum TODO para mostrar 🎉</☐.text>
|
|
303
|
+
) : (
|
|
304
|
+
filtered.map(todo => (
|
|
305
|
+
<☐.card({
|
|
306
|
+
key: todo.id,
|
|
307
|
+
className: `flex items-center justify-between p-3 ${todo.done ? 'opacity-50' : ''}`,
|
|
308
|
+
children: (
|
|
309
|
+
<>
|
|
310
|
+
<div className='flex items-center gap-3'>
|
|
311
|
+
<input
|
|
312
|
+
type='checkbox'
|
|
313
|
+
checked={todo.done}
|
|
314
|
+
onChange={() => toggleTodo(todo.id)}
|
|
315
|
+
className='w-5 h-5'
|
|
316
|
+
/>
|
|
317
|
+
<span className={todo.done ? 'line-through' : ''}>
|
|
318
|
+
{todo.text}
|
|
319
|
+
</span>
|
|
320
|
+
</div>
|
|
321
|
+
<☐.btn({
|
|
322
|
+
onClick: () => deleteTodo(todo.id),
|
|
323
|
+
type: 'danger',
|
|
324
|
+
children: '🗑️'
|
|
325
|
+
})}
|
|
326
|
+
</>
|
|
327
|
+
)
|
|
328
|
+
})}
|
|
329
|
+
))
|
|
330
|
+
)}
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
{/* 📜 LOG */}
|
|
334
|
+
<div className='mt-8 p-4 bg-gray-100 rounded text-xs font-mono'>
|
|
335
|
+
<☐.h3>📜 Console</☐.h3>
|
|
336
|
+
<☐.text>
|
|
337
|
+
Abra DevTools (F12) para ver logs completos
|
|
338
|
+
</☐.text>
|
|
339
|
+
</div>
|
|
340
|
+
</>
|
|
341
|
+
)
|
|
342
|
+
})
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* 📱 WRAPPER PARA DESENVOLVIMENTO
|
|
348
|
+
*/
|
|
349
|
+
export default function AppWrapper() {
|
|
350
|
+
return (
|
|
351
|
+
<div className='min-h-screen bg-gradient-to-br from-blue-50 to-purple-50 p-4'>
|
|
352
|
+
<EnhancedTODOApp />
|
|
353
|
+
</div>
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
358
|
+
// 🎓 USO DOS SÍMBOLOS:
|
|
359
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
360
|
+
/*
|
|
361
|
+
Σ = Estado reativo (useState)
|
|
362
|
+
⚡ = Efeitos colaterais (useEffect)
|
|
363
|
+
⇄ = HTTP fetch async
|
|
364
|
+
𝓜 = Armazenamento persistente (localStorage)
|
|
365
|
+
☐ = Componentes UI (card, btn, input, modal, etc)
|
|
366
|
+
🧭 = Navegação
|
|
367
|
+
📜 = Logging
|
|
368
|
+
λ⁺ = Memoização (useMemo)
|
|
369
|
+
λ⇄ = Callbacks memoizados (useCallback)
|
|
370
|
+
🛡 = Validação
|
|
371
|
+
🔑 = Firebase Login
|
|
372
|
+
🚪 = Firebase Logout
|
|
373
|
+
📊 = Firebase Escrever dados
|
|
374
|
+
🗑️ = Firebase Deletar dados
|
|
375
|
+
📡 = Firebase Observar dados
|
|
376
|
+
👤 = Usuário autenticado
|
|
377
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eny-ai",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "🧠 AI
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "🧠 ENY-AI v2.0 — Runtime Simbólico Universal. Código 90% simbólico. Zero Build necessário. React + Firebase + Next.js. Σ = Sigma (estado), 🔐 = Login, 🃏 = Card. Executa símbolos direto sem compilação!",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -12,9 +12,19 @@
|
|
|
12
12
|
"require": "./dist/index.cjs"
|
|
13
13
|
},
|
|
14
14
|
"./react": {
|
|
15
|
-
"types": "./dist/react/
|
|
16
|
-
"import": "./dist/react/
|
|
17
|
-
"require": "./dist/react/
|
|
15
|
+
"types": "./dist/react/hooks.d.ts",
|
|
16
|
+
"import": "./dist/react/hooks.js",
|
|
17
|
+
"require": "./dist/react/hooks.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./firebase": {
|
|
20
|
+
"types": "./dist/firebase/index.d.ts",
|
|
21
|
+
"import": "./dist/firebase/index.js",
|
|
22
|
+
"require": "./dist/firebase/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./runtime": {
|
|
25
|
+
"types": "./dist/runtime.d.ts",
|
|
26
|
+
"import": "./dist/runtime.js",
|
|
27
|
+
"require": "./dist/runtime.cjs"
|
|
18
28
|
},
|
|
19
29
|
"./symbols": {
|
|
20
30
|
"types": "./dist/symbols.d.ts",
|
|
@@ -22,15 +32,15 @@
|
|
|
22
32
|
"require": "./dist/symbols.cjs"
|
|
23
33
|
}
|
|
24
34
|
},
|
|
25
|
-
"files": ["dist", "README.md", "examples", "master.mid.ai"],
|
|
35
|
+
"files": ["dist", "README.md", "V2_README.md", "examples", "master.mid.ai"],
|
|
26
36
|
"bin": {
|
|
27
37
|
"eny": "dist/cli.cjs",
|
|
28
38
|
"eny-ai": "dist/cli.cjs"
|
|
29
39
|
},
|
|
30
40
|
"scripts": {
|
|
31
|
-
"build": "tsup
|
|
32
|
-
"build:watch": "tsup
|
|
33
|
-
"dev": "tsup
|
|
41
|
+
"build": "tsup",
|
|
42
|
+
"build:watch": "tsup --watch",
|
|
43
|
+
"dev": "tsup --watch",
|
|
34
44
|
"test": "vitest",
|
|
35
45
|
"lint": "eslint . --ext .ts,.tsx",
|
|
36
46
|
"prepublishOnly": "npm run build && npm test",
|
|
@@ -52,11 +62,13 @@
|
|
|
52
62
|
"engines": { "node": ">=18" },
|
|
53
63
|
"peerDependencies": {
|
|
54
64
|
"react": ">=17",
|
|
55
|
-
"react-dom": ">=17"
|
|
65
|
+
"react-dom": ">=17",
|
|
66
|
+
"firebase": ">=9"
|
|
56
67
|
},
|
|
57
68
|
"peerDependenciesMeta": {
|
|
58
69
|
"react": { "optional": true },
|
|
59
|
-
"react-dom": { "optional": true }
|
|
70
|
+
"react-dom": { "optional": true },
|
|
71
|
+
"firebase": { "optional": true }
|
|
60
72
|
},
|
|
61
73
|
"devDependencies": {
|
|
62
74
|
"@types/node": "^20.0.0",
|