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.
- package/README.md +39 -12
- package/dist/builtins-DegwhFGA.js +3507 -0
- package/dist/builtins-ml-9qB2MOxt.js +51 -0
- package/dist/{design-system-CrrSGfFB.js → design-system-Dxx1Sh7r.js} +284 -268
- package/dist/errors-B3H1wRwj.js +8 -0
- package/dist/kit-CuRF6dhL.js +1847 -0
- package/dist/mlform/behaviors.mjs +32 -0
- package/dist/mlform/builtins-ml.mjs +3 -0
- package/dist/mlform/design-system.mjs +1 -1
- package/dist/mlform/kit.mjs +3 -3
- package/dist/mlform/presentation.mjs +2 -0
- package/dist/mlform/primitives.mjs +2 -2
- package/dist/mlform/runtime.mjs +5 -0
- package/dist/mlform/schema.mjs +102 -0
- package/dist/mlform/transport.mjs +2 -2
- package/dist/mlform.mjs +8 -4
- package/dist/presentation-CkQuYheR.js +200 -0
- package/dist/{primitives-BqjFDDhL.js → primitives-Duag8Lj0.js} +1367 -1312
- package/dist/runtime-DMjDVo0H.js +1824 -0
- package/dist/strings-CWwrrYzz.js +4 -0
- package/dist/{transport-A1RsnZhD.js → transport-CtVX8ZUT.js} +311 -336
- package/dist/types/src/behaviors/index.d.ts +3 -0
- package/dist/types/src/builtins-ml/index.d.ts +5 -0
- package/dist/types/src/design-system/runtime/fingerprint.d.ts +8 -0
- package/dist/types/src/design-system/runtime/host-observer.d.ts +1 -0
- package/dist/types/src/design-system/runtime/hydration-state.d.ts +13 -0
- package/dist/types/src/design-system/runtime/inherited-scheme.d.ts +5 -0
- package/dist/types/src/design-system/runtime/media.d.ts +19 -0
- package/dist/types/src/index.d.ts +10 -4
- package/dist/types/src/kit/accordion-root-styles.d.ts +1 -0
- package/dist/types/src/kit/accordion-root.d.ts +24 -0
- package/dist/types/src/kit/accordion.d.ts +2 -0
- package/dist/types/src/kit/constants.d.ts +29 -0
- package/dist/types/src/kit/defaults.d.ts +2 -2
- package/dist/types/src/kit/index.d.ts +6 -1
- package/dist/types/src/kit/layout-helpers.d.ts +29 -0
- package/dist/types/src/kit/layout-node-render.d.ts +18 -0
- package/dist/types/src/kit/layout-node-resolver.d.ts +3 -0
- package/dist/types/src/kit/layout-types.d.ts +124 -0
- package/dist/types/src/kit/layout-utils.d.ts +9 -0
- package/dist/types/src/kit/layout.d.ts +8 -0
- package/dist/types/src/kit/mount-types.d.ts +54 -0
- package/dist/types/src/kit/panel-nav.d.ts +9 -0
- package/dist/types/src/{questionnaire/primitives/components → kit}/step-indicator.d.ts +3 -3
- package/dist/types/src/kit/tabs-root-styles.d.ts +1 -0
- package/dist/types/src/kit/tabs-root.d.ts +24 -0
- package/dist/types/src/kit/tabs.d.ts +2 -0
- package/dist/types/src/kit/types.d.ts +4 -51
- package/dist/types/src/kit/view-layout-state.d.ts +14 -0
- package/dist/types/src/kit/view-navigation.d.ts +8 -0
- package/dist/types/src/kit/view-snapshot-cache.d.ts +14 -0
- package/dist/types/src/kit/view-snapshot.d.ts +15 -0
- package/dist/types/src/kit/view-types.d.ts +172 -0
- package/dist/types/src/kit/view.d.ts +8 -0
- package/dist/types/src/kit/wizard-constants.d.ts +19 -0
- package/dist/types/src/kit/wizard-root-styles.d.ts +1 -0
- package/dist/types/src/kit/wizard-root.d.ts +23 -0
- package/dist/types/src/kit/wizard.d.ts +2 -0
- package/dist/types/src/packs/default.d.ts +2 -0
- package/dist/types/src/packs/index.d.ts +3 -0
- package/dist/types/src/packs/ml.d.ts +2 -0
- package/dist/types/src/packs/shared.d.ts +25 -0
- package/dist/types/src/presentation/define-explanation-kind.d.ts +11 -0
- package/dist/types/src/presentation/define-field-kind.d.ts +18 -0
- package/dist/types/src/presentation/define-report-kind.d.ts +15 -0
- package/dist/types/src/presentation/index.d.ts +10 -0
- package/dist/types/src/presentation/register-kind.d.ts +6 -0
- package/dist/types/src/presentation/registry.d.ts +15 -0
- package/dist/types/src/presentation/types/explanation.d.ts +32 -0
- package/dist/types/src/presentation/types/field.d.ts +36 -0
- package/dist/types/src/presentation/types/report.d.ts +41 -0
- package/dist/types/src/primitives/base-explanation-element.d.ts +2 -1
- package/dist/types/src/primitives/base-field-element.d.ts +2 -1
- package/dist/types/src/primitives/base-report-element.d.ts +2 -1
- package/dist/types/src/primitives/components/explanation-panel.d.ts +4 -2
- package/dist/types/src/primitives/components/field-frame-feedback.d.ts +9 -0
- package/dist/types/src/primitives/components/field-frame-styles.d.ts +1 -0
- package/dist/types/src/primitives/components/field-frame.d.ts +5 -3
- package/dist/types/src/primitives/components/form-errors.d.ts +1 -1
- package/dist/types/src/primitives/components/form-root-presenters.d.ts +17 -0
- package/dist/types/src/primitives/components/form-root-state.d.ts +19 -0
- package/dist/types/src/primitives/components/form-root-styles.d.ts +1 -0
- package/dist/types/src/primitives/components/form-root-templates.d.ts +42 -0
- package/dist/types/src/primitives/components/form-root.d.ts +4 -2
- package/dist/types/src/primitives/components/presentation.d.ts +1 -1
- package/dist/types/src/primitives/components/report-frame.d.ts +4 -2
- package/dist/types/src/primitives/components/submit-button.d.ts +1 -1
- package/dist/types/src/primitives/constants.d.ts +1 -1
- package/dist/types/src/primitives/fields/series-field-helpers.d.ts +23 -0
- package/dist/types/src/primitives/fields/series-field-styles.d.ts +1 -0
- package/dist/types/src/primitives/mount-form.d.ts +1 -1
- package/dist/types/src/primitives/presentation.d.ts +8 -0
- package/dist/types/src/primitives/types.d.ts +4 -1
- package/dist/types/src/{engine → runtime}/builtins/index.d.ts +1 -3
- package/dist/types/src/{engine → runtime}/builtins/reports/classifier.d.ts +1 -1
- package/dist/types/src/{engine → runtime}/builtins/shared.d.ts +2 -0
- package/dist/types/src/runtime/declarative/presentation.d.ts +61 -0
- package/dist/types/src/runtime/fields/state-calculations.d.ts +25 -0
- package/dist/types/src/runtime/fields/state.d.ts +2 -0
- package/dist/types/src/runtime/form.d.ts +1 -0
- package/dist/types/src/runtime/index.d.ts +16 -0
- package/dist/types/src/runtime/registry/index.d.ts +5 -0
- package/dist/types/src/runtime/runtime-behaviors.d.ts +23 -0
- package/dist/types/src/runtime/runtime-controller.d.ts +34 -0
- package/dist/types/src/runtime/runtime-refresh.d.ts +14 -0
- package/dist/types/src/runtime/runtime-values.d.ts +19 -0
- package/dist/types/src/runtime/submission/create-submitter.d.ts +2 -0
- package/dist/types/src/runtime/submission/error-flow.d.ts +19 -0
- package/dist/types/src/runtime/submission/field-updates.d.ts +14 -0
- package/dist/types/src/runtime/submission/report-updates.d.ts +16 -0
- package/dist/types/src/runtime/submission/stream-progress.d.ts +4 -0
- package/dist/types/src/runtime/submission/submitter.d.ts +2 -0
- package/dist/types/src/runtime/submission/types.d.ts +60 -0
- package/dist/types/src/runtime/types/behavior.d.ts +32 -0
- package/dist/types/src/runtime/types/explanation.d.ts +22 -0
- package/dist/types/src/runtime/types/field.d.ts +24 -0
- package/dist/types/src/{engine → runtime}/types/form.d.ts +8 -11
- package/dist/types/src/runtime/types/index.d.ts +9 -0
- package/dist/types/src/runtime/types/registry.d.ts +6 -0
- package/dist/types/src/runtime/types/report.d.ts +23 -0
- package/dist/types/src/{engine → runtime}/utils.d.ts +2 -2
- package/dist/types/src/{engine/validation/field.d.ts → runtime/validation/field-state.d.ts} +3 -19
- package/dist/types/src/runtime/validation/field-validator.d.ts +18 -0
- package/dist/types/src/runtime/validation/field.d.ts +2 -0
- package/dist/types/src/schema/index.d.ts +7 -0
- package/dist/types/src/schema/normalize.d.ts +2 -0
- package/dist/types/src/schema/registry.d.ts +9 -0
- package/dist/types/src/schema/types/explanation.d.ts +43 -0
- package/dist/types/src/{engine → schema}/types/field.d.ts +3 -45
- package/dist/types/src/schema/types/form.d.ts +13 -0
- package/dist/types/src/schema/types/report.d.ts +43 -0
- package/dist/types/src/shared/index.d.ts +2 -0
- package/dist/types/src/shared/object.d.ts +1 -0
- package/dist/types/src/shared/strings.d.ts +1 -0
- package/dist/types/src/transport/composition/fanout-helpers.d.ts +2 -0
- package/dist/types/src/transport/composition/fanout.d.ts +1 -2
- package/dist/types/src/transport/composition/index.d.ts +1 -0
- package/dist/types/src/transport/composition/quorum-fanout.d.ts +2 -0
- package/dist/types/src/transport/internal-core.d.ts +21 -0
- package/dist/types/src/transport/internal-errors.d.ts +21 -0
- package/dist/types/src/transport/internal-request.d.ts +21 -0
- package/dist/types/src/transport/internal-routing.d.ts +25 -0
- package/dist/types/src/transport/internal-sse.d.ts +14 -0
- package/dist/types/src/transport/internal-stream.d.ts +13 -0
- package/dist/types/src/transport/internal.d.ts +6 -110
- package/dist/types/src/transport/types/options-http.d.ts +85 -0
- package/dist/types/src/transport/types/options-middleware.d.ts +96 -0
- package/dist/types/src/transport/types/options-routing.d.ts +82 -0
- package/dist/types/src/transport/types/options.d.ts +3 -258
- package/package.json +20 -8
- package/dist/engine-CEy1IX7y.js +0 -5367
- package/dist/kit-DrrbtxI2.js +0 -76
- package/dist/mlform/engine.mjs +0 -3
- package/dist/mlform/questionnaire.mjs +0 -640
- package/dist/types/src/engine/index.d.ts +0 -11
- package/dist/types/src/engine/registry/index.d.ts +0 -26
- package/dist/types/src/engine/submission/submitter.d.ts +0 -40
- package/dist/types/src/engine/types/explanation.d.ts +0 -109
- package/dist/types/src/engine/types/index.d.ts +0 -9
- package/dist/types/src/engine/types/report.d.ts +0 -87
- package/dist/types/src/questionnaire/constants.d.ts +0 -31
- package/dist/types/src/questionnaire/defaults.d.ts +0 -8
- package/dist/types/src/questionnaire/engine/controller.d.ts +0 -12
- package/dist/types/src/questionnaire/engine/schema.d.ts +0 -9
- package/dist/types/src/questionnaire/errors.d.ts +0 -3
- package/dist/types/src/questionnaire/index.d.ts +0 -6
- package/dist/types/src/questionnaire/mount.d.ts +0 -3
- package/dist/types/src/questionnaire/primitives/components/questionnaire-root.d.ts +0 -23
- package/dist/types/src/questionnaire/primitives/register.d.ts +0 -0
- package/dist/types/src/questionnaire/types.d.ts +0 -69
- package/dist/types/src/{engine/declarative → presentation/types}/presentation.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/boolean.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/category.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/date.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/long-text.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/mapped-category.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/multi-choice.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/number.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/rating.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/series.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/single-choice.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/fields/text.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/builtins/reports/regressor.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/comparison.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/constants.d.ts +0 -0
- package/dist/types/src/{engine/form.d.ts → runtime/create-runtime.d.ts} +0 -0
- package/dist/types/src/{engine → runtime}/declarative/explanation.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/declarative/field.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/declarative/report.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/equality.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/errors.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/explanations/controller.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/explanations/index.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/fields/controller.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/fields/index.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/paths.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/reports/controller.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/reports/index.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/schema/index.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/state/engine.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/state/index.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/state/snapshots.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/state/store.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/submission/abort.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/submission/explanations.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/submission/index.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/submission/lifecycle.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/submission/pipeline.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/submission/reports.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/submission/request.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/submission/result.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/types/pipeline.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/types/transport.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/validation/conditions.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/validation/form.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/validation/index.d.ts +0 -0
- package/dist/types/src/{engine → runtime}/values.d.ts +0 -0
- package/dist/types/src/{engine → schema}/types/registry.d.ts +1 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { DesignSystemConfig, DesignSystemRegistry, ResolvedDesignSystem, AttachedDesignSystem } from '../../design-system';
|
|
2
|
+
import { PresentationRegistry } from '../../presentation';
|
|
3
|
+
import { ExplanationController, ExplanationDescriptor, ExplanationStateSnapshot, FieldController, FieldDescriptor, FieldStateSnapshot, FormController, FormState, FormValidationResult, Registry, ReportController, ReportDescriptor, ReportStateSnapshot, SubmitOptions, SubmitResult } from '../../runtime';
|
|
4
|
+
import { PrimitiveRegistry, PrimitiveTextOverrides } from '../../primitives';
|
|
5
|
+
import { LayoutReferences } from './layout-utils';
|
|
6
|
+
import { FormLayoutConfig, ResolvedFormLayout, ResolvedFormLayoutNode } from './layout-types';
|
|
7
|
+
import { MountFormOptions, KitLabels } from './mount-types';
|
|
8
|
+
import { PanelState } from './panel-nav';
|
|
9
|
+
import { WizardLabels, WizardTextOverrides } from './wizard-constants';
|
|
10
|
+
export interface WizardState {
|
|
11
|
+
stepIndex: number;
|
|
12
|
+
stepCount: number;
|
|
13
|
+
currentStepId: string;
|
|
14
|
+
canNext: boolean;
|
|
15
|
+
canPrev: boolean;
|
|
16
|
+
isLastStep: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface TabsState {
|
|
19
|
+
activeTabIndex: number;
|
|
20
|
+
tabCount: number;
|
|
21
|
+
currentTabId: string;
|
|
22
|
+
canGoNext: boolean;
|
|
23
|
+
canGoPrev: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface AccordionState {
|
|
26
|
+
openSectionIds: string[];
|
|
27
|
+
sectionCount: number;
|
|
28
|
+
}
|
|
29
|
+
export interface FormViewFieldItem {
|
|
30
|
+
id: string;
|
|
31
|
+
kind: string;
|
|
32
|
+
config: FieldController["config"];
|
|
33
|
+
controller: FieldController;
|
|
34
|
+
state: FieldStateSnapshot;
|
|
35
|
+
descriptor: FieldDescriptor;
|
|
36
|
+
stepId: string | null;
|
|
37
|
+
tabId: string | null;
|
|
38
|
+
visibleInLayout: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface FormViewReportItem {
|
|
41
|
+
id: string;
|
|
42
|
+
kind: string;
|
|
43
|
+
config: ReportController["config"];
|
|
44
|
+
controller: ReportController;
|
|
45
|
+
state: ReportStateSnapshot;
|
|
46
|
+
descriptor: ReportDescriptor | null;
|
|
47
|
+
stepId: string | null;
|
|
48
|
+
tabId: string | null;
|
|
49
|
+
visibleInLayout: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface FormViewExplanationItem {
|
|
52
|
+
id: string;
|
|
53
|
+
kind: string;
|
|
54
|
+
config: ExplanationController["config"];
|
|
55
|
+
controller: ExplanationController;
|
|
56
|
+
state: ExplanationStateSnapshot;
|
|
57
|
+
descriptor: ExplanationDescriptor | null;
|
|
58
|
+
stepId: string | null;
|
|
59
|
+
tabId: string | null;
|
|
60
|
+
visibleInLayout: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface FormViewState {
|
|
63
|
+
form: FormState;
|
|
64
|
+
wizard: WizardState | null;
|
|
65
|
+
tabs: TabsState | null;
|
|
66
|
+
accordion: AccordionState | null;
|
|
67
|
+
}
|
|
68
|
+
export interface FormViewSnapshot {
|
|
69
|
+
form: FormState;
|
|
70
|
+
layout: ResolvedFormLayout;
|
|
71
|
+
fields: FormViewFieldItem[];
|
|
72
|
+
reports: FormViewReportItem[];
|
|
73
|
+
explanations: FormViewExplanationItem[];
|
|
74
|
+
wizard: WizardState | null;
|
|
75
|
+
tabs: TabsState | null;
|
|
76
|
+
accordion: AccordionState | null;
|
|
77
|
+
}
|
|
78
|
+
export interface CreateFormViewOptions extends Omit<MountFormOptions, "layout"> {
|
|
79
|
+
layout?: FormLayoutConfig;
|
|
80
|
+
}
|
|
81
|
+
export interface FormViewController {
|
|
82
|
+
readonly form: FormController;
|
|
83
|
+
readonly engineRegistry: Registry;
|
|
84
|
+
readonly presentationRegistry: PresentationRegistry;
|
|
85
|
+
readonly primitiveRegistry: PrimitiveRegistry;
|
|
86
|
+
readonly designSystemRegistry: DesignSystemRegistry;
|
|
87
|
+
readonly state: FormViewState;
|
|
88
|
+
getSnapshot(): FormViewSnapshot;
|
|
89
|
+
getNodeById(id: string): ResolvedFormLayoutNode | undefined;
|
|
90
|
+
getField(id: string): FormViewFieldItem | undefined;
|
|
91
|
+
getReport(id: string): FormViewReportItem | undefined;
|
|
92
|
+
getExplanation(id: string): FormViewExplanationItem | undefined;
|
|
93
|
+
getVisibleFields(): FormViewFieldItem[];
|
|
94
|
+
getVisibleReports(): FormViewReportItem[];
|
|
95
|
+
getVisibleExplanations(): FormViewExplanationItem[];
|
|
96
|
+
getActiveLayoutNodes(): ResolvedFormLayoutNode[];
|
|
97
|
+
getLayoutReferences(): LayoutReferences;
|
|
98
|
+
validate(): Promise<FormValidationResult>;
|
|
99
|
+
submit(options?: SubmitOptions): Promise<SubmitResult>;
|
|
100
|
+
reset(): void;
|
|
101
|
+
subscribe(listener: (snapshot: FormViewSnapshot) => void): () => void;
|
|
102
|
+
nextStep(): Promise<boolean>;
|
|
103
|
+
prevStep(): void;
|
|
104
|
+
goToStep(stepId: string): Promise<boolean>;
|
|
105
|
+
setActiveTab(tabId: string): void;
|
|
106
|
+
nextTab(): boolean;
|
|
107
|
+
prevTab(): boolean;
|
|
108
|
+
toggleSection(sectionId: string): void;
|
|
109
|
+
openSection(sectionId: string): void;
|
|
110
|
+
closeSection(sectionId: string): void;
|
|
111
|
+
openAllSections(): void;
|
|
112
|
+
closeAllSections(): void;
|
|
113
|
+
}
|
|
114
|
+
export interface WizardMountUiOptions {
|
|
115
|
+
labels?: WizardLabels;
|
|
116
|
+
text?: WizardTextOverrides;
|
|
117
|
+
primitiveText?: PrimitiveTextOverrides;
|
|
118
|
+
designSystem?: DesignSystemConfig;
|
|
119
|
+
designSystemRegistry?: DesignSystemRegistry;
|
|
120
|
+
onDesignSystemChange?: (resolved: ResolvedDesignSystem) => void;
|
|
121
|
+
}
|
|
122
|
+
export type MountWizardFormOptions = ({
|
|
123
|
+
view: FormViewController;
|
|
124
|
+
} & WizardMountUiOptions) | (CreateFormViewOptions & WizardMountUiOptions & {
|
|
125
|
+
layout: import('./layout-types').WizardLayoutConfig;
|
|
126
|
+
});
|
|
127
|
+
export interface MountedWizardForm {
|
|
128
|
+
readonly view: FormViewController;
|
|
129
|
+
readonly form: FormController;
|
|
130
|
+
readonly host: HTMLElement;
|
|
131
|
+
readonly designSystem: AttachedDesignSystem;
|
|
132
|
+
unmount(): void;
|
|
133
|
+
}
|
|
134
|
+
export interface TabsMountUiOptions {
|
|
135
|
+
labels?: KitLabels;
|
|
136
|
+
primitiveText?: PrimitiveTextOverrides;
|
|
137
|
+
designSystem?: DesignSystemConfig;
|
|
138
|
+
designSystemRegistry?: DesignSystemRegistry;
|
|
139
|
+
onDesignSystemChange?: (resolved: ResolvedDesignSystem) => void;
|
|
140
|
+
}
|
|
141
|
+
export type MountTabsFormOptions = ({
|
|
142
|
+
view: FormViewController;
|
|
143
|
+
} & TabsMountUiOptions) | (CreateFormViewOptions & TabsMountUiOptions & {
|
|
144
|
+
layout: import('./layout-types').TabsLayoutConfig;
|
|
145
|
+
});
|
|
146
|
+
export interface MountedTabsForm {
|
|
147
|
+
readonly view: FormViewController;
|
|
148
|
+
readonly form: FormController;
|
|
149
|
+
readonly host: HTMLElement;
|
|
150
|
+
readonly designSystem: AttachedDesignSystem;
|
|
151
|
+
unmount(): void;
|
|
152
|
+
}
|
|
153
|
+
export interface AccordionMountUiOptions {
|
|
154
|
+
labels?: KitLabels;
|
|
155
|
+
primitiveText?: PrimitiveTextOverrides;
|
|
156
|
+
designSystem?: DesignSystemConfig;
|
|
157
|
+
designSystemRegistry?: DesignSystemRegistry;
|
|
158
|
+
onDesignSystemChange?: (resolved: ResolvedDesignSystem) => void;
|
|
159
|
+
}
|
|
160
|
+
export type MountAccordionFormOptions = ({
|
|
161
|
+
view: FormViewController;
|
|
162
|
+
} & AccordionMountUiOptions) | (CreateFormViewOptions & AccordionMountUiOptions & {
|
|
163
|
+
layout: import('./layout-types').AccordionLayoutConfig;
|
|
164
|
+
});
|
|
165
|
+
export interface MountedAccordionForm {
|
|
166
|
+
readonly view: FormViewController;
|
|
167
|
+
readonly form: FormController;
|
|
168
|
+
readonly host: HTMLElement;
|
|
169
|
+
readonly designSystem: AttachedDesignSystem;
|
|
170
|
+
unmount(): void;
|
|
171
|
+
}
|
|
172
|
+
export type { LayoutReferences, PanelState };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PresentationRegistry } from '../../presentation';
|
|
2
|
+
import { CreateFormViewOptions, FormViewController } from './types';
|
|
3
|
+
type InternalCreateFormViewOptions = CreateFormViewOptions & {
|
|
4
|
+
presentationRegistry?: PresentationRegistry;
|
|
5
|
+
behaviors?: import('../../runtime').RuntimeBehavior[];
|
|
6
|
+
};
|
|
7
|
+
export declare const createFormView: (options: InternalCreateFormViewOptions) => FormViewController;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface WizardLabels {
|
|
2
|
+
prev?: string;
|
|
3
|
+
next?: string;
|
|
4
|
+
submit?: string;
|
|
5
|
+
validating?: string;
|
|
6
|
+
submitting?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface WizardText {
|
|
9
|
+
stepLabel: (current: number, total: number) => string;
|
|
10
|
+
prevLabel: string;
|
|
11
|
+
nextLabel: string;
|
|
12
|
+
submitLabel: string;
|
|
13
|
+
validatingLabel: string;
|
|
14
|
+
submittingLabel: string;
|
|
15
|
+
}
|
|
16
|
+
export type WizardTextOverrides = Partial<WizardText>;
|
|
17
|
+
export declare const defaultWizardLabels: Required<WizardLabels>;
|
|
18
|
+
export declare const wizardStaticText: WizardText;
|
|
19
|
+
export declare const resolveWizardText: (overrides?: WizardTextOverrides) => WizardText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const wizardRootStyles: import('lit').CSSResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { PrimitiveText } from '../../primitives/constants';
|
|
3
|
+
import { PrimitiveRegistry } from '../../primitives/types';
|
|
4
|
+
import { kitTagNames } from './constants';
|
|
5
|
+
import { FormViewController } from './types';
|
|
6
|
+
export declare class KitWizardElement extends LitElement {
|
|
7
|
+
#private;
|
|
8
|
+
static styles: import('lit').CSSResult;
|
|
9
|
+
accessor view: FormViewController | undefined;
|
|
10
|
+
accessor registry: PrimitiveRegistry | undefined;
|
|
11
|
+
accessor primitiveText: PrimitiveText;
|
|
12
|
+
accessor labels: Required<import('./wizard-constants').WizardLabels>;
|
|
13
|
+
accessor text: import('./wizard-constants').WizardText;
|
|
14
|
+
private accessor snapshot;
|
|
15
|
+
protected willUpdate(changed: Map<string, unknown>): void;
|
|
16
|
+
disconnectedCallback(): void;
|
|
17
|
+
render(): import('lit').TemplateResult<1>;
|
|
18
|
+
}
|
|
19
|
+
declare global {
|
|
20
|
+
interface HTMLElementTagNameMap {
|
|
21
|
+
[kitTagNames.wizard]: KitWizardElement;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ExplanationPresenter, FieldPresenter, PresentationRegistry, ReportPresenter } from '../../presentation';
|
|
2
|
+
import { RuntimeBehavior } from '../../runtime';
|
|
3
|
+
import { ExplanationConfig, FieldConfig, Registry, ReportConfig } from '../../schema';
|
|
4
|
+
type DescriptorCapableFieldDefinition = {
|
|
5
|
+
kind: string;
|
|
6
|
+
describe?: FieldPresenter<FieldConfig, unknown>["describe"];
|
|
7
|
+
};
|
|
8
|
+
type DescriptorCapableReportDefinition = {
|
|
9
|
+
kind: string;
|
|
10
|
+
describe?: ReportPresenter<ReportConfig>["describe"];
|
|
11
|
+
};
|
|
12
|
+
type DescriptorCapableExplanationDefinition = {
|
|
13
|
+
kind: string;
|
|
14
|
+
describe?: ExplanationPresenter<ExplanationConfig>["describe"];
|
|
15
|
+
};
|
|
16
|
+
export type RegistryPack = {
|
|
17
|
+
registry: Registry;
|
|
18
|
+
presentationRegistry: PresentationRegistry;
|
|
19
|
+
behaviors: RuntimeBehavior[];
|
|
20
|
+
};
|
|
21
|
+
export declare const registerFieldPresenterFromDefinition: (presentationRegistry: PresentationRegistry, definition: DescriptorCapableFieldDefinition) => void;
|
|
22
|
+
export declare const registerReportPresenterFromDefinition: (presentationRegistry: PresentationRegistry, definition: DescriptorCapableReportDefinition) => void;
|
|
23
|
+
export declare const registerExplanationPresenterFromDefinition: (presentationRegistry: PresentationRegistry, definition: DescriptorCapableExplanationDefinition) => void;
|
|
24
|
+
export declare const registerPresentersFromRegistry: (presentationRegistry: PresentationRegistry, registry: Registry) => void;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ExplanationConfig, ExplanationDefinition, NormalizedExplanationConfig } from '../../schema';
|
|
2
|
+
import { DeclarativeExplanationKind, ExplanationDescriptor, ExplanationDescriptorContext, ExplanationPresenter } from './index';
|
|
3
|
+
export type DefinedExplanationKind<TConfig extends ExplanationConfig, _TResult> = {
|
|
4
|
+
kind: string;
|
|
5
|
+
schema: import('zod').ZodType<TConfig>;
|
|
6
|
+
transport: ExplanationDefinition<TConfig>["transport"];
|
|
7
|
+
describe?: (config: NormalizedExplanationConfig<TConfig>, context: ExplanationDescriptorContext) => ExplanationDescriptor | null;
|
|
8
|
+
definition: ExplanationDefinition<TConfig>;
|
|
9
|
+
presenter: ExplanationPresenter<TConfig>;
|
|
10
|
+
};
|
|
11
|
+
export declare const defineExplanationKind: <TConfig extends ExplanationConfig, TResult>(kind: DeclarativeExplanationKind<TConfig, TResult>) => DefinedExplanationKind<TConfig, TResult>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FieldConfig, FieldDefinition, NormalizedFieldConfig } from '../../schema';
|
|
2
|
+
import { DeclarativeFieldKind, FieldDescriptor, FieldDescriptorContext, FieldPresenter } from './index';
|
|
3
|
+
export type DefinedFieldKind<TConfig extends FieldConfig, TValue> = {
|
|
4
|
+
kind: string;
|
|
5
|
+
schema: import('zod').ZodType<TConfig>;
|
|
6
|
+
getDefaultValue?: (config: TConfig) => TValue;
|
|
7
|
+
normalizeValue?: (value: unknown, config: TConfig) => TValue;
|
|
8
|
+
cloneValue?: (value: TValue, config: TConfig) => TValue;
|
|
9
|
+
isEqual?: (previous: TValue, next: TValue, config: TConfig) => boolean;
|
|
10
|
+
serializeValue?: (value: TValue, config: TConfig) => unknown;
|
|
11
|
+
validate?: FieldDefinition<TConfig, TValue>["validate"];
|
|
12
|
+
describe?: (config: NormalizedFieldConfig<TConfig>, context: FieldDescriptorContext & {
|
|
13
|
+
value: TValue;
|
|
14
|
+
}) => FieldDescriptor;
|
|
15
|
+
definition: FieldDefinition<TConfig, TValue>;
|
|
16
|
+
presenter: FieldPresenter<TConfig, TValue>;
|
|
17
|
+
};
|
|
18
|
+
export declare const defineFieldKind: <TConfig extends FieldConfig, TValue>(kind: DeclarativeFieldKind<TConfig, TValue>) => DefinedFieldKind<TConfig, TValue>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NormalizedReportConfig, ReportConfig, ReportDefinition } from '../../schema';
|
|
2
|
+
import { DeclarativeReportKind, ReportDescriptor, ReportDescriptorContext, ReportPresenter } from './index';
|
|
3
|
+
export type DefinedReportKind<TConfig extends ReportConfig, _TPayload> = {
|
|
4
|
+
kind: string;
|
|
5
|
+
schema: import('zod').ZodType<TConfig>;
|
|
6
|
+
payloadSchema?: ReportDefinition<TConfig>["payloadSchema"];
|
|
7
|
+
payloadValidationPolicy?: ReportDefinition<TConfig>["payloadValidationPolicy"];
|
|
8
|
+
partialUpdatePolicy?: ReportDefinition<TConfig>["partialUpdatePolicy"];
|
|
9
|
+
clonePayload?: ReportDefinition<TConfig>["clonePayload"];
|
|
10
|
+
resolvePayload?: ReportDefinition<TConfig>["resolvePayload"];
|
|
11
|
+
describe?: (config: NormalizedReportConfig<TConfig>, context: ReportDescriptorContext) => ReportDescriptor | null;
|
|
12
|
+
definition: ReportDefinition<TConfig>;
|
|
13
|
+
presenter: ReportPresenter<TConfig>;
|
|
14
|
+
};
|
|
15
|
+
export declare const defineReportKind: <TConfig extends ReportConfig, TPayload>(kind: DeclarativeReportKind<TConfig, TPayload>) => DefinedReportKind<TConfig, TPayload>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { defineExplanationKind, type DefinedExplanationKind } from './define-explanation-kind';
|
|
2
|
+
export { defineFieldKind, type DefinedFieldKind } from './define-field-kind';
|
|
3
|
+
export { defineReportKind, type DefinedReportKind } from './define-report-kind';
|
|
4
|
+
export { registerDefinedExplanationKind, registerDefinedFieldKind, registerDefinedReportKind, } from './register-kind';
|
|
5
|
+
export { createPresentationRegistry, PresentationRegistry } from './registry';
|
|
6
|
+
export { toPresentationNodes } from './types/presentation';
|
|
7
|
+
export type * from './types/explanation';
|
|
8
|
+
export type * from './types/field';
|
|
9
|
+
export type * from './types/presentation';
|
|
10
|
+
export type * from './types/report';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Registry } from '../../schema';
|
|
2
|
+
import { DefinedExplanationKind, DefinedFieldKind, DefinedReportKind } from './index';
|
|
3
|
+
import { PresentationRegistry } from './registry';
|
|
4
|
+
export declare const registerDefinedFieldKind: <TConfig extends import('../../schema').FieldConfig, TValue>(registry: Registry, presentationRegistry: PresentationRegistry, kind: DefinedFieldKind<TConfig, TValue>) => void;
|
|
5
|
+
export declare const registerDefinedReportKind: <TConfig extends import('../../schema').ReportConfig>(registry: Registry, presentationRegistry: PresentationRegistry, kind: DefinedReportKind<TConfig, unknown>) => void;
|
|
6
|
+
export declare const registerDefinedExplanationKind: <TConfig extends import('../../schema').ExplanationConfig>(registry: Registry, presentationRegistry: PresentationRegistry, kind: DefinedExplanationKind<TConfig, unknown>) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseExplanationConfig, BaseFieldConfig, BaseReportConfig } from '../../schema';
|
|
2
|
+
import { ExplanationPresenter, FieldPresenter, ReportPresenter } from './index';
|
|
3
|
+
export declare class PresentationRegistry {
|
|
4
|
+
private readonly fieldPresenters;
|
|
5
|
+
private readonly reportPresenters;
|
|
6
|
+
private readonly explanationPresenters;
|
|
7
|
+
registerField<TConfig extends BaseFieldConfig, TValue>(presenter: FieldPresenter<TConfig, TValue>): this;
|
|
8
|
+
registerReport<TConfig extends BaseReportConfig>(presenter: ReportPresenter<TConfig>): this;
|
|
9
|
+
registerExplanation<TConfig extends BaseExplanationConfig>(presenter: ExplanationPresenter<TConfig>): this;
|
|
10
|
+
getField(kind: string): FieldPresenter<BaseFieldConfig, unknown> | undefined;
|
|
11
|
+
getReport(kind: string): ReportPresenter<BaseReportConfig> | undefined;
|
|
12
|
+
getExplanation(kind: string): ExplanationPresenter<BaseExplanationConfig> | undefined;
|
|
13
|
+
clone(): PresentationRegistry;
|
|
14
|
+
}
|
|
15
|
+
export declare const createPresentationRegistry: () => PresentationRegistry;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ExplanationConfig, ExplanationFetchFactory, ExplanationStateSnapshot, NormalizedExplanationConfig } from '../../../schema';
|
|
2
|
+
import { ZodType } from 'zod';
|
|
3
|
+
import { PresentationContent, PresentationSummary } from './presentation';
|
|
4
|
+
export interface ExplanationDescriptor {
|
|
5
|
+
component: string;
|
|
6
|
+
props: Record<string, unknown>;
|
|
7
|
+
meta?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface ExplanationDescriptorContext {
|
|
10
|
+
explanationId: string;
|
|
11
|
+
state: ExplanationStateSnapshot;
|
|
12
|
+
}
|
|
13
|
+
export interface ExplanationRenderSpecContext<TConfig extends ExplanationConfig = ExplanationConfig, TResult = unknown> {
|
|
14
|
+
config: NormalizedExplanationConfig<TConfig>;
|
|
15
|
+
explanationId: string;
|
|
16
|
+
state: ExplanationStateSnapshot;
|
|
17
|
+
result: TResult;
|
|
18
|
+
}
|
|
19
|
+
export interface ExplanationRenderSpec<TConfig extends ExplanationConfig = ExplanationConfig, TResult = unknown> {
|
|
20
|
+
summary?: (context: ExplanationRenderSpecContext<TConfig, TResult>) => PresentationSummary | undefined;
|
|
21
|
+
content: (context: ExplanationRenderSpecContext<TConfig, TResult>) => PresentationContent;
|
|
22
|
+
}
|
|
23
|
+
export interface DeclarativeExplanationKind<TConfig extends ExplanationConfig = ExplanationConfig, TResult = unknown> {
|
|
24
|
+
kind: string;
|
|
25
|
+
schema: ZodType<TConfig>;
|
|
26
|
+
fetch: ExplanationFetchFactory<TConfig>;
|
|
27
|
+
render: ExplanationRenderSpec<TConfig, TResult>;
|
|
28
|
+
}
|
|
29
|
+
export interface ExplanationPresenter<TConfig extends ExplanationConfig = ExplanationConfig> {
|
|
30
|
+
kind: string;
|
|
31
|
+
describe(config: NormalizedExplanationConfig<TConfig>, context: ExplanationDescriptorContext): ExplanationDescriptor | null;
|
|
32
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FieldConfig, FieldStateSnapshot, FieldValidationFnContext, FieldValueAdapter, NormalizedFieldConfig } from '../../../schema';
|
|
2
|
+
import { ZodType } from 'zod';
|
|
3
|
+
export interface FieldDescriptor {
|
|
4
|
+
component: string;
|
|
5
|
+
props: Record<string, unknown>;
|
|
6
|
+
meta?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export type FieldWidget = "text" | "number" | "boolean" | "select" | "date" | "series";
|
|
9
|
+
export type FieldRenderHints = Record<string, unknown>;
|
|
10
|
+
export interface FieldRenderSpecContext<TConfig extends FieldConfig = FieldConfig, TValue = unknown> {
|
|
11
|
+
config: TConfig;
|
|
12
|
+
fieldId: string;
|
|
13
|
+
state: FieldStateSnapshot;
|
|
14
|
+
value: TValue;
|
|
15
|
+
}
|
|
16
|
+
export interface FieldRenderSpec<TConfig extends FieldConfig = FieldConfig, TValue = unknown> {
|
|
17
|
+
widget: FieldWidget;
|
|
18
|
+
hints?: FieldRenderHints | ((context: FieldRenderSpecContext<TConfig, TValue>) => FieldRenderHints);
|
|
19
|
+
}
|
|
20
|
+
export interface DeclarativeFieldKind<TConfig extends FieldConfig = FieldConfig, TValue = unknown> {
|
|
21
|
+
kind: string;
|
|
22
|
+
schema: ZodType<TConfig>;
|
|
23
|
+
value?: FieldValueAdapter<TConfig, TValue>;
|
|
24
|
+
validate?: (context: FieldValidationFnContext<TConfig, TValue>) => string[] | PromiseLike<string[]>;
|
|
25
|
+
render: FieldRenderSpec<TConfig, TValue>;
|
|
26
|
+
}
|
|
27
|
+
export interface FieldDescriptorContext {
|
|
28
|
+
fieldId: string;
|
|
29
|
+
state: FieldStateSnapshot;
|
|
30
|
+
}
|
|
31
|
+
export interface FieldPresenter<TConfig extends FieldConfig = FieldConfig, TValue = unknown> {
|
|
32
|
+
kind: string;
|
|
33
|
+
describe(config: NormalizedFieldConfig<TConfig>, context: FieldDescriptorContext & {
|
|
34
|
+
value: TValue;
|
|
35
|
+
}): FieldDescriptor;
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { NormalizedReportConfig, ReportConfig, ReportResolveContext, ReportStateSnapshot } from '../../../schema';
|
|
2
|
+
import { SubmitResult } from '../../../runtime/types/transport';
|
|
3
|
+
import { ZodType } from 'zod';
|
|
4
|
+
import { PresentationContent, PresentationSummary } from './presentation';
|
|
5
|
+
export interface ReportDescriptor {
|
|
6
|
+
component: string;
|
|
7
|
+
props: Record<string, unknown>;
|
|
8
|
+
meta?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface ReportDescriptorContext {
|
|
11
|
+
reportId: string;
|
|
12
|
+
state: ReportStateSnapshot;
|
|
13
|
+
payload: unknown;
|
|
14
|
+
result: SubmitResult | null;
|
|
15
|
+
}
|
|
16
|
+
export interface ReportRenderSpecContext<TConfig extends ReportConfig = ReportConfig, TPayload = unknown> {
|
|
17
|
+
config: NormalizedReportConfig<TConfig>;
|
|
18
|
+
report: NormalizedReportConfig<TConfig>;
|
|
19
|
+
reportId: string;
|
|
20
|
+
state: ReportStateSnapshot;
|
|
21
|
+
payload: TPayload;
|
|
22
|
+
result: SubmitResult | null;
|
|
23
|
+
}
|
|
24
|
+
export interface ReportRenderSpec<TConfig extends ReportConfig = ReportConfig, TPayload = unknown> {
|
|
25
|
+
summary?: (context: ReportRenderSpecContext<TConfig, TPayload>) => PresentationSummary | undefined;
|
|
26
|
+
content: (context: ReportRenderSpecContext<TConfig, TPayload>) => PresentationContent;
|
|
27
|
+
}
|
|
28
|
+
export interface DeclarativeReportKind<TConfig extends ReportConfig = ReportConfig, TPayload = unknown> {
|
|
29
|
+
kind: string;
|
|
30
|
+
schema: ZodType<TConfig>;
|
|
31
|
+
payloadSchema?: ZodType<unknown>;
|
|
32
|
+
payloadValidationPolicy?: "report-error" | "fail-submit";
|
|
33
|
+
partialUpdatePolicy?: "trust" | "validate" | "defer";
|
|
34
|
+
clonePayload?: (payload: TPayload, config: TConfig) => TPayload;
|
|
35
|
+
resolve: (context: ReportResolveContext<TConfig>) => unknown;
|
|
36
|
+
render: ReportRenderSpec<TConfig, TPayload>;
|
|
37
|
+
}
|
|
38
|
+
export interface ReportPresenter<TConfig extends ReportConfig = ReportConfig> {
|
|
39
|
+
kind: string;
|
|
40
|
+
describe(config: NormalizedReportConfig<TConfig>, context: ReportDescriptorContext): ReportDescriptor | null;
|
|
41
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, CSSResultGroup } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { ExplanationDescriptor } from '../../presentation';
|
|
3
|
+
import { ExplanationController } from '../../runtime';
|
|
3
4
|
import { PrimitiveText } from './constants';
|
|
4
5
|
import { PrimitiveExplanationRenderContext } from './types';
|
|
5
6
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, nothing, CSSResultGroup, TemplateResult } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { FieldDescriptor } from '../../presentation';
|
|
3
|
+
import { FieldController } from '../../runtime';
|
|
3
4
|
import { PrimitiveText } from './constants';
|
|
4
5
|
import { PrimitiveFieldRenderContext } from './types';
|
|
5
6
|
export declare abstract class PrimitiveFieldElement extends LitElement {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, CSSResultGroup } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { ReportDescriptor } from '../../presentation';
|
|
3
|
+
import { ReportController } from '../../runtime';
|
|
3
4
|
import { PrimitiveText } from './constants';
|
|
4
5
|
import { PrimitiveReportRenderContext, PrimitiveReportRequest, PrimitiveReportTransport } from './types';
|
|
5
6
|
export declare abstract class PrimitiveReportElement extends LitElement {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import { ExplanationController, SubmitResult } from '../../../
|
|
2
|
+
import { ExplanationController, SubmitResult } from '../../../runtime';
|
|
3
|
+
import { ExplanationDescriptor } from '../../../presentation';
|
|
3
4
|
import { primitiveTagNames, PrimitiveText } from '../constants';
|
|
4
5
|
import { PrimitiveRegistry } from '../types';
|
|
5
6
|
export declare class PrimitiveExplanationPanelElement extends LitElement {
|
|
@@ -9,7 +10,8 @@ export declare class PrimitiveExplanationPanelElement extends LitElement {
|
|
|
9
10
|
accessor registry: PrimitiveRegistry | undefined;
|
|
10
11
|
accessor lastResult: SubmitResult | null;
|
|
11
12
|
accessor text: PrimitiveText;
|
|
12
|
-
|
|
13
|
+
accessor descriptor: ExplanationDescriptor | null;
|
|
14
|
+
private accessor resolvedDescriptor;
|
|
13
15
|
private accessor explanationState;
|
|
14
16
|
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
15
17
|
disconnectedCallback(): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FieldStateSnapshot } from '../../../runtime';
|
|
2
|
+
import { PrimitiveText } from '../constants';
|
|
3
|
+
export declare const resolveFieldFeedbackComponent: (component: string, props: Record<string, unknown>) => string;
|
|
4
|
+
export declare const resolveCategorySelection: (props: Record<string, unknown>, value: unknown) => {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
} | null;
|
|
8
|
+
export declare const hasIntroducedValue: (component: string, props: Record<string, unknown>, state: FieldStateSnapshot, defaultValue: unknown) => boolean;
|
|
9
|
+
export declare const createFieldSuccessMessage: (component: string, props: Record<string, unknown>, state: FieldStateSnapshot, text: PrimitiveText) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fieldFrameStyles: import('lit').CSSResult;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import { FieldController } from '../../../
|
|
2
|
+
import { FieldController } from '../../../runtime';
|
|
3
|
+
import { FieldDescriptor } from '../../../presentation';
|
|
3
4
|
import { primitiveTagNames, PrimitiveText } from '../constants';
|
|
4
5
|
import { PrimitiveRegistry } from '../types';
|
|
5
6
|
export declare class PrimitiveFieldFrameElement extends LitElement {
|
|
6
7
|
#private;
|
|
7
8
|
static styles: import('lit').CSSResult;
|
|
8
9
|
accessor controller: FieldController | undefined;
|
|
10
|
+
accessor descriptor: FieldDescriptor | null;
|
|
9
11
|
accessor registry: PrimitiveRegistry | undefined;
|
|
10
12
|
accessor text: PrimitiveText;
|
|
11
|
-
private accessor
|
|
13
|
+
private accessor resolvedDescriptor;
|
|
12
14
|
private accessor fieldState;
|
|
13
|
-
private accessor
|
|
15
|
+
private accessor descriptionVisibilityOverride;
|
|
14
16
|
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
15
17
|
render(): import('lit').TemplateResult;
|
|
16
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import { FormController } from '../../../
|
|
2
|
+
import { FormController } from '../../../runtime';
|
|
3
3
|
import { primitiveTagNames, PrimitiveText } from '../constants';
|
|
4
4
|
export declare class PrimitiveFormErrorsElement extends LitElement {
|
|
5
5
|
#private;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FieldDescriptor, PresentationRegistry, ReportDescriptor } from '../../../presentation';
|
|
2
|
+
import { ExplanationController, FormController, ReportController } from '../../../runtime';
|
|
3
|
+
export type PresentedField = {
|
|
4
|
+
controller: NonNullable<ReturnType<FormController["getField"]>>;
|
|
5
|
+
descriptor: FieldDescriptor;
|
|
6
|
+
};
|
|
7
|
+
export type PresentedReport = {
|
|
8
|
+
controller: ReportController;
|
|
9
|
+
descriptor: ReportDescriptor | null;
|
|
10
|
+
};
|
|
11
|
+
export type PresentedExplanation = {
|
|
12
|
+
controller: ExplanationController;
|
|
13
|
+
descriptor: import('../../../presentation').ExplanationDescriptor | null;
|
|
14
|
+
};
|
|
15
|
+
export declare const presentVisibleFields: (form: FormController, fieldIds: readonly string[], presentationRegistry: PresentationRegistry | undefined) => PresentedField[];
|
|
16
|
+
export declare const presentVisibleReports: (form: FormController, reportIds: readonly string[], reportPane: "auto" | "always" | "hidden", presentationRegistry: PresentationRegistry | undefined) => PresentedReport[];
|
|
17
|
+
export declare const presentExplanations: (form: FormController, explanationIds: readonly string[], presentationRegistry: PresentationRegistry | undefined) => PresentedExplanation[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormController, FormStatus, ReportController } from '../../../runtime';
|
|
2
|
+
export type FormRenderState = {
|
|
3
|
+
status: FormStatus;
|
|
4
|
+
submitCount: number;
|
|
5
|
+
hasFormErrors: boolean;
|
|
6
|
+
hasLastResult: boolean;
|
|
7
|
+
submissionLoaded?: number;
|
|
8
|
+
submissionTotal?: number;
|
|
9
|
+
submissionMessage?: string;
|
|
10
|
+
submissionSessionMessageCount?: number;
|
|
11
|
+
visibleFieldIds: string[];
|
|
12
|
+
visibleReportIds: string[];
|
|
13
|
+
explanationIds: string[];
|
|
14
|
+
reportStateKeys: string[];
|
|
15
|
+
explanationStateKeys: string[];
|
|
16
|
+
};
|
|
17
|
+
export declare const sameFormRenderState: (left: FormRenderState, right: FormRenderState) => boolean;
|
|
18
|
+
export declare const selectFormRenderState: (form: FormController) => FormRenderState;
|
|
19
|
+
export declare const resolveVisibleReports: (form: FormController, visibleReportIds: string[], reportPane: "auto" | "always" | "hidden") => readonly ReportController[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formRootStyles: import('lit').CSSResult;
|