@elaraai/e3-ui 1.0.12 → 1.0.14
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/dist/src/{data.d.ts → bind/data.d.ts} +7 -0
- package/dist/src/bind/data.d.ts.map +1 -0
- package/dist/src/{data.js → bind/data.js} +7 -0
- package/dist/src/bind/data.js.map +1 -0
- package/dist/src/bind/func.d.ts.map +1 -0
- package/dist/src/bind/func.js.map +1 -0
- package/dist/src/bind/record.d.ts +275 -0
- package/dist/src/bind/record.d.ts.map +1 -0
- package/dist/src/bind/record.js +239 -0
- package/dist/src/bind/record.js.map +1 -0
- package/dist/src/decision/bind.d.ts +1 -1
- package/dist/src/decision/bind.d.ts.map +1 -1
- package/dist/src/decision/bind.js +1 -1
- package/dist/src/decision/bind.js.map +1 -1
- package/dist/src/{diff.d.ts → diff/index.d.ts} +3 -3
- package/dist/src/diff/index.d.ts.map +1 -0
- package/dist/src/{diff.js → diff/index.js} +3 -3
- package/dist/src/diff/index.js.map +1 -0
- package/dist/src/experiment/index.d.ts +379 -325
- package/dist/src/experiment/index.d.ts.map +1 -1
- package/dist/src/experiment/index.js +59 -60
- package/dist/src/experiment/index.js.map +1 -1
- package/dist/src/experiment/types.d.ts +439 -475
- package/dist/src/experiment/types.d.ts.map +1 -1
- package/dist/src/experiment/types.js +218 -256
- package/dist/src/experiment/types.js.map +1 -1
- package/dist/src/index.d.ts +7 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -10
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +7 -6
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +7 -6
- package/dist/src/internal.js.map +1 -1
- package/dist/src/{ontology.d.ts → ontology/index.d.ts} +3 -3
- package/dist/src/ontology/index.d.ts.map +1 -0
- package/dist/src/{ontology.js → ontology/index.js} +3 -3
- package/dist/src/ontology/index.js.map +1 -0
- package/dist/src/runtime/diff.d.ts +1 -1
- package/dist/src/runtime/diff.d.ts.map +1 -1
- package/dist/src/runtime/diff.js +1 -1
- package/dist/src/runtime/diff.js.map +1 -1
- package/dist/src/runtime/ontology.d.ts +1 -1
- package/dist/src/runtime/ontology.d.ts.map +1 -1
- package/dist/src/runtime/ontology.js +1 -1
- package/dist/src/runtime/ontology.js.map +1 -1
- package/dist/src/ui.js +3 -3
- package/dist/src/ui.js.map +1 -1
- package/dist/src/utils/derive.d.ts +29 -0
- package/dist/src/utils/derive.d.ts.map +1 -0
- package/dist/src/utils/derive.js +57 -0
- package/dist/src/utils/derive.js.map +1 -0
- package/dist/src/{manifest.d.ts → utils/manifest.d.ts} +9 -14
- package/dist/src/utils/manifest.d.ts.map +1 -0
- package/dist/src/utils/manifest.js +37 -0
- package/dist/src/utils/manifest.js.map +1 -0
- package/dist/test/bind/data/data.examples.d.ts.map +1 -0
- package/dist/test/bind/data/data.examples.js.map +1 -0
- package/dist/test/bind/func/func.examples.d.ts.map +1 -0
- package/dist/test/bind/func/func.examples.js.map +1 -0
- package/dist/test/bind/record/record.examples.d.ts +13 -0
- package/dist/test/bind/record/record.examples.d.ts.map +1 -0
- package/dist/test/bind/record/record.examples.js +73 -0
- package/dist/test/bind/record/record.examples.js.map +1 -0
- package/dist/test/experiment/experiment.examples.d.ts +285 -385
- package/dist/test/experiment/experiment.examples.d.ts.map +1 -1
- package/dist/test/experiment/experiment.examples.js +148 -79
- package/dist/test/experiment/experiment.examples.js.map +1 -1
- package/package.json +7 -7
- package/dist/src/data.d.ts.map +0 -1
- package/dist/src/data.js.map +0 -1
- package/dist/src/derive.d.ts +0 -34
- package/dist/src/derive.d.ts.map +0 -1
- package/dist/src/derive.js +0 -86
- package/dist/src/derive.js.map +0 -1
- package/dist/src/diff.d.ts.map +0 -1
- package/dist/src/diff.js.map +0 -1
- package/dist/src/func.d.ts.map +0 -1
- package/dist/src/func.js.map +0 -1
- package/dist/src/manifest.d.ts.map +0 -1
- package/dist/src/manifest.js +0 -53
- package/dist/src/manifest.js.map +0 -1
- package/dist/src/ontology.d.ts.map +0 -1
- package/dist/src/ontology.js.map +0 -1
- package/dist/test/data/data.examples.d.ts.map +0 -1
- package/dist/test/data/data.examples.js.map +0 -1
- package/dist/test/func/func.examples.d.ts.map +0 -1
- package/dist/test/func/func.examples.js.map +0 -1
- /package/dist/src/{func.d.ts → bind/func.d.ts} +0 -0
- /package/dist/src/{func.js → bind/func.js} +0 -0
- /package/dist/test/{data → bind/data}/data.examples.d.ts +0 -0
- /package/dist/test/{data → bind/data}/data.examples.js +0 -0
- /package/dist/test/{func → bind/func}/func.examples.d.ts +0 -0
- /package/dist/test/{func → bind/func}/func.examples.js +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@elaraai/e3-ui/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
4
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
5
|
+
*/
|
|
6
|
+
/** @jsxImportSource @elaraai/e3-ui */
|
|
7
|
+
import { East, IntegerType, NullType, example } from "@elaraai/east";
|
|
8
|
+
import { Button, HStack, Reactive, Stat, Text, UIComponentType, VStack } from "@elaraai/east-ui";
|
|
9
|
+
import { Record } from "@elaraai/e3-ui";
|
|
10
|
+
import e3 from "@elaraai/e3";
|
|
11
|
+
// The package-side record + mutation definitions. `Record.bind` takes the
|
|
12
|
+
// record def + its mutations — the state type, mutation names and arg types
|
|
13
|
+
// all come from them, so the binding can never drift from the deployed record.
|
|
14
|
+
export const counter = e3.record("counter", IntegerType, 0n);
|
|
15
|
+
export const increment = e3.mutation("increment", counter, East.function([IntegerType, IntegerType], IntegerType, ($, state, by) => state.add(by)));
|
|
16
|
+
export const reset = e3.mutation("reset", counter, East.function([IntegerType], IntegerType, (_$, _state) => 0n));
|
|
17
|
+
export const recordBindMutate = example({
|
|
18
|
+
keywords: ["Record", "bind", "mutate", "Reactive", "Button", "read", "pending", "status", "system of record"],
|
|
19
|
+
description: "Bind an e3.record + its mutations; buttons apply typed mutations, a stat shows the current state, and the mutate lifecycle status is rendered",
|
|
20
|
+
fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
|
|
21
|
+
const r = $.let(Record.bind(counter, [increment, reset]));
|
|
22
|
+
const status = $.let(r.mutate.status().getTag().upperCase());
|
|
23
|
+
// Surface the failure detail so a failed mutation shows WHY, not just
|
|
24
|
+
// that it failed.
|
|
25
|
+
const detail = $.let(r.mutate.error().match({
|
|
26
|
+
some: (_$, e) => e.message,
|
|
27
|
+
none: _$ => East.str ``,
|
|
28
|
+
}));
|
|
29
|
+
const bump = $.const(East.function([], NullType, $ => {
|
|
30
|
+
$(r.mutate.increment(1n));
|
|
31
|
+
}));
|
|
32
|
+
const clear = $.const(East.function([], NullType, $ => {
|
|
33
|
+
$(r.mutate.reset());
|
|
34
|
+
}));
|
|
35
|
+
// A mutation commits the record but does not propagate; `start`
|
|
36
|
+
// launches the workspace dataflow so tasks consuming the record
|
|
37
|
+
// recompute. Queued behind any in-flight mutation.
|
|
38
|
+
const run = $.const(East.function([], NullType, $ => {
|
|
39
|
+
$(r.start());
|
|
40
|
+
}));
|
|
41
|
+
return (_jsxs(VStack, { gap: "3", align: "stretch", children: [_jsx(Stat, { label: "Counter", value: East.print(r.read()) }), _jsxs(HStack, { gap: "2", children: [_jsx(Button, { onClick: bump, loading: r.mutate.pending(), children: "Increment" }), _jsx(Button, { variant: "outline", onClick: clear, children: "Reset" }), _jsx(Button, { variant: "ghost", onClick: run, children: "Run downstream" })] }), _jsx(Text.MonoLabel, { children: status }), _jsx(Text, { color: "fg.muted", children: detail })] }));
|
|
42
|
+
} }))),
|
|
43
|
+
inputs: [],
|
|
44
|
+
});
|
|
45
|
+
export const recordBindStatus = example({
|
|
46
|
+
keywords: ["Record", "bind", "status", "error", "lifecycle", "mutate"],
|
|
47
|
+
description: "Render the mutation lifecycle (idle / running / committed / failed / cancelled) and any failure",
|
|
48
|
+
fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
|
|
49
|
+
const r = $.let(Record.bind(counter, [increment]));
|
|
50
|
+
const bump = $.const(East.function([], NullType, $ => { $(r.mutate.increment(1n)); }));
|
|
51
|
+
const statusLine = $.let(r.mutate.status().getTag().upperCase());
|
|
52
|
+
const detail = $.let(r.mutate.error().match({
|
|
53
|
+
some: (_$, e) => e.message,
|
|
54
|
+
none: _$ => East.print(r.read()),
|
|
55
|
+
}));
|
|
56
|
+
return (_jsxs(VStack, { gap: "3", align: "stretch", children: [_jsx(Button, { onClick: bump, loading: r.mutate.pending(), children: "Increment" }), _jsx(Text.MonoLabel, { children: statusLine }), _jsx(Text, { color: "fg.muted", children: detail })] }));
|
|
57
|
+
} }))),
|
|
58
|
+
inputs: [],
|
|
59
|
+
});
|
|
60
|
+
export const recordBindHistory = example({
|
|
61
|
+
keywords: ["Record", "bind", "history", "audit", "commit", "chain"],
|
|
62
|
+
description: "Read the record's commit history (the audit trail) alongside its current value",
|
|
63
|
+
fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
|
|
64
|
+
const r = $.let(Record.bind(counter, [increment]));
|
|
65
|
+
const count = $.let(r.history().match({
|
|
66
|
+
some: (_$, commits) => commits.size(),
|
|
67
|
+
none: _$ => 0n,
|
|
68
|
+
}));
|
|
69
|
+
return (_jsxs(VStack, { gap: "3", align: "stretch", children: [_jsx(Stat, { label: "Counter", value: East.print(r.read()) }), _jsx(Text.MonoLabel, { children: East.str `${count} COMMITS` })] }));
|
|
70
|
+
} }))),
|
|
71
|
+
inputs: [],
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=record.examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.examples.js","sourceRoot":"","sources":["../../../../test/bind/record/record.examples.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AACH,sCAAsC;AACtC,OAAO,EAAE,IAAI,EAAE,W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