@memnest/ui-core 0.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 +21 -0
- package/README.md +44 -0
- package/dist/chunk-JCMPD6YF.js +1076 -0
- package/dist/chunk-JCMPD6YF.js.map +1 -0
- package/dist/index.cjs +2398 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +513 -0
- package/dist/index.d.ts +513 -0
- package/dist/index.js +1277 -0
- package/dist/index.js.map +1 -0
- package/dist/layout-worker-CLScIQSu.d.cts +142 -0
- package/dist/layout-worker-CLScIQSu.d.ts +142 -0
- package/dist/layout-worker.cjs +1051 -0
- package/dist/layout-worker.cjs.map +1 -0
- package/dist/layout-worker.d.cts +1 -0
- package/dist/layout-worker.d.ts +1 -0
- package/dist/layout-worker.js +10 -0
- package/dist/layout-worker.js.map +1 -0
- package/package.json +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Memnest contributors
|
|
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,44 @@
|
|
|
1
|
+
# @memnest/ui-core
|
|
2
|
+
|
|
3
|
+
Framework-free UI logic for Memnest: the controllers behind the dashboard's views, graph layout, topic clustering, viewport math, hit-testing and canvas drawing. No React, no Vue, no DOM: every controller is `getState()` plus `subscribe(listener)`, so a framework wrapper is a few lines (`@memnest/ui-react` is one).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { createMemnestClient } from '@memnest/client';
|
|
7
|
+
import { createWorkspace } from '@memnest/ui-core';
|
|
8
|
+
|
|
9
|
+
const workspace = createWorkspace({ client: createMemnestClient({ baseUrl: '' }), containerTag: 'user:123' });
|
|
10
|
+
|
|
11
|
+
workspace.trace.setQuery('what database does this user use?');
|
|
12
|
+
workspace.trace.setTokenBudget(200);
|
|
13
|
+
await workspace.trace.run();
|
|
14
|
+
workspace.trace.getState().rows; // every candidate, why it was included or excluded, and the budget line
|
|
15
|
+
|
|
16
|
+
workspace.select(memoryId); // detail and lineage load; the graph highlights it
|
|
17
|
+
workspace.detail.requestForget();
|
|
18
|
+
await workspace.detail.confirmForget(); // trace, finder, timeline and graph refresh
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`client` is any `MemnestApi`, including the embedded engine, so the same controllers run in tests with no server.
|
|
22
|
+
|
|
23
|
+
| Controller | What it holds |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `graph` | The global graph: filter, clusters above 2,000 matching memories, force layout, viewport, selection, lineage overlay, hover |
|
|
26
|
+
| `lineage` | One memory's lineage as a layered (Sugiyama-style) DAG |
|
|
27
|
+
| `trace` | A search's candidates joined with their text, cumulative tokens and the budget line |
|
|
28
|
+
| `timeline` | A topic's facts over time: version chains as lanes, each switch dated |
|
|
29
|
+
| `detail` | A memory, its version history, relations and sources; two-step forget |
|
|
30
|
+
| `finder` | Search or browse memories |
|
|
31
|
+
|
|
32
|
+
**Layout.** `computeLayout(nodes, edges, { algorithm: 'force' | 'layered' })` is deterministic for a seed. For large graphs, run it in a worker:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// layout.worker.ts
|
|
36
|
+
import { serveLayoutRequests } from '@memnest/ui-core';
|
|
37
|
+
serveLayoutRequests(self);
|
|
38
|
+
|
|
39
|
+
// app
|
|
40
|
+
const layout = createWorkerLayoutRunner(new Worker(new URL('./layout.worker.ts', import.meta.url), { type: 'module' }));
|
|
41
|
+
createWorkspace({ client, containerTag, layout }); // graphs of 500+ nodes lay out off the main thread
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Drawing.** `buildGraphScene(state, theme)` turns graph state into circles and lines, and `drawScene(ctx, scene, viewport, size, theme)` paints them on any 2D canvas context. Labels are culled and capped per frame.
|