@ja-platform/parser-core 0.0.0-dev-20261021195551 → 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,27 +0,0 @@
1
- import { AttributeParseEvent } from '../AttributeParseEvent';
2
- import { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
3
- import { DefaultValueType, V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';
4
- import { V5EditorHelpers } from '../events/V5EditorContext';
5
- import type { V5Node } from '../nodes/V5Node';
6
- export type CombinedNumberExpression = EvaluatedExpression | ConstantExpression<number>;
7
- export interface V5NumberAttributeRange {
8
- min?: number;
9
- max?: number;
10
- }
11
- export interface V5NumberAttributeOptions extends V5AttributeOptions<DefaultValueType<number>, number> {
12
- range?: V5NumberAttributeRange;
13
- }
14
- export interface V5NumberAttributeGenerics extends V5AttributeGenerics {
15
- Options: V5NumberAttributeOptions;
16
- Value: CombinedNumberExpression | null;
17
- NormalizedValue: number;
18
- }
19
- export declare class V5NumberAttribute extends V5Attribute<V5NumberAttributeGenerics> {
20
- static TYPE: string;
21
- static isInstanceOf(attr: V5Attribute): attr is V5NumberAttribute;
22
- constructor(options: V5NumberAttributeGenerics['Options']);
23
- protected getParsedValue(event: AttributeParseEvent): V5NumberAttributeGenerics['Value'];
24
- setParent(parent: V5Node<any>): void;
25
- getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
26
- serialize(): any;
27
- }
@@ -1,11 +0,0 @@
1
- import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
2
- import { V5Attribute, V5AttributeOptions, V5AttributeGenerics } from './V5Attribute';
3
- export type CombinedPathExpression = EvaluatedExpression | ConstantExpression;
4
- export interface V5PathAttributeGenerics extends V5AttributeGenerics {
5
- Value: CombinedPathExpression | null;
6
- }
7
- export declare class V5PathAttribute extends V5Attribute<V5PathAttributeGenerics> {
8
- static TYPE: string;
9
- constructor(options: Omit<V5AttributeOptions, 'configurable'>);
10
- serialize(): any;
11
- }
@@ -1,18 +0,0 @@
1
- import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';
2
- import { V5EditorHelpers } from '../events/V5EditorContext';
3
- import { DefaultValueType, V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';
4
- export type CombinedSetExpression = EvaluatedExpression | ConstantExpression;
5
- export interface V5SetAttributeOptions extends V5AttributeOptions<DefaultValueType<string>> {
6
- options: string[];
7
- }
8
- export interface V5SetAttributeGenerics extends V5AttributeGenerics {
9
- Value: CombinedSetExpression | null;
10
- Options: V5SetAttributeOptions;
11
- }
12
- export declare class V5SetAttribute extends V5Attribute<V5SetAttributeGenerics> {
13
- static TYPE: string;
14
- constructor(options: V5SetAttributeOptions);
15
- static isInstanceOf(attr: V5Attribute): attr is V5SetAttribute;
16
- getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
17
- serialize(): any;
18
- }
@@ -1,15 +0,0 @@
1
- import { V5Attribute } from './V5Attribute';
2
- import { V5TextAttribute, V5TextAttributeGenerics, V5TextAttributeOptions } from './V5TextAttribute';
3
- export interface V5TextArrayAttributeOptions extends V5TextAttributeOptions<string[]> {
4
- delimiter?: string;
5
- }
6
- export interface V5TextArrayAttributeGenerics extends V5TextAttributeGenerics<string[]> {
7
- Options: V5TextArrayAttributeOptions;
8
- }
9
- export declare class V5TextArrayAttribute extends V5TextAttribute<V5TextArrayAttributeGenerics> {
10
- static TYPE: string;
11
- delimiter: string;
12
- static isInstanceOf(attr: V5Attribute): attr is V5TextArrayAttribute;
13
- constructor(options: V5TextArrayAttributeGenerics['Options']);
14
- serialize(): any;
15
- }
@@ -1,20 +0,0 @@
1
- import { AttributeParseEvent } from '../AttributeParseEvent';
2
- import { DefaultValueType, V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';
3
- import { V5EditorHelpers } from '../events/V5EditorContext';
4
- import { FormatStringExpression, EvaluatedExpression } from '@ja-platform/parser-expressions';
5
- export type CombinedTextExpression = FormatStringExpression | EvaluatedExpression;
6
- export type V5TextAttributeOptions<Value = string> = V5AttributeOptions<DefaultValueType<Value>, Value>;
7
- export interface V5TextAttributeGenerics<Value = string> extends V5AttributeGenerics {
8
- Value: CombinedTextExpression | null;
9
- Options: V5TextAttributeOptions<Value>;
10
- NormalizedValue: Value;
11
- }
12
- export declare class V5TextAttribute<T extends V5TextAttributeGenerics<unknown> = V5TextAttributeGenerics> extends V5Attribute<T> {
13
- static TYPE: string;
14
- constructor(options: T['Options']);
15
- static isInstanceOf(attr: V5Attribute): attr is V5TextAttribute<V5TextAttributeGenerics<unknown>>;
16
- protected getParsedValue(event: AttributeParseEvent, parseContext?: Record<string, any>): CombinedTextExpression | null;
17
- protected validateInput(event: AttributeParseEvent, expression: CombinedTextExpression, parseContext: Record<string, any>): void;
18
- getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T;
19
- serialize(): any;
20
- }
@@ -1,15 +0,0 @@
1
- export * from './AttributeDefaults';
2
- export * from './ConditionType';
3
- export * from './V5Attribute';
4
- export * from './V5BooleanAttribute';
5
- export * from './V5ConstantBooleanAttribute';
6
- export * from './V5ConstantTextAttribute';
7
- export * from './V5ContentTextAttribute';
8
- export * from './V5ExpressionAttribute';
9
- export * from './V5FunctionAttribute';
10
- export * from './V5ListAttribute';
11
- export * from './V5NumberAttribute';
12
- export * from './V5PathAttribue';
13
- export * from './V5SetAttribute';
14
- export * from './V5TextArrayAttribute';
15
- export * from './V5TextAttribute';
@@ -1,15 +0,0 @@
1
- export interface V5AbstractEntityOptions {
2
- key?: string;
3
- name: string;
4
- description?: string;
5
- }
6
- export interface V5AbstractEntityGenerics {
7
- Options: V5AbstractEntityOptions;
8
- }
9
- export declare abstract class V5AbstractEntity<G extends V5AbstractEntityGenerics = V5AbstractEntityGenerics> {
10
- options: G['Options'];
11
- constructor(options: G['Options']);
12
- serialize(): {
13
- name: string;
14
- };
15
- }
@@ -1,28 +0,0 @@
1
- import { V5Node } from '../nodes/V5Node';
2
- import { V5AbstractEntity, V5AbstractEntityGenerics, V5AbstractEntityOptions } from './V5AbstractEntity';
3
- export interface V5CommonEntityOptions extends V5AbstractEntityOptions {
4
- docs?: string;
5
- /**
6
- * Request the enclosing collection scope from a parser that supports scoped declarations.
7
- */
8
- queryScoped?: boolean;
9
- }
10
- export interface V5CommonEntityListener {
11
- }
12
- export interface V5CommonEntityGenerics extends V5AbstractEntityGenerics {
13
- Options: V5CommonEntityOptions;
14
- Listener: V5CommonEntityListener;
15
- }
16
- export declare abstract class V5CommonEntity<G extends V5CommonEntityGenerics = V5CommonEntityGenerics> extends V5AbstractEntity<G> {
17
- listeners: G['Listener'][];
18
- parent: V5Node<any>;
19
- constructor(options: G['Options']);
20
- serialize(): {
21
- name: string;
22
- queryScoped?: boolean;
23
- };
24
- getRootNode(): V5Node<any>;
25
- registerListener(listener: G['Listener']): () => void;
26
- fireListeners(cb: (listener: G['Listener']) => any): void;
27
- setParent(parent: V5Node<any>): void;
28
- }
@@ -1,2 +0,0 @@
1
- export * from './V5AbstractEntity';
2
- export * from './V5CommonEntity';
@@ -1,43 +0,0 @@
1
- export interface V5EditorHelpers<FieldDefinition> {
2
- /**
3
- * Return functions from the javascript context in the editor for a view
4
- */
5
- viewFunctionsSelection(signature?: string): FieldDefinition;
6
- /**
7
- * Return functions from the javascript context in the editor for a navigation view
8
- */
9
- navigateFunctionsSelection(signature?: string): FieldDefinition;
10
- typedBinding(options: {
11
- types: string[] | null;
12
- writable: boolean;
13
- constants: boolean;
14
- }, defaultValue?: string): FieldDefinition;
15
- typedBindingOrFunction(options: {
16
- types: string[] | null;
17
- writable: boolean;
18
- constants: boolean;
19
- }, defaultValue?: string): FieldDefinition;
20
- /**
21
- * One of a set list of values, or a $: function.
22
- */
23
- dynamicSet(values: string[], defaultValue?: string): FieldDefinition;
24
- /**
25
- * A list of values, or a $: function.
26
- */
27
- dynamicList(values: string[], defaultValue?: string[]): FieldDefinition;
28
- formatString(queryScopeTag?: string): FieldDefinition;
29
- /**
30
- * Color selection (constant or function).
31
- *
32
- * @param params.text: true if the color is for foreground text
33
- */
34
- color(options: {
35
- text: boolean;
36
- }): FieldDefinition;
37
- /**
38
- * Name of a built-in icon, or path to an icon.
39
- */
40
- icon(options: {
41
- includeUploads?: boolean;
42
- }): FieldDefinition;
43
- }
@@ -1,6 +0,0 @@
1
- export * from './ParsedArrayNode';
2
- export * from './ParsedAttribute';
3
- export * from './ParsedContentNode';
4
- export * from './ParsedDiagnostic';
5
- export * from './ParsedNode';
6
- export * from './ParsedNodeTypes';
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fanDefaultValue = fanDefaultValue;
4
- const V5Attribute_1 = require("./V5Attribute");
5
- /**
6
- * Normalize a scalar declaration to all supported size variants.
7
- */
8
- function fanDefaultValue(defaultValue) {
9
- return {
10
- [V5Attribute_1.ComponentSize.SMALL]: defaultValue,
11
- [V5Attribute_1.ComponentSize.MEDIUM]: defaultValue,
12
- [V5Attribute_1.ComponentSize.LARGE]: defaultValue
13
- };
14
- }
15
- //# sourceMappingURL=AttributeDefaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AttributeDefaults.js","sourceRoot":"","sources":["../../src/attributes/AttributeDefaults.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAE9C;;GAEG;AACH,yBAAmC,YAAe;IAChD,OAAO;QACL,CAAC,2BAAa,CAAC,KAAK,CAAC,EAAE,YAAY;QACnC,CAAC,2BAAa,CAAC,MAAM,CAAC,EAAE,YAAY;QACpC,CAAC,2BAAa,CAAC,KAAK,CAAC,EAAE,YAAY;KACpC,CAAC;AACJ,CAAC","sourcesContent":["import { ComponentSize } from './V5Attribute';\n\n/**\n * Normalize a scalar declaration to all supported size variants.\n */\nexport function fanDefaultValue<T>(defaultValue: T): { [k in ComponentSize]: T } {\n return {\n [ComponentSize.SMALL]: defaultValue,\n [ComponentSize.MEDIUM]: defaultValue,\n [ComponentSize.LARGE]: defaultValue\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5Attribute.js","sourceRoot":"","sources":["../../src/attributes/V5Attribute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAY,GAAG,oDAAgC;AAC/C,wEASyC;AACzC,wEAAiE;AACjE,+D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,CAAC;YACH,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;gBACxB,UAAU,GAAG,IAAI,CAAC,cAAc,iCAAM,KAAK,KAAE,KAAK,kCAAO,KAAK,KAAE,KAAK,EAAE,KAAK,CAAC,KAAK,QAAM,YAAY,CAAC,CAAC;YACxG,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,CAAC,KAAK,YAAY,WAAW,CAAC,EAAE,CAAC;gBACpC,MAAM,KAAK,CAAC;YACd,CAAC;YACD,OAAO,GAAG,KAAK,CAAC;QAClB,CAAC;QAED,MAAM,eAAe,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACjD,UAAU,EAAE,IAAI;YAChB,KAAK;YACL,UAAU;YACV,YAAY;SACb,CAAC,CAAC;QAEH,IAAI,OAAO,EAAE,CAAC;YACZ,eAAe,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACjF,CAAC;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;;AAtIQ,gBAAI,GAAG,gBAAgB,CAAC","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 { V5CommonEntity, V5CommonEntityListener, V5CommonEntityOptions } from '../entities/V5CommonEntity';\nimport { V5EditorHelpers } from '../events/V5EditorContext';\nimport { V5Node } from '../nodes/V5Node';\nimport { ParsedAttribute, ParsedAttributeOptions, ParsedNode } from '../parsed';\n\nexport type CombinedAttributeExpression = EvaluatedExpression | ConstantExpression<unknown>;\n\nexport enum DefaultValueKind {\n COLOR = 'color',\n SIZE = 'size'\n}\n\nexport enum ComponentSize {\n SMALL = 'small',\n MEDIUM = 'medium',\n LARGE = 'large'\n}\n\nexport type DefaultValueMap<T extends any> = { [k in string | number | symbol]: T };\n\nexport interface V5AttributeListener extends V5CommonEntityListener {}\n\nexport interface NodeChecker {\n hasAttributeType(type: string): boolean;\n}\n\nexport type DefaultValueType<T> = { [k in ComponentSize]: T } | T;\n\nexport enum AttributeCategory {\n THEME = 'theme',\n LAYOUT = 'layout'\n}\n\nexport interface V5AttributeOptions<DEFAULT = any, VALUE = unknown> extends V5CommonEntityOptions {\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\n /**\n * Used to categorise sets of attributes for easier filtering\n */\n category?: AttributeCategory;\n fragmentNamespace?: string;\n\n defaultValue?: DEFAULT;\n /**\n * Select a variant contribution explicitly; omitted defaults are literal values.\n */\n defaultValueKind?: DefaultValueKind;\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 V5AttributeGenerics<O extends V5AttributeOptions = V5AttributeOptions> {\n Options: O;\n Listener: V5AttributeListener;\n Value: any;\n NormalizedValue: unknown;\n}\n\nexport interface StringifyDirective {\n isAttribute: boolean;\n value: string | null;\n}\n\nexport class V5Attribute<G extends V5AttributeGenerics = V5AttributeGenerics> extends V5CommonEntity<G> {\n static TYPE = 'base-attribute';\n parent: V5Node<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: V5Node = 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 defaultValueKind: this.options.defaultValueKind,\n docs: this.options.docs,\n type: 'standard',\n advanced: !!this.options.advanced\n };\n }\n getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T {\n return helpers.viewFunctionsSelection();\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"]}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5BooleanAttribute = void 0;
4
- const ConditionType_1 = require("./ConditionType");
5
- const AttributeDefaults_1 = require("./AttributeDefaults");
6
- const V5Attribute_1 = require("./V5Attribute");
7
- const parser_expressions_1 = require("@ja-platform/parser-expressions");
8
- const parser_type_system_1 = require("@ja-platform/parser-type-system");
9
- /**
10
- * For dealing with boolean attribute types such as `show-if` and `hide-if`
11
- */
12
- class V5BooleanAttribute extends V5Attribute_1.V5Attribute {
13
- static isInstanceOf(attr) {
14
- return attr.type === V5BooleanAttribute.TYPE;
15
- }
16
- constructor(options) {
17
- var _a, _b, _c, _d;
18
- const valueType = (_a = options.valueType) !== null && _a !== void 0 ? _a : new ConditionType_1.ConditionType();
19
- super(V5BooleanAttribute.TYPE, Object.assign(Object.assign({}, options), { valueType, syntax: (_b = options.syntax) !== null && _b !== void 0 ? _b : new parser_expressions_1.CombinedParser([
20
- new parser_expressions_1.FunctionExpressionParser(),
21
- new parser_expressions_1.EvaluatedExpressionParser(),
22
- new parser_expressions_1.ShorthandExpressionParser(),
23
- new parser_expressions_1.ConstantExpressionParser((_c = options.valueType) !== null && _c !== void 0 ? _c : parser_type_system_1.booleanType)
24
- ]), defaultValueKind: V5Attribute_1.DefaultValueKind.SIZE, configurable: (_d = options.configurable) !== null && _d !== void 0 ? _d : true }));
25
- if (typeof this.options.defaultValue == 'boolean') {
26
- this.options.defaultValue = (0, AttributeDefaults_1.fanDefaultValue)(this.options.defaultValue);
27
- }
28
- }
29
- getEditorV5Syntax(helpers) {
30
- return helpers.typedBindingOrFunction({
31
- // Do not limit the type to boolean.
32
- // Very often the developer wants to set something based on the
33
- // presence of a non-boolean field.
34
- types: null,
35
- writable: false,
36
- constants: true
37
- }, this.options.defaultValue == null ? null : '' + this.options.defaultValue);
38
- }
39
- serialize() {
40
- return Object.assign(Object.assign({}, super.serialize()), { type: 'boolean' });
41
- }
42
- }
43
- exports.V5BooleanAttribute = V5BooleanAttribute;
44
- V5BooleanAttribute.TYPE = 'boolean-attribute';
45
- //# sourceMappingURL=V5BooleanAttribute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5BooleanAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5BooleanAttribute.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,2DAAsD;AACtD,+CAMuB;AAEvB,wEASyC;AACzC,wEAA8D;AAU9D;;GAEG;AACH,wBAAgC,SAAQ,yBAAuC;IAG7E,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC;IAC/C,CAAC;IAED,YAAY,OAA8C;;QACxD,MAAM,SAAS,SAAG,OAAO,CAAC,SAAS,mCAAI,IAAI,6BAAa,EAAE,CAAC;QAC3D,KAAK,CAAC,kBAAkB,CAAC,IAAI,kCACxB,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,gBAAgB,EAAE,8BAAgB,CAAC,IAAI,EACvC,YAAY,QAAE,OAAO,CAAC,YAAY,mCAAI,IAAI,IAC1C,CAAC;QACH,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,SAAS,EAAE,CAAC;YAClD,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAA,mCAAe,EAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED,iBAAiB,CAAI,OAA2B;QAC9C,OAAO,OAAO,CAAC,sBAAsB,CACnC;YACE,oCAAoC;YACpC,+DAA+D;YAC/D,mCAAmC;YACnC,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,IAAI;SAChB,EACD,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAC1E,CAAC;IACJ,CAAC;IAED,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,SAAS,IACf;IACJ,CAAC;CACF;;AA/CQ,uBAAI,GAAG,mBAAmB,CAAC","sourcesContent":["import { ConditionType } from './ConditionType';\nimport { fanDefaultValue } from './AttributeDefaults';\nimport {\n DefaultValueKind,\n V5Attribute,\n V5AttributeOptions,\n V5AttributeGenerics,\n DefaultValueType\n} from './V5Attribute';\nimport { V5EditorHelpers } from '../events/V5EditorContext';\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 V5BooleanAttributeGenerics extends V5AttributeGenerics {\n Options: V5AttributeOptions<DefaultValueType<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 V5BooleanAttribute extends V5Attribute<V5BooleanAttributeGenerics> {\n static TYPE = 'boolean-attribute';\n\n static isInstanceOf(attr: V5Attribute): attr is V5BooleanAttribute {\n return attr.type === V5BooleanAttribute.TYPE;\n }\n\n constructor(options: V5BooleanAttributeGenerics['Options']) {\n const valueType = options.valueType ?? new ConditionType();\n super(V5BooleanAttribute.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 defaultValueKind: DefaultValueKind.SIZE,\n configurable: options.configurable ?? true\n });\n if (typeof this.options.defaultValue == 'boolean') {\n this.options.defaultValue = fanDefaultValue(this.options.defaultValue);\n }\n }\n\n getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T {\n return helpers.typedBindingOrFunction(\n {\n // Do not limit the type to boolean.\n // Very often the developer wants to set something based on the\n // presence of a non-boolean field.\n types: null,\n writable: false,\n constants: true\n },\n this.options.defaultValue == null ? null : '' + this.options.defaultValue\n );\n }\n\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'boolean'\n };\n }\n}\n"]}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5ConstantBooleanAttribute = 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 V5Attribute_1 = require("./V5Attribute");
7
- /**
8
- * A boolean attribute that accepts constant text only.
9
- */
10
- class V5ConstantBooleanAttribute extends V5Attribute_1.V5Attribute {
11
- static isInstanceOf(attr) {
12
- return attr.type === V5ConstantBooleanAttribute.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(V5ConstantBooleanAttribute.TYPE, Object.assign(Object.assign({}, options), { syntax: new parser_expressions_1.ConstantExpressionParser(valueType), valueType }));
18
- }
19
- }
20
- exports.V5ConstantBooleanAttribute = V5ConstantBooleanAttribute;
21
- V5ConstantBooleanAttribute.TYPE = 'constant-boolean-attribute';
22
- //# sourceMappingURL=V5ConstantBooleanAttribute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5ConstantBooleanAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5ConstantBooleanAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAA+F;AAC/F,wEAA8D;AAC9D,+CAAqF;AAQrF;;GAEG;AACH,gCAAwC,SAAQ,yBAA+C;IAG7F,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,0BAA0B,CAAC,IAAI,CAAC;IACvD,CAAC;IAED,YAAY,OAAsD;;QAChE,MAAM,SAAS,SAAG,OAAO,CAAC,SAAS,mCAAI,gCAAW,CAAC;QACnD,KAAK,CAAC,0BAA0B,CAAC,IAAI,kCAChC,OAAO,KACV,MAAM,EAAE,IAAI,6CAAwB,CAAC,SAAS,CAAC,EAC/C,SAAS,IACT,CAAC;IACL,CAAC;CACF;;AAdQ,+BAAI,GAAG,4BAA4B,CAAC","sourcesContent":["import { ConstantExpression, ConstantExpressionParser } from '@ja-platform/parser-expressions';\nimport { booleanType } from '@ja-platform/parser-type-system';\nimport { V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';\n\nexport interface V5ConstantBooleanAttributeGenerics extends V5AttributeGenerics {\n Options: V5AttributeOptions<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 V5ConstantBooleanAttribute extends V5Attribute<V5ConstantBooleanAttributeGenerics> {\n static TYPE = 'constant-boolean-attribute';\n\n static isInstanceOf(attr: V5Attribute): attr is V5ConstantBooleanAttribute {\n return attr.type === V5ConstantBooleanAttribute.TYPE;\n }\n\n constructor(options: V5ConstantBooleanAttributeGenerics['Options']) {\n const valueType = options.valueType ?? booleanType;\n super(V5ConstantBooleanAttribute.TYPE, {\n ...options,\n syntax: new ConstantExpressionParser(valueType),\n valueType\n });\n }\n}\n"]}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5ConstantTextAttribute = 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 V5Attribute_1 = require("./V5Attribute");
7
- /**
8
- * A string attribute that accepts constant text only.
9
- */
10
- class V5ConstantTextAttribute extends V5Attribute_1.V5Attribute {
11
- static isInstanceOf(attr) {
12
- return attr.type === V5ConstantTextAttribute.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(V5ConstantTextAttribute.TYPE, Object.assign(Object.assign({}, options), { syntax: new parser_expressions_1.ConstantExpressionParser(valueType), valueType }));
18
- }
19
- }
20
- exports.V5ConstantTextAttribute = V5ConstantTextAttribute;
21
- V5ConstantTextAttribute.TYPE = 'constant-text-attribute';
22
- //# sourceMappingURL=V5ConstantTextAttribute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5ConstantTextAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5ConstantTextAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAA+F;AAC/F,wEAA2D;AAC3D,+CAAqF;AAQrF;;GAEG;AACH,6BAAqC,SAAQ,yBAA4C;IAGvF,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,uBAAuB,CAAC,IAAI,CAAC;IACpD,CAAC;IAED,YAAY,OAAmD;;QAC7D,MAAM,SAAS,SAAG,OAAO,CAAC,SAAS,mCAAI,6BAAQ,CAAC;QAChD,KAAK,CAAC,uBAAuB,CAAC,IAAI,kCAC7B,OAAO,KACV,MAAM,EAAE,IAAI,6CAAwB,CAAC,SAAS,CAAC,EAC/C,SAAS,IACT,CAAC;IACL,CAAC;CACF;;AAdQ,4BAAI,GAAG,yBAAyB,CAAC","sourcesContent":["import { ConstantExpression, ConstantExpressionParser } from '@ja-platform/parser-expressions';\nimport { textType } from '@ja-platform/parser-type-system';\nimport { V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';\n\nexport interface V5ConstantTextAttributeGenerics extends V5AttributeGenerics {\n Options: V5AttributeOptions<string, string>;\n Value: ConstantExpression | null;\n NormalizedValue: string;\n}\n\n/**\n * A string attribute that accepts constant text only.\n */\nexport class V5ConstantTextAttribute extends V5Attribute<V5ConstantTextAttributeGenerics> {\n static TYPE = 'constant-text-attribute';\n\n static isInstanceOf(attr: V5Attribute): attr is V5ConstantTextAttribute {\n return attr.type === V5ConstantTextAttribute.TYPE;\n }\n\n constructor(options: V5ConstantTextAttributeGenerics['Options']) {\n const valueType = options.valueType ?? textType;\n super(V5ConstantTextAttribute.TYPE, {\n ...options,\n syntax: new ConstantExpressionParser(valueType),\n valueType\n });\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5ContentTextAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5ContentTextAttribute.ts"],"names":[],"mappings":";;;AACA,uDAK2B;AAI3B,wDAAuD;AAIvD,4BAAoC,SAAQ,iCAI3C;IAGC,YAAY,OAAsC;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,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,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,2BAAI,GAAG,wBAAwB,CAAC","sourcesContent":["import { AttributeParseEvent, AttributeParseInput } from '../AttributeParseEvent';\nimport {\n CombinedTextExpression,\n V5TextAttribute,\n V5TextAttributeGenerics,\n V5TextAttributeOptions\n} from './V5TextAttribute';\nimport { StringifyDirective } from './V5Attribute';\nimport { ParsedNode } from '../parsed';\nimport { XMLParseEvent } from '../XMLParseEvent';\nimport { getAttribute } from '@journeyapps/common-xml';\n\nexport interface V5ContextTextAttributeOptions extends Omit<V5TextAttributeOptions, 'configurable'> {}\n\nexport class V5ContentTextAttribute extends V5TextAttribute<\n V5TextAttributeGenerics & {\n Options: V5ContextTextAttributeOptions;\n }\n> {\n static TYPE = 'content-text-attribute';\n\n constructor(options: V5ContextTextAttributeOptions) {\n super(options);\n this.type = V5ContentTextAttribute.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: V5TextAttributeGenerics['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"]}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5ExpressionAttribute = void 0;
4
- const parser_expressions_1 = require("@ja-platform/parser-expressions");
5
- const V5Attribute_1 = require("./V5Attribute");
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 V5ExpressionAttribute extends V5Attribute_1.V5Attribute {
12
- constructor(options) {
13
- var _a;
14
- super(V5ExpressionAttribute.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
- getEditorV5Syntax(helpers) {
21
- return helpers.typedBindingOrFunction({
22
- types: null,
23
- writable: false,
24
- constants: false
25
- });
26
- }
27
- }
28
- exports.V5ExpressionAttribute = V5ExpressionAttribute;
29
- V5ExpressionAttribute.TYPE = 'expression-attribute';
30
- //# sourceMappingURL=V5ExpressionAttribute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5ExpressionAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5ExpressionAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAOyC;AAEzC,+CAAiE;AAQjE;;;;GAIG;AACH,2BAAmC,SAAQ,yBAA0C;IAGnF,YAAY,OAAiD;;QAC3D,KAAK,CAAC,qBAAqB,CAAC,IAAI,kCAC3B,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;IAED,iBAAiB,CAAI,OAA2B;QAC9C,OAAO,OAAO,CAAC,sBAAsB,CAAC;YACpC,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IACL,CAAC;CACF;;AAtBQ,0BAAI,GAAG,sBAAsB,CAAC","sourcesContent":["import {\n CombinedParser,\n EvaluatedExpression,\n EvaluatedExpressionParser,\n FunctionExpressionParser,\n ShorthandExpression,\n ShorthandExpressionParser\n} from '@ja-platform/parser-expressions';\nimport { V5EditorHelpers } from '../events/V5EditorContext';\nimport { V5Attribute, V5AttributeGenerics } from './V5Attribute';\n\nexport type CombinedExpression = EvaluatedExpression | ShorthandExpression;\n\nexport interface V5ExpressionAttributeGenerics extends V5AttributeGenerics {\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 V5ExpressionAttribute extends V5Attribute<V5ExpressionAttributeGenerics> {\n static TYPE = 'expression-attribute';\n\n constructor(options: V5ExpressionAttributeGenerics['Options']) {\n super(V5ExpressionAttribute.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 getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T {\n return helpers.typedBindingOrFunction({\n types: null,\n writable: false,\n constants: false\n });\n }\n}\n"]}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5FunctionAttribute = void 0;
4
- const parser_expressions_1 = require("@ja-platform/parser-expressions");
5
- const V5Attribute_1 = require("./V5Attribute");
6
- class V5FunctionAttribute extends V5Attribute_1.V5Attribute {
7
- constructor(options) {
8
- var _a;
9
- super(V5FunctionAttribute.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.V5FunctionAttribute = V5FunctionAttribute;
13
- V5FunctionAttribute.TYPE = 'on-function-attribute';
14
- //# sourceMappingURL=V5FunctionAttribute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5FunctionAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5FunctionAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAA+F;AAC/F,+CAAiE;AAMjE,yBAAiC,SAAQ,yBAAwC;IAG/E,YAAY,OAA6D;;QACvE,KAAK,CAAC,mBAAmB,CAAC,IAAI,gCAC5B,SAAS,EAAE,KAAK,IACb,OAAO,KACV,MAAM,QAAE,OAAO,CAAC,MAAM,mCAAI,IAAI,6CAAwB,EAAE,IACxD,CAAC;IACL,CAAC;CACF;;AATQ,wBAAI,GAAG,uBAAuB,CAAC","sourcesContent":["import { FunctionExpression, FunctionExpressionParser } from '@ja-platform/parser-expressions';\nimport { V5Attribute, V5AttributeGenerics } from './V5Attribute';\n\nexport interface V5FunctionAttributeGenerics extends V5AttributeGenerics {\n Value: FunctionExpression | null;\n}\n\nexport class V5FunctionAttribute extends V5Attribute<V5FunctionAttributeGenerics> {\n static TYPE = 'on-function-attribute';\n\n constructor(options: Omit<V5AttributeGenerics['Options'], 'configurable'>) {\n super(V5FunctionAttribute.TYPE, {\n autoWatch: false,\n ...options,\n syntax: options.syntax ?? new FunctionExpressionParser()\n });\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5ListAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5ListAttribute.ts"],"names":[],"mappings":";;;AACA,+CAAqF;AAerF,qBAA6B,SAAQ,yBAAoC;IAGvE,YAAY,OAA2C;;QACrD,KAAK,CAAC,eAAe,CAAC,IAAI,kCACrB,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,IAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,IAAI,CAAC;IAC5C,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;IAED,iBAAiB,CAAI,OAA2B;QAC9C,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9E,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;;AAtCQ,oBAAI,GAAG,gBAAgB,CAAC","sourcesContent":["import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';\nimport { V5Attribute, V5AttributeGenerics, V5AttributeOptions } from './V5Attribute';\nimport { V5EditorHelpers } from '../events/V5EditorContext';\n\nexport type CombinedListExpression = EvaluatedExpression | ConstantExpression;\n\nexport interface V5ListAttributeOptions extends V5AttributeOptions<string[]> {\n options: string[];\n delimiter?: string;\n}\n\nexport interface V5ListAttributeGenerics extends V5AttributeGenerics {\n Value: CombinedListExpression | null;\n Options: V5ListAttributeOptions;\n}\n\nexport class V5ListAttribute extends V5Attribute<V5ListAttributeGenerics> {\n static TYPE = 'list-attribute';\n delimiter: string;\n constructor(options: V5ListAttributeGenerics['Options']) {\n super(V5ListAttribute.TYPE, {\n ...options,\n options: options.options || [],\n configurable: options.configurable ?? true\n });\n this.delimiter = options.delimiter ?? ',';\n }\n\n static isInstanceOf(attr: V5Attribute): attr is V5ListAttribute {\n return attr.type === V5ListAttribute.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\n getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T {\n return helpers.dynamicList(this.options.options, this.options.defaultValue);\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'list',\n options: this.options.options\n };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5NumberAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5NumberAttribute.ts"],"names":[],"mappings":";;;AACA,wEAA0F;AAC1F,wEAA6D;AAC7D,2DAAsD;AACtD,+CAMuB;AAqBvB,uBAA+B,SAAQ,yBAAsC;IAG3E,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,iBAAiB,CAAC,IAAI,CAAC;IAC9C,CAAC;IAED,YAAY,OAA6C;;QACvD,KAAK,CAAC,iBAAiB,CAAC,IAAI,kCACvB,OAAO,KACV,SAAS,QAAE,OAAO,CAAC,SAAS,mCAAI,+BAAU,EAC1C,gBAAgB,EAAE,8BAAgB,CAAC,I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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;IAED,iBAAiB,CAAI,OAA2B;QAC9C,OAAO,OAAO,CAAC,sBAAsB,CAAC;YACpC,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IACL,CAAC;IACD,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,QAAQ,IACd;IACJ,CAAC;CACF;;AAhEQ,sBAAI,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 { fanDefaultValue } from './AttributeDefaults';\nimport {\n DefaultValueType,\n DefaultValueKind,\n V5Attribute,\n V5AttributeGenerics,\n V5AttributeOptions\n} from './V5Attribute';\nimport { V5EditorHelpers } from '../events/V5EditorContext';\nimport type { V5Node } from '../nodes/V5Node';\n\nexport type CombinedNumberExpression = EvaluatedExpression | ConstantExpression<number>;\n\nexport interface V5NumberAttributeRange {\n min?: number;\n max?: number;\n}\n\nexport interface V5NumberAttributeOptions extends V5AttributeOptions<DefaultValueType<number>, number> {\n range?: V5NumberAttributeRange;\n}\n\nexport interface V5NumberAttributeGenerics extends V5AttributeGenerics {\n Options: V5NumberAttributeOptions;\n Value: CombinedNumberExpression | null;\n NormalizedValue: number;\n}\n\nexport class V5NumberAttribute extends V5Attribute<V5NumberAttributeGenerics> {\n static TYPE = 'number-attribute';\n\n static isInstanceOf(attr: V5Attribute): attr is V5NumberAttribute {\n return attr.type === V5NumberAttribute.TYPE;\n }\n\n constructor(options: V5NumberAttributeGenerics['Options']) {\n super(V5NumberAttribute.TYPE, {\n ...options,\n valueType: options.valueType ?? numberType,\n defaultValueKind: DefaultValueKind.SIZE,\n configurable: options.configurable ?? true\n });\n if (typeof this.options.defaultValue == 'number') {\n this.options.defaultValue = fanDefaultValue(this.options.defaultValue);\n }\n }\n\n protected getParsedValue(event: AttributeParseEvent): V5NumberAttributeGenerics['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: V5Node<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\n getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T {\n return helpers.typedBindingOrFunction({\n types: ['number'],\n writable: false,\n constants: false\n });\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'number'\n };\n }\n}\n"]}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5PathAttribute = void 0;
4
- const V5Attribute_1 = require("./V5Attribute");
5
- class V5PathAttribute extends V5Attribute_1.V5Attribute {
6
- constructor(options) {
7
- super(V5PathAttribute.TYPE, options);
8
- }
9
- serialize() {
10
- return Object.assign(Object.assign({}, super.serialize()), { type: 'path' });
11
- }
12
- }
13
- exports.V5PathAttribute = V5PathAttribute;
14
- V5PathAttribute.TYPE = 'path-attribute';
15
- //# sourceMappingURL=V5PathAttribue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5PathAttribue.js","sourceRoot":"","sources":["../../src/attributes/V5PathAttribue.ts"],"names":[],"mappings":";;;AACA,+CAAqF;AAQrF,qBAA6B,SAAQ,yBAAoC;IAGvE,YAAY,OAAiD;QAC3D,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IACD,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,MAAM,IACZ;IACJ,CAAC;CACF;;AAXQ,oBAAI,GAAG,gBAAgB,CAAC","sourcesContent":["import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';\nimport { V5Attribute, V5AttributeOptions, V5AttributeGenerics } from './V5Attribute';\n\nexport type CombinedPathExpression = EvaluatedExpression | ConstantExpression;\n\nexport interface V5PathAttributeGenerics extends V5AttributeGenerics {\n Value: CombinedPathExpression | null;\n}\n\nexport class V5PathAttribute extends V5Attribute<V5PathAttributeGenerics> {\n static TYPE = 'path-attribute';\n\n constructor(options: Omit<V5AttributeOptions, 'configurable'>) {\n super(V5PathAttribute.TYPE, options);\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'path'\n };\n }\n}\n"]}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5SetAttribute = void 0;
4
- const AttributeDefaults_1 = require("./AttributeDefaults");
5
- const V5Attribute_1 = require("./V5Attribute");
6
- class V5SetAttribute extends V5Attribute_1.V5Attribute {
7
- constructor(options) {
8
- var _a;
9
- super(V5SetAttribute.TYPE, Object.assign(Object.assign({}, options), { defaultValueKind: V5Attribute_1.DefaultValueKind.SIZE, configurable: (_a = options.configurable) !== null && _a !== void 0 ? _a : true, options: options.options || [] }));
10
- if (typeof this.options.defaultValue == 'string') {
11
- this.options.defaultValue = (0, AttributeDefaults_1.fanDefaultValue)(this.options.defaultValue);
12
- }
13
- }
14
- static isInstanceOf(attr) {
15
- return attr.type === V5SetAttribute.TYPE;
16
- }
17
- getEditorV5Syntax(helpers) {
18
- var _a;
19
- return helpers.dynamicSet(this.options.options, (_a = (this.options.defaultValue || {})[V5Attribute_1.ComponentSize.MEDIUM]) !== null && _a !== void 0 ? _a : this.options.defaultValue);
20
- }
21
- serialize() {
22
- return Object.assign(Object.assign({}, super.serialize()), { type: 'set', options: this.options.options });
23
- }
24
- }
25
- exports.V5SetAttribute = V5SetAttribute;
26
- V5SetAttribute.TYPE = 'set-attribute';
27
- //# sourceMappingURL=V5SetAttribute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5SetAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5SetAttribute.ts"],"names":[],"mappings":";;;AAEA,2DAAsD;AACtD,+CAOuB;AAavB,oBAA4B,SAAQ,yBAAmC;IAErE,YAAY,OAA8B;;QACxC,KAAK,CAAC,cAAc,CAAC,IAAI,kCACpB,OAAO,KACV,gBAAgB,EAAE,8BAAgB,CAAC,IAAI,EACvC,YAAY,QAAE,OAAO,CAAC,YAAY,mCAAI,IAAI,EAC1C,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE,IAC9B,CAAC;QAEH,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,QAAQ,EAAE,CAAC;YACjD,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAA,mCAAe,EAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,CAAC;IAC3C,CAAC;IAED,iBAAiB,CAAI,OAA2B;;QAC9C,OAAO,OAAO,CAAC,UAAU,CACvB,IAAI,CAAC,OAAO,CAAC,OAAO,QACpB,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,2BAAa,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CACrF,CAAC;IACJ,CAAC;IACD,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,IAC7B;IACJ,CAAC;CACF;;AA/BQ,mBAAI,GAAG,eAAe,CAAC","sourcesContent":["import type { EvaluatedExpression, ConstantExpression } from '@ja-platform/parser-expressions';\nimport { V5EditorHelpers } from '../events/V5EditorContext';\nimport { fanDefaultValue } from './AttributeDefaults';\nimport {\n ComponentSize,\n DefaultValueType,\n DefaultValueKind,\n V5Attribute,\n V5AttributeGenerics,\n V5AttributeOptions\n} from './V5Attribute';\n\nexport type CombinedSetExpression = EvaluatedExpression | ConstantExpression;\n\nexport interface V5SetAttributeOptions extends V5AttributeOptions<DefaultValueType<string>> {\n options: string[];\n}\n\nexport interface V5SetAttributeGenerics extends V5AttributeGenerics {\n Value: CombinedSetExpression | null;\n Options: V5SetAttributeOptions;\n}\n\nexport class V5SetAttribute extends V5Attribute<V5SetAttributeGenerics> {\n static TYPE = 'set-attribute';\n constructor(options: V5SetAttributeOptions) {\n super(V5SetAttribute.TYPE, {\n ...options,\n defaultValueKind: DefaultValueKind.SIZE,\n configurable: options.configurable ?? true,\n options: options.options || []\n });\n\n if (typeof this.options.defaultValue == 'string') {\n this.options.defaultValue = fanDefaultValue(this.options.defaultValue);\n }\n }\n\n static isInstanceOf(attr: V5Attribute): attr is V5SetAttribute {\n return attr.type === V5SetAttribute.TYPE;\n }\n\n getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T {\n return helpers.dynamicSet(\n this.options.options,\n (this.options.defaultValue || {})[ComponentSize.MEDIUM] ?? this.options.defaultValue\n );\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'set',\n options: this.options.options\n };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5TextArrayAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5TextArrayAttribute.ts"],"names":[],"mappings":";;;AAAA,wEAAiE;AACjE,2DAAsD;AAEtD,uDAAoD;AACpD,uDAAqG;AAUrG,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,iCAAe,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAED,0BAAkC,SAAQ,iCAA6C;IAIrF,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,oBAAoB,CAAC,IAAI,CAAC;IACjD,CAAC;IAED,YAAY,OAAgD;;QAC1D,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,oBAAoB,CAAC,IAAI,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACxC,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAA,mCAAe,EAAC,OAAO,CAAC,YAAY,CAE/D,CAAC;QACJ,CAAC;IACH,CAAC;IACD,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,OAAO,IACb;IACJ,CAAC;CACF;;AA9BQ,yBAAI,GAAG,YAAY,CAAC","sourcesContent":["import { Type, textType } from '@ja-platform/parser-type-system';\nimport { fanDefaultValue } from './AttributeDefaults';\nimport { ComponentSize, V5Attribute } from './V5Attribute';\nimport { V5ListAttribute } from './V5ListAttribute';\nimport { V5TextAttribute, V5TextAttributeGenerics, V5TextAttributeOptions } from './V5TextAttribute';\n\nexport interface V5TextArrayAttributeOptions extends V5TextAttributeOptions<string[]> {\n delimiter?: string;\n}\n\nexport interface V5TextArrayAttributeGenerics extends V5TextAttributeGenerics<string[]> {\n Options: V5TextArrayAttributeOptions;\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 V5ListAttribute.toList(value, this.delimiter);\n }\n}\n\nexport class V5TextArrayAttribute extends V5TextAttribute<V5TextArrayAttributeGenerics> {\n static TYPE = 'text-array';\n delimiter: string;\n\n static isInstanceOf(attr: V5Attribute): attr is V5TextArrayAttribute {\n return attr.type === V5TextArrayAttribute.TYPE;\n }\n\n constructor(options: V5TextArrayAttributeGenerics['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 = V5TextArrayAttribute.TYPE;\n this.delimiter = delimiter;\n\n if (Array.isArray(options.defaultValue)) {\n this.options.defaultValue = fanDefaultValue(options.defaultValue) as {\n [k in ComponentSize]: string[];\n };\n }\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'array'\n };\n }\n}\n"]}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V5TextAttribute = void 0;
4
- const AttributeDefaults_1 = require("./AttributeDefaults");
5
- const V5Attribute_1 = require("./V5Attribute");
6
- const parser_expressions_1 = require("@ja-platform/parser-expressions");
7
- const parser_type_system_1 = require("@ja-platform/parser-type-system");
8
- class V5TextAttribute extends V5Attribute_1.V5Attribute {
9
- constructor(options) {
10
- var _a, _b, _c;
11
- super(V5TextAttribute.TYPE, Object.assign(Object.assign({}, options), { valueType: (_a = options.valueType) !== null && _a !== void 0 ? _a : parser_type_system_1.textType, syntax: (_b = options.syntax) !== null && _b !== void 0 ? _b : new parser_expressions_1.CombinedParser([
12
- new parser_expressions_1.FunctionExpressionParser(),
13
- new parser_expressions_1.EvaluatedExpressionParser(),
14
- new parser_expressions_1.FormatStringExpressionParser()
15
- ]), defaultValueKind: V5Attribute_1.DefaultValueKind.SIZE, configurable: (_c = options.configurable) !== null && _c !== void 0 ? _c : true }));
16
- if (typeof this.options.defaultValue === 'string') {
17
- this.options.defaultValue = (0, AttributeDefaults_1.fanDefaultValue)(this.options.defaultValue);
18
- }
19
- }
20
- static isInstanceOf(attr) {
21
- return attr.type === V5TextAttribute.TYPE;
22
- }
23
- getParsedValue(event, parseContext = {}) {
24
- const expression = super.getParsedValue(event, parseContext);
25
- this.validateInput(event, expression, parseContext);
26
- return expression;
27
- }
28
- validateInput(event, expression, parseContext) {
29
- var _a, _b;
30
- (_b = (_a = event.helper).validateFormatAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, {
31
- element: event.element,
32
- attribute: this.options.name,
33
- scope: event.scope,
34
- expression
35
- });
36
- }
37
- getEditorV5Syntax(helpers) {
38
- if (!this.options.autoWatch) {
39
- // Ancestor tag that may contain a 'query' attribute, which determines the scope of this attribute.
40
- // Only used for auto-complete.
41
- // TODO: Replace with proper scope system at some point.
42
- return helpers.formatString(this.parent.getRootNode().options.name);
43
- }
44
- return helpers.formatString();
45
- }
46
- serialize() {
47
- return Object.assign(Object.assign({}, super.serialize()), { type: 'text' });
48
- }
49
- }
50
- exports.V5TextAttribute = V5TextAttribute;
51
- V5TextAttribute.TYPE = 'text-attribute';
52
- //# sourceMappingURL=V5TextAttribute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"V5TextAttribute.js","sourceRoot":"","sources":["../../src/attributes/V5TextAttribute.ts"],"names":[],"mappings":";;;AACA,2DAAsD;AACtD,+CAMuB;AAEvB,wEAOyC;AACzC,wEAA2D;AAY3D,qBAEE,SAAQ,yBAAc;IAGtB,YAAY,OAAqB;;QAC/B,KAAK,CAAC,eAAe,CAAC,IAAI,kCACrB,OAAO,KACV,SAAS,QAAE,OAAO,CAAC,SAAS,mCAAI,6BAAQ,EACxC,MAAM,QACJ,OAAO,CAAC,MAAM,mCACd,IAAI,mCAAc,CAAyB;gBACzC,IAAI,6CAAwB,EAAE;gBAC9B,IAAI,8CAAyB,EAAE;gBAC/B,IAAI,iDAA4B,EAAE;aACnC,CAAC,EACJ,gBAAgB,EAAE,8BAAgB,CAAC,IAAI,EACvC,YAAY,QAAE,OAAO,CAAC,YAAY,mCAAI,IAAI,IAC1C,CAAC;QACH,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;YAClD,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAA,mCAAe,EAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,IAAI,CAAC;IAC5C,CAAC;IAES,cAAc,CACtB,KAA0B,EAC1B,YAAY,GAAwB,EAAE;QAEtC,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC7D,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;QACpD,OAAO,UAAU,CAAC;IACpB,CAAC;IAES,aAAa,CACrB,KAA0B,EAC1B,UAAkC,EAClC,YAAiC;;QAEjC,MAAA,MAAA,KAAK,CAAC,MAAM,EAAC,uBAAuB,mDAAG;YACrC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB,CAAI,OAA2B;QAC9C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC5B,mGAAmG;YACnG,+BAA+B;YAC/B,wDAAwD;YACxD,OAAO,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,OAAO,CAAC,YAAY,EAAE,CAAC;IAChC,CAAC;IACD,SAAS;QACP,uCACK,KAAK,CAAC,SAAS,EAAE,KACpB,IAAI,EAAE,MAAM,IACZ;IACJ,CAAC;CACF;;AA9DQ,oBAAI,GAAG,gBAAgB,CAAC","sourcesContent":["import { AttributeParseEvent } from '../AttributeParseEvent';\nimport { fanDefaultValue } from './AttributeDefaults';\nimport {\n DefaultValueType,\n DefaultValueKind,\n V5Attribute,\n V5AttributeGenerics,\n V5AttributeOptions\n} from './V5Attribute';\nimport { V5EditorHelpers } from '../events/V5EditorContext';\nimport {\n FormatStringExpression,\n CombinedParser,\n FunctionExpressionParser,\n EvaluatedExpressionParser,\n FormatStringExpressionParser,\n EvaluatedExpression\n} from '@ja-platform/parser-expressions';\nimport { textType } from '@ja-platform/parser-type-system';\n\nexport type CombinedTextExpression = FormatStringExpression | EvaluatedExpression;\n\nexport type V5TextAttributeOptions<Value = string> = V5AttributeOptions<DefaultValueType<Value>, Value>;\n\nexport interface V5TextAttributeGenerics<Value = string> extends V5AttributeGenerics {\n Value: CombinedTextExpression | null;\n Options: V5TextAttributeOptions<Value>;\n NormalizedValue: Value;\n}\n\nexport class V5TextAttribute<\n T extends V5TextAttributeGenerics<unknown> = V5TextAttributeGenerics\n> extends V5Attribute<T> {\n static TYPE = 'text-attribute';\n\n constructor(options: T['Options']) {\n super(V5TextAttribute.TYPE, {\n ...options,\n valueType: options.valueType ?? textType,\n syntax:\n options.syntax ??\n new CombinedParser<CombinedTextExpression>([\n new FunctionExpressionParser(),\n new EvaluatedExpressionParser(),\n new FormatStringExpressionParser()\n ]),\n defaultValueKind: DefaultValueKind.SIZE,\n configurable: options.configurable ?? true\n });\n if (typeof this.options.defaultValue === 'string') {\n this.options.defaultValue = fanDefaultValue(this.options.defaultValue);\n }\n }\n\n static isInstanceOf(attr: V5Attribute): attr is V5TextAttribute<V5TextAttributeGenerics<unknown>> {\n return attr.type === V5TextAttribute.TYPE;\n }\n\n protected getParsedValue(\n event: AttributeParseEvent,\n parseContext: Record<string, any> = {}\n ): CombinedTextExpression | null {\n const expression = super.getParsedValue(event, parseContext);\n this.validateInput(event, expression, parseContext);\n return expression;\n }\n\n protected validateInput(\n event: AttributeParseEvent,\n expression: CombinedTextExpression,\n parseContext: Record<string, any>\n ): void {\n event.helper.validateFormatAttribute?.({\n element: event.element,\n attribute: this.options.name,\n scope: event.scope,\n expression\n });\n }\n\n getEditorV5Syntax<T>(helpers: V5EditorHelpers<T>): T {\n if (!this.options.autoWatch) {\n // Ancestor tag that may contain a 'query' attribute, which determines the scope of this attribute.\n // Only used for auto-complete.\n // TODO: Replace with proper scope system at some point.\n return helpers.formatString(this.parent.getRootNode().options.name);\n }\n return helpers.formatString();\n }\n serialize(): any {\n return {\n ...super.serialize(),\n type: 'text'\n };\n }\n}\n"]}