@uistate/core 4.1.2 → 5.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.
- package/LICENSE-eventTest.md +26 -0
- package/README.md +409 -42
- package/cssState.js +32 -1
- package/eventState.js +58 -49
- package/eventTest.js +196 -0
- package/examples/001-counter/README.md +44 -0
- package/examples/001-counter/eventState.js +86 -0
- package/examples/001-counter/index.html +30 -0
- package/examples/002-counter-improved/README.md +44 -0
- package/examples/002-counter-improved/eventState.js +86 -0
- package/examples/002-counter-improved/index.html +44 -0
- package/examples/003-input-reactive/README.md +44 -0
- package/examples/003-input-reactive/eventState.js +86 -0
- package/examples/003-input-reactive/index.html +30 -0
- package/examples/004-computed-state/README.md +45 -0
- package/examples/004-computed-state/eventState.js +86 -0
- package/examples/004-computed-state/index.html +62 -0
- package/examples/005-conditional-rendering/README.md +42 -0
- package/examples/005-conditional-rendering/eventState.js +86 -0
- package/examples/005-conditional-rendering/index.html +36 -0
- package/examples/006-list-rendering/README.md +49 -0
- package/examples/006-list-rendering/eventState.js +86 -0
- package/examples/006-list-rendering/index.html +60 -0
- package/examples/007-form-validation/README.md +52 -0
- package/examples/007-form-validation/eventState.js +86 -0
- package/examples/007-form-validation/index.html +99 -0
- package/examples/008-undo-redo/README.md +70 -0
- package/examples/008-undo-redo/eventState.js +86 -0
- package/examples/008-undo-redo/index.html +105 -0
- package/examples/009-localStorage-side-effects/README.md +72 -0
- package/examples/009-localStorage-side-effects/eventState.js +86 -0
- package/examples/009-localStorage-side-effects/index.html +54 -0
- package/examples/010-decoupled-components/README.md +74 -0
- package/examples/010-decoupled-components/eventState.js +86 -0
- package/examples/010-decoupled-components/index.html +90 -0
- package/examples/011-async-patterns/README.md +98 -0
- package/examples/011-async-patterns/eventState.js +86 -0
- package/examples/011-async-patterns/index.html +129 -0
- package/examples/028-counter-improved-eventTest/LICENSE +55 -0
- package/examples/028-counter-improved-eventTest/README.md +131 -0
- package/examples/028-counter-improved-eventTest/app/store.js +9 -0
- package/examples/028-counter-improved-eventTest/index.html +49 -0
- package/examples/028-counter-improved-eventTest/runtime/core/behaviors.runtime.js +282 -0
- package/examples/028-counter-improved-eventTest/runtime/core/eventState.js +100 -0
- package/examples/028-counter-improved-eventTest/runtime/core/helpers.js +212 -0
- package/examples/028-counter-improved-eventTest/runtime/core/router.js +271 -0
- package/examples/028-counter-improved-eventTest/store.d.ts +8 -0
- package/examples/028-counter-improved-eventTest/style.css +170 -0
- package/examples/028-counter-improved-eventTest/tests/README.md +208 -0
- package/examples/028-counter-improved-eventTest/tests/counter.test.js +116 -0
- package/examples/028-counter-improved-eventTest/tests/eventTest.js +176 -0
- package/examples/028-counter-improved-eventTest/tests/generateTypes.js +168 -0
- package/examples/028-counter-improved-eventTest/tests/run.js +20 -0
- package/examples/030-todo-app-with-eventTest/LICENSE +55 -0
- package/examples/030-todo-app-with-eventTest/README.md +121 -0
- package/examples/030-todo-app-with-eventTest/app/router.js +25 -0
- package/examples/030-todo-app-with-eventTest/app/store.js +16 -0
- package/examples/030-todo-app-with-eventTest/app/views/home.js +11 -0
- package/examples/030-todo-app-with-eventTest/app/views/todoDemo.js +88 -0
- package/examples/030-todo-app-with-eventTest/index.html +65 -0
- package/examples/030-todo-app-with-eventTest/runtime/core/behaviors.runtime.js +282 -0
- package/examples/030-todo-app-with-eventTest/runtime/core/eventState.js +100 -0
- package/examples/030-todo-app-with-eventTest/runtime/core/helpers.js +212 -0
- package/examples/030-todo-app-with-eventTest/runtime/core/router.js +271 -0
- package/examples/030-todo-app-with-eventTest/store.d.ts +18 -0
- package/examples/030-todo-app-with-eventTest/style.css +170 -0
- package/examples/030-todo-app-with-eventTest/tests/README.md +208 -0
- package/examples/030-todo-app-with-eventTest/tests/eventTest.js +176 -0
- package/examples/030-todo-app-with-eventTest/tests/generateTypes.js +189 -0
- package/examples/030-todo-app-with-eventTest/tests/run.js +20 -0
- package/examples/030-todo-app-with-eventTest/tests/todos.test.js +167 -0
- package/examples/031-todo-app-with-eventTest/LICENSE +55 -0
- package/examples/031-todo-app-with-eventTest/README.md +54 -0
- package/examples/031-todo-app-with-eventTest/TUTORIAL.md +390 -0
- package/examples/031-todo-app-with-eventTest/WHY_EVENTSTATE.md +777 -0
- package/examples/031-todo-app-with-eventTest/app/bridges.js +113 -0
- package/examples/031-todo-app-with-eventTest/app/router.js +26 -0
- package/examples/031-todo-app-with-eventTest/app/store.js +15 -0
- package/examples/031-todo-app-with-eventTest/app/views/home.js +46 -0
- package/examples/031-todo-app-with-eventTest/app/views/todoDemo.js +69 -0
- package/examples/031-todo-app-with-eventTest/devtools/dock.js +41 -0
- package/examples/031-todo-app-with-eventTest/devtools/stateTracker.dock.js +10 -0
- package/examples/031-todo-app-with-eventTest/devtools/stateTracker.js +246 -0
- package/examples/031-todo-app-with-eventTest/devtools/telemetry.js +104 -0
- package/examples/031-todo-app-with-eventTest/devtools/typeGenerator.js +339 -0
- package/examples/031-todo-app-with-eventTest/index.html +103 -0
- package/examples/031-todo-app-with-eventTest/package-lock.json +2184 -0
- package/examples/031-todo-app-with-eventTest/package.json +24 -0
- package/examples/031-todo-app-with-eventTest/runtime/core/behaviors.runtime.js +282 -0
- package/examples/031-todo-app-with-eventTest/runtime/core/eventState.js +100 -0
- package/examples/031-todo-app-with-eventTest/runtime/core/helpers.js +212 -0
- package/examples/031-todo-app-with-eventTest/runtime/core/router.js +271 -0
- package/examples/031-todo-app-with-eventTest/runtime/extensions/boundary.js +36 -0
- package/examples/031-todo-app-with-eventTest/runtime/extensions/converge.js +63 -0
- package/examples/031-todo-app-with-eventTest/runtime/extensions/eventState.plus.js +210 -0
- package/examples/031-todo-app-with-eventTest/runtime/extensions/hydrate.js +157 -0
- package/examples/031-todo-app-with-eventTest/runtime/extensions/queryBinding.js +69 -0
- package/examples/031-todo-app-with-eventTest/runtime/forms/computed.js +78 -0
- package/examples/031-todo-app-with-eventTest/runtime/forms/meta.js +51 -0
- package/examples/031-todo-app-with-eventTest/runtime/forms/submitWithBoundary.js +28 -0
- package/examples/031-todo-app-with-eventTest/runtime/forms/validators.js +55 -0
- package/examples/031-todo-app-with-eventTest/store.d.ts +23 -0
- package/examples/031-todo-app-with-eventTest/style.css +170 -0
- package/examples/031-todo-app-with-eventTest/tests/README.md +208 -0
- package/examples/031-todo-app-with-eventTest/tests/eventTest.js +176 -0
- package/examples/031-todo-app-with-eventTest/tests/generateTypes.js +191 -0
- package/examples/031-todo-app-with-eventTest/tests/run.js +20 -0
- package/examples/031-todo-app-with-eventTest/tests/todos.test.js +192 -0
- package/examples/032-todo-app-with-eventTest/LICENSE +55 -0
- package/examples/032-todo-app-with-eventTest/README.md +54 -0
- package/examples/032-todo-app-with-eventTest/TUTORIAL.md +390 -0
- package/examples/032-todo-app-with-eventTest/WHY_EVENTSTATE.md +777 -0
- package/examples/032-todo-app-with-eventTest/app/actions/index.js +153 -0
- package/examples/032-todo-app-with-eventTest/app/bridges.js +113 -0
- package/examples/032-todo-app-with-eventTest/app/router.js +26 -0
- package/examples/032-todo-app-with-eventTest/app/store.js +15 -0
- package/examples/032-todo-app-with-eventTest/app/views/home.js +46 -0
- package/examples/032-todo-app-with-eventTest/app/views/todoDemo.js +69 -0
- package/examples/032-todo-app-with-eventTest/devtools/dock.js +41 -0
- package/examples/032-todo-app-with-eventTest/devtools/stateTracker.dock.js +10 -0
- package/examples/032-todo-app-with-eventTest/devtools/stateTracker.js +246 -0
- package/examples/032-todo-app-with-eventTest/devtools/telemetry.js +104 -0
- package/examples/032-todo-app-with-eventTest/devtools/typeGenerator.js +339 -0
- package/examples/032-todo-app-with-eventTest/index.html +87 -0
- package/examples/032-todo-app-with-eventTest/package-lock.json +2184 -0
- package/examples/032-todo-app-with-eventTest/package.json +24 -0
- package/examples/032-todo-app-with-eventTest/runtime/core/behaviors.runtime.js +282 -0
- package/examples/032-todo-app-with-eventTest/runtime/core/eventState.js +100 -0
- package/examples/032-todo-app-with-eventTest/runtime/core/helpers.js +212 -0
- package/examples/032-todo-app-with-eventTest/runtime/core/router.js +271 -0
- package/examples/032-todo-app-with-eventTest/runtime/extensions/boundary.js +36 -0
- package/examples/032-todo-app-with-eventTest/runtime/extensions/converge.js +63 -0
- package/examples/032-todo-app-with-eventTest/runtime/extensions/eventState.plus.js +210 -0
- package/examples/032-todo-app-with-eventTest/runtime/extensions/hydrate.js +157 -0
- package/examples/032-todo-app-with-eventTest/runtime/extensions/queryBinding.js +69 -0
- package/examples/032-todo-app-with-eventTest/runtime/forms/computed.js +78 -0
- package/examples/032-todo-app-with-eventTest/runtime/forms/meta.js +51 -0
- package/examples/032-todo-app-with-eventTest/runtime/forms/submitWithBoundary.js +28 -0
- package/examples/032-todo-app-with-eventTest/runtime/forms/validators.js +55 -0
- package/examples/032-todo-app-with-eventTest/store.d.ts +23 -0
- package/examples/032-todo-app-with-eventTest/style.css +170 -0
- package/examples/032-todo-app-with-eventTest/tests/README.md +208 -0
- package/examples/032-todo-app-with-eventTest/tests/eventTest.js +176 -0
- package/examples/032-todo-app-with-eventTest/tests/generateTypes.js +191 -0
- package/examples/032-todo-app-with-eventTest/tests/run.js +20 -0
- package/examples/032-todo-app-with-eventTest/tests/todos.test.js +192 -0
- package/index.js +14 -3
- package/package.json +16 -7
- package/stateSerializer.js +99 -4
- package/templateManager.js +50 -2
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* todos.test.js - Event-sequence tests for todo functionality
|
|
3
|
+
*
|
|
4
|
+
* These tests define the behavior AND types of the todo domain
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { createEventTest, test, runTests } from './eventTest.js';
|
|
8
|
+
|
|
9
|
+
// Helper to set up todo bridges on a test store
|
|
10
|
+
function setupTodoBridges(store) {
|
|
11
|
+
let nextId = 1;
|
|
12
|
+
|
|
13
|
+
// Add todo
|
|
14
|
+
store.subscribe('intent.todo.add', (detail) => {
|
|
15
|
+
const { text } = detail;
|
|
16
|
+
const items = store.get('domain.todos.items') || [];
|
|
17
|
+
const todo = { id: nextId++, text: String(text || '').trim(), done: false };
|
|
18
|
+
if (!todo.text) return;
|
|
19
|
+
store.set('domain.todos.items', [...items, todo]);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Toggle todo
|
|
23
|
+
store.subscribe('intent.todo.toggle', (detail) => {
|
|
24
|
+
const { id } = detail;
|
|
25
|
+
const items = store.get('domain.todos.items') || [];
|
|
26
|
+
const out = items.map(t => (String(t?.id) === String(id)) ? { ...t, done: !t.done } : t);
|
|
27
|
+
store.set('domain.todos.items', out);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Clear completed
|
|
31
|
+
store.subscribe('intent.todo.clearCompleted', () => {
|
|
32
|
+
const items = store.get('domain.todos.items') || [];
|
|
33
|
+
store.set('domain.todos.items', items.filter(t => !t.done));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// UI filter
|
|
37
|
+
store.subscribe('intent.ui.filter', (detail) => {
|
|
38
|
+
const { filter } = detail;
|
|
39
|
+
const f = (filter === 'active' || filter === 'completed') ? filter : 'all';
|
|
40
|
+
store.set('ui.todos.filter', f);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Test suite
|
|
45
|
+
const tests = {
|
|
46
|
+
'add todo creates correct structure': () => {
|
|
47
|
+
const t = createEventTest({
|
|
48
|
+
domain: { todos: { items: [] } }
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Set up bridges for this test
|
|
52
|
+
setupTodoBridges(t.store);
|
|
53
|
+
|
|
54
|
+
// Trigger intent
|
|
55
|
+
t.trigger('intent.todo.add', { text: 'Buy milk' });
|
|
56
|
+
|
|
57
|
+
// Assert array structure and element types
|
|
58
|
+
t.assertArrayOf('domain.todos.items', {
|
|
59
|
+
id: 'number',
|
|
60
|
+
text: 'string',
|
|
61
|
+
done: 'boolean'
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Assert array length
|
|
65
|
+
t.assertArrayLength('domain.todos.items', 1);
|
|
66
|
+
|
|
67
|
+
// Assert specific values
|
|
68
|
+
const items = t.store.get('domain.todos.items');
|
|
69
|
+
if (items[0].text !== 'Buy milk') {
|
|
70
|
+
throw new Error('Expected first todo text to be "Buy milk"');
|
|
71
|
+
}
|
|
72
|
+
if (items[0].done !== false) {
|
|
73
|
+
throw new Error('Expected first todo to not be done');
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
'toggle todo changes done state': () => {
|
|
78
|
+
const t = createEventTest({
|
|
79
|
+
domain: { todos: { items: [{ id: 1, text: 'Buy milk', done: false }] } }
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Set up bridges for this test
|
|
83
|
+
setupTodoBridges(t.store);
|
|
84
|
+
|
|
85
|
+
// Trigger toggle
|
|
86
|
+
t.trigger('intent.todo.toggle', { id: 1 });
|
|
87
|
+
|
|
88
|
+
// Assert structure
|
|
89
|
+
t.assertArrayOf('domain.todos.items', {
|
|
90
|
+
id: 'number',
|
|
91
|
+
text: 'string',
|
|
92
|
+
done: 'boolean'
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Assert done is now true
|
|
96
|
+
const items = t.store.get('domain.todos.items');
|
|
97
|
+
if (items[0].done !== true) {
|
|
98
|
+
throw new Error('Expected todo to be done');
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
'clear completed removes done todos': () => {
|
|
103
|
+
const t = createEventTest({
|
|
104
|
+
domain: {
|
|
105
|
+
todos: {
|
|
106
|
+
items: [
|
|
107
|
+
{ id: 1, text: 'Buy milk', done: true },
|
|
108
|
+
{ id: 2, text: 'Walk dog', done: false }
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Set up bridges for this test
|
|
115
|
+
setupTodoBridges(t.store);
|
|
116
|
+
|
|
117
|
+
// Trigger clear
|
|
118
|
+
t.trigger('intent.todo.clearCompleted');
|
|
119
|
+
|
|
120
|
+
// Assert only active todo remains
|
|
121
|
+
t.assertArrayLength('domain.todos.items', 1);
|
|
122
|
+
|
|
123
|
+
const items = t.store.get('domain.todos.items');
|
|
124
|
+
if (items[0].text !== 'Walk dog') {
|
|
125
|
+
throw new Error('Expected only "Walk dog" to remain');
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
'filter intent updates filter state': () => {
|
|
130
|
+
const t = createEventTest({
|
|
131
|
+
ui: { todos: { filter: 'all' } }
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Set up bridges for this test
|
|
135
|
+
setupTodoBridges(t.store);
|
|
136
|
+
|
|
137
|
+
// Trigger filter change
|
|
138
|
+
t.trigger('intent.ui.filter', { filter: 'active' });
|
|
139
|
+
|
|
140
|
+
// Assert type
|
|
141
|
+
t.assertType('ui.todos.filter', 'string');
|
|
142
|
+
|
|
143
|
+
// Assert value
|
|
144
|
+
t.assertPath('ui.todos.filter', 'active');
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
'intent.todo.add has correct shape': () => {
|
|
148
|
+
const t = createEventTest({});
|
|
149
|
+
|
|
150
|
+
// Trigger intent
|
|
151
|
+
t.trigger('intent.todo.add', { text: 'Buy milk' });
|
|
152
|
+
|
|
153
|
+
// Assert intent shape (for type generation)
|
|
154
|
+
t.assertShape('intent.todo.add', {
|
|
155
|
+
text: 'string'
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
'intent.todo.toggle has correct shape': () => {
|
|
160
|
+
const t = createEventTest({});
|
|
161
|
+
|
|
162
|
+
// Trigger intent
|
|
163
|
+
t.trigger('intent.todo.toggle', { id: 1 });
|
|
164
|
+
|
|
165
|
+
// Assert intent shape
|
|
166
|
+
t.assertShape('intent.todo.toggle', {
|
|
167
|
+
id: 'number'
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
'empty todos array is valid': () => {
|
|
172
|
+
const t = createEventTest({
|
|
173
|
+
domain: { todos: { items: [] } }
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Assert empty array is still typed correctly
|
|
177
|
+
t.assertArrayOf('domain.todos.items', {
|
|
178
|
+
id: 'number',
|
|
179
|
+
text: 'string',
|
|
180
|
+
done: 'boolean'
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
t.assertArrayLength('domain.todos.items', 0);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// Run tests if executed directly
|
|
188
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
189
|
+
runTests(tests);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export default tests;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
30
|
+
|
|
31
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
32
|
+
|
|
33
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
34
|
+
|
|
35
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
36
|
+
|
|
37
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
38
|
+
|
|
39
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
40
|
+
|
|
41
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
42
|
+
|
|
43
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# 010-006 Core Primitives (Public API)
|
|
2
|
+
|
|
3
|
+
This folder demonstrates a path‑first, browser‑native architecture. The public primitives are exposed via `core/index.js`.
|
|
4
|
+
|
|
5
|
+
## Public API
|
|
6
|
+
|
|
7
|
+
- `hydrateMerge(store, root, payload, opts)`
|
|
8
|
+
- Deep merge payload into `store` under `root`.
|
|
9
|
+
- Arrays: `opts.arrayStrategy` = `replace` (default) or `keyedMerge` with `opts.keyField` (default: `id`).
|
|
10
|
+
- Guards: `opts.version` + `opts.getVersion()`, `opts.whitelistPaths`, optional `opts.onConflict(path, prev, next)`.
|
|
11
|
+
- `hydrateReplace(store, payload, opts)`
|
|
12
|
+
- Replace top-level subtrees in `store`. Optional `opts.whitelistPaths` and `opts.batch`.
|
|
13
|
+
- `renderNode(desc, document)` / `replaceRoot(rootEl, desc)`
|
|
14
|
+
- Safe JSON→DOM rendering with allowlists (structure‑only). Use `replaceRoot` to swap rendered content.
|
|
15
|
+
- `bindPaths(store, rootEl, bindings)`
|
|
16
|
+
- Path→DOM projection. `bindings[path] = { selector, prop='textContent' | attr }`.
|
|
17
|
+
- Subscribes to `path` and sets `el[prop]` or `el.setAttribute(attr, value)`.
|
|
18
|
+
- `bindArray(store, rootEl, arrayBindings, { renderNode })`
|
|
19
|
+
- Array projection. `arrayBindings[path] = { container, renderItem(item) -> nodeDesc }`.
|
|
20
|
+
- Renders items into `container` (defaults to `replaceChildren` strategy). Pass `renderNode` from renderer.
|
|
21
|
+
- `installBehaviors(store, options)`
|
|
22
|
+
- Minimal `data-on`/`data-bind`/`data-repeat` runtime for demos and tests.
|
|
23
|
+
|
|
24
|
+
Import surface:
|
|
25
|
+
```js
|
|
26
|
+
import { hydrateMerge, hydrateReplace, renderNode, replaceRoot, bindPaths, bindArray, installBehaviors } from './core/index.js'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Safe Renderer Contract (jsonTemplate.render.js)
|
|
30
|
+
|
|
31
|
+
- Allowed tags: `div, section, article, header, footer, main, aside, nav, span, p, h1..h6, ul, ol, li, button, input, label, strong, em, small, code, pre`
|
|
32
|
+
- Allowed attributes:
|
|
33
|
+
- Global: `id, class, role`
|
|
34
|
+
- ARIA: `aria-*`
|
|
35
|
+
- Input-only: `type, value, placeholder, name, disabled`
|
|
36
|
+
- Disallowed: any event attributes (`onclick`, etc.), unknown tags/attrs.
|
|
37
|
+
|
|
38
|
+
## Template Bindings (externalized)
|
|
39
|
+
|
|
40
|
+
- `bindings/template-a.js`, `bindings/template-b.js`
|
|
41
|
+
- `views/jsonTemplateDemo.js` dynamically imports the binding map by template key.
|
|
42
|
+
- Array bindings are kept in the demo view for clarity: `ui.items → #items`, `demo.items → #demoItems`.
|
|
43
|
+
|
|
44
|
+
## Tests
|
|
45
|
+
|
|
46
|
+
- `vitest/jsonTemplate.render.spec.ts`: allowlist behavior; `replaceRoot` swap.
|
|
47
|
+
- `vitest/jsonTemplate.bind.spec.ts`: path binder behavior (initial + updates).
|
|
48
|
+
- Additional repeater/behaviors tests live under `vitest/`.
|
|
49
|
+
|
|
50
|
+
## Notes
|
|
51
|
+
|
|
52
|
+
- This is structure‑only rendering. Content (data) should arrive via `hydrateMerge/Replace` and be projected via `bindPaths/bindArray`.
|
|
53
|
+
- For large lists, you can add a keyed policy in `bindArray` or hydrate with `arrayStrategy: 'keyedMerge'` to minimize DOM churn.
|
|
54
|
+
- SPDX headers: core files include `Apache-2.0` identifiers. LICENSE is Apache‑2.0 for this folder.
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
# EventState Tutorial
|
|
2
|
+
|
|
3
|
+
Learn how to build reactive web applications with EventState's fine-grained state management.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Core Concepts](#core-concepts)
|
|
8
|
+
2. [Getting Started](#getting-started)
|
|
9
|
+
3. [Architecture Patterns](#architecture-patterns)
|
|
10
|
+
4. [Advanced Features](#advanced-features)
|
|
11
|
+
5. [Comparison with Other Frameworks](#comparison)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Core Concepts
|
|
16
|
+
|
|
17
|
+
### 1. Fine-Grained Reactivity
|
|
18
|
+
|
|
19
|
+
EventState uses **path-based subscriptions** for surgical DOM updates:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
// Subscribe to specific paths
|
|
23
|
+
store.subscribe('domain.todos.items', render); // Only updates when todos change
|
|
24
|
+
store.subscribe('ui.theme', updateTheme); // Only updates when theme changes
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Key differences from other frameworks:**
|
|
28
|
+
- ❌ No virtual DOM diffing
|
|
29
|
+
- ❌ No component-level re-renders
|
|
30
|
+
- ✅ Direct path → handler mapping
|
|
31
|
+
- ✅ Update only what changed
|
|
32
|
+
|
|
33
|
+
### 2. Intent-Based Architecture
|
|
34
|
+
|
|
35
|
+
EventState separates **what happened** (intent) from **what to do** (bridge):
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
UI Event → intent.* → Bridge → domain.* → View Update
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Benefits:**
|
|
42
|
+
- ✅ Unidirectional data flow (like Redux)
|
|
43
|
+
- ✅ No boilerplate (unlike Redux)
|
|
44
|
+
- ✅ Testable business logic (bridges are pure functions)
|
|
45
|
+
- ✅ Decoupled UI from domain logic
|
|
46
|
+
|
|
47
|
+
### 3. Progressive API
|
|
48
|
+
|
|
49
|
+
Start simple, add complexity only when needed:
|
|
50
|
+
|
|
51
|
+
**Declarative** (for simple interactions):
|
|
52
|
+
```html
|
|
53
|
+
<button data-on="click: addTodo()">Add</button>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Imperative** (for complex views):
|
|
57
|
+
```javascript
|
|
58
|
+
store.subscribe('domain.todos.items', (items) => {
|
|
59
|
+
// Custom rendering logic
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Getting Started
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Quick Start
|
|
69
|
+
|
|
70
|
+
**1. Create a store:**
|
|
71
|
+
```javascript
|
|
72
|
+
import { createEventState } from './runtime/core/eventState.js';
|
|
73
|
+
|
|
74
|
+
const store = createEventState({
|
|
75
|
+
ui: { count: 0 },
|
|
76
|
+
domain: { todos: [] }
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**2. Subscribe to changes:**
|
|
81
|
+
```javascript
|
|
82
|
+
store.subscribe('ui.count', (count) => {
|
|
83
|
+
document.getElementById('count').textContent = count;
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**3. Update state:**
|
|
88
|
+
```javascript
|
|
89
|
+
button.onclick = () => {
|
|
90
|
+
store.set('ui.count', store.get('ui.count') + 1);
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
That's it! No build step, no framework, just reactive data.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Architecture Patterns
|
|
99
|
+
|
|
100
|
+
### The Intent-Bridge-Domain Pattern
|
|
101
|
+
|
|
102
|
+
**Step 1: UI fires an intent**
|
|
103
|
+
```javascript
|
|
104
|
+
// User clicks "Add Todo"
|
|
105
|
+
store.set('intent.todo.add', { text: 'Buy milk' });
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Step 2: Bridge handles the intent**
|
|
109
|
+
```javascript
|
|
110
|
+
// app/bridges.js
|
|
111
|
+
store.subscribe('intent.todo.add', ({ text }) => {
|
|
112
|
+
const items = store.get('domain.todos.items') || [];
|
|
113
|
+
store.set('domain.todos.items', [...items, { id: Date.now(), text }]);
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Step 3: View reacts to domain change**
|
|
118
|
+
```javascript
|
|
119
|
+
// app/views/todoDemo.js
|
|
120
|
+
store.subscribe('domain.todos.items', (items) => {
|
|
121
|
+
renderTodoList(items);
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Why this pattern?**
|
|
126
|
+
- ✅ Testable (test bridges in isolation)
|
|
127
|
+
- ✅ Auditable (log all intents)
|
|
128
|
+
- ✅ Flexible (change behavior without touching UI)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Advanced Features
|
|
133
|
+
|
|
134
|
+
### 1. Wildcard Subscriptions
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
// Listen to all state changes
|
|
138
|
+
store.subscribe('**', (value, path) => {
|
|
139
|
+
console.log(`[state] ${path}`, value);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// Listen to all intents
|
|
143
|
+
store.subscribe('intent.**', (value, path) => {
|
|
144
|
+
console.log(`[intent] ${path}`, value);
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 2. Batch Updates
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
import { upgradeEventState } from './runtime/extensions/eventState.plus.js';
|
|
152
|
+
|
|
153
|
+
const storePlus = upgradeEventState(store);
|
|
154
|
+
|
|
155
|
+
storePlus.setMany({
|
|
156
|
+
'ui.loading': false,
|
|
157
|
+
'domain.user': userData,
|
|
158
|
+
'ui.error': null
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 3. Router Integration
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
import { createRouter } from './runtime/core/router.js';
|
|
166
|
+
|
|
167
|
+
const router = createRouter({
|
|
168
|
+
routes: [
|
|
169
|
+
{ path: '/', view: 'home', component: Home },
|
|
170
|
+
{ path: '/todos', view: 'todos', component: TodoList }
|
|
171
|
+
],
|
|
172
|
+
store,
|
|
173
|
+
rootSelector: '[data-route-root]'
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
router.start();
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### 4. Built-in Telemetry
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
// All state changes are automatically logged in dev mode
|
|
183
|
+
// Click "Console" button in dev dock to copy logs
|
|
184
|
+
|
|
185
|
+
// Or access programmatically:
|
|
186
|
+
window.__telemetry.get(); // Get all logs
|
|
187
|
+
window.__telemetry.copy(); // Copy to clipboard
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Comparison
|
|
193
|
+
|
|
194
|
+
### Why Choose EventState?
|
|
195
|
+
|
|
196
|
+
#### 1. No Common React Bugs
|
|
197
|
+
|
|
198
|
+
**Stale Closures**
|
|
199
|
+
```javascript
|
|
200
|
+
// React problem:
|
|
201
|
+
const [count, setCount] = useState(0);
|
|
202
|
+
setTimeout(() => console.log(count), 1000); // Stale!
|
|
203
|
+
|
|
204
|
+
// EventState framework:
|
|
205
|
+
store.subscribe('ui.count', (val) => console.log(val)); // Always fresh
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Dependency Arrays**
|
|
209
|
+
```javascript
|
|
210
|
+
// React:
|
|
211
|
+
useEffect(() => { /* ... */ }, [dep1, dep2, dep3]); // Miss one? Bug!
|
|
212
|
+
|
|
213
|
+
// EventState framework:
|
|
214
|
+
store.subscribe('path.to.dep', handler); // Explicit, no guessing
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Prop Drilling**
|
|
218
|
+
```javascript
|
|
219
|
+
// React: <A> → <B> → <C> → <D> (pass props 4 levels)
|
|
220
|
+
// EventState framework: Any component reads store.get('shared.data')
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Re-render Debugging**
|
|
224
|
+
```javascript
|
|
225
|
+
// EventState: Only subscribed handlers run
|
|
226
|
+
store.subscribe('ui.count', updateCount); // Only this runs when count changes
|
|
227
|
+
|
|
228
|
+
// React: Entire component tree may re-render
|
|
229
|
+
// Need React DevTools to debug why
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### 2. Performance by Default
|
|
233
|
+
|
|
234
|
+
**Other frameworks require optimization:**
|
|
235
|
+
```javascript
|
|
236
|
+
// React: Manual memoization
|
|
237
|
+
const MemoizedComponent = memo(Component);
|
|
238
|
+
const memoizedValue = useMemo(() => compute(a, b), [a, b]);
|
|
239
|
+
const memoizedCallback = useCallback(() => {}, [deps]);
|
|
240
|
+
|
|
241
|
+
// Angular: Change detection strategy
|
|
242
|
+
@Component({ changeDetection: ChangeDetectionStrategy.OnPush })
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**EventState: Fast by default**
|
|
246
|
+
```javascript
|
|
247
|
+
// Direct DOM updates, no virtual DOM
|
|
248
|
+
// Only subscribed handlers run
|
|
249
|
+
// No manual optimization needed
|
|
250
|
+
store.subscribe('ui.count', (val) => el.textContent = val);
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### 3. Less Boilerplate
|
|
254
|
+
|
|
255
|
+
**Redux:**
|
|
256
|
+
```javascript
|
|
257
|
+
// actions.js
|
|
258
|
+
export const ADD_TODO = 'ADD_TODO';
|
|
259
|
+
export const addTodo = (text) => ({ type: ADD_TODO, text });
|
|
260
|
+
|
|
261
|
+
// reducers.js
|
|
262
|
+
export default function todos(state = [], action) {
|
|
263
|
+
switch (action.type) {
|
|
264
|
+
case ADD_TODO:
|
|
265
|
+
return [...state, { id: Date.now(), text: action.text }];
|
|
266
|
+
default:
|
|
267
|
+
return state;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// component.js
|
|
272
|
+
const mapStateToProps = (state) => ({ todos: state.todos });
|
|
273
|
+
const mapDispatchToProps = { addTodo };
|
|
274
|
+
export default connect(mapStateToProps, mapDispatchToProps)(TodoList);
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**EventState:**
|
|
278
|
+
```javascript
|
|
279
|
+
// bridges.js
|
|
280
|
+
store.subscribe('intent.todo.add', ({ text }) => {
|
|
281
|
+
const items = store.get('domain.todos.items') || [];
|
|
282
|
+
store.set('domain.todos.items', [...items, { id: Date.now(), text }]);
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**3 files vs 1 function.**
|
|
287
|
+
|
|
288
|
+
#### 4. Built-in Observability
|
|
289
|
+
|
|
290
|
+
```javascript
|
|
291
|
+
// See every state change (one line)
|
|
292
|
+
store.subscribe('**', (val, path) => console.log('[state]', path, val));
|
|
293
|
+
|
|
294
|
+
// Time-travel debugging
|
|
295
|
+
const history = [];
|
|
296
|
+
store.subscribe('**', (val, path) => history.push({ path, val }));
|
|
297
|
+
history.forEach(({ path, val }) => store.set(path, val)); // Replay
|
|
298
|
+
|
|
299
|
+
// State snapshot
|
|
300
|
+
const snapshot = store.get(''); // Entire state tree
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**No browser extensions needed** - everything is built-in.
|
|
304
|
+
|
|
305
|
+
#### 5. Framework-Agnostic
|
|
306
|
+
|
|
307
|
+
```javascript
|
|
308
|
+
// Works in vanilla JS
|
|
309
|
+
store.set('count', 1);
|
|
310
|
+
|
|
311
|
+
// Works with React
|
|
312
|
+
function Counter() {
|
|
313
|
+
const [count, setCount] = useState(store.get('count'));
|
|
314
|
+
useEffect(() => store.subscribe('count', setCount), []);
|
|
315
|
+
return <div>{count}</div>;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Works with Web Components
|
|
319
|
+
class MyCounter extends HTMLElement {
|
|
320
|
+
connectedCallback() {
|
|
321
|
+
this.unsub = store.subscribe('count', (val) => {
|
|
322
|
+
this.textContent = val;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Works with any build tool (or none)
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Feature Comparison
|
|
333
|
+
|
|
334
|
+
| Feature | React | Redux | Vue | Solid | EventState |
|
|
335
|
+
|---------|-------|-------|-----|-------|------------|
|
|
336
|
+
| Fine-grained updates | ❌ | ❌ | ⚠️ | ✅ | ✅ |
|
|
337
|
+
| No boilerplate | ⚠️ | ❌ | ⚠️ | ✅ | ✅ |
|
|
338
|
+
| Framework-agnostic | ❌ | ⚠️ | ❌ | ⚠️ | ✅ |
|
|
339
|
+
| Built-in time-travel | ❌ | ✅ | ❌ | ❌ | ✅ |
|
|
340
|
+
| Wildcard subscriptions | ❌ | ❌ | ❌ | ❌ | ✅ |
|
|
341
|
+
| Bundle size | 45KB | 3KB | 34KB | 7KB | <1KB |
|
|
342
|
+
| Learning curve | High | Very High | Medium | Medium | Low |
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## What's Next
|
|
347
|
+
|
|
348
|
+
### Current Status
|
|
349
|
+
|
|
350
|
+
**What EventState has today:**
|
|
351
|
+
- ✅ Solid reactivity primitive (~200 lines)
|
|
352
|
+
- ✅ Clean architecture (intent → bridge → domain)
|
|
353
|
+
- ✅ Low complexity (no build step required)
|
|
354
|
+
- ✅ Good performance (fine-grained updates)
|
|
355
|
+
- ✅ Generic router (`runtime/core/router.js`)
|
|
356
|
+
- ✅ Form utilities (`runtime/forms/`)
|
|
357
|
+
- ✅ Dev tools (telemetry, state tracker)
|
|
358
|
+
|
|
359
|
+
### Roadmap
|
|
360
|
+
|
|
361
|
+
**In Development:**
|
|
362
|
+
- TypeScript definitions
|
|
363
|
+
- Component abstraction layer
|
|
364
|
+
- Comprehensive test suite
|
|
365
|
+
- npm package (`@uistate/core`)
|
|
366
|
+
|
|
367
|
+
**Planned:**
|
|
368
|
+
- Separate packages (`@uistate/router`, `@uistate/forms`)
|
|
369
|
+
- VS Code extension (path autocomplete)
|
|
370
|
+
- Documentation site
|
|
371
|
+
- SSR adapter
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Learn More
|
|
376
|
+
|
|
377
|
+
- **[WHY_EVENTSTATE.md](./WHY_EVENTSTATE.md)** - Philosophy and comparisons
|
|
378
|
+
- **[runtime/core/eventState.js](./runtime/core/eventState.js)** - Source code (~200 lines)
|
|
379
|
+
- **[app/bridges.js](./app/bridges.js)** - Real-world patterns
|
|
380
|
+
- **[runtime/core/router.js](./runtime/core/router.js)** - Generic SPA router
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Contributing
|
|
385
|
+
|
|
386
|
+
EventState is in active development. Feedback, issues, and contributions are welcome!
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
*EventState: Fine-grained reactivity without the complexity.*
|