steel-frame 5.1.16 → 7.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
@@ -21,8 +21,9 @@
21
21
  - [How POWERFUL is SteelFrameKit](#how-powerful-is-steelframekit)
22
22
  - [Road map](#road-map)
23
23
  - [Change log](#change-log)
24
- - [5.1](#51)
25
- - [5.0](#50)
24
+ - [7.0](#70)
25
+ - [6.0 RC (never released)](#60-rc-never-released)
26
+ - [5.0 - 5.1](#50---51)
26
27
  - [4.0 - 4.3](#40---43)
27
28
  - [3.0 - 3.2](#30---32)
28
29
  - [2.0 - 2.3](#20---23)
@@ -129,18 +130,24 @@ We respect semantic versioning:
129
130
  - A minor version is increased when we add functionality.
130
131
  - Patch version is increased when we fix bugs.
131
132
 
132
- ### 5.1
133
+ ### 7.0
133
134
 
134
- Add support for web components compile target `web build components`.
135
- _Web components as custom tags are supported in any version._
135
+ - WIP
136
136
 
137
- ### 5.0
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
138
143
 
139
144
  - Add support for context and dependencies injection.
140
145
  - New developement direction: `fault tolerant`.
141
146
  - Renamed to `steel-frame`. **[API change]**
142
147
  - Removed `forward` and `backward` functions. **[API change]**
143
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._
144
151
 
145
152
  ### 4.0 - 4.3
146
153
 
@@ -1,4 +1,4 @@
1
- import { App } from "vasille";
1
+ import { App, ArrayModel, MapModel, SetModel } from "vasille";
2
2
  import type { TagOptions } from "vasille/web-runner";
3
3
  import type { StyleSheetProps as StyleProps } from "vasille-web";
4
4
  import type { ScreenProps } from "vasille-router";
@@ -57,9 +57,11 @@ export declare function screen<Route extends string>(renderer: Screen<Route>): S
57
57
  /** Composes a page, the file-based router navigates between pages (used for tests only) */
58
58
  export declare function page<Route extends string>(renderer: Screen<Route>): Screen<Route>;
59
59
 
60
- /** Returns the raw value of expression */
60
+ /** Returns the raw value of the expression */
61
61
  export declare function raw<T>(v: T): T;
62
- /** Returns a reactive value of expression */
62
+ /** Unwrap the expression */
63
+ export declare function unwrap<T>(v: T): T;
64
+ /** Pack value into a reactive reference */
63
65
  export declare function ref<T>(v: T): T;
64
66
  /** Returns a reactive-computed form of expression */
65
67
  export declare function bind<T>(v: T): T;
@@ -68,11 +70,11 @@ export declare function calculate<T>(fn: () => T): T;
68
70
  /** Runs the function each time when a dependency is changed */
69
71
  export declare function watch(f: () => void): void;
70
72
  /** Returns an array model of the array */
71
- export declare function arrayModel<T>(v?: T[]): T[];
73
+ export declare function arrayModel<T>(v?: T[]): ArrayModel<T>;
72
74
  /** Returns a set model of array values */
73
- export declare function setModel<T>(v?: T[]): Set<T>;
75
+ export declare function setModel<T>(v?: T[]): SetModel<T>;
74
76
  /** Returns a map model of map data */
75
- export declare function mapModel<K, T>(v?: [K, T][]): Map<K, T>;
77
+ export declare function mapModel<K, T>(v?: [K, T][]): MapModel<K, T>;
76
78
 
77
79
  /** Awaits async data in a sync component */
78
80
  export declare function awaited<T>(target: Promise<T>): [unknown, T | undefined, () => void];
@@ -124,7 +126,49 @@ export declare function For<K, T>(props: {
124
126
  "vasille:slot"?: VasilleSlot;
125
127
  }): void;
126
128
 
127
- /** Refresh the content each time then the reactive model is updated */
129
+ /** Renders content of an `array`, updates are tracked via a diff algorithm */
130
+ export declare function ArrayView<T>(props: { $of: ReadonlyArray<T>; slot: ($value: T, $index: number) => void }): void;
131
+
132
+ /** Renders content of an `array model`, which can be updated via `push`, `pull`, ... */
133
+ export declare function ArrayModelView<T>(props: {
134
+ of: ReadonlyArray<T>;
135
+ slot: (value: T, $index: number) => void;
136
+ }): void;
137
+
138
+ /** Renders content of a `map model`, which can be updated via `set`, `delete`, ... */
139
+ export declare function MapModelView<K, T>(props: { of: ReadonlyMap<K, T>; slot: ($value: T, key: K) => void }): void;
140
+
141
+ /** Renders content of a `set model`, which can be updated via `add`, `delete`, ... */
142
+ export declare function SetModelView<T>(props: { of: ReadonlySet<T>; slot: (value: T) => void }): void;
143
+
144
+ /** Will be translated to for (let value of value) { slot(item) } */
145
+ export declare function Iterate<
146
+ T extends { [Symbol.iterator](): IteratorObject<unknown, unknown, unknown> },
147
+ K = T extends { [Symbol.iterator](): IteratorObject<infer R, unknown, unknown> } ? R : never,
148
+ >(props: { value: T; slot: (item: K) => void });
149
+
150
+ /** Will be translated to value.forEach(slot) */
151
+ export declare function ForEach<T>(props: {
152
+ value: ReadonlyArray<T>;
153
+ slot: (item: T, index: number, value: T[]) => void;
154
+ });
155
+ export declare function ForEach<T>(props: {
156
+ value: ReadonlySet<T>;
157
+ slot: (item: T, key: T, set: ReadonlySet<T>) => void;
158
+ });
159
+ export declare function ForEach<K, T>(props: {
160
+ value: ReadonlyMap<K, T>;
161
+ slot: (item: T, key: K, map: ReadonlyMap<K, T>) => void;
162
+ });
163
+
164
+ /** Renders content in a non-blocking way via queue */
165
+ export declare function QueuedRender(props: {
166
+ priority?: "high" | "low";
167
+ callback?(): void;
168
+ "vasille:slot": VasilleSlot;
169
+ }): void;
170
+
171
+ /** Refresh the content each time, when the reactive model is updated */
128
172
  export declare function Watch<T>(props: { $model: T; slot?: (value: T) => void; "vasille:slot"?: VasilleSlot }): void;
129
173
 
130
174
  /** Render content after a while */
@@ -263,6 +307,19 @@ export declare function receive<Class>(className: abstract new (...args: unknown
263
307
  /** Receive a setting */
264
308
  export declare function receive(key: string): string;
265
309
 
310
+ /** Receive an optional shared context */
311
+ export declare function receiveOptional<Args extends unknown[], Value>(
312
+ ctx: SteelContext<Args, Value>,
313
+ ): Value | undefined;
314
+
315
+ /** Receive an optional dependency */
316
+ export declare function receiveOptional<Class>(
317
+ className: abstract new (...args: unknown[]) => Class,
318
+ ): Class | undefined;
319
+
320
+ /** Receive an optional setting */
321
+ export declare function receiveOptional(key: string): string | undefined;
322
+
266
323
  /** Create and share a context when it is missing */
267
324
  export declare function impute<Args extends unknown[], Value>(ctx: SteelContext<Args, Value>, ...args: Args): Value;
268
325
 
package/lib/index.js CHANGED
@@ -1,13 +1,14 @@
1
- import { devArrayModel, devAwaited, DevDelay, devEnsure, devExpr, DevFor, devMapModel, devMatch, devModel, devRef, devSet, devSetModel, DevSlot, devStore, DevSwitch, devView, DevWatch, } from "vasille-jsx/dev";
1
+ import { devArrayModel, devAwaited, DevDelay, devEnsure, devExpr, DevFor, devMapModel, devMatch, devModel, devRef, devSet, devSetModel, DevSlot, devStore, DevSwitch, devView, DevWatch, DevArrayView, DevMapModelView, DevSetModelView, DevArrayModelView, } from "vasille-jsx/dev";
2
2
  import { devModal, devPrompt, devRouterApp, devMount } from "vasille-web/dev";
3
3
  import { devScreen } from "vasille-router/dev";
4
4
  import { Inspector } from "./inspector.js";
5
- export { executionPosition, wrapFn, runFn, registerReference, shareStateById, positionedText, setupPosition, } from "vasille/dev";
6
- export { setErrorHandler, earlyInspector } from "vasille-jsx/dev";
5
+ export { executionPosition, wrapFn, runFn, registerReference, positionedText, setupPosition } from "vasille/dev";
6
+ export { setErrorHandler } from "vasille-jsx/dev";
7
+ export { QueuedRender } from "vasille-jsx";
7
8
  export { safe, } from "vasille-web";
8
9
  export { setLaptopMaxWidth, setTabletMaxWidth, setMobileMaxWidth } from "vasille-css";
9
10
  export { devStyleSheet as styleSheet } from "vasille-css/dev";
10
- export { context, impute, receive, share } from "vasille-context";
11
+ export { context, impute, receive, share, receiveOptional } from "vasille-context";
11
12
  export const view = devView;
12
13
  export const component = devView;
13
14
  export const compose = devView;
@@ -30,6 +31,10 @@ export const mapModel = devMapModel;
30
31
  export const arrayModel = devArrayModel;
31
32
  export const Switch = DevSwitch;
32
33
  export const match = devMatch;
34
+ export const ArrayView = DevArrayView;
35
+ export const MapModelView = DevMapModelView;
36
+ export const SetModelView = DevSetModelView;
37
+ export const ArrayModelView = DevArrayModelView;
33
38
  export const screen = devScreen;
34
39
  export const page = devScreen;
35
40
  export const modal = devModal;
package/lib/inspector.js CHANGED
@@ -1,7 +1,7 @@
1
- import { AbstractInspector, earlyInspector } from "vasille-jsx/dev";
2
1
  import { Fragment } from "vasille";
3
2
  import { expr, ref } from "vasille-jsx";
4
- import { DevFragment, DevTag, DevTextNode } from "vasille/dev";
3
+ import { DevFragment, DevTag, DevTextNode, inspector } from "vasille/dev";
4
+ import { AbstractInspector } from "vasille/dev";
5
5
  class AppHandler {
6
6
  constructor() {
7
7
  this.canvas = null;
@@ -96,8 +96,10 @@ class AppHandler {
96
96
  ctx.clearRect(0, 0, canvas.width, canvas.height);
97
97
  ctx.fillStyle = "#ff000030";
98
98
  for (const tag of tags) {
99
- const rect = tag.getNode().getBoundingClientRect();
100
- ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
99
+ const rect = tag.node?.getBoundingClientRect();
100
+ if (rect) {
101
+ ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
102
+ }
101
103
  }
102
104
  }
103
105
  const sel = window.getSelection();
@@ -171,7 +173,7 @@ export class Inspector extends AbstractInspector {
171
173
  this.queue = [];
172
174
  this.app = new AppHandler();
173
175
  this._connect();
174
- earlyInspector.connect(this);
176
+ inspector.connect(this);
175
177
  }
176
178
  setup(app) {
177
179
  this.app.setup(app, this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steel-frame",
3
- "version": "5.1.16",
3
+ "version": "7.0.0-rc",
4
4
  "description": "SteelFrame: Build Fault-Tolerant Web Applications Effortlessly.",
5
5
  "main": "index.js",
6
6
  "types": "./index.d.ts",
@@ -44,13 +44,13 @@
44
44
  "homepage": "https://github.com/vasille-js/vasille-js#readme",
45
45
  "dependencies": {
46
46
  "csstype": "^3.1.3",
47
- "vasille": "^5.1.9",
48
- "vasille-context": "^5.0.0",
47
+ "vasille": "^7.0.0-rc.2",
48
+ "vasille-context": "^6.0.0-rc",
49
49
  "vasille-css": "^5.0.0",
50
- "vasille-jsx": "^5.1.4",
51
- "vasille-router": "^5.0.0",
52
- "vasille-shadow": "^5.0.0",
53
- "vasille-web": "^5.1.4"
50
+ "vasille-jsx": "^7.0.0-rc.1",
51
+ "vasille-router": "^7.0.0-rc",
52
+ "vasille-shadow": "^7.0.0-rc.1",
53
+ "vasille-web": "^7.0.0-rc.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/node": "^24.3.0",
package/src/index.ts CHANGED
@@ -16,6 +16,10 @@ import {
16
16
  DevSwitch,
17
17
  devView,
18
18
  DevWatch,
19
+ DevArrayView,
20
+ DevMapModelView,
21
+ DevSetModelView,
22
+ DevArrayModelView,
19
23
  } from "vasille-jsx/dev";
20
24
  import { WebRouterInitialization } from "vasille-web";
21
25
  import { devModal, devPrompt, devRouterApp, devMount } from "vasille-web/dev";
@@ -24,16 +28,9 @@ import { TagOptions } from "vasille/web-runner";
24
28
  import { devScreen } from "vasille-router/dev";
25
29
  import { Inspector } from "./inspector.js";
26
30
 
27
- export {
28
- executionPosition,
29
- wrapFn,
30
- runFn,
31
- registerReference,
32
- shareStateById,
33
- positionedText,
34
- setupPosition,
35
- } from "vasille/dev";
36
- export { setErrorHandler, earlyInspector } from "vasille-jsx/dev";
31
+ export { executionPosition, wrapFn, runFn, registerReference, positionedText, setupPosition } from "vasille/dev";
32
+ export { setErrorHandler } from "vasille-jsx/dev";
33
+ export { QueuedRender } from "vasille-jsx";
37
34
  export { type IdeSide, type AppSide } from "./communication.js";
38
35
 
39
36
  export {
@@ -49,7 +46,7 @@ export {
49
46
  } from "vasille-web";
50
47
  export { setLaptopMaxWidth, setTabletMaxWidth, setMobileMaxWidth } from "vasille-css";
51
48
  export { devStyleSheet as styleSheet } from "vasille-css/dev";
52
- export { context, impute, receive, share } from "vasille-context";
49
+ export { context, impute, receive, share, receiveOptional } from "vasille-context";
53
50
 
54
51
  export const view = devView;
55
52
  export const component = devView;
@@ -73,6 +70,10 @@ export const mapModel = devMapModel;
73
70
  export const arrayModel = devArrayModel;
74
71
  export const Switch = DevSwitch;
75
72
  export const match = devMatch;
73
+ export const ArrayView = DevArrayView;
74
+ export const MapModelView = DevMapModelView;
75
+ export const SetModelView = DevSetModelView;
76
+ export const ArrayModelView = DevArrayModelView;
76
77
 
77
78
  export const screen = devScreen;
78
79
  export const page = devScreen;
package/src/inspector.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { AbstractInspector, earlyInspector } from "vasille-jsx/dev";
2
1
  import type { AppSide, IdeSide } from "./communication.js";
3
2
  import { App, Fragment, Reactive } from "vasille";
4
3
  import { TagOptions, TextNode, Runner } from "vasille/web-runner";
5
4
  import { expr, ref } from "vasille-jsx";
6
- import { DevFragment, DevTag, DevTextNode } from "vasille/dev";
5
+ import { DevFragment, DevTag, DevTextNode, inspector } from "vasille/dev";
6
+ import { AbstractInspector } from "vasille/dev";
7
7
 
8
8
  class AppHandler implements AppSide {
9
9
  private canvas: HTMLCanvasElement | null = null;
@@ -117,9 +117,11 @@ class AppHandler implements AppSide {
117
117
  ctx.fillStyle = "#ff000030";
118
118
 
119
119
  for (const tag of tags) {
120
- const rect = tag.getNode().getBoundingClientRect();
120
+ const rect = tag.node?.getBoundingClientRect();
121
121
 
122
- ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
122
+ if (rect) {
123
+ ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
124
+ }
123
125
  }
124
126
  }
125
127
 
@@ -212,7 +214,7 @@ export class Inspector extends AbstractInspector implements IdeSide {
212
214
  this.queue = [];
213
215
  this.app = new AppHandler();
214
216
  this._connect();
215
- earlyInspector.connect(this);
217
+ inspector.connect(this);
216
218
  }
217
219
 
218
220
  public setup(app: App<Node, Element, TagOptions>) {
@@ -260,7 +262,7 @@ export class Inspector extends AbstractInspector implements IdeSide {
260
262
  };
261
263
  }
262
264
 
263
- protected send(method: string, arg: object) {
265
+ protected override send(method: string, arg: object) {
264
266
  this.callInspector(method, arg);
265
267
  }
266
268
 
package/types/index.d.ts CHANGED
@@ -1,16 +1,17 @@
1
- import { devArrayModel, devAwaited, DevDelay, devEnsure, devExpr, DevFor, devMapModel, devMatch, devModel, devRef, devSet, devSetModel, DevSlot, devStore, DevSwitch, devView, DevWatch } from "vasille-jsx/dev";
1
+ import { devArrayModel, devAwaited, DevDelay, devEnsure, devExpr, DevFor, devMapModel, devMatch, devModel, devRef, devSet, devSetModel, DevSlot, devStore, DevSwitch, devView, DevWatch, DevArrayView, DevMapModelView, DevSetModelView, DevArrayModelView } from "vasille-jsx/dev";
2
2
  import { WebRouterInitialization } from "vasille-web";
3
3
  import { devModal, devPrompt } from "vasille-web/dev";
4
4
  import { App } from "vasille";
5
5
  import { TagOptions } from "vasille/web-runner";
6
6
  import { devScreen } from "vasille-router/dev";
7
- export { executionPosition, wrapFn, runFn, registerReference, shareStateById, positionedText, setupPosition, } from "vasille/dev";
8
- export { setErrorHandler, earlyInspector } from "vasille-jsx/dev";
7
+ export { executionPosition, wrapFn, runFn, registerReference, positionedText, setupPosition } from "vasille/dev";
8
+ export { setErrorHandler } from "vasille-jsx/dev";
9
+ export { QueuedRender } from "vasille-jsx";
9
10
  export { type IdeSide, type AppSide } from "./communication.js";
10
11
  export { type QueryParams, type ScreenProps, type RouteParameters, type FallbackScreenProps, type ErrorScreenProps, type WebRouterInitialization, type NavigationMode, type Router, safe, } from "vasille-web";
11
12
  export { setLaptopMaxWidth, setTabletMaxWidth, setMobileMaxWidth } from "vasille-css";
12
13
  export { devStyleSheet as styleSheet } from "vasille-css/dev";
13
- export { context, impute, receive, share } from "vasille-context";
14
+ export { context, impute, receive, share, receiveOptional } from "vasille-context";
14
15
  export declare const view: typeof devView;
15
16
  export declare const component: typeof devView;
16
17
  export declare const compose: typeof devView;
@@ -33,6 +34,10 @@ export declare const mapModel: typeof devMapModel;
33
34
  export declare const arrayModel: typeof devArrayModel;
34
35
  export declare const Switch: typeof DevSwitch;
35
36
  export declare const match: typeof devMatch;
37
+ export declare const ArrayView: typeof DevArrayView;
38
+ export declare const MapModelView: typeof DevMapModelView;
39
+ export declare const SetModelView: typeof DevSetModelView;
40
+ export declare const ArrayModelView: typeof DevArrayModelView;
36
41
  export declare const screen: typeof devScreen;
37
42
  export declare const page: typeof devScreen;
38
43
  export declare const modal: typeof devModal;
@@ -1,7 +1,7 @@
1
- import { AbstractInspector } from "vasille-jsx/dev";
2
1
  import type { IdeSide } from "./communication.js";
3
2
  import { App } from "vasille";
4
3
  import { TagOptions } from "vasille/web-runner";
4
+ import { AbstractInspector } from "vasille/dev";
5
5
  export declare class Inspector extends AbstractInspector implements IdeSide {
6
6
  private ws;
7
7
  private queue;