vsn 0.1.149 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/index.cjs +5011 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +630 -0
- package/dist/index.d.ts +630 -0
- package/dist/index.js +4942 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +9 -0
- package/dist/index.min.js.map +1 -0
- package/package.json +30 -48
- package/.gitattributes +0 -2
- package/.travis.yml +0 -28
- package/demo/demo.html +0 -237
- package/demo/examples/cascading-function-sheets.html +0 -39
- package/demo/examples/component-slots.html +0 -29
- package/demo/examples/events.html +0 -21
- package/demo/examples/item-filtering.html +0 -45
- package/demo/examples/loop.html +0 -21
- package/demo/examples/persist.html +0 -17
- package/demo/examples/replace-html.html +0 -19
- package/demo/markup-default.html +0 -2
- package/demo/markup.html +0 -2
- package/demo/memory-leak-test.html +0 -82
- package/demo/named-stack.html +0 -34
- package/demo/resources/xhr-animations.html +0 -24
- package/demo/resources/xhr-cfs.html +0 -1
- package/demo/resources/xhr-html.html +0 -1
- package/demo/resources/xhr-lazy.html +0 -60
- package/demo/resources/xhr-memory-leak-test.html +0 -14
- package/demo/resources/xhr-persist.html +0 -40
- package/demo/resources/xhr-test-component.html +0 -4
- package/demo/service.html +0 -22
- package/demo/silly-animations.html +0 -27
- package/demo/vsn.js +0 -3
- package/demo/xhr-response.html +0 -1
- package/demo/xhr-test.html +0 -32
- package/dist/AST/ArithmeticNode.d.ts +0 -15
- package/dist/AST/ArithmeticNode.js +0 -114
- package/dist/AST/ArithmeticNode.js.map +0 -1
- package/dist/AST/ArrayNode.d.ts +0 -14
- package/dist/AST/ArrayNode.js +0 -166
- package/dist/AST/ArrayNode.js.map +0 -1
- package/dist/AST/AsNode.d.ts +0 -13
- package/dist/AST/AsNode.js +0 -92
- package/dist/AST/AsNode.js.map +0 -1
- package/dist/AST/AssignmentNode.d.ts +0 -24
- package/dist/AST/AssignmentNode.js +0 -392
- package/dist/AST/AssignmentNode.js.map +0 -1
- package/dist/AST/BlockNode.d.ts +0 -11
- package/dist/AST/BlockNode.js +0 -114
- package/dist/AST/BlockNode.js.map +0 -1
- package/dist/AST/BooleanLiteralNode.d.ts +0 -5
- package/dist/AST/BooleanLiteralNode.js +0 -31
- package/dist/AST/BooleanLiteralNode.js.map +0 -1
- package/dist/AST/ClassNode.d.ts +0 -47
- package/dist/AST/ClassNode.js +0 -593
- package/dist/AST/ClassNode.js.map +0 -1
- package/dist/AST/ComparisonNode.d.ts +0 -15
- package/dist/AST/ComparisonNode.js +0 -120
- package/dist/AST/ComparisonNode.js.map +0 -1
- package/dist/AST/ConditionalNode.d.ts +0 -13
- package/dist/AST/ConditionalNode.js +0 -95
- package/dist/AST/ConditionalNode.js.map +0 -1
- package/dist/AST/DispatchEventNode.d.ts +0 -17
- package/dist/AST/DispatchEventNode.js +0 -152
- package/dist/AST/DispatchEventNode.js.map +0 -1
- package/dist/AST/ElementAttributeNode.d.ts +0 -20
- package/dist/AST/ElementAttributeNode.js +0 -242
- package/dist/AST/ElementAttributeNode.js.map +0 -1
- package/dist/AST/ElementQueryNode.d.ts +0 -17
- package/dist/AST/ElementQueryNode.js +0 -148
- package/dist/AST/ElementQueryNode.js.map +0 -1
- package/dist/AST/ElementStyleNode.d.ts +0 -20
- package/dist/AST/ElementStyleNode.js +0 -205
- package/dist/AST/ElementStyleNode.js.map +0 -1
- package/dist/AST/ForStatementNode.d.ts +0 -17
- package/dist/AST/ForStatementNode.js +0 -121
- package/dist/AST/ForStatementNode.js.map +0 -1
- package/dist/AST/FunctionArgumentNode.d.ts +0 -11
- package/dist/AST/FunctionArgumentNode.js +0 -142
- package/dist/AST/FunctionArgumentNode.js.map +0 -1
- package/dist/AST/FunctionCallNode.d.ts +0 -14
- package/dist/AST/FunctionCallNode.js +0 -241
- package/dist/AST/FunctionCallNode.js.map +0 -1
- package/dist/AST/FunctionNode.d.ts +0 -20
- package/dist/AST/FunctionNode.js +0 -220
- package/dist/AST/FunctionNode.js.map +0 -1
- package/dist/AST/IfStatementNode.d.ts +0 -14
- package/dist/AST/IfStatementNode.js +0 -168
- package/dist/AST/IfStatementNode.js.map +0 -1
- package/dist/AST/InNode.d.ts +0 -15
- package/dist/AST/InNode.js +0 -107
- package/dist/AST/InNode.js.map +0 -1
- package/dist/AST/IndexNode.d.ts +0 -16
- package/dist/AST/IndexNode.js +0 -152
- package/dist/AST/IndexNode.js.map +0 -1
- package/dist/AST/LiteralNode.d.ts +0 -10
- package/dist/AST/LiteralNode.js +0 -74
- package/dist/AST/LiteralNode.js.map +0 -1
- package/dist/AST/LoopNode.d.ts +0 -12
- package/dist/AST/LoopNode.js +0 -121
- package/dist/AST/LoopNode.js.map +0 -1
- package/dist/AST/ModifierNode.d.ts +0 -14
- package/dist/AST/ModifierNode.js +0 -90
- package/dist/AST/ModifierNode.js.map +0 -1
- package/dist/AST/NamedStackNode.d.ts +0 -28
- package/dist/AST/NamedStackNode.js +0 -142
- package/dist/AST/NamedStackNode.js.map +0 -1
- package/dist/AST/Node.d.ts +0 -28
- package/dist/AST/Node.js +0 -263
- package/dist/AST/Node.js.map +0 -1
- package/dist/AST/NotNode.d.ts +0 -12
- package/dist/AST/NotNode.js +0 -103
- package/dist/AST/NotNode.js.map +0 -1
- package/dist/AST/NumberLiteralNode.d.ts +0 -5
- package/dist/AST/NumberLiteralNode.js +0 -36
- package/dist/AST/NumberLiteralNode.js.map +0 -1
- package/dist/AST/ObjectNode.d.ts +0 -14
- package/dist/AST/ObjectNode.js +0 -147
- package/dist/AST/ObjectNode.js.map +0 -1
- package/dist/AST/OnNode.d.ts +0 -9
- package/dist/AST/OnNode.js +0 -129
- package/dist/AST/OnNode.js.map +0 -1
- package/dist/AST/RootScopeMemberNode.d.ts +0 -12
- package/dist/AST/RootScopeMemberNode.js +0 -90
- package/dist/AST/RootScopeMemberNode.js.map +0 -1
- package/dist/AST/ScopeMemberNode.d.ts +0 -13
- package/dist/AST/ScopeMemberNode.js +0 -165
- package/dist/AST/ScopeMemberNode.js.map +0 -1
- package/dist/AST/ScopeNodeAbstract.d.ts +0 -8
- package/dist/AST/ScopeNodeAbstract.js +0 -105
- package/dist/AST/ScopeNodeAbstract.js.map +0 -1
- package/dist/AST/StringFormatNode.d.ts +0 -18
- package/dist/AST/StringFormatNode.js +0 -151
- package/dist/AST/StringFormatNode.js.map +0 -1
- package/dist/AST/UnitLiteralNode.d.ts +0 -15
- package/dist/AST/UnitLiteralNode.js +0 -72
- package/dist/AST/UnitLiteralNode.js.map +0 -1
- package/dist/AST/WASM/Context.d.ts +0 -4
- package/dist/AST/WASM/Context.js +0 -18
- package/dist/AST/WASM/Context.js.map +0 -1
- package/dist/AST/WASM/Function.d.ts +0 -22
- package/dist/AST/WASM/Function.js +0 -126
- package/dist/AST/WASM/Function.js.map +0 -1
- package/dist/AST/WASM/Memory.d.ts +0 -12
- package/dist/AST/WASM/Memory.js +0 -22
- package/dist/AST/WASM/Memory.js.map +0 -1
- package/dist/AST/WASM/Section.d.ts +0 -5
- package/dist/AST/WASM/Section.js +0 -11
- package/dist/AST/WASM/Section.js.map +0 -1
- package/dist/AST/WASM.d.ts +0 -58
- package/dist/AST/WASM.js +0 -293
- package/dist/AST/WASM.js.map +0 -1
- package/dist/AST/WithNode.d.ts +0 -15
- package/dist/AST/WithNode.js +0 -197
- package/dist/AST/WithNode.js.map +0 -1
- package/dist/AST/XHRNode.d.ts +0 -15
- package/dist/AST/XHRNode.js +0 -151
- package/dist/AST/XHRNode.js.map +0 -1
- package/dist/AST.d.ts +0 -160
- package/dist/AST.js +0 -1156
- package/dist/AST.js.map +0 -1
- package/dist/Attribute.d.ts +0 -46
- package/dist/Attribute.js +0 -262
- package/dist/Attribute.js.map +0 -1
- package/dist/Bencmark.d.ts +0 -14
- package/dist/Bencmark.js +0 -236
- package/dist/Bencmark.js.map +0 -1
- package/dist/Component.d.ts +0 -7
- package/dist/Component.js +0 -179
- package/dist/Component.js.map +0 -1
- package/dist/Configuration.d.ts +0 -12
- package/dist/Configuration.js +0 -64
- package/dist/Configuration.js.map +0 -1
- package/dist/Controller.d.ts +0 -13
- package/dist/Controller.js +0 -60
- package/dist/Controller.js.map +0 -1
- package/dist/DOM/AbstractDOM.d.ts +0 -56
- package/dist/DOM/AbstractDOM.js +0 -1078
- package/dist/DOM/AbstractDOM.js.map +0 -1
- package/dist/DOM/DOMObject.d.ts +0 -33
- package/dist/DOM/DOMObject.js +0 -152
- package/dist/DOM/DOMObject.js.map +0 -1
- package/dist/DOM/ShadowDOM.d.ts +0 -5
- package/dist/DOM/ShadowDOM.js +0 -32
- package/dist/DOM/ShadowDOM.js.map +0 -1
- package/dist/DOM/WrappedDocument.d.ts +0 -5
- package/dist/DOM/WrappedDocument.js +0 -34
- package/dist/DOM/WrappedDocument.js.map +0 -1
- package/dist/DOM/WrappedWindow.d.ts +0 -6
- package/dist/DOM/WrappedWindow.js +0 -45
- package/dist/DOM/WrappedWindow.js.map +0 -1
- package/dist/DOM.d.ts +0 -5
- package/dist/DOM.js +0 -37
- package/dist/DOM.js.map +0 -1
- package/dist/EventDispatcher.d.ts +0 -36
- package/dist/EventDispatcher.js +0 -393
- package/dist/EventDispatcher.js.map +0 -1
- package/dist/Formats.d.ts +0 -5
- package/dist/Formats.js +0 -47
- package/dist/Formats.js.map +0 -1
- package/dist/MessageList.d.ts +0 -15
- package/dist/MessageList.js +0 -127
- package/dist/MessageList.js.map +0 -1
- package/dist/Model.d.ts +0 -12
- package/dist/Model.js +0 -92
- package/dist/Model.js.map +0 -1
- package/dist/Modifiers.d.ts +0 -17
- package/dist/Modifiers.js +0 -100
- package/dist/Modifiers.js.map +0 -1
- package/dist/Query.d.ts +0 -4
- package/dist/Query.js +0 -66
- package/dist/Query.js.map +0 -1
- package/dist/Registry.d.ts +0 -41
- package/dist/Registry.js +0 -165
- package/dist/Registry.js.map +0 -1
- package/dist/Scope/DynamicScopeData.d.ts +0 -6
- package/dist/Scope/DynamicScopeData.js +0 -83
- package/dist/Scope/DynamicScopeData.js.map +0 -1
- package/dist/Scope/ObjectAccessor.d.ts +0 -7
- package/dist/Scope/ObjectAccessor.js +0 -40
- package/dist/Scope/ObjectAccessor.js.map +0 -1
- package/dist/Scope/QueryReference.d.ts +0 -10
- package/dist/Scope/QueryReference.js +0 -103
- package/dist/Scope/QueryReference.js.map +0 -1
- package/dist/Scope/ScopeAbstract.d.ts +0 -9
- package/dist/Scope/ScopeAbstract.js +0 -28
- package/dist/Scope/ScopeAbstract.js.map +0 -1
- package/dist/Scope/ScopeData.d.ts +0 -4
- package/dist/Scope/ScopeData.js +0 -60
- package/dist/Scope/ScopeData.js.map +0 -1
- package/dist/Scope/ScopeDataAbstract.d.ts +0 -30
- package/dist/Scope/ScopeDataAbstract.js +0 -303
- package/dist/Scope/ScopeDataAbstract.js.map +0 -1
- package/dist/Scope/ScopeObject.d.ts +0 -3
- package/dist/Scope/ScopeObject.js +0 -28
- package/dist/Scope/ScopeObject.js.map +0 -1
- package/dist/Scope/ScopeReference.d.ts +0 -10
- package/dist/Scope/ScopeReference.js +0 -73
- package/dist/Scope/ScopeReference.js.map +0 -1
- package/dist/Scope/ScopedVariableType.d.ts +0 -6
- package/dist/Scope/ScopedVariableType.js +0 -14
- package/dist/Scope/ScopedVariableType.js.map +0 -1
- package/dist/Scope/WrappedArray.d.ts +0 -21
- package/dist/Scope/WrappedArray.js +0 -252
- package/dist/Scope/WrappedArray.js.map +0 -1
- package/dist/Scope/properties/ArrayProperty.d.ts +0 -12
- package/dist/Scope/properties/ArrayProperty.js +0 -88
- package/dist/Scope/properties/ArrayProperty.js.map +0 -1
- package/dist/Scope/properties/FloatProperty.d.ts +0 -4
- package/dist/Scope/properties/FloatProperty.js +0 -30
- package/dist/Scope/properties/FloatProperty.js.map +0 -1
- package/dist/Scope/properties/IntegerProperty.d.ts +0 -4
- package/dist/Scope/properties/IntegerProperty.js +0 -30
- package/dist/Scope/properties/IntegerProperty.js.map +0 -1
- package/dist/Scope/properties/Property.d.ts +0 -30
- package/dist/Scope/properties/Property.js +0 -205
- package/dist/Scope/properties/Property.js.map +0 -1
- package/dist/Scope/properties/_imports.d.ts +0 -4
- package/dist/Scope/properties/_imports.js +0 -13
- package/dist/Scope/properties/_imports.js.map +0 -1
- package/dist/Scope.d.ts +0 -39
- package/dist/Scope.js +0 -434
- package/dist/Scope.js.map +0 -1
- package/dist/Service.d.ts +0 -9
- package/dist/Service.js +0 -49
- package/dist/Service.js.map +0 -1
- package/dist/Tag/ShadowRootTag.d.ts +0 -3
- package/dist/Tag/ShadowRootTag.js +0 -28
- package/dist/Tag/ShadowRootTag.js.map +0 -1
- package/dist/Tag/SlotTag.d.ts +0 -3
- package/dist/Tag/SlotTag.js +0 -28
- package/dist/Tag/SlotTag.js.map +0 -1
- package/dist/Tag/SlottedTag.d.ts +0 -7
- package/dist/Tag/SlottedTag.js +0 -78
- package/dist/Tag/SlottedTag.js.map +0 -1
- package/dist/Tag/TagList.d.ts +0 -13
- package/dist/Tag/TagList.js +0 -104
- package/dist/Tag/TagList.js.map +0 -1
- package/dist/Tag.d.ts +0 -117
- package/dist/Tag.js +0 -1471
- package/dist/Tag.js.map +0 -1
- package/dist/Types.d.ts +0 -8
- package/dist/Types.js +0 -54
- package/dist/Types.js.map +0 -1
- package/dist/Validators.d.ts +0 -7
- package/dist/Validators.js +0 -54
- package/dist/Validators.js.map +0 -1
- package/dist/attributes/AddClassIf.d.ts +0 -4
- package/dist/attributes/AddClassIf.js +0 -93
- package/dist/attributes/AddClassIf.js.map +0 -1
- package/dist/attributes/Bind.d.ts +0 -24
- package/dist/attributes/Bind.js +0 -273
- package/dist/attributes/Bind.js.map +0 -1
- package/dist/attributes/ComponentAttribute.d.ts +0 -5
- package/dist/attributes/ComponentAttribute.js +0 -110
- package/dist/attributes/ComponentAttribute.js.map +0 -1
- package/dist/attributes/ControllerAttribute.d.ts +0 -11
- package/dist/attributes/ControllerAttribute.js +0 -127
- package/dist/attributes/ControllerAttribute.js.map +0 -1
- package/dist/attributes/DisableIf.d.ts +0 -5
- package/dist/attributes/DisableIf.js +0 -94
- package/dist/attributes/DisableIf.js.map +0 -1
- package/dist/attributes/Exec.d.ts +0 -10
- package/dist/attributes/Exec.js +0 -133
- package/dist/attributes/Exec.js.map +0 -1
- package/dist/attributes/Format.d.ts +0 -5
- package/dist/attributes/Format.js +0 -99
- package/dist/attributes/Format.js.map +0 -1
- package/dist/attributes/If.d.ts +0 -11
- package/dist/attributes/If.js +0 -159
- package/dist/attributes/If.js.map +0 -1
- package/dist/attributes/JSONAttribute.d.ts +0 -5
- package/dist/attributes/JSONAttribute.js +0 -119
- package/dist/attributes/JSONAttribute.js.map +0 -1
- package/dist/attributes/KeyAbstract.d.ts +0 -7
- package/dist/attributes/KeyAbstract.js +0 -117
- package/dist/attributes/KeyAbstract.js.map +0 -1
- package/dist/attributes/KeyDown.d.ts +0 -4
- package/dist/attributes/KeyDown.js +0 -88
- package/dist/attributes/KeyDown.js.map +0 -1
- package/dist/attributes/KeyUp.d.ts +0 -4
- package/dist/attributes/KeyUp.js +0 -88
- package/dist/attributes/KeyUp.js.map +0 -1
- package/dist/attributes/LazyAttribute.d.ts +0 -8
- package/dist/attributes/LazyAttribute.js +0 -122
- package/dist/attributes/LazyAttribute.js.map +0 -1
- package/dist/attributes/List.d.ts +0 -18
- package/dist/attributes/List.js +0 -396
- package/dist/attributes/List.js.map +0 -1
- package/dist/attributes/ListItem.d.ts +0 -12
- package/dist/attributes/ListItem.js +0 -119
- package/dist/attributes/ListItem.js.map +0 -1
- package/dist/attributes/ListItemModel.d.ts +0 -4
- package/dist/attributes/ListItemModel.js +0 -39
- package/dist/attributes/ListItemModel.js.map +0 -1
- package/dist/attributes/ModelAttribute.d.ts +0 -5
- package/dist/attributes/ModelAttribute.js +0 -41
- package/dist/attributes/ModelAttribute.js.map +0 -1
- package/dist/attributes/Name.d.ts +0 -6
- package/dist/attributes/Name.js +0 -88
- package/dist/attributes/Name.js.map +0 -1
- package/dist/attributes/On.d.ts +0 -9
- package/dist/attributes/On.js +0 -135
- package/dist/attributes/On.js.map +0 -1
- package/dist/attributes/PersistAttribute.d.ts +0 -15
- package/dist/attributes/PersistAttribute.js +0 -215
- package/dist/attributes/PersistAttribute.js.map +0 -1
- package/dist/attributes/Referenced.d.ts +0 -3
- package/dist/attributes/Referenced.js +0 -38
- package/dist/attributes/Referenced.js.map +0 -1
- package/dist/attributes/RootAttribute.d.ts +0 -7
- package/dist/attributes/RootAttribute.js +0 -141
- package/dist/attributes/RootAttribute.js.map +0 -1
- package/dist/attributes/ScopeAttribute.d.ts +0 -9
- package/dist/attributes/ScopeAttribute.js +0 -152
- package/dist/attributes/ScopeAttribute.js.map +0 -1
- package/dist/attributes/ScopeChange.d.ts +0 -10
- package/dist/attributes/ScopeChange.js +0 -153
- package/dist/attributes/ScopeChange.js.map +0 -1
- package/dist/attributes/ScriptAttribute.d.ts +0 -4
- package/dist/attributes/ScriptAttribute.js +0 -45
- package/dist/attributes/ScriptAttribute.js.map +0 -1
- package/dist/attributes/ServiceAttribute.d.ts +0 -7
- package/dist/attributes/ServiceAttribute.js +0 -45
- package/dist/attributes/ServiceAttribute.js.map +0 -1
- package/dist/attributes/SetAttribute.d.ts +0 -11
- package/dist/attributes/SetAttribute.js +0 -146
- package/dist/attributes/SetAttribute.js.map +0 -1
- package/dist/attributes/StandardAttribute.d.ts +0 -15
- package/dist/attributes/StandardAttribute.js +0 -170
- package/dist/attributes/StandardAttribute.js.map +0 -1
- package/dist/attributes/StyleAttribute.d.ts +0 -14
- package/dist/attributes/StyleAttribute.js +0 -218
- package/dist/attributes/StyleAttribute.js.map +0 -1
- package/dist/attributes/StyleVarAttribute.d.ts +0 -11
- package/dist/attributes/StyleVarAttribute.js +0 -124
- package/dist/attributes/StyleVarAttribute.js.map +0 -1
- package/dist/attributes/TemplateAttribute.d.ts +0 -5
- package/dist/attributes/TemplateAttribute.js +0 -89
- package/dist/attributes/TemplateAttribute.js.map +0 -1
- package/dist/attributes/TypeAttribute.d.ts +0 -5
- package/dist/attributes/TypeAttribute.js +0 -104
- package/dist/attributes/TypeAttribute.js.map +0 -1
- package/dist/attributes/XHRAttribute.d.ts +0 -14
- package/dist/attributes/XHRAttribute.js +0 -242
- package/dist/attributes/XHRAttribute.js.map +0 -1
- package/dist/attributes/_imports.d.ts +0 -32
- package/dist/attributes/_imports.js +0 -68
- package/dist/attributes/_imports.js.map +0 -1
- package/dist/contrib/XHR.d.ts +0 -21
- package/dist/contrib/XHR.js +0 -78
- package/dist/contrib/XHR.js.map +0 -1
- package/dist/contrib/_imports.d.ts +0 -1
- package/dist/contrib/_imports.js +0 -6
- package/dist/contrib/_imports.js.map +0 -1
- package/dist/custom-elements.d.ts +0 -9
- package/dist/custom-elements.js +0 -44
- package/dist/custom-elements.js.map +0 -1
- package/dist/demo/ServiceDemo.d.ts +0 -5
- package/dist/demo/ServiceDemo.js +0 -87
- package/dist/demo/ServiceDemo.js.map +0 -1
- package/dist/demo.d.ts +0 -2
- package/dist/demo.js +0 -17
- package/dist/demo.js.map +0 -1
- package/dist/helpers/DOMHelper.d.ts +0 -3
- package/dist/helpers/DOMHelper.js +0 -81
- package/dist/helpers/DOMHelper.js.map +0 -1
- package/dist/helpers/ElementHelper.d.ts +0 -4
- package/dist/helpers/ElementHelper.js +0 -53
- package/dist/helpers/ElementHelper.js.map +0 -1
- package/dist/helpers/VisionHelper.d.ts +0 -13
- package/dist/helpers/VisionHelper.js +0 -148
- package/dist/helpers/VisionHelper.js.map +0 -1
- package/dist/helpers/decorators.d.ts +0 -5
- package/dist/helpers/decorators.js +0 -59
- package/dist/helpers/decorators.js.map +0 -1
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -5
- package/dist/version.js.map +0 -1
- package/dist/vsn.d.ts +0 -36
- package/dist/vsn.js +0 -201
- package/dist/vsn.js.map +0 -1
- package/karma.conf.js +0 -34
- package/src/AST/ArithmeticNode.ts +0 -52
- package/src/AST/ArrayNode.ts +0 -39
- package/src/AST/AsNode.ts +0 -32
- package/src/AST/AssignmentNode.ts +0 -256
- package/src/AST/BlockNode.ts +0 -25
- package/src/AST/BooleanLiteralNode.ts +0 -10
- package/src/AST/ClassNode.ts +0 -267
- package/src/AST/ComparisonNode.ts +0 -57
- package/src/AST/ConditionalNode.ts +0 -36
- package/src/AST/DispatchEventNode.ts +0 -58
- package/src/AST/ElementAttributeNode.ts +0 -97
- package/src/AST/ElementQueryNode.ts +0 -48
- package/src/AST/ElementStyleNode.ts +0 -74
- package/src/AST/ForStatementNode.ts +0 -59
- package/src/AST/FunctionArgumentNode.ts +0 -27
- package/src/AST/FunctionCallNode.ts +0 -93
- package/src/AST/FunctionNode.ts +0 -82
- package/src/AST/IfStatementNode.ts +0 -67
- package/src/AST/InNode.ts +0 -46
- package/src/AST/IndexNode.ts +0 -64
- package/src/AST/LiteralNode.ts +0 -17
- package/src/AST/LoopNode.ts +0 -35
- package/src/AST/ModifierNode.ts +0 -32
- package/src/AST/NamedStackNode.ts +0 -83
- package/src/AST/Node.ts +0 -104
- package/src/AST/NotNode.ts +0 -41
- package/src/AST/NumberLiteralNode.ts +0 -14
- package/src/AST/ObjectNode.ts +0 -55
- package/src/AST/OnNode.ts +0 -23
- package/src/AST/RootScopeMemberNode.ts +0 -27
- package/src/AST/ScopeMemberNode.ts +0 -63
- package/src/AST/ScopeNodeAbstract.ts +0 -21
- package/src/AST/StringFormatNode.ts +0 -43
- package/src/AST/UnitLiteralNode.ts +0 -51
- package/src/AST/WASM/Context.ts +0 -12
- package/src/AST/WASM/Function.ts +0 -67
- package/src/AST/WASM/Memory.ts +0 -21
- package/src/AST/WASM/Section.ts +0 -6
- package/src/AST/WASM.ts +0 -244
- package/src/AST/WithNode.ts +0 -68
- package/src/AST/XHRNode.ts +0 -85
- package/src/AST.ts +0 -969
- package/src/Attribute.ts +0 -130
- package/src/Bencmark.ts +0 -184
- package/src/Component.ts +0 -63
- package/src/Configuration.ts +0 -47
- package/src/Controller.ts +0 -36
- package/src/DOM/AbstractDOM.ts +0 -465
- package/src/DOM/DOMObject.ts +0 -77
- package/src/DOM/ShadowDOM.ts +0 -15
- package/src/DOM/WrappedDocument.ts +0 -9
- package/src/DOM/WrappedWindow.ts +0 -21
- package/src/DOM.ts +0 -13
- package/src/EventDispatcher.ts +0 -234
- package/src/Formats.ts +0 -33
- package/src/MessageList.ts +0 -85
- package/src/Model.ts +0 -44
- package/src/Modifiers.ts +0 -54
- package/src/Query.ts +0 -17
- package/src/Registry.ts +0 -141
- package/src/Scope/DynamicScopeData.ts +0 -27
- package/src/Scope/ObjectAccessor.ts +0 -21
- package/src/Scope/QueryReference.ts +0 -29
- package/src/Scope/ScopeAbstract.ts +0 -11
- package/src/Scope/ScopeData.ts +0 -20
- package/src/Scope/ScopeDataAbstract.ts +0 -200
- package/src/Scope/ScopeObject.ts +0 -3
- package/src/Scope/ScopeReference.ts +0 -30
- package/src/Scope/ScopedVariableType.ts +0 -7
- package/src/Scope/WrappedArray.ts +0 -134
- package/src/Scope/properties/ArrayProperty.ts +0 -46
- package/src/Scope/properties/FloatProperty.ts +0 -5
- package/src/Scope/properties/IntegerProperty.ts +0 -5
- package/src/Scope/properties/Property.ts +0 -173
- package/src/Scope/properties/_imports.ts +0 -4
- package/src/Scope.ts +0 -333
- package/src/Service.ts +0 -24
- package/src/Tag/ShadowRootTag.ts +0 -5
- package/src/Tag/SlotTag.ts +0 -5
- package/src/Tag/SlottedTag.ts +0 -17
- package/src/Tag/TagList.ts +0 -52
- package/src/Tag.ts +0 -838
- package/src/Types.ts +0 -34
- package/src/Validators.ts +0 -45
- package/src/attributes/AddClassIf.ts +0 -14
- package/src/attributes/Bind.ts +0 -144
- package/src/attributes/ComponentAttribute.ts +0 -23
- package/src/attributes/ControllerAttribute.ts +0 -50
- package/src/attributes/DisableIf.ts +0 -16
- package/src/attributes/Exec.ts +0 -32
- package/src/attributes/Format.ts +0 -18
- package/src/attributes/If.ts +0 -40
- package/src/attributes/JSONAttribute.ts +0 -40
- package/src/attributes/KeyAbstract.ts +0 -28
- package/src/attributes/KeyDown.ts +0 -10
- package/src/attributes/KeyUp.ts +0 -10
- package/src/attributes/LazyAttribute.ts +0 -30
- package/src/attributes/List.ts +0 -210
- package/src/attributes/ListItem.ts +0 -30
- package/src/attributes/ListItemModel.ts +0 -7
- package/src/attributes/ModelAttribute.ts +0 -8
- package/src/attributes/Name.ts +0 -16
- package/src/attributes/On.ts +0 -39
- package/src/attributes/PersistAttribute.ts +0 -83
- package/src/attributes/Referenced.ts +0 -5
- package/src/attributes/RootAttribute.ts +0 -24
- package/src/attributes/ScopeAttribute.ts +0 -40
- package/src/attributes/ScopeChange.ts +0 -35
- package/src/attributes/ScriptAttribute.ts +0 -9
- package/src/attributes/ServiceAttribute.ts +0 -13
- package/src/attributes/SetAttribute.ts +0 -44
- package/src/attributes/StandardAttribute.ts +0 -72
- package/src/attributes/StyleAttribute.ts +0 -90
- package/src/attributes/StyleVarAttribute.ts +0 -40
- package/src/attributes/TemplateAttribute.ts +0 -12
- package/src/attributes/TypeAttribute.ts +0 -23
- package/src/attributes/XHRAttribute.ts +0 -109
- package/src/attributes/_imports.ts +0 -32
- package/src/contrib/XHR.ts +0 -46
- package/src/contrib/_imports.ts +0 -1
- package/src/custom-elements.ts +0 -46
- package/src/demo/ServiceDemo.ts +0 -12
- package/src/demo.ts +0 -2
- package/src/helpers/DOMHelper.ts +0 -17
- package/src/helpers/ElementHelper.ts +0 -26
- package/src/helpers/VisionHelper.ts +0 -88
- package/src/helpers/decorators.ts +0 -11
- package/src/version.ts +0 -2
- package/src/vsn.ts +0 -106
- package/test/AST/ArithmeticAssignmentNode.spec.ts +0 -45
- package/test/AST/ClassNode.spec.ts +0 -175
- package/test/AST/FunctionNode.spec.ts +0 -51
- package/test/AST/StringFormatNode.spec.ts +0 -12
- package/test/AST/WASM.spec.ts +0 -63
- package/test/AST/XHRNode.spec.ts +0 -10
- package/test/AST.spec.ts +0 -353
- package/test/Controller.spec.ts +0 -42
- package/test/DOM.spec.ts +0 -63
- package/test/EventDispatcher.spec.ts +0 -191
- package/test/MessageList.spec.ts +0 -101
- package/test/Model/DataModel.spec.ts +0 -0
- package/test/Scope/DynamicScopeData.spec.ts +0 -141
- package/test/Scope/ScopeData.spec.ts +0 -58
- package/test/Scope/WrappedArray.spec.ts +0 -11
- package/test/Scope/properties/ArrayProperty.spec.ts +0 -23
- package/test/Scope.spec.ts +0 -69
- package/test/Tag/TagList.spec.ts +0 -21
- package/test/Tag.spec.ts +0 -4
- package/test/attributes/Bind.spec.ts +0 -174
- package/test/attributes/JSONAttribute.spec.ts +0 -91
- package/test/attributes/ListItem.spec.ts +0 -118
- package/test/attributes/ScopeAttribute.spec.ts +0 -35
- package/test/attributes/ServiceAttribute.spec.ts +0 -41
- package/test/attributes/SetAttribute.spec.ts +0 -55
- package/test/attributes/Styles.spec.ts +0 -43
- package/test/globals.js +0 -2
- package/tsconfig.base.json +0 -17
- package/tsconfig.json +0 -6
- package/tsconfig.test.json +0 -7
- package/types/vsn-component.d.ts +0 -5
- package/webpack.config.js +0 -48
- package/webpack.development.js +0 -6
- package/webpack.production.js +0 -5
package/test/AST.spec.ts
DELETED
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
import {WrappedArray} from '../src/Scope/WrappedArray';
|
|
2
|
-
import {Scope} from "../src/Scope";
|
|
3
|
-
import {Tree} from "../src/AST";
|
|
4
|
-
import {DOM} from "../src/DOM";
|
|
5
|
-
|
|
6
|
-
describe('Tree', () => {
|
|
7
|
-
let scope: Scope = null,
|
|
8
|
-
scope2: Scope = null;
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
scope = new Scope();
|
|
12
|
-
scope2 = new Scope();
|
|
13
|
-
scope.set('foo', 2);
|
|
14
|
-
scope.set('bar', 3);
|
|
15
|
-
scope.set('baz', scope2);
|
|
16
|
-
scope2.set('add', (a, b) => {
|
|
17
|
-
return a + b;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
scope2.set('generate', (a, b) => {
|
|
21
|
-
const _scope: Scope = new Scope();
|
|
22
|
-
_scope.set(a, b);
|
|
23
|
-
return _scope;
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("should parse number literals correctly", async () => {
|
|
28
|
-
scope = new Scope();
|
|
29
|
-
let tree: Tree = new Tree('foo = 5;baz=-15;');
|
|
30
|
-
const dom: DOM = new DOM(document.body, false);
|
|
31
|
-
await tree.evaluate(scope, dom)
|
|
32
|
-
expect(scope.get('baz')).toBe(-15);
|
|
33
|
-
expect(scope.get('foo')).toBe(5);
|
|
34
|
-
|
|
35
|
-
tree = new Tree('bar = 1.5;nitch=-1.5;');
|
|
36
|
-
await tree.evaluate(scope, dom);
|
|
37
|
-
expect(scope.get('bar')).toBe(1.5);
|
|
38
|
-
expect(scope.get('nitch')).toBe(-1.5);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("should evaluate scope variables correctly", async () => {
|
|
42
|
-
let tree: Tree = new Tree('foo');
|
|
43
|
-
const dom: DOM = new DOM(document.body, false);
|
|
44
|
-
expect(await tree.evaluate(scope, dom)).toBe(2);
|
|
45
|
-
|
|
46
|
-
tree = new Tree('bar');
|
|
47
|
-
expect(await tree.evaluate(scope, dom)).toBe(3);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("should be able to call functions within the scope", async () => {
|
|
51
|
-
const tree: Tree = new Tree('baz.add(foo, bar)');
|
|
52
|
-
const dom: DOM = new DOM(document.body, false);
|
|
53
|
-
expect(await tree.evaluate(scope, dom)).toBe(5);
|
|
54
|
-
|
|
55
|
-
scope.set('foo', 15);
|
|
56
|
-
scope.set('bar', 33);
|
|
57
|
-
expect(await tree.evaluate(scope, dom)).toBe(48);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it("should be able to call functions with literals", async () => {
|
|
61
|
-
let tree: Tree = new Tree('baz.add(foo, 5)');
|
|
62
|
-
const dom: DOM = new DOM(document.body, false);
|
|
63
|
-
expect(await tree.evaluate(scope, dom)).toBe(7);
|
|
64
|
-
|
|
65
|
-
scope.set('foo', 15);
|
|
66
|
-
expect(await tree.evaluate(scope, dom)).toBe(20);
|
|
67
|
-
|
|
68
|
-
tree = new Tree('baz.add(100, 5)');
|
|
69
|
-
expect(await tree.evaluate(scope, dom)).toBe(105);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it("should be able to call member variable of value returned from function call", async () => {
|
|
73
|
-
const tree: Tree = new Tree('baz.generate("test", foo).test');
|
|
74
|
-
const dom: DOM = new DOM(document.body, false);
|
|
75
|
-
expect(await tree.evaluate(scope, dom)).toBe(2);
|
|
76
|
-
|
|
77
|
-
scope.set('foo', 15);
|
|
78
|
-
expect(await tree.evaluate(scope, dom)).toBe(15);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("should be able to call nested functions within the scope", async () => {
|
|
82
|
-
const tree: Tree = new Tree('baz.add(baz.add(foo, foo), baz.add(bar, bar))');
|
|
83
|
-
const dom: DOM = new DOM(document.body, false);
|
|
84
|
-
expect(await tree.evaluate(scope, dom)).toBe(10);
|
|
85
|
-
|
|
86
|
-
scope.set('foo', 15);
|
|
87
|
-
scope.set('bar', 33);
|
|
88
|
-
expect(await tree.evaluate(scope, dom)).toBe(96);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it("should be able to execute multiple statments properly", async () => {
|
|
92
|
-
const tree: Tree = new Tree(`
|
|
93
|
-
1;
|
|
94
|
-
2;
|
|
95
|
-
baz.add(100, 5);
|
|
96
|
-
5;
|
|
97
|
-
`);
|
|
98
|
-
const dom: DOM = new DOM(document.body, false);
|
|
99
|
-
expect(await tree.evaluate(scope, dom)).toBe(5);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("should be able to compare properly", async () => {
|
|
103
|
-
let tree: Tree = new Tree(`1!='1'`);
|
|
104
|
-
const dom: DOM = new DOM(document.body, false);
|
|
105
|
-
expect(await tree.evaluate(scope, dom)).toBe(true);
|
|
106
|
-
tree = new Tree(`1==1`);
|
|
107
|
-
expect(await tree.evaluate(scope, dom)).toBe(true);
|
|
108
|
-
tree = new Tree(`1>1`);
|
|
109
|
-
expect(await tree.evaluate(scope, dom)).toBe(false);
|
|
110
|
-
tree = new Tree(`2>1`);
|
|
111
|
-
expect(await tree.evaluate(scope, dom)).toBe(true);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it("should be able to execute if statements properly",async () => {
|
|
115
|
-
let tree: Tree = new Tree('if (true) { return true; } else { return false; }');
|
|
116
|
-
const dom: DOM = new DOM(document.body, false);
|
|
117
|
-
expect(await tree.evaluate(scope, dom)).toBe(true);
|
|
118
|
-
tree = new Tree('if (false) { return true; } else { return false; }');
|
|
119
|
-
expect(await tree.evaluate(scope, dom)).toBe(false);
|
|
120
|
-
tree = new Tree('if (false) { return true; } else if (true) { return 15; } else { return false; }');
|
|
121
|
-
expect(await tree.evaluate(scope, dom)).toBe(15);
|
|
122
|
-
const innerScope: Scope = new Scope();
|
|
123
|
-
innerScope.wrap({method: () => { return 15; }});
|
|
124
|
-
scope.set('test', innerScope);
|
|
125
|
-
tree = new Tree(`
|
|
126
|
-
if (false) {
|
|
127
|
-
return true;
|
|
128
|
-
} else if (test.method() == 15) {
|
|
129
|
-
test.method() + 5;
|
|
130
|
-
return test.method();
|
|
131
|
-
} else {
|
|
132
|
-
return false;
|
|
133
|
-
}`);
|
|
134
|
-
expect(await tree.evaluate(scope, dom)).toBe(15);
|
|
135
|
-
tree = new Tree(`
|
|
136
|
-
test = 11;
|
|
137
|
-
if (test == 11) {
|
|
138
|
-
return true;
|
|
139
|
-
} else if (true) {
|
|
140
|
-
return false;
|
|
141
|
-
} else {
|
|
142
|
-
return null;
|
|
143
|
-
}`);
|
|
144
|
-
expect(await tree.evaluate(scope, dom)).toBe(true);
|
|
145
|
-
// Multiple if statements
|
|
146
|
-
tree = new Tree(`
|
|
147
|
-
foo = 15;
|
|
148
|
-
if (foo > 5) {
|
|
149
|
-
foo = 3;
|
|
150
|
-
} else if (true) {
|
|
151
|
-
foo = 5;
|
|
152
|
-
} else {
|
|
153
|
-
foo = false;
|
|
154
|
-
}
|
|
155
|
-
if (foo == 3) {
|
|
156
|
-
foo = 5;
|
|
157
|
-
}`);
|
|
158
|
-
await tree.evaluate(scope, dom);
|
|
159
|
-
expect(scope.get('foo')).toBe(5);
|
|
160
|
-
|
|
161
|
-
// Array literals should be instantiaed as WrappedArray
|
|
162
|
-
tree = new Tree(`[123,456];`);
|
|
163
|
-
expect((await tree.evaluate(scope, dom)) instanceof WrappedArray).toBe(true);
|
|
164
|
-
|
|
165
|
-
// Array if statement and length test
|
|
166
|
-
tree = new Tree(`
|
|
167
|
-
foo1 = [1234,5678,9101112];
|
|
168
|
-
bar1 = [];
|
|
169
|
-
fooLength = foo1.length;
|
|
170
|
-
fooTest = false;
|
|
171
|
-
barTest = false;
|
|
172
|
-
|
|
173
|
-
if (foo1) {
|
|
174
|
-
fooTest = true;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (bar1) {
|
|
178
|
-
barTest = true;
|
|
179
|
-
}
|
|
180
|
-
`);
|
|
181
|
-
await tree.evaluate(scope, dom);
|
|
182
|
-
expect(scope.get('fooTest')).toBe(true);
|
|
183
|
-
expect(scope.get('barTest')).toBe(false);
|
|
184
|
-
expect(scope.get('fooLength')).toBe(3);
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it("should be able to assign variables properly", async () => {
|
|
188
|
-
let tree: Tree = new Tree(`something = 5;somethingElse=6;return something;`);
|
|
189
|
-
const dom: DOM = new DOM(document.body, false);
|
|
190
|
-
expect(await tree.evaluate(scope, dom)).toBe(5);
|
|
191
|
-
expect(scope.get('something')).toBe(5);
|
|
192
|
-
tree = new Tree(`something = somethingElse = 5;return something;`);
|
|
193
|
-
expect(await tree.evaluate(scope, dom)).toBe(5);
|
|
194
|
-
expect(scope.get('something')).toBe(5);
|
|
195
|
-
expect(scope.get('somethingElse')).toBe(5);
|
|
196
|
-
tree = new Tree(`something = null;`);
|
|
197
|
-
await tree.evaluate(scope, dom);
|
|
198
|
-
expect(scope.get('something')).toBe(null);
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it("should be able to execute basic arithmetic", async () => {
|
|
202
|
-
let tree: Tree = new Tree('5 + 3');
|
|
203
|
-
const dom: DOM = new DOM(document.body, false);
|
|
204
|
-
expect(await tree.evaluate(scope, dom)).toBe(8);
|
|
205
|
-
tree = new Tree('8 - 3');
|
|
206
|
-
expect(await tree.evaluate(scope, dom)).toBe(5);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it("should be able to assign with incrementing/decrementing variables properly", async () => {
|
|
210
|
-
let tree: Tree = new Tree(`something = 5;something += 10;`);
|
|
211
|
-
const dom: DOM = new DOM(document.body, false);
|
|
212
|
-
expect(await tree.evaluate(scope, dom)).toBe(15);
|
|
213
|
-
expect(scope.get('something')).toBe(15);
|
|
214
|
-
tree = new Tree(`something = 5;something -= 10;`);
|
|
215
|
-
expect(await tree.evaluate(scope, dom)).toBe(-5);
|
|
216
|
-
expect(scope.get('something')).toBe(-5);
|
|
217
|
-
tree = new Tree(`something = 5;something *= 10;`);
|
|
218
|
-
expect(await tree.evaluate(scope, dom)).toBe(50);
|
|
219
|
-
expect(scope.get('something')).toBe(50);
|
|
220
|
-
tree = new Tree(`something = 10;something /= 10;`);
|
|
221
|
-
expect(await tree.evaluate(scope, dom)).toBe(1);
|
|
222
|
-
expect(scope.get('something')).toBe(1);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
it("should be able to assign arrays with incrementing/decrementing variables properly", async () => {
|
|
226
|
-
let tree: Tree = new Tree(`something = [5,6];something += 10;`);
|
|
227
|
-
const dom: DOM = new DOM(document.body, false);
|
|
228
|
-
await tree.evaluate(scope, dom);
|
|
229
|
-
const something = scope.get('something');
|
|
230
|
-
expect(something.length).toEqual(3);
|
|
231
|
-
expect(something[0]).toEqual(5);
|
|
232
|
-
expect(something[1]).toEqual(6);
|
|
233
|
-
expect(something[2]).toEqual(10);
|
|
234
|
-
|
|
235
|
-
tree = new Tree(`something -= 5;`);
|
|
236
|
-
await tree.evaluate(scope, dom);
|
|
237
|
-
expect(something.length).toEqual(2);
|
|
238
|
-
expect(something[0]).toEqual(6);
|
|
239
|
-
expect(something[1]).toEqual(10);
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it("should be able to block properly with promises", async () => {
|
|
243
|
-
scope.set('blockingFunction', async (num, toAdd, fin: boolean = false) => {
|
|
244
|
-
return new Promise((resolve, reject) => {
|
|
245
|
-
expect(scope.get('test')).toBe(num);
|
|
246
|
-
|
|
247
|
-
setTimeout(() => {
|
|
248
|
-
resolve(num + toAdd);
|
|
249
|
-
}, 1);
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
let tree: Tree = new Tree(`
|
|
254
|
-
test = 1;
|
|
255
|
-
if (true) {
|
|
256
|
-
test = blockingFunction(test, 2);
|
|
257
|
-
test = blockingFunction(test, 5);
|
|
258
|
-
test = blockingFunction(test, 1, true);
|
|
259
|
-
}
|
|
260
|
-
`);
|
|
261
|
-
const dom: DOM = new DOM(document.body, false);
|
|
262
|
-
await tree.evaluate(scope, dom);
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
it("should be able to execute for loops", async () => {
|
|
266
|
-
scope.set('loopTest', [1,2,3,4,5,6,7,8,9]);
|
|
267
|
-
let tree: Tree = new Tree(`
|
|
268
|
-
test = 1;
|
|
269
|
-
for (var of loopTest) {
|
|
270
|
-
test += var;
|
|
271
|
-
}
|
|
272
|
-
`);
|
|
273
|
-
const dom: DOM = new DOM(document.body, false);
|
|
274
|
-
await tree.evaluate(scope, dom);
|
|
275
|
-
expect(scope.get('test')).toBe(46);
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
it("should be able parse an array of numbers", async () => {
|
|
279
|
-
let tree: Tree = new Tree(`test = [0,1,2,3,4,5];`);
|
|
280
|
-
const dom: DOM = new DOM(document.body, false);
|
|
281
|
-
await tree.evaluate(scope, dom);
|
|
282
|
-
|
|
283
|
-
expect(scope.get('test').length).toBe(6);
|
|
284
|
-
for (let i = 0; i<=5; i++) {
|
|
285
|
-
expect(scope.get('test')[i]).toBe(i);
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
it("should be able parse an array of strings", async () => {
|
|
290
|
-
let tree: Tree = new Tree(`test = ["one","two","three"];`);
|
|
291
|
-
const dom: DOM = new DOM(document.body, false);
|
|
292
|
-
await tree.evaluate(scope, dom);
|
|
293
|
-
|
|
294
|
-
expect(scope.get('test').length).toBe(3);
|
|
295
|
-
const expected = ["one", "two", "three"];
|
|
296
|
-
for (let i = 0; i<=5; i++) {
|
|
297
|
-
expect(scope.get('test')[i]).toBe(expected[i]);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
it("should be able parse an object literal", async () => {
|
|
302
|
-
let tree: Tree = new Tree(`test = {"x":0,"y":1,"z":2};`);
|
|
303
|
-
const dom: DOM = new DOM(document.body, false);
|
|
304
|
-
await tree.evaluate(scope, dom);
|
|
305
|
-
expect(scope.get('test').get('x')).toBe(0);
|
|
306
|
-
expect(scope.get('test').get('y')).toBe(1);
|
|
307
|
-
expect(scope.get('test').get('z')).toBe(2);
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
it("should be able parse an object literal with a key from the scope", async () => {
|
|
311
|
-
let tree: Tree = new Tree(`xKey = 'x'; test = {xKey:120,"y":1,"z":2};`);
|
|
312
|
-
const dom: DOM = new DOM(document.body, false);
|
|
313
|
-
await tree.evaluate(scope, dom);
|
|
314
|
-
expect(scope.get('test').get('y')).toBe(1);
|
|
315
|
-
expect(scope.get('test').get('z')).toBe(2);
|
|
316
|
-
expect(scope.get('test').get('x')).toBe(120);
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
it("should be able parse an object literal containing arrays", async () => {
|
|
320
|
-
let tree: Tree = new Tree(`test = {"test_1": ["test", "testing"], "test_2": ["foo", "bar"]}`);
|
|
321
|
-
const dom: DOM = new DOM(document.body, false);
|
|
322
|
-
await tree.evaluate(scope, dom);
|
|
323
|
-
expect(scope.get('test').get('test_1')[0]).toBe("test");
|
|
324
|
-
expect(scope.get('test').get('test_1')[1]).toBe("testing");
|
|
325
|
-
expect(scope.get('test').get('test_2')[0]).toBe("foo");
|
|
326
|
-
expect(scope.get('test').get('test_2')[1]).toBe("bar");
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
it("should be able to check if item is in an array", async () => {
|
|
330
|
-
let tree: Tree = new Tree(`a in [1,2,3]`);
|
|
331
|
-
const dom: DOM = new DOM(document.body, false);
|
|
332
|
-
scope.set('a', 1);
|
|
333
|
-
expect(await tree.evaluate(scope, dom)).toBe(true);
|
|
334
|
-
scope.set('a', 4);
|
|
335
|
-
expect(await tree.evaluate(scope, dom)).toBe(false);
|
|
336
|
-
|
|
337
|
-
tree = new Tree(`a in b`);
|
|
338
|
-
scope.set('a', 'test');
|
|
339
|
-
scope.set('b', [1,2,3]);
|
|
340
|
-
expect(await tree.evaluate(scope, dom)).toBe(false);
|
|
341
|
-
|
|
342
|
-
tree = new Tree(`a not in b`);
|
|
343
|
-
scope.set('a', 'test');
|
|
344
|
-
scope.set('b', [1,2,3]);
|
|
345
|
-
expect(await tree.evaluate(scope, dom)).toBe(true);
|
|
346
|
-
scope.set('a', 1);
|
|
347
|
-
scope.set('b', [1,2,3]);
|
|
348
|
-
expect(await tree.evaluate(scope, dom)).toBe(false);
|
|
349
|
-
scope.set('a', 4);
|
|
350
|
-
scope.set('b', [1,2,3]);
|
|
351
|
-
expect(await tree.evaluate(scope, dom)).toBe(true);
|
|
352
|
-
});
|
|
353
|
-
});
|
package/test/Controller.spec.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {Controller} from '../src/Controller';
|
|
2
|
-
import {DOM} from "../src/DOM";
|
|
3
|
-
import {Registry} from "../src/Registry";
|
|
4
|
-
import {property} from "../src/Scope/properties/Property";
|
|
5
|
-
import {Property, Scope, Tag} from "../src/vsn";
|
|
6
|
-
|
|
7
|
-
@Registry.controller('ControllerTestController')
|
|
8
|
-
class TestController extends Controller {
|
|
9
|
-
@property()
|
|
10
|
-
public test: string;
|
|
11
|
-
|
|
12
|
-
@property(Property, {
|
|
13
|
-
type: 'integer',
|
|
14
|
-
min: 0,
|
|
15
|
-
max: 100,
|
|
16
|
-
validators: [
|
|
17
|
-
'positive',
|
|
18
|
-
]
|
|
19
|
-
})
|
|
20
|
-
public positive_integer: number;
|
|
21
|
-
|
|
22
|
-
isValid(): boolean {
|
|
23
|
-
return this.test === 'test';
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
describe('Controller', () => {
|
|
28
|
-
it("methods should be callable from vsn-script", async () => {
|
|
29
|
-
document.body.innerHTML = `
|
|
30
|
-
<div id="controller" vsn-controller:test="ControllerTestController" vsn-set:test.test="notTest" vsn-bind="test.test"></div>
|
|
31
|
-
`;
|
|
32
|
-
const dom = new DOM(document.body);
|
|
33
|
-
await new Promise((resolve, reject) => {
|
|
34
|
-
dom.once('built', async () => {
|
|
35
|
-
const tag = await dom.exec('#controller');
|
|
36
|
-
expect(tag).toBeInstanceOf(Tag);
|
|
37
|
-
expect(tag.scope).toBeInstanceOf(Scope);
|
|
38
|
-
resolve(null);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
package/test/DOM.spec.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import "../src/vsn";
|
|
2
|
-
import {DOM} from "../src/DOM";
|
|
3
|
-
import {Registry} from "../src/Registry";
|
|
4
|
-
|
|
5
|
-
@Registry.controller('TestController')
|
|
6
|
-
class TestController {}
|
|
7
|
-
|
|
8
|
-
describe('DOM', () => {
|
|
9
|
-
it("should be able to set up tags correctly", (done) => {
|
|
10
|
-
document.body.innerHTML = `
|
|
11
|
-
<div vsn-controller:test="TestController"></div>
|
|
12
|
-
`;
|
|
13
|
-
const dom = new DOM(document.body);
|
|
14
|
-
dom.once('built', async () => {
|
|
15
|
-
const bodyTag = await dom.getTagForElement(document.body);
|
|
16
|
-
expect(bodyTag.hasAttribute('vsn-root')).toBe(true)
|
|
17
|
-
done();
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("should use scopes correctly", (done) => {
|
|
22
|
-
document.body.innerHTML = `
|
|
23
|
-
<div id="parent" vsn-set:asd|integer="123">
|
|
24
|
-
<div id="testing" vsn-controller:test="TestController" vsn-set:asd="234|integer">
|
|
25
|
-
<div vsn-set:asd|integer="345"></div>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
`;
|
|
29
|
-
const dom = new DOM(document.body);
|
|
30
|
-
dom.once('built', async () => {
|
|
31
|
-
expect(await dom.exec('?(#parent).asd')).toBe(123);
|
|
32
|
-
expect(await dom.exec('?(#testing).asd')).toBe(345);
|
|
33
|
-
done();
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("should be able to query elements in all directions", (done) => {
|
|
38
|
-
document.body.innerHTML = `
|
|
39
|
-
<div id="root" vsn-set:asd|integer="1">
|
|
40
|
-
<main id="parent" vsn-set:asd|integer="123">
|
|
41
|
-
<div id="testing" vsn-controller:test="TestController" vsn-set:asd="234|integer">
|
|
42
|
-
<div id="child" vsn-set:asd|integer="345">
|
|
43
|
-
<ul>
|
|
44
|
-
<li vsn-set:asd|integer="456"></li>
|
|
45
|
-
<li id="grandchild" vsn-set:asd|integer="567"></li>
|
|
46
|
-
</ul>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</main>
|
|
50
|
-
</div>
|
|
51
|
-
`;
|
|
52
|
-
const dom = new DOM(document.body);
|
|
53
|
-
dom.once('built', async () => {
|
|
54
|
-
const root = await dom.exec('#root');
|
|
55
|
-
const child = await dom.exec('#child');
|
|
56
|
-
const grandchild = await dom.exec('#grandchild');
|
|
57
|
-
expect(await child.exec('?<(main).asd')).toBe(123);
|
|
58
|
-
expect(await child.exec('?>(li)[0].asd')).toBe(456);
|
|
59
|
-
expect(await dom.exec('?(#grandchild)[0]')).toBe(grandchild);
|
|
60
|
-
done();
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { EventDispatcher } from "../src/EventDispatcher";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
describe('EventDispatcher', () => {
|
|
5
|
-
let dispatcher: EventDispatcher,
|
|
6
|
-
dummy: any = null,
|
|
7
|
-
dummy2: any = null;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
dispatcher = new EventDispatcher();
|
|
11
|
-
dummy = jasmine.createSpyObj('dummy', ['callback']);
|
|
12
|
-
dummy2 = jasmine.createSpyObj('dummy2', ['callback']);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should bind and be called properly", () => {
|
|
16
|
-
dispatcher.on('event', dummy.callback.bind(dummy));
|
|
17
|
-
expect(dummy.callback).not.toHaveBeenCalled();
|
|
18
|
-
dispatcher.dispatch('event', 1, 2, 'three');
|
|
19
|
-
expect(dummy.callback).toHaveBeenCalled();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("should unbind and not be called", () => {
|
|
23
|
-
const key: number = dispatcher.on('event', dummy.callback.bind(dummy));
|
|
24
|
-
expect(dispatcher.off('event', key)).toEqual(true);
|
|
25
|
-
dispatcher.dispatch('event', 1, 2, 'three');
|
|
26
|
-
expect(dummy.callback).not.toHaveBeenCalled();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("should not unbind events that don't exist", () => {
|
|
30
|
-
const key: number = dispatcher.on('event', dummy.callback.bind(dummy));
|
|
31
|
-
expect(dispatcher.off('fake_event', -1)).toEqual(false);
|
|
32
|
-
dispatcher.dispatch('event', 1, 2, 'three');
|
|
33
|
-
expect(dummy.callback).toHaveBeenCalled();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("should bind and be called properly", () => {
|
|
37
|
-
dispatcher.on('event', dummy.callback.bind(dummy));
|
|
38
|
-
expect(dummy.callback).not.toHaveBeenCalled();
|
|
39
|
-
dispatcher.dispatch('event', 1, 2, 'three');
|
|
40
|
-
expect(dummy.callback).toHaveBeenCalled();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it("should unbind all", () => {
|
|
44
|
-
dispatcher.on('event', dummy.callback, dummy);
|
|
45
|
-
dispatcher.on('event', dummy.callback, dummy);
|
|
46
|
-
dispatcher.on('event', dummy2.callback, dummy2);
|
|
47
|
-
expect(dispatcher.off('event')).toEqual(true);
|
|
48
|
-
expect(dispatcher.offWithContext('event', dummy)).toBe(0);
|
|
49
|
-
expect(dispatcher.offWithContext('event', dummy2)).toBe(0);
|
|
50
|
-
dispatcher.dispatch('event');
|
|
51
|
-
expect(dummy.callback).not.toHaveBeenCalled();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("should unbind all with matching context", () => {
|
|
55
|
-
dispatcher.on('event', dummy.callback, dummy);
|
|
56
|
-
dispatcher.on('event', dummy.callback, dummy);
|
|
57
|
-
dispatcher.on('event', dummy2.callback, dummy2);
|
|
58
|
-
expect(dispatcher.offWithContext('event', dummy)).toBe(2);
|
|
59
|
-
dispatcher.dispatch('event');
|
|
60
|
-
expect(dummy.callback).not.toHaveBeenCalled();
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("should unbind the correct listeners by key", () => {
|
|
64
|
-
let key1 = dispatcher.on('event', dummy.callback, dummy),
|
|
65
|
-
key2 = dispatcher.on('event', dummy.callback, dummy),
|
|
66
|
-
key3 = dispatcher.on('event', dummy.callback, dummy),
|
|
67
|
-
key4 = dispatcher.on('event', dummy.callback, dummy),
|
|
68
|
-
key5 = dispatcher.on('event', dummy.callback, dummy);
|
|
69
|
-
|
|
70
|
-
expect(dispatcher.off('event', key2)).toBe(true);
|
|
71
|
-
expect(dispatcher.off('event', key4)).toBe(true);
|
|
72
|
-
expect(dispatcher.off('event', key1)).toBe(true);
|
|
73
|
-
expect(dispatcher.off('event', key3)).toBe(true);
|
|
74
|
-
expect(dispatcher.off('event', key5)).toBe(true);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("should fail to unbind the once listeners", () => {
|
|
78
|
-
let key1: number = dispatcher.once('event', dummy.callback, dummy),
|
|
79
|
-
cb1: any = dispatcher.getListener('event', key1),
|
|
80
|
-
key2: number = dispatcher.once('event', dummy.callback, dummy),
|
|
81
|
-
cb2: any = dispatcher.getListener('event', key2),
|
|
82
|
-
key3: number = dispatcher.once('event', dummy.callback, dummy),
|
|
83
|
-
cb3: any = dispatcher.getListener('event', key3),
|
|
84
|
-
key4: number = dispatcher.on('event', dummy.callback, dummy),
|
|
85
|
-
cb4: any = dispatcher.getListener('event', key4),
|
|
86
|
-
key5: number = dispatcher.once('event', dummy.callback, dummy),
|
|
87
|
-
cb5: any = dispatcher.getListener('event', key5);
|
|
88
|
-
|
|
89
|
-
dispatcher.dispatch('event');
|
|
90
|
-
dispatcher.dispatch('event');
|
|
91
|
-
dispatcher.dispatch('event');
|
|
92
|
-
dispatcher.dispatch('event');
|
|
93
|
-
expect(dispatcher.off('event', key2)).toBe(false);
|
|
94
|
-
expect(cb2.calls).toBe(1);
|
|
95
|
-
expect(dispatcher.off('event', key4)).toBe(true);
|
|
96
|
-
expect(cb4.calls).toBe(4);
|
|
97
|
-
expect(dispatcher.off('event', key1)).toBe(false);
|
|
98
|
-
expect(cb1.calls).toBe(1);
|
|
99
|
-
expect(dispatcher.off('event', key3)).toBe(false);
|
|
100
|
-
expect(cb3.calls).toBe(1);
|
|
101
|
-
expect(dispatcher.off('event', key5)).toBe(false);
|
|
102
|
-
expect(cb5.calls).toBe(1);
|
|
103
|
-
expect(dispatcher.off('event', key4)).toBe(false);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("should only be called once", () => {
|
|
107
|
-
let onceCalls = 0,
|
|
108
|
-
normalCalls = 0;
|
|
109
|
-
dispatcher.once('event', () => {
|
|
110
|
-
// empty
|
|
111
|
-
});
|
|
112
|
-
dispatcher.once('event', () => {
|
|
113
|
-
onceCalls += 1;
|
|
114
|
-
});
|
|
115
|
-
dispatcher.once('event', () => {
|
|
116
|
-
// empty
|
|
117
|
-
});
|
|
118
|
-
dispatcher.on('event', () => {
|
|
119
|
-
normalCalls += 1;
|
|
120
|
-
});
|
|
121
|
-
dispatcher.dispatch('event');
|
|
122
|
-
dispatcher.dispatch('event');
|
|
123
|
-
dispatcher.dispatch('event');
|
|
124
|
-
dispatcher.dispatch('event');
|
|
125
|
-
expect(onceCalls).toBe(1);
|
|
126
|
-
expect(normalCalls).toBe(4);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it("should only be called once with nested event triggers", () => {
|
|
130
|
-
let onceCalls = 0,
|
|
131
|
-
normalCalls = 0;
|
|
132
|
-
const key: number = dispatcher.once('event', () => {
|
|
133
|
-
dispatcher.dispatch('event');
|
|
134
|
-
}),
|
|
135
|
-
cb: any = dispatcher.getListener('event', key);
|
|
136
|
-
dispatcher.dispatch('event');
|
|
137
|
-
expect(cb.calls).toBe(1);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it("should pass arguments", () => {
|
|
141
|
-
const key = dispatcher.once('event', (num, arr, obj) => {
|
|
142
|
-
expect(num).toBe(1);
|
|
143
|
-
expect(arr[0]).toBe(1);
|
|
144
|
-
expect(arr[1]).toBe(2);
|
|
145
|
-
expect(arr[2]).toBe(3);
|
|
146
|
-
expect(obj.foo).toBe('bar');
|
|
147
|
-
}),
|
|
148
|
-
cb = dispatcher.getListener('event', key);
|
|
149
|
-
dispatcher.dispatch('event', 1, [1,2,3], {foo:'bar'});
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it("cannot call a once event more than once", () => {
|
|
153
|
-
const key: number = dispatcher.once('event', () => {}),
|
|
154
|
-
cb: any = dispatcher.getListener('event', key);
|
|
155
|
-
dispatcher.dispatch('event');
|
|
156
|
-
expect(cb.call()).toBe(false);
|
|
157
|
-
expect(cb.calls).toBe(1);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it("should not unbind anything and return 0", () => {
|
|
161
|
-
expect(dispatcher.offWithContext('event', null)).toBe(0);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it("should not trigger events that don't exist", () => {
|
|
165
|
-
expect(dispatcher.dispatch('event')).toBe(undefined);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it("should trigger events in the correct order", () => {
|
|
169
|
-
let check: number = 1;
|
|
170
|
-
dispatcher.on('event', () => {
|
|
171
|
-
expect(check).toBe(1);
|
|
172
|
-
check++;
|
|
173
|
-
});
|
|
174
|
-
dispatcher.on('event', () => {
|
|
175
|
-
expect(check).toBe(2);
|
|
176
|
-
check++;
|
|
177
|
-
});
|
|
178
|
-
dispatcher.on('event', () => {
|
|
179
|
-
expect(check).toBe(3);
|
|
180
|
-
check++;
|
|
181
|
-
});
|
|
182
|
-
dispatcher.on('event', () => {
|
|
183
|
-
expect(check).toBe(4);
|
|
184
|
-
check++;
|
|
185
|
-
});
|
|
186
|
-
dispatcher.on('event', () => {
|
|
187
|
-
expect(check).toBe(5);
|
|
188
|
-
});
|
|
189
|
-
dispatcher.dispatch('event');
|
|
190
|
-
});
|
|
191
|
-
});
|