castle-web-cli 0.4.188 → 0.4.190
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/agent-prompts.js +4 -2
- package/dist/agent.js +30 -12
- package/dist/castleJson.d.ts +1 -0
- package/dist/castleJson.js +6 -0
- package/dist/forks.js +5 -3
- package/dist/ide.js +9 -2
- package/dist/imports.d.ts +8 -2
- package/dist/imports.js +67 -7
- package/dist/init.js +12 -2
- package/dist/shell/assets/index-Bo8dx2Ps.js +449 -0
- package/dist/shell/assets/index-DrFIFZVh.css +1 -0
- package/dist/shell/index.html +2 -2
- package/kits/physics-2d/castle.json +1 -1
- package/kits/physics-2d/editors/PxArtEditor.jsx +6 -28
- package/kits/physics-2d/editors/SceneEditor.jsx +16 -67
- package/kits/physics-2d/editors/editorHistory.js +27 -0
- package/kits/physics-2d/editors/pixelEditorChrome.jsx +7 -19
- package/kits/physics-2d/engine/icons.js +0 -2
- package/kits/physics-2d/eslint.config.js +1 -1
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/engine3d/PxModelEditor.jsx +2 -2
- package/kits/physics-3d/engine3d/Scene3DEditor.jsx +2 -2
- package/kits/physics-3d/engine3d/editorChrome.jsx +23 -51
- package/package.json +2 -2
- package/dist/shell/assets/index-BHS1yecn.js +0 -449
- package/dist/shell/assets/index-BaqrGZkv.css +0 -1
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
styles,
|
|
18
18
|
useMobileSheet,
|
|
19
19
|
} from '@imports/castle.physics-2d/engine/ui';
|
|
20
|
-
import { useEditHistory } from '@imports/castle.physics-2d/editors/editorHistory';
|
|
20
|
+
import { useEditHistory, useHostUndoRedo } from '@imports/castle.physics-2d/editors/editorHistory';
|
|
21
21
|
import { useLiveDeckFiles3D, useStableSprites, fetchMissingFile } from './modelFiles';
|
|
22
22
|
import { parseModelCached, parseModel, serializeModel, STARTER_MODEL_TEXT } from './pxmodel';
|
|
23
23
|
import { boxMesh, extrudeFace, roundMeshInPlace } from './meshops';
|
|
@@ -236,6 +236,7 @@ export function PxModelEditor({ path }) {
|
|
|
236
236
|
};
|
|
237
237
|
|
|
238
238
|
const readOnly = useReadOnlyFile(path);
|
|
239
|
+
useHostUndoRedo(history, { enabled: !readOnly });
|
|
239
240
|
useEditorShortcuts({
|
|
240
241
|
history,
|
|
241
242
|
setMode,
|
|
@@ -350,7 +351,6 @@ export function PxModelEditor({ path }) {
|
|
|
350
351
|
<div className={styles.stageWrap} style={{ padding: 0, position: 'relative' }}>
|
|
351
352
|
<StageCanvas ref={canvasRef} />
|
|
352
353
|
<StageControls
|
|
353
|
-
history={history}
|
|
354
354
|
mode={mode}
|
|
355
355
|
setMode={setMode}
|
|
356
356
|
readOnly={readOnly}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
behaviorClasses,
|
|
13
13
|
findBehaviorClass,
|
|
14
14
|
} from '@imports/castle.physics-2d/editors/behaviorRegistry';
|
|
15
|
-
import { useEditHistory } from '@imports/castle.physics-2d/editors/editorHistory';
|
|
15
|
+
import { useEditHistory, useHostUndoRedo } from '@imports/castle.physics-2d/editors/editorHistory';
|
|
16
16
|
import { BlueprintLibrary } from '@imports/castle.physics-2d/editors/BlueprintLibrary';
|
|
17
17
|
import {
|
|
18
18
|
EditorBody,
|
|
@@ -87,6 +87,7 @@ export function Scene3DEditor({ path }) {
|
|
|
87
87
|
saver.schedule(filePath, nextText);
|
|
88
88
|
};
|
|
89
89
|
const history = useEditHistory(text, onChangeText, path);
|
|
90
|
+
useHostUndoRedo(history, { enabled: !readOnly });
|
|
90
91
|
const isBlueprintFile = isBlueprintPath(path);
|
|
91
92
|
|
|
92
93
|
const [selectedActorIds, setSelectedActorIdsRaw] = useState(stash?.selectedActorIds ?? []);
|
|
@@ -355,7 +356,6 @@ export function Scene3DEditor({ path }) {
|
|
|
355
356
|
<div className={styles.stageWrap} style={{ padding: 0, position: 'relative' }}>
|
|
356
357
|
<StageCanvas ref={canvasRef} />
|
|
357
358
|
<StageControls
|
|
358
|
-
history={history}
|
|
359
359
|
mode={mode}
|
|
360
360
|
setMode={setMode}
|
|
361
361
|
readOnly={readOnly}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Chrome shared by the kit's editors (scene + model): the debounced file
|
|
2
|
-
// saver, the stage canvas, the
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// saver, the stage canvas, the mode/action button overlays, and the common
|
|
3
|
+
// keyboard shortcuts. One place so the editors stay in the same design
|
|
4
|
+
// system by construction.
|
|
5
5
|
import React, { forwardRef, useEffect, useRef } from 'react';
|
|
6
6
|
import { isImportedFile, onBeforeRestart, writeFile } from 'castle-web-sdk';
|
|
7
7
|
import { useForkedPaths } from '@imports/castle.physics-2d/editors/SingleEditor';
|
|
@@ -60,15 +60,6 @@ export function HotbarButton({ icon, glyph, label, ...props }) {
|
|
|
60
60
|
// Stage tool buttons run a bit bigger than the default IconButton.
|
|
61
61
|
export const TOOL_BUTTON_STYLE = { width: 40, height: 40, fontSize: 17 };
|
|
62
62
|
|
|
63
|
-
const UNDO_STYLE = {
|
|
64
|
-
position: 'absolute',
|
|
65
|
-
left: 10,
|
|
66
|
-
top: 10,
|
|
67
|
-
display: 'flex',
|
|
68
|
-
flexDirection: 'row',
|
|
69
|
-
gap: 6,
|
|
70
|
-
zIndex: 5,
|
|
71
|
-
};
|
|
72
63
|
const MODE_STYLE = {
|
|
73
64
|
position: 'absolute',
|
|
74
65
|
right: 8,
|
|
@@ -205,10 +196,9 @@ export const StageCanvas = forwardRef(function StageCanvas(props, ref) {
|
|
|
205
196
|
);
|
|
206
197
|
});
|
|
207
198
|
|
|
208
|
-
//
|
|
209
|
-
//
|
|
199
|
+
// Select/move/rotate (plus duplicate/delete when handlers are given) down
|
|
200
|
+
// the right edge. Undo/redo live on the host chrome.
|
|
210
201
|
export function StageControls({
|
|
211
|
-
history,
|
|
212
202
|
mode,
|
|
213
203
|
setMode,
|
|
214
204
|
onDuplicate,
|
|
@@ -230,47 +220,29 @@ export function StageControls({
|
|
|
230
220
|
return <div style={MODE_STYLE}>{modeButton('select', 'marquee', 'Select (1)')}</div>;
|
|
231
221
|
}
|
|
232
222
|
return (
|
|
233
|
-
|
|
234
|
-
|
|
223
|
+
<div style={MODE_STYLE}>
|
|
224
|
+
{modeButton('select', 'marquee', 'Select (1)')}
|
|
225
|
+
{modeButton('move', 'move', 'Move (2)')}
|
|
226
|
+
{modeButton('rotate', 'rotate', 'Rotate (3)')}
|
|
227
|
+
{onDuplicate || onDelete ? <div style={{ height: 8 }} /> : null}
|
|
228
|
+
{onDuplicate ? (
|
|
235
229
|
<IconButton
|
|
236
|
-
icon="
|
|
237
|
-
label="
|
|
230
|
+
icon="clone"
|
|
231
|
+
label="Duplicate"
|
|
238
232
|
style={TOOL_BUTTON_STYLE}
|
|
239
|
-
|
|
240
|
-
|
|
233
|
+
disabled={actionsDisabled}
|
|
234
|
+
onClick={onDuplicate}
|
|
241
235
|
/>
|
|
236
|
+
) : null}
|
|
237
|
+
{onDelete ? (
|
|
242
238
|
<IconButton
|
|
243
|
-
icon="
|
|
244
|
-
label="
|
|
239
|
+
icon="trash"
|
|
240
|
+
label="Delete"
|
|
245
241
|
style={TOOL_BUTTON_STYLE}
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
disabled={actionsDisabled}
|
|
243
|
+
onClick={onDelete}
|
|
248
244
|
/>
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
{modeButton('select', 'marquee', 'Select (1)')}
|
|
252
|
-
{modeButton('move', 'move', 'Move (2)')}
|
|
253
|
-
{modeButton('rotate', 'rotate', 'Rotate (3)')}
|
|
254
|
-
{onDuplicate || onDelete ? <div style={{ height: 8 }} /> : null}
|
|
255
|
-
{onDuplicate ? (
|
|
256
|
-
<IconButton
|
|
257
|
-
icon="clone"
|
|
258
|
-
label="Duplicate"
|
|
259
|
-
style={TOOL_BUTTON_STYLE}
|
|
260
|
-
disabled={actionsDisabled}
|
|
261
|
-
onClick={onDuplicate}
|
|
262
|
-
/>
|
|
263
|
-
) : null}
|
|
264
|
-
{onDelete ? (
|
|
265
|
-
<IconButton
|
|
266
|
-
icon="trash"
|
|
267
|
-
label="Delete"
|
|
268
|
-
style={TOOL_BUTTON_STYLE}
|
|
269
|
-
disabled={actionsDisabled}
|
|
270
|
-
onClick={onDelete}
|
|
271
|
-
/>
|
|
272
|
-
) : null}
|
|
273
|
-
</div>
|
|
274
|
-
</>
|
|
245
|
+
) : null}
|
|
246
|
+
</div>
|
|
275
247
|
);
|
|
276
248
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "castle-web-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.190",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/castle-xyz/castle-experimental-web.git"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "rm -rf dist && tsc && chmod +x dist/index.js && vite build && cp -R src/castle-host dist/castle-host && chmod -R u+w kits 2>/dev/null; rm -rf kits && cp -R ../kits kits && chmod -R u+w kits && rm -rf kits/*/imports",
|
|
14
14
|
"dev": "tsc --watch",
|
|
15
|
-
"check": "node ../scripts/sync-shared.mjs --check && node ../scripts/tests/icon-registry.mjs && node ../scripts/tests/sandbox-graphql-fields.mjs && eslint . && jscpd && tsc --noEmit && tsc --noEmit -p src/shell/tsconfig.json"
|
|
15
|
+
"check": "node ../scripts/sync-shared.mjs --check && node ../scripts/tests/icon-registry.mjs && node ../scripts/tests/sandbox-graphql-fields.mjs && node ../scripts/tests/kit-package-json.mjs && eslint . && jscpd && tsc --noEmit && tsc --noEmit -p src/shell/tsconfig.json"
|
|
16
16
|
},
|
|
17
17
|
"jscpd": {
|
|
18
18
|
"path": [
|