vasille-context 5.0.0 → 7.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/README.md CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  ![Vasille.js logo](https://raw.githubusercontent.com/vasille-js/vasille-js/refs/heads/v5/doc/img/logo.png)
4
4
 
5
- `SteelFrameKit` is a front-end development kit, which is developed to provide bulletproof frontends.
5
+ `SteelFrameKit` is a front-end development kit, which is developed to provide fault tolerant web applications.
6
6
 
7
- [![npm](https://img.shields.io/npm/v/vasille?style=flat-square)](https://www.npmjs.com/package/vasille)
7
+ [![npm](https://img.shields.io/npm/v/steel-frame?style=round-square)](https://www.npmjs.com/package/steel-frame)
8
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/vasille-js/steel-frame)
9
+ [![Coverage Status](https://coveralls.io/repos/github/vasille-js/steel-frame/badge.svg?branch=v5)](https://coveralls.io/github/vasille-js/steel-frame?branch=v5)
8
10
 
9
11
  ## Table of content
10
12
 
@@ -19,14 +21,15 @@
19
21
  - [How POWERFUL is SteelFrameKit](#how-powerful-is-steelframekit)
20
22
  - [Road map](#road-map)
21
23
  - [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)
24
+ - [7.0](#70)
25
+ - [6.0 RC (never released)](#60-rc-never-released)
26
+ - [5.0 - 5.1](#50---51)
27
+ - [4.0 - 4.3](#40---43)
28
+ - [3.0 - 3.2](#30---32)
29
+ - [2.0 - 2.3](#20---23)
30
+ - [1.0 - 1.2](#10---12)
27
31
  - [Questions](#questions)
28
32
 
29
-
30
33
  <hr>
31
34
 
32
35
  ## Installation
@@ -44,37 +47,41 @@ $ npm create steel-frame
44
47
  ```
45
48
 
46
49
  ### Full documentation:
47
- * [Learn `SteelFrameKit` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v4/doc/V4-API.md)
48
- * [Router Documentation](https://github.com/vasille-js/vasille-js/blob/v4/doc/Router-API.md)
49
- * [Compostion functions](https://github.com/vasille-js/vasille-js/blob/v4/doc/Compositions.md)
50
- * [Dependency injection](https://github.com/vasille-js/vasille-js/blob/v4/doc/Context.md)
50
+
51
+ - [Learn `SteelFrameKit` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v5/doc/V4-API.md)
52
+ - [Router Documentation](https://github.com/vasille-js/vasille-js/blob/v5/doc/Router-API.md)
53
+ - [Compostion functions](https://github.com/vasille-js/vasille-js/blob/v5/doc/Compositions.md)
54
+ - [Dependency injection](https://github.com/vasille-js/vasille-js/blob/v5/doc/Context.md)
51
55
 
52
56
  ### Examples
53
- * [TypeScript Example](https://github.com/vasille-js/example-typescript)
54
- * [JavaScript Example](https://github.com/vasille-js/example-javascript)
57
+
58
+ - [TypeScript Example](https://github.com/vasille-js/example-typescript)
59
+ - [JavaScript Example](https://github.com/vasille-js/example-javascript)
55
60
 
56
61
  <hr>
57
62
 
58
63
  ## How SAFE is SteelFrameKit
59
64
 
60
65
  The safe of your application is ensured by
61
- * `100%` coverage of code by unit tests.
66
+
67
+ - `100%` coverage of code by unit tests.
62
68
  Each function, each branch is working as designed.
63
- * OOP, DRY, KISS and SOLID principles are applied.
64
- * `strong typing` makes your javascript/typescript code safe as C++ code.
65
- All entities of `SteelFrameKit` core library are strongly typed, including:
66
- * data fields & properties.
67
- * computed properties (function parameters and result).
68
- * methods.
69
- * events (defined handlers & event emit).
70
- * DOM events & DOM operation (attributing, styling, etc.).
71
- * slots of components.
72
- * references to children.
73
- * No asynchronous code, when the line of code is executed, the DOM and reactive things are already synced.
69
+ - OOP, DRY, KISS and SOLID principles are applied.
70
+ - `strong typing` makes your code safe.
71
+ All entities of `SteelFrameKit` core library are strongly typed, including:
72
+ - data fields & properties.
73
+ - computed properties (function parameters and result).
74
+ - methods.
75
+ - events (defined handlers & event emit).
76
+ - DOM events & DOM operation (attributing, styling, etc.).
77
+ - slots of components.
78
+ - references to children.
79
+ - No asynchronous code, when the line of code is executed, the DOM and reactive things are already synced.
74
80
 
75
81
  ## How INTUITIVE is SteelFrameKit
76
82
 
77
83
  There is the "Hello World":
84
+
78
85
  ```typescript jsx
79
86
  import { compose, mount } from "steel-frame";
80
87
 
@@ -88,57 +95,86 @@ mount(document.body, App, {});
88
95
  ## How POWERFUL is SteelFrameKit
89
96
 
90
97
  All of these are supported:
91
- * Components.
92
- * Reactive values (observables).
93
- * Inline computed values.
94
- * Multiline computed values.
95
- * HTML & SVG tags.
96
- * Component custom slots.
97
- * 2-way data binding in components.
98
- * Logic block (if, else).
99
- * Loops (array, map, set).
100
- * Dependency injection.
98
+
99
+ - Components.
100
+ - Reactive values (observables).
101
+ - Inline computed values.
102
+ - Multiline computed values.
103
+ - HTML tags.
104
+ - Component custom slots.
105
+ - 2-way data binding in components.
106
+ - Logic block (if, else).
107
+ - Loops (array, map, set).
108
+ - Dependency injection.
101
109
 
102
110
  <hr>
103
111
 
104
112
  ## Road map
105
113
 
106
- * [x] Update the `core` library to version 3.0.
107
- * [x] `100%` Test Coverage for core Library v3.
108
- * [x] Develop the `JSX` library.
109
- * [x] `100%` Test Coverage for the JSX library.
110
- * [x] Develop the `Babel Plugin`.
111
- * [x] `100%` Test Coverage fot babel plugin.
112
- * [x] Add CSS support (define styles in components).
113
- * [x] Add router.
114
- * [x] Add SSG (static site generation).
115
- * [ ] Develop tools extension for debugging (WIP).
116
- * [ ] Add SSR (server side rendering).
114
+ - [x] `100%` Test Coverage for core Library v3.
115
+ - [x] Develop the `JSX` library.
116
+ - [x] `100%` Test Coverage for the JSX library.
117
+ - [x] Develop the `Babel Plugin`.
118
+ - [x] `100%` Test Coverage fot babel plugin.
119
+ - [x] Add CSS support (define styles in components).
120
+ - [x] Add router.
121
+ - [x] Add SSG (static site generation).
122
+ - [ ] Develop tools extension for debugging (WIP).
123
+ - [ ] Add SSR (server side rendering).
117
124
 
118
125
  ## Change log
119
126
 
120
- ### 5.0.0
127
+ We respect semantic versioning:
128
+
129
+ - A major version is increased when we make incompatible API changes.
130
+ - A minor version is increased when we add functionality.
131
+ - Patch version is increased when we fix bugs.
132
+
133
+ ### 7.0
134
+
135
+ - WIP
136
+
137
+ ### 6.0 RC (never released)
138
+
139
+ - Add `QueueRenderer`, `ArrayView`, `ArrayModelView`, `SetModelView`, `MapModelView`, `Iterate` and `ForEach` components.
140
+ - `const a = []` is not implicit array model, use explicit `arrayModel`. **[API change]**
141
+
142
+ ### 5.0 - 5.1
121
143
 
122
- Add support for context and dependencies injection.
144
+ - Add support for context and dependencies injection.
145
+ - New developement direction: `fault tolerant`.
146
+ - Renamed to `steel-frame`. **[API change]**
147
+ - Removed `forward` and `backward` functions. **[API change]**
148
+ - Removed `Debug` component. **[API change]**
149
+ - Add support for web components compile target `web build components`.
150
+ _Web components as custom tags are supported in any version._
123
151
 
124
- ### 4.3.0
152
+ ### 4.0 - 4.3
125
153
 
126
- Add new function `safe` which make functions safe, errors are reported automatically.
154
+ - Initial version of the framework with file based routing and building scripts (`web dev` and `web build spa`).
155
+ - Reactive values naming switched to `$` prefix. **[API change]**
156
+ - `4.1` Added SSG (static site generation) as build option `web build static`.
157
+ - `4.2` Add support for inlined conditions in JSX, binary `&&` and ternary `?:` operator.
158
+ - `4.3` Add new function `safe` which make functions safe, errors are reported automatically.
127
159
 
128
- ### 4.2.0
160
+ ### 3.0 - 3.2
129
161
 
130
- Add support for inlined conditions in JSX, binary `&&` and ternary `?:` operator.
162
+ - Switch to a babel plugin to compile components code. **[API change]**
163
+ - 100% of the code has been covered with unit tests.
164
+ - New developement direction: `keep it simple`.
131
165
 
132
- ### 4.1.0
166
+ ### 2.0 - 2.3
133
167
 
134
- Added SSG (static site generation) as build option `sf build static`.
168
+ - Introduces components compilation via a typescript plugin. **[API change]**
169
+ - New developement direction: `write less, do more`.
135
170
 
136
- ### 4.0.0
171
+ ### 1.0 - 1.2
137
172
 
138
- Initial version of the framework with file based routing and building scripts (`sf dev` and `sf build spa`).
173
+ - Initial version of a core library.
174
+ - Developemnt direction: `performance-first`.
139
175
 
140
176
  ## Questions
141
177
 
142
178
  If you have questions, feel free to contact the maintainer of the project:
143
179
 
144
- * [Author's Email](mailto:vas.lixcode@gmail.com)
180
+ - [Author's Email](mailto:vas.lixcode@gmail.com)
package/lib/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { Fragment } from "vasille";
2
1
  const searchMap = new Map();
3
2
  function lookUp(node, key) {
4
3
  let it = node;
@@ -7,7 +6,7 @@ function lookUp(node, key) {
7
6
  if (value !== undefined) {
8
7
  return value;
9
8
  }
10
- it = it instanceof Fragment ? it.parent : null;
9
+ it = "parent" in it ? it.parent : null;
11
10
  }
12
11
  }
13
12
  function setUp(node, key, value) {
@@ -42,6 +41,9 @@ export function receive(node, key) {
42
41
  }
43
42
  return value;
44
43
  }
44
+ export function receiveOptional(node, key) {
45
+ return lookUp(node, key);
46
+ }
45
47
  export function impute(node, target, ...args) {
46
48
  if (target instanceof SteelContext || typeof target === "string") {
47
49
  // @ts-expect-error
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vasille-context",
3
- "version": "5.0.0",
3
+ "version": "7.0.0-rc.1",
4
4
  "description": "Provide contextual data between Vasille.JS components",
5
5
  "keywords": [
6
6
  "frontend",
@@ -25,8 +25,8 @@
25
25
  "prettier": "npx prettier src test --write",
26
26
  "prebuild": "rm -rf types lib",
27
27
  "build": "tsc --build tsconfig.json",
28
- "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
29
- "test-coverage": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage"
28
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
29
+ "test-coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage"
30
30
  },
31
31
  "repository": {
32
32
  "type": "git",
@@ -34,13 +34,12 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/jest": "^30.0.0",
37
- "cross-env": "^10.1.0",
38
37
  "jest": "^30.2.0",
39
38
  "prettier": "^3.8.1",
40
39
  "ts-jest": "^29.4.6",
41
40
  "typescript": "^5.9.3"
42
41
  },
43
42
  "dependencies": {
44
- "vasille": "^5.0.0"
43
+ "vasille": "^7.0.0-rc.9"
45
44
  }
46
45
  }
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Reactive } from "vasille";
1
+ import type { Reactive } from "vasille";
2
2
  export declare class SteelContext<Args extends unknown[], Value> {
3
3
  readonly fn: (...args: Args) => Value;
4
4
  constructor(fn: (...args: Args) => Value);
@@ -10,6 +10,9 @@ export declare function share(node: Reactive, key: string, value: string): strin
10
10
  export declare function receive<Args extends unknown[], Value>(node: Reactive, ctx: SteelContext<Args, Value>): Value;
11
11
  export declare function receive<Class>(node: Reactive, className: abstract new (...args: unknown[]) => Class): Class;
12
12
  export declare function receive(node: Reactive, key: string): string;
13
+ export declare function receiveOptional<Args extends unknown[], Value>(node: Reactive, ctx: SteelContext<Args, Value>): Value | undefined;
14
+ export declare function receiveOptional<Class>(node: Reactive, className: abstract new (...args: unknown[]) => Class): Class | undefined;
15
+ export declare function receiveOptional(node: Reactive, key: string): string | undefined;
13
16
  export declare function impute<Args extends unknown[], Value>(node: Reactive, ctx: SteelContext<Args, Value>, ...args: Args): Value;
14
17
  export declare function impute<Class>(node: Reactive, className: abstract new (...args: unknown[]) => Class, value: () => Class): Class;
15
18
  export declare function impute(node: Reactive, key: string, value: string): string;