@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
@@ -1,16 +1,16 @@
1
1
  import { TreeEntity } from '@journeyapps/common-tree';
2
2
  import { XMLParseEvent } from '../XMLParseEvent';
3
3
  import { XMLPositional } from '@journeyapps/common-xml';
4
- import { V5Attribute } from '../attributes/V5Attribute';
4
+ import { Attribute } from '../attributes/Attribute';
5
5
  import { ParsedDiagnostic } from './ParsedDiagnostic';
6
6
  import { ParsedNode } from './ParsedNode';
7
- export interface ParsedAttributeOptions<Expression = any, Definition extends V5Attribute = V5Attribute> {
7
+ export interface ParsedAttributeOptions<Expression = any, Definition extends Attribute = Attribute> {
8
8
  definition: Definition;
9
9
  event: XMLParseEvent<ParsedNode>;
10
10
  expression: Expression;
11
11
  parseContext?: Record<string, any>;
12
12
  }
13
- export declare class ParsedAttribute<Expression = any, Definition extends V5Attribute = V5Attribute> extends TreeEntity {
13
+ export declare class ParsedAttribute<Expression = any, Definition extends Attribute = Attribute> extends TreeEntity {
14
14
  readonly definition: Definition;
15
15
  private expressionValue;
16
16
  readonly sourceElement: XMLPositional;
@@ -24,5 +24,5 @@ export declare class ParsedAttribute<Expression = any, Definition extends V5Attr
24
24
  pushError({ message, element, type }: ParsedDiagnostic): ParsedDiagnostic;
25
25
  errors(): ParsedDiagnostic[];
26
26
  hasErrors(): boolean;
27
- stringify(): import("../attributes/V5Attribute").StringifyDirective;
27
+ stringify(): import("../attributes/Attribute").StringifyDirective;
28
28
  }
@@ -2,15 +2,15 @@ import { ParsedNodeValuesLike } from '../values/ParsedNodeValues';
2
2
  import { TreeNode, TreeNodeListener } from '@journeyapps/common-tree';
3
3
  import { XMLParseEvent } from '../XMLParseEvent';
4
4
  import { XMLElement } from '@journeyapps/domparser/lib';
5
- import { V5Node } from '../nodes/V5Node';
5
+ import { Node } from '../nodes/Node';
6
6
  import { ParsedAttribute } from './ParsedAttribute';
7
7
  import { ParsedDiagnostic, ParsedValidationDiagnostic } from './ParsedDiagnostic';
8
8
  import type { ValidationContext } from '@ja-platform/parser-expressions';
9
- import { ParsedChild, ParsedChildNamesMarker, ParsedNodeAttribute, ParsedNodeAttributeShape, ParsedNodeAttributeName, ParsedNodeChild, ParsedNodeDefinition, ParsedNodeExpressionKey, ParsedNodeKnownChildKey, ParsedNodeValue, ParsedNodeValueRequest, ParsedNodeValueRequestKey, ParsedNodeRequiredAttributeName, ParsedNodeShape, ParsedNodeUntypedExpressionKey } from './ParsedNodeTypes';
9
+ import { ParsedChild, ParsedChildNamesMarker, ParsedNodeAttribute, ParsedNodeAttributeShape, ParsedNodeAttributeName, ParsedNodeChild, ParsedNodeExpressionKey, ParsedNodeKnownChildKey, ParsedNodeValue, ParsedNodeValueRequest, ParsedNodeValueRequestKey, ParsedNodeRequiredAttributeName, ParsedNodeShape, ParsedNodeUntypedExpressionKey } from './ParsedNodeTypes';
10
10
  import { ParsedValue } from '../values/ParsedValue';
11
11
  import { AbstractValueProvider } from '../values/AbstractValueProvider';
12
12
  export interface ParsedNodeOptions {
13
- definition: V5Node<any>;
13
+ definition: Node<any>;
14
14
  event: XMLParseEvent<ParsedNode>;
15
15
  key?: string;
16
16
  valueProviders?: readonly AbstractValueProvider[];
@@ -42,7 +42,7 @@ export declare class ParsedNode<T extends ParsedNodeShape = ParsedNodeShape, Val
42
42
  private attributesByKey;
43
43
  private childrenByKey;
44
44
  private valueProviders?;
45
- readonly definition: ParsedNodeDefinition<T>;
45
+ readonly definition: Node<any>;
46
46
  readonly sourceElement: XMLElement;
47
47
  readonly parseParentNode?: ParsedNode;
48
48
  private parsedContent;
@@ -1,5 +1,5 @@
1
1
  import type { ConstantExpression, FormatStringExpression, AbstractExpression } from '@ja-platform/parser-expressions';
2
- import type { V5Node } from '../nodes/V5Node';
2
+ import type { Node } from '../nodes/Node';
3
3
  import type { ParsedArrayNode } from './ParsedArrayNode';
4
4
  import type { ParsedAttribute } from './ParsedAttribute';
5
5
  import type { ParsedNode } from './ParsedNode';
@@ -42,8 +42,7 @@ export type ParsedNodeChildName<T> = T extends ParsedChildNamesMarker<infer Name
42
42
  export type ParsedNodeRequiredAttributeName<T> = T extends ParsedRequiredAttributeNamesMarker<infer Names> ? Names : never;
43
43
  export type ParsedNodeConstantAttributeName<T> = T extends ParsedConstantAttributeNamesMarker<infer Names> ? Names : never;
44
44
  export type ParsedNodeShapeValue = ParsedExpression | ParsedNode<any, any> | ParsedArrayNode<any> | ParsedNodeShapeValue[] | null | undefined;
45
- export type ParsedNodeDefinition<T> = V5Node<any>;
46
- export type ParsedNodeAttributeShape<T> = T extends V5Node ? ParsedNodeShape : T;
45
+ export type ParsedNodeAttributeShape<T> = T extends Node ? ParsedNodeShape : T;
47
46
  export type ParsedNodeShapeKey<Shape> = Extract<keyof ParsedNodeAttributeShape<Shape>, string>;
48
47
  export type ParsedNodeChildKey<Shape> = {
49
48
  [Key in ParsedNodeShapeKey<Shape>]: NonNullable<ParsedNodeAttributeShape<Shape>[Key]> extends ParsedChild ? Key : never;
@@ -1 +1 @@
1
- {"version":3,"file":"XMLParseEvent.js","sourceRoot":"","sources":["../src/XMLParseEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { ParsedDiagnostic } from './parsed/ParsedDiagnostic';\nimport type { XMLElement } from '@journeyapps/domparser/types';\nimport type {\n AbstractExpression,\n ValidationContext,\n FormatStringExpression,\n EvaluatedExpression\n} from '@ja-platform/parser-expressions';\nimport type { ParsedNode } from './parsed/ParsedNode';\nimport type { V5Attribute } from './attributes/V5Attribute';\n\nexport interface XMLParseEventHelper<\n Node extends ParsedNode = ParsedNode,\n Scope extends ValidationContext = ValidationContext,\n Expression extends AbstractExpression = FormatStringExpression | EvaluatedExpression\n> {\n /**\n * Resolve context-specific syntax before using the attribute's parser.\n */\n parseAttributeExpression?({\n attribute,\n source\n }: {\n attribute: V5Attribute;\n source: string;\n }): AbstractExpression | undefined;\n /**\n * Prepare a node after its attributes and before its children are parsed.\n */\n prepareNode?(node: Node): void;\n validateFormatAttribute?({\n element,\n attribute,\n scope,\n expression\n }: {\n element: XMLElement;\n attribute: string;\n scope: Scope;\n expression: Expression;\n }): void;\n validateFormatContent?({\n element,\n scope,\n expression\n }: {\n element: XMLElement;\n scope: Scope;\n expression: Expression;\n }): void;\n pushError(diagnostic: ParsedDiagnostic): void;\n}\n\nexport interface XMLParseEvent<ParentNode, Helper extends XMLParseEventHelper = XMLParseEventHelper> {\n element: XMLElement;\n parentNode?: ParentNode;\n parsedNode?: ParentNode;\n scope?: ValidationContext;\n helper: Helper;\n}\n"]}
1
+ {"version":3,"file":"XMLParseEvent.js","sourceRoot":"","sources":["../src/XMLParseEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { ParsedDiagnostic } from './parsed/ParsedDiagnostic';\nimport type { XMLElement } from '@journeyapps/domparser/types';\nimport type {\n AbstractExpression,\n ValidationContext,\n FormatStringExpression,\n EvaluatedExpression\n} from '@ja-platform/parser-expressions';\nimport type { ParsedNode } from './parsed/ParsedNode';\nimport type { Attribute } from './attributes/Attribute';\n\nexport interface XMLParseEventHelper<\n Node extends ParsedNode = ParsedNode,\n Scope extends ValidationContext = ValidationContext,\n Expression extends AbstractExpression = FormatStringExpression | EvaluatedExpression\n> {\n /**\n * Resolve context-specific syntax before using the attribute's parser.\n */\n parseAttributeExpression?({\n attribute,\n source\n }: {\n attribute: Attribute;\n source: string;\n }): AbstractExpression | undefined;\n /**\n * Prepare a node after its attributes and before its children are parsed.\n */\n prepareNode?(node: Node): void;\n validateFormatAttribute?({\n element,\n attribute,\n scope,\n expression\n }: {\n element: XMLElement;\n attribute: string;\n scope: Scope;\n expression: Expression;\n }): void;\n validateFormatContent?({\n element,\n scope,\n expression\n }: {\n element: XMLElement;\n scope: Scope;\n expression: Expression;\n }): void;\n pushError(diagnostic: ParsedDiagnostic): void;\n}\n\nexport interface XMLParseEvent<ParentNode, Helper extends XMLParseEventHelper = XMLParseEventHelper> {\n element: XMLElement;\n parentNode?: ParentNode;\n parsedNode?: ParentNode;\n scope?: ValidationContext;\n helper: Helper;\n}\n"]}
@@ -33,29 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.V5Attribute = exports.AttributeCategory = exports.ComponentSize = exports.DefaultValueKind = void 0;
36
+ exports.Attribute = void 0;
37
37
  const xml = __importStar(require("@journeyapps/common-xml"));
38
38
  const parser_expressions_1 = require("@ja-platform/parser-expressions");
39
39
  const parser_type_system_1 = require("@ja-platform/parser-type-system");
40
- const V5CommonEntity_1 = require("../entities/V5CommonEntity");
41
- const parsed_1 = require("../parsed");
42
- var DefaultValueKind;
43
- (function (DefaultValueKind) {
44
- DefaultValueKind["COLOR"] = "color";
45
- DefaultValueKind["SIZE"] = "size";
46
- })(DefaultValueKind || (exports.DefaultValueKind = DefaultValueKind = {}));
47
- var ComponentSize;
48
- (function (ComponentSize) {
49
- ComponentSize["SMALL"] = "small";
50
- ComponentSize["MEDIUM"] = "medium";
51
- ComponentSize["LARGE"] = "large";
52
- })(ComponentSize || (exports.ComponentSize = ComponentSize = {}));
53
- var AttributeCategory;
54
- (function (AttributeCategory) {
55
- AttributeCategory["THEME"] = "theme";
56
- AttributeCategory["LAYOUT"] = "layout";
57
- })(AttributeCategory || (exports.AttributeCategory = AttributeCategory = {}));
58
- class V5Attribute extends V5CommonEntity_1.V5CommonEntity {
40
+ const CommonEntity_1 = require("../entities/CommonEntity");
41
+ const ParsedAttribute_1 = require("../parsed/ParsedAttribute");
42
+ class Attribute extends CommonEntity_1.CommonEntity {
59
43
  constructor(type, options) {
60
44
  var _a, _b, _c, _d, _e;
61
45
  super(Object.assign(Object.assign({}, options), { syntax: (_a = options.syntax) !== null && _a !== void 0 ? _a : new parser_expressions_1.CombinedParser([
@@ -98,10 +82,7 @@ class V5Attribute extends V5CommonEntity_1.V5CommonEntity {
98
82
  return false;
99
83
  }
100
84
  serialize() {
101
- return Object.assign(Object.assign({}, super.serialize()), { required: this.options.required, defaultValue: this.options.defaultValue, defaultValueKind: this.options.defaultValueKind, docs: this.options.docs, type: 'standard', advanced: !!this.options.advanced });
102
- }
103
- getEditorV5Syntax(helpers) {
104
- return helpers.viewFunctionsSelection();
85
+ return Object.assign(Object.assign({}, super.serialize()), { required: this.options.required, defaultValue: this.options.defaultValue, docs: this.options.docs, type: 'standard', advanced: !!this.options.advanced });
105
86
  }
106
87
  getParsedValue(event, _parseContext) {
107
88
  var _a, _b;
@@ -121,7 +102,7 @@ class V5Attribute extends V5CommonEntity_1.V5CommonEntity {
121
102
  };
122
103
  }
123
104
  createParsedAttribute(options) {
124
- return new parsed_1.ParsedAttribute(options);
105
+ return new ParsedAttribute_1.ParsedAttribute(options);
125
106
  }
126
107
  getInput(event) {
127
108
  var _a;
@@ -157,6 +138,6 @@ class V5Attribute extends V5CommonEntity_1.V5CommonEntity {
157
138
  return parsedAttribute;
158
139
  }
159
140
  }
160
- exports.V5Attribute = V5Attribute;
161
- V5Attribute.TYPE = 'base-attribute';
162
- //# sourceMappingURL=V5Attribute.js.map
141
+ exports.Attribute = Attribute;
142
+ Attribute.TYPE = 'base-attribute';
143
+ //# sourceMappingURL=Attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Attribute.js","sourceRoot":"","sources":["../../src/attributes/Attribute.ts"],"names":[],"mappings":"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","sourcesContent":["import { AttributeParseEvent, AttributeParseInput } from '../AttributeParseEvent';\nimport { XMLParseEvent } from '../XMLParseEvent';\nimport * as xml from '@journeyapps/common-xml';\nimport {\n AbstractExpression,\n ExpressionParser,\n ConstantExpression,\n EvaluatedExpression,\n CombinedParser,\n FunctionExpressionParser,\n EvaluatedExpressionParser,\n ConstantExpressionParser\n} from '@ja-platform/parser-expressions';\nimport { Type, textType } from '@ja-platform/parser-type-system';\nimport { CommonEntity, CommonEntityListener, CommonEntityOptions } from '../entities/CommonEntity';\nimport { Node } from '../nodes/Node';\nimport { ParsedAttribute, ParsedAttributeOptions } from '../parsed/ParsedAttribute';\nimport { ParsedNode } from '../parsed/ParsedNode';\n\nexport type CombinedAttributeExpression = EvaluatedExpression | ConstantExpression<unknown>;\n\nexport interface AttributeListener extends CommonEntityListener {}\n\nexport interface NodeChecker {\n hasAttributeType(type: string): boolean;\n}\n\nexport interface AttributeOptions<DEFAULT = any, VALUE = unknown> extends CommonEntityOptions {\n /**\n * Accepted expression syntax. Defaults to prefixed code followed by constant text.\n */\n syntax?: ExpressionParser<AbstractExpression>;\n /**\n * Conversion and literal validation for the resolved attribute value.\n */\n valueType?: Type<VALUE>;\n required?: boolean;\n configurable?: boolean;\n advanced?: boolean;\n fragmentNamespace?: string;\n\n defaultValue?: DEFAULT;\n /**\n * The interim value to use when the component attribute is still being evaluated (ie. setting up watches),\n * will fallback to `defaultValue` if not set.\n */\n loadingValue?: DEFAULT;\n /**\n * By default autowatch is enabled, disable it if the attribute relies on parameters such as $object\n * (used quite often in query-widget) which need to have watches setup in virtual tables\n * @deprecated\n */\n autoWatch?: boolean;\n /**\n * Indicates that the attribute is considered deprecated\n */\n deprecated?: boolean;\n /**\n * Ensures that functions returned by this attribute will be mapped to string identifiers in the runtime\n */\n mapGeneratedFunctions?: boolean;\n}\n\nexport interface AttributeGenerics<O extends AttributeOptions = AttributeOptions> {\n Options: O;\n Listener: AttributeListener;\n Value: any;\n NormalizedValue: unknown;\n}\n\nexport interface StringifyDirective {\n isAttribute: boolean;\n value: string | null;\n}\n\nexport class Attribute<G extends AttributeGenerics = AttributeGenerics> extends CommonEntity<G> {\n static TYPE = 'base-attribute';\n parent: Node<any>;\n type: string;\n\n constructor(type: string, options: G['Options']) {\n super({\n ...options,\n syntax:\n options.syntax ??\n new CombinedParser<CombinedAttributeExpression>([\n new FunctionExpressionParser(),\n new EvaluatedExpressionParser(),\n new ConstantExpressionParser(options.valueType ?? textType)\n ]),\n autoWatch: options.autoWatch ?? true,\n configurable: options.configurable ?? false,\n advanced: options.advanced ?? false\n });\n this.type = type;\n }\n\n get key() {\n return this.options.key;\n }\n\n get defaultValue() {\n return this.options.defaultValue;\n }\n\n get name() {\n return this.options.name;\n }\n\n normalizeValue(value: unknown): G['NormalizedValue'] {\n return (this.options.valueType ? this.options.valueType.parse(value) : value) as G['NormalizedValue'];\n }\n\n isEnclosedWith(checkerCB: (helper: NodeChecker) => boolean) {\n let node: Node = this.parent;\n\n const checker: NodeChecker = {\n hasAttributeType(type: string): boolean {\n for (let attr of node.attributes) {\n if (attr.constructor.name === type) {\n return true;\n }\n }\n }\n };\n // keep checking the parent\n do {\n if (checkerCB(checker)) {\n return true;\n }\n\n node = node.parent;\n } while (!!node);\n return false;\n }\n\n serialize(): any {\n return {\n ...super.serialize(),\n required: this.options.required,\n defaultValue: this.options.defaultValue,\n\n docs: this.options.docs,\n type: 'standard',\n advanced: !!this.options.advanced\n };\n }\n\n protected getParsedValue(event: AttributeParseEvent, _parseContext?: Record<string, any>): G['Value'] {\n return (\n event.helper.parseAttributeExpression?.({ attribute: this, source: event.input.value }) ??\n this.options.syntax.parse(event.input.value)\n );\n }\n\n stringify(value: G['Value'], parent: ParsedNode): StringifyDirective {\n if (value == null) {\n return {\n isAttribute: true,\n value: null\n };\n }\n\n return {\n isAttribute: true,\n value: value.raw()\n };\n }\n\n createParsedAttribute(options: ParsedAttributeOptions<G['Value'], this>): ParsedAttribute<G['Value'], this> {\n return new ParsedAttribute(options);\n }\n\n protected getInput(event: XMLParseEvent<ParsedNode>): AttributeParseInput {\n return {\n value: event.element == null ? null : xml.getAttribute(event.element, this.options.name),\n source: event.element == null ? null : (xml.attributeNode(event.element, this.options.name) ?? event.element)\n };\n }\n\n parse(event: XMLParseEvent<ParsedNode>, parseContext: Record<string, any> = {}) {\n const input = this.getInput(event);\n let expression: G['Value'] = null;\n let failure: SyntaxError;\n try {\n if (input.value != null) {\n expression = this.getParsedValue({ ...event, input: { ...input, value: input.value } }, parseContext);\n }\n } catch (error) {\n if (!(error instanceof SyntaxError)) {\n throw error;\n }\n failure = error;\n }\n\n const parsedAttribute = this.createParsedAttribute({\n definition: this,\n event,\n expression,\n parseContext\n });\n\n if (failure) {\n parsedAttribute.pushError({ message: failure.message, element: input.source });\n }\n return parsedAttribute;\n }\n}\n"]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BooleanAttribute = void 0;
4
+ const ConditionType_1 = require("./ConditionType");
5
+ const Attribute_1 = require("./Attribute");
6
+ const parser_expressions_1 = require("@ja-platform/parser-expressions");
7
+ const parser_type_system_1 = require("@ja-platform/parser-type-system");
8
+ /**
9
+ * For dealing with boolean attribute types such as `show-if` and `hide-if`
10
+ */
11
+ class BooleanAttribute extends Attribute_1.Attribute {
12
+ static isInstanceOf(attr) {
13
+ return attr.type === BooleanAttribute.TYPE;
14
+ }
15
+ constructor(options) {
16
+ var _a, _b, _c, _d;
17
+ const valueType = (_a = options.valueType) !== null && _a !== void 0 ? _a : new ConditionType_1.ConditionType();
18
+ super(BooleanAttribute.TYPE, Object.assign(Object.assign({}, options), { valueType, syntax: (_b = options.syntax) !== null && _b !== void 0 ? _b : new parser_expressions_1.CombinedParser([
19
+ new parser_expressions_1.FunctionExpressionParser(),
20
+ new parser_expressions_1.EvaluatedExpressionParser(),
21
+ new parser_expressions_1.ShorthandExpressionParser(),
22
+ new parser_expressions_1.ConstantExpressionParser((_c = options.valueType) !== null && _c !== void 0 ? _c : parser_type_system_1.booleanType)
23
+ ]), configurable: (_d = options.configurable) !== null && _d !== void 0 ? _d : true }));
24
+ }
25
+ serialize() {
26
+ return Object.assign(Object.assign({}, super.serialize()), { type: 'boolean' });
27
+ }
28
+ }
29
+ exports.BooleanAttribute = BooleanAttribute;
30
+ BooleanAttribute.TYPE = 'boolean-attribute';
31
+ //# sourceMappingURL=BooleanAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BooleanAttribute.js","sourceRoot":"","sources":["../../src/attributes/BooleanAttribute.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,2CAA6E;AAC7E,wEASyC;AACzC,wEAA8D;AAU9D;;GAEG;AACH,sBAA8B,SAAQ,qBAAmC;IAGvE,MAAM,CAAC,YAAY,CAAC,IAAe;QACjC,OAAO,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAAC,IAAI,CAAC;IAC7C,CAAC;IAED,YAAY,OAA4C;;QACtD,MAAM,SAAS,SAAG,OAAO,CAAC,SAAS,mCAAI,IAAI,6BAAa,EAAE,CAAC;QAC3D,KAAK,CAAC,gBAAgB,CAAC,IAAI,kCACtB,OAAO,KACV,SAAS,EACT,MAAM,QACJ,OAAO,CAAC,MAAM,mCACd,IAAI,mCAAc,CAA4B;gBAC5C,IAAI,6CAAwB,EAAE;gBAC9B,IAAI,8CAAyB,EAAE;gBAC/B,IAAI,8CAAyB,EAAE;gBAC/B,IAAI,6CAAwB,OAAC,OAAO,CAAC,SAAS,mCAAI,gCAAW,CAAC;aAC/D,CAAC,EACJ,YAAY,QAAE,OAAO,CAAC,YAAY,mCAAI,IAAI,IAC1C,CAAC;IACL,CAAC;IAED,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,SAAS,IACf;IACJ,CAAC;CACF;;AA7BQ,qBAAI,GAAG,mBAAmB,CAAC","sourcesContent":["import { ConditionType } from './ConditionType';\nimport { Attribute, AttributeOptions, AttributeGenerics } from './Attribute';\nimport {\n EvaluatedExpression,\n ConstantExpression,\n ShorthandExpression,\n CombinedParser,\n FunctionExpressionParser,\n EvaluatedExpressionParser,\n ConstantExpressionParser,\n ShorthandExpressionParser\n} from '@ja-platform/parser-expressions';\nimport { booleanType } from '@ja-platform/parser-type-system';\n\nexport type CombinedBooleanExpression = EvaluatedExpression | ConstantExpression<boolean> | ShorthandExpression;\n\nexport interface BooleanAttributeGenerics extends AttributeGenerics {\n Options: AttributeOptions<boolean, boolean>;\n Value: CombinedBooleanExpression | null;\n NormalizedValue: boolean;\n}\n\n/**\n * For dealing with boolean attribute types such as `show-if` and `hide-if`\n */\nexport class BooleanAttribute extends Attribute<BooleanAttributeGenerics> {\n static TYPE = 'boolean-attribute';\n\n static isInstanceOf(attr: Attribute): attr is BooleanAttribute {\n return attr.type === BooleanAttribute.TYPE;\n }\n\n constructor(options: BooleanAttributeGenerics['Options']) {\n const valueType = options.valueType ?? new ConditionType();\n super(BooleanAttribute.TYPE, {\n ...options,\n valueType,\n syntax:\n options.syntax ??\n new CombinedParser<CombinedBooleanExpression>([\n new FunctionExpressionParser(),\n new EvaluatedExpressionParser(),\n new ShorthandExpressionParser(),\n new ConstantExpressionParser(options.valueType ?? booleanType)\n ]),\n configurable: options.configurable ?? true\n });\n }\n\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'boolean'\n };\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConstantBooleanAttribute = void 0;
4
+ const parser_expressions_1 = require("@ja-platform/parser-expressions");
5
+ const parser_type_system_1 = require("@ja-platform/parser-type-system");
6
+ const Attribute_1 = require("./Attribute");
7
+ /**
8
+ * A boolean attribute that accepts constant text only.
9
+ */
10
+ class ConstantBooleanAttribute extends Attribute_1.Attribute {
11
+ static isInstanceOf(attr) {
12
+ return attr.type === ConstantBooleanAttribute.TYPE;
13
+ }
14
+ constructor(options) {
15
+ var _a;
16
+ const valueType = (_a = options.valueType) !== null && _a !== void 0 ? _a : parser_type_system_1.booleanType;
17
+ super(ConstantBooleanAttribute.TYPE, Object.assign(Object.assign({}, options), { syntax: new parser_expressions_1.ConstantExpressionParser(valueType), valueType }));
18
+ }
19
+ }
20
+ exports.ConstantBooleanAttribute = ConstantBooleanAttribute;
21
+ ConstantBooleanAttribute.TYPE = 'constant-boolean-attribute';
22
+ //# sourceMappingURL=ConstantBooleanAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConstantBooleanAttribute.js","sourceRoot":"","sources":["../../src/attributes/ConstantBooleanAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAA+F;AAC/F,wEAA8D;AAC9D,2CAA6E;AAQ7E;;GAEG;AACH,8BAAsC,SAAQ,qBAA2C;IAGvF,MAAM,CAAC,YAAY,CAAC,IAAe;QACjC,OAAO,IAAI,CAAC,IAAI,KAAK,wBAAwB,CAAC,IAAI,CAAC;IACrD,CAAC;IAED,YAAY,OAAoD;;QAC9D,MAAM,SAAS,SAAG,OAAO,CAAC,SAAS,mCAAI,gCAAW,CAAC;QACnD,KAAK,CAAC,wBAAwB,CAAC,IAAI,kCAC9B,OAAO,KACV,MAAM,EAAE,IAAI,6CAAwB,CAAC,SAAS,CAAC,EAC/C,SAAS,IACT,CAAC;IACL,CAAC;CACF;;AAdQ,6BAAI,GAAG,4BAA4B,CAAC","sourcesContent":["import { ConstantExpression, ConstantExpressionParser } from '@ja-platform/parser-expressions';\nimport { booleanType } from '@ja-platform/parser-type-system';\nimport { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';\n\nexport interface ConstantBooleanAttributeGenerics extends AttributeGenerics {\n Options: AttributeOptions<boolean, boolean>;\n Value: ConstantExpression<boolean> | null;\n NormalizedValue: boolean;\n}\n\n/**\n * A boolean attribute that accepts constant text only.\n */\nexport class ConstantBooleanAttribute extends Attribute<ConstantBooleanAttributeGenerics> {\n static TYPE = 'constant-boolean-attribute';\n\n static isInstanceOf(attr: Attribute): attr is ConstantBooleanAttribute {\n return attr.type === ConstantBooleanAttribute.TYPE;\n }\n\n constructor(options: ConstantBooleanAttributeGenerics['Options']) {\n const valueType = options.valueType ?? booleanType;\n super(ConstantBooleanAttribute.TYPE, {\n ...options,\n syntax: new ConstantExpressionParser(valueType),\n valueType\n });\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConstantTextAttribute = void 0;
4
+ const parser_expressions_1 = require("@ja-platform/parser-expressions");
5
+ const parser_type_system_1 = require("@ja-platform/parser-type-system");
6
+ const Attribute_1 = require("./Attribute");
7
+ /**
8
+ * A string attribute that accepts constant text only.
9
+ */
10
+ class ConstantTextAttribute extends Attribute_1.Attribute {
11
+ static isInstanceOf(attr) {
12
+ return attr.type === ConstantTextAttribute.TYPE;
13
+ }
14
+ constructor(options) {
15
+ var _a;
16
+ const valueType = (_a = options.valueType) !== null && _a !== void 0 ? _a : parser_type_system_1.textType;
17
+ super(ConstantTextAttribute.TYPE, Object.assign(Object.assign({}, options), { syntax: new parser_expressions_1.ConstantExpressionParser(valueType), valueType }));
18
+ }
19
+ }
20
+ exports.ConstantTextAttribute = ConstantTextAttribute;
21
+ ConstantTextAttribute.TYPE = 'constant-text-attribute';
22
+ //# sourceMappingURL=ConstantTextAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConstantTextAttribute.js","sourceRoot":"","sources":["../../src/attributes/ConstantTextAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAA+F;AAC/F,wEAA2D;AAC3D,2CAA6E;AAQ7E;;GAEG;AACH,2BAAmC,SAAQ,qBAAwC;IAGjF,MAAM,CAAC,YAAY,CAAC,IAAe;QACjC,OAAO,IAAI,CAAC,IAAI,KAAK,qBAAqB,CAAC,IAAI,CAAC;IAClD,CAAC;IAED,YAAY,OAAiD;;QAC3D,MAAM,SAAS,SAAG,OAAO,CAAC,SAAS,mCAAI,6BAAQ,CAAC;QAChD,KAAK,CAAC,qBAAqB,CAAC,IAAI,kCAC3B,OAAO,KACV,MAAM,EAAE,IAAI,6CAAwB,CAAC,SAAS,CAAC,EAC/C,SAAS,IACT,CAAC;IACL,CAAC;CACF;;AAdQ,0BAAI,GAAG,yBAAyB,CAAC","sourcesContent":["import { ConstantExpression, ConstantExpressionParser } from '@ja-platform/parser-expressions';\nimport { textType } from '@ja-platform/parser-type-system';\nimport { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';\n\nexport interface ConstantTextAttributeGenerics extends AttributeGenerics {\n Options: AttributeOptions<string, string>;\n Value: ConstantExpression | null;\n NormalizedValue: string;\n}\n\n/**\n * A string attribute that accepts constant text only.\n */\nexport class ConstantTextAttribute extends Attribute<ConstantTextAttributeGenerics> {\n static TYPE = 'constant-text-attribute';\n\n static isInstanceOf(attr: Attribute): attr is ConstantTextAttribute {\n return attr.type === ConstantTextAttribute.TYPE;\n }\n\n constructor(options: ConstantTextAttributeGenerics['Options']) {\n const valueType = options.valueType ?? textType;\n super(ConstantTextAttribute.TYPE, {\n ...options,\n syntax: new ConstantExpressionParser(valueType),\n valueType\n });\n }\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5ContentTextAttribute = void 0;
4
- const V5TextAttribute_1 = require("./V5TextAttribute");
3
+ exports.ContentTextAttribute = void 0;
4
+ const TextAttribute_1 = require("./TextAttribute");
5
5
  const common_xml_1 = require("@journeyapps/common-xml");
6
- class V5ContentTextAttribute extends V5TextAttribute_1.V5TextAttribute {
6
+ class ContentTextAttribute extends TextAttribute_1.TextAttribute {
7
7
  constructor(options) {
8
8
  super(options);
9
- this.type = V5ContentTextAttribute.TYPE;
9
+ this.type = ContentTextAttribute.TYPE;
10
10
  }
11
11
  getInput(event) {
12
12
  var _a;
@@ -39,6 +39,6 @@ class V5ContentTextAttribute extends V5TextAttribute_1.V5TextAttribute {
39
39
  return Object.assign(Object.assign({}, super.serialize()), { type: 'content-text' });
40
40
  }
41
41
  }
42
- exports.V5ContentTextAttribute = V5ContentTextAttribute;
43
- V5ContentTextAttribute.TYPE = 'content-text-attribute';
44
- //# sourceMappingURL=V5ContentTextAttribute.js.map
42
+ exports.ContentTextAttribute = ContentTextAttribute;
43
+ ContentTextAttribute.TYPE = 'content-text-attribute';
44
+ //# sourceMappingURL=ContentTextAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTextAttribute.js","sourceRoot":"","sources":["../../src/attributes/ContentTextAttribute.ts"],"names":[],"mappings":";;;AACA,mDAAqH;AAIrH,wDAAuD;AAIvD,0BAAkC,SAAQ,6BAIzC;IAGC,YAAY,OAAoC;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC;IACxC,CAAC;IAES,QAAQ,CAAC,KAAgC;;;QACjD,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,EAAE,KAAK,QAAE,MAAA,KAAK,CAAC,OAAO,0CAAE,WAAW,mCAAI,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAC9E,CAAC;IAES,cAAc,CACtB,KAA0B,EAC1B,YAAY,GAAwB,EAAE;QAEtC,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC7D,IAAI,IAAA,yBAAY,EAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YAC3D,YAAY,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;QACxC,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAES,aAAa,CACrB,KAA0B,EAC1B,UAAkC,EAClC,YAAiC;;QAEjC,IAAI,IAAA,yBAAY,EAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YAC3D,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;YACrD,OAAO;QACT,CAAC;QACD,MAAA,MAAA,KAAK,CAAC,MAAM,EAAC,qBAAqB,mDAAG,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;IACnG,CAAC;IAED,SAAS,CAAC,KAAqC,EAAE,MAAkB;QACjE,uCACK,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,KACjC,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,IAC9B;IACJ,CAAC;IAED,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,cAAc,IACpB;IACJ,CAAC;CACF;;AAnDQ,yBAAI,GAAG,wBAAwB,CAAC","sourcesContent":["import { AttributeParseEvent, AttributeParseInput } from '../AttributeParseEvent';\nimport { CombinedTextExpression, TextAttribute, TextAttributeGenerics, TextAttributeOptions } from './TextAttribute';\nimport { StringifyDirective } from './Attribute';\nimport { ParsedNode } from '../parsed/ParsedNode';\nimport { XMLParseEvent } from '../XMLParseEvent';\nimport { getAttribute } from '@journeyapps/common-xml';\n\nexport interface ContentTextAttributeOptions extends Omit<TextAttributeOptions, 'configurable'> {}\n\nexport class ContentTextAttribute extends TextAttribute<\n TextAttributeGenerics & {\n Options: ContentTextAttributeOptions;\n }\n> {\n static TYPE = 'content-text-attribute';\n\n constructor(options: ContentTextAttributeOptions) {\n super(options);\n this.type = ContentTextAttribute.TYPE;\n }\n\n protected getInput(event: XMLParseEvent<ParsedNode>): AttributeParseInput {\n const input = super.getInput(event);\n if (input.value != null) {\n return input;\n }\n return { value: event.element?.textContent ?? null, source: event.element };\n }\n\n protected getParsedValue(\n event: AttributeParseEvent,\n parseContext: Record<string, any> = {}\n ): CombinedTextExpression | null {\n const expression = super.getParsedValue(event, parseContext);\n if (getAttribute(event.element, this.options.name) == null) {\n parseContext['_content'] = expression;\n }\n return expression;\n }\n\n protected validateInput(\n event: AttributeParseEvent,\n expression: CombinedTextExpression,\n parseContext: Record<string, any>\n ): void {\n if (getAttribute(event.element, this.options.name) != null) {\n super.validateInput(event, expression, parseContext);\n return;\n }\n event.helper.validateFormatContent?.({ element: event.element, scope: event.scope, expression });\n }\n\n stringify(value: TextAttributeGenerics['Value'], parent: ParsedNode): StringifyDirective {\n return {\n ...super.stringify(value, parent),\n isAttribute: !parent.content()\n };\n }\n\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'content-text'\n };\n }\n}\n"]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExpressionAttribute = void 0;
4
+ const parser_expressions_1 = require("@ja-platform/parser-expressions");
5
+ const Attribute_1 = require("./Attribute");
6
+ /**
7
+ * An attribute containing a reference or explicitly evaluated code.
8
+ * Examples include `user.name`, `$object.quantity` and `$:calculateTotal()`.
9
+ * Bare identifiers always represent references; there is no literal text fallback.
10
+ */
11
+ class ExpressionAttribute extends Attribute_1.Attribute {
12
+ constructor(options) {
13
+ var _a;
14
+ super(ExpressionAttribute.TYPE, Object.assign(Object.assign({}, options), { syntax: (_a = options.syntax) !== null && _a !== void 0 ? _a : new parser_expressions_1.CombinedParser([
15
+ new parser_expressions_1.FunctionExpressionParser(),
16
+ new parser_expressions_1.EvaluatedExpressionParser(),
17
+ new parser_expressions_1.ShorthandExpressionParser()
18
+ ]) }));
19
+ }
20
+ }
21
+ exports.ExpressionAttribute = ExpressionAttribute;
22
+ ExpressionAttribute.TYPE = 'expression-attribute';
23
+ //# sourceMappingURL=ExpressionAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressionAttribute.js","sourceRoot":"","sources":["../../src/attributes/ExpressionAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAOyC;AACzC,2CAA2D;AAQ3D;;;;GAIG;AACH,yBAAiC,SAAQ,qBAAsC;IAG7E,YAAY,OAA+C;;QACzD,KAAK,CAAC,mBAAmB,CAAC,IAAI,kCACzB,OAAO,KACV,MAAM,QACJ,OAAO,CAAC,MAAM,mCACd,IAAI,mCAAc,CAAqB;gBACrC,IAAI,6CAAwB,EAAE;gBAC9B,IAAI,8CAAyB,EAAE;gBAC/B,IAAI,8CAAyB,EAAE;aAChC,CAAC,IACJ,CAAC;IACL,CAAC;CACF;;AAdQ,wBAAI,GAAG,sBAAsB,CAAC","sourcesContent":["import {\n CombinedParser,\n EvaluatedExpression,\n EvaluatedExpressionParser,\n FunctionExpressionParser,\n ShorthandExpression,\n ShorthandExpressionParser\n} from '@ja-platform/parser-expressions';\nimport { Attribute, AttributeGenerics } from './Attribute';\n\nexport type CombinedExpression = EvaluatedExpression | ShorthandExpression;\n\nexport interface ExpressionAttributeGenerics extends AttributeGenerics {\n Value: CombinedExpression | null;\n}\n\n/**\n * An attribute containing a reference or explicitly evaluated code.\n * Examples include `user.name`, `$object.quantity` and `$:calculateTotal()`.\n * Bare identifiers always represent references; there is no literal text fallback.\n */\nexport class ExpressionAttribute extends Attribute<ExpressionAttributeGenerics> {\n static TYPE = 'expression-attribute';\n\n constructor(options: ExpressionAttributeGenerics['Options']) {\n super(ExpressionAttribute.TYPE, {\n ...options,\n syntax:\n options.syntax ??\n new CombinedParser<CombinedExpression>([\n new FunctionExpressionParser(),\n new EvaluatedExpressionParser(),\n new ShorthandExpressionParser()\n ])\n });\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FunctionAttribute = void 0;
4
+ const parser_expressions_1 = require("@ja-platform/parser-expressions");
5
+ const Attribute_1 = require("./Attribute");
6
+ class FunctionAttribute extends Attribute_1.Attribute {
7
+ constructor(options) {
8
+ var _a;
9
+ super(FunctionAttribute.TYPE, Object.assign(Object.assign({ autoWatch: false }, options), { syntax: (_a = options.syntax) !== null && _a !== void 0 ? _a : new parser_expressions_1.FunctionExpressionParser() }));
10
+ }
11
+ }
12
+ exports.FunctionAttribute = FunctionAttribute;
13
+ FunctionAttribute.TYPE = 'on-function-attribute';
14
+ //# sourceMappingURL=FunctionAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FunctionAttribute.js","sourceRoot":"","sources":["../../src/attributes/FunctionAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAA+F;AAC/F,2CAA2D;AAM3D,uBAA+B,SAAQ,qBAAoC;IAGzE,YAAY,OAA2D;;QACrE,KAAK,CAAC,iBAAiB,CAAC,IAAI,gCAC1B,SAAS,EAAE,KAAK,IACb,OAAO,KACV,MAAM,QAAE,OAAO,CAAC,MAAM,mCAAI,IAAI,6CAAwB,EAAE,IACxD,CAAC;IACL,CAAC;CACF;;AATQ,sBAAI,GAAG,uBAAuB,CAAC","sourcesContent":["import { FunctionExpression, FunctionExpressionParser } from '@ja-platform/parser-expressions';\nimport { Attribute, AttributeGenerics } from './Attribute';\n\nexport interface FunctionAttributeGenerics extends AttributeGenerics {\n Value: FunctionExpression | null;\n}\n\nexport class FunctionAttribute extends Attribute<FunctionAttributeGenerics> {\n static TYPE = 'on-function-attribute';\n\n constructor(options: Omit<AttributeGenerics['Options'], 'configurable'>) {\n super(FunctionAttribute.TYPE, {\n autoWatch: false,\n ...options,\n syntax: options.syntax ?? new FunctionExpressionParser()\n });\n }\n}\n"]}
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5ListAttribute = void 0;
4
- const V5Attribute_1 = require("./V5Attribute");
5
- class V5ListAttribute extends V5Attribute_1.V5Attribute {
3
+ exports.ListAttribute = void 0;
4
+ const Attribute_1 = require("./Attribute");
5
+ class ListAttribute extends Attribute_1.Attribute {
6
6
  constructor(options) {
7
7
  var _a, _b;
8
- super(V5ListAttribute.TYPE, Object.assign(Object.assign({}, options), { options: options.options || [], configurable: (_a = options.configurable) !== null && _a !== void 0 ? _a : true }));
8
+ super(ListAttribute.TYPE, Object.assign(Object.assign({}, options), { options: options.options || [], configurable: (_a = options.configurable) !== null && _a !== void 0 ? _a : true }));
9
9
  this.delimiter = (_b = options.delimiter) !== null && _b !== void 0 ? _b : ',';
10
10
  }
11
11
  static isInstanceOf(attr) {
12
- return attr.type === V5ListAttribute.TYPE;
12
+ return attr.type === ListAttribute.TYPE;
13
13
  }
14
14
  static toList(value, delimiter = ',') {
15
15
  if (value == null) {
@@ -26,13 +26,10 @@ class V5ListAttribute extends V5Attribute_1.V5Attribute {
26
26
  return value;
27
27
  }
28
28
  }
29
- getEditorV5Syntax(helpers) {
30
- return helpers.dynamicList(this.options.options, this.options.defaultValue);
31
- }
32
29
  serialize() {
33
30
  return Object.assign(Object.assign({}, super.serialize()), { type: 'list', options: this.options.options });
34
31
  }
35
32
  }
36
- exports.V5ListAttribute = V5ListAttribute;
37
- V5ListAttribute.TYPE = 'list-attribute';
38
- //# sourceMappingURL=V5ListAttribute.js.map
33
+ exports.ListAttribute = ListAttribute;
34
+ ListAttribute.TYPE = 'list-attribute';
35
+ //# sourceMappingURL=ListAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListAttribute.js","sourceRoot":"","sources":["../../src/attributes/ListAttribute.ts"],"names":[],"mappings":";;;AACA,2CAA6E;AAc7E,mBAA2B,SAAQ,qBAAgC;IAGjE,YAAY,OAAyC;;QACnD,KAAK,CAAC,aAAa,CAAC,IAAI,kCACnB,OAAO,KACV,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE,EAC9B,YAAY,QAAE,OAAO,CAAC,YAAY,mCAAI,IAAI,IAC1C,CAAC;QACH,IAAI,CAAC,SAAS,SAAG,OAAO,CAAC,SAAS,mCAAI,GAAG,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAAe;QACjC,OAAO,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAU,EAAE,SAAS,GAAG,GAAG;QACvC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC;QACf,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE,CAAC;YAChE,OAAO,GAAG,KAAK,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,6DAA6D;YAC7D,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,IAC7B;IACJ,CAAC;CACF;;AAlCQ,kBAAI,GAAG,gBAAgB,CAAC","sourcesContent":["import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';\nimport { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';\n\nexport type CombinedListExpression = EvaluatedExpression | ConstantExpression;\n\nexport interface ListAttributeOptions extends AttributeOptions<string[]> {\n options: string[];\n delimiter?: string;\n}\n\nexport interface ListAttributeGenerics extends AttributeGenerics {\n Value: CombinedListExpression | null;\n Options: ListAttributeOptions;\n}\n\nexport class ListAttribute extends Attribute<ListAttributeGenerics> {\n static TYPE = 'list-attribute';\n delimiter: string;\n constructor(options: ListAttributeGenerics['Options']) {\n super(ListAttribute.TYPE, {\n ...options,\n options: options.options || [],\n configurable: options.configurable ?? true\n });\n this.delimiter = options.delimiter ?? ',';\n }\n\n static isInstanceOf(attr: Attribute): attr is ListAttribute {\n return attr.type === ListAttribute.TYPE;\n }\n\n static toList(value: any, delimiter = ','): any[] {\n if (value == null) {\n return null;\n } else if (Array.isArray(value)) {\n return value;\n } else if (typeof value === 'string' || value instanceof String) {\n return `${value}`.split(delimiter);\n } else {\n // Value might be an object, which will be resolved elsewhere\n return value;\n }\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'list',\n options: this.options.options\n };\n }\n}\n"]}
@@ -1,20 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5NumberAttribute = void 0;
3
+ exports.NumberAttribute = void 0;
4
4
  const parser_expressions_1 = require("@ja-platform/parser-expressions");
5
5
  const parser_type_system_1 = require("@ja-platform/parser-type-system");
6
- const AttributeDefaults_1 = require("./AttributeDefaults");
7
- const V5Attribute_1 = require("./V5Attribute");
8
- class V5NumberAttribute extends V5Attribute_1.V5Attribute {
6
+ const Attribute_1 = require("./Attribute");
7
+ class NumberAttribute extends Attribute_1.Attribute {
9
8
  static isInstanceOf(attr) {
10
- return attr.type === V5NumberAttribute.TYPE;
9
+ return attr.type === NumberAttribute.TYPE;
11
10
  }
12
11
  constructor(options) {
13
12
  var _a, _b;
14
- super(V5NumberAttribute.TYPE, Object.assign(Object.assign({}, options), { valueType: (_a = options.valueType) !== null && _a !== void 0 ? _a : parser_type_system_1.numberType, defaultValueKind: V5Attribute_1.DefaultValueKind.SIZE, configurable: (_b = options.configurable) !== null && _b !== void 0 ? _b : true }));
15
- if (typeof this.options.defaultValue == 'number') {
16
- this.options.defaultValue = (0, AttributeDefaults_1.fanDefaultValue)(this.options.defaultValue);
17
- }
13
+ super(NumberAttribute.TYPE, Object.assign(Object.assign({}, options), { valueType: (_a = options.valueType) !== null && _a !== void 0 ? _a : parser_type_system_1.numberType, configurable: (_b = options.configurable) !== null && _b !== void 0 ? _b : true }));
18
14
  }
19
15
  getParsedValue(event) {
20
16
  const value = event.input.value;
@@ -48,17 +44,10 @@ class V5NumberAttribute extends V5Attribute_1.V5Attribute {
48
44
  }
49
45
  });
50
46
  }
51
- getEditorV5Syntax(helpers) {
52
- return helpers.typedBindingOrFunction({
53
- types: ['number'],
54
- writable: false,
55
- constants: false
56
- });
57
- }
58
47
  serialize() {
59
48
  return Object.assign(Object.assign({}, super.serialize()), { type: 'number' });
60
49
  }
61
50
  }
62
- exports.V5NumberAttribute = V5NumberAttribute;
63
- V5NumberAttribute.TYPE = 'number-attribute';
64
- //# sourceMappingURL=V5NumberAttribute.js.map
51
+ exports.NumberAttribute = NumberAttribute;
52
+ NumberAttribute.TYPE = 'number-attribute';
53
+ //# sourceMappingURL=NumberAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberAttribute.js","sourceRoot":"","sources":["../../src/attributes/NumberAttribute.ts"],"names":[],"mappings":";;;AACA,wEAA0F;AAC1F,wEAA6D;AAC7D,2CAA6E;AAoB7E,qBAA6B,SAAQ,qBAAkC;IAGrE,MAAM,CAAC,YAAY,CAAC,IAAe;QACjC,OAAO,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,IAAI,CAAC;IAC5C,CAAC;IAED,YAAY,OAA2C;;QACrD,KAAK,CAAC,eAAe,CAAC,IAAI,kCACrB,OAAO,KACV,SAAS,QAAE,OAAO,CAAC,SAAS,mCAAI,+BAAU,EAC1C,YAAY,QAAE,OAAO,CAAC,YAAY,mCAAI,IAAI,IAC1C,CAAC;IACL,CAAC;IAES,cAAc,CAAC,KAA0B;QACjD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;QAChC,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,SAAS,CAAC,MAAiB;QACzB,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxB,MAAM,CAAC,gBAAgB,CAAC;YACtB,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;gBACxB,MAAM,CAAC,gBAAgB,CAAC;oBACtB,cAAc,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;;wBAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;wBAC3D,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;wBACrC,IAAI,UAAU,YAAY,uCAAkB,IAAI,KAAK,EAAE,CAAC;4BACtD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;4BACjC,MAAM,GAAG,SAAG,KAAK,CAAC,GAAG,mCAAI,MAAM,CAAC,iBAAiB,CAAC;4BAClD,MAAM,GAAG,SAAG,KAAK,CAAC,GAAG,mCAAI,MAAM,CAAC,iBAAiB,CAAC;4BAClD,IAAI,KAAK,GAAG,GAAG,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;gCAC/B,OAAO,CAAC,MAAM,CAAC;oCACb,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;oCAC3B,OAAO,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,QAAQ,eAAe,IAAI,KAAK,UAAU,CAAC,GAAG,EAAE,oCAAoC,GAAG,KAAK,GAAG,IAAI;iCACrI,CAAC,CAAC;4BACL,CAAC;wBACH,CAAC;oBACH,CAAC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IACD,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,QAAQ,IACd;IACJ,CAAC;CACF;;AApDQ,oBAAI,GAAG,kBAAkB,CAAC","sourcesContent":["import { AttributeParseEvent } from '../AttributeParseEvent';\nimport { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';\nimport { numberType } from '@ja-platform/parser-type-system';\nimport { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';\nimport type { Node } from '../nodes/Node';\n\nexport type CombinedNumberExpression = EvaluatedExpression | ConstantExpression<number>;\n\nexport interface NumberAttributeRange {\n min?: number;\n max?: number;\n}\n\nexport interface NumberAttributeOptions extends AttributeOptions<number, number> {\n range?: NumberAttributeRange;\n}\n\nexport interface NumberAttributeGenerics extends AttributeGenerics {\n Options: NumberAttributeOptions;\n Value: CombinedNumberExpression | null;\n NormalizedValue: number;\n}\n\nexport class NumberAttribute extends Attribute<NumberAttributeGenerics> {\n static TYPE = 'number-attribute';\n\n static isInstanceOf(attr: Attribute): attr is NumberAttribute {\n return attr.type === NumberAttribute.TYPE;\n }\n\n constructor(options: NumberAttributeGenerics['Options']) {\n super(NumberAttribute.TYPE, {\n ...options,\n valueType: options.valueType ?? numberType,\n configurable: options.configurable ?? true\n });\n }\n\n protected getParsedValue(event: AttributeParseEvent): NumberAttributeGenerics['Value'] {\n const value = event.input.value;\n if (value.trim() === '') {\n return null;\n }\n return super.getParsedValue(event);\n }\n\n setParent(parent: Node<any>) {\n super.setParent(parent);\n parent.registerListener({\n postParse: ({ parsed }) => {\n parsed.registerListener({\n postValidation: ({ context }) => {\n const expression = parsed.attrExpression(this.options.key);\n const { name, range } = this.options;\n if (expression instanceof ConstantExpression && range) {\n const value = expression.value();\n const min = range.min ?? Number.NEGATIVE_INFINITY;\n const max = range.max ?? Number.POSITIVE_INFINITY;\n if (value < min || value > max) {\n context.report({\n token: expression.tokens[0],\n message: `${parsed.sourceElement.nodeName}: Attribute ${name}=\"${expression.raw()}\" is outside of allowable range [${min}, ${max}].`\n });\n }\n }\n }\n });\n }\n });\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'number'\n };\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PathAttribute = void 0;
4
+ const Attribute_1 = require("./Attribute");
5
+ class PathAttribute extends Attribute_1.Attribute {
6
+ constructor(options) {
7
+ super(PathAttribute.TYPE, options);
8
+ }
9
+ serialize() {
10
+ return Object.assign(Object.assign({}, super.serialize()), { type: 'path' });
11
+ }
12
+ }
13
+ exports.PathAttribute = PathAttribute;
14
+ PathAttribute.TYPE = 'path-attribute';
15
+ //# sourceMappingURL=PathAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PathAttribute.js","sourceRoot":"","sources":["../../src/attributes/PathAttribute.ts"],"names":[],"mappings":";;;AACA,2CAA6E;AAQ7E,mBAA2B,SAAQ,qBAAgC;IAGjE,YAAY,OAA+C;QACzD,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IACD,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,MAAM,IACZ;IACJ,CAAC;CACF;;AAXQ,kBAAI,GAAG,gBAAgB,CAAC","sourcesContent":["import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';\nimport { Attribute, AttributeOptions, AttributeGenerics } from './Attribute';\n\nexport type CombinedPathExpression = EvaluatedExpression | ConstantExpression;\n\nexport interface PathAttributeGenerics extends AttributeGenerics {\n Value: CombinedPathExpression | null;\n}\n\nexport class PathAttribute extends Attribute<PathAttributeGenerics> {\n static TYPE = 'path-attribute';\n\n constructor(options: Omit<AttributeOptions, 'configurable'>) {\n super(PathAttribute.TYPE, options);\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'path'\n };\n }\n}\n"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetAttribute = void 0;
4
+ const Attribute_1 = require("./Attribute");
5
+ class SetAttribute extends Attribute_1.Attribute {
6
+ constructor(options) {
7
+ var _a;
8
+ super(SetAttribute.TYPE, Object.assign(Object.assign({}, options), { configurable: (_a = options.configurable) !== null && _a !== void 0 ? _a : true, options: options.options || [] }));
9
+ }
10
+ static isInstanceOf(attr) {
11
+ return attr.type === SetAttribute.TYPE;
12
+ }
13
+ serialize() {
14
+ return Object.assign(Object.assign({}, super.serialize()), { type: 'set', options: this.options.options });
15
+ }
16
+ }
17
+ exports.SetAttribute = SetAttribute;
18
+ SetAttribute.TYPE = 'set-attribute';
19
+ //# sourceMappingURL=SetAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SetAttribute.js","sourceRoot":"","sources":["../../src/attributes/SetAttribute.ts"],"names":[],"mappings":";;;AACA,2CAA6E;AAa7E,kBAA0B,SAAQ,qBAA+B;IAE/D,YAAY,OAA4B;;QACtC,KAAK,CAAC,YAAY,CAAC,IAAI,kCAClB,OAAO,KACV,YAAY,QAAE,OAAO,CAAC,YAAY,mCAAI,IAAI,EAC1C,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE,IAC9B,CAAC;IACL,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAAe;QACjC,OAAO,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,IAAI,CAAC;IACzC,CAAC;IAED,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,IAC7B;IACJ,CAAC;CACF;;AApBQ,iBAAI,GAAG,eAAe,CAAC","sourcesContent":["import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';\nimport { Attribute, AttributeGenerics, AttributeOptions } from './Attribute';\n\nexport type CombinedSetExpression = EvaluatedExpression | ConstantExpression;\n\nexport interface SetAttributeOptions extends AttributeOptions<string> {\n options: string[];\n}\n\nexport interface SetAttributeGenerics extends AttributeGenerics {\n Value: CombinedSetExpression | null;\n Options: SetAttributeOptions;\n}\n\nexport class SetAttribute extends Attribute<SetAttributeGenerics> {\n static TYPE = 'set-attribute';\n constructor(options: SetAttributeOptions) {\n super(SetAttribute.TYPE, {\n ...options,\n configurable: options.configurable ?? true,\n options: options.options || []\n });\n }\n\n static isInstanceOf(attr: Attribute): attr is SetAttribute {\n return attr.type === SetAttribute.TYPE;\n }\n\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'set',\n options: this.options.options\n };\n }\n}\n"]}
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5TextArrayAttribute = void 0;
3
+ exports.TextArrayAttribute = void 0;
4
4
  const parser_type_system_1 = require("@ja-platform/parser-type-system");
5
- const AttributeDefaults_1 = require("./AttributeDefaults");
6
- const V5ListAttribute_1 = require("./V5ListAttribute");
7
- const V5TextAttribute_1 = require("./V5TextAttribute");
5
+ const ListAttribute_1 = require("./ListAttribute");
6
+ const TextAttribute_1 = require("./TextAttribute");
8
7
  class TextArrayType extends parser_type_system_1.Type {
9
8
  constructor(delimiter) {
10
9
  super('text-array');
@@ -14,27 +13,24 @@ class TextArrayType extends parser_type_system_1.Type {
14
13
  return Array.isArray(value) && value.every(parser_type_system_1.textType.is);
15
14
  }
16
15
  parse(value) {
17
- return V5ListAttribute_1.V5ListAttribute.toList(value, this.delimiter);
16
+ return ListAttribute_1.ListAttribute.toList(value, this.delimiter);
18
17
  }
19
18
  }
20
- class V5TextArrayAttribute extends V5TextAttribute_1.V5TextAttribute {
19
+ class TextArrayAttribute extends TextAttribute_1.TextAttribute {
21
20
  static isInstanceOf(attr) {
22
- return attr.type === V5TextArrayAttribute.TYPE;
21
+ return attr.type === TextArrayAttribute.TYPE;
23
22
  }
24
23
  constructor(options) {
25
24
  var _a, _b, _c;
26
25
  const delimiter = (_a = options.delimiter) !== null && _a !== void 0 ? _a : ',';
27
26
  super(Object.assign(Object.assign({}, options), { valueType: (_b = options.valueType) !== null && _b !== void 0 ? _b : new TextArrayType(delimiter), configurable: (_c = options.configurable) !== null && _c !== void 0 ? _c : true, advanced: true }));
28
- this.type = V5TextArrayAttribute.TYPE;
27
+ this.type = TextArrayAttribute.TYPE;
29
28
  this.delimiter = delimiter;
30
- if (Array.isArray(options.defaultValue)) {
31
- this.options.defaultValue = (0, AttributeDefaults_1.fanDefaultValue)(options.defaultValue);
32
- }
33
29
  }
34
30
  serialize() {
35
31
  return Object.assign(Object.assign({}, super.serialize()), { type: 'array' });
36
32
  }
37
33
  }
38
- exports.V5TextArrayAttribute = V5TextArrayAttribute;
39
- V5TextArrayAttribute.TYPE = 'text-array';
40
- //# sourceMappingURL=V5TextArrayAttribute.js.map
34
+ exports.TextArrayAttribute = TextArrayAttribute;
35
+ TextArrayAttribute.TYPE = 'text-array';
36
+ //# sourceMappingURL=TextArrayAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextArrayAttribute.js","sourceRoot":"","sources":["../../src/attributes/TextArrayAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAAiE;AAEjE,mDAAgD;AAChD,mDAA6F;AAU7F,MAAM,aAAc,SAAQ,yBAAc;IACxC,YAA6B,SAAiB;QAC5C,KAAK,CAAC,YAAY,CAAC,CAAC;yBADO,SAAS;IAEtC,CAAC;IAED,EAAE,CAAC,KAAc;QACf,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,6BAAQ,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,KAAc;QAClB,OAAO,6BAAa,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;CACF;AAED,wBAAgC,SAAQ,6BAAyC;IAI/E,MAAM,CAAC,YAAY,CAAC,IAAe;QACjC,OAAO,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC;IAC/C,CAAC;IAED,YAAY,OAA8C;;QACxD,MAAM,SAAS,SAAG,OAAO,CAAC,SAAS,mCAAI,GAAG,CAAC;QAC3C,KAAK,iCACA,OAAO,KACV,SAAS,QAAE,OAAO,CAAC,SAAS,mCAAI,IAAI,aAAa,CAAC,SAAS,CAAC,EAC5D,YAAY,QAAE,OAAO,CAAC,YAAY,mCAAI,IAAI,EAC1C,QAAQ,EAAE,IAAI,IACd,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IACD,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,OAAO,IACb;IACJ,CAAC;CACF;;AAxBQ,uBAAI,GAAG,YAAY,CAAC","sourcesContent":["import { Type, textType } from '@ja-platform/parser-type-system';\nimport { Attribute } from './Attribute';\nimport { ListAttribute } from './ListAttribute';\nimport { TextAttribute, TextAttributeGenerics, TextAttributeOptions } from './TextAttribute';\n\nexport interface TextArrayAttributeOptions extends TextAttributeOptions<string[]> {\n delimiter?: string;\n}\n\nexport interface TextArrayAttributeGenerics extends TextAttributeGenerics<string[]> {\n Options: TextArrayAttributeOptions;\n}\n\nclass TextArrayType extends Type<string[]> {\n constructor(private readonly delimiter: string) {\n super('text-array');\n }\n\n is(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(textType.is);\n }\n\n parse(value: unknown): string[] {\n return ListAttribute.toList(value, this.delimiter);\n }\n}\n\nexport class TextArrayAttribute extends TextAttribute<TextArrayAttributeGenerics> {\n static TYPE = 'text-array';\n delimiter: string;\n\n static isInstanceOf(attr: Attribute): attr is TextArrayAttribute {\n return attr.type === TextArrayAttribute.TYPE;\n }\n\n constructor(options: TextArrayAttributeGenerics['Options']) {\n const delimiter = options.delimiter ?? ',';\n super({\n ...options,\n valueType: options.valueType ?? new TextArrayType(delimiter),\n configurable: options.configurable ?? true,\n advanced: true\n });\n this.type = TextArrayAttribute.TYPE;\n this.delimiter = delimiter;\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'array'\n };\n }\n}\n"]}