stillflow.engine 0.4.4 → 0.4.6
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/dist/jsx-runtime.d.ts +2 -1
- package/dist/jsx-runtime.js +5 -1
- package/dist/stillflow-adapters/dom/jsx.dom.d.ts +2 -1
- package/dist/stillflow-adapters/dom/jsx.dom.js +3 -0
- package/dist/stillflow-examples/app.js +8 -30
- package/dist/stillflow-examples/data.d.ts +1 -5
- package/dist/stillflow-examples/test.js +5 -7
- package/package.json +34 -21
- package/dist/stillflow-adapters/dom/symbols.d.ts +0 -1
- package/dist/stillflow-adapters/dom/symbols.js +0 -1
- package/dist/stillflow-adapters/vm.d.ts +0 -3
- package/dist/stillflow-adapters/vm.js +0 -2
- package/dist/stillflow-vm/jsx-runtime.d.ts +0 -2
- package/dist/stillflow-vm/jsx-runtime.js +0 -3
- package/dist/stillflow-vm/runtime/jsx-runtime.d.ts +0 -2
- package/dist/stillflow-vm/runtime/jsx-runtime.js +0 -3
- package/dist/stillflow-vm/runtime/jsx.runtime.d.ts +0 -2
- package/dist/stillflow-vm/runtime/jsx.runtime.js +0 -3
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Binding } from "./stillflow-vm/binding.js";
|
|
2
|
-
export declare function jsx<T>(type: (properties: Record<string, any>, children: Binding<any>[]) => Binding<T>, properties: Record<string, any
|
|
2
|
+
export declare function jsx<T>(type: (properties: Record<string, any>, children: Binding<any>[]) => Binding<T>, properties: Record<string, any>): Binding<T>;
|
|
3
|
+
export declare function jsxs<T>(type: (properties: Record<string, any>, children: Binding<any>[]) => Binding<T>, properties: Record<string, any>): Binding<T>;
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -6,8 +6,9 @@ declare const DELEGATE_EVENT_PROPERTY_PREFIX = "sf:on-";
|
|
|
6
6
|
declare const COMMON_EVENT_PROPERTY_PREFIX = "on:";
|
|
7
7
|
type ElementStyles<K extends keyof HTMLElementTagNameMap> = {
|
|
8
8
|
styles: Partial<HTMLElementTagNameMap[K]['style']>;
|
|
9
|
+
children: any;
|
|
9
10
|
};
|
|
10
|
-
type ElementPropertiesWithoutStyles<K extends keyof HTMLElementTagNameMap> = Omit<HTMLElementTagNameMap[K], 'style'>;
|
|
11
|
+
type ElementPropertiesWithoutStyles<K extends keyof HTMLElementTagNameMap> = Omit<HTMLElementTagNameMap[K], 'style' | 'children'>;
|
|
11
12
|
type ElementServicePropertiesWithoutPrefix<V> = {
|
|
12
13
|
'vm': (context: V) => (node: AnyDOM<V>) => vm.Target<HTMLElement, V>;
|
|
13
14
|
'if': (context: V) => boolean;
|
|
@@ -16,6 +16,9 @@ class JSXDOMUtilities {
|
|
|
16
16
|
const dynamic_content = new Array();
|
|
17
17
|
const static_content = new Array();
|
|
18
18
|
const children = new Array();
|
|
19
|
+
if (Array.isArray(all) == false) {
|
|
20
|
+
all = [all];
|
|
21
|
+
}
|
|
19
22
|
for (const child of all) {
|
|
20
23
|
if (typeof child === 'string' || typeof child === 'number') {
|
|
21
24
|
static_content.push(child.toString());
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "..//jsx-runtime.js";
|
|
2
|
+
import { core, operators, adapters, collection } from "../index.js";
|
|
2
3
|
import { buildData } from "./data.js";
|
|
3
4
|
const { Stillflow, State, Batcher } = core;
|
|
4
5
|
const { jsxdom, dom } = adapters;
|
|
@@ -96,44 +97,22 @@ class BenchmarkApplicationController {
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
function BenchmarkApplicationHeader() {
|
|
99
|
-
return (
|
|
100
|
-
vm.jsx(jsxdom.h1, null, "Stillflow")));
|
|
100
|
+
return (_jsx(jsxdom.div, { className: "col-md-6", children: _jsx(jsxdom.h1, { children: "Stillflow" }) }));
|
|
101
101
|
}
|
|
102
102
|
function BenchmarkApplicationButton(context) {
|
|
103
|
-
return (
|
|
104
|
-
vm.jsx(jsxdom.button, { type: "button", className: "btn btn-primary btn-block", id: context.id, "on:click": context.handle }, context.text)));
|
|
103
|
+
return (_jsx(jsxdom.div, { className: "col-sm-6 smallpad", children: _jsx(jsxdom.button, { type: "button", className: "btn btn-primary btn-block", id: context.id, "on:click": context.handle, children: context.text }) }));
|
|
105
104
|
}
|
|
106
105
|
function BenchmarkApplicationTableRow(context) {
|
|
107
106
|
const { controller } = context;
|
|
108
|
-
return (
|
|
109
|
-
vm.jsx(jsxdom.td, { className: "col-md-1" }, (context) => context.id),
|
|
110
|
-
vm.jsx(jsxdom.td, { className: "col-md-4" },
|
|
111
|
-
vm.jsx(jsxdom.a, { "sf:on-click": (event, context) => controller.select(context.index) }, (context) => context.label)),
|
|
112
|
-
vm.jsx(jsxdom.td, { className: "col-md-1" },
|
|
113
|
-
vm.jsx(jsxdom.a, { "sf:on-click": (event, context) => controller.remove(context.index) },
|
|
114
|
-
vm.jsx(jsxdom.span, { ariaHidden: "true", className: "glyphicon glyphicon-remove" }))),
|
|
115
|
-
vm.jsx(jsxdom.td, { className: "col-md-6" })));
|
|
107
|
+
return (_jsxs(jsxdom.tr, { "sf:className": (context) => controller.is_selected(context.index) ? "danger" : String(), children: [_jsx(jsxdom.td, { className: "col-md-1", children: (context) => context.id }), _jsx(jsxdom.td, { className: "col-md-4", children: _jsx(jsxdom.a, { "sf:on-click": (event, context) => controller.select(context.index), children: (context) => context.label }) }), _jsx(jsxdom.td, { className: "col-md-1", children: _jsx(jsxdom.a, { "sf:on-click": (event, context) => controller.remove(context.index), children: _jsx(jsxdom.span, { ariaHidden: "true", className: "glyphicon glyphicon-remove" }) }) }), _jsx(jsxdom.td, { className: "col-md-6" })] }));
|
|
116
108
|
}
|
|
117
109
|
function BenchmarkApplicationTable(context) {
|
|
118
110
|
const { controller } = context;
|
|
119
|
-
return (
|
|
111
|
+
return (_jsx(jsxdom.table, { className: "table table-hover table-striped test-data", children: _jsx(jsxdom.tbody, { "sf:for": () => controller.items, "sf:each": () => _jsx(BenchmarkApplicationTableRow, { controller: controller }) }) }));
|
|
120
112
|
}
|
|
121
113
|
function BenchmarkApplicationView(context) {
|
|
122
114
|
const { controller } = context;
|
|
123
|
-
return (
|
|
124
|
-
vm.jsx(jsxdom.div, { className: "jumbotron" },
|
|
125
|
-
vm.jsx(jsxdom.div, { className: "row" },
|
|
126
|
-
vm.jsx(BenchmarkApplicationHeader, null),
|
|
127
|
-
vm.jsx(jsxdom.div, { className: "row" },
|
|
128
|
-
vm.jsx(jsxdom.div, { className: "col-md-6" },
|
|
129
|
-
vm.jsx(BenchmarkApplicationButton, { text: "Create 1,000 rows", id: "run", handle: () => controller.run() }),
|
|
130
|
-
vm.jsx(BenchmarkApplicationButton, { text: "Create 10,000 rows", id: "runlots", handle: () => controller.run_lots() }),
|
|
131
|
-
vm.jsx(BenchmarkApplicationButton, { text: "Append 1,000 rows", id: "add", handle: () => controller.add() }),
|
|
132
|
-
vm.jsx(BenchmarkApplicationButton, { text: "Update every 10th row", id: "update", handle: () => controller.update() }),
|
|
133
|
-
vm.jsx(BenchmarkApplicationButton, { text: "Clear", id: "clear", handle: () => controller.clear() }),
|
|
134
|
-
vm.jsx(BenchmarkApplicationButton, { text: "Swap rows", id: "swaprows", handle: () => controller.swap() }))))),
|
|
135
|
-
vm.jsx(BenchmarkApplicationTable, { controller: controller }),
|
|
136
|
-
vm.jsx(jsxdom.span, { ariaHidden: "true", className: "preloadicon glyphicon glyphicon-remove" })));
|
|
115
|
+
return (_jsxs(jsxdom.div, { id: "app", className: "container", children: [_jsx(jsxdom.div, { className: "jumbotron", children: _jsxs(jsxdom.div, { className: "row", children: [_jsx(BenchmarkApplicationHeader, {}), _jsx(jsxdom.div, { className: "row", children: _jsxs(jsxdom.div, { className: "col-md-6", children: [_jsx(BenchmarkApplicationButton, { text: "Create 1,000 rows", id: "run", handle: () => controller.run() }), _jsx(BenchmarkApplicationButton, { text: "Create 10,000 rows", id: "runlots", handle: () => controller.run_lots() }), _jsx(BenchmarkApplicationButton, { text: "Append 1,000 rows", id: "add", handle: () => controller.add() }), _jsx(BenchmarkApplicationButton, { text: "Update every 10th row", id: "update", handle: () => controller.update() }), _jsx(BenchmarkApplicationButton, { text: "Clear", id: "clear", handle: () => controller.clear() }), _jsx(BenchmarkApplicationButton, { text: "Swap rows", id: "swaprows", handle: () => controller.swap() })] }) })] }) }), _jsx(BenchmarkApplicationTable, { controller: controller }), _jsx(jsxdom.span, { ariaHidden: "true", className: "preloadicon glyphicon glyphicon-remove" })] }));
|
|
137
116
|
}
|
|
138
117
|
function custom_compiler(node) {
|
|
139
118
|
return {
|
|
@@ -144,7 +123,6 @@ function custom_compiler(node) {
|
|
|
144
123
|
};
|
|
145
124
|
}
|
|
146
125
|
const controller = new BenchmarkApplicationController();
|
|
147
|
-
const update = dom.$(
|
|
148
|
-
vm.jsx(BenchmarkApplicationView, { controller: controller })));
|
|
126
|
+
const update = dom.$(_jsx(jsxdom.div, { "sf:vm": () => custom_compiler, children: _jsx(BenchmarkApplicationView, { controller: controller }) }));
|
|
149
127
|
controller.core.on(() => update({}));
|
|
150
128
|
update({});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "..//jsx-runtime.js";
|
|
2
|
+
import { core, collection, operators, adapters } from '../index.js';
|
|
2
3
|
const { jsxdom, dom } = adapters;
|
|
3
4
|
const state = new core.State();
|
|
4
5
|
const stillflow = new core.Stillflow(state);
|
|
@@ -20,15 +21,12 @@ function add() {
|
|
|
20
21
|
stillflow.commit();
|
|
21
22
|
}
|
|
22
23
|
function TodoItem() {
|
|
23
|
-
return (
|
|
24
|
+
return (_jsx(jsxdom.div, { children: (context) => context.label }));
|
|
24
25
|
}
|
|
25
26
|
function App() {
|
|
26
|
-
return (
|
|
27
|
-
vm.jsx(jsxdom.input, { "sf:value": (context) => context.input, "on:change": change }),
|
|
28
|
-
vm.jsx(jsxdom.button, { "on:click": add }, "Add"),
|
|
29
|
-
vm.jsx(jsxdom.div, { "sf:for": (context) => context.items, "sf:each": () => vm.jsx(TodoItem, null) })));
|
|
27
|
+
return (_jsxs(jsxdom.div, { children: [_jsx(jsxdom.input, { "sf:value": (context) => context.input, "on:change": change }), _jsx(jsxdom.button, { "on:click": add, children: "Add" }), _jsx(jsxdom.div, { "sf:for": (context) => context.items, "sf:each": () => _jsx(TodoItem, {}) })] }));
|
|
30
28
|
}
|
|
31
|
-
const update = dom.$(
|
|
29
|
+
const update = dom.$(_jsx(App, {}), { container: document.body });
|
|
32
30
|
stillflow.on(() => update(instance));
|
|
33
31
|
instance.input = String();
|
|
34
32
|
stillflow.commit();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stillflow.engine",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "A headless, transaction-based UI engine with AOT compilation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -8,24 +8,34 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"exports": {
|
|
11
|
-
".":
|
|
12
|
-
"./dist"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"./dist/index.js"
|
|
22
|
-
|
|
23
|
-
"./
|
|
24
|
-
"./dist/index.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./main": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./adapters": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./core": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./vm": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./collection": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./jsx-runtime": {
|
|
36
|
+
"type": "./dist/jsx-runtime.d.ts",
|
|
37
|
+
"import": "./dist/jsx-runtime.js"
|
|
38
|
+
}
|
|
29
39
|
},
|
|
30
40
|
"files": [
|
|
31
41
|
"dist",
|
|
@@ -51,11 +61,14 @@
|
|
|
51
61
|
},
|
|
52
62
|
"homepage": "https://github.com/SampleUserD/Stillflow.Engine#readme",
|
|
53
63
|
"scripts": {
|
|
54
|
-
"build": "tsc --build",
|
|
55
|
-
"watch": "tsc
|
|
64
|
+
"build": "tsc --build && tsc-alias && tsc-esm-fix",
|
|
65
|
+
"watch": "concurrently \"tsc -w\" \"tsc-alias -w\"",
|
|
56
66
|
"prepublishOnly": "npm run build"
|
|
57
67
|
},
|
|
58
68
|
"devDependencies": {
|
|
69
|
+
"@types/node": "^26.6.6",
|
|
70
|
+
"tsc-alias": "^1.9.10",
|
|
71
|
+
"tsc-esm-fix": "^3.1.2",
|
|
59
72
|
"typescript": "^5.0.0"
|
|
60
73
|
}
|
|
61
74
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Adapters = 'webgl' | 'canvas' | 'dom';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|