vasille 2.2.0 → 2.3.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.
Files changed (43) hide show
  1. package/README.md +34 -28
  2. package/cdn/es2015.js +548 -548
  3. package/cdn/es5.js +616 -608
  4. package/flow-typed/vasille.js +55 -50
  5. package/lib/binding/attribute.js +1 -1
  6. package/lib/binding/binding.js +5 -5
  7. package/lib/binding/class.js +2 -2
  8. package/lib/binding/style.js +1 -1
  9. package/lib/core/core.js +21 -15
  10. package/lib/core/destroyable.js +2 -2
  11. package/lib/core/ivalue.js +4 -4
  12. package/lib/functional/reactivity.js +1 -1
  13. package/lib/index.js +2 -3
  14. package/lib/models/array-model.js +6 -9
  15. package/lib/models/object-model.js +3 -17
  16. package/lib/node/app.js +3 -3
  17. package/lib/node/node.js +53 -42
  18. package/lib/node/watch.js +1 -1
  19. package/lib/v/index.js +1 -1
  20. package/lib/value/expression.js +13 -13
  21. package/lib/value/mirror.js +15 -15
  22. package/lib/value/pointer.js +5 -5
  23. package/lib/value/reference.js +18 -18
  24. package/lib/views/base-view.js +1 -1
  25. package/lib/views/object-view.js +1 -1
  26. package/lib/views/repeat-node.js +4 -4
  27. package/package.json +1 -1
  28. package/types/binding/binding.d.ts +1 -1
  29. package/types/core/core.d.ts +8 -6
  30. package/types/core/destroyable.d.ts +2 -2
  31. package/types/core/ivalue.d.ts +4 -4
  32. package/types/functional/options.d.ts +2 -2
  33. package/types/index.d.ts +3 -4
  34. package/types/models/array-model.d.ts +1 -1
  35. package/types/models/object-model.d.ts +1 -1
  36. package/types/node/node.d.ts +18 -15
  37. package/types/node/watch.d.ts +2 -2
  38. package/types/v/index.d.ts +4 -0
  39. package/types/value/expression.d.ts +5 -5
  40. package/types/value/mirror.d.ts +6 -6
  41. package/types/value/pointer.d.ts +1 -1
  42. package/types/value/reference.d.ts +7 -7
  43. package/types/views/repeat-node.d.ts +3 -3
@@ -11,16 +11,16 @@ declare class Mirror<T> extends Reference<T> {
11
11
  * pointed value
12
12
  * @type IValue
13
13
  */
14
- pointedValue: IValue<T>;
14
+ $pointedValue: IValue<T>;
15
15
  /**
16
16
  * Collection of handlers
17
17
  * @type Set
18
18
  */
19
- handler: any;
19
+ $handler;
20
20
  /**
21
21
  * Ensure forward only synchronization
22
22
  */
23
- forwardOnly: boolean;
23
+ $forwardOnly: boolean;
24
24
  /**
25
25
  * Constructs a notifiable bind to a value
26
26
  * @param value {IValue} is initial value
@@ -29,9 +29,9 @@ declare class Mirror<T> extends Reference<T> {
29
29
  constructor(value: IValue<T>, forwardOnly?: boolean): void;
30
30
  get $(): T;
31
31
  set $(v: T): void;
32
- enable(): void;
33
- disable(): void;
34
- destroy(): void;
32
+ $enable(): void;
33
+ $disable(): void;
34
+ $destroy(): void;
35
35
  }
36
36
 
37
37
 
@@ -73,11 +73,11 @@ declare class Expression<T,Args> extends IValue<T> {
73
73
  constructor(func: (...args: Args) => T, link: boolean, ...values: KindOfIValue<Args>): void;
74
74
  get $(): T;
75
75
  set $(value: T): void;
76
- on(handler: (value: T) => void): this;
77
- off(handler: (value: T) => void): this;
78
- enable(): this;
79
- disable(): this;
80
- destroy(): void;
76
+ $on(handler: (value: T) => void): this;
77
+ $off(handler: (value: T) => void): this;
78
+ $enable(): this;
79
+ $disable(): this;
80
+ $destroy(): void;
81
81
  }
82
82
 
83
83
 
@@ -91,24 +91,24 @@ declare class Reference<T> extends IValue<T> {
91
91
  * The encapsulated value
92
92
  * @type {*}
93
93
  */
94
- value: any;
94
+ $value;
95
95
  /**
96
96
  * Array of handlers
97
97
  * @type {Set}
98
98
  * @readonly
99
99
  */
100
- onchange: any;
100
+ $onchange;
101
101
  /**
102
102
  * @param value {any} the initial value
103
103
  */
104
104
  constructor(value: T): void;
105
105
  get $(): T;
106
106
  set $(value: T): void;
107
- enable(): void;
108
- disable(): void;
109
- on(handler: (value: T) => void): void;
110
- off(handler: (value: T) => void): void;
111
- destroy(): void;
107
+ $enable(): void;
108
+ $disable(): void;
109
+ $on(handler: (value: T) => void): void;
110
+ $off(handler: (value: T) => void): void;
111
+ $destroy(): void;
112
112
  }
113
113
 
114
114
 
@@ -127,7 +127,7 @@ declare class Pointer<T> extends Mirror<T> {
127
127
  * Point a new ivalue
128
128
  * @param value {IValue} value to point
129
129
  */
130
- point(value: IValue<T>): void;
130
+ set $$(value: IValue<T>): void;
131
131
  }
132
132
 
133
133
 
@@ -163,9 +163,9 @@ declare class RepeatNodePrivate<IdT> extends INodePrivate {
163
163
  */
164
164
  nodes: Map<IdT, Fragment>;
165
165
  constructor(): void;
166
- destroy(): void;
166
+ $destroy(): void;
167
167
  }
168
- declare interface RNO<T, IdT> extends Options {
168
+ declare interface RNO<T, IdT> extends FragmentOptions {
169
169
  slot?: (node: Fragment, value: T, index: IdT) => void;
170
170
  }
171
171
  /**
@@ -268,12 +268,12 @@ declare class ObjectModel<T> extends Object implements ListenableModel<string, T
268
268
  * @return {ObjectModel} a pointer to this
269
269
  */
270
270
  set(key: string, v: T): this;
271
+ get values(): Record<string, T>;
271
272
  /**
272
273
  * Deletes an object property
273
274
  * @param key {string} property name
274
275
  */
275
276
  delete(key: string): void;
276
- proxy(): Record<string, T>;
277
277
  enableReactivity(): void;
278
278
  disableReactivity(): void;
279
279
  }
@@ -325,7 +325,6 @@ declare class ArrayModel<T> extends Array<T> implements ListenableModel<T, T> {
325
325
  * @param data {Array} input data
326
326
  */
327
327
  constructor(data?: Array<T>): void;
328
- proxy(): ArrayModel<T>;
329
328
  /**
330
329
  * Gets the last item of array
331
330
  * @return {*} the last item of array
@@ -413,6 +412,7 @@ declare class ArrayModel<T> extends Array<T> implements ListenableModel<T, T> {
413
412
  * @return {this}
414
413
  */
415
414
  removeOne(v: T): this;
415
+ replace(at: number, with_: T): this;
416
416
  enableReactivity(): void;
417
417
  disableReactivity(): void;
418
418
  }
@@ -550,7 +550,7 @@ declare interface ListenableModel<K, T> extends IModel {
550
550
  }
551
551
 
552
552
 
553
- declare interface WatchOptions<T> extends Options {
553
+ declare interface WatchOptions<T> extends FragmentOptions {
554
554
  model: IValue<T>;
555
555
  slot?: (node: Fragment, value: T) => void;
556
556
  }
@@ -602,7 +602,7 @@ declare class FragmentPrivate extends ReactivePrivate {
602
602
  /**
603
603
  * Unlinks all bindings
604
604
  */
605
- destroy(): void;
605
+ $destroy(): void;
606
606
  }
607
607
  /**
608
608
  * This class is symbolic
@@ -637,7 +637,8 @@ declare class Fragment<T> extends Reactive {
637
637
  * @param data {*} additional data
638
638
  */
639
639
  preinit(app: AppNode, parent: Fragment, data?: any): void;
640
- compose(input: Options): void;
640
+ init(): T['return'];
641
+ compose(input: T): void;
641
642
  /** To be overloaded: ready event handler */
642
643
  ready(): void;
643
644
  /**
@@ -681,7 +682,7 @@ declare class Fragment<T> extends Reactive {
681
682
  * @param node {Fragment} vasille element to insert
682
683
  * @param callback {function($ : *)}
683
684
  */
684
- create<T>(node: T, callback?: T['input']['slot']): void;
685
+ create<T>(node: T, callback?: T['input']['slot']): T['input']['return'];
685
686
  /**
686
687
  * Defines an if node
687
688
  * @param cond {IValue} condition
@@ -712,7 +713,7 @@ declare class Fragment<T> extends Reactive {
712
713
  insertBefore(node: Fragment): void;
713
714
  insertAfter(node: Fragment): void;
714
715
  remove(): void;
715
- destroy(): void;
716
+ $destroy(): void;
716
717
  }
717
718
  /**
718
719
  * The part of a text node
@@ -732,7 +733,7 @@ declare class TextNodePrivate extends FragmentPrivate {
732
733
  /**
733
734
  * Clear node data
734
735
  */
735
- destroy(): void;
736
+ $destroy(): void;
736
737
  }
737
738
  /**
738
739
  * Represents a text node
@@ -744,7 +745,7 @@ declare class TextNode extends Fragment {
744
745
  constructor($?: TextNodePrivate): void;
745
746
  preinit(app: AppNode, parent: Fragment, text?: IValue<string> | string): void;
746
747
  findFirstChild(): Node;
747
- destroy(): void;
748
+ $destroy(): void;
748
749
  }
749
750
  /**
750
751
  * The part of a base node
@@ -763,7 +764,7 @@ declare class INodePrivate extends FragmentPrivate {
763
764
  */
764
765
  node: Element;
765
766
  constructor(): void;
766
- destroy(): void;
767
+ $destroy(): void;
767
768
  }
768
769
  /**
769
770
  * Vasille node which can manipulate an element node
@@ -870,7 +871,7 @@ declare class Tag<K> extends INode<TagOptionsWithSlot<K>> {
870
871
  /**
871
872
  * Runs GC
872
873
  */
873
- destroy(): void;
874
+ $destroy(): void;
874
875
  }
875
876
  /**
876
877
  * Represents a vasille extension node
@@ -879,7 +880,8 @@ declare class Tag<K> extends INode<TagOptionsWithSlot<K>> {
879
880
  */
880
881
  declare class Extension<T> extends INode<T> {
881
882
  preinit(app: AppNode, parent: Fragment): void;
882
- destroy(): void;
883
+ extend(options: T): void;
884
+ $destroy(): void;
883
885
  }
884
886
  /**
885
887
  * Node which cas has just a child
@@ -887,6 +889,7 @@ declare class Extension<T> extends INode<T> {
887
889
  * @extends Extension
888
890
  */
889
891
  declare class Component<T> extends Extension<T> {
892
+ init(): void;
890
893
  ready(): void;
891
894
  preinit(app: AppNode, parent: Fragment): void;
892
895
  }
@@ -918,7 +921,7 @@ declare class SwitchedNodePrivate extends FragmentPrivate {
918
921
  /**
919
922
  * Runs GC
920
923
  */
921
- destroy(): void;
924
+ $destroy(): void;
922
925
  }
923
926
  /**
924
927
  * Defines a node witch can switch its children conditionally
@@ -939,7 +942,7 @@ declare class SwitchedNode extends Fragment {
939
942
  */
940
943
  createChild(cb: (node: Fragment) => void): void;
941
944
  ready(): void;
942
- destroy(): void;
945
+ $destroy(): void;
943
946
  }
944
947
  /**
945
948
  * The part of a text node
@@ -957,7 +960,7 @@ declare class DebugPrivate extends FragmentPrivate {
957
960
  /**
958
961
  * Clear node data
959
962
  */
960
- destroy(): void;
963
+ $destroy(): void;
961
964
  }
962
965
  /**
963
966
  * Represents a debug node
@@ -975,7 +978,7 @@ declare class DebugNode extends Fragment {
975
978
  /**
976
979
  * Runs garbage collector
977
980
  */
978
- destroy(): void;
981
+ $destroy(): void;
979
982
  }
980
983
 
981
984
 
@@ -1039,7 +1042,7 @@ declare class Binding<T> extends Destroyable {
1039
1042
  /**
1040
1043
  * Just clear bindings
1041
1044
  */
1042
- destroy(): void;
1045
+ $destroy(): void;
1043
1046
  }
1044
1047
 
1045
1048
 
@@ -1128,13 +1131,13 @@ declare function debug(text: IValue<string>): void;
1128
1131
  declare function predefine<T>(slot: T | null | undefined, predefined: T): T;
1129
1132
 
1130
1133
 
1131
- declare interface Options {
1134
+ declare interface FragmentOptions {
1132
1135
  "v:is"?: Record<string, IValue<any>>;
1133
1136
  return?: any;
1134
1137
  slot?: (node: Fragment, ...args: any[]) => void;
1135
1138
  }
1136
1139
  declare type AttrType<T> = IValue<T | string | null> | T | string | null | undefined;
1137
- declare interface TagOptions<T> extends Options {
1140
+ declare interface TagOptions<T> extends FragmentOptions {
1138
1141
  "v:attr"?: {
1139
1142
  [K : string]:? AttrType<AcceptedTagsSpec[T]['attrs'][K]>;
1140
1143
  } & Record<string, AttrType<number | boolean>>;
@@ -1162,11 +1165,11 @@ declare class Destroyable {
1162
1165
  * Make object fields non configurable
1163
1166
  * @protected
1164
1167
  */
1165
- seal(): void;
1168
+ $seal(): void;
1166
1169
  /**
1167
1170
  * Garbage collector method
1168
1171
  */
1169
- destroy(): void;
1172
+ $destroy(): void;
1170
1173
  }
1171
1174
 
1172
1175
 
@@ -1180,11 +1183,11 @@ declare class Switchable extends Destroyable {
1180
1183
  /**
1181
1184
  * Enable update handlers triggering
1182
1185
  */
1183
- enable(): void;
1186
+ $enable(): void;
1184
1187
  /**
1185
1188
  * disable update handlers triggering
1186
1189
  */
1187
- disable(): void;
1190
+ $disable(): void;
1188
1191
  }
1189
1192
  /**
1190
1193
  * Interface which describes a value
@@ -1215,12 +1218,12 @@ declare class IValue<T> extends Switchable {
1215
1218
  * Add a new handler to value change
1216
1219
  * @param handler {function(value : *)} the handler to add
1217
1220
  */
1218
- on(handler: (value: T) => void): void;
1221
+ $on(handler: (value: T) => void): void;
1219
1222
  /**
1220
1223
  * Removes a handler of value change
1221
1224
  * @param handler {function(value : *)} the handler to remove
1222
1225
  */
1223
- off(handler: (value: T) => void): void;
1226
+ $off(handler: (value: T) => void): void;
1224
1227
  }
1225
1228
 
1226
1229
 
@@ -1267,7 +1270,7 @@ declare class ReactivePrivate extends Destroyable {
1267
1270
  parent: Reactive;
1268
1271
  onDestroy?: () => void;
1269
1272
  constructor(): void;
1270
- destroy(): void;
1273
+ $destroy(): void;
1271
1274
  }
1272
1275
  /**
1273
1276
  * A reactive object
@@ -1340,12 +1343,14 @@ declare class Reactive<T> extends Destroyable {
1340
1343
  * @param onOn {function} on hide feedback
1341
1344
  */
1342
1345
  bindAlive(cond: IValue<boolean>, onOff?: () => void, onOn?: () => void): this;
1343
- init(): void;
1346
+ init(): T['return'];
1344
1347
  applyOptions(input: T): void;
1345
- compose(input: T): void;
1348
+ applyOptionsNow(): void;
1349
+ compose(input: T): T['return'];
1350
+ composeNow(): void;
1346
1351
  runFunctional<F>(f: F, ...args: Parameters<F>): ReturnType<F>;
1347
1352
  runOnDestroy(func: () => void): void;
1348
- destroy(): void;
1353
+ $destroy(): void;
1349
1354
  }
1350
1355
 
1351
1356
 
@@ -26,6 +26,6 @@ export class AttributeBinding extends Binding {
26
26
  node.node.removeAttribute(name);
27
27
  }
28
28
  });
29
- this.seal();
29
+ this.$seal();
30
30
  }
31
31
  }
@@ -12,18 +12,18 @@ export class Binding extends Destroyable {
12
12
  constructor(value) {
13
13
  super();
14
14
  this.binding = value;
15
- this.seal();
15
+ this.$seal();
16
16
  }
17
17
  init(bounded) {
18
18
  this.func = bounded;
19
- this.binding.on(this.func);
19
+ this.binding.$on(this.func);
20
20
  this.func(this.binding.$);
21
21
  }
22
22
  /**
23
23
  * Just clear bindings
24
24
  */
25
- destroy() {
26
- this.binding.off(this.func);
27
- super.destroy();
25
+ $destroy() {
26
+ this.binding.$off(this.func);
27
+ super.$destroy();
28
28
  }
29
29
  }
@@ -20,7 +20,7 @@ export class StaticClassBinding extends Binding {
20
20
  this.current = value;
21
21
  }
22
22
  });
23
- this.seal();
23
+ this.$seal();
24
24
  }
25
25
  }
26
26
  export class DynamicalClassBinding extends Binding {
@@ -38,6 +38,6 @@ export class DynamicalClassBinding extends Binding {
38
38
  this.current = value;
39
39
  }
40
40
  });
41
- this.seal();
41
+ this.$seal();
42
42
  }
43
43
  }
@@ -18,6 +18,6 @@ export class StyleBinding extends Binding {
18
18
  node.node.style.setProperty(name, value);
19
19
  }
20
20
  });
21
- this.seal();
21
+ this.$seal();
22
22
  }
23
23
  }
package/lib/core/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Destroyable } from "./destroyable.js";
2
- import { wrongBinding } from "./errors";
2
+ import { notOverwritten, wrongBinding } from "./errors";
3
3
  import { Expression } from "../value/expression";
4
4
  import { Reference } from "../value/reference";
5
5
  import { Pointer } from "../value/pointer";
@@ -45,18 +45,18 @@ export class ReactivePrivate extends Destroyable {
45
45
  * @type {boolean}
46
46
  */
47
47
  this.frozen = false;
48
- this.seal();
48
+ this.$seal();
49
49
  }
50
- destroy() {
51
- this.watch.forEach(value => value.destroy());
50
+ $destroy() {
51
+ this.watch.forEach(value => value.$destroy());
52
52
  this.watch.clear();
53
- this.bindings.forEach(binding => binding.destroy());
53
+ this.bindings.forEach(binding => binding.$destroy());
54
54
  this.bindings.clear();
55
55
  this.models.forEach(model => model.disableReactivity());
56
56
  this.models.clear();
57
- this.freezeExpr && this.freezeExpr.destroy();
57
+ this.freezeExpr && this.freezeExpr.$destroy();
58
58
  this.onDestroy && this.onDestroy();
59
- super.destroy();
59
+ super.$destroy();
60
60
  }
61
61
  }
62
62
  /**
@@ -69,7 +69,7 @@ export class Reactive extends Destroyable {
69
69
  super();
70
70
  this.input = input;
71
71
  this.$ = $ || new ReactivePrivate;
72
- this.seal();
72
+ this.$seal();
73
73
  }
74
74
  /**
75
75
  * Get parent node
@@ -152,7 +152,7 @@ export class Reactive extends Destroyable {
152
152
  const $ = this.$;
153
153
  if (!$.enabled) {
154
154
  $.watch.forEach(watcher => {
155
- watcher.enable();
155
+ watcher.$enable();
156
156
  });
157
157
  $.models.forEach(model => {
158
158
  model.enableReactivity();
@@ -167,7 +167,7 @@ export class Reactive extends Destroyable {
167
167
  const $ = this.$;
168
168
  if ($.enabled) {
169
169
  $.watch.forEach(watcher => {
170
- watcher.disable();
170
+ watcher.$disable();
171
171
  });
172
172
  $.models.forEach(model => {
173
173
  model.disableReactivity();
@@ -204,13 +204,19 @@ export class Reactive extends Destroyable {
204
204
  }
205
205
  init() {
206
206
  this.applyOptions(this.input);
207
- this.compose(this.input);
207
+ return this.compose(this.input);
208
208
  }
209
209
  applyOptions(input) {
210
210
  // empty
211
211
  }
212
+ applyOptionsNow() {
213
+ this.applyOptions(this.input);
214
+ }
212
215
  compose(input) {
213
- // empty
216
+ throw notOverwritten();
217
+ }
218
+ composeNow() {
219
+ this.compose(this.input);
214
220
  }
215
221
  runFunctional(f, ...args) {
216
222
  stack(this);
@@ -224,9 +230,9 @@ export class Reactive extends Destroyable {
224
230
  runOnDestroy(func) {
225
231
  this.$.onDestroy = func;
226
232
  }
227
- destroy() {
228
- super.destroy();
229
- this.$.destroy();
233
+ $destroy() {
234
+ super.$destroy();
235
+ this.$.$destroy();
230
236
  this.$ = null;
231
237
  }
232
238
  }
@@ -7,7 +7,7 @@ export class Destroyable {
7
7
  * Make object fields non configurable
8
8
  * @protected
9
9
  */
10
- seal() {
10
+ $seal() {
11
11
  const $ = this;
12
12
  Object.keys($).forEach(i => {
13
13
  // eslint-disable-next-line no-prototype-builtins
@@ -39,7 +39,7 @@ export class Destroyable {
39
39
  /**
40
40
  * Garbage collector method
41
41
  */
42
- destroy() {
42
+ $destroy() {
43
43
  // nothing here
44
44
  }
45
45
  }
@@ -4,13 +4,13 @@ export class Switchable extends Destroyable {
4
4
  /**
5
5
  * Enable update handlers triggering
6
6
  */
7
- enable() {
7
+ $enable() {
8
8
  throw notOverwritten();
9
9
  }
10
10
  /**
11
11
  * disable update handlers triggering
12
12
  */
13
- disable() {
13
+ $disable() {
14
14
  throw notOverwritten();
15
15
  }
16
16
  }
@@ -45,14 +45,14 @@ export class IValue extends Switchable {
45
45
  * Add a new handler to value change
46
46
  * @param handler {function(value : *)} the handler to add
47
47
  */
48
- on(handler) {
48
+ $on(handler) {
49
49
  throw notOverwritten();
50
50
  }
51
51
  /**
52
52
  * Removes a handler of value change
53
53
  * @param handler {function(value : *)} the handler to remove
54
54
  */
55
- off(handler) {
55
+ $off(handler) {
56
56
  throw notOverwritten();
57
57
  }
58
58
  }
@@ -25,7 +25,7 @@ export function valueOf(value) {
25
25
  }
26
26
  export function setValue(ref, value) {
27
27
  if (ref instanceof Pointer && value instanceof IValue) {
28
- ref.point(value);
28
+ ref.$$ = value;
29
29
  }
30
30
  else {
31
31
  ref.$ = value instanceof IValue ? value.$ : value;
package/lib/index.js CHANGED
@@ -6,7 +6,7 @@ import { Listener } from "./models/listener";
6
6
  import { MapModel } from "./models/map-model";
7
7
  import { ObjectModel } from "./models/object-model";
8
8
  import { SetModel } from "./models/set-model";
9
- import { App, AppNode } from "./node/app";
9
+ import { App, AppNode, Portal } from "./node/app";
10
10
  import { Component, Extension, Fragment, INode, Tag } from "./node/node";
11
11
  import { Expression } from "./value/expression";
12
12
  import { Mirror } from "./value/mirror";
@@ -18,5 +18,4 @@ import { MapView } from "./views/map-view";
18
18
  import { ObjectView } from "./views/object-view";
19
19
  import { SetView } from "./views/set-view";
20
20
  import { Binding } from "./binding/binding";
21
- import * as libV from "./v/index";
22
- export { Destroyable, IValue, Reference, Mirror, Pointer, ArrayModel, MapModel, ObjectModel, SetModel, BaseView, Listener, ArrayView, MapView, ObjectView, SetView, Fragment, INode, Tag, Component, Extension, AppNode, App, Expression, Binding, Reactive, libV };
21
+ export { Destroyable, IValue, Reference, Mirror, Pointer, ArrayModel, MapModel, ObjectModel, SetModel, BaseView, Listener, ArrayView, MapView, ObjectView, SetView, Fragment, INode, Tag, Component, Extension, AppNode, App, Portal, Expression, Binding, Reactive };
@@ -19,15 +19,6 @@ export class ArrayModel extends Array {
19
19
  super.push(data[i]);
20
20
  }
21
21
  }
22
- // proxy
23
- proxy() {
24
- return new Proxy(this, {
25
- set(target, p, value) {
26
- target.splice(parseInt(p), 1, value);
27
- return true;
28
- }
29
- });
30
- }
31
22
  /* Array members */
32
23
  /**
33
24
  * Gets the last item of array
@@ -208,6 +199,12 @@ export class ArrayModel extends Array {
208
199
  this.removeAt(this.indexOf(v));
209
200
  return this;
210
201
  }
202
+ replace(at, with_) {
203
+ this.listener.emitAdded(this[at], with_);
204
+ this.listener.emitRemoved(this[at], this[at]);
205
+ this[at] = with_;
206
+ return this;
207
+ }
211
208
  enableReactivity() {
212
209
  this.listener.enableReactivity();
213
210
  }
@@ -56,6 +56,9 @@ export class ObjectModel extends Object {
56
56
  this.listener.emitAdded(key, this.container[key]);
57
57
  return this;
58
58
  }
59
+ get values() {
60
+ return this.container;
61
+ }
59
62
  /**
60
63
  * Deletes an object property
61
64
  * @param key {string} property name
@@ -66,23 +69,6 @@ export class ObjectModel extends Object {
66
69
  delete this.container[key];
67
70
  }
68
71
  }
69
- proxy() {
70
- // eslint-disable-next-line @typescript-eslint/no-this-alias
71
- const ts = this;
72
- return new Proxy(this.container, {
73
- get(target, p) {
74
- return ts.get(p);
75
- },
76
- set(target, p, value) {
77
- ts.set(p, value);
78
- return true;
79
- },
80
- deleteProperty(target, p) {
81
- ts.delete(p);
82
- return true;
83
- }
84
- });
85
- }
86
72
  enableReactivity() {
87
73
  this.listener.enableReactivity();
88
74
  }
package/lib/node/app.js CHANGED
@@ -11,7 +11,7 @@ export class AppNode extends INode {
11
11
  constructor(input) {
12
12
  super(input);
13
13
  this.debugUi = input.debugUi || false;
14
- this.seal();
14
+ this.$seal();
15
15
  }
16
16
  }
17
17
  /**
@@ -30,7 +30,7 @@ export class App extends AppNode {
30
30
  this.$.node = node;
31
31
  this.preinit(this, this);
32
32
  this.init();
33
- this.seal();
33
+ this.$seal();
34
34
  }
35
35
  appendNode(node) {
36
36
  this.$.node.appendChild(node);
@@ -40,7 +40,7 @@ export class Portal extends AppNode {
40
40
  constructor(input) {
41
41
  super(input);
42
42
  this.$.node = input.node;
43
- this.seal();
43
+ this.$seal();
44
44
  }
45
45
  appendNode(node) {
46
46
  this.$.node.appendChild(node);