@fps-games/editor 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/dist/authoring-apply.d.ts +21 -0
- package/dist/authoring-apply.d.ts.map +1 -0
- package/dist/authoring-apply.js +45 -0
- package/dist/authoring-apply.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +539 -0
- package/dist/index.js.map +1 -0
- package/dist/local-editor-harness.d.ts +173 -0
- package/dist/local-editor-harness.d.ts.map +1 -0
- package/dist/local-editor-harness.js +969 -0
- package/dist/local-editor-harness.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/camera-controller.d.ts +20 -0
- package/node_modules/@fps-games/editor-babylon/dist/camera-controller.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/camera-controller.js +239 -0
- package/node_modules/@fps-games/editor-babylon/dist/camera-controller.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/edit-session.d.ts +30 -0
- package/node_modules/@fps-games/editor-babylon/dist/edit-session.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/edit-session.js +297 -0
- package/node_modules/@fps-games/editor-babylon/dist/edit-session.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/editor-world.d.ts +30 -0
- package/node_modules/@fps-games/editor-babylon/dist/editor-world.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/editor-world.js +67 -0
- package/node_modules/@fps-games/editor-babylon/dist/editor-world.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/event-guard.d.ts +13 -0
- package/node_modules/@fps-games/editor-babylon/dist/event-guard.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/event-guard.js +101 -0
- package/node_modules/@fps-games/editor-babylon/dist/event-guard.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/index.d.ts +19 -0
- package/node_modules/@fps-games/editor-babylon/dist/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/index.js +18 -0
- package/node_modules/@fps-games/editor-babylon/dist/index.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/input-controller.d.ts +3 -0
- package/node_modules/@fps-games/editor-babylon/dist/input-controller.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/input-controller.js +182 -0
- package/node_modules/@fps-games/editor-babylon/dist/input-controller.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/inspector-adapter.d.ts +13 -0
- package/node_modules/@fps-games/editor-babylon/dist/inspector-adapter.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/inspector-adapter.js +94 -0
- package/node_modules/@fps-games/editor-babylon/dist/inspector-adapter.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/inspector-host.d.ts +43 -0
- package/node_modules/@fps-games/editor-babylon/dist/inspector-host.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/inspector-host.js +510 -0
- package/node_modules/@fps-games/editor-babylon/dist/inspector-host.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/legacy-runtime.d.ts +5 -0
- package/node_modules/@fps-games/editor-babylon/dist/legacy-runtime.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/legacy-runtime.js +5 -0
- package/node_modules/@fps-games/editor-babylon/dist/legacy-runtime.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.d.ts +22 -0
- package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.js +408 -0
- package/node_modules/@fps-games/editor-babylon/dist/material-property-adapter.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/monitor.d.ts +39 -0
- package/node_modules/@fps-games/editor-babylon/dist/monitor.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/monitor.js +780 -0
- package/node_modules/@fps-games/editor-babylon/dist/monitor.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/outline-adapter.d.ts +37 -0
- package/node_modules/@fps-games/editor-babylon/dist/outline-adapter.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/outline-adapter.js +268 -0
- package/node_modules/@fps-games/editor-babylon/dist/outline-adapter.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection-selection-controller.d.ts +34 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection-selection-controller.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection-selection-controller.js +221 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection-selection-controller.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +90 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.js +479 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/runtime-globals.d.ts +3 -0
- package/node_modules/@fps-games/editor-babylon/dist/runtime-globals.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/runtime-globals.js +7 -0
- package/node_modules/@fps-games/editor-babylon/dist/runtime-globals.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.d.ts +18 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.js +213 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-input-controller.d.ts +36 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-input-controller.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-input-controller.js +272 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-input-controller.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/selection-controller.d.ts +27 -0
- package/node_modules/@fps-games/editor-babylon/dist/selection-controller.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/selection-controller.js +308 -0
- package/node_modules/@fps-games/editor-babylon/dist/selection-controller.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/tool-controller.d.ts +17 -0
- package/node_modules/@fps-games/editor-babylon/dist/tool-controller.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/tool-controller.js +83 -0
- package/node_modules/@fps-games/editor-babylon/dist/tool-controller.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts +47 -0
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js +689 -0
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/types.d.ts +111 -0
- package/node_modules/@fps-games/editor-babylon/dist/types.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/types.js +2 -0
- package/node_modules/@fps-games/editor-babylon/dist/types.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/package.json +25 -0
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts +28 -0
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/index.js +54 -0
- package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-input-router.d.ts +12 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-input-router.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-input-router.js +80 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-input-router.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.d.ts +11 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.js +33 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panel-registry.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +9 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +444 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.d.ts +21 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.js +103 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.d.ts +12 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.js +123 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shared.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shortcuts.d.ts +2 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shortcuts.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shortcuts.js +115 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-shortcuts.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-theme.d.ts +3 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-theme.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-theme.js +68 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-theme.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +183 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js +2 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts +58 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js +136 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +4 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +589 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/package.json +16 -0
- package/node_modules/@fps-games/editor-core/dist/authoring-source.d.ts +211 -0
- package/node_modules/@fps-games/editor-core/dist/authoring-source.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/authoring-source.js +511 -0
- package/node_modules/@fps-games/editor-core/dist/authoring-source.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts +132 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.js +265 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/host-services.d.ts +24 -0
- package/node_modules/@fps-games/editor-core/dist/host-services.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/host-services.js +2 -0
- package/node_modules/@fps-games/editor-core/dist/host-services.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/index.d.ts +106 -0
- package/node_modules/@fps-games/editor-core/dist/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/index.js +217 -0
- package/node_modules/@fps-games/editor-core/dist/index.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/scene-graph.d.ts +44 -0
- package/node_modules/@fps-games/editor-core/dist/scene-graph.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/scene-graph.js +86 -0
- package/node_modules/@fps-games/editor-core/dist/scene-graph.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/scene-view-input.d.ts +41 -0
- package/node_modules/@fps-games/editor-core/dist/scene-view-input.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/scene-view-input.js +2 -0
- package/node_modules/@fps-games/editor-core/dist/scene-view-input.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/serialized-object.d.ts +53 -0
- package/node_modules/@fps-games/editor-core/dist/serialized-object.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/serialized-object.js +32 -0
- package/node_modules/@fps-games/editor-core/dist/serialized-object.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/transform-gizmo.d.ts +48 -0
- package/node_modules/@fps-games/editor-core/dist/transform-gizmo.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/transform-gizmo.js +2 -0
- package/node_modules/@fps-games/editor-core/dist/transform-gizmo.js.map +1 -0
- package/node_modules/@fps-games/editor-core/package.json +19 -0
- package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts +46 -0
- package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-forge-play/dist/index.js +156 -0
- package/node_modules/@fps-games/editor-forge-play/dist/index.js.map +1 -0
- package/node_modules/@fps-games/editor-forge-play/package.json +19 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts +239 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.js +54 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/package.json +16 -0
- package/package.json +40 -0
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
export class AuthoringSourceRegistry {
|
|
2
|
+
constructor(sources = []) {
|
|
3
|
+
this.sources = new Map();
|
|
4
|
+
for (const source of sources)
|
|
5
|
+
this.register(source);
|
|
6
|
+
}
|
|
7
|
+
register(source) {
|
|
8
|
+
this.sources.set(toAuthoringSourceKey(source.ref), cloneAuthoringSourceDescriptor(source));
|
|
9
|
+
}
|
|
10
|
+
get(ref) {
|
|
11
|
+
const source = this.sources.get(toAuthoringSourceKey(ref));
|
|
12
|
+
return source ? cloneAuthoringSourceDescriptor(source) : null;
|
|
13
|
+
}
|
|
14
|
+
list() {
|
|
15
|
+
return [...this.sources.values()].map(cloneAuthoringSourceDescriptor);
|
|
16
|
+
}
|
|
17
|
+
has(ref) {
|
|
18
|
+
return this.sources.has(toAuthoringSourceKey(ref));
|
|
19
|
+
}
|
|
20
|
+
unregister(ref) {
|
|
21
|
+
return this.sources.delete(toAuthoringSourceKey(ref));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function toAuthoringSourceKey(ref) {
|
|
25
|
+
return `${ref.sourceType}:${ref.sourceId}`;
|
|
26
|
+
}
|
|
27
|
+
export function cloneAuthoringSourceDescriptor(source) {
|
|
28
|
+
return {
|
|
29
|
+
...source,
|
|
30
|
+
ref: { ...source.ref },
|
|
31
|
+
capabilities: source.capabilities ? { ...source.capabilities } : undefined,
|
|
32
|
+
metadata: source.metadata ? { ...source.metadata } : undefined,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function createProjectAuthoringHost(options = {}) {
|
|
36
|
+
return new DefaultProjectAuthoringHost(options);
|
|
37
|
+
}
|
|
38
|
+
class DefaultProjectAuthoringHost {
|
|
39
|
+
constructor(options) {
|
|
40
|
+
this.drivers = new Map();
|
|
41
|
+
this.registry = new AuthoringSourceRegistry(options.sources ?? []);
|
|
42
|
+
this.runtimeAdapter = options.runtimeAdapter ?? null;
|
|
43
|
+
for (const driver of options.drivers ?? [])
|
|
44
|
+
this.registerSourceDriver(driver);
|
|
45
|
+
}
|
|
46
|
+
getSourceRegistry() {
|
|
47
|
+
return this.registry;
|
|
48
|
+
}
|
|
49
|
+
registerSource(source) {
|
|
50
|
+
this.registry.register(source);
|
|
51
|
+
}
|
|
52
|
+
registerSourceDriver(driver) {
|
|
53
|
+
this.drivers.set(driver.sourceType, driver);
|
|
54
|
+
}
|
|
55
|
+
async loadSource(ref) {
|
|
56
|
+
const driver = this.getDriver(ref);
|
|
57
|
+
if (!driver) {
|
|
58
|
+
return failedAuthoringResult({
|
|
59
|
+
intent: 'commit',
|
|
60
|
+
reason: 'source_driver_not_found',
|
|
61
|
+
diagnostics: [createDiagnostic('error', `No source driver registered for "${ref.sourceType}".`, ref)],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
const descriptor = this.registry.get(ref) ?? createSourceDescriptorFromRef(ref);
|
|
66
|
+
const loaded = await driver.load({ ref: cloneAuthoringSourceRef(ref), descriptor });
|
|
67
|
+
this.registry.register(loaded.source);
|
|
68
|
+
return {
|
|
69
|
+
ok: true,
|
|
70
|
+
intent: 'commit',
|
|
71
|
+
source: cloneAuthoringSourceDescriptor(loaded.source),
|
|
72
|
+
document: loaded.document,
|
|
73
|
+
saved: false,
|
|
74
|
+
runtimeApplied: false,
|
|
75
|
+
summary: loaded.summary,
|
|
76
|
+
diagnostics: cloneDiagnostics(loaded.diagnostics),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
return failedAuthoringResult({
|
|
81
|
+
intent: 'commit',
|
|
82
|
+
reason: 'source_not_found',
|
|
83
|
+
diagnostics: [diagnosticFromError('source_not_found', error, ref)],
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async commitSource(input) {
|
|
88
|
+
const requestedSource = cloneAuthoringSourceDescriptor(input.source);
|
|
89
|
+
const source = this.registry.get(requestedSource.ref) ?? requestedSource;
|
|
90
|
+
const intent = 'commit';
|
|
91
|
+
const driver = this.getDriver(source.ref);
|
|
92
|
+
if (!driver) {
|
|
93
|
+
return failedAuthoringResult({
|
|
94
|
+
intent,
|
|
95
|
+
source,
|
|
96
|
+
document: input.document,
|
|
97
|
+
reason: 'source_driver_not_found',
|
|
98
|
+
diagnostics: [createDiagnostic('error', `No source driver registered for "${source.ref.sourceType}".`, source.ref)],
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (input.expectedRevision !== undefined && source.ref.revision !== input.expectedRevision) {
|
|
102
|
+
return failedAuthoringResult({
|
|
103
|
+
intent,
|
|
104
|
+
source,
|
|
105
|
+
document: input.document,
|
|
106
|
+
reason: 'source_revision_mismatch',
|
|
107
|
+
diagnostics: [
|
|
108
|
+
createDiagnostic('error', `Source revision mismatch: expected ${input.expectedRevision}, current ${String(source.ref.revision)}.`, source.ref, 'source_revision_mismatch'),
|
|
109
|
+
],
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
let diagnostics;
|
|
113
|
+
try {
|
|
114
|
+
diagnostics = await validateWithDriver(driver, {
|
|
115
|
+
source,
|
|
116
|
+
document: input.document,
|
|
117
|
+
command: input.command,
|
|
118
|
+
intent,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
return failedAuthoringResult({
|
|
123
|
+
intent,
|
|
124
|
+
source,
|
|
125
|
+
document: input.document,
|
|
126
|
+
reason: 'source_validation_failed',
|
|
127
|
+
diagnostics: [diagnosticFromError('source_validation_failed', error, source.ref)],
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (hasErrorDiagnostic(diagnostics)) {
|
|
131
|
+
return failedAuthoringResult({
|
|
132
|
+
intent,
|
|
133
|
+
source,
|
|
134
|
+
document: input.document,
|
|
135
|
+
reason: 'source_validation_failed',
|
|
136
|
+
diagnostics,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
let saveResult;
|
|
140
|
+
try {
|
|
141
|
+
saveResult = await driver.save({
|
|
142
|
+
source,
|
|
143
|
+
document: input.document,
|
|
144
|
+
command: input.command,
|
|
145
|
+
expectedRevision: input.expectedRevision,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
return failedAuthoringResult({
|
|
150
|
+
intent,
|
|
151
|
+
source,
|
|
152
|
+
document: input.document,
|
|
153
|
+
reason: 'source_save_failed',
|
|
154
|
+
diagnostics: [
|
|
155
|
+
...diagnostics,
|
|
156
|
+
diagnosticFromError('source_save_failed', error, source.ref),
|
|
157
|
+
],
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
const savedSource = cloneAuthoringSourceDescriptor(saveResult.source);
|
|
161
|
+
this.registry.register(savedSource);
|
|
162
|
+
diagnostics = [...diagnostics, ...cloneDiagnostics(saveResult.diagnostics)];
|
|
163
|
+
const artifacts = [...(saveResult.artifacts ?? [])];
|
|
164
|
+
try {
|
|
165
|
+
if (driver.compile) {
|
|
166
|
+
artifacts.push(...await driver.compile({
|
|
167
|
+
source: savedSource,
|
|
168
|
+
document: saveResult.document,
|
|
169
|
+
command: input.command,
|
|
170
|
+
intent,
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
return {
|
|
176
|
+
ok: false,
|
|
177
|
+
intent,
|
|
178
|
+
source: savedSource,
|
|
179
|
+
document: saveResult.document,
|
|
180
|
+
saved: true,
|
|
181
|
+
runtimeApplied: false,
|
|
182
|
+
reason: 'source_compile_failed',
|
|
183
|
+
summary: saveResult.summary,
|
|
184
|
+
diagnostics: [
|
|
185
|
+
...diagnostics,
|
|
186
|
+
diagnosticFromError('source_compile_failed', error, savedSource.ref),
|
|
187
|
+
],
|
|
188
|
+
artifacts,
|
|
189
|
+
runtimePatches: saveResult.runtimePatches,
|
|
190
|
+
metadata: saveResult.metadata,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
let runtimePatches = [...(saveResult.runtimePatches ?? [])];
|
|
194
|
+
try {
|
|
195
|
+
if (driver.compileRuntimePatch && input.beforeDocument && input.command) {
|
|
196
|
+
runtimePatches = [
|
|
197
|
+
...runtimePatches,
|
|
198
|
+
...await driver.compileRuntimePatch({
|
|
199
|
+
source: savedSource,
|
|
200
|
+
beforeDocument: input.beforeDocument,
|
|
201
|
+
afterDocument: saveResult.document,
|
|
202
|
+
command: input.command,
|
|
203
|
+
}),
|
|
204
|
+
];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
return {
|
|
209
|
+
ok: false,
|
|
210
|
+
intent,
|
|
211
|
+
source: savedSource,
|
|
212
|
+
document: saveResult.document,
|
|
213
|
+
saved: true,
|
|
214
|
+
runtimeApplied: false,
|
|
215
|
+
reason: 'source_compile_failed',
|
|
216
|
+
summary: saveResult.summary,
|
|
217
|
+
diagnostics: [
|
|
218
|
+
...diagnostics,
|
|
219
|
+
diagnosticFromError('source_compile_failed', error, savedSource.ref),
|
|
220
|
+
],
|
|
221
|
+
artifacts,
|
|
222
|
+
runtimePatches,
|
|
223
|
+
metadata: saveResult.metadata,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
const runtimeResult = await this.applyRuntimePatches({
|
|
227
|
+
patches: runtimePatches,
|
|
228
|
+
source: savedSource.ref,
|
|
229
|
+
intent,
|
|
230
|
+
saved: true,
|
|
231
|
+
});
|
|
232
|
+
if (!runtimeResult.ok) {
|
|
233
|
+
return {
|
|
234
|
+
ok: false,
|
|
235
|
+
intent,
|
|
236
|
+
source: savedSource,
|
|
237
|
+
document: saveResult.document,
|
|
238
|
+
saved: true,
|
|
239
|
+
runtimeApplied: false,
|
|
240
|
+
reason: runtimeResult.reason,
|
|
241
|
+
summary: saveResult.summary,
|
|
242
|
+
diagnostics: [...diagnostics, ...runtimeResult.diagnostics],
|
|
243
|
+
artifacts,
|
|
244
|
+
runtimePatches,
|
|
245
|
+
runtimeResults: runtimeResult.runtimeResults,
|
|
246
|
+
metadata: saveResult.metadata,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
ok: true,
|
|
251
|
+
intent,
|
|
252
|
+
source: savedSource,
|
|
253
|
+
document: saveResult.document,
|
|
254
|
+
saved: true,
|
|
255
|
+
runtimeApplied: runtimeResult.runtimeApplied,
|
|
256
|
+
summary: saveResult.summary,
|
|
257
|
+
diagnostics,
|
|
258
|
+
artifacts,
|
|
259
|
+
runtimePatches,
|
|
260
|
+
runtimeResults: runtimeResult.runtimeResults,
|
|
261
|
+
metadata: saveResult.metadata,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
async dispatch(command) {
|
|
265
|
+
const intent = command.intent ?? 'commit';
|
|
266
|
+
if (intent !== 'preview' && intent !== 'commit') {
|
|
267
|
+
return failedAuthoringResult({
|
|
268
|
+
intent: 'commit',
|
|
269
|
+
reason: 'unsupported_intent',
|
|
270
|
+
diagnostics: [createDiagnostic('error', `Unsupported authoring intent "${String(command.intent)}".`, command.source)],
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
const driver = this.getDriver(command.source);
|
|
274
|
+
if (!driver) {
|
|
275
|
+
return failedAuthoringResult({
|
|
276
|
+
intent,
|
|
277
|
+
reason: 'source_driver_not_found',
|
|
278
|
+
diagnostics: [createDiagnostic('error', `No source driver registered for "${command.source.sourceType}".`, command.source)],
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
let loaded;
|
|
282
|
+
try {
|
|
283
|
+
loaded = await driver.load({
|
|
284
|
+
ref: cloneAuthoringSourceRef(command.source),
|
|
285
|
+
descriptor: this.registry.get(command.source) ?? createSourceDescriptorFromRef(command.source),
|
|
286
|
+
});
|
|
287
|
+
this.registry.register(loaded.source);
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
return failedAuthoringResult({
|
|
291
|
+
intent,
|
|
292
|
+
reason: 'source_not_found',
|
|
293
|
+
diagnostics: [diagnosticFromError('source_not_found', error, command.source)],
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
const beforeDocument = loaded.document;
|
|
297
|
+
if (intent === 'commit') {
|
|
298
|
+
let afterDocument = beforeDocument;
|
|
299
|
+
try {
|
|
300
|
+
if (driver.reduce) {
|
|
301
|
+
afterDocument = await driver.reduce({
|
|
302
|
+
source: loaded.source,
|
|
303
|
+
document: beforeDocument,
|
|
304
|
+
command,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
return failedAuthoringResult({
|
|
310
|
+
intent,
|
|
311
|
+
source: loaded.source,
|
|
312
|
+
document: beforeDocument,
|
|
313
|
+
reason: 'source_reduce_failed',
|
|
314
|
+
diagnostics: [
|
|
315
|
+
...cloneDiagnostics(loaded.diagnostics),
|
|
316
|
+
diagnosticFromError('source_reduce_failed', error, loaded.source.ref),
|
|
317
|
+
],
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
return this.commitSource({
|
|
321
|
+
source: loaded.source,
|
|
322
|
+
document: afterDocument,
|
|
323
|
+
beforeDocument,
|
|
324
|
+
expectedRevision: command.expectedRevision,
|
|
325
|
+
command,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
let diagnostics;
|
|
329
|
+
try {
|
|
330
|
+
diagnostics = await validateWithDriver(driver, {
|
|
331
|
+
source: loaded.source,
|
|
332
|
+
document: beforeDocument,
|
|
333
|
+
command,
|
|
334
|
+
intent,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
return failedAuthoringResult({
|
|
339
|
+
intent,
|
|
340
|
+
source: loaded.source,
|
|
341
|
+
document: beforeDocument,
|
|
342
|
+
reason: 'source_validation_failed',
|
|
343
|
+
diagnostics: [diagnosticFromError('source_validation_failed', error, loaded.source.ref)],
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
diagnostics = [...cloneDiagnostics(loaded.diagnostics), ...diagnostics];
|
|
347
|
+
if (hasErrorDiagnostic(diagnostics)) {
|
|
348
|
+
return failedAuthoringResult({
|
|
349
|
+
intent,
|
|
350
|
+
source: loaded.source,
|
|
351
|
+
document: beforeDocument,
|
|
352
|
+
reason: 'source_validation_failed',
|
|
353
|
+
diagnostics,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
let runtimePatches = [];
|
|
357
|
+
try {
|
|
358
|
+
runtimePatches = driver.compileRuntimePatch
|
|
359
|
+
? await driver.compileRuntimePatch({
|
|
360
|
+
source: loaded.source,
|
|
361
|
+
beforeDocument,
|
|
362
|
+
afterDocument: beforeDocument,
|
|
363
|
+
command,
|
|
364
|
+
})
|
|
365
|
+
: [];
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
return failedAuthoringResult({
|
|
369
|
+
intent,
|
|
370
|
+
source: loaded.source,
|
|
371
|
+
document: beforeDocument,
|
|
372
|
+
reason: 'source_compile_failed',
|
|
373
|
+
diagnostics: [
|
|
374
|
+
...diagnostics,
|
|
375
|
+
diagnosticFromError('source_compile_failed', error, loaded.source.ref),
|
|
376
|
+
],
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
const runtimeResult = await this.applyRuntimePatches({
|
|
380
|
+
patches: runtimePatches,
|
|
381
|
+
source: loaded.source.ref,
|
|
382
|
+
intent,
|
|
383
|
+
saved: false,
|
|
384
|
+
});
|
|
385
|
+
if (!runtimeResult.ok) {
|
|
386
|
+
return {
|
|
387
|
+
ok: false,
|
|
388
|
+
intent,
|
|
389
|
+
source: cloneAuthoringSourceDescriptor(loaded.source),
|
|
390
|
+
document: beforeDocument,
|
|
391
|
+
saved: false,
|
|
392
|
+
runtimeApplied: false,
|
|
393
|
+
reason: runtimeResult.reason,
|
|
394
|
+
diagnostics: [...diagnostics, ...runtimeResult.diagnostics],
|
|
395
|
+
runtimePatches,
|
|
396
|
+
runtimeResults: runtimeResult.runtimeResults,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
return {
|
|
400
|
+
ok: true,
|
|
401
|
+
intent,
|
|
402
|
+
source: cloneAuthoringSourceDescriptor(loaded.source),
|
|
403
|
+
document: beforeDocument,
|
|
404
|
+
saved: false,
|
|
405
|
+
runtimeApplied: runtimeResult.runtimeApplied,
|
|
406
|
+
diagnostics,
|
|
407
|
+
runtimePatches,
|
|
408
|
+
runtimeResults: runtimeResult.runtimeResults,
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
attachRuntimeAdapter(adapter) {
|
|
412
|
+
if (this.runtimeAdapter && this.runtimeAdapter !== adapter)
|
|
413
|
+
this.runtimeAdapter.dispose?.();
|
|
414
|
+
this.runtimeAdapter = adapter;
|
|
415
|
+
}
|
|
416
|
+
detachRuntimeAdapter() {
|
|
417
|
+
this.runtimeAdapter?.dispose?.();
|
|
418
|
+
this.runtimeAdapter = null;
|
|
419
|
+
}
|
|
420
|
+
getDriver(ref) {
|
|
421
|
+
return this.drivers.get(ref.sourceType) ?? null;
|
|
422
|
+
}
|
|
423
|
+
async applyRuntimePatches(input) {
|
|
424
|
+
if (input.patches.length === 0) {
|
|
425
|
+
return { ok: true, runtimeApplied: false, diagnostics: [] };
|
|
426
|
+
}
|
|
427
|
+
if (!this.runtimeAdapter) {
|
|
428
|
+
return {
|
|
429
|
+
ok: true,
|
|
430
|
+
runtimeApplied: false,
|
|
431
|
+
diagnostics: [
|
|
432
|
+
createDiagnostic('warning', 'Runtime patches were produced but no runtime adapter is attached.', input.source),
|
|
433
|
+
],
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
try {
|
|
437
|
+
const runtimeResults = await this.runtimeAdapter.apply(input.patches);
|
|
438
|
+
const failed = runtimeResults.filter(result => !result.applied);
|
|
439
|
+
if (failed.length > 0) {
|
|
440
|
+
return {
|
|
441
|
+
ok: false,
|
|
442
|
+
runtimeApplied: false,
|
|
443
|
+
reason: 'runtime_apply_failed',
|
|
444
|
+
diagnostics: failed.flatMap(result => result.diagnostics?.length
|
|
445
|
+
? cloneDiagnostics(result.diagnostics)
|
|
446
|
+
: [createDiagnostic('error', result.reason ?? 'Runtime apply failed.', input.source, 'runtime_apply_failed')]),
|
|
447
|
+
runtimeResults,
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
return {
|
|
451
|
+
ok: true,
|
|
452
|
+
runtimeApplied: true,
|
|
453
|
+
diagnostics: [],
|
|
454
|
+
runtimeResults,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
return {
|
|
459
|
+
ok: false,
|
|
460
|
+
runtimeApplied: false,
|
|
461
|
+
reason: 'runtime_apply_failed',
|
|
462
|
+
diagnostics: [diagnosticFromError('runtime_apply_failed', error, input.source)],
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
async function validateWithDriver(driver, input) {
|
|
468
|
+
if (!driver.validate)
|
|
469
|
+
return [];
|
|
470
|
+
return cloneDiagnostics(await driver.validate(input));
|
|
471
|
+
}
|
|
472
|
+
function hasErrorDiagnostic(diagnostics) {
|
|
473
|
+
return diagnostics.some(diagnostic => diagnostic.severity === 'error');
|
|
474
|
+
}
|
|
475
|
+
function failedAuthoringResult(input) {
|
|
476
|
+
return {
|
|
477
|
+
ok: false,
|
|
478
|
+
intent: input.intent,
|
|
479
|
+
source: input.source ? cloneAuthoringSourceDescriptor(input.source) : undefined,
|
|
480
|
+
document: input.document,
|
|
481
|
+
saved: false,
|
|
482
|
+
runtimeApplied: false,
|
|
483
|
+
reason: input.reason,
|
|
484
|
+
diagnostics: cloneDiagnostics(input.diagnostics),
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
function createSourceDescriptorFromRef(ref) {
|
|
488
|
+
return { ref: cloneAuthoringSourceRef(ref) };
|
|
489
|
+
}
|
|
490
|
+
function cloneAuthoringSourceRef(ref) {
|
|
491
|
+
return { ...ref };
|
|
492
|
+
}
|
|
493
|
+
function cloneDiagnostics(diagnostics) {
|
|
494
|
+
return (diagnostics ?? []).map(diagnostic => ({
|
|
495
|
+
...diagnostic,
|
|
496
|
+
source: diagnostic.source ? cloneAuthoringSourceRef(diagnostic.source) : undefined,
|
|
497
|
+
metadata: diagnostic.metadata ? { ...diagnostic.metadata } : undefined,
|
|
498
|
+
}));
|
|
499
|
+
}
|
|
500
|
+
function createDiagnostic(severity, message, source, code) {
|
|
501
|
+
return {
|
|
502
|
+
severity,
|
|
503
|
+
message,
|
|
504
|
+
code,
|
|
505
|
+
source: source ? cloneAuthoringSourceRef(source) : undefined,
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function diagnosticFromError(code, error, source) {
|
|
509
|
+
return createDiagnostic('error', error instanceof Error ? error.message : String(error), source, code);
|
|
510
|
+
}
|
|
511
|
+
//# sourceMappingURL=authoring-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-source.js","sourceRoot":"","sources":["../src/authoring-source.ts"],"names":[],"mappings":"AAyQA,MAAM,OAAO,uBAAuB;IAGlC,YAAY,UAAuC,EAAE;QAFpC,YAAO,GAAG,IAAI,GAAG,EAAqC,CAAC;QAGtE,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ,CAAC,MAAiC;QACxC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,8BAA8B,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,GAAG,CAAC,GAAwD;QAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,CAAC,CAAC,8BAA8B,CAAC,MAAM,CAAC,CAAC,C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AC,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;QAClF,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;KACvE,CAAC,CAAC,CAAC;AACN,CAAC;AAED,SAAS,gBAAgB,CACvB,QAAqC,EACrC,OAAe,EACf,MAA2B,EAC3B,IAAa;IAEb,OAAO;QACL,QAAQ;QACR,OAAO;QACP,IAAI;QACJ,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;KAC7D,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,IAAmC,EACnC,KAAc,EACd,MAA2B;IAE3B,OAAO,gBAAgB,CAAC,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACzG,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { AuthoringSourceDescriptor } from './authoring-source';
|
|
2
|
+
export type EditorSessionLifecycle = 'idle' | 'editing' | 'saving' | 'exiting' | 'error';
|
|
3
|
+
export interface EditorSelectionState {
|
|
4
|
+
selectedIds: string[];
|
|
5
|
+
activeId: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface EditorCommandBase {
|
|
8
|
+
type: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DocumentPatchCommand<TPatch = unknown> extends EditorCommandBase {
|
|
12
|
+
type: 'document.patch';
|
|
13
|
+
patch: TPatch;
|
|
14
|
+
targetId?: string;
|
|
15
|
+
propertyPath?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface DocumentReplaceCommand<TDocument> extends EditorCommandBase {
|
|
18
|
+
type: 'document.replace';
|
|
19
|
+
document: TDocument;
|
|
20
|
+
}
|
|
21
|
+
export type DocumentCommand<TDocument = unknown, TPatch = unknown> = DocumentPatchCommand<TPatch> | DocumentReplaceCommand<TDocument>;
|
|
22
|
+
export interface SelectionReplaceCommand extends EditorCommandBase {
|
|
23
|
+
type: 'selection.replace';
|
|
24
|
+
selectedIds: string[];
|
|
25
|
+
activeId?: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface SelectionAddCommand extends EditorCommandBase {
|
|
28
|
+
type: 'selection.add';
|
|
29
|
+
selectedIds: string[];
|
|
30
|
+
activeId?: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface SelectionRemoveCommand extends EditorCommandBase {
|
|
33
|
+
type: 'selection.remove';
|
|
34
|
+
selectedIds: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface SelectionToggleCommand extends EditorCommandBase {
|
|
37
|
+
type: 'selection.toggle';
|
|
38
|
+
selectedIds: string[];
|
|
39
|
+
activeId?: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface SelectionClearCommand extends EditorCommandBase {
|
|
42
|
+
type: 'selection.clear';
|
|
43
|
+
}
|
|
44
|
+
export type SelectionCommand = SelectionReplaceCommand | SelectionAddCommand | SelectionRemoveCommand | SelectionToggleCommand | SelectionClearCommand;
|
|
45
|
+
export type EditorCommand<TDocument = unknown, TPatch = unknown> = DocumentCommand<TDocument, TPatch> | SelectionCommand;
|
|
46
|
+
export interface EditorSessionState<TDocument> {
|
|
47
|
+
persistedDocument: TDocument;
|
|
48
|
+
workingDocument: TDocument;
|
|
49
|
+
source?: AuthoringSourceDescriptor;
|
|
50
|
+
selection: EditorSelectionState;
|
|
51
|
+
dirty: boolean;
|
|
52
|
+
canUndo: boolean;
|
|
53
|
+
canRedo: boolean;
|
|
54
|
+
history: EditorSessionHistoryView;
|
|
55
|
+
lifecycle: EditorSessionLifecycle;
|
|
56
|
+
}
|
|
57
|
+
export interface EditorSessionDispatchResult<TDocument> {
|
|
58
|
+
command: EditorCommand;
|
|
59
|
+
workingDocument: TDocument;
|
|
60
|
+
selection: EditorSelectionState;
|
|
61
|
+
dirty: boolean;
|
|
62
|
+
documentChanged: boolean;
|
|
63
|
+
selectionChanged: boolean;
|
|
64
|
+
transaction?: UndoTransaction<TDocument>;
|
|
65
|
+
}
|
|
66
|
+
export interface EditorSessionOptions<TDocument, TPatch = unknown> {
|
|
67
|
+
source?: AuthoringSourceDescriptor;
|
|
68
|
+
persistedDocument: TDocument;
|
|
69
|
+
workingDocument?: TDocument;
|
|
70
|
+
selection?: Partial<EditorSelectionState>;
|
|
71
|
+
lifecycle?: EditorSessionLifecycle;
|
|
72
|
+
cloneDocument?: (document: TDocument) => TDocument;
|
|
73
|
+
compareDocuments?: (left: TDocument, right: TDocument) => boolean;
|
|
74
|
+
reduceDocument?: (document: TDocument, command: DocumentCommand<TDocument, TPatch>) => TDocument;
|
|
75
|
+
}
|
|
76
|
+
export interface UndoTransaction<TDocument> {
|
|
77
|
+
id: string;
|
|
78
|
+
label: string;
|
|
79
|
+
commandType: string;
|
|
80
|
+
beforeDocument: TDocument;
|
|
81
|
+
afterDocument: TDocument;
|
|
82
|
+
createdAt: number;
|
|
83
|
+
}
|
|
84
|
+
export interface EditorSessionHistoryEntry {
|
|
85
|
+
id: string;
|
|
86
|
+
label: string;
|
|
87
|
+
commandType: string;
|
|
88
|
+
createdAt: number;
|
|
89
|
+
}
|
|
90
|
+
export interface EditorSessionHistoryView {
|
|
91
|
+
entries: EditorSessionHistoryEntry[];
|
|
92
|
+
}
|
|
93
|
+
export interface EditorSessionHistoryResult<TDocument> {
|
|
94
|
+
transaction: UndoTransaction<TDocument>;
|
|
95
|
+
workingDocument: TDocument;
|
|
96
|
+
selection: EditorSelectionState;
|
|
97
|
+
dirty: boolean;
|
|
98
|
+
documentChanged: true;
|
|
99
|
+
}
|
|
100
|
+
export declare class EditorSession<TDocument, TPatch = unknown> {
|
|
101
|
+
private source?;
|
|
102
|
+
private persistedDocument;
|
|
103
|
+
private workingDocument;
|
|
104
|
+
private selection;
|
|
105
|
+
private lifecycle;
|
|
106
|
+
private readonly cloneDocument;
|
|
107
|
+
private readonly compareDocuments;
|
|
108
|
+
private readonly reduceDocument?;
|
|
109
|
+
private undoStack;
|
|
110
|
+
private redoStack;
|
|
111
|
+
private nextTransactionId;
|
|
112
|
+
constructor(options: EditorSessionOptions<TDocument, TPatch>);
|
|
113
|
+
getState(): EditorSessionState<TDocument>;
|
|
114
|
+
getWorkingDocument(): TDocument;
|
|
115
|
+
getSource(): AuthoringSourceDescriptor | undefined;
|
|
116
|
+
getSelection(): EditorSelectionState;
|
|
117
|
+
isDirty(): boolean;
|
|
118
|
+
canUndo(): boolean;
|
|
119
|
+
canRedo(): boolean;
|
|
120
|
+
getLifecycle(): EditorSessionLifecycle;
|
|
121
|
+
setLifecycle(lifecycle: EditorSessionLifecycle): EditorSessionState<TDocument>;
|
|
122
|
+
dispatch(command: EditorCommand<TDocument, TPatch>): EditorSessionDispatchResult<TDocument>;
|
|
123
|
+
undo(): EditorSessionHistoryResult<TDocument> | null;
|
|
124
|
+
redo(): EditorSessionHistoryResult<TDocument> | null;
|
|
125
|
+
markSaved(document: TDocument, source?: AuthoringSourceDescriptor): EditorSessionState<TDocument>;
|
|
126
|
+
reset(document: TDocument, source?: AuthoringSourceDescriptor): EditorSessionState<TDocument>;
|
|
127
|
+
private pushTransaction;
|
|
128
|
+
private getHistoryView;
|
|
129
|
+
}
|
|
130
|
+
export declare function createEditorSession<TDocument>(options: EditorSessionOptions<TDocument>): EditorSession<TDocument>;
|
|
131
|
+
export declare function createEditorSession<TDocument, TPatch>(options: EditorSessionOptions<TDocument, TPatch>): EditorSession<TDocument, TPatch>;
|
|
132
|
+
//# sourceMappingURL=editor-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-session.d.ts","sourceRoot":"","sources":["../src/editor-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAy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