@maelstrom-co/react 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +75 -2
- package/dist/_testing.d.ts +13 -0
- package/dist/_testing.d.ts.map +1 -0
- package/dist/_testing.js +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5110 -0
- package/dist/lib/build-execute-action.d.ts +9 -0
- package/dist/lib/build-execute-action.d.ts.map +1 -0
- package/dist/lib/chart/chart.d.ts +14 -0
- package/dist/lib/chart/chart.d.ts.map +1 -0
- package/dist/lib/chart/error-boundary.d.ts +17 -0
- package/dist/lib/chart/error-boundary.d.ts.map +1 -0
- package/dist/lib/chart/loading.d.ts +14 -0
- package/dist/lib/chart/loading.d.ts.map +1 -0
- package/dist/lib/chart/motion/flip.d.ts +18 -0
- package/dist/lib/chart/motion/flip.d.ts.map +1 -0
- package/dist/lib/chart/motion/measure.d.ts +8 -0
- package/dist/lib/chart/motion/measure.d.ts.map +1 -0
- package/dist/lib/chart/motion/motion-config.d.ts +27 -0
- package/dist/lib/chart/motion/motion-config.d.ts.map +1 -0
- package/dist/lib/chart/motion/use-chart-motion.d.ts +7 -0
- package/dist/lib/chart/motion/use-chart-motion.d.ts.map +1 -0
- package/dist/lib/chart/motion/use-exiting-instances.d.ts +9 -0
- package/dist/lib/chart/motion/use-exiting-instances.d.ts.map +1 -0
- package/dist/lib/config-types.d.ts +29 -0
- package/dist/lib/config-types.d.ts.map +1 -0
- package/dist/lib/context.d.ts +42 -0
- package/dist/lib/context.d.ts.map +1 -0
- package/dist/lib/create-maelstrom.d.ts +39 -0
- package/dist/lib/create-maelstrom.d.ts.map +1 -0
- package/dist/lib/dynamic-vessel-types.d.ts +57 -0
- package/dist/lib/dynamic-vessel-types.d.ts.map +1 -0
- package/dist/lib/extension-types.d.ts +58 -0
- package/dist/lib/extension-types.d.ts.map +1 -0
- package/dist/lib/maelstrom-instance-types.d.ts +228 -0
- package/dist/lib/maelstrom-instance-types.d.ts.map +1 -0
- package/dist/lib/maelstrom-state-types.d.ts +30 -0
- package/dist/lib/maelstrom-state-types.d.ts.map +1 -0
- package/dist/lib/provider.d.ts +135 -0
- package/dist/lib/provider.d.ts.map +1 -0
- package/dist/lib/register-vessel.d.ts +13 -0
- package/dist/lib/register-vessel.d.ts.map +1 -0
- package/dist/lib/require-context.d.ts +9 -0
- package/dist/lib/require-context.d.ts.map +1 -0
- package/dist/lib/update-vessel.d.ts +21 -0
- package/dist/lib/update-vessel.d.ts.map +1 -0
- package/dist/lib/use-actions.d.ts +19 -0
- package/dist/lib/use-actions.d.ts.map +1 -0
- package/dist/lib/use-instance.d.ts +11 -0
- package/dist/lib/use-instance.d.ts.map +1 -0
- package/dist/lib/use-intent-submission.d.ts +8 -0
- package/dist/lib/use-intent-submission.d.ts.map +1 -0
- package/dist/lib/use-latest-ref.d.ts +4 -0
- package/dist/lib/use-latest-ref.d.ts.map +1 -0
- package/dist/lib/use-maelstrom.d.ts +7 -0
- package/dist/lib/use-maelstrom.d.ts.map +1 -0
- package/dist/lib/use-store-selector.d.ts +17 -0
- package/dist/lib/use-store-selector.d.ts.map +1 -0
- package/dist/lib/use-vessel-core.d.ts +18 -0
- package/dist/lib/use-vessel-core.d.ts.map +1 -0
- package/dist/lib/use-vessel.d.ts +7 -0
- package/dist/lib/use-vessel.d.ts.map +1 -0
- package/dist/lib/vessel-entry-types.d.ts +170 -0
- package/dist/lib/vessel-entry-types.d.ts.map +1 -0
- package/dist/lib/vessel.d.ts +10 -0
- package/dist/lib/vessel.d.ts.map +1 -0
- package/dist/lib/warn-once.d.ts +23 -0
- package/dist/lib/warn-once.d.ts.map +1 -0
- package/dist/warn-once-Cq9ShMdA.js +10 -0
- package/package.json +83 -4
- package/skills/maelstrom-react-sdk/SKILL.md +29 -0
- package/skills/maelstrom-react-sdk/references/common-tasks.md +146 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Jose Ignacio Vazquez Calleja, Krzysztof Trześniewski and Javier Cabrera Arteaga
|
|
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
CHANGED
|
@@ -1,3 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @maelstrom-co/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/maelstrom-co/maelstrom/blob/main/LICENSE)
|
|
4
|
+
|
|
5
|
+
React bindings for Maelstrom — AI-orchestrated dynamic UIs.
|
|
6
|
+
|
|
7
|
+
📚 **Full documentation:** <https://docs.maelstrom-ai.co/reference/react/readme/>
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun add @maelstrom-co/react
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or: `npm install` / `pnpm add` / `yarn add @maelstrom-co/react`
|
|
16
|
+
|
|
17
|
+
## What it does
|
|
18
|
+
|
|
19
|
+
- **`createMaelstrom({ vessels })`** — factory that returns a typed Maelstrom instance — see bullets below for what it exposes
|
|
20
|
+
- **`defineVessel(config)`** — declares the framework-agnostic vessel state machine
|
|
21
|
+
- **`vessel(definition, component | loader, loadingComponent?)`** — pairs a vessel definition with a React component; `loadingComponent` is only used when a lazy loader is passed
|
|
22
|
+
- **`WebSocketConnector` / `HttpConnector`** — client connectors re-exported for React apps
|
|
23
|
+
- **`m.Provider`** — connects to the engine and owns all chart state; accepts any `EngineConnector`
|
|
24
|
+
- **`m.Chart`** — renders the grid canvas; the engine emits layout directives that Chart renders as CSS positioning
|
|
25
|
+
- **Hooks**
|
|
26
|
+
- `useMaelstrom` — intent submission and connection status
|
|
27
|
+
- `useVessel` and `useActions` — vessel-level state
|
|
28
|
+
- `useInstance` — raw access to the Maelstrom instance
|
|
29
|
+
- **`.with(extension)`** — builder for optional extensions
|
|
30
|
+
|
|
31
|
+
## Quick example
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { createMaelstrom, defineVessel, vessel, WebSocketConnector } from '@maelstrom-co/react';
|
|
35
|
+
|
|
36
|
+
const greetingVessel = vessel(
|
|
37
|
+
defineVessel({
|
|
38
|
+
id: 'greeting',
|
|
39
|
+
name: 'Greeting',
|
|
40
|
+
description: 'Displays a greeting message.',
|
|
41
|
+
defaultVariant: 'compact',
|
|
42
|
+
variants: {
|
|
43
|
+
compact: {
|
|
44
|
+
description: 'One-line greeting',
|
|
45
|
+
props: { message: 'Hello!' },
|
|
46
|
+
minSize: { width: 2, height: 1 },
|
|
47
|
+
actions: [],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
({ variantProps }) => <div>{variantProps.message}</div>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const m = createMaelstrom({ vessels: [greetingVessel] });
|
|
55
|
+
const connector = new WebSocketConnector({ url: 'ws://localhost:3001/ws' });
|
|
56
|
+
|
|
57
|
+
export function App() {
|
|
58
|
+
return (
|
|
59
|
+
<m.Provider connector={connector}>
|
|
60
|
+
<m.Chart className="h-screen" />
|
|
61
|
+
</m.Provider>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Docs
|
|
67
|
+
|
|
68
|
+
- Quick start: https://docs.maelstrom-ai.co/getting-started/quick-start/
|
|
69
|
+
- Core concepts: https://docs.maelstrom-ai.co/getting-started/core-concepts/
|
|
70
|
+
- React guides: https://docs.maelstrom-ai.co/guides/react/creating-vessels/
|
|
71
|
+
- Optional DevTools: [inspect requests, layouts, voice events, and recordings](https://docs.maelstrom-ai.co/guides/devtools/) with `@maelstrom-co/react-devtools`.
|
|
72
|
+
- API reference: https://docs.maelstrom-ai.co/reference/react/readme/
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Test-only utilities for `@maelstrom-co/react`. */
|
|
2
|
+
/**
|
|
3
|
+
* Clears warning de-duplication state held by this loaded module instance.
|
|
4
|
+
* Calling it with no recorded warnings is a no-op. After a reset, a subsequent
|
|
5
|
+
* enabled warning for a previously recorded key can be emitted again.
|
|
6
|
+
*
|
|
7
|
+
* The state is local to the loaded package copy in the current process; this
|
|
8
|
+
* does not reset other processes, realms, or separately loaded copies. Unlike
|
|
9
|
+
* the application-facing package root, the `_testing` subpath intentionally
|
|
10
|
+
* exposes this reset utility and does not expose the warning helper itself.
|
|
11
|
+
*/
|
|
12
|
+
export { resetWarnings } from './lib/warn-once.js';
|
|
13
|
+
//# sourceMappingURL=_testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_testing.d.ts","sourceRoot":"","sources":["../src/_testing.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/_testing.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as resetWarnings } from "./warn-once-Cq9ShMdA.js";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { ActionHandler, ActionNames, ActionParams, ActionResult, ActionRunner, VariantNames, } from '@maelstrom-co/client';
|
|
2
|
+
export { HttpConnector, WebSocketConnector, } from '@maelstrom-co/client';
|
|
3
|
+
export { defineVessel } from '@maelstrom-co/protocol';
|
|
4
|
+
export type { ChartProps } from './lib/chart/chart.js';
|
|
5
|
+
export type { ChartMotionConfig } from './lib/chart/motion/motion-config.js';
|
|
6
|
+
export type { CreateMaelstromConfig } from './lib/create-maelstrom.js';
|
|
7
|
+
export { createMaelstrom } from './lib/create-maelstrom.js';
|
|
8
|
+
export type { DynamicVesselHandle, UntypedVesselProps, } from './lib/dynamic-vessel-types.js';
|
|
9
|
+
export type { MaelstromExtension, MaelstromExtensionContext, MaelstromExtensionContextValue, } from './lib/extension-types.js';
|
|
10
|
+
export type { MaelstromInstance } from './lib/maelstrom-instance-types.js';
|
|
11
|
+
export type { MaelstromState } from './lib/maelstrom-state-types.js';
|
|
12
|
+
export type { MaelstromProviderProps } from './lib/provider.js';
|
|
13
|
+
export { useIntentSubmission } from './lib/use-intent-submission.js';
|
|
14
|
+
export { vessel } from './lib/vessel.js';
|
|
15
|
+
export type { LazyVesselComponentLoader, LazyVesselEntry, RepublishableVessel, TypedVesselProps, UpdateVesselConflict, UpdateVesselConflictCode, UpdateVesselPayload, UpdateVesselResult, VariantProps, VesselEntry, VesselIds, } from './lib/vessel-entry-types.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,aAAa,EACb,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,YAAY,EACV,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EACV,kBAAkB,EAClB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EACV,yBAAyB,EACzB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,SAAS,GACV,MAAM,6BAA6B,CAAC"}
|