@paramrig/web 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 +359 -0
- package/dist/index-L3Zm-CoX.js +512 -0
- package/dist/paramrig-web.js +533 -0
- package/dist/rigs/extended-types.d.ts +184 -0
- package/dist/rigs/types.d.ts +199 -0
- package/dist/web/contracts.d.ts +287 -0
- package/dist/web/geometry.d.ts +5 -0
- package/dist/web/sdk.d.ts +20 -0
- package/package.json +40 -0
- package/schemas/batch.schema.json +126 -0
- package/schemas/manifest.schema.json +83 -0
- package/schemas/response.schema.json +33 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { ParameterDef, ParamValue } from './types';
|
|
2
|
+
export type ParameterBase = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
group: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type Option = {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
preview?: string;
|
|
13
|
+
};
|
|
14
|
+
export type Point = {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
export type RadialZone = {
|
|
19
|
+
label: string;
|
|
20
|
+
start: number;
|
|
21
|
+
end: number;
|
|
22
|
+
};
|
|
23
|
+
export type RadialLayer = {
|
|
24
|
+
name: string;
|
|
25
|
+
color: string;
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
points: Point[];
|
|
28
|
+
};
|
|
29
|
+
export type ResourceValue = {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
mime: string;
|
|
33
|
+
size: number;
|
|
34
|
+
};
|
|
35
|
+
export type Gizmo2DValue = {
|
|
36
|
+
position: [number, number];
|
|
37
|
+
size: [number, number];
|
|
38
|
+
rotation: number;
|
|
39
|
+
};
|
|
40
|
+
export type Gizmo3DValue = {
|
|
41
|
+
position: [number, number, number];
|
|
42
|
+
rotation: [number, number, number];
|
|
43
|
+
scale: [number, number, number];
|
|
44
|
+
mode: 'translate' | 'rotate' | 'scale';
|
|
45
|
+
};
|
|
46
|
+
export type TextureFrameValue = {
|
|
47
|
+
rect: [number, number, number, number];
|
|
48
|
+
rotation: number;
|
|
49
|
+
};
|
|
50
|
+
export type CameraValue = {
|
|
51
|
+
azimuth: number;
|
|
52
|
+
elevation: number;
|
|
53
|
+
distance: number;
|
|
54
|
+
fov: number;
|
|
55
|
+
};
|
|
56
|
+
export type ModulationValue = {
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
mode: string;
|
|
59
|
+
rate: number;
|
|
60
|
+
phase: number;
|
|
61
|
+
amplitude: number;
|
|
62
|
+
offset: number;
|
|
63
|
+
attack: number;
|
|
64
|
+
hold: number;
|
|
65
|
+
release: number;
|
|
66
|
+
seed: number;
|
|
67
|
+
};
|
|
68
|
+
export type ValueSource = {
|
|
69
|
+
mode: 'local';
|
|
70
|
+
} | {
|
|
71
|
+
mode: 'parameter';
|
|
72
|
+
source?: string;
|
|
73
|
+
} | {
|
|
74
|
+
mode: 'expression';
|
|
75
|
+
expression?: string;
|
|
76
|
+
} | {
|
|
77
|
+
mode: 'animation';
|
|
78
|
+
} | {
|
|
79
|
+
mode: 'macro';
|
|
80
|
+
source?: string;
|
|
81
|
+
min: number;
|
|
82
|
+
max: number;
|
|
83
|
+
} | {
|
|
84
|
+
mode: 'modulation';
|
|
85
|
+
shape: ModulationValue['mode'];
|
|
86
|
+
rate: number;
|
|
87
|
+
phase: number;
|
|
88
|
+
amplitude: number;
|
|
89
|
+
offset: number;
|
|
90
|
+
attack: number;
|
|
91
|
+
hold: number;
|
|
92
|
+
release: number;
|
|
93
|
+
seed: number;
|
|
94
|
+
} | {
|
|
95
|
+
mode: 'blend';
|
|
96
|
+
source?: string;
|
|
97
|
+
amount?: number;
|
|
98
|
+
from: number;
|
|
99
|
+
to: number;
|
|
100
|
+
};
|
|
101
|
+
export type ExtendedParameter = ParameterBase & ({
|
|
102
|
+
kind: 'vector';
|
|
103
|
+
defaultValue: number[];
|
|
104
|
+
axes: string[];
|
|
105
|
+
min: number;
|
|
106
|
+
max: number;
|
|
107
|
+
step: number;
|
|
108
|
+
unit?: string;
|
|
109
|
+
view?: 'fields' | 'xy' | 'dimensions' | 'direction' | 'rotation' | 'anchor';
|
|
110
|
+
proportional?: boolean;
|
|
111
|
+
linkLabel?: string;
|
|
112
|
+
} | {
|
|
113
|
+
kind: 'range';
|
|
114
|
+
defaultValue: number[];
|
|
115
|
+
min: number;
|
|
116
|
+
max: number;
|
|
117
|
+
step: number;
|
|
118
|
+
unit?: string;
|
|
119
|
+
} | {
|
|
120
|
+
kind: 'text';
|
|
121
|
+
defaultValue: string;
|
|
122
|
+
multiline?: boolean;
|
|
123
|
+
maxLength?: number;
|
|
124
|
+
} | {
|
|
125
|
+
kind: 'multiselect';
|
|
126
|
+
defaultValue: string[];
|
|
127
|
+
options: Option[];
|
|
128
|
+
} | {
|
|
129
|
+
kind: 'palette';
|
|
130
|
+
defaultValue: string[];
|
|
131
|
+
maxItems?: number;
|
|
132
|
+
} | {
|
|
133
|
+
kind: 'points';
|
|
134
|
+
defaultValue: Point[];
|
|
135
|
+
view?: 'curve' | 'ramp' | 'path';
|
|
136
|
+
min?: number;
|
|
137
|
+
max?: number;
|
|
138
|
+
} | {
|
|
139
|
+
kind: 'radial';
|
|
140
|
+
defaultValue: RadialLayer[];
|
|
141
|
+
zones?: RadialZone[];
|
|
142
|
+
maxLayers?: number;
|
|
143
|
+
} | {
|
|
144
|
+
kind: 'resource';
|
|
145
|
+
defaultValue: ResourceValue | null;
|
|
146
|
+
accept: string;
|
|
147
|
+
view?: 'image' | 'texture' | 'svg' | 'font' | 'model' | 'environment';
|
|
148
|
+
maxMB?: number;
|
|
149
|
+
} | {
|
|
150
|
+
kind: 'gizmo2d';
|
|
151
|
+
defaultValue: Gizmo2DValue;
|
|
152
|
+
} | {
|
|
153
|
+
kind: 'gizmo3d';
|
|
154
|
+
defaultValue: Gizmo3DValue;
|
|
155
|
+
} | {
|
|
156
|
+
kind: 'textureFrame';
|
|
157
|
+
defaultValue: TextureFrameValue;
|
|
158
|
+
} | {
|
|
159
|
+
kind: 'camera';
|
|
160
|
+
defaultValue: CameraValue;
|
|
161
|
+
} | {
|
|
162
|
+
kind: 'group';
|
|
163
|
+
defaultValue: Record<string, ParamValue>;
|
|
164
|
+
fields: ParameterDef[];
|
|
165
|
+
} | {
|
|
166
|
+
kind: 'list';
|
|
167
|
+
defaultValue: ParamValue[];
|
|
168
|
+
item: ParameterDef;
|
|
169
|
+
maxItems?: number;
|
|
170
|
+
} | {
|
|
171
|
+
kind: 'action';
|
|
172
|
+
defaultValue: number;
|
|
173
|
+
action: 'set' | 'randomize' | 'reset' | 'trigger';
|
|
174
|
+
targets?: string[];
|
|
175
|
+
values?: Record<string, ParamValue>;
|
|
176
|
+
} | {
|
|
177
|
+
kind: 'preset';
|
|
178
|
+
defaultValue: string;
|
|
179
|
+
options: {
|
|
180
|
+
value: string;
|
|
181
|
+
label: string;
|
|
182
|
+
values: Record<string, ParamValue>;
|
|
183
|
+
}[];
|
|
184
|
+
});
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
export type Vec2 = [number, number];
|
|
2
|
+
export type BezierCurve = {
|
|
3
|
+
type: 'cubic-bezier';
|
|
4
|
+
p0: Vec2;
|
|
5
|
+
p1: Vec2;
|
|
6
|
+
p2: Vec2;
|
|
7
|
+
p3: Vec2;
|
|
8
|
+
};
|
|
9
|
+
export type GradientStop = {
|
|
10
|
+
t: number;
|
|
11
|
+
color: string;
|
|
12
|
+
};
|
|
13
|
+
export type ParamValue = number | string | boolean | null | BezierCurve | GradientStop[] | ParamValue[] | {
|
|
14
|
+
[key: string]: ParamValue;
|
|
15
|
+
};
|
|
16
|
+
export type NumberParam = {
|
|
17
|
+
kind: 'number';
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
group: string;
|
|
21
|
+
min: number;
|
|
22
|
+
max: number;
|
|
23
|
+
step: number;
|
|
24
|
+
unit?: string;
|
|
25
|
+
/** Display-only unit conversions. Stored values remain in the base unit. */
|
|
26
|
+
units?: {
|
|
27
|
+
value: string;
|
|
28
|
+
label: string;
|
|
29
|
+
factor: number;
|
|
30
|
+
step?: number;
|
|
31
|
+
}[];
|
|
32
|
+
defaultValue: number;
|
|
33
|
+
sliderMin?: number;
|
|
34
|
+
sliderMax?: number;
|
|
35
|
+
/** 'bar' is the default measured view: the field itself is the track, filled to the value. */
|
|
36
|
+
view?: 'field' | 'stepper' | 'bar' | 'knob' | 'angle' | 'seed';
|
|
37
|
+
scale?: 'linear' | 'log';
|
|
38
|
+
stops?: number[];
|
|
39
|
+
readOnly?: boolean;
|
|
40
|
+
role?: 'duration' | 'playhead';
|
|
41
|
+
defaultSource?: import('./extended-types').ValueSource;
|
|
42
|
+
hidden?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export type ColorParam = {
|
|
45
|
+
kind: 'color';
|
|
46
|
+
id: string;
|
|
47
|
+
label: string;
|
|
48
|
+
group: string;
|
|
49
|
+
defaultValue: string;
|
|
50
|
+
alpha?: boolean;
|
|
51
|
+
channels?: boolean;
|
|
52
|
+
hidden?: boolean;
|
|
53
|
+
};
|
|
54
|
+
export type SelectParam = {
|
|
55
|
+
kind: 'select';
|
|
56
|
+
id: string;
|
|
57
|
+
label: string;
|
|
58
|
+
group: string;
|
|
59
|
+
options: {
|
|
60
|
+
value: string;
|
|
61
|
+
label: string;
|
|
62
|
+
preview?: string;
|
|
63
|
+
}[];
|
|
64
|
+
defaultValue: string;
|
|
65
|
+
appliesToTracks?: boolean;
|
|
66
|
+
view?: 'search' | 'visual' | 'font';
|
|
67
|
+
hidden?: boolean;
|
|
68
|
+
};
|
|
69
|
+
export type CurveParam = {
|
|
70
|
+
kind: 'curve';
|
|
71
|
+
id: string;
|
|
72
|
+
label: string;
|
|
73
|
+
group: string;
|
|
74
|
+
defaultValue: BezierCurve;
|
|
75
|
+
hidden?: boolean;
|
|
76
|
+
};
|
|
77
|
+
export type SwitchParam = {
|
|
78
|
+
kind: 'switch';
|
|
79
|
+
id: string;
|
|
80
|
+
label: string;
|
|
81
|
+
group: string;
|
|
82
|
+
defaultValue: boolean;
|
|
83
|
+
hidden?: boolean;
|
|
84
|
+
};
|
|
85
|
+
export type GradientParam = {
|
|
86
|
+
kind: 'gradient';
|
|
87
|
+
id: string;
|
|
88
|
+
label: string;
|
|
89
|
+
group: string;
|
|
90
|
+
defaultValue: GradientStop[];
|
|
91
|
+
hidden?: boolean;
|
|
92
|
+
};
|
|
93
|
+
export type ParameterDef = NumberParam | ColorParam | SelectParam | CurveParam | SwitchParam | GradientParam | import('./extended-types').ExtendedParameter;
|
|
94
|
+
export type Keyframe = {
|
|
95
|
+
id?: string;
|
|
96
|
+
time: number;
|
|
97
|
+
value: number;
|
|
98
|
+
easing?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'step';
|
|
99
|
+
};
|
|
100
|
+
export type KeyframeRef = {
|
|
101
|
+
paramId: string;
|
|
102
|
+
id: string;
|
|
103
|
+
};
|
|
104
|
+
export type LoopRange = {
|
|
105
|
+
start: number;
|
|
106
|
+
end: number;
|
|
107
|
+
};
|
|
108
|
+
export type AnimTrack = {
|
|
109
|
+
paramId: string;
|
|
110
|
+
interpolation: 'linear' | 'step';
|
|
111
|
+
keyframes: Keyframe[];
|
|
112
|
+
};
|
|
113
|
+
export type AnimationDef = {
|
|
114
|
+
duration: number;
|
|
115
|
+
fps: number;
|
|
116
|
+
loop: boolean;
|
|
117
|
+
tracks: AnimTrack[];
|
|
118
|
+
};
|
|
119
|
+
export type ParamGroup = {
|
|
120
|
+
id: string;
|
|
121
|
+
label: string;
|
|
122
|
+
/** Optional secondary inspector tab. Groups without one remain visible in every tab. */
|
|
123
|
+
tab?: string;
|
|
124
|
+
defaultOpen?: boolean;
|
|
125
|
+
};
|
|
126
|
+
export type InspectorCategory = {
|
|
127
|
+
id: string;
|
|
128
|
+
label: string;
|
|
129
|
+
};
|
|
130
|
+
export type RendererKind = 'svg' | 'three' | 'html' | 'vector' | 'scene' | 'web';
|
|
131
|
+
export type RigManifest = {
|
|
132
|
+
id: string;
|
|
133
|
+
name: string;
|
|
134
|
+
summary: string;
|
|
135
|
+
description: string;
|
|
136
|
+
renderer: RendererKind;
|
|
137
|
+
rendererLabel: string;
|
|
138
|
+
collection: 'examples' | 'project';
|
|
139
|
+
/** Storybook-style path. Folders are `/` segments; the leaf is `name`. */
|
|
140
|
+
title: string;
|
|
141
|
+
sourceFile: string;
|
|
142
|
+
tags: string[];
|
|
143
|
+
/** Optional second-level navigation for rigs with several families of controls. */
|
|
144
|
+
inspectorCategories?: InspectorCategory[];
|
|
145
|
+
groups: ParamGroup[];
|
|
146
|
+
parameters: ParameterDef[];
|
|
147
|
+
animation?: AnimationDef;
|
|
148
|
+
};
|
|
149
|
+
export type Snapshot = {
|
|
150
|
+
id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
values: Record<string, ParamValue>;
|
|
154
|
+
valueSources?: Record<string, import('./extended-types').ValueSource>;
|
|
155
|
+
tracks?: AnimTrack[];
|
|
156
|
+
loop?: boolean;
|
|
157
|
+
loopRange?: LoopRange | null;
|
|
158
|
+
duration?: number;
|
|
159
|
+
};
|
|
160
|
+
export type ExportDocument = {
|
|
161
|
+
version: 1;
|
|
162
|
+
rigId: string;
|
|
163
|
+
name: string;
|
|
164
|
+
exportedAt: string;
|
|
165
|
+
values: Record<string, ParamValue>;
|
|
166
|
+
valueSources: Record<string, import('./extended-types').ValueSource>;
|
|
167
|
+
animation?: {
|
|
168
|
+
duration: number;
|
|
169
|
+
fps: number;
|
|
170
|
+
loop: boolean;
|
|
171
|
+
playhead: number;
|
|
172
|
+
tracks: AnimTrack[];
|
|
173
|
+
loopRange?: LoopRange | null;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
export type StoredDraft = {
|
|
177
|
+
version: 1;
|
|
178
|
+
rigId: string;
|
|
179
|
+
values: Record<string, ParamValue>;
|
|
180
|
+
valueSources?: Record<string, import('./extended-types').ValueSource>;
|
|
181
|
+
snapshots: Snapshot[];
|
|
182
|
+
compare: 'original' | 'current';
|
|
183
|
+
activeSnapshotId: string | null;
|
|
184
|
+
playhead: number;
|
|
185
|
+
loop: boolean;
|
|
186
|
+
tracks?: AnimTrack[];
|
|
187
|
+
loopRange?: LoopRange | null;
|
|
188
|
+
duration?: number;
|
|
189
|
+
};
|
|
190
|
+
export type PanelPrefs = {
|
|
191
|
+
version: 1;
|
|
192
|
+
navWidth: number;
|
|
193
|
+
inspectorWidth: number;
|
|
194
|
+
timelineHeight: number;
|
|
195
|
+
navCollapsed: boolean;
|
|
196
|
+
navCompact: boolean;
|
|
197
|
+
inspectorCollapsed: boolean;
|
|
198
|
+
timelineCollapsed: boolean;
|
|
199
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import type { ParameterDef, ParamGroup, ParamValue } from '../rigs/types.ts';
|
|
2
|
+
export declare const WEB_PROTOCOL = 1;
|
|
3
|
+
export declare const WEB_CHANNEL = "paramrig.web";
|
|
4
|
+
export type Values = Record<string, ParamValue>;
|
|
5
|
+
export type Point = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
export type Rect = Point & {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
export type TargetKey = {
|
|
14
|
+
id: string;
|
|
15
|
+
instance?: string;
|
|
16
|
+
};
|
|
17
|
+
export type WebBinding = {
|
|
18
|
+
paramId: string;
|
|
19
|
+
scope: 'global' | 'page' | 'element';
|
|
20
|
+
pageId?: string;
|
|
21
|
+
target?: TargetKey;
|
|
22
|
+
kind: 'css-variable' | 'style' | 'adapter';
|
|
23
|
+
property: string;
|
|
24
|
+
unit?: string;
|
|
25
|
+
source?: string;
|
|
26
|
+
};
|
|
27
|
+
export type WebProjectManifest = {
|
|
28
|
+
version: 1;
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
revision: string;
|
|
32
|
+
origin: string;
|
|
33
|
+
pages: {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
path: string;
|
|
37
|
+
}[];
|
|
38
|
+
groups: ParamGroup[];
|
|
39
|
+
parameters: ParameterDef[];
|
|
40
|
+
bindings: WebBinding[];
|
|
41
|
+
};
|
|
42
|
+
export type WebTarget = {
|
|
43
|
+
key: string;
|
|
44
|
+
stable?: TargetKey;
|
|
45
|
+
selector: string;
|
|
46
|
+
fingerprint: string;
|
|
47
|
+
label: string;
|
|
48
|
+
tag: string;
|
|
49
|
+
source?: string;
|
|
50
|
+
pageId: string;
|
|
51
|
+
rect: Rect;
|
|
52
|
+
clip?: Rect;
|
|
53
|
+
ancestors: {
|
|
54
|
+
key: string;
|
|
55
|
+
label: string;
|
|
56
|
+
stable?: TargetKey;
|
|
57
|
+
}[];
|
|
58
|
+
status: 'resolved' | 'provisional' | 'missing' | 'ambiguous';
|
|
59
|
+
/** How many of the manifest's controls reach this element. Absent means none were counted. */
|
|
60
|
+
controls?: number;
|
|
61
|
+
};
|
|
62
|
+
/** Colours the host hands the page so the overlay follows the workbench theme. */
|
|
63
|
+
export type WebChrome = {
|
|
64
|
+
outline: string;
|
|
65
|
+
chip: string;
|
|
66
|
+
chipText: string;
|
|
67
|
+
};
|
|
68
|
+
export type WebContext = {
|
|
69
|
+
pageId: string;
|
|
70
|
+
url: string;
|
|
71
|
+
viewport: {
|
|
72
|
+
width: number;
|
|
73
|
+
height: number;
|
|
74
|
+
dpr: number;
|
|
75
|
+
};
|
|
76
|
+
scroll: Point;
|
|
77
|
+
scrollers: {
|
|
78
|
+
target: WebTarget;
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
export type MarkTool = 'note' | 'arrow' | 'rectangle' | 'ellipse' | 'highlight' | 'pen';
|
|
84
|
+
export type WebMark = {
|
|
85
|
+
id: string;
|
|
86
|
+
tool: MarkTool;
|
|
87
|
+
color: string;
|
|
88
|
+
width: number;
|
|
89
|
+
points: Point[];
|
|
90
|
+
/** Element marks use fractions of its box; free marks use document CSS pixels. */
|
|
91
|
+
targetKey?: string;
|
|
92
|
+
pageId: string;
|
|
93
|
+
viewport: {
|
|
94
|
+
width: number;
|
|
95
|
+
height: number;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export type Capture = {
|
|
99
|
+
id: string;
|
|
100
|
+
kind: 'dom' | 'screen';
|
|
101
|
+
createdAt: string;
|
|
102
|
+
status: 'ready' | 'failed';
|
|
103
|
+
file?: string;
|
|
104
|
+
note: string;
|
|
105
|
+
/** Offline recovery only; removed once the capture has been saved to disk. */
|
|
106
|
+
dataUrl?: string;
|
|
107
|
+
};
|
|
108
|
+
export type TicketStatus = 'draft' | 'todo' | 'review' | 'validated' | 'clarification';
|
|
109
|
+
export type WebTicket = {
|
|
110
|
+
id: string;
|
|
111
|
+
/** The number a person sees. Assigned once and never reused, so removals do not renumber. */
|
|
112
|
+
number?: number;
|
|
113
|
+
comment: string;
|
|
114
|
+
status: TicketStatus;
|
|
115
|
+
revision: string;
|
|
116
|
+
createdAt: string;
|
|
117
|
+
context: WebContext;
|
|
118
|
+
targets: WebTarget[];
|
|
119
|
+
marks: WebMark[];
|
|
120
|
+
captures: Capture[];
|
|
121
|
+
batchId?: string;
|
|
122
|
+
response?: string;
|
|
123
|
+
responseRevision?: string;
|
|
124
|
+
};
|
|
125
|
+
export type ValueConflict = {
|
|
126
|
+
id: string;
|
|
127
|
+
before?: ParamValue;
|
|
128
|
+
chosen: ParamValue;
|
|
129
|
+
source?: ParamValue;
|
|
130
|
+
removed: boolean;
|
|
131
|
+
};
|
|
132
|
+
export type WebSnapshot = {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
revision: string;
|
|
136
|
+
values: Values;
|
|
137
|
+
};
|
|
138
|
+
export type WebDraft = {
|
|
139
|
+
version: 1;
|
|
140
|
+
projectId: string;
|
|
141
|
+
sourceRevision: string;
|
|
142
|
+
sourceValues: Values;
|
|
143
|
+
values: Values;
|
|
144
|
+
tickets: WebTicket[];
|
|
145
|
+
snapshots: WebSnapshot[];
|
|
146
|
+
conflicts: ValueConflict[];
|
|
147
|
+
handledResponses: string[];
|
|
148
|
+
};
|
|
149
|
+
export type FeedbackBatch = {
|
|
150
|
+
version: 1;
|
|
151
|
+
id: string;
|
|
152
|
+
projectId: string;
|
|
153
|
+
sourceRevision: string;
|
|
154
|
+
createdAt: string;
|
|
155
|
+
values: Values;
|
|
156
|
+
changes: {
|
|
157
|
+
paramId: string;
|
|
158
|
+
label: string;
|
|
159
|
+
before: ParamValue;
|
|
160
|
+
after: ParamValue;
|
|
161
|
+
bindings: WebBinding[];
|
|
162
|
+
}[];
|
|
163
|
+
tickets: WebTicket[];
|
|
164
|
+
};
|
|
165
|
+
export type AgentResponse = {
|
|
166
|
+
version: 1;
|
|
167
|
+
id: string;
|
|
168
|
+
batchId: string;
|
|
169
|
+
projectId: string;
|
|
170
|
+
sourceRevision: string;
|
|
171
|
+
resultRevision: string;
|
|
172
|
+
createdAt: string;
|
|
173
|
+
tickets: {
|
|
174
|
+
id: string;
|
|
175
|
+
status: 'implemented' | 'needs-info';
|
|
176
|
+
message: string;
|
|
177
|
+
}[];
|
|
178
|
+
summary: string;
|
|
179
|
+
};
|
|
180
|
+
export type HostCommand = {
|
|
181
|
+
type: 'hello';
|
|
182
|
+
projectId: string;
|
|
183
|
+
} | {
|
|
184
|
+
type: 'configure';
|
|
185
|
+
mode: 'browse' | 'select' | 'annotate';
|
|
186
|
+
tool: MarkTool;
|
|
187
|
+
color: string;
|
|
188
|
+
targets: WebTarget[];
|
|
189
|
+
marks: WebMark[];
|
|
190
|
+
activeTarget?: string;
|
|
191
|
+
activeTargets?: string[];
|
|
192
|
+
activeMarks?: string[];
|
|
193
|
+
displayScale?: number;
|
|
194
|
+
chrome?: WebChrome;
|
|
195
|
+
} | {
|
|
196
|
+
type: 'values';
|
|
197
|
+
values: Values;
|
|
198
|
+
source: boolean;
|
|
199
|
+
} | {
|
|
200
|
+
type: 'select';
|
|
201
|
+
target: WebTarget;
|
|
202
|
+
} | {
|
|
203
|
+
type: 'reveal-target';
|
|
204
|
+
target: WebTarget;
|
|
205
|
+
} | {
|
|
206
|
+
type: 'restore-context';
|
|
207
|
+
context: WebContext;
|
|
208
|
+
} | {
|
|
209
|
+
type: 'navigate';
|
|
210
|
+
path: string;
|
|
211
|
+
} | {
|
|
212
|
+
type: 'capture';
|
|
213
|
+
requestId: string;
|
|
214
|
+
};
|
|
215
|
+
export type SDKEvent = {
|
|
216
|
+
type: 'ready';
|
|
217
|
+
instanceId: string;
|
|
218
|
+
manifest: WebProjectManifest;
|
|
219
|
+
sourceValues: Values;
|
|
220
|
+
context: WebContext;
|
|
221
|
+
} | {
|
|
222
|
+
type: 'scene';
|
|
223
|
+
context: WebContext;
|
|
224
|
+
targets: WebTarget[];
|
|
225
|
+
page?: WebTarget[];
|
|
226
|
+
} | {
|
|
227
|
+
type: 'selection';
|
|
228
|
+
target: WebTarget;
|
|
229
|
+
additive: boolean;
|
|
230
|
+
} | {
|
|
231
|
+
type: 'comment';
|
|
232
|
+
target: WebTarget;
|
|
233
|
+
} | {
|
|
234
|
+
type: 'exit-tool';
|
|
235
|
+
} | {
|
|
236
|
+
type: 'mark';
|
|
237
|
+
mark: WebMark;
|
|
238
|
+
target?: WebTarget;
|
|
239
|
+
context: WebContext;
|
|
240
|
+
} | {
|
|
241
|
+
type: 'capture';
|
|
242
|
+
requestId: string;
|
|
243
|
+
dataUrl?: string;
|
|
244
|
+
error?: string;
|
|
245
|
+
} | {
|
|
246
|
+
type: 'error';
|
|
247
|
+
message: string;
|
|
248
|
+
} | {
|
|
249
|
+
type: 'history';
|
|
250
|
+
direction: 'undo' | 'redo';
|
|
251
|
+
};
|
|
252
|
+
export type Envelope<T> = {
|
|
253
|
+
channel: typeof WEB_CHANNEL;
|
|
254
|
+
version: number;
|
|
255
|
+
sessionId: string;
|
|
256
|
+
payload: T;
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* The frame the SDK sends the moment it starts listening, before any session exists.
|
|
260
|
+
* It carries no session ID, so it is deliberately not an envelope: the host answers it with
|
|
261
|
+
* `hello` and every later message is checked against the session that handshake opened.
|
|
262
|
+
*/
|
|
263
|
+
export type SDKAnnouncement = {
|
|
264
|
+
channel: typeof WEB_CHANNEL;
|
|
265
|
+
version: number;
|
|
266
|
+
type: 'sdk-present';
|
|
267
|
+
projectId: string;
|
|
268
|
+
instanceId: string;
|
|
269
|
+
};
|
|
270
|
+
export declare function record(value: unknown): value is Record<string, unknown>;
|
|
271
|
+
export declare function safeId(value: unknown): value is string;
|
|
272
|
+
export declare function isValues(value: unknown): value is Values;
|
|
273
|
+
export declare function parseManifest(value: unknown): WebProjectManifest;
|
|
274
|
+
export declare function isTarget(v: unknown): v is WebTarget;
|
|
275
|
+
export declare function isChrome(v: unknown): v is WebChrome;
|
|
276
|
+
export declare function isContext(v: unknown): v is WebContext;
|
|
277
|
+
export declare function isMark(v: unknown): v is WebMark;
|
|
278
|
+
export declare function isTicket(v: unknown): v is WebTicket;
|
|
279
|
+
export declare function isDraft(v: unknown): v is WebDraft;
|
|
280
|
+
export declare function isBatch(v: unknown): v is FeedbackBatch;
|
|
281
|
+
export declare function isResponse(v: unknown): v is AgentResponse;
|
|
282
|
+
export declare function envelope<T>(sessionId: string, payload: T): Envelope<T>;
|
|
283
|
+
export declare function announcement(projectId: string, instanceId: string): SDKAnnouncement;
|
|
284
|
+
export declare function isAnnouncement(v: unknown): v is SDKAnnouncement;
|
|
285
|
+
export declare function isEnvelope(v: unknown): v is Envelope<Record<string, unknown>>;
|
|
286
|
+
export declare function isCommand(p: Record<string, unknown>): boolean;
|
|
287
|
+
export declare function isEvent(p: Record<string, unknown>): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Point, Rect, WebMark, WebTarget } from './contracts.ts';
|
|
2
|
+
export declare function markPoints(mark: WebMark, targets: WebTarget[], scroll: Point): Point[] | null;
|
|
3
|
+
export declare function storedPoint(point: Point, target: WebTarget | undefined, scroll: Point): Point;
|
|
4
|
+
export declare function bounds(points: Point[]): Rect;
|
|
5
|
+
export declare function pathForMark(mark: WebMark, points: Point[]): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type WebProjectManifest } from './contracts.ts';
|
|
2
|
+
import type { ParamValue } from '../rigs/types.ts';
|
|
3
|
+
export { parseManifest } from './contracts.ts';
|
|
4
|
+
export type { WebProjectManifest, WebBinding, WebTarget, FeedbackBatch, AgentResponse } from './contracts.ts';
|
|
5
|
+
export type { ParameterDef, ParamValue } from '../rigs/types.ts';
|
|
6
|
+
export type WebAdapter = {
|
|
7
|
+
read: () => ParamValue;
|
|
8
|
+
apply: (value: ParamValue) => void;
|
|
9
|
+
restore: () => void;
|
|
10
|
+
};
|
|
11
|
+
export type ConnectWebOptions = {
|
|
12
|
+
manifest: WebProjectManifest;
|
|
13
|
+
hostOrigin?: string | readonly string[];
|
|
14
|
+
adapters?: Record<string, WebAdapter>;
|
|
15
|
+
};
|
|
16
|
+
/** Where the workbench runs by default. Both aliases, because a browser reaches it by either. */
|
|
17
|
+
export declare const DEFAULT_HOST_ORIGINS: readonly string[];
|
|
18
|
+
export declare function connectWeb({ manifest: rawManifest, hostOrigin, adapters }: ConnectWebOptions): {
|
|
19
|
+
dispose(): void;
|
|
20
|
+
};
|