gesso-framework 0.1.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/CHANGELOG.md +34 -0
- package/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/FunctionComponent-DAyf5HQ6.d.ts +716 -0
- package/dist/createComponent-3n1ZSql8.js +254 -0
- package/dist/createComponent-3n1ZSql8.js.map +1 -0
- package/dist/index-BkYPVXSJ.d.ts +7272 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +8720 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx/jsx-dev-runtime.d.ts +2 -0
- package/dist/jsx/jsx-dev-runtime.js +2 -0
- package/dist/jsx/jsx-runtime.d.ts +117 -0
- package/dist/jsx/jsx-runtime.js +153 -0
- package/dist/jsx/jsx-runtime.js.map +1 -0
- package/dist/persisted-Ddb51avc.js +2648 -0
- package/dist/persisted-Ddb51avc.js.map +1 -0
- package/dist/worker/index.d.ts +32 -0
- package/dist/worker/index.js +2 -0
- package/package.json +71 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# gesso-framework
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
First public release.
|
|
6
|
+
|
|
7
|
+
Components, cells, the frame runtime, channels, routing and the worker
|
|
8
|
+
barrier.
|
|
9
|
+
|
|
10
|
+
A component body runs once and an `Observable` binds straight into the
|
|
11
|
+
retained graph, so there is no re-render pass, no virtual DOM diff and no
|
|
12
|
+
`useEffect`. An application is three files across three threads joined by one
|
|
13
|
+
contract module: `channel()` names the shapes, `serveChannels` serves them
|
|
14
|
+
from the application worker, `renderRoot` draws on the render worker, and
|
|
15
|
+
`createApp` on the main thread spawns both and then holds neither end.
|
|
16
|
+
|
|
17
|
+
`createApp(App).mountSync('#app')` runs the same contract in a single thread,
|
|
18
|
+
for tests, headless rendering and environments without `OffscreenCanvas`.
|
|
19
|
+
|
|
20
|
+
**The accessibility mirror.** The shell writes the semantics tree into an
|
|
21
|
+
off-screen DOM over the canvas, so a screen reader, an OS accessibility API or
|
|
22
|
+
an automated testing tool sees real elements where before it saw one empty
|
|
23
|
+
canvas. On by default in both configurations; `accessibility: false` opts out.
|
|
24
|
+
Presses, focus moves and value sets come back as ordinary input.
|
|
25
|
+
|
|
26
|
+
**Failures reach the shell.** `renderRoot` listens for `error` and
|
|
27
|
+
`unhandledrejection` on the worker global, so a component that throws during a
|
|
28
|
+
frame is reported rather than lost; `UiInputDispatcher.onListenerError` reports
|
|
29
|
+
the exceptions it has to swallow, so an `onClick` that throws is no longer
|
|
30
|
+
logged only to a worker console. The protocol's `error` carries a `source` of
|
|
31
|
+
`message`, `uncaught`, `renderer`, `channel` or `listener`.
|
|
32
|
+
|
|
33
|
+
Entry points: the root, `/worker`, `/jsx-runtime`, `/jsx-dev-runtime` and
|
|
34
|
+
`/testing`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kevin Baker
|
|
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
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# gesso-framework
|
|
2
|
+
|
|
3
|
+
Components, cells, the frame runtime, channels, routing and the worker barrier, over [`gesso-core`](https://github.com/kevinpbaker/gesso/tree/main/packages/core).
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install gesso-core gesso-framework rxjs
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## An application is three files
|
|
10
|
+
|
|
11
|
+
One shared module holds names and shapes and no implementation:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// notes.contract.ts
|
|
15
|
+
import { channel } from 'gesso-framework';
|
|
16
|
+
|
|
17
|
+
export const Notes = channel<NotesView, NotesCommands>('notes', { rows: [], open: null });
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Your application, on its own worker. Below `serveChannels` there is no framework import in the dependency graph, so every layer beneath it is testable with bare Vitest, in node, with no browser:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// notes.app.worker.ts
|
|
24
|
+
import { serveChannels } from 'gesso-framework';
|
|
25
|
+
|
|
26
|
+
serveChannels([
|
|
27
|
+
{
|
|
28
|
+
token: Notes,
|
|
29
|
+
source: {
|
|
30
|
+
view: { rows: view.rows, open: view.open },
|
|
31
|
+
commands: { open: id => domain.select(id), create: () => domain.create() }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Everything the person sees, on the render worker:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// notes.render.worker.ts
|
|
41
|
+
import { renderRoot } from 'gesso-framework';
|
|
42
|
+
|
|
43
|
+
function NotesApp(inputs, ctx) {
|
|
44
|
+
const notes = ctx.channel(Notes);
|
|
45
|
+
return (
|
|
46
|
+
<column gap={12} padding={24}>
|
|
47
|
+
<button onClick={() => notes.send.create()} padding={8}>
|
|
48
|
+
<text text="New note" />
|
|
49
|
+
</button>
|
|
50
|
+
</column>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
renderRoot(NotesApp).useChannel(Notes);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
And the main thread's entire job:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
// main.ts
|
|
61
|
+
createApp({
|
|
62
|
+
renderWorker: () => new Worker(new URL('./notes.render.worker.ts', import.meta.url), { type: 'module' }),
|
|
63
|
+
appLogicWorker: () => new Worker(new URL('./notes.app.worker.ts', import.meta.url), { type: 'module' })
|
|
64
|
+
}).mount('#app');
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The shell spawns both workers, joins them with one `MessageChannel`, hands each an end, and then holds neither. It cannot be in a patch's way even by accident.
|
|
68
|
+
|
|
69
|
+
## What is not there
|
|
70
|
+
|
|
71
|
+
A component body runs **once**, and an `Observable` binds straight into the retained graph. So there is no re-render pass, no virtual DOM diff, no `useEffect`, and no base class to extend for your state. Component identity _is_ node identity, so there is no second reconciler.
|
|
72
|
+
|
|
73
|
+
Single-thread mode exists for tests, headless rendering and environments without `OffscreenCanvas`: `createApp(NotesApp).useChannel(Notes, { source }).mountSync('#app')`. Channels resolve in-process there, so the same contract runs with no ports.
|
|
74
|
+
|
|
75
|
+
## Entry points
|
|
76
|
+
|
|
77
|
+
- `gesso-framework` -- components, cells, the runtime, routing, channels
|
|
78
|
+
- `gesso-framework/worker` -- what a render or application worker imports
|
|
79
|
+
- `gesso-framework/jsx-runtime`, `/jsx-dev-runtime` -- set `jsxImportSource` to `gesso-framework`
|
|
80
|
+
- `gesso-framework/testing` -- the doubles its own suite uses
|
|
81
|
+
|
|
82
|
+
## Documentation
|
|
83
|
+
|
|
84
|
+
[Your first component](https://github.com/kevinpbaker/gesso/blob/main/apps/docs/guide/counter.md) | [Components run once](https://github.com/kevinpbaker/gesso/blob/main/apps/docs/guide/components-run-once.md) | [Cells and bindings](https://github.com/kevinpbaker/gesso/blob/main/apps/docs/guide/cells-and-bindings.md) | [Channels and the barrier](https://github.com/kevinpbaker/gesso/blob/main/apps/docs/structure/channels-and-the-barrier.md) | [Routing](https://github.com/kevinpbaker/gesso/blob/main/apps/docs/structure/routing.md)
|
|
85
|
+
|
|
86
|
+
MIT (c) Kevin Baker
|