stillflow.engine 0.4.4 → 0.4.5

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.
@@ -1,2 +1,2 @@
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>, ...children: Binding<any>[]): Binding<T>;
2
+ export declare function jsx<T>(type: (properties: Record<string, any>, children: Binding<any>[]) => Binding<T>, properties: Record<string, any>): Binding<T>;
@@ -1,3 +1,4 @@
1
- export function jsx(type, properties, ...children) {
1
+ export function jsx(type, properties) {
2
+ const children = properties.children || [];
2
3
  return type(properties, children);
3
4
  }
@@ -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;
@@ -1,4 +1,5 @@
1
- import { core, vm, operators, adapters, collection } from "../index.js";
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 (vm.jsx(jsxdom.div, { className: "col-md-6" },
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 (vm.jsx(jsxdom.div, { className: "col-sm-6 smallpad" },
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 (vm.jsx(jsxdom.tr, { "sf:className": (context) => controller.is_selected(context.index) ? "danger" : String() },
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 (vm.jsx(jsxdom.table, { className: "table table-hover table-striped test-data" }, vm.jsx(jsxdom.tbody, { "sf:for": () => controller.items, "sf:each": () => vm.jsx(BenchmarkApplicationTableRow, { controller: controller }) })));
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 (vm.jsx(jsxdom.div, { id: "app", className: "container" },
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.$(vm.jsx(jsxdom.div, { "sf:vm": () => custom_compiler },
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,5 +1 @@
1
- export declare function buildData(count?: number): {
2
- id: number;
3
- index: number;
4
- label: string;
5
- }[];
1
+ export declare function buildData(count?: number): any[];
@@ -1,4 +1,5 @@
1
- import { core, vm, collection, operators, adapters } from '../index.js';
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 (vm.jsx(jsxdom.div, null, (context) => context.label));
24
+ return (_jsx(jsxdom.div, { children: (context) => context.label }));
24
25
  }
25
26
  function App() {
26
- return (vm.jsx(jsxdom.div, null,
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.$(vm.jsx(App, null), { container: document.body });
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.4",
3
+ "version": "0.4.5",
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
- "./main": [
15
- "./dist/index.js"
16
- ],
17
- "./adapters": [
18
- "./dist/index.js"
19
- ],
20
- "./core": [
21
- "./dist/index.js"
22
- ],
23
- "./vm": [
24
- "./dist/index.js"
25
- ],
26
- "./collection": [
27
- "./dist/index.js"
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 --watch",
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 {};
@@ -1,3 +0,0 @@
1
- export declare function vm({ type }: {
2
- type: () => string;
3
- }): void;
@@ -1,2 +0,0 @@
1
- export function vm({ type }) {
2
- }
@@ -1,2 +0,0 @@
1
- import { Binding } from "./binding.js";
2
- export declare function jsx<T>(type: (properties: Record<string, any>, children: Binding<any>[]) => Binding<T>, properties: Record<string, any>, ...children: Binding<any>[]): Binding<T>;
@@ -1,3 +0,0 @@
1
- export function jsx(type, properties, ...children) {
2
- return type(properties, children);
3
- }
@@ -1,2 +0,0 @@
1
- import { Binding } from "../binding.js";
2
- export declare function jsx<T>(type: (properties: Record<string, any>, children: Binding<any>[]) => Binding<T>, properties: Record<string, any>, ...children: Binding<any>[]): Binding<T>;
@@ -1,3 +0,0 @@
1
- export function jsx(type, properties, ...children) {
2
- return type(properties, children);
3
- }
@@ -1,2 +0,0 @@
1
- import { Binding } from "../binding.js";
2
- export declare function jsx<T>(type: (properties: Record<string, any>, children: Binding<any>[]) => Binding<T>, properties: Record<string, any>, ...children: Binding<any>[]): Binding<T>;
@@ -1,3 +0,0 @@
1
- export function jsx(type, properties, ...children) {
2
- return type(properties, children);
3
- }