@neta-art/cohub 2.15.0 → 3.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/README.md +56 -0
- package/dist/board.d.ts +99 -0
- package/dist/board.js +2 -0
- package/dist/chunks/board.d.ts +2589 -0
- package/dist/chunks/board.js +392 -0
- package/dist/chunks/http.d.ts +238 -52
- package/dist/chunks/http.js +179 -66
- package/dist/chunks/websocket.d.ts +37 -116
- package/dist/chunks/websocket.js +0 -16
- package/dist/http.d.ts +4 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -2
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -74,6 +74,62 @@ await session.messages.send({
|
|
|
74
74
|
});
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
## Boards
|
|
78
|
+
|
|
79
|
+
Use `space.boards` for collection operations and bind an ID with
|
|
80
|
+
`space.board(boardId)` for entity operations:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const created = await space.boards.create({
|
|
84
|
+
path: "boards/plan.board",
|
|
85
|
+
title: "Plan",
|
|
86
|
+
nodes: [],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const board = space.board(created.board.id);
|
|
90
|
+
// Equivalent: space.boards.byId(created.board.id)
|
|
91
|
+
|
|
92
|
+
const snapshot = await board.inspect({
|
|
93
|
+
include: ["nodes", "effects", "sequences", "clips", "playback"],
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
await board.apply({
|
|
97
|
+
txId: crypto.randomUUID(),
|
|
98
|
+
baseVersion: snapshot.board.version,
|
|
99
|
+
operations: [
|
|
100
|
+
{ type: "board.patch", payload: { patch: { title: "Updated plan" } } },
|
|
101
|
+
],
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
A bound `BoardClient` injects its `boardId` into validation and transaction
|
|
106
|
+
requests. Realtime subscriptions are also scoped to that Board:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
const stop = board.subscribe({
|
|
110
|
+
transaction(event) {
|
|
111
|
+
console.log("version", event.payload.version);
|
|
112
|
+
},
|
|
113
|
+
playback(event) {
|
|
114
|
+
console.log("playback", event.payload.status);
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
stop();
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Import timeline compilation and extension registry helpers from the lightweight
|
|
122
|
+
Board entry point:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import {
|
|
126
|
+
clip,
|
|
127
|
+
compileSequence,
|
|
128
|
+
createBoardExtensionRegistry,
|
|
129
|
+
timeline,
|
|
130
|
+
} from "@neta-art/cohub/board";
|
|
131
|
+
```
|
|
132
|
+
|
|
77
133
|
## Session subscriptions
|
|
78
134
|
|
|
79
135
|
```ts
|
package/dist/board.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { C as BoardRenderCost, S as BoardCapability, c as BoardEffect, i as BoardClip, s as BoardDiagnostic, t as BoardAssetRef, v as BoardSequence, x as BoardValidationResult, y as BoardTarget } from "./chunks/board.js";
|
|
2
|
+
//#region src/board.d.ts
|
|
3
|
+
type TimelineClipInput = Omit<BoardClip, "id" | "sequenceId" | "start" | "seed"> & {
|
|
4
|
+
id?: string;
|
|
5
|
+
seed?: string;
|
|
6
|
+
};
|
|
7
|
+
type TimelineInput = {
|
|
8
|
+
type: "clip";
|
|
9
|
+
clip: TimelineClipInput;
|
|
10
|
+
} | {
|
|
11
|
+
type: "parallel";
|
|
12
|
+
children: TimelineInput[];
|
|
13
|
+
} | {
|
|
14
|
+
type: "sequence";
|
|
15
|
+
children: TimelineInput[];
|
|
16
|
+
} | {
|
|
17
|
+
type: "stagger";
|
|
18
|
+
each: number;
|
|
19
|
+
children: TimelineInput[];
|
|
20
|
+
} | {
|
|
21
|
+
type: "delay";
|
|
22
|
+
duration: number;
|
|
23
|
+
child: TimelineInput;
|
|
24
|
+
} | {
|
|
25
|
+
type: "repeat";
|
|
26
|
+
count: number;
|
|
27
|
+
child: TimelineInput;
|
|
28
|
+
};
|
|
29
|
+
type CompiledSequence = {
|
|
30
|
+
sequence: Omit<BoardSequence, "boardId" | "revision">;
|
|
31
|
+
clips: Array<Omit<BoardClip, "sequenceId">>;
|
|
32
|
+
assetRefs: BoardAssetRef[];
|
|
33
|
+
};
|
|
34
|
+
type RenderBounds = {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
};
|
|
40
|
+
type QualityProfile = "low" | "medium" | "high";
|
|
41
|
+
type BoardExtensionDefinition = BoardCapability & {
|
|
42
|
+
validate?: (params: Record<string, unknown>) => BoardDiagnostic[];
|
|
43
|
+
getBounds?: (params: Record<string, unknown>) => RenderBounds | null;
|
|
44
|
+
getAssetRefs?: (params: Record<string, unknown>) => BoardAssetRef[];
|
|
45
|
+
estimateCost: (params: Record<string, unknown>, profile: QualityProfile) => Partial<BoardRenderCost>;
|
|
46
|
+
};
|
|
47
|
+
type BoardPresetDefinition = BoardCapability & {
|
|
48
|
+
kind: "preset";
|
|
49
|
+
compile: (params: Record<string, unknown>) => TimelineInput;
|
|
50
|
+
};
|
|
51
|
+
declare const DEFAULT_BOARD_LIMITS: BoardRenderCost;
|
|
52
|
+
declare const timeline: {
|
|
53
|
+
clip(clip: TimelineClipInput): TimelineInput;
|
|
54
|
+
parallel(...children: TimelineInput[]): TimelineInput;
|
|
55
|
+
sequence(...children: TimelineInput[]): TimelineInput;
|
|
56
|
+
stagger(each: number, ...children: TimelineInput[]): TimelineInput;
|
|
57
|
+
delay(duration: number, child: TimelineInput): TimelineInput;
|
|
58
|
+
repeat(count: number, child: TimelineInput): TimelineInput;
|
|
59
|
+
};
|
|
60
|
+
declare function clip(input: {
|
|
61
|
+
kind: string;
|
|
62
|
+
target: BoardTarget;
|
|
63
|
+
duration: number;
|
|
64
|
+
params?: Record<string, unknown>;
|
|
65
|
+
keyframes?: BoardClip["keyframes"];
|
|
66
|
+
assetRefs?: BoardAssetRef[];
|
|
67
|
+
easing?: string;
|
|
68
|
+
fill?: BoardClip["fill"];
|
|
69
|
+
layer?: BoardClip["layer"];
|
|
70
|
+
kindVersion?: number;
|
|
71
|
+
id?: string;
|
|
72
|
+
seed?: string;
|
|
73
|
+
metadata?: Record<string, unknown>;
|
|
74
|
+
}): TimelineInput;
|
|
75
|
+
declare function compileSequence(input: {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
seed: string;
|
|
79
|
+
timeline: TimelineInput;
|
|
80
|
+
restPose?: Record<string, unknown>;
|
|
81
|
+
metadata?: Record<string, unknown>;
|
|
82
|
+
}): CompiledSequence;
|
|
83
|
+
declare class BoardExtensionRegistry {
|
|
84
|
+
#private;
|
|
85
|
+
register(definition: BoardExtensionDefinition | BoardPresetDefinition): this;
|
|
86
|
+
capabilities(): BoardCapability[];
|
|
87
|
+
compilePreset(id: string, version: number, params: Record<string, unknown>): TimelineInput;
|
|
88
|
+
validate(input: {
|
|
89
|
+
clips: Array<Omit<BoardClip, "sequenceId">>;
|
|
90
|
+
effects?: Array<Omit<BoardEffect, "boardId" | "revision">>;
|
|
91
|
+
profile?: QualityProfile;
|
|
92
|
+
limits?: BoardRenderCost;
|
|
93
|
+
}): BoardValidationResult;
|
|
94
|
+
}
|
|
95
|
+
declare function createBoardExtensionRegistry(input?: {
|
|
96
|
+
builtins?: boolean;
|
|
97
|
+
}): BoardExtensionRegistry;
|
|
98
|
+
//#endregion
|
|
99
|
+
export { BoardExtensionDefinition, BoardExtensionRegistry, BoardPresetDefinition, CompiledSequence, DEFAULT_BOARD_LIMITS, QualityProfile, RenderBounds, TimelineClipInput, TimelineInput, clip, compileSequence, createBoardExtensionRegistry, timeline };
|
package/dist/board.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as createBoardExtensionRegistry, i as compileSequence, n as DEFAULT_BOARD_LIMITS, o as timeline, r as clip, t as BoardExtensionRegistry } from "./chunks/board.js";
|
|
2
|
+
export { BoardExtensionRegistry, DEFAULT_BOARD_LIMITS, clip, compileSequence, createBoardExtensionRegistry, timeline };
|