vasille 2.0.3 → 2.0.4

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/cdn/es2015.js CHANGED
@@ -2428,7 +2428,7 @@ class Extension extends INode {
2428
2428
  $.node = parent.node;
2429
2429
  }
2430
2430
  else {
2431
- throw internalError("A extension node can be encapsulated only in a tag/extension/component");
2431
+ throw userError("A extension node can be encapsulated only in a tag/extension/component", "virtual-dom");
2432
2432
  }
2433
2433
  }
2434
2434
  constructor($) {
@@ -2452,7 +2452,7 @@ class Component extends Extension {
2452
2452
  $mounted() {
2453
2453
  super.$mounted();
2454
2454
  if (this.$children.length !== 1) {
2455
- throw userError("UserNode must have a child only", "dom-error");
2455
+ throw userError("Component must have a child only", "dom-error");
2456
2456
  }
2457
2457
  const child = this.$children[0];
2458
2458
  if (child instanceof Tag || child instanceof Component) {
@@ -2460,9 +2460,12 @@ class Component extends Extension {
2460
2460
  $.node = child.node;
2461
2461
  }
2462
2462
  else {
2463
- throw userError("UserNode child must be Tag or Component", "dom-error");
2463
+ throw userError("Component child must be Tag or Component", "dom-error");
2464
2464
  }
2465
2465
  }
2466
+ $preinit(app, parent) {
2467
+ this.$.preinit(app, parent);
2468
+ }
2466
2469
  }
2467
2470
  /**
2468
2471
  * Private part of switch node
package/cdn/es5.js CHANGED
@@ -2778,7 +2778,7 @@ var Extension = /** @class */ (function (_super) {
2778
2778
  $.node = parent.node;
2779
2779
  }
2780
2780
  else {
2781
- throw internalError("A extension node can be encapsulated only in a tag/extension/component");
2781
+ throw userError("A extension node can be encapsulated only in a tag/extension/component", "virtual-dom");
2782
2782
  }
2783
2783
  };
2784
2784
  Extension.prototype.$destroy = function () {
@@ -2802,7 +2802,7 @@ var Component = /** @class */ (function (_super) {
2802
2802
  Component.prototype.$mounted = function () {
2803
2803
  _super.prototype.$mounted.call(this);
2804
2804
  if (this.$children.length !== 1) {
2805
- throw userError("UserNode must have a child only", "dom-error");
2805
+ throw userError("Component must have a child only", "dom-error");
2806
2806
  }
2807
2807
  var child = this.$children[0];
2808
2808
  if (child instanceof Tag || child instanceof Component) {
@@ -2810,9 +2810,12 @@ var Component = /** @class */ (function (_super) {
2810
2810
  $.node = child.node;
2811
2811
  }
2812
2812
  else {
2813
- throw userError("UserNode child must be Tag or Component", "dom-error");
2813
+ throw userError("Component child must be Tag or Component", "dom-error");
2814
2814
  }
2815
2815
  };
2816
+ Component.prototype.$preinit = function (app, parent) {
2817
+ this.$.preinit(app, parent);
2818
+ };
2816
2819
  return Component;
2817
2820
  }(Extension));
2818
2821
 
@@ -6,13 +6,14 @@ interface IModel {
6
6
  enableReactivity () : void;
7
7
  disableReactivity () : void;
8
8
  }
9
- type AppOptions = ?{
10
- debugUi?: boolean,
11
- freezeUi ?: boolean,
12
- executor ?: Executor
13
- }
14
-
15
9
  declare module "vasille" {
10
+
11
+ declare type AppOptions = ?{
12
+ debugUi?: boolean,
13
+ freezeUi ?: boolean,
14
+ executor ?: Executor
15
+ }
16
+
16
17
  declare export class Destroyable {
17
18
  $seal () : void;
18
19
  $destroy () : void;
@@ -178,7 +179,7 @@ declare module "vasille" {
178
179
  ) : void;
179
180
  }
180
181
  declare export class Slot<
181
- t1 = void, t2 = void, t3 = void, t4 = void, t5 = void, t6 = void, t7 = void, t8 = void, t9 = void
182
+ T = Fragment, t1 = void, t2 = void, t3 = void, t4 = void, t5 = void, t6 = void, t7 = void, t8 = void, t9 = void
182
183
  > {
183
184
  runner : ?(a0 : T, a1 : t1, a2 : t2, a3 : t3, a4 : t4, a5 : t5, a6 : t6, a7 : t7, a8 : t8, a9 : t9) => void;
184
185
 
@@ -232,6 +233,8 @@ declare module "vasille" {
232
233
  removeFirst () : this;
233
234
  removeLast () : this;
234
235
  removeOne (v : T) : this;
236
+ enableReactivity () : void;
237
+ disableReactivity () : void;
235
238
  }
236
239
  declare export class MapModel<K, T> extends Map<K, T> implements IModel {
237
240
  listener : Listener<T, K>;
@@ -240,6 +243,8 @@ declare module "vasille" {
240
243
  clear () : void;
241
244
  delete (key : any) : boolean;
242
245
  set (key : K, value : T) : this;
246
+ enableReactivity () : void;
247
+ disableReactivity () : void;
243
248
  }
244
249
  declare export class ObjectModel<T> extends Object implements IModel {
245
250
  listener : Listener<T, string>;
@@ -248,14 +253,18 @@ declare module "vasille" {
248
253
  get (key : string) : T;
249
254
  set (key : string, v : T) : this;
250
255
  delete (key : string) : void;
256
+ enableReactivity () : void;
257
+ disableReactivity () : void;
251
258
  }
252
259
  declare export class SetModel<T> extends Set<T> implements IModel {
253
260
  listener : Listener<T, T>;
254
261
 
255
262
  constructor (set ?: T[]) : void;
256
263
  add (value : T) : this;
257
- clear () : this;
264
+ clear () : void;
258
265
  delete (value : T) : boolean;
266
+ enableReactivity () : void;
267
+ disableReactivity () : void;
259
268
  }
260
269
  declare export class AppNode extends INode {
261
270
  $run : Executor;
@@ -298,7 +307,6 @@ declare module "vasille" {
298
307
  preinit (app : AppNode, parent: Fragment) : void;
299
308
  }
300
309
  declare export class Fragment extends Reactive {
301
- $ : FragmentPrivate;
302
310
  $children : Array<Fragment>;
303
311
 
304
312
  constructor ($ : ?FragmentPrivate) : void;
@@ -322,12 +330,12 @@ declare module "vasille" {
322
330
  $debug(text : IValue<string>) : this;
323
331
  $tag<T = Element> (
324
332
  tagName : string,
325
- cb : ?(node : Tag, element : T) => void
333
+ cb ?: (node : Tag, element : T) => void
326
334
  ) : this;
327
335
  $create<T> (
328
336
  node : T,
329
- callback : ($ : T) => void,
330
- callback1 : ($ : T) => void
337
+ callback ?: ($ : T) => void,
338
+ callback1 ?: ($ : T) => void
331
339
  ) : this;
332
340
  $if (
333
341
  cond : IValue<boolean>,
@@ -353,7 +361,6 @@ declare module "vasille" {
353
361
  preinitText (app : AppNode, parent: Fragment, text : IValue<string>) : void;
354
362
  }
355
363
  declare export class TextNode extends Fragment {
356
- $ : TextNodePrivate;
357
364
  constructor () : void;
358
365
 
359
366
  $preinit (app : AppNode, parent : Fragment, text : ?IValue<string>) : void;
@@ -366,7 +373,6 @@ declare module "vasille" {
366
373
  constructor () : void;
367
374
  }
368
375
  declare export class INode extends Fragment {
369
- $ : INodePrivate;
370
376
 
371
377
  constructor ($ : ?INodePrivate) : void;
372
378
  $init () : this;
@@ -595,7 +601,6 @@ declare module "vasille" {
595
601
  preinitComment (app : AppNode, parent: Fragment, text : IValue<string>) : void;
596
602
  }
597
603
  declare export class DebugNode extends Fragment {
598
- $ : DebugPrivate;
599
604
 
600
605
  constructor () : void;
601
606
 
package/lib/node/node.js CHANGED
@@ -1012,7 +1012,7 @@ export class Extension extends INode {
1012
1012
  $.node = parent.node;
1013
1013
  }
1014
1014
  else {
1015
- throw internalError("A extension node can be encapsulated only in a tag/extension/component");
1015
+ throw userError("A extension node can be encapsulated only in a tag/extension/component", "virtual-dom");
1016
1016
  }
1017
1017
  }
1018
1018
  constructor($) {
@@ -1036,7 +1036,7 @@ export class Component extends Extension {
1036
1036
  $mounted() {
1037
1037
  super.$mounted();
1038
1038
  if (this.$children.length !== 1) {
1039
- throw userError("UserNode must have a child only", "dom-error");
1039
+ throw userError("Component must have a child only", "dom-error");
1040
1040
  }
1041
1041
  const child = this.$children[0];
1042
1042
  if (child instanceof Tag || child instanceof Component) {
@@ -1044,9 +1044,12 @@ export class Component extends Extension {
1044
1044
  $.node = child.node;
1045
1045
  }
1046
1046
  else {
1047
- throw userError("UserNode child must be Tag or Component", "dom-error");
1047
+ throw userError("Component child must be Tag or Component", "dom-error");
1048
1048
  }
1049
1049
  }
1050
+ $preinit(app, parent) {
1051
+ this.$.preinit(app, parent);
1052
+ }
1050
1053
  }
1051
1054
  /**
1052
1055
  * Private part of switch node
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Vasille - Safe. Fast. Powerful.",
4
4
  "main": "lib/index.js",
5
5
  "types": "types/index.d.ts",
6
- "version": "2.0.3",
6
+ "version": "2.0.4",
7
7
  "exports": {
8
8
  "import": "./lib/index.js",
9
9
  "browser": "./lib/index.js"
@@ -23,13 +23,12 @@
23
23
  "url": "https://gitlab.com/vasille-js/vasille-js.git"
24
24
  },
25
25
  "keywords": [
26
+ "front-end",
27
+ "web",
28
+ "app",
26
29
  "safe",
27
30
  "fast",
28
- "poweful",
29
- "frontend",
30
- "javascript",
31
- "typescript",
32
- "flow-js"
31
+ "poweful"
33
32
  ],
34
33
  "author": "Vasile Lixcode <lixcode@vivaldi.net> (https://t.me/lixcode)",
35
34
  "license": "MIT",
@@ -667,6 +667,7 @@ export declare class Extension extends INode {
667
667
  export declare class Component extends Extension {
668
668
  constructor();
669
669
  $mounted(): void;
670
+ $preinit(app: AppNode, parent: Fragment): void;
670
671
  }
671
672
  /**
672
673
  * Private part of switch node