mlform 0.1.7 → 0.1.8

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.
Files changed (218) hide show
  1. package/README.md +39 -12
  2. package/dist/builtins-DegwhFGA.js +3507 -0
  3. package/dist/builtins-ml-9qB2MOxt.js +51 -0
  4. package/dist/{design-system-CrrSGfFB.js → design-system-Dxx1Sh7r.js} +284 -268
  5. package/dist/errors-B3H1wRwj.js +8 -0
  6. package/dist/kit-CuRF6dhL.js +1847 -0
  7. package/dist/mlform/behaviors.mjs +32 -0
  8. package/dist/mlform/builtins-ml.mjs +3 -0
  9. package/dist/mlform/design-system.mjs +1 -1
  10. package/dist/mlform/kit.mjs +3 -3
  11. package/dist/mlform/presentation.mjs +2 -0
  12. package/dist/mlform/primitives.mjs +2 -2
  13. package/dist/mlform/runtime.mjs +5 -0
  14. package/dist/mlform/schema.mjs +102 -0
  15. package/dist/mlform/transport.mjs +2 -2
  16. package/dist/mlform.mjs +8 -4
  17. package/dist/presentation-CkQuYheR.js +200 -0
  18. package/dist/{primitives-BqjFDDhL.js → primitives-Duag8Lj0.js} +1367 -1312
  19. package/dist/runtime-DMjDVo0H.js +1824 -0
  20. package/dist/strings-CWwrrYzz.js +4 -0
  21. package/dist/{transport-A1RsnZhD.js → transport-CtVX8ZUT.js} +311 -336
  22. package/dist/types/src/behaviors/index.d.ts +3 -0
  23. package/dist/types/src/builtins-ml/index.d.ts +5 -0
  24. package/dist/types/src/design-system/runtime/fingerprint.d.ts +8 -0
  25. package/dist/types/src/design-system/runtime/host-observer.d.ts +1 -0
  26. package/dist/types/src/design-system/runtime/hydration-state.d.ts +13 -0
  27. package/dist/types/src/design-system/runtime/inherited-scheme.d.ts +5 -0
  28. package/dist/types/src/design-system/runtime/media.d.ts +19 -0
  29. package/dist/types/src/index.d.ts +10 -4
  30. package/dist/types/src/kit/accordion-root-styles.d.ts +1 -0
  31. package/dist/types/src/kit/accordion-root.d.ts +24 -0
  32. package/dist/types/src/kit/accordion.d.ts +2 -0
  33. package/dist/types/src/kit/constants.d.ts +29 -0
  34. package/dist/types/src/kit/defaults.d.ts +2 -2
  35. package/dist/types/src/kit/index.d.ts +6 -1
  36. package/dist/types/src/kit/layout-helpers.d.ts +29 -0
  37. package/dist/types/src/kit/layout-node-render.d.ts +18 -0
  38. package/dist/types/src/kit/layout-node-resolver.d.ts +3 -0
  39. package/dist/types/src/kit/layout-types.d.ts +124 -0
  40. package/dist/types/src/kit/layout-utils.d.ts +9 -0
  41. package/dist/types/src/kit/layout.d.ts +8 -0
  42. package/dist/types/src/kit/mount-types.d.ts +54 -0
  43. package/dist/types/src/kit/panel-nav.d.ts +9 -0
  44. package/dist/types/src/{questionnaire/primitives/components → kit}/step-indicator.d.ts +3 -3
  45. package/dist/types/src/kit/tabs-root-styles.d.ts +1 -0
  46. package/dist/types/src/kit/tabs-root.d.ts +24 -0
  47. package/dist/types/src/kit/tabs.d.ts +2 -0
  48. package/dist/types/src/kit/types.d.ts +4 -51
  49. package/dist/types/src/kit/view-layout-state.d.ts +14 -0
  50. package/dist/types/src/kit/view-navigation.d.ts +8 -0
  51. package/dist/types/src/kit/view-snapshot-cache.d.ts +14 -0
  52. package/dist/types/src/kit/view-snapshot.d.ts +15 -0
  53. package/dist/types/src/kit/view-types.d.ts +172 -0
  54. package/dist/types/src/kit/view.d.ts +8 -0
  55. package/dist/types/src/kit/wizard-constants.d.ts +19 -0
  56. package/dist/types/src/kit/wizard-root-styles.d.ts +1 -0
  57. package/dist/types/src/kit/wizard-root.d.ts +23 -0
  58. package/dist/types/src/kit/wizard.d.ts +2 -0
  59. package/dist/types/src/packs/default.d.ts +2 -0
  60. package/dist/types/src/packs/index.d.ts +3 -0
  61. package/dist/types/src/packs/ml.d.ts +2 -0
  62. package/dist/types/src/packs/shared.d.ts +25 -0
  63. package/dist/types/src/presentation/define-explanation-kind.d.ts +11 -0
  64. package/dist/types/src/presentation/define-field-kind.d.ts +18 -0
  65. package/dist/types/src/presentation/define-report-kind.d.ts +15 -0
  66. package/dist/types/src/presentation/index.d.ts +10 -0
  67. package/dist/types/src/presentation/register-kind.d.ts +6 -0
  68. package/dist/types/src/presentation/registry.d.ts +15 -0
  69. package/dist/types/src/presentation/types/explanation.d.ts +32 -0
  70. package/dist/types/src/presentation/types/field.d.ts +36 -0
  71. package/dist/types/src/presentation/types/report.d.ts +41 -0
  72. package/dist/types/src/primitives/base-explanation-element.d.ts +2 -1
  73. package/dist/types/src/primitives/base-field-element.d.ts +2 -1
  74. package/dist/types/src/primitives/base-report-element.d.ts +2 -1
  75. package/dist/types/src/primitives/components/explanation-panel.d.ts +4 -2
  76. package/dist/types/src/primitives/components/field-frame-feedback.d.ts +9 -0
  77. package/dist/types/src/primitives/components/field-frame-styles.d.ts +1 -0
  78. package/dist/types/src/primitives/components/field-frame.d.ts +5 -3
  79. package/dist/types/src/primitives/components/form-errors.d.ts +1 -1
  80. package/dist/types/src/primitives/components/form-root-presenters.d.ts +17 -0
  81. package/dist/types/src/primitives/components/form-root-state.d.ts +19 -0
  82. package/dist/types/src/primitives/components/form-root-styles.d.ts +1 -0
  83. package/dist/types/src/primitives/components/form-root-templates.d.ts +42 -0
  84. package/dist/types/src/primitives/components/form-root.d.ts +4 -2
  85. package/dist/types/src/primitives/components/presentation.d.ts +1 -1
  86. package/dist/types/src/primitives/components/report-frame.d.ts +4 -2
  87. package/dist/types/src/primitives/components/submit-button.d.ts +1 -1
  88. package/dist/types/src/primitives/constants.d.ts +1 -1
  89. package/dist/types/src/primitives/fields/series-field-helpers.d.ts +23 -0
  90. package/dist/types/src/primitives/fields/series-field-styles.d.ts +1 -0
  91. package/dist/types/src/primitives/mount-form.d.ts +1 -1
  92. package/dist/types/src/primitives/presentation.d.ts +8 -0
  93. package/dist/types/src/primitives/types.d.ts +4 -1
  94. package/dist/types/src/{engine → runtime}/builtins/index.d.ts +1 -3
  95. package/dist/types/src/{engine → runtime}/builtins/reports/classifier.d.ts +1 -1
  96. package/dist/types/src/{engine → runtime}/builtins/shared.d.ts +2 -0
  97. package/dist/types/src/runtime/declarative/presentation.d.ts +61 -0
  98. package/dist/types/src/runtime/fields/state-calculations.d.ts +25 -0
  99. package/dist/types/src/runtime/fields/state.d.ts +2 -0
  100. package/dist/types/src/runtime/form.d.ts +1 -0
  101. package/dist/types/src/runtime/index.d.ts +16 -0
  102. package/dist/types/src/runtime/registry/index.d.ts +5 -0
  103. package/dist/types/src/runtime/runtime-behaviors.d.ts +23 -0
  104. package/dist/types/src/runtime/runtime-controller.d.ts +34 -0
  105. package/dist/types/src/runtime/runtime-refresh.d.ts +14 -0
  106. package/dist/types/src/runtime/runtime-values.d.ts +19 -0
  107. package/dist/types/src/runtime/submission/create-submitter.d.ts +2 -0
  108. package/dist/types/src/runtime/submission/error-flow.d.ts +19 -0
  109. package/dist/types/src/runtime/submission/field-updates.d.ts +14 -0
  110. package/dist/types/src/runtime/submission/report-updates.d.ts +16 -0
  111. package/dist/types/src/runtime/submission/stream-progress.d.ts +4 -0
  112. package/dist/types/src/runtime/submission/submitter.d.ts +2 -0
  113. package/dist/types/src/runtime/submission/types.d.ts +60 -0
  114. package/dist/types/src/runtime/types/behavior.d.ts +32 -0
  115. package/dist/types/src/runtime/types/explanation.d.ts +22 -0
  116. package/dist/types/src/runtime/types/field.d.ts +24 -0
  117. package/dist/types/src/{engine → runtime}/types/form.d.ts +8 -11
  118. package/dist/types/src/runtime/types/index.d.ts +9 -0
  119. package/dist/types/src/runtime/types/registry.d.ts +6 -0
  120. package/dist/types/src/runtime/types/report.d.ts +23 -0
  121. package/dist/types/src/{engine → runtime}/utils.d.ts +2 -2
  122. package/dist/types/src/{engine/validation/field.d.ts → runtime/validation/field-state.d.ts} +3 -19
  123. package/dist/types/src/runtime/validation/field-validator.d.ts +18 -0
  124. package/dist/types/src/runtime/validation/field.d.ts +2 -0
  125. package/dist/types/src/schema/index.d.ts +7 -0
  126. package/dist/types/src/schema/normalize.d.ts +2 -0
  127. package/dist/types/src/schema/registry.d.ts +9 -0
  128. package/dist/types/src/schema/types/explanation.d.ts +43 -0
  129. package/dist/types/src/{engine → schema}/types/field.d.ts +3 -45
  130. package/dist/types/src/schema/types/form.d.ts +13 -0
  131. package/dist/types/src/schema/types/report.d.ts +43 -0
  132. package/dist/types/src/shared/index.d.ts +2 -0
  133. package/dist/types/src/shared/object.d.ts +1 -0
  134. package/dist/types/src/shared/strings.d.ts +1 -0
  135. package/dist/types/src/transport/composition/fanout-helpers.d.ts +2 -0
  136. package/dist/types/src/transport/composition/fanout.d.ts +1 -2
  137. package/dist/types/src/transport/composition/index.d.ts +1 -0
  138. package/dist/types/src/transport/composition/quorum-fanout.d.ts +2 -0
  139. package/dist/types/src/transport/internal-core.d.ts +21 -0
  140. package/dist/types/src/transport/internal-errors.d.ts +21 -0
  141. package/dist/types/src/transport/internal-request.d.ts +21 -0
  142. package/dist/types/src/transport/internal-routing.d.ts +25 -0
  143. package/dist/types/src/transport/internal-sse.d.ts +14 -0
  144. package/dist/types/src/transport/internal-stream.d.ts +13 -0
  145. package/dist/types/src/transport/internal.d.ts +6 -110
  146. package/dist/types/src/transport/types/options-http.d.ts +85 -0
  147. package/dist/types/src/transport/types/options-middleware.d.ts +96 -0
  148. package/dist/types/src/transport/types/options-routing.d.ts +82 -0
  149. package/dist/types/src/transport/types/options.d.ts +3 -258
  150. package/package.json +20 -8
  151. package/dist/engine-CEy1IX7y.js +0 -5367
  152. package/dist/kit-DrrbtxI2.js +0 -76
  153. package/dist/mlform/engine.mjs +0 -3
  154. package/dist/mlform/questionnaire.mjs +0 -640
  155. package/dist/types/src/engine/index.d.ts +0 -11
  156. package/dist/types/src/engine/registry/index.d.ts +0 -26
  157. package/dist/types/src/engine/submission/submitter.d.ts +0 -40
  158. package/dist/types/src/engine/types/explanation.d.ts +0 -109
  159. package/dist/types/src/engine/types/index.d.ts +0 -9
  160. package/dist/types/src/engine/types/report.d.ts +0 -87
  161. package/dist/types/src/questionnaire/constants.d.ts +0 -31
  162. package/dist/types/src/questionnaire/defaults.d.ts +0 -8
  163. package/dist/types/src/questionnaire/engine/controller.d.ts +0 -12
  164. package/dist/types/src/questionnaire/engine/schema.d.ts +0 -9
  165. package/dist/types/src/questionnaire/errors.d.ts +0 -3
  166. package/dist/types/src/questionnaire/index.d.ts +0 -6
  167. package/dist/types/src/questionnaire/mount.d.ts +0 -3
  168. package/dist/types/src/questionnaire/primitives/components/questionnaire-root.d.ts +0 -23
  169. package/dist/types/src/questionnaire/primitives/register.d.ts +0 -0
  170. package/dist/types/src/questionnaire/types.d.ts +0 -69
  171. package/dist/types/src/{engine/declarative → presentation/types}/presentation.d.ts +0 -0
  172. package/dist/types/src/{engine → runtime}/builtins/fields/boolean.d.ts +0 -0
  173. package/dist/types/src/{engine → runtime}/builtins/fields/category.d.ts +0 -0
  174. package/dist/types/src/{engine → runtime}/builtins/fields/date.d.ts +0 -0
  175. package/dist/types/src/{engine → runtime}/builtins/fields/long-text.d.ts +0 -0
  176. package/dist/types/src/{engine → runtime}/builtins/fields/mapped-category.d.ts +0 -0
  177. package/dist/types/src/{engine → runtime}/builtins/fields/multi-choice.d.ts +0 -0
  178. package/dist/types/src/{engine → runtime}/builtins/fields/number.d.ts +0 -0
  179. package/dist/types/src/{engine → runtime}/builtins/fields/rating.d.ts +0 -0
  180. package/dist/types/src/{engine → runtime}/builtins/fields/series.d.ts +0 -0
  181. package/dist/types/src/{engine → runtime}/builtins/fields/single-choice.d.ts +0 -0
  182. package/dist/types/src/{engine → runtime}/builtins/fields/text.d.ts +0 -0
  183. package/dist/types/src/{engine → runtime}/builtins/reports/regressor.d.ts +0 -0
  184. package/dist/types/src/{engine → runtime}/comparison.d.ts +0 -0
  185. package/dist/types/src/{engine → runtime}/constants.d.ts +0 -0
  186. package/dist/types/src/{engine/form.d.ts → runtime/create-runtime.d.ts} +0 -0
  187. package/dist/types/src/{engine → runtime}/declarative/explanation.d.ts +0 -0
  188. package/dist/types/src/{engine → runtime}/declarative/field.d.ts +0 -0
  189. package/dist/types/src/{engine → runtime}/declarative/report.d.ts +0 -0
  190. package/dist/types/src/{engine → runtime}/equality.d.ts +0 -0
  191. package/dist/types/src/{engine → runtime}/errors.d.ts +0 -0
  192. package/dist/types/src/{engine → runtime}/explanations/controller.d.ts +0 -0
  193. package/dist/types/src/{engine → runtime}/explanations/index.d.ts +0 -0
  194. package/dist/types/src/{engine → runtime}/fields/controller.d.ts +0 -0
  195. package/dist/types/src/{engine → runtime}/fields/index.d.ts +0 -0
  196. package/dist/types/src/{engine → runtime}/paths.d.ts +0 -0
  197. package/dist/types/src/{engine → runtime}/reports/controller.d.ts +0 -0
  198. package/dist/types/src/{engine → runtime}/reports/index.d.ts +0 -0
  199. package/dist/types/src/{engine → runtime}/schema/index.d.ts +0 -0
  200. package/dist/types/src/{engine → runtime}/state/engine.d.ts +0 -0
  201. package/dist/types/src/{engine → runtime}/state/index.d.ts +0 -0
  202. package/dist/types/src/{engine → runtime}/state/snapshots.d.ts +0 -0
  203. package/dist/types/src/{engine → runtime}/state/store.d.ts +0 -0
  204. package/dist/types/src/{engine → runtime}/submission/abort.d.ts +0 -0
  205. package/dist/types/src/{engine → runtime}/submission/explanations.d.ts +0 -0
  206. package/dist/types/src/{engine → runtime}/submission/index.d.ts +0 -0
  207. package/dist/types/src/{engine → runtime}/submission/lifecycle.d.ts +0 -0
  208. package/dist/types/src/{engine → runtime}/submission/pipeline.d.ts +0 -0
  209. package/dist/types/src/{engine → runtime}/submission/reports.d.ts +0 -0
  210. package/dist/types/src/{engine → runtime}/submission/request.d.ts +0 -0
  211. package/dist/types/src/{engine → runtime}/submission/result.d.ts +0 -0
  212. package/dist/types/src/{engine → runtime}/types/pipeline.d.ts +0 -0
  213. package/dist/types/src/{engine → runtime}/types/transport.d.ts +0 -0
  214. package/dist/types/src/{engine → runtime}/validation/conditions.d.ts +0 -0
  215. package/dist/types/src/{engine → runtime}/validation/form.d.ts +0 -0
  216. package/dist/types/src/{engine → runtime}/validation/index.d.ts +0 -0
  217. package/dist/types/src/{engine → runtime}/values.d.ts +0 -0
  218. package/dist/types/src/{engine → schema}/types/registry.d.ts +1 -1
@@ -0,0 +1,42 @@
1
+ import { nothing, TemplateResult } from 'lit';
2
+ import { PresentationRegistry } from '../../../presentation';
3
+ import { FormController } from '../../../runtime';
4
+ import { PrimitiveText } from '../constants';
5
+ import { PrimitiveRegistry, PrimitiveReportTransport } from '../types';
6
+ import { FormRenderState } from './form-root-state';
7
+ import { PresentedField, PresentedReport } from './form-root-presenters';
8
+ export declare const renderExplanations: (form: FormController, state: FormRenderState, registry: PrimitiveRegistry | undefined, presentationRegistry: PresentationRegistry | undefined, text: PrimitiveText) => TemplateResult | typeof nothing;
9
+ export declare const renderStackedLayout: (options: {
10
+ form: FormController;
11
+ state: FormRenderState;
12
+ visibleFields: readonly PresentedField[];
13
+ reportsToRender: readonly PresentedReport[];
14
+ showReports: boolean;
15
+ registry: PrimitiveRegistry | undefined;
16
+ presentationRegistry: PresentationRegistry | undefined;
17
+ text: PrimitiveText;
18
+ formLabel: string;
19
+ reportsLabel: string;
20
+ submitLabel: string;
21
+ validatingLabel: string;
22
+ submittingLabel: string;
23
+ reportTransport: PrimitiveReportTransport | undefined;
24
+ onSubmitRequest: () => Promise<void>;
25
+ }) => TemplateResult;
26
+ export declare const renderSplitLayout: (options: {
27
+ form: FormController;
28
+ state: FormRenderState;
29
+ visibleFields: readonly PresentedField[];
30
+ reportsToRender: readonly PresentedReport[];
31
+ showReports: boolean;
32
+ registry: PrimitiveRegistry | undefined;
33
+ presentationRegistry: PresentationRegistry | undefined;
34
+ text: PrimitiveText;
35
+ formLabel: string;
36
+ reportsLabel: string;
37
+ submitLabel: string;
38
+ validatingLabel: string;
39
+ submittingLabel: string;
40
+ reportTransport: PrimitiveReportTransport | undefined;
41
+ onSubmitRequest: () => Promise<void>;
42
+ }) => TemplateResult;
@@ -1,5 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
- import { FormController } from '../../../engine';
2
+ import { PresentationRegistry } from '../../../presentation';
3
+ import { FormController } from '../../../runtime';
3
4
  import { primitiveTagNames, PrimitiveText } from '../constants';
4
5
  import { PrimitiveLayout, PrimitiveRegistry, PrimitiveReportTransport } from '../types';
5
6
  export declare class PrimitiveFormElement extends LitElement {
@@ -7,6 +8,7 @@ export declare class PrimitiveFormElement extends LitElement {
7
8
  static styles: import('lit').CSSResult;
8
9
  accessor form: FormController | undefined;
9
10
  accessor registry: PrimitiveRegistry | undefined;
11
+ accessor presentationRegistry: PresentationRegistry | undefined;
10
12
  accessor layout: PrimitiveLayout;
11
13
  accessor formLabel: string;
12
14
  accessor reportsLabel: string;
@@ -20,7 +22,7 @@ export declare class PrimitiveFormElement extends LitElement {
20
22
  protected willUpdate(changedProperties: Map<string, unknown>): void;
21
23
  connectedCallback(): void;
22
24
  disconnectedCallback(): void;
23
- render(): import('lit').TemplateResult<1>;
25
+ render(): import('lit').TemplateResult;
24
26
  }
25
27
  declare global {
26
28
  interface HTMLElementTagNameMap {
@@ -1,4 +1,4 @@
1
1
  import { nothing, TemplateResult } from 'lit';
2
- import { PresentationNode, PresentationSummary } from '../../../engine';
2
+ import { PresentationNode, PresentationSummary } from '../../../runtime';
3
3
  export declare const renderPresentationSummary: (summary: PresentationSummary | null | undefined, fallbackTitle?: string) => TemplateResult | typeof nothing;
4
4
  export declare const renderPresentationNodes: (nodes: PresentationNode[]) => TemplateResult | typeof nothing;
@@ -1,5 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
- import { ReportController, SubmitResult } from '../../../engine';
2
+ import { ReportController, SubmitResult } from '../../../runtime';
3
+ import { ReportDescriptor } from '../../../presentation';
3
4
  import { primitiveTagNames, PrimitiveText } from '../constants';
4
5
  import { PrimitiveReportTransport, PrimitiveRegistry } from '../types';
5
6
  export declare class PrimitiveReportFrameElement extends LitElement {
@@ -10,7 +11,8 @@ export declare class PrimitiveReportFrameElement extends LitElement {
10
11
  accessor text: PrimitiveText;
11
12
  accessor transport: PrimitiveReportTransport | undefined;
12
13
  accessor lastResult: SubmitResult | null;
13
- private accessor descriptor;
14
+ accessor descriptor: ReportDescriptor | null;
15
+ private accessor resolvedDescriptor;
14
16
  private accessor reportState;
15
17
  protected willUpdate(changedProperties: Map<string, unknown>): void;
16
18
  render(): import('lit').TemplateResult;
@@ -1,5 +1,5 @@
1
1
  import { LitElement } from 'lit';
2
- import { FormStatus } from '../../../engine';
2
+ import { FormStatus } from '../../../runtime';
3
3
  import { primitiveTagNames } from '../constants';
4
4
  export declare class PrimitiveSubmitButtonElement extends LitElement {
5
5
  #private;
@@ -1,4 +1,4 @@
1
- import { FormStatus, ReportStatus } from '../../engine';
1
+ import { FormStatus, ReportStatus } from '../../runtime';
2
2
  export declare const primitiveTagNames: {
3
3
  readonly form: "mlf-form";
4
4
  readonly formErrors: "mlf-form-errors";
@@ -0,0 +1,23 @@
1
+ export type SeriesSubFieldConfig = {
2
+ kind?: unknown;
3
+ label?: unknown;
4
+ required?: unknown;
5
+ options?: unknown;
6
+ min?: unknown;
7
+ max?: unknown;
8
+ step?: unknown;
9
+ unit?: unknown;
10
+ placeholder?: unknown;
11
+ trueLabel?: unknown;
12
+ falseLabel?: unknown;
13
+ };
14
+ export type DraftRow = {
15
+ key: string;
16
+ field1: unknown;
17
+ field2: unknown;
18
+ };
19
+ export declare const createRowKey: () => string;
20
+ export declare const normalizeCellValue: (config: SeriesSubFieldConfig, value: unknown) => unknown;
21
+ export declare const normalizeRows: (value: unknown, field1Config: SeriesSubFieldConfig, field2Config: SeriesSubFieldConfig) => DraftRow[];
22
+ export declare const commitSeriesCellValue: (config: SeriesSubFieldConfig, value: unknown) => unknown;
23
+ export declare const seriesNumberUnit: (config: SeriesSubFieldConfig) => string;
@@ -0,0 +1 @@
1
+ export declare const seriesFieldStyles: import('lit').CSSResult;
@@ -1,4 +1,4 @@
1
- import { FormController } from '../../engine';
1
+ import { FormController } from '../../runtime';
2
2
  import { MountFormOptions, MountedForm } from './types';
3
3
  export declare const mountForm: (container: HTMLElement, form: FormController, options?: MountFormOptions) => MountedForm;
4
4
  export declare const unmountForm: (mounted: MountedForm) => void;
@@ -0,0 +1,8 @@
1
+ import { ExplanationDescriptor, FieldDescriptor, PresentationRegistry, ReportDescriptor } from '../../presentation';
2
+ import { ExplanationController, FieldController, FormController, ReportController } from '../../runtime';
3
+ export declare const fallbackFieldDescriptor: (field: FieldController) => FieldDescriptor;
4
+ export declare const fallbackReportDescriptor: (report: ReportController) => ReportDescriptor;
5
+ export declare const fallbackExplanationDescriptor: (explanation: ExplanationController) => ExplanationDescriptor;
6
+ export declare const resolveFieldDescriptor: (field: FieldController, presentationRegistry: PresentationRegistry | undefined) => FieldDescriptor;
7
+ export declare const resolveReportDescriptor: (report: ReportController, form: FormController, presentationRegistry: PresentationRegistry | undefined) => ReportDescriptor | null;
8
+ export declare const resolveExplanationDescriptor: (explanation: ExplanationController, presentationRegistry: PresentationRegistry | undefined) => ExplanationDescriptor | null;
@@ -1,5 +1,6 @@
1
- import { ExplanationController, ExplanationDescriptor, ExplanationFetchRequest, ExplanationFetchTransport, FieldController, FieldDescriptor, FormController, FormState, FormStatus, ReportController, ReportDescriptor, SubmitResult } from '../../engine';
1
+ import { ExplanationController, ExplanationFetchRequest, ExplanationFetchTransport, FieldController, FormController, FormState, FormStatus, ReportController, SubmitResult } from '../../runtime';
2
2
  import { PrimitiveText, PrimitiveTextOverrides } from './constants';
3
+ import { ExplanationDescriptor, FieldDescriptor, PresentationRegistry, ReportDescriptor } from '../../presentation';
3
4
  export type PrimitiveLayout = "stacked" | "split";
4
5
  export type PrimitiveContainerStrategy = "error" | "replace";
5
6
  export interface PrimitiveRegistry {
@@ -48,6 +49,7 @@ export type ExplanationRequest = ExplanationFetchRequest;
48
49
  export type ExplanationTransport = ExplanationFetchTransport;
49
50
  export interface MountFormOptions {
50
51
  registry?: PrimitiveRegistry;
52
+ presentationRegistry?: PresentationRegistry;
51
53
  layout?: PrimitiveLayout;
52
54
  containerStrategy?: PrimitiveContainerStrategy;
53
55
  formLabel?: string;
@@ -64,6 +66,7 @@ export interface MountedForm {
64
66
  readonly form: FormController;
65
67
  readonly host: HTMLElement;
66
68
  readonly registry: PrimitiveRegistry;
69
+ readonly presentationRegistry: PresentationRegistry;
67
70
  readonly text: PrimitiveText;
68
71
  unmount(): void;
69
72
  }
@@ -1,4 +1,3 @@
1
- import { Registry } from '../types';
2
1
  import { booleanFieldDefinition } from './fields/boolean';
3
2
  import { categoryFieldDefinition } from './fields/category';
4
3
  import { mappedCategoryFieldDefinition } from './fields/mapped-category';
@@ -96,10 +95,9 @@ export declare const builtinFieldDefinitions: readonly [import('..').FieldDefini
96
95
  export declare const builtinReportDefinitions: readonly [import('..').ReportDefinition<import('..').BaseReportConfig & {
97
96
  kind: "classifier";
98
97
  labels?: string[];
99
- details?: boolean;
98
+ showClassProbabilities?: boolean;
100
99
  }>, import('..').ReportDefinition<import('..').BaseReportConfig & {
101
100
  kind: "regressor";
102
101
  unit?: string;
103
102
  precision?: number;
104
103
  }>];
105
- export declare const createBuiltinRegistry: () => Registry;
@@ -2,7 +2,7 @@ import { BaseReportConfig, ReportDefinition } from '../../types';
2
2
  type ClassifierReportConfig = BaseReportConfig & {
3
3
  kind: "classifier";
4
4
  labels?: string[];
5
- details?: boolean;
5
+ showClassProbabilities?: boolean;
6
6
  };
7
7
  export declare const classifierReportDefinition: ReportDefinition<ClassifierReportConfig>;
8
8
  export {};
@@ -5,6 +5,7 @@ export declare const baseFieldShape: {
5
5
  id: z.ZodOptional<z.ZodString>;
6
6
  label: z.ZodString;
7
7
  description: z.ZodOptional<z.ZodString>;
8
+ showDescriptionInline: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
9
  required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
9
10
  disabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
10
11
  hidden: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -42,6 +43,7 @@ export declare const makeFieldDescriptor: (component: string, config: Normalized
42
43
  kind: string;
43
44
  label: string;
44
45
  description: string;
46
+ showDescriptionInline: boolean;
45
47
  required: boolean;
46
48
  disabled: boolean;
47
49
  };
@@ -0,0 +1,61 @@
1
+ export type PresentationTone = "neutral" | "info" | "success" | "warning" | "danger";
2
+ export interface PresentationSummary {
3
+ title?: string;
4
+ description?: string;
5
+ value?: unknown;
6
+ badge?: string;
7
+ tone?: PresentationTone;
8
+ }
9
+ export interface PresentationTextNode {
10
+ type: "text";
11
+ label?: string;
12
+ value: unknown;
13
+ tone?: PresentationTone;
14
+ }
15
+ export interface PresentationMetricNode {
16
+ type: "metric";
17
+ label: string;
18
+ value: unknown;
19
+ hint?: string;
20
+ tone?: PresentationTone;
21
+ }
22
+ export interface PresentationKeyValueEntry {
23
+ label: string;
24
+ value: unknown;
25
+ }
26
+ export interface PresentationKeyValueNode {
27
+ type: "kv";
28
+ label?: string;
29
+ entries: PresentationKeyValueEntry[] | Record<string, unknown>;
30
+ }
31
+ export interface PresentationListNode {
32
+ type: "list";
33
+ label?: string;
34
+ items: unknown[];
35
+ ordered?: boolean;
36
+ }
37
+ export interface PresentationTableNode {
38
+ type: "table";
39
+ label?: string;
40
+ columns: string[];
41
+ rows: Array<Record<string, unknown> | unknown[]>;
42
+ }
43
+ export interface PresentationBadgeNode {
44
+ type: "badge";
45
+ label: string;
46
+ tone?: PresentationTone;
47
+ }
48
+ export interface PresentationNoticeNode {
49
+ type: "notice";
50
+ title?: string;
51
+ body: unknown;
52
+ tone?: PresentationTone;
53
+ }
54
+ export interface PresentationJsonNode {
55
+ type: "json";
56
+ label?: string;
57
+ value: unknown;
58
+ }
59
+ export type PresentationNode = PresentationTextNode | PresentationMetricNode | PresentationKeyValueNode | PresentationListNode | PresentationTableNode | PresentationBadgeNode | PresentationNoticeNode | PresentationJsonNode;
60
+ export type PresentationContent = PresentationNode | PresentationNode[];
61
+ export declare const toPresentationNodes: (value: PresentationContent | undefined) => PresentationNode[];
@@ -0,0 +1,25 @@
1
+ import { InternalFieldState } from '../state';
2
+ import { FieldDefinition, FormStatus, InactiveFieldPolicy, NormalizedFieldConfig } from '../types';
3
+ export declare const prepareFieldState: ({ config, definition, value, values, currentState, getSubmitCount, getFormStatus, }: {
4
+ config: NormalizedFieldConfig;
5
+ definition: FieldDefinition;
6
+ value: unknown;
7
+ values: Record<string, unknown>;
8
+ currentState: InternalFieldState;
9
+ getSubmitCount: () => number;
10
+ getFormStatus: () => FormStatus;
11
+ }) => InternalFieldState;
12
+ export declare const refreshFieldState: ({ config, definition, currentState, values, getSubmitCount, getFormStatus, options, }: {
13
+ config: NormalizedFieldConfig;
14
+ definition: FieldDefinition;
15
+ currentState: InternalFieldState;
16
+ values: Record<string, unknown>;
17
+ getSubmitCount: () => number;
18
+ getFormStatus: () => FormStatus;
19
+ options?: {
20
+ preserveValidationErrors?: boolean;
21
+ preserveExternalErrors?: boolean;
22
+ resetInactiveToInitial?: boolean;
23
+ inactiveFieldPolicy?: InactiveFieldPolicy;
24
+ };
25
+ }) => InternalFieldState;
@@ -0,0 +1,2 @@
1
+ import { EngineStore, InternalFieldState } from '../state';
2
+ export declare const setFieldState: (store: EngineStore, fieldId: string, nextState: InternalFieldState) => void;
@@ -0,0 +1 @@
1
+ export { createForm } from './create-runtime';
@@ -0,0 +1,16 @@
1
+ export { booleanFieldDefinition, categoryFieldDefinition, classifierReportDefinition, dateFieldDefinition, mappedCategoryFieldDefinition, longTextFieldDefinition, multiChoiceFieldDefinition, numberFieldDefinition, ratingFieldDefinition, regressorReportDefinition, seriesFieldDefinition, singleChoiceFieldDefinition, textFieldDefinition, } from './builtins';
2
+ export { createExplanationController } from './explanations';
3
+ export { executeExplanations, executeFormPipeline } from './submission';
4
+ export { EngineError, ReportPayloadError, RegistryError, SubmissionAbortedError, SubmitError, TransportError, transportErrorCodes, ValidationError, } from './errors';
5
+ export type { TransportErrorCode } from './errors';
6
+ export { createForm, createForm as createFormRuntime } from './form';
7
+ export { createRegistry, defineExplanationDefinition, defineFieldDefinition, defineReportDefinition, } from './registry';
8
+ export { defineExplanationKind, defineFieldKind, defineReportKind } from '../../presentation';
9
+ export { defaultEquality, shallowArrayEquality, shallowEquality, shallowObjectEquality, } from './equality';
10
+ export { identity, isPromiseLike } from './utils';
11
+ export type { AfterExplanationContext, AllConditions, AfterSubmitContext, AfterValidateContext, AnyConditions, BaseExplanationConfig, BaseFieldConfig, BaseReportConfig, BeforeSubmitContext, BeforeValidateContext, ExplanationFetchContext, ExplanationFetchFactory, CreateFormConfig, DeclarativeFieldCondition, ExplanationConfig, ExplanationController, ExplanationDefinition, ExplanationErrorContext, ExplanationExecutionContext, ExplanationExecutionResult, ExplanationFetchRequest, ExplanationFetchTransport, ExplanationStateSnapshot, ExplanationStatus, FieldValidationFnContext, FieldValueAdapter, FieldConfig, FieldComparisonCondition, FieldCondition, FieldConditionContext, FieldController, FieldDefinition, FieldStateSnapshot, FieldStatus, FieldValueCondition, FieldValidationContext, FieldValidationResult, FormController, FormHooks, FormSchema, FormState, FormStatusCondition, FormStatus, FormValidator, FormValidationContext, FormValidationIssue, FormValidationResult, InactiveFieldPolicy, MaybePromise, NormalizedExplanationConfig, NormalizedFieldConfig, NormalizedReportConfig, Registry, ReportConfig, ReportController, ReportDefinition, ReportResolveContext, ReportStateSnapshot, ReportStatus, PipelineArtifactAdapter, PipelineArtifactContext, PipelineResult, ExecuteFormPipelineOptions, SelectorSubscriptionOptions, SubmitCountCondition, SubmitErrorContext, SubmitOptions, SubmitRequest, SubmitRequestTransportContext, SubmitResult, Transport, TransportAuthKind, TransportBackpressureMode, TransportCapabilities, TransportConsistency, TransportDeliveryMode, TransportPolicyContext, TransportSession, TransportSessionEvent, TransportSessionMessage, TransportStreamEvent, TransportResponse, NotCondition, RuntimeBehavior, RuntimeBehaviorContext, RuntimeBehaviorSubmissionRecords, RuntimeBehaviorValueChangeEvent, } from './types';
12
+ export type { DeclarativeExplanationKind, DeclarativeFieldKind, DeclarativeReportKind, ExplanationDescriptor, ExplanationDescriptorContext, ExplanationRenderSpec, ExplanationRenderSpecContext, FieldDescriptor, FieldRenderHints, FieldRenderSpec, FieldRenderSpecContext, FieldWidget, PresentationContent, PresentationNode, PresentationSummary, PresentationTone, ReportDescriptor, ReportRenderSpec, ReportRenderSpecContext, } from '../../presentation';
13
+ export type FieldHandle = import('./types').FieldController;
14
+ export type ReportHandle = import('./types').ReportController;
15
+ export type ExplanationHandle = import('./types').ExplanationController;
16
+ export type FormRuntime = import('./types').FormController;
@@ -0,0 +1,5 @@
1
+ import { ExplanationDefinition, FieldDefinition, Registry, ReportDefinition } from '../types';
2
+ export declare const createRegistry: () => Registry;
3
+ export declare const defineFieldDefinition: <TConfig extends import('../../../schema').FieldConfig, TValue>(definition: FieldDefinition<TConfig, TValue>) => FieldDefinition<TConfig, TValue>;
4
+ export declare const defineReportDefinition: <TConfig extends import('../../../schema').ReportConfig>(definition: ReportDefinition<TConfig>) => ReportDefinition<TConfig>;
5
+ export declare const defineExplanationDefinition: <TConfig extends import('../../../schema').ExplanationConfig>(definition: ExplanationDefinition<TConfig>) => ExplanationDefinition<TConfig>;
@@ -0,0 +1,23 @@
1
+ import { Registry } from '../../schema';
2
+ import { InternalFieldController } from './fields';
3
+ import { CreateFormConfig, FormState, RuntimeBehavior, RuntimeBehaviorContext, RuntimeBehaviorValueChangeEvent } from './types';
4
+ type CreateRuntimeBehaviorsOptions = {
5
+ registry: Registry;
6
+ behaviors: RuntimeBehavior[];
7
+ fields: readonly InternalFieldController[];
8
+ getValues: () => Record<string, unknown>;
9
+ getSubmitCount: () => number;
10
+ getFormStatus: () => FormState["status"];
11
+ commitDerivedValue: (targetId: string, value: unknown) => void;
12
+ syncDerivedState: (values: Record<string, unknown>) => void;
13
+ onListenerError: CreateFormConfig["onListenerError"];
14
+ };
15
+ export declare const createRuntimeBehaviors: ({ registry, behaviors, fields, getValues, getSubmitCount, getFormStatus, commitDerivedValue, syncDerivedState, onListenerError, }: CreateRuntimeBehaviorsOptions) => {
16
+ createBehaviorContext: () => RuntimeBehaviorContext;
17
+ runBehaviorValueChange: (event: RuntimeBehaviorValueChangeEvent) => void;
18
+ runBeforeSubmitRecords: (records: import('./types').RuntimeBehaviorSubmissionRecords) => Promise<void>;
19
+ validateBehaviors: () => void;
20
+ fieldMap: Map<string, InternalFieldController>;
21
+ resolveField: (targetId: string) => InternalFieldController | undefined;
22
+ };
23
+ export {};
@@ -0,0 +1,34 @@
1
+ import { FormController, FormState, RuntimeBehaviorValueChangeEvent } from './types';
2
+ import { InternalExplanationController } from './explanations';
3
+ import { InternalFieldController } from './fields';
4
+ import { InternalReportController } from './reports';
5
+ import { EngineStore } from './state';
6
+ type CreateRuntimeControllerOptions = {
7
+ fields: InternalFieldController[];
8
+ reports: InternalReportController[];
9
+ explanations: InternalExplanationController[];
10
+ fieldMap: Map<string, InternalFieldController>;
11
+ reportMap: Map<string, InternalReportController>;
12
+ explanationMap: Map<string, InternalExplanationController>;
13
+ store: EngineStore;
14
+ getPublicState: () => FormState;
15
+ getValues: () => Record<string, unknown>;
16
+ getInternalValues: () => Record<string, unknown>;
17
+ formValidator: {
18
+ validate(): Promise<import('./types').FormValidationResult>;
19
+ };
20
+ formSubmitter: {
21
+ submit(options?: import('./types').SubmitOptions): Promise<import('./types').SubmitResult>;
22
+ abort(reason?: string): void;
23
+ reset(): void;
24
+ };
25
+ syncDerivedFieldState: (options?: import('./fields').RefreshOptions) => void;
26
+ shouldResetInactiveFields: () => boolean;
27
+ inactiveFieldPolicy: import('./types').InactiveFieldPolicy | undefined;
28
+ bumpLifecycleVersion: () => number;
29
+ resetReports: () => void;
30
+ resetExplanations: () => void;
31
+ runBehaviorValueChange: (event: RuntimeBehaviorValueChangeEvent) => void;
32
+ };
33
+ export declare const createRuntimeController: ({ fields, reports, explanations, fieldMap, reportMap, explanationMap, store, getPublicState, getValues, getInternalValues, formValidator, formSubmitter, syncDerivedFieldState, shouldResetInactiveFields, inactiveFieldPolicy, bumpLifecycleVersion, resetReports, resetExplanations, runBehaviorValueChange, }: CreateRuntimeControllerOptions) => FormController;
34
+ export {};
@@ -0,0 +1,14 @@
1
+ import { InternalFieldState, EngineStore } from './state';
2
+ import { RefreshOptions, InternalFieldController } from './fields';
3
+ type CreateRuntimeRefreshOptions = {
4
+ store: EngineStore;
5
+ fields: readonly InternalFieldController[];
6
+ shouldResetInactiveFields: () => boolean;
7
+ inactiveFieldPolicy: RefreshOptions["inactiveFieldPolicy"];
8
+ hasInteractiveFieldState: (fieldStates: Record<string, InternalFieldState>) => boolean;
9
+ };
10
+ export declare const createRuntimeRefresh: ({ store, fields, shouldResetInactiveFields, inactiveFieldPolicy, hasInteractiveFieldState, }: CreateRuntimeRefreshOptions) => {
11
+ syncDerivedFieldState: (options?: RefreshOptions) => void;
12
+ setRestingStatus: () => void;
13
+ };
14
+ export {};
@@ -0,0 +1,19 @@
1
+ import { RefreshOptions, InternalFieldController } from './fields';
2
+ import { InternalFieldState } from './state';
3
+ type GetFieldMap = () => Map<string, InternalFieldController>;
4
+ type GetValues = () => Record<string, unknown>;
5
+ type CreateRuntimeValuesOptions = {
6
+ getFieldMap: GetFieldMap;
7
+ getValues: GetValues;
8
+ getCurrentFieldState: (fieldId: string) => InternalFieldState | undefined;
9
+ syncDerivedFieldState: (options?: RefreshOptions) => void;
10
+ shouldResetInactiveFields: () => boolean;
11
+ inactiveFieldPolicy: RefreshOptions["inactiveFieldPolicy"];
12
+ };
13
+ export declare const createRuntimeValues: ({ getFieldMap, getValues, getCurrentFieldState, syncDerivedFieldState, shouldResetInactiveFields, inactiveFieldPolicy, }: CreateRuntimeValuesOptions) => {
14
+ getValues: () => {
15
+ [k: string]: unknown;
16
+ };
17
+ commitDerivedValue: (targetId: string, value: unknown) => void;
18
+ };
19
+ export {};
@@ -0,0 +1,2 @@
1
+ import { CreateFormSubmitterOptions, FormSubmitter } from './types';
2
+ export declare const createFormSubmitter: ({ store, transport, hooks, hookFailurePolicy, normalizedSchema, fields, reports, validate, getSubmitCount, markReportsLoading, resetReports, resetExplanations, syncDerivedFieldState, shouldResetInactiveFields, resolveInactiveFieldPolicy, inactiveFieldPolicy, onRemoteFieldUpdate, beforeSubmitRecords, }: CreateFormSubmitterOptions) => FormSubmitter;
@@ -0,0 +1,19 @@
1
+ import { EngineStore } from '../state';
2
+ import { FormHooks } from '../types';
3
+ import { SubmissionValueRecords } from './request';
4
+ import { createSubmissionAbortManager } from './abort';
5
+ import { createSubmissionLifecycle } from './lifecycle';
6
+ type AbortManager = ReturnType<typeof createSubmissionAbortManager>;
7
+ type Lifecycle = ReturnType<typeof createSubmissionLifecycle>;
8
+ type CreateSubmissionErrorFlowOptions = {
9
+ hooks: FormHooks | undefined;
10
+ abortManager: AbortManager;
11
+ lifecycle: Lifecycle;
12
+ store: EngineStore;
13
+ };
14
+ export declare const createSubmissionErrorFlow: ({ hooks, abortManager, lifecycle, store, }: CreateSubmissionErrorFlowOptions) => {
15
+ notifySubmitError: (backend: string | undefined, records: SubmissionValueRecords, submitCount: number, error: unknown) => Promise<void>;
16
+ handleSubmissionAbort: (error: unknown, submissionRequestId: number, lifecycleVersion: number, submitCount: number, records: SubmissionValueRecords, backend: string | undefined) => Promise<never>;
17
+ handleSubmissionError: (error: unknown, submissionRequestId: number, lifecycleVersion: number, submitCount: number, records: SubmissionValueRecords, backend: string | undefined) => Promise<never>;
18
+ };
19
+ export {};
@@ -0,0 +1,14 @@
1
+ import { EngineStore } from '../state';
2
+ import { TransportStreamEvent } from '../types';
3
+ import { LiveSubmissionField } from './types';
4
+ type CreateFieldUpdatesOptions = {
5
+ store: EngineStore;
6
+ fieldMap: Map<string, LiveSubmissionField>;
7
+ onRemoteFieldUpdate?: (fieldId: string) => Promise<void>;
8
+ };
9
+ export declare const createFieldUpdates: ({ store, fieldMap, onRemoteFieldUpdate, }: CreateFieldUpdatesOptions) => {
10
+ applyFieldUpdate: (event: Extract<TransportStreamEvent, {
11
+ type: "field-update";
12
+ }>) => void;
13
+ };
14
+ export {};
@@ -0,0 +1,16 @@
1
+ import { LiveSubmissionReport } from './types';
2
+ import { SubmissionValueRecords } from './request';
3
+ type CreateReportUpdatesOptions = {
4
+ reportMap: Map<string, LiveSubmissionReport>;
5
+ getReportState: (reportId: string) => {
6
+ payload?: unknown;
7
+ } | undefined;
8
+ getReportStates: () => Record<string, unknown>;
9
+ getSubmissionMeta: () => Record<string, unknown>;
10
+ storePendingPatch: (reportId: string, patch: Record<string, unknown>) => void;
11
+ };
12
+ export declare const createReportUpdates: ({ reportMap, getReportState, getReportStates, getSubmissionMeta, storePendingPatch, }: CreateReportUpdatesOptions) => {
13
+ applyValidatedReportReplace: (reportId: string, payload: unknown, records: SubmissionValueRecords, backend: string | undefined) => Promise<void>;
14
+ applyValidatedReportPatch: (reportId: string, patch: unknown, strategy: "replace" | "shallow-merge" | "deep-merge" | undefined, records: SubmissionValueRecords, backend: string | undefined) => Promise<void>;
15
+ };
16
+ export {};
@@ -0,0 +1,4 @@
1
+ import { EngineStore } from '../state';
2
+ import { SubmissionProgressState, TransportStreamEvent } from '../types';
3
+ export declare const updateStreamProgress: (store: EngineStore, currentRequestId: () => number | null, progress: SubmissionProgressState, submissionRequestId: number, lifecycleVersion: number) => void;
4
+ export declare const toSubmissionProgress: (previous: SubmissionProgressState | null, event: TransportStreamEvent) => SubmissionProgressState;
@@ -0,0 +1,2 @@
1
+ export { createFormSubmitter } from './create-submitter';
2
+ export type { FormSubmitter, CreateFormSubmitterOptions } from './types';
@@ -0,0 +1,60 @@
1
+ import { NormalizedFormSchema } from '../schema';
2
+ import { InternalFieldState, EngineStore } from '../state';
3
+ import { FormHooks, FormValidationResult, InactiveFieldPolicy, SubmissionProgressState, SubmitOptions, SubmitResult, Transport, TransportStreamEvent } from '../types';
4
+ import { buildSubmissionValueRecords, SubmissionValueRecords } from './request';
5
+ import { SubmissionReport } from './reports';
6
+ export type SubmissionField = Parameters<typeof buildSubmissionValueRecords>[0][number];
7
+ export type LiveSubmissionField = SubmissionField & {
8
+ coerceValue(value: unknown): unknown;
9
+ commitState(state: InternalFieldState): void;
10
+ };
11
+ export type LiveSubmissionReport = SubmissionReport;
12
+ export type SyncDerivedFieldStateOptions = {
13
+ values?: Record<string, unknown>;
14
+ preserveValidationErrors?: boolean;
15
+ preserveExternalErrors?: boolean;
16
+ resetInactiveToInitial?: boolean;
17
+ inactiveFieldPolicy?: InactiveFieldPolicy;
18
+ };
19
+ export type CreateFormSubmitterOptions = {
20
+ store: EngineStore;
21
+ transport: Transport;
22
+ hooks?: FormHooks;
23
+ hookFailurePolicy?: {
24
+ afterSubmit?: "fail-submit" | "preserve-success";
25
+ };
26
+ normalizedSchema: NormalizedFormSchema;
27
+ fields: readonly SubmissionField[];
28
+ reports: readonly SubmissionReport[];
29
+ validate: () => Promise<FormValidationResult>;
30
+ getSubmitCount: () => number;
31
+ markReportsLoading: () => void;
32
+ resetReports: () => void;
33
+ resetExplanations: () => void;
34
+ syncDerivedFieldState: (options?: SyncDerivedFieldStateOptions) => void;
35
+ shouldResetInactiveFields: () => boolean;
36
+ resolveInactiveFieldPolicy: (field: SubmissionField) => InactiveFieldPolicy;
37
+ inactiveFieldPolicy?: InactiveFieldPolicy;
38
+ onRemoteFieldUpdate?: (fieldId: string) => Promise<void>;
39
+ beforeSubmitRecords?: (records: SubmissionValueRecords) => Promise<void>;
40
+ };
41
+ export type FormSubmitter = {
42
+ submit(options?: SubmitOptions): Promise<SubmitResult>;
43
+ abort(reason?: string): void;
44
+ reset(): void;
45
+ };
46
+ export type SubmissionMaps = {
47
+ fieldMap: Map<string, LiveSubmissionField>;
48
+ reportMap: Map<string, LiveSubmissionReport>;
49
+ };
50
+ export type SubmissionRuntime = {
51
+ store: EngineStore;
52
+ maps: SubmissionMaps;
53
+ onRemoteFieldUpdate?: (fieldId: string) => Promise<void>;
54
+ };
55
+ export type StreamApplyContext = {
56
+ records: SubmissionValueRecords;
57
+ backend: string | undefined;
58
+ };
59
+ export type StreamProgressHandler = (progress: SubmissionProgressState, submissionRequestId: number, lifecycleVersion: number) => void;
60
+ export type StreamEventApplier = (event: TransportStreamEvent, context: StreamApplyContext) => Promise<void>;
@@ -0,0 +1,32 @@
1
+ import { Registry } from '../../../schema';
2
+ import { FieldHandle } from './field';
3
+ import { FormStatus } from './form';
4
+ type MaybePromise<T> = T | PromiseLike<T>;
5
+ export interface RuntimeBehaviorValueChangeEvent {
6
+ fieldId: string;
7
+ source: "local" | "remote";
8
+ values: Record<string, unknown>;
9
+ }
10
+ export interface RuntimeBehaviorSubmissionRecords {
11
+ values: Record<string, unknown>;
12
+ fieldValues: Record<string, unknown>;
13
+ serializedValues: Record<string, unknown>;
14
+ serializedFieldValues: Record<string, unknown>;
15
+ }
16
+ export interface RuntimeBehaviorContext {
17
+ readonly registry: Registry;
18
+ readonly fields: readonly FieldHandle[];
19
+ getField(id: string): FieldHandle | undefined;
20
+ resolveFieldId(id: string): string | undefined;
21
+ getValues(): Record<string, unknown>;
22
+ getSubmitCount(): number;
23
+ getFormStatus(): FormStatus;
24
+ commitDerivedValue(fieldId: string, value: unknown): void;
25
+ syncDerivedState(values?: Record<string, unknown>): void;
26
+ }
27
+ export interface RuntimeBehavior {
28
+ validate?(context: RuntimeBehaviorContext): void;
29
+ onValuesChanged?(event: RuntimeBehaviorValueChangeEvent, context: RuntimeBehaviorContext): MaybePromise<void>;
30
+ beforeSubmitRecords?(records: RuntimeBehaviorSubmissionRecords, context: RuntimeBehaviorContext): MaybePromise<void>;
31
+ }
32
+ export {};
@@ -0,0 +1,22 @@
1
+ import { ExplanationDefinition as SchemaExplanationDefinition, ExplanationFetchRequest, ExplanationStateSnapshot, NormalizedExplanationConfig as SchemaNormalizedExplanationConfig } from '../../../schema';
2
+ import { ExplanationDescriptor } from '../../../presentation';
3
+ export type { BaseExplanationConfig, ExplanationConfig, ExplanationFetchContext, ExplanationFetchFactory, ExplanationFetchRequest, ExplanationFetchTransport, ExplanationStateSnapshot, ExplanationStatus, } from '../../../schema';
4
+ export interface ExplanationHandle {
5
+ readonly id: string;
6
+ readonly kind: string;
7
+ readonly config: SchemaNormalizedExplanationConfig;
8
+ readonly state: ExplanationStateSnapshot;
9
+ fetch(request: ExplanationFetchRequest): Promise<void>;
10
+ abort(): void;
11
+ reset(): void;
12
+ subscribe(listener: (state: ExplanationStateSnapshot) => void): () => void;
13
+ }
14
+ export type ExplanationController = ExplanationHandle;
15
+ export type ExplanationDefinition<TConfig extends import('../../../schema').ExplanationConfig = import('../../../schema').ExplanationConfig> = SchemaExplanationDefinition<TConfig> & {
16
+ describe?: (config: SchemaNormalizedExplanationConfig<TConfig>, context: {
17
+ explanationId: string;
18
+ state: ExplanationStateSnapshot;
19
+ }) => ExplanationDescriptor | null;
20
+ [key: string]: unknown;
21
+ };
22
+ export type NormalizedExplanationConfig<TConfig extends import('../../../schema').ExplanationConfig = import('../../../schema').ExplanationConfig> = SchemaNormalizedExplanationConfig<TConfig>;