@elaraai/e3-ui 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.
- package/CLA.md +26 -0
- package/CONTRIBUTING.md +28 -0
- package/LICENSE.md +31 -0
- package/README.md +149 -0
- package/dist/src/buttons.d.ts +2 -0
- package/dist/src/buttons.d.ts.map +1 -0
- package/dist/src/buttons.js +2 -0
- package/dist/src/buttons.js.map +1 -0
- package/dist/src/data.d.ts +241 -0
- package/dist/src/data.d.ts.map +1 -0
- package/dist/src/data.js +195 -0
- package/dist/src/data.js.map +1 -0
- package/dist/src/derive.d.ts +33 -0
- package/dist/src/derive.d.ts.map +1 -0
- package/dist/src/derive.js +64 -0
- package/dist/src/derive.js.map +1 -0
- package/dist/src/diff.d.ts +335 -0
- package/dist/src/diff.d.ts.map +1 -0
- package/dist/src/diff.js +197 -0
- package/dist/src/diff.js.map +1 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +25 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/manifest.d.ts +27 -0
- package/dist/src/manifest.d.ts.map +1 -0
- package/dist/src/manifest.js +29 -0
- package/dist/src/manifest.js.map +1 -0
- package/dist/src/ontology.d.ts +517 -0
- package/dist/src/ontology.d.ts.map +1 -0
- package/dist/src/ontology.js +311 -0
- package/dist/src/ontology.js.map +1 -0
- package/dist/src/ui.d.ts +57 -0
- package/dist/src/ui.d.ts.map +1 -0
- package/dist/src/ui.js +72 -0
- package/dist/src/ui.js.map +1 -0
- package/dist/src/utils.d.ts +21 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +24 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/test/data.examples.d.ts +20 -0
- package/dist/test/data.examples.d.ts.map +1 -0
- package/dist/test/data.examples.js +156 -0
- package/dist/test/data.examples.js.map +1 -0
- package/dist/test/diff.examples.d.ts +138 -0
- package/dist/test/diff.examples.d.ts.map +1 -0
- package/dist/test/diff.examples.js +964 -0
- package/dist/test/diff.examples.js.map +1 -0
- package/dist/test/ontology.examples.d.ts +412 -0
- package/dist/test/ontology.examples.d.ts.map +1 -0
- package/dist/test/ontology.examples.js +298 -0
- package/dist/test/ontology.examples.js.map +1 -0
- package/package.json +80 -0
package/CLA.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Contributor License Agreement
|
|
2
|
+
|
|
3
|
+
This Contributor License Agreement ("Agreement") is entered into between Elara AI Pty Ltd ("Company") and you (the "Contributor").
|
|
4
|
+
|
|
5
|
+
## Grant of Copyright License
|
|
6
|
+
|
|
7
|
+
You hereby grant to the Company and to recipients of software distributed by the Company a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, distribute, and use Your Contributions and such derivative works.
|
|
8
|
+
|
|
9
|
+
## Grant of Patent License
|
|
10
|
+
|
|
11
|
+
You hereby grant to the Company and to recipients of software distributed by the Company a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer Your Contributions.
|
|
12
|
+
|
|
13
|
+
## Relicensing Rights
|
|
14
|
+
|
|
15
|
+
You grant the Company the right to license Your Contributions under any license terms, including but not limited to commercial licenses, in addition to the open source license under which the project is distributed.
|
|
16
|
+
|
|
17
|
+
## Your Representations
|
|
18
|
+
|
|
19
|
+
You represent that:
|
|
20
|
+
- You are legally entitled to grant the above licenses
|
|
21
|
+
- Each of Your Contributions is Your original creation
|
|
22
|
+
- Your Contribution submissions include complete details of any third-party license or other restriction of which you are aware
|
|
23
|
+
|
|
24
|
+
## Agreement
|
|
25
|
+
|
|
26
|
+
By signing this Agreement through CLA Assistant or by submitting a Contribution, you accept and agree to the terms of this Agreement.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Contributing to e3-ui
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! We welcome contributions from the community.
|
|
4
|
+
|
|
5
|
+
## Contributor License Agreement (CLA)
|
|
6
|
+
|
|
7
|
+
Before we can accept your contribution, you must sign our Contributor License Agreement (CLA). This agreement gives Elara AI Pty Ltd the right to use and relicense your contributions, including under commercial licenses, while you retain ownership of your contribution.
|
|
8
|
+
|
|
9
|
+
**Why do we require a CLA?**
|
|
10
|
+
This project is dual-licensed under AGPL-3.0 and commercial licenses. The CLA allows us to offer commercial licenses to users who wish to use this software in proprietary applications.
|
|
11
|
+
|
|
12
|
+
### Signing the CLA
|
|
13
|
+
|
|
14
|
+
When you submit your first pull request, the CLA Assistant bot will automatically comment on your PR with a link to sign the CLA electronically. It only takes a minute, and you'll only need to sign it once.
|
|
15
|
+
|
|
16
|
+
## Contributing Process
|
|
17
|
+
|
|
18
|
+
1. Fork the [east-workspace monorepo](https://github.com/elaraai/east-workspace)
|
|
19
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
20
|
+
3. Make your changes
|
|
21
|
+
4. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
22
|
+
5. Push to the branch (`git push origin feature/amazing-feature`)
|
|
23
|
+
6. Open a Pull Request
|
|
24
|
+
7. Sign the CLA when the bot prompts you
|
|
25
|
+
|
|
26
|
+
## Questions?
|
|
27
|
+
|
|
28
|
+
Contact us at support@elara.ai
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Copyright (c) 2025 Elara AI Pty Ltd
|
|
2
|
+
|
|
3
|
+
# Dual License — AGPL-3.0 / Commercial
|
|
4
|
+
|
|
5
|
+
This software is available under two licenses. You may choose which license applies to your use:
|
|
6
|
+
|
|
7
|
+
## Option 1: AGPL-3.0 (Open Source)
|
|
8
|
+
|
|
9
|
+
You may use, modify, and distribute this software under the terms of the GNU Affero General Public License v3.0.
|
|
10
|
+
|
|
11
|
+
This requires that if you use this software in a network service, you must make your complete source code available under AGPL-3.0.
|
|
12
|
+
|
|
13
|
+
Full text: https://www.gnu.org/licenses/agpl-3.0.html
|
|
14
|
+
|
|
15
|
+
## Option 2: Commercial License
|
|
16
|
+
|
|
17
|
+
If you wish to use this software without the source code disclosure requirements of AGPL-3.0, you must obtain a commercial license from Elara AI Pty Ltd.
|
|
18
|
+
|
|
19
|
+
Contact: support@elara.ai
|
|
20
|
+
|
|
21
|
+
## Contributions
|
|
22
|
+
|
|
23
|
+
Contributions are welcome. By submitting a pull request, you agree to license your contribution under both AGPL-3.0 and our commercial license terms.
|
|
24
|
+
|
|
25
|
+
## Governing Law
|
|
26
|
+
|
|
27
|
+
This license is governed by the laws of New South Wales, Australia.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
*Elara AI Pty Ltd*
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# East UI
|
|
2
|
+
|
|
3
|
+
> UI component library for the East language
|
|
4
|
+
|
|
5
|
+
[](LICENSE.md)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
|
|
8
|
+
**East UI** provides typed UI component definitions for the [East language](https://github.com/elaraai/east-workspace/tree/main/libs/east). Components return data structures describing UI layouts rather than rendering directly, enabling portability across different rendering environments.
|
|
9
|
+
|
|
10
|
+
## Packages
|
|
11
|
+
|
|
12
|
+
| Package | Description | npm |
|
|
13
|
+
|---------|-------------|-----|
|
|
14
|
+
| [@elaraai/east-ui](packages/east-ui) | Core UI component definitions | [](https://www.npmjs.com/package/@elaraai/east-ui) |
|
|
15
|
+
| [@elaraai/east-ui-components](packages/east-ui-components) | React rendering with Chakra UI | [](https://www.npmjs.com/package/@elaraai/east-ui-components) |
|
|
16
|
+
| [east-ui-preview](packages/east-ui-extension) | VSCode extension for live preview | [Marketplace](https://marketplace.visualstudio.com/items?itemName=ElaraAI.east-ui-preview) |
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **Layout** - Box, Stack, Grid, Splitter, Separator
|
|
21
|
+
- **Typography** - Text, Code, Heading, Link, Highlight, Mark, List, CodeBlock
|
|
22
|
+
- **Buttons** - Button, IconButton with variants
|
|
23
|
+
- **Forms** - Input, Select, Checkbox, Switch, Slider, Textarea, TagsInput, FileUpload
|
|
24
|
+
- **Collections** - Table, DataList, TreeView
|
|
25
|
+
- **Charts** - Area, Bar, Line, Pie, Radar, Scatter, Sparkline, BarList, BarSegment
|
|
26
|
+
- **Display** - Badge, Tag, Avatar, Stat, Icon
|
|
27
|
+
- **Feedback** - Alert, Progress
|
|
28
|
+
- **Disclosure** - Accordion, Tabs, Carousel
|
|
29
|
+
- **Overlays** - Dialog, Drawer, Popover, Tooltip, Menu, HoverCard, ToggleTip, ActionBar
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @elaraai/east-ui @elaraai/east
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { East } from "@elaraai/east";
|
|
39
|
+
import { Stack, Text, Button, UIComponentType } from "@elaraai/east-ui";
|
|
40
|
+
|
|
41
|
+
const MyComponent = East.function([], UIComponentType, () => {
|
|
42
|
+
return Stack.Root([
|
|
43
|
+
Text.Root("Hello, World!", { fontSize: "xl", fontWeight: "bold" }),
|
|
44
|
+
Button.Root("Click Me", { variant: "solid", colorPalette: "blue" }),
|
|
45
|
+
], { gap: "4" });
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Development
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Install dependencies
|
|
53
|
+
npm install
|
|
54
|
+
|
|
55
|
+
# Build all packages
|
|
56
|
+
npm run build
|
|
57
|
+
|
|
58
|
+
# Run tests
|
|
59
|
+
npm test
|
|
60
|
+
|
|
61
|
+
# Run linter
|
|
62
|
+
npm run lint
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Claude Code plugin
|
|
66
|
+
|
|
67
|
+
The East ecosystem also ships a [Claude Code](https://claude.com/claude-code) plugin — East language skills, example search, and preemptive diagnostics for East code — installed separately from the `elaraai` marketplace:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
# Inside Claude Code
|
|
71
|
+
/plugin marketplace add elaraai/east-workspace
|
|
72
|
+
/plugin install east@elaraai
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# From a terminal
|
|
77
|
+
claude plugin marketplace add elaraai/east-workspace
|
|
78
|
+
claude plugin install east@elaraai
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
Dual-licensed:
|
|
84
|
+
- **Open Source**: [AGPL-3.0](LICENSE.md) - Free for open source use
|
|
85
|
+
- **Commercial**: Available for proprietary use - contact support@elara.ai
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
<!-- Ecosystem — keep in sync with docs/snippets/ECOSYSTEM.md -->
|
|
89
|
+
|
|
90
|
+
### Ecosystem
|
|
91
|
+
|
|
92
|
+
- **[East](https://github.com/elaraai/east-workspace/tree/main/libs/east)**: Statically typed, expression-based language with serializable IR. Run portable logic across TypeScript, Python, C, and other runtimes.
|
|
93
|
+
- [@elaraai/east](https://www.npmjs.com/package/@elaraai/east): Core language SDK with type system, expressions, and reference JS compiler
|
|
94
|
+
|
|
95
|
+
- **[East Node](https://github.com/elaraai/east-workspace/tree/main/libs/east-node)**: Node.js platform functions for I/O, databases, and system operations.
|
|
96
|
+
- [@elaraai/east-node-std](https://www.npmjs.com/package/@elaraai/east-node-std): Console, FileSystem, Fetch, Crypto, Time, Path, Random
|
|
97
|
+
- [@elaraai/east-node-io](https://www.npmjs.com/package/@elaraai/east-node-io): SQLite, PostgreSQL, MySQL, MongoDB, Redis, S3, FTP, SFTP, XLSX, XML, compression
|
|
98
|
+
- [@elaraai/east-node-cli](https://www.npmjs.com/package/@elaraai/east-node-cli): CLI for running East IR programs in Node.js
|
|
99
|
+
|
|
100
|
+
- **[East C](https://github.com/elaraai/east-workspace/tree/main/libs/east-c)**: C11 native runtime for executing East IR. Tarballed for `linux-x64` and `linux-arm64`, attached to each GitHub Release.
|
|
101
|
+
- `east-c`: Core runtime — type system, IR interpreter, 200+ builtins, serialization (Beast2, JSON, CSV, East text)
|
|
102
|
+
- `east-c-std`: Console, FileSystem, Fetch, Crypto, Time, Path, Random
|
|
103
|
+
- `east-c-cli`: CLI for running East IR programs natively
|
|
104
|
+
|
|
105
|
+
- **[East Python](https://github.com/elaraai/east-workspace/tree/main/libs/east-py)**: Python runtime, standard platform, I/O, and data-science platform functions. Published to PyPI.
|
|
106
|
+
- [east-py](https://pypi.org/project/east-py/): Core Python runtime — type system, IR compiler, 212+ builtins, Cython-accelerated hot paths
|
|
107
|
+
- [east-py-std](https://pypi.org/project/east-py-std/): Console, FileSystem, Fetch, Crypto, Time, Path, Random
|
|
108
|
+
- [east-py-io](https://pypi.org/project/east-py-io/): SQLite, PostgreSQL, MySQL, MongoDB, Redis, S3, FTP, SFTP, XLSX, XML, compression
|
|
109
|
+
- [east-py-cli](https://pypi.org/project/east-py-cli/): CLI for running East IR programs in Python
|
|
110
|
+
- [east-py-datascience](https://pypi.org/project/east-py-datascience/) (PyPI) + [@elaraai/east-py-datascience](https://www.npmjs.com/package/@elaraai/east-py-datascience) (npm): Optimization (MADS, Optuna, ALNS, GoogleOR), ML (XGBoost, LightGBM, NGBoost, PyTorch, Lightning, GP), Bayesian inference (PyMC), explainability (SHAP), conformal prediction (MAPIE)
|
|
111
|
+
|
|
112
|
+
- **[East UI](https://github.com/elaraai/east-workspace/tree/main/libs/east-ui)**: Typed UI component definitions and React renderer, plus VS Code preview.
|
|
113
|
+
- [@elaraai/east-ui](https://www.npmjs.com/package/@elaraai/east-ui): 50+ typed UI components for layouts, forms, charts, tables, dialogs
|
|
114
|
+
- [@elaraai/east-ui-components](https://www.npmjs.com/package/@elaraai/east-ui-components): React renderer with Chakra UI v3 styling
|
|
115
|
+
- [@elaraai/e3-ui](https://www.npmjs.com/package/@elaraai/e3-ui): e3 + UI bridge — Data bindings, `e3.ui()` task, manifest
|
|
116
|
+
- [@elaraai/e3-ui-components](https://www.npmjs.com/package/@elaraai/e3-ui-components): React Query hooks and preview components for the e3 API
|
|
117
|
+
- [east-ui-preview](https://marketplace.visualstudio.com/items?itemName=ElaraAI.east-ui-preview): VS Code extension for live East UI component preview
|
|
118
|
+
|
|
119
|
+
- **[e3 — East Execution Engine](https://github.com/elaraai/east-workspace/tree/main/libs/e3)**: Durable execution engine for running East pipelines at scale. Git-like content-addressable storage, automatic memoization, reactive dataflow, real-time monitoring.
|
|
120
|
+
- [@elaraai/e3](https://www.npmjs.com/package/@elaraai/e3): SDK for authoring e3 packages with typed tasks and pipelines
|
|
121
|
+
- [@elaraai/e3-core](https://www.npmjs.com/package/@elaraai/e3-core): Object store, dataflow orchestrator, execution state
|
|
122
|
+
- [@elaraai/e3-types](https://www.npmjs.com/package/@elaraai/e3-types): Shared type definitions for e3 packages
|
|
123
|
+
- [@elaraai/e3-cli](https://www.npmjs.com/package/@elaraai/e3-cli): `e3 repo`, `e3 package`, `e3 workspace`, `e3 start`, `e3 watch`, `e3 logs` commands
|
|
124
|
+
- [@elaraai/e3-api-client](https://www.npmjs.com/package/@elaraai/e3-api-client): HTTP client for remote e3 repositories
|
|
125
|
+
- [@elaraai/e3-api-server](https://www.npmjs.com/package/@elaraai/e3-api-server): REST API server for e3 repositories
|
|
126
|
+
- [@elaraai/e3-api-tests](https://www.npmjs.com/package/@elaraai/e3-api-tests): Shared API compliance test suites
|
|
127
|
+
|
|
128
|
+
## Links
|
|
129
|
+
|
|
130
|
+
- **Live Showcase**: [https://elaraai.github.io/east-ui/](https://elaraai.github.io/east-ui/)
|
|
131
|
+
- **Website**: [https://elaraai.com/](https://elaraai.com/)
|
|
132
|
+
- **East Repository**: [https://github.com/elaraai/east-workspace/tree/main/libs/east](https://github.com/elaraai/east-workspace/tree/main/libs/east)
|
|
133
|
+
- **Issues**: [https://github.com/elaraai/east-workspace/issues](https://github.com/elaraai/east-workspace/issues)
|
|
134
|
+
- **Email**: support@elara.ai
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
<!-- About Elara — keep in sync with docs/snippets/ABOUT_ELARA.md -->
|
|
138
|
+
|
|
139
|
+
## About Elara
|
|
140
|
+
|
|
141
|
+
East is developed by [Elara AI Pty Ltd](https://elaraai.com/), an AI-powered platform that creates economic digital twins of businesses that optimize performance. Elara combines business objectives, decisions and data to help organizations make data-driven decisions across operations, purchasing, sales and customer engagement, and project and investment planning. East powers the computational layer of Elara solutions, enabling the expression of complex business logic and data in a simple, type-safe and portable language.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
*Developed by [Elara AI Pty Ltd](https://elaraai.com/).*
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
*Developed by [Elara AI Pty Ltd](https://elaraai.com/) - Powering the computational layer of AI-driven business optimization.*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buttons.d.ts","sourceRoot":"","sources":["../../src/buttons.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buttons.js","sourceRoot":"","sources":["../../src/buttons.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Reactive dataset binding for e3 UI tasks.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import { NullType, BooleanType, FunctionType, StructType, VariantType, OptionType, type EastType, type ExprType } from '@elaraai/east';
|
|
11
|
+
import { type TreePath } from '@elaraai/e3-types';
|
|
12
|
+
/**
|
|
13
|
+
* The two operating modes for {@link Data.bind}.
|
|
14
|
+
*
|
|
15
|
+
* @property staged - Edits are buffered locally (in-memory + IndexedDB) and
|
|
16
|
+
* only flushed on `commit()`. Use for editor flows where the user reviews
|
|
17
|
+
* pending changes before publishing.
|
|
18
|
+
* @property direct - Every `write()` immediately mutates the destination
|
|
19
|
+
* (the source dataset, or the patch dataset when `patch` is set). Use for
|
|
20
|
+
* live shared cursors and other no-staging surfaces.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DataBindModeType: VariantType<{
|
|
23
|
+
readonly staged: NullType;
|
|
24
|
+
readonly direct: NullType;
|
|
25
|
+
}>;
|
|
26
|
+
/** Type alias for {@link DataBindModeType}. */
|
|
27
|
+
export type DataBindModeType = typeof DataBindModeType;
|
|
28
|
+
/** String literal form of {@link DataBindModeType}. */
|
|
29
|
+
export type DataBindModeLiteral = "staged" | "direct";
|
|
30
|
+
/**
|
|
31
|
+
* Descriptor for a single binding the {@link Diff.Root} component displays.
|
|
32
|
+
*
|
|
33
|
+
* Every {@link Data.bind} call exposes this descriptor as its `binding`
|
|
34
|
+
* field, so callers can wire a Diff card via `Diff.Root({ bindings:
|
|
35
|
+
* [view.binding, ...] })` without re-spelling the source / patch paths.
|
|
36
|
+
*
|
|
37
|
+
* @property source - The dataset path of the source value the binding
|
|
38
|
+
* reads from.
|
|
39
|
+
* @property patch - When the binding writes through a separate patch
|
|
40
|
+
* dataset, this is its path. `none` means the binding writes directly to
|
|
41
|
+
* the source on commit (or to the staging buffer in staged mode).
|
|
42
|
+
* @property mode - The binding's operating mode — see {@link DataBindModeType}.
|
|
43
|
+
*/
|
|
44
|
+
export declare const DiffBindingType: StructType<{
|
|
45
|
+
readonly source: import("@elaraai/east").ArrayType<VariantType<{
|
|
46
|
+
readonly field: import("@elaraai/east").StringType;
|
|
47
|
+
}>>;
|
|
48
|
+
readonly patch: OptionType<import("@elaraai/east").ArrayType<VariantType<{
|
|
49
|
+
readonly field: import("@elaraai/east").StringType;
|
|
50
|
+
}>>>;
|
|
51
|
+
readonly mode: VariantType<{
|
|
52
|
+
readonly staged: NullType;
|
|
53
|
+
readonly direct: NullType;
|
|
54
|
+
}>;
|
|
55
|
+
}>;
|
|
56
|
+
/** Type alias for {@link DiffBindingType}. */
|
|
57
|
+
export type DiffBindingType = typeof DiffBindingType;
|
|
58
|
+
/**
|
|
59
|
+
* The struct returned by every {@link Data.bind} call. Every field is
|
|
60
|
+
* present regardless of `mode` / `patch` — the per-mode semantics are
|
|
61
|
+
* captured in the property docs of {@link Data.bind}.
|
|
62
|
+
*
|
|
63
|
+
* @property read - Reactive accessor for the binding's view of the source.
|
|
64
|
+
* @property write - Update the binding (buffer in staged mode, dataset in
|
|
65
|
+
* direct mode). Always returns null.
|
|
66
|
+
* @property writeAndStart - Like `write`, but kicks the workspace dataflow
|
|
67
|
+
* so downstream tasks recompute. Only meaningful when `mode = "direct"`
|
|
68
|
+
* and `patch` is absent — in other modes it falls back to `write`.
|
|
69
|
+
* @property source - Read the raw source value with no overlay applied.
|
|
70
|
+
* @property pending - True when there is an in-flight change waiting to be
|
|
71
|
+
* committed. Always false in `mode = "direct"` without a `patch` dataset.
|
|
72
|
+
* @property commit - Resolve the in-flight change. The destination depends
|
|
73
|
+
* on `mode` / `patch` — see {@link Data.bind} for the full matrix.
|
|
74
|
+
* @property discard - Drop the in-flight change.
|
|
75
|
+
* @property has - True iff the source dataset has a value.
|
|
76
|
+
* @property status - Per-dataset freshness signal — see
|
|
77
|
+
* {@link DatasetStatusType}.
|
|
78
|
+
* @property binding - Descriptor for this binding — pass directly to
|
|
79
|
+
* {@link Diff.Root}'s `bindings` array.
|
|
80
|
+
*/
|
|
81
|
+
export declare const DataBindHandleType: <T extends EastType | string>(t: T) => StructType<{
|
|
82
|
+
readonly read: FunctionType<[], T>;
|
|
83
|
+
readonly write: FunctionType<[T], NullType>;
|
|
84
|
+
readonly writeAndStart: FunctionType<[T], NullType>;
|
|
85
|
+
readonly source: FunctionType<[], T>;
|
|
86
|
+
readonly pending: FunctionType<[], BooleanType>;
|
|
87
|
+
readonly commit: FunctionType<[], NullType>;
|
|
88
|
+
readonly discard: FunctionType<[], NullType>;
|
|
89
|
+
readonly has: FunctionType<[], BooleanType>;
|
|
90
|
+
readonly status: FunctionType<[], VariantType<{
|
|
91
|
+
readonly unset: NullType;
|
|
92
|
+
readonly stale: NullType;
|
|
93
|
+
readonly 'up-to-date': NullType;
|
|
94
|
+
}>>;
|
|
95
|
+
readonly binding: StructType<{
|
|
96
|
+
readonly source: import("@elaraai/east").ArrayType<VariantType<{
|
|
97
|
+
readonly field: import("@elaraai/east").StringType;
|
|
98
|
+
}>>;
|
|
99
|
+
readonly patch: OptionType<import("@elaraai/east").ArrayType<VariantType<{
|
|
100
|
+
readonly field: import("@elaraai/east").StringType;
|
|
101
|
+
}>>>;
|
|
102
|
+
readonly mode: VariantType<{
|
|
103
|
+
readonly staged: NullType;
|
|
104
|
+
readonly direct: NullType;
|
|
105
|
+
}>;
|
|
106
|
+
}>;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* The underlying `Data.bind` platform-function definition. End-users
|
|
110
|
+
* should call {@link Data.bind} (the typed factory in this module);
|
|
111
|
+
* runtime implementations register against this raw definition via
|
|
112
|
+
* `bindPlatformFn.implement(...)`.
|
|
113
|
+
*/
|
|
114
|
+
export declare const bindPlatformFn: import("@elaraai/east").GenericPlatformDefinition<readonly ["T"], readonly [import("@elaraai/east").ArrayType<VariantType<{
|
|
115
|
+
readonly field: import("@elaraai/east").StringType;
|
|
116
|
+
}>>, OptionType<import("@elaraai/east").ArrayType<VariantType<{
|
|
117
|
+
readonly field: import("@elaraai/east").StringType;
|
|
118
|
+
}>>>, VariantType<{
|
|
119
|
+
readonly staged: NullType;
|
|
120
|
+
readonly direct: NullType;
|
|
121
|
+
}>], StructType<{
|
|
122
|
+
readonly read: FunctionType<[], "T">;
|
|
123
|
+
readonly write: FunctionType<["T"], NullType>;
|
|
124
|
+
readonly writeAndStart: FunctionType<["T"], NullType>;
|
|
125
|
+
readonly source: FunctionType<[], "T">;
|
|
126
|
+
readonly pending: FunctionType<[], BooleanType>;
|
|
127
|
+
readonly commit: FunctionType<[], NullType>;
|
|
128
|
+
readonly discard: FunctionType<[], NullType>;
|
|
129
|
+
readonly has: FunctionType<[], BooleanType>;
|
|
130
|
+
readonly status: FunctionType<[], VariantType<{
|
|
131
|
+
readonly unset: NullType;
|
|
132
|
+
readonly stale: NullType;
|
|
133
|
+
readonly 'up-to-date': NullType;
|
|
134
|
+
}>>;
|
|
135
|
+
readonly binding: StructType<{
|
|
136
|
+
readonly source: import("@elaraai/east").ArrayType<VariantType<{
|
|
137
|
+
readonly field: import("@elaraai/east").StringType;
|
|
138
|
+
}>>;
|
|
139
|
+
readonly patch: OptionType<import("@elaraai/east").ArrayType<VariantType<{
|
|
140
|
+
readonly field: import("@elaraai/east").StringType;
|
|
141
|
+
}>>>;
|
|
142
|
+
readonly mode: VariantType<{
|
|
143
|
+
readonly staged: NullType;
|
|
144
|
+
readonly direct: NullType;
|
|
145
|
+
}>;
|
|
146
|
+
}>;
|
|
147
|
+
}>>;
|
|
148
|
+
/**
|
|
149
|
+
* Options for {@link Data.bind}.
|
|
150
|
+
*
|
|
151
|
+
* @property mode - Operating mode. `"staged"` (default) buffers edits
|
|
152
|
+
* locally and commits on demand; `"direct"` writes through immediately.
|
|
153
|
+
* @property patch - When supplied, the binding's commit / live writes
|
|
154
|
+
* target this patch dataset (typed `PatchType(T)`). Must be a static
|
|
155
|
+
* {@link TreePath} so manifest derivation can preload it; computed
|
|
156
|
+
* East-side path expressions are not supported. When omitted, writes
|
|
157
|
+
* target the source itself.
|
|
158
|
+
*/
|
|
159
|
+
export interface DataBindOptions {
|
|
160
|
+
/** Operating mode — `"staged"` (default) or `"direct"`. */
|
|
161
|
+
mode?: DataBindModeLiteral;
|
|
162
|
+
/** Optional separate patch dataset path. Must be statically known. */
|
|
163
|
+
patch?: TreePath;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The Data namespace — reactive dataset binding for e3 UI tasks.
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* `Data.bind` exposes a single binding handle that adapts to four
|
|
170
|
+
* combinations of `mode` (staged | direct) and `patch` (absent | present).
|
|
171
|
+
* The full per-mode semantics matrix is documented on {@link Data.bind}.
|
|
172
|
+
*
|
|
173
|
+
* Use inside `Reactive.Root` for reactive re-rendering when the underlying
|
|
174
|
+
* datasets change.
|
|
175
|
+
*/
|
|
176
|
+
export declare const Data: {
|
|
177
|
+
/**
|
|
178
|
+
* Bind a dataset path to a reactive view of its current value, with
|
|
179
|
+
* optional local staging or a separate server-backed patch dataset.
|
|
180
|
+
*
|
|
181
|
+
* @typeParam T - The East type of the source dataset value.
|
|
182
|
+
* @param types - Single-element type-args tuple `[T]`.
|
|
183
|
+
* @param source - The source dataset path.
|
|
184
|
+
* @param options - {@link DataBindOptions}. When omitted, defaults to
|
|
185
|
+
* `{ mode: "staged" }` (no separate patch dataset, edits buffered
|
|
186
|
+
* locally until commit).
|
|
187
|
+
* @returns A handle struct described by {@link DataBindHandleType} —
|
|
188
|
+
* `read` / `write` / `writeAndStart` / `source` / `pending` /
|
|
189
|
+
* `commit` / `discard` / `has` / `status` / `binding`.
|
|
190
|
+
*
|
|
191
|
+
* @remarks
|
|
192
|
+
* Per-mode semantics matrix (rows are `mode × patch`, columns are
|
|
193
|
+
* methods):
|
|
194
|
+
*
|
|
195
|
+
* | mode | patch | `read()` | `write(v)` | `commit()` | `discard()` | `pending()` |
|
|
196
|
+
* |---------|---------|-------------------------------------|-----------------------------------------|-----------------------------------------------------|------------------------------|---------------------|
|
|
197
|
+
* | direct | absent | source | dataset write | no-op | no-op | always false |
|
|
198
|
+
* | direct | present | apply(source, patch dataset) | write diff(source, v) → patch dataset | apply patch → source; clear patch dataset | clear patch dataset | patch non-trivial |
|
|
199
|
+
* | staged | absent | buffered ?? source | update buffer (pin snapshot first time) | apply buffer → source; drop buffer | drop buffer | buffer non-empty |
|
|
200
|
+
* | staged | present | buffered ?? apply(source, patch) | update buffer | write diff(source, buffer) → patch dataset; drop buffer | drop buffer (patch intact) | buffer non-empty |
|
|
201
|
+
*
|
|
202
|
+
* `writeAndStart(v)` kicks the workspace dataflow after the write — only
|
|
203
|
+
* meaningful for `mode = "direct"` without a `patch` dataset; in other
|
|
204
|
+
* modes it falls back to `write(v)` (the workspace dataflow is triggered
|
|
205
|
+
* on `commit` instead).
|
|
206
|
+
*
|
|
207
|
+
* The `binding` field surfaces this binding's descriptor as a
|
|
208
|
+
* {@link DiffBindingType} value — pass it directly to
|
|
209
|
+
* {@link Diff.Root}'s `bindings` array to surface the in-flight change
|
|
210
|
+
* in a Diff card.
|
|
211
|
+
*
|
|
212
|
+
* Use inside `Reactive.Root` so `read` / `pending` / `status` re-fire
|
|
213
|
+
* on every dataset or staging-buffer change.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* import { East, FloatType, NullType } from "@elaraai/east";
|
|
218
|
+
* import { Reactive, Slider, UIComponentType } from "@elaraai/east-ui";
|
|
219
|
+
* import { Data, Diff } from "@elaraai/e3-ui";
|
|
220
|
+
* import * as e3 from "@elaraai/e3";
|
|
221
|
+
*
|
|
222
|
+
* const thresholdInput = e3.input("threshold", FloatType, 38.0);
|
|
223
|
+
*
|
|
224
|
+
* // Mirrors `dataBindStaged` in test/data.examples.ts.
|
|
225
|
+
* const dataBindStaged = East.function([], UIComponentType, _$ => {
|
|
226
|
+
* return Reactive.Root(East.function([], UIComponentType, $ => {
|
|
227
|
+
* const view = $.let(Data.bind([FloatType], thresholdInput.path));
|
|
228
|
+
* const value = $.let(view.read(), FloatType);
|
|
229
|
+
* return Slider.Root(value, {
|
|
230
|
+
* min: 30.0, max: 60.0, step: 1.0,
|
|
231
|
+
* onChangeEnd: East.function([FloatType], NullType, ($, v) => {
|
|
232
|
+
* $(view.write(v));
|
|
233
|
+
* }),
|
|
234
|
+
* });
|
|
235
|
+
* }));
|
|
236
|
+
* });
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
readonly bind: <T extends EastType>(types: [T], source: TreePath, options?: DataBindOptions) => ExprType<ReturnType<typeof DataBindHandleType<T>>>;
|
|
240
|
+
};
|
|
241
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAEH,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EAIV,KAAK,QAAQ,EACb,KAAK,QAAQ,EAGhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAmC,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAMnF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC;AACH,+CAA+C;AAC/C,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC;AAEvD,uDAAuD;AACvD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;EAI1B,CAAC;AACH,8CAA8C;AAC9C,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC;AAMrD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,QAAQ,GAAG,MAAM,EAAE,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;EAWlE,CAAC;AAMH;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiB1B,CAAC;AAMF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC5B,2DAA2D;IAC3D,IAAI,CAAC,EAAG,mBAAmB,CAAC;IAC5B,sEAAsE;IACtE,KAAK,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI;IACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6DG;oBACE,CAAC,SAAS,QAAQ,SACZ,CAAC,CAAC,CAAC,UACF,QAAQ,YACN,eAAe,KAC1B,QAAQ,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;CAa/C,CAAC"}
|