@getodk/xforms-engine 0.9.0 → 0.10.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/SelectNode.d.ts +1 -0
- package/dist/client/TextRange.d.ts +4 -0
- package/dist/index.js +125 -133
- package/dist/index.js.map +1 -1
- package/dist/instance/SelectControl.d.ts +1 -0
- package/dist/instance/text/TextRange.d.ts +11 -1
- package/dist/lib/reactivity/text/createTextRange.d.ts +1 -2
- package/dist/parse/expression/TextChunkExpression.d.ts +16 -0
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +2 -4
- package/dist/parse/text/MessageDefinition.d.ts +3 -7
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +2 -8
- package/dist/parse/text/abstract/TextRangeDefinition.d.ts +2 -2
- package/dist/solid.js +125 -133
- package/dist/solid.js.map +1 -1
- package/package.json +2 -2
- package/src/client/SelectNode.ts +2 -0
- package/src/client/TextRange.ts +5 -1
- package/src/instance/SelectControl.ts +6 -0
- package/src/instance/text/TextRange.ts +21 -1
- package/src/lib/reactivity/text/createTextRange.ts +56 -43
- package/src/lib/reactivity/validation/createValidation.ts +1 -3
- package/src/parse/expression/TextChunkExpression.ts +78 -0
- package/src/parse/text/ItemsetLabelDefinition.ts +8 -12
- package/src/parse/text/MessageDefinition.ts +9 -16
- package/src/parse/text/abstract/TextElementDefinition.ts +10 -26
- package/src/parse/text/abstract/TextRangeDefinition.ts +2 -2
- package/src/parse/xpath/semantic-analysis.ts +7 -2
- package/dist/parse/expression/TextLiteralExpression.d.ts +0 -9
- package/dist/parse/expression/TextOutputExpression.d.ts +0 -7
- package/dist/parse/expression/TextReferenceExpression.d.ts +0 -7
- package/dist/parse/expression/TextTranslationExpression.d.ts +0 -8
- package/dist/parse/expression/abstract/TextChunkExpression.d.ts +0 -17
- package/src/parse/expression/TextLiteralExpression.ts +0 -19
- package/src/parse/expression/TextOutputExpression.ts +0 -25
- package/src/parse/expression/TextReferenceExpression.ts +0 -14
- package/src/parse/expression/TextTranslationExpression.ts +0 -38
- package/src/parse/expression/abstract/TextChunkExpression.ts +0 -38
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { expressionParser } from '@getodk/xpath/expressionParser.js';
|
|
2
|
-
import type { AnyTextRangeDefinition } from '../text/abstract/TextRangeDefinition.ts';
|
|
3
|
-
import type { TranslationExpression } from '../xpath/semantic-analysis.ts';
|
|
4
|
-
import { isTranslationExpression } from '../xpath/semantic-analysis.ts';
|
|
5
|
-
import { TextChunkExpression } from './abstract/TextChunkExpression.ts';
|
|
6
|
-
|
|
7
|
-
export class TextTranslationExpression extends TextChunkExpression<'translation'> {
|
|
8
|
-
static fromMessage(
|
|
9
|
-
context: AnyTextRangeDefinition,
|
|
10
|
-
maybeExpression: string
|
|
11
|
-
): TextTranslationExpression | null {
|
|
12
|
-
try {
|
|
13
|
-
expressionParser.parse(maybeExpression);
|
|
14
|
-
} catch {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (isTranslationExpression(maybeExpression)) {
|
|
19
|
-
return new this(context, maybeExpression);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static from(context: AnyTextRangeDefinition, maybeExpression: string) {
|
|
26
|
-
if (isTranslationExpression(maybeExpression)) {
|
|
27
|
-
return new this(context, maybeExpression);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
readonly source = 'translation';
|
|
34
|
-
|
|
35
|
-
private constructor(context: AnyTextRangeDefinition, expression: TranslationExpression) {
|
|
36
|
-
super(context, expression, { isTranslated: true });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { TextChunkSource } from '../../../client/TextRange.ts';
|
|
2
|
-
import type { AnyTextRangeDefinition } from '../../text/abstract/TextRangeDefinition.ts';
|
|
3
|
-
import type { TextLiteralExpression } from '../TextLiteralExpression.ts';
|
|
4
|
-
import type { TextOutputExpression } from '../TextOutputExpression.ts';
|
|
5
|
-
import type { TextReferenceExpression } from '../TextReferenceExpression.ts';
|
|
6
|
-
import type { TextTranslationExpression } from '../TextTranslationExpression.ts';
|
|
7
|
-
import { DependentExpression } from './DependentExpression.ts';
|
|
8
|
-
|
|
9
|
-
interface TextChunkExpressionOptions {
|
|
10
|
-
readonly isTranslated?: true;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export abstract class TextChunkExpression<
|
|
14
|
-
Source extends TextChunkSource,
|
|
15
|
-
> extends DependentExpression<'string'> {
|
|
16
|
-
abstract readonly source: Source;
|
|
17
|
-
readonly stringValue?: string;
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
context: AnyTextRangeDefinition,
|
|
21
|
-
expression: string,
|
|
22
|
-
options: TextChunkExpressionOptions = {}
|
|
23
|
-
) {
|
|
24
|
-
super(context, 'string', expression, {
|
|
25
|
-
semanticDependencies: {
|
|
26
|
-
translations: options.isTranslated,
|
|
27
|
-
},
|
|
28
|
-
ignoreContextReference: true,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// prettier-ignore
|
|
34
|
-
export type AnyTextChunkExpression =
|
|
35
|
-
| TextLiteralExpression
|
|
36
|
-
| TextOutputExpression
|
|
37
|
-
| TextReferenceExpression
|
|
38
|
-
| TextTranslationExpression;
|