@praxisui/core 1.0.0-beta.30 → 1.0.0-beta.40

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 CHANGED
@@ -115,6 +115,99 @@ Observação: os IDs de widgets usados na página devem estar registrados via `C
115
115
  [`public-api.ts`](https://github.com/codexrodrigues/praxis/blob/main/frontend-libs/praxis-ui-workspace/projects/praxis-core/src/public-api.ts)
116
116
  para a lista consolidada de serviços, tokens, modelos e utilitários disponíveis para importação.
117
117
 
118
+ ## ⚙️ Global Config (bootstrap)
119
+
120
+ - Use `provideGlobalConfigTenant(...)` para definir o tenant e bloquear o bootstrap até a config remota ser carregada.
121
+ - Se não houver tenant, use `provideGlobalConfigReady()` para apenas aguardar o carregamento remoto.
122
+
123
+ ## 🌐 Global Actions (shell + widgets)
124
+
125
+ O core agora suporta **ações globais** executadas por widgets e pelo Widget Shell, permitindo integrar navegação, dialog, toast, analytics, API e rotas dinâmicas de forma padronizada.
126
+
127
+ ### 1) Providers (plug-and-play no host)
128
+
129
+ ```ts
130
+ import {
131
+ providePraxisGlobalActions,
132
+ providePraxisToastGlobalActions,
133
+ providePraxisAnalyticsGlobalActions,
134
+ } from '@praxisui/core';
135
+ import { providePraxisDialogGlobalActions } from '@praxisui/dialog';
136
+
137
+ providers: [
138
+ ...providePraxisGlobalActions({ dialog: false, toast: false, analytics: false }),
139
+ providePraxisDialogGlobalActions(),
140
+ providePraxisToastGlobalActions(),
141
+ providePraxisAnalyticsGlobalActions({ prefix: 'app' }),
142
+ ]
143
+ ```
144
+
145
+ ### 2) Mapeando outputs para ações globais
146
+
147
+ `WidgetDefinition.outputs` pode apontar para ações globais:
148
+
149
+ ```ts
150
+ definition: {
151
+ id: 'praxis-dynamic-form',
152
+ outputs: {
153
+ formSubmit: {
154
+ type: 'api.post',
155
+ params: { url: '/api/clientes', body: '${payload.formData}' }
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ ### 3) Ação global no Widget Shell
162
+
163
+ ```ts
164
+ shell: {
165
+ actions: [
166
+ { id: 'back', icon: 'arrow_back', command: 'global:navigation.back' }
167
+ ]
168
+ }
169
+ ```
170
+
171
+ ### 4) Catálogo básico de ações globais
172
+
173
+ - `navigation.back`
174
+ - `navigation.openExternal` → `{ url }`
175
+ - `dialog.alert` → `{ title, message, variant }`
176
+ - `dialog.prompt` → `{ title, message, placeholder, defaultValue }`
177
+ - `dialog.open` → `{ componentId, inputs, size, data }`
178
+ - `toast.success` / `toast.error` → `{ message }`
179
+ - `clipboard.copy` → `{ text }`
180
+ - `trackEvent` → `{ eventName, payload }`
181
+ - `log` → `{ level, message, payload }`
182
+ - `api.get` / `api.post` / `api.patch` → `{ url, params|body }`
183
+ - `route.register` → `{ path, componentId|loadChildren, data?, resolve?, guards?, canMatch?, canActivateChild?, replace?, position? }`
184
+
185
+ ### 5) Rotas dinâmicas (route.register)
186
+
187
+ Requer `componentId` **ou** `loadChildren`. Guards são resolvidos pelo host via `GLOBAL_ROUTE_GUARD_RESOLVER`.
188
+
189
+ ```ts
190
+ // payload
191
+ {
192
+ path: '/clientes/novo',
193
+ componentId: 'praxis-dynamic-page',
194
+ data: { pageId: 'clientes-novo' },
195
+ guards: ['auth', 'permission:clientes.create'],
196
+ position: 'before-wildcard'
197
+ }
198
+ ```
199
+
200
+ As rotas registradas são persistidas em `GlobalConfig.routes.dynamic`. O host deve re‑hidratar isso no bootstrap (ex.: ler `GlobalConfigService` e re‑aplicar com `route.register`).
201
+
202
+ ### 7) Output mapeado para ação global x conexões
203
+
204
+ Quando `WidgetDefinition.outputs[output]` aponta para uma ação global (não `'emit'`), o evento **não** é repassado para conexões locais — a ação global tem prioridade.
205
+
206
+ ### 6) Estilo de toast
207
+
208
+ O estilo padrão usa as classes `.pdx-toast-success` / `.pdx-toast-error`.
209
+ Inclua estilos equivalentes no app host (ou sobrescreva com `providePraxisToastGlobalActions`).
210
+
118
211
  ## 🔎 Schema Viewer (para Showcases)
119
212
 
120
213
  Para exibir os metadados e schemas usados por um exemplo (ex.: na aba “Schema” de um showcase), use o componente `SchemaViewerComponent` e (opcionalmente) injete o contexto via `SCHEMA_VIEWER_CONTEXT`.
@@ -130,7 +223,7 @@ import { SchemaViewerComponent, SCHEMA_VIEWER_CONTEXT } from '@praxisui/core';
130
223
  imports: [PraxisTabs, SchemaViewerComponent],
131
224
  template: `
132
225
  <!-- Aba Preview -->
133
- <praxis-tabs [config]="tabs"></praxis-tabs>
226
+ <praxis-tabs [config]="tabs" tabsId="tabs-preview"></praxis-tabs>
134
227
 
135
228
  <!-- Aba Schema -->
136
229
  <praxis-schema-viewer [context]="schemaCtx"></praxis-schema-viewer>