@ja-platform/parser-core 0.0.0-dev-20261019214152
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/@types/AttributeParseEvent.d.ts +15 -0
- package/dist/@types/XMLParseEvent.d.ts +37 -0
- package/dist/@types/attributes/AttributeDefaults.d.ts +7 -0
- package/dist/@types/attributes/ConditionType.d.ts +10 -0
- package/dist/@types/attributes/V5Attribute.d.ts +103 -0
- package/dist/@types/attributes/V5BooleanAttribute.d.ts +19 -0
- package/dist/@types/attributes/V5ConstantBooleanAttribute.d.ts +15 -0
- package/dist/@types/attributes/V5ConstantTextAttribute.d.ts +15 -0
- package/dist/@types/attributes/V5ContentTextAttribute.d.ts +18 -0
- package/dist/@types/attributes/V5ExpressionAttribute.d.ts +17 -0
- package/dist/@types/attributes/V5FunctionAttribute.d.ts +9 -0
- package/dist/@types/attributes/V5ListAttribute.d.ts +21 -0
- package/dist/@types/attributes/V5NumberAttribute.d.ts +27 -0
- package/dist/@types/attributes/V5PathAttribue.d.ts +11 -0
- package/dist/@types/attributes/V5SetAttribute.d.ts +18 -0
- package/dist/@types/attributes/V5TextArrayAttribute.d.ts +15 -0
- package/dist/@types/attributes/V5TextAttribute.d.ts +20 -0
- package/dist/@types/attributes/index.d.ts +15 -0
- package/dist/@types/entities/V5AbstractEntity.d.ts +15 -0
- package/dist/@types/entities/V5CommonEntity.d.ts +28 -0
- package/dist/@types/entities/index.d.ts +2 -0
- package/dist/@types/events/V5EditorContext.d.ts +43 -0
- package/dist/@types/index.d.ts +36 -0
- package/dist/@types/nodes/V5ContentNode.d.ts +45 -0
- package/dist/@types/nodes/V5Node.d.ts +128 -0
- package/dist/@types/nodes/V5NodeAlternatives.d.ts +24 -0
- package/dist/@types/parsed/ParsedArrayNode.d.ts +28 -0
- package/dist/@types/parsed/ParsedAttribute.d.ts +28 -0
- package/dist/@types/parsed/ParsedContentNode.d.ts +13 -0
- package/dist/@types/parsed/ParsedDiagnostic.d.ts +12 -0
- package/dist/@types/parsed/ParsedNode.d.ts +103 -0
- package/dist/@types/parsed/ParsedNodeTypes.d.ts +64 -0
- package/dist/@types/parsed/index.d.ts +6 -0
- package/dist/@types/utils/types/valueOf.d.ts +3 -0
- package/dist/@types/values/AbstractValueProvider.d.ts +16 -0
- package/dist/@types/values/ConstantExpressionValueProvider.d.ts +9 -0
- package/dist/@types/values/ParsedNodeValues.d.ts +24 -0
- package/dist/@types/values/ParsedProviderValue.d.ts +31 -0
- package/dist/@types/values/ParsedValue.d.ts +38 -0
- package/dist/@types/values/ParserDefaultValueProvider.d.ts +9 -0
- package/dist/AttributeParseEvent.js +3 -0
- package/dist/AttributeParseEvent.js.map +1 -0
- package/dist/XMLParseEvent.js +3 -0
- package/dist/XMLParseEvent.js.map +1 -0
- package/dist/attributes/AttributeDefaults.js +15 -0
- package/dist/attributes/AttributeDefaults.js.map +1 -0
- package/dist/attributes/ConditionType.js +26 -0
- package/dist/attributes/ConditionType.js.map +1 -0
- package/dist/attributes/V5Attribute.js +162 -0
- package/dist/attributes/V5Attribute.js.map +1 -0
- package/dist/attributes/V5BooleanAttribute.js +45 -0
- package/dist/attributes/V5BooleanAttribute.js.map +1 -0
- package/dist/attributes/V5ConstantBooleanAttribute.js +22 -0
- package/dist/attributes/V5ConstantBooleanAttribute.js.map +1 -0
- package/dist/attributes/V5ConstantTextAttribute.js +22 -0
- package/dist/attributes/V5ConstantTextAttribute.js.map +1 -0
- package/dist/attributes/V5ContentTextAttribute.js +44 -0
- package/dist/attributes/V5ContentTextAttribute.js.map +1 -0
- package/dist/attributes/V5ExpressionAttribute.js +30 -0
- package/dist/attributes/V5ExpressionAttribute.js.map +1 -0
- package/dist/attributes/V5FunctionAttribute.js +14 -0
- package/dist/attributes/V5FunctionAttribute.js.map +1 -0
- package/dist/attributes/V5ListAttribute.js +38 -0
- package/dist/attributes/V5ListAttribute.js.map +1 -0
- package/dist/attributes/V5NumberAttribute.js +64 -0
- package/dist/attributes/V5NumberAttribute.js.map +1 -0
- package/dist/attributes/V5PathAttribue.js +15 -0
- package/dist/attributes/V5PathAttribue.js.map +1 -0
- package/dist/attributes/V5SetAttribute.js +27 -0
- package/dist/attributes/V5SetAttribute.js.map +1 -0
- package/dist/attributes/V5TextArrayAttribute.js +40 -0
- package/dist/attributes/V5TextArrayAttribute.js.map +1 -0
- package/dist/attributes/V5TextAttribute.js +52 -0
- package/dist/attributes/V5TextAttribute.js.map +1 -0
- package/dist/attributes/index.js +32 -0
- package/dist/attributes/index.js.map +1 -0
- package/dist/entities/V5AbstractEntity.js +17 -0
- package/dist/entities/V5AbstractEntity.js.map +1 -0
- package/dist/entities/V5CommonEntity.js +33 -0
- package/dist/entities/V5CommonEntity.js.map +1 -0
- package/dist/entities/index.js +19 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/events/V5EditorContext.js +3 -0
- package/dist/events/V5EditorContext.js.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/V5ContentNode.js +57 -0
- package/dist/nodes/V5ContentNode.js.map +1 -0
- package/dist/nodes/V5Node.js +277 -0
- package/dist/nodes/V5Node.js.map +1 -0
- package/dist/nodes/V5NodeAlternatives.js +119 -0
- package/dist/nodes/V5NodeAlternatives.js.map +1 -0
- package/dist/parsed/ParsedArrayNode.js +48 -0
- package/dist/parsed/ParsedArrayNode.js.map +1 -0
- package/dist/parsed/ParsedAttribute.js +41 -0
- package/dist/parsed/ParsedAttribute.js.map +1 -0
- package/dist/parsed/ParsedContentNode.js +19 -0
- package/dist/parsed/ParsedContentNode.js.map +1 -0
- package/dist/parsed/ParsedDiagnostic.js +21 -0
- package/dist/parsed/ParsedDiagnostic.js.map +1 -0
- package/dist/parsed/ParsedNode.js +240 -0
- package/dist/parsed/ParsedNode.js.map +1 -0
- package/dist/parsed/ParsedNodeTypes.js +3 -0
- package/dist/parsed/ParsedNodeTypes.js.map +1 -0
- package/dist/parsed/index.js +23 -0
- package/dist/parsed/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/types/valueOf.js +3 -0
- package/dist/utils/types/valueOf.js.map +1 -0
- package/dist/values/AbstractValueProvider.js +45 -0
- package/dist/values/AbstractValueProvider.js.map +1 -0
- package/dist/values/ConstantExpressionValueProvider.js +22 -0
- package/dist/values/ConstantExpressionValueProvider.js.map +1 -0
- package/dist/values/ParsedNodeValues.js +80 -0
- package/dist/values/ParsedNodeValues.js.map +1 -0
- package/dist/values/ParsedProviderValue.js +44 -0
- package/dist/values/ParsedProviderValue.js.map +1 -0
- package/dist/values/ParsedValue.js +73 -0
- package/dist/values/ParsedValue.js.map +1 -0
- package/dist/values/ParserDefaultValueProvider.js +16 -0
- package/dist/values/ParserDefaultValueProvider.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { XMLPositional } from '@journeyapps/common-xml';
|
|
2
|
+
import type { XMLParseEvent } from './XMLParseEvent';
|
|
3
|
+
import type { ParsedNode } from './parsed/ParsedNode';
|
|
4
|
+
export interface AttributeParseInput {
|
|
5
|
+
value: string | null;
|
|
6
|
+
source: XMLPositional;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* An XML parse event with the input selected for an attribute codec.
|
|
10
|
+
*/
|
|
11
|
+
export interface AttributeParseEvent<Node extends ParsedNode<any, any> = any> extends XMLParseEvent<Node> {
|
|
12
|
+
input: AttributeParseInput & {
|
|
13
|
+
value: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ParsedDiagnostic } from './parsed/ParsedDiagnostic';
|
|
2
|
+
import type { XMLElement } from '@journeyapps/domparser/types';
|
|
3
|
+
import type { AbstractExpression, ValidationContext, FormatStringExpression, EvaluatedExpression } from '@ja-platform/parser-expressions';
|
|
4
|
+
import type { ParsedNode } from './parsed/ParsedNode';
|
|
5
|
+
import type { V5Attribute } from './attributes/V5Attribute';
|
|
6
|
+
export interface XMLParseEventHelper<Node extends ParsedNode = ParsedNode, Scope extends ValidationContext = ValidationContext, Expression extends AbstractExpression = FormatStringExpression | EvaluatedExpression> {
|
|
7
|
+
/**
|
|
8
|
+
* Resolve context-specific syntax before using the attribute's parser.
|
|
9
|
+
*/
|
|
10
|
+
parseAttributeExpression?({ attribute, source }: {
|
|
11
|
+
attribute: V5Attribute;
|
|
12
|
+
source: string;
|
|
13
|
+
}): AbstractExpression | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Prepare a node after its attributes and before its children are parsed.
|
|
16
|
+
*/
|
|
17
|
+
prepareNode?(node: Node): void;
|
|
18
|
+
validateFormatAttribute?({ element, attribute, scope, expression }: {
|
|
19
|
+
element: XMLElement;
|
|
20
|
+
attribute: string;
|
|
21
|
+
scope: Scope;
|
|
22
|
+
expression: Expression;
|
|
23
|
+
}): void;
|
|
24
|
+
validateFormatContent?({ element, scope, expression }: {
|
|
25
|
+
element: XMLElement;
|
|
26
|
+
scope: Scope;
|
|
27
|
+
expression: Expression;
|
|
28
|
+
}): void;
|
|
29
|
+
pushError(diagnostic: ParsedDiagnostic): void;
|
|
30
|
+
}
|
|
31
|
+
export interface XMLParseEvent<ParentNode, Helper extends XMLParseEventHelper = XMLParseEventHelper> {
|
|
32
|
+
element: XMLElement;
|
|
33
|
+
parentNode?: ParentNode;
|
|
34
|
+
parsedNode?: ParentNode;
|
|
35
|
+
scope?: ValidationContext;
|
|
36
|
+
helper: Helper;
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BooleanType } from '@ja-platform/parser-type-system';
|
|
2
|
+
/**
|
|
3
|
+
* Convert resolved conditions, including the presence of objects and non-boolean fields.
|
|
4
|
+
* Literal boolean syntax is validated separately by BooleanType.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ConditionType extends BooleanType {
|
|
7
|
+
readonly _typeName = "condition";
|
|
8
|
+
readonly name = "condition";
|
|
9
|
+
parse(value: unknown): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { AttributeParseEvent, AttributeParseInput } from '../AttributeParseEvent';
|
|
2
|
+
import { XMLParseEvent } from '../XMLParseEvent';
|
|
3
|
+
import { AbstractExpression, ExpressionParser, ConstantExpression, EvaluatedExpression } from '@ja-platform/parser-expressions';
|
|
4
|
+
import { Type } from '@ja-platform/parser-type-system';
|
|
5
|
+
import { V5CommonEntity, V5CommonEntityListener, V5CommonEntityOptions } from '../entities/V5CommonEntity';
|
|
6
|
+
import { V5EditorHelpers } from '../events/V5EditorContext';
|
|
7
|
+
import { V5Node } from '../nodes/V5Node';
|
|
8
|
+
import { ParsedAttribute, ParsedAttributeOptions, ParsedNode } from '../parsed';
|
|
9
|
+
export type CombinedAttributeExpression = EvaluatedExpression | ConstantExpression<unknown>;
|
|
10
|
+
export declare enum DefaultValueKind {
|
|
11
|
+
COLOR = "color",
|
|
12
|
+
SIZE = "size"
|
|
13
|
+
}
|
|
14
|
+
export declare enum ComponentSize {
|
|
15
|
+
SMALL = "small",
|
|
16
|
+
MEDIUM = "medium",
|
|
17
|
+
LARGE = "large"
|
|
18
|
+
}
|
|
19
|
+
export type DefaultValueMap<T extends any> = {
|
|
20
|
+
[k in string | number | symbol]: T;
|
|
21
|
+
};
|
|
22
|
+
export interface V5AttributeListener extends V5CommonEntityListener {
|
|
23
|
+
}
|
|
24
|
+
export interface NodeChecker {
|
|
25
|
+
hasAttributeType(type: string): boolean;
|
|
26
|
+
}
|
|
27
|
+
export type DefaultValueType<T> = {
|
|
28
|
+
[k in ComponentSize]: T;
|
|
29
|
+
} | T;
|
|
30
|
+
export declare enum AttributeCategory {
|
|
31
|
+
THEME = "theme",
|
|
32
|
+
LAYOUT = "layout"
|
|
33
|
+
}
|
|
34
|
+
export interface V5AttributeOptions<DEFAULT = any, VALUE = unknown> extends V5CommonEntityOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Accepted expression syntax. Defaults to prefixed code followed by constant text.
|
|
37
|
+
*/
|
|
38
|
+
syntax?: ExpressionParser<AbstractExpression>;
|
|
39
|
+
/**
|
|
40
|
+
* Conversion and literal validation for the resolved attribute value.
|
|
41
|
+
*/
|
|
42
|
+
valueType?: Type<VALUE>;
|
|
43
|
+
required?: boolean;
|
|
44
|
+
configurable?: boolean;
|
|
45
|
+
advanced?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Used to categorise sets of attributes for easier filtering
|
|
48
|
+
*/
|
|
49
|
+
category?: AttributeCategory;
|
|
50
|
+
fragmentNamespace?: string;
|
|
51
|
+
defaultValue?: DEFAULT;
|
|
52
|
+
/**
|
|
53
|
+
* Select a variant contribution explicitly; omitted defaults are literal values.
|
|
54
|
+
*/
|
|
55
|
+
defaultValueKind?: DefaultValueKind;
|
|
56
|
+
/**
|
|
57
|
+
* The interim value to use when the component attribute is still being evaluated (ie. setting up watches),
|
|
58
|
+
* will fallback to `defaultValue` if not set.
|
|
59
|
+
*/
|
|
60
|
+
loadingValue?: DEFAULT;
|
|
61
|
+
/**
|
|
62
|
+
* By default autowatch is enabled, disable it if the attribute relies on parameters such as $object
|
|
63
|
+
* (used quite often in query-widget) which need to have watches setup in virtual tables
|
|
64
|
+
* @deprecated
|
|
65
|
+
*/
|
|
66
|
+
autoWatch?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Indicates that the attribute is considered deprecated
|
|
69
|
+
*/
|
|
70
|
+
deprecated?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Ensures that functions returned by this attribute will be mapped to string identifiers in the runtime
|
|
73
|
+
*/
|
|
74
|
+
mapGeneratedFunctions?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface V5AttributeGenerics<O extends V5AttributeOptions = V5AttributeOptions> {
|
|
77
|
+
Options: O;
|
|
78
|
+
Listener: V5AttributeListener;
|
|
79
|
+
Value: any;
|
|
80
|
+
NormalizedValue: unknown;
|
|
81
|
+
}
|
|
82
|
+
export interface StringifyDirective {
|
|
83
|
+
isAttribute: boolean;
|
|
84
|
+
value: string | null;
|
|
85
|
+
}
|
|
86
|
+
export declare class V5Attribute<G extends V5AttributeGenerics = V5AttributeGenerics> extends V5CommonEntity<G> {
|
|
87
|
+
static TYPE: string;
|
|
88
|
+
parent: V5Node<any>;
|
|
89
|
+
type: string;
|
|
90
|
+
constructor(type: string, options: G['Options']);
|
|
91
|
+
get key(): string;
|
|
92
|
+
get defaultValue(): any;
|
|
93
|
+
get name(): string;
|
|
94
|
+
normalizeValue(value: unknown): G['NormalizedValue'];
|
|
95
|
+
isEnclosedWith(checkerCB: (helper: NodeChecker) => boolean): boolean;
|
|
96
|
+
serialize(): any;
|
|
97
|
+
getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
|
|
98
|
+
protected getParsedValue(event: AttributeParseEvent, _parseContext?: Record<string, any>): G['Value'];
|
|
99
|
+
stringify(value: G['Value'], parent: ParsedNode): StringifyDirective;
|
|
100
|
+
createParsedAttribute(options: ParsedAttributeOptions<G['Value'], this>): ParsedAttribute<G['Value'], this>;
|
|
101
|
+
protected getInput(event: XMLParseEvent<ParsedNode>): AttributeParseInput;
|
|
102
|
+
parse(event: XMLParseEvent<ParsedNode>, parseContext?: Record<string, any>): ParsedAttribute<G["Value"], this>;
|
|
103
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { V5Attribute, V5AttributeOptions, V5AttributeGenerics, DefaultValueType } from './V5Attribute';
|
|
2
|
+
import { V5EditorHelpers } from '../events/V5EditorContext';
|
|
3
|
+
import { EvaluatedExpression, ConstantExpression, ShorthandExpression } from '@ja-platform/parser-expressions';
|
|
4
|
+
export type CombinedBooleanExpression = EvaluatedExpression | ConstantExpression<boolean> | ShorthandExpression;
|
|
5
|
+
export interface V5BooleanAttributeGenerics extends V5AttributeGenerics {
|
|
6
|
+
Options: V5AttributeOptions<DefaultValueType<boolean>, boolean>;
|
|
7
|
+
Value: CombinedBooleanExpression | null;
|
|
8
|
+
NormalizedValue: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* For dealing with boolean attribute types such as `show-if` and `hide-if`
|
|
12
|
+
*/
|
|
13
|
+
export declare class V5BooleanAttribute extends V5Attribute<V5BooleanAttributeGenerics> {
|
|
14
|
+
static TYPE: string;
|
|
15
|
+
static isInstanceOf(attr: V5Attribute): attr is V5BooleanAttribute;
|
|
16
|
+
constructor(options: V5BooleanAttributeGenerics['Options']);
|
|
17
|
+
getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
|
|
18
|
+
serialize(): any;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ConstantExpression } from '@ja-platform/parser-expressions';
|
|
2
|
+
import { V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';
|
|
3
|
+
export interface V5ConstantBooleanAttributeGenerics extends V5AttributeGenerics {
|
|
4
|
+
Options: V5AttributeOptions<boolean, boolean>;
|
|
5
|
+
Value: ConstantExpression<boolean> | null;
|
|
6
|
+
NormalizedValue: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A boolean attribute that accepts constant text only.
|
|
10
|
+
*/
|
|
11
|
+
export declare class V5ConstantBooleanAttribute extends V5Attribute<V5ConstantBooleanAttributeGenerics> {
|
|
12
|
+
static TYPE: string;
|
|
13
|
+
static isInstanceOf(attr: V5Attribute): attr is V5ConstantBooleanAttribute;
|
|
14
|
+
constructor(options: V5ConstantBooleanAttributeGenerics['Options']);
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ConstantExpression } from '@ja-platform/parser-expressions';
|
|
2
|
+
import { V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';
|
|
3
|
+
export interface V5ConstantTextAttributeGenerics extends V5AttributeGenerics {
|
|
4
|
+
Options: V5AttributeOptions<string, string>;
|
|
5
|
+
Value: ConstantExpression | null;
|
|
6
|
+
NormalizedValue: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A string attribute that accepts constant text only.
|
|
10
|
+
*/
|
|
11
|
+
export declare class V5ConstantTextAttribute extends V5Attribute<V5ConstantTextAttributeGenerics> {
|
|
12
|
+
static TYPE: string;
|
|
13
|
+
static isInstanceOf(attr: V5Attribute): attr is V5ConstantTextAttribute;
|
|
14
|
+
constructor(options: V5ConstantTextAttributeGenerics['Options']);
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AttributeParseEvent, AttributeParseInput } from '../AttributeParseEvent';
|
|
2
|
+
import { CombinedTextExpression, V5TextAttribute, V5TextAttributeGenerics, V5TextAttributeOptions } from './V5TextAttribute';
|
|
3
|
+
import { StringifyDirective } from './V5Attribute';
|
|
4
|
+
import { ParsedNode } from '../parsed';
|
|
5
|
+
import { XMLParseEvent } from '../XMLParseEvent';
|
|
6
|
+
export interface V5ContextTextAttributeOptions extends Omit<V5TextAttributeOptions, 'configurable'> {
|
|
7
|
+
}
|
|
8
|
+
export declare class V5ContentTextAttribute extends V5TextAttribute<V5TextAttributeGenerics & {
|
|
9
|
+
Options: V5ContextTextAttributeOptions;
|
|
10
|
+
}> {
|
|
11
|
+
static TYPE: string;
|
|
12
|
+
constructor(options: V5ContextTextAttributeOptions);
|
|
13
|
+
protected getInput(event: XMLParseEvent<ParsedNode>): AttributeParseInput;
|
|
14
|
+
protected getParsedValue(event: AttributeParseEvent, parseContext?: Record<string, any>): CombinedTextExpression | null;
|
|
15
|
+
protected validateInput(event: AttributeParseEvent, expression: CombinedTextExpression, parseContext: Record<string, any>): void;
|
|
16
|
+
stringify(value: V5TextAttributeGenerics['Value'], parent: ParsedNode): StringifyDirective;
|
|
17
|
+
serialize(): any;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EvaluatedExpression, ShorthandExpression } from '@ja-platform/parser-expressions';
|
|
2
|
+
import { V5EditorHelpers } from '../events/V5EditorContext';
|
|
3
|
+
import { V5Attribute, V5AttributeGenerics } from './V5Attribute';
|
|
4
|
+
export type CombinedExpression = EvaluatedExpression | ShorthandExpression;
|
|
5
|
+
export interface V5ExpressionAttributeGenerics extends V5AttributeGenerics {
|
|
6
|
+
Value: CombinedExpression | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* An attribute containing a reference or explicitly evaluated code.
|
|
10
|
+
* Examples include `user.name`, `$object.quantity` and `$:calculateTotal()`.
|
|
11
|
+
* Bare identifiers always represent references; there is no literal text fallback.
|
|
12
|
+
*/
|
|
13
|
+
export declare class V5ExpressionAttribute extends V5Attribute<V5ExpressionAttributeGenerics> {
|
|
14
|
+
static TYPE: string;
|
|
15
|
+
constructor(options: V5ExpressionAttributeGenerics['Options']);
|
|
16
|
+
getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FunctionExpression } from '@ja-platform/parser-expressions';
|
|
2
|
+
import { V5Attribute, V5AttributeGenerics } from './V5Attribute';
|
|
3
|
+
export interface V5FunctionAttributeGenerics extends V5AttributeGenerics {
|
|
4
|
+
Value: FunctionExpression | null;
|
|
5
|
+
}
|
|
6
|
+
export declare class V5FunctionAttribute extends V5Attribute<V5FunctionAttributeGenerics> {
|
|
7
|
+
static TYPE: string;
|
|
8
|
+
constructor(options: Omit<V5AttributeGenerics['Options'], 'configurable'>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
|
|
2
|
+
import { V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';
|
|
3
|
+
import { V5EditorHelpers } from '../events/V5EditorContext';
|
|
4
|
+
export type CombinedListExpression = EvaluatedExpression | ConstantExpression;
|
|
5
|
+
export interface V5ListAttributeOptions extends V5AttributeOptions<string[]> {
|
|
6
|
+
options: string[];
|
|
7
|
+
delimiter?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface V5ListAttributeGenerics extends V5AttributeGenerics {
|
|
10
|
+
Value: CombinedListExpression | null;
|
|
11
|
+
Options: V5ListAttributeOptions;
|
|
12
|
+
}
|
|
13
|
+
export declare class V5ListAttribute extends V5Attribute<V5ListAttributeGenerics> {
|
|
14
|
+
static TYPE: string;
|
|
15
|
+
delimiter: string;
|
|
16
|
+
constructor(options: V5ListAttributeGenerics['Options']);
|
|
17
|
+
static isInstanceOf(attr: V5Attribute): attr is V5ListAttribute;
|
|
18
|
+
static toList(value: any, delimiter?: string): any[];
|
|
19
|
+
getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
|
|
20
|
+
serialize(): any;
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AttributeParseEvent } from '../AttributeParseEvent';
|
|
2
|
+
import { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
|
|
3
|
+
import { DefaultValueType, V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';
|
|
4
|
+
import { V5EditorHelpers } from '../events/V5EditorContext';
|
|
5
|
+
import type { V5Node } from '../nodes/V5Node';
|
|
6
|
+
export type CombinedNumberExpression = EvaluatedExpression | ConstantExpression<number>;
|
|
7
|
+
export interface V5NumberAttributeRange {
|
|
8
|
+
min?: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface V5NumberAttributeOptions extends V5AttributeOptions<DefaultValueType<number>, number> {
|
|
12
|
+
range?: V5NumberAttributeRange;
|
|
13
|
+
}
|
|
14
|
+
export interface V5NumberAttributeGenerics extends V5AttributeGenerics {
|
|
15
|
+
Options: V5NumberAttributeOptions;
|
|
16
|
+
Value: CombinedNumberExpression | null;
|
|
17
|
+
NormalizedValue: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class V5NumberAttribute extends V5Attribute<V5NumberAttributeGenerics> {
|
|
20
|
+
static TYPE: string;
|
|
21
|
+
static isInstanceOf(attr: V5Attribute): attr is V5NumberAttribute;
|
|
22
|
+
constructor(options: V5NumberAttributeGenerics['Options']);
|
|
23
|
+
protected getParsedValue(event: AttributeParseEvent): V5NumberAttributeGenerics['Value'];
|
|
24
|
+
setParent(parent: V5Node<any>): void;
|
|
25
|
+
getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
|
|
26
|
+
serialize(): any;
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
|
|
2
|
+
import { V5Attribute, V5AttributeOptions, V5AttributeGenerics } from './V5Attribute';
|
|
3
|
+
export type CombinedPathExpression = EvaluatedExpression | ConstantExpression;
|
|
4
|
+
export interface V5PathAttributeGenerics extends V5AttributeGenerics {
|
|
5
|
+
Value: CombinedPathExpression | null;
|
|
6
|
+
}
|
|
7
|
+
export declare class V5PathAttribute extends V5Attribute<V5PathAttributeGenerics> {
|
|
8
|
+
static TYPE: string;
|
|
9
|
+
constructor(options: Omit<V5AttributeOptions, 'configurable'>);
|
|
10
|
+
serialize(): any;
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
|
|
2
|
+
import { V5EditorHelpers } from '../events/V5EditorContext';
|
|
3
|
+
import { DefaultValueType, V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';
|
|
4
|
+
export type CombinedSetExpression = EvaluatedExpression | ConstantExpression;
|
|
5
|
+
export interface V5SetAttributeOptions extends V5AttributeOptions<DefaultValueType<string>> {
|
|
6
|
+
options: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface V5SetAttributeGenerics extends V5AttributeGenerics {
|
|
9
|
+
Value: CombinedSetExpression | null;
|
|
10
|
+
Options: V5SetAttributeOptions;
|
|
11
|
+
}
|
|
12
|
+
export declare class V5SetAttribute extends V5Attribute<V5SetAttributeGenerics> {
|
|
13
|
+
static TYPE: string;
|
|
14
|
+
constructor(options: V5SetAttributeOptions);
|
|
15
|
+
static isInstanceOf(attr: V5Attribute): attr is V5SetAttribute;
|
|
16
|
+
getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
|
|
17
|
+
serialize(): any;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { V5Attribute } from './V5Attribute';
|
|
2
|
+
import { V5TextAttribute, V5TextAttributeGenerics, V5TextAttributeOptions } from './V5TextAttribute';
|
|
3
|
+
export interface V5TextArrayAttributeOptions extends V5TextAttributeOptions<string[]> {
|
|
4
|
+
delimiter?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface V5TextArrayAttributeGenerics extends V5TextAttributeGenerics<string[]> {
|
|
7
|
+
Options: V5TextArrayAttributeOptions;
|
|
8
|
+
}
|
|
9
|
+
export declare class V5TextArrayAttribute extends V5TextAttribute<V5TextArrayAttributeGenerics> {
|
|
10
|
+
static TYPE: string;
|
|
11
|
+
delimiter: string;
|
|
12
|
+
static isInstanceOf(attr: V5Attribute): attr is V5TextArrayAttribute;
|
|
13
|
+
constructor(options: V5TextArrayAttributeGenerics['Options']);
|
|
14
|
+
serialize(): any;
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AttributeParseEvent } from '../AttributeParseEvent';
|
|
2
|
+
import { DefaultValueType, V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';
|
|
3
|
+
import { V5EditorHelpers } from '../events/V5EditorContext';
|
|
4
|
+
import { FormatStringExpression, EvaluatedExpression } from '@ja-platform/parser-expressions';
|
|
5
|
+
export type CombinedTextExpression = FormatStringExpression | EvaluatedExpression;
|
|
6
|
+
export type V5TextAttributeOptions<Value = string> = V5AttributeOptions<DefaultValueType<Value>, Value>;
|
|
7
|
+
export interface V5TextAttributeGenerics<Value = string> extends V5AttributeGenerics {
|
|
8
|
+
Value: CombinedTextExpression | null;
|
|
9
|
+
Options: V5TextAttributeOptions<Value>;
|
|
10
|
+
NormalizedValue: Value;
|
|
11
|
+
}
|
|
12
|
+
export declare class V5TextAttribute<T extends V5TextAttributeGenerics<unknown> = V5TextAttributeGenerics> extends V5Attribute<T> {
|
|
13
|
+
static TYPE: string;
|
|
14
|
+
constructor(options: T['Options']);
|
|
15
|
+
static isInstanceOf(attr: V5Attribute): attr is V5TextAttribute<V5TextAttributeGenerics<unknown>>;
|
|
16
|
+
protected getParsedValue(event: AttributeParseEvent, parseContext?: Record<string, any>): CombinedTextExpression | null;
|
|
17
|
+
protected validateInput(event: AttributeParseEvent, expression: CombinedTextExpression, parseContext: Record<string, any>): void;
|
|
18
|
+
getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
|
|
19
|
+
serialize(): any;
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './AttributeDefaults';
|
|
2
|
+
export * from './ConditionType';
|
|
3
|
+
export * from './V5Attribute';
|
|
4
|
+
export * from './V5BooleanAttribute';
|
|
5
|
+
export * from './V5ConstantBooleanAttribute';
|
|
6
|
+
export * from './V5ConstantTextAttribute';
|
|
7
|
+
export * from './V5ContentTextAttribute';
|
|
8
|
+
export * from './V5ExpressionAttribute';
|
|
9
|
+
export * from './V5FunctionAttribute';
|
|
10
|
+
export * from './V5ListAttribute';
|
|
11
|
+
export * from './V5NumberAttribute';
|
|
12
|
+
export * from './V5PathAttribue';
|
|
13
|
+
export * from './V5SetAttribute';
|
|
14
|
+
export * from './V5TextArrayAttribute';
|
|
15
|
+
export * from './V5TextAttribute';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface V5AbstractEntityOptions {
|
|
2
|
+
key?: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface V5AbstractEntityGenerics {
|
|
7
|
+
Options: V5AbstractEntityOptions;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class V5AbstractEntity<G extends V5AbstractEntityGenerics = V5AbstractEntityGenerics> {
|
|
10
|
+
options: G['Options'];
|
|
11
|
+
constructor(options: G['Options']);
|
|
12
|
+
serialize(): {
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { V5Node } from '../nodes/V5Node';
|
|
2
|
+
import { V5AbstractEntity, V5AbstractEntityGenerics, V5AbstractEntityOptions } from './V5AbstractEntity';
|
|
3
|
+
export interface V5CommonEntityOptions extends V5AbstractEntityOptions {
|
|
4
|
+
docs?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Request the enclosing collection scope from a parser that supports scoped declarations.
|
|
7
|
+
*/
|
|
8
|
+
queryScoped?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface V5CommonEntityListener {
|
|
11
|
+
}
|
|
12
|
+
export interface V5CommonEntityGenerics extends V5AbstractEntityGenerics {
|
|
13
|
+
Options: V5CommonEntityOptions;
|
|
14
|
+
Listener: V5CommonEntityListener;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class V5CommonEntity<G extends V5CommonEntityGenerics = V5CommonEntityGenerics> extends V5AbstractEntity<G> {
|
|
17
|
+
listeners: G['Listener'][];
|
|
18
|
+
parent: V5Node<any>;
|
|
19
|
+
constructor(options: G['Options']);
|
|
20
|
+
serialize(): {
|
|
21
|
+
name: string;
|
|
22
|
+
queryScoped?: boolean;
|
|
23
|
+
};
|
|
24
|
+
getRootNode(): V5Node<any>;
|
|
25
|
+
registerListener(listener: G['Listener']): () => void;
|
|
26
|
+
fireListeners(cb: (listener: G['Listener']) => any): void;
|
|
27
|
+
setParent(parent: V5Node<any>): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface V5EditorHelpers<FieldDefinition> {
|
|
2
|
+
/**
|
|
3
|
+
* Return functions from the javascript context in the editor for a view
|
|
4
|
+
*/
|
|
5
|
+
viewFunctionsSelection(signature?: string): FieldDefinition;
|
|
6
|
+
/**
|
|
7
|
+
* Return functions from the javascript context in the editor for a navigation view
|
|
8
|
+
*/
|
|
9
|
+
navigateFunctionsSelection(signature?: string): FieldDefinition;
|
|
10
|
+
typedBinding(options: {
|
|
11
|
+
types: string[] | null;
|
|
12
|
+
writable: boolean;
|
|
13
|
+
constants: boolean;
|
|
14
|
+
}, defaultValue?: string): FieldDefinition;
|
|
15
|
+
typedBindingOrFunction(options: {
|
|
16
|
+
types: string[] | null;
|
|
17
|
+
writable: boolean;
|
|
18
|
+
constants: boolean;
|
|
19
|
+
}, defaultValue?: string): FieldDefinition;
|
|
20
|
+
/**
|
|
21
|
+
* One of a set list of values, or a $: function.
|
|
22
|
+
*/
|
|
23
|
+
dynamicSet(values: string[], defaultValue?: string): FieldDefinition;
|
|
24
|
+
/**
|
|
25
|
+
* A list of values, or a $: function.
|
|
26
|
+
*/
|
|
27
|
+
dynamicList(values: string[], defaultValue?: string[]): FieldDefinition;
|
|
28
|
+
formatString(queryScopeTag?: string): FieldDefinition;
|
|
29
|
+
/**
|
|
30
|
+
* Color selection (constant or function).
|
|
31
|
+
*
|
|
32
|
+
* @param params.text: true if the color is for foreground text
|
|
33
|
+
*/
|
|
34
|
+
color(options: {
|
|
35
|
+
text: boolean;
|
|
36
|
+
}): FieldDefinition;
|
|
37
|
+
/**
|
|
38
|
+
* Name of a built-in icon, or path to an icon.
|
|
39
|
+
*/
|
|
40
|
+
icon(options: {
|
|
41
|
+
includeUploads?: boolean;
|
|
42
|
+
}): FieldDefinition;
|
|
43
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export * from './AttributeParseEvent';
|
|
2
|
+
export * from './XMLParseEvent';
|
|
3
|
+
export * from './attributes/V5Attribute';
|
|
4
|
+
export * from './attributes/V5ConstantBooleanAttribute';
|
|
5
|
+
export * from './attributes/V5ConstantTextAttribute';
|
|
6
|
+
export * from './entities/V5AbstractEntity';
|
|
7
|
+
export * from './entities/V5CommonEntity';
|
|
8
|
+
export * from './nodes/V5Node';
|
|
9
|
+
export * from './nodes/V5ContentNode';
|
|
10
|
+
export * from './nodes/V5NodeAlternatives';
|
|
11
|
+
export * from './parsed/ParsedArrayNode';
|
|
12
|
+
export * from './parsed/ParsedAttribute';
|
|
13
|
+
export * from './parsed/ParsedContentNode';
|
|
14
|
+
export * from './parsed/ParsedDiagnostic';
|
|
15
|
+
export * from './parsed/ParsedNode';
|
|
16
|
+
export * from './parsed/ParsedNodeTypes';
|
|
17
|
+
export * from './values/AbstractValueProvider';
|
|
18
|
+
export * from './values/ConstantExpressionValueProvider';
|
|
19
|
+
export * from './values/ParserDefaultValueProvider';
|
|
20
|
+
export * from './values/ParsedNodeValues';
|
|
21
|
+
export * from './values/ParsedProviderValue';
|
|
22
|
+
export * from './values/ParsedValue';
|
|
23
|
+
export * from './attributes/V5NumberAttribute';
|
|
24
|
+
export * from './attributes/V5BooleanAttribute';
|
|
25
|
+
export * from './attributes/V5SetAttribute';
|
|
26
|
+
export * from './attributes/V5ListAttribute';
|
|
27
|
+
export * from './attributes/V5TextAttribute';
|
|
28
|
+
export * from './attributes/V5TextArrayAttribute';
|
|
29
|
+
export * from './attributes/V5ExpressionAttribute';
|
|
30
|
+
export * from './attributes/V5FunctionAttribute';
|
|
31
|
+
export * from './attributes/V5ContentTextAttribute';
|
|
32
|
+
export * from './attributes/V5PathAttribue';
|
|
33
|
+
export * from './attributes/ConditionType';
|
|
34
|
+
export * from './events/V5EditorContext';
|
|
35
|
+
export * from './utils/types/valueOf';
|
|
36
|
+
export * from './attributes/AttributeDefaults';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ConstantExpression, ExpressionParser, AbstractExpression } from '@ja-platform/parser-expressions';
|
|
2
|
+
import { Type } from '@ja-platform/parser-type-system';
|
|
3
|
+
import { V5Attribute } from '../attributes/V5Attribute';
|
|
4
|
+
import { AttributeParseInput } from '../AttributeParseEvent';
|
|
5
|
+
import { XMLParseEvent } from '../XMLParseEvent';
|
|
6
|
+
import { ParsedNode } from '../parsed/ParsedNode';
|
|
7
|
+
import { ParsedContentNode, ParsedContentNodeShape } from '../parsed/ParsedContentNode';
|
|
8
|
+
import { ParseTreeOptions } from './V5Node';
|
|
9
|
+
import { V5Node, V5NodeGenerics, V5NodeOptions } from './V5Node';
|
|
10
|
+
export type NodeDefaultOptions<Value> = {
|
|
11
|
+
isMultiple?: false;
|
|
12
|
+
defaultValue?: Value;
|
|
13
|
+
} | {
|
|
14
|
+
isMultiple: true;
|
|
15
|
+
defaultValue?: Value[];
|
|
16
|
+
};
|
|
17
|
+
export type V5ContentNodeOptions<Value, Expression extends AbstractExpression = ConstantExpression<Value>> = Omit<V5NodeOptions, 'isMultiple' | 'defaultValue'> & NodeDefaultOptions<Value> & {
|
|
18
|
+
valueType: Type<Value>;
|
|
19
|
+
syntax?: ExpressionParser<Expression>;
|
|
20
|
+
};
|
|
21
|
+
interface V5ContentNodeGenerics<Value, Expression extends AbstractExpression> extends V5NodeGenerics<ParsedContentNodeShape<Expression>, ParsedContentNode<Expression, Value>, Value | undefined> {
|
|
22
|
+
Options: V5ContentNodeOptions<Value, Expression>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Adapt element content to the shared value-provider pipeline.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ContentValueAttribute extends V5Attribute {
|
|
28
|
+
protected getInput(event: XMLParseEvent<ParsedNode>): AttributeParseInput;
|
|
29
|
+
stringify(value: AbstractExpression): {
|
|
30
|
+
isAttribute: boolean;
|
|
31
|
+
value: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Parse element content using its declared value type and optional expression syntax.
|
|
36
|
+
*/
|
|
37
|
+
export declare class V5ContentNode<Value, Expression extends AbstractExpression = ConstantExpression<Value>> extends V5Node<V5ContentNodeGenerics<Value, Expression>> {
|
|
38
|
+
constructor(options: V5ContentNodeOptions<Value, Expression>);
|
|
39
|
+
protected createParsedNode(options: ParseTreeOptions): ParsedContentNode<Expression, Value>;
|
|
40
|
+
protected parseAttributes({ parsed, event }: {
|
|
41
|
+
parsed: ParsedContentNode<Expression, Value>;
|
|
42
|
+
event: XMLParseEvent<ParsedNode>;
|
|
43
|
+
}): void;
|
|
44
|
+
}
|
|
45
|
+
export {};
|