castle-web-cli 0.4.68 → 0.4.70
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/ide.d.ts +0 -1
- package/dist/ide.js +0 -10
- package/dist/serve.js +2 -2
- package/kits/basic-2d/editors/SingleEditor.jsx +2 -9
- package/kits/basic-2d/engine/ui.module.css +30 -0
- package/package.json +1 -1
package/dist/ide.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Duplex } from "stream";
|
|
|
3
3
|
import { type RawData } from "ws";
|
|
4
4
|
export declare const IDE_ASSET_PREFIX = "/__castle/ide/";
|
|
5
5
|
export declare const PTY_WS_PATH = "/__castle/pty";
|
|
6
|
-
export declare const DECK_FOCUS_SCRIPT: string;
|
|
7
6
|
export declare function rawDataToString(data: RawData): string;
|
|
8
7
|
export interface IdeServer {
|
|
9
8
|
/** Serve the IDE page + its static assets. Returns true if it handled the request. */
|
package/dist/ide.js
CHANGED
|
@@ -62,16 +62,6 @@ function serveShellFile(res, asset) {
|
|
|
62
62
|
// upgrade handler on Vite's HTTP server).
|
|
63
63
|
export const IDE_ASSET_PREFIX = "/__castle/ide/";
|
|
64
64
|
export const PTY_WS_PATH = "/__castle/pty";
|
|
65
|
-
// Injected into every served deck's <head>. When the deck runs embedded in
|
|
66
|
-
// the IDE shell iframe, Ctrl+T moves keyboard focus out to the panel (the
|
|
67
|
-
// chat input or the terminal, whichever view is active) -- but while the
|
|
68
|
-
// iframe holds focus the parent sees no keydowns, so the deck page has to
|
|
69
|
-
// forward Ctrl+T itself. No-op for a standalone deck.
|
|
70
|
-
export const DECK_FOCUS_SCRIPT = `<script>(function(){if(window.parent===window)return;` +
|
|
71
|
-
`document.addEventListener('keydown',function(e){` +
|
|
72
|
-
`if(e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey&&(e.key==='t'||e.key==='T')){` +
|
|
73
|
-
`e.preventDefault();try{parent.postMessage({type:'castle-ide-toggle-focus'},'*');}catch(_){}}` +
|
|
74
|
-
`},true);})();</script>`;
|
|
75
65
|
function defaultShell() {
|
|
76
66
|
if (process.platform === "win32") {
|
|
77
67
|
return { command: process.env.COMSPEC ?? "cmd.exe", args: [] };
|
package/dist/serve.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as path from 'path';
|
|
|
4
4
|
import { spawn } from 'child_process';
|
|
5
5
|
import { createServer } from 'vite';
|
|
6
6
|
import { WebSocketServer, WebSocket } from 'ws';
|
|
7
|
-
import { createIdeServer
|
|
7
|
+
import { createIdeServer } from './ide.js';
|
|
8
8
|
import { createAgentServer } from './agent.js';
|
|
9
9
|
import { sceneFilesPlugin } from './vitePlugins.js';
|
|
10
10
|
import * as config from './config.js';
|
|
@@ -31,7 +31,7 @@ function castlePlugin(wsPort, ideServer, agentServer) {
|
|
|
31
31
|
transformIndexHtml: {
|
|
32
32
|
order: 'pre',
|
|
33
33
|
handler(html) {
|
|
34
|
-
return html.replace(/<head(\s[^>]*)?>/i, (match) => `${match}\n <script>window.CastleEmbed={edit:true,host:'dev'};</script
|
|
34
|
+
return html.replace(/<head(\s[^>]*)?>/i, (match) => `${match}\n <script>window.CastleEmbed={edit:true,host:'dev'};</script>`);
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
configureServer(server) {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import React, { useEffect, useRef, useState } from 'react';
|
|
9
9
|
import { onBeforeRestart, writeFile } from 'castle-web-sdk';
|
|
10
10
|
import { formatJson, getFileKind, initialFiles, parseJsonFile } from '../engine/files';
|
|
11
|
-
import { MainEditor } from '../engine/ui';
|
|
11
|
+
import { MainEditor, styles } from '../engine/ui';
|
|
12
12
|
import { CodeEditor } from './CodeEditor';
|
|
13
13
|
import { DrawingEditor } from './DrawingEditor';
|
|
14
14
|
import { FileTree } from './FileBrowser';
|
|
@@ -100,14 +100,7 @@ export function SingleEditor({ path, editor }) {
|
|
|
100
100
|
body = <CodeEditor path={path} text={text} onChange={onChange} bare />;
|
|
101
101
|
}
|
|
102
102
|
return (
|
|
103
|
-
<div
|
|
104
|
-
style={{
|
|
105
|
-
display: 'grid',
|
|
106
|
-
gridTemplateColumns: '1fr',
|
|
107
|
-
width: '100vw',
|
|
108
|
-
height: '100vh',
|
|
109
|
-
background: 'var(--castle-workspace-bg)',
|
|
110
|
-
}}>
|
|
103
|
+
<div className={styles.panelBare}>
|
|
111
104
|
<MainEditor>{body}</MainEditor>
|
|
112
105
|
</div>
|
|
113
106
|
);
|
|
@@ -935,3 +935,33 @@
|
|
|
935
935
|
word-break: break-all;
|
|
936
936
|
}
|
|
937
937
|
}
|
|
938
|
+
|
|
939
|
+
/* Bare (panel) editor wrapper: fills the panel iframe; single column. */
|
|
940
|
+
.panelBare {
|
|
941
|
+
display: grid;
|
|
942
|
+
grid-template-columns: 1fr;
|
|
943
|
+
width: 100vw;
|
|
944
|
+
height: 100vh;
|
|
945
|
+
background: var(--castle-workspace-bg);
|
|
946
|
+
}
|
|
947
|
+
/* In a panel the editor toolbar (play / undo / add) must stay visible even
|
|
948
|
+
below 860px -- it normally moves into the mobile header, which bare mode
|
|
949
|
+
removes. Keep it; the inspector still drops below at narrow widths. */
|
|
950
|
+
@media (max-width: 860px) {
|
|
951
|
+
/* restore the 48px tools row the narrow layout drops, show the toolbar, and
|
|
952
|
+
put the stage back in row 2 (the narrow layout moves it up into row 1). */
|
|
953
|
+
.panelBare .sceneWorkspace,
|
|
954
|
+
.panelBare .drawingEditor {
|
|
955
|
+
grid-template-rows: 48px minmax(0, 1fr);
|
|
956
|
+
}
|
|
957
|
+
.panelBare .sceneTools {
|
|
958
|
+
display: grid;
|
|
959
|
+
}
|
|
960
|
+
.panelBare .drawingTools {
|
|
961
|
+
display: flex;
|
|
962
|
+
}
|
|
963
|
+
.panelBare .stageWrap,
|
|
964
|
+
.panelBare .drawingCanvasWrap {
|
|
965
|
+
grid-row: 2;
|
|
966
|
+
}
|
|
967
|
+
}
|