vasille-jsx 3.1.3 → 3.2.1
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/README.md +5 -4
- package/lib/components.js +21 -16
- package/lib/compose.js +80 -23
- package/lib/index.js +1 -1
- package/lib/internal.js +5 -2
- package/lib/models.js +2 -0
- package/lib/objects.js +5 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +2 -2
- package/types/components.d.ts +8 -8
- package/types/compose.d.ts +7 -5
- package/types/index.d.ts +1 -1
- package/types/internal.d.ts +2 -1
- package/types/tsconfig-types.tsbuildinfo +1 -0
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* [Installation](#installation)
|
|
12
12
|
* [How to use Vasille](#how-to-use-vasille)
|
|
13
13
|
* [How SAFE is Vasille](#how-safe-is-vasille)
|
|
14
|
-
* [How
|
|
14
|
+
* [How INTUITIVE is Vasille](#how-intuitive-is-vasille)
|
|
15
15
|
* [How POWERFUL is Vasille](#how-powerful-is-vasille)
|
|
16
16
|
* [Road Map](#road-map)
|
|
17
17
|
|
|
@@ -44,6 +44,7 @@ $ npx degit vasille-js/example-javascript my-project
|
|
|
44
44
|
|
|
45
45
|
### Full documentation:
|
|
46
46
|
* [Learn `Vasille` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v3/doc/V3-API.md)
|
|
47
|
+
* [Vasille Router Documentation](https://github.com/vasille-js/vasille-js/blob/v3/doc/Router-API.md)
|
|
47
48
|
|
|
48
49
|
### Examples
|
|
49
50
|
* [TypeScript Example](https://github.com/vasille-js/example-typescript)
|
|
@@ -60,7 +61,7 @@ The safe of your application is ensured by
|
|
|
60
61
|
* `strong typing` makes your javascript/typescript code safe as C++ code.
|
|
61
62
|
All entities of `vasille` core library are strongly typed, including:
|
|
62
63
|
* data fields & properties.
|
|
63
|
-
* computed properties (function parameters
|
|
64
|
+
* computed properties (function parameters and result).
|
|
64
65
|
* methods.
|
|
65
66
|
* events (defined handlers & event emit).
|
|
66
67
|
* DOM events & DOM operation (attributing, styling, etc.).
|
|
@@ -68,7 +69,7 @@ All entities of `vasille` core library are strongly typed, including:
|
|
|
68
69
|
* references to children.
|
|
69
70
|
* No asynchronous code, when the line of code is executed, the DOM and reactive things are already synced.
|
|
70
71
|
|
|
71
|
-
## How
|
|
72
|
+
## How INTUITIVE is Vasille
|
|
72
73
|
|
|
73
74
|
There is the "Hello World":
|
|
74
75
|
```typescript jsx
|
|
@@ -105,7 +106,7 @@ All of these are supported:
|
|
|
105
106
|
* [x] Develop the `Vasille Babel Plugin`.
|
|
106
107
|
* [x] `100%` Test Coverage fot babel plugin.
|
|
107
108
|
* [x] Add CSS support (define styles in components).
|
|
108
|
-
* [
|
|
109
|
+
* [x] Add router.
|
|
109
110
|
* [ ] Add SSR (server side rendering).
|
|
110
111
|
* [ ] Develop tools extension for debugging.
|
|
111
112
|
|
package/lib/components.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ArrayModel, ArrayView, Fragment, IValue, MapModel, MapView, SetModel, S
|
|
|
2
2
|
export function readValue(v) {
|
|
3
3
|
return v instanceof IValue ? v.$ : v;
|
|
4
4
|
}
|
|
5
|
-
export function Slot(ctx,
|
|
5
|
+
export function Slot(options, ctx, defaultSlot) {
|
|
6
6
|
const model = readValue(options.model);
|
|
7
7
|
if (model) {
|
|
8
8
|
if (model.length <= 1) {
|
|
@@ -14,6 +14,7 @@ export function Slot(ctx, options) {
|
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
16
|
for (const key in options) {
|
|
17
|
+
/* istanbul ignore else */
|
|
17
18
|
if (!(options[key] instanceof IValue)) {
|
|
18
19
|
options[key] = ctx.ref(options[key]);
|
|
19
20
|
}
|
|
@@ -22,25 +23,27 @@ export function Slot(ctx, options) {
|
|
|
22
23
|
model(options, ctx);
|
|
23
24
|
}
|
|
24
25
|
else {
|
|
25
|
-
readValue(options.slot)?.(ctx);
|
|
26
|
+
(readValue(options.slot) ?? defaultSlot)?.(ctx);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
export function If(
|
|
29
|
-
const slot = readValue(magicSlot);
|
|
29
|
+
export function If({ condition, slot: magicSlot }, ctx, defaultSlot) {
|
|
30
|
+
const slot = readValue(magicSlot) ?? defaultSlot;
|
|
30
31
|
ctx.if(condition instanceof IValue ? condition : ctx.ref(condition), slot ?? (() => { }));
|
|
31
32
|
}
|
|
32
|
-
export function ElseIf(
|
|
33
|
-
const slot = readValue(magicSlot);
|
|
33
|
+
export function ElseIf({ condition, slot: magicSlot }, ctx, defaultSlot) {
|
|
34
|
+
const slot = readValue(magicSlot) ?? defaultSlot;
|
|
34
35
|
ctx.elif(condition instanceof IValue ? condition : ctx.ref(condition), slot ?? (() => { }));
|
|
35
36
|
}
|
|
36
|
-
export function Else(
|
|
37
|
-
const slot = readValue(magicSlot);
|
|
37
|
+
export function Else({ slot: magicSlot }, ctx, defaultSlot) {
|
|
38
|
+
const slot = readValue(magicSlot) ?? defaultSlot;
|
|
39
|
+
/* istanbul ignore else */
|
|
38
40
|
if (slot) {
|
|
39
41
|
ctx.else(slot);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
export function For(
|
|
43
|
-
const slot = readValue(magicSlot);
|
|
44
|
+
export function For({ of, slot: magicSlot }, ctx, defaultSlot) {
|
|
45
|
+
const slot = readValue(magicSlot) ?? defaultSlot;
|
|
46
|
+
/* istanbul ignore else */
|
|
44
47
|
if (of instanceof IValue) {
|
|
45
48
|
ctx.create(new CoreWatch({
|
|
46
49
|
model: of,
|
|
@@ -71,7 +74,7 @@ export function For(ctx, { of, slot: magicSlot }) {
|
|
|
71
74
|
else if (model instanceof SetModel) {
|
|
72
75
|
node.create(new SetView({
|
|
73
76
|
model,
|
|
74
|
-
slot,
|
|
77
|
+
slot: slot,
|
|
75
78
|
}, node.runner));
|
|
76
79
|
}
|
|
77
80
|
// fallback if is used external Array/Map/Set
|
|
@@ -98,21 +101,23 @@ export function For(ctx, { of, slot: magicSlot }) {
|
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
export function Watch(
|
|
102
|
-
const slot = readValue(magicSlot);
|
|
104
|
+
export function Watch({ model, slot: magicSlot }, ctx, defaultSlot) {
|
|
105
|
+
const slot = readValue(magicSlot) ?? defaultSlot;
|
|
106
|
+
/* istanbul ignore else */
|
|
103
107
|
if (slot && model instanceof IValue) {
|
|
104
108
|
ctx.create(new CoreWatch({ model, slot }, ctx.runner));
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
|
-
export function Debug(
|
|
111
|
+
export function Debug({ model }, ctx) {
|
|
108
112
|
const value = model instanceof IValue ? model : ctx.ref(model);
|
|
109
113
|
ctx.debug(value);
|
|
110
114
|
}
|
|
111
|
-
export function Delay(
|
|
115
|
+
export function Delay({ time, slot }, ctx, defaultSlot) {
|
|
112
116
|
const fragment = new Fragment({}, ctx.runner, ":timer");
|
|
113
|
-
const dSlot = readValue(slot);
|
|
117
|
+
const dSlot = readValue(slot) ?? defaultSlot;
|
|
114
118
|
let timer;
|
|
115
119
|
ctx.create(fragment, function (node) {
|
|
120
|
+
/* istanbul ignore else */
|
|
116
121
|
if (dSlot) {
|
|
117
122
|
timer = setTimeout(() => {
|
|
118
123
|
dSlot(node);
|
package/lib/compose.js
CHANGED
|
@@ -1,36 +1,93 @@
|
|
|
1
1
|
import { Fragment, App, reportError, IValue, Reference } from "vasille";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
function create(node, renderer, props, callback, slot, name) {
|
|
3
|
+
if (!node) {
|
|
4
|
+
throw new Error("Vasille: Component context is missing");
|
|
5
|
+
}
|
|
6
|
+
const frag = new Fragment(props, node.runner, name);
|
|
7
|
+
if (slot) {
|
|
8
|
+
props.slot = slot;
|
|
9
|
+
}
|
|
10
|
+
node.create(frag);
|
|
11
|
+
try {
|
|
12
|
+
const result = renderer(frag, props);
|
|
13
|
+
if (result !== undefined && callback) {
|
|
14
|
+
callback(result);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
reportError(e);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function fieldError(key) {
|
|
22
|
+
return new Error([
|
|
23
|
+
`Vasille: Field ${key} has a reactive value, which is not allowed in model.`,
|
|
24
|
+
"Use bridge.stored() to disable the reactivity of value,",
|
|
25
|
+
"or hybridView properties parameter which accepts reactive values.",
|
|
26
|
+
].join(" "));
|
|
8
27
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
|
|
28
|
+
function getProp(target, p, isModel) {
|
|
29
|
+
if (isModel) {
|
|
30
|
+
const value = target[p];
|
|
31
|
+
if (value instanceof IValue) {
|
|
32
|
+
throw fieldError(String(p));
|
|
14
33
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const value = target[p];
|
|
38
|
+
if (value instanceof IValue) {
|
|
39
|
+
return value;
|
|
21
40
|
}
|
|
22
|
-
|
|
23
|
-
|
|
41
|
+
return (target[p] = new Reference(target[p]));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function mvvmView(renderer, name) {
|
|
45
|
+
return function (props, node, slot) {
|
|
46
|
+
create(node, renderer, new Proxy(props, {
|
|
47
|
+
get(target, p) {
|
|
48
|
+
return getProp(target, p);
|
|
49
|
+
},
|
|
50
|
+
}), props.callback, slot, name);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function mvcView(renderer, name) {
|
|
54
|
+
return function (props, node, slot) {
|
|
55
|
+
for (const key in props) {
|
|
56
|
+
if (props[key] instanceof IValue) {
|
|
57
|
+
throw fieldError(key);
|
|
58
|
+
}
|
|
24
59
|
}
|
|
60
|
+
create(node, renderer, props, props.callback, slot, name);
|
|
25
61
|
};
|
|
26
62
|
}
|
|
27
|
-
export function
|
|
28
|
-
|
|
63
|
+
export function hybridView(renderer, modelProps, name) {
|
|
64
|
+
if (modelProps.length === 0) {
|
|
65
|
+
return mvvmView(renderer, name);
|
|
66
|
+
}
|
|
67
|
+
else if (modelProps.length === 1) {
|
|
68
|
+
const key = modelProps[0];
|
|
69
|
+
return function (props, node, slot) {
|
|
70
|
+
create(node, renderer, new Proxy(props, {
|
|
71
|
+
get(target, p) {
|
|
72
|
+
return getProp(target, p, key === p);
|
|
73
|
+
},
|
|
74
|
+
}), props.callback, slot, name);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const modelPropsSet = new Set(modelProps);
|
|
78
|
+
return function (props, node, slot) {
|
|
79
|
+
create(node, renderer, new Proxy(props, {
|
|
80
|
+
get(target, p) {
|
|
81
|
+
return getProp(target, p, modelPropsSet.has(p));
|
|
82
|
+
},
|
|
83
|
+
}), props.callback, slot, name);
|
|
84
|
+
};
|
|
29
85
|
}
|
|
30
|
-
export function mount(tag,
|
|
86
|
+
export function mount(tag, view, runner, $) {
|
|
31
87
|
const root = new App(tag, runner, {});
|
|
32
88
|
const frag = new Fragment({}, runner, ":app-root");
|
|
33
89
|
root.create(frag, function () {
|
|
34
|
-
|
|
90
|
+
view($, frag);
|
|
35
91
|
});
|
|
92
|
+
return root;
|
|
36
93
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Debug, Delay, Else, ElseIf, For, If, Slot, Watch } from "./components.js";
|
|
2
|
-
export {
|
|
2
|
+
export { mvvmView, mvcView, hybridView, mount } from "./compose.js";
|
|
3
3
|
export { awaited, store } from "./library.js";
|
|
4
4
|
export { internal as $ } from "./internal.js";
|
package/lib/internal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { proxyArrayModel, Expression, Pointer, Reference } from "vasille";
|
|
1
|
+
import { IValue, proxyArrayModel, Expression, Pointer, Reference } from "vasille";
|
|
2
2
|
import { reactiveObject, reactiveObjectProxy, storeReactiveObject } from "./objects.js";
|
|
3
3
|
import { ContextArray, ContextMap, ContextSet } from "./models.js";
|
|
4
4
|
export const internal = {
|
|
@@ -8,12 +8,15 @@ export const internal = {
|
|
|
8
8
|
},
|
|
9
9
|
/** create a forward-only pointer (without context), use it for OwningPointer */
|
|
10
10
|
fo(v) {
|
|
11
|
-
return new Pointer(v
|
|
11
|
+
return new Pointer(v);
|
|
12
12
|
},
|
|
13
13
|
/** create a reference (without context), use it for default composing props values */
|
|
14
14
|
r(v) {
|
|
15
15
|
return new Reference(v);
|
|
16
16
|
},
|
|
17
|
+
rv(v) {
|
|
18
|
+
return v instanceof IValue ? v.$ : v;
|
|
19
|
+
},
|
|
17
20
|
/** create a reactive object proxy, use it for sending reactive objects to child components */
|
|
18
21
|
rop(o) {
|
|
19
22
|
return reactiveObjectProxy(o);
|
package/lib/models.js
CHANGED
|
@@ -90,6 +90,7 @@ export class ContextArray extends ArrayModel {
|
|
|
90
90
|
export class ContextMap extends MapModel {
|
|
91
91
|
constructor(map) {
|
|
92
92
|
const ctx = new Context();
|
|
93
|
+
/* istanbul ignore else */
|
|
93
94
|
if (map) {
|
|
94
95
|
for (const item of map) {
|
|
95
96
|
item[1] = ctx.checkEnable(item[1]);
|
|
@@ -122,6 +123,7 @@ export class ContextSet extends SetModel {
|
|
|
122
123
|
constructor(set) {
|
|
123
124
|
const ctx = new Context();
|
|
124
125
|
const real = new Map();
|
|
126
|
+
/* istanbul ignore else */
|
|
125
127
|
if (set) {
|
|
126
128
|
for (let i = 0; i < set.length; i++) {
|
|
127
129
|
real.set(set[i], (set[i] = ctx.checkEnable(set[i])));
|
package/lib/objects.js
CHANGED
|
@@ -13,6 +13,7 @@ export function proxyObject(obj, proxyRef) {
|
|
|
13
13
|
},
|
|
14
14
|
set(target, p, newValue, receiver) {
|
|
15
15
|
const response = Reflect.set(target, p, newValue, receiver);
|
|
16
|
+
/* istanbul ignore else */
|
|
16
17
|
if (response) {
|
|
17
18
|
proxyRef.forceUpdate();
|
|
18
19
|
}
|
|
@@ -20,6 +21,7 @@ export function proxyObject(obj, proxyRef) {
|
|
|
20
21
|
},
|
|
21
22
|
defineProperty(target, property, attributes) {
|
|
22
23
|
const response = Reflect.defineProperty(target, property, attributes);
|
|
24
|
+
/* istanbul ignore else */
|
|
23
25
|
if (response) {
|
|
24
26
|
proxyRef.forceUpdate();
|
|
25
27
|
}
|
|
@@ -27,6 +29,7 @@ export function proxyObject(obj, proxyRef) {
|
|
|
27
29
|
},
|
|
28
30
|
deleteProperty(target, p) {
|
|
29
31
|
const response = Reflect.deleteProperty(target, p);
|
|
32
|
+
/* istanbul ignore else */
|
|
30
33
|
if (response) {
|
|
31
34
|
proxyRef.forceUpdate();
|
|
32
35
|
}
|
|
@@ -61,6 +64,7 @@ export function reactiveObject(node, o, name) {
|
|
|
61
64
|
}
|
|
62
65
|
},
|
|
63
66
|
deleteProperty(_, p) {
|
|
67
|
+
/* istanbul ignore else */
|
|
64
68
|
if (p in o && o[p] instanceof IValue) {
|
|
65
69
|
node.release(p[0]);
|
|
66
70
|
}
|
|
@@ -81,6 +85,7 @@ export function reactiveObjectProxy(o) {
|
|
|
81
85
|
}
|
|
82
86
|
export function storeReactiveObject(o) {
|
|
83
87
|
for (const key of Object.keys(o)) {
|
|
88
|
+
/* istanbul ignore else */
|
|
84
89
|
if (!(o[key] instanceof IValue)) {
|
|
85
90
|
o[key] = new Reference(proxy(o[key]));
|
|
86
91
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/components.ts","../src/compose.ts","../src/index.ts","../src/internal.ts","../src/library.ts","../src/models.ts","../src/objects.ts"],"version":"5.9.2"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vasille-jsx",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "The first Developer eXperience Orientated front-end framework (JSX components)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "git+https://github.com/vasille-js/vasille-js.git"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"vasille": "^3.1
|
|
40
|
+
"vasille": "^3.2.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/jest": "^30.0.0",
|
package/types/components.d.ts
CHANGED
|
@@ -7,34 +7,34 @@ interface SlotOptions<Node, Element, TagOptions extends object, T extends object
|
|
|
7
7
|
model?: (input: T, ctx: Fragment<Node, Element, TagOptions>) => void;
|
|
8
8
|
slot?: (ctx: Fragment<Node, Element, TagOptions>) => void;
|
|
9
9
|
}
|
|
10
|
-
export declare function Slot<Node, Element, TagOptions extends object, T extends object = {}>(ctx: Fragment<Node, Element, TagOptions>,
|
|
10
|
+
export declare function Slot<Node, Element, TagOptions extends object, T extends object = {}>(options: Magic<SlotOptions<Node, Element, TagOptions, T>> & T, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: (ctx: Fragment<Node, Element, TagOptions>) => void): void;
|
|
11
11
|
interface IfOptions {
|
|
12
12
|
condition: unknown;
|
|
13
13
|
slot?: () => void;
|
|
14
14
|
}
|
|
15
|
-
export declare function If<Node, Element, TagOptions extends object>(ctx: Fragment<Node, Element, TagOptions>,
|
|
16
|
-
export declare function ElseIf<Node, Element, TagOptions extends object>(ctx: Fragment<Node, Element, TagOptions>,
|
|
15
|
+
export declare function If<Node, Element, TagOptions extends object>({ condition, slot: magicSlot }: Magic<IfOptions>, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: () => void): void;
|
|
16
|
+
export declare function ElseIf<Node, Element, TagOptions extends object>({ condition, slot: magicSlot }: Magic<IfOptions>, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: () => void): void;
|
|
17
17
|
interface ElseOptions {
|
|
18
18
|
slot?: () => void;
|
|
19
19
|
}
|
|
20
|
-
export declare function Else<Node, Element, TagOptions extends object>(ctx: Fragment<Node, Element, TagOptions>,
|
|
20
|
+
export declare function Else<Node, Element, TagOptions extends object>({ slot: magicSlot }: Magic<ElseOptions>, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: () => void): void;
|
|
21
21
|
interface ForOptions<Node, Element, TagOptions extends object, T, K, V> {
|
|
22
22
|
of: T;
|
|
23
23
|
slot?: (ctx: Fragment<Node, Element, TagOptions>, value: T, index: K) => void;
|
|
24
24
|
}
|
|
25
|
-
export declare function For<Node, Element, TagOptions extends object, T extends Set<unknown> | Map<unknown, unknown> | unknown[], K = T extends unknown[] ? number : T extends Set<infer R> ? R : T extends Map<infer R, unknown> ? R : never, V = T extends (infer R)[] ? R : T extends Set<infer R> ? R : T extends Map<unknown, infer R> ? R : never>(
|
|
25
|
+
export declare function For<Node, Element, TagOptions extends object, T extends Set<unknown> | Map<unknown, unknown> | unknown[], K = T extends unknown[] ? number : T extends Set<infer R> ? R : T extends Map<infer R, unknown> ? R : never, V = T extends (infer R)[] ? R : T extends Set<infer R> ? R : T extends Map<unknown, infer R> ? R : never>({ of, slot: magicSlot }: Magic<ForOptions<Node, Element, TagOptions, T, K, V>>, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: (ctx: Fragment<Node, Element, TagOptions>) => void): void;
|
|
26
26
|
interface WatchOptions<Node, Element, TagOptions extends object, T> {
|
|
27
27
|
model: T;
|
|
28
28
|
slot?: (ctx: Fragment<Node, Element, TagOptions>, value: T) => void;
|
|
29
29
|
}
|
|
30
|
-
export declare function Watch<Node, Element, TagOptions extends object, T>(
|
|
30
|
+
export declare function Watch<Node, Element, TagOptions extends object, T>({ model, slot: magicSlot }: Magic<WatchOptions<Node, Element, TagOptions, T>>, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: (ctx: Fragment<Node, Element, TagOptions>) => void): void;
|
|
31
31
|
interface DebugOptions {
|
|
32
32
|
model: unknown;
|
|
33
33
|
}
|
|
34
|
-
export declare function Debug<Node, Element, TagOptions extends object>(ctx: Fragment<Node, Element, TagOptions
|
|
34
|
+
export declare function Debug<Node, Element, TagOptions extends object>({ model }: DebugOptions, ctx: Fragment<Node, Element, TagOptions>): void;
|
|
35
35
|
interface DelayOptions<Node, Element, TagOptions extends object> {
|
|
36
36
|
time?: number;
|
|
37
37
|
slot?: (ctx: Fragment<Node, Element, TagOptions>) => unknown;
|
|
38
38
|
}
|
|
39
|
-
export declare function Delay<Node, Element, TagOptions extends object>(ctx: Fragment<Node, Element, TagOptions>,
|
|
39
|
+
export declare function Delay<Node, Element, TagOptions extends object>({ time, slot }: Magic<DelayOptions<Node, Element, TagOptions>>, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: (ctx: Fragment<Node, Element, TagOptions>) => void): void;
|
|
40
40
|
export {};
|
package/types/compose.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { Fragment, Runner } from "vasille";
|
|
1
|
+
import { Fragment, App, Runner } from "vasille";
|
|
2
2
|
interface CompositionProps {
|
|
3
3
|
slot?: (...args: any[]) => void;
|
|
4
4
|
}
|
|
5
|
-
type Composed<Node, Element, TagOptions extends object, In extends CompositionProps, Out> = (
|
|
5
|
+
export type Composed<Node, Element, TagOptions extends object, In extends CompositionProps, Out> = ($: In & {
|
|
6
6
|
callback?(data: Out | undefined): void;
|
|
7
|
-
}, slot?: In["slot"]) => void;
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
7
|
+
}, node?: Fragment<Node, Element, TagOptions>, slot?: In["slot"]) => void;
|
|
8
|
+
export declare function mvvmView<Node, Element, TagOptions extends object, In extends CompositionProps, Out>(renderer: (node: Fragment<Node, Element, TagOptions>, input: In) => Out, name: string): Composed<Node, Element, TagOptions, In, Out>;
|
|
9
|
+
export declare function mvcView<Node, Element, TagOptions extends object, In extends CompositionProps, Out>(renderer: (node: Fragment<Node, Element, TagOptions>, input: In) => Out, name: string): Composed<Node, Element, TagOptions, In, Out>;
|
|
10
|
+
export declare function hybridView<Node, Element, TagOptions extends object, In extends CompositionProps, Out>(renderer: (node: Fragment<Node, Element, TagOptions>, input: In) => Out, modelProps: string[], name: string): Composed<Node, Element, TagOptions, In, Out>;
|
|
11
|
+
export declare function mount<Node, Element, TagOptions extends object, T>(tag: Element, view: ($: T, node: Fragment<Node, Element, TagOptions>) => unknown, runner: Runner<Node, Element, TagOptions>, $: T): App<Node, Element, TagOptions>;
|
|
10
12
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Debug, Delay, Else, ElseIf, For, If, Slot, Watch } from "./components.js";
|
|
2
|
-
export {
|
|
2
|
+
export { mvvmView, mvcView, hybridView, mount, Composed } from "./compose.js";
|
|
3
3
|
export { awaited, store } from "./library.js";
|
|
4
4
|
export { internal as $ } from "./internal.js";
|
package/types/internal.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ export declare const internal: {
|
|
|
5
5
|
/** create an expression (without context), use it for OwningPointer */
|
|
6
6
|
ex<T, Args extends unknown[]>(func: (...args: Args) => T, values: KindOfIValue<Args>): Expression<T, Args>;
|
|
7
7
|
/** create a forward-only pointer (without context), use it for OwningPointer */
|
|
8
|
-
fo<T>(v: IValue<T>
|
|
8
|
+
fo<T>(v: IValue<T>): IValue<T>;
|
|
9
9
|
/** create a reference (without context), use it for default composing props values */
|
|
10
10
|
r<T>(v: T): IValue<T>;
|
|
11
|
+
rv<T>(v: T | IValue<T>): T;
|
|
11
12
|
/** create a reactive object proxy, use it for sending reactive objects to child components */
|
|
12
13
|
rop<T extends {
|
|
13
14
|
[k: string | symbol]: IValue<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/components.ts","../src/compose.ts","../src/index.ts","../src/internal.ts","../src/library.ts","../src/models.ts","../src/objects.ts"],"version":"5.9.2"}
|