vasille 2.2.2 → 2.3.2

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 (68) hide show
  1. package/README.md +34 -28
  2. package/cdn/es2015.js +18 -724
  3. package/cdn/es5.js +687 -957
  4. package/flow-typed/vasille.js +14 -59
  5. package/lib/core/core.js +3 -3
  6. package/lib/index.js +5 -4
  7. package/lib/models/array-model.js +6 -9
  8. package/lib/models/object-model.js +3 -17
  9. package/lib/node/node.js +6 -3
  10. package/lib/views/object-view.js +1 -1
  11. package/lib-node/binding/attribute.js +35 -0
  12. package/lib-node/binding/binding.js +33 -0
  13. package/lib-node/binding/class.js +48 -0
  14. package/lib-node/binding/style.js +27 -0
  15. package/lib-node/core/core.js +243 -0
  16. package/lib-node/core/destroyable.js +49 -0
  17. package/lib-node/core/errors.js +23 -0
  18. package/lib-node/core/ivalue.js +63 -0
  19. package/lib-node/functional/options.js +2 -0
  20. package/lib-node/index.js +54 -0
  21. package/lib-node/models/array-model.js +218 -0
  22. package/lib-node/models/listener.js +134 -0
  23. package/lib-node/models/map-model.js +70 -0
  24. package/lib-node/models/model.js +2 -0
  25. package/lib-node/models/object-model.js +82 -0
  26. package/lib-node/models/set-model.js +66 -0
  27. package/lib-node/node/app.js +54 -0
  28. package/lib-node/node/node.js +885 -0
  29. package/lib-node/node/watch.js +23 -0
  30. package/lib-node/spec/html.js +2 -0
  31. package/lib-node/spec/react.js +2 -0
  32. package/lib-node/spec/svg.js +2 -0
  33. package/lib-node/value/expression.js +90 -0
  34. package/lib-node/value/mirror.js +60 -0
  35. package/lib-node/value/pointer.js +30 -0
  36. package/lib-node/value/reference.js +55 -0
  37. package/lib-node/views/array-view.js +21 -0
  38. package/lib-node/views/base-view.js +43 -0
  39. package/lib-node/views/map-view.js +18 -0
  40. package/lib-node/views/object-view.js +20 -0
  41. package/lib-node/views/repeat-node.js +71 -0
  42. package/lib-node/views/set-view.js +19 -0
  43. package/package.json +21 -17
  44. package/types/core/core.d.ts +4 -4
  45. package/types/functional/options.d.ts +2 -2
  46. package/types/index.d.ts +10 -7
  47. package/types/models/array-model.d.ts +1 -1
  48. package/types/models/object-model.d.ts +1 -1
  49. package/types/node/node.d.ts +5 -4
  50. package/types/node/watch.d.ts +2 -2
  51. package/types/views/repeat-node.d.ts +2 -2
  52. package/lib/core/executor.js +0 -154
  53. package/lib/core/signal.js +0 -50
  54. package/lib/core/slot.js +0 -47
  55. package/lib/functional/components.js +0 -17
  56. package/lib/functional/merge.js +0 -41
  57. package/lib/functional/models.js +0 -26
  58. package/lib/functional/reactivity.js +0 -33
  59. package/lib/functional/stack.js +0 -127
  60. package/lib/node/interceptor.js +0 -83
  61. package/lib/v/index.js +0 -23
  62. package/lib/views/repeater.js +0 -63
  63. package/types/functional/components.d.ts +0 -4
  64. package/types/functional/merge.d.ts +0 -1
  65. package/types/functional/models.d.ts +0 -10
  66. package/types/functional/reactivity.d.ts +0 -11
  67. package/types/functional/stack.d.ts +0 -24
  68. package/types/v/index.d.ts +0 -36
@@ -1,63 +0,0 @@
1
- import { RepeatNode, RepeatNodePrivate } from "./repeat-node";
2
- import { Reference } from "../value/reference";
3
- /**
4
- * Private part of repeater
5
- * @class RepeaterPrivate
6
- * @extends RepeatNodePrivate
7
- */
8
- export class RepeaterPrivate extends RepeatNodePrivate {
9
- constructor() {
10
- super();
11
- /**
12
- * Current count of child nodes
13
- */
14
- this.currentCount = 0;
15
- this.seal();
16
- }
17
- }
18
- /**
19
- * The simplest repeat node interpretation, repeat children pack a several times
20
- * @class Repeater
21
- * @extends RepeatNode
22
- */
23
- export class Repeater extends RepeatNode {
24
- constructor($) {
25
- super($ || new RepeaterPrivate);
26
- /**
27
- * The count of children
28
- */
29
- this.count = new Reference(0);
30
- this.seal();
31
- }
32
- /**
33
- * Changes the children count
34
- */
35
- changeCount(number) {
36
- const $ = this.$;
37
- if (number > $.currentCount) {
38
- for (let i = $.currentCount; i < number; i++) {
39
- this.createChild(i, i);
40
- }
41
- }
42
- else {
43
- for (let i = $.currentCount - 1; i >= number; i--) {
44
- this.destroyChild(i, i);
45
- }
46
- }
47
- $.currentCount = number;
48
- }
49
- created() {
50
- const $ = this.$;
51
- super.created();
52
- $.updateHandler = this.changeCount.bind(this);
53
- this.count.on($.updateHandler);
54
- }
55
- ready() {
56
- this.changeCount(this.count.$);
57
- }
58
- destroy() {
59
- const $ = this.$;
60
- super.destroy();
61
- this.count.off($.updateHandler);
62
- }
63
- }
@@ -1,4 +0,0 @@
1
- import { IValue } from "../core/ivalue";
2
- export declare function text(text: string | IValue<string>): void;
3
- export declare function debug(text: IValue<string>): void;
4
- export declare function predefine<T extends (...args: any) => any>(slot: T | null | undefined, predefined: T): T;
@@ -1 +0,0 @@
1
- export declare function merge(main: Record<string, any>, ...targets: Record<string, any>[]): void;
@@ -1,10 +0,0 @@
1
- import { ArrayModel } from "../models/array-model";
2
- import { MapModel } from "../models/map-model";
3
- import { SetModel } from "../models/set-model";
4
- import { ObjectModel } from "../models/object-model";
5
- export declare function arrayModel<T>(arr?: T[]): ArrayModel<T>;
6
- export declare function mapModel<K, T>(map?: [K, T][]): MapModel<K, T>;
7
- export declare function setModel<T>(arr?: T[]): SetModel<T>;
8
- export declare function objectModel<T>(obj?: {
9
- [p: string]: T;
10
- }): ObjectModel<T>;
@@ -1,11 +0,0 @@
1
- import { IValue } from "../core/ivalue";
2
- import { Pointer } from "../value/pointer";
3
- import { KindOfIValue } from "../value/expression";
4
- export declare function ref<T>(value: T): [IValue<T>, (value: T) => void];
5
- export declare function mirror<T>(value: IValue<T>): import("../index").Mirror<T>;
6
- export declare function forward<T>(value: IValue<T>): import("../index").Mirror<T>;
7
- export declare function point<T>(value: IValue<T>): Pointer<T>;
8
- export declare function expr<T, Args extends unknown[]>(func: (...args: Args) => T, ...values: KindOfIValue<Args>): IValue<T>;
9
- export declare function watch<Args extends unknown[]>(func: (...args: Args) => void, ...values: KindOfIValue<Args>): void;
10
- export declare function valueOf<T>(value: IValue<T>): T;
11
- export declare function setValue<T>(ref: IValue<T>, value: IValue<T> | T): void;
@@ -1,24 +0,0 @@
1
- import { Fragment, TagOptionsWithSlot } from "../node/node";
2
- import { AppOptions } from "../node/app";
3
- import { Options, TagOptions } from "./options";
4
- import { IValue } from "../core/ivalue";
5
- import { ListenableModel } from "../models/model";
6
- import { AcceptedTagsMap } from "../spec/react";
7
- export declare function app<In extends AppOptions<any>>(renderer: (opts: In) => In["return"]): (node: Element, opts: In) => In["return"];
8
- export declare function component<In extends TagOptions<any>>(renderer: (opts: In) => In["return"]): (opts: In, callback?: In['slot']) => In["return"];
9
- export declare function fragment<In extends Options>(renderer: (opts: In) => In["return"]): (opts: In, callback?: In['slot']) => In["return"];
10
- export declare function extension<In extends TagOptions<any>>(renderer: (opts: In) => In["return"]): (opts: In, callback?: In['slot']) => In["return"];
11
- export declare function tag<K extends keyof AcceptedTagsMap>(name: K, opts: TagOptionsWithSlot<K>, callback?: () => void): {
12
- node: (HTMLElementTagNameMap & SVGElementTagNameMap)[K];
13
- };
14
- declare type ExtractParams<T> = T extends ((node: Fragment, ...args: infer P) => any) ? P : never;
15
- export declare function create<T extends Fragment>(node: T, callback?: (...args: ExtractParams<T['input']['slot']>) => void): T;
16
- export declare const vx: {
17
- if(condition: IValue<boolean>, callback: () => void): void;
18
- else(callback: () => void): void;
19
- elif(condition: IValue<boolean>, callback: () => void): void;
20
- for<T, K>(model: ListenableModel<K, T>, callback: (value: T, index: K) => void): void;
21
- watch<T_1>(model: IValue<T_1>, callback: (value: T_1) => void): void;
22
- nextTick(callback: () => void): void;
23
- };
24
- export {};
@@ -1,36 +0,0 @@
1
- import { debug, text } from "../functional/components";
2
- import { arrayModel, mapModel, objectModel, setModel } from "../functional/models";
3
- import { expr, forward, mirror, point, ref, setValue, valueOf, watch } from "../functional/reactivity";
4
- import { app, component, create, extension, fragment, tag } from "../functional/stack";
5
- import { Options, TagOptions } from "../functional/options";
6
- import { AppOptions } from "../node/app";
7
- import { Reference } from "../value/reference";
8
- import { merge } from "../functional/merge";
9
- export { debug, arrayModel, mapModel, objectModel, setModel, expr, forward, mirror, point, ref, setValue, valueOf, watch, Options, TagOptions, AppOptions };
10
- export declare type VApp<In extends AppOptions<any> = AppOptions<'div'>> = (node: Element, opts: In) => In['return'];
11
- export declare type VComponent<In extends TagOptions<any>> = (opts: In, callback?: In['slot']) => In['return'];
12
- export declare type VFragment<In extends Options = Options> = (opts: In, callback?: In['slot']) => In['return'];
13
- export declare type VExtension<In extends TagOptions<any>> = (opts: In, callback?: In['slot']) => In['return'];
14
- export declare const v: {
15
- merge: typeof merge;
16
- destructor(): any;
17
- runOnDestroy(callback: () => void): void;
18
- if(condition: import("../index").IValue<boolean>, callback: () => void): void;
19
- else(callback: () => void): void;
20
- elif(condition: import("../index").IValue<boolean>, callback: () => void): void;
21
- for<T, K>(model: import("../models/model").ListenableModel<K, T>, callback: (value: T, index: K) => void): void;
22
- watch<T_1>(model: import("../index").IValue<T_1>, callback: (value: T_1) => void): void;
23
- nextTick(callback: () => void): void;
24
- ref(value: any): import("../index").IValue<any>;
25
- expr: typeof expr;
26
- of: typeof valueOf;
27
- sv: typeof setValue;
28
- alwaysFalse: Reference<boolean>;
29
- app: typeof app;
30
- component: typeof component;
31
- fragment: typeof fragment;
32
- extension: typeof extension;
33
- text: typeof text;
34
- tag: typeof tag;
35
- create: typeof create;
36
- };