@stillflow/engine 0.0.0-stage → 1.0.0

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.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +156 -3
  3. package/dist/index.cjs.js +1051 -0
  4. package/dist/index.d.ts +9 -0
  5. package/dist/index.es.js +1023 -0
  6. package/dist/jsx-runtime.d.ts +43 -0
  7. package/dist/lib-DUuDpiwh.js +11975 -0
  8. package/dist/lib-lWz8P7iq.cjs +11979 -0
  9. package/dist/stillflow/abstracts/IR.d.ts +7 -0
  10. package/dist/stillflow/abstracts/meta.d.ts +8 -0
  11. package/dist/stillflow/abstracts/operators.d.ts +22 -0
  12. package/dist/stillflow/abstracts/state.d.ts +13 -0
  13. package/dist/stillflow/abstracts/view.d.ts +8 -0
  14. package/dist/stillflow/compiler/compile.d.ts +11 -0
  15. package/dist/stillflow/compiler/instantiate.d.ts +3 -0
  16. package/dist/stillflow/factories/factories.d.ts +10 -0
  17. package/dist/stillflow/index.d.ts +5 -0
  18. package/dist/stillflow/kernel/buffer.d.ts +10 -0
  19. package/dist/stillflow/kernel/kernel.d.ts +26 -0
  20. package/dist/stillflow/kernel/signal.d.ts +5 -0
  21. package/dist/stillflow/operators.d.ts +15 -0
  22. package/dist/stillflow/state.d.ts +15 -0
  23. package/dist/stillflow/stillflow.d.ts +28 -0
  24. package/dist/stillflow/tools/batcher.d.ts +9 -0
  25. package/dist/stillflow/variable.d.ts +12 -0
  26. package/dist/stillflow-collection/abstract/collection.delta.d.ts +10 -0
  27. package/dist/stillflow-collection/abstract/collection.flusher.d.ts +17 -0
  28. package/dist/stillflow-collection/abstract/collection.glee.d.ts +28 -0
  29. package/dist/stillflow-collection/abstract/collection.index.d.ts +9 -0
  30. package/dist/stillflow-collection/abstract/collection.logical.d.ts +13 -0
  31. package/dist/stillflow-collection/abstract/collection.physical.d.ts +13 -0
  32. package/dist/stillflow-collection/abstract/collection.serializable.d.ts +4 -0
  33. package/dist/stillflow-collection/array.d.ts +21 -0
  34. package/dist/stillflow-collection/fenwick.d.ts +28 -0
  35. package/dist/stillflow-collection/flushable.d.ts +38 -0
  36. package/dist/stillflow-collection/index.d.ts +6 -0
  37. package/dist/stillflow-collection/utilities/disjointed-set.d.ts +10 -0
  38. package/dist/stillflow-collection/utilities/fenwick-tree.d.ts +9 -0
  39. package/dist/stillflow-collection/utilities/index.d.ts +1 -0
  40. package/dist/stillflow-collection/utilities/interval-merger.d.ts +7 -0
  41. package/dist/stillflow-collection/utilities/range-fenwick-tree.d.ts +11 -0
  42. package/dist/stillflow-runtime/dom.d.ts +5 -0
  43. package/dist/stillflow-runtime/utilities/delegate-event.d.ts +1 -0
  44. package/dist/stillflow-runtime/utilities/index.d.ts +3 -0
  45. package/dist/stillflow-runtime/utilities/reconcile-if.d.ts +10 -0
  46. package/dist/stillflow-runtime/utilities/reconcile-list.d.ts +8 -0
  47. package/dist/stillflow-serialize/deserialize.d.ts +2 -0
  48. package/dist/stillflow-serialize/index.d.ts +2 -0
  49. package/dist/stillflow-serialize/serialize.d.ts +2 -0
  50. package/dist/stillflow-serialize/serialized.d.ts +4 -0
  51. package/dist/stillflow-vite/dom.pass.codegen.d.ts +8 -0
  52. package/dist/stillflow-vite/dom.pass.transform.d.ts +16 -0
  53. package/dist/stillflow-vite/dom.target.d.ts +2 -0
  54. package/dist/stillflow-vite/targets.plugin.d.ts +9 -0
  55. package/dist/stillflow-vite/vm-abstract/index.d.ts +3 -0
  56. package/dist/stillflow-vite/vm-abstract/vm.instruction.d.ts +7 -0
  57. package/dist/stillflow-vite/vm-abstract/vm.options.d.ts +4 -0
  58. package/dist/stillflow-vite/vm-abstract/vm.target.d.ts +23 -0
  59. package/dist/stillflow-vite/vm-compiler/bytecode-builder.d.ts +33 -0
  60. package/dist/stillflow-vite/vm-compiler/codes.d.ts +20 -0
  61. package/dist/stillflow-vite/vm-compiler/dirty.d.ts +7 -0
  62. package/dist/stillflow-vite/vm-compiler/fabric.d.ts +9 -0
  63. package/dist/stillflow-vite/vm-compiler/index.d.ts +8 -0
  64. package/dist/stillflow-vite/vm-compiler/nodes.d.ts +72 -0
  65. package/dist/stillflow-vite/vm-compiler/pass.analyze-dirty.d.ts +3 -0
  66. package/dist/stillflow-vite/vm-compiler/pass.analyze-dynamic.d.ts +2 -0
  67. package/dist/stillflow-vite/vm-compiler/pass.lowering.d.ts +4 -0
  68. package/dist/stillflow-vite/vm-compiler/pass.scopes.d.ts +14 -0
  69. package/dist/stillflow-vite/vm-targets/collect-components.d.ts +8 -0
  70. package/dist/stillflow-vite/vm-targets/collect-imports.d.ts +3 -0
  71. package/dist/stillflow-vite/vm-targets/find-component.d.ts +3 -0
  72. package/dist/targets.index.d.ts +1 -0
  73. package/dist/vite.cjs.js +261 -0
  74. package/dist/vite.es.js +260 -0
  75. package/dist/vite.plugin.d.ts +3 -0
  76. package/dist/vm.instruction-DPuxu4sV.cjs +9 -0
  77. package/dist/vm.instruction-oyM-GI-p.js +4 -0
  78. package/dist/vms.cjs.js +1096 -0
  79. package/dist/vms.es.js +1095 -0
  80. package/package.json +99 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SampleUserD
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,156 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # Stillflow
2
+
3
+ [![npm version](https://img.shields.io/npm/v/stillflow.engine)](https://www.npmjs.com/package/stillflow.engine)
4
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/stillflow.engine)](https://bundlephobia.com/package/stillflow.engine)
5
+ [![dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://npmgraph.js.org/?q=stillflow.engine)
6
+ [![license](https://img.shields.io/npm/l/stillflow.engine)](./LICENSE)
7
+ [![CI](https://github.com/SampleUserD/Stillflow.Engine/actions/workflows/ci.yml/badge.svg)](https://github.com/SampleUserD/Stillflow.Engine/actions/workflows/ci.yml)
8
+
9
+ A headless, transaction-based UI engine with AOT compilation, designed for predictable performance and minimal memory overhead (<3.5 kB gzipped, zero runtime dependencies).
10
+
11
+ ---
12
+
13
+ ## Why Stillflow?
14
+
15
+ Built to achieve explicit control over the application lifecycle with predictable performance and out-of-the-box serializable state, Stillflow **does not use a Virtual DOM**. Instead of unpredictable $O(n)$ VDOM diffing, it compiles JSX ahead-of-time into flat bytecode instructions and updates the DOM directly through atomic transactions.
16
+
17
+ ---
18
+
19
+ ## Philosophy
20
+
21
+ $$\text{UI} = \text{State} + \text{Projections} + \text{Bindings} + \text{Feedback Loop}$$
22
+
23
+ * **UI is a subset of State:** Real applications deal with user and document events (`click`, `input`, `load`, etc.), meaning state cannot be fully reconstructed from the UI alone.
24
+ * **Map-State as a Single Source of Truth:** Global state is modeled as a clean, serializable structure ("map-state") free of symbols, functions, or opaque class instances.
25
+ * **Explicit Reactivity over Implicit Magic:** Stillflow uses an explicit `commit()` boundary where mutations accumulate in double-buffered queues and apply atomically.
26
+
27
+ ---
28
+
29
+ ## Key Features
30
+
31
+ 1. **AOT Compilation & Bytecode IR** — Compiles JSX inside the `$()` entry point into flat bytecode instructions at build time.
32
+ 2. **Transactional Kernel** — Explicit `commit()`, double-buffered delta queues, and atomic updates.
33
+ 3. **Keyless List Reconciliation via Fenwick Trees** — Built-in `Flushable` collections backed by resizable `Int32Array` Fenwick trees map logical indices to physical DOM nodes in $O(\log n)$ time.
34
+ 4. **Headless Core** — Completely decoupled from the DOM to target custom renderers.
35
+ 5. **Type-Safe JSX** — Full TypeScript inference and autocomplete for DOM properties and directives.
36
+
37
+ ---
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ npm install stillflow.engine
43
+ ```
44
+
45
+ ### Vite & TypeScript Setup
46
+
47
+ Configure Vite with the Stillflow AOT compiler plugin and point TypeScript JSX to `stillflow.engine`:
48
+
49
+ ```ts
50
+ // vite.config.ts
51
+ import { defineConfig } from 'vite'
52
+ import { stillflow_plugin } from 'stillflow.engine/vite'
53
+ import { dom } from 'stillflow.engine/vms'
54
+
55
+ export default defineConfig({
56
+ plugins: [
57
+ stillflow_plugin({
58
+ targets: {
59
+ 0: dom
60
+ }
61
+ })
62
+ ]
63
+ })
64
+ ```
65
+
66
+ ```json
67
+ {
68
+ "compilerOptions": {
69
+ "moduleResolution": "bundler",
70
+ "jsx": "preserve",
71
+ "jsxImportSource": "stillflow.engine"
72
+ }
73
+ }
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Quick Start
79
+
80
+ > **[Try the Live Interactive Playground on GitHub Pages →](https://sampleuserd.github.io/Stillflow.Engine/)**
81
+
82
+
83
+ ### 1. Basic Counter & Conditional Rendering
84
+
85
+ Wrap your JSX tree in `$()` to compile it into direct DOM operations, and trigger updates explicitly via a commit function:
86
+
87
+ ```tsx
88
+ import { runtime } from 'stillflow.engine'
89
+
90
+ const { $ } = runtime
91
+
92
+ let count = 0
93
+
94
+ const update = $(
95
+ <main>
96
+ <h1>Count: {count}</h1>
97
+ <if cond={count > 0}>
98
+ <p>Positive value</p>
99
+ </if>
100
+ <else>
101
+ <p>Zero or negative</p>
102
+ </else>
103
+ <button sf:click={[() => { count++; update() }, {}] as const}>
104
+ Increment
105
+ </button>
106
+ </main>
107
+ )(document.body)
108
+ ```
109
+
110
+ ### 2. High-Speed Lists (`<for>`) & Zero-Closure Event Tuples
111
+
112
+ Use `FlushableCollection` for $O(\log n)$ list operations and pass `[handler, item]` tuples to `sf:*` events to avoid per-row closure allocations:
113
+
114
+ ```tsx
115
+ import { collections, runtime } from 'stillflow.engine'
116
+
117
+ const { $, $index } = runtime
118
+
119
+ interface Task {
120
+ id: number
121
+ title: string
122
+ }
123
+
124
+ const tasks = collections.Flushable.fenwick<Task>()
125
+ let next_id = 1
126
+
127
+ const remove_task = (index: number) => {
128
+ tasks.drop(index)
129
+ update()
130
+ }
131
+
132
+ const add_task = () => {
133
+ tasks.push({ id: next_id++, title: `Task #${next_id}` })
134
+ update()
135
+ }
136
+
137
+ const update = $(
138
+ <section>
139
+ <button sf:click={[add_task, {}]}>Add Task</button>
140
+ <ul>
141
+ <for select={tasks}>
142
+ <li>
143
+ <span>{$it.title}</span>
144
+ <button sf:click={[remove_task, $index]}>×</button>
145
+ </li>
146
+ </for>
147
+ </ul>
148
+ </section>
149
+ )(document.body)
150
+ ```
151
+
152
+ ---
153
+
154
+ ## License
155
+
156
+ [MIT](./LICENSE)