@praxisui/page-builder 10.0.0-rc.6 → 10.0.0-rc.61

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
@@ -4,6 +4,61 @@ Visual page and dashboard builder for Praxis UI applications.
4
4
 
5
5
  Use this package when an application must let users compose governed operational pages from registered widgets, visual layout, shell settings, component editors, `composition.links`, and optional AI-assisted authoring.
6
6
 
7
+ For the prospective governed-page journey, see [Create, review and publish pages — UX design](https://github.com/codexrodrigues/praxis-ui-angular/blob/main/projects/praxis-page-builder/docs/governed-page-publication-ux.md). This is a storyboard and acceptance criteria for subsequent host/lifecycle integration; it does not make page creation or publication available in the current builder.
8
+
9
+ ## Dashboard pages and persistence ownership
10
+
11
+ A dashboard is a `WidgetPageDefinition` rendered by `praxis-dynamic-page` and edited
12
+ by `praxis-dynamic-page-builder`. The beta `PraxisDashboardPage` wrapper was removed;
13
+ use these existing components instead. Application titles, toolbar presentation and
14
+ business navigation remain host concerns.
15
+
16
+ For manual page editing, opt in to the Core persistence lifecycle:
17
+
18
+ ```html
19
+ <praxis-dynamic-page-builder
20
+ #builder
21
+ [page]="defaultPage"
22
+ [pageIdentity]="identity"
23
+ [autoPersist]="true"
24
+ [enableCustomization]="editing"
25
+ (persistenceChange)="persistence = $event"
26
+ />
27
+ ```
28
+
29
+ `autoPersist` defaults to `false` on the builder, preserving its previous effective
30
+ behavior (the child runtime previously always received `false`). Hosts that already
31
+ persist `pageAuthoringChange`/`pageSaveRequested` must leave it disabled. Core Dynamic
32
+ Page keeps its own existing default. Do not enable a second host writer when Core
33
+ owns persistence.
34
+
35
+ Pass `PageIdentity` with the application's actual tenant/user/route. Core uses the
36
+ configured `ASYNC_CONFIG_STORAGE`; no separate localStorage cache, browser globals
37
+ or persona-specific host reconciler is needed. Storage identity is not backend
38
+ authorization. Persisted documents, including an empty widget list, are authoritative;
39
+ new factory widgets are not silently appended to a user's saved page. When a host
40
+ requires deterministic schema reconciliation on load or sanitization of transient runtime
41
+ projections before save, bind the opt-in Core passthrough hooks `[reconcilePersistedPage]`
42
+ and `[preparePageForPersistence]` on `<praxis-dynamic-page-builder>`. Runtime calls to
43
+ `patchWidgetInputs` and `updateWidgetShell` default to non-persistable overlays unless
44
+ `{ persistable: true }` is passed explicitly.
45
+
46
+ `persistenceChange` forwards Core's operational `WidgetPagePersistenceState`:
47
+ `idle`, `loading`, `saving`, `saved`, `resetting` or `error`, with `customized`, optional
48
+ ISO `savedAt`, operation and a safe `errorKind`. Show success only after acknowledgement,
49
+ and distinguish conflicts from a pending or failed write. It is not business metadata
50
+ and must not be persisted in `WidgetPageDefinition`.
51
+
52
+ `builder.resetPersistedPage(defaultPage)` deletes this identity's saved page and applies
53
+ the supplied default only after acknowledgement. `builder.reloadPersistedPage(defaultPage)`
54
+ explicitly discards the draft and reloads storage, using the supplied default when no saved
55
+ page exists. Make that destructive-to-draft intent visible in the host. The existing Save
56
+ button retries through Core for manually managed pages; conflicts require an explicit reload.
57
+
58
+ For `authoringDocument` or agentic authoring, Core automatic persistence is disabled even
59
+ when requested: the existing host/server apply lifecycle owns revisions and provenance.
60
+ An AI preview must never be saved through an automatic generic config write.
61
+
7
62
  ## Widget shell editor integrity
8
63
 
9
64
  The shell editor exposes **Keep header visible while scrolling the page**
@@ -75,6 +130,13 @@ row-height defaults remain omitted; the editor does not freeze resolved runtime
75
130
  to supply it. Selecting a shell preset writes an explicit override; clearing it restores
76
131
  inheritance, including after Apply and reopen.
77
132
 
133
+ When `GlobalConfig.pages.defaults` (`layoutPreset`, `themePreset`, `shellPreset`, `columns`,
134
+ `gap`, `paddingInline`, `autoRows`) is configured via `provideGlobalConfig` or the Global
135
+ Config Editor, omitted page-level fields inherit those corporate defaults at runtime (`<praxis-dynamic-page>`).
136
+ Both `PageConfigEditorComponent` and `DynamicPageConfigEditorComponent` surface inherited
137
+ corporate defaults with a `(global)` indicator in summary chips, `PagePresetComparisonComponent`,
138
+ and the `paddingInline` placeholder without freezing them into the saved `WidgetPageDefinition`.
139
+
78
140
  Inside Widget Settings, **Undo last resize** prepares the inverse preview; **Apply** commits
79
141
  it to the page. This differs from discarding an unapplied draft and from saving the page
80
142
  through its host. Preset selection does not introduce collective repacking or new AI operations.
@@ -87,7 +149,7 @@ order, with natural content height. It replaces positions and width bounds only
87
149
  that device, preserves hidden widgets and other overrides, and leaves the base and
88
150
  other device layouts unchanged. Apply/Save materializes the existing
89
151
  `deviceLayouts[device].canvas` contract; Reset restores the original draft.
90
- Advanced JSON overrides remain available under **Advanced overrides**.
152
+ Advanced JSON overrides remain available under **Advanced overrides** (`widgetOverrides`) and strictly validate the canonical `WidgetPageWidgetLayoutOverride` keys (`className`, `span`, `order`, `hidden`), diagnosing and rejecting unsupported properties such as `definition` or `inputs` without discarding the user's draft text.
91
153
 
92
154
  Reducing a device's column count also reflows inherited base positions in Core.
93
155
  Explicit device positions remain authoritative. With no device variant the base
@@ -113,7 +175,7 @@ documents already clamped by Core remain valid on opening: declared spans need
113
175
  not equal rendered spans. Invalid inherited bounds can be corrected in the same
114
176
  draft. The editor does not rewrite geometry to satisfy newly authored bounds.
115
177
  Dynamic title expressions are
116
- identified by stable widget key, not evaluated in the editor.
178
+ identified by stable widget key and resolved friendly widget titles (from static shell metadata or inner widget titles), not evaluated in the editor.
117
179
 
118
180
  Apply previews the same document returned by Save; Reset reloads the input baseline.
119
181
  Pending changes are tracked independently of validity, including edits to an
@@ -135,7 +197,7 @@ Page, the editor receives transient runtime validation through `SETTINGS_PANEL_D
135
197
  Apply/Save and reopen check the current active-device geometry and report the minimum
136
198
  beside the height field. The callback and observed dimensions never enter the document.
137
199
  Changed columns, gap, width or shell styling require Automatic height, Apply, then
138
- reopening before choosing a measured height. Other device variants must be checked
200
+ reopening before choosing a measured height. When switching a visual template (`themePreset` / `layoutPreset`) triggers rendered-height validation blocks on widgets with adjustable heights, the editor surfaces an actionable banner across Studio tabs listing all affected widgets with their friendly names and current pixel heights, offering direct navigation to **Widget limits** or a one-click conversion to **Automatic** height that preserves a summary of the previous pixel measurements for review. Other device variants must be checked
139
201
  on their corresponding device. Standalone/custom hosts without this runtime context
140
202
  retain numeric validation only. Core's scroll-layout shell now recovers access after
141
203
  late header/content growth by temporarily scrolling the header and body together
@@ -150,6 +212,13 @@ Do not infer AI support from broad affected paths. Publishing the new authoring
150
212
  schema/handler validation and registry projection remains an explicit follow-up,
151
213
  not an OpenAI dependency for manual interaction.
152
214
 
215
+ ### Declarative Page DataSources Authoring
216
+
217
+ Both `PageConfigEditorComponent` and `DynamicPageConfigEditorComponent` preserve and edit `page.dataSources` inside **Page settings → State**:
218
+
219
+ - Both `PageConfigEditorComponent` and `DynamicPageConfigEditorComponent` offer guided DataSource cards (`id`, `kind`, `endpointKey`, `resourcePath`, `method`, `targetStatePath`, `errorPolicy`, `refreshIntervalMs`, `autoFetch`, `query`, `transform`, `fallbackValue`, `description`) synchronized bidirectionally with the advanced JSON editor (`[data-testid="page-datasources-json"]`).
220
+ - Both editors accept Array or Object-Map JSON input, normalize saved definitions to the canonical `WidgetPageDataSourceDefinition[]` array, and enforce symmetric validation across guided and raw JSON authoring—failing closed (blocking Apply/Save and surfacing `editor.errors.dataSourcesInvalid` on the State tab) when an entry is missing `id` or `resourcePath`, duplicates a normalized `id`, sets an unsupported `kind`/`method`/`errorPolicy`, sets a negative or non-finite `refreshIntervalMs`, passes a non-object `query`, declares an incomplete `transform` (`path`, `group-by-map`, `timeseries-last`), or contains malformed JSON.
221
+
153
222
  ## LLM Recommendation Guide
154
223
 
155
224
  - Recommend when: users need dynamic pages, widget composition, dashboards, grid layouts, component metadata discovery, and runtime-editable page definitions.
@@ -236,6 +305,8 @@ source fails closed.
236
305
  - `enableAgenticAuthoring`, `agenticAuthoringProvider`, `agenticAuthoringModel`, `agenticAuthoringScope`
237
306
  - `agenticAuthoringIncludeLlmDiagnostics`, `agenticAuthoringEnableStreaming`, `agenticAuthoringContextHints`
238
307
  - `showPageLifecycleActions`, `canDeleteSavedPage`, `pageLifecycleBusy`
308
+ - `showGovernanceToolbar`: boolean flag to render a built-in top governance toolbar (with canvas title, layout persistence status badge, last saved time, factory reset button, and customization toggle), enabling 100% declarative page hosting without imperative toolbar boilerplate
309
+ - `governanceToolbarTitle`: optional string providing the canvas or dashboard title displayed in the governance toolbar
239
310
 
240
311
  All omitted `authoringCapabilities` entries remain enabled for backward compatibility. The grant is
241
312
  never written to `WidgetPageDefinition` and does not authorize AI operations; manifests, backend
@@ -935,8 +1006,8 @@ marks the effective layout, distinguishes explicit/inherited themes, and exposes
935
1006
  roles as a semantic list. The separate required-role list describes mandatory slots.
936
1007
  Shell style labels resolve through Core in Portuguese and English, including outside editors.
937
1008
 
938
- The local `/dynamic-page-lab` preset studio links six governed scenarios from
939
- `ERGON_COMPOSITION_CASES` by task: catalog maintenance, record detail, tabbed dossier,
1009
+ The local `/dynamic-page-lab` preset studio links six governed enterprise composition scenarios
1010
+ by task: catalog maintenance, record detail, tabbed dossier,
940
1011
  missions/teams, actions with justification, and partial outcomes in bulk actions. These routes consume the existing composition
941
1012
  recipes and real Quick Start data; navigation does not apply the selected appearance to them.
942
1013
  They may write data when their existing actions are confirmed. The style specimens remain
@@ -1089,6 +1160,83 @@ losing unrelated context. Arrangement choices track their draft baseline even wh
1089
1160
  selected distribution initially produces no changes, so later edits clear stale status.
1090
1161
  These fixes are not part of the already published 9.0.68-rc.2 package.
1091
1162
 
1163
+ `retryPersistedPage()` retries the current draft after a non-conflict save failure,
1164
+ including empty pages, without emitting host save lifecycle events. Conflicts require
1165
+ explicit `reloadPersistedPage(defaultPage)`; reload discards the local draft.
1166
+
1167
+ ### Optional editing highlight
1168
+
1169
+ This feature was added in source after `10.0.0-rc.36`; it is not yet part of a published package release.
1170
+
1171
+ `WidgetShellConfig.appearance.card.interactionHighlight` selects `standard` or
1172
+ `gradient`. Omit it to inherit the shell preset; the final default is `standard`.
1173
+ An explicit `standard` overrides a gradient preset. This is editing chrome: it
1174
+ appears on selection or keyboard focus while customization is enabled, never as a
1175
+ permanent border in the published page. Focusing a child control does not change selection; the highlight itself does not emit selection.
1176
+ The gradient uses the current primary, tertiary and secondary theme tokens. Resize
1177
+ grips follow the same choice. Internal control focus indicators remain intact;
1178
+ blocked canvas operations retain the error indicator and forced colors use a solid
1179
+ system-color outline. The highlight follows the resolved card radius (square for
1180
+ content-only shells).
1181
+
1182
+ ```json
1183
+ {"shell":{"kind":"dashboard-card","appearance":{"card":{"interactionHighlight":"gradient"}}}}
1184
+ ```
1185
+
1186
+ In Widget settings → Appearance, choose Inherit, Standard or Gradient and inspect
1187
+ its preview. Apply updates the local draft; the host controls remote persistence.
1188
+ Saving the settings panel alone is not proof of a server write: the reference Page
1189
+ Builder host requires Save page. Reopening and Reset preserve the distinction between
1190
+ an omitted value and an explicit override. Editing appearance on a widget without a
1191
+ shell preserves content-only presentation (`kind: 'none'`); a card requires an explicit
1192
+ choice. The option does not change child component inputs or enable customization.
1193
+
1194
+ This preference controls editing appearance; it grants no authorization and carries
1195
+ no business selection state. The host integrates persistence, identity and tenant
1196
+ scope through the canonical configuration infrastructure, including its ETag
1197
+ contract; this option requires no separate ETag implementation in the host. Editing only this preference must preserve unrelated
1198
+ shell settings, including `bodyLayout`, `windowActions` and action `pressed` values.
1199
+ Local editor round-trip tests do not prove remote tenant isolation or ETag behavior.
1200
+
1201
+ The existing AI operation `widget.shell.configure` merges partial shell input.
1202
+ Omitting `interactionHighlight` from that input preserves an existing override; it
1203
+ does not perform the visual editor's Inherit action, which removes the field from
1204
+ the complete saved document. Explicit `standard` disables the gradient but remains
1205
+ an override. Resetting an existing override to inherited styling through this AI
1206
+ operation remains unsupported; this option does not imply full editor/AI parity.
1207
+
1208
+ The historical live shell-authoring trial recorded in the validation report did
1209
+ not establish SSE, apply and persisted reopen support: its global assistant entry
1210
+ had no pinned widget target. Contextual child authoring also needs the correct
1211
+ operation owner and complete Page Builder document, rather than a child manifest
1212
+ and `definition.inputs`. Schema publication and compiler unit tests alone do not
1213
+ prove that journey. This integration preserves current dispatch; the historical
1214
+ failure is not a claim that every path on the current main has been disproven.
1215
+ Use the separately validated visual editor path for this preference until a
1216
+ successful shell-authoring AI journey is recorded for the integrated source.
1217
+
1218
+ ## Reusable copy and save-as journey
1219
+
1220
+ `PraxisPageCopyActionComponent` and `PraxisPageSaveAsComponent` provide reusable authoring controls for copying the current draft and saving a new page with a menu name/icon and confirmed internal route. Hosts provide an explicit `PageSaveAsAdapter`; the controls own validation feedback, retry snapshot/key, busy state, obsolete callback rejection and the last confirmed link. They do not provide storage or grant publication authority.
1221
+
1222
+ Connect `saveRequested` to `DynamicPageBuilderComponent.saveCurrentPage()` and its `pageSaveRequested` to `saveAs.save($event)` with `autoPersist=false`. Keep host routing, persistence and authorization in the adapter. See [contract, integration and proof limits](https://github.com/codexrodrigues/praxis-ui-angular/blob/main/projects/praxis-page-builder/docs/page-save-as.md). The first Hero proof is browser-local, not governed corporate publication; importing hosts require the matching packaged API before merge.
1223
+
1224
+ ### Shared assistant voice policy
1225
+
1226
+ Configure `{ provide: PRAXIS_ASSISTANT_VOICE_INPUT_MODE, useValue: 'governed-transcription' }` once in the host application (token from `@praxisui/ai`). The shell, Page Builder and Table inherit it; explicit component inputs can override it, including `disabled`. The default remains disabled when the host does not opt in.
1227
+
1228
+ The shared composer checks `GET /api/praxis/config/ai/transcriptions/capabilities` before requesting microphone permission. Readiness means local provider/credential configuration, not quota or network health. Recording, transcription and cancellation preserve the editable draft and never auto-submit. Deploy the backend capability before enabling the updated client.
1229
+
1230
+ Voice language also inherits `PRAXIS_ASSISTANT_VOICE_LANGUAGE`; explicit component inputs override it. Governed capture is bound to confirmed enterprise context (user/tenant/profile/version) and is cancelled when that authority is invalidated. Page Builder session resets and Table owner changes discard the old shell capture; editing the current draft does not cancel it. The host must keep its session and runtime authority coherent and invalidate it on session-generation changes.
1231
+
1232
+ Corporate adoption requires a ready context and current context-version headers, a host resolver bound to the server session/membership, and the correct cookie transport. The quickstart enterprise resolver applies this admission to all its AI callers. Local header-only integration cannot detect cookie changes that the host does not report. Focused/mock tests are not proof of durable session persistence, provider connectivity or published package adoption.
1233
+
1234
+ ## Workspace Shell, Page Integrity, Sanitization & Sibling Grid Sync
1235
+
1236
+ - **Enterprise Workspace Shell (`PraxisEnterpriseWorkspaceShellComponent`):** Locks `switchingContext` synchronously before consulting `PraxisContextSwitchGuard`, logs switch failures cleanly without mutating active context, prioritizes structured `errorCode` values (`TENANT_SCOPE_WRITE_FORBIDDEN`, `GOVERNANCE_DENIED`, `FORBIDDEN`) in save-error banners, guards `onSignOut()` against dirty state (`signOutBlocked`), forwards `canConfigure`, `isTenantWriteBlocked`, `globalSettingsTrigger`, `createPageTrigger`, and the `workspace-scope-bar` -> `shell-scope-bar` projection slot to `<praxis-app-shell>`, and localizes fallback command/search chrome. Import `<praxis-command-palette>` directly from `@praxisui/core` (the re-export from `@praxisui/page-builder` is deprecated).
1237
+ - **Persistence Policy, Integrity & Preview Cleanup:** `DynamicPageBuilderComponent.autoPersistPolicy` (`'independent' | 'suspend-when-agentic' | 'disabled'`) explicitly decouples runtime auto-persistence from agentic authoring, `integrityPolicy` delegates load/save structural reconciliation (`composition.links`, `layoutPreset`, `grouping`, conservative `context` merge) to `PraxisPageReconcilerService`, and `clearAgenticAuthoringPreviewState` discards paused runtime writes unless `{ keepPausedPersistence: true }` is passed.
1238
+ - **Declarative Sibling Grid Sync & Deep Sanitization:** `siblingGridGeometrySync` (`syncSiblingGridGeometry` / `createSiblingGridGeometryPrepareHook`) synchronizes tab sibling coordinates while clamping `col` against `columns - colSpan + 1` (even when `lockSize: true`), inheriting base `constraints` on `deviceLayouts`, preventing positional fallback collisions with explicit `slotMappings`, and deduplicating overlapping groupings. `sanitizeWidgetPageDefinition` recursively strips nested container widgets (`widgets`, `children`, `tabs`, `panels`, `steps`, and embedded `inputs.page`), deep `chartDocumentOverrides`, and optional declared `ComponentDocMeta.transientInputs`.
1239
+
1092
1240
  <!-- praxis-npm-catalog-links:start -->
1093
1241
  ## Official documentation and examples
1094
1242