vasille 4.0.0 → 4.1.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/lib/models/array-model.js +10 -6
- package/lib/node/node.js +3 -3
- package/lib/views/set-view.js +0 -1
- package/package.json +2 -2
- package/types/models/listener.d.ts +6 -6
- package/types/views/set-view.d.ts +1 -1
- package/eslint.config.js +0 -25
|
@@ -48,9 +48,11 @@ export class ArrayModel extends Array {
|
|
|
48
48
|
* @return {*} removed value
|
|
49
49
|
*/
|
|
50
50
|
pop() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
if (this.length > 0) {
|
|
52
|
+
const v = super.pop();
|
|
53
|
+
this.listener.emitRemoved(v, v);
|
|
54
|
+
return v;
|
|
55
|
+
}
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
56
58
|
* Calls `Array.push` and notify about changes
|
|
@@ -69,9 +71,11 @@ export class ArrayModel extends Array {
|
|
|
69
71
|
* @return {*} the shifted value
|
|
70
72
|
*/
|
|
71
73
|
shift() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
if (this.length > 0) {
|
|
75
|
+
const v = super.shift();
|
|
76
|
+
this.listener.emitRemoved(v, v);
|
|
77
|
+
return v;
|
|
78
|
+
}
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
77
81
|
* Calls `Array.splice` and notify about changed
|
package/lib/node/node.js
CHANGED
|
@@ -177,7 +177,7 @@ export class Fragment extends Root {
|
|
|
177
177
|
* @extends Fragment
|
|
178
178
|
*/
|
|
179
179
|
export class TextNode extends Fragment {
|
|
180
|
-
handler;
|
|
180
|
+
handler = null;
|
|
181
181
|
data;
|
|
182
182
|
constructor(input, runner) {
|
|
183
183
|
super(runner);
|
|
@@ -238,7 +238,7 @@ export class SwitchedNode extends Fragment {
|
|
|
238
238
|
* Index of current true condition
|
|
239
239
|
* @type number
|
|
240
240
|
*/
|
|
241
|
-
index;
|
|
241
|
+
index = -1;
|
|
242
242
|
/**
|
|
243
243
|
* Array of possible cases
|
|
244
244
|
* @type {Array<{cond : IValue<unknown>, cb : function(Fragment)}>}
|
|
@@ -301,7 +301,7 @@ export class SwitchedNode extends Fragment {
|
|
|
301
301
|
* @extends Fragment
|
|
302
302
|
*/
|
|
303
303
|
export class DebugNode extends Fragment {
|
|
304
|
-
handler;
|
|
304
|
+
handler = null;
|
|
305
305
|
data;
|
|
306
306
|
constructor(input, runner) {
|
|
307
307
|
super(runner);
|
package/lib/views/set-view.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vasille",
|
|
3
|
-
"description": "The framework designed to build bulletproof frontends (core library).",
|
|
3
|
+
"description": "The same framework which is designed to build bulletproof frontends (core library).",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.1.0",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./types/index.d.ts",
|
|
@@ -18,31 +18,31 @@ export declare class Listener<ValueT, IndexT = string | number> {
|
|
|
18
18
|
* @param index {*} index of value
|
|
19
19
|
* @param value {*} value of added item
|
|
20
20
|
*/
|
|
21
|
-
emitAdded(index
|
|
21
|
+
emitAdded(index: IndexT, value: ValueT): void;
|
|
22
22
|
/**
|
|
23
23
|
* Emits removed event to listeners
|
|
24
24
|
* @param index {*} index of removed value
|
|
25
25
|
* @param value {*} value of removed item
|
|
26
26
|
*/
|
|
27
|
-
emitRemoved(index
|
|
27
|
+
emitRemoved(index: IndexT, value: ValueT): void;
|
|
28
28
|
/**
|
|
29
29
|
* Adds a handler to added event
|
|
30
30
|
* @param handler {function} function to run on event emitting
|
|
31
31
|
*/
|
|
32
|
-
onAdd(handler: (index
|
|
32
|
+
onAdd(handler: (index: IndexT, value: ValueT) => void): void;
|
|
33
33
|
/**
|
|
34
34
|
* Adds a handler to removed event
|
|
35
35
|
* @param handler {function} function to run on event emitting
|
|
36
36
|
*/
|
|
37
|
-
onRemove(handler: (index
|
|
37
|
+
onRemove(handler: (index: IndexT, value: ValueT) => void): void;
|
|
38
38
|
/**
|
|
39
39
|
* Removes a handler from added event
|
|
40
40
|
* @param handler {function} handler to remove
|
|
41
41
|
*/
|
|
42
|
-
offAdd(handler: (index
|
|
42
|
+
offAdd(handler: (index: IndexT, value: ValueT) => void): void;
|
|
43
43
|
/**
|
|
44
44
|
* Removes a handler form removed event
|
|
45
45
|
* @param handler {function} handler to remove
|
|
46
46
|
*/
|
|
47
|
-
offRemove(handler: (index
|
|
47
|
+
offRemove(handler: (index: IndexT, value: ValueT) => void): void;
|
|
48
48
|
}
|
|
@@ -8,5 +8,5 @@ import { SetModel } from "../models/set-model.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class SetView<Node, Element, TagOptions extends object, T> extends BaseView<Node, Element, TagOptions, T, T, SetModel<T>> {
|
|
10
10
|
constructor(input: BaseViewOptions<Node, Element, TagOptions, T, T, SetModel<T>>, runner: Runner<Node, Element, TagOptions>);
|
|
11
|
-
compose():
|
|
11
|
+
compose(): void;
|
|
12
12
|
}
|
package/eslint.config.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import compat from "eslint-plugin-compat";
|
|
2
|
-
import tseslint from "typescript-eslint";
|
|
3
|
-
import { globalIgnores } from "eslint/config";
|
|
4
|
-
|
|
5
|
-
export default tseslint.config(
|
|
6
|
-
tseslint.configs.base,
|
|
7
|
-
{
|
|
8
|
-
name: "compat check",
|
|
9
|
-
files: ["src/**/*.ts", "src/**/*.tsx"],
|
|
10
|
-
plugins: { compat },
|
|
11
|
-
rules: {
|
|
12
|
-
"compat/compat": "error",
|
|
13
|
-
},
|
|
14
|
-
settings: {
|
|
15
|
-
polyfills: ["Set", "Map"],
|
|
16
|
-
},
|
|
17
|
-
languageOptions: {
|
|
18
|
-
parserOptions: {
|
|
19
|
-
projectService: false,
|
|
20
|
-
tsconfigRootDir: import.meta.dirname,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
globalIgnores(["node_modules", "lib/**/*", "types", "coverage/**/*"]),
|
|
25
|
-
);
|