vasille-web 5.1.4 → 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 CHANGED
@@ -1,6 +1,7 @@
1
- import { devMount as coreMount } from "vasille-jsx/dev";
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
- return (input, node, slot, usage) => {
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, node, slot);
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
- return function (node, input, timeout, usage) {
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 = {
@@ -79,6 +95,15 @@ export function devPrompt(modal, declaration, name) {
79
95
  },
80
96
  });
81
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);
103
+ };
104
+ return devDynamicalModule(renderer, fragments, (parent, input, usage) => {
105
+ void run(parent, input, 0, usage);
106
+ });
82
107
  }
83
108
  export function devMount(element, component, input, inspector) {
84
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vasille-web",
3
- "version": "5.1.4",
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": "^5.1.9",
54
- "vasille-context": "^5.0.0",
53
+ "vasille": "6.0.0-rc.4",
54
+ "vasille-context": "^6.0.0-rc",
55
55
  "vasille-css": "^5.0.0",
56
- "vasille-jsx": "^5.1.4",
57
- "vasille-router": "^5.0.0"
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): import("vasille").App<Node, Element, import("vasille/dev").DevTagOptions, import("vasille").Runner<Node, Element, import("vasille/dev").DevTagOptions>>;
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>>;
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";