@sonata-innovations/fiber-fbre 3.3.0 → 3.4.0

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/AGENTS.md ADDED
@@ -0,0 +1,58 @@
1
+ # @sonata-innovations/fiber-fbre — Agent Guide
2
+
3
+ Fiber Render Engine. Consumes **Flow** JSON, renders the form (conditions, validation, screen transitions), returns collected **FlowData** to the parent app. A standard React component — no iframe, no external service.
4
+
5
+ Docs in this package are versioned with the code you installed. Read them from `node_modules/@sonata-innovations/fiber-fbre/docs/`.
6
+
7
+ ## Documentation map
8
+
9
+ | Read this | When |
10
+ |---|---|
11
+ | `docs/fiber-concepts.md` | You are new to Fiber. The Flow/Screen/Component model, Flow vs FlowData, how builders and the render engine relate. |
12
+ | `docs/integration/fbre.md` | **The main reference.** Props for all three modes, the `onFlowComplete` contract, store access, events, pre-populating data, pitfalls. |
13
+ | `docs/features/fbre-theming.md` | Theming beyond a one-line accent change: precedence model, palette knobs, the full `--fbre-*` token catalog. |
14
+ | `docs/features/confirmation-screen.md` | The post-submit "thank you" screen and its dynamic `${...}` content. |
15
+ | `@sonata-innovations/fiber-types/docs/schema/flow-quick-reference.md` | Constructing or reading Flow JSON: component types, conditions, validation, widths. |
16
+ | `@sonata-innovations/fiber-types/docs/schema/flow-schema.md` | Exhaustive per-property schema reference. |
17
+ | `@sonata-innovations/fiber-types/docs/schema/flow-data-schema.md` | The shape of the data FBRE hands back. |
18
+
19
+ Schema docs live in `fiber-types` (a direct dependency of this package), so they are always present in `node_modules` and never drift from the version you installed.
20
+
21
+ ## Minimal usage
22
+
23
+ ```tsx
24
+ import { FBRE } from "@sonata-innovations/fiber-fbre";
25
+ import "@sonata-innovations/fiber-fbre/styles"; // required — styles are not bundled with the JS
26
+
27
+ <FBRE flow={myFlow} onFlowComplete={(data) => console.log(data)} />;
28
+ ```
29
+
30
+ ## The three modes
31
+
32
+ Mutually exclusive; selected by which props you pass.
33
+
34
+ - **Local** — you hold the Flow: `<FBRE flow={flow} onFlowComplete={fn} />`
35
+ - **Remote** — fetch a published flow: `<FBRE flowId="…" apiEndpoint="…" onFlowComplete={fn} />`
36
+ - **Server-driven** — the server evaluates conditions/validation, one screen at a time: `<FBRE sessionEndpoint="…" flowId="…" onFlowComplete={fn} />`
37
+
38
+ ## Rules that are easy to get wrong
39
+
40
+ - **Import the stylesheet separately.** `import "@sonata-innovations/fiber-fbre/styles";` Without it the form renders unstyled.
41
+ - **`data` is not reactive.** It is applied when the flow loads. Changing `data` alone does nothing — change `flow.uuid` or call `loadFlow(flow, data)` through `storeRef`.
42
+ - **`flow.uuid` change ⇒ full reload.** Keep it stable unless you intend to reset.
43
+ - **Never set `value`, `valid`, or `addedComponents` in Flow JSON.** They are runtime-only.
44
+ - **Display components are excluded from FlowData** (`header`, `text`, `divider`, `callout`, `table`), as are condition-hidden components and screens. `computed` **is** included.
45
+ - **`getMaxScreenIndex()` returns the max screen _index_** (count − 1). The last screen is `getMaxScreenIndex()`. (Renamed from the misleadingly-named `getMaxScreenCount`.)
46
+ - **There is no screen-validity callback prop.** Subscribe through `storeRef` and read `getScreenValidity(i)`. (`onScreenValidationChange` never fired and has been removed.)
47
+ - **The file-upload event bus is module-global**, not per-instance: one listener sees uploads from every mounted `<FBRE />`, distinguished only by component UUID.
48
+ - **Server-driven mode renders a terminal confirmation on completion** (from `config.confirmation`, else a generic "Thank you") and resets the submit button. `onFlowComplete` still fires with the server result if you want to drive your own post-completion UI.
49
+
50
+ ## Types
51
+
52
+ `Flow`, `FlowData`, `ScreenData`, `ComponentData`, `FileUploadData`, `ThemeConfig`, `NavigationConfig`, `ControlsConfig`, `ConfirmationConfig`, `ConfirmationResult`, `FBREStoreState`, and the condition/validation types are all re-exported from this package. You do not need to depend on `fiber-types` directly.
53
+
54
+ ## Companion packages
55
+
56
+ - `@sonata-innovations/fiber-fbt` — full drag-and-drop builder that authors Flow JSON
57
+ - `@sonata-innovations/fiber-fbtl` — lite builder for non-technical end users
58
+ - `@sonata-innovations/fiber-theme-editor` — visual theme editor that emits a `ThemeConfig`
package/CHANGELOG.md ADDED
@@ -0,0 +1,129 @@
1
+ # Changelog — @sonata-innovations/fiber-fbre
2
+
3
+ All notable changes to the Fiber Render Engine. Dates are release dates.
4
+
5
+ ## 3.4.0 — 2026-07-10
6
+
7
+ ### Added
8
+
9
+ - Documentation now ships inside the package under `docs/`, plus an `AGENTS.md` routing guide at the package root. The docs you read are always the ones matching the version you installed.
10
+
11
+ ### Fixed
12
+
13
+ - Corrected several documentation errors: the theming token catalog's font stack, the claim that legacy `required`/`regex` properties are auto-migrated (they are not — pre-migrate them), the calculation formula example (single braces `{uuid}`, not double), and the conversational style list (styles partition by mode: 6 standard, 4 conversational).
14
+ - Base64 file uploads now emit the deprecated `File.lastModifiedDate` property as an ISO-8601 string instead of passing the raw `Date` object through, so `FlowData` survives a JSON round-trip unchanged. The field remains optional and is only present in browsers that still expose the property.
15
+ - Server-driven mode no longer stays stuck on "Submitting…" after a successful completion. It now resets the submit button and renders a terminal confirmation screen — the flow's configured `config.confirmation` message when present, otherwise a generic "Thank you". `onFlowComplete` still fires with the server result.
16
+
17
+ ### Changed
18
+
19
+ - Renamed the store method `getMaxScreenCount()` to `getMaxScreenIndex()`. It always returned the maximum screen *index* (count − 1), not a count, so the name was misleading; the behavior is unchanged. Update `storeRef` call sites to the new name.
20
+
21
+ ### Removed
22
+
23
+ - The `onScreenValidationChange` prop, which was never invoked in any released version — it was accepted, threaded down, and dropped. To react to screen validity, subscribe through `storeRef` and read `getScreenValidity(i)`, which is what the prop's documentation has recommended as a workaround all along.
24
+
25
+ ## 3.3.0 — 2026-07-03
26
+
27
+ ### Added
28
+
29
+ - **Confirmation ("thank you") screen.** A terminal screen configured via `flow.config.confirmation` (`show`, `title`, `body`), supporting `${...}` references to collected values, calculation results, and context. `onFlowComplete` gained a return contract: return `void` to show it optimistically, a `Promise` to hold the submit button in its in-flight state, or a `ConfirmationResult` (sync or resolved) to override the message with content known only after submit — e.g. a server reference number. A rejected promise surfaces a completion error and suppresses the confirmation.
30
+ - Exports `ConfirmationConfig` and `ConfirmationResult`.
31
+
32
+ ## 3.2.1 — 2026-06-16
33
+
34
+ ### Fixed
35
+
36
+ - Tall conversational screens no longer have their tops clipped.
37
+
38
+ ## 3.2.0 — 2026-06-10
39
+
40
+ ### Added
41
+
42
+ - **Theme palette knobs.** `ThemeConfig` accepts `background`, `surface`, `text`, `border`, `radius`, `fontFamily`, `error`, `success`, and `warning`. Each sets a primary `--fbre-*` token and derives its related tokens, so a single value yields a coherent result. Unset knobs fall through to the preset.
43
+ - New input, label, success, and warning tokens.
44
+
45
+ ### Changed
46
+
47
+ - **`colorScheme: "light" | "dark"` replaces the `darkMode` boolean** on both `ThemeConfig` and the FBRE props. There is no runtime fallback — pre-migrate stored flows.
48
+
49
+ ## 3.1.0 — 2026-05-28
50
+
51
+ ### Added
52
+
53
+ - Keyboard accessibility: correct tab order across a screen, and focus management on screen transitions.
54
+
55
+ ## 3.0.0 — 2026-05-19
56
+
57
+ ### Changed — breaking
58
+
59
+ - **`Component` is now a discriminated union keyed on `type`.** After narrowing on `component.type`, `component.properties` narrows to the matching properties shape. Consumers with `properties` casts will need to update. Requires `@sonata-innovations/fiber-types` v2.
60
+ - Component metadata is derived from a single manifest in `fiber-types`, with a build-time parity guard.
61
+
62
+ ### Added
63
+
64
+ - Complete public exports for the per-component property types.
65
+
66
+ ### Fixed
67
+
68
+ - The repeater's minimum-iteration count now reads `properties.minIterations`.
69
+ - Markup conversion moved into `@sonata-innovations/fiber-shared`, so the browser and the server render markup identically.
70
+
71
+ ## 2.1.1 — 2026-05-14
72
+
73
+ ### Fixed
74
+
75
+ - A dropdown panel is no longer clipped by the next component in conversational mode.
76
+
77
+ ## 2.1.0 — 2026-05-14
78
+
79
+ ### Added
80
+
81
+ - Pick-one components honour `properties.defaultValue`.
82
+
83
+ ### Fixed
84
+
85
+ - `cardSelect` stacks 1–3 options and equalizes card heights from 4 options up.
86
+
87
+ ## 2.0.6 — 2026-04-29
88
+
89
+ ### Fixed
90
+
91
+ - Conversational auto-advance now only fires when the screen has a single visible input.
92
+
93
+ ## 2.0.5 — 2026-04-18
94
+
95
+ ### Added
96
+
97
+ - **Controls layout overhaul**: a solo-wide default plus `centered`, `inline-full`, and `stacked` variants.
98
+ - `showBorder` on group and repeater containers.
99
+
100
+ ### Fixed
101
+
102
+ - Conversational mode centers vertically via a dedicated screen slot.
103
+
104
+ ## 2.0.4 — 2026-03-20
105
+
106
+ ### Added
107
+
108
+ - Calculation results are included in the FlowData output.
109
+
110
+ ### Fixed
111
+
112
+ - Component renderers are no longer tree-shaken out of the published bundle.
113
+ - Conversational mode no longer clips overflowing content.
114
+
115
+ ## 2.0.1 – 2.0.3 — 2026-03-04
116
+
117
+ ### Added
118
+
119
+ - **Conversational mode** with four dedicated styles (`centered-minimal`, `stacked-cards`, `soft-float`, `bold-statement`).
120
+ - Four additional standard styles: `refined-clean`, `airy-clean`, `soft-outlined`, `defined-outlined`.
121
+ - `stepperStyle` as an independent config value.
122
+ - Signature component; expanded read-only support; formula engine enhancements.
123
+ - `computed` component type with per-iteration formula evaluation.
124
+ - Computation layer: repeater component, calculations, and rich option metadata.
125
+ - `cardSelect` component; icon picker for callout and rating.
126
+
127
+ ### Fixed
128
+
129
+ - The bar stepper no longer breaks for flows with more than six screens.