vasille-context 5.0.0 → 6.0.0-rc

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,14 @@
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
+ - [5.1](#51)
25
+ - [5.0](#50)
26
+ - [4.0 - 4.3](#40---43)
27
+ - [3.0 - 3.2](#30---32)
28
+ - [2.0 - 2.3](#20---23)
29
+ - [1.0 - 1.2](#10---12)
27
30
  - [Questions](#questions)
28
31
 
29
-
30
32
  <hr>
31
33
 
32
34
  ## Installation
@@ -44,37 +46,41 @@ $ npm create steel-frame
44
46
  ```
45
47
 
46
48
  ### 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)
49
+
50
+ - [Learn `SteelFrameKit` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v5/doc/V4-API.md)
51
+ - [Router Documentation](https://github.com/vasille-js/vasille-js/blob/v5/doc/Router-API.md)
52
+ - [Compostion functions](https://github.com/vasille-js/vasille-js/blob/v5/doc/Compositions.md)
53
+ - [Dependency injection](https://github.com/vasille-js/vasille-js/blob/v5/doc/Context.md)
51
54
 
52
55
  ### Examples
53
- * [TypeScript Example](https://github.com/vasille-js/example-typescript)
54
- * [JavaScript Example](https://github.com/vasille-js/example-javascript)
56
+
57
+ - [TypeScript Example](https://github.com/vasille-js/example-typescript)
58
+ - [JavaScript Example](https://github.com/vasille-js/example-javascript)
55
59
 
56
60
  <hr>
57
61
 
58
62
  ## How SAFE is SteelFrameKit
59
63
 
60
64
  The safe of your application is ensured by
61
- * `100%` coverage of code by unit tests.
65
+
66
+ - `100%` coverage of code by unit tests.
62
67
  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.
68
+ - OOP, DRY, KISS and SOLID principles are applied.
69
+ - `strong typing` makes your code safe.
70
+ All entities of `SteelFrameKit` core library are strongly typed, including:
71
+ - data fields & properties.
72
+ - computed properties (function parameters and result).
73
+ - methods.
74
+ - events (defined handlers & event emit).
75
+ - DOM events & DOM operation (attributing, styling, etc.).
76
+ - slots of components.
77
+ - references to children.
78
+ - No asynchronous code, when the line of code is executed, the DOM and reactive things are already synced.
74
79
 
75
80
  ## How INTUITIVE is SteelFrameKit
76
81
 
77
82
  There is the "Hello World":
83
+
78
84
  ```typescript jsx
79
85
  import { compose, mount } from "steel-frame";
80
86
 
@@ -88,57 +94,80 @@ mount(document.body, App, {});
88
94
  ## How POWERFUL is SteelFrameKit
89
95
 
90
96
  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.
97
+
98
+ - Components.
99
+ - Reactive values (observables).
100
+ - Inline computed values.
101
+ - Multiline computed values.
102
+ - HTML tags.
103
+ - Component custom slots.
104
+ - 2-way data binding in components.
105
+ - Logic block (if, else).
106
+ - Loops (array, map, set).
107
+ - Dependency injection.
101
108
 
102
109
  <hr>
103
110
 
104
111
  ## Road map
105
112
 
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).
113
+ - [x] `100%` Test Coverage for core Library v3.
114
+ - [x] Develop the `JSX` library.
115
+ - [x] `100%` Test Coverage for the JSX library.
116
+ - [x] Develop the `Babel Plugin`.
117
+ - [x] `100%` Test Coverage fot babel plugin.
118
+ - [x] Add CSS support (define styles in components).
119
+ - [x] Add router.
120
+ - [x] Add SSG (static site generation).
121
+ - [ ] Develop tools extension for debugging (WIP).
122
+ - [ ] Add SSR (server side rendering).
117
123
 
118
124
  ## Change log
119
125
 
120
- ### 5.0.0
126
+ We respect semantic versioning:
127
+
128
+ - A major version is increased when we make incompatible API changes.
129
+ - A minor version is increased when we add functionality.
130
+ - Patch version is increased when we fix bugs.
131
+
132
+ ### 5.1
133
+
134
+ Add support for web components compile target `web build components`.
135
+ _Web components as custom tags are supported in any version._
136
+
137
+ ### 5.0
121
138
 
122
- Add support for context and dependencies injection.
139
+ - Add support for context and dependencies injection.
140
+ - New developement direction: `fault tolerant`.
141
+ - Renamed to `steel-frame`. **[API change]**
142
+ - Removed `forward` and `backward` functions. **[API change]**
143
+ - Removed `Debug` component. **[API change]**
123
144
 
124
- ### 4.3.0
145
+ ### 4.0 - 4.3
125
146
 
126
- Add new function `safe` which make functions safe, errors are reported automatically.
147
+ - Initial version of the framework with file based routing and building scripts (`web dev` and `web build spa`).
148
+ - Reactive values naming switched to `$` prefix. **[API change]**
149
+ - `4.1` Added SSG (static site generation) as build option `web build static`.
150
+ - `4.2` Add support for inlined conditions in JSX, binary `&&` and ternary `?:` operator.
151
+ - `4.3` Add new function `safe` which make functions safe, errors are reported automatically.
127
152
 
128
- ### 4.2.0
153
+ ### 3.0 - 3.2
129
154
 
130
- Add support for inlined conditions in JSX, binary `&&` and ternary `?:` operator.
155
+ - Switch to a babel plugin to compile components code. **[API change]**
156
+ - 100% of the code has been covered with unit tests.
157
+ - New developement direction: `keep it simple`.
131
158
 
132
- ### 4.1.0
159
+ ### 2.0 - 2.3
133
160
 
134
- Added SSG (static site generation) as build option `sf build static`.
161
+ - Introduces components compilation via a typescript plugin. **[API change]**
162
+ - New developement direction: `write less, do more`.
135
163
 
136
- ### 4.0.0
164
+ ### 1.0 - 1.2
137
165
 
138
- Initial version of the framework with file based routing and building scripts (`sf dev` and `sf build spa`).
166
+ - Initial version of a core library.
167
+ - Developemnt direction: `performance-first`.
139
168
 
140
169
  ## Questions
141
170
 
142
171
  If you have questions, feel free to contact the maintainer of the project:
143
172
 
144
- * [Author's Email](mailto:vas.lixcode@gmail.com)
173
+ - [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": "6.0.0-rc",
4
4
  "description": "Provide contextual data between Vasille.JS components",
5
5
  "keywords": [
6
6
  "frontend",
@@ -41,6 +41,6 @@
41
41
  "typescript": "^5.9.3"
42
42
  },
43
43
  "dependencies": {
44
- "vasille": "^5.0.0"
44
+ "vasille": "^6.0.0-rc.4"
45
45
  }
46
46
  }
package/types/index.d.ts CHANGED
@@ -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;