vasille-web 5.1.2 → 5.1.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/lib/dev.js +4 -7
- package/lib/index.js +7 -2
- package/package.json +2 -2
- package/types/dev.d.ts +2 -1
- package/types/index.d.ts +3 -2
package/lib/dev.js
CHANGED
|
@@ -8,7 +8,7 @@ function createPortal(node, declaration, usage, name) {
|
|
|
8
8
|
return portal;
|
|
9
9
|
}
|
|
10
10
|
export function devModal(modalFn, declaration, name) {
|
|
11
|
-
return (input, node, usage) => {
|
|
11
|
+
return (input, node, slot, usage) => {
|
|
12
12
|
modal(modalFn, node => {
|
|
13
13
|
const portal = createPortal(node, declaration, usage, name);
|
|
14
14
|
const inspector = portal.runner.inspector;
|
|
@@ -29,7 +29,7 @@ export function devModal(modalFn, declaration, name) {
|
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
31
|
return portal;
|
|
32
|
-
})(input, node);
|
|
32
|
+
})(input, node, slot);
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
export function devPrompt(modal, declaration, name) {
|
|
@@ -50,8 +50,7 @@ export function devPrompt(modal, declaration, name) {
|
|
|
50
50
|
target,
|
|
51
51
|
});
|
|
52
52
|
return portal;
|
|
53
|
-
})(node, {
|
|
54
|
-
...input,
|
|
53
|
+
})(node, input, timeout, {
|
|
55
54
|
resolve(data) {
|
|
56
55
|
if (inspector && target) {
|
|
57
56
|
inspector.eventTrigger({
|
|
@@ -64,7 +63,6 @@ export function devPrompt(modal, declaration, name) {
|
|
|
64
63
|
},
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
|
-
input.resolve(data);
|
|
68
66
|
},
|
|
69
67
|
reject(err) {
|
|
70
68
|
if (inspector && target) {
|
|
@@ -78,9 +76,8 @@ export function devPrompt(modal, declaration, name) {
|
|
|
78
76
|
},
|
|
79
77
|
});
|
|
80
78
|
}
|
|
81
|
-
input.reject(err);
|
|
82
79
|
},
|
|
83
|
-
}
|
|
80
|
+
});
|
|
84
81
|
};
|
|
85
82
|
}
|
|
86
83
|
export function devMount(element, component, input, inspector) {
|
package/lib/index.js
CHANGED
|
@@ -15,11 +15,14 @@ function createPortal(node) {
|
|
|
15
15
|
return portal;
|
|
16
16
|
}
|
|
17
17
|
export function modal(modal, create = createPortal) {
|
|
18
|
-
return function (props, node) {
|
|
18
|
+
return function (props, node, slot) {
|
|
19
19
|
if (!node) {
|
|
20
20
|
throw new Error("Vasille: Modal context is missing");
|
|
21
21
|
}
|
|
22
22
|
const portal = create(node);
|
|
23
|
+
if (!props.slot && slot) {
|
|
24
|
+
props.slot = slot;
|
|
25
|
+
}
|
|
23
26
|
try {
|
|
24
27
|
modal(portal, props);
|
|
25
28
|
}
|
|
@@ -29,7 +32,7 @@ export function modal(modal, create = createPortal) {
|
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
34
|
export function prompt(modal, create = createPortal) {
|
|
32
|
-
return function (node, input, timeout) {
|
|
35
|
+
return function (node, input, timeout, debugProps) {
|
|
33
36
|
return new Promise((resolve, reject) => {
|
|
34
37
|
const portal = create(node);
|
|
35
38
|
const timer = timeout &&
|
|
@@ -46,10 +49,12 @@ export function prompt(modal, create = createPortal) {
|
|
|
46
49
|
...input,
|
|
47
50
|
resolve(value) {
|
|
48
51
|
destroy();
|
|
52
|
+
debugProps?.resolve(value);
|
|
49
53
|
resolve(value);
|
|
50
54
|
},
|
|
51
55
|
reject(error) {
|
|
52
56
|
destroy();
|
|
57
|
+
debugProps?.reject(error);
|
|
53
58
|
reject(error);
|
|
54
59
|
},
|
|
55
60
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vasille-web",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.4",
|
|
4
4
|
"description": "The same framework which is designed to build bulletproof frontends.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"vasille": "^5.1.9",
|
|
54
54
|
"vasille-context": "^5.0.0",
|
|
55
55
|
"vasille-css": "^5.0.0",
|
|
56
|
-
"vasille-jsx": "^5.1.
|
|
56
|
+
"vasille-jsx": "^5.1.4",
|
|
57
57
|
"vasille-router": "^5.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
package/types/dev.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { TagOptions } from "vasille/web-runner";
|
|
|
3
3
|
import { 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
|
+
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;
|
|
7
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>;
|
|
8
9
|
export declare function devMount<T>(element: Element, component: ($: T) => void, input: T, inspector: Inspector): import("vasille").App<Node, Element, import("vasille/dev").DevTagOptions, import("vasille").Runner<Node, Element, import("vasille/dev").DevTagOptions>>;
|
|
9
10
|
export declare function devRouterApp<Routes extends string>(init: WebRouterInitialization<Routes>, element: Element, inspector: Inspector): import("vasille").App<Node, Element, import("vasille/dev").DevTagOptions, import("vasille").Runner<Node, Element, import("vasille/dev").DevTagOptions>>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { App, Fragment, Portal } from "vasille";
|
|
2
2
|
import { TagOptions } from "vasille/web-runner";
|
|
3
|
+
import { CompositionProps } from "vasille-jsx";
|
|
3
4
|
import { WebRouterInitialization } from "vasille-router/web-router";
|
|
4
5
|
export { styleSheet } from "vasille-css";
|
|
5
6
|
export type { RawStyleProps as StyleProps, StyleSheetProps } from "./spec/css.js";
|
|
@@ -10,11 +11,11 @@ export { type QueryParams, type ScreenProps, type RouteParameters, screen, scree
|
|
|
10
11
|
export { Router, type WebRouterInitialization, type NavigationMode } from "vasille-router/web-router";
|
|
11
12
|
export { setMobileMaxWidth, setTabletMaxWidth, setLaptopMaxWidth } from "vasille-css";
|
|
12
13
|
export { context, impute, receive, share } from "vasille-context";
|
|
13
|
-
export declare function modal<T extends
|
|
14
|
+
export declare function modal<T extends CompositionProps>(modal: (node: Fragment<Node, Element, TagOptions>, input: T) => void, create?: (node: Fragment<Node, Element, TagOptions>) => Portal<Node, Element, TagOptions>): (input: T, node: Fragment<Node, Element, TagOptions>, slot?: T["slot"]) => void;
|
|
14
15
|
export interface PromptProps {
|
|
15
16
|
resolve(data: unknown): void;
|
|
16
17
|
reject(err: unknown): void;
|
|
17
18
|
}
|
|
18
|
-
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>;
|
|
19
20
|
export declare function mount<T>(element: Element, component: ($: T) => void, input: T): App<Node, Element, TagOptions>;
|
|
20
21
|
export declare function routerApp<Routes extends string>(init: WebRouterInitialization<Routes>, element?: Element): App<Node, Element, TagOptions>;
|