@marktiderman/genesis-forms 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/dist/destinations.cjs +55 -3
- package/dist/destinations.cjs.map +1 -1
- package/dist/destinations.d.cts +1 -1
- package/dist/destinations.d.ts +1 -1
- package/dist/destinations.js +55 -3
- package/dist/destinations.js.map +1 -1
- package/dist/{engine-BDq0XJ21.d.cts → engine-CpfOz8FN.d.ts} +10 -3
- package/dist/{engine-Qzp6bX6O.d.ts → engine-DC4YTPdr.d.cts} +10 -3
- package/dist/index.cjs +484 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -7
- package/dist/index.d.ts +29 -7
- package/dist/index.js +461 -63
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +541 -21
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +193 -3
- package/dist/server.d.ts +193 -3
- package/dist/server.js +522 -22
- package/dist/server.js.map +1 -1
- package/dist/testing.cjs +314 -21
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +4 -4
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +314 -21
- package/dist/testing.js.map +1 -1
- package/dist/{types-BhYUbLJ-.d.cts → types-oAckGR_Z.d.cts} +10 -0
- package/dist/{types-BhYUbLJ-.d.ts → types-oAckGR_Z.d.ts} +10 -0
- package/dist/validate-B5WKHbst.d.cts +322 -0
- package/dist/validate-GpTXPwyl.d.ts +322 -0
- package/package.json +1 -1
- package/dist/validate-Bs1lyoOl.d.ts +0 -131
- package/dist/validate-BsZ0YTQS.d.cts +0 -131
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as FieldBlock, J as Json, C as ContentBlock, P as PageBreakBlock, O as OptionsSource, F as FormDefinition, H as HiddenInput, b as FormLayout, L as LogicRule, E as Ending, c as FormSettings, d as Condition, B as Block } from './types-
|
|
2
|
-
export { e as FormEvent, f as Operand, g as Operator } from './types-
|
|
3
|
-
import { F as FormEngine, a as FormState } from './engine-
|
|
4
|
-
export { C as CreateFormOptions, c as createForm, i as isFormEvent, b as isJson, r as replay } from './engine-
|
|
5
|
-
import { F as FieldValidator } from './validate-
|
|
6
|
-
export { C as
|
|
1
|
+
import { a as FieldBlock, J as Json, C as ContentBlock, P as PageBreakBlock, O as OptionsSource, F as FormDefinition, H as HiddenInput, b as FormLayout, L as LogicRule, E as Ending, c as FormSettings, d as Condition, B as Block } from './types-oAckGR_Z.cjs';
|
|
2
|
+
export { e as FormEvent, f as Operand, g as Operator } from './types-oAckGR_Z.cjs';
|
|
3
|
+
import { F as FormEngine, a as FormState } from './engine-DC4YTPdr.cjs';
|
|
4
|
+
export { C as CreateFormOptions, c as createForm, i as isFormEvent, b as isJson, r as replay } from './engine-DC4YTPdr.cjs';
|
|
5
|
+
import { F as FieldValidator } from './validate-B5WKHbst.cjs';
|
|
6
|
+
export { A as AnswerSnapshot, C as CHOICE_FIELD_TYPES, a as ChoiceOption, b as FieldTypeManifest, H as HostOptions, L as LinkParams, M as MAX_PREFILL_PARAM_LENGTH, O as OPTION_LIMITS, c as OTHER_MAX_LENGTH, d as OptionSnapshot, P as PrefillSetting, e as PrefillState, R as REQUIRED_MESSAGE, f as RestoredAnswers, S as SEARCHABLE_OPTION_COUNT, g as StandardSchemaV1, h as answerSnapshots, i as answersFromSnapshots, j as answersOnPath, k as choiceOptions, l as clearFilteredAnswers, m as dateLimits, n as filteredChoiceError, o as getFieldType, p as hasOptionFilters, q as hiddenByPrefill, r as isEmptyValue, s as isHttpsUrl, t as isIsoDate, u as isOtherValue, v as isPrefillParam, w as isSearchable, x as isSensitive, y as listFieldTypes, z as normalizeValue, B as numberLimits, D as optionFilter, E as optionJson, G as optionMatches, I as optionsSource, J as otherOption, K as prefillFromLink, N as prefillSetting, Q as ratingDisplay, T as readOption, U as registerFieldType, V as respondentPath, W as scaleLabels, X as searchOptions, Y as summarizeValue, Z as validateField, _ as visibleOptions, $ as withHostOptions } from './validate-B5WKHbst.cjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The `photo` field type: a respondent attaches up to a few photos, such as a
|
|
@@ -87,6 +87,9 @@ interface ChoiceFieldOptions<O extends string> extends FieldOptions {
|
|
|
87
87
|
options?: readonly {
|
|
88
88
|
value: O;
|
|
89
89
|
label?: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
image?: string;
|
|
92
|
+
attributes?: Record<string, string | string[]>;
|
|
90
93
|
}[] | undefined;
|
|
91
94
|
/**
|
|
92
95
|
* Options the app showing the form supplies, by key (`OptionsSource`), such
|
|
@@ -101,6 +104,17 @@ interface ChoiceFieldOptions<O extends string> extends FieldOptions {
|
|
|
101
104
|
other?: boolean | {
|
|
102
105
|
label?: string;
|
|
103
106
|
} | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Preselect from the link the form was opened from: `{ param: "location" }` takes
|
|
109
|
+
* `?location=…` when it is one of the options; `hideWhenPrefilled` then skips the question.
|
|
110
|
+
* See `prefillFromLink`.
|
|
111
|
+
*/
|
|
112
|
+
prefill?: {
|
|
113
|
+
param: string;
|
|
114
|
+
hideWhenPrefilled?: boolean;
|
|
115
|
+
} | undefined;
|
|
116
|
+
/** A search box over the options: true or false, or by default when there are more than 10 (`isSearchable`). */
|
|
117
|
+
searchable?: boolean | undefined;
|
|
104
118
|
}
|
|
105
119
|
interface HiddenOptions {
|
|
106
120
|
source?: HiddenInput["source"] | undefined;
|
|
@@ -721,4 +735,12 @@ declare function explain(source: FormEngine | ExplainInput, blockId: string, opt
|
|
|
721
735
|
/** A condition as a plain-English clause: `contact_me is not Yes`. */
|
|
722
736
|
declare function describeCondition(condition: Condition, def: FormDefinition, fields?: Map<string, FieldBlock>): string;
|
|
723
737
|
|
|
724
|
-
|
|
738
|
+
/**
|
|
739
|
+
* Answers given to one version of a form, as answers to another (by field id), matched
|
|
740
|
+
* by field key: what an edit link prefills when the form has a newer version. Answers
|
|
741
|
+
* to fields the other version doesn't have are dropped; `extra` (by key) fills fields
|
|
742
|
+
* the stored answers leave out, such as contact details kept apart.
|
|
743
|
+
*/
|
|
744
|
+
declare function carryAnswers(from: FormDefinition, to: FormDefinition, answers: Record<string, Json>, extra?: Record<string, Json | null | undefined>): Record<string, Json>;
|
|
745
|
+
|
|
746
|
+
export { type AnswersOf, Block, CALCULATED_TYPE, COMPUTED_FIELD_TYPES, type CalculatedFormat, type CalculatedProps, type ChoiceFieldOptions, type CoerceHiddenOptions, type CoercedHidden, Condition, ContentBlock, DEFAULT_PHOTO_FILES, DEFAULT_PHOTO_SIZE_MB, Ending, type ExplainInput, type ExplainOptions, type Explanation, FORMULA_FUNCTIONS, FieldBlock, type FieldOptions, type FieldSpec, type FieldValidation, FieldValidator, type Form, FormDefinition, FormEngine, type FormInput, type FormIssue, FormLayout, type FormProgress, FormSettings, FormState, type FormulaFunction, type FormulaNode, type FormulaParseResult, type FormulaReader, type FormulaRef, type FormulaValue, HIGHLIGHT_NOTE_MESSAGE, HiddenInput, type Highlight, Json, type JumpTrace, type KeyResolver, LogicRule, MAX_CALCULATED_DECIMALS, MAX_FORMULA_ITEMS, MAX_FORMULA_LENGTH, MAX_FORM_FORMULA_LENGTH, MAX_HIDDEN_STRING_LENGTH, MAX_HIGHLIGHT_NOTE_LENGTH, MAX_HIGHLIGHT_QUOTE_LENGTH, MAX_PHOTO_FILES, MAX_PHOTO_ID_LENGTH, MAX_PHOTO_NAME_LENGTH, MAX_PHOTO_SIZE_MB, MAX_SETTLE_ITEMS, MAX_TABLE_CELL_LENGTH, MAX_TABLE_COLUMNS, MAX_TIMESTAMP_SECONDS, type MediaNote, OptionsSource, PHOTO_FORMATS, PHOTO_TYPE, PageBreakBlock, type ParseResult, type PathResult, type PhotoFormat, type PhotoLimits, type PhotoRef, type RuleSpec, type RuleTrace, STRUCTURED_FIELD_TYPES, type TableColumn, UPLOAD_FIELD_TYPES, calculatedProps, calculatedValue, canonicalJson, carryAnswers, coerceHidden, coerceHiddenValue, computePath, defineForm, describeCondition, evaluate, evaluateFormula, explain, f, fingerprint, formProgress, formatCalculated, formatTimestamp, formulaInput, formulaNumber, formulaRefs, furthestReached, isPhotoFormat, isPhotoRef, listLimits, parseForm, parseFormula, parseTimestamp, photoCountMessage, photoFormatList, photoLimits, photoRefs, photoSizeMessage, photoTypeMessage, recall, renameFormulaKey, ruleVisible, steps, tableColumns, tableLimits, when };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as FieldBlock, J as Json, C as ContentBlock, P as PageBreakBlock, O as OptionsSource, F as FormDefinition, H as HiddenInput, b as FormLayout, L as LogicRule, E as Ending, c as FormSettings, d as Condition, B as Block } from './types-
|
|
2
|
-
export { e as FormEvent, f as Operand, g as Operator } from './types-
|
|
3
|
-
import { F as FormEngine, a as FormState } from './engine-
|
|
4
|
-
export { C as CreateFormOptions, c as createForm, i as isFormEvent, b as isJson, r as replay } from './engine-
|
|
5
|
-
import { F as FieldValidator } from './validate-
|
|
6
|
-
export { C as
|
|
1
|
+
import { a as FieldBlock, J as Json, C as ContentBlock, P as PageBreakBlock, O as OptionsSource, F as FormDefinition, H as HiddenInput, b as FormLayout, L as LogicRule, E as Ending, c as FormSettings, d as Condition, B as Block } from './types-oAckGR_Z.js';
|
|
2
|
+
export { e as FormEvent, f as Operand, g as Operator } from './types-oAckGR_Z.js';
|
|
3
|
+
import { F as FormEngine, a as FormState } from './engine-CpfOz8FN.js';
|
|
4
|
+
export { C as CreateFormOptions, c as createForm, i as isFormEvent, b as isJson, r as replay } from './engine-CpfOz8FN.js';
|
|
5
|
+
import { F as FieldValidator } from './validate-GpTXPwyl.js';
|
|
6
|
+
export { A as AnswerSnapshot, C as CHOICE_FIELD_TYPES, a as ChoiceOption, b as FieldTypeManifest, H as HostOptions, L as LinkParams, M as MAX_PREFILL_PARAM_LENGTH, O as OPTION_LIMITS, c as OTHER_MAX_LENGTH, d as OptionSnapshot, P as PrefillSetting, e as PrefillState, R as REQUIRED_MESSAGE, f as RestoredAnswers, S as SEARCHABLE_OPTION_COUNT, g as StandardSchemaV1, h as answerSnapshots, i as answersFromSnapshots, j as answersOnPath, k as choiceOptions, l as clearFilteredAnswers, m as dateLimits, n as filteredChoiceError, o as getFieldType, p as hasOptionFilters, q as hiddenByPrefill, r as isEmptyValue, s as isHttpsUrl, t as isIsoDate, u as isOtherValue, v as isPrefillParam, w as isSearchable, x as isSensitive, y as listFieldTypes, z as normalizeValue, B as numberLimits, D as optionFilter, E as optionJson, G as optionMatches, I as optionsSource, J as otherOption, K as prefillFromLink, N as prefillSetting, Q as ratingDisplay, T as readOption, U as registerFieldType, V as respondentPath, W as scaleLabels, X as searchOptions, Y as summarizeValue, Z as validateField, _ as visibleOptions, $ as withHostOptions } from './validate-GpTXPwyl.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The `photo` field type: a respondent attaches up to a few photos, such as a
|
|
@@ -87,6 +87,9 @@ interface ChoiceFieldOptions<O extends string> extends FieldOptions {
|
|
|
87
87
|
options?: readonly {
|
|
88
88
|
value: O;
|
|
89
89
|
label?: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
image?: string;
|
|
92
|
+
attributes?: Record<string, string | string[]>;
|
|
90
93
|
}[] | undefined;
|
|
91
94
|
/**
|
|
92
95
|
* Options the app showing the form supplies, by key (`OptionsSource`), such
|
|
@@ -101,6 +104,17 @@ interface ChoiceFieldOptions<O extends string> extends FieldOptions {
|
|
|
101
104
|
other?: boolean | {
|
|
102
105
|
label?: string;
|
|
103
106
|
} | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Preselect from the link the form was opened from: `{ param: "location" }` takes
|
|
109
|
+
* `?location=…` when it is one of the options; `hideWhenPrefilled` then skips the question.
|
|
110
|
+
* See `prefillFromLink`.
|
|
111
|
+
*/
|
|
112
|
+
prefill?: {
|
|
113
|
+
param: string;
|
|
114
|
+
hideWhenPrefilled?: boolean;
|
|
115
|
+
} | undefined;
|
|
116
|
+
/** A search box over the options: true or false, or by default when there are more than 10 (`isSearchable`). */
|
|
117
|
+
searchable?: boolean | undefined;
|
|
104
118
|
}
|
|
105
119
|
interface HiddenOptions {
|
|
106
120
|
source?: HiddenInput["source"] | undefined;
|
|
@@ -721,4 +735,12 @@ declare function explain(source: FormEngine | ExplainInput, blockId: string, opt
|
|
|
721
735
|
/** A condition as a plain-English clause: `contact_me is not Yes`. */
|
|
722
736
|
declare function describeCondition(condition: Condition, def: FormDefinition, fields?: Map<string, FieldBlock>): string;
|
|
723
737
|
|
|
724
|
-
|
|
738
|
+
/**
|
|
739
|
+
* Answers given to one version of a form, as answers to another (by field id), matched
|
|
740
|
+
* by field key: what an edit link prefills when the form has a newer version. Answers
|
|
741
|
+
* to fields the other version doesn't have are dropped; `extra` (by key) fills fields
|
|
742
|
+
* the stored answers leave out, such as contact details kept apart.
|
|
743
|
+
*/
|
|
744
|
+
declare function carryAnswers(from: FormDefinition, to: FormDefinition, answers: Record<string, Json>, extra?: Record<string, Json | null | undefined>): Record<string, Json>;
|
|
745
|
+
|
|
746
|
+
export { type AnswersOf, Block, CALCULATED_TYPE, COMPUTED_FIELD_TYPES, type CalculatedFormat, type CalculatedProps, type ChoiceFieldOptions, type CoerceHiddenOptions, type CoercedHidden, Condition, ContentBlock, DEFAULT_PHOTO_FILES, DEFAULT_PHOTO_SIZE_MB, Ending, type ExplainInput, type ExplainOptions, type Explanation, FORMULA_FUNCTIONS, FieldBlock, type FieldOptions, type FieldSpec, type FieldValidation, FieldValidator, type Form, FormDefinition, FormEngine, type FormInput, type FormIssue, FormLayout, type FormProgress, FormSettings, FormState, type FormulaFunction, type FormulaNode, type FormulaParseResult, type FormulaReader, type FormulaRef, type FormulaValue, HIGHLIGHT_NOTE_MESSAGE, HiddenInput, type Highlight, Json, type JumpTrace, type KeyResolver, LogicRule, MAX_CALCULATED_DECIMALS, MAX_FORMULA_ITEMS, MAX_FORMULA_LENGTH, MAX_FORM_FORMULA_LENGTH, MAX_HIDDEN_STRING_LENGTH, MAX_HIGHLIGHT_NOTE_LENGTH, MAX_HIGHLIGHT_QUOTE_LENGTH, MAX_PHOTO_FILES, MAX_PHOTO_ID_LENGTH, MAX_PHOTO_NAME_LENGTH, MAX_PHOTO_SIZE_MB, MAX_SETTLE_ITEMS, MAX_TABLE_CELL_LENGTH, MAX_TABLE_COLUMNS, MAX_TIMESTAMP_SECONDS, type MediaNote, OptionsSource, PHOTO_FORMATS, PHOTO_TYPE, PageBreakBlock, type ParseResult, type PathResult, type PhotoFormat, type PhotoLimits, type PhotoRef, type RuleSpec, type RuleTrace, STRUCTURED_FIELD_TYPES, type TableColumn, UPLOAD_FIELD_TYPES, calculatedProps, calculatedValue, canonicalJson, carryAnswers, coerceHidden, coerceHiddenValue, computePath, defineForm, describeCondition, evaluate, evaluateFormula, explain, f, fingerprint, formProgress, formatCalculated, formatTimestamp, formulaInput, formulaNumber, formulaRefs, furthestReached, isPhotoFormat, isPhotoRef, listLimits, parseForm, parseFormula, parseTimestamp, photoCountMessage, photoFormatList, photoLimits, photoRefs, photoSizeMessage, photoTypeMessage, recall, renameFormulaKey, ruleVisible, steps, tableColumns, tableLimits, when };
|