stillflow.engine 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +114 -2
- package/dist/index.d.ts +9 -0
- package/dist/index.js +8 -0
- package/dist/stillflow/abstracts/IR.d.ts +7 -0
- package/dist/stillflow/abstracts/IR.js +1 -0
- package/dist/stillflow/abstracts/meta.d.ts +8 -0
- package/dist/stillflow/abstracts/meta.js +1 -0
- package/dist/stillflow/abstracts/operators.d.ts +22 -0
- package/dist/stillflow/abstracts/operators.js +1 -0
- package/dist/stillflow/abstracts/state.d.ts +7 -0
- package/dist/stillflow/abstracts/state.js +1 -0
- package/dist/stillflow/abstracts/view.d.ts +8 -0
- package/dist/stillflow/abstracts/view.js +1 -0
- package/dist/stillflow/compiler/compile.d.ts +11 -0
- package/dist/stillflow/compiler/compile.js +84 -0
- package/dist/stillflow/compiler/instantiate.d.ts +3 -0
- package/dist/stillflow/compiler/instantiate.js +40 -0
- package/dist/stillflow/factories/factories.d.ts +10 -0
- package/dist/stillflow/factories/factories.js +20 -0
- package/dist/stillflow/kernel/buffer.d.ts +9 -0
- package/dist/stillflow/kernel/buffer.js +13 -0
- package/dist/stillflow/kernel/kernel.d.ts +20 -0
- package/dist/stillflow/kernel/kernel.js +44 -0
- package/dist/stillflow/kernel/signal.d.ts +5 -0
- package/dist/stillflow/kernel/signal.js +12 -0
- package/dist/stillflow/operators.d.ts +15 -0
- package/dist/stillflow/operators.js +31 -0
- package/dist/stillflow/state.d.ts +9 -0
- package/dist/stillflow/state.js +12 -0
- package/dist/stillflow/stillflow.d.ts +27 -0
- package/dist/stillflow/stillflow.js +59 -0
- package/dist/stillflow/tools/batcher.d.ts +8 -0
- package/dist/stillflow/tools/batcher.js +17 -0
- package/dist/stillflow/variable.d.ts +12 -0
- package/dist/stillflow/variable.js +24 -0
- package/dist/stillflow-adapters/binding.d.ts +4 -0
- package/dist/stillflow-adapters/binding.js +1 -0
- package/dist/stillflow-adapters/dom/compiler/apply.d.ts +16 -0
- package/dist/stillflow-adapters/dom/compiler/apply.js +212 -0
- package/dist/stillflow-adapters/dom/compiler/compile.d.ts +18 -0
- package/dist/stillflow-adapters/dom/compiler/compile.js +47 -0
- package/dist/stillflow-adapters/dom/compiler/transform.d.ts +2 -0
- package/dist/stillflow-adapters/dom/compiler/transform.js +41 -0
- package/dist/stillflow-adapters/dom/description/describe.d.ts +3 -0
- package/dist/stillflow-adapters/dom/description/describe.js +6 -0
- package/dist/stillflow-adapters/dom/dom.d.ts +4 -0
- package/dist/stillflow-adapters/dom/dom.js +1 -0
- package/dist/stillflow-adapters/dom/index.d.ts +15 -0
- package/dist/stillflow-adapters/dom/index.js +22 -0
- package/dist/stillflow-adapters/dom/jsx.dom.d.ts +32 -0
- package/dist/stillflow-adapters/dom/jsx.dom.js +77 -0
- package/dist/stillflow-adapters/dom/properties/modifiers.d.ts +17 -0
- package/dist/stillflow-adapters/dom/properties/modifiers.js +1 -0
- package/dist/stillflow-adapters/dom/properties/properties.d.ts +15 -0
- package/dist/stillflow-adapters/dom/properties/properties.js +1 -0
- package/dist/stillflow-adapters/dom/tags.d.ts +7 -0
- package/dist/stillflow-adapters/dom/tags.js +5 -0
- package/dist/stillflow-adapters/index.d.ts +3 -0
- package/dist/stillflow-adapters/index.js +3 -0
- package/dist/stillflow-adapters/runtime/jsx.runtime.d.ts +2 -0
- package/dist/stillflow-adapters/runtime/jsx.runtime.js +3 -0
- package/dist/stillflow-collection/abstract/collection.d.ts +15 -0
- package/dist/stillflow-collection/abstract/collection.js +1 -0
- package/dist/stillflow-collection/delta.d.ts +10 -0
- package/dist/stillflow-collection/delta.js +18 -0
- package/dist/stillflow-collection/fenwick.d.ts +24 -0
- package/dist/stillflow-collection/fenwick.js +102 -0
- package/dist/stillflow-collection/flushable.d.ts +21 -0
- package/dist/stillflow-collection/flushable.js +70 -0
- package/dist/stillflow-collection/utilities/disjointed-set.d.ts +10 -0
- package/dist/stillflow-collection/utilities/disjointed-set.js +45 -0
- package/dist/stillflow-collection/utilities/fenwick-tree.d.ts +9 -0
- package/dist/stillflow-collection/utilities/fenwick-tree.js +27 -0
- package/dist/stillflow-collection/utilities/interval-merger.d.ts +7 -0
- package/dist/stillflow-collection/utilities/interval-merger.js +70 -0
- package/dist/stillflow-collection/utilities/range-fenwick-tree.d.ts +11 -0
- package/dist/stillflow-collection/utilities/range-fenwick-tree.js +28 -0
- package/dist/stillflow-examples/app.d.ts +1 -0
- package/dist/stillflow-examples/app.js +140 -0
- package/dist/stillflow-examples/data.d.ts +5 -0
- package/dist/stillflow-examples/data.js +73 -0
- package/dist/stillflow-examples/test.d.ts +1 -0
- package/dist/stillflow-examples/test.js +35 -0
- package/dist/stillflow-scripts/gen-tags.d.ts +1 -0
- package/dist/stillflow-scripts/gen-tags.js +50 -0
- package/dist/stillflow-vm/analyze.d.ts +7 -0
- package/dist/stillflow-vm/analyze.js +22 -0
- package/dist/stillflow-vm/buffer.d.ts +1 -0
- package/dist/stillflow-vm/buffer.js +1 -0
- package/dist/stillflow-vm/instruction.d.ts +1 -0
- package/dist/stillflow-vm/instruction.js +1 -0
- package/dist/stillflow-vm/pool.d.ts +1 -0
- package/dist/stillflow-vm/pool.js +1 -0
- package/dist/stillflow-vm/resources.d.ts +14 -0
- package/dist/stillflow-vm/resources.js +16 -0
- package/package.json +38 -4
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Stillflow, State, Batcher, operators, adapters, FlushableCollection, FenwickCollection } from "../index.js";
|
|
2
|
+
import { buildData } from "./data.js";
|
|
3
|
+
const { jsxdom, jsx, DOM } = adapters;
|
|
4
|
+
class BenchmarkApplicationController {
|
|
5
|
+
_stillflow = new Stillflow(new State(), { strategy: site => requestAnimationFrame(site) });
|
|
6
|
+
_clearing = new Batcher(site => requestIdleCallback(site));
|
|
7
|
+
_factory = this._stillflow.factory();
|
|
8
|
+
_view;
|
|
9
|
+
schedule_clear() {
|
|
10
|
+
this._view.items.mark_cleared();
|
|
11
|
+
this._clearing.task(() => this._view.items.shrink());
|
|
12
|
+
}
|
|
13
|
+
deselect() {
|
|
14
|
+
this._view.selection.current_id = undefined;
|
|
15
|
+
this._view.selection.previous_id = undefined;
|
|
16
|
+
this._stillflow.commit();
|
|
17
|
+
}
|
|
18
|
+
create(count = 1000) {
|
|
19
|
+
this.schedule_clear();
|
|
20
|
+
this.deselect();
|
|
21
|
+
this.add(count);
|
|
22
|
+
}
|
|
23
|
+
get source() {
|
|
24
|
+
const previous_id = this._stillflow.variable('previous_id');
|
|
25
|
+
const current_id = this._stillflow.variable('current_id');
|
|
26
|
+
const data = this._stillflow.variable('data');
|
|
27
|
+
return {
|
|
28
|
+
selection: operators.link({
|
|
29
|
+
previous_id: previous_id.backref(),
|
|
30
|
+
current_id: current_id.backref()
|
|
31
|
+
}),
|
|
32
|
+
data: data.backref(),
|
|
33
|
+
items: operators.is(FlushableCollection.name)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
constructor() {
|
|
37
|
+
const collection = new FlushableCollection(new FenwickCollection(10000));
|
|
38
|
+
const view = this._stillflow.compile(this.source);
|
|
39
|
+
this._factory.add(FlushableCollection.name, view => collection);
|
|
40
|
+
this._view = this._stillflow.instantiate(view, this._factory);
|
|
41
|
+
}
|
|
42
|
+
is_selected(id) {
|
|
43
|
+
return this._view.selection.current_id === id;
|
|
44
|
+
}
|
|
45
|
+
add(count = 1000) {
|
|
46
|
+
this._view.items.attach(buildData(count));
|
|
47
|
+
this._stillflow.commit();
|
|
48
|
+
}
|
|
49
|
+
run() {
|
|
50
|
+
this.create(1000);
|
|
51
|
+
}
|
|
52
|
+
run_lots() {
|
|
53
|
+
this.create(10000);
|
|
54
|
+
}
|
|
55
|
+
remove(id) {
|
|
56
|
+
this._view.items.mark_removed(id);
|
|
57
|
+
this._stillflow.commit();
|
|
58
|
+
}
|
|
59
|
+
select(id) {
|
|
60
|
+
const NO_OP = () => { };
|
|
61
|
+
this._view.selection.previous_id = this._view.selection.current_id;
|
|
62
|
+
this._view.selection.current_id = id;
|
|
63
|
+
this._view.items.mutate(this._view.selection.previous_id || 0, NO_OP);
|
|
64
|
+
this._view.items.mutate(id, NO_OP);
|
|
65
|
+
this._stillflow.commit();
|
|
66
|
+
}
|
|
67
|
+
clear() {
|
|
68
|
+
this.schedule_clear();
|
|
69
|
+
this._stillflow.commit();
|
|
70
|
+
}
|
|
71
|
+
update() {
|
|
72
|
+
const length = this._view.items.size;
|
|
73
|
+
const mutator = (view) => view.label += ' !!!';
|
|
74
|
+
for (let id = 0; id < length; id += 10) {
|
|
75
|
+
this._view.items.mutate(this._view.items.map(id), mutator);
|
|
76
|
+
}
|
|
77
|
+
this._stillflow.commit();
|
|
78
|
+
}
|
|
79
|
+
swap() {
|
|
80
|
+
const size = this._view.items.size;
|
|
81
|
+
const mutator = (id) => (view) => view.index = id;
|
|
82
|
+
if (size > 998) {
|
|
83
|
+
this._view.items.swap(1, 998);
|
|
84
|
+
this._view.items.mutate(1, mutator(1));
|
|
85
|
+
this._view.items.mutate(998, mutator(998));
|
|
86
|
+
this._stillflow.commit();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
get items() {
|
|
90
|
+
return this._view.items;
|
|
91
|
+
}
|
|
92
|
+
get core() {
|
|
93
|
+
return this._stillflow;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function BenchmarkApplicationHeader() {
|
|
97
|
+
return (adapters.jsx(jsxdom.div, { className: "col-md-6" },
|
|
98
|
+
adapters.jsx(jsxdom.h1, null, "Stillflow")));
|
|
99
|
+
}
|
|
100
|
+
function BenchmarkApplicationButton(context) {
|
|
101
|
+
return (adapters.jsx(jsxdom.div, { className: "col-sm-6 smallpad" },
|
|
102
|
+
adapters.jsx(jsxdom.button, { type: "button", className: "btn btn-primary btn-block", id: context.id, "on:click": context.handle }, context.text)));
|
|
103
|
+
}
|
|
104
|
+
function BenchmarkApplicationTableRow(context) {
|
|
105
|
+
const { controller } = context;
|
|
106
|
+
return (adapters.jsx(jsxdom.tr, { "sf:className": (context) => controller.is_selected(context.index) ? "danger" : String() },
|
|
107
|
+
adapters.jsx(jsxdom.td, { className: "col-md-1" }, (context) => context.id),
|
|
108
|
+
adapters.jsx(jsxdom.td, { className: "col-md-4" },
|
|
109
|
+
adapters.jsx(jsxdom.a, { "sf:on-click": (event, context) => controller.select(context.index) }, (context) => context.label)),
|
|
110
|
+
adapters.jsx(jsxdom.td, { className: "col-md-1" },
|
|
111
|
+
adapters.jsx(jsxdom.a, { "sf:on-click": (event, context) => controller.remove(context.index) },
|
|
112
|
+
adapters.jsx(jsxdom.span, { ariaHidden: "true", className: "glyphicon glyphicon-remove" }))),
|
|
113
|
+
adapters.jsx(jsxdom.td, { className: "col-md-6" })));
|
|
114
|
+
}
|
|
115
|
+
function BenchmarkApplicationTable(context) {
|
|
116
|
+
const { controller } = context;
|
|
117
|
+
return (adapters.jsx(jsxdom.table, { className: "table table-hover table-striped test-data" }, adapters.jsx(jsxdom.tbody, { "sf:for": () => controller.items, "sf:each": () => adapters.jsx(BenchmarkApplicationTableRow, { controller: controller }) })));
|
|
118
|
+
}
|
|
119
|
+
function BenchmarkApplicationView(context) {
|
|
120
|
+
const { controller } = context;
|
|
121
|
+
return (adapters.jsx(jsxdom.div, { id: "app", className: "container" },
|
|
122
|
+
adapters.jsx(jsxdom.div, { className: "jumbotron" },
|
|
123
|
+
adapters.jsx(jsxdom.div, { className: "row" },
|
|
124
|
+
adapters.jsx(BenchmarkApplicationHeader, null),
|
|
125
|
+
adapters.jsx(jsxdom.div, { className: "row" },
|
|
126
|
+
adapters.jsx(jsxdom.div, { className: "col-md-6" },
|
|
127
|
+
adapters.jsx(BenchmarkApplicationButton, { text: "Create 1,000 rows", id: "run", handle: () => controller.run() }),
|
|
128
|
+
adapters.jsx(BenchmarkApplicationButton, { text: "Create 10,000 rows", id: "runlots", handle: () => controller.run_lots() }),
|
|
129
|
+
adapters.jsx(BenchmarkApplicationButton, { text: "Append 1,000 rows", id: "add", handle: () => controller.add() }),
|
|
130
|
+
adapters.jsx(BenchmarkApplicationButton, { text: "Update every 10th row", id: "update", handle: () => controller.update() }),
|
|
131
|
+
adapters.jsx(BenchmarkApplicationButton, { text: "Clear", id: "clear", handle: () => controller.clear() }),
|
|
132
|
+
adapters.jsx(BenchmarkApplicationButton, { text: "Swap rows", id: "swaprows", handle: () => controller.swap() }))))),
|
|
133
|
+
adapters.jsx(BenchmarkApplicationTable, { controller: controller }),
|
|
134
|
+
adapters.jsx(jsxdom.span, { ariaHidden: "true", className: "preloadicon glyphicon glyphicon-remove" })));
|
|
135
|
+
}
|
|
136
|
+
const controller = new BenchmarkApplicationController();
|
|
137
|
+
const { element, update } = new DOM().$(adapters.jsx(BenchmarkApplicationView, { controller: controller }));
|
|
138
|
+
controller.core.on(() => update({}));
|
|
139
|
+
document.body.appendChild(element);
|
|
140
|
+
update({});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
let ID = 1;
|
|
2
|
+
function _random(max) {
|
|
3
|
+
return Math.round(Math.random() * 1000) % max;
|
|
4
|
+
}
|
|
5
|
+
export function buildData(count = 1000) {
|
|
6
|
+
const adjectives = [
|
|
7
|
+
'pretty',
|
|
8
|
+
'large',
|
|
9
|
+
'big',
|
|
10
|
+
'small',
|
|
11
|
+
'tall',
|
|
12
|
+
'short',
|
|
13
|
+
'long',
|
|
14
|
+
'handsome',
|
|
15
|
+
'plain',
|
|
16
|
+
'quaint',
|
|
17
|
+
'clean',
|
|
18
|
+
'elegant',
|
|
19
|
+
'easy',
|
|
20
|
+
'angry',
|
|
21
|
+
'crazy',
|
|
22
|
+
'helpful',
|
|
23
|
+
'mushy',
|
|
24
|
+
'odd',
|
|
25
|
+
'unsightly',
|
|
26
|
+
'adorable',
|
|
27
|
+
'important',
|
|
28
|
+
'inexpensive',
|
|
29
|
+
'cheap',
|
|
30
|
+
'expensive',
|
|
31
|
+
'fancy'
|
|
32
|
+
];
|
|
33
|
+
const colours = [
|
|
34
|
+
'red',
|
|
35
|
+
'yellow',
|
|
36
|
+
'blue',
|
|
37
|
+
'green',
|
|
38
|
+
'pink',
|
|
39
|
+
'brown',
|
|
40
|
+
'purple',
|
|
41
|
+
'brown',
|
|
42
|
+
'white',
|
|
43
|
+
'black',
|
|
44
|
+
'orange'
|
|
45
|
+
];
|
|
46
|
+
const nouns = [
|
|
47
|
+
'table',
|
|
48
|
+
'chair',
|
|
49
|
+
'house',
|
|
50
|
+
'bbq',
|
|
51
|
+
'desk',
|
|
52
|
+
'car',
|
|
53
|
+
'pony',
|
|
54
|
+
'cookie',
|
|
55
|
+
'sandwich',
|
|
56
|
+
'burger',
|
|
57
|
+
'pizza',
|
|
58
|
+
'mouse',
|
|
59
|
+
'keyboard'
|
|
60
|
+
];
|
|
61
|
+
const data = [];
|
|
62
|
+
for (let i = 0; i < count; i++)
|
|
63
|
+
data.push({
|
|
64
|
+
id: ID++,
|
|
65
|
+
index: i,
|
|
66
|
+
label: adjectives[_random(adjectives.length)] +
|
|
67
|
+
' ' +
|
|
68
|
+
colours[_random(colours.length)] +
|
|
69
|
+
' ' +
|
|
70
|
+
nouns[_random(nouns.length)]
|
|
71
|
+
});
|
|
72
|
+
return data;
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Stillflow, State, FenwickCollection, FlushableCollection, operators, adapters } from '../index.js';
|
|
2
|
+
const { jsxdom, DOM } = adapters;
|
|
3
|
+
const state = new State();
|
|
4
|
+
const stillflow = new Stillflow(state);
|
|
5
|
+
const factory = stillflow.factory();
|
|
6
|
+
factory.add(FlushableCollection.name, () => new FlushableCollection(new FenwickCollection(100)));
|
|
7
|
+
const source = {
|
|
8
|
+
input: stillflow.variable('input').backref(),
|
|
9
|
+
items: operators.is(FlushableCollection.name)
|
|
10
|
+
};
|
|
11
|
+
const view = stillflow.compile(source);
|
|
12
|
+
const instance = stillflow.instantiate(view, factory);
|
|
13
|
+
function change(event) {
|
|
14
|
+
instance.input = event.target.value;
|
|
15
|
+
stillflow.commit();
|
|
16
|
+
}
|
|
17
|
+
function add() {
|
|
18
|
+
instance.items.add({ label: instance.input });
|
|
19
|
+
instance.input = String();
|
|
20
|
+
stillflow.commit();
|
|
21
|
+
}
|
|
22
|
+
function TodoItem() {
|
|
23
|
+
return (adapters.jsx(jsxdom.div, null, (context) => context.label));
|
|
24
|
+
}
|
|
25
|
+
function App() {
|
|
26
|
+
return (adapters.jsx(jsxdom.div, null,
|
|
27
|
+
adapters.jsx(jsxdom.input, { "sf:value": (context) => context.input, "on:change": change }),
|
|
28
|
+
adapters.jsx(jsxdom.button, { "on:click": add }, "Add"),
|
|
29
|
+
adapters.jsx(jsxdom.div, { "sf:for": (context) => context.items, "sf:each": () => adapters.jsx(TodoItem, null) })));
|
|
30
|
+
}
|
|
31
|
+
const { element: app, update } = new DOM().$(adapters.jsx(App, null));
|
|
32
|
+
stillflow.on(() => update(instance));
|
|
33
|
+
instance.input = String();
|
|
34
|
+
document.body.appendChild(app);
|
|
35
|
+
update(instance);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// scripts/gen-tags.ts
|
|
2
|
+
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
3
|
+
import { resolve, dirname } from 'node:path';
|
|
4
|
+
function extractKeys(dts, interfaceName) {
|
|
5
|
+
// ищем `interface Name { ... }` с балансировкой скобок
|
|
6
|
+
const start = dts.indexOf(`interface ${interfaceName}`);
|
|
7
|
+
if (start === -1)
|
|
8
|
+
throw new Error(`${interfaceName} not found in lib.dom.d.ts`);
|
|
9
|
+
const braceOpen = dts.indexOf('{', start);
|
|
10
|
+
let depth = 0;
|
|
11
|
+
let braceClose = -1;
|
|
12
|
+
for (let i = braceOpen; i < dts.length; i++) {
|
|
13
|
+
if (dts[i] === '{')
|
|
14
|
+
depth++;
|
|
15
|
+
else if (dts[i] === '}') {
|
|
16
|
+
depth--;
|
|
17
|
+
if (depth === 0) {
|
|
18
|
+
braceClose = i;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (braceClose === -1)
|
|
24
|
+
throw new Error(`Unbalanced braces in ${interfaceName}`);
|
|
25
|
+
const body = dts.slice(braceOpen + 1, braceClose);
|
|
26
|
+
// ключи в мапе — это строковые литералы: "div": HTMLDivElement;
|
|
27
|
+
return [...body.matchAll(/"([^"]+)"\s*:/g)].map(m => m[1]);
|
|
28
|
+
}
|
|
29
|
+
const dtsPath = resolve('node_modules/@typescript/typescript-win32-x64/lib/lib.dom.d.ts');
|
|
30
|
+
const dts = readFileSync(dtsPath, 'utf8');
|
|
31
|
+
const html = extractKeys(dts, 'HTMLElementTagNameMap');
|
|
32
|
+
const svg = extractKeys(dts, 'SVGElementTagNameMap');
|
|
33
|
+
const math = extractKeys(dts, 'MathMLElementTagNameMap');
|
|
34
|
+
const out = `// AUTO-GENERATED by scripts/gen-tags.ts. Do not edit.
|
|
35
|
+
// Source: typescript/lib/lib.dom.d.ts
|
|
36
|
+
|
|
37
|
+
export const HTML_TAGS = ${JSON.stringify(html)} as const
|
|
38
|
+
export const SVG_TAGS = ${JSON.stringify(svg)} as const
|
|
39
|
+
export const MATH_TAGS = ${JSON.stringify(math)} as const
|
|
40
|
+
|
|
41
|
+
export type HTMLTag = typeof HTML_TAGS[number]
|
|
42
|
+
export type SVGTag = typeof SVG_TAGS[number]
|
|
43
|
+
export type MathTag = typeof MATH_TAGS[number]
|
|
44
|
+
|
|
45
|
+
export type Tag = HTMLTag | SVGTag | MathTag
|
|
46
|
+
`;
|
|
47
|
+
const outPath = resolve('src/stillflow-adapters/dom/tags.ts');
|
|
48
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
49
|
+
writeFileSync(outPath, out);
|
|
50
|
+
console.log(`Generated: ${html.length} HTML, ${svg.length} SVG, ${math.length} MathML tags`);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class Analyzer {
|
|
2
|
+
static MAXIMAL_SIZE = 2 ** 16;
|
|
3
|
+
static ID_COUNTER = 0;
|
|
4
|
+
traverse(binding, callback, path = []) {
|
|
5
|
+
callback(binding, path);
|
|
6
|
+
for (let index = 0, length = binding.children.length; index < length; index++) {
|
|
7
|
+
const child = binding.children[index];
|
|
8
|
+
if (typeof child === 'object') {
|
|
9
|
+
this.traverse(child, callback, [...path, index]);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
analyze(binding) {
|
|
14
|
+
const buffer = new Uint32Array(Analyzer.MAXIMAL_SIZE);
|
|
15
|
+
let offset = 0;
|
|
16
|
+
let length = 0;
|
|
17
|
+
buffer[offset++] = length;
|
|
18
|
+
this.traverse(binding, (binding, path) => {
|
|
19
|
+
});
|
|
20
|
+
return buffer;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FlushableCollection } from "../index.js";
|
|
2
|
+
import { Binding } from "../stillflow-adapters/binding.js";
|
|
3
|
+
export declare class Resources<T> {
|
|
4
|
+
private _resources;
|
|
5
|
+
add(resource: T): number;
|
|
6
|
+
get(index: number): T;
|
|
7
|
+
}
|
|
8
|
+
export declare const POOL_STRINGS: Resources<string>;
|
|
9
|
+
export declare const TEXT_PROPERTIES: Resources<(context: unknown) => string>;
|
|
10
|
+
export declare const CONDITIONAL_PROPERTIES: Resources<(context: unknown) => boolean>;
|
|
11
|
+
export declare const EVENT_PROPERTIES: Resources<(event: unknown, context: unknown) => void>;
|
|
12
|
+
export declare const PROPERTIES: Resources<(event: unknown) => string>;
|
|
13
|
+
export declare const ITERATE_PROPERTIES: Resources<[(context: unknown) => FlushableCollection<unknown>, () => Binding<unknown>]>;
|
|
14
|
+
export declare const POOLS: never[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class Resources {
|
|
2
|
+
_resources = [];
|
|
3
|
+
add(resource) {
|
|
4
|
+
return this._resources.push(resource);
|
|
5
|
+
}
|
|
6
|
+
get(index) {
|
|
7
|
+
return this._resources[index];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export const POOL_STRINGS = new Resources();
|
|
11
|
+
export const TEXT_PROPERTIES = new Resources();
|
|
12
|
+
export const CONDITIONAL_PROPERTIES = new Resources();
|
|
13
|
+
export const EVENT_PROPERTIES = new Resources();
|
|
14
|
+
export const PROPERTIES = new Resources();
|
|
15
|
+
export const ITERATE_PROPERTIES = new Resources();
|
|
16
|
+
export const POOLS = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stillflow.engine",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "A headless, transaction-based UI engine with AOT compilation.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"ui",
|
|
15
|
+
"framework",
|
|
16
|
+
"transactional",
|
|
17
|
+
"aot",
|
|
18
|
+
"headless",
|
|
19
|
+
"typescript",
|
|
20
|
+
"dom"
|
|
21
|
+
],
|
|
22
|
+
"author": "SampleUserD",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/SampleUserD/Stillflow.Engine.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/SampleUserD/Stillflow.Engine/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/SampleUserD/Stillflow.Engine#readme",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc --build",
|
|
34
|
+
"watch": "tsc --watch",
|
|
35
|
+
"prepublishOnly": "npm run build"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"typescript": "^5.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|