@jarenjs/studio 0.83.3 → 0.85.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 +21 -6
- package/contracts/data.contract.json +243 -0
- package/dist/types/component/data/actions.d.ts +234 -0
- package/dist/types/component/data/index.d.ts +9 -0
- package/dist/types/component/data/mount.d.ts +87 -0
- package/dist/types/component/data/project-widget.d.ts +27 -0
- package/dist/types/component/data/viewmodel.d.ts +85 -0
- package/dist/types/component/data/views.d.ts +148 -0
- package/dist/types/component/document.d.ts +82 -0
- package/dist/types/component/flow/actions.d.ts +708 -0
- package/dist/types/component/flow/index.d.ts +7 -0
- package/dist/types/component/flow/mount.d.ts +66 -0
- package/dist/types/component/flow/project-widget.d.ts +8 -0
- package/dist/types/component/flow/runtime.d.ts +57 -0
- package/dist/types/component/flow/views.d.ts +242 -0
- package/dist/types/component/host.d.ts +2 -2
- package/dist/types/component/index.d.ts +21 -15
- package/dist/types/component/mount.d.ts +51 -0
- package/dist/types/component/project-actions.d.ts +302 -0
- package/dist/types/component/project-controller.d.ts +81 -0
- package/dist/types/component/project-state.d.ts +1 -0
- package/dist/types/component/project.d.ts +327 -0
- package/dist/types/component/shared/host-widget.d.ts +24 -0
- package/dist/types/component/shared/memo.d.ts +12 -0
- package/dist/types/component/shared/nodes.d.ts +92 -0
- package/dist/types/component/shared/schema-options.d.ts +28 -0
- package/dist/types/component/shared/studio-kit.d.ts +78 -0
- package/dist/types/component/shared/ui.d.ts +136 -0
- package/dist/types/component/view.d.ts +6 -6
- package/dist/types/data/boot-stages.d.ts +97 -0
- package/dist/types/data/browser-worker.d.ts +22 -0
- package/dist/types/data/contract.d.ts +9 -0
- package/dist/types/data/editor.d.ts +81 -0
- package/dist/types/data/handlers.d.ts +130 -0
- package/dist/types/data/host.d.ts +8 -0
- package/dist/types/data/project-worker.d.ts +8 -0
- package/dist/types/data/runtime.d.ts +46 -0
- package/dist/types/data/state.d.ts +33 -0
- package/dist/types/data/storage.d.ts +26 -0
- package/dist/types/data/transport.d.ts +69 -0
- package/dist/types/flow-document.d.ts +19 -0
- package/dist/types/flow-editor.d.ts +88 -0
- package/docs/EDITORS.md +158 -0
- package/docs/PROJECT-FORMAT.md +1 -11
- package/package.json +32 -15
- package/src/component/data/actions.js +138 -0
- package/src/component/data/index.js +10 -0
- package/src/component/data/mount.js +63 -0
- package/src/component/data/project-widget.js +164 -0
- package/src/component/data/viewmodel.js +185 -0
- package/src/component/data/views.js +241 -0
- package/src/component/document.js +344 -0
- package/src/component/flow/actions.js +331 -0
- package/src/component/flow/index.js +8 -0
- package/src/component/flow/mount.js +53 -0
- package/src/component/flow/project-widget.js +44 -0
- package/src/component/flow/runtime.js +481 -0
- package/src/component/flow/views.js +196 -0
- package/src/component/host.js +2 -2
- package/src/component/index.js +19 -9
- package/src/component/mount.js +43 -0
- package/src/component/project-actions.js +189 -0
- package/src/component/project-controller.js +248 -0
- package/src/component/project-state.js +30 -0
- package/src/component/project.js +308 -0
- package/src/component/shared/host-widget.js +35 -0
- package/src/component/shared/memo.js +28 -0
- package/src/component/shared/nodes.js +94 -0
- package/src/component/shared/schema-options.js +30 -0
- package/src/component/shared/studio-kit.js +59 -0
- package/src/component/shared/ui.js +134 -0
- package/src/data/boot-stages.js +202 -0
- package/src/data/browser-worker.js +247 -0
- package/src/data/contract.js +7 -0
- package/src/data/editor.js +95 -0
- package/src/data/handlers.js +349 -0
- package/src/data/host.js +8 -0
- package/src/data/project-worker.js +26 -0
- package/src/data/runtime.js +462 -0
- package/src/data/state.js +46 -0
- package/src/data/storage.js +61 -0
- package/src/data/transport.js +215 -0
- package/src/flow-document.js +24 -0
- package/src/flow-editor.js +98 -0
- package/styles/data.css +53 -0
- package/styles/editor.css +150 -0
- package/styles/flow.css +99 -0
- package/styles/studio.css +1 -0
- package/dist/types/author.d.ts +0 -27
- package/src/author.js +0 -55
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** Assemble the shared Flow component. The public mount exposes only document operations. */
|
|
2
|
+
import { createApp } from '@jarenjs/app';
|
|
3
|
+
import { createFlowController } from '../../flow-editor.js';
|
|
4
|
+
/** @param {HTMLElement|null} node @param {any} options
|
|
5
|
+
* @returns {{ app: ReturnType<typeof createApp>, editor: Pick<ReturnType<typeof createFlowController>, 'read'|'validate'|'replace'|'apply'|'run'|'subscribe'|'dispose'> }} */
|
|
6
|
+
export declare function createFlowEditor(node: HTMLElement | null, options: any): {
|
|
7
|
+
app: ReturnType<typeof createApp>;
|
|
8
|
+
editor: Pick<ReturnType<typeof createFlowController>, 'read' | 'validate' | 'replace' | 'apply' | 'run' | 'subscribe' | 'dispose'>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param {HTMLElement|null} node
|
|
12
|
+
* @param {{ kind?: 'fsm'|'dag'|null, document?: any, input?: any, templates?: any[],
|
|
13
|
+
* template?: (name: string) => any, tasks?: Record<string, Function>,
|
|
14
|
+
* schedule?: (flush: () => void) => void, onError?: (error: Error) => void }} [options]
|
|
15
|
+
*/
|
|
16
|
+
export declare function mountFlowEditor(node: HTMLElement | null, options?: {
|
|
17
|
+
kind?: 'fsm' | 'dag' | null;
|
|
18
|
+
document?: any;
|
|
19
|
+
input?: any;
|
|
20
|
+
templates?: any[];
|
|
21
|
+
template?: (name: string) => any;
|
|
22
|
+
tasks?: Record<string, Function>;
|
|
23
|
+
schedule?: (flush: () => void) => void;
|
|
24
|
+
onError?: (error: Error) => void;
|
|
25
|
+
}): Pick<{
|
|
26
|
+
read: () => import("../../flow-editor.js").FlowSnapshot;
|
|
27
|
+
validate: (candidate: any, kind?: 'fsm' | 'dag') => {
|
|
28
|
+
valid: boolean;
|
|
29
|
+
kind: string;
|
|
30
|
+
total: number;
|
|
31
|
+
errors: Array<{
|
|
32
|
+
code: string | null;
|
|
33
|
+
message: string;
|
|
34
|
+
docPath?: string;
|
|
35
|
+
}>;
|
|
36
|
+
} | {
|
|
37
|
+
valid: boolean;
|
|
38
|
+
errors: {
|
|
39
|
+
code: any;
|
|
40
|
+
message: any;
|
|
41
|
+
docPath: any;
|
|
42
|
+
}[];
|
|
43
|
+
};
|
|
44
|
+
replace: (candidate: any, options?: {
|
|
45
|
+
expectedRevision?: string;
|
|
46
|
+
kind?: 'fsm' | 'dag';
|
|
47
|
+
}) => Promise<import("../../flow-editor.js").EditorReceipt>;
|
|
48
|
+
apply: (patch: Parameters<typeof import("@jarenjs/json").applyJSONPatch>[1], options?: {
|
|
49
|
+
expectedRevision?: string;
|
|
50
|
+
kind?: 'fsm' | 'dag';
|
|
51
|
+
}) => Promise<import("../../flow-editor.js").EditorReceipt>;
|
|
52
|
+
run: (options?: {
|
|
53
|
+
input?: any;
|
|
54
|
+
event?: string;
|
|
55
|
+
}) => Promise<import("../../flow-editor.js").EditorReceipt>;
|
|
56
|
+
subscribe: (listener: (snapshot: import("../../flow-editor.js").FlowSnapshot) => void) => () => void;
|
|
57
|
+
attach: () => void;
|
|
58
|
+
effects: {
|
|
59
|
+
'flow-accepted': (id: any) => void;
|
|
60
|
+
'flow-refused': (id: any) => void;
|
|
61
|
+
'flow-editor-run': ((props: any, dispatch: any) => Promise<void>) & {
|
|
62
|
+
dispose: () => void;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
dispose: () => void;
|
|
66
|
+
}, "apply" | "dispose" | "read" | "replace" | "run" | "subscribe" | "validate">;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Read a JSON Pointer from a document (the inspector's selection). */
|
|
2
|
+
export declare function memberAt(doc: any, pointer: any): any;
|
|
3
|
+
/** @param {'fsm'|'dag'} kind @param {any} doc @returns {string} */
|
|
4
|
+
export declare function flowText(kind: 'fsm' | 'dag', doc: any): string;
|
|
5
|
+
/**
|
|
6
|
+
* The text pane is read-only when the document carries members the
|
|
7
|
+
* diagram text cannot represent — committing an edit would silently
|
|
8
|
+
* destroy them (APP-INTEGRATION honesty rule, MERMAID-FORMAT §5.1).
|
|
9
|
+
* @param {'fsm'|'dag'} kind @param {any} doc
|
|
10
|
+
* @returns {string|null} the human explanation, or null when editable
|
|
11
|
+
*/
|
|
12
|
+
export declare function textLossReason(kind: 'fsm' | 'dag', doc: any): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* @param {any} flow - the `state.flow` slice
|
|
15
|
+
* @returns {any} the `$.ui.flow` node
|
|
16
|
+
*/
|
|
17
|
+
export declare function flowPageViewModel(flow: any, templates?: any[]): any;
|
|
18
|
+
/**
|
|
19
|
+
* The Flow studio runtime: the nested-app host widget for machine runs
|
|
20
|
+
* and the effect registry (template loading, fail-closed text parsing,
|
|
21
|
+
* machine sends, dag runs with abort). One closure ref ties the
|
|
22
|
+
* running instances to their effects.
|
|
23
|
+
* @param {{ schedule?: any, template?: (name: string) => any, tasks?: Record<string, Function>, getFlow?: () => any, mintFromCount?: boolean }} [env]
|
|
24
|
+
*/
|
|
25
|
+
export declare function createFlowRuntime(env?: {
|
|
26
|
+
schedule?: any;
|
|
27
|
+
template?: (name: string) => any;
|
|
28
|
+
tasks?: Record<string, Function>;
|
|
29
|
+
getFlow?: () => any;
|
|
30
|
+
mintFromCount?: boolean;
|
|
31
|
+
}): {
|
|
32
|
+
widget: {
|
|
33
|
+
mount: Function;
|
|
34
|
+
update: Function;
|
|
35
|
+
unmount: Function;
|
|
36
|
+
};
|
|
37
|
+
effects: {
|
|
38
|
+
'flow-mint': (props: any, dispatch: any) => void;
|
|
39
|
+
'flow-template': (props: any, dispatch: any) => void;
|
|
40
|
+
'flow-parse': (props: any, dispatch: any) => void;
|
|
41
|
+
'flow-run-send': (props: any) => void;
|
|
42
|
+
'flow-dag-run': (props: any, dispatch: any) => Promise<{
|
|
43
|
+
ok: boolean;
|
|
44
|
+
error: string;
|
|
45
|
+
output?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
error?: undefined;
|
|
48
|
+
ok: boolean;
|
|
49
|
+
output: any;
|
|
50
|
+
} | {
|
|
51
|
+
ok: boolean;
|
|
52
|
+
error: string;
|
|
53
|
+
}>;
|
|
54
|
+
'flow-dag-abort': () => void;
|
|
55
|
+
};
|
|
56
|
+
dispose: () => void;
|
|
57
|
+
};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Flow studio — mode 'flow', dispatched with `$.ui.flow` as the
|
|
3
|
+
* current node. One jaren-fsm or jaren-dag document, edited three ways
|
|
4
|
+
* that cannot disagree: clicking the diagram (every gesture an RFC 6902
|
|
5
|
+
* patch), the forms-generated inspector, and the mermaid text pane —
|
|
6
|
+
* plus a live run mode where the same document boots a nested
|
|
7
|
+
* @jarenjs/app (machines) or a compileDag run (dataflow).
|
|
8
|
+
*
|
|
9
|
+
* The stylesheet renders derived projections only; the document itself
|
|
10
|
+
* lives at `state.flow.doc` and every mutation goes through the
|
|
11
|
+
* actions' patches — no pane owns private truth.
|
|
12
|
+
*
|
|
13
|
+
* Below the breakpoint the three cards become one pane at a time behind
|
|
14
|
+
* the shared segmented switcher (Diagram · Inspector · Run); selecting
|
|
15
|
+
* a node jumps to the inspector and running jumps to the run pane, so a
|
|
16
|
+
* phone never leaves the user looking at the pane they just left.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FLOW_RULES: ({
|
|
19
|
+
match: string;
|
|
20
|
+
mode: string;
|
|
21
|
+
body: (string | {
|
|
22
|
+
$apply?: undefined;
|
|
23
|
+
class: string;
|
|
24
|
+
} | {
|
|
25
|
+
$apply: string;
|
|
26
|
+
class?: undefined;
|
|
27
|
+
})[];
|
|
28
|
+
} | {
|
|
29
|
+
match: string;
|
|
30
|
+
mode: string;
|
|
31
|
+
body: (string | (string | {
|
|
32
|
+
$apply: string;
|
|
33
|
+
}[] | {
|
|
34
|
+
class: string;
|
|
35
|
+
})[] | {
|
|
36
|
+
key: string;
|
|
37
|
+
})[];
|
|
38
|
+
} | {
|
|
39
|
+
match: string;
|
|
40
|
+
mode: string;
|
|
41
|
+
body: (string | (string | {}[] | (string | {
|
|
42
|
+
type: string;
|
|
43
|
+
class: string;
|
|
44
|
+
on: {
|
|
45
|
+
click: {
|
|
46
|
+
action: string;
|
|
47
|
+
with: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
})[] | {
|
|
51
|
+
class: string;
|
|
52
|
+
})[] | {
|
|
53
|
+
class: string;
|
|
54
|
+
})[];
|
|
55
|
+
} | {
|
|
56
|
+
match: string;
|
|
57
|
+
mode: string;
|
|
58
|
+
body: (string | (string | (string | {
|
|
59
|
+
type: string;
|
|
60
|
+
class: {
|
|
61
|
+
$if: (string | {
|
|
62
|
+
$eq: string[];
|
|
63
|
+
})[];
|
|
64
|
+
};
|
|
65
|
+
'aria-pressed': {
|
|
66
|
+
$if: (string | {
|
|
67
|
+
$eq: string[];
|
|
68
|
+
})[];
|
|
69
|
+
};
|
|
70
|
+
on: {
|
|
71
|
+
click: {
|
|
72
|
+
action: string;
|
|
73
|
+
with: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
})[] | {
|
|
77
|
+
class: string;
|
|
78
|
+
role: string;
|
|
79
|
+
'aria-label': string;
|
|
80
|
+
})[] | (string | (string | (string | {}[] | {
|
|
81
|
+
class: string;
|
|
82
|
+
})[] | {
|
|
83
|
+
key: string;
|
|
84
|
+
class: string;
|
|
85
|
+
$if?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
key?: undefined;
|
|
88
|
+
$if: (string | (string | {
|
|
89
|
+
key: string;
|
|
90
|
+
$if?: undefined;
|
|
91
|
+
} | {
|
|
92
|
+
key?: undefined;
|
|
93
|
+
$if: (string | {}[] | {}[])[];
|
|
94
|
+
})[] | (string | (string | {
|
|
95
|
+
class: string;
|
|
96
|
+
rows: number;
|
|
97
|
+
spellcheck: string;
|
|
98
|
+
value: string;
|
|
99
|
+
on: {
|
|
100
|
+
input: string;
|
|
101
|
+
change: string;
|
|
102
|
+
};
|
|
103
|
+
})[] | (string | (string | {
|
|
104
|
+
type: string;
|
|
105
|
+
class: string;
|
|
106
|
+
on: {
|
|
107
|
+
click: string;
|
|
108
|
+
};
|
|
109
|
+
})[] | {
|
|
110
|
+
class: string;
|
|
111
|
+
$if?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
$if: (string | (string | {
|
|
114
|
+
type: string;
|
|
115
|
+
class: string;
|
|
116
|
+
on: {
|
|
117
|
+
click: string;
|
|
118
|
+
};
|
|
119
|
+
})[])[];
|
|
120
|
+
class?: undefined;
|
|
121
|
+
})[] | {
|
|
122
|
+
key: string;
|
|
123
|
+
$if?: undefined;
|
|
124
|
+
} | {
|
|
125
|
+
key?: undefined;
|
|
126
|
+
$if: (string | (string | (string | {
|
|
127
|
+
$for: {
|
|
128
|
+
l: string;
|
|
129
|
+
};
|
|
130
|
+
$return: (string | {
|
|
131
|
+
class: string;
|
|
132
|
+
})[];
|
|
133
|
+
}[] | {
|
|
134
|
+
class: string;
|
|
135
|
+
})[] | {
|
|
136
|
+
$if?: undefined;
|
|
137
|
+
} | {
|
|
138
|
+
$if: (string | (string | {}[] | {
|
|
139
|
+
class: string;
|
|
140
|
+
})[])[];
|
|
141
|
+
})[])[];
|
|
142
|
+
})[])[];
|
|
143
|
+
class?: undefined;
|
|
144
|
+
})[] | (string | (string | {}[] | {
|
|
145
|
+
class: string;
|
|
146
|
+
$if?: undefined;
|
|
147
|
+
} | {
|
|
148
|
+
$if: (string | (string | {
|
|
149
|
+
class: string;
|
|
150
|
+
})[])[];
|
|
151
|
+
class?: undefined;
|
|
152
|
+
})[] | {
|
|
153
|
+
key: string;
|
|
154
|
+
class: string;
|
|
155
|
+
$if?: undefined;
|
|
156
|
+
} | {
|
|
157
|
+
key?: undefined;
|
|
158
|
+
$if: (string | (string | {
|
|
159
|
+
class: string;
|
|
160
|
+
})[] | (string | {
|
|
161
|
+
key: string;
|
|
162
|
+
$apply?: undefined;
|
|
163
|
+
} | {
|
|
164
|
+
key?: undefined;
|
|
165
|
+
$apply: string;
|
|
166
|
+
})[])[];
|
|
167
|
+
class?: undefined;
|
|
168
|
+
})[] | {
|
|
169
|
+
key: string;
|
|
170
|
+
class: string;
|
|
171
|
+
})[] | (string | (string | (string | {
|
|
172
|
+
type: string;
|
|
173
|
+
class: {
|
|
174
|
+
$if: (string | {
|
|
175
|
+
$eq: string[];
|
|
176
|
+
})[];
|
|
177
|
+
};
|
|
178
|
+
on: {
|
|
179
|
+
click: {
|
|
180
|
+
action: string;
|
|
181
|
+
with: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
})[] | {
|
|
185
|
+
class: string;
|
|
186
|
+
})[] | (string | (string | {
|
|
187
|
+
$if?: undefined;
|
|
188
|
+
} | {
|
|
189
|
+
$if: string[];
|
|
190
|
+
})[] | (string | any[] | {
|
|
191
|
+
class: string;
|
|
192
|
+
$if?: undefined;
|
|
193
|
+
} | {
|
|
194
|
+
$if: (string | any[])[];
|
|
195
|
+
class?: undefined;
|
|
196
|
+
})[] | {
|
|
197
|
+
class: string;
|
|
198
|
+
})[] | {
|
|
199
|
+
key: string;
|
|
200
|
+
class: string;
|
|
201
|
+
$if?: undefined;
|
|
202
|
+
} | {
|
|
203
|
+
$if: ((string | {
|
|
204
|
+
key: string;
|
|
205
|
+
class: string;
|
|
206
|
+
})[] | (string | (string | {
|
|
207
|
+
class: string;
|
|
208
|
+
rows: number;
|
|
209
|
+
spellcheck: string;
|
|
210
|
+
value: string;
|
|
211
|
+
readonly: {
|
|
212
|
+
$if: (string | boolean)[];
|
|
213
|
+
};
|
|
214
|
+
on: {
|
|
215
|
+
change: string;
|
|
216
|
+
};
|
|
217
|
+
})[] | {
|
|
218
|
+
key: string;
|
|
219
|
+
$if?: undefined;
|
|
220
|
+
} | {
|
|
221
|
+
key?: undefined;
|
|
222
|
+
$if: (string | (string | {
|
|
223
|
+
class: string;
|
|
224
|
+
})[])[];
|
|
225
|
+
})[] | {
|
|
226
|
+
$eq: string[];
|
|
227
|
+
})[];
|
|
228
|
+
key?: undefined;
|
|
229
|
+
class?: undefined;
|
|
230
|
+
} | {
|
|
231
|
+
key?: undefined;
|
|
232
|
+
$if: (string | (string | {
|
|
233
|
+
class: string;
|
|
234
|
+
})[])[];
|
|
235
|
+
class?: undefined;
|
|
236
|
+
})[] | {
|
|
237
|
+
key: string;
|
|
238
|
+
class: string;
|
|
239
|
+
'data-pane': string;
|
|
240
|
+
})[];
|
|
241
|
+
})[];
|
|
242
|
+
export declare const FLOW_FORM_RULES: any[];
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* is skipped.
|
|
9
9
|
*
|
|
10
10
|
* `reconcileBuffer` (editor buffer ↔ document): a CLEAN buffer adopts an
|
|
11
|
-
* incoming write (share / undo / an
|
|
11
|
+
* incoming write (share / undo / an external edit lands); a DIRTY buffer whose
|
|
12
12
|
* text differs from the incoming write keeps the human's text and records
|
|
13
13
|
* the write as a recoverable draft — never a silent clobber, never a
|
|
14
14
|
* hidden write.
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
export declare function hostPolicy(prevProject: any, nextProject: any): Record<string, 'reboot' | 'hot' | 'skip'>;
|
|
25
25
|
/**
|
|
26
26
|
* Reconcile the editor's local typing buffer against an incoming
|
|
27
|
-
* committed text (a share/undo restore, or an
|
|
27
|
+
* committed text (a share/undo restore, or an external write onto the same
|
|
28
28
|
* file). A clean buffer adopts; a dirty buffer that already matches the
|
|
29
29
|
* incoming text simply clears (the commit landed); a dirty buffer that
|
|
30
30
|
* differs keeps the human's text and surfaces the incoming version as a
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* the JSLT view (`rules` + `mode`), the derivation (`viewModel`), the two
|
|
6
|
-
* hard-problem policies (`hostPolicy`, `reconcileBuffer`), and the engine
|
|
7
|
-
* surface. The reducer `project/*` actions, the DOM stage/splitter
|
|
8
|
-
* widgets, and the live site mount are wired at the host; the chrome and
|
|
9
|
-
* its derivation — everything renderable without a DOM — live here and
|
|
10
|
-
* are tested headlessly.
|
|
2
|
+
* The complete project editor and composable host pieces. A host can mount
|
|
3
|
+
* the editor directly, or compose the same actions, projections and controller
|
|
4
|
+
* into its application. Preview runners, templates and storage are injected.
|
|
11
5
|
*/
|
|
12
6
|
import { classifyChange, parseProject } from '../index.js';
|
|
13
7
|
import { projectViewModel } from './viewmodel.js';
|
|
@@ -75,13 +69,12 @@ export declare function createStudioComponent(options?: {
|
|
|
75
69
|
class: string;
|
|
76
70
|
$if?: undefined;
|
|
77
71
|
} | {
|
|
78
|
-
class?: undefined;
|
|
79
72
|
$if: (string | (string | {
|
|
80
73
|
class: string;
|
|
81
74
|
role: string;
|
|
82
75
|
})[])[];
|
|
83
|
-
} | {
|
|
84
76
|
class?: undefined;
|
|
77
|
+
} | {
|
|
85
78
|
$if: ((string | (string | {
|
|
86
79
|
name: {
|
|
87
80
|
$default: string[];
|
|
@@ -90,12 +83,12 @@ export declare function createStudioComponent(options?: {
|
|
|
90
83
|
})[] | {
|
|
91
84
|
class: string;
|
|
92
85
|
})[] | {
|
|
93
|
-
$if?: undefined;
|
|
94
86
|
$eq: string[];
|
|
87
|
+
$if?: undefined;
|
|
95
88
|
} | {
|
|
96
89
|
$if: ({
|
|
97
|
-
$if?: undefined;
|
|
98
90
|
$eq: string[];
|
|
91
|
+
$if?: undefined;
|
|
99
92
|
} | {
|
|
100
93
|
$eq?: undefined;
|
|
101
94
|
$if: (string | (string | {
|
|
@@ -113,6 +106,7 @@ export declare function createStudioComponent(options?: {
|
|
|
113
106
|
})[];
|
|
114
107
|
$eq?: undefined;
|
|
115
108
|
})[];
|
|
109
|
+
class?: undefined;
|
|
116
110
|
})[] | (string | (string | {
|
|
117
111
|
class: string;
|
|
118
112
|
type: string;
|
|
@@ -235,7 +229,6 @@ export declare function createStudioComponent(options?: {
|
|
|
235
229
|
})[] | (string | {
|
|
236
230
|
class: string;
|
|
237
231
|
})[] | {
|
|
238
|
-
$if?: undefined;
|
|
239
232
|
type: string;
|
|
240
233
|
class: {
|
|
241
234
|
$if: string[];
|
|
@@ -247,8 +240,8 @@ export declare function createStudioComponent(options?: {
|
|
|
247
240
|
with: string;
|
|
248
241
|
};
|
|
249
242
|
};
|
|
243
|
+
$if?: undefined;
|
|
250
244
|
} | {
|
|
251
|
-
class?: undefined;
|
|
252
245
|
type?: undefined;
|
|
253
246
|
title?: undefined;
|
|
254
247
|
on?: undefined;
|
|
@@ -256,6 +249,7 @@ export declare function createStudioComponent(options?: {
|
|
|
256
249
|
class: string;
|
|
257
250
|
title: string;
|
|
258
251
|
})[])[];
|
|
252
|
+
class?: undefined;
|
|
259
253
|
})[] | {
|
|
260
254
|
class: string;
|
|
261
255
|
})[];
|
|
@@ -301,3 +295,15 @@ export declare function createStudioComponent(options?: {
|
|
|
301
295
|
parseProject: typeof parseProject;
|
|
302
296
|
};
|
|
303
297
|
export { projectViewModel, projectRules, projectModes, PROJECT_MODE, PROJECT_BASE, hostPolicy, reconcileBuffer, editorTextarea, errorLine, KIND_BADGE, };
|
|
298
|
+
export { createStudioDocumentHost } from './document.js';
|
|
299
|
+
export { createProjectHost } from './project.js';
|
|
300
|
+
export { p, cards, table, callout, code, errorMessage, error, details, chart, article, search, more } from './shared/nodes.js';
|
|
301
|
+
export { tabRule, UI_RULES } from './shared/ui.js';
|
|
302
|
+
export { memo1 } from './shared/memo.js';
|
|
303
|
+
export { OUR_SCHEMA_OPTIONS } from './shared/schema-options.js';
|
|
304
|
+
export { createHostWidget } from './shared/host-widget.js';
|
|
305
|
+
export { PROJECT_ACTIONS } from './project-actions.js';
|
|
306
|
+
export { createProjectState } from './project-state.js';
|
|
307
|
+
export { createProjectController } from './project-controller.js';
|
|
308
|
+
export { mountStudioEditor } from './mount.js';
|
|
309
|
+
export { editorTextarea as sharedEditorTextarea, errorLine as editorErrorLine, paneSwitcher } from './shared/studio-kit.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution, document rendering, seeds and private data ownership are host services.
|
|
3
|
+
* The returned surface publishes document operations; the app state stays private.
|
|
4
|
+
* @param {HTMLElement | null} node
|
|
5
|
+
* @param {{ project: object, host: any, projectData?: any, projectTemplate?: Function,
|
|
6
|
+
* templates?: any[], widgets?: Record<string, any>, schedule?: (flush: () => void) => void,
|
|
7
|
+
* debounceMs?: number, download?: Function, exportProject?: Function, onError?: (error: Error) => void }} options
|
|
8
|
+
*/
|
|
9
|
+
export declare function mountStudioEditor(node: HTMLElement | null, options: {
|
|
10
|
+
project: object;
|
|
11
|
+
host: any;
|
|
12
|
+
projectData?: any;
|
|
13
|
+
projectTemplate?: Function;
|
|
14
|
+
templates?: any[];
|
|
15
|
+
widgets?: Record<string, any>;
|
|
16
|
+
schedule?: (flush: () => void) => void;
|
|
17
|
+
debounceMs?: number;
|
|
18
|
+
download?: Function;
|
|
19
|
+
exportProject?: Function;
|
|
20
|
+
onError?: (error: Error) => void;
|
|
21
|
+
}): {
|
|
22
|
+
read: () => import("./project-controller.js").ProjectSnapshot;
|
|
23
|
+
validate: (candidate: any) => {
|
|
24
|
+
valid: boolean;
|
|
25
|
+
errors: any;
|
|
26
|
+
total: any;
|
|
27
|
+
document: any;
|
|
28
|
+
} | {
|
|
29
|
+
document?: undefined;
|
|
30
|
+
valid: boolean;
|
|
31
|
+
errors: {
|
|
32
|
+
code: any;
|
|
33
|
+
message: any;
|
|
34
|
+
docPath: any;
|
|
35
|
+
}[];
|
|
36
|
+
total: number;
|
|
37
|
+
};
|
|
38
|
+
replace: (candidate: any, { expectedRevision }?: {
|
|
39
|
+
expectedRevision?: string;
|
|
40
|
+
}) => Promise<import("./project-controller.js").EditorReceipt>;
|
|
41
|
+
apply: (patch: Parameters<typeof import("@jarenjs/json").applyJSONPatch>[1], options?: {
|
|
42
|
+
expectedRevision?: string;
|
|
43
|
+
}) => Promise<import("./project-controller.js").EditorReceipt>;
|
|
44
|
+
run: (name?: string, options?: {
|
|
45
|
+
restart?: boolean;
|
|
46
|
+
}) => Promise<import("./project-controller.js").EditorReceipt> | {
|
|
47
|
+
error: string;
|
|
48
|
+
};
|
|
49
|
+
subscribe: (listener: (snapshot: import("./project-controller.js").ProjectSnapshot) => void) => () => void;
|
|
50
|
+
dispose(): void;
|
|
51
|
+
};
|