forlogic-core 1.10.2 → 1.10.3
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 +99 -0
- package/dist/README.md +99 -0
- package/dist/index.esm.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -218,6 +218,105 @@ VITE_IS_QUALIEX=true
|
|
|
218
218
|
|
|
219
219
|
---
|
|
220
220
|
|
|
221
|
+
## 🚀 Quick Setup: CoreProviders
|
|
222
|
+
|
|
223
|
+
O `CoreProviders` é um componente que encapsula todos os providers essenciais da biblioteca, simplificando drasticamente a configuração de novos projetos.
|
|
224
|
+
|
|
225
|
+
### O que está incluído
|
|
226
|
+
|
|
227
|
+
O `CoreProviders` encapsula automaticamente:
|
|
228
|
+
|
|
229
|
+
| Provider | Descrição |
|
|
230
|
+
|----------|-----------|
|
|
231
|
+
| `ErrorBoundary` | Captura e trata erros de renderização React |
|
|
232
|
+
| `I18nextProvider` | Sistema de internacionalização (i18n) |
|
|
233
|
+
| `QueryClientProvider` | Cache e gerenciamento de queries (React Query) |
|
|
234
|
+
| `AuthProvider` | Autenticação e gerenciamento de sessão |
|
|
235
|
+
| `LocaleProvider` | Gerenciamento de locale (idioma, timezone, formato de data) |
|
|
236
|
+
| `TranslationLoader` | Carregamento dinâmico de traduções do banco de dados |
|
|
237
|
+
|
|
238
|
+
### Uso Básico
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
import { CoreProviders } from 'forlogic-core';
|
|
242
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
243
|
+
|
|
244
|
+
function App() {
|
|
245
|
+
return (
|
|
246
|
+
<CoreProviders>
|
|
247
|
+
<BrowserRouter>
|
|
248
|
+
<Routes>
|
|
249
|
+
{/* Suas rotas aqui */}
|
|
250
|
+
</Routes>
|
|
251
|
+
</BrowserRouter>
|
|
252
|
+
</CoreProviders>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Com QueryClient Customizado
|
|
258
|
+
|
|
259
|
+
Se você precisar de configurações específicas para o React Query:
|
|
260
|
+
|
|
261
|
+
```tsx
|
|
262
|
+
import { CoreProviders } from 'forlogic-core';
|
|
263
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
264
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
265
|
+
|
|
266
|
+
const queryClient = new QueryClient({
|
|
267
|
+
defaultOptions: {
|
|
268
|
+
queries: {
|
|
269
|
+
staleTime: 10 * 60 * 1000, // 10 minutos
|
|
270
|
+
retry: 2,
|
|
271
|
+
refetchOnWindowFocus: false,
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
function App() {
|
|
277
|
+
return (
|
|
278
|
+
<CoreProviders queryClient={queryClient}>
|
|
279
|
+
<BrowserRouter>
|
|
280
|
+
{/* Suas rotas */}
|
|
281
|
+
</BrowserRouter>
|
|
282
|
+
</CoreProviders>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Props
|
|
288
|
+
|
|
289
|
+
| Prop | Tipo | Obrigatório | Descrição |
|
|
290
|
+
|------|------|-------------|-----------|
|
|
291
|
+
| `children` | `ReactNode` | ✅ | Componentes filhos a serem envolvidos |
|
|
292
|
+
| `queryClient` | `QueryClient` | ❌ | Instância customizada do QueryClient. Se não fornecido, um default é criado |
|
|
293
|
+
|
|
294
|
+
### QueryClient Default
|
|
295
|
+
|
|
296
|
+
Se você não fornecer um `queryClient`, o `CoreProviders` cria um com as seguintes configurações:
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
{
|
|
300
|
+
defaultOptions: {
|
|
301
|
+
queries: {
|
|
302
|
+
staleTime: 5 * 60 * 1000, // 5 minutos
|
|
303
|
+
retry: 1,
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Benefícios
|
|
310
|
+
|
|
311
|
+
- ✅ **Zero configuração de i18n** - Traduções funcionam automaticamente
|
|
312
|
+
- ✅ **Autenticação pronta** - `useAuth()` disponível em qualquer componente filho
|
|
313
|
+
- ✅ **Tratamento de erros** - ErrorBoundary captura erros de renderização
|
|
314
|
+
- ✅ **React Query configurado** - Cache e queries prontos para uso
|
|
315
|
+
- ✅ **Locale gerenciado** - Preferências de idioma, timezone e formato de data
|
|
316
|
+
- ✅ **Atualizações centralizadas** - Novos providers são adicionados automaticamente
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
221
320
|
<!-- AUTO_GENERATED_START -->
|
|
222
321
|
|
|
223
322
|
### 📚 Estatísticas da Documentação
|
package/dist/README.md
CHANGED
|
@@ -218,6 +218,105 @@ VITE_IS_QUALIEX=true
|
|
|
218
218
|
|
|
219
219
|
---
|
|
220
220
|
|
|
221
|
+
## 🚀 Quick Setup: CoreProviders
|
|
222
|
+
|
|
223
|
+
O `CoreProviders` é um componente que encapsula todos os providers essenciais da biblioteca, simplificando drasticamente a configuração de novos projetos.
|
|
224
|
+
|
|
225
|
+
### O que está incluído
|
|
226
|
+
|
|
227
|
+
O `CoreProviders` encapsula automaticamente:
|
|
228
|
+
|
|
229
|
+
| Provider | Descrição |
|
|
230
|
+
|----------|-----------|
|
|
231
|
+
| `ErrorBoundary` | Captura e trata erros de renderização React |
|
|
232
|
+
| `I18nextProvider` | Sistema de internacionalização (i18n) |
|
|
233
|
+
| `QueryClientProvider` | Cache e gerenciamento de queries (React Query) |
|
|
234
|
+
| `AuthProvider` | Autenticação e gerenciamento de sessão |
|
|
235
|
+
| `LocaleProvider` | Gerenciamento de locale (idioma, timezone, formato de data) |
|
|
236
|
+
| `TranslationLoader` | Carregamento dinâmico de traduções do banco de dados |
|
|
237
|
+
|
|
238
|
+
### Uso Básico
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
import { CoreProviders } from 'forlogic-core';
|
|
242
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
243
|
+
|
|
244
|
+
function App() {
|
|
245
|
+
return (
|
|
246
|
+
<CoreProviders>
|
|
247
|
+
<BrowserRouter>
|
|
248
|
+
<Routes>
|
|
249
|
+
{/* Suas rotas aqui */}
|
|
250
|
+
</Routes>
|
|
251
|
+
</BrowserRouter>
|
|
252
|
+
</CoreProviders>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Com QueryClient Customizado
|
|
258
|
+
|
|
259
|
+
Se você precisar de configurações específicas para o React Query:
|
|
260
|
+
|
|
261
|
+
```tsx
|
|
262
|
+
import { CoreProviders } from 'forlogic-core';
|
|
263
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
264
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
265
|
+
|
|
266
|
+
const queryClient = new QueryClient({
|
|
267
|
+
defaultOptions: {
|
|
268
|
+
queries: {
|
|
269
|
+
staleTime: 10 * 60 * 1000, // 10 minutos
|
|
270
|
+
retry: 2,
|
|
271
|
+
refetchOnWindowFocus: false,
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
function App() {
|
|
277
|
+
return (
|
|
278
|
+
<CoreProviders queryClient={queryClient}>
|
|
279
|
+
<BrowserRouter>
|
|
280
|
+
{/* Suas rotas */}
|
|
281
|
+
</BrowserRouter>
|
|
282
|
+
</CoreProviders>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Props
|
|
288
|
+
|
|
289
|
+
| Prop | Tipo | Obrigatório | Descrição |
|
|
290
|
+
|------|------|-------------|-----------|
|
|
291
|
+
| `children` | `ReactNode` | ✅ | Componentes filhos a serem envolvidos |
|
|
292
|
+
| `queryClient` | `QueryClient` | ❌ | Instância customizada do QueryClient. Se não fornecido, um default é criado |
|
|
293
|
+
|
|
294
|
+
### QueryClient Default
|
|
295
|
+
|
|
296
|
+
Se você não fornecer um `queryClient`, o `CoreProviders` cria um com as seguintes configurações:
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
{
|
|
300
|
+
defaultOptions: {
|
|
301
|
+
queries: {
|
|
302
|
+
staleTime: 5 * 60 * 1000, // 5 minutos
|
|
303
|
+
retry: 1,
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Benefícios
|
|
310
|
+
|
|
311
|
+
- ✅ **Zero configuração de i18n** - Traduções funcionam automaticamente
|
|
312
|
+
- ✅ **Autenticação pronta** - `useAuth()` disponível em qualquer componente filho
|
|
313
|
+
- ✅ **Tratamento de erros** - ErrorBoundary captura erros de renderização
|
|
314
|
+
- ✅ **React Query configurado** - Cache e queries prontos para uso
|
|
315
|
+
- ✅ **Locale gerenciado** - Preferências de idioma, timezone e formato de data
|
|
316
|
+
- ✅ **Atualizações centralizadas** - Novos providers são adicionados automaticamente
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
221
320
|
<!-- AUTO_GENERATED_START -->
|
|
222
321
|
|
|
223
322
|
### 📚 Estatísticas da Documentação
|