@crowdedkingdoms/crowdyjs 10.0.0 → 11.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/MIGRATION.md +48 -48
- package/README.md +24 -21
- package/dist/crowdy-client.d.ts +3 -3
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +2 -2
- package/dist/crowdy-studio/controller.d.ts +188 -0
- package/dist/crowdy-studio/controller.d.ts.map +1 -0
- package/dist/{mod-studio → crowdy-studio}/controller.js +22 -22
- package/dist/crowdy-studio/diagnostics.d.ts +22 -0
- package/dist/crowdy-studio/diagnostics.d.ts.map +1 -0
- package/dist/{mod-studio → crowdy-studio}/diagnostics.js +2 -2
- package/dist/{mod-studio → crowdy-studio}/dom-shell.d.ts +4 -4
- package/dist/crowdy-studio/dom-shell.d.ts.map +1 -0
- package/dist/{mod-studio → crowdy-studio}/dom-shell.js +31 -31
- package/dist/crowdy-studio/editor.d.ts +17 -0
- package/dist/crowdy-studio/editor.d.ts.map +1 -0
- package/dist/crowdy-studio/index.d.ts +10 -0
- package/dist/crowdy-studio/index.d.ts.map +1 -0
- package/dist/{mod-studio → crowdy-studio}/index.js +4 -4
- package/dist/crowdy-studio/models.d.ts +149 -0
- package/dist/crowdy-studio/models.d.ts.map +1 -0
- package/dist/{mod-studio → crowdy-studio}/models.js +10 -10
- package/dist/{mod-studio → crowdy-studio}/monaco-editor.d.ts +3 -3
- package/dist/crowdy-studio/monaco-editor.d.ts.map +1 -0
- package/dist/{mod-studio → crowdy-studio}/monaco-editor.js +4 -4
- package/dist/crowdy-studio/mount.d.ts +17 -0
- package/dist/crowdy-studio/mount.d.ts.map +1 -0
- package/dist/{mod-studio → crowdy-studio}/mount.js +14 -14
- package/dist/crowdy-studio/starter-projects.d.ts +11 -0
- package/dist/crowdy-studio/starter-projects.d.ts.map +1 -0
- package/dist/{mod-studio → crowdy-studio}/starter-projects.js +2 -2
- package/dist/crowdy-studio/styles.d.ts +2 -0
- package/dist/crowdy-studio/styles.d.ts.map +1 -0
- package/dist/crowdy-studio/styles.js +14 -0
- package/dist/crowdy-studio/textarea-editor.d.ts +8 -0
- package/dist/crowdy-studio/textarea-editor.d.ts.map +1 -0
- package/dist/{mod-studio → crowdy-studio}/textarea-editor.js +3 -3
- package/dist/domains/crowdyStudio.d.ts +27 -0
- package/dist/domains/crowdyStudio.d.ts.map +1 -0
- package/dist/domains/{playerCodeProjects.js → crowdyStudio.js} +47 -45
- package/dist/domains/playerCompute.d.ts +1 -1
- package/dist/domains/playerCompute.js +1 -1
- package/dist/generated/graphql.d.ts +670 -670
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +57 -57
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/live-coding/rust-analysis.js +1 -1
- package/package.json +4 -4
- package/dist/domains/playerCodeProjects.d.ts +0 -25
- package/dist/domains/playerCodeProjects.d.ts.map +0 -1
- package/dist/mod-studio/controller.d.ts +0 -188
- package/dist/mod-studio/controller.d.ts.map +0 -1
- package/dist/mod-studio/diagnostics.d.ts +0 -22
- package/dist/mod-studio/diagnostics.d.ts.map +0 -1
- package/dist/mod-studio/dom-shell.d.ts.map +0 -1
- package/dist/mod-studio/editor.d.ts +0 -17
- package/dist/mod-studio/editor.d.ts.map +0 -1
- package/dist/mod-studio/index.d.ts +0 -10
- package/dist/mod-studio/index.d.ts.map +0 -1
- package/dist/mod-studio/models.d.ts +0 -149
- package/dist/mod-studio/models.d.ts.map +0 -1
- package/dist/mod-studio/monaco-editor.d.ts.map +0 -1
- package/dist/mod-studio/mount.d.ts +0 -17
- package/dist/mod-studio/mount.d.ts.map +0 -1
- package/dist/mod-studio/starter-projects.d.ts +0 -11
- package/dist/mod-studio/starter-projects.d.ts.map +0 -1
- package/dist/mod-studio/styles.d.ts +0 -2
- package/dist/mod-studio/styles.d.ts.map +0 -1
- package/dist/mod-studio/styles.js +0 -14
- package/dist/mod-studio/textarea-editor.d.ts +0 -8
- package/dist/mod-studio/textarea-editor.d.ts.map +0 -1
- /package/dist/{mod-studio → crowdy-studio}/editor.js +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { PlayerCodeBroker, } from '../player-runtime/player-code-broker.js';
|
|
2
2
|
import { parseRustcDiagnostics } from './diagnostics.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { cloneCrowdyStudioProject, crowdyStudioFileKey, normalizeCrowdyStudioPath, projectTargets, CrowdyStudioOfflineError, CrowdyStudioRevisionConflictError, } from './models.js';
|
|
4
|
+
import { createCrowdyStudioStarterProject, } from './starter-projects.js';
|
|
5
5
|
class OperationCancelledError extends Error {
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Headless project-first
|
|
8
|
+
* Headless project-first Crowdy Studio driver. It owns optimistic project saves,
|
|
9
9
|
* file CRUD, deployment ordering, runtime polling, and client hot swaps; the
|
|
10
10
|
* DOM mount is only a view over this state.
|
|
11
11
|
*/
|
|
12
|
-
export class
|
|
12
|
+
export class CrowdyStudioController {
|
|
13
13
|
constructor(options) {
|
|
14
14
|
this.options = options;
|
|
15
15
|
this.state = {
|
|
@@ -74,7 +74,7 @@ export class ModStudioController {
|
|
|
74
74
|
]);
|
|
75
75
|
}
|
|
76
76
|
catch (error) {
|
|
77
|
-
if (error instanceof
|
|
77
|
+
if (error instanceof CrowdyStudioOfflineError ||
|
|
78
78
|
this.options.isOnline?.() === false) {
|
|
79
79
|
this.update({
|
|
80
80
|
saveState: 'OFFLINE',
|
|
@@ -101,7 +101,7 @@ export class ModStudioController {
|
|
|
101
101
|
if (this.state.project && !(await this.saveNow())) {
|
|
102
102
|
throw new Error('Resolve or retry the current project save before creating another');
|
|
103
103
|
}
|
|
104
|
-
const input =
|
|
104
|
+
const input = createCrowdyStudioStarterProject({
|
|
105
105
|
...options,
|
|
106
106
|
...this.scope(),
|
|
107
107
|
});
|
|
@@ -138,7 +138,7 @@ export class ModStudioController {
|
|
|
138
138
|
this.editGeneration = 0;
|
|
139
139
|
this.persistedGeneration = 0;
|
|
140
140
|
this.conflictRemote = null;
|
|
141
|
-
const clone =
|
|
141
|
+
const clone = cloneCrowdyStudioProject(project);
|
|
142
142
|
const preferred = clone.files.find((file) => file.path === 'src/lib.rs') ?? clone.files[0];
|
|
143
143
|
const activeFile = preferred ? projectFileRef(preferred) : null;
|
|
144
144
|
this.update({
|
|
@@ -178,7 +178,7 @@ export class ModStudioController {
|
|
|
178
178
|
addFile(target, path, content = '') {
|
|
179
179
|
const project = this.requireProject();
|
|
180
180
|
this.assertProjectTarget(project, target);
|
|
181
|
-
const normalized =
|
|
181
|
+
const normalized = normalizeCrowdyStudioPath(path);
|
|
182
182
|
if (project.files.some((file) => file.target === target && file.path === normalized)) {
|
|
183
183
|
throw new Error(`${target}:${normalized} already exists`);
|
|
184
184
|
}
|
|
@@ -194,8 +194,8 @@ export class ModStudioController {
|
|
|
194
194
|
}
|
|
195
195
|
renameFile(target, path, nextPath) {
|
|
196
196
|
const project = this.requireProject();
|
|
197
|
-
const normalized =
|
|
198
|
-
const renamed =
|
|
197
|
+
const normalized = normalizeCrowdyStudioPath(path);
|
|
198
|
+
const renamed = normalizeCrowdyStudioPath(nextPath);
|
|
199
199
|
const file = project.files.find((entry) => entry.target === target && entry.path === normalized);
|
|
200
200
|
if (!file)
|
|
201
201
|
throw new Error(`${target}:${normalized} does not exist`);
|
|
@@ -219,7 +219,7 @@ export class ModStudioController {
|
|
|
219
219
|
}
|
|
220
220
|
deleteFile(target, path) {
|
|
221
221
|
const project = this.requireProject();
|
|
222
|
-
const normalized =
|
|
222
|
+
const normalized = normalizeCrowdyStudioPath(path);
|
|
223
223
|
const index = project.files.findIndex((entry) => entry.target === target && entry.path === normalized);
|
|
224
224
|
if (index < 0)
|
|
225
225
|
throw new Error(`${target}:${normalized} does not exist`);
|
|
@@ -246,13 +246,13 @@ export class ModStudioController {
|
|
|
246
246
|
projects: upsertSummary(this.state.projects, summaryOf(saved)),
|
|
247
247
|
});
|
|
248
248
|
const imported = saved.files.find((file) => file.target === reference.target &&
|
|
249
|
-
file.path ===
|
|
249
|
+
file.path === normalizeCrowdyStudioPath(destinationPath));
|
|
250
250
|
if (imported)
|
|
251
251
|
this.openFile(projectFileRef(imported));
|
|
252
252
|
}
|
|
253
253
|
async saveProjectFileToLibrary(target, path, title) {
|
|
254
254
|
const file = this.requireProject().files.find((entry) => entry.target === target &&
|
|
255
|
-
entry.path ===
|
|
255
|
+
entry.path === normalizeCrowdyStudioPath(path));
|
|
256
256
|
if (!file)
|
|
257
257
|
throw new Error(`${target}:${path} does not exist`);
|
|
258
258
|
const saved = await this.options.projectProvider.savePersonalLibraryFile({
|
|
@@ -269,7 +269,7 @@ export class ModStudioController {
|
|
|
269
269
|
}
|
|
270
270
|
updateFile(target, path, content) {
|
|
271
271
|
const project = this.requireProject();
|
|
272
|
-
const normalized =
|
|
272
|
+
const normalized = normalizeCrowdyStudioPath(path);
|
|
273
273
|
const file = project.files.find((entry) => entry.target === target && entry.path === normalized);
|
|
274
274
|
if (!file)
|
|
275
275
|
throw new Error(`${target}:${normalized} does not exist`);
|
|
@@ -676,7 +676,7 @@ export class ModStudioController {
|
|
|
676
676
|
while (this.persistedGeneration !== this.editGeneration) {
|
|
677
677
|
const project = this.requireProject();
|
|
678
678
|
const savingGeneration = this.editGeneration;
|
|
679
|
-
const snapshot =
|
|
679
|
+
const snapshot = cloneCrowdyStudioProject(project);
|
|
680
680
|
this.update({ saveState: 'SAVING', saveMessage: undefined });
|
|
681
681
|
try {
|
|
682
682
|
const saved = await this.options.projectProvider.saveProject({
|
|
@@ -690,7 +690,7 @@ export class ModStudioController {
|
|
|
690
690
|
if (this.state.project?.projectId !== saved.projectId)
|
|
691
691
|
return true;
|
|
692
692
|
if (this.editGeneration === savingGeneration) {
|
|
693
|
-
this.state.project =
|
|
693
|
+
this.state.project = cloneCrowdyStudioProject(saved);
|
|
694
694
|
}
|
|
695
695
|
else {
|
|
696
696
|
// Preserve newer local edits while advancing the revision precondition.
|
|
@@ -704,12 +704,12 @@ export class ModStudioController {
|
|
|
704
704
|
});
|
|
705
705
|
}
|
|
706
706
|
catch (error) {
|
|
707
|
-
if (error instanceof
|
|
707
|
+
if (error instanceof CrowdyStudioRevisionConflictError) {
|
|
708
708
|
this.conflictRemote = error.remoteProject ?? null;
|
|
709
709
|
this.update({ saveState: 'CONFLICT', saveMessage: error.message });
|
|
710
710
|
return false;
|
|
711
711
|
}
|
|
712
|
-
if (error instanceof
|
|
712
|
+
if (error instanceof CrowdyStudioOfflineError ||
|
|
713
713
|
this.options.isOnline?.() === false) {
|
|
714
714
|
this.update({ saveState: 'OFFLINE', saveMessage: errorMessage(error) });
|
|
715
715
|
this.scheduleRetry();
|
|
@@ -808,13 +808,13 @@ export class ModStudioController {
|
|
|
808
808
|
}
|
|
809
809
|
requireProject() {
|
|
810
810
|
if (!this.state.project)
|
|
811
|
-
throw new Error('No
|
|
811
|
+
throw new Error('No Crowdy Studio project is open');
|
|
812
812
|
return this.state.project;
|
|
813
813
|
}
|
|
814
814
|
requireFile(ref) {
|
|
815
815
|
if (ref.source === 'PROJECT') {
|
|
816
816
|
const file = this.requireProject().files.find((entry) => entry.target === ref.target &&
|
|
817
|
-
entry.path ===
|
|
817
|
+
entry.path === normalizeCrowdyStudioPath(ref.path));
|
|
818
818
|
if (file)
|
|
819
819
|
return file;
|
|
820
820
|
}
|
|
@@ -848,7 +848,7 @@ export class ModStudioController {
|
|
|
848
848
|
}
|
|
849
849
|
ensureAlive() {
|
|
850
850
|
if (this.destroyed)
|
|
851
|
-
throw new Error('
|
|
851
|
+
throw new Error('CrowdyStudioController is destroyed');
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
function projectFileRef(file) {
|
|
@@ -861,7 +861,7 @@ function sameFileRef(a, b) {
|
|
|
861
861
|
a.referenceId === b.referenceId);
|
|
862
862
|
}
|
|
863
863
|
function compareProjectFile(a, b) {
|
|
864
|
-
return
|
|
864
|
+
return crowdyStudioFileKey(a.target, a.path).localeCompare(crowdyStudioFileKey(b.target, b.path));
|
|
865
865
|
}
|
|
866
866
|
function moduleNameFor(project, target) {
|
|
867
867
|
const name = target === 'SERVER'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type CrowdyStudioTarget } from './models.js';
|
|
2
|
+
export type CrowdyStudioDiagnosticSeverity = 'error' | 'warning' | 'info' | 'hint';
|
|
3
|
+
export type CrowdyStudioDiagnosticSource = 'rustc' | 'local-advisory';
|
|
4
|
+
export interface CrowdyStudioDiagnostic {
|
|
5
|
+
target: CrowdyStudioTarget;
|
|
6
|
+
path: string;
|
|
7
|
+
line: number;
|
|
8
|
+
column: number;
|
|
9
|
+
endLine?: number;
|
|
10
|
+
endColumn?: number;
|
|
11
|
+
severity: CrowdyStudioDiagnosticSeverity;
|
|
12
|
+
message: string;
|
|
13
|
+
code?: string;
|
|
14
|
+
source: CrowdyStudioDiagnosticSource;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse rustc's authoritative human or JSON output. Locations are converted to
|
|
18
|
+
* one-based project paths for UI lists; Monaco adapters convert back to marker
|
|
19
|
+
* ranges. Non-location summary lines remain in the Build output, not Problems.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseRustcDiagnostics(output: string | null | undefined, defaultTarget: CrowdyStudioTarget): CrowdyStudioDiagnostic[];
|
|
22
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,8BAA8B,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AACnF,MAAM,MAAM,4BAA4B,GAAG,OAAO,GAAG,gBAAgB,CAAC;AAEtE,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,8BAA8B,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,4BAA4B,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,aAAa,EAAE,kBAAkB,GAChC,sBAAsB,EAAE,CA8E1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { normalizeCrowdyStudioPath, } from './models.js';
|
|
2
2
|
/**
|
|
3
3
|
* Parse rustc's authoritative human or JSON output. Locations are converted to
|
|
4
4
|
* one-based project paths for UI lists; Monaco adapters convert back to marker
|
|
@@ -127,7 +127,7 @@ function normalizeLocation(value, defaultTarget) {
|
|
|
127
127
|
else if (path.includes('/'))
|
|
128
128
|
path = path.replace(/^.*\/(?=Cargo\.toml$)/u, '');
|
|
129
129
|
}
|
|
130
|
-
return { target, path:
|
|
130
|
+
return { target, path: normalizeCrowdyStudioPath(path) };
|
|
131
131
|
}
|
|
132
132
|
function normalizeSeverity(value) {
|
|
133
133
|
if (value === 'warning')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CrowdyStudioController, type CrowdyStudioState } from './controller.js';
|
|
2
2
|
/** Modular DOM shell; editor implementations mount into `editorHost`. */
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class CrowdyStudioDomShell {
|
|
4
4
|
private readonly controller;
|
|
5
5
|
readonly root: HTMLElement;
|
|
6
6
|
readonly editorHost: HTMLElement;
|
|
@@ -34,8 +34,8 @@ export declare class ModStudioDomShell {
|
|
|
34
34
|
private readonly panels;
|
|
35
35
|
private activePanel;
|
|
36
36
|
private disposed;
|
|
37
|
-
constructor(host: HTMLElement, controller:
|
|
38
|
-
render(state:
|
|
37
|
+
constructor(host: HTMLElement, controller: CrowdyStudioController);
|
|
38
|
+
render(state: CrowdyStudioState): void;
|
|
39
39
|
dispose(): void;
|
|
40
40
|
private createPanel;
|
|
41
41
|
private activatePanel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-shell.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/dom-shell.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AAYzB,yEAAyE;AACzE,qBAAa,oBAAoB;IAoC7B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAnC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAoB;IAClD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IACjD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAc;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAA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AAc;IAgCtB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,iBAAiB;YAgBX,GAAG;CAQlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { projectTargets, } from './models.js';
|
|
2
|
-
import {
|
|
2
|
+
import { CROWDY_STUDIO_STYLES } from './styles.js';
|
|
3
3
|
/** Modular DOM shell; editor implementations mount into `editorHost`. */
|
|
4
|
-
export class
|
|
4
|
+
export class CrowdyStudioDomShell {
|
|
5
5
|
constructor(host, controller) {
|
|
6
6
|
this.controller = controller;
|
|
7
7
|
this.panelButtons = new Map();
|
|
@@ -9,30 +9,30 @@ export class ModStudioDomShell {
|
|
|
9
9
|
this.activePanel = 'problems';
|
|
10
10
|
this.disposed = false;
|
|
11
11
|
const style = document.createElement('style');
|
|
12
|
-
style.textContent =
|
|
13
|
-
this.root = element('div', 'ck-
|
|
12
|
+
style.textContent = CROWDY_STUDIO_STYLES;
|
|
13
|
+
this.root = element('div', 'ck-crowdy-studio');
|
|
14
14
|
this.root.append(style);
|
|
15
|
-
const toolbar = element('div', 'ck-
|
|
16
|
-
const projectTools = element('div', 'ck-
|
|
15
|
+
const toolbar = element('div', 'ck-crowdy-studio-toolbar');
|
|
16
|
+
const projectTools = element('div', 'ck-crowdy-studio-project-tools');
|
|
17
17
|
this.projectSelect = document.createElement('select');
|
|
18
18
|
this.projectSelect.setAttribute('aria-label', 'Current project');
|
|
19
19
|
const newButton = button('New project');
|
|
20
|
-
this.saveBadge = element('span', 'ck-
|
|
20
|
+
this.saveBadge = element('span', 'ck-crowdy-studio-save');
|
|
21
21
|
this.saveAction = button('Retry save');
|
|
22
22
|
this.remoteAction = button('Use cloud version');
|
|
23
23
|
this.saveAction.hidden = true;
|
|
24
24
|
this.remoteAction.hidden = true;
|
|
25
25
|
projectTools.append(this.projectSelect, newButton, this.saveBadge, this.saveAction, this.remoteAction);
|
|
26
|
-
const runtimeTools = element('div', 'ck-
|
|
26
|
+
const runtimeTools = element('div', 'ck-crowdy-studio-runtime-tools');
|
|
27
27
|
this.testAction = button('Test draft');
|
|
28
28
|
this.deployAction = button('Deploy live');
|
|
29
29
|
const stop = button('Stop project');
|
|
30
|
-
this.runtimeStatus = element('span', 'ck-
|
|
31
|
-
this.budgetStatus = element('span', 'ck-
|
|
30
|
+
this.runtimeStatus = element('span', 'ck-crowdy-studio-status');
|
|
31
|
+
this.budgetStatus = element('span', 'ck-crowdy-studio-status');
|
|
32
32
|
runtimeTools.append(this.testAction, this.deployAction, stop, this.runtimeStatus, this.budgetStatus);
|
|
33
33
|
toolbar.append(projectTools, runtimeTools);
|
|
34
34
|
this.newForm = document.createElement('form');
|
|
35
|
-
this.newForm.className = 'ck-
|
|
35
|
+
this.newForm.className = 'ck-crowdy-studio-new';
|
|
36
36
|
this.newForm.dataset.open = 'false';
|
|
37
37
|
this.newName = document.createElement('input');
|
|
38
38
|
this.newName.required = true;
|
|
@@ -56,13 +56,13 @@ export class ModStudioDomShell {
|
|
|
56
56
|
const create = button('Create project', 'submit');
|
|
57
57
|
const cancel = button('Cancel');
|
|
58
58
|
this.newForm.append(this.newName, this.newKind, create, cancel);
|
|
59
|
-
const main = element('div', 'ck-
|
|
60
|
-
this.explorer = element('aside', 'ck-
|
|
61
|
-
const editorColumn = element('section', 'ck-
|
|
62
|
-
this.tabs = element('div', 'ck-
|
|
63
|
-
this.editorHost = element('div', 'ck-
|
|
59
|
+
const main = element('div', 'ck-crowdy-studio-main');
|
|
60
|
+
this.explorer = element('aside', 'ck-crowdy-studio-explorer');
|
|
61
|
+
const editorColumn = element('section', 'ck-crowdy-studio-editor-column');
|
|
62
|
+
this.tabs = element('div', 'ck-crowdy-studio-tabs');
|
|
63
|
+
this.editorHost = element('div', 'ck-crowdy-studio-editor');
|
|
64
64
|
editorColumn.append(this.tabs, this.editorHost);
|
|
65
|
-
const settings = element('aside', 'ck-
|
|
65
|
+
const settings = element('aside', 'ck-crowdy-studio-settings');
|
|
66
66
|
const settingsTitle = element('h3');
|
|
67
67
|
settingsTitle.textContent = 'Project settings';
|
|
68
68
|
this.settingsName = input('Project name');
|
|
@@ -76,8 +76,8 @@ export class ModStudioDomShell {
|
|
|
76
76
|
]);
|
|
77
77
|
settings.append(settingsTitle, labeled('Name', this.settingsName), labeled('Description', this.settingsDescription), labeled('Server module', this.serverModuleName), labeled('Client module', this.clientModuleName), labeled('Pairing', this.pairing));
|
|
78
78
|
main.append(this.explorer, editorColumn, settings);
|
|
79
|
-
const bottom = element('section', 'ck-
|
|
80
|
-
const panelTabs = element('div', 'ck-
|
|
79
|
+
const bottom = element('section', 'ck-crowdy-studio-bottom');
|
|
80
|
+
const panelTabs = element('div', 'ck-crowdy-studio-panel-tabs');
|
|
81
81
|
this.problemsPanel = this.createPanel('problems', 'Problems', panelTabs);
|
|
82
82
|
this.buildPanel = this.createPanel('build', 'Build', panelTabs);
|
|
83
83
|
this.logsPanel = this.createPanel('logs', 'Logs', panelTabs);
|
|
@@ -94,7 +94,7 @@ export class ModStudioDomShell {
|
|
|
94
94
|
this.invokeParams.setAttribute('aria-label', 'Invoke JSON parameters');
|
|
95
95
|
const invokeButton = button('Invoke server export');
|
|
96
96
|
this.invokeResult = document.createElement('pre');
|
|
97
|
-
const invokeControls = element('div', 'ck-
|
|
97
|
+
const invokeControls = element('div', 'ck-crowdy-studio-invoke');
|
|
98
98
|
invokeControls.append(this.invokeExport, this.invokeParams, invokeButton);
|
|
99
99
|
this.invokePanel.append(invokeControls, this.invokeResult);
|
|
100
100
|
this.root.append(toolbar, this.newForm, main, bottom);
|
|
@@ -188,11 +188,11 @@ export class ModStudioDomShell {
|
|
|
188
188
|
}
|
|
189
189
|
createPanel(name, label, tabs) {
|
|
190
190
|
const tab = button(label);
|
|
191
|
-
tab.className = 'ck-
|
|
191
|
+
tab.className = 'ck-crowdy-studio-panel-tab';
|
|
192
192
|
tab.addEventListener('click', () => this.activatePanel(name));
|
|
193
193
|
this.panelButtons.set(name, tab);
|
|
194
194
|
tabs.append(tab);
|
|
195
|
-
const panel = element('div', 'ck-
|
|
195
|
+
const panel = element('div', 'ck-crowdy-studio-panel');
|
|
196
196
|
panel.dataset.panel = name;
|
|
197
197
|
this.panels.set(name, panel);
|
|
198
198
|
return panel;
|
|
@@ -266,8 +266,8 @@ export class ModStudioDomShell {
|
|
|
266
266
|
this.explorer.append(this.referenceSection('Personal library', state.personalLibraryFiles), this.referenceSection('Common files', state.commonFiles));
|
|
267
267
|
}
|
|
268
268
|
projectSection(target, refs) {
|
|
269
|
-
const section = element('section', 'ck-
|
|
270
|
-
const header = element('div', 'ck-
|
|
269
|
+
const section = element('section', 'ck-crowdy-studio-section');
|
|
270
|
+
const header = element('div', 'ck-crowdy-studio-section-header');
|
|
271
271
|
const title = document.createElement('span');
|
|
272
272
|
title.textContent = `${target} files`;
|
|
273
273
|
const add = button('+ File');
|
|
@@ -289,7 +289,7 @@ export class ModStudioDomShell {
|
|
|
289
289
|
return section;
|
|
290
290
|
}
|
|
291
291
|
projectFileRow(ref) {
|
|
292
|
-
const row = element('div', 'ck-
|
|
292
|
+
const row = element('div', 'ck-crowdy-studio-file');
|
|
293
293
|
const open = button(ref.path);
|
|
294
294
|
open.title = `${ref.target}:${ref.path}`;
|
|
295
295
|
open.addEventListener('click', () => this.controller.openFile(ref));
|
|
@@ -324,8 +324,8 @@ export class ModStudioDomShell {
|
|
|
324
324
|
return row;
|
|
325
325
|
}
|
|
326
326
|
referenceSection(titleText, files) {
|
|
327
|
-
const section = element('section', 'ck-
|
|
328
|
-
const header = element('div', 'ck-
|
|
327
|
+
const section = element('section', 'ck-crowdy-studio-section');
|
|
328
|
+
const header = element('div', 'ck-crowdy-studio-section-header');
|
|
329
329
|
header.textContent = titleText;
|
|
330
330
|
section.append(header);
|
|
331
331
|
for (const file of files) {
|
|
@@ -335,7 +335,7 @@ export class ModStudioDomShell {
|
|
|
335
335
|
path: file.path,
|
|
336
336
|
referenceId: file.id,
|
|
337
337
|
};
|
|
338
|
-
const row = element('div', 'ck-
|
|
338
|
+
const row = element('div', 'ck-crowdy-studio-file');
|
|
339
339
|
const open = button(`${file.target ? `${file.target.toLowerCase()}/` : ''}${file.path}`);
|
|
340
340
|
open.addEventListener('click', () => this.controller.openFile(ref));
|
|
341
341
|
const add = button('Add');
|
|
@@ -357,7 +357,7 @@ export class ModStudioDomShell {
|
|
|
357
357
|
this.tabs.replaceChildren();
|
|
358
358
|
for (const ref of state.openFiles) {
|
|
359
359
|
const tab = button(`${ref.target ? `${ref.target.toLowerCase()}/` : ''}${ref.path}`);
|
|
360
|
-
tab.className = 'ck-
|
|
360
|
+
tab.className = 'ck-crowdy-studio-tab';
|
|
361
361
|
tab.dataset.active = String(Boolean(state.activeFile && sameRef(state.activeFile, ref)));
|
|
362
362
|
tab.addEventListener('click', () => this.controller.openFile(ref));
|
|
363
363
|
const close = document.createElement('span');
|
|
@@ -406,7 +406,7 @@ export class ModStudioDomShell {
|
|
|
406
406
|
return;
|
|
407
407
|
}
|
|
408
408
|
for (const diagnostic of diagnostics) {
|
|
409
|
-
const row = element('button', 'ck-
|
|
409
|
+
const row = element('button', 'ck-crowdy-studio-problem');
|
|
410
410
|
row.dataset.source = diagnostic.source;
|
|
411
411
|
const source = document.createElement('span');
|
|
412
412
|
source.textContent =
|
|
@@ -516,7 +516,7 @@ function select(options) {
|
|
|
516
516
|
return value;
|
|
517
517
|
}
|
|
518
518
|
function empty(message) {
|
|
519
|
-
const value = element('div', 'ck-
|
|
519
|
+
const value = element('div', 'ck-crowdy-studio-empty');
|
|
520
520
|
value.textContent = message;
|
|
521
521
|
return value;
|
|
522
522
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CrowdyStudioState } from './controller.js';
|
|
2
|
+
import type { CrowdyStudioFileRef } from './models.js';
|
|
3
|
+
export type CrowdyStudioEditorMode = 'monaco' | 'textarea';
|
|
4
|
+
/** Editor implementation used by the DOM mount. */
|
|
5
|
+
export interface CrowdyStudioEditorAdapter {
|
|
6
|
+
readonly mode: CrowdyStudioEditorMode;
|
|
7
|
+
sync(state: CrowdyStudioState): void;
|
|
8
|
+
layout(): void;
|
|
9
|
+
dispose(): void;
|
|
10
|
+
}
|
|
11
|
+
export interface CrowdyStudioEditorCallbacks {
|
|
12
|
+
onProjectFileChange(target: 'SERVER' | 'CLIENT', path: string, content: string): void;
|
|
13
|
+
onLocalDiagnostics(diagnostics: CrowdyStudioState['localDiagnostics']): void;
|
|
14
|
+
onOpenFile(ref: CrowdyStudioFileRef): void;
|
|
15
|
+
onFailure?(error: Error): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE3D,mDAAmD;AACnD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACrC,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,CACjB,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,IAAI,CAAC;IACR,kBAAkB,CAChB,WAAW,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,GACjD,IAAI,CAAC;IACR,UAAU,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC3C,SAAS,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAChC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { CrowdyStudioController, type CrowdyStudioControllerOptions, type CrowdyStudioBroker, type CrowdyStudioInvokeResult, type CrowdyStudioPhase, type CrowdyStudioPolledSurface, type CrowdyStudioRun, type CrowdyStudioRuntimeStatus, type CrowdyStudioPlayerCompute, type CrowdyStudioPlayerWallet, type CrowdyStudioState, type CrowdyStudioStopResult, type CrowdyStudioUsageSnapshot, type CrowdyStudioWalletSnapshot, } from './controller.js';
|
|
2
|
+
export { mountCrowdyStudio, type CrowdyStudioHandle, type MountCrowdyStudioOptions, } from './mount.js';
|
|
3
|
+
export { CrowdyStudioOfflineError, CrowdyStudioRevisionConflictError, cloneCrowdyStudioProject, crowdyStudioFileKey, crowdyStudioFileUri, normalizeCrowdyStudioPath, projectTargets, type CreateCrowdyStudioProjectInput, type ImportCrowdyStudioReferenceFileInput, type CrowdyStudioFileRef, type CrowdyStudioPairingPreference, type CrowdyStudioProject, type CrowdyStudioProjectFile, type CrowdyStudioProjectKind, type CrowdyStudioProjectMetadata, type CrowdyStudioProjectProvider, type CrowdyStudioProjectRevision, type CrowdyStudioProjectScope, type CrowdyStudioProjectSummary, type CrowdyStudioReferenceFile, type CrowdyStudioSaveState, type CrowdyStudioTarget, type SaveCrowdyStudioLibraryFileInput, type SaveCrowdyStudioProjectInput, } from './models.js';
|
|
4
|
+
export { createCrowdyStudioStarterProject, type CrowdyStudioNewProjectOptions, } from './starter-projects.js';
|
|
5
|
+
export { parseRustcDiagnostics, type CrowdyStudioDiagnostic, type CrowdyStudioDiagnosticSeverity, type CrowdyStudioDiagnosticSource, } from './diagnostics.js';
|
|
6
|
+
export { isCurrentDiagnosticVersion, type MonacoCrowdyStudioEditorOptions, } from './monaco-editor.js';
|
|
7
|
+
export { EMBEDDED_PLATFORM_INDEX, MAX_PLATFORM_CRATES, MAX_PLATFORM_CRATE_FIELD_LENGTH, MAX_PLATFORM_INDEX_BYTES, computePlatformIndexContentHash, loadPlatformIndex, type PlatformCrate, type PlatformIndex, type PlatformSymbol, type PlatformSymbolKind, } from '../live-coding/platform-index.js';
|
|
8
|
+
export { DEFAULT_VFS_LIMITS, VfsLimitError, VirtualFileSystem, offsetAt, type VirtualDocument, type VirtualFileSystemLimits, } from '../live-coding/vfs.js';
|
|
9
|
+
export { WorkerLanguageClient, WorkerMessageReader, WorkerMessageWriter, createDefaultRustLanguageWorker, type LanguageWorkerLike, type WorkerLanguageClientOptions, } from '../live-coding/worker-transport.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,EAClC,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,GAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,wBAAwB,EACxB,iCAAiC,EACjC,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,cAAc,EACd,KAAK,8BAA8B,EACnC,KAAK,oCAAoC,EACzC,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,GAClC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gCAAgC,EAChC,KAAK,6BAA6B,GACnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,KAAK,+BAA+B,GACrC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,+BAA+B,EAC/B,wBAAwB,EACxB,+BAA+B,EAC/B,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,GACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,KAAK,eAAe,EACpB,KAAK,uBAAuB,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,+BAA+B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,GACjC,MAAM,oCAAoC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { CrowdyStudioController, } from './controller.js';
|
|
2
|
+
export { mountCrowdyStudio, } from './mount.js';
|
|
3
|
+
export { CrowdyStudioOfflineError, CrowdyStudioRevisionConflictError, cloneCrowdyStudioProject, crowdyStudioFileKey, crowdyStudioFileUri, normalizeCrowdyStudioPath, projectTargets, } from './models.js';
|
|
4
|
+
export { createCrowdyStudioStarterProject, } from './starter-projects.js';
|
|
5
5
|
export { parseRustcDiagnostics, } from './diagnostics.js';
|
|
6
6
|
export { isCurrentDiagnosticVersion, } from './monaco-editor.js';
|
|
7
7
|
export { EMBEDDED_PLATFORM_INDEX, MAX_PLATFORM_CRATES, MAX_PLATFORM_CRATE_FIELD_LENGTH, MAX_PLATFORM_INDEX_BYTES, computePlatformIndexContentHash, loadPlatformIndex, } from '../live-coding/platform-index.js';
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/** Compile targets supported by player-authored projects. */
|
|
2
|
+
export type CrowdyStudioTarget = 'SERVER' | 'CLIENT';
|
|
3
|
+
/** The target layout selected when a project is created. */
|
|
4
|
+
export type CrowdyStudioProjectKind = 'SERVER' | 'CLIENT' | 'FULL_STACK';
|
|
5
|
+
/**
|
|
6
|
+
* Whether a full-stack server should advertise its client companion.
|
|
7
|
+
* `OPTIONAL` records author intent without creating a runtime requirement;
|
|
8
|
+
* `REQUIRED` is applied with `playerCompute.setRequires` after both targets
|
|
9
|
+
* compile successfully.
|
|
10
|
+
*/
|
|
11
|
+
export type CrowdyStudioPairingPreference = 'NONE' | 'OPTIONAL' | 'REQUIRED';
|
|
12
|
+
/** A source file in one project target. Paths are relative to that target. */
|
|
13
|
+
export interface CrowdyStudioProjectFile {
|
|
14
|
+
target: CrowdyStudioTarget;
|
|
15
|
+
path: string;
|
|
16
|
+
content: string;
|
|
17
|
+
}
|
|
18
|
+
/** A read-only source file made available to the browser language worker. */
|
|
19
|
+
export interface CrowdyStudioReferenceFile {
|
|
20
|
+
id: string;
|
|
21
|
+
source: 'PERSONAL_LIBRARY' | 'COMMON';
|
|
22
|
+
title: string;
|
|
23
|
+
/** Optional target fence. Omitted files are useful from either target. */
|
|
24
|
+
target?: CrowdyStudioTarget;
|
|
25
|
+
path: string;
|
|
26
|
+
content: string;
|
|
27
|
+
tags?: string[];
|
|
28
|
+
updatedAt?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface CrowdyStudioProjectMetadata {
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
serverModuleName?: string;
|
|
34
|
+
clientModuleName?: string;
|
|
35
|
+
pairingPreference: CrowdyStudioPairingPreference;
|
|
36
|
+
}
|
|
37
|
+
/** Immutable revision identity returned by the cloud project service. */
|
|
38
|
+
export interface CrowdyStudioProjectRevision {
|
|
39
|
+
id: string;
|
|
40
|
+
savedAt: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* One atomic cloud project snapshot. SERVER and CLIENT files intentionally
|
|
44
|
+
* share a project revision so a full-stack save cannot persist half a pair.
|
|
45
|
+
*/
|
|
46
|
+
export interface CrowdyStudioProject {
|
|
47
|
+
projectId: string;
|
|
48
|
+
appId: string;
|
|
49
|
+
gridId: string;
|
|
50
|
+
kind: CrowdyStudioProjectKind;
|
|
51
|
+
metadata: CrowdyStudioProjectMetadata;
|
|
52
|
+
files: CrowdyStudioProjectFile[];
|
|
53
|
+
sdkVersion: string;
|
|
54
|
+
abiVersion: number;
|
|
55
|
+
revision: CrowdyStudioProjectRevision;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
}
|
|
59
|
+
export interface CrowdyStudioProjectSummary {
|
|
60
|
+
projectId: string;
|
|
61
|
+
name: string;
|
|
62
|
+
kind: CrowdyStudioProjectKind;
|
|
63
|
+
revisionId: string;
|
|
64
|
+
serverModuleName?: string;
|
|
65
|
+
clientModuleName?: string;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
}
|
|
68
|
+
/** Explicit persistence state rendered by Crowdy Studio. */
|
|
69
|
+
export type CrowdyStudioSaveState = 'SAVING' | 'SAVED' | 'CONFLICT' | 'OFFLINE';
|
|
70
|
+
export interface CrowdyStudioFileRef {
|
|
71
|
+
source: 'PROJECT' | 'PERSONAL_LIBRARY' | 'COMMON';
|
|
72
|
+
target?: CrowdyStudioTarget;
|
|
73
|
+
path: string;
|
|
74
|
+
referenceId?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface CreateCrowdyStudioProjectInput {
|
|
77
|
+
appId: string;
|
|
78
|
+
gridId: string;
|
|
79
|
+
kind: CrowdyStudioProjectKind;
|
|
80
|
+
metadata: CrowdyStudioProjectMetadata;
|
|
81
|
+
files: CrowdyStudioProjectFile[];
|
|
82
|
+
}
|
|
83
|
+
export interface SaveCrowdyStudioProjectInput {
|
|
84
|
+
appId: string;
|
|
85
|
+
gridId: string;
|
|
86
|
+
projectId: string;
|
|
87
|
+
/** Optimistic-concurrency precondition for the atomic project write. */
|
|
88
|
+
expectedRevisionId: string;
|
|
89
|
+
metadata: CrowdyStudioProjectMetadata;
|
|
90
|
+
files: CrowdyStudioProjectFile[];
|
|
91
|
+
}
|
|
92
|
+
export interface CrowdyStudioProjectScope {
|
|
93
|
+
appId: string;
|
|
94
|
+
gridId: string;
|
|
95
|
+
}
|
|
96
|
+
export interface ImportCrowdyStudioReferenceFileInput extends CrowdyStudioProjectScope {
|
|
97
|
+
projectId: string;
|
|
98
|
+
expectedRevisionId: string;
|
|
99
|
+
source: 'PERSONAL_LIBRARY' | 'COMMON';
|
|
100
|
+
referenceId: string;
|
|
101
|
+
destinationPath?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface SaveCrowdyStudioLibraryFileInput extends CrowdyStudioProjectScope {
|
|
104
|
+
title: string;
|
|
105
|
+
target: CrowdyStudioTarget;
|
|
106
|
+
path: string;
|
|
107
|
+
content: string;
|
|
108
|
+
tags?: string[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Storage contract consumed by Crowdy Studio. It deliberately has no generated
|
|
112
|
+
* GraphQL types, JSON source maps, or transport-specific errors.
|
|
113
|
+
*/
|
|
114
|
+
export interface CrowdyStudioProjectProvider {
|
|
115
|
+
listProjects(scope: CrowdyStudioProjectScope): Promise<CrowdyStudioProjectSummary[]>;
|
|
116
|
+
getProject(scope: CrowdyStudioProjectScope & {
|
|
117
|
+
projectId: string;
|
|
118
|
+
}): Promise<CrowdyStudioProject>;
|
|
119
|
+
createProject(input: CreateCrowdyStudioProjectInput): Promise<CrowdyStudioProject>;
|
|
120
|
+
saveProject(input: SaveCrowdyStudioProjectInput): Promise<CrowdyStudioProject>;
|
|
121
|
+
listPersonalLibraryFiles(scope: CrowdyStudioProjectScope): Promise<CrowdyStudioReferenceFile[]>;
|
|
122
|
+
listCommonFiles(scope: CrowdyStudioProjectScope): Promise<CrowdyStudioReferenceFile[]>;
|
|
123
|
+
importReferenceFile(input: ImportCrowdyStudioReferenceFileInput): Promise<CrowdyStudioProject>;
|
|
124
|
+
savePersonalLibraryFile(input: SaveCrowdyStudioLibraryFileInput): Promise<CrowdyStudioReferenceFile>;
|
|
125
|
+
}
|
|
126
|
+
/** Provider error indicating that the expected revision lost a save race. */
|
|
127
|
+
export declare class CrowdyStudioRevisionConflictError extends Error {
|
|
128
|
+
readonly remoteProject?: CrowdyStudioProject | undefined;
|
|
129
|
+
readonly code = "PROJECT_REVISION_CONFLICT";
|
|
130
|
+
constructor(message?: string, remoteProject?: CrowdyStudioProject | undefined);
|
|
131
|
+
}
|
|
132
|
+
/** Provider error indicating that the write should be retried when online. */
|
|
133
|
+
export declare class CrowdyStudioOfflineError extends Error {
|
|
134
|
+
readonly code = "PROJECT_OFFLINE";
|
|
135
|
+
readonly cause?: unknown;
|
|
136
|
+
constructor(message?: string, cause?: unknown);
|
|
137
|
+
}
|
|
138
|
+
/** Validate and normalize a target-relative project path. */
|
|
139
|
+
export declare function normalizeCrowdyStudioPath(path: string): string;
|
|
140
|
+
/** Stable key for maps, tabs, diagnostics, and tests. */
|
|
141
|
+
export declare function crowdyStudioFileKey(target: CrowdyStudioTarget, path: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* Target-prefixed URI used by Monaco and the browser VFS. Both targets can
|
|
144
|
+
* therefore load `Cargo.toml` and `src/lib.rs` at the same time.
|
|
145
|
+
*/
|
|
146
|
+
export declare function crowdyStudioFileUri(workspaceUri: string, target: CrowdyStudioTarget, path: string): string;
|
|
147
|
+
export declare function projectTargets(kind: CrowdyStudioProjectKind): CrowdyStudioTarget[];
|
|
148
|
+
export declare function cloneCrowdyStudioProject(project: CrowdyStudioProject): CrowdyStudioProject;
|
|
149
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/models.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD,4DAA4D;AAC5D,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE7E,8EAA8E;AAC9E,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,kBAAkB,GAAG,QAAQ,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,6BAA6B,CAAC;CAClD;AAED,yEAAyE;AACzE,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,C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