@praxisui/page-builder 7.0.0-beta.0 → 8.0.0-beta.1
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 +70 -0
- package/fesm2022/praxisui-page-builder.mjs +1755 -18
- package/index.d.ts +247 -33
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ Peer dependencies (Angular v20):
|
|
|
28
28
|
- `@angular/forms` `^20.0.0`
|
|
29
29
|
- `@angular/cdk` `^20.0.0`
|
|
30
30
|
- `@angular/material` `^20.0.0`
|
|
31
|
+
- `@praxisui/ai` `*`
|
|
31
32
|
- `@praxisui/core` `*`
|
|
32
33
|
- `@praxisui/settings-panel` `*`
|
|
33
34
|
|
|
@@ -53,6 +54,7 @@ import { bootstrapApplication } from '@angular/platform-browser';
|
|
|
53
54
|
import { PAGE_BUILDER_WIDGET_AI_CATALOGS, providePageBuilderWidgetAiCatalogs } from '@praxisui/page-builder';
|
|
54
55
|
import { TABLE_AI_CAPABILITIES } from '@praxisui/table';
|
|
55
56
|
import { CRUD_AI_CAPABILITIES } from '@praxisui/crud';
|
|
57
|
+
import { RICH_CONTENT_AI_CAPABILITIES } from '@praxisui/rich-content';
|
|
56
58
|
import { AppComponent } from './app/app.component';
|
|
57
59
|
|
|
58
60
|
bootstrapApplication(AppComponent, {
|
|
@@ -62,6 +64,7 @@ bootstrapApplication(AppComponent, {
|
|
|
62
64
|
useValue: {
|
|
63
65
|
'praxis-table': TABLE_AI_CAPABILITIES,
|
|
64
66
|
'praxis-crud': CRUD_AI_CAPABILITIES,
|
|
67
|
+
'praxis-rich-content': RICH_CONTENT_AI_CAPABILITIES,
|
|
65
68
|
},
|
|
66
69
|
},
|
|
67
70
|
providePageBuilderWidgetAiCatalogs(),
|
|
@@ -75,16 +78,53 @@ Registro manual (util para apps que precisam customizar o mapa):
|
|
|
75
78
|
import { registerWidgetAiCatalogs } from '@praxisui/page-builder';
|
|
76
79
|
import { TABLE_AI_CAPABILITIES } from '@praxisui/table';
|
|
77
80
|
import { CRUD_AI_CAPABILITIES } from '@praxisui/crud';
|
|
81
|
+
import { RICH_CONTENT_AI_CAPABILITIES } from '@praxisui/rich-content';
|
|
78
82
|
|
|
79
83
|
registerWidgetAiCatalogs({
|
|
80
84
|
'praxis-table': TABLE_AI_CAPABILITIES,
|
|
81
85
|
'praxis-crud': CRUD_AI_CAPABILITIES,
|
|
86
|
+
'praxis-rich-content': RICH_CONTENT_AI_CAPABILITIES,
|
|
82
87
|
});
|
|
83
88
|
```
|
|
84
89
|
|
|
85
90
|
Registro via token:
|
|
86
91
|
- Use o InjectionToken `PAGE_BUILDER_WIDGET_AI_CATALOGS` para fornecer o mapa no host.
|
|
87
92
|
|
|
93
|
+
## Agentic Authoring
|
|
94
|
+
|
|
95
|
+
Para gerar uma página a partir de um prompt usando o backend canônico do `praxis-config-starter`, configure `PageBuilderAgenticAuthoringService` com o endpoint interno opt-in `/api/praxis/config/ai/authoring`.
|
|
96
|
+
|
|
97
|
+
O chrome conversacional do assistente usa `PraxisAiAssistantShellComponent` de `@praxisui/ai`. O Page Builder continua dono da semântica agentic de página: resolução de intenção, preview, apply, save, reopen e compilação do plano validado para `WidgetPageDefinition`.
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { PAGE_BUILDER_AGENTIC_AUTHORING_OPTIONS } from '@praxisui/page-builder';
|
|
101
|
+
|
|
102
|
+
providers: [
|
|
103
|
+
{
|
|
104
|
+
provide: PAGE_BUILDER_AGENTIC_AUTHORING_OPTIONS,
|
|
105
|
+
useValue: {
|
|
106
|
+
baseUrl: '/api/praxis/config/ai/authoring',
|
|
107
|
+
headersFactory: () => ({
|
|
108
|
+
'X-Tenant-ID': tenantId,
|
|
109
|
+
'X-User-ID': userId,
|
|
110
|
+
'X-Env': 'local',
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Fluxo canônico:
|
|
118
|
+
|
|
119
|
+
- `resolveIntent` envia prompt, pagina atual e widget selecionado para resolver operacao, recurso, schema, surface e elegibilidade.
|
|
120
|
+
- `previewPage` envia o prompt junto de `intentResolution` elegivel e recebe `MinimalFormPlan` + `CompiledFormPatch`.
|
|
121
|
+
- `resolveIntent` e `previewPage` tambem aceitam `sessionId`, `clientTurnId`, `conversationMessages`, `pendingClarification` e `attachmentSummaries` para que respostas curtas e contexto anexado continuem o turno sem reescrever o prompt no frontend.
|
|
122
|
+
- `attachmentSummaries` deve conter apenas metadados serializaveis (`id`, `name`, `kind`, `mimeType`, `sizeBytes`, `source`, `hasPreview`). O frontend nao envia `File`, bytes, base64 nem URLs locais `blob:`. Quando uma pergunta de clarificacao nasce de um turno com anexos, o backend pode ecoar esses resumos em `pendingClarification.diagnostics.attachmentSummaries`; o Page Builder reenvia esse estado no proximo turno.
|
|
123
|
+
- `PageBuilderAiAdapter.applyCompiledFormPatch` aplica somente `compiledFormPatch.patch.page` no runtime do builder.
|
|
124
|
+
- `applyPage` persiste o mesmo `patch.page` em `ui_user_config`, com `componentType`, `componentId`, `scope` e `If-Match` delegados ao backend canônico.
|
|
125
|
+
|
|
126
|
+
O frontend não deve persistir o envelope completo do patch como payload de runtime. O envelope fica para preview, auditoria e diagnóstico; o documento salvo é a página renderizável.
|
|
127
|
+
|
|
88
128
|
## Settings Panel Bridge
|
|
89
129
|
|
|
90
130
|
Para abrir "Configuracoes da Pagina" e editores de shell no painel lateral, o host deve registrar o bridge do Settings Panel:
|
|
@@ -101,10 +141,32 @@ providers: [
|
|
|
101
141
|
]
|
|
102
142
|
```
|
|
103
143
|
|
|
144
|
+
## Component Config Editors
|
|
145
|
+
|
|
146
|
+
O page-builder não deve implementar editores locais para os inputs de cada
|
|
147
|
+
widget. Quando um componente registra `ComponentDocMeta.configEditor`, o runtime
|
|
148
|
+
canônico (`praxis-dynamic-page`) injeta a ação "Configurar conteudo" no shell do
|
|
149
|
+
widget e abre o editor declarado pelo dono do componente.
|
|
150
|
+
|
|
151
|
+
Fluxo canônico:
|
|
152
|
+
|
|
153
|
+
- a lib dona registra `configEditor` em `ComponentMetadataRegistry`
|
|
154
|
+
- o page-builder habilita customization e fornece `SETTINGS_PANEL_BRIDGE`
|
|
155
|
+
- o editor recebe `{ inputs, widgetKey, widgetType }`
|
|
156
|
+
- `Apply` atualiza `definition.inputs` sem fechar o painel; ele não é rollback transacional e pode ser observado pelo host imediatamente
|
|
157
|
+
- `Save` atualiza `definition.inputs` e persiste a página quando houver `pageIdentity`
|
|
158
|
+
- `Reset` restaura o estado interno do editor para o snapshot aberto; ele não desfaz automaticamente um `Apply` já emitido ao runtime/host
|
|
159
|
+
|
|
160
|
+
Exemplo com `praxis-rich-content`: o editor canônico é
|
|
161
|
+
`PraxisRichContentConfigEditor`, publicado por `@praxisui/rich-content`. Ele
|
|
162
|
+
edita `definition.inputs.document`, `layout` e `rootClassName` sem criar uma DSL
|
|
163
|
+
local de page-builder para blocos ricos.
|
|
164
|
+
|
|
104
165
|
Catalogos conhecidos (exports):
|
|
105
166
|
- `TABLE_AI_CAPABILITIES` - `@praxisui/table` (`praxis-table`)
|
|
106
167
|
- `CRUD_AI_CAPABILITIES` - `@praxisui/crud` (`praxis-crud`)
|
|
107
168
|
- `LIST_AI_CAPABILITIES` - `@praxisui/list` (`praxis-list`)
|
|
169
|
+
- `RICH_CONTENT_AI_CAPABILITIES` - `@praxisui/rich-content` (`praxis-rich-content`)
|
|
108
170
|
- `FORM_AI_CAPABILITIES` - `@praxisui/dynamic-form` (`praxis-dynamic-form`)
|
|
109
171
|
- `FILES_UPLOAD_AI_CAPABILITIES` - `@praxisui/files-upload` (`praxis-files-upload`)
|
|
110
172
|
- `STEPPER_AI_CAPABILITIES` - `@praxisui/stepper` (`praxis-stepper`)
|
|
@@ -126,6 +188,12 @@ O builder canonico expoe authoring de shell/palette sobre `praxis-dynamic-page`.
|
|
|
126
188
|
|
|
127
189
|
`page` e um `WidgetPageDefinition` (do `@praxisui/core`) contendo `widgets` e opcionalmente `composition.links`. O envelope `composition` e o caminho `composition.links` formam a superficie canonica persistida para wiring da pagina, com `condition` em Json Logic e `policy` para comportamento operacional.
|
|
128
190
|
|
|
191
|
+
Para conteudo editorial rico dentro da pagina, use um widget `praxis-rich-content`
|
|
192
|
+
com `definition.inputs.document: RichContentDocument`. Isso evita criar uma DSL
|
|
193
|
+
local de page-builder para cards, imagens, timelines ou blocos de apresentacao,
|
|
194
|
+
e preserva `WidgetPageDefinition.widgets` como superficie unica de ocupacao do
|
|
195
|
+
canvas.
|
|
196
|
+
|
|
129
197
|
## Widget Shell (Dashboard Cards)
|
|
130
198
|
|
|
131
199
|
Cada widget pode declarar um `shell` para renderizar um card padronizado com cabecalho rico, acoes de contexto e controles de janela (expandir/recolher).
|
|
@@ -172,6 +240,8 @@ Exports deste pacote:
|
|
|
172
240
|
- `WidgetShellEditorComponent`
|
|
173
241
|
- `DynamicPageConfigEditorComponent`
|
|
174
242
|
- `DynamicPageBuilderComponent`
|
|
243
|
+
- `PageBuilderAgenticAuthoringService`
|
|
244
|
+
- `PAGE_BUILDER_AGENTIC_AUTHORING_OPTIONS`
|
|
175
245
|
|
|
176
246
|
Integracoes comuns:
|
|
177
247
|
- `SettingsPanelService.open({ id, title, content: { component, inputs } })` para page settings e shell editors
|