vasille-web 4.3.1 → 5.0.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/README.md CHANGED
@@ -1,19 +1,30 @@
1
- # Vasille
1
+ # Steel Frame
2
2
 
3
- ![Vasille.js logo](https://raw.githubusercontent.com/vasille-js/vasille-js/refs/heads/v4/doc/img/logo.png)
3
+ ![Vasille.js logo](https://raw.githubusercontent.com/vasille-js/vasille-js/refs/heads/v5/doc/img/logo.png)
4
4
 
5
- `Vasille Web` is a front-end framework, which is developed to provide bulletproof frontends.
5
+ `SteelFrameKit` is a front-end development kit, which is developed to provide bulletproof frontends.
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/vasille?style=flat-square)](https://www.npmjs.com/package/vasille)
8
8
 
9
9
  ## Table of content
10
10
 
11
- * [Installation](#installation)
12
- * [How to use Vasille](#how-to-use-vasille)
13
- * [How SAFE is Vasille](#how-safe-is-vasille)
14
- * [How INTUITIVE is Vasille](#how-intuitive-is-vasille)
15
- * [How POWERFUL is Vasille](#how-powerful-is-vasille)
16
- * [Road Map](#road-map)
11
+ - [Steel Frame](#steel-frame)
12
+ - [Table of content](#table-of-content)
13
+ - [Installation](#installation)
14
+ - [How to use SteelFramekit](#how-to-use-steelframekit)
15
+ - [Full documentation:](#full-documentation)
16
+ - [Examples](#examples)
17
+ - [How SAFE is SteelFrameKit](#how-safe-is-steelframekit)
18
+ - [How INTUITIVE is SteelFrameKit](#how-intuitive-is-steelframekit)
19
+ - [How POWERFUL is SteelFrameKit](#how-powerful-is-steelframekit)
20
+ - [Road map](#road-map)
21
+ - [Change log](#change-log)
22
+ - [5.0.0](#500)
23
+ - [4.3.0](#430)
24
+ - [4.2.0](#420)
25
+ - [4.1.0](#410)
26
+ - [4.0.0](#400)
27
+ - [Questions](#questions)
17
28
 
18
29
 
19
30
  <hr>
@@ -21,21 +32,22 @@
21
32
  ## Installation
22
33
 
23
34
  ```
24
- npm install vasille-web --save
35
+ npm install steel-frame --save
25
36
  ```
26
37
 
27
- ## How to use Vasille
38
+ ## How to use SteelFramekit
28
39
 
29
40
  Create an app from a template
30
41
 
31
42
  ```bash
32
- $ npm create vasille
43
+ $ npm create steel-frame
33
44
  ```
34
45
 
35
46
  ### Full documentation:
36
- * [Learn `Vasille` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v4/doc/V4-API.md)
37
- * [Vasille Router Documentation](https://github.com/vasille-js/vasille-js/blob/v4/doc/Router-API.md)
38
- * [Vasille Compostion function](https://github.com/vasille-js/vasille-js/blob/v4/doc/Compositions.md)
47
+ * [Learn `SteelFrameKit` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v5/doc/V4-API.md)
48
+ * [Router Documentation](https://github.com/vasille-js/vasille-js/blob/v5/doc/Router-API.md)
49
+ * [Compostion functions](https://github.com/vasille-js/vasille-js/blob/v5/doc/Compositions.md)
50
+ * [Dependency injection](https://github.com/vasille-js/vasille-js/blob/v5/doc/Context.md)
39
51
 
40
52
  ### Examples
41
53
  * [TypeScript Example](https://github.com/vasille-js/example-typescript)
@@ -43,14 +55,14 @@ $ npm create vasille
43
55
 
44
56
  <hr>
45
57
 
46
- ## How SAFE is Vasille
58
+ ## How SAFE is SteelFrameKit
47
59
 
48
60
  The safe of your application is ensured by
49
61
  * `100%` coverage of code by unit tests.
50
62
  Each function, each branch is working as designed.
51
63
  * OOP, DRY, KISS and SOLID principles are applied.
52
64
  * `strong typing` makes your javascript/typescript code safe as C++ code.
53
- All entities of `vasille` core library are strongly typed, including:
65
+ All entities of `SteelFrameKit` core library are strongly typed, including:
54
66
  * data fields & properties.
55
67
  * computed properties (function parameters and result).
56
68
  * methods.
@@ -60,11 +72,11 @@ All entities of `vasille` core library are strongly typed, including:
60
72
  * references to children.
61
73
  * No asynchronous code, when the line of code is executed, the DOM and reactive things are already synced.
62
74
 
63
- ## How INTUITIVE is Vasille
75
+ ## How INTUITIVE is SteelFrameKit
64
76
 
65
77
  There is the "Hello World":
66
78
  ```typescript jsx
67
- import { compose, mount } from "vasille-dx";
79
+ import { compose, mount } from "steel-frame";
68
80
 
69
81
  const App = compose(() => {
70
82
  <p>Hello world</p>;
@@ -73,7 +85,7 @@ const App = compose(() => {
73
85
  mount(document.body, App, {});
74
86
  ```
75
87
 
76
- ## How POWERFUL is Vasille
88
+ ## How POWERFUL is SteelFrameKit
77
89
 
78
90
  All of these are supported:
79
91
  * Components.
@@ -85,25 +97,30 @@ All of these are supported:
85
97
  * 2-way data binding in components.
86
98
  * Logic block (if, else).
87
99
  * Loops (array, map, set).
100
+ * Dependency injection.
88
101
 
89
102
  <hr>
90
103
 
91
104
  ## Road map
92
105
 
93
- * [x] Update the `Vasille Core` library to version 3.0.
106
+ * [x] Update the `core` library to version 3.0.
94
107
  * [x] `100%` Test Coverage for core Library v3.
95
- * [x] Develop the `Vasille JSX` library.
108
+ * [x] Develop the `JSX` library.
96
109
  * [x] `100%` Test Coverage for the JSX library.
97
- * [x] Develop the `Vasille Babel Plugin`.
110
+ * [x] Develop the `Babel Plugin`.
98
111
  * [x] `100%` Test Coverage fot babel plugin.
99
112
  * [x] Add CSS support (define styles in components).
100
113
  * [x] Add router.
101
114
  * [x] Add SSG (static site generation).
115
+ * [ ] Develop tools extension for debugging (WIP).
102
116
  * [ ] Add SSR (server side rendering).
103
- * [ ] Develop tools extension for debugging.
104
117
 
105
118
  ## Change log
106
119
 
120
+ ### 5.0.0
121
+
122
+ Add support for context and dependencies injection.
123
+
107
124
  ### 4.3.0
108
125
 
109
126
  Add new function `safe` which make functions safe, errors are reported automatically.
@@ -114,19 +131,14 @@ Add support for inlined conditions in JSX, binary `&&` and ternary `?:` operator
114
131
 
115
132
  ### 4.1.0
116
133
 
117
- Added SSG (static site generation) as build option `vasille-web build static`.
134
+ Added SSG (static site generation) as build option `sf build static`.
118
135
 
119
136
  ### 4.0.0
120
137
 
121
- Initial version of the framework with file based routing and building scripts (`vasille-web dev` and `vasille-web build spa`).
138
+ Initial version of the framework with file based routing and building scripts (`sf dev` and `sf build spa`).
122
139
 
123
140
  ## Questions
124
141
 
125
142
  If you have questions, feel free to contact the maintainer of the project:
126
143
 
127
144
  * [Author's Email](mailto:vas.lixcode@gmail.com)
128
- * [Author's Telegram](https://t.me/lixcode)
129
-
130
- <hr>
131
-
132
- **Made in Moldova** 🇲🇩
package/lib/dev.js ADDED
@@ -0,0 +1,25 @@
1
+ import { devMount as coreMount } from "vasille-jsx/dev";
2
+ import { devRouteApp as coreRouteApp } from "vasille-router/dev";
3
+ import { DevPortal, DevRunner } from "vasille/dev";
4
+ import { modal, prompt } from "./index.js";
5
+ function createPortal(node, declaration, usage, name) {
6
+ const portal = new DevPortal({ node: document.body }, node.runner, declaration, usage, name);
7
+ node.create(portal);
8
+ return portal;
9
+ }
10
+ export function devModal(modalFn, declaration, name) {
11
+ return (input, node, usage) => {
12
+ modal(modalFn, node => createPortal(node, declaration, usage, name))(input, node);
13
+ };
14
+ }
15
+ export function devPrompt(modal, declaration, name) {
16
+ return function (node, input, timeout, usage) {
17
+ return prompt(modal, node => createPortal(node, declaration, usage, name))(node, input, timeout);
18
+ };
19
+ }
20
+ export function devMount(element, component, input, inspector) {
21
+ return coreMount(element, component, new DevRunner(window.document, inspector), input, inspector);
22
+ }
23
+ export function devRouterApp(init, element, inspector) {
24
+ return coreRouteApp(element, window, window.location, init, inspector);
25
+ }
package/lib/index.js CHANGED
@@ -1,25 +1,25 @@
1
1
  import { Portal, reportError } from "vasille";
2
2
  import { Runner } from "vasille/web-runner";
3
3
  import { mount as coreMount } from "vasille-jsx";
4
- import { styleSheet as coreStyleSheet } from "vasille-css";
5
4
  import { routeApp as coreRouteApp } from "vasille-router/web-router";
5
+ export { styleSheet } from "vasille-css";
6
6
  export { safe } from "vasille";
7
- export { view, view as component, view as compose, forward, backward, ensure, ref, expr, expr as bind, expr as calculate, expr as watch, set, Debug, 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, } from "vasille-jsx";
8
8
  export { screen, screen as page, } from "vasille-router";
9
- export { Router, routeApp } from "vasille-router/web-router";
9
+ export { Router } from "vasille-router/web-router";
10
10
  export { setMobileMaxWidth, setTabletMaxWidth, setLaptopMaxWidth } from "vasille-css";
11
- export const styleSheet = coreStyleSheet;
11
+ export { context, impute, receive, share } from "vasille-context";
12
12
  function createPortal(node) {
13
13
  const portal = new Portal({ node: document.body }, node.runner);
14
14
  node.create(portal);
15
15
  return portal;
16
16
  }
17
- export function modal(modal) {
17
+ export function modal(modal, create = createPortal) {
18
18
  return function (props, node) {
19
19
  if (!node) {
20
20
  throw new Error("Vasille: Modal context is missing");
21
21
  }
22
- const portal = createPortal(node);
22
+ const portal = create(node);
23
23
  try {
24
24
  modal(portal, props);
25
25
  }
@@ -28,10 +28,10 @@ export function modal(modal) {
28
28
  }
29
29
  };
30
30
  }
31
- export function prompt(modal) {
31
+ export function prompt(modal, create = createPortal) {
32
32
  return function (node, input, timeout) {
33
33
  return new Promise((resolve, reject) => {
34
- const portal = createPortal(node);
34
+ const portal = create(node);
35
35
  const timer = timeout &&
36
36
  setTimeout(() => {
37
37
  destroy();
@@ -61,9 +61,9 @@ export function prompt(modal) {
61
61
  });
62
62
  };
63
63
  }
64
- export function mount(element, component, input, debugUi) {
65
- return coreMount(element, component, new Runner(debugUi ?? false, window.document), input);
64
+ export function mount(element, component, input) {
65
+ return coreMount(element, component, new Runner(window.document), input);
66
66
  }
67
- export function routerApp(init, element, debugUi) {
68
- return coreRouteApp(element ?? document.body, window, window.location, init, debugUi);
67
+ export function routerApp(init, element) {
68
+ return coreRouteApp(element ?? document.body, window, window.location, init);
69
69
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "vasille-web",
3
- "version": "4.3.1",
3
+ "version": "5.0.0",
4
4
  "description": "The same framework which is designed to build bulletproof frontends.",
5
5
  "main": "index.js",
6
6
  "types": "./index.d.ts",
7
- "bin": {
8
- "vasille-web": "./lib/bin.js"
9
- },
10
7
  "exports": {
11
8
  ".": {
12
- "types": "./fake-types/index.d.ts",
9
+ "types": "./types/index.d.ts",
13
10
  "import": "./lib/index.js",
14
11
  "browser": "./lib/index.js",
15
12
  "node": "./lib/index.js"
@@ -19,13 +16,19 @@
19
16
  "import": "./lib/jsx-runtime.js",
20
17
  "browser": "./lib/jsx-runtime.js",
21
18
  "node": "./lib/jsx-runtime.js"
19
+ },
20
+ "./dev": {
21
+ "types": "./types/dev.d.ts",
22
+ "import": "./lib/dev.js",
23
+ "browser": "./lib/dev.js",
24
+ "node": "./lib/dev.js"
22
25
  }
23
26
  },
24
27
  "scripts": {
25
28
  "prepack": "cp -f ../README.md ./README.md",
26
- "prettier": "prettier src fake-types --write",
27
- "build": "tsc --build tsconfig.json",
28
- "check-types": "tsc --noEmit --lib es2020 --types web --moduleResolution Node16 --module Node16 ./fake-types/index.d.ts"
29
+ "prettier": "prettier src --write",
30
+ "prebuild": "rm -rf lib types",
31
+ "build": "tsc --build tsconfig.json"
29
32
  },
30
33
  "type": "module",
31
34
  "repository": {
@@ -47,10 +50,11 @@
47
50
  "homepage": "https://github.com/vasille-js/vasille-js#readme",
48
51
  "dependencies": {
49
52
  "csstype": "^3.1.3",
50
- "vasille": "^4.3.1",
51
- "vasille-css": "^4.1.0",
52
- "vasille-jsx": "^4.3.0",
53
- "vasille-router": "^4.0.0"
53
+ "vasille": "^5.0.0",
54
+ "vasille-context": "^5.0.0",
55
+ "vasille-css": "^5.0.0",
56
+ "vasille-jsx": "^5.0.0",
57
+ "vasille-router": "^5.0.0"
54
58
  },
55
59
  "devDependencies": {
56
60
  "@types/node": "^24.3.0",
package/types/dev.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { Fragment } from "vasille";
2
+ import { TagOptions } from "vasille/web-runner";
3
+ import { IDevRunner, Inspector, StaticPosition } from "vasille/dev";
4
+ import { PromptProps } from "./index.js";
5
+ import { WebRouterInitialization } from "vasille-router/web-router";
6
+ export declare function devModal<T extends object>(modalFn: (node: Fragment<Node, Element, TagOptions>, input: T) => void, declaration: StaticPosition, name: string): (input: T, node: Fragment<Node, Element, TagOptions>, usage: StaticPosition | undefined) => void;
7
+ 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
+ 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
+ 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,27 +1,20 @@
1
- import { Fragment } from "vasille";
2
- import { StyleProps } from "../spec/css.js";
1
+ import { App, Fragment, Portal } from "vasille";
3
2
  import { TagOptions } from "vasille/web-runner";
4
3
  import { WebRouterInitialization } from "vasille-router/web-router";
5
- export type { RawStyleProps as StyleProps } from "../spec/css.js";
4
+ export { styleSheet } from "vasille-css";
5
+ export type { RawStyleProps as StyleProps, StyleSheetProps } from "./spec/css.js";
6
6
  export type { ClassItem } from "./jsx-runtime.js";
7
7
  export { safe } from "vasille";
8
- export { view, view as component, view as compose, forward, backward, ensure, ref, expr, expr as bind, expr as calculate, expr as watch, set, Debug, Delay, For, Slot, Watch, awaited, store, model, setModel, mapModel, arrayModel, Switch, setErrorHandler, match, } from "vasille-jsx";
8
+ 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
9
  export { type QueryParams, type ScreenProps, type RouteParameters, screen, screen as page, type FallbackScreenProps, type ErrorScreenProps, } from "vasille-router";
10
- export { Router, type WebRouterInitialization, type NavigationMode, routeApp } from "vasille-router/web-router";
10
+ export { Router, type WebRouterInitialization, type NavigationMode } from "vasille-router/web-router";
11
11
  export { setMobileMaxWidth, setTabletMaxWidth, setLaptopMaxWidth } from "vasille-css";
12
- export declare const styleSheet: <T extends {
13
- [className: string]: {
14
- [media: `@${string}`]: {
15
- [state: `:${string}`]: StyleProps;
16
- } & StyleProps;
17
- [state: `:${string}`]: StyleProps;
18
- } & StyleProps;
19
- }>(input: T) => { [K in keyof T]: string; };
20
- export declare function modal<T extends object>(modal: (node: Fragment<Node, Element, TagOptions>, input: T) => void): (input: T, node: Fragment<Node, Element, TagOptions>) => void;
12
+ export { context, impute, receive, share } from "vasille-context";
13
+ export declare function modal<T extends object>(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>) => void;
21
14
  export interface PromptProps {
22
15
  resolve(data: unknown): void;
23
16
  reject(err: unknown): void;
24
17
  }
25
- export declare function prompt<T extends PromptProps>(modal: (node: Fragment<Node, Element, TagOptions>, input: T) => void): (node: Fragment<Node, Element, TagOptions>, input: T, timeout?: number) => Promise<unknown>;
26
- export declare function mount<T>(element: Element, component: ($: T) => void, input: T, debugUi?: boolean): import("vasille").App<Node, Element, TagOptions, object>;
27
- export declare function routerApp<Routes extends string>(init: WebRouterInitialization<Routes>, element?: Element, debugUi?: boolean): import("vasille").App<Node, Element, TagOptions, object>;
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 mount<T>(element: Element, component: ($: T) => void, input: T): App<Node, Element, TagOptions>;
20
+ export declare function routerApp<Routes extends string>(init: WebRouterInitialization<Routes>, element?: Element): App<Node, Element, TagOptions>;
@@ -1,5 +1,5 @@
1
- import type { RawStyleProps } from "../spec/css.d.ts";
2
- import type { HtmlTagMap } from "../spec/html.d.ts";
1
+ import type { RawStyleProps } from "./spec/css.ts";
2
+ import type { HtmlTagMap } from "./spec/html.ts";
3
3
  type prefixedObject<T, P extends string> = {
4
4
  [K in keyof T as K extends string ? `${P}${K}` : never]?: T[K];
5
5
  };
@@ -21,7 +21,7 @@ export declare namespace JSX {
21
21
  slot: unknown;
22
22
  }
23
23
  interface IntrinsicElements {
24
- a2: HtmlInput<"a">;
24
+ a: HtmlInput<"a">;
25
25
  abbr: HtmlInput<"abbr">;
26
26
  address: HtmlInput<"address">;
27
27
  area: HtmlInput<"area">;
@@ -0,0 +1,7 @@
1
+ import type { ObsoletePropertiesHyphen, StandardPropertiesHyphen, VendorPropertiesHyphen } from "csstype";
2
+ export type RawStyleProps = StandardPropertiesHyphen<string | number | number[]> & VendorPropertiesHyphen<string | number | number[]> & ObsoletePropertiesHyphen<string | number | number[]> & {
3
+ [variable: `--${string}`]: string;
4
+ };
5
+ export type StyleSheetProps = {
6
+ [K in keyof RawStyleProps]: RawStyleProps[K] | RawStyleProps[K][];
7
+ };