@praxisui/rich-content 8.0.0-beta.2 → 8.0.0-beta.20

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
@@ -61,6 +61,24 @@ settings-panel editor for `praxis-rich-content`. Hosts such as
61
61
  `@praxisui/page-builder` should open this editor from the component metadata
62
62
  instead of creating local rich-content JSON editors.
63
63
 
64
+ The canonical editor provides structured block authoring for common top-level
65
+ nodes (`text`, `badge`, `icon`, `image`, `metric`, `progress`, `compose`,
66
+ `link`, `actionButton`, `card`, `callout`, `ctaGroup`, `keyValueList`,
67
+ `emptyState`, `propertySheet`, `statGroup`, `tabs`, `recordSummary`, `lookupResult`, `lookupCard`, `relatedRecord`,
68
+ `actionCard`, `collapsibleCard`, `disclosure`, `accordion`, `formLauncher`, `mediaBlock`,
69
+ `timeline` and `preset`), including add, reorder, inline removal confirmation
70
+ and field-level editing. It also supports nested authoring for
71
+ `card.content[]`, named card slots, `compose.items[]`, `timeline.items[]` and
72
+ governed action collections such as `callout.actions[]`,
73
+ `recordSummary.actions[]`, `lookupCard.secondaryActions[]`, `actionCard.secondaryActions[]` and
74
+ `disclosure.actions[]`, plus governed preset selection from
75
+ `PRAXIS_RICH_BLOCK_PRESETS`. Common node metadata such as `testId`,
76
+ `className`, capability-gated visibility (`requiresCapabilities` and
77
+ `capabilityMode`), a simple `visibleWhen` equality rule and one safe inline
78
+ style declaration can be edited visually. Advanced JSON remains available for
79
+ less common nested fields and deep structures, but it is no longer the only
80
+ authoring path.
81
+
64
82
  The editor receives the widget input envelope and returns the same canonical
65
83
  shape expected by the runtime:
66
84
 
@@ -85,6 +103,163 @@ Authoring labels, helper text and validation messages use the rich-content i18n
85
103
  dictionary. Apps can provide overrides with `providePraxisRichContentI18n()` or
86
104
  reuse `resolvePraxisRichContentText()` when extending the canonical editor.
87
105
 
106
+ The editor validates the public `RichContentDocument` contract before
107
+ Apply/Save. Hosts that need the same checks outside the settings panel can use
108
+ `validateRichContentDocument()` from `@praxisui/rich-content` to reject
109
+ unsupported document versions, unknown node types, unsafe URLs, unsafe style
110
+ values and malformed nested nodes before persistence.
111
+
112
+ ### Timeline authoring
113
+
114
+ `timeline` is a governed rich-content block, not a local page-builder widget.
115
+ The public document contract supports node-level presentation fields
116
+ `orientation`, `order`, `position`, `connectorVariant`, `connectorColor`,
117
+ `markerVariant`, `markerColor` and `markerStyle`, plus item-level `opposite`
118
+ and `oppositeExpr` content. `orientation` accepts `vertical` or `horizontal`;
119
+ `order` accepts `normal` or `reverse`, allowing hosts and agents to publish the
120
+ same lifecycle data as a vertical document flow, a horizontal process rail or a
121
+ reverse chronological activity stream without reshaping `timeline.items[]`.
122
+ Timeline items may override `connectorVariant`, `connectorColor`, `markerColor`
123
+ and `markerStyle` when a specific step needs status or exception emphasis.
124
+ These fields are available through the canonical rich-content editor, validated
125
+ by `validateRichContentDocument()` and consumed directly by the runtime
126
+ renderer.
127
+
128
+ Use timeline node settings when the host needs to publish lifecycle, workflow or
129
+ operational history as portable `RichContentDocument` JSON. Use item-level
130
+ fields such as `title`, `subtitle`, `meta`, `icon`, `badge` and `opposite` for
131
+ display data, with `*Expr` variants when the values come from the widget
132
+ context.
133
+
134
+ ## Semantic blocks and interactive surfaces
135
+
136
+ `@praxisui/rich-content` now supports a broader contract for configuration-first
137
+ platform surfaces:
138
+
139
+ - semantic editorial blocks such as `callout`, `keyValueList`, `emptyState`,
140
+ `recordSummary`, `statGroup`, `tabs`, `lookupResult`, `lookupCard`, `relatedRecord`, `actionCard`, `collapsibleCard`,
141
+ `disclosure` and `accordion`
142
+ - interactive buttons through `actionButton`, mediated by
143
+ `hostCapabilities.dispatchAction(...)`
144
+ - governed action surfaces such as `lookupCard`, `relatedRecord`, `actionCard` and `formLauncher`, which keep
145
+ the document canonical while delegating execution to host capabilities
146
+ - capability-gated visibility through `requiresCapabilities` and
147
+ `capabilityMode`
148
+ - richer `card` composition through semantic surface fields (`variant`, `tone`,
149
+ `size`, `density`, `orientation`), optional `media`, `headerAction`,
150
+ whole-card `interaction`, accessibility overrides and named slots (`header`,
151
+ `body`, `footer`, `actions`, `aside`) while preserving the required
152
+ `content[]` path for existing consumers
153
+
154
+ This keeps purely visual content (`card`, `callout`, `keyValueList`) distinct
155
+ from host-mediated interaction (`actionButton`) without introducing ad hoc host
156
+ JSON.
157
+
158
+ Example semantic card surface:
159
+
160
+ ```ts
161
+ const document: RichContentDocument = {
162
+ kind: 'praxis.rich-content',
163
+ version: '1.0.0',
164
+ nodes: [
165
+ {
166
+ type: 'card',
167
+ titleExpr: '${decision.title}',
168
+ subtitleExpr: '${decision.source}',
169
+ variant: 'elevated',
170
+ tone: 'info',
171
+ size: 'lg',
172
+ orientation: 'horizontal',
173
+ media: {
174
+ kind: 'icon',
175
+ icon: 'psychology',
176
+ label: 'AI-authored decision surface',
177
+ placement: 'leading',
178
+ },
179
+ interaction: {
180
+ mode: 'action',
181
+ action: { actionId: 'decision.open' },
182
+ },
183
+ accessibility: {
184
+ role: 'button',
185
+ ariaLabel: 'Open decision surface',
186
+ },
187
+ content: [
188
+ { type: 'text', textExpr: '${decision.summary}' },
189
+ ],
190
+ },
191
+ ],
192
+ };
193
+ ```
194
+
195
+ ## Governed presets
196
+
197
+ The preset registry still uses `PRAXIS_RICH_BLOCK_PRESETS`, and the lib now also
198
+ publishes `providePraxisDefaultRichBlockPresets()` with a small canonical starter
199
+ set for configuration-first hosts:
200
+
201
+ - `callout-guidance`
202
+ - `empty-state-launcher`
203
+ - `record-summary-compact`
204
+
205
+ For widget hosts such as `@praxisui/page-builder`, the component metadata also
206
+ publishes insertion presets through `ComponentDocMeta.insertionPresets`. The
207
+ current canonical starter set is:
208
+
209
+ - `editorial-card`
210
+ - `callout-guidance`
211
+ - `cta-group`
212
+ - `knowledge-surface`
213
+ - `lookup-card`
214
+ - `related-record`
215
+ - `action-card`
216
+ - `approval-audit-surface`
217
+ - `approval-decision-surface`
218
+ - `approval-review-surface`
219
+ - `approval-sla-triage-surface`
220
+ - `approval-delegation-exception-surface`
221
+ - `employee-insight-surface`
222
+ - `hr-compensation-review-surface`
223
+ - `hr-performance-review-surface`
224
+ - `hr-promotion-review-surface`
225
+ - `hr-offboarding-surface`
226
+ - `hr-succession-planning-surface`
227
+ - `hr-leave-absence-surface`
228
+ - `hr-internal-mobility-surface`
229
+ - `onboarding-journey-surface`
230
+ - `onboarding-equipment-access-recovery-surface`
231
+ - `onboarding-day-30-coaching-surface`
232
+ - `onboarding-manager-follow-up-surface`
233
+ - `onboarding-readiness-surface`
234
+ - `stat-group`
235
+ - `timeline-surface`
236
+ - `tabs-surface`
237
+
238
+ Hosts can use the defaults directly or provide their own governed preset pack.
239
+
240
+ ## Agentic Authoring Contract
241
+
242
+ `@praxisui/rich-content` publishes an executable `ComponentAuthoringManifest`
243
+ through `PRAXIS_RICH_CONTENT_AUTHORING_MANIFEST`.
244
+
245
+ The manifest treats rich content as structured `RichContentDocument` data, not
246
+ HTML or markdown patches. It governs document replacement, block add/remove,
247
+ block order, text updates, canonical link nodes, common node metadata,
248
+ `mediaBlock` fields, timeline node settings, `timeline.items[]`, preset refs
249
+ and sanitization policy.
250
+ Security-sensitive policy edits and destructive removals require confirmation
251
+ before a patch can be compiled.
252
+
253
+ Link authoring uses a first-class `link` node with `label`, `href`, `target`
254
+ and `rel`; unsafe protocols are rejected by `validateRichContentDocument()`.
255
+
256
+ Each operation declares its own editable target resolver, ambiguity policy,
257
+ preconditions, validators, affected paths, effects and typed submission impact.
258
+ Document, block, text, link, media, timeline, preset, metadata and sanitization
259
+ operations are `config-only` because they edit the structured widget input
260
+ contract. `display.mode.set` is `visual-only` because it changes `layout` and
261
+ `rootClassName` without mutating the `RichContentDocument`.
262
+
88
263
  ## Layout Modes
89
264
 
90
265
  The component defaults to `layout="block"` to preserve document-style rendering.