vasille-web 5.1.3 → 6.0.0-rc.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/lib/dev.js +32 -10
- package/lib/index.js +4 -2
- package/package.json +5 -5
- package/types/dev.d.ts +4 -4
- package/types/index.d.ts +2 -2
package/lib/dev.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment } from "vasille";
|
|
2
|
+
import { devMount as coreMount, devDynamicalModule } from "vasille-jsx/dev";
|
|
2
3
|
import { devRouteApp as coreRouteApp } from "vasille-router/dev";
|
|
3
|
-
import { DevPortal, DevRunner, errorToString, toDevValue } from "vasille/dev";
|
|
4
|
+
import { DevPortal, DevRunner, errorToString, toDevValue, } from "vasille/dev";
|
|
4
5
|
import { modal, prompt } from "./index.js";
|
|
5
6
|
function createPortal(node, declaration, usage, name) {
|
|
6
7
|
const portal = new DevPortal({ node: document.body }, node.runner, declaration, usage, name);
|
|
@@ -8,7 +9,8 @@ function createPortal(node, declaration, usage, name) {
|
|
|
8
9
|
return portal;
|
|
9
10
|
}
|
|
10
11
|
export function devModal(modalFn, declaration, name) {
|
|
11
|
-
|
|
12
|
+
const fragments = new Map();
|
|
13
|
+
const run = function (parent, input, usage) {
|
|
12
14
|
modal(modalFn, node => {
|
|
13
15
|
const portal = createPortal(node, declaration, usage, name);
|
|
14
16
|
const inspector = portal.runner.inspector;
|
|
@@ -29,11 +31,25 @@ export function devModal(modalFn, declaration, name) {
|
|
|
29
31
|
});
|
|
30
32
|
});
|
|
31
33
|
return portal;
|
|
32
|
-
})(input,
|
|
34
|
+
})(input, parent, undefined);
|
|
33
35
|
};
|
|
36
|
+
const renderer = (input, node, slot, usage) => {
|
|
37
|
+
if (!node) {
|
|
38
|
+
throw new Error("Vasille: Modal context is missing");
|
|
39
|
+
}
|
|
40
|
+
const frag = new Fragment(node.runner);
|
|
41
|
+
if (!input.slot && slot) {
|
|
42
|
+
input.slot = slot;
|
|
43
|
+
}
|
|
44
|
+
node.create(frag);
|
|
45
|
+
fragments.set(frag, { props: input, node: frag, usage });
|
|
46
|
+
run(frag, input, usage);
|
|
47
|
+
};
|
|
48
|
+
return devDynamicalModule(renderer, fragments, run);
|
|
34
49
|
}
|
|
35
50
|
export function devPrompt(modal, declaration, name) {
|
|
36
|
-
|
|
51
|
+
const fragments = new Map();
|
|
52
|
+
const run = function (node, input, timeout, usage) {
|
|
37
53
|
let target = null;
|
|
38
54
|
let inspector = null;
|
|
39
55
|
const event = {
|
|
@@ -50,8 +66,7 @@ export function devPrompt(modal, declaration, name) {
|
|
|
50
66
|
target,
|
|
51
67
|
});
|
|
52
68
|
return portal;
|
|
53
|
-
})(node, {
|
|
54
|
-
...input,
|
|
69
|
+
})(node, input, timeout, {
|
|
55
70
|
resolve(data) {
|
|
56
71
|
if (inspector && target) {
|
|
57
72
|
inspector.eventTrigger({
|
|
@@ -64,7 +79,6 @@ export function devPrompt(modal, declaration, name) {
|
|
|
64
79
|
},
|
|
65
80
|
});
|
|
66
81
|
}
|
|
67
|
-
input.resolve(data);
|
|
68
82
|
},
|
|
69
83
|
reject(err) {
|
|
70
84
|
if (inspector && target) {
|
|
@@ -78,10 +92,18 @@ export function devPrompt(modal, declaration, name) {
|
|
|
78
92
|
},
|
|
79
93
|
});
|
|
80
94
|
}
|
|
81
|
-
input.reject(err);
|
|
82
95
|
},
|
|
83
|
-
}
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
const renderer = (node, input, timeout, usage) => {
|
|
99
|
+
const frag = new Fragment(node.runner);
|
|
100
|
+
node.create(frag);
|
|
101
|
+
fragments.set(frag, { props: input, node: frag, usage });
|
|
102
|
+
return run(frag, input, timeout, usage);
|
|
84
103
|
};
|
|
104
|
+
return devDynamicalModule(renderer, fragments, (parent, input, usage) => {
|
|
105
|
+
void run(parent, input, 0, usage);
|
|
106
|
+
});
|
|
85
107
|
}
|
|
86
108
|
export function devMount(element, component, input, inspector) {
|
|
87
109
|
return coreMount(element, component, new DevRunner(window.document, inspector), input, inspector);
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { mount as coreMount } from "vasille-jsx";
|
|
|
4
4
|
import { routeApp as coreRouteApp } from "vasille-router/web-router";
|
|
5
5
|
export { styleSheet } from "vasille-css";
|
|
6
6
|
export { safe } from "vasille";
|
|
7
|
-
export { view, view as component, view as compose, ensure, ref, expr, expr as bind, expr as calculate, expr as watch, set, Delay, For, Slot, Watch, awaited, store, model, setModel, mapModel, arrayModel, Switch, setErrorHandler, match, } from "vasille-jsx";
|
|
7
|
+
export { view, view as component, view as compose, ensure, ref, expr, expr as bind, expr as calculate, expr as watch, set, Delay, For, Slot, Watch, awaited, store, model, setModel, mapModel, arrayModel, Switch, setErrorHandler, match, ArrayView, ArrayModelView, MapModelView, SetModelView, QueuedRender, } from "vasille-jsx";
|
|
8
8
|
export { screen, screen as page, } from "vasille-router";
|
|
9
9
|
export { Router } from "vasille-router/web-router";
|
|
10
10
|
export { setMobileMaxWidth, setTabletMaxWidth, setLaptopMaxWidth } from "vasille-css";
|
|
@@ -32,7 +32,7 @@ export function modal(modal, create = createPortal) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
export function prompt(modal, create = createPortal) {
|
|
35
|
-
return function (node, input, timeout) {
|
|
35
|
+
return function (node, input, timeout, debugProps) {
|
|
36
36
|
return new Promise((resolve, reject) => {
|
|
37
37
|
const portal = create(node);
|
|
38
38
|
const timer = timeout &&
|
|
@@ -49,10 +49,12 @@ export function prompt(modal, create = createPortal) {
|
|
|
49
49
|
...input,
|
|
50
50
|
resolve(value) {
|
|
51
51
|
destroy();
|
|
52
|
+
debugProps?.resolve(value);
|
|
52
53
|
resolve(value);
|
|
53
54
|
},
|
|
54
55
|
reject(error) {
|
|
55
56
|
destroy();
|
|
57
|
+
debugProps?.reject(error);
|
|
56
58
|
reject(error);
|
|
57
59
|
},
|
|
58
60
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vasille-web",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-rc.1",
|
|
4
4
|
"description": "The same framework which is designed to build bulletproof frontends.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"homepage": "https://github.com/vasille-js/vasille-js#readme",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"csstype": "^3.1.3",
|
|
53
|
-
"vasille": "
|
|
54
|
-
"vasille-context": "^
|
|
53
|
+
"vasille": "6.0.0-rc.4",
|
|
54
|
+
"vasille-context": "^6.0.0-rc",
|
|
55
55
|
"vasille-css": "^5.0.0",
|
|
56
|
-
"vasille-jsx": "^
|
|
57
|
-
"vasille-router": "^
|
|
56
|
+
"vasille-jsx": "^6.0.0-rc.3",
|
|
57
|
+
"vasille-router": "^6.0.0-rc"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/node": "^24.3.0",
|
package/types/dev.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Fragment } from "vasille";
|
|
1
|
+
import { App, Fragment, Runner as IRunner } from "vasille";
|
|
2
2
|
import { TagOptions } from "vasille/web-runner";
|
|
3
|
-
import { IDevRunner, Inspector, StaticPosition } from "vasille/dev";
|
|
3
|
+
import { DevTagOptions, IDevRunner, Inspector, StaticPosition } from "vasille/dev";
|
|
4
4
|
import { PromptProps } from "./index.js";
|
|
5
5
|
import { WebRouterInitialization } from "vasille-router/web-router";
|
|
6
6
|
import { CompositionProps } from "vasille-jsx";
|
|
7
7
|
export declare function devModal<T extends CompositionProps>(modalFn: (node: Fragment<Node, Element, TagOptions>, input: T) => void, declaration: StaticPosition, name: string): (input: T, node: Fragment<Node, Element, TagOptions>, slot?: T["slot"], usage?: StaticPosition) => void;
|
|
8
8
|
export declare function devPrompt<T extends PromptProps>(modal: (node: Fragment<Node, Element, TagOptions, IDevRunner<Node, Element, TagOptions>>, input: T) => void, declaration: StaticPosition, name: string): (node: Fragment<Node, Element, TagOptions, IDevRunner<Node, Element, TagOptions>>, input: T, timeout: number | undefined, usage: StaticPosition | undefined) => Promise<unknown>;
|
|
9
|
-
export declare function devMount<T>(element: Element, component: ($: T) => void, input: T, inspector: Inspector):
|
|
10
|
-
export declare function devRouterApp<Routes extends string>(init: WebRouterInitialization<Routes>, element: Element, inspector: Inspector):
|
|
9
|
+
export declare function devMount<T>(element: Element, component: ($: T) => void, input: T, inspector: Inspector): App<Node, Element, DevTagOptions, IRunner<Node, Element, DevTagOptions>>;
|
|
10
|
+
export declare function devRouterApp<Routes extends string>(init: WebRouterInitialization<Routes>, element: Element, inspector: Inspector): App<Node, Element, DevTagOptions, IRunner<Node, Element, DevTagOptions>>;
|
package/types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { styleSheet } from "vasille-css";
|
|
|
6
6
|
export type { RawStyleProps as StyleProps, StyleSheetProps } from "./spec/css.js";
|
|
7
7
|
export type { ClassItem } from "./jsx-runtime.js";
|
|
8
8
|
export { safe } from "vasille";
|
|
9
|
-
export { view, view as component, view as compose, ensure, ref, expr, expr as bind, expr as calculate, expr as watch, set, Delay, For, Slot, Watch, awaited, store, model, setModel, mapModel, arrayModel, Switch, setErrorHandler, match, } from "vasille-jsx";
|
|
9
|
+
export { view, view as component, view as compose, ensure, ref, expr, expr as bind, expr as calculate, expr as watch, set, Delay, For, Slot, Watch, awaited, store, model, setModel, mapModel, arrayModel, Switch, setErrorHandler, match, ArrayView, ArrayModelView, MapModelView, SetModelView, QueuedRender, } from "vasille-jsx";
|
|
10
10
|
export { type QueryParams, type ScreenProps, type RouteParameters, screen, screen as page, type FallbackScreenProps, type ErrorScreenProps, } from "vasille-router";
|
|
11
11
|
export { Router, type WebRouterInitialization, type NavigationMode } from "vasille-router/web-router";
|
|
12
12
|
export { setMobileMaxWidth, setTabletMaxWidth, setLaptopMaxWidth } from "vasille-css";
|
|
@@ -16,6 +16,6 @@ export interface PromptProps {
|
|
|
16
16
|
resolve(data: unknown): void;
|
|
17
17
|
reject(err: unknown): void;
|
|
18
18
|
}
|
|
19
|
-
export declare function prompt<T extends PromptProps>(modal: (node: Fragment<Node, Element, TagOptions>, input: T) => void, create?: (node: Fragment<Node, Element, TagOptions>) => Portal<Node, Element, TagOptions>): (node: Fragment<Node, Element, TagOptions>, input: T, timeout?: number) => Promise<unknown>;
|
|
19
|
+
export declare function prompt<T extends PromptProps>(modal: (node: Fragment<Node, Element, TagOptions>, input: T) => void, create?: (node: Fragment<Node, Element, TagOptions>) => Portal<Node, Element, TagOptions>): (node: Fragment<Node, Element, TagOptions>, input: T, timeout?: number, debugProps?: PromptProps) => Promise<unknown>;
|
|
20
20
|
export declare function mount<T>(element: Element, component: ($: T) => void, input: T): App<Node, Element, TagOptions>;
|
|
21
21
|
export declare function routerApp<Routes extends string>(init: WebRouterInitialization<Routes>, element?: Element): App<Node, Element, TagOptions>;
|