@ja-platform/parser-core 0.0.0-dev-20261021200117 → 0.0.0-dev-20261021212654

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.
Files changed (123) hide show
  1. package/dist/@types/XMLParseEvent.d.ts +2 -2
  2. package/dist/@types/attributes/{V5Attribute.d.ts → Attribute.d.ts} +10 -38
  3. package/dist/@types/attributes/BooleanAttribute.d.ts +17 -0
  4. package/dist/@types/attributes/ConstantBooleanAttribute.d.ts +15 -0
  5. package/dist/@types/attributes/ConstantTextAttribute.d.ts +15 -0
  6. package/dist/@types/attributes/ContentTextAttribute.d.ts +18 -0
  7. package/dist/@types/attributes/{V5ExpressionAttribute.d.ts → ExpressionAttribute.d.ts} +4 -6
  8. package/dist/@types/attributes/FunctionAttribute.d.ts +9 -0
  9. package/dist/@types/attributes/ListAttribute.d.ts +19 -0
  10. package/dist/@types/attributes/NumberAttribute.d.ts +25 -0
  11. package/dist/@types/attributes/PathAttribute.d.ts +11 -0
  12. package/dist/@types/attributes/SetAttribute.d.ts +16 -0
  13. package/dist/@types/attributes/TextArrayAttribute.d.ts +15 -0
  14. package/dist/@types/attributes/TextAttribute.d.ts +18 -0
  15. package/dist/@types/entities/AbstractEntity.d.ts +15 -0
  16. package/dist/@types/entities/CommonEntity.d.ts +28 -0
  17. package/dist/@types/index.d.ts +19 -21
  18. package/dist/@types/nodes/{V5ContentNode.d.ts → ContentNode.d.ts} +9 -9
  19. package/dist/@types/nodes/{V5Node.d.ts → Node.d.ts} +23 -23
  20. package/dist/@types/nodes/{V5NodeAlternatives.d.ts → NodeAlternatives.d.ts} +7 -6
  21. package/dist/@types/parsed/ParsedArrayNode.d.ts +3 -3
  22. package/dist/@types/parsed/ParsedAttribute.d.ts +4 -4
  23. package/dist/@types/parsed/ParsedNode.d.ts +4 -4
  24. package/dist/@types/parsed/ParsedNodeTypes.d.ts +2 -3
  25. package/dist/XMLParseEvent.js.map +1 -1
  26. package/dist/attributes/{V5Attribute.js → Attribute.js} +9 -28
  27. package/dist/attributes/Attribute.js.map +1 -0
  28. package/dist/attributes/BooleanAttribute.js +31 -0
  29. package/dist/attributes/BooleanAttribute.js.map +1 -0
  30. package/dist/attributes/ConstantBooleanAttribute.js +22 -0
  31. package/dist/attributes/ConstantBooleanAttribute.js.map +1 -0
  32. package/dist/attributes/ConstantTextAttribute.js +22 -0
  33. package/dist/attributes/ConstantTextAttribute.js.map +1 -0
  34. package/dist/attributes/{V5ContentTextAttribute.js → ContentTextAttribute.js} +7 -7
  35. package/dist/attributes/ContentTextAttribute.js.map +1 -0
  36. package/dist/attributes/ExpressionAttribute.js +23 -0
  37. package/dist/attributes/ExpressionAttribute.js.map +1 -0
  38. package/dist/attributes/FunctionAttribute.js +14 -0
  39. package/dist/attributes/FunctionAttribute.js.map +1 -0
  40. package/dist/attributes/{V5ListAttribute.js → ListAttribute.js} +8 -11
  41. package/dist/attributes/ListAttribute.js.map +1 -0
  42. package/dist/attributes/{V5NumberAttribute.js → NumberAttribute.js} +8 -19
  43. package/dist/attributes/NumberAttribute.js.map +1 -0
  44. package/dist/attributes/PathAttribute.js +15 -0
  45. package/dist/attributes/PathAttribute.js.map +1 -0
  46. package/dist/attributes/SetAttribute.js +19 -0
  47. package/dist/attributes/SetAttribute.js.map +1 -0
  48. package/dist/attributes/{V5TextArrayAttribute.js → TextArrayAttribute.js} +10 -14
  49. package/dist/attributes/TextArrayAttribute.js.map +1 -0
  50. package/dist/attributes/TextAttribute.js +39 -0
  51. package/dist/attributes/TextAttribute.js.map +1 -0
  52. package/dist/entities/{V5AbstractEntity.js → AbstractEntity.js} +4 -4
  53. package/dist/entities/AbstractEntity.js.map +1 -0
  54. package/dist/entities/{V5CommonEntity.js → CommonEntity.js} +5 -5
  55. package/dist/entities/CommonEntity.js.map +1 -0
  56. package/dist/index.js +19 -21
  57. package/dist/index.js.map +1 -1
  58. package/dist/nodes/{V5ContentNode.js → ContentNode.js} +7 -7
  59. package/dist/nodes/ContentNode.js.map +1 -0
  60. package/dist/nodes/{V5Node.js → Node.js} +7 -7
  61. package/dist/nodes/Node.js.map +1 -0
  62. package/dist/nodes/{V5NodeAlternatives.js → NodeAlternatives.js} +8 -8
  63. package/dist/nodes/NodeAlternatives.js.map +1 -0
  64. package/dist/parsed/ParsedArrayNode.js.map +1 -1
  65. package/dist/parsed/ParsedAttribute.js.map +1 -1
  66. package/dist/parsed/ParsedNode.js.map +1 -1
  67. package/dist/parsed/ParsedNodeTypes.js.map +1 -1
  68. package/dist/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +3 -3
  70. package/dist/@types/attributes/AttributeDefaults.d.ts +0 -7
  71. package/dist/@types/attributes/V5BooleanAttribute.d.ts +0 -19
  72. package/dist/@types/attributes/V5ConstantBooleanAttribute.d.ts +0 -15
  73. package/dist/@types/attributes/V5ConstantTextAttribute.d.ts +0 -15
  74. package/dist/@types/attributes/V5ContentTextAttribute.d.ts +0 -18
  75. package/dist/@types/attributes/V5FunctionAttribute.d.ts +0 -9
  76. package/dist/@types/attributes/V5ListAttribute.d.ts +0 -21
  77. package/dist/@types/attributes/V5NumberAttribute.d.ts +0 -27
  78. package/dist/@types/attributes/V5PathAttribue.d.ts +0 -11
  79. package/dist/@types/attributes/V5SetAttribute.d.ts +0 -18
  80. package/dist/@types/attributes/V5TextArrayAttribute.d.ts +0 -15
  81. package/dist/@types/attributes/V5TextAttribute.d.ts +0 -20
  82. package/dist/@types/attributes/index.d.ts +0 -15
  83. package/dist/@types/entities/V5AbstractEntity.d.ts +0 -15
  84. package/dist/@types/entities/V5CommonEntity.d.ts +0 -28
  85. package/dist/@types/entities/index.d.ts +0 -2
  86. package/dist/@types/events/V5EditorContext.d.ts +0 -43
  87. package/dist/@types/parsed/index.d.ts +0 -6
  88. package/dist/attributes/AttributeDefaults.js +0 -15
  89. package/dist/attributes/AttributeDefaults.js.map +0 -1
  90. package/dist/attributes/V5Attribute.js.map +0 -1
  91. package/dist/attributes/V5BooleanAttribute.js +0 -45
  92. package/dist/attributes/V5BooleanAttribute.js.map +0 -1
  93. package/dist/attributes/V5ConstantBooleanAttribute.js +0 -22
  94. package/dist/attributes/V5ConstantBooleanAttribute.js.map +0 -1
  95. package/dist/attributes/V5ConstantTextAttribute.js +0 -22
  96. package/dist/attributes/V5ConstantTextAttribute.js.map +0 -1
  97. package/dist/attributes/V5ContentTextAttribute.js.map +0 -1
  98. package/dist/attributes/V5ExpressionAttribute.js +0 -30
  99. package/dist/attributes/V5ExpressionAttribute.js.map +0 -1
  100. package/dist/attributes/V5FunctionAttribute.js +0 -14
  101. package/dist/attributes/V5FunctionAttribute.js.map +0 -1
  102. package/dist/attributes/V5ListAttribute.js.map +0 -1
  103. package/dist/attributes/V5NumberAttribute.js.map +0 -1
  104. package/dist/attributes/V5PathAttribue.js +0 -15
  105. package/dist/attributes/V5PathAttribue.js.map +0 -1
  106. package/dist/attributes/V5SetAttribute.js +0 -27
  107. package/dist/attributes/V5SetAttribute.js.map +0 -1
  108. package/dist/attributes/V5TextArrayAttribute.js.map +0 -1
  109. package/dist/attributes/V5TextAttribute.js +0 -52
  110. package/dist/attributes/V5TextAttribute.js.map +0 -1
  111. package/dist/attributes/index.js +0 -32
  112. package/dist/attributes/index.js.map +0 -1
  113. package/dist/entities/V5AbstractEntity.js.map +0 -1
  114. package/dist/entities/V5CommonEntity.js.map +0 -1
  115. package/dist/entities/index.js +0 -19
  116. package/dist/entities/index.js.map +0 -1
  117. package/dist/events/V5EditorContext.js +0 -3
  118. package/dist/events/V5EditorContext.js.map +0 -1
  119. package/dist/nodes/V5ContentNode.js.map +0 -1
  120. package/dist/nodes/V5Node.js.map +0 -1
  121. package/dist/nodes/V5NodeAlternatives.js.map +0 -1
  122. package/dist/parsed/index.js +0 -23
  123. package/dist/parsed/index.js.map +0 -1
@@ -2,13 +2,13 @@ import type { ParsedDiagnostic } from './parsed/ParsedDiagnostic';
2
2
  import type { XMLElement } from '@journeyapps/domparser/types';
3
3
  import type { AbstractExpression, ValidationContext, FormatStringExpression, EvaluatedExpression } from '@ja-platform/parser-expressions';
4
4
  import type { ParsedNode } from './parsed/ParsedNode';
5
- import type { V5Attribute } from './attributes/V5Attribute';
5
+ import type { Attribute } from './attributes/Attribute';
6
6
  export interface XMLParseEventHelper<Node extends ParsedNode = ParsedNode, Scope extends ValidationContext = ValidationContext, Expression extends AbstractExpression = FormatStringExpression | EvaluatedExpression> {
7
7
  /**
8
8
  * Resolve context-specific syntax before using the attribute's parser.
9
9
  */
10
10
  parseAttributeExpression?({ attribute, source }: {
11
- attribute: V5Attribute;
11
+ attribute: Attribute;
12
12
  source: string;
13
13
  }): AbstractExpression | undefined;
14
14
  /**
@@ -2,36 +2,17 @@ import { AttributeParseEvent, AttributeParseInput } from '../AttributeParseEvent
2
2
  import { XMLParseEvent } from '../XMLParseEvent';
3
3
  import { AbstractExpression, ExpressionParser, ConstantExpression, EvaluatedExpression } from '@ja-platform/parser-expressions';
4
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';
5
+ import { CommonEntity, CommonEntityListener, CommonEntityOptions } from '../entities/CommonEntity';
6
+ import { Node } from '../nodes/Node';
7
+ import { ParsedAttribute, ParsedAttributeOptions } from '../parsed/ParsedAttribute';
8
+ import { ParsedNode } from '../parsed/ParsedNode';
9
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 {
10
+ export interface AttributeListener extends CommonEntityListener {
23
11
  }
24
12
  export interface NodeChecker {
25
13
  hasAttributeType(type: string): boolean;
26
14
  }
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 {
15
+ export interface AttributeOptions<DEFAULT = any, VALUE = unknown> extends CommonEntityOptions {
35
16
  /**
36
17
  * Accepted expression syntax. Defaults to prefixed code followed by constant text.
37
18
  */
@@ -43,16 +24,8 @@ export interface V5AttributeOptions<DEFAULT = any, VALUE = unknown> extends V5Co
43
24
  required?: boolean;
44
25
  configurable?: boolean;
45
26
  advanced?: boolean;
46
- /**
47
- * Used to categorise sets of attributes for easier filtering
48
- */
49
- category?: AttributeCategory;
50
27
  fragmentNamespace?: string;
51
28
  defaultValue?: DEFAULT;
52
- /**
53
- * Select a variant contribution explicitly; omitted defaults are literal values.
54
- */
55
- defaultValueKind?: DefaultValueKind;
56
29
  /**
57
30
  * The interim value to use when the component attribute is still being evaluated (ie. setting up watches),
58
31
  * will fallback to `defaultValue` if not set.
@@ -73,9 +46,9 @@ export interface V5AttributeOptions<DEFAULT = any, VALUE = unknown> extends V5Co
73
46
  */
74
47
  mapGeneratedFunctions?: boolean;
75
48
  }
76
- export interface V5AttributeGenerics<O extends V5AttributeOptions = V5AttributeOptions> {
49
+ export interface AttributeGenerics<O extends AttributeOptions = AttributeOptions> {
77
50
  Options: O;
78
- Listener: V5AttributeListener;
51
+ Listener: AttributeListener;
79
52
  Value: any;
80
53
  NormalizedValue: unknown;
81
54
  }
@@ -83,9 +56,9 @@ export interface StringifyDirective {
83
56
  isAttribute: boolean;
84
57
  value: string | null;
85
58
  }
86
- export declare class V5Attribute<G extends V5AttributeGenerics = V5AttributeGenerics> extends V5CommonEntity<G> {
59
+ export declare class Attribute<G extends AttributeGenerics = AttributeGenerics> extends CommonEntity<G> {
87
60
  static TYPE: string;
88
- parent: V5Node<any>;
61
+ parent: Node<any>;
89
62
  type: string;
90
63
  constructor(type: string, options: G['Options']);
91
64
  get key(): string;
@@ -94,7 +67,6 @@ export declare class V5Attribute<G extends V5AttributeGenerics = V5AttributeGene
94
67
  normalizeValue(value: unknown): G['NormalizedValue'];
95
68
  isEnclosedWith(checkerCB: (helper: NodeChecker) => boolean): boolean;
96
69
  serialize(): any;
97
- getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
98
70
  protected getParsedValue(event: AttributeParseEvent, _parseContext?: Record<string, any>): G['Value'];
99
71
  stringify(value: G['Value'], parent: ParsedNode): StringifyDirective;
100
72
  createParsedAttribute(options: ParsedAttributeOptions<G['Value'], this>): ParsedAttribute<G['Value'], this>;
@@ -0,0 +1,17 @@
1
+ import { Attribute, AttributeOptions, AttributeGenerics } from './Attribute';
2
+ import { EvaluatedExpression, ConstantExpression, ShorthandExpression } from '@ja-platform/parser-expressions';
3
+ export type CombinedBooleanExpression = EvaluatedExpression | ConstantExpression<boolean> | ShorthandExpression;
4
+ export interface BooleanAttributeGenerics extends AttributeGenerics {
5
+ Options: AttributeOptions<boolean, boolean>;
6
+ Value: CombinedBooleanExpression | null;
7
+ NormalizedValue: boolean;
8
+ }
9
+ /**
10
+ * For dealing with boolean attribute types such as `show-if` and `hide-if`
11
+ */
12
+ export declare class BooleanAttribute extends Attribute<BooleanAttributeGenerics> {
13
+ static TYPE: string;
14
+ static isInstanceOf(attr: Attribute): attr is BooleanAttribute;
15
+ constructor(options: BooleanAttributeGenerics['Options']);
16
+ serialize(): any;
17
+ }
@@ -0,0 +1,15 @@
1
+ import { ConstantExpression } from '@ja-platform/parser-expressions';
2
+ import { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';
3
+ export interface ConstantBooleanAttributeGenerics extends AttributeGenerics {
4
+ Options: AttributeOptions<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 ConstantBooleanAttribute extends Attribute<ConstantBooleanAttributeGenerics> {
12
+ static TYPE: string;
13
+ static isInstanceOf(attr: Attribute): attr is ConstantBooleanAttribute;
14
+ constructor(options: ConstantBooleanAttributeGenerics['Options']);
15
+ }
@@ -0,0 +1,15 @@
1
+ import { ConstantExpression } from '@ja-platform/parser-expressions';
2
+ import { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';
3
+ export interface ConstantTextAttributeGenerics extends AttributeGenerics {
4
+ Options: AttributeOptions<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 ConstantTextAttribute extends Attribute<ConstantTextAttributeGenerics> {
12
+ static TYPE: string;
13
+ static isInstanceOf(attr: Attribute): attr is ConstantTextAttribute;
14
+ constructor(options: ConstantTextAttributeGenerics['Options']);
15
+ }
@@ -0,0 +1,18 @@
1
+ import { AttributeParseEvent, AttributeParseInput } from '../AttributeParseEvent';
2
+ import { CombinedTextExpression, TextAttribute, TextAttributeGenerics, TextAttributeOptions } from './TextAttribute';
3
+ import { StringifyDirective } from './Attribute';
4
+ import { ParsedNode } from '../parsed/ParsedNode';
5
+ import { XMLParseEvent } from '../XMLParseEvent';
6
+ export interface ContentTextAttributeOptions extends Omit<TextAttributeOptions, 'configurable'> {
7
+ }
8
+ export declare class ContentTextAttribute extends TextAttribute<TextAttributeGenerics & {
9
+ Options: ContentTextAttributeOptions;
10
+ }> {
11
+ static TYPE: string;
12
+ constructor(options: ContentTextAttributeOptions);
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: TextAttributeGenerics['Value'], parent: ParsedNode): StringifyDirective;
17
+ serialize(): any;
18
+ }
@@ -1,8 +1,7 @@
1
1
  import { EvaluatedExpression, ShorthandExpression } from '@ja-platform/parser-expressions';
2
- import { V5EditorHelpers } from '../events/V5EditorContext';
3
- import { V5Attribute, V5AttributeGenerics } from './V5Attribute';
2
+ import { Attribute, AttributeGenerics } from './Attribute';
4
3
  export type CombinedExpression = EvaluatedExpression | ShorthandExpression;
5
- export interface V5ExpressionAttributeGenerics extends V5AttributeGenerics {
4
+ export interface ExpressionAttributeGenerics extends AttributeGenerics {
6
5
  Value: CombinedExpression | null;
7
6
  }
8
7
  /**
@@ -10,8 +9,7 @@ export interface V5ExpressionAttributeGenerics extends V5AttributeGenerics {
10
9
  * Examples include `user.name`, `$object.quantity` and `$:calculateTotal()`.
11
10
  * Bare identifiers always represent references; there is no literal text fallback.
12
11
  */
13
- export declare class V5ExpressionAttribute extends V5Attribute<V5ExpressionAttributeGenerics> {
12
+ export declare class ExpressionAttribute extends Attribute<ExpressionAttributeGenerics> {
14
13
  static TYPE: string;
15
- constructor(options: V5ExpressionAttributeGenerics['Options']);
16
- getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
14
+ constructor(options: ExpressionAttributeGenerics['Options']);
17
15
  }
@@ -0,0 +1,9 @@
1
+ import { FunctionExpression } from '@ja-platform/parser-expressions';
2
+ import { Attribute, AttributeGenerics } from './Attribute';
3
+ export interface FunctionAttributeGenerics extends AttributeGenerics {
4
+ Value: FunctionExpression | null;
5
+ }
6
+ export declare class FunctionAttribute extends Attribute<FunctionAttributeGenerics> {
7
+ static TYPE: string;
8
+ constructor(options: Omit<AttributeGenerics['Options'], 'configurable'>);
9
+ }
@@ -0,0 +1,19 @@
1
+ import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
2
+ import { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';
3
+ export type CombinedListExpression = EvaluatedExpression | ConstantExpression;
4
+ export interface ListAttributeOptions extends AttributeOptions<string[]> {
5
+ options: string[];
6
+ delimiter?: string;
7
+ }
8
+ export interface ListAttributeGenerics extends AttributeGenerics {
9
+ Value: CombinedListExpression | null;
10
+ Options: ListAttributeOptions;
11
+ }
12
+ export declare class ListAttribute extends Attribute<ListAttributeGenerics> {
13
+ static TYPE: string;
14
+ delimiter: string;
15
+ constructor(options: ListAttributeGenerics['Options']);
16
+ static isInstanceOf(attr: Attribute): attr is ListAttribute;
17
+ static toList(value: any, delimiter?: string): any[];
18
+ serialize(): any;
19
+ }
@@ -0,0 +1,25 @@
1
+ import { AttributeParseEvent } from '../AttributeParseEvent';
2
+ import { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
3
+ import { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';
4
+ import type { Node } from '../nodes/Node';
5
+ export type CombinedNumberExpression = EvaluatedExpression | ConstantExpression<number>;
6
+ export interface NumberAttributeRange {
7
+ min?: number;
8
+ max?: number;
9
+ }
10
+ export interface NumberAttributeOptions extends AttributeOptions<number, number> {
11
+ range?: NumberAttributeRange;
12
+ }
13
+ export interface NumberAttributeGenerics extends AttributeGenerics {
14
+ Options: NumberAttributeOptions;
15
+ Value: CombinedNumberExpression | null;
16
+ NormalizedValue: number;
17
+ }
18
+ export declare class NumberAttribute extends Attribute<NumberAttributeGenerics> {
19
+ static TYPE: string;
20
+ static isInstanceOf(attr: Attribute): attr is NumberAttribute;
21
+ constructor(options: NumberAttributeGenerics['Options']);
22
+ protected getParsedValue(event: AttributeParseEvent): NumberAttributeGenerics['Value'];
23
+ setParent(parent: Node<any>): void;
24
+ serialize(): any;
25
+ }
@@ -0,0 +1,11 @@
1
+ import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
2
+ import { Attribute, AttributeOptions, AttributeGenerics } from './Attribute';
3
+ export type CombinedPathExpression = EvaluatedExpression | ConstantExpression;
4
+ export interface PathAttributeGenerics extends AttributeGenerics {
5
+ Value: CombinedPathExpression | null;
6
+ }
7
+ export declare class PathAttribute extends Attribute<PathAttributeGenerics> {
8
+ static TYPE: string;
9
+ constructor(options: Omit<AttributeOptions, 'configurable'>);
10
+ serialize(): any;
11
+ }
@@ -0,0 +1,16 @@
1
+ import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
2
+ import { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';
3
+ export type CombinedSetExpression = EvaluatedExpression | ConstantExpression;
4
+ export interface SetAttributeOptions extends AttributeOptions<string> {
5
+ options: string[];
6
+ }
7
+ export interface SetAttributeGenerics extends AttributeGenerics {
8
+ Value: CombinedSetExpression | null;
9
+ Options: SetAttributeOptions;
10
+ }
11
+ export declare class SetAttribute extends Attribute<SetAttributeGenerics> {
12
+ static TYPE: string;
13
+ constructor(options: SetAttributeOptions);
14
+ static isInstanceOf(attr: Attribute): attr is SetAttribute;
15
+ serialize(): any;
16
+ }
@@ -0,0 +1,15 @@
1
+ import { Attribute } from './Attribute';
2
+ import { TextAttribute, TextAttributeGenerics, TextAttributeOptions } from './TextAttribute';
3
+ export interface TextArrayAttributeOptions extends TextAttributeOptions<string[]> {
4
+ delimiter?: string;
5
+ }
6
+ export interface TextArrayAttributeGenerics extends TextAttributeGenerics<string[]> {
7
+ Options: TextArrayAttributeOptions;
8
+ }
9
+ export declare class TextArrayAttribute extends TextAttribute<TextArrayAttributeGenerics> {
10
+ static TYPE: string;
11
+ delimiter: string;
12
+ static isInstanceOf(attr: Attribute): attr is TextArrayAttribute;
13
+ constructor(options: TextArrayAttributeGenerics['Options']);
14
+ serialize(): any;
15
+ }
@@ -0,0 +1,18 @@
1
+ import { AttributeParseEvent } from '../AttributeParseEvent';
2
+ import { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';
3
+ import { FormatStringExpression, EvaluatedExpression } from '@ja-platform/parser-expressions';
4
+ export type CombinedTextExpression = FormatStringExpression | EvaluatedExpression;
5
+ export type TextAttributeOptions<Value = string> = AttributeOptions<Value, Value>;
6
+ export interface TextAttributeGenerics<Value = string> extends AttributeGenerics {
7
+ Value: CombinedTextExpression | null;
8
+ Options: TextAttributeOptions<Value>;
9
+ NormalizedValue: Value;
10
+ }
11
+ export declare class TextAttribute<T extends TextAttributeGenerics<unknown> = TextAttributeGenerics> extends Attribute<T> {
12
+ static TYPE: string;
13
+ constructor(options: T['Options']);
14
+ static isInstanceOf(attr: Attribute): attr is TextAttribute<TextAttributeGenerics<unknown>>;
15
+ protected getParsedValue(event: AttributeParseEvent, parseContext?: Record<string, any>): CombinedTextExpression | null;
16
+ protected validateInput(event: AttributeParseEvent, expression: CombinedTextExpression, parseContext: Record<string, any>): void;
17
+ serialize(): any;
18
+ }
@@ -0,0 +1,15 @@
1
+ export interface AbstractEntityOptions {
2
+ key?: string;
3
+ name: string;
4
+ description?: string;
5
+ }
6
+ export interface AbstractEntityGenerics {
7
+ Options: AbstractEntityOptions;
8
+ }
9
+ export declare abstract class AbstractEntity<G extends AbstractEntityGenerics = AbstractEntityGenerics> {
10
+ options: G['Options'];
11
+ constructor(options: G['Options']);
12
+ serialize(): {
13
+ name: string;
14
+ };
15
+ }
@@ -0,0 +1,28 @@
1
+ import { Node } from '../nodes/Node';
2
+ import { AbstractEntity, AbstractEntityGenerics, AbstractEntityOptions } from './AbstractEntity';
3
+ export interface CommonEntityOptions extends AbstractEntityOptions {
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 CommonEntityListener {
11
+ }
12
+ export interface CommonEntityGenerics extends AbstractEntityGenerics {
13
+ Options: CommonEntityOptions;
14
+ Listener: CommonEntityListener;
15
+ }
16
+ export declare abstract class CommonEntity<G extends CommonEntityGenerics = CommonEntityGenerics> extends AbstractEntity<G> {
17
+ listeners: G['Listener'][];
18
+ parent: Node<any>;
19
+ constructor(options: G['Options']);
20
+ serialize(): {
21
+ name: string;
22
+ queryScoped?: boolean;
23
+ };
24
+ getRootNode(): Node<any>;
25
+ registerListener(listener: G['Listener']): () => void;
26
+ fireListeners(cb: (listener: G['Listener']) => any): void;
27
+ setParent(parent: Node<any>): void;
28
+ }
@@ -1,13 +1,24 @@
1
1
  export * from './AttributeParseEvent';
2
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';
3
+ export * from './attributes/ConditionType';
4
+ export * from './attributes/Attribute';
5
+ export * from './attributes/BooleanAttribute';
6
+ export * from './attributes/ConstantBooleanAttribute';
7
+ export * from './attributes/ConstantTextAttribute';
8
+ export * from './attributes/ContentTextAttribute';
9
+ export * from './attributes/ExpressionAttribute';
10
+ export * from './attributes/FunctionAttribute';
11
+ export * from './attributes/ListAttribute';
12
+ export * from './attributes/NumberAttribute';
13
+ export * from './attributes/PathAttribute';
14
+ export * from './attributes/SetAttribute';
15
+ export * from './attributes/TextArrayAttribute';
16
+ export * from './attributes/TextAttribute';
17
+ export * from './entities/AbstractEntity';
18
+ export * from './entities/CommonEntity';
19
+ export * from './nodes/Node';
20
+ export * from './nodes/ContentNode';
21
+ export * from './nodes/NodeAlternatives';
11
22
  export * from './parsed/ParsedArrayNode';
12
23
  export * from './parsed/ParsedAttribute';
13
24
  export * from './parsed/ParsedContentNode';
@@ -20,17 +31,4 @@ export * from './values/ParserDefaultValueProvider';
20
31
  export * from './values/ParsedNodeValues';
21
32
  export * from './values/ParsedProviderValue';
22
33
  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
34
  export * from './utils/types/valueOf';
36
- export * from './attributes/AttributeDefaults';
@@ -1,12 +1,12 @@
1
1
  import { ConstantExpression, ExpressionParser, AbstractExpression } from '@ja-platform/parser-expressions';
2
2
  import { Type } from '@ja-platform/parser-type-system';
3
- import { V5Attribute } from '../attributes/V5Attribute';
3
+ import { Attribute } from '../attributes/Attribute';
4
4
  import { AttributeParseInput } from '../AttributeParseEvent';
5
5
  import { XMLParseEvent } from '../XMLParseEvent';
6
6
  import { ParsedNode } from '../parsed/ParsedNode';
7
7
  import { ParsedContentNode, ParsedContentNodeShape } from '../parsed/ParsedContentNode';
8
- import { ParseTreeOptions } from './V5Node';
9
- import { V5Node, V5NodeGenerics, V5NodeOptions } from './V5Node';
8
+ import { ParseTreeOptions } from './Node';
9
+ import { Node, NodeGenerics, NodeOptions } from './Node';
10
10
  export type NodeDefaultOptions<Value> = {
11
11
  isMultiple?: false;
12
12
  defaultValue?: Value;
@@ -14,17 +14,17 @@ export type NodeDefaultOptions<Value> = {
14
14
  isMultiple: true;
15
15
  defaultValue?: Value[];
16
16
  };
17
- export type V5ContentNodeOptions<Value, Expression extends AbstractExpression = ConstantExpression<Value>> = Omit<V5NodeOptions, 'isMultiple' | 'defaultValue'> & NodeDefaultOptions<Value> & {
17
+ export type ContentNodeOptions<Value, Expression extends AbstractExpression = ConstantExpression<Value>> = Omit<NodeOptions, 'isMultiple' | 'defaultValue'> & NodeDefaultOptions<Value> & {
18
18
  valueType: Type<Value>;
19
19
  syntax?: ExpressionParser<Expression>;
20
20
  };
21
- interface V5ContentNodeGenerics<Value, Expression extends AbstractExpression> extends V5NodeGenerics<ParsedContentNodeShape<Expression>, ParsedContentNode<Expression, Value>, Value | undefined> {
22
- Options: V5ContentNodeOptions<Value, Expression>;
21
+ interface ContentNodeGenerics<Value, Expression extends AbstractExpression> extends NodeGenerics<ParsedContentNodeShape<Expression>, ParsedContentNode<Expression, Value>, Value | undefined> {
22
+ Options: ContentNodeOptions<Value, Expression>;
23
23
  }
24
24
  /**
25
25
  * Adapt element content to the shared value-provider pipeline.
26
26
  */
27
- export declare class ContentValueAttribute extends V5Attribute {
27
+ export declare class ContentValueAttribute extends Attribute {
28
28
  protected getInput(event: XMLParseEvent<ParsedNode>): AttributeParseInput;
29
29
  stringify(value: AbstractExpression): {
30
30
  isAttribute: boolean;
@@ -34,8 +34,8 @@ export declare class ContentValueAttribute extends V5Attribute {
34
34
  /**
35
35
  * Parse element content using its declared value type and optional expression syntax.
36
36
  */
37
- export declare class V5ContentNode<Value, Expression extends AbstractExpression = ConstantExpression<Value>> extends V5Node<V5ContentNodeGenerics<Value, Expression>> {
38
- constructor(options: V5ContentNodeOptions<Value, Expression>);
37
+ export declare class ContentNode<Value, Expression extends AbstractExpression = ConstantExpression<Value>> extends Node<ContentNodeGenerics<Value, Expression>> {
38
+ constructor(options: ContentNodeOptions<Value, Expression>);
39
39
  protected createParsedNode(options: ParseTreeOptions): ParsedContentNode<Expression, Value>;
40
40
  protected parseAttributes({ parsed, event }: {
41
41
  parsed: ParsedContentNode<Expression, Value>;
@@ -1,13 +1,13 @@
1
1
  import { XMLParseEvent } from '../XMLParseEvent';
2
2
  import { XMLElement } from '@journeyapps/domparser/lib';
3
- import { V5Attribute } from '../attributes/V5Attribute';
4
- import { V5ContentTextAttribute } from '../attributes/V5ContentTextAttribute';
5
- import { V5CommonEntity, V5CommonEntityGenerics, V5CommonEntityOptions } from '../entities/V5CommonEntity';
3
+ import { Attribute } from '../attributes/Attribute';
4
+ import { ContentTextAttribute } from '../attributes/ContentTextAttribute';
5
+ import { CommonEntity, CommonEntityGenerics, CommonEntityOptions } from '../entities/CommonEntity';
6
6
  import { ParsedNode } from '../parsed/ParsedNode';
7
7
  import { ParsedNodeShape } from '../parsed/ParsedNodeTypes';
8
8
  import { AbstractValueProvider } from '../values/AbstractValueProvider';
9
9
  import type { NodeValidationContext } from '../parsed/ParsedNode';
10
- export interface V5NodeListener<Shape extends ParsedNodeShape = ParsedNodeShape> {
10
+ export interface NodeListener<Shape extends ParsedNodeShape = ParsedNodeShape> {
11
11
  /**
12
12
  * before the node is parsed
13
13
  */
@@ -30,7 +30,7 @@ export interface V5NodeListener<Shape extends ParsedNodeShape = ParsedNodeShape>
30
30
  /**
31
31
  * Represents a template for a node
32
32
  */
33
- export interface V5Template {
33
+ export interface NodeTemplate {
34
34
  /**
35
35
  * Name of the node
36
36
  */
@@ -46,18 +46,18 @@ export interface V5Template {
46
46
  */
47
47
  attrs?: string[];
48
48
  }
49
- export interface V5NodeOptions extends V5CommonEntityOptions {
49
+ export interface NodeOptions extends CommonEntityOptions {
50
50
  isMultiple?: boolean;
51
51
  defaultValue?: unknown;
52
52
  isRequired?: boolean;
53
- templates?: V5Template[];
53
+ templates?: NodeTemplate[];
54
54
  }
55
- export interface V5NodeGenerics<Shape extends ParsedNodeShape = ParsedNodeShape, Parsed extends ParsedNode<Shape, any> = ParsedNode<Shape>, Value = unknown> extends V5CommonEntityGenerics {
55
+ export interface NodeGenerics<Shape extends ParsedNodeShape = ParsedNodeShape, Parsed extends ParsedNode<Shape, any> = ParsedNode<Shape>, Value = unknown> extends CommonEntityGenerics {
56
56
  Shape: Shape;
57
57
  Parsed: Parsed;
58
58
  Value: Value;
59
- Options: V5NodeOptions;
60
- Listener: V5NodeListener<Shape>;
59
+ Options: NodeOptions;
60
+ Listener: NodeListener<Shape>;
61
61
  }
62
62
  export interface ParseTreeOptions {
63
63
  event: XMLParseEvent<ParsedNode>;
@@ -65,18 +65,18 @@ export interface ParseTreeOptions {
65
65
  key?: string;
66
66
  valueProviders?: readonly AbstractValueProvider[];
67
67
  }
68
- export declare class V5Node<G extends V5NodeGenerics<any> = V5NodeGenerics<any>> extends V5CommonEntity<G> {
69
- attributes: V5Attribute[];
70
- nodes: V5Node<any>[];
68
+ export declare class Node<G extends NodeGenerics<any> = NodeGenerics<any>> extends CommonEntity<G> {
69
+ attributes: Attribute[];
70
+ nodes: Node<any>[];
71
71
  constructor(options: G['Options']);
72
72
  get name(): string;
73
73
  get defaultValue(): G['Value'] | G['Value'][] | undefined;
74
74
  serialize(): any;
75
- getNodes(name: string): V5Node<any>[];
76
- getNode(name: string): V5Node<any>;
77
- getAttribute(name: string): V5Attribute;
75
+ getNodes(name: string): Node<any>[];
76
+ getNode(name: string): Node<any>;
77
+ getAttribute(name: string): Attribute;
78
78
  removeAttribute(name: string): this;
79
- getContentAttribute(): V5ContentTextAttribute | null;
79
+ getContentAttribute(): ContentTextAttribute | null;
80
80
  getTemplate(cursor?: string): {
81
81
  template?: string;
82
82
  templates?: {
@@ -84,11 +84,11 @@ export declare class V5Node<G extends V5NodeGenerics<any> = V5NodeGenerics<any>>
84
84
  template: string;
85
85
  }[];
86
86
  };
87
- addAttributes(attrs: V5Attribute[]): void;
88
- addAttribute(attribute: V5Attribute): V5Node<G>;
89
- replaceAttribute(attribute: V5Attribute): V5Node<G>;
90
- addNode(node: V5Node<any>): V5Node<G>;
91
- registerListener(listener: V5NodeListener<G['Shape']>): () => void;
87
+ addAttributes(attrs: Attribute[]): void;
88
+ addAttribute(attribute: Attribute): Node<G>;
89
+ replaceAttribute(attribute: Attribute): Node<G>;
90
+ addNode(node: Node<any>): Node<G>;
91
+ registerListener(listener: NodeListener<G['Shape']>): () => void;
92
92
  parse(options: ParseTreeOptions): G['Parsed'] | null;
93
93
  parseTree(options: ParseTreeOptions): G['Parsed'];
94
94
  validateParsedNode({ parsed, parentEvent }: {
@@ -122,7 +122,7 @@ export declare class V5Node<G extends V5NodeGenerics<any> = V5NodeGenerics<any>>
122
122
  }): ParsedNode | null;
123
123
  protected validateChildElementCount({ context, definition, matchingElements }: {
124
124
  context: NodeValidationContext;
125
- definition: V5Node<any>;
125
+ definition: Node<any>;
126
126
  matchingElements: XMLElement[];
127
127
  }): void;
128
128
  }
@@ -1,15 +1,16 @@
1
- import { ParsedNode, ParsedNodeShape } from '../parsed';
2
- import { ParseTreeOptions, V5Node, V5NodeGenerics, V5NodeOptions } from './V5Node';
1
+ import { ParsedNode } from '../parsed/ParsedNode';
2
+ import { ParsedNodeShape } from '../parsed/ParsedNodeTypes';
3
+ import { ParseTreeOptions, Node, NodeGenerics, NodeOptions } from './Node';
3
4
  import { XMLElement } from '@journeyapps/domparser/lib';
4
- export interface V5NodeAlternativesOptions extends Omit<V5NodeOptions, 'name'> {
5
+ export interface NodeAlternativesOptions extends Omit<NodeOptions, 'name'> {
5
6
  key: string;
6
- alternatives: V5Node<any>[];
7
+ alternatives: Node<any>[];
7
8
  exclusive?: boolean;
8
9
  }
9
- export declare class V5NodeAlternatives<Shape extends ParsedNodeShape = ParsedNodeShape> extends V5Node<V5NodeGenerics<Shape>> {
10
+ export declare class NodeAlternatives<Shape extends ParsedNodeShape = ParsedNodeShape> extends Node<NodeGenerics<Shape>> {
10
11
  private readonly exclusiveValue;
11
12
  private readonly alternatives;
12
- constructor(options: V5NodeAlternativesOptions);
13
+ constructor(options: NodeAlternativesOptions);
13
14
  get exclusive(): boolean;
14
15
  parseChildrenInto({ parent, elements, options }: {
15
16
  parent: ParsedNode;
@@ -1,17 +1,17 @@
1
1
  import { ParsedNodeValuesLike } from '../values/ParsedNodeValues';
2
2
  import { ParsedExpressionValue } from './ParsedNodeTypes';
3
3
  import { TreeNode } from '@journeyapps/common-tree';
4
- import { V5Node } from '../nodes/V5Node';
4
+ import { Node } from '../nodes/Node';
5
5
  import { AbstractValueProvider } from '../values/AbstractValueProvider';
6
6
  import { ParsedDiagnostic } from './ParsedDiagnostic';
7
7
  import { ParsedNode } from './ParsedNode';
8
8
  export interface ParsedArrayNodeOptions {
9
- definition: V5Node<any>;
9
+ definition: Node<any>;
10
10
  key: string;
11
11
  }
12
12
  export type ParsedArrayNodeChild = ParsedNode<any, any> | ParsedArrayNode<any>;
13
13
  export declare class ParsedArrayNode<Child extends ParsedArrayNodeChild = ParsedNode<any, any>> extends TreeNode {
14
- readonly definition: V5Node<any>;
14
+ readonly definition: Node<any>;
15
15
  private readonly diagnostics;
16
16
  constructor(options: ParsedArrayNodeOptions);
17
17
  nodes(): Child[];