vasille 1.2.9 → 2.0.3

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 (133) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +195 -129
  3. package/cdn/es2015.js +3231 -0
  4. package/cdn/es5.js +3675 -0
  5. package/flow-typed/vasille.js +839 -0
  6. package/lib/binding/attribute.js +32 -0
  7. package/lib/binding/binding.js +39 -0
  8. package/lib/binding/class.js +51 -0
  9. package/lib/binding/style.js +29 -0
  10. package/lib/core/core.js +186 -0
  11. package/lib/core/destroyable.js +45 -0
  12. package/lib/core/errors.js +16 -0
  13. package/lib/core/executor.js +154 -0
  14. package/lib/core/ivalue.js +56 -0
  15. package/lib/core/signal.js +50 -0
  16. package/lib/core/slot.js +47 -0
  17. package/lib/index.js +27 -22
  18. package/lib/models/array-model.js +208 -0
  19. package/lib/models/listener.js +130 -0
  20. package/lib/models/map-model.js +66 -0
  21. package/lib/models/model.js +1 -0
  22. package/lib/models/object-model.js +78 -0
  23. package/lib/models/set-model.js +62 -0
  24. package/lib/node/app.js +39 -0
  25. package/lib/node/interceptor.js +83 -0
  26. package/lib/node/node.js +1204 -0
  27. package/lib/node/watch.js +27 -0
  28. package/lib/value/expression.js +83 -0
  29. package/lib/value/mirror.js +58 -0
  30. package/lib/value/pointer.js +26 -0
  31. package/lib/value/reference.js +55 -0
  32. package/lib/views/array-view.js +21 -0
  33. package/lib/views/base-view.js +49 -0
  34. package/lib/views/map-view.js +19 -0
  35. package/lib/views/object-view.js +19 -0
  36. package/lib/views/repeat-node.js +106 -0
  37. package/lib/views/repeater.js +63 -0
  38. package/lib/views/set-view.js +22 -0
  39. package/package.json +26 -18
  40. package/types/binding/attribute.d.ts +23 -0
  41. package/types/binding/binding.d.ts +30 -0
  42. package/types/binding/class.d.ts +23 -0
  43. package/types/binding/style.d.ts +23 -0
  44. package/types/core/core.d.ts +144 -0
  45. package/types/core/destroyable.d.ts +15 -0
  46. package/types/core/errors.d.ts +4 -0
  47. package/types/core/executor.d.ts +87 -0
  48. package/types/core/ivalue.d.ts +45 -0
  49. package/types/core/signal.d.ts +35 -0
  50. package/types/core/slot.d.ts +45 -0
  51. package/types/index.d.ts +27 -21
  52. package/types/models/array-model.d.ts +103 -0
  53. package/types/models/listener.d.ts +74 -0
  54. package/types/models/map-model.d.ts +35 -0
  55. package/types/models/model.d.ts +19 -0
  56. package/types/models/object-model.d.ts +36 -0
  57. package/types/models/set-model.d.ts +34 -0
  58. package/types/node/app.d.ts +42 -0
  59. package/types/node/interceptor.d.ts +50 -0
  60. package/types/node/node.d.ts +741 -0
  61. package/types/node/watch.d.ts +23 -0
  62. package/types/value/expression.d.ts +60 -0
  63. package/types/value/mirror.d.ts +35 -0
  64. package/types/value/pointer.d.ts +19 -0
  65. package/types/value/reference.d.ts +30 -0
  66. package/types/views/array-view.d.ts +13 -0
  67. package/types/views/base-view.d.ts +43 -0
  68. package/types/views/map-view.d.ts +11 -0
  69. package/types/views/object-view.d.ts +11 -0
  70. package/types/views/repeat-node.d.ts +35 -0
  71. package/types/views/repeater.d.ts +38 -0
  72. package/types/views/set-view.d.ts +11 -0
  73. package/CHANGELOG.md +0 -23
  74. package/img/favicon.svg +0 -441
  75. package/img/getLocus.svg +0 -18
  76. package/img/logo.png +0 -0
  77. package/img/logo.svg +0 -550
  78. package/img/scores-o-log.png +0 -0
  79. package/img/scores-o.png +0 -0
  80. package/img/scores-wo-log.png +0 -0
  81. package/img/scores-wo.png +0 -0
  82. package/img/x1-x32.png +0 -0
  83. package/lib/attribute.js +0 -71
  84. package/lib/attribute.js.map +0 -1
  85. package/lib/bind.js +0 -286
  86. package/lib/bind.js.map +0 -1
  87. package/lib/class.js +0 -97
  88. package/lib/class.js.map +0 -1
  89. package/lib/executor.js +0 -167
  90. package/lib/executor.js.map +0 -1
  91. package/lib/index.js.map +0 -1
  92. package/lib/interfaces/core.js +0 -247
  93. package/lib/interfaces/core.js.map +0 -1
  94. package/lib/interfaces/destroyable.js +0 -39
  95. package/lib/interfaces/destroyable.js.map +0 -1
  96. package/lib/interfaces/errors.js +0 -49
  97. package/lib/interfaces/errors.js.map +0 -1
  98. package/lib/interfaces/ibind.js +0 -31
  99. package/lib/interfaces/ibind.js.map +0 -1
  100. package/lib/interfaces/idefinition.js +0 -64
  101. package/lib/interfaces/idefinition.js.map +0 -1
  102. package/lib/interfaces/ivalue.js +0 -60
  103. package/lib/interfaces/ivalue.js.map +0 -1
  104. package/lib/models.js +0 -579
  105. package/lib/models.js.map +0 -1
  106. package/lib/node.js +0 -2155
  107. package/lib/node.js.map +0 -1
  108. package/lib/property.js +0 -38
  109. package/lib/property.js.map +0 -1
  110. package/lib/style.js +0 -66
  111. package/lib/style.js.map +0 -1
  112. package/lib/value.js +0 -203
  113. package/lib/value.js.map +0 -1
  114. package/lib/views.js +0 -688
  115. package/lib/views.js.map +0 -1
  116. package/types/attribute.d.ts +0 -18
  117. package/types/bind.d.ts +0 -72
  118. package/types/class.d.ts +0 -19
  119. package/types/data.d.ts +0 -11
  120. package/types/event.d.ts +0 -10
  121. package/types/executor.d.ts +0 -57
  122. package/types/interfaces/core.d.ts +0 -129
  123. package/types/interfaces/destroyable.d.ts +0 -11
  124. package/types/interfaces/errors.d.ts +0 -24
  125. package/types/interfaces/ibind.d.ts +0 -19
  126. package/types/interfaces/idefinition.d.ts +0 -29
  127. package/types/interfaces/ivalue.d.ts +0 -40
  128. package/types/models.d.ts +0 -179
  129. package/types/node.d.ts +0 -906
  130. package/types/property.d.ts +0 -9
  131. package/types/style.d.ts +0 -28
  132. package/types/value.d.ts +0 -43
  133. package/types/views.d.ts +0 -135
@@ -0,0 +1,23 @@
1
+ import { Fragment } from "./node";
2
+ import { Slot } from "../core/slot";
3
+ import { IValue } from "../core/ivalue";
4
+ /**
5
+ * Watch Node
6
+ * @class Watch
7
+ * @extends Fragment
8
+ */
9
+ export declare class Watch<T> extends Fragment {
10
+ /**
11
+ * Default slot
12
+ * @type Slot
13
+ */
14
+ slot: Slot<Fragment, T>;
15
+ /**
16
+ * iValue to watch
17
+ * @type IValue
18
+ */
19
+ model: IValue<T>;
20
+ constructor();
21
+ $createWatchers(): void;
22
+ $compose(): void;
23
+ }
@@ -0,0 +1,60 @@
1
+ import { IValue } from "../core/ivalue";
2
+ /**
3
+ * Bind some values to one expression
4
+ * @class Expression
5
+ * @extends IValue
6
+ */
7
+ export declare class Expression<T, T1 = void, T2 = void, T3 = void, T4 = void, T5 = void, T6 = void, T7 = void, T8 = void, T9 = void> extends IValue<T> {
8
+ /**
9
+ * The array of value which will trigger recalculation
10
+ * @type {Array}
11
+ */
12
+ private values;
13
+ /**
14
+ * Cache the values of expression variables
15
+ * @type {Array}
16
+ */
17
+ private readonly valuesCache;
18
+ /**
19
+ * The function which will be executed on recalculation
20
+ */
21
+ private readonly func;
22
+ /**
23
+ * Expression will link different handler for each value of list
24
+ */
25
+ private linkedFunc;
26
+ /**
27
+ * The buffer to keep the last calculated value
28
+ */
29
+ private sync;
30
+ /**
31
+ * Creates a function bounded to N values
32
+ * @param func {Function} the function to bound
33
+ * @param link {Boolean} links immediately if true
34
+ * @param v1 {*} argument
35
+ * @param v2 {*} argument
36
+ * @param v3 {*} argument
37
+ * @param v4 {*} argument
38
+ * @param v5 {*} argument
39
+ * @param v6 {*} argument
40
+ * @param v7 {*} argument
41
+ * @param v8 {*} argument
42
+ * @param v9 {*} argument
43
+ */
44
+ constructor(func: (a1: T1) => T, link: boolean, v1: IValue<T1>, v2?: IValue<void>, v3?: IValue<void>, v4?: IValue<void>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>);
45
+ constructor(func: (a1: T1, a2: T2) => T, link: boolean, v1: IValue<T1>, v2: IValue<T2>, v3?: IValue<void>, v4?: IValue<void>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>);
46
+ constructor(func: (a1: T1, a2: T2, a3: T3) => T, link: boolean, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4?: IValue<void>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>);
47
+ constructor(func: (a1: T1, a2: T2, a3: T3, a4: T4) => T, link: boolean, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>);
48
+ constructor(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => T, link: boolean, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>);
49
+ constructor(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => T, link: boolean, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>);
50
+ constructor(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7) => T, link: boolean, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8?: IValue<void>, v9?: IValue<void>);
51
+ constructor(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8) => T, link: boolean, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9?: IValue<void>);
52
+ constructor(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8, a9: T9) => T, link: boolean, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9: IValue<T9>);
53
+ get $(): T;
54
+ set $(value: T);
55
+ on(handler: (value: T) => void): this;
56
+ off(handler: (value: T) => void): this;
57
+ enable(): this;
58
+ disable(): this;
59
+ $destroy(): void;
60
+ }
@@ -0,0 +1,35 @@
1
+ import { IValue } from "../core/ivalue";
2
+ import { Reference } from "./reference";
3
+ /**
4
+ * Declares a notifiable bind to a value
5
+ * @class Mirror
6
+ * @extends IValue
7
+ * @version 2
8
+ */
9
+ export declare class Mirror<T> extends Reference<T> {
10
+ /**
11
+ * pointed value
12
+ * @type IValue
13
+ */
14
+ protected pointedValue: IValue<T>;
15
+ /**
16
+ * Collection of handlers
17
+ * @type Set
18
+ */
19
+ private readonly handler;
20
+ /**
21
+ * Ensure forward only synchronization
22
+ */
23
+ forwardOnly: boolean;
24
+ /**
25
+ * Constructs a notifiable bind to a value
26
+ * @param value {IValue} is initial value
27
+ * @param forwardOnly {boolean} ensure forward only synchronization
28
+ */
29
+ constructor(value: IValue<T>, forwardOnly?: boolean);
30
+ get $(): T;
31
+ set $(v: T);
32
+ enable(): this;
33
+ disable(): this;
34
+ $destroy(): void;
35
+ }
@@ -0,0 +1,19 @@
1
+ import { Mirror } from "./mirror";
2
+ import { IValue } from "../core/ivalue";
3
+ /**
4
+ * r/w pointer to a value
5
+ * @class Pointer
6
+ * @extends Mirror
7
+ */
8
+ export declare class Pointer<T> extends Mirror<T> {
9
+ /**
10
+ * @param value {IValue} value to point
11
+ * @param forwardOnly {boolean} forward only data flow
12
+ */
13
+ constructor(value: IValue<T>, forwardOnly?: boolean);
14
+ /**
15
+ * Point a new ivalue
16
+ * @param value {IValue} value to point
17
+ */
18
+ point(value: IValue<T>): void;
19
+ }
@@ -0,0 +1,30 @@
1
+ import { IValue } from "../core/ivalue";
2
+ /**
3
+ * Declares a notifiable value
4
+ * @class Reference
5
+ * @extends IValue
6
+ */
7
+ export declare class Reference<T> extends IValue<T> {
8
+ /**
9
+ * The encapsulated value
10
+ * @type {*}
11
+ */
12
+ private value;
13
+ /**
14
+ * Array of handlers
15
+ * @type {Set}
16
+ * @readonly
17
+ */
18
+ private readonly onchange;
19
+ /**
20
+ * @param value {any} the initial value
21
+ */
22
+ constructor(value: T);
23
+ get $(): T;
24
+ set $(value: T);
25
+ enable(): this;
26
+ disable(): this;
27
+ on(handler: (value: T) => void): this;
28
+ off(handler: (value: T) => void): this;
29
+ $destroy(): void;
30
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseView } from "./base-view";
2
+ import { ArrayModel } from "../models/array-model";
3
+ import { Fragment } from "../node/node";
4
+ /**
5
+ * Represents a view of an array model
6
+ * @class ArrayView
7
+ * @extends BaseView
8
+ */
9
+ export declare class ArrayView<T> extends BaseView<T, T, ArrayModel<T>> {
10
+ constructor(model: ArrayModel<T>);
11
+ createChild(id: T, item: T, before?: Fragment): any;
12
+ $ready(): void;
13
+ }
@@ -0,0 +1,43 @@
1
+ import { RepeatNode, RepeatNodePrivate } from "./repeat-node";
2
+ import { IModel } from "../models/model";
3
+ /**
4
+ * Private part of BaseView
5
+ * @class BaseViewPrivate
6
+ * @extends RepeatNodePrivate
7
+ */
8
+ export declare class BaseViewPrivate<K, T> extends RepeatNodePrivate<K> {
9
+ /**
10
+ * Handler to catch values addition
11
+ * @type {Function}
12
+ */
13
+ addHandler: (index: K, value: T) => void;
14
+ /**
15
+ * Handler to catch values removes
16
+ * @type {Function}
17
+ */
18
+ removeHandler: (index: K, value: T) => void;
19
+ constructor();
20
+ }
21
+ /**
22
+ * Base class of default views
23
+ * @class BaseView
24
+ * @extends RepeatNode
25
+ * @implements IModel
26
+ */
27
+ export declare class BaseView<K, T, Model extends IModel<K, T>> extends RepeatNode<K, T> {
28
+ protected $: BaseViewPrivate<K, T>;
29
+ /**
30
+ * Property which will contain a model
31
+ * @type {IModel}
32
+ */
33
+ model: Model;
34
+ constructor($1?: BaseViewPrivate<K, T>);
35
+ /**
36
+ * Handle ready event
37
+ */
38
+ $ready(): void;
39
+ /**
40
+ * Handles destroy event
41
+ */
42
+ $destroy(): void;
43
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseView } from "./base-view";
2
+ import { MapModel } from "../models/map-model";
3
+ /**
4
+ * Create a children pack for each map value
5
+ * @class MapView
6
+ * @extends BaseView
7
+ */
8
+ export declare class MapView<K, T> extends BaseView<K, T, MapModel<K, T>> {
9
+ constructor(model: MapModel<K, T>);
10
+ $ready(): void;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseView } from "./base-view";
2
+ import { ObjectModel } from "../models/object-model";
3
+ /**
4
+ * Create a children pack for each object field
5
+ * @class ObjectView
6
+ * @extends BaseView
7
+ */
8
+ export declare class ObjectView<T> extends BaseView<string, T, ObjectModel<T>> {
9
+ constructor(model: ObjectModel<T>);
10
+ $ready(): void;
11
+ }
@@ -0,0 +1,35 @@
1
+ import { Fragment, INodePrivate } from "../node/node";
2
+ import { Slot } from "../core/slot";
3
+ /**
4
+ * Private part of repeat node
5
+ * @class RepeatNodePrivate
6
+ * @extends INodePrivate
7
+ */
8
+ export declare class RepeatNodePrivate<IdT> extends INodePrivate {
9
+ /**
10
+ * Children node hash
11
+ * @type {Map}
12
+ */
13
+ nodes: Map<IdT, Fragment>;
14
+ constructor();
15
+ $destroy(): void;
16
+ }
17
+ /**
18
+ * Repeat node repeats its children
19
+ * @class RepeatNode
20
+ * @extends Fragment
21
+ */
22
+ export declare class RepeatNode<IdT, T> extends Fragment {
23
+ protected $: RepeatNodePrivate<IdT>;
24
+ /**
25
+ * Default slot
26
+ */
27
+ slot: Slot<Fragment, T, IdT>;
28
+ /**
29
+ * If false will use timeout executor, otherwise the app executor
30
+ */
31
+ freezeUi: boolean;
32
+ constructor($?: RepeatNodePrivate<IdT>);
33
+ createChild(id: IdT, item: T, before?: Fragment): any;
34
+ destroyChild(id: IdT, item: T): void;
35
+ }
@@ -0,0 +1,38 @@
1
+ import { RepeatNode, RepeatNodePrivate } from "./repeat-node";
2
+ import { IValue } from "../core/ivalue";
3
+ /**
4
+ * Private part of repeater
5
+ * @class RepeaterPrivate
6
+ * @extends RepeatNodePrivate
7
+ */
8
+ export declare class RepeaterPrivate<IdT> extends RepeatNodePrivate<IdT> {
9
+ /**
10
+ * Handler to catch count updates
11
+ */
12
+ updateHandler: (value: number) => void;
13
+ /**
14
+ * Current count of child nodes
15
+ */
16
+ currentCount: number;
17
+ constructor();
18
+ }
19
+ /**
20
+ * The simplest repeat node interpretation, repeat children pack a several times
21
+ * @class Repeater
22
+ * @extends RepeatNode
23
+ */
24
+ export declare class Repeater extends RepeatNode<number, number> {
25
+ protected $: RepeaterPrivate<number>;
26
+ /**
27
+ * The count of children
28
+ */
29
+ count: IValue<number>;
30
+ constructor($?: RepeaterPrivate<number>);
31
+ /**
32
+ * Changes the children count
33
+ */
34
+ changeCount(number: number): void;
35
+ $created(): void;
36
+ $ready(): void;
37
+ $destroy(): void;
38
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseView } from "./base-view";
2
+ import { SetModel } from "../models/set-model";
3
+ /**
4
+ * Create a children pack for each set value
5
+ * @class SetView
6
+ * @extends BaseView
7
+ */
8
+ export declare class SetView<T> extends BaseView<T, T, SetModel<T>> {
9
+ constructor(model: SetModel<T>);
10
+ $ready(): void;
11
+ }
package/CHANGELOG.md DELETED
@@ -1,23 +0,0 @@
1
- # Changelog
2
-
3
- ## 1.2
4
-
5
- * `:alive` directive
6
- * `:mount` directive
7
- * `on$destroy` & `on$mount` events
8
-
9
- ## 1.1
10
-
11
- * Boost up **Reactive References**
12
- * `:show` directive
13
- * Small bug fixes
14
-
15
- ## 1.0
16
-
17
- Initial version which includes:
18
- * **Vasille.js node** classes (Component, Fragment, App)
19
- * **Reactive Reference** library: Reference, Pointer & Expression
20
- * **Conditional** node: SwitchNode
21
- * **Loop nodes**: Repeater, ObjectView, ArrayView, SetView & MapView
22
- * **Bindings**: class, attribute, event
23
- * **DOM** creation tools