vasille 5.1.5 → 5.1.7
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 +45 -40
- package/lib/dev/index.js +1 -1
- package/lib/dev/inspectable.js +17 -4
- package/lib/dev/runner.js +5 -3
- package/package.json +1 -1
- package/types/dev/index.d.ts +1 -1
- package/types/dev/inspectable.d.ts +11 -1
package/README.md
CHANGED
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
- [1.0 - 1.2](#10---12)
|
|
30
30
|
- [Questions](#questions)
|
|
31
31
|
|
|
32
|
-
|
|
33
32
|
<hr>
|
|
34
33
|
|
|
35
34
|
## Installation
|
|
@@ -47,37 +46,41 @@ $ npm create steel-frame
|
|
|
47
46
|
```
|
|
48
47
|
|
|
49
48
|
### Full documentation:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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)
|
|
54
54
|
|
|
55
55
|
### Examples
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
|
|
57
|
+
- [TypeScript Example](https://github.com/vasille-js/example-typescript)
|
|
58
|
+
- [JavaScript Example](https://github.com/vasille-js/example-javascript)
|
|
58
59
|
|
|
59
60
|
<hr>
|
|
60
61
|
|
|
61
62
|
## How SAFE is SteelFrameKit
|
|
62
63
|
|
|
63
64
|
The safe of your application is ensured by
|
|
64
|
-
|
|
65
|
+
|
|
66
|
+
- `100%` coverage of code by unit tests.
|
|
65
67
|
Each function, each branch is working as designed.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
All entities of `SteelFrameKit` core library are strongly typed, including:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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.
|
|
77
79
|
|
|
78
80
|
## How INTUITIVE is SteelFrameKit
|
|
79
81
|
|
|
80
82
|
There is the "Hello World":
|
|
83
|
+
|
|
81
84
|
```typescript jsx
|
|
82
85
|
import { compose, mount } from "steel-frame";
|
|
83
86
|
|
|
@@ -91,35 +94,37 @@ mount(document.body, App, {});
|
|
|
91
94
|
## How POWERFUL is SteelFrameKit
|
|
92
95
|
|
|
93
96
|
All of these are supported:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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.
|
|
104
108
|
|
|
105
109
|
<hr>
|
|
106
110
|
|
|
107
111
|
## Road map
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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).
|
|
119
123
|
|
|
120
124
|
## Change log
|
|
121
125
|
|
|
122
126
|
We respect semantic versioning:
|
|
127
|
+
|
|
123
128
|
- A major version is increased when we make incompatible API changes.
|
|
124
129
|
- A minor version is increased when we add functionality.
|
|
125
130
|
- Patch version is increased when we fix bugs.
|
|
@@ -165,4 +170,4 @@ _Web components as custom tags are supported in any version._
|
|
|
165
170
|
|
|
166
171
|
If you have questions, feel free to contact the maintainer of the project:
|
|
167
172
|
|
|
168
|
-
|
|
173
|
+
- [Author's Email](mailto:vas.lixcode@gmail.com)
|
package/lib/dev/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DevReactive } from "./core.js";
|
|
2
2
|
export { DevApp, DevPortal, DevSwitchedNode, DevWatch } from "./components.js";
|
|
3
|
-
export { executionPosition, provideId, runFn, wrapFn, registerReference, toDevId, toDevIdOrValue, toDevObject, toDevValue, errorToString, } from "./inspectable.js";
|
|
3
|
+
export { executionPosition, provideId, setupPosition, getPosition, runFn, wrapFn, registerReference, toDevId, toDevIdOrValue, toDevObject, toDevValue, errorToString, } from "./inspectable.js";
|
|
4
4
|
export { DevArrayModel, DevMapModel, DevSetModel } from "./models.js";
|
|
5
5
|
export { DevFragment, ModelId, shareStateById } from "./node.js";
|
|
6
6
|
export { DevRunner, PositionedText, positionedText, remapObject, DevTextNode, DevTag, } from "./runner.js";
|
package/lib/dev/inspectable.js
CHANGED
|
@@ -34,11 +34,24 @@ export function registerReference(value, declaration, inspector) {
|
|
|
34
34
|
});
|
|
35
35
|
return value;
|
|
36
36
|
}
|
|
37
|
+
const positionKey = Symbol("vasille-position");
|
|
37
38
|
let executionId = 0;
|
|
39
|
+
export function setupPosition(obj, declaration) {
|
|
40
|
+
Object.defineProperty(obj, positionKey, {
|
|
41
|
+
value: declaration,
|
|
42
|
+
enumerable: false,
|
|
43
|
+
configurable: false,
|
|
44
|
+
writable: false,
|
|
45
|
+
});
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
48
|
+
export function getPosition(obj) {
|
|
49
|
+
return obj[positionKey];
|
|
50
|
+
}
|
|
38
51
|
export function wrapFn(fn, declaration, inspector) {
|
|
39
|
-
return (...args) => {
|
|
52
|
+
return setupPosition((...args) => {
|
|
40
53
|
return runFn(fn, args, declaration, inspector);
|
|
41
|
-
};
|
|
54
|
+
}, declaration);
|
|
42
55
|
}
|
|
43
56
|
export function runFn(fn, args, declaration, inspector) {
|
|
44
57
|
const id = ++executionId;
|
|
@@ -64,7 +77,7 @@ export function runFn(fn, args, declaration, inspector) {
|
|
|
64
77
|
result.catch(e => {
|
|
65
78
|
inspector.functionThrows({
|
|
66
79
|
targetId: id,
|
|
67
|
-
error:
|
|
80
|
+
error: errorToString(e),
|
|
68
81
|
async: false,
|
|
69
82
|
time: Date.now(),
|
|
70
83
|
});
|
|
@@ -85,7 +98,7 @@ export function runFn(fn, args, declaration, inspector) {
|
|
|
85
98
|
catch (e) {
|
|
86
99
|
inspector.functionThrows({
|
|
87
100
|
targetId: id,
|
|
88
|
-
error:
|
|
101
|
+
error: errorToString(e),
|
|
89
102
|
async: false,
|
|
90
103
|
time: Date.now(),
|
|
91
104
|
});
|
package/lib/dev/runner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IValue } from "../core/ivalue.js";
|
|
2
2
|
import { Runner, Tag, TextNode } from "../runner/web/runner.js";
|
|
3
|
-
import { provideId, toDevId, toDevIdOrValue, toDevObject, toDevValue, } from "./inspectable.js";
|
|
3
|
+
import { getPosition, provideId, toDevId, toDevIdOrValue, toDevObject, toDevValue, } from "./inspectable.js";
|
|
4
4
|
import { DevExpression, DevReference } from "./state.js";
|
|
5
5
|
export class PositionedText {
|
|
6
6
|
text;
|
|
@@ -87,9 +87,10 @@ export class DevTag extends Tag {
|
|
|
87
87
|
const userHandler = handler[0];
|
|
88
88
|
handler[0] = ev => {
|
|
89
89
|
this.runner.inspector.eventTrigger({
|
|
90
|
-
|
|
90
|
+
target: { tag: this.id },
|
|
91
91
|
eventName: key,
|
|
92
92
|
time: Date.now(),
|
|
93
|
+
position: getPosition(handler[0]),
|
|
93
94
|
});
|
|
94
95
|
userHandler(ev);
|
|
95
96
|
};
|
|
@@ -97,9 +98,10 @@ export class DevTag extends Tag {
|
|
|
97
98
|
else {
|
|
98
99
|
options[key] = ev => {
|
|
99
100
|
this.runner.inspector.eventTrigger({
|
|
100
|
-
|
|
101
|
+
target: { tag: this.id },
|
|
101
102
|
eventName: key,
|
|
102
103
|
time: Date.now(),
|
|
104
|
+
position: getPosition(handler),
|
|
103
105
|
});
|
|
104
106
|
handler(ev);
|
|
105
107
|
};
|
package/package.json
CHANGED
package/types/dev/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DevReactive } from "./core.js";
|
|
2
2
|
export { DevApp, DevPortal, DevSwitchedNode, DevWatch } from "./components.js";
|
|
3
|
-
export { type Dependency, type DevValue, type Inspectable, type InspectableReactive, type InspectableReference, type Inspector, type StaticPosition, type ExecutionPosition, type ProtocolExecutionPosition, type ProtocolComponent, type ProtocolDependency, type ProtocolExpression, type ProtocolExpressionError, type ProtocolExpressionUpdate, type ProtocolModel, type ProtocolModelUpdate, type ProtocolNode, type ProtocolParent, type ProtocolPosition, type ProtocolReference, type ProtocolReferenceError, type ProtocolReferenceUpdate, type ProtocolState, type ProtocolTag, type ProtocolCustomModel, type ProtocolStore, type ProtocolRouterActionCall, type ProtocolDevValue, type ProtocolSlotError, type ProtocolRouterStateChange, type ProtocolRoutes, type ProtocolRouterTargetResult, type ProtocolFunctionError, type ProtocolFunctionResult, type ProtocolFunctionCall, type ProtocolEventTrigger, type ProtocolComposeTime, type ProtocolError, type IDevRunner, type DestroyData, executionPosition, provideId, runFn, wrapFn, registerReference, toDevId, toDevIdOrValue, toDevObject, toDevValue, errorToString, } from "./inspectable.js";
|
|
3
|
+
export { type Dependency, type DevValue, type Inspectable, type InspectableReactive, type InspectableReference, type Inspector, type StaticPosition, type ExecutionPosition, type ProtocolExecutionPosition, type ProtocolComponent, type ProtocolDependency, type ProtocolExpression, type ProtocolExpressionError, type ProtocolExpressionUpdate, type ProtocolModel, type ProtocolModelUpdate, type ProtocolNode, type ProtocolParent, type ProtocolPosition, type ProtocolReference, type ProtocolReferenceError, type ProtocolReferenceUpdate, type ProtocolState, type ProtocolTag, type ProtocolCustomModel, type ProtocolStore, type ProtocolRouterActionCall, type ProtocolDevValue, type ProtocolSlotError, type ProtocolRouterStateChange, type ProtocolRoutes, type ProtocolRouterTargetResult, type ProtocolFunctionError, type ProtocolFunctionResult, type ProtocolFunctionCall, type ProtocolEventTrigger, type ProtocolComposeTime, type ProtocolError, type IDevRunner, type DestroyData, executionPosition, provideId, setupPosition, getPosition, runFn, wrapFn, registerReference, toDevId, toDevIdOrValue, toDevObject, toDevValue, errorToString, } from "./inspectable.js";
|
|
4
4
|
export { DevArrayModel, DevMapModel, DevSetModel } from "./models.js";
|
|
5
5
|
export { DevFragment, ModelId, shareStateById } from "./node.js";
|
|
6
6
|
export { DevRunner, PositionedText, type DevTagOptions, positionedText, remapObject, DevTextNode, DevTag, } from "./runner.js";
|
|
@@ -174,9 +174,17 @@ export interface ProtocolFunctionCall {
|
|
|
174
174
|
time: number;
|
|
175
175
|
}
|
|
176
176
|
export interface ProtocolEventTrigger {
|
|
177
|
-
|
|
177
|
+
target: {
|
|
178
|
+
tag?: number;
|
|
179
|
+
component?: number;
|
|
180
|
+
};
|
|
178
181
|
eventName: string;
|
|
179
182
|
time: number;
|
|
183
|
+
position?: StaticPosition;
|
|
184
|
+
result?: {
|
|
185
|
+
value?: DevValue;
|
|
186
|
+
error?: string;
|
|
187
|
+
};
|
|
180
188
|
}
|
|
181
189
|
export interface ProtocolFunctionResult {
|
|
182
190
|
id: number;
|
|
@@ -229,6 +237,8 @@ export interface DevValue {
|
|
|
229
237
|
id?: number;
|
|
230
238
|
}
|
|
231
239
|
export declare function registerReference<T>(value: DevReference<T>, declaration: StaticPosition, inspector: Inspector): DevReference<T>;
|
|
240
|
+
export declare function setupPosition<T extends object>(obj: T, declaration: StaticPosition): T;
|
|
241
|
+
export declare function getPosition(obj: object): StaticPosition | undefined;
|
|
232
242
|
export declare function wrapFn<Args extends unknown[], Result extends object>(fn: (...args: Args) => Result, declaration: StaticPosition, inspector: Inspector): (...args: Args) => Result;
|
|
233
243
|
export declare function runFn<Args extends unknown[], Result extends object>(fn: (...args: Args) => Result, args: Args, declaration: StaticPosition, inspector: Inspector): Result;
|
|
234
244
|
export declare function toDevValue(value: unknown): {
|