@getodk/xforms-engine 0.12.0 → 0.14.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/dist/client/BaseItem.d.ts +6 -0
- package/dist/client/GroupNode.d.ts +4 -4
- package/dist/client/MarkdownNode.d.ts +33 -0
- package/dist/client/RankNode.d.ts +2 -4
- package/dist/client/SelectNode.d.ts +2 -5
- package/dist/client/TextRange.d.ts +2 -11
- package/dist/client/hierarchy.d.ts +1 -2
- package/dist/client/index.d.ts +1 -1
- package/dist/client/node-types.d.ts +1 -1
- package/dist/index.js +10543 -332
- package/dist/index.js.map +1 -1
- package/dist/instance/RankControl.d.ts +3 -2
- package/dist/instance/SelectControl.d.ts +3 -2
- package/dist/instance/hierarchy.d.ts +5 -6
- package/dist/instance/markdown/MarkdownNode.d.ts +75 -0
- package/dist/instance/text/TextChunk.d.ts +0 -1
- package/dist/instance/text/TextRange.d.ts +2 -1
- package/dist/instance/text/markdownFormat.d.ts +3 -0
- package/dist/lib/reactivity/createItemCollection.d.ts +5 -7
- package/dist/parse/body/BodyDefinition.d.ts +2 -8
- package/dist/parse/body/GroupElementDefinition.d.ts +22 -0
- package/dist/parse/body/control/ItemsetDefinition.d.ts +4 -1
- package/dist/parse/expression/BindComputationExpression.d.ts +1 -1
- package/dist/parse/expression/ItemPropertyExpression.d.ts +6 -0
- package/dist/parse/expression/ItemsetNodesetExpression.d.ts +1 -2
- package/dist/parse/expression/TextChunkExpression.d.ts +9 -7
- package/dist/parse/expression/abstract/DependentExpression.d.ts +1 -15
- package/dist/parse/model/{SubtreeDefinition.d.ts → GroupDefinition.d.ts} +4 -3
- package/dist/parse/model/ModelDefinition.d.ts +6 -1
- package/dist/parse/model/NodeDefinition.d.ts +7 -8
- package/dist/parse/model/RepeatDefinition.d.ts +1 -1
- package/dist/parse/model/RootDefinition.d.ts +1 -1
- package/dist/parse/model/generateItextChunks.d.ts +5 -0
- package/dist/parse/text/LabelDefinition.d.ts +4 -5
- package/dist/parse/xpath/semantic-analysis.d.ts +1 -0
- package/dist/solid.js +10543 -332
- package/dist/solid.js.map +1 -1
- package/package.json +3 -2
- package/src/client/BaseItem.ts +7 -0
- package/src/client/GroupNode.ts +4 -10
- package/src/client/MarkdownNode.ts +53 -0
- package/src/client/RankNode.ts +2 -5
- package/src/client/SelectNode.ts +2 -6
- package/src/client/TextRange.ts +2 -11
- package/src/client/hierarchy.ts +0 -2
- package/src/client/index.ts +1 -1
- package/src/client/node-types.ts +0 -1
- package/src/instance/Group.ts +1 -1
- package/src/instance/RankControl.ts +8 -2
- package/src/instance/SelectControl.ts +8 -2
- package/src/instance/children/buildChildren.ts +1 -17
- package/src/instance/children/normalizeChildInitOptions.ts +44 -59
- package/src/instance/hierarchy.ts +0 -6
- package/src/instance/markdown/MarkdownNode.ts +115 -0
- package/src/instance/text/TextChunk.ts +0 -5
- package/src/instance/text/TextRange.ts +5 -3
- package/src/instance/text/markdownFormat.ts +214 -0
- package/src/integration/xpath/adapter/names.ts +0 -1
- package/src/lib/reactivity/createItemCollection.ts +25 -9
- package/src/lib/reactivity/text/createTextRange.ts +30 -30
- package/src/parse/body/BodyDefinition.ts +7 -34
- package/src/parse/body/GroupElementDefinition.ts +47 -0
- package/src/parse/body/control/ItemsetDefinition.ts +9 -2
- package/src/parse/expression/BindComputationExpression.ts +2 -7
- package/src/parse/expression/ItemPropertyExpression.ts +12 -0
- package/src/parse/expression/ItemsetNodesetExpression.ts +2 -3
- package/src/parse/expression/ItemsetValueExpression.ts +1 -1
- package/src/parse/expression/RepeatCountControlExpression.ts +4 -4
- package/src/parse/expression/TextChunkExpression.ts +25 -35
- package/src/parse/expression/abstract/DependentExpression.ts +2 -38
- package/src/parse/model/{SubtreeDefinition.ts → GroupDefinition.ts} +6 -8
- package/src/parse/model/ModelDefinition.ts +13 -0
- package/src/parse/model/NodeDefinition.ts +8 -9
- package/src/parse/model/RepeatDefinition.ts +2 -2
- package/src/parse/model/RootDefinition.ts +2 -2
- package/src/parse/model/generateItextChunks.ts +61 -0
- package/src/parse/text/ItemsetLabelDefinition.ts +4 -4
- package/src/parse/text/LabelDefinition.ts +4 -9
- package/src/parse/text/MessageDefinition.ts +4 -4
- package/src/parse/text/abstract/TextElementDefinition.ts +6 -7
- package/src/parse/xpath/semantic-analysis.ts +37 -8
- package/dist/client/SubtreeNode.d.ts +0 -56
- package/dist/instance/Subtree.d.ts +0 -38
- package/dist/instance/text/FormattedTextStub.d.ts +0 -1
- package/dist/parse/body/group/BaseGroupDefinition.d.ts +0 -40
- package/dist/parse/body/group/LogicalGroupDefinition.d.ts +0 -6
- package/dist/parse/body/group/PresentationGroupDefinition.d.ts +0 -11
- package/dist/parse/body/group/StructuralGroupDefinition.d.ts +0 -6
- package/src/client/SubtreeNode.ts +0 -61
- package/src/instance/Subtree.ts +0 -102
- package/src/instance/text/FormattedTextStub.ts +0 -8
- package/src/parse/body/group/BaseGroupDefinition.ts +0 -89
- package/src/parse/body/group/LogicalGroupDefinition.ts +0 -11
- package/src/parse/body/group/PresentationGroupDefinition.ts +0 -28
- package/src/parse/body/group/StructuralGroupDefinition.ts +0 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { GroupElementDefinition } from '../parse/body/GroupElementDefinition.ts';
|
|
2
|
+
import { GroupDefinition as GroupNodeDefinition } from '../parse/model/GroupDefinition.ts';
|
|
3
3
|
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
4
|
import { NodeAppearances } from './NodeAppearances.ts';
|
|
5
5
|
import { RootNode } from './RootNode.ts';
|
|
@@ -11,8 +11,8 @@ export interface GroupNodeState extends BaseNodeState {
|
|
|
11
11
|
get valueOptions(): null;
|
|
12
12
|
get value(): null;
|
|
13
13
|
}
|
|
14
|
-
export interface GroupDefinition extends
|
|
15
|
-
readonly bodyElement:
|
|
14
|
+
export interface GroupDefinition extends GroupNodeDefinition {
|
|
15
|
+
readonly bodyElement: GroupElementDefinition;
|
|
16
16
|
}
|
|
17
17
|
export type GroupNodeAppearances = NodeAppearances<GroupDefinition>;
|
|
18
18
|
/**
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type Heading = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
2
|
+
export type ElementName = Heading | 'a' | 'div' | 'em' | 'li' | 'ol' | 'p' | 'span' | 'strong' | 'u' | 'ul';
|
|
3
|
+
export type MarkdownNode = ChildMarkdownNode | HtmlMarkdownNode | ParentMarkdownNode;
|
|
4
|
+
export interface ParentMarkdownNode {
|
|
5
|
+
readonly role: 'parent';
|
|
6
|
+
readonly elementName: string;
|
|
7
|
+
readonly children: MarkdownNode[];
|
|
8
|
+
}
|
|
9
|
+
export interface ChildMarkdownNode {
|
|
10
|
+
readonly role: 'child';
|
|
11
|
+
readonly value: string;
|
|
12
|
+
}
|
|
13
|
+
export interface HtmlMarkdownNode {
|
|
14
|
+
readonly role: 'html';
|
|
15
|
+
readonly unsafeHtml: string;
|
|
16
|
+
}
|
|
17
|
+
export interface AnchorMarkdownNode extends ParentMarkdownNode {
|
|
18
|
+
readonly elementName: 'a';
|
|
19
|
+
readonly url: string;
|
|
20
|
+
}
|
|
21
|
+
export interface StyledMarkdownNode extends ParentMarkdownNode {
|
|
22
|
+
readonly elementName: 'div' | 'p' | 'span';
|
|
23
|
+
readonly properties: MarkdownProperty | undefined;
|
|
24
|
+
}
|
|
25
|
+
export interface MarkdownProperty {
|
|
26
|
+
readonly style: StyleProperty;
|
|
27
|
+
}
|
|
28
|
+
export interface StyleProperty {
|
|
29
|
+
readonly color: string | undefined;
|
|
30
|
+
readonly 'font-family': string | undefined;
|
|
31
|
+
readonly 'text-align': 'center' | 'left' | 'right' | undefined;
|
|
32
|
+
readonly 'font-size': string | undefined;
|
|
33
|
+
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { RankControlDefinition } from '../parse/body/control/RankControlDefinition.ts';
|
|
2
2
|
import { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
3
3
|
import { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
4
|
+
import { BaseItem } from './BaseItem.ts';
|
|
4
5
|
import { RootNode } from './RootNode.ts';
|
|
5
6
|
import { TextRange } from './TextRange.ts';
|
|
6
7
|
import { GeneralParentNode } from './hierarchy.ts';
|
|
7
8
|
import { LeafNodeValidationState } from './validation.ts';
|
|
8
9
|
import { UnknownAppearanceDefinition } from '../parse/body/appearance/unknownAppearanceParser.ts';
|
|
9
10
|
import { ValueType } from './ValueType.ts';
|
|
10
|
-
export
|
|
11
|
-
get label(): TextRange<'item-label'>;
|
|
12
|
-
get value(): string;
|
|
13
|
-
}
|
|
11
|
+
export type RankItem = BaseItem;
|
|
14
12
|
export type RankValueOptions = readonly RankItem[];
|
|
15
13
|
export interface RankNodeState extends BaseValueNodeState<readonly string[]> {
|
|
16
14
|
get valueOptions(): RankValueOptions;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { AnySelectControlDefinition, SelectType } from '../parse/body/control/SelectControlDefinition.ts';
|
|
2
2
|
import { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
3
3
|
import { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
4
|
+
import { BaseItem } from './BaseItem.ts';
|
|
4
5
|
import { NodeAppearances } from './NodeAppearances.ts';
|
|
5
6
|
import { RootNode } from './RootNode.ts';
|
|
6
|
-
import { TextRange } from './TextRange.ts';
|
|
7
7
|
import { ValueType } from './ValueType.ts';
|
|
8
8
|
import { GeneralParentNode } from './hierarchy.ts';
|
|
9
9
|
import { LeafNodeValidationState } from './validation.ts';
|
|
10
|
-
export
|
|
11
|
-
get label(): TextRange<'item-label'>;
|
|
12
|
-
get value(): string;
|
|
13
|
-
}
|
|
10
|
+
export type SelectItem = BaseItem;
|
|
14
11
|
export type SelectValueOptions = readonly SelectItem[];
|
|
15
12
|
export interface SelectNodeState extends BaseValueNodeState<readonly string[]> {
|
|
16
13
|
get isSelectWithImages(): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JRResourceURL } from '../../../common/src/jr-resources/JRResourceURL.ts';
|
|
2
2
|
import { ActiveLanguage } from './FormLanguage.ts';
|
|
3
|
+
import { MarkdownNode } from './MarkdownNode.ts';
|
|
3
4
|
/**
|
|
4
5
|
* **COMMENTARY**
|
|
5
6
|
*
|
|
@@ -47,15 +48,6 @@ import { ActiveLanguage } from './FormLanguage.ts';
|
|
|
47
48
|
* - `h:body//hint/@ref[not(is-translation-expr())]`
|
|
48
49
|
*
|
|
49
50
|
* (See notes above for clarification of `is-translation-expr()`.)
|
|
50
|
-
*
|
|
51
|
-
* @todo It's unclear whether this will all become simpler or more compelex when
|
|
52
|
-
* we add support for outputs in translations. In theory, the actual translation
|
|
53
|
-
* `<text>` nodes map quite well to the `TextRange` concept (i.e. they are a
|
|
54
|
-
* range of static and output chunks, just like labels and hints). The potential
|
|
55
|
-
* for complications arise from XPath implementation details being largely
|
|
56
|
-
* opaque (as in, the `jr:itext` implementation is encapsulated in the `xpath`
|
|
57
|
-
* package, and the engine doesn't really deal with itext translations at the
|
|
58
|
-
* node level at all).
|
|
59
51
|
*/
|
|
60
52
|
export type TextChunkSource = 'literal' | 'output' | 'reference' | 'translation';
|
|
61
53
|
/**
|
|
@@ -73,7 +65,6 @@ export interface TextChunk {
|
|
|
73
65
|
*/
|
|
74
66
|
get language(): ActiveLanguage;
|
|
75
67
|
get asString(): string;
|
|
76
|
-
get formatted(): unknown;
|
|
77
68
|
}
|
|
78
69
|
export type ElementTextRole = 'hint' | 'label' | 'item-label';
|
|
79
70
|
export type ValidationTextRole = 'constraintMsg' | 'requiredMsg';
|
|
@@ -135,7 +126,7 @@ export interface TextRange<Role extends TextRole, Origin extends TextOrigin = Te
|
|
|
135
126
|
readonly role: Role;
|
|
136
127
|
[Symbol.iterator](): Iterable<TextChunk>;
|
|
137
128
|
get asString(): string;
|
|
138
|
-
get formatted():
|
|
129
|
+
get formatted(): MarkdownNode[];
|
|
139
130
|
get imageSource(): JRResourceURL | undefined;
|
|
140
131
|
get audioSource(): JRResourceURL | undefined;
|
|
141
132
|
get videoSource(): JRResourceURL | undefined;
|
|
@@ -10,7 +10,6 @@ import { RepeatRangeControlledNode } from './repeat/RepeatRangeControlledNode.ts
|
|
|
10
10
|
import { RepeatRangeUncontrolledNode } from './repeat/RepeatRangeUncontrolledNode.ts';
|
|
11
11
|
import { RootNode } from './RootNode.ts';
|
|
12
12
|
import { SelectNode } from './SelectNode.ts';
|
|
13
|
-
import { SubtreeNode } from './SubtreeNode.ts';
|
|
14
13
|
import { TriggerNode } from './TriggerNode.ts';
|
|
15
14
|
import { UploadNode } from './UploadNode.ts';
|
|
16
15
|
export type AnyControlNode = AnyInputNode | AnyNoteNode | AnyRangeNode | RankNode | SelectNode | TriggerNode | UploadNode;
|
|
@@ -20,7 +19,7 @@ export type RepeatRangeNode = RepeatRangeControlledNode | RepeatRangeUncontrolle
|
|
|
20
19
|
* Any of the concrete node types which may be a parent of non-repeat instance
|
|
21
20
|
* child nodes.
|
|
22
21
|
*/
|
|
23
|
-
export type GeneralParentNode = RootNode |
|
|
22
|
+
export type GeneralParentNode = RootNode | GroupNode | RepeatInstanceNode;
|
|
24
23
|
/**
|
|
25
24
|
* Any of the concrete node types which may be a parent of any other node.
|
|
26
25
|
*
|
package/dist/client/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type * from './GroupNode.ts';
|
|
|
15
15
|
export type { AnyChildNode, AnyControlNode, AnyLeafNode, AnyNode, AnyParentNode, GeneralChildNode, GeneralParentNode, RepeatRangeNode, } from './hierarchy.ts';
|
|
16
16
|
export type * from './identity.ts';
|
|
17
17
|
export type * from './InputNode.ts';
|
|
18
|
+
export type * from './MarkdownNode.ts';
|
|
18
19
|
export type * from './ModelValueNode.ts';
|
|
19
20
|
export type * from './NoteNode.ts';
|
|
20
21
|
export type * from './OpaqueReactiveObjectFactory.ts';
|
|
@@ -32,7 +33,6 @@ export type * from './serialization/InstancePayload.ts';
|
|
|
32
33
|
export type * from './serialization/InstancePayloadOptions.ts';
|
|
33
34
|
export type * from './serialization/InstanceState.ts';
|
|
34
35
|
export type * from './submission/SubmissionMeta.ts';
|
|
35
|
-
export type * from './SubtreeNode.ts';
|
|
36
36
|
export type * from './TextRange.ts';
|
|
37
37
|
export type * from './TriggerNode.ts';
|
|
38
38
|
export type * from './UploadNode.ts';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type RepeatRangeNodeType = 'repeat-range:controlled' | 'repeat-range:uncontrolled';
|
|
2
2
|
export type LeafNodeType = 'model-value' | 'note' | 'select' | 'input' | 'trigger' | 'range' | 'rank' | 'upload';
|
|
3
|
-
export type InstanceNodeType = 'root' | RepeatRangeNodeType | 'repeat-instance' | 'group' |
|
|
3
|
+
export type InstanceNodeType = 'root' | RepeatRangeNodeType | 'repeat-instance' | 'group' | LeafNodeType;
|